From: Fan Yong Date: Sun, 7 Dec 2014 01:00:55 +0000 (+0800) Subject: LU-6321 lfsck: make lfsck_namespace trace file as index X-Git-Tag: 2.7.51~67 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ca8067522d6a6928e33dc8d34d5ad208c7eb535f LU-6321 lfsck: make lfsck_namespace trace file as index 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 Change-Id: I76d8b1416c4c507793aa9bbab2d52cc7d8daa440 Reviewed-on: http://review.whamcloud.com/13945 Tested-by: Jenkins Reviewed-by: Lai Siyao Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 83250b6..585ab52 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -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, - 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; @@ -490,12 +488,9 @@ lfsck_namespace_load_one_trace_file(const struct lu_env *env, 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; } @@ -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, - 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); @@ -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_NAMESPACE, NULL, true); + LFSCK_NAMESPACE, true); 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); - 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));