Whamcloud - gitweb
LU-17744 ldiskfs: mballoc stats fixes
[fs/lustre-release.git] / lustre / osc / osc_dev.c
index cbddab5..7cd8bd1 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * Implementation of cl_device, for OSC layer.
  *
@@ -39,6 +38,7 @@
 /* class_name2obd() */
 #include <obd_class.h>
 #include <lustre_osc.h>
+#include <uapi/linux/lustre/lustre_param.h>
 
 #include "osc_internal.h"
 
@@ -54,7 +54,6 @@ EXPORT_SYMBOL(osc_object_kmem);
 struct kmem_cache *osc_thread_kmem;
 struct kmem_cache *osc_session_kmem;
 struct kmem_cache *osc_extent_kmem;
-struct kmem_cache *osc_quota_kmem;
 struct kmem_cache *osc_obdo_kmem;
 
 struct lu_kmem_descr osc_caches[] = {
@@ -84,11 +83,6 @@ struct lu_kmem_descr osc_caches[] = {
                .ckd_size  = sizeof (struct osc_extent)
        },
        {
-               .ckd_cache = &osc_quota_kmem,
-               .ckd_name  = "osc_quota_kmem",
-               .ckd_size  = sizeof(struct osc_quota_info)
-       },
-       {
                .ckd_cache = &osc_obdo_kmem,
                .ckd_name  = "osc_obdo_kmem",
                .ckd_size  = sizeof(struct obdo)
@@ -159,16 +153,17 @@ EXPORT_SYMBOL(osc_session_key);
 /* type constructor/destructor: osc_type_{init,fini,start,stop}(). */
 LU_TYPE_INIT_FINI(osc, &osc_key, &osc_session_key);
 
-static int osc_cl_process_config(const struct lu_env *env,
-                                 struct lu_device *d, struct lustre_cfg *cfg)
+static int osc_process_config(const struct lu_env *env, struct lu_device *d,
+                             struct lustre_cfg *cfg)
 {
-        ENTRY;
-        RETURN(osc_process_config_base(d->ld_obd, cfg));
+       ssize_t count  = class_modify_config(cfg, PARAM_OSC,
+                                            &d->ld_obd->obd_kset.kobj);
+       return count > 0 ? 0 : count;
 }
 
 static const struct lu_device_operations osc_lu_ops = {
         .ldo_object_alloc      = osc_object_alloc,
-        .ldo_process_config    = osc_cl_process_config,
+       .ldo_process_config    = osc_process_config,
         .ldo_recovery_complete = NULL
 };
 
@@ -189,41 +184,42 @@ EXPORT_SYMBOL(osc_device_fini);
 struct lu_device *osc_device_free(const struct lu_env *env,
                                  struct lu_device *d)
 {
-       struct osc_device *od = lu2osc_dev(d);
+       struct osc_device *oc = lu2osc_dev(d);
 
        cl_device_fini(lu2cl_dev(d));
-       OBD_FREE_PTR(od);
+       OBD_FREE_PTR(oc);
        return NULL;
 }
 EXPORT_SYMBOL(osc_device_free);
 
 static struct lu_device *osc_device_alloc(const struct lu_env *env,
-                                          struct lu_device_type *t,
-                                          struct lustre_cfg *cfg)
+                                         struct lu_device_type *t,
+                                         struct lustre_cfg *cfg)
 {
-        struct lu_device *d;
-        struct osc_device *od;
-        struct obd_device *obd;
-        int rc;
-
-        OBD_ALLOC_PTR(od);
-        if (od == NULL)
-                RETURN(ERR_PTR(-ENOMEM));
-
-        cl_device_init(&od->od_cl, t);
-        d = osc2lu_dev(od);
-        d->ld_ops = &osc_lu_ops;
-
-        /* Setup OSC OBD */
-        obd = class_name2obd(lustre_cfg_string(cfg, 0));
-        LASSERT(obd != NULL);
-        rc = osc_setup(obd, cfg);
-        if (rc) {
-                osc_device_free(env, d);
-                RETURN(ERR_PTR(rc));
-        }
-        od->od_exp = obd->obd_self_export;
-        RETURN(d);
+       struct lu_device *d;
+       struct osc_device *osc;
+       struct obd_device *obd;
+       int rc;
+
+       OBD_ALLOC_PTR(osc);
+       if (osc == NULL)
+               RETURN(ERR_PTR(-ENOMEM));
+
+       cl_device_init(&osc->osc_cl, t);
+       d = osc2lu_dev(osc);
+       d->ld_ops = &osc_lu_ops;
+
+       /* Setup OSC OBD */
+       obd = class_name2obd(lustre_cfg_string(cfg, 0));
+       LASSERT(obd != NULL);
+       rc = osc_setup(obd, cfg);
+       if (rc) {
+               osc_device_free(env, d);
+               RETURN(ERR_PTR(rc));
+       }
+       osc->osc_exp = obd->obd_self_export;
+       osc->osc_stats.os_init = ktime_get_real();
+       RETURN(d);
 }
 
 static const struct lu_device_type_operations osc_device_type_ops = {