All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] resize.f2fs: fix new reserved segments calculation
@ 2021-02-24 17:03 Arnaud Ferraris
  2021-02-25  1:50 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Ferraris @ 2021-02-24 17:03 UTC (permalink / raw
  To: linux-f2fs-devel; +Cc: jaegeuk, Arnaud Ferraris

f8410857b7a81b1b347253fcca713d8b105e9e7b changed the way reserved
segments count was calculated in `mkfs`, but that wasn't reported back
to `resize`, making it impossible to resize a filesystem in some cases.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
---
 fsck/resize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fsck/resize.c b/fsck/resize.c
index 46b1cfb..3ee05f7 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -148,8 +148,8 @@ safe_resize:
 	/* Let's determine the best reserved and overprovisioned space */
 	c.new_overprovision = get_best_overprovision(sb);
 	c.new_reserved_segments =
-		(2 * (100 / c.new_overprovision + 1) + 6) *
-						get_sb(segs_per_sec);
+		(2 * (100 / c.new_overprovision + 1) + NR_CURSEG_TYPE) *
+			round_up(f2fs_get_usable_segments(sb), get_sb(section_count));
 
 	if ((get_sb(segment_count_main) - 2) < c.new_reserved_segments ||
 		get_sb(segment_count_main) * blks_per_seg >
-- 
2.30.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH] resize.f2fs: fix new reserved segments calculation
  2021-02-24 17:03 [f2fs-dev] [PATCH] resize.f2fs: fix new reserved segments calculation Arnaud Ferraris
@ 2021-02-25  1:50 ` Chao Yu
  2021-02-25  9:18   ` Arnaud Ferraris
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2021-02-25  1:50 UTC (permalink / raw
  To: Arnaud Ferraris, linux-f2fs-devel; +Cc: jaegeuk

On 2021/2/25 1:03, Arnaud Ferraris wrote:
> f8410857b7a81b1b347253fcca713d8b105e9e7b changed the way reserved

Commit f8410857b7a8 ("f2fs-tools: zns zone-capacity support") changed ...

Otherwise, it looks good to me.

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> segments count was calculated in `mkfs`, but that wasn't reported back
> to `resize`, making it impossible to resize a filesystem in some cases.
> 
> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
> ---
>   fsck/resize.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fsck/resize.c b/fsck/resize.c
> index 46b1cfb..3ee05f7 100644
> --- a/fsck/resize.c
> +++ b/fsck/resize.c
> @@ -148,8 +148,8 @@ safe_resize:
>   	/* Let's determine the best reserved and overprovisioned space */
>   	c.new_overprovision = get_best_overprovision(sb);
>   	c.new_reserved_segments =
> -		(2 * (100 / c.new_overprovision + 1) + 6) *
> -						get_sb(segs_per_sec);
> +		(2 * (100 / c.new_overprovision + 1) + NR_CURSEG_TYPE) *
> +			round_up(f2fs_get_usable_segments(sb), get_sb(section_count));
>   
>   	if ((get_sb(segment_count_main) - 2) < c.new_reserved_segments ||
>   		get_sb(segment_count_main) * blks_per_seg >
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH] resize.f2fs: fix new reserved segments calculation
  2021-02-25  1:50 ` Chao Yu
@ 2021-02-25  9:18   ` Arnaud Ferraris
  2021-02-25 15:35     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Ferraris @ 2021-02-25  9:18 UTC (permalink / raw
  To: Chao Yu, linux-f2fs-devel; +Cc: jaegeuk

Hi,

Le 25/02/2021 à 02:50, Chao Yu a écrit :
> On 2021/2/25 1:03, Arnaud Ferraris wrote:
>> f8410857b7a81b1b347253fcca713d8b105e9e7b changed the way reserved
> 
> Commit f8410857b7a8 ("f2fs-tools: zns zone-capacity support") changed ...

Will do.
However, I didn't test that patch enough as it can corrupt large
filesystems, I'll dig a bit deeper and post a v2 asap.

Thanks,
Arnaud

> 
> Otherwise, it looks good to me.
> 
> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> 
> Thanks,
> 
>> segments count was calculated in `mkfs`, but that wasn't reported back
>> to `resize`, making it impossible to resize a filesystem in some cases.
>>
>> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
>> ---
>>   fsck/resize.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fsck/resize.c b/fsck/resize.c
>> index 46b1cfb..3ee05f7 100644
>> --- a/fsck/resize.c
>> +++ b/fsck/resize.c
>> @@ -148,8 +148,8 @@ safe_resize:
>>       /* Let's determine the best reserved and overprovisioned space */
>>       c.new_overprovision = get_best_overprovision(sb);
>>       c.new_reserved_segments =
>> -        (2 * (100 / c.new_overprovision + 1) + 6) *
>> -                        get_sb(segs_per_sec);
>> +        (2 * (100 / c.new_overprovision + 1) + NR_CURSEG_TYPE) *
>> +            round_up(f2fs_get_usable_segments(sb),
>> get_sb(section_count));
>>         if ((get_sb(segment_count_main) - 2) < c.new_reserved_segments ||
>>           get_sb(segment_count_main) * blks_per_seg >
>>


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH] resize.f2fs: fix new reserved segments calculation
  2021-02-25  9:18   ` Arnaud Ferraris
@ 2021-02-25 15:35     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2021-02-25 15:35 UTC (permalink / raw
  To: Arnaud Ferraris, Chao Yu, linux-f2fs-devel; +Cc: jaegeuk

On 2021/2/25 17:18, Arnaud Ferraris wrote:
> Hi,
> 
> Le 25/02/2021 à 02:50, Chao Yu a écrit :
>> On 2021/2/25 1:03, Arnaud Ferraris wrote:
>>> f8410857b7a81b1b347253fcca713d8b105e9e7b changed the way reserved
>>
>> Commit f8410857b7a8 ("f2fs-tools: zns zone-capacity support") changed ...
> 
> Will do.
> However, I didn't test that patch enough as it can corrupt large

Oops, I've no idea why this can happen after reviewing these codes..

Let me know you have any progress.

Thanks

> filesystems, I'll dig a bit deeper and post a v2 asap.
> 
> Thanks,
> Arnaud
> 
>>
>> Otherwise, it looks good to me.
>>
>> Reviewed-by: Chao Yu <yuchao0@huawei.com>
>>
>> Thanks,
>>
>>> segments count was calculated in `mkfs`, but that wasn't reported back
>>> to `resize`, making it impossible to resize a filesystem in some cases.
>>>
>>> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
>>> ---
>>>    fsck/resize.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fsck/resize.c b/fsck/resize.c
>>> index 46b1cfb..3ee05f7 100644
>>> --- a/fsck/resize.c
>>> +++ b/fsck/resize.c
>>> @@ -148,8 +148,8 @@ safe_resize:
>>>        /* Let's determine the best reserved and overprovisioned space */
>>>        c.new_overprovision = get_best_overprovision(sb);
>>>        c.new_reserved_segments =
>>> -        (2 * (100 / c.new_overprovision + 1) + 6) *
>>> -                        get_sb(segs_per_sec);
>>> +        (2 * (100 / c.new_overprovision + 1) + NR_CURSEG_TYPE) *
>>> +            round_up(f2fs_get_usable_segments(sb),
>>> get_sb(section_count));
>>>          if ((get_sb(segment_count_main) - 2) < c.new_reserved_segments ||
>>>            get_sb(segment_count_main) * blks_per_seg >
>>>
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-25 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-24 17:03 [f2fs-dev] [PATCH] resize.f2fs: fix new reserved segments calculation Arnaud Ferraris
2021-02-25  1:50 ` Chao Yu
2021-02-25  9:18   ` Arnaud Ferraris
2021-02-25 15:35     ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.