f2fs: split free nid list
authorChao Yu <yuchao0@huawei.com>
Wed, 12 Oct 2016 11:28:29 +0000 (19:28 +0800)
committerJaegeuk Kim <jaegeuk@google.com>
Mon, 25 Sep 2017 22:05:19 +0000 (15:05 -0700)
commite18c2624506f44b87f505adc36b78782eacd8628
treed2fdd2a6089fd9c8949a909ed79a433426145dff
parent8db338877d72a24743a3808d4bc774f74a058f8f
f2fs: split free nid list

commit b8559dc242d1d47dcf99660a4d6afded727e0cc0 upstream.

During free nid allocation, in order to do preallocation, we will tag free
nid entry as allocated one and still leave it in free nid list, for other
allocators who want to grab free nids, it needs to traverse the free nid
list for lookup. It becomes overhead in scenario of allocating free nid
intensively by multithreads.

This patch splits free nid list to two list: {free,alloc}_nid_list, to
keep free nids and preallocated free nids separately, after that, traverse
latency will be gone, besides split nid_cnt for separate statistic.

Additionally, introduce __insert_nid_to_list and __remove_nid_from_list for
cleanup.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: modify f2fs_bug_on to avoid needless branches]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/debug.c
fs/f2fs/f2fs.h
fs/f2fs/node.c
fs/f2fs/node.h
fs/f2fs/shrinker.c