Whamcloud - gitweb
LU-17464 lod: use OBD_ALLOC_LARGE for ldo_comp_entries
authorBobi Jam <bobijam@whamcloud.com>
Mon, 17 Jun 2024 10:56:56 +0000 (18:56 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 19 Jun 2024 05:34:48 +0000 (05:34 +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.

Lustre-change: https://review.whamcloud.com//55449
Lustre-commit: TBD (from 1c1ae0a5b642b2dd749c466dec5f91930db24601)

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ie356ae875329af07c893586fa4b1485dbd17afe6
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/55455
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lod/lod_object.c

index 1ac06ad..cd8784d 100644 (file)
@@ -2894,7 +2894,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);
@@ -2982,7 +2982,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;
@@ -3000,7 +3000,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);
@@ -4482,7 +4482,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);
 
@@ -4530,7 +4530,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;
 
@@ -4544,7 +4544,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;
 }
@@ -4672,7 +4672,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);
 
@@ -4682,7 +4682,7 @@ 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 {
@@ -7876,7 +7876,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);
@@ -7920,7 +7920,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