* [PATCH] f2fs: remove unneed reada during build free nids
@ 2018-02-09 3:58 Yunlei He
2018-02-09 13:36 ` Chao Yu
0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2018-02-09 3:58 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: heyunlei
This patch remove unneed reada during build free nids.
If few nids left, three will introduce a lot of no hit
read io.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/node.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 833b46b..ad28965 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2033,10 +2033,6 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
return;
}
- /* readahead nat pages to be scanned */
- ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nid), FREE_NID_PAGES,
- META_NAT, true);
-
down_read(&nm_i->nat_tree_lock);
while (1) {
@@ -2052,7 +2048,12 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
if (unlikely(nid >= nm_i->max_nid))
nid = 0;
- if (++i >= FREE_NID_PAGES)
+ /* bg build, no more than 8 pages */
+ if ((!sync || mount) && ++i >= FREE_NID_PAGES)
+ break;
+
+ /* fg build, until free nids is not zero */
+ if (sync && !mount && nm_i->nid_cnt[FREE_NID])
break;
}
@@ -2063,9 +2064,6 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
scan_curseg_cache(sbi);
up_read(&nm_i->nat_tree_lock);
-
- ra_meta_pages(sbi, NAT_BLOCK_OFFSET(nm_i->next_scan_nid),
- nm_i->ra_nid_pages, META_NAT, false);
}
void build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount)
--
1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: remove unneed reada during build free nids
2018-02-09 3:58 [PATCH] f2fs: remove unneed reada during build free nids Yunlei He
@ 2018-02-09 13:36 ` Chao Yu
2018-02-11 1:55 ` heyunlei
0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2018-02-09 13:36 UTC (permalink / raw)
To: Yunlei He, jaegeuk, yuchao0, linux-f2fs-devel
On 2018/2/9 11:58, Yunlei He wrote:
> This patch remove unneed reada during build free nids.
> If few nids left, three will introduce a lot of no hit
> read io.
I guess it is due to be lack of commit c1fe3e981440 ("Revert "f2fs:
reuse nids more aggressively""), before that commit, we will update
.next_scan_nid randomly instead of updating it ascendingly, then
during __build_free_nids we may readahead NAT pages starting from
random position.
Could try that commit to check IO again?
Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: remove unneed reada during build free nids
2018-02-09 13:36 ` Chao Yu
@ 2018-02-11 1:55 ` heyunlei
2018-02-11 3:12 ` Chao Yu
0 siblings, 1 reply; 4+ messages in thread
From: heyunlei @ 2018-02-11 1:55 UTC (permalink / raw)
To: Chao Yu, jaegeuk@kernel.org, Yuchao (T),
linux-f2fs-devel@lists.sourceforge.net
>-----Original Message-----
>From: Chao Yu [mailto:chao@kernel.org]
>Sent: Friday, February 09, 2018 9:37 PM
>To: heyunlei; jaegeuk@kernel.org; Yuchao (T); linux-f2fs-devel@lists.sourceforge.net
>Subject: Re: [f2fs-dev] [PATCH] f2fs: remove unneed reada during build free nids
>
>On 2018/2/9 11:58, Yunlei He wrote:
>> This patch remove unneed reada during build free nids.
>> If few nids left, three will introduce a lot of no hit
>> read io.
>
>I guess it is due to be lack of commit c1fe3e981440 ("Revert "f2fs:
>reuse nids more aggressively""), before that commit, we will update
>.next_scan_nid randomly instead of updating it ascendingly, then
>during __build_free_nids we may readahead NAT pages starting from
>random position.
I think commit c1fe3e981440 will reduce fragment of nat area, it
will locate all used nids at the left head of nat area, which I think
will do benefit to WA ?
e.g, if we have used 10000 nids, which will hold 10000/455 blocks at least.
Without this commit, the blocks taken for nids will expansion, may be 10000
blocks in the worst case, at this time, if we update node info, we will produce
more nat IOs?
>
>Could try that commit to check IO again?
>
>Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: remove unneed reada during build free nids
2018-02-11 1:55 ` heyunlei
@ 2018-02-11 3:12 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-02-11 3:12 UTC (permalink / raw)
To: heyunlei, Chao Yu, jaegeuk@kernel.org,
linux-f2fs-devel@lists.sourceforge.net
On 2018/2/11 9:55, heyunlei wrote:
>
>
>> -----Original Message-----
>> From: Chao Yu [mailto:chao@kernel.org]
>> Sent: Friday, February 09, 2018 9:37 PM
>> To: heyunlei; jaegeuk@kernel.org; Yuchao (T); linux-f2fs-devel@lists.sourceforge.net
>> Subject: Re: [f2fs-dev] [PATCH] f2fs: remove unneed reada during build free nids
>>
>> On 2018/2/9 11:58, Yunlei He wrote:
>>> This patch remove unneed reada during build free nids.
>>> If few nids left, three will introduce a lot of no hit
>>> read io.
>>
>> I guess it is due to be lack of commit c1fe3e981440 ("Revert "f2fs:
>> reuse nids more aggressively""), before that commit, we will update
>> .next_scan_nid randomly instead of updating it ascendingly, then
>> during __build_free_nids we may readahead NAT pages starting from
>> random position.
>
> I think commit c1fe3e981440 will reduce fragment of nat area, it
> will locate all used nids at the left head of nat area, which I think
> will do benefit to WA ?
Yup, IMO, it can reduce WA. ;)
Also, there is another patch intends to reduce WA by adjusting allocation
policy of free nid.
FYI
https://patchwork.kernel.org/patch/10084653/
>
> e.g, if we have used 10000 nids, which will hold 10000/455 blocks at least.
> Without this commit, the blocks taken for nids will expansion, may be 10000
> blocks in the worst case, at this time, if we update node info, we will produce
> more nat IOs?
That's right.
Thanks,
>
>>
>> Could try that commit to check IO again?
>>
>> Thanks,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-11 3:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 3:58 [PATCH] f2fs: remove unneed reada during build free nids Yunlei He
2018-02-09 13:36 ` Chao Yu
2018-02-11 1:55 ` heyunlei
2018-02-11 3:12 ` Chao Yu
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).