Skip to contentSkip to conversation

f2fs: stop issue discard if something wrong with f2fs

PATCH Superseded Yunlei He 2 participants 4 messages Apr 9, 2018 – Apr 10, 2018 F2FS file system

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH v3 1/1 f2fs: stop issue discard if something wrong with f2fs

This patch stop async thread and umount process to issue discard 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 v2->v3: remove redundant error message

---
 fs/f2fs/segment.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/segment.c +3 -0
index 5854cc4..e31d506 100644
@@ -1202,6 +1202,9 @@ 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))
+		return issued;
+
 	for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
 		if (i + 1 < dpolicy->granularity)
 			break;
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
#1 lore raw
Quoted 16 lines · Yunlei He

This patch stop async thread and umount process to issue discard 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 v2->v3: remove redundant error message

---
 fs/f2fs/segment.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/segment.c +0 -0
index 5854cc4..e31d506 100644

fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1206

Quoted 5 lines
fs/f2fs/segment.c +2 -0
@@ -1202,6 +1202,9 @@ 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))
+		return issued;

Hmm.. except here, I mean we'd better add it into issue_discard_thread too?

Thanks,

fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1210

Quoted 5 lines
fs/f2fs/segment.c +1 -0
+
 	for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
 		if (i + 1 < dpolicy->granularity)
 			break;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#2 lore raw
Quoted 29 lines

-----Original Message-----
From: Yuchao (T)
Sent: Tuesday, April 10, 2018 10:36 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Zhangdianfang (Euler)
Subject: Re: [f2fs-dev][PATCH v3] f2fs: stop issue discard if something wrong with f2fs

Quoted 19 lines · Yunlei He

This patch stop async thread and umount process to issue discard 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 v2->v3: remove redundant error message

---
 fs/f2fs/segment.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/segment.c +0 -0
index 5854cc4..e31d506 100644
@@ -1202,6 +1202,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 	int i, iter = 0, issued = 0;
 	bool io_interrupted = false;
 
Quoted 4 lines

fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1206

Quoted 2 lines
fs/f2fs/segment.c +2 -0
+	if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
+		return issued;

Hmm.. except here, I mean we'd better add it into issue_discard_thread too?

Async thread will also use this function to issue discard, besides, in this case __issue_discard_cmd will return zero to async thread, thread will wait max Interval 60s. Anything I missed?

Thanks.

Quoted 8 lines

Thanks,

Quoted 5 lines
fs/f2fs/segment.c +1 -0
+
 	for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
 		if (i + 1 < dpolicy->granularity)
 			break;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#3 lore raw
Quoted 29 lines · heyunlei
Quoted 29 lines

-----Original Message-----
From: Yuchao (T)
Sent: Tuesday, April 10, 2018 10:36 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Zhangdianfang (Euler)
Subject: Re: [f2fs-dev][PATCH v3] f2fs: stop issue discard if something wrong with f2fs

Quoted 19 lines · Yunlei He

This patch stop async thread and umount process to issue discard 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 v2->v3: remove redundant error message

---
 fs/f2fs/segment.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/segment.c +0 -0
index 5854cc4..e31d506 100644
@@ -1202,6 +1202,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 	int i, iter = 0, issued = 0;
 	bool io_interrupted = false;
 
Quoted 8 lines
Quoted 4 lines

fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1206

Quoted 2 lines
fs/f2fs/segment.c +2 -0
+	if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
+		return issued;

Hmm.. except here, I mean we'd better add it into issue_discard_thread too?

Async thread will also use this function to issue discard, besides, in this case __issue_discard_cmd will return zero to async thread, thread will wait max Interval 60s. Anything I missed?

There is still locking overhead from sb_{start,end}_intwrite, although it's tiny, but since there is no way to revert NEED_FSCK status, so just let discard thread be aware of this to walk around is OK.

Thanks,

Quoted 6 lines

Thanks.

Quoted 3 lines

Thanks,

Quoted 9 lines
Quoted 5 lines

fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1210

Quoted 5 lines
fs/f2fs/segment.c +1 -0
+
 	for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
 		if (i + 1 < dpolicy->granularity)
 			break;

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot