Whamcloud - gitweb
LU-8508 nodemap: improve object handling in cache saving
[fs/lustre-release.git] / lustre / mdd / mdd_device.c
index 2728b20..4a7b872 100644 (file)
@@ -884,7 +884,7 @@ static void mdd_device_shutdown(const struct lu_env *env, struct mdd_device *m,
        mdd_changelog_fini(env, m);
        orph_index_fini(env, m);
        mdd_dot_lustre_cleanup(env, m);
        mdd_changelog_fini(env, m);
        orph_index_fini(env, m);
        mdd_dot_lustre_cleanup(env, m);
-       nodemap_fs_fini(env, mdd2obd_dev(m));
+       nm_config_file_deregister_tgt(env, mdd2obd_dev(m)->u.obt.obt_nodemap_config_file);
        if (m->mdd_los != NULL) {
                local_oid_storage_fini(env, m->mdd_los);
                m->mdd_los = NULL;
        if (m->mdd_los != NULL) {
                local_oid_storage_fini(env, m->mdd_los);
                m->mdd_los = NULL;
@@ -995,10 +995,11 @@ static int mdd_prepare(const struct lu_env *env,
                        struct lu_device *pdev,
                        struct lu_device *cdev)
 {
                        struct lu_device *pdev,
                        struct lu_device *cdev)
 {
-       struct mdd_device       *mdd = lu2mdd_dev(cdev);
-       struct lu_device        *next = &mdd->mdd_child->dd_lu_dev;
-       struct lu_fid            fid;
-       int                      rc;
+       struct mdd_device *mdd = lu2mdd_dev(cdev);
+       struct lu_device *next = &mdd->mdd_child->dd_lu_dev;
+       struct nm_config_file *nodemap_config;
+       struct lu_fid fid;
+       int rc;
 
        ENTRY;
 
 
        ENTRY;
 
@@ -1058,10 +1059,12 @@ static int mdd_prepare(const struct lu_env *env,
        if (rc != 0)
                GOTO(out_changelog, rc);
 
        if (rc != 0)
                GOTO(out_changelog, rc);
 
-       rc = nodemap_fs_init(env, mdd->mdd_bottom, mdd2obd_dev(mdd),
-                            mdd->mdd_los);
-       if (rc != 0)
-               GOTO(out_hsm, rc);
+       nodemap_config = nm_config_file_register_tgt(env, mdd->mdd_bottom,
+                                                    mdd->mdd_los);
+       if (IS_ERR(nodemap_config))
+               GOTO(out_hsm, rc = PTR_ERR(nodemap_config));
+
+       mdd2obd_dev(mdd)->u.obt.obt_nodemap_config_file = nodemap_config;
 
        rc = lfsck_register(env, mdd->mdd_bottom, mdd->mdd_child,
                            mdd2obd_dev(mdd), mdd_lfsck_out_notify,
 
        rc = lfsck_register(env, mdd->mdd_bottom, mdd->mdd_child,
                            mdd2obd_dev(mdd), mdd_lfsck_out_notify,
@@ -1075,7 +1078,8 @@ static int mdd_prepare(const struct lu_env *env,
        RETURN(0);
 
 out_nodemap:
        RETURN(0);
 
 out_nodemap:
-       nodemap_fs_fini(env, mdd2obd_dev(mdd));
+       nm_config_file_deregister_tgt(env, mdd2obd_dev(mdd)->u.obt.obt_nodemap_config_file);
+       mdd2obd_dev(mdd)->u.obt.obt_nodemap_config_file = NULL;
 out_hsm:
        mdd_hsm_actions_llog_fini(env, mdd);
 out_changelog:
 out_hsm:
        mdd_hsm_actions_llog_fini(env, mdd);
 out_changelog: