Re: [PATCH v2] zloop: truncate finished zones to zone capacity

Damien Le Moal <[email protected]> Tue, 4 Aug 2026 13:26:24 +0900
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Organization Western Digital Research
Message-ID <[email protected]>
On 8/4/26 11:34, raoxu wrote:
> From: Xu Rao <[email protected]>
> 
> 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 <[email protected]>
> Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
> Cc: [email protected]
> Signed-off-by: Xu Rao <[email protected]>

Looks good.

Reviewed-by: Damien Le Moal <[email protected]>

-- 
Damien Le Moal
Western Digital Research