Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339012 > unrolled thread

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

Started byPhilippe Loctaux <phil@philippeloctaux.com>
First post2016-02-22 00:30 +0100
Last post2016-02-22 02:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Btrfs: compression: added line after variable declaration Philippe Loctaux <phil@philippeloctaux.com> - 2016-02-22 00:30 +0100
    Re: [PATCH] Btrfs: compression: added line after variable  declaration Joe Perches <joe@perches.com> - 2016-02-22 01:40 +0100
      Re: [PATCH] Btrfs: compression: added line after variable declaration Philippe Loctaux <phil@philippeloctaux.com> - 2016-02-22 02:00 +0100

#1339012 — [PATCH] Btrfs: compression: added line after variable declaration

FromPhilippe Loctaux <phil@philippeloctaux.com>
Date2016-02-22 00:30 +0100
Subject[PATCH] Btrfs: compression: added line after variable declaration
Message-ID<r4LBU-53D-3@gated-at.bofh.it>
Added line after variable declaration, fixing checkpatch warning.

Signed-off-by: Philippe Loctaux <phil@philippeloctaux.com>
---
 fs/btrfs/compression.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 3346cd8..5194b6f 100644
--- 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);
-- 
2.7.1

[toc] | [next] | [standalone]


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

FromJoe Perches <joe@perches.com>
Date2016-02-22 01:40 +0100
SubjectRe: [PATCH] Btrfs: compression: added line after variable declaration
Message-ID<r4MHF-5TA-33@gated-at.bofh.it>
In reply to#1339012
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);
 			}

[toc] | [prev] | [next] | [standalone]


#1339043

FromPhilippe Loctaux <phil@philippeloctaux.com>
Date2016-02-22 02:00 +0100
Message-ID<r4N10-62H-17@gated-at.bofh.it>
In reply to#1339037
Oh, I see now :)
I'll try your changes and tell if they work or not :)

--
Philippe Loctaux
phil@philippeloctaux.com


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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web