Re: [PATCH] Btrfs: compression: added line after variable declaration

From: Philippe Loctaux
Date: Sun Feb 21 2016 - 19:51:36 EST


Oh, I see now :)
I'll try your changes and tell if they work or not :)

--
Philippe Loctaux
phil@xxxxxxxxxxxxxxxxxxx


On Sun, Feb 21, 2016 at 04:37:54PM -0800, Joe Perches wrote:
> On Mon, 2016-02-22 at 00:26 +0100, Philippe Loctaux wrote:
> > Added line after variable declaration, fixing checkpatch warning.
> []
> > diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> []
> > @@ -522,6 +522,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
> > Â
> > Â if (zero_offset) {
> > Â int zeros;
> > +
> > Â zeros = PAGE_CACHE_SIZE - zero_offset;
> > Â userpage = kmap_atomic(page);
> > Â memset(userpage + zero_offset, 0, zeros);
>
> This zeros temporary is used once.
> Perhaps it should just be removed instead.
>
> Maybe the userpage declaration should move too.
>
> Something like:
> ---
> Âfs/btrfs/compression.c | 9 ++++-----
> Â1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 3346cd8..be41f83 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -517,14 +517,13 @@ static noinline int add_ra_bio_pages(struct inode *inode,
> Â free_extent_map(em);
> Â
> Â if (page->index == end_index) {
> - char *userpage;
> Â size_t zero_offset = isize & (PAGE_CACHE_SIZE - 1);
> Â
> Â if (zero_offset) {
> - int zeros;
> - zeros = PAGE_CACHE_SIZE - zero_offset;
> - userpage = kmap_atomic(page);
> - memset(userpage + zero_offset, 0, zeros);
> + char *userpage = kmap_atomic(page);
> +
> + memset(userpage + zero_offset, 0,
> + ÂÂÂÂÂÂÂPAGE_CACHE_SIZE - zero_offset);
> Â flush_dcache_page(page);
> Â kunmap_atomic(userpage);
> Â }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html