f2fs: stop issue discard if something wrong with f2fs
PATCH v2 1/1 f2fs: stop issue discard if something wrong with f2fs
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
--- fs/f2fs/segment.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/segment.c +6 -1
@@ -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 ;
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
Quoted 15 lines · Yunlei He
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 processSigned-off-by Yunlei He <[email protected]>--- fs/f2fs/segment.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/segment.c +0
-0
fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1207
Quoted 6 lines
fs/f2fs/segment.c +3
-0@@ -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." );
I think we don't need to print this message redundantly if we have print in all places we set the flag.
So let's just skip issuing discard in async thread and __submit_discard_cmd.
fs/f2fs/segment.c static int issue_discard_thread(void *data) · line 1413
Quoted 11 lines
fs/f2fs/segment.c +3
-1+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 ; -
We'd better to avoid meaningless blank line removal.
Thank,s
fs/f2fs/segment.c static int issue_discard_thread(void *data) · line 1421
Quoted 4 lines
fs/f2fs/segment.c +0
-0if (dcc->discard_wake) dcc->discard_wake =0 ;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 28 lines
-----Original Message-----
From: Yuchao (T)
Sent: Monday, April 09, 2018 7:05 PM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Zhangdianfang (Euler)
Subject: Re: [f2fs-dev][PATCH v2] f2fs: stop issue discard if something wrong with f2fsQuoted 18 lines · Yunlei He
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 processSigned-off-by Yunlei He <[email protected]>--- fs/f2fs/segment.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/segment.c +0
-0@@ -1202,6 +1202,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,int i, iter =0 , issued =0 ;bool io_interrupted = false;
Quoted 8 lines
fs/f2fs/segment.c static int __issue_discard_cmd(struct f2fs_sb_info *sbi, · line 1207
Quoted 3 lines
fs/f2fs/segment.c +3
-0+if (is_sbi_flag_set (sbi,SBI_NEED_FSCK )) { +f2fs_msg (sbi->sb,KERN_WARNING , +"Found FS corruption, run fsck to fix." );I think we don't need to print this message redundantly if we have print in all places we set the flag.
So let's just skip issuing discard in async thread and
__submit_discard_cmd.
Okay, I'll resend a new version.
Quoted 14 lines
fs/f2fs/segment.c static int issue_discard_thread(void *data) · line 1413
Quoted 12 lines
fs/f2fs/segment.c +3
-1+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 ; -We'd better to avoid meaningless blank line removal.
Sorry for this mistake.
Thanks.
Quoted 7 lines
Thank,s
Quoted 4 lines
fs/f2fs/segment.c +0
-0if (dcc->discard_wake) dcc->discard_wake =0 ;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot