aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-10-04 09:08:34 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-10-26 10:44:08 +0200
commit78997b569f5625f2762b3c4e743c33becdd5d99d (patch)
tree47662630449ff77dd02e0c4ef08ee5777079ba3e /fs/f2fs/segment.h
parentf2fs: wrap discard policy (diff)
downloadlinux-dev-78997b569f5625f2762b3c4e743c33becdd5d99d.tar.xz
linux-dev-78997b569f5625f2762b3c4e743c33becdd5d99d.zip
f2fs: split discard policy
There are many different scenarios such as fstrim, umount, urgent or background where we will issue discards, actually, they need use different policy in aspect of io aware, discard granularity, delay interval and so on. But now they just share one common discard policy, so there will be race when changing policy in between these scenarios, the interference of changing discard policy will be very serious. This patch changes to split discard policy for different scenarios. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r--fs/f2fs/segment.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index e0a6cc23ace3..5a1f7b9c8a72 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -796,8 +796,9 @@ static inline void wake_up_discard_thread(struct f2fs_sb_info *sbi, bool force)
goto wake_up;
mutex_lock(&dcc->cmd_lock);
- for (i = MAX_PLIST_NUM - 1;
- i >= 0 && plist_issue(dcc->pend_list_tag[i]); i--) {
+ for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
+ if (i + 1 < dcc->discard_granularity)
+ break;
if (!list_empty(&dcc->pend_list[i])) {
wakeup = true;
break;