Re: [PATCH 07/13] block: track zone conditions

Bart Van Assche
2025-11-03T18:32:02Z

On 11/3/25 7:48 AM, Bart Van Assche wrote:
> On 11/2/25 10:05 PM, Damien Le Moal wrote:
>> On 11/1/25 06:17, Bart Van Assche wrote:
>>> On 10/30/25 11:13 PM, Damien Le Moal wrote:
>>>> Implement tracking of the runtime changes to zone conditions using
>>>> the new cond field in struct blk_zone_wplug. The size of this structure
>>>> remains 112 Bytes as the new field replaces the 4 Bytes padding at the
>>>> end of the structure. For zones that do not have a zone write plug, the
>>>> zones_cond array of a disk is used to track changes to zone conditions,
>>>> e.g. when a zone reset, reset all or finish operation is executed.
>>>
>>> Why is it necessary to track the condition of sequential zones that do
>>> not have a zone write plug? Please explain what the use cases are.
>>
>> Because zones that do not have a zone write plug can be empty OR full.
>
> Why does the block layer have to track this information? Filesystems can
> easily derive this information from the filesystem metadata information,
> isn't it?

(replying to my own email)

Is this a good way to check what zone type information filesystems need?

$ git grep -nH BLK_ZONE_TYPE_ fs
fs/btrfs/zoned.c:96: ASSERT(zones[i].type != BLK_ZONE_TYPE_CONVENTIONAL);
fs/btrfs/zoned.c:211: zones[i].type = BLK_ZONE_TYPE_CONVENTIONAL;
fs/btrfs/zoned.c:488: if (zones[i].type == BLK_ZONE_TYPE_SEQWRITE_REQ)
fs/btrfs/zoned.c:566: BLK_ZONE_TYPE_CONVENTIONAL)
fs/btrfs/zoned.c:815: if (zones[0].type == BLK_ZONE_TYPE_CONVENTIONAL) {
fs/btrfs/zoned.c:1360: if (unlikely(zone.type ==
BLK_ZONE_TYPE_CONVENTIONAL)) {
fs/f2fs/segment.c:5295: if (zone->type != BLK_ZONE_TYPE_SEQWRITE_REQ)
fs/f2fs/segment.c:5417: if (zone.type != BLK_ZONE_TYPE_SEQWRITE_REQ)
fs/f2fs/segment.c:5473: if (zone.type != BLK_ZONE_TYPE_SEQWRITE_REQ)
fs/f2fs/super.c:4332: if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
fs/xfs/libxfs/xfs_zones.c:177: case BLK_ZONE_TYPE_CONVENTIONAL:
fs/xfs/libxfs/xfs_zones.c:179: case BLK_ZONE_TYPE_SEQWRITE_REQ:
fs/zonefs/super.c:385: zone.type = BLK_ZONE_TYPE_CONVENTIONAL;
fs/zonefs/super.c:874: case BLK_ZONE_TYPE_CONVENTIONAL:
fs/zonefs/super.c:886: case BLK_ZONE_TYPE_SEQWRITE_REQ:
fs/zonefs/super.c:887: case BLK_ZONE_TYPE_SEQWRITE_PREF:
fs/zonefs/zonefs.h:26: * defined in linux/blkzoned.h, that is,
BLK_ZONE_TYPE_SEQWRITE_REQ and
fs/zonefs/zonefs.h:27: * BLK_ZONE_TYPE_SEQWRITE_PREF.
fs/zonefs/zonefs.h:37: if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)

In the above I see that all filesystems check for the following zone
types and don't check whether a zone is empty or full:
* CONVENTIONAL
* SEQWRITE_REQ
* SEQWRITE_PREF

Do you agree with this conclusion?

Thanks,

Bart.