Re: [PATCH v9 13/13] dm: add power-of-2 target for zoned devices with non power-of-2 zone sizes

From: Pankaj Raghav
Date: Thu Aug 11 2022 - 09:18:03 EST



>> +==========
>> +dm-po2zone
>> +==========
>> +The dm-po2zone device mapper target exposes a zoned block device with a
>> +non-power-of-2(npo2) zone number of sectors as a power-of-2(po2) zone number
>
> s/zone number of sectors/number of sectors per zone (zone size)
>
>> +of sectors.
>> +The filesystems that support zoned block devices such as F2FS and BTRFS
>> +assume po2 zone size sectors as the kernel has traditionally only supported
>> +those devices. However, as the kernel now supports zoned block devices with
>> +npo2 zone size sectors, the dm-po2zone target can be used by the filesystems
>> +before adding native support.
>
> filesystems will not "use" the target. The user has to set up the target first
> and the filesystem will run on top of it. Detail, but rewording this make it
> clear that this is not an automatic thing magically happening.
>
> Not that your patch series is lacking f2fs and btrfs patches to check for the
> power of 2 zone size of the zoned device. Unless these checks are already in place ?
>
btrfs already had these checks in place and f2fs patch to allow only po2
zone size was already merged by Jaegeuk.

7f262f737502 ("f2fs: ensure only power of 2 zone sizes are allowed")
>> +
>> +Partial mapping of the underlying device is not supported by this target.
>> +
>> +Algorithm
>> +=========
>> +The device mapper target maps the underlying device's zone size to the
>> +zone capacity and changes the zone size to the nearest po2 number of sectors.
>> +The gap between the zone capacity and the zone size is emulated in the target.
>> +E.g., a zoned block device with a zone size (and capacity) of 3M will have an
>> +equivalent target layout with mapping as follows:
>> +
>> +::
>> +
>> + 0M 3M 4M 6M 8M
>> + | | | | |
>> + +x------------+--+x---------+--+x------- Target
>> + |x | |x | |x
>> + x x x
>> + x x x
>> + x x x
>> + x x x
>> + |x |x |x
>> + +x------------+x------------+x---------- Device
>> + | | |
>> + 0M 3M 6M
>> +