linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite()
@ 2019-12-03  8:16 Yunfeng Ye
  2019-12-03  8:24 ` Omar Sandoval
  0 siblings, 1 reply; 3+ messages in thread
From: Yunfeng Ye @ 2019-12-03  8:16 UTC (permalink / raw)
  To: clm, josef, dsterba, linux-btrfs, linux-kernel, hushiyuan, linfeilong

The condition '!ret2' is always true. so remove the unused condition
check.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
 fs/btrfs/inode.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 56032c518b26..eef2432597e2 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9073,7 +9073,6 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
 		ret = VM_FAULT_SIGBUS;
 		goto out_unlock;
 	}
-	ret2 = 0;

 	/* page is wholly or partially inside EOF */
 	if (page_start + PAGE_SIZE > size)
@@ -9097,12 +9096,10 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)

 	unlock_extent_cached(io_tree, page_start, page_end, &cached_state);

-	if (!ret2) {
-		btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
-		sb_end_pagefault(inode->i_sb);
-		extent_changeset_free(data_reserved);
-		return VM_FAULT_LOCKED;
-	}
+	btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
+	sb_end_pagefault(inode->i_sb);
+	extent_changeset_free(data_reserved);
+	return VM_FAULT_LOCKED;

 out_unlock:
 	unlock_page(page);
-- 
2.7.4


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

* Re: [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite()
  2019-12-03  8:16 [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite() Yunfeng Ye
@ 2019-12-03  8:24 ` Omar Sandoval
  2019-12-03  8:33   ` Yunfeng Ye
  0 siblings, 1 reply; 3+ messages in thread
From: Omar Sandoval @ 2019-12-03  8:24 UTC (permalink / raw)
  To: Yunfeng Ye
  Cc: clm, josef, dsterba, linux-btrfs, linux-kernel, hushiyuan, linfeilong

On Tue, Dec 03, 2019 at 04:16:43PM +0800, Yunfeng Ye wrote:
> The condition '!ret2' is always true. so remove the unused condition
> check.
> 
> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>

For this sort of change, one should mention how the code got in this
state. In this case, commit 717beb96d969 ("Btrfs: fix regression in
btrfs_page_mkwrite() from vm_fault_t conversion") left behind the check
after moving this code out of the goto.

Ohter than that,

Reviewed-by: Omar Sandoval <osandov@fb.com>

> ---
>  fs/btrfs/inode.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 56032c518b26..eef2432597e2 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -9073,7 +9073,6 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
>  		ret = VM_FAULT_SIGBUS;
>  		goto out_unlock;
>  	}
> -	ret2 = 0;
> 
>  	/* page is wholly or partially inside EOF */
>  	if (page_start + PAGE_SIZE > size)
> @@ -9097,12 +9096,10 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
> 
>  	unlock_extent_cached(io_tree, page_start, page_end, &cached_state);
> 
> -	if (!ret2) {
> -		btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
> -		sb_end_pagefault(inode->i_sb);
> -		extent_changeset_free(data_reserved);
> -		return VM_FAULT_LOCKED;
> -	}
> +	btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
> +	sb_end_pagefault(inode->i_sb);
> +	extent_changeset_free(data_reserved);
> +	return VM_FAULT_LOCKED;
> 
>  out_unlock:
>  	unlock_page(page);
> -- 
> 2.7.4
> 

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

* Re: [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite()
  2019-12-03  8:24 ` Omar Sandoval
@ 2019-12-03  8:33   ` Yunfeng Ye
  0 siblings, 0 replies; 3+ messages in thread
From: Yunfeng Ye @ 2019-12-03  8:33 UTC (permalink / raw)
  To: Omar Sandoval
  Cc: clm, josef, dsterba, linux-btrfs, linux-kernel, hushiyuan, linfeilong



On 2019/12/3 16:24, Omar Sandoval wrote:
> On Tue, Dec 03, 2019 at 04:16:43PM +0800, Yunfeng Ye wrote:
>> The condition '!ret2' is always true. so remove the unused condition
>> check.
>>
>> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> 
> For this sort of change, one should mention how the code got in this
> state. In this case, commit 717beb96d969 ("Btrfs: fix regression in
> btrfs_page_mkwrite() from vm_fault_t conversion") left behind the check
> after moving this code out of the goto.
> 
ok, I will update the comment, thanks.

> Ohter than that,
> 
> Reviewed-by: Omar Sandoval <osandov@fb.com>
> 
>> ---
>>  fs/btrfs/inode.c | 11 ++++-------
>>  1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
>> index 56032c518b26..eef2432597e2 100644
>> --- a/fs/btrfs/inode.c
>> +++ b/fs/btrfs/inode.c
>> @@ -9073,7 +9073,6 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
>>  		ret = VM_FAULT_SIGBUS;
>>  		goto out_unlock;
>>  	}
>> -	ret2 = 0;
>>
>>  	/* page is wholly or partially inside EOF */
>>  	if (page_start + PAGE_SIZE > size)
>> @@ -9097,12 +9096,10 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
>>
>>  	unlock_extent_cached(io_tree, page_start, page_end, &cached_state);
>>
>> -	if (!ret2) {
>> -		btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
>> -		sb_end_pagefault(inode->i_sb);
>> -		extent_changeset_free(data_reserved);
>> -		return VM_FAULT_LOCKED;
>> -	}
>> +	btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
>> +	sb_end_pagefault(inode->i_sb);
>> +	extent_changeset_free(data_reserved);
>> +	return VM_FAULT_LOCKED;
>>
>>  out_unlock:
>>  	unlock_page(page);
>> -- 
>> 2.7.4
>>
> 
> .
> 


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

end of thread, other threads:[~2019-12-03  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  8:16 [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite() Yunfeng Ye
2019-12-03  8:24 ` Omar Sandoval
2019-12-03  8:33   ` Yunfeng Ye

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).