linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	"hushiyuan@huawei.com" <hushiyuan@huawei.com>,
	"linfeilong@huawei.com" <linfeilong@huawei.com>
Subject: Re: [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite()
Date: Tue, 3 Dec 2019 00:24:26 -0800	[thread overview]
Message-ID: <20191203082426.GC829117@vader> (raw)
In-Reply-To: <a84442bc-304b-2514-272e-ea89aae4b992@huawei.com>

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
> 

  reply	other threads:[~2019-12-03  8:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03  8:16 [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite() Yunfeng Ye
2019-12-03  8:24 ` Omar Sandoval [this message]
2019-12-03  8:33   ` Yunfeng Ye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203082426.GC829117@vader \
    --to=osandov@osandov.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=hushiyuan@huawei.com \
    --cc=josef@toxicpanda.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yeyunfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).