mbox series

[v3,00/10] btrfs-progs: zoned: proper "mkfs.btrfs -b" support

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

Message

Naohiro Aota May 22, 2024, 6:02 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.

This one passed CI workflow here:

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

Patches 4 to 6 address the issues.

Patches 7 to 10 add/modify the test cases. First, patch 7 adds nullb
functions to use in later patches. Patch 8 adds a new test for
zone resetting. And, patches 9 and 10 rewrites existing tests with the
nullb helper.

Changes:
- v3:
  - Tweak minimum FS size calculation style.
  - Round down the specified byte_count towards sectorsize and zone
    size, instead of banning unaligned byte_count.
  - Add active zone description in the commit log of patch 6.
  - Add nullb test functions and use them in tests.
- v2: https://lore.kernel.org/linux-btrfs/20240514182227.1197664-1-naohiro.aota@wdc.com/T/#t
  - fix function declaration on older distro (non-ZONED setup)
  - fix mkfs test failure
- v1: https://lore.kernel.org/linux-btrfs/20240514005133.44786-1-naohiro.aota@wdc.com/

Naohiro Aota (10):
  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 mode
  btrfs-progs: mkfs: align byte_count with sectorsize and zone size
  btrfs-progs: support byte length for zone resetting
  btrfs-progs: test: add nullb setup functions
  btrfs-progs: test: add test for zone resetting
  btrfs-progs: test: use nullb helper and smaller zone size
  btrfs-progs: test: use nullb helpers in 031-zoned-bgt

 common/device-utils.c                    | 45 +++++++-----
 kernel-shared/zoned.c                    | 23 ++++++-
 kernel-shared/zoned.h                    |  7 +-
 mkfs/common.c                            | 62 ++++++++++++++---
 mkfs/common.h                            |  2 +-
 mkfs/main.c                              | 88 ++++++++++--------------
 tests/common                             | 63 +++++++++++++++++
 tests/mkfs-tests/030-zoned-rst/test.sh   | 14 ++--
 tests/mkfs-tests/031-zoned-bgt/test.sh   | 30 ++------
 tests/mkfs-tests/032-zoned-reset/test.sh | 43 ++++++++++++
 10 files changed, 259 insertions(+), 118 deletions(-)
 create mode 100755 tests/mkfs-tests/032-zoned-reset/test.sh

--
2.45.1

Comments

Qu Wenruo May 22, 2024, 6:50 a.m. UTC | #1
在 2024/5/22 15:32, Naohiro Aota 写道:
> 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.
>
> This one passed CI workflow here:
>
> Patches 1 to 3 are clean up patches, so they should not change the behavior.
>
> Patches 4 to 6 address the issues.
>
> Patches 7 to 10 add/modify the test cases. First, patch 7 adds nullb
> functions to use in later patches. Patch 8 adds a new test for
> zone resetting. And, patches 9 and 10 rewrites existing tests with the
> nullb helper.

Looks good to me overall, with only one small problem related to patch 5
commented.

You can add my reviewed-by after fixing that small
round_down()/round_up() problem.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
>
> Changes:
> - v3:
>    - Tweak minimum FS size calculation style.
>    - Round down the specified byte_count towards sectorsize and zone
>      size, instead of banning unaligned byte_count.
>    - Add active zone description in the commit log of patch 6.
>    - Add nullb test functions and use them in tests.
> - v2: https://lore.kernel.org/linux-btrfs/20240514182227.1197664-1-naohiro.aota@wdc.com/T/#t
>    - fix function declaration on older distro (non-ZONED setup)
>    - fix mkfs test failure
> - v1: https://lore.kernel.org/linux-btrfs/20240514005133.44786-1-naohiro.aota@wdc.com/
>
> Naohiro Aota (10):
>    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 mode
>    btrfs-progs: mkfs: align byte_count with sectorsize and zone size
>    btrfs-progs: support byte length for zone resetting
>    btrfs-progs: test: add nullb setup functions
>    btrfs-progs: test: add test for zone resetting
>    btrfs-progs: test: use nullb helper and smaller zone size
>    btrfs-progs: test: use nullb helpers in 031-zoned-bgt
>
>   common/device-utils.c                    | 45 +++++++-----
>   kernel-shared/zoned.c                    | 23 ++++++-
>   kernel-shared/zoned.h                    |  7 +-
>   mkfs/common.c                            | 62 ++++++++++++++---
>   mkfs/common.h                            |  2 +-
>   mkfs/main.c                              | 88 ++++++++++--------------
>   tests/common                             | 63 +++++++++++++++++
>   tests/mkfs-tests/030-zoned-rst/test.sh   | 14 ++--
>   tests/mkfs-tests/031-zoned-bgt/test.sh   | 30 ++------
>   tests/mkfs-tests/032-zoned-reset/test.sh | 43 ++++++++++++
>   10 files changed, 259 insertions(+), 118 deletions(-)
>   create mode 100755 tests/mkfs-tests/032-zoned-reset/test.sh
>
> --
> 2.45.1
>
>