Whamcloud - gitweb
LU-3963 libcfs: convert md[d/t]/mg[c/s] to linux atomic primitives
[fs/lustre-release.git] / lustre / mdd / mdd_device.c
index 0153d18..1d049ea 100644 (file)
@@ -564,7 +564,8 @@ static int obf_lookup(const struct lu_env *env, struct md_object *p,
                 GOTO(out, rc = -EINVAL);
         }
 
-       if (!fid_is_norm(f) && !fid_is_igif(f) && !fid_is_root(f)) {
+       if (!fid_is_norm(f) && !fid_is_igif(f) && !fid_is_root(f) &&
+           !fid_seq_is_dot(f->f_seq)) {
                CWARN("%s: "DFID" is invalid, sequence should be "
                      ">= "LPX64" or within ["LPX64","LPX64"].\n",
                      mdd2obd_dev(mdd)->obd_name, PFID(f),
@@ -1078,7 +1079,7 @@ static struct lu_device *mdd_device_free(const struct lu_env *env,
        struct mdd_device *m = lu2mdd_dev(lu);
        ENTRY;
 
-       LASSERT(cfs_atomic_read(&lu->ld_ref) == 0);
+       LASSERT(atomic_read(&lu->ld_ref) == 0);
        md_device_fini(&m->mdd_md_dev);
        OBD_FREE_PTR(m);
        RETURN(NULL);
@@ -1158,15 +1159,26 @@ static int mdd_obd_disconnect(struct obd_export *exp)
        RETURN(rc);
 }
 
-static int mdd_obd_health_check(const struct lu_env *env,
-                               struct obd_device *obd)
+static int mdd_obd_get_info(const struct lu_env *env, struct obd_export *exp,
+                           __u32 keylen, void *key, __u32 *vallen, void *val,
+                           struct lov_stripe_md *lsm)
 {
-       struct mdd_device *mdd = lu2mdd_dev(obd->obd_lu_dev);
-       int                rc;
-       ENTRY;
+       int rc = -EINVAL;
+
+       if (KEY_IS(KEY_OSP_CONNECTED)) {
+               struct obd_device       *obd = exp->exp_obd;
+               struct mdd_device       *mdd;
+
+               if (!obd->obd_set_up || obd->obd_stopping)
+                       RETURN(-EAGAIN);
+
+               mdd = lu2mdd_dev(obd->obd_lu_dev);
+               LASSERT(mdd);
+               rc = obd_get_info(env, mdd->mdd_child_exp, keylen, key, vallen,
+                                 val, lsm);
+               RETURN(rc);
+       }
 
-       LASSERT(mdd);
-       rc = obd_health_check(env, mdd->mdd_child_exp->exp_obd);
        RETURN(rc);
 }
 
@@ -1174,7 +1186,7 @@ static struct obd_ops mdd_obd_device_ops = {
        .o_owner        = THIS_MODULE,
        .o_connect      = mdd_obd_connect,
        .o_disconnect   = mdd_obd_disconnect,
-       .o_health_check = mdd_obd_health_check
+       .o_get_info     = mdd_obd_get_info,
 };
 
 static int mdd_changelog_user_register(const struct lu_env *env,
@@ -1498,8 +1510,11 @@ static int __init mdd_mod_init(void)
        hsm_actions_logops.lop_add = llog_cat_add_rec;
        hsm_actions_logops.lop_declare_add = llog_cat_declare_add_rec;
 
-       rc = class_register_type(&mdd_obd_device_ops, NULL, lvars.module_vars,
-                                LUSTRE_MDD_NAME, &mdd_device_type);
+       rc = class_register_type(&mdd_obd_device_ops, NULL, NULL,
+#ifndef HAVE_ONLY_PROCFS_SEQ
+                               lvars.module_vars,
+#endif
+                               LUSTRE_MDD_NAME, &mdd_device_type);
        if (rc)
                lu_kmem_fini(mdd_caches);
        return rc;