mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
dlm: cleanup memory allocation helpers
This patch removes a unnecessary parameter from DLM memory allocation helpers and reduce some functions by just directly reply the pointer address of the allocated memory. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
de9c2c66ad
commit
1169788544
3 changed files with 9 additions and 18 deletions
|
@ -600,7 +600,7 @@ static int get_rsb_struct(struct dlm_ls *ls, const void *name, int len,
|
|||
{
|
||||
struct dlm_rsb *r;
|
||||
|
||||
r = dlm_allocate_rsb(ls);
|
||||
r = dlm_allocate_rsb();
|
||||
if (!r)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -1497,7 +1497,7 @@ static int _create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret,
|
|||
limit.max = end;
|
||||
limit.min = start;
|
||||
|
||||
lkb = dlm_allocate_lkb(ls);
|
||||
lkb = dlm_allocate_lkb();
|
||||
if (!lkb)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -84,10 +84,7 @@ void dlm_memory_exit(void)
|
|||
|
||||
char *dlm_allocate_lvb(struct dlm_ls *ls)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = kzalloc(ls->ls_lvblen, GFP_ATOMIC);
|
||||
return p;
|
||||
return kzalloc(ls->ls_lvblen, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
void dlm_free_lvb(char *p)
|
||||
|
@ -95,12 +92,9 @@ void dlm_free_lvb(char *p)
|
|||
kfree(p);
|
||||
}
|
||||
|
||||
struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls)
|
||||
struct dlm_rsb *dlm_allocate_rsb(void)
|
||||
{
|
||||
struct dlm_rsb *r;
|
||||
|
||||
r = kmem_cache_zalloc(rsb_cache, GFP_ATOMIC);
|
||||
return r;
|
||||
return kmem_cache_zalloc(rsb_cache, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
static void __free_rsb_rcu(struct rcu_head *rcu)
|
||||
|
@ -116,12 +110,9 @@ void dlm_free_rsb(struct dlm_rsb *r)
|
|||
call_rcu(&r->rcu, __free_rsb_rcu);
|
||||
}
|
||||
|
||||
struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls)
|
||||
struct dlm_lkb *dlm_allocate_lkb(void)
|
||||
{
|
||||
struct dlm_lkb *lkb;
|
||||
|
||||
lkb = kmem_cache_zalloc(lkb_cache, GFP_ATOMIC);
|
||||
return lkb;
|
||||
return kmem_cache_zalloc(lkb_cache, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
void dlm_free_lkb(struct dlm_lkb *lkb)
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
int dlm_memory_init(void);
|
||||
void dlm_memory_exit(void);
|
||||
struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls);
|
||||
struct dlm_rsb *dlm_allocate_rsb(void);
|
||||
void dlm_free_rsb(struct dlm_rsb *r);
|
||||
struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls);
|
||||
struct dlm_lkb *dlm_allocate_lkb(void);
|
||||
void dlm_free_lkb(struct dlm_lkb *l);
|
||||
char *dlm_allocate_lvb(struct dlm_ls *ls);
|
||||
void dlm_free_lvb(char *l);
|
||||
|
|
Loading…
Reference in a new issue