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
Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: Ibc82369ff6531b56ceda4b1c0a833720dc61f3f4
Reviewed-on: https://review.whamcloud.com/28604
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
enum lfsck_type ltn_type;
};
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[] = {
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 = "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)
{ .ltn_name = NULL } };
static enum lfsck_type lfsck_name2type(const char *name)