naota / linux

Linux kernel source tree
Other
3 stars 1 forks source link

Mkfs with DUP metadata leaves one non-referenced zone #60

Open naota opened 2 years ago

naota commented 2 years ago

Creating zoned FS with DUP metadata profile will leave one extra zone which is not referenced from any BGs.

This is a zone used for the first temporally SYSTEM BG. That is moved to a new DUP SYSTEM BG in the final phase of the mkfs process.

We need to reset the zone to make the zone usable for FS and to free up the active zone.

$ sudo ./mkfs.btrfs -f /dev/nullb0; sudo blkzone report /dev/nullb0 |grep oi |cat -n
btrfs-progs v5.11
See http://btrfs.wiki.kernel.org for more information.

Zoned: /dev/nullb0: host-managed device detected, setting zoned feature
Resetting device zones /dev/nullb0 (1600 zones) ...
NOTE: several default settings have changed in version 5.15, please make sure
      this does not affect your deployments:
      - DUP for metadata (-m dup)
      - enabled no-holes (-O no-holes)
      - enabled free-space-tree (-R free-space-tree)

Label:              (null)
UUID:               501187d0-a4ff-4429-a500-75de4cd6c7f1
Node size:          16384
Sector size:        4096
Filesystem size:    12.50GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP               8.00MiB
  System:           DUP               8.00MiB
SSD detected:       yes
Zoned device:       yes
  Zone size:        8.00MiB
Incompat features:  extref, skinny-metadata, no-holes, zoned
Runtime features:   free-space-tree
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1    12.50GiB  /dev/nullb0

     1    start: 0x000000000, len 0x004000, cap 0x004000, wptr 0x000008 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]
     2    start: 0x00000c000, len 0x004000, cap 0x004000, wptr 0x000120 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]
     3    start: 0x000014000, len 0x004000, cap 0x004000, wptr 0x000040 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]
     4    start: 0x000018000, len 0x004000, cap 0x004000, wptr 0x000040 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]
     5    start: 0x00001c000, len 0x004000, cap 0x004000, wptr 0x0001a0 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]
     6    start: 0x000020000, len 0x004000, cap 0x004000, wptr 0x0001a0 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]

In this example, zone at "start: 0x00000c000" is not referenced.