Whamcloud - gitweb
LU-6321 lfsck: make lfsck_namespace trace file as index 45/13945/2
authorFan Yong <fan.yong@intel.com>
Sun, 7 Dec 2014 01:00:55 +0000 (09:00 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 4 Mar 2015 03:46:17 +0000 (03:46 +0000)
Originally, the "lfsck_namespace" file stored both the namespace
LFSCK statistics information and the FIDs to be double scanned.
But to improve the namespace LFSCK performance (since Lustre-2.7),
we used multiple trace files with the name "lfsck_namespace_xx".
At that time, the original "lfsck_namespace" file only need to
record the namespace LFSCK statistics information. So we made it
as regular file, NOT index file. Such changes will cause trouble
when downgrade to Lustre-2.6 or older, becuase the old namespace
LFSCK needs an index trace file instead of regular file. To avoid
the compatibility issues, we will keep the "lfsck_namespace" file
as index file on b2_7 and newer release.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I76d8b1416c4c507793aa9bbab2d52cc7d8daa440
Reviewed-on: http://review.whamcloud.com/13945
Tested-by: Jenkins
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lfsck/lfsck_namespace.c

index 83250b6..585ab52 100644 (file)
@@ -476,9 +476,7 @@ static struct dt_object *
 lfsck_namespace_load_one_trace_file(const struct lu_env *env,
                                    struct lfsck_component *com,
                                    struct dt_object *parent,
 lfsck_namespace_load_one_trace_file(const struct lu_env *env,
                                    struct lfsck_component *com,
                                    struct dt_object *parent,
-                                   const char *name,
-                                   const struct dt_index_features *ft,
-                                   bool reset)
+                                   const char *name, bool reset)
 {
        struct lfsck_instance   *lfsck = com->lc_lfsck;
        struct dt_object        *obj;
 {
        struct lfsck_instance   *lfsck = com->lc_lfsck;
        struct dt_object        *obj;
@@ -490,12 +488,9 @@ lfsck_namespace_load_one_trace_file(const struct lu_env *env,
                        return ERR_PTR(rc);
        }
 
                        return ERR_PTR(rc);
        }
 
-       if (ft != NULL)
-               obj = local_index_find_or_create(env, lfsck->li_los, parent,
-                                       name, S_IFREG | S_IRUGO | S_IWUSR, ft);
-       else
-               obj = local_file_find_or_create(env, lfsck->li_los, parent,
-                                       name, S_IFREG | S_IRUGO | S_IWUSR);
+       obj = local_index_find_or_create(env, lfsck->li_los, parent, name,
+                                        S_IFREG | S_IRUGO | S_IWUSR,
+                                        &dt_lfsck_features);
 
        return obj;
 }
 
        return obj;
 }
@@ -522,8 +517,7 @@ static int lfsck_namespace_load_sub_trace_files(const struct lu_env *env,
                }
 
                obj = lfsck_namespace_load_one_trace_file(env, com,
                }
 
                obj = lfsck_namespace_load_one_trace_file(env, com,
-                                       com->lc_lfsck->li_lfsck_dir,
-                                       name, &dt_lfsck_features, reset);
+                               com->lc_lfsck->li_lfsck_dir, name, reset);
                if (IS_ERR(obj))
                        return PTR_ERR(obj);
 
                if (IS_ERR(obj))
                        return PTR_ERR(obj);
 
@@ -3752,7 +3746,7 @@ static int lfsck_namespace_reset(const struct lu_env *env,
        lfsck_object_put(env, com->lc_obj);
        com->lc_obj = NULL;
        dto = lfsck_namespace_load_one_trace_file(env, com, root,
        lfsck_object_put(env, com->lc_obj);
        com->lc_obj = NULL;
        dto = lfsck_namespace_load_one_trace_file(env, com, root,
-                               LFSCK_NAMESPACE, NULL, true);
+                                                 LFSCK_NAMESPACE, true);
        if (IS_ERR(dto))
                GOTO(out, rc = PTR_ERR(dto));
 
        if (IS_ERR(dto))
                GOTO(out, rc = PTR_ERR(dto));
 
@@ -6440,9 +6434,10 @@ int lfsck_namespace_setup(const struct lu_env *env,
        if (unlikely(!dt_try_as_dir(env, root)))
                GOTO(out, rc = -ENOTDIR);
 
        if (unlikely(!dt_try_as_dir(env, root)))
                GOTO(out, rc = -ENOTDIR);
 
-       obj = local_file_find_or_create(env, lfsck->li_los, root,
-                                       LFSCK_NAMESPACE,
-                                       S_IFREG | S_IRUGO | S_IWUSR);
+       obj = local_index_find_or_create(env, lfsck->li_los, root,
+                                        LFSCK_NAMESPACE,
+                                        S_IFREG | S_IRUGO | S_IWUSR,
+                                        &dt_lfsck_features);
        if (IS_ERR(obj))
                GOTO(out, rc = PTR_ERR(obj));
 
        if (IS_ERR(obj))
                GOTO(out, rc = PTR_ERR(obj));