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 <andreas.dilger@intel.com>
Change-Id: I6056aebc1a381b09c1a436fb4a7986a51f3ebbe5
Reviewed-on: https://review.whamcloud.com/26681
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Steve Guminski <stephenx.guminski@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
16 files changed:
#define LMV_USER_MAGIC 0x0CD30CD0 /*default lmv magic*/
#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
#define LOV_PATTERN_RAID0 0x001
#define LOV_PATTERN_RAID1 0x002
#define LOV_PATTERN_FIRST 0x100
#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_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)
{
static inline bool lov_pattern_supported(__u32 pattern)
{
(struct lov_user_md_v3 *)lmm);
if (S_ISREG(body->mbo_mode))
lustre_swab_lov_user_md_objects(
(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);
}
} else if (lmm->lmm_magic ==
cpu_to_le32(LOV_MAGIC_COMP_V1)) {
lustre_swab_lov_comp_md_v1(
(struct lov_comp_md_v1 *)lmm);
}
- *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,
}
static int ll_lov_setea(struct inode *inode, struct file *file,
__u32 llc_pattern;
__u16 llc_layout_gen;
__u16 llc_stripe_offset;
__u32 llc_pattern;
__u16 llc_layout_gen;
__u16 llc_stripe_offset;
+ __u16 llc_stripe_count;
__u16 llc_stripes_allocated;
char *llc_pool;
/* ost list specified with LOV_USER_MAGIC_SPECIFIC lum */
__u16 llc_stripes_allocated;
char *llc_pool;
/* ost list specified with LOV_USER_MAGIC_SPECIFIC lum */
__u32 lds_def_comp_size_cnt;
struct lod_layout_component *lds_def_comp_entries;
/* default LMV */
__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) */
__u32 lds_dir_def_stripe_offset;
__u32 lds_dir_def_hash_type;
/* default file striping flags (LOV) */
+ /* common fields for both files and directories */
struct dt_object ldo_obj;
union {
/* file stripe (LOV) */
struct dt_object ldo_obj;
union {
/* file stripe (LOV) */
/* directory stripe (LMV) */
struct {
/* Slave stripe count for striped directory. */
/* 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;
/* How many stripes allocated for a striped directory */
__u16 ldo_dir_stripes_allocated;
__u32 ldo_dir_stripe_offset;
};
/* file stripe (LOV) */
struct lod_layout_component *ldo_comp_entries;
};
/* 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;
};
struct dt_object **ldo_stripe;
};
return false;
if (S_ISDIR(dt->do_lu.lo_header->loh_attr))
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;
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;
return true;
}
return false;
* save the specified OST index list.
*/
static inline void
* 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
{
/**
* Need one lov_ost_data_v1 to store invalid ost_idx, please refer to
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);
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);
/* lproc_lod.c */
int lod_procfs_init(struct lod_device *lod);
struct lov_ost_data_v1 *objs;
struct lod_layout_component *lod_comp;
__u32 magic;
struct lov_ost_data_v1 *objs;
struct lod_layout_component *lod_comp;
__u32 magic;
lmm_oi_cpu_to_le(&lmm->lmm_oi, &lmm->lmm_oi);
lmm->lmm_stripe_size = cpu_to_le32(lod_comp->llc_stripe_size);
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.
/**
* for dir and uninstantiated component, lmm_layout_gen stores
* default stripe offset.
RETURN(-E2BIG);
objs = &v3->lmm_objects[0];
}
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)
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);
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;
struct dt_object *object;
__u32 ost_idx = (__u32)-1UL;
int type = LU_SEQ_RANGE_OST;
}
done:
if (lmm_size != NULL)
}
done:
if (lmm_size != NULL)
- *lmm_size = lov_mds_md_size(stripecnt, magic);
+ *lmm_size = lov_mds_md_size(stripe_count, magic);
* Instantiate objects for stripes.
*
* Allocate and initialize LU-objects representing the stripes. The number
* 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.
* 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.
lod_comp = &lo->ldo_comp_entries[comp_idx];
LASSERT(lod_comp->llc_stripe == NULL);
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);
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);
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;
if (unlikely(lovea_slot_is_dummy(&objs[i])))
continue;
dt_object_put(env, stripe[i]);
OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len);
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;
} else {
lod_comp->llc_stripe = stripe;
lod_comp->llc_stripes_allocated = stripe_len;
lod_comp->llc_pattern = pattern;
lod_comp->llc_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
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) {
lod_comp->llc_layout_gen = le16_to_cpu(lmm->lmm_layout_gen);
if (magic == LOV_MAGIC_V3) {
* used in lod_alloc_ost_list().
*/
lod_comp->llc_ostlist.op_count =
* 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_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);
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);
lod_comp->llc_ostlist.op_array[j] =
le32_to_cpu(objs[j].l_ost_idx);
}
/* the user uses "0" for default stripe pattern normally. */
}
/* 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))) {
lum->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0);
if (!lov_pattern_supported(le32_to_cpu(lum->lmm_pattern))) {
struct dt_it *it_next;
ENTRY;
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);
next = lo->ldo_stripe[0];
LASSERT(next != NULL);
LASSERT(next->do_index_ops != NULL);
do { \
LASSERT((it)->lit_obj != NULL); \
LASSERT((it)->lit_it != NULL); \
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); \
}
/* go to next stripe */
}
/* 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++;
RETURN(1);
it->lit_stripe_index++;
- if (lo->ldo_dir_stripenr > 0) {
+ if (lo->ldo_dir_stripe_count > 0) {
- 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,
if (dt_object_exists(lo->ldo_stripe[i]) == 0)
continue;
rc = lo->ldo_stripe[i]->do_ops->do_index_try(env,
if (lod_comp->llc_stripe == NULL)
continue;
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)
struct dt_object *dt = lod_comp->llc_stripe[j];
if (dt == NULL)
*/
if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
LASSERT(lo->ldo_stripe);
*/
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],
if (lo->ldo_stripe[i] == NULL)
continue;
rc = lod_sub_declare_attr_set(env, lo->ldo_stripe[i],
*/
if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
LASSERT(lo->ldo_stripe);
*/
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;
if (unlikely(lo->ldo_stripe[i] == NULL))
continue;
ENTRY;
LASSERT(lo->ldo_dir_striped != 0);
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));
/* 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));
}
out:
lo->ldo_stripe = stripe;
}
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);
lo->ldo_dir_stripes_allocated = le32_to_cpu(lmv1->lmv_stripe_count);
if (rc != 0)
lod_object_free_striping(env, lo);
GOTO(out, rc = -EINVAL);
rec->rec_type = S_IFDIR;
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;
struct dt_object *dto = lo->ldo_stripe[i];
char *stripe_name = info->lti_key;
struct lu_name *sname;
lo->ldo_dir_striped = 1;
lo->ldo_stripe = stripe;
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;
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);
GOTO(out_put, rc = -ENOSPC);
rc = lod_dir_declare_create_stripes(env, dt, attr, dof, th);
if (stripe[i] != NULL)
dt_object_put(env, stripe[i]);
OBD_FREE(stripe, sizeof(stripe[0]) * stripe_count);
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;
}
lo->ldo_dir_stripes_allocated = 0;
lo->ldo_stripe = NULL;
}
- if (lo->ldo_dir_stripenr == 0)
+ if (lo->ldo_dir_stripe_count == 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],
LASSERT(lo->ldo_stripe[i]);
rc = lod_sub_declare_xattr_set(env, lo->ldo_stripe[i],
data.locd_declare = declare;
rc = lod_obj_for_each_stripe(env, lo, th,
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);
-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))
{
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->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)
}
static int lod_comp_md_size(struct lod_object *lo, bool is_dir)
}
for (i = 0; i < comp_cnt; i++) {
}
for (i = 0; i < comp_cnt; i++) {
magic = comp_entries[i].llc_pool ? LOV_MAGIC_V3 : LOV_MAGIC_V1;
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)
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;
LASSERT(size % sizeof(__u64) == 0);
}
return size;
lod_comp->llc_extent.e_end = ext->e_end;
lod_comp->llc_stripe_offset = v1->lmm_stripe_offset;
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 =
lod_comp->llc_stripe_size = v1->lmm_stripe_size;
if (!lod_comp->llc_stripe_size)
lod_comp->llc_stripe_size =
if (lod_comp->llc_stripe == NULL)
continue;
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)
struct dt_object *obj = lod_comp->llc_stripe[j];
if (obj == NULL)
* it will confuse the fid2path process(see mdt_path_current()).
* The linkEA between master and sub-stripes is set in
* lod_xattr_set_lmv(). */
* 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)
- 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,
LASSERT(lo->ldo_stripe[i]);
rc = lod_sub_xattr_set(env, lo->ldo_stripe[i], buf, name,
if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr))
RETURN(rc);
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)
- 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);
LASSERT(lo->ldo_stripe[i]);
rc = lod_sub_xattr_del(env, lo->ldo_stripe[i], name, th);
/* The stripes are supposed to be allocated in declare phase,
* if there are no stripes being allocated, it will skip */
/* 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);
RETURN(0);
rc = dt_attr_get(env, dt_object_child(dt), attr);
slave_lmv_buf.lb_len = sizeof(*slave_lmm);
rec->rec_type = S_IFDIR;
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;
struct dt_object *dto;
char *stripe_name = info->lti_key;
struct lu_name *sname;
lds->lds_def_striping_set ||
lds->lds_dir_def_striping_set));
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;
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));
if (info->lti_ea_store_size < sizeof(*v1)) {
rc = lod_ea_store_resize(info, sizeof(*v1));
/* Transfer default LMV striping from the parent */
if (lds != NULL && lds->lds_dir_def_striping_set &&
/* 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;
lds->lds_dir_def_stripe_offset)) {
struct lmv_user_md_v1 *v1 = info->lti_ea_store;
memset(v1, 0, sizeof(*v1));
v1->lum_magic = cpu_to_le32(LMV_USER_MAGIC);
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);
- cpu_to_le32(lds->lds_dir_def_stripe_offset);
+ cpu_to_le32(lds->lds_dir_def_stripe_offset);
- 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);
info->lti_buf.lb_buf = v1;
info->lti_buf.lb_len = sizeof(*v1);
if (lod_comp->llc_stripe == NULL)
continue;
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)
struct dt_object *obj = lod_comp->llc_stripe[j];
if (obj == NULL)
- if (lo->ldo_dir_stripenr == 0)
+ if (lo->ldo_dir_stripe_count == 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);
LASSERT(lo->ldo_stripe[i]);
rc = lod_sub_declare_xattr_del(env, lo->ldo_stripe[i],
name, th);
if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr))
RETURN(rc);
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)
- 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);
LASSERT(lo->ldo_stripe[i]);
rc = lod_sub_xattr_del(env, lo->ldo_stripe[i], name, th);
(int)v1->lmm_stripe_count, (int)v1->lmm_stripe_size,
(int)v1->lmm_stripe_offset);
(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;
lod_comp->llc_stripe_size = v1->lmm_stripe_size;
lod_comp->llc_stripe_offset = v1->lmm_stripe_offset;
- 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;
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;
CDEBUG(D_LAYOUT, "Inherite from default: size:%hu "
"nr:%u offset:%u %s\n",
def_comp->llc_stripe_size,
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 ?: "");
def_comp->llc_stripe_offset,
def_comp->llc_pool ?: "");
if (!lo->ldo_is_composite)
continue;
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)) {
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;
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",
"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);
}
}
lo->ldo_dir_hash_type);
}
}
lod_comp = &lo->ldo_comp_entries[0];
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;
lod_comp->llc_stripe_size <= 0)
return true;
lod_verify_md_striping(d, ah->dah_eadata) == 0) {
const struct lmv_user_md_v1 *lum1 = ah->dah_eadata;
lod_verify_md_striping(d, ah->dah_eadata) == 0) {
const struct lmv_user_md_v1 *lum1 = ah->dah_eadata;
+ 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);
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 {
(int)lc->ldo_dir_stripe_offset,
lc->ldo_dir_hash_type);
} else {
}
/* shrink the stripe_count to the avaible MDT count */
}
/* 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))
!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
/* 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 */
* 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",
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);
lod_comp = &lc->ldo_comp_entries[0];
def_comp = &lds->lds_def_comp_entries[0];
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;
if (lod_comp->llc_stripe_size <= 0)
lod_comp->llc_stripe_size =
def_comp->llc_stripe_size;
LASSERT(!lc->ldo_is_composite);
lod_comp = &lc->ldo_comp_entries[0];
desc = &d->lod_desc;
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;
if (lod_comp->llc_stripe_size <= 0)
lod_comp->llc_stripe_size =
desc->ld_default_stripe_size;
struct dt_object **objects = NULL;
struct lu_attr *attr = &lod_env_info(env)->lti_attr;
uint64_t size, offs;
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))
ENTRY;
if (!lod_obj_is_striped(dt))
if (!lo->ldo_is_composite ||
(size >= extent->e_start && size < extent->e_end)) {
objects = lod_comp->llc_stripe;
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;
}
}
stripe_size = lod_comp->llc_stripe_size;
break;
}
}
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);
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;
LASSERT(objects[stripe] != NULL);
size = size * stripe_size;
if (lod_comp->llc_stripe == NULL)
continue;
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);
struct dt_object *object = lod_comp->llc_stripe[j];
LASSERT(object != NULL);
rc = lod_sub_create(env, object, attr, NULL, dof, th);
- 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);
rc = lod_sub_declare_ref_del(env, next, th);
if (rc != 0)
RETURN(rc);
/* declare destroy all striped objects */
if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
/* 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;
if (lo->ldo_stripe[i] == NULL)
continue;
- 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);
rc = lod_sub_ref_del(env, next, th);
if (rc != 0)
RETURN(rc);
/* destroy all striped objects */
if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
/* 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) ||
if (lo->ldo_stripe[i] == NULL)
continue;
if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) ||
RETURN(0);
LASSERT(S_ISDIR(dt->do_lu.lo_header->loh_attr));
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)));
/* Note: for remote lock for single stripe dir, MDT will cancel
* the lock by lockh directly */
LASSERT(!dt_object_remote(dt_object_child(dt)));
GOTO(out, rc);
/* No stripes */
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
/*
* NB, ei_cbdata stores pointer to slave locks, if no locks
* taken, make sure it's set to NULL, otherwise MDT will try to
- 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);
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 */
/* 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;
struct lustre_handle lockh;
struct ldlm_res_id *res_id;
LASSERT(lo->ldo_comp_entries == NULL);
LASSERT(lo->ldo_dir_stripes_allocated > 0);
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]);
}
if (lo->ldo_stripe[i])
dt_object_put(env, lo->ldo_stripe[i]);
}
OBD_FREE(lo->ldo_stripe, j);
lo->ldo_stripe = NULL;
lo->ldo_dir_stripes_allocated = 0;
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 */
} else if (lo->ldo_comp_entries != NULL) {
for (i = 0; i < lo->ldo_comp_cnt; i++) {
/* free lod_layout_component::llc_stripe array */
* Return an acceptable stripe count depending on flag LOV_USES_DEFAULT_STRIPE:
* all stripes or 3/4 of stripes.
*
* 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
*/
* \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 ?
{
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
}
#define LOV_CREATE_RESEED_MULT 30
struct ost_pool *osts;
struct lod_qos_rr *lqr;
unsigned int i, array_idx;
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];
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);
if (lod_comp->llc_pool != NULL)
pool = lod_find_pool(m, lod_comp->llc_pool);
- rc = lod_qos_ost_in_use_clear(env, stripe_cnt);
+ rc = lod_qos_ost_in_use_clear(env, stripe_count);
lqr->lqr_start_count =
(LOV_CREATE_RESEED_MIN / max(osts->op_count, 1U) +
LOV_CREATE_RESEED_MULT) * max(osts->op_count, 1U);
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;
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:
++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 : "",
"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);
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;
array_idx = (lqr->lqr_start_idx + lqr->lqr_offset_idx) %
osts->op_count;
++lqr->lqr_start_idx;
if (rc != 0 && OST_TGT(m, ost_idx)->ltd_connecting)
ost_connecting = 1;
}
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;
/* Try again, allowing slower OSCs */
speed++;
lqr->lqr_start_idx = ost_start_idx_temp;
up_read(&m->lod_qos.lq_rw_sem);
if (stripe_idx) {
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 {
/* at least one stripe is allocated */
rc = 0;
} else {
lod_comp = &lo->ldo_comp_entries[comp_idx];
LASSERT(lod_comp->llc_ostlist.op_array);
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);
- 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 (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);
}
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)) {
__u32 ost_idx = lod_comp->llc_ostlist.op_array[array_idx];
if (!cfs_bitmap_check(m->lod_ost_bitmap, ost_idx)) {
LASSERT(lo->ldo_comp_cnt > comp_idx && lo->ldo_comp_entries != NULL);
lod_comp = &lo->ldo_comp_entries[comp_idx];
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);
stripe_num++;
/* We have enough stripes */
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) {
GOTO(out, rc = 0);
}
if (speed < 2) {
*/
CERROR("can't lstripe objid "DFID": have %d want %u\n",
PFID(lu_object_fid(lod2lu_obj(lo))), stripe_num,
*/
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) {
rc = stripe_num == 0 ? -ENOSPC : -EFBIG;
out:
if (pool != NULL) {
struct pool_desc *pool = NULL;
struct ost_pool *osts;
unsigned int i;
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];
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)
RETURN(-EINVAL);
if (lod_comp->llc_pool != NULL)
- 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);
QOS_DEBUG("found %d good osts\n", good_osts);
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 */
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;
/* Find enough OSTs with weighted random allocation. */
nfound = 0;
- while (nfound < stripe_cnt) {
+ while (nfound < stripe_count) {
__u64 rand, cur_weight;
cur_weight = 0;
__u64 rand, cur_weight;
cur_weight = 0;
continue;
cur_weight += ost->ltd_qos.ltq_weight;
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)
total_weight);
if (cur_weight < rand)
- 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
/*
* when the decision to use weighted algorithm was made
* we had enough appropriate OSPs, but this state can
* an object due to just changed state
*/
QOS_DEBUG("%s: wanted %d objects, found only %d\n",
* 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]);
for (i = 0; i < nfound; i++) {
LASSERT(stripe[i] != NULL);
dt_object_put(env, stripe[i]);
*
* \retval the maximum usable stripe count
*/
*
* \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;
{
__u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD;
lod_comp = &lo->ldo_comp_entries[i];
if (lod_comp->llc_flags & LCME_FL_INIT)
header_sz += lov_mds_md_size(
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;
}
if (easize > header_sz)
easize -= header_sz;
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_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
lod_comp->llc_layout_gen = le16_to_cpu(v1->lmm_layout_gen);
/**
* The stripe_offset of an uninit-ed component is stored in
if (v1->lmm_stripe_size)
lod_comp->llc_stripe_size = v1->lmm_stripe_size;
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)
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);
lod_comp->llc_stripe_offset = v1->lmm_stripe_offset;
lod_obj_set_pool(lo, i, pool_name);
- 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);
/*
* no striping has been created so far
*/
/*
* 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);
/*
* 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);
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 */
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) {
d->lod_desc.ld_tgt_count, stripe_len);
if (lod_comp->llc_ostlist.op_array) {
dt_object_put(env, stripe[i]);
OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len);
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;
} else {
lod_comp->llc_stripe = stripe;
lod_comp->llc_stripes_allocated = stripe_len;
* striping (not a hint), so it allocated all the object
* now we need to create them
*/
* 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];
struct dt_object *o;
o = lod_comp->llc_stripe[i];
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;
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_count = 0;
int i;
int rc;
for (i = 0; i < lo->ldo_comp_cnt; i++)
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);
&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);
- * 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
*
* contain default value for striping: taken from the parent
* or from filesystem defaults
*
-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;
{
struct lov_stripe_md *lsm;
struct lov_stripe_md_entry *lsme;
.lsm_unpackmd = lsm_unpackmd_v1,
};
.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;
{
struct lov_mds_md_v3 *lmm = buf;
void lov_fix_desc_stripe_count(__u32 *val);
void lov_fix_desc_pattern(__u32 *val);
void lov_fix_desc_qos_maxage(__u32 *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);
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);
void lov_fix_desc(struct lov_desc *desc)
{
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)
}
int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
}
static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod,
}
static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod,
}
for (i = 0; i < stripe_count; ++i, ++lod) {
}
for (i = 0; i < stripe_count; ++i, ++lod) {
ostid_le_to_cpu(&lod->l_ost_oi, &oi);
CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n", i,
ostid_le_to_cpu(&lod->l_ost_oi, &oi);
CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n", i,
void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *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)
}
void lov_dump_lmm(int level, void *lmm)
for (entry = 0; entry < lsm->lsm_entry_count; entry++) {
struct lov_stripe_md_entry *lsme;
struct lov_mds_md *lmm;
for (entry = 0; entry < lsm->lsm_entry_count; entry++) {
struct lov_stripe_md_entry *lsme;
struct lov_mds_md *lmm;
lsme = lsm->lsm_entries[entry];
lcme = &lcmv1->lcm_entries[entry];
lsme = lsm->lsm_entries[entry];
lcme = &lcmv1->lcm_entries[entry];
if (lsme_inited(lsme) &&
!(lsme->lsme_pattern & LOV_PATTERN_F_RELEASED))
if (lsme_inited(lsme) &&
!(lsme->lsme_pattern & LOV_PATTERN_F_RELEASED))
- stripecnt = lsme->lsme_stripe_count;
+ stripe_count = lsme->lsme_stripe_count;
- 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);
struct lov_oinfo *loi = lsme->lsme_oinfo[i];
ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi);
cpu_to_le32(loi->loi_ost_idx);
}
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 */
lcme->lcme_size = cpu_to_le32(size);
offset += size;
} /* for each layout component */
}
/* Find the max stripecount we should use */
}
/* 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);
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;
}
int lov_free_memmd(struct lov_stripe_md **lsmp)
}
int lov_free_memmd(struct lov_stripe_md **lsmp)
- __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)
if (osfs->os_files != LOV_U64_MAX)
lov_do_div64(osfs->os_files, expected_stripes);
if (osfs->os_ffree != LOV_U64_MAX)
void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
void *ea, size_t ealen)
{
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_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)
}
void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
if (parent == NULL)
RETURN(-ENXIO);
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);
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->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();
ma->ma_attr.la_valid = LA_CTIME | LA_MODE;
ma->ma_attr.la_ctime = cfs_time_current_64();
done
# all osp devices get activated, hence -1 stripe count restored
done
# all osp devices get activated, hence -1 stripe count restored
# sleep 2*lod_qos_maxage seconds waiting for lod qos to notice osp
# devices get activated.
sleep_maxage
$LFS setstripe -c -1 $DIR/$tfile
# 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)
- [ $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"
return 0
}
run_test 27y "create files while OST0 is degraded and the rest inactive"
[ "$(facet_fstype ost$(($($GETSTRIPE -i $fm_file) + 1)))" = "zfs" ] &&
skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return
[ "$(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"
error "dd failed on $fm_file"
filefrag -ves $fm_file || error "filefrag $fm_file failed"
(( tot_len += ext_len ))
last_lun=$frag_lun
done
(( 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"
cleanup_130
error "FIEMAP on $fm_file failed; returned wrong number of " \
"luns or wrong len for OST $last_lun"
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.50) ] &&
skip "Need MDS version at least 2.8.50" && return
[ $(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)
local def_stripe_size=$($GETSTRIPE -S $MOUNT)
local def_stripe_offset=$($GETSTRIPE -i $MOUNT)
local def_pool=$($GETSTRIPE -p $MOUNT)
# restore FS default striping
if [ -z $def_pool ]; then
# 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
-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
error "restore default striping with $def_pool failed"
fi
# 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
# 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
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"
/* 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;
/* 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);
if (!param->fp_raw)
ostid_set_seq(&lmm->lmm_oi,
FID_SEQ_LOV_DEFAULT);