Whamcloud - gitweb
LU-17464 lod: use OBD_ALLOC_LARGE for ldo_comp_entries 49/55449/3
authorBobi Jam <bobijam@whamcloud.com>
Mon, 17 Jun 2024 10:10:05 +0000 (18:10 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Jul 2024 20:08:40 +0000 (20:08 +0000)
The lod_object::ldo_comp_entries is allocated/free with _LARGE macros
so that it could be large enought to use vmalloc instead of kmalloc
for memory allocation. There are some places use OBD_ALLOC without
_LARGE to re-allocate memory which mismatch the assumption.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ie356ae875329af07c893586fa4b1485dbd17afe6
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55449
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lod/lod_object.c

index 4347eda..f488a30 100644 (file)
@@ -2846,7 +2846,7 @@ static int lod_declare_layout_add(const struct lu_env *env,
        mutex_lock(&lo->ldo_layout_mutex);
 
        array_cnt = lo->ldo_comp_cnt + comp_v1->lcm_entry_count;
-       OBD_ALLOC_PTR_ARRAY(comp_array, array_cnt);
+       OBD_ALLOC_PTR_ARRAY_LARGE(comp_array, array_cnt);
        if (comp_array == NULL) {
                mutex_unlock(&lo->ldo_layout_mutex);
                RETURN(-ENOMEM);
@@ -2928,7 +2928,7 @@ static int lod_declare_layout_add(const struct lu_env *env,
                GOTO(error, rc);
        }
 
-       OBD_FREE_PTR_ARRAY(old_array, old_array_cnt);
+       OBD_FREE_PTR_ARRAY_LARGE(old_array, old_array_cnt);
 
        LASSERT(lo->ldo_mirror_count == 1);
        lo->ldo_mirrors[0].lme_end = array_cnt - 1;
@@ -2946,7 +2946,7 @@ error:
                        lod_comp->llc_pool = NULL;
                }
        }
-       OBD_FREE_PTR_ARRAY(comp_array, array_cnt);
+       OBD_FREE_PTR_ARRAY_LARGE(comp_array, array_cnt);
        mutex_unlock(&lo->ldo_layout_mutex);
 
        RETURN(rc);
@@ -4810,7 +4810,7 @@ static int lod_layout_repeat_comp(const struct lu_env *env,
 
        CDEBUG(D_LAYOUT, "repeating component %d\n", index);
 
-       OBD_ALLOC_PTR_ARRAY(comp_array, new_cnt);
+       OBD_ALLOC_PTR_ARRAY_LARGE(comp_array, new_cnt);
        if (comp_array == NULL)
                GOTO(out, rc = -ENOMEM);
 
@@ -4858,7 +4858,7 @@ static int lod_layout_repeat_comp(const struct lu_env *env,
                new_comp->llc_ostlist.op_array = op_array;
        }
 
-       OBD_FREE_PTR_ARRAY(lo->ldo_comp_entries, lo->ldo_comp_cnt);
+       OBD_FREE_PTR_ARRAY_LARGE(lo->ldo_comp_entries, lo->ldo_comp_cnt);
        lo->ldo_comp_entries = comp_array;
        lo->ldo_comp_cnt = new_cnt;
 
@@ -4872,7 +4872,7 @@ static int lod_layout_repeat_comp(const struct lu_env *env,
        EXIT;
 out:
        if (rc)
-               OBD_FREE_PTR_ARRAY(comp_array, new_cnt);
+               OBD_FREE_PTR_ARRAY_LARGE(comp_array, new_cnt);
 
        return rc;
 }
@@ -5000,7 +5000,7 @@ static int lod_layout_del_prep_layout(const struct lu_env *env,
        if (info->lti_count > 0) {
                struct lod_layout_component *comp_array;
 
-               OBD_ALLOC_PTR_ARRAY(comp_array, info->lti_count);
+               OBD_ALLOC_PTR_ARRAY_LARGE(comp_array, info->lti_count);
                if (comp_array == NULL)
                        GOTO(out, rc = -ENOMEM);
 
@@ -5010,7 +5010,8 @@ static int lod_layout_del_prep_layout(const struct lu_env *env,
                               sizeof(*comp_array));
                }
 
-               OBD_FREE_PTR_ARRAY(lo->ldo_comp_entries, lo->ldo_comp_cnt);
+               OBD_FREE_PTR_ARRAY_LARGE(lo->ldo_comp_entries,
+                                        lo->ldo_comp_cnt);
                lo->ldo_comp_entries = comp_array;
                lo->ldo_comp_cnt = info->lti_count;
        } else {
@@ -8126,7 +8127,7 @@ static int lod_declare_pccro_set(const struct lu_env *env,
                RETURN(-ENOMEM);
 
        new_cnt = lo->ldo_comp_cnt + 1;
-       OBD_ALLOC_PTR_ARRAY(comp_array, new_cnt);
+       OBD_ALLOC_PTR_ARRAY_LARGE(comp_array, new_cnt);
        if (comp_array == NULL) {
                OBD_FREE_PTR_ARRAY(mirror_array, mirror_cnt);
                RETURN(-ENOMEM);
@@ -8170,7 +8171,7 @@ static int lod_declare_pccro_set(const struct lu_env *env,
 
        if (lo->ldo_mirrors)
                OBD_FREE_PTR_ARRAY(lo->ldo_mirrors, lo->ldo_mirror_count);
-       OBD_FREE_PTR_ARRAY(lo->ldo_comp_entries, lo->ldo_comp_cnt);
+       OBD_FREE_PTR_ARRAY_LARGE(lo->ldo_comp_entries, lo->ldo_comp_cnt);
 
        /*
         * The @ldo_mirror will be refilled by lod_fill_mirrors() when