From: Andreas Dilger Date: Fri, 26 Jan 2018 21:37:35 +0000 (-0700) Subject: LU-9771 util: rename LCM_FL_NOT_FLR to LCM_FL_NONE X-Git-Tag: 2.10.59~123 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=fa15e5347c2eccd432924e57440829606c7339f6 LU-9771 util: rename LCM_FL_NOT_FLR to LCM_FL_NONE Having "lfs getstripe" print out "lcm_flags: not_flr" is not very useful, as the composite files may not relate to FLR (e.g. PFL). Rename "LCM_FL_NOT_FLR" to "LCM_FL_NONE" so it is more clear there are no composite flags on the layout. Print out "0" for flags if no flags are set, to match old behaviour. Signed-off-by: Andreas Dilger Change-Id: Ib3701da8368253969567b927300cd42bc33ebbe5 Reviewed-on: https://review.whamcloud.com/31047 Reviewed-by: Bobi Jam Tested-by: Jenkins Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h index d96c85a..5dec7e4 100644 --- a/lustre/include/lustre/lustreapi.h +++ b/lustre/include/lustre/lustreapi.h @@ -481,22 +481,6 @@ int llapi_ladvise(int fd, unsigned long long flags, int num_advise, /* llapi_layout user interface */ -static inline const char *lcm_flags_string(__u16 flags) -{ - switch (flags & LCM_FL_FLR_MASK) { - case LCM_FL_NOT_FLR: - return "not_flr"; - case LCM_FL_RDONLY: - return "ro"; - case LCM_FL_WRITE_PENDING: - return "wp"; - case LCM_FL_SYNC_PENDING: - return "sp"; - default: - return ""; - } -} - /** * An array element storing component info to be resynced during mirror * resynchronization. @@ -806,6 +790,7 @@ int llapi_layout_file_create(const char *path, int open_flags, int mode, */ int llapi_layout_flags_set(struct llapi_layout *layout, uint32_t flags); int llapi_layout_flags_get(struct llapi_layout *layout, uint32_t *flags); +const char *llapi_layout_flags_string(uint32_t flags); /** * llapi_layout_mirror_count_get() - Get mirror count from the header of diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 59956dc..8479c11 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -636,7 +636,7 @@ static inline __u16 mirror_id_of(__u32 id) */ enum lov_comp_md_flags { /* the least 2 bits are used by FLR to record file state */ - LCM_FL_NOT_FLR = 0, + LCM_FL_NONE = 0, LCM_FL_RDONLY = 1, LCM_FL_WRITE_PENDING = 2, LCM_FL_SYNC_PENDING = 3, diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index acfdd01..9e098c3 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -2339,7 +2339,7 @@ static int lod_declare_layout_add(const struct lu_env *env, LASSERT(lo->ldo_is_composite); - if (lo->ldo_flr_state != LCM_FL_NOT_FLR) + if (lo->ldo_flr_state != LCM_FL_NONE) RETURN(-EBUSY); rc = lod_verify_striping(d, lo, buf, false); @@ -2549,7 +2549,7 @@ static int lod_declare_layout_del(const struct lu_env *env, LASSERT(lo->ldo_is_composite); - if (lo->ldo_flr_state != LCM_FL_NOT_FLR) + if (lo->ldo_flr_state != LCM_FL_NONE) RETURN(-EBUSY); magic = comp_v1->lcm_magic; @@ -2764,7 +2764,7 @@ static int lod_layout_convert(struct lod_thread_info *info) lcm->lcm_size = cpu_to_le32(size); lcm->lcm_layout_gen = cpu_to_le32(le16_to_cpu( lmm_save->lmm_layout_gen)); - lcm->lcm_flags = cpu_to_le16(LCM_FL_NOT_FLR); + lcm->lcm_flags = cpu_to_le16(LCM_FL_NONE); lcm->lcm_entry_count = cpu_to_le16(1); lcm->lcm_mirror_count = 0; @@ -2913,7 +2913,7 @@ static int lod_declare_layout_merge(const struct lu_env *env, lcm->lcm_size = cpu_to_le32(size); lcm->lcm_entry_count = cpu_to_le16(cur_entry_count + merge_entry_count); lcm->lcm_mirror_count = cpu_to_le16(mirror_count); - if ((le16_to_cpu(lcm->lcm_flags) & LCM_FL_FLR_MASK) == LCM_FL_NOT_FLR) + if ((le16_to_cpu(lcm->lcm_flags) & LCM_FL_FLR_MASK) == LCM_FL_NONE) lcm->lcm_flags = cpu_to_le32(LCM_FL_RDONLY); LASSERT(dt_write_locked(env, dt_object_child(dt))); @@ -5415,7 +5415,7 @@ static int lod_declare_update_plain(const struct lu_env *env, int i, rc; ENTRY; - LASSERT(lo->ldo_flr_state == LCM_FL_NOT_FLR); + LASSERT(lo->ldo_flr_state == LCM_FL_NONE); /* * In case the client is passing lovea, which only happens during @@ -5961,7 +5961,7 @@ static int lod_declare_layout_change(const struct lu_env *env, GOTO(out, rc); switch (lo->ldo_flr_state) { - case LCM_FL_NOT_FLR: + case LCM_FL_NONE: rc = lod_declare_update_plain(env, lo, mlc->mlc_intent, &mlc->mlc_buf, th); break; diff --git a/lustre/lov/lov_cl_internal.h b/lustre/lov/lov_cl_internal.h index 485f706..76b1155 100644 --- a/lustre/lov/lov_cl_internal.h +++ b/lustre/lov/lov_cl_internal.h @@ -352,14 +352,14 @@ static inline struct lov_stripe_md_entry *lov_lse(struct lov_object *lov, int i) static inline unsigned lov_flr_state(const struct lov_object *lov) { if (lov->lo_type != LLT_COMP) - return LCM_FL_NOT_FLR; + return LCM_FL_NONE; return lov->u.composite.lo_flags & LCM_FL_FLR_MASK; } static inline bool lov_is_flr(const struct lov_object *lov) { - return lov_flr_state(lov) != LCM_FL_NOT_FLR; + return lov_flr_state(lov) != LCM_FL_NONE; } static inline struct lov_layout_entry *lov_entry(struct lov_object *lov, int i) diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 3628b7a..1b337a2 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -657,7 +657,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, comp->lo_entry_count = lsm->lsm_entry_count; comp->lo_preferred_mirror = -1; - if (equi(flr_state == LCM_FL_NOT_FLR, comp->lo_mirror_count > 1)) + if (equi(flr_state == LCM_FL_NONE, comp->lo_mirror_count > 1)) RETURN(-EINVAL); OBD_ALLOC(comp->lo_mirrors, @@ -695,7 +695,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, lle->lle_extent = &lle->lle_lsme->lsme_extent; lle->lle_valid = !(lle->lle_lsme->lsme_flags & LCME_FL_STALE); - if (flr_state != LCM_FL_NOT_FLR) + if (flr_state != LCM_FL_NONE) mirror_id = mirror_id_of(lle->lle_lsme->lsme_id); lre = &comp->lo_mirrors[j]; diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 17642ca..2e9bf89 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -1328,14 +1328,14 @@ static int mdd_split_ea(struct lov_comp_md_v1 *comp_v1, __u16 mirror_id, comp_rem->lcm_entry_count = cpu_to_le32(comp_cnt - count); comp_rem->lcm_size = cpu_to_le32(lmm_size - lmm_size_vic); if (!comp_rem->lcm_mirror_count) - comp_rem->lcm_flags = cpu_to_le16(LCM_FL_NOT_FLR); + comp_rem->lcm_flags = cpu_to_le16(LCM_FL_NONE); memset(comp_vic, 0, sizeof(*comp_v1)); comp_vic->lcm_magic = cpu_to_le32(LOV_MAGIC_COMP_V1); comp_vic->lcm_mirror_count = 0; comp_vic->lcm_entry_count = cpu_to_le32(count); comp_vic->lcm_size = cpu_to_le32(lmm_size_vic + sizeof(*comp_vic)); - comp_vic->lcm_flags = cpu_to_le16(LCM_FL_NOT_FLR); + comp_vic->lcm_flags = cpu_to_le16(LCM_FL_NONE); comp_vic->lcm_layout_gen = 0; offset = sizeof(*comp_v1) + sizeof(*entry) * comp_cnt; @@ -2496,7 +2496,7 @@ mdd_layout_change(const struct lu_env *env, struct md_object *o, /* please refer to HLD of FLR for state transition */ switch (flr_state) { - case LCM_FL_NOT_FLR: + case LCM_FL_NONE: rc = mdd_layout_instantiate_component(env, obj, mlc, handle); break; case LCM_FL_WRITE_PENDING: diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 4d80f79..d6b1219 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1734,8 +1734,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0]) == 48, "found %lld\n", (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0])); CLASSERT(LOV_MAGIC_COMP_V1 == (0x0BD60000 | 0x0BD0)); - LASSERTF(LCM_FL_NOT_FLR == 0, "found %lld\n", - (long long)LCM_FL_NOT_FLR); + LASSERTF(LCM_FL_NONE == 0, "found %lld\n", + (long long)LCM_FL_NONE); LASSERTF(LCM_FL_RDONLY == 1, "found %lld\n", (long long)LCM_FL_RDONLY); LASSERTF(LCM_FL_WRITE_PENDING == 2, "found %lld\n", diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index f247dd1..74f2bba 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -7094,10 +7094,10 @@ int verify_mirror_ids(const char *fname, __u16 *mirror_ids, int ids_nr) flr_state &= LCM_FL_FLR_MASK; switch (flr_state) { - case LCM_FL_NOT_FLR: + case LCM_FL_NONE: rc = -EINVAL; fprintf(stderr, "%s: '%s' file state error: %s.\n", - progname, fname, lcm_flags_string(flr_state)); + progname, fname, llapi_layout_flags_string(flr_state)); goto free_layout; default: break; @@ -7198,11 +7198,11 @@ int lfs_mirror_resync_file(const char *fname, struct ll_ioc_lease *ioc, flr_state &= LCM_FL_FLR_MASK; switch (flr_state) { - case LCM_FL_NOT_FLR: + case LCM_FL_NONE: rc = -EINVAL; case LCM_FL_RDONLY: - fprintf(stderr, "%s: '%s' file state error: %s.\n", - progname, fname, lcm_flags_string(flr_state)); + fprintf(stderr, "%s: '%s' file state error: %s\n", progname, + fname, llapi_layout_flags_string(flr_state)); goto close_fd; default: break; @@ -7826,10 +7826,10 @@ int lfs_mirror_verify_file(const char *fname, __u16 *mirror_ids, int ids_nr, flr_state &= LCM_FL_FLR_MASK; switch (flr_state) { - case LCM_FL_NOT_FLR: + case LCM_FL_NONE: rc = -EINVAL; fprintf(stderr, "%s: '%s' file state error: %s.\n", - progname, fname, lcm_flags_string(flr_state)); + progname, fname, llapi_layout_flags_string(flr_state)); goto free_layout; default: break; diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index ed07763..e9ce5b8 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -2840,8 +2840,8 @@ static void lov_dump_comp_v1_header(struct find_param *param, char *path, "mirrored" : ""); else llapi_printf(LLAPI_MSG_NORMAL, - "%2slcm_flags: %s\n", - " ", lcm_flags_string(comp_v1->lcm_flags)); + "%2slcm_flags: %s\n", " ", + llapi_layout_flags_string(comp_v1->lcm_flags)); } if (verbose & VERBOSE_GENERATION) { diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index f289224..f206c96 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -1539,6 +1539,20 @@ int llapi_layout_flags_set(struct llapi_layout *layout, uint32_t flags) return 0; } +const char *llapi_layout_flags_string(uint32_t flags) +{ + switch (flags & LCM_FL_FLR_MASK) { + case LCM_FL_RDONLY: + return "ro"; + case LCM_FL_WRITE_PENDING: + return "wp"; + case LCM_FL_SYNC_PENDING: + return "sp"; + } + + return "0"; +} + /** * llapi_layout_mirror_count_is_valid() - Check the validity of mirror count. * @count: Mirror count value to be checked. diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 57c8124..1ffd199 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -794,7 +794,7 @@ check_lov_comp_md_v1(void) CHECK_CDEFINE(LOV_MAGIC_COMP_V1); - CHECK_VALUE(LCM_FL_NOT_FLR); + CHECK_VALUE(LCM_FL_NONE); CHECK_VALUE(LCM_FL_RDONLY); CHECK_VALUE(LCM_FL_WRITE_PENDING); CHECK_VALUE(LCM_FL_SYNC_PENDING); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index f22804f..d01d8f7 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1755,8 +1755,8 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0]) == 48, "found %lld\n", (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0])); CLASSERT(LOV_MAGIC_COMP_V1 == (0x0BD60000 | 0x0BD0)); - LASSERTF(LCM_FL_NOT_FLR == 0, "found %lld\n", - (long long)LCM_FL_NOT_FLR); + LASSERTF(LCM_FL_NONE == 0, "found %lld\n", + (long long)LCM_FL_NONE); LASSERTF(LCM_FL_RDONLY == 1, "found %lld\n", (long long)LCM_FL_RDONLY); LASSERTF(LCM_FL_WRITE_PENDING == 2, "found %lld\n",