Skip to contentSkip to conversation

Btrfs: compression: added line after variable declaration

PATCH In review Philippe Loctaux 2 participants 3 messages Feb 21, 2016 – Feb 22, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: compression: added line after variable declaration

Added line after variable declaration, fixing checkpatch warning.

---
 fs/btrfs/compression.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/compression.c +1 -0
index 3346cd8..5194b6f 100644
@@ -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);
Signature · 1 line
2.7.1
#1 lore raw
Quoted 1 line · Philippe Loctaux

Added line after variable declaration, fixing checkpatch warning.

[]

fs/btrfs/compression.c

Quoted 1 line
fs/btrfs/compression.c +0 -0

[]

Quoted 8 lines
fs/btrfs/compression.c +0 -0
@@ -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(-)
fs/btrfs/compression.c +0 -0
index 3346cd8..be41f83 100644
@@ -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);
  }

#2 lore raw

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

--
Philippe Loctaux
[email protected]

Quoted 52 lines · Joe Perches
Quoted 1 line · Philippe Loctaux

Added line after variable declaration, fixing checkpatch warning.

[]

fs/btrfs/compression.c

Quoted 1 line
fs/btrfs/compression.c +0 -0

[]

Quoted 8 lines
fs/btrfs/compression.c +0 -0
@@ -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(-)
fs/btrfs/compression.c +0 -0
index 3346cd8..be41f83 100644
@@ -517,14 +517,13 @@ static noinline int add_ra_bio_pages(struct inode *inode,
  		free_extent_map(em);


  if (page->index == end_index) {

fs/btrfs/compression.c +0 -1
-			char *userpage;

  size_t zero_offset = isize & (PAGE_CACHE_SIZE - 1);
  if (zero_offset) {

fs/btrfs/compression.c +4 -4
-				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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html