lkml.org 
[lkml]   [2015]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 23/31] fs/ocfs2: use kmemdup rather than duplicating its implementation
From
Date
Ping.

Regards
Andrzej

On 08/07/2015 09:59 AM, Andrzej Hajda wrote:
> The patch was generated using fixed coccinelle semantic patch
> scripts/coccinelle/api/memdup.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> fs/ocfs2/localalloc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
> index 0a4457f..194d6d6 100644
> --- a/fs/ocfs2/localalloc.c
> +++ b/fs/ocfs2/localalloc.c
> @@ -434,12 +434,11 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
> bh = osb->local_alloc_bh;
> alloc = (struct ocfs2_dinode *) bh->b_data;
>
> - alloc_copy = kmalloc(bh->b_size, GFP_NOFS);
> + alloc_copy = kmemdup(alloc, bh->b_size, GFP_NOFS);
> if (!alloc_copy) {
> status = -ENOMEM;
> goto out_commit;
> }
> - memcpy(alloc_copy, alloc, bh->b_size);
>
> status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode),
> bh, OCFS2_JOURNAL_ACCESS_WRITE);
> @@ -1285,13 +1284,12 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
> * local alloc shutdown won't try to double free main bitmap
> * bits. Make a copy so the sync function knows which bits to
> * free. */
> - alloc_copy = kmalloc(osb->local_alloc_bh->b_size, GFP_NOFS);
> + alloc_copy = kmemdup(alloc, osb->local_alloc_bh->b_size, GFP_NOFS);
> if (!alloc_copy) {
> status = -ENOMEM;
> mlog_errno(status);
> goto bail;
> }
> - memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size);
>
> status = ocfs2_journal_access_di(handle,
> INODE_CACHE(local_alloc_inode),



\
 
 \ /
  Last update: 2015-09-16 12:21    [W:0.412 / U:0.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site