From: Patrick Farrell Date: Mon, 21 Aug 2017 09:45:05 +0000 (-0500) Subject: LU-9894 lfsck: Print correct lfsck start info X-Git-Tag: 2.10.3-RC1~35 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=eb339c2df4b08a73d329a19820616fc7fb25216f;p=fs%2Flustre-release.git LU-9894 lfsck: Print correct lfsck start info When printing which scan type was started, lfsck iterates through an array of types and compares the given type to the types in the array. Type numbers are a bit mask. However, LFSCK_TYPES_SUPPORTED and LFSCK_TYPES_DEF are the full mask, and they are the first in the array. This means we always match LFSCK_TYPES_SUPPORTED, which results in always printing "all" as the type of scan. Reorder the struct to increasing bit order to fix this. Test-Parameters: trivial testlist=sanity-scrub,sanity-lfsck Lustre-change: https://review.whamcloud.com/28604 Lustre-commit: 0c6805b2a0d575331dff0c22a657da91f61a1809 Signed-off-by: Patrick Farrell Change-Id: Ibc82369ff6531b56ceda4b1c0a833720dc61f3f4 Reviewed-by: Fan Yong Reviewed-by: James Nunez Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/30265 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond --- diff --git a/lustre/utils/lustre_lfsck.c b/lustre/utils/lustre_lfsck.c index 14c569d..d90863b 100644 --- a/lustre/utils/lustre_lfsck.c +++ b/lustre/utils/lustre_lfsck.c @@ -90,12 +90,14 @@ struct lfsck_type_name { enum lfsck_type ltn_type; }; +/* Note types must be in order of increasing value so we can iterate through + * this correctly. See enum lfsck_type for values. LU-9894. */ static struct lfsck_type_name lfsck_types_names[] = { - { .ltn_name = "all", .ltn_type = LFSCK_TYPES_SUPPORTED }, - { .ltn_name = "default", .ltn_type = LFSCK_TYPES_DEF }, { .ltn_name = "layout", .ltn_type = LFSCK_TYPE_LAYOUT }, { .ltn_name = "namespace", .ltn_type = LFSCK_TYPE_NAMESPACE }, { .ltn_name = "scrub", .ltn_type = LFSCK_TYPE_SCRUB }, + { .ltn_name = "all", .ltn_type = LFSCK_TYPES_SUPPORTED }, + { .ltn_name = "default", .ltn_type = LFSCK_TYPES_DEF }, { .ltn_name = NULL } }; static enum lfsck_type lfsck_name2type(const char *name)