All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: compress_file_range() remove dead variable num_bytes
@ 2017-09-11 21:15 Timofey Titovets
  2017-09-26  9:24 ` Nikolay Borisov
  0 siblings, 1 reply; 2+ messages in thread
From: Timofey Titovets @ 2017-09-11 21:15 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Timofey Titovets

Remove dead assigment of num_bytes

Also as num_bytes only used in will_compress block as
copy of total_in just replace that with total_in and drop num_bytes entire

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
 fs/btrfs/inode.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 17ad018da0a2..1ff4fa461555 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -446,7 +446,6 @@ static noinline void compress_file_range(struct inode *inode,
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
 	struct btrfs_root *root = BTRFS_I(inode)->root;
-	u64 num_bytes;
 	u64 blocksize = fs_info->sectorsize;
 	u64 actual_end;
 	u64 isize = i_size_read(inode);
@@ -496,8 +495,6 @@ static noinline void compress_file_range(struct inode *inode,
 
 	total_compressed = min_t(unsigned long, total_compressed,
 			BTRFS_MAX_UNCOMPRESSED);
-	num_bytes = ALIGN(end - start + 1, blocksize);
-	num_bytes = max(blocksize,  num_bytes);
 	total_in = 0;
 	ret = 0;
 
@@ -613,7 +610,6 @@ static noinline void compress_file_range(struct inode *inode,
 		 */
 		total_in = ALIGN(total_in, PAGE_SIZE);
 		if (total_compressed + blocksize <= total_in) {
-			num_bytes = total_in;
 			*num_added += 1;
 
 			/*
@@ -621,12 +617,12 @@ static noinline void compress_file_range(struct inode *inode,
 			 * allocation on disk for these compressed pages, and
 			 * will submit them to the elevator.
 			 */
-			add_async_extent(async_cow, start, num_bytes,
+			add_async_extent(async_cow, start, total_in,
 					total_compressed, pages, nr_pages,
 					compress_type);
 
-			if (start + num_bytes < end) {
-				start += num_bytes;
+			if (start + total_in < end) {
+				start += total_in;
 				pages = NULL;
 				cond_resched();
 				goto again;
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Btrfs: compress_file_range() remove dead variable num_bytes
  2017-09-11 21:15 [PATCH] Btrfs: compress_file_range() remove dead variable num_bytes Timofey Titovets
@ 2017-09-26  9:24 ` Nikolay Borisov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Borisov @ 2017-09-26  9:24 UTC (permalink / raw)
  To: Timofey Titovets, linux-btrfs



On 12.09.2017 00:15, Timofey Titovets wrote:
> Remove dead assigment of num_bytes
> 
> Also as num_bytes only used in will_compress block as
> copy of total_in just replace that with total_in and drop num_bytes entire
> 
> Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/inode.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 17ad018da0a2..1ff4fa461555 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -446,7 +446,6 @@ static noinline void compress_file_range(struct inode *inode,
>  {
>  	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
>  	struct btrfs_root *root = BTRFS_I(inode)->root;
> -	u64 num_bytes;
>  	u64 blocksize = fs_info->sectorsize;
>  	u64 actual_end;
>  	u64 isize = i_size_read(inode);
> @@ -496,8 +495,6 @@ static noinline void compress_file_range(struct inode *inode,
>  
>  	total_compressed = min_t(unsigned long, total_compressed,
>  			BTRFS_MAX_UNCOMPRESSED);
> -	num_bytes = ALIGN(end - start + 1, blocksize);
> -	num_bytes = max(blocksize,  num_bytes);
>  	total_in = 0;
>  	ret = 0;
>  
> @@ -613,7 +610,6 @@ static noinline void compress_file_range(struct inode *inode,
>  		 */
>  		total_in = ALIGN(total_in, PAGE_SIZE);
>  		if (total_compressed + blocksize <= total_in) {
> -			num_bytes = total_in;
>  			*num_added += 1;
>  
>  			/*
> @@ -621,12 +617,12 @@ static noinline void compress_file_range(struct inode *inode,
>  			 * allocation on disk for these compressed pages, and
>  			 * will submit them to the elevator.
>  			 */
> -			add_async_extent(async_cow, start, num_bytes,
> +			add_async_extent(async_cow, start, total_in,
>  					total_compressed, pages, nr_pages,
>  					compress_type);
>  
> -			if (start + num_bytes < end) {
> -				start += num_bytes;
> +			if (start + total_in < end) {
> +				start += total_in;
>  				pages = NULL;
>  				cond_resched();
>  				goto again;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-26  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 21:15 [PATCH] Btrfs: compress_file_range() remove dead variable num_bytes Timofey Titovets
2017-09-26  9:24 ` Nikolay Borisov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.