From 53d3890f16e4c6e5717c4d020ef213897a36c2b7 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 30 Sep 2016 18:07:17 -0600 Subject: [PATCH] LU-8653 lod: use stripe_count instead of stripe_nr Replace the use of stripenr and stripecnt in the code with stripe_count to be consistent the rest of the code. Introduce LOV_PATTERN_NONE instead of using "0" around the code to indicate no layout has been specified. Introduce LOV_PATTERN_DEFAULT to indicate the entire layout is unset, instead of using "0xffffffff" in the code. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I6056aebc1a381b09c1a436fb4a7986a51f3ebbe5 Reviewed-on: https://review.whamcloud.com/26681 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Steve Guminski Reviewed-by: Oleg Drokin --- lustre/include/uapi/linux/lustre/lustre_user.h | 2 + lustre/llite/file.c | 14 +- lustre/lod/lod_internal.h | 27 ++-- lustre/lod/lod_lov.c | 33 ++-- lustre/lod/lod_object.c | 202 +++++++++++++------------ lustre/lod/lod_qos.c | 116 +++++++------- lustre/lov/lov_ea.c | 14 +- lustre/lov/lov_internal.h | 3 +- lustre/lov/lov_obd.c | 8 +- lustre/lov/lov_pack.c | 56 +++---- lustre/lov/lov_request.c | 4 +- lustre/mdc/mdc_lib.c | 31 ++-- lustre/obdecho/echo_client.c | 32 ++-- lustre/tests/sanity.sh | 22 +-- lustre/tests/sanityn.sh | 6 +- lustre/utils/liblustreapi.c | 2 +- 16 files changed, 293 insertions(+), 279 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 17c985a..6ae38c4 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -429,6 +429,7 @@ enum ll_lease_type { #define LMV_USER_MAGIC 0x0CD30CD0 /*default lmv magic*/ +#define LOV_PATTERN_NONE 0x000 #define LOV_PATTERN_RAID0 0x001 #define LOV_PATTERN_RAID1 0x002 #define LOV_PATTERN_FIRST 0x100 @@ -437,6 +438,7 @@ enum ll_lease_type { #define LOV_PATTERN_F_MASK 0xffff0000 #define LOV_PATTERN_F_HOLE 0x40000000 /* there is hole in LOV EA */ #define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */ +#define LOV_PATTERN_DEFAULT 0xffffffff static inline bool lov_pattern_supported(__u32 pattern) { diff --git a/lustre/llite/file.c b/lustre/llite/file.c index cf71134..2e976c5 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1730,20 +1730,20 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, (struct lov_user_md_v3 *)lmm); if (S_ISREG(body->mbo_mode)) lustre_swab_lov_user_md_objects( - ((struct lov_user_md_v3 *)lmm)->lmm_objects, - stripe_count); + ((struct lov_user_md_v3 *)lmm)->lmm_objects, + stripe_count); } else if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_COMP_V1)) { lustre_swab_lov_comp_md_v1( (struct lov_comp_md_v1 *)lmm); } - } + } out: - *lmmp = lmm; - *lmm_size = lmmsize; - *request = req; - return rc; + *lmmp = lmm; + *lmm_size = lmmsize; + *request = req; + return rc; } static int ll_lov_setea(struct inode *inode, struct file *file, diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h index 139ec4e..7468c76 100644 --- a/lustre/lod/lod_internal.h +++ b/lustre/lod/lod_internal.h @@ -236,7 +236,7 @@ struct lod_layout_component { __u32 llc_pattern; __u16 llc_layout_gen; __u16 llc_stripe_offset; - __u16 llc_stripenr; + __u16 llc_stripe_count; __u16 llc_stripes_allocated; char *llc_pool; /* ost list specified with LOV_USER_MAGIC_SPECIFIC lum */ @@ -252,7 +252,7 @@ struct lod_default_striping { __u32 lds_def_comp_size_cnt; struct lod_layout_component *lds_def_comp_entries; /* default LMV */ - __u32 lds_dir_def_stripenr; + __u32 lds_dir_def_stripe_count; __u32 lds_dir_def_stripe_offset; __u32 lds_dir_def_hash_type; /* default file striping flags (LOV) */ @@ -263,6 +263,7 @@ struct lod_default_striping { }; struct lod_object { + /* common fields for both files and directories */ struct dt_object ldo_obj; union { /* file stripe (LOV) */ @@ -277,7 +278,7 @@ struct lod_object { /* directory stripe (LMV) */ struct { /* Slave stripe count for striped directory. */ - __u16 ldo_dir_stripenr; + __u16 ldo_dir_stripe_count; /* How many stripes allocated for a striped directory */ __u16 ldo_dir_stripes_allocated; __u32 ldo_dir_stripe_offset; @@ -295,7 +296,7 @@ struct lod_object { }; /* file stripe (LOV) */ struct lod_layout_component *ldo_comp_entries; - /* slave stripes of striped directory (LMV)*/ + /* slave stripes of striped directory (LMV) */ struct dt_object **ldo_stripe; }; @@ -458,12 +459,12 @@ static inline bool lod_obj_is_striped(struct dt_object *dt) return false; if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) - return lo->ldo_dir_stripenr != 0; + return lo->ldo_dir_stripe_count != 0; for (i = 0; i < lo->ldo_comp_cnt; i++) { if (lo->ldo_comp_entries[i].llc_stripe == NULL) continue; - LASSERT(lo->ldo_comp_entries[i].llc_stripenr > 0); + LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0); return true; } return false; @@ -569,8 +570,8 @@ lod_comp_inited(const struct lod_layout_component *entry) * save the specified OST index list. */ static inline void -lod_comp_shrink_stripecount(struct lod_layout_component *lod_comp, - __u16 *stripe_count) +lod_comp_shrink_stripe_count(struct lod_layout_component *lod_comp, + __u16 *stripe_count) { /** * Need one lov_ost_data_v1 to store invalid ost_idx, please refer to @@ -649,11 +650,11 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo, int lod_qos_prep_create(const struct lu_env *env, struct lod_object *lo, struct lu_attr *attr, struct thandle *th, int comp_idx, struct ost_pool *inuse); -__u16 lod_comp_entry_stripecnt(struct lod_object *lo, - struct lod_layout_component *entry, - bool is_dir); -__u16 lod_get_stripecnt(struct lod_device *lod, struct lod_object *lo, - __u16 stripe_count); +__u16 lod_comp_entry_stripe_count(struct lod_object *lo, + struct lod_layout_component *entry, + bool is_dir); +__u16 lod_get_stripe_count(struct lod_device *lod, struct lod_object *lo, + __u16 stripe_count); /* lproc_lod.c */ int lod_procfs_init(struct lod_device *lod); diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 43375f2..89be42f 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -744,7 +744,7 @@ static int lod_gen_component_ea(const struct lu_env *env, struct lov_ost_data_v1 *objs; struct lod_layout_component *lod_comp; __u32 magic; - __u16 stripecnt; + __u16 stripe_count; int i, rc = 0; ENTRY; @@ -767,7 +767,7 @@ static int lod_gen_component_ea(const struct lu_env *env, lmm_oi_cpu_to_le(&lmm->lmm_oi, &lmm->lmm_oi); lmm->lmm_stripe_size = cpu_to_le32(lod_comp->llc_stripe_size); - lmm->lmm_stripe_count = cpu_to_le16(lod_comp->llc_stripenr); + lmm->lmm_stripe_count = cpu_to_le16(lod_comp->llc_stripe_count); /** * for dir and uninstantiated component, lmm_layout_gen stores * default stripe offset. @@ -788,16 +788,16 @@ static int lod_gen_component_ea(const struct lu_env *env, RETURN(-E2BIG); objs = &v3->lmm_objects[0]; } - stripecnt = lod_comp_entry_stripecnt(lo, lod_comp, is_dir); + stripe_count = lod_comp_entry_stripe_count(lo, lod_comp, is_dir); if (!is_dir && lo->ldo_is_composite) - lod_comp_shrink_stripecount(lod_comp, &stripecnt); + lod_comp_shrink_stripe_count(lod_comp, &stripe_count); if (is_dir || lod_comp->llc_pattern & LOV_PATTERN_F_RELEASED) GOTO(done, rc = 0); /* generate ost_idx of this component stripe */ lod = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev); - for (i = 0; i < stripecnt; i++) { + for (i = 0; i < stripe_count; i++) { struct dt_object *object; __u32 ost_idx = (__u32)-1UL; int type = LU_SEQ_RANGE_OST; @@ -843,7 +843,7 @@ static int lod_gen_component_ea(const struct lu_env *env, } done: if (lmm_size != NULL) - *lmm_size = lov_mds_md_size(stripecnt, magic); + *lmm_size = lov_mds_md_size(stripe_count, magic); RETURN(rc); } @@ -1084,7 +1084,7 @@ static int validate_lod_and_idx(struct lod_device *md, __u32 idx) * Instantiate objects for stripes. * * Allocate and initialize LU-objects representing the stripes. The number - * of the stripes (ldo_stripenr) must be initialized already. The caller + * of the stripes (ldo_stripe_count) must be initialized already. The caller * must ensure nobody else is calling the function on the object at the same * time. FLDB service must be running to be able to map a FID to the targets * and find appropriate device representing that target. @@ -1118,15 +1118,15 @@ int lod_initialize_objects(const struct lu_env *env, struct lod_object *lo, lod_comp = &lo->ldo_comp_entries[comp_idx]; LASSERT(lod_comp->llc_stripe == NULL); - LASSERT(lod_comp->llc_stripenr > 0); + LASSERT(lod_comp->llc_stripe_count > 0); LASSERT(lod_comp->llc_stripe_size > 0); - stripe_len = lod_comp->llc_stripenr; + stripe_len = lod_comp->llc_stripe_count; OBD_ALLOC(stripe, sizeof(stripe[0]) * stripe_len); if (stripe == NULL) RETURN(-ENOMEM); - for (i = 0; i < lod_comp->llc_stripenr; i++) { + for (i = 0; i < lod_comp->llc_stripe_count; i++) { if (unlikely(lovea_slot_is_dummy(&objs[i]))) continue; @@ -1168,7 +1168,7 @@ out: dt_object_put(env, stripe[i]); OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len); - lod_comp->llc_stripenr = 0; + lod_comp->llc_stripe_count = 0; } else { lod_comp->llc_stripe = stripe; lod_comp->llc_stripes_allocated = stripe_len; @@ -1262,7 +1262,7 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, lod_comp->llc_pattern = pattern; lod_comp->llc_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); - lod_comp->llc_stripenr = le16_to_cpu(lmm->lmm_stripe_count); + lod_comp->llc_stripe_count = le16_to_cpu(lmm->lmm_stripe_count); lod_comp->llc_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); if (magic == LOV_MAGIC_V3) { @@ -1285,15 +1285,16 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, * used in lod_alloc_ost_list(). */ lod_comp->llc_ostlist.op_count = - lod_comp->llc_stripenr; + lod_comp->llc_stripe_count; lod_comp->llc_ostlist.op_size = - lod_comp->llc_stripenr * sizeof(__u32); + lod_comp->llc_stripe_count * + sizeof(__u32); OBD_ALLOC(lod_comp->llc_ostlist.op_array, lod_comp->llc_ostlist.op_size); if (!lod_comp->llc_ostlist.op_array) GOTO(out, rc = -ENOMEM); - for (j = 0; j < lod_comp->llc_stripenr; j++) + for (j = 0; j < lod_comp->llc_stripe_count; j++) lod_comp->llc_ostlist.op_array[j] = le32_to_cpu(objs[j].l_ost_idx); @@ -1512,7 +1513,7 @@ static int lod_verify_v1v3(struct lod_device *d, const struct lu_buf *buf, } /* the user uses "0" for default stripe pattern normally. */ - if (!is_from_disk && lum->lmm_pattern == 0) + if (!is_from_disk && lum->lmm_pattern == LOV_PATTERN_NONE) lum->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0); if (!lov_pattern_supported(le32_to_cpu(lum->lmm_pattern))) { diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index f2e3d6f..cedac80 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -381,7 +381,7 @@ static struct dt_it *lod_striped_it_init(const struct lu_env *env, struct dt_it *it_next; ENTRY; - LASSERT(lo->ldo_dir_stripenr > 0); + LASSERT(lo->ldo_dir_stripe_count > 0); next = lo->ldo_stripe[0]; LASSERT(next != NULL); LASSERT(next->do_index_ops != NULL); @@ -408,8 +408,8 @@ static struct dt_it *lod_striped_it_init(const struct lu_env *env, do { \ LASSERT((it)->lit_obj != NULL); \ LASSERT((it)->lit_it != NULL); \ - LASSERT((lo)->ldo_dir_stripenr > 0); \ - LASSERT((it)->lit_stripe_index < (lo)->ldo_dir_stripenr); \ + LASSERT((lo)->ldo_dir_stripe_count > 0); \ + LASSERT((it)->lit_stripe_index < (lo)->ldo_dir_stripe_count); \ } while (0) /** @@ -545,7 +545,7 @@ again: } /* go to next stripe */ - if (it->lit_stripe_index + 1 >= lo->ldo_dir_stripenr) + if (it->lit_stripe_index + 1 >= lo->ldo_dir_stripe_count) RETURN(1); it->lit_stripe_index++; @@ -955,10 +955,10 @@ static int lod_index_try(const struct lu_env *env, struct dt_object *dt, if (rc != 0) RETURN(rc); - if (lo->ldo_dir_stripenr > 0) { + if (lo->ldo_dir_stripe_count > 0) { int i; - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { if (dt_object_exists(lo->ldo_stripe[i]) == 0) continue; rc = lo->ldo_stripe[i]->do_ops->do_index_try(env, @@ -1061,8 +1061,8 @@ int lod_obj_for_each_stripe(const struct lu_env *env, struct lod_object *lo, if (lod_comp->llc_stripe == NULL) continue; - LASSERT(lod_comp->llc_stripenr > 0); - for (j = 0; j < lod_comp->llc_stripenr; j++) { + LASSERT(lod_comp->llc_stripe_count > 0); + for (j = 0; j < lod_comp->llc_stripe_count; j++) { struct dt_object *dt = lod_comp->llc_stripe[j]; if (dt == NULL) @@ -1148,7 +1148,7 @@ static int lod_declare_attr_set(const struct lu_env *env, */ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) { LASSERT(lo->ldo_stripe); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { if (lo->ldo_stripe[i] == NULL) continue; rc = lod_sub_declare_attr_set(env, lo->ldo_stripe[i], @@ -1237,7 +1237,7 @@ static int lod_attr_set(const struct lu_env *env, */ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) { LASSERT(lo->ldo_stripe); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { if (unlikely(lo->ldo_stripe[i] == NULL)) continue; @@ -1499,8 +1499,8 @@ static int lod_prep_lmv_md(const struct lu_env *env, struct dt_object *dt, ENTRY; LASSERT(lo->ldo_dir_striped != 0); - LASSERT(lo->ldo_dir_stripenr > 0); - stripe_count = lo->ldo_dir_stripenr; + LASSERT(lo->ldo_dir_stripe_count > 0); + stripe_count = lo->ldo_dir_stripe_count; /* Only store the LMV EA heahder on the disk. */ if (info->lti_ea_store_size < sizeof(*lmm1)) { rc = lod_ea_store_resize(info, sizeof(*lmm1)); @@ -1610,7 +1610,7 @@ int lod_parse_dir_striping(const struct lu_env *env, struct lod_object *lo, } out: lo->ldo_stripe = stripe; - lo->ldo_dir_stripenr = le32_to_cpu(lmv1->lmv_stripe_count); + lo->ldo_dir_stripe_count = le32_to_cpu(lmv1->lmv_stripe_count); lo->ldo_dir_stripes_allocated = le32_to_cpu(lmv1->lmv_stripe_count); if (rc != 0) lod_object_free_striping(env, lo); @@ -1671,7 +1671,7 @@ static int lod_dir_declare_create_stripes(const struct lu_env *env, GOTO(out, rc = -EINVAL); rec->rec_type = S_IFDIR; - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { struct dt_object *dto = lo->ldo_stripe[i]; char *stripe_name = info->lti_key; struct lu_name *sname; @@ -1899,10 +1899,10 @@ static int lod_prep_md_striped_create(const struct lu_env *env, lo->ldo_dir_striped = 1; lo->ldo_stripe = stripe; - lo->ldo_dir_stripenr = i; + lo->ldo_dir_stripe_count = i; lo->ldo_dir_stripes_allocated = stripe_count; - if (lo->ldo_dir_stripenr == 0) + if (lo->ldo_dir_stripe_count == 0) GOTO(out_put, rc = -ENOSPC); rc = lod_dir_declare_create_stripes(env, dt, attr, dof, th); @@ -1915,7 +1915,7 @@ out_put: if (stripe[i] != NULL) dt_object_put(env, stripe[i]); OBD_FREE(stripe, sizeof(stripe[0]) * stripe_count); - lo->ldo_dir_stripenr = 0; + lo->ldo_dir_stripe_count = 0; lo->ldo_dir_stripes_allocated = 0; lo->ldo_stripe = NULL; } @@ -2037,10 +2037,10 @@ static int lod_dir_declare_xattr_set(const struct lu_env *env, if (rc != 0) RETURN(rc); - if (lo->ldo_dir_stripenr == 0) + if (lo->ldo_dir_stripe_count == 0) RETURN(0); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { LASSERT(lo->ldo_stripe[i]); rc = lod_sub_declare_xattr_set(env, lo->ldo_stripe[i], @@ -2134,25 +2134,26 @@ static int lod_replace_parent_fid(const struct lu_env *env, data.locd_declare = declare; rc = lod_obj_for_each_stripe(env, lo, th, - lod_obj_stripe_replace_parent_fid_cb, &data); + lod_obj_stripe_replace_parent_fid_cb, + &data); RETURN(rc); } -inline __u16 lod_comp_entry_stripecnt(struct lod_object *lo, - struct lod_layout_component *entry, - bool is_dir) +inline __u16 lod_comp_entry_stripe_count(struct lod_object *lo, + struct lod_layout_component *entry, + bool is_dir) { struct lod_device *lod = lu2lod_dev(lod2lu_obj(lo)->lo_dev); if (is_dir) return 0; else if (lod_comp_inited(entry)) - return entry->llc_stripenr; - else if ((__u16)-1 == entry->llc_stripenr) + return entry->llc_stripe_count; + else if ((__u16)-1 == entry->llc_stripe_count) return lod->lod_desc.ld_tgt_count; else - return lod_get_stripecnt(lod, lo, entry->llc_stripenr); + return lod_get_stripe_count(lod, lo, entry->llc_stripe_count); } static int lod_comp_md_size(struct lod_object *lo, bool is_dir) @@ -2182,16 +2183,16 @@ static int lod_comp_md_size(struct lod_object *lo, bool is_dir) } for (i = 0; i < comp_cnt; i++) { - __u16 stripenr; + __u16 stripe_count; magic = comp_entries[i].llc_pool ? LOV_MAGIC_V3 : LOV_MAGIC_V1; - stripenr = lod_comp_entry_stripecnt(lo, &comp_entries[i], - is_dir); + stripe_count = lod_comp_entry_stripe_count(lo, &comp_entries[i], + is_dir); if (!is_dir && is_composite) - lod_comp_shrink_stripecount(&comp_entries[i], - &stripenr); + lod_comp_shrink_stripe_count(&comp_entries[i], + &stripe_count); - size += lov_user_md_size(stripenr, magic); + size += lov_user_md_size(stripe_count, magic); LASSERT(size % sizeof(__u64) == 0); } return size; @@ -2265,10 +2266,11 @@ static int lod_declare_layout_add(const struct lu_env *env, lod_comp->llc_extent.e_end = ext->e_end; lod_comp->llc_stripe_offset = v1->lmm_stripe_offset; - lod_comp->llc_stripenr = v1->lmm_stripe_count; - if (!lod_comp->llc_stripenr || - lod_comp->llc_stripenr == (__u16)-1) - lod_comp->llc_stripenr = desc->ld_default_stripe_count; + lod_comp->llc_stripe_count = v1->lmm_stripe_count; + if (!lod_comp->llc_stripe_count || + lod_comp->llc_stripe_count == (__u16)-1) + lod_comp->llc_stripe_count = + desc->ld_default_stripe_count; lod_comp->llc_stripe_size = v1->lmm_stripe_size; if (!lod_comp->llc_stripe_size) lod_comp->llc_stripe_size = @@ -2482,8 +2484,8 @@ static int lod_declare_layout_del(const struct lu_env *env, if (lod_comp->llc_stripe == NULL) continue; - LASSERT(lod_comp->llc_stripenr > 0); - for (j = 0; j < lod_comp->llc_stripenr; j++) { + LASSERT(lod_comp->llc_stripe_count > 0); + for (j = 0; j < lod_comp->llc_stripe_count; j++) { struct dt_object *obj = lod_comp->llc_stripe[j]; if (obj == NULL) @@ -2691,10 +2693,10 @@ static int lod_xattr_set_internal(const struct lu_env *env, * it will confuse the fid2path process(see mdt_path_current()). * The linkEA between master and sub-stripes is set in * lod_xattr_set_lmv(). */ - if (lo->ldo_dir_stripenr == 0 || strcmp(name, XATTR_NAME_LINK) == 0) + if (lo->ldo_dir_stripe_count == 0 || strcmp(name, XATTR_NAME_LINK) == 0) RETURN(0); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { LASSERT(lo->ldo_stripe[i]); rc = lod_sub_xattr_set(env, lo->ldo_stripe[i], buf, name, @@ -2733,10 +2735,10 @@ static int lod_xattr_del_internal(const struct lu_env *env, if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr)) RETURN(rc); - if (lo->ldo_dir_stripenr == 0) + if (lo->ldo_dir_stripe_count == 0) RETURN(rc); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { LASSERT(lo->ldo_stripe[i]); rc = lod_sub_xattr_del(env, lo->ldo_stripe[i], name, th); @@ -2913,7 +2915,7 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt, /* The stripes are supposed to be allocated in declare phase, * if there are no stripes being allocated, it will skip */ - if (lo->ldo_dir_stripenr == 0) + if (lo->ldo_dir_stripe_count == 0) RETURN(0); rc = dt_attr_get(env, dt_object_child(dt), attr); @@ -2938,7 +2940,7 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt, slave_lmv_buf.lb_len = sizeof(*slave_lmm); rec->rec_type = S_IFDIR; - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { struct dt_object *dto; char *stripe_name = info->lti_key; struct lu_name *sname; @@ -3069,10 +3071,10 @@ static int lod_dir_striping_create_internal(const struct lu_env *env, lds->lds_def_striping_set || lds->lds_dir_def_striping_set)); - if (!LMVEA_DELETE_VALUES(lo->ldo_dir_stripenr, + if (!LMVEA_DELETE_VALUES(lo->ldo_dir_stripe_count, lo->ldo_dir_stripe_offset)) { struct lmv_user_md_v1 *v1 = info->lti_ea_store; - int stripe_count = lo->ldo_dir_stripenr; + int stripe_count = lo->ldo_dir_stripe_count; if (info->lti_ea_store_size < sizeof(*v1)) { rc = lod_ea_store_resize(info, sizeof(*v1)); @@ -3102,7 +3104,7 @@ static int lod_dir_striping_create_internal(const struct lu_env *env, /* Transfer default LMV striping from the parent */ if (lds != NULL && lds->lds_dir_def_striping_set && - !LMVEA_DELETE_VALUES(lds->lds_dir_def_stripenr, + !LMVEA_DELETE_VALUES(lds->lds_dir_def_stripe_count, lds->lds_dir_def_stripe_offset)) { struct lmv_user_md_v1 *v1 = info->lti_ea_store; @@ -3115,11 +3117,12 @@ static int lod_dir_striping_create_internal(const struct lu_env *env, memset(v1, 0, sizeof(*v1)); v1->lum_magic = cpu_to_le32(LMV_USER_MAGIC); - v1->lum_stripe_count = cpu_to_le32(lds->lds_dir_def_stripenr); + v1->lum_stripe_count = + cpu_to_le32(lds->lds_dir_def_stripe_count); v1->lum_stripe_offset = - cpu_to_le32(lds->lds_dir_def_stripe_offset); + cpu_to_le32(lds->lds_dir_def_stripe_offset); v1->lum_hash_type = - cpu_to_le32(lds->lds_dir_def_hash_type); + cpu_to_le32(lds->lds_dir_def_hash_type); info->lti_buf.lb_buf = v1; info->lti_buf.lb_len = sizeof(*v1); @@ -3274,8 +3277,8 @@ static int lod_layout_del(const struct lu_env *env, struct dt_object *dt, if (lod_comp->llc_stripe == NULL) continue; - LASSERT(lod_comp->llc_stripenr > 0); - for (j = 0; j < lod_comp->llc_stripenr; j++) { + LASSERT(lod_comp->llc_stripe_count > 0); + for (j = 0; j < lod_comp->llc_stripe_count; j++) { struct dt_object *obj = lod_comp->llc_stripe[j]; if (obj == NULL) @@ -3473,10 +3476,10 @@ static int lod_declare_xattr_del(const struct lu_env *env, if (rc != 0) RETURN(rc); - if (lo->ldo_dir_stripenr == 0) + if (lo->ldo_dir_stripe_count == 0) RETURN(0); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { LASSERT(lo->ldo_stripe[i]); rc = lod_sub_declare_xattr_del(env, lo->ldo_stripe[i], name, th); @@ -3511,10 +3514,10 @@ static int lod_xattr_del(const struct lu_env *env, struct dt_object *dt, if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr)) RETURN(rc); - if (lo->ldo_dir_stripenr == 0) + if (lo->ldo_dir_stripe_count == 0) RETURN(0); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { LASSERT(lo->ldo_stripe[i]); rc = lod_sub_xattr_del(env, lo->ldo_stripe[i], name, th); @@ -3641,7 +3644,7 @@ static int lod_get_default_lov_striping(const struct lu_env *env, (int)v1->lmm_stripe_count, (int)v1->lmm_stripe_size, (int)v1->lmm_stripe_offset); - lod_comp->llc_stripenr = v1->lmm_stripe_count; + lod_comp->llc_stripe_count = v1->lmm_stripe_count; lod_comp->llc_stripe_size = v1->lmm_stripe_size; lod_comp->llc_stripe_offset = v1->lmm_stripe_offset; @@ -3688,7 +3691,7 @@ static int lod_get_default_lmv_striping(const struct lu_env *env, v1 = info->lti_ea_store; - lds->lds_dir_def_stripenr = le32_to_cpu(v1->lum_stripe_count); + lds->lds_dir_def_stripe_count = le32_to_cpu(v1->lum_stripe_count); lds->lds_dir_def_stripe_offset = le32_to_cpu(v1->lum_stripe_offset); lds->lds_dir_def_hash_type = le32_to_cpu(v1->lum_hash_type); lds->lds_dir_def_striping_set = 1; @@ -3756,7 +3759,7 @@ static void lod_striping_from_default(struct lod_object *lo, CDEBUG(D_LAYOUT, "Inherite from default: size:%hu " "nr:%u offset:%u %s\n", def_comp->llc_stripe_size, - def_comp->llc_stripenr, + def_comp->llc_stripe_count, def_comp->llc_stripe_offset, def_comp->llc_pool ?: ""); @@ -3778,25 +3781,26 @@ static void lod_striping_from_default(struct lod_object *lo, if (!lo->ldo_is_composite) continue; - if (obj_comp->llc_stripenr <= 0) - obj_comp->llc_stripenr = + if (obj_comp->llc_stripe_count <= 0) + obj_comp->llc_stripe_count = desc->ld_default_stripe_count; if (obj_comp->llc_stripe_size <= 0) obj_comp->llc_stripe_size = desc->ld_default_stripe_size; } } else if (lds->lds_dir_def_striping_set && S_ISDIR(mode)) { - if (lo->ldo_dir_stripenr == 0) - lo->ldo_dir_stripenr = lds->lds_dir_def_stripenr; + if (lo->ldo_dir_stripe_count == 0) + lo->ldo_dir_stripe_count = + lds->lds_dir_def_stripe_count; if (lo->ldo_dir_stripe_offset == -1) lo->ldo_dir_stripe_offset = lds->lds_dir_def_stripe_offset; if (lo->ldo_dir_hash_type == 0) lo->ldo_dir_hash_type = lds->lds_dir_def_hash_type; - CDEBUG(D_LAYOUT, "striping from default dir: nr:%hu, " + CDEBUG(D_LAYOUT, "striping from default dir: count:%hu, " "offset:%u, hash_type:%u\n", - lo->ldo_dir_stripenr, lo->ldo_dir_stripe_offset, + lo->ldo_dir_stripe_count, lo->ldo_dir_stripe_offset, lo->ldo_dir_hash_type); } } @@ -3813,7 +3817,7 @@ static inline bool lod_need_inherit_more(struct lod_object *lo, bool from_root) lod_comp = &lo->ldo_comp_entries[0]; - if (lod_comp->llc_stripenr <= 0 || + if (lod_comp->llc_stripe_count <= 0 || lod_comp->llc_stripe_size <= 0) return true; @@ -3889,15 +3893,15 @@ static void lod_ah_init(const struct lu_env *env, lod_verify_md_striping(d, ah->dah_eadata) == 0) { const struct lmv_user_md_v1 *lum1 = ah->dah_eadata; - lc->ldo_dir_stripenr = + lc->ldo_dir_stripe_count = le32_to_cpu(lum1->lum_stripe_count); lc->ldo_dir_stripe_offset = le32_to_cpu(lum1->lum_stripe_offset); lc->ldo_dir_hash_type = le32_to_cpu(lum1->lum_hash_type); - CDEBUG(D_INFO, "set dir stripe: count %hu, offset %d, " - "hash_type %u\n", - lc->ldo_dir_stripenr, + CDEBUG(D_INFO, + "set dirstripe: count %hu, offset %d, hash %u\n", + lc->ldo_dir_stripe_count, (int)lc->ldo_dir_stripe_offset, lc->ldo_dir_hash_type); } else { @@ -3906,20 +3910,20 @@ static void lod_ah_init(const struct lu_env *env, } /* shrink the stripe_count to the avaible MDT count */ - if (lc->ldo_dir_stripenr > d->lod_remote_mdt_count + 1 && + if (lc->ldo_dir_stripe_count > d->lod_remote_mdt_count + 1 && !OBD_FAIL_CHECK(OBD_FAIL_LARGE_STRIPE)) - lc->ldo_dir_stripenr = d->lod_remote_mdt_count + 1; + lc->ldo_dir_stripe_count = d->lod_remote_mdt_count + 1; /* Directory will be striped only if stripe_count > 1, if - * stripe_count == 1, let's reset stripenr = 0 to avoid + * stripe_count == 1, let's reset stripe_count = 0 to avoid * create single master stripe and also help to unify the * stripe handling of directories and files */ - if (lc->ldo_dir_stripenr == 1) - lc->ldo_dir_stripenr = 0; + if (lc->ldo_dir_stripe_count == 1) + lc->ldo_dir_stripe_count = 0; CDEBUG(D_INFO, "final dir stripe [%hu %d %u]\n", - lc->ldo_dir_stripenr, (int)lc->ldo_dir_stripe_offset, - lc->ldo_dir_hash_type); + lc->ldo_dir_stripe_count, + (int)lc->ldo_dir_stripe_offset, lc->ldo_dir_hash_type); RETURN_EXIT; } @@ -3978,8 +3982,9 @@ static void lod_ah_init(const struct lu_env *env, lod_comp = &lc->ldo_comp_entries[0]; def_comp = &lds->lds_def_comp_entries[0]; - if (lod_comp->llc_stripenr <= 0) - lod_comp->llc_stripenr = def_comp->llc_stripenr; + if (lod_comp->llc_stripe_count <= 0) + lod_comp->llc_stripe_count = + def_comp->llc_stripe_count; if (lod_comp->llc_stripe_size <= 0) lod_comp->llc_stripe_size = def_comp->llc_stripe_size; @@ -4010,8 +4015,9 @@ out: LASSERT(!lc->ldo_is_composite); lod_comp = &lc->ldo_comp_entries[0]; desc = &d->lod_desc; - if (lod_comp->llc_stripenr <= 0) - lod_comp->llc_stripenr = desc->ld_default_stripe_count; + if (lod_comp->llc_stripe_count <= 0) + lod_comp->llc_stripe_count = + desc->ld_default_stripe_count; if (lod_comp->llc_stripe_size <= 0) lod_comp->llc_stripe_size = desc->ld_default_stripe_size; @@ -4045,7 +4051,7 @@ static int lod_declare_init_size(const struct lu_env *env, struct dt_object **objects = NULL; struct lu_attr *attr = &lod_env_info(env)->lti_attr; uint64_t size, offs; - int i, rc, stripe, stripenr = 0, stripe_size = 0; + int i, rc, stripe, stripe_count = 0, stripe_size = 0; ENTRY; if (!lod_obj_is_striped(dt)) @@ -4075,20 +4081,20 @@ static int lod_declare_init_size(const struct lu_env *env, if (!lo->ldo_is_composite || (size >= extent->e_start && size < extent->e_end)) { objects = lod_comp->llc_stripe; - stripenr = lod_comp->llc_stripenr; + stripe_count = lod_comp->llc_stripe_count; stripe_size = lod_comp->llc_stripe_size; break; } } - if (stripenr == 0) + if (stripe_count == 0) RETURN(0); LASSERT(objects != NULL && stripe_size != 0); /* ll_do_div64(a, b) returns a % b, and a = a / b */ ll_do_div64(size, (__u64)stripe_size); - stripe = ll_do_div64(size, (__u64)stripenr); + stripe = ll_do_div64(size, (__u64)stripe_count); LASSERT(objects[stripe] != NULL); size = size * stripe_size; @@ -4326,8 +4332,8 @@ int lod_striped_create(const struct lu_env *env, struct dt_object *dt, if (lod_comp->llc_stripe == NULL) continue; - LASSERT(lod_comp->llc_stripenr); - for (j = 0; j < lod_comp->llc_stripenr; j++) { + LASSERT(lod_comp->llc_stripe_count); + for (j = 0; j < lod_comp->llc_stripe_count; j++) { struct dt_object *object = lod_comp->llc_stripe[j]; LASSERT(object != NULL); rc = lod_sub_create(env, object, attr, NULL, dof, th); @@ -4429,7 +4435,7 @@ static int lod_declare_destroy(const struct lu_env *env, struct dt_object *dt, if (rc != 0) RETURN(rc); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { rc = lod_sub_declare_ref_del(env, next, th); if (rc != 0) RETURN(rc); @@ -4460,7 +4466,7 @@ static int lod_declare_destroy(const struct lu_env *env, struct dt_object *dt, /* declare destroy all striped objects */ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) { - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { if (lo->ldo_stripe[i] == NULL) continue; @@ -4510,7 +4516,7 @@ static int lod_destroy(const struct lu_env *env, struct dt_object *dt, if (rc != 0) RETURN(rc); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { rc = lod_sub_ref_del(env, next, th); if (rc != 0) RETURN(rc); @@ -4543,7 +4549,7 @@ static int lod_destroy(const struct lu_env *env, struct dt_object *dt, /* destroy all striped objects */ if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) { - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { if (lo->ldo_stripe[i] == NULL) continue; if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) || @@ -4689,7 +4695,7 @@ static int lod_object_unlock(const struct lu_env *env, struct dt_object *dt, RETURN(0); LASSERT(S_ISDIR(dt->do_lu.lo_header->loh_attr)); - LASSERT(lo->ldo_dir_stripenr > 1); + LASSERT(lo->ldo_dir_stripe_count > 1); /* Note: for remote lock for single stripe dir, MDT will cancel * the lock by lockh directly */ LASSERT(!dt_object_remote(dt_object_child(dt))); @@ -4744,7 +4750,7 @@ static int lod_object_lock(const struct lu_env *env, GOTO(out, rc); /* No stripes */ - if (lo->ldo_dir_stripenr <= 1) { + if (lo->ldo_dir_stripe_count <= 1) { /* * NB, ei_cbdata stores pointer to slave locks, if no locks * taken, make sure it's set to NULL, otherwise MDT will try to @@ -4754,16 +4760,16 @@ static int lod_object_lock(const struct lu_env *env, GOTO(out, rc = 0); } - slave_locks_size = sizeof(*slave_locks) + lo->ldo_dir_stripenr * + slave_locks_size = sizeof(*slave_locks) + lo->ldo_dir_stripe_count * sizeof(slave_locks->handles[0]); /* Freed in lod_object_unlock */ OBD_ALLOC(slave_locks, slave_locks_size); if (slave_locks == NULL) GOTO(out, rc = -ENOMEM); - slave_locks->count = lo->ldo_dir_stripenr; + slave_locks->count = lo->ldo_dir_stripe_count; /* striped directory lock */ - for (i = 1; i < lo->ldo_dir_stripenr; i++) { + for (i = 1; i < lo->ldo_dir_stripe_count; i++) { struct lustre_handle lockh; struct ldlm_res_id *res_id; @@ -5178,7 +5184,7 @@ void lod_object_free_striping(const struct lu_env *env, struct lod_object *lo) LASSERT(lo->ldo_comp_entries == NULL); LASSERT(lo->ldo_dir_stripes_allocated > 0); - for (i = 0; i < lo->ldo_dir_stripenr; i++) { + for (i = 0; i < lo->ldo_dir_stripe_count; i++) { if (lo->ldo_stripe[i]) dt_object_put(env, lo->ldo_stripe[i]); } @@ -5187,7 +5193,7 @@ void lod_object_free_striping(const struct lu_env *env, struct lod_object *lo) OBD_FREE(lo->ldo_stripe, j); lo->ldo_stripe = NULL; lo->ldo_dir_stripes_allocated = 0; - lo->ldo_dir_stripenr = 0; + lo->ldo_dir_stripe_count = 0; } else if (lo->ldo_comp_entries != NULL) { for (i = 0; i < lo->ldo_comp_cnt; i++) { /* free lod_layout_component::llc_stripe array */ diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index cb3ac44..d42f7d1 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -732,15 +732,15 @@ out: * Return an acceptable stripe count depending on flag LOV_USES_DEFAULT_STRIPE: * all stripes or 3/4 of stripes. * - * \param[in] stripe_cnt number of stripes requested + * \param[in] stripe_count number of stripes requested * \param[in] flags 0 or LOV_USES_DEFAULT_STRIPE * * \retval acceptable stripecount */ -static int min_stripe_count(__u32 stripe_cnt, int flags) +static int min_stripe_count(__u32 stripe_count, int flags) { return (flags & LOV_USES_DEFAULT_STRIPE ? - stripe_cnt - (stripe_cnt / 4) : stripe_cnt); + stripe_count - (stripe_count / 4) : stripe_count); } #define LOV_CREATE_RESEED_MULT 30 @@ -971,16 +971,16 @@ static int lod_alloc_rr(const struct lu_env *env, struct lod_object *lo, struct ost_pool *osts; struct lod_qos_rr *lqr; unsigned int i, array_idx; - __u32 ost_start_idx_temp; - __u32 stripe_idx = 0; - __u32 stripe_cnt, stripe_cnt_min, ost_idx; - int rc, speed = 0, ost_connecting = 0; + __u32 ost_start_idx_temp; + __u32 stripe_idx = 0; + __u32 stripe_count, stripe_count_min, ost_idx; + int rc, speed = 0, ost_connecting = 0; ENTRY; LASSERT(lo->ldo_comp_cnt > comp_idx && lo->ldo_comp_entries != NULL); lod_comp = &lo->ldo_comp_entries[comp_idx]; - stripe_cnt = lod_comp->llc_stripenr; - stripe_cnt_min = min_stripe_count(stripe_cnt, flags); + stripe_count = lod_comp->llc_stripe_count; + stripe_count_min = min_stripe_count(stripe_count, flags); if (lod_comp->llc_pool != NULL) pool = lod_find_pool(m, lod_comp->llc_pool); @@ -998,7 +998,7 @@ static int lod_alloc_rr(const struct lu_env *env, struct lod_object *lo, if (rc) GOTO(out, rc); - rc = lod_qos_ost_in_use_clear(env, stripe_cnt); + rc = lod_qos_ost_in_use_clear(env, stripe_count); if (rc) GOTO(out, rc); @@ -1009,26 +1009,26 @@ static int lod_alloc_rr(const struct lu_env *env, struct lod_object *lo, lqr->lqr_start_count = (LOV_CREATE_RESEED_MIN / max(osts->op_count, 1U) + LOV_CREATE_RESEED_MULT) * max(osts->op_count, 1U); - } else if (stripe_cnt_min >= osts->op_count || + } else if (stripe_count_min >= osts->op_count || lqr->lqr_start_idx > osts->op_count) { /* If we have allocated from all of the OSTs, slowly * precess the next start if the OST/stripe count isn't * already doing this for us. */ lqr->lqr_start_idx %= osts->op_count; - if (stripe_cnt > 1 && (osts->op_count % stripe_cnt) != 1) + if (stripe_count > 1 && (osts->op_count % stripe_count) != 1) ++lqr->lqr_offset_idx; } ost_start_idx_temp = lqr->lqr_start_idx; repeat_find: - QOS_DEBUG("pool '%s' want %d startidx %d startcnt %d offset %d " + QOS_DEBUG("pool '%s' want %d start_idx %d start_count %d offset %d " "active %d count %d\n", lod_comp->llc_pool ? lod_comp->llc_pool : "", - stripe_cnt, lqr->lqr_start_idx, lqr->lqr_start_count, + stripe_count, lqr->lqr_start_idx, lqr->lqr_start_count, lqr->lqr_offset_idx, osts->op_count, osts->op_count); - for (i = 0; i < osts->op_count && stripe_idx < stripe_cnt; i++) { + for (i = 0; i < osts->op_count && stripe_idx < stripe_count; i++) { array_idx = (lqr->lqr_start_idx + lqr->lqr_offset_idx) % osts->op_count; ++lqr->lqr_start_idx; @@ -1055,7 +1055,7 @@ repeat_find: if (rc != 0 && OST_TGT(m, ost_idx)->ltd_connecting) ost_connecting = 1; } - if ((speed < 2) && (stripe_idx < stripe_cnt_min)) { + if ((speed < 2) && (stripe_idx < stripe_count_min)) { /* Try again, allowing slower OSCs */ speed++; lqr->lqr_start_idx = ost_start_idx_temp; @@ -1068,7 +1068,7 @@ repeat_find: up_read(&m->lod_qos.lq_rw_sem); if (stripe_idx) { - lod_comp->llc_stripenr = stripe_idx; + lod_comp->llc_stripe_count = stripe_idx; /* at least one stripe is allocated */ rc = 0; } else { @@ -1133,26 +1133,26 @@ static int lod_alloc_ost_list(const struct lu_env *env, struct lod_object *lo, lod_comp = &lo->ldo_comp_entries[comp_idx]; LASSERT(lod_comp->llc_ostlist.op_array); - rc = lod_qos_ost_in_use_clear(env, lod_comp->llc_stripenr); + rc = lod_qos_ost_in_use_clear(env, lod_comp->llc_stripe_count); if (rc < 0) RETURN(rc); - for (i = 0; i < lod_comp->llc_stripenr; i++) { + for (i = 0; i < lod_comp->llc_stripe_count; i++) { if (lod_comp->llc_ostlist.op_array[i] == lod_comp->llc_stripe_offset) { array_idx = i; break; } } - if (i == lod_comp->llc_stripenr) { + if (i == lod_comp->llc_stripe_count) { CDEBUG(D_OTHER, "%s: start index %d not in the specified list of OSTs\n", lod2obd(m)->obd_name, lod_comp->llc_stripe_offset); RETURN(-EINVAL); } - for (i = 0; i < lod_comp->llc_stripenr; - i++, array_idx = (array_idx + 1) % lod_comp->llc_stripenr) { + for (i = 0; i < lod_comp->llc_stripe_count; + i++, array_idx = (array_idx + 1) % lod_comp->llc_stripe_count) { __u32 ost_idx = lod_comp->llc_ostlist.op_array[array_idx]; if (!cfs_bitmap_check(m->lod_ost_bitmap, ost_idx)) { @@ -1239,7 +1239,7 @@ static int lod_alloc_specific(const struct lu_env *env, struct lod_object *lo, LASSERT(lo->ldo_comp_cnt > comp_idx && lo->ldo_comp_entries != NULL); lod_comp = &lo->ldo_comp_entries[comp_idx]; - rc = lod_qos_ost_in_use_clear(env, lod_comp->llc_stripenr); + rc = lod_qos_ost_in_use_clear(env, lod_comp->llc_stripe_count); if (rc) GOTO(out, rc); @@ -1332,7 +1332,7 @@ repeat_find: stripe_num++; /* We have enough stripes */ - if (stripe_num == lod_comp->llc_stripenr) + if (stripe_num == lod_comp->llc_stripe_count) GOTO(out, rc = 0); } if (speed < 2) { @@ -1347,7 +1347,7 @@ repeat_find: */ CERROR("can't lstripe objid "DFID": have %d want %u\n", PFID(lu_object_fid(lod2lu_obj(lo))), stripe_num, - lod_comp->llc_stripenr); + lod_comp->llc_stripe_count); rc = stripe_num == 0 ? -ENOSPC : -EFBIG; out: if (pool != NULL) { @@ -1438,15 +1438,15 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, struct pool_desc *pool = NULL; struct ost_pool *osts; unsigned int i; - __u32 nfound, good_osts, stripe_cnt, stripe_cnt_min; + __u32 nfound, good_osts, stripe_count, stripe_count_min; int rc = 0; ENTRY; LASSERT(lo->ldo_comp_cnt > comp_idx && lo->ldo_comp_entries != NULL); lod_comp = &lo->ldo_comp_entries[comp_idx]; - stripe_cnt = lod_comp->llc_stripenr; - stripe_cnt_min = min_stripe_count(stripe_cnt, flags); - if (stripe_cnt_min < 1) + stripe_count = lod_comp->llc_stripe_count; + stripe_count_min = min_stripe_count(stripe_count, flags); + if (stripe_count_min < 1) RETURN(-EINVAL); if (lod_comp->llc_pool != NULL) @@ -1477,7 +1477,7 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, if (rc) GOTO(out, rc); - rc = lod_qos_ost_in_use_clear(env, lod_comp->llc_stripenr); + rc = lod_qos_ost_in_use_clear(env, lod_comp->llc_stripe_count); if (rc) GOTO(out, rc); @@ -1514,16 +1514,16 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, QOS_DEBUG("found %d good osts\n", good_osts); - if (good_osts < stripe_cnt_min) + if (good_osts < stripe_count_min) GOTO(out, rc = -EAGAIN); /* We have enough osts */ - if (good_osts < stripe_cnt) - stripe_cnt = good_osts; + if (good_osts < stripe_count) + stripe_count = good_osts; /* Find enough OSTs with weighted random allocation. */ nfound = 0; - while (nfound < stripe_cnt) { + while (nfound < stripe_count) { __u64 rand, cur_weight; cur_weight = 0; @@ -1568,9 +1568,9 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, continue; cur_weight += ost->ltd_qos.ltq_weight; - QOS_DEBUG("stripe_cnt=%d nfound=%d cur_weight=%llu" - " rand=%llu total_weight=%llu\n", - stripe_cnt, nfound, cur_weight, rand, + QOS_DEBUG("stripe_count=%d nfound=%d cur_weight=%llu " + "rand=%llu total_weight=%llu\n", + stripe_count, nfound, cur_weight, rand, total_weight); if (cur_weight < rand) @@ -1605,7 +1605,7 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, } } - if (unlikely(nfound != stripe_cnt)) { + if (unlikely(nfound != stripe_count)) { /* * when the decision to use weighted algorithm was made * we had enough appropriate OSPs, but this state can @@ -1614,7 +1614,7 @@ static int lod_alloc_qos(const struct lu_env *env, struct lod_object *lo, * an object due to just changed state */ QOS_DEBUG("%s: wanted %d objects, found only %d\n", - lod2obd(lod)->obd_name, stripe_cnt, nfound); + lod2obd(lod)->obd_name, stripe_count, nfound); for (i = 0; i < nfound; i++) { LASSERT(stripe[i] != NULL); dt_object_put(env, stripe[i]); @@ -1658,8 +1658,8 @@ out_nolock: * * \retval the maximum usable stripe count */ -__u16 lod_get_stripecnt(struct lod_device *lod, struct lod_object *lo, - __u16 stripe_count) +__u16 lod_get_stripe_count(struct lod_device *lod, struct lod_object *lo, + __u16 stripe_count) { __u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD; @@ -1685,7 +1685,8 @@ __u16 lod_get_stripecnt(struct lod_device *lod, struct lod_object *lo, lod_comp = &lo->ldo_comp_entries[i]; if (lod_comp->llc_flags & LCME_FL_INIT) header_sz += lov_mds_md_size( - lod_comp->llc_stripenr, LOV_MAGIC_V3); + lod_comp->llc_stripe_count, + LOV_MAGIC_V3); } if (easize > header_sz) easize -= header_sz; @@ -1787,7 +1788,7 @@ int lod_use_defined_striping(const struct lu_env *env, lod_comp->llc_pattern = le32_to_cpu(v1->lmm_pattern); lod_comp->llc_stripe_size = le32_to_cpu(v1->lmm_stripe_size); - lod_comp->llc_stripenr = le16_to_cpu(v1->lmm_stripe_count); + lod_comp->llc_stripe_count = le16_to_cpu(v1->lmm_stripe_count); lod_comp->llc_layout_gen = le16_to_cpu(v1->lmm_layout_gen); /** * The stripe_offset of an uninit-ed component is stored in @@ -1969,9 +1970,9 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo, if (v1->lmm_stripe_size) lod_comp->llc_stripe_size = v1->lmm_stripe_size; - lod_comp->llc_stripenr = desc->ld_default_stripe_count; + lod_comp->llc_stripe_count = desc->ld_default_stripe_count; if (v1->lmm_stripe_count) - lod_comp->llc_stripenr = v1->lmm_stripe_count; + lod_comp->llc_stripe_count = v1->lmm_stripe_count; lod_comp->llc_stripe_offset = v1->lmm_stripe_offset; lod_obj_set_pool(lo, i, pool_name); @@ -1998,8 +1999,8 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo, } } - if (lod_comp->llc_stripenr > pool_tgt_count(pool)) - lod_comp->llc_stripenr = pool_tgt_count(pool); + if (lod_comp->llc_stripe_count > pool_tgt_count(pool)) + lod_comp->llc_stripe_count = pool_tgt_count(pool); lod_pool_putref(pool); } @@ -2054,23 +2055,24 @@ int lod_qos_prep_create(const struct lu_env *env, struct lod_object *lo, /* * no striping has been created so far */ - LASSERT(lod_comp->llc_stripenr); + LASSERT(lod_comp->llc_stripe_count); /* * statfs and check OST targets now, since ld_active_tgt_count * could be changed if some OSTs are [de]activated manually. */ lod_qos_statfs_update(env, d); - stripe_len = lod_get_stripecnt(d, lo, lod_comp->llc_stripenr); + stripe_len = lod_get_stripe_count(d, lo, + lod_comp->llc_stripe_count); if (stripe_len == 0) GOTO(out, rc = -ERANGE); - lod_comp->llc_stripenr = stripe_len; + lod_comp->llc_stripe_count = stripe_len; OBD_ALLOC(stripe, sizeof(stripe[0]) * stripe_len); if (stripe == NULL) GOTO(out, rc = -ENOMEM); lod_getref(&d->lod_ost_descs); /* XXX: support for non-0 files w/o objects */ - CDEBUG(D_OTHER, "tgt_count %d stripenr %d\n", + CDEBUG(D_OTHER, "tgt_count %d stripe_count %d\n", d->lod_desc.ld_tgt_count, stripe_len); if (lod_comp->llc_ostlist.op_array) { @@ -2094,7 +2096,7 @@ int lod_qos_prep_create(const struct lu_env *env, struct lod_object *lo, dt_object_put(env, stripe[i]); OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len); - lod_comp->llc_stripenr = 0; + lod_comp->llc_stripe_count = 0; } else { lod_comp->llc_stripe = stripe; lod_comp->llc_stripes_allocated = stripe_len; @@ -2105,7 +2107,7 @@ int lod_qos_prep_create(const struct lu_env *env, struct lod_object *lo, * striping (not a hint), so it allocated all the object * now we need to create them */ - for (i = 0; i < lod_comp->llc_stripenr; i++) { + for (i = 0; i < lod_comp->llc_stripe_count; i++) { struct dt_object *o; o = lod_comp->llc_stripe[i]; @@ -2195,14 +2197,14 @@ int lod_prepare_inuse(const struct lu_env *env, struct lod_object *lo) struct lod_device *d = lu2lod_dev(lod2lu_obj(lo)->lo_dev); struct ost_pool *inuse = &info->lti_inuse_osts; struct lod_obj_stripe_cb_data data; - __u32 stripe_cnt = 0; + __u32 stripe_count = 0; int i; int rc; for (i = 0; i < lo->ldo_comp_cnt; i++) - stripe_cnt += lod_comp_entry_stripecnt(lo, + stripe_count += lod_comp_entry_stripe_count(lo, &lo->ldo_comp_entries[i], false); - rc = lod_inuse_resize(inuse, stripe_cnt, d->lod_osd_max_easize); + rc = lod_inuse_resize(inuse, stripe_count, d->lod_osd_max_easize); if (rc) return rc; @@ -2234,7 +2236,7 @@ int lod_prepare_create(const struct lu_env *env, struct lod_object *lo, RETURN(-EIO); /* - * by this time, the object's ldo_stripenr and ldo_stripe_size + * by this time, the object's ldo_stripe_count and ldo_stripe_size * contain default value for striping: taken from the parent * or from filesystem defaults * diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index f7e9137..b29bb43 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -265,11 +265,10 @@ out_lsme: return ERR_PTR(rc); } -static struct lov_stripe_md * -lsm_unpackmd_v1v3(struct lov_obd *lov, - struct lov_mds_md *lmm, size_t buf_size, - const char *pool_name, - struct lov_ost_data_v1 *objects) +static struct +lov_stripe_md *lsm_unpackmd_v1v3(struct lov_obd *lov, struct lov_mds_md *lmm, + size_t buf_size, const char *pool_name, + struct lov_ost_data_v1 *objects) { struct lov_stripe_md *lsm; struct lov_stripe_md_entry *lsme; @@ -324,8 +323,9 @@ const struct lsm_operations lsm_v1_ops = { .lsm_unpackmd = lsm_unpackmd_v1, }; -static inline struct lov_stripe_md * -lsm_unpackmd_v3(struct lov_obd *lov, void *buf, size_t buf_size) +static inline +struct lov_stripe_md *lsm_unpackmd_v3(struct lov_obd *lov, void *buf, + size_t buf_size) { struct lov_mds_md_v3 *lmm = buf; diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index edbad91..fda1c49 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -271,7 +271,8 @@ void lov_fix_desc_stripe_size(__u64 *val); void lov_fix_desc_stripe_count(__u32 *val); void lov_fix_desc_pattern(__u32 *val); void lov_fix_desc_qos_maxage(__u32 *val); -__u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count); +__u16 lov_get_stripe_count(struct lov_obd *lov, __u32 magic, + __u16 stripe_count); int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, struct obd_connect_data *data); int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 31203b5..671f8ec 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -727,10 +727,10 @@ void lov_fix_desc_qos_maxage(__u32 *val) void lov_fix_desc(struct lov_desc *desc) { - lov_fix_desc_stripe_size(&desc->ld_default_stripe_size); - lov_fix_desc_stripe_count(&desc->ld_default_stripe_count); - lov_fix_desc_pattern(&desc->ld_pattern); - lov_fix_desc_qos_maxage(&desc->ld_qos_maxage); + lov_fix_desc_stripe_size(&desc->ld_default_stripe_size); + lov_fix_desc_stripe_count(&desc->ld_default_stripe_count); + lov_fix_desc_pattern(&desc->ld_pattern); + lov_fix_desc_qos_maxage(&desc->ld_qos_maxage); } int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index e630913..fd07e4a 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -63,7 +63,7 @@ void lov_dump_lmm_common(int level, void *lmmp) } static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod, - int stripe_count) + int stripe_count) { int i; @@ -74,7 +74,7 @@ static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod, } for (i = 0; i < stripe_count; ++i, ++lod) { - struct ost_id oi; + struct ost_id oi; ostid_le_to_cpu(&lod->l_ost_oi, &oi); CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n", i, @@ -91,10 +91,10 @@ void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm) void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm) { - lov_dump_lmm_common(level, lmm); - CDEBUG(level,"pool_name "LOV_POOLNAMEF"\n", lmm->lmm_pool_name); - lov_dump_lmm_objects(level, lmm->lmm_objects, - le16_to_cpu(lmm->lmm_stripe_count)); + lov_dump_lmm_common(level, lmm); + CDEBUG(level, "pool_name "LOV_POOLNAMEF"\n", lmm->lmm_pool_name); + lov_dump_lmm_objects(level, lmm->lmm_objects, + le16_to_cpu(lmm->lmm_stripe_count)); } void lov_dump_lmm(int level, void *lmm) @@ -213,7 +213,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, for (entry = 0; entry < lsm->lsm_entry_count; entry++) { struct lov_stripe_md_entry *lsme; struct lov_mds_md *lmm; - __u16 stripecnt; + __u16 stripe_count; lsme = lsm->lsm_entries[entry]; lcme = &lcmv1->lcm_entries[entry]; @@ -248,11 +248,11 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, if (lsme_inited(lsme) && !(lsme->lsme_pattern & LOV_PATTERN_F_RELEASED)) - stripecnt = lsme->lsme_stripe_count; + stripe_count = lsme->lsme_stripe_count; else - stripecnt = 0; + stripe_count = 0; - for (i = 0; i < stripecnt; i++) { + for (i = 0; i < stripe_count; i++) { struct lov_oinfo *loi = lsme->lsme_oinfo[i]; ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi); @@ -262,7 +262,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, cpu_to_le32(loi->loi_ost_idx); } - size = lov_mds_md_size(stripecnt, lsme->lsme_magic); + size = lov_mds_md_size(stripe_count, lsme->lsme_magic); lcme->lcme_size = cpu_to_le32(size); offset += size; } /* for each layout component */ @@ -271,28 +271,28 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, } /* Find the max stripecount we should use */ -__u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count) +__u16 lov_get_stripe_count(struct lov_obd *lov, __u32 magic, __u16 stripe_count) { - __u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD; - - if (!stripe_count) - stripe_count = lov->desc.ld_default_stripe_count; - if (stripe_count > lov->desc.ld_active_tgt_count) - stripe_count = lov->desc.ld_active_tgt_count; - if (!stripe_count) - stripe_count = 1; - - /* stripe count is based on whether ldiskfs can handle - * larger EA sizes */ - if (lov->lov_ocd.ocd_connect_flags & OBD_CONNECT_MAX_EASIZE && - lov->lov_ocd.ocd_max_easize) + __u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD; + + if (!stripe_count) + stripe_count = lov->desc.ld_default_stripe_count; + if (stripe_count > lov->desc.ld_active_tgt_count) + stripe_count = lov->desc.ld_active_tgt_count; + if (!stripe_count) + stripe_count = 1; + + /* stripe count is based on whether ldiskfs can handle + * larger EA sizes */ + if (lov->lov_ocd.ocd_connect_flags & OBD_CONNECT_MAX_EASIZE && + lov->lov_ocd.ocd_max_easize) max_stripes = lov_mds_md_max_stripe_count( lov->lov_ocd.ocd_max_easize, magic); - if (stripe_count > max_stripes) - stripe_count = max_stripes; + if (stripe_count > max_stripes) + stripe_count = max_stripes; - return stripe_count; + return stripe_count; } int lov_free_memmd(struct lov_stripe_md **lsmp) diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index a48dca8..57cb568 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -153,8 +153,8 @@ lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, int success) ENTRY; if (success) { - __u32 expected_stripes = lov_get_stripecnt(&obd->u.lov, - LOV_MAGIC, 0); + __u32 expected_stripes = lov_get_stripe_count(&obd->u.lov, + LOV_MAGIC, 0); if (osfs->os_files != LOV_U64_MAX) lov_do_div64(osfs->os_files, expected_stripes); if (osfs->os_ffree != LOV_U64_MAX) diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 6cbc258..03147cd 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -365,25 +365,26 @@ static void mdc_ioepoch_pack(struct mdt_ioepoch *epoch, void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data, void *ea, size_t ealen) { - struct mdt_rec_setattr *rec; - struct lov_user_md *lum = NULL; + struct mdt_rec_setattr *rec; + struct lov_user_md *lum = NULL; - CLASSERT(sizeof(struct mdt_rec_reint) ==sizeof(struct mdt_rec_setattr)); - rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); - mdc_setattr_pack_rec(rec, op_data); + CLASSERT(sizeof(struct mdt_rec_reint) == + sizeof(struct mdt_rec_setattr)); + rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); + mdc_setattr_pack_rec(rec, op_data); - if (ealen == 0) - return; + if (ealen == 0) + return; - lum = req_capsule_client_get(&req->rq_pill, &RMF_EADATA); - if (ea == NULL) { /* Remove LOV EA */ + lum = req_capsule_client_get(&req->rq_pill, &RMF_EADATA); + if (ea == NULL) { /* Remove LOV EA */ lum->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V1); - lum->lmm_stripe_size = 0; - lum->lmm_stripe_count = 0; - lum->lmm_stripe_offset = (typeof(lum->lmm_stripe_offset))(-1); - } else { - memcpy(lum, ea, ealen); - } + lum->lmm_stripe_size = 0; + lum->lmm_stripe_count = 0; + lum->lmm_stripe_offset = (typeof(lum->lmm_stripe_offset))(-1); + } else { + memcpy(lum, ea, ealen); + } } void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data) diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 71ec99f..371e7cb 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -1594,25 +1594,25 @@ static int echo_create_md_object(const struct lu_env *env, if (parent == NULL) RETURN(-ENXIO); - memset(ma, 0, sizeof(*ma)); - memset(spec, 0, sizeof(*spec)); - if (stripe_count != 0) { - spec->sp_cr_flags |= FMODE_WRITE; + memset(ma, 0, sizeof(*ma)); + memset(spec, 0, sizeof(*spec)); + if (stripe_count != 0) { + spec->sp_cr_flags |= FMODE_WRITE; echo_set_lmm_size(env, ld, ma); - if (stripe_count != -1) { - struct lov_user_md_v3 *lum = &info->eti_lum; - - lum->lmm_magic = LOV_USER_MAGIC_V3; - lum->lmm_stripe_count = stripe_count; - lum->lmm_stripe_offset = stripe_offset; - lum->lmm_pattern = 0; - spec->u.sp_ea.eadata = lum; + if (stripe_count != -1) { + struct lov_user_md_v3 *lum = &info->eti_lum; + + lum->lmm_magic = LOV_USER_MAGIC_V3; + lum->lmm_stripe_count = stripe_count; + lum->lmm_stripe_offset = stripe_offset; + lum->lmm_pattern = LOV_PATTERN_NONE; + spec->u.sp_ea.eadata = lum; spec->u.sp_ea.eadatalen = sizeof(*lum); - spec->sp_cr_flags |= MDS_OPEN_HAS_EA; - } - } + spec->sp_cr_flags |= MDS_OPEN_HAS_EA; + } + } - ma->ma_attr.la_mode = mode; + ma->ma_attr.la_mode = mode; ma->ma_attr.la_valid = LA_CTIME | LA_MODE; ma->ma_attr.la_ctime = cfs_time_current_64(); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 97c6d0f..32676b0 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1825,16 +1825,16 @@ test_27y() { done # all osp devices get activated, hence -1 stripe count restored - local stripecnt=0 + local stripe_count=0 # sleep 2*lod_qos_maxage seconds waiting for lod qos to notice osp # devices get activated. sleep_maxage $LFS setstripe -c -1 $DIR/$tfile - stripecnt=$($LFS getstripe -c $DIR/$tfile) + stripe_count=$($LFS getstripe -c $DIR/$tfile) rm -f $DIR/$tfile - [ $stripecnt -ne $OSTCOUNT ] && - error "Of $OSTCOUNT OSTs, only $stripecnt is available" + [ $stripe_count -ne $OSTCOUNT ] && + error "Of $OSTCOUNT OSTs, only $stripe_count is available" return 0 } run_test 27y "create files while OST0 is degraded and the rest inactive" @@ -9427,8 +9427,8 @@ test_130d() { [ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] && skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return - local actual_stripecnt=$($GETSTRIPE -c $fm_file) - dd if=/dev/zero of=$fm_file bs=1M count=$actual_stripecnt || + local actual_stripe_count=$($GETSTRIPE -c $fm_file) + dd if=/dev/zero of=$fm_file bs=1M count=$actual_stripe_count || error "dd failed on $fm_file" filefrag -ves $fm_file || error "filefrag $fm_file failed" @@ -9460,7 +9460,7 @@ test_130d() { (( tot_len += ext_len )) last_lun=$frag_lun done - if (( num_luns != actual_stripecnt || tot_len != 1024 )); then + if (( num_luns != actual_stripe_count || tot_len != 1024 )); then cleanup_130 error "FIEMAP on $fm_file failed; returned wrong number of " \ "luns or wrong len for OST $last_lun" @@ -16214,7 +16214,7 @@ test_406() { [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.50) ] && skip "Need MDS version at least 2.8.50" && return - local def_stripenr=$($GETSTRIPE -c $MOUNT) + local def_stripe_count=$($GETSTRIPE -c $MOUNT) local def_stripe_size=$($GETSTRIPE -S $MOUNT) local def_stripe_offset=$($GETSTRIPE -i $MOUNT) local def_pool=$($GETSTRIPE -p $MOUNT) @@ -16269,12 +16269,12 @@ test_406() { # restore FS default striping if [ -z $def_pool ]; then - $SETSTRIPE -c $def_stripenr -S $def_stripe_size \ + $SETSTRIPE -c $def_stripe_count -S $def_stripe_size \ -i $def_stripe_offset $MOUNT || error "restore default striping failed" else - $SETSTRIPE -c $def_stripenr -S $def_stripe_size -p $def_pool \ - -i $def_stripe_offset $MOUNT || + $SETSTRIPE -c $def_stripe_count -S $def_stripe_size \ + -i $def_stripe_offset -p $def_pool $MOUNT || error "restore default striping with $def_pool failed" fi diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 94bb091..130bd7d 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -2493,14 +2493,14 @@ test_51c() { # write something to the file, it should be blocked on fetching layout dd if=/dev/zero of=$DIR2/$tdir/$tfile bs=1k count=1 conv=notrunc - local stripecnt=$($LFS getstripe -c $DIR2/$tdir/$tfile) + local stripe_count=$($LFS getstripe -c $DIR2/$tdir/$tfile) wait $pid # lod_qos.c::min_stripe_count() allows setstripe with a default stripe # count to succeed with only 3/4 of the number of stripes (rounded up), # so creating striped files does not fail if an OST is offline or full - [ $stripecnt -ge $((OSTCOUNT - $OSTCOUNT / 4)) ] || - error "layout wrong: getstripe -c $stripecnt < $OSTCOUNT * 3/4" + [ $stripe_count -ge $((OSTCOUNT - $OSTCOUNT / 4)) ] || + error "bad layout: getstripe -c $stripe_count < $OSTCOUNT * 3/4" rm -fr $DIR1/$tdir } diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index b433549..982f565 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -3659,7 +3659,7 @@ static int cb_find_init(char *path, DIR *parent, DIR **dirp, /* We need to "fake" the "use the default" values * since the lmm struct is zeroed out at this point. */ lmm->lmm_magic = LOV_USER_MAGIC_V1; - lmm->lmm_pattern = 0xFFFFFFFF; + lmm->lmm_pattern = LOV_PATTERN_DEFAULT; if (!param->fp_raw) ostid_set_seq(&lmm->lmm_oi, FID_SEQ_LOV_DEFAULT); -- 1.8.3.1