aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/shrinker.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2016-10-12 19:28:29 +0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:34:18 +0200
commit33406a01ae3dd9db134e831fda22391aa6c26b93 (patch)
tree8664f95f1a35078b6dfe2881f0b9ee983168e0f1 /fs/f2fs/shrinker.c
parenta1c6090b950c6cef05b49ccac9e3624ffbda46cf (diff)
f2fs: split free nid list
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>
Diffstat (limited to 'fs/f2fs/shrinker.c')
-rw-r--r--fs/f2fs/shrinker.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index 30fb48137..618dc65e2 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -26,8 +26,8 @@ static unsigned long __count_nat_entries(struct f2fs_sb_info *sbi)
static unsigned long __count_free_nids(struct f2fs_sb_info *sbi)
{
- if (NM_I(sbi)->fcnt > MAX_FREE_NIDS)
- return NM_I(sbi)->fcnt - MAX_FREE_NIDS;
+ if (NM_I(sbi)->nid_cnt[FREE_NID_LIST] > MAX_FREE_NIDS)
+ return NM_I(sbi)->nid_cnt[FREE_NID_LIST] - MAX_FREE_NIDS;
return 0;
}