summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-12-13 20:50:51 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-12-26 15:16:54 -0800
commit76c7bfb3a89371aa87bda99c8ee2611ff5150434 (patch)
tree5310982a9ad5cffc7fe84fea7f4cb1ad0885dcbc /fs/f2fs/segment.c
parent72691af6dbd719349c559117652a70bfd4309ad2 (diff)
downloadlinux-76c7bfb3a89371aa87bda99c8ee2611ff5150434.tar.gz
linux-76c7bfb3a89371aa87bda99c8ee2611ff5150434.tar.bz2
linux-76c7bfb3a89371aa87bda99c8ee2611ff5150434.zip
f2fs: flush stale issued discard candidates
Sometimes, I could observe # of issuing_discard to be 1 which blocks background jobs due to is_idle()=false. The only way to get out of it was to trigger gc_urgent. This patch avoids that by checking any candidates as done in the list. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 0f7a92be678a..d9a3345a244a 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1652,6 +1652,10 @@ static int issue_discard_thread(void *data)
if (dcc->discard_wake)
dcc->discard_wake = 0;
+ /* clean up pending candidates before going to sleep */
+ if (atomic_read(&dcc->queued_discard))
+ __wait_all_discard_cmd(sbi, NULL);
+
if (try_to_freeze())
continue;
if (f2fs_readonly(sbi->sb))