summaryrefslogtreecommitdiff
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorYunlei He <heyunlei@huawei.com>2018-04-13 11:08:05 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-31 11:31:47 -0700
commitd618477473ebd9abc26580a762f460860e541f57 (patch)
tree7040bc5f4e70fc6f60d8315a6e089a4adc98ca18 /fs/f2fs/segment.c
parentb169c3c560e2b133860f0496d0872699c9b48d54 (diff)
f2fs: stop issue discard if something wrong with f2fs
v4->v5: move data corruption check to __submit_discard_cmd, in order to control discard io submitted more accurately, besides, increase async thread wait time if data corruption detected. This patch stop async thread and umount process to issue discard if something wrong with f2fs, which is similar to fstrim. Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 33d33db15d2f..7843089f6699 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -963,6 +963,9 @@ static void __submit_discard_cmd(struct f2fs_sb_info *sbi,
if (dc->state != D_PREP)
return;
+ if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
+ return;
+
trace_f2fs_issue_discard(dc->bdev, dc->start, dc->len);
dc->error = __blkdev_issue_discard(dc->bdev,
@@ -1395,6 +1398,10 @@ static int issue_discard_thread(void *data)
continue;
if (kthread_should_stop())
return 0;
+ if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
+ wait_ms = dpolicy.max_interval;
+ continue;
+ }
if (dcc->discard_wake)
dcc->discard_wake = 0;