Re: [PATCH v2] zloop: truncate finished zones to zone capacity
From: Damien Le Moal
Date: Tue Aug 04 2026 - 00:26:55 EST
On 8/4/26 11:34, raoxu wrote:
> From: Xu Rao <raoxu@xxxxxxxxxxxxx>
>
> The size of a sequential zone backing file records the amount of data
> written and is used to restore the zone state. A backing file whose size
> is equal to the zone capacity is restored as a full zone, while a file
> larger than the zone capacity is rejected as invalid.
>
> However, zloop_finish_zone() currently truncates the backing file to the
> zone size. For devices with a reduced zone capacity, finishing a zone
> therefore creates a backing file larger than the zone capacity. After the
> device is removed and later re-added, that zone file is rejected instead
> of being restored as a full zone.
>
> Truncate finished sequential zones to the zone capacity, matching the
> persistent representation accepted by zloop_update_seq_zone() for a full
> zone.
>
> Suggested-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
> Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Xu Rao <raoxu@xxxxxxxxxxxxx>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
--
Damien Le Moal
Western Digital Research