Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
50d4411
)
LU-18461 lod: convert a lti_ea_store to the lu_buf
87/57187/8
author
Alexey Lyashkov
<alexey.lyashkov@hpe.com>
Wed, 20 Nov 2024 08:33:12 +0000
(11:33 +0300)
committer
Oleg Drokin
<green@whamcloud.com>
Sat, 7 Jun 2025 22:54:52 +0000
(22:54 +0000)
lti_ea_store + lti_ea_store_size is same as lu_buf,
lets reuse code.
Signed-off-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Change-Id: I61334247288736286937eeb0bb3afee0638c28bb
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57187
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_dev.c
patch
|
blob
|
history
lustre/lod/lod_internal.h
patch
|
blob
|
history
lustre/lod/lod_lov.c
patch
|
blob
|
history
lustre/lod/lod_object.c
patch
|
blob
|
history
lustre/lod/lod_qos.c
patch
|
blob
|
history
diff --git
a/lustre/lod/lod_dev.c
b/lustre/lod/lod_dev.c
index
160f05d
..
aeb44f9
100644
(file)
--- a/
lustre/lod/lod_dev.c
+++ b/
lustre/lod/lod_dev.c
@@
-2337,11
+2337,7
@@
static void lod_key_fini(const struct lu_context *ctx,
* XXX: this is overload, a tread may have such store but used only
* once. Probably better would be pool of such stores per LOD.
*/
- if (info->lti_ea_store) {
- OBD_FREE_LARGE(info->lti_ea_store, info->lti_ea_store_size);
- info->lti_ea_store = NULL;
- info->lti_ea_store_size = 0;
- }
+ lu_buf_free(&info->lti_ea_buf);
lu_buf_free(&info->lti_linkea_buf);
if (lds)
diff --git
a/lustre/lod/lod_internal.h
b/lustre/lod/lod_internal.h
index
98b4ca2
..
449ee8e
100644
(file)
--- a/
lustre/lod/lod_internal.h
+++ b/
lustre/lod/lod_internal.h
@@
-392,8
+392,7
@@
struct lod_it {
#define LOD_OBJS_INTRANS 4
struct lod_thread_info {
/* per-thread buffer for LOV EA, may be vmalloc'd */
- void *lti_ea_store;
- __u32 lti_ea_store_size;
+ struct lu_buf lti_ea_buf;
/* per-thread buffer for LMV EA */
struct lu_buf lti_buf;
struct ost_id lti_ostid;
@@
-428,6
+427,9
@@
struct lod_thread_info {
__u32 lti_gen[LOD_OBJS_INTRANS];
};
+#define lti_ea_store lti_ea_buf.lb_buf
+#define lti_ea_store_size lti_ea_buf.lb_len
+
/**
* \retval 0 object's layout hasn't changed in the transaction
* \retval > 0 object's layout has changed
diff --git
a/lustre/lod/lod_lov.c
b/lustre/lod/lod_lov.c
index
02adb97
..
0c83bae
100644
(file)
--- a/
lustre/lod/lod_lov.c
+++ b/
lustre/lod/lod_lov.c
@@
-431,19
+431,9
@@
int lod_ea_store_resize(struct lod_thread_info *info, size_t size)
{
__u32 round = size_roundup_power2(size);
- if (info->lti_ea_store) {
- LASSERT(info->lti_ea_store_size);
- CDEBUG(D_INFO, "EA store size %d is not enough, need %d\n",
- info->lti_ea_store_size, round);
- OBD_FREE_LARGE(info->lti_ea_store, info->lti_ea_store_size);
- info->lti_ea_store = NULL;
- info->lti_ea_store_size = 0;
- }
-
- OBD_ALLOC_LARGE(info->lti_ea_store, round);
- if (info->lti_ea_store == NULL)
+ lu_buf_check_and_alloc(&info->lti_ea_buf, round);
+ if (info->lti_ea_buf.lb_buf == NULL)
RETURN(-ENOMEM);
- info->lti_ea_store_size = round;
RETURN(0);
}
@@
-1018,7
+1008,7
@@
out:
* @lo: LOD object
* @name: name of the EA
*
- * Fill lti_ea_
store
buffer in the environment with a value for the given
+ * Fill lti_ea_
buf
buffer in the environment with a value for the given
* EA. The buffer is reallocated if the value doesn't fit.
*
* Return:
@@
-1036,13
+1026,12
@@
int lod_get_ea(const struct lu_env *env, struct lod_object *lo,
LASSERT(info);
- if (unlikely(info->lti_ea_
store
== NULL)) {
+ if (unlikely(info->lti_ea_
buf.lb_buf
== NULL)) {
/* just to enter in allocation block below */
rc = -ERANGE;
} else {
repeat:
- info->lti_buf.lb_buf = info->lti_ea_store;
- info->lti_buf.lb_len = info->lti_ea_store_size;
+ info->lti_buf = info->lti_ea_buf;
rc = dt_xattr_get(env, next, &info->lti_buf, name);
}
@@
-1616,8
+1605,7
@@
int lod_striping_load(const struct lu_env *env, struct lod_object *lo)
* there is LOV EA (striping information) in this object
* let's parse it and create in-core objects for the stripes
*/
- buf->lb_buf = info->lti_ea_store;
- buf->lb_len = info->lti_ea_store_size;
+ *buf = info->lti_ea_buf;
rc = lod_parse_striping(env, lo, buf, 0);
if (rc == 0)
lo->ldo_comp_cached = 1;
@@
-1625,14
+1613,13
@@
int lod_striping_load(const struct lu_env *env, struct lod_object *lo)
rc = lod_get_lmv_ea(env, lo);
if (rc > (int)sizeof(struct lmv_foreign_md)) {
- struct lmv_foreign_md *lfm = info->lti_ea_
store
;
+ struct lmv_foreign_md *lfm = info->lti_ea_
buf.lb_buf
;
if (le32_to_cpu(lfm->lfm_magic) == LMV_MAGIC_FOREIGN) {
- lo->ldo_foreign_lmv = info->lti_ea_
store
;
+ lo->ldo_foreign_lmv = info->lti_ea_
buf.lb_buf
;
lo->ldo_foreign_lmv_size =
- info->lti_ea_store_size;
- info->lti_ea_store = NULL;
- info->lti_ea_store_size = 0;
+ info->lti_ea_buf.lb_len;
+ info->lti_ea_buf = LU_BUF_NULL;
lo->ldo_dir_stripe_loaded = 1;
lo->ldo_is_foreign = 1;
@@
-1649,15
+1636,12
@@
int lod_striping_load(const struct lu_env *env, struct lod_object *lo)
lo->ldo_dir_stripe_loaded = 1;
GOTO(unlock, rc = rc > 0 ? -EINVAL : rc);
}
- buf->lb_buf = info->lti_ea_store;
- buf->lb_len = info->lti_ea_store_size;
+ *buf = info->lti_ea_buf;
if (rc == sizeof(struct lmv_mds_md_v1)) {
rc = lod_load_lmv_shards(env, lo, buf, true);
- if (buf->lb_buf != info->lti_ea_store) {
- OBD_FREE_LARGE(info->lti_ea_store,
- info->lti_ea_store_size);
- info->lti_ea_store = buf->lb_buf;
- info->lti_ea_store_size = buf->lb_len;
+ if (buf->lb_buf != info->lti_ea_buf.lb_buf) {
+ lu_buf_free(&info->lti_ea_buf);
+ info->lti_ea_buf = *buf;
}
if (rc < 0)
diff --git
a/lustre/lod/lod_object.c
b/lustre/lod/lod_object.c
index
ee217b5
..
aa11bae
100644
(file)
--- a/
lustre/lod/lod_object.c
+++ b/
lustre/lod/lod_object.c
@@
-1306,8
+1306,7
@@
static int lod_declare_attr_set(const struct lu_env *env,
struct lod_thread_info *info = lod_env_info(env);
struct lu_buf *buf = &info->lti_buf;
- buf->lb_buf = info->lti_ea_store;
- buf->lb_len = info->lti_ea_store_size;
+ *buf = info->lti_ea_buf;
rc = lod_sub_declare_xattr_set(env, next, buf, XATTR_NAME_LOV,
LU_XATTR_REPLACE, th);
}
@@
-1414,9
+1413,8
@@
static int lod_attr_set(const struct lu_env *env,
if (rc <= 0)
RETURN(rc);
- buf->lb_buf = info->lti_ea_store;
- buf->lb_len = info->lti_ea_store_size;
- lmm = info->lti_ea_store;
+ *buf = info->lti_ea_buf;
+ lmm = buf->lb_buf;
magic = le32_to_cpu(lmm->lmm_magic);
if (magic == LOV_MAGIC_COMP_V1 || magic == LOV_MAGIC_SEL) {
struct lov_comp_md_v1 *lcm = buf->lb_buf;
@@
-1449,8
+1447,7
@@
static int lod_attr_set(const struct lu_env *env,
if (rc <= 0)
RETURN(rc);
- buf->lb_buf = info->lti_ea_store;
- buf->lb_len = info->lti_ea_store_size;
+ *buf = info->lti_ea_buf;
lcm = buf->lb_buf;
if (le32_to_cpu(lcm->lcm_magic) != LOV_MAGIC_COMP_V1 &&
le32_to_cpu(lcm->lcm_magic) != LOV_MAGIC_SEL)
@@
-1669,7
+1666,7
@@
static int lod_prep_lmv_md(const struct lu_env *env, struct dt_object *dt,
memset(info->lti_ea_store, 0, sizeof(*lmm1));
}
- lmm1 = (struct lmv_mds_md_v1 *)info->lti_ea_
store
;
+ lmm1 = (struct lmv_mds_md_v1 *)info->lti_ea_
buf.lb_buf
;
memset(lmm1, 0, sizeof(*lmm1));
lmm1->lmv_magic = cpu_to_le32(LMV_MAGIC);
lmm1->lmv_stripe_count = cpu_to_le32(stripe_count);
@@
-1686,7
+1683,7
@@
static int lod_prep_lmv_md(const struct lu_env *env, struct dt_object *dt,
RETURN(rc);
lmm1->lmv_master_mdt_index = cpu_to_le32(mdtidx);
- lmv_buf->lb_buf = info->lti_ea_
store
;
+ lmv_buf->lb_buf = info->lti_ea_
buf.lb_buf
;
lmv_buf->lb_len = sizeof(*lmm1);
RETURN(rc);
@@
-3306,7
+3303,7
@@
unlock:
*/
static int lod_layout_convert(struct lod_thread_info *info)
{
- struct lov_mds_md *lmm = info->lti_ea_
store
;
+ struct lov_mds_md *lmm = info->lti_ea_
buf.lb_buf
;
struct lov_mds_md *lmm_save;
struct lov_comp_md_v1 *lcm;
struct lov_comp_md_entry_v1 *lcme;
@@
-3332,7
+3329,7
@@
static int lod_layout_convert(struct lod_thread_info *info)
GOTO(out, rc);
}
- lcm = info->lti_ea_
store
;
+ lcm = info->lti_ea_
buf.lb_buf
;
memset(lcm, 0, sizeof(*lcm) + sizeof(*lcme));
lcm->lcm_magic = cpu_to_le32(LOV_MAGIC_COMP_V1);
lcm->lcm_size = cpu_to_le32(size);
@@
-3405,7
+3402,7
@@
static int lod_declare_layout_merge(const struct lu_env *env,
if (rc <= 0)
RETURN(rc ? : -ENODATA);
- cur_lcm = info->lti_ea_
store
;
+ cur_lcm = info->lti_ea_
buf.lb_buf
;
switch (le32_to_cpu(cur_lcm->lcm_magic)) {
case LOV_MAGIC_V1:
case LOV_MAGIC_V3:
@@
-3422,7
+3419,7
@@
static int lod_declare_layout_merge(const struct lu_env *env,
RETURN(rc);
/* info->lti_ea_store could be reallocated in lod_layout_convert() */
- cur_lcm = info->lti_ea_
store
;
+ cur_lcm = info->lti_ea_
buf.lb_buf
;
cur_entry_count = le16_to_cpu(cur_lcm->lcm_entry_count);
/* 'lcm_mirror_count + 1' is the current # of mirrors the file has */
@@
-4122,7
+4119,7
@@
static int lod_xattr_set_default_lov_on_dir(const struct lu_env *env,
if (v1->lmm_magic == LOV_USER_MAGIC_V1 && pool[0] != '\0' &&
!is_del) {
struct lod_thread_info *info = lod_env_info(env);
- struct lov_user_md_v3 *v3 = info->lti_ea_
store
;
+ struct lov_user_md_v3 *v3 = info->lti_ea_
buf.lb_buf
;
memset(v3, 0, sizeof(*v3));
v3->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V3);
@@
-4180,7
+4177,7
@@
static int lod_xattr_set_default_lov_on_dir(const struct lu_env *env,
rc = lod_ea_store_resize(info, size);
if (rc == 0) {
- comp_v1p = info->lti_ea_
store
;
+ comp_v1p = info->lti_ea_
buf.lb_buf
;
*comp_v1p = *comp_v1;
comp_v1p->lcm_size = cpu_to_le32(size);
embed_pool_to_comp_v1(comp_v1, pool, comp_v1p);
@@
-4517,14
+4514,14
@@
static int lod_dir_striping_create_internal(const struct lu_env *env,
lo->ldo_dir_stripe_offset)) {
if (!lmu->lb_buf) {
/* mkdir by default LMV */
- struct lmv_user_md_v1 *v1 = info->lti_ea_
store
;
+ struct lmv_user_md_v1 *v1 = info->lti_ea_
buf.lb_buf
;
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 (rc != 0)
RETURN(rc);
- v1 = info->lti_ea_
store
;
+ v1 = info->lti_ea_
buf.lb_buf
;
}
memset(v1, 0, sizeof(*v1));
@@
-4573,13
+4570,13
@@
static int lod_dir_striping_create_internal(const struct lu_env *env,
lds->lds_dir_def_stripe_offset) &&
le32_to_cpu(lds->lds_dir_def_hash_type) !=
LMV_HASH_TYPE_UNKNOWN)) {
- struct lmv_user_md_v1 *v1 = info->lti_ea_
store
;
+ struct lmv_user_md_v1 *v1 = info->lti_ea_
buf.lb_buf
;
if (info->lti_ea_store_size < sizeof(*v1)) {
rc = lod_ea_store_resize(info, sizeof(*v1));
if (rc != 0)
RETURN(rc);
- v1 = info->lti_ea_
store
;
+ v1 = info->lti_ea_
buf.lb_buf
;
}
memset(v1, 0, sizeof(*v1));
@@
-4621,7
+4618,7
@@
static int lod_dir_striping_create_internal(const struct lu_env *env,
if (rc != 0)
RETURN(rc);
}
- lmm = info->lti_ea_
store
;
+ lmm = info->lti_ea_
buf.lb_buf
;
rc = lod_generate_lovea(env, lo, lmm, &lmm_size, true);
if (rc != 0)
@@
-4711,7
+4708,7
@@
static int lod_generate_and_set_lovea(const struct lu_env *env,
if (rc)
RETURN(rc);
}
- lmm = info->lti_ea_
store
;
+ lmm = info->lti_ea_
buf.lb_buf
;
rc = lod_generate_lovea(env, lo, lmm, &lmm_size, false);
if (rc)
@@
-5366,7
+5363,7
@@
static int lod_get_default_lov_striping(const struct lu_env *env,
if (rc < (typeof(rc))sizeof(struct lov_user_md))
RETURN(0);
- magic = *(__u32 *)info->lti_ea_
store
;
+ magic = *(__u32 *)info->lti_ea_
buf.lb_buf
;
if (magic == __swab32(LOV_USER_MAGIC_V1)) {
lustre_swab_lov_user_md_v1(info->lti_ea_store);
} else if (magic == __swab32(LOV_USER_MAGIC_V3)) {
@@
-5378,18
+5375,18
@@
static int lod_get_default_lov_striping(const struct lu_env *env,
v3->lmm_stripe_count);
} else if (magic == __swab32(LOV_USER_MAGIC_COMP_V1) ||
magic == __swab32(LOV_USER_MAGIC_SEL)) {
- lustre_swab_lov_comp_md_v1(info->lti_ea_
store
);
+ lustre_swab_lov_comp_md_v1(info->lti_ea_
buf.lb_buf
);
}
switch (magic) {
case LOV_MAGIC_V1:
case LOV_MAGIC_V3:
case LOV_USER_MAGIC_SPECIFIC:
- v1 = info->lti_ea_
store
;
+ v1 = info->lti_ea_
buf.lb_buf
;
break;
case LOV_MAGIC_COMP_V1:
case LOV_MAGIC_SEL:
- lcm = info->lti_ea_
store
;
+ lcm = info->lti_ea_
buf.lb_buf
;
entry_count = lcm->lcm_entry_count;
if (entry_count == 0)
RETURN(-EINVAL);
@@
-5533,7
+5530,7
@@
static int lod_get_default_lmv_striping(const struct lu_env *env,
if (rc >= (int)sizeof(*lmu)) {
struct lod_thread_info *info = lod_env_info(env);
- lmu = info->lti_ea_
store
;
+ lmu = info->lti_ea_
buf.lb_buf
;
lod_lum2lds(lds, lmu);
}
diff --git
a/lustre/lod/lod_qos.c
b/lustre/lod/lod_qos.c
index
230ae32
..
4a594c4
100644
(file)
--- a/
lustre/lod/lod_qos.c
+++ b/
lustre/lod/lod_qos.c
@@
-405,9
+405,9
@@
static inline int lod_qos_tgt_in_use_clear(const struct lu_env *env,
{
struct lod_thread_info *info = lod_env_info(env);
- if (info->lti_ea_
store_size
< sizeof(int) * stripes)
+ if (info->lti_ea_
buf.lb_len
< sizeof(int) * stripes)
lod_ea_store_resize(info, stripes * sizeof(int));
- if (info->lti_ea_
store_size
< sizeof(int) * stripes) {
+ if (info->lti_ea_
buf.lb_len
< sizeof(int) * stripes) {
CERROR("can't allocate memory for tgt-in-use array\n");
return -ENOMEM;
}
@@
-428,9
+428,9
@@
static inline void lod_qos_tgt_in_use(const struct lu_env *env,
int idx, int tgt_idx)
{
struct lod_thread_info *info = lod_env_info(env);
- int *tgts = info->lti_ea_
store
;
+ int *tgts = info->lti_ea_
buf.lb_buf
;
- LASSERT(info->lti_ea_
store_size
>= idx * sizeof(int));
+ LASSERT(info->lti_ea_
buf.lb_len
>= idx * sizeof(int));
tgts[idx] = tgt_idx;
}
@@
-451,7
+451,7
@@
static int lod_qos_is_tgt_used(const struct lu_env *env, int tgt_idx,
__u32 stripes)
{
struct lod_thread_info *info = lod_env_info(env);
- int *tgts = info->lti_ea_
store
;
+ int *tgts = info->lti_ea_
buf.lb_buf
;
__u32 j;
for (j = 0; j < stripes; j++) {