* [PATCH v3] f2fs: stop issue discard if something wrong with f2fs
@ 2018-04-09 11:27 Yunlei He
2018-04-10 2:36 ` Chao Yu
0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2018-04-09 11:27 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: zhangdianfang
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
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/segment.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 5854cc4..e31d506 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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;
--
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] f2fs: stop issue discard if something wrong with f2fs
2018-04-09 11:27 [PATCH v3] f2fs: stop issue discard if something wrong with f2fs Yunlei He
@ 2018-04-10 2:36 ` Chao Yu
2018-04-10 2:46 ` heyunlei
0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2018-04-10 2:36 UTC (permalink / raw)
To: Yunlei He, jaegeuk, linux-f2fs-devel; +Cc: zhangdianfang
On 2018/4/9 19:27, Yunlei He wrote:
> 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
>
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
> fs/f2fs/segment.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 5854cc4..e31d506 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -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,
> +
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] f2fs: stop issue discard if something wrong with f2fs
2018-04-10 2:36 ` Chao Yu
@ 2018-04-10 2:46 ` heyunlei
2018-04-10 3:12 ` Chao Yu
0 siblings, 1 reply; 4+ messages in thread
From: heyunlei @ 2018-04-10 2:46 UTC (permalink / raw)
To: Yuchao (T), jaegeuk@kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Cc: Zhangdianfang (Euler)
>-----Original Message-----
>From: Yuchao (T)
>Sent: Tuesday, April 10, 2018 10:36 AM
>To: heyunlei; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net
>Cc: Wangbintian; Zhangdianfang (Euler)
>Subject: Re: [f2fs-dev][PATCH v3] f2fs: stop issue discard if something wrong with f2fs
>
>On 2018/4/9 19:27, Yunlei He wrote:
>> 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
>>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> ---
>> fs/f2fs/segment.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 5854cc4..e31d506 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -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?
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.
>
>Thanks,
>
>> +
>> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] f2fs: stop issue discard if something wrong with f2fs
2018-04-10 2:46 ` heyunlei
@ 2018-04-10 3:12 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-04-10 3:12 UTC (permalink / raw)
To: heyunlei, jaegeuk@kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Cc: Zhangdianfang (Euler)
On 2018/4/10 10:46, heyunlei wrote:
>
>
>> -----Original Message-----
>> From: Yuchao (T)
>> Sent: Tuesday, April 10, 2018 10:36 AM
>> To: heyunlei; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net
>> Cc: Wangbintian; Zhangdianfang (Euler)
>> Subject: Re: [f2fs-dev][PATCH v3] f2fs: stop issue discard if something wrong with f2fs
>>
>> On 2018/4/9 19:27, Yunlei He wrote:
>>> 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
>>>
>>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>>> ---
>>> fs/f2fs/segment.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index 5854cc4..e31d506 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -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?
>
> 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,
>
> Thanks.
>
>>
>> Thanks,
>>
>>> +
>>> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-10 3:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-09 11:27 [PATCH v3] f2fs: stop issue discard if something wrong with f2fs Yunlei He
2018-04-10 2:36 ` Chao Yu
2018-04-10 2:46 ` heyunlei
2018-04-10 3:12 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).