mbox series

[00/26] btrfs-progs: zoned: zoned block device support

Message ID cover.1619416549.git.naohiro.aota@wdc.com (mailing list archive)
Headers show
Series btrfs-progs: zoned: zoned block device support | expand

Message

Naohiro Aota April 26, 2021, 6:27 a.m. UTC
This series implements user-land side support for zoned btrfs.

This series is based on misc-next + preparation series below.
https://lore.kernel.org/linux-btrfs/cover.1617694997.git.naohiro.aota@wdc.com/

Userland tool depends on patched util-linux (libblkid and wipefs) to handle
log-structured superblock. The patches are available in the util-linux list.
https://lore.kernel.org/util-linux/20210426055036.2103620-1-naohiro.aota@wdc.com/T/

Followup work will address several areas that can be improved.


* Patch series organization

Patches 1 and 2 are preparation patches. They add a helper function
queue_param() and provide fs_info in struct btrfs_device as same as the
kernel code.

Patch 3 adds a check for a header file of zoned block device support.

Patches 4 to 16 implement zoned btrfs features (loading zone info,
chunk/extent allocator, zone emulation for a non-zoned device, etc.) like
in the kernel code.

Patches 17 to 19 extend btrfs_prepare_device() for a zoned device.

Patches 20 to 24 implement zoned support for mkfs.btrfs.

And, patches 25 and 26 add zoned support for other commands ("device add"
and "device replace").

Naohiro Aota (26):
  btrfs-progs: utils: Introduce queue_param helper function
  btrfs-progs: provide fs_info from btrfs_device
  btrfs-progs: build: zoned: Check zoned block device support
  btrfs-progs: zoned: add new ZONED feature flag
  btrfs-progs: zoned: get zone information of zoned block devices
  btrfs-progs: zoned: check and enable ZONED mode
  btrfs-progs: zoned: introduce max_zone_append_size
  btrfs-progs: zoned: disallow mixed-bg in ZONED mode
  btrfs-progs: zoned: allow zoned filesystems on non-zoned block devices
  btrfs-progs: zoned: implement log-structured superblock for ZONED mode
  btrfs-progs: zoned: implement zoned chunk allocator
  btrfs-progs: zoned: load zone's allocation offset
  btrfs-progs: zoned: implement sequential extent allocation
  btrfs-progs: zoned: calculate allocation offset for conventional zones
  btrfs-progs: zoned: redirty clean extent buffers in zoned btrfs
  btrfs-progs: zoned: reset zone of freed block group
  btrfs-progs: zoned: support resetting zoned device
  btrfs-progs: zoned: support zero out on zoned block device
  btrfs-progs: zoned: support wiping SB on sequential write zone
  btrfs-progs: mkfs: zoned: detect and enable zoned feature flag
  btrfs-progs: mkfs: zoned: check incompatible features with zoned btrfs
  btrfs-progs: mkfs: zoned: tweak initial system block group placement
  btrfs-progs: mkfs: zoned: use sbwrite to update superblock
  btrfs-progs: zoned: wipe temporary superblocks in superblock log zone
  btrfs-progs: zoned: device-add: support ZONED device
  btrfs-progs: zoned: introduce zoned support for device replace

 Makefile                    |    2 +-
 cmds/device.c               |   21 +-
 cmds/inspect-dump-super.c   |    3 +-
 cmds/replace.c              |   13 +-
 cmds/rescue-chunk-recover.c |    2 +-
 common/device-scan.c        |    7 +-
 common/device-utils.c       |  127 +++-
 common/device-utils.h       |    4 +
 common/fsfeatures.c         |    8 +
 common/fsfeatures.h         |    3 +-
 configure.ac                |   13 +
 kerncompat.h                |   23 +
 kernel-shared/ctree.h       |   28 +-
 kernel-shared/disk-io.c     |   39 +-
 kernel-shared/extent-tree.c |   26 +
 kernel-shared/print-tree.c  |    1 +
 kernel-shared/transaction.c |    6 +
 kernel-shared/volumes.c     |  153 ++++-
 kernel-shared/volumes.h     |    8 +-
 kernel-shared/zoned.c       | 1181 +++++++++++++++++++++++++++++++++++
 kernel-shared/zoned.h       |  170 +++++
 mkfs/common.c               |   38 +-
 mkfs/common.h               |    1 +
 mkfs/main.c                 |  112 ++--
 24 files changed, 1887 insertions(+), 102 deletions(-)
 create mode 100644 kernel-shared/zoned.c
 create mode 100644 kernel-shared/zoned.h

Comments

David Sterba April 29, 2021, 3:53 p.m. UTC | #1
On Mon, Apr 26, 2021 at 03:27:16PM +0900, Naohiro Aota wrote:
> This series implements user-land side support for zoned btrfs.
> 
> This series is based on misc-next + preparation series below.
> https://lore.kernel.org/linux-btrfs/cover.1617694997.git.naohiro.aota@wdc.com/

The prep patchset has been merged.

> Userland tool depends on patched util-linux (libblkid and wipefs) to handle
> log-structured superblock. The patches are available in the util-linux list.
> https://lore.kernel.org/util-linux/20210426055036.2103620-1-naohiro.aota@wdc.com/T/

I was wondering if we should implement some workarounds in case the
blkid utils don't have the zoned support. This will inevitably happen
that not all the tools (progs/kernel/blkid) will have the support, at
least temporarily.

We'd need only the detection and eventually lookup of the most recent
superblock.

> Naohiro Aota (26):
>   btrfs-progs: utils: Introduce queue_param helper function
>   btrfs-progs: provide fs_info from btrfs_device
>   btrfs-progs: build: zoned: Check zoned block device support
>   btrfs-progs: zoned: add new ZONED feature flag
>   btrfs-progs: zoned: get zone information of zoned block devices
>   btrfs-progs: zoned: check and enable ZONED mode
>   btrfs-progs: zoned: introduce max_zone_append_size
>   btrfs-progs: zoned: disallow mixed-bg in ZONED mode
>   btrfs-progs: zoned: allow zoned filesystems on non-zoned block devices
>   btrfs-progs: zoned: implement log-structured superblock for ZONED mode
>   btrfs-progs: zoned: implement zoned chunk allocator
>   btrfs-progs: zoned: load zone's allocation offset
>   btrfs-progs: zoned: implement sequential extent allocation
>   btrfs-progs: zoned: calculate allocation offset for conventional zones
>   btrfs-progs: zoned: redirty clean extent buffers in zoned btrfs
>   btrfs-progs: zoned: reset zone of freed block group
>   btrfs-progs: zoned: support resetting zoned device
>   btrfs-progs: zoned: support zero out on zoned block device
>   btrfs-progs: zoned: support wiping SB on sequential write zone
>   btrfs-progs: mkfs: zoned: detect and enable zoned feature flag
>   btrfs-progs: mkfs: zoned: check incompatible features with zoned btrfs
>   btrfs-progs: mkfs: zoned: tweak initial system block group placement
>   btrfs-progs: mkfs: zoned: use sbwrite to update superblock
>   btrfs-progs: zoned: wipe temporary superblocks in superblock log zone
>   btrfs-progs: zoned: device-add: support ZONED device
>   btrfs-progs: zoned: introduce zoned support for device replace

Now in devel. I did some fixups on the way but only minor ones. There
are still cleanups needed that we'll do as followup patches. I'd like to
also have some zoned tests inside progs testsuite so eg. mkfs can be
verified to work.

The kernel 5.12 is out so my plan for progs 5.12 release is sometime
next week. I'll probably do an rc1 with current devel so we have some
checkpoint before the full release.