Whamcloud - gitweb
LU-5092 nodemap: save nodemaps to targets for caching
[fs/lustre-release.git] / lustre / ofd / ofd_dev.c
index 05365a9..7e596a4 100644 (file)
@@ -2802,6 +2802,7 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
        struct ofd_thread_info  *info = NULL;
        struct obd_device       *obd;
        struct obd_statfs       *osfs;
        struct ofd_thread_info  *info = NULL;
        struct obd_device       *obd;
        struct obd_statfs       *osfs;
+       struct lu_fid            fid;
        int                      rc;
 
        ENTRY;
        int                      rc;
 
        ENTRY;
@@ -2933,14 +2934,31 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
        if (rc)
                GOTO(err_fini_lut, rc);
 
        if (rc)
                GOTO(err_fini_lut, rc);
 
-       rc = ofd_start_inconsistency_verification_thread(m);
+       fid.f_seq = FID_SEQ_LOCAL_NAME;
+       fid.f_oid = 1;
+       fid.f_ver = 0;
+       rc = local_oid_storage_init(env, m->ofd_osd, &fid,
+                                   &m->ofd_los);
        if (rc != 0)
                GOTO(err_fini_fs, rc);
 
        if (rc != 0)
                GOTO(err_fini_fs, rc);
 
+       rc = nodemap_fs_init(env, m->ofd_osd, obd, m->ofd_los);
+       if (rc != 0)
+               GOTO(err_fini_los, rc);
+
+       rc = ofd_start_inconsistency_verification_thread(m);
+       if (rc != 0)
+               GOTO(err_fini_nm, rc);
+
        tgt_adapt_sptlrpc_conf(&m->ofd_lut, 1);
 
        RETURN(0);
 
        tgt_adapt_sptlrpc_conf(&m->ofd_lut, 1);
 
        RETURN(0);
 
+err_fini_nm:
+       nodemap_fs_fini(env, obd);
+err_fini_los:
+       local_oid_storage_fini(env, m->ofd_los);
+       m->ofd_los = NULL;
 err_fini_fs:
        ofd_fs_cleanup(env, m);
 err_fini_lut:
 err_fini_fs:
        ofd_fs_cleanup(env, m);
 err_fini_lut:
@@ -2985,6 +3003,12 @@ static void ofd_fini(const struct lu_env *env, struct ofd_device *m)
        ofd_stop_inconsistency_verification_thread(m);
        lfsck_degister(env, m->ofd_osd);
        ofd_fs_cleanup(env, m);
        ofd_stop_inconsistency_verification_thread(m);
        lfsck_degister(env, m->ofd_osd);
        ofd_fs_cleanup(env, m);
+       nodemap_fs_fini(env, obd);
+
+       if (m->ofd_los != NULL) {
+               local_oid_storage_fini(env, m->ofd_los);
+               m->ofd_los = NULL;
+       }
 
        if (m->ofd_namespace != NULL) {
                ldlm_namespace_free_post(m->ofd_namespace);
 
        if (m->ofd_namespace != NULL) {
                ldlm_namespace_free_post(m->ofd_namespace);