All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: remove unused check on nid
@ 2020-09-21  6:19 Wang Xiaojun
  2020-09-21  9:20 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Xiaojun @ 2020-09-21  6:19 UTC (permalink / raw)
  To: yuchao0, jaegeuk; +Cc: linux-f2fs-devel

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;
 
@@ -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;
 
-- 
2.25.1



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

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

* Re: [f2fs-dev] [PATCH] f2fs: remove unused check on nid
  2020-09-21  6:19 [f2fs-dev] [PATCH] f2fs: remove unused check on nid Wang Xiaojun
@ 2020-09-21  9:20 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2020-09-21  9:20 UTC (permalink / raw)
  To: Wang Xiaojun, jaegeuk; +Cc: linux-f2fs-devel

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

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

end of thread, other threads:[~2020-09-21  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21  6:19 [f2fs-dev] [PATCH] f2fs: remove unused check on nid Wang Xiaojun
2020-09-21  9:20 ` Chao Yu

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.