Whamcloud - gitweb
LU-9771 util: rename LCM_FL_NOT_FLR to LCM_FL_NONE 47/31047/6
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 26 Jan 2018 21:37:35 +0000 (14:37 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 14 Feb 2018 00:51:00 +0000 (00:51 +0000)
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 <andreas.dilger@intel.com>
Change-Id: Ib3701da8368253969567b927300cd42bc33ebbe5
Reviewed-on: https://review.whamcloud.com/31047
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Tested-by: Jenkins
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
12 files changed:
lustre/include/lustre/lustreapi.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/lod/lod_object.c
lustre/lov/lov_cl_internal.h
lustre/lov/lov_object.c
lustre/mdd/mdd_object.c
lustre/ptlrpc/wiretest.c
lustre/utils/lfs.c
lustre/utils/liblustreapi.c
lustre/utils/liblustreapi_layout.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index d96c85a..5dec7e4 100644 (file)
@@ -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
index 59956dc..8479c11 100644 (file)
@@ -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,
index acfdd01..9e098c3 100644 (file)
@@ -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;
index 485f706..76b1155 100644 (file)
@@ -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)
index 3628b7a..1b337a2 100644 (file)
@@ -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];
index 17642ca..2e9bf89 100644 (file)
@@ -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:
index 4d80f79..d6b1219 100644 (file)
@@ -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",
index f247dd1..74f2bba 100644 (file)
@@ -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;
index ed07763..e9ce5b8 100644 (file)
@@ -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) {
index f289224..f206c96 100644 (file)
@@ -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.
index 57c8124..1ffd199 100644 (file)
@@ -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);
index f22804f..d01d8f7 100644 (file)
@@ -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",