mbox series

[0/7] btrfs-progs: zoned: proper "mkfs.btrfs -b" support

Message ID 20240514005133.44786-1-naohiro.aota@wdc.com (mailing list archive)
Headers show
Series btrfs-progs: zoned: proper "mkfs.btrfs -b" support | expand

Message

Naohiro Aota May 14, 2024, 12:51 a.m. UTC
mkfs.btrfs -b <byte_count> on a zoned device has several issues listed
below.

- The FS size needs to be larger than minimal size that can host a btrfs,
  but its calculation does not consider non-SINGLE profile
- The calculation also does not ensure tree-log BG and data relocation BG
- It allows creating a FS not aligned to the zone boundary
- It resets all device zones beyond the specified length

This series fixes the issues with some cleanups.

Patches 1 to 3 are clean up patches, so they should not change the behavior.

Patches 4 to 6 address the issues and the last patch adds a test case.

Naohiro Aota (7):
  btrfs-progs: rename block_count to byte_count
  btrfs-progs: mkfs: remove duplicated device size check
  btrfs-progs: mkfs: unify zoned mode minimum size calc into
    btrfs_min_dev_size()
  btrfs-progs: mkfs: fix minimum size calculation for zoned
  btrfs-progs: mkfs: check if byte_count is zone size aligned
  btrfs-progs: support byte length for zone resetting
  btrfs-progs: add test for zone resetting

 common/device-utils.c                    | 45 +++++++------
 kernel-shared/zoned.c                    | 23 ++++++-
 kernel-shared/zoned.h                    |  2 +-
 mkfs/common.c                            | 48 +++++++++++++-
 mkfs/common.h                            |  2 +-
 mkfs/main.c                              | 82 ++++++++++--------------
 tests/mkfs-tests/032-zoned-reset/test.sh | 62 ++++++++++++++++++
 7 files changed, 192 insertions(+), 72 deletions(-)
 create mode 100755 tests/mkfs-tests/032-zoned-reset/test.sh

--
2.45.0

Comments

David Sterba May 14, 2024, 3:39 p.m. UTC | #1
On Mon, May 13, 2024 at 06:51:26PM -0600, Naohiro Aota wrote:
> mkfs.btrfs -b <byte_count> on a zoned device has several issues listed
> below.
> 
> - The FS size needs to be larger than minimal size that can host a btrfs,
>   but its calculation does not consider non-SINGLE profile
> - The calculation also does not ensure tree-log BG and data relocation BG
> - It allows creating a FS not aligned to the zone boundary
> - It resets all device zones beyond the specified length
> 
> This series fixes the issues with some cleanups.
> 
> Patches 1 to 3 are clean up patches, so they should not change the behavior.
> 
> Patches 4 to 6 address the issues and the last patch adds a test case.
> 
> Naohiro Aota (7):
>   btrfs-progs: rename block_count to byte_count
>   btrfs-progs: mkfs: remove duplicated device size check
>   btrfs-progs: mkfs: unify zoned mode minimum size calc into
>     btrfs_min_dev_size()
>   btrfs-progs: mkfs: fix minimum size calculation for zoned
>   btrfs-progs: mkfs: check if byte_count is zone size aligned
>   btrfs-progs: support byte length for zone resetting
>   btrfs-progs: add test for zone resetting

I did a quick CI check, the mkfs tests fails. You can open a pull
request to get your changes tested (it can be just for the testing
purpose, if you note that I'll skip it until the final version).

https://github.com/kdave/btrfs-progs/actions/runs/9081685951

There are also some compatibility build tests on older distros,

https://github.com/kdave/btrfs-progs/actions/runs/9081685969
Naohiro Aota May 14, 2024, 5:14 p.m. UTC | #2
On Tue, May 14, 2024 at 05:39:38PM +0200, David Sterba wrote:
> On Mon, May 13, 2024 at 06:51:26PM -0600, Naohiro Aota wrote:
> > mkfs.btrfs -b <byte_count> on a zoned device has several issues listed
> > below.
> > 
> > - The FS size needs to be larger than minimal size that can host a btrfs,
> >   but its calculation does not consider non-SINGLE profile
> > - The calculation also does not ensure tree-log BG and data relocation BG
> > - It allows creating a FS not aligned to the zone boundary
> > - It resets all device zones beyond the specified length
> > 
> > This series fixes the issues with some cleanups.
> > 
> > Patches 1 to 3 are clean up patches, so they should not change the behavior.
> > 
> > Patches 4 to 6 address the issues and the last patch adds a test case.
> > 
> > Naohiro Aota (7):
> >   btrfs-progs: rename block_count to byte_count
> >   btrfs-progs: mkfs: remove duplicated device size check
> >   btrfs-progs: mkfs: unify zoned mode minimum size calc into
> >     btrfs_min_dev_size()
> >   btrfs-progs: mkfs: fix minimum size calculation for zoned
> >   btrfs-progs: mkfs: check if byte_count is zone size aligned
> >   btrfs-progs: support byte length for zone resetting
> >   btrfs-progs: add test for zone resetting
> 
> I did a quick CI check, the mkfs tests fails. You can open a pull
> request to get your changes tested (it can be just for the testing
> purpose, if you note that I'll skip it until the final version).
> 
> https://github.com/kdave/btrfs-progs/actions/runs/9081685951

Thank you. I just noticed some workflows are running on my btrfs-progs
repository too.

I'm checking the fixed code with this workflow just in case.

> There are also some compatibility build tests on older distros,
> 
> https://github.com/kdave/btrfs-progs/actions/runs/9081685969
David Sterba May 14, 2024, 5:21 p.m. UTC | #3
On Tue, May 14, 2024 at 05:14:39PM +0000, Naohiro Aota wrote:
> On Tue, May 14, 2024 at 05:39:38PM +0200, David Sterba wrote:
> > On Mon, May 13, 2024 at 06:51:26PM -0600, Naohiro Aota wrote:
> > > mkfs.btrfs -b <byte_count> on a zoned device has several issues listed
> > > below.
> > > 
> > > - The FS size needs to be larger than minimal size that can host a btrfs,
> > >   but its calculation does not consider non-SINGLE profile
> > > - The calculation also does not ensure tree-log BG and data relocation BG
> > > - It allows creating a FS not aligned to the zone boundary
> > > - It resets all device zones beyond the specified length
> > > 
> > > This series fixes the issues with some cleanups.
> > > 
> > > Patches 1 to 3 are clean up patches, so they should not change the behavior.
> > > 
> > > Patches 4 to 6 address the issues and the last patch adds a test case.
> > > 
> > > Naohiro Aota (7):
> > >   btrfs-progs: rename block_count to byte_count
> > >   btrfs-progs: mkfs: remove duplicated device size check
> > >   btrfs-progs: mkfs: unify zoned mode minimum size calc into
> > >     btrfs_min_dev_size()
> > >   btrfs-progs: mkfs: fix minimum size calculation for zoned
> > >   btrfs-progs: mkfs: check if byte_count is zone size aligned
> > >   btrfs-progs: support byte length for zone resetting
> > >   btrfs-progs: add test for zone resetting
> > 
> > I did a quick CI check, the mkfs tests fails. You can open a pull
> > request to get your changes tested (it can be just for the testing
> > purpose, if you note that I'll skip it until the final version).
> > 
> > https://github.com/kdave/btrfs-progs/actions/runs/9081685951
> 
> Thank you. I just noticed some workflows are running on my btrfs-progs
> repository too.

Yes, the jobs are matched by the branch names and will start if you have
Actions enabled in the repository.