[PATCH] f2fs: give another chance to issue discard with current granularity

From: Chao Yu
Date: Tue Jul 03 2018 - 08:18:35 EST


If discard IOs are blocked by user IO, do not skip to select and issue
discard with lower granularity, retry with current granularity.

Signed-off-by: Chao Yu <yuchao0@xxxxxxxxxx>
---
fs/f2fs/segment.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 60f54ed1413a..13f5e3665bf0 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1199,6 +1199,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
pend_list = &dcc->pend_list[i];

mutex_lock(&dcc->cmd_lock);
+retry:
if (list_empty(pend_list))
goto next;
if (unlikely(dcc->rbtree_check))
@@ -1221,6 +1222,13 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
break;
}
blk_finish_plug(&plug);
+
+ /*
+ * if discard IO was interrupted by user IOs, give another
+ * chance to issue discard with current granularity.
+ */
+ if (io_interrupted)
+ goto retry;
next:
mutex_unlock(&dcc->cmd_lock);

--
2.18.0.rc1