Skip to contentSkip to conversation

f2fs: stop issue discard if something wrong with f2fs

PATCH In review Yunlei He 1 participant 2 messages Apr 13, 2018 – Apr 20, 2018 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH v5 1/1 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.

---
 fs/f2fs/segment.c | 7 +++++++
 1 file changed, 7 insertions(+)
fs/f2fs/segment.c +7 -0
index d923ef5..991d1a2 100644
@@ -929,6 +929,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,
@@ -1410,6 +1413,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;
Signature · 6 lines
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
author
#1 lore raw
Quoted 13 lines

-----Original Message-----
From: heyunlei
Sent: Friday, April 13, 2018 11:08 AM
To: [email protected]; Yuchao (T); [email protected]
Cc: Wangbintian; heyunlei; Zhangdianfang (Euler)
Subject: [f2fs-dev][PATCH v5] 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.

Quoted 7 lines

This patch stop async thread and umount process to issue discard if something wrong with f2fs, which is similar to fstrim.

---
fs/f2fs/segment.c | 7 +++++++

1 file changed, 7 insertions(+)

Ping

Thanks.

Quoted 27 lines
fs/f2fs/segment.c +7 -1
index d923ef5..991d1a2 100644
@@ -929,6 +929,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,
@@ -1410,6 +1413,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;
--
Quoted 1 line

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