Whamcloud - gitweb
LU-7623 lov: Get rid of an ugly statfs hack in lov_iocontrol
[fs/lustre-release.git] / lustre / lov / lov_obd.c
index 7a654f0..7c00acf 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #define DEBUG_SUBSYSTEM S_LOV
 #include <libcfs/libcfs.h>
 
-#include <obd_support.h>
-#include <lustre_ioctl.h>
-#include <lustre_lib.h>
-#include <lustre_net.h>
 #include <lustre/lustre_idl.h>
+
+#include <cl_object.h>
 #include <lustre_dlm.h>
+#include <lustre_fid.h>
+#include <lustre_ioctl.h>
+#include <lustre_lib.h>
 #include <lustre_mds.h>
-#include <obd_class.h>
-#include <lprocfs_status.h>
+#include <lustre_net.h>
 #include <lustre_param.h>
-#include <cl_object.h>
-#include <lustre_fid.h>
+#include <lustre_swab.h>
+#include <lprocfs_status.h>
+#include <obd_class.h>
+#include <obd_support.h>
 
 #include "lov_internal.h"
 
@@ -881,31 +883,6 @@ out:
        return rc;
 }
 
-static int lov_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
-{
-        int rc = 0;
-        struct lov_obd *lov = &obd->u.lov;
-
-        ENTRY;
-
-        switch (stage) {
-        case OBD_CLEANUP_EARLY: {
-                int i;
-                for (i = 0; i < lov->desc.ld_tgt_count; i++) {
-                        if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active)
-                                continue;
-                        obd_precleanup(class_exp2obd(lov->lov_tgts[i]->ltd_exp),
-                                       OBD_CLEANUP_EARLY);
-                }
-                break;
-       }
-       default:
-               break;
-       }
-
-       RETURN(rc);
-}
-
 static int lov_cleanup(struct obd_device *obd)
 {
         struct lov_obd *lov = &obd->u.lov;
@@ -1119,7 +1096,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 __u32 index;
                __u32 flags;
 
-                memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
+                memcpy(&index, data->ioc_inlbuf2, sizeof(index));
                 if ((index >= count))
                         RETURN(-ENODEV);
 
@@ -1139,7 +1116,9 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                                       sizeof(struct obd_uuid))))
                        RETURN(-EFAULT);
 
-               flags = uarg ? *(__u32 __user *)uarg : 0;
+               memcpy(&flags, data->ioc_inlbuf1, sizeof(flags));
+               flags = flags & LL_STATFS_NODELAY ? OBD_STATFS_NODELAY : 0;
+
                 /* got statfs data */
                 rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
                                 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
@@ -1463,13 +1442,11 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
 static struct obd_ops lov_obd_ops = {
        .o_owner                = THIS_MODULE,
        .o_setup                = lov_setup,
-       .o_precleanup           = lov_precleanup,
        .o_cleanup              = lov_cleanup,
        .o_connect              = lov_connect,
        .o_disconnect           = lov_disconnect,
        .o_statfs               = lov_statfs,
        .o_statfs_async         = lov_statfs_async,
-       .o_unpackmd             = lov_unpackmd,
        .o_iocontrol            = lov_iocontrol,
        .o_get_info             = lov_get_info,
        .o_set_info_async       = lov_set_info_async,
@@ -1524,15 +1501,15 @@ static int __init lov_init(void)
         RETURN(rc);
 }
 
-static void /*__exit*/ lov_exit(void)
+static void __exit lov_exit(void)
 {
        class_unregister_type(LUSTRE_LOV_NAME);
        kmem_cache_destroy(lov_oinfo_slab);
        lu_kmem_fini(lov_caches);
 }
 
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre Logical Object Volume OBD driver");
+MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
+MODULE_DESCRIPTION("Lustre Logical Object Volume");
 MODULE_VERSION(LUSTRE_VERSION_STRING);
 MODULE_LICENSE("GPL");