linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Wang Xiaojun <wangxiaojun11@huawei.com>, <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: remove unused check on nid
Date: Mon, 21 Sep 2020 17:20:52 +0800	[thread overview]
Message-ID: <47b4bd9d-0934-1f83-5a68-be8628ddea44@huawei.com> (raw)
In-Reply-To: <20200921061916.1917750-1-wangxiaojun11@huawei.com>

Hi Xiaojun,

On 2020/9/21 14:19, Wang Xiaojun wrote:
> The case where nid is 0 will be checked in f2fs_check_nid_range.
> Remove the unused check.
> 
> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
> ---
>   fs/f2fs/node.c | 8 --------
>   1 file changed, 8 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index cb1b5b61a1da..c61d5b52e29e 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1319,8 +1319,6 @@ void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)
>   	struct page *apage;
>   	int err;
>   
> -	if (!nid)
> -		return;
>   	if (f2fs_check_nid_range(sbi, nid))
>   		return;

They have different usage, first condition is used to bypass @nid = 0 case which
is legal case; second condition is used to check sanity of nid value, in where
warn log would be printed once nid is a illegal value and in addition, SBI_NEED_FSCK
will be set for later fsck.

So let's keep it as it is. :)

Thanks,

>   
> @@ -1342,8 +1340,6 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,
>   	struct page *page;
>   	int err;
>   
> -	if (!nid)
> -		return ERR_PTR(-ENOENT);
>   	if (f2fs_check_nid_range(sbi, nid))
>   		return ERR_PTR(-EINVAL);
>   repeat:
> @@ -2193,10 +2189,6 @@ static bool add_free_nid(struct f2fs_sb_info *sbi,
>   	int err = -EINVAL;
>   	bool ret = false;
>   
> -	/* 0 nid should not be used */
> -	if (unlikely(nid == 0))
> -		return false;
> -
>   	if (unlikely(f2fs_check_nid_range(sbi, nid)))
>   		return false;
>   
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2020-09-21  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21  6:19 [f2fs-dev] [PATCH] f2fs: remove unused check on nid Wang Xiaojun
2020-09-21  9:20 ` Chao Yu [this message]

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=47b4bd9d-0934-1f83-5a68-be8628ddea44@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=wangxiaojun11@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).