summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2021-02-22 11:07:33 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2021-03-12 22:16:42 +0100
commit43f8c47ea7d59c7b2270835f1d7c4618a1ea27b6 (patch)
tree1c056b5cf8b92c3fec9d733e6de555d36d2365e5 /fs/f2fs
parentf2fs: update comments for explicit memory barrier (diff)
downloadlinux-43f8c47ea7d59c7b2270835f1d7c4618a1ea27b6.tar.xz
linux-43f8c47ea7d59c7b2270835f1d7c4618a1ea27b6.zip
f2fs: check discard command number before traversing discard pending list
In trim thread, let's add a condition to check discard command number before traversing discard pending list, it can avoid unneeded traversing if there is no discard command. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 29403540ff6e..b5a40a39a03f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1759,6 +1759,8 @@ static int issue_discard_thread(void *data)
wait_ms = dpolicy.max_interval;
continue;
}
+ if (!atomic_read(&dcc->discard_cmd_cnt))
+ continue;
if (sbi->gc_mode == GC_URGENT_HIGH)
__init_discard_policy(sbi, &dpolicy, DPOLICY_FORCE, 1);