summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorHeng Xiao <heng.xiao@unisoc.com>2019-07-03 05:29:57 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2019-07-11 04:13:53 +0300
commit6e0cd4a9dd4df1a0afcb454f1e654b5c80685913 (patch)
tree0d4696f802f2f8ad1b69747bd8bfa4149b107c76 /fs/f2fs
parentb13bdf03bb8007279bb0efdf127bafb2d84e8b0a (diff)
downloadlinux-6e0cd4a9dd4df1a0afcb454f1e654b5c80685913.tar.xz
f2fs: fix to avoid long latency during umount
In umount, we give an constand time to handle pending discard, previously, in __issue_discard_cmd() we missed to check timeout condition in loop, result in delaying long time, fix it. Signed-off-by: Heng Xiao <heng.xiao@unisoc.com> [Chao Yu: add commit message] 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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 478284db3065..2d1d7baaf1b6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1497,6 +1497,10 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
list_for_each_entry_safe(dc, tmp, pend_list, list) {
f2fs_bug_on(sbi, dc->state != D_PREP);
+ if (dpolicy->timeout != 0 &&
+ f2fs_time_over(sbi, dpolicy->timeout))
+ break;
+
if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
!is_idle(sbi, DISCARD_TIME)) {
io_interrupted = true;