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
(from parent 1:
09f9fb3
)
LU-9679 obdclass: use OBD_ALLOC_PTR_ARRAY() and others
21/38121/4
author
Mr NeilBrown
<neilb@suse.de>
Thu, 14 Nov 2019 03:20:01 +0000
(14:20 +1100)
committer
Oleg Drokin
<green@whamcloud.com>
Thu, 14 May 2020 05:38:36 +0000
(
05:38
+0000)
Use:
OBD_ALLOC_PTR_ARRAY
OBD_ALLOC_PTR_ARRAY_WAIT
OBD_FREE_PTR_ARRAY
OBD_ALLOC_PTR_ARRAY_LARGE
OBD_FREE_PTR_ARRAY_LARGE
for allocating and freeing arrays in obdclass
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I2ebf853769a9711f1f99431aa7f69a18ba2ea552
Reviewed-on: https://review.whamcloud.com/38121
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/obdclass/cl_object.c
patch
|
blob
|
history
lustre/obdclass/lu_object.c
patch
|
blob
|
history
lustre/obdclass/lustre_handles.c
patch
|
blob
|
history
lustre/obdclass/obd_mount.c
patch
|
blob
|
history
diff --git
a/lustre/obdclass/cl_object.c
b/lustre/obdclass/cl_object.c
index
9844ed0
..
730deb9
100644
(file)
--- a/
lustre/obdclass/cl_object.c
+++ b/
lustre/obdclass/cl_object.c
@@
-1074,7
+1074,7
@@
int cl_global_init(void)
{
int result;
- OBD_ALLOC
(cl_envs, sizeof(*cl_envs) *
num_possible_cpus());
+ OBD_ALLOC
_PTR_ARRAY(cl_envs,
num_possible_cpus());
if (cl_envs == NULL)
GOTO(out, result = -ENOMEM);
@@
-1098,7
+1098,7
@@
out_keys:
out_kmem:
lu_kmem_fini(cl_object_caches);
out_envs:
- OBD_FREE
(cl_envs, sizeof(*cl_envs) *
num_possible_cpus());
+ OBD_FREE
_PTR_ARRAY(cl_envs,
num_possible_cpus());
out:
return result;
}
@@
-1119,5
+1119,5
@@
void cl_global_fini(void)
cl_env_percpu_fini();
lu_context_key_degister(&cl_key);
lu_kmem_fini(cl_object_caches);
- OBD_FREE
(cl_envs, sizeof(*cl_envs) *
num_possible_cpus());
+ OBD_FREE
_PTR_ARRAY(cl_envs,
num_possible_cpus());
}
diff --git
a/lustre/obdclass/lu_object.c
b/lustre/obdclass/lu_object.c
index
916ad94
..
62d4521
100644
(file)
--- a/
lustre/obdclass/lu_object.c
+++ b/
lustre/obdclass/lu_object.c
@@
-1157,7
+1157,7
@@
int lu_site_init(struct lu_site *s, struct lu_device *top)
s->ls_bkt_cnt = max_t(long, 1 << LU_SITE_BKT_BITS,
2 * num_possible_cpus());
s->ls_bkt_cnt = roundup_pow_of_two(s->ls_bkt_cnt);
- OBD_ALLOC_
LARGE(s->ls_bkts, s->ls_bkt_cnt * sizeof(*bkt)
);
+ OBD_ALLOC_
PTR_ARRAY_LARGE(s->ls_bkts, s->ls_bkt_cnt
);
if (!s->ls_bkts) {
cfs_hash_putref(s->ls_obj_hash);
s->ls_obj_hash = NULL;
@@
-1171,14
+1171,14
@@
int lu_site_init(struct lu_site *s, struct lu_device *top)
init_waitqueue_head(&bkt->lsb_waitq);
}
-
s->ls_stats = lprocfs_alloc_stats(LU_SS_LAST_STAT, 0);
-
if (s->ls_stats == NULL) {
- OBD_FREE_
LARGE(s->ls_bkts, s->ls_bkt_cnt * sizeof(*bkt)
);
+ s->ls_stats = lprocfs_alloc_stats(LU_SS_LAST_STAT, 0);
+ if (s->ls_stats == NULL) {
+ OBD_FREE_
PTR_ARRAY_LARGE(s->ls_bkts, s->ls_bkt_cnt
);
cfs_hash_putref(s->ls_obj_hash);
-
s->ls_obj_hash = NULL;
+ s->ls_obj_hash = NULL;
s->ls_bkts = NULL;
-
return -ENOMEM;
-
}
+ return -ENOMEM;
+ }
lprocfs_counter_init(s->ls_stats, LU_SS_CREATED,
0, "created", "created");
@@
-1224,7
+1224,7
@@
void lu_site_fini(struct lu_site *s)
s->ls_obj_hash = NULL;
}
- OBD_FREE_
LARGE(s->ls_bkts, s->ls_bkt_cnt * sizeof(*s->ls_bkts)
);
+ OBD_FREE_
PTR_ARRAY_LARGE(s->ls_bkts, s->ls_bkt_cnt
);
if (s->ls_top_dev != NULL) {
s->ls_top_dev->ld_site = NULL;
@@
-1700,7
+1700,7
@@
static void keys_fini(struct lu_context *ctx)
for (i = 0; i < ARRAY_SIZE(lu_keys); ++i)
key_fini(ctx, i);
- OBD_FREE
(ctx->lc_value, ARRAY_SIZE(lu_keys) * sizeof ctx->lc_value[0]
);
+ OBD_FREE
_PTR_ARRAY(ctx->lc_value, ARRAY_SIZE(lu_keys)
);
ctx->lc_value = NULL;
}
@@
-1768,7
+1768,7
@@
static int keys_fill(struct lu_context *ctx)
static int keys_init(struct lu_context *ctx)
{
- OBD_ALLOC
(ctx->lc_value, ARRAY_SIZE(lu_keys) * sizeof ctx->lc_value[0]
);
+ OBD_ALLOC
_PTR_ARRAY(ctx->lc_value, ARRAY_SIZE(lu_keys)
);
if (likely(ctx->lc_value != NULL))
return keys_fill(ctx);
diff --git
a/lustre/obdclass/lustre_handles.c
b/lustre/obdclass/lustre_handles.c
index
27f6971
..
061090a
100644
(file)
--- a/
lustre/obdclass/lustre_handles.c
+++ b/
lustre/obdclass/lustre_handles.c
@@
-166,7
+166,7
@@
int class_handle_init(void)
LASSERT(handle_hash == NULL);
- OBD_ALLOC_
LARGE(handle_hash, sizeof(*bucket) *
HANDLE_HASH_SIZE);
+ OBD_ALLOC_
PTR_ARRAY_LARGE(handle_hash,
HANDLE_HASH_SIZE);
if (handle_hash == NULL)
return -ENOMEM;
@@
-212,7
+212,7
@@
void class_handle_cleanup(void)
count = cleanup_all_handles();
- OBD_FREE_
LARGE(handle_hash, sizeof(*handle_hash) *
HANDLE_HASH_SIZE);
+ OBD_FREE_
PTR_ARRAY_LARGE(handle_hash,
HANDLE_HASH_SIZE);
handle_hash = NULL;
if (count != 0)
diff --git
a/lustre/obdclass/obd_mount.c
b/lustre/obdclass/obd_mount.c
index
cd9c7d4
..
5edc929
100644
(file)
--- a/
lustre/obdclass/obd_mount.c
+++ b/
lustre/obdclass/obd_mount.c
@@
-1033,7
+1033,7
@@
static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
devmax = strlen(ptr) / 8 + 1;
/* temp storage until we figure out how many we have */
- OBD_ALLOC
(exclude_list, sizeof(index) *
devmax);
+ OBD_ALLOC
_PTR_ARRAY(exclude_list,
devmax);
if (!exclude_list)
RETURN(-ENOMEM);
@@
-1064,8
+1064,8
@@
static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
if (lmd->lmd_exclude_count) {
/* permanent, freed in lustre_free_lsi */
- OBD_ALLOC
(lmd->lmd_exclude, sizeof(index) *
- lmd->lmd_exclude_count);
+ OBD_ALLOC
_PTR_ARRAY(lmd->lmd_exclude,
+
lmd->lmd_exclude_count);
if (lmd->lmd_exclude) {
memcpy(lmd->lmd_exclude, exclude_list,
sizeof(index) * lmd->lmd_exclude_count);
@@
-1074,7
+1074,7
@@
static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
lmd->lmd_exclude_count = 0;
}
}
- OBD_FREE
(exclude_list, sizeof(index) *
devmax);
+ OBD_FREE
_PTR_ARRAY(exclude_list,
devmax);
RETURN(rc);
}