This patch stop discard thread to issue discard io if something wrong with f2fs, which is similar to fstrim.
v1->v2: add fs error check in not only discard thread but also umount process Signed-off-by: Yunlei He <[email protected]> --- fs/f2fs/segment.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5854cc4..7f45cc4 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1202,6 +1202,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, int i, iter = 0, issued = 0; bool io_interrupted = false; + if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) { + f2fs_msg(sbi->sb, KERN_WARNING, + "Found FS corruption, run fsck to fix."); + return issued; + } + for (i = MAX_PLIST_NUM - 1; i >= 0; i--) { if (i + 1 < dpolicy->granularity) break; @@ -1410,7 +1416,6 @@ static int issue_discard_thread(void *data) continue; if (kthread_should_stop()) return 0; - if (dcc->discard_wake) dcc->discard_wake = 0; -- 1.9.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
