* [PATCH] btrfs-progs: check for minimal needed number of zones
@ 2021-05-12 7:53 Johannes Thumshirn
2021-05-12 10:36 ` David Sterba
2021-05-12 14:19 ` Naohiro Aota
0 siblings, 2 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2021-05-12 7:53 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Johannes Thumshirn
In order to create a usable zoned filesystem a minimum of 5 zones is
needed:
- 2 zones for the 1st superblock
- 1 zone for the system block group
- 1 zone for a metadata block group
- 1 zone for a data block group
Some tests in xfstests create a sized filesystem and depending on the zone
size of the underlying device, it may happen, that this filesystem is too
small to be used. It's better to not create a filesystem at all than to
create an unusable filesystem.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
mkfs/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mkfs/main.c b/mkfs/main.c
index 104eead2cee8..a56d970f6362 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1283,6 +1283,14 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
min_dev_size);
goto error;
}
+ if (zoned && block_count && block_count < 5 * zone_size(file)) {
+ error("size %llu is too small to make a usable filesystem",
+ block_count);
+ error("minimum size for a zoned btrfs filesystem is %llu",
+ min_dev_size);
+ goto error;
+ }
+
for (i = saved_optind; i < saved_optind + dev_cnt; i++) {
char *path;
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: check for minimal needed number of zones
2021-05-12 7:53 [PATCH] btrfs-progs: check for minimal needed number of zones Johannes Thumshirn
@ 2021-05-12 10:36 ` David Sterba
2021-05-12 12:27 ` Johannes Thumshirn
2021-05-12 14:19 ` Naohiro Aota
1 sibling, 1 reply; 5+ messages in thread
From: David Sterba @ 2021-05-12 10:36 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs
On Wed, May 12, 2021 at 04:53:05PM +0900, Johannes Thumshirn wrote:
> In order to create a usable zoned filesystem a minimum of 5 zones is
> needed:
>
> - 2 zones for the 1st superblock
> - 1 zone for the system block group
> - 1 zone for a metadata block group
> - 1 zone for a data block group
>
> Some tests in xfstests create a sized filesystem and depending on the zone
> size of the underlying device, it may happen, that this filesystem is too
> small to be used. It's better to not create a filesystem at all than to
> create an unusable filesystem.
Agreed, though there's no spare zone for relocation once any of them
becomes unusable (which is a known problem and can happen for any zone
count). Once this gets solved the limit will be increased accordingly.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: check for minimal needed number of zones
2021-05-12 10:36 ` David Sterba
@ 2021-05-12 12:27 ` Johannes Thumshirn
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2021-05-12 12:27 UTC (permalink / raw)
To: dsterba; +Cc: David Sterba, linux-btrfs
On 12/05/2021 12:39, David Sterba wrote:
> On Wed, May 12, 2021 at 04:53:05PM +0900, Johannes Thumshirn wrote:
>> In order to create a usable zoned filesystem a minimum of 5 zones is
>> needed:
>>
>> - 2 zones for the 1st superblock
>> - 1 zone for the system block group
>> - 1 zone for a metadata block group
>> - 1 zone for a data block group
>>
>> Some tests in xfstests create a sized filesystem and depending on the zone
>> size of the underlying device, it may happen, that this filesystem is too
>> small to be used. It's better to not create a filesystem at all than to
>> create an unusable filesystem.
>
> Agreed, though there's no spare zone for relocation once any of them
> becomes unusable (which is a known problem and can happen for any zone
> count). Once this gets solved the limit will be increased accordingly.
>
Indeed, I'm planning to have something like a 'global' reserve zone for
relocation. Hope to get this done before the cut for v5.14.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: check for minimal needed number of zones
2021-05-12 7:53 [PATCH] btrfs-progs: check for minimal needed number of zones Johannes Thumshirn
2021-05-12 10:36 ` David Sterba
@ 2021-05-12 14:19 ` Naohiro Aota
2021-05-17 7:40 ` Johannes Thumshirn
1 sibling, 1 reply; 5+ messages in thread
From: Naohiro Aota @ 2021-05-12 14:19 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs
On Wed, May 12, 2021 at 04:53:05PM +0900, Johannes Thumshirn wrote:
> In order to create a usable zoned filesystem a minimum of 5 zones is
> needed:
>
> - 2 zones for the 1st superblock
> - 1 zone for the system block group
> - 1 zone for a metadata block group
> - 1 zone for a data block group
>
> Some tests in xfstests create a sized filesystem and depending on the zone
> size of the underlying device, it may happen, that this filesystem is too
> small to be used. It's better to not create a filesystem at all than to
> create an unusable filesystem.
We also want to think about reserved zones for regular
superblocks. For example, with zone_size == 16M, we reserve zone #4
for regular superblock at 64MB, and this setup require one more zone
to allocate a data block group.
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> mkfs/main.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/mkfs/main.c b/mkfs/main.c
> index 104eead2cee8..a56d970f6362 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -1283,6 +1283,14 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
> min_dev_size);
> goto error;
> }
> + if (zoned && block_count && block_count < 5 * zone_size(file)) {
> + error("size %llu is too small to make a usable filesystem",
> + block_count);
> + error("minimum size for a zoned btrfs filesystem is %llu",
> + min_dev_size);
This should be "5 * zone_size(file)".
How about extending btrfs_min_dev_size() for zoned? Then, we can avoid
repeating the size check code.
> + goto error;
> + }
> +
> for (i = saved_optind; i < saved_optind + dev_cnt; i++) {
> char *path;
>
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: check for minimal needed number of zones
2021-05-12 14:19 ` Naohiro Aota
@ 2021-05-17 7:40 ` Johannes Thumshirn
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2021-05-17 7:40 UTC (permalink / raw)
To: Naohiro Aota; +Cc: David Sterba, linux-btrfs
On 12/05/2021 16:19, Naohiro Aota wrote:
> On Wed, May 12, 2021 at 04:53:05PM +0900, Johannes Thumshirn wrote:
>> In order to create a usable zoned filesystem a minimum of 5 zones is
>> needed:
>>
>> - 2 zones for the 1st superblock
>> - 1 zone for the system block group
>> - 1 zone for a metadata block group
>> - 1 zone for a data block group
>>
>> Some tests in xfstests create a sized filesystem and depending on the zone
>> size of the underlying device, it may happen, that this filesystem is too
>> small to be used. It's better to not create a filesystem at all than to
>> create an unusable filesystem.
>
> We also want to think about reserved zones for regular
> superblocks. For example, with zone_size == 16M, we reserve zone #4
> for regular superblock at 64MB, and this setup require one more zone
> to allocate a data block group.
>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> ---
>> mkfs/main.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/mkfs/main.c b/mkfs/main.c
>> index 104eead2cee8..a56d970f6362 100644
>> --- a/mkfs/main.c
>> +++ b/mkfs/main.c
>> @@ -1283,6 +1283,14 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>> min_dev_size);
>> goto error;
>> }
>> + if (zoned && block_count && block_count < 5 * zone_size(file)) {
>> + error("size %llu is too small to make a usable filesystem",
>> + block_count);
>> + error("minimum size for a zoned btrfs filesystem is %llu",
>> + min_dev_size);
>
> This should be "5 * zone_size(file)".
>
> How about extending btrfs_min_dev_size() for zoned? Then, we can avoid
> repeating the size check code.
I'll look into it.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-17 7:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 7:53 [PATCH] btrfs-progs: check for minimal needed number of zones Johannes Thumshirn
2021-05-12 10:36 ` David Sterba
2021-05-12 12:27 ` Johannes Thumshirn
2021-05-12 14:19 ` Naohiro Aota
2021-05-17 7:40 ` Johannes Thumshirn
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.