[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 1/4] file-posix: add tracking of the zone write pointers
From: |
Damien Le Moal |
Subject: |
Re: [PATCH v6 1/4] file-posix: add tracking of the zone write pointers |
Date: |
Thu, 16 Mar 2023 06:23:55 +0900 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 |
On 3/15/23 21:59, Sam Li wrote:
> Damien Le Moal <damien.lemoal@opensource.wdc.com> 于2023年3月14日周二 11:49写道:
>>
>> On 3/14/23 11:23, Dmitry Fomichev wrote:
>>>> @@ -3339,10 +3473,27 @@ static int coroutine_fn
>>>> raw_co_zone_mgmt(BlockDriverState *bs, BlockZoneOp op,
>>>> len >> BDRV_SECTOR_BITS);
>>>> ret = raw_thread_pool_submit(bs, handle_aiocb_zone_mgmt, &acb);
>>>> if (ret != 0) {
>>>> + update_zones_wp(s->fd, wps, offset, index);
>>>> ret = -errno;
>>>> error_report("ioctl %s failed %d", op_name, ret);
>>>> + goto out;
>>>> }
>>>>
>>>> + if (zo == BLKRESETZONE && len == capacity) {
>>>> + for (int i = 0; i < bs->bl.nr_zones; ++i) {
>>>> + if (!BDRV_ZT_IS_CONV(wps->wp[i])) {
>>>> + wps->wp[i] = i * bs->bl.zone_size;
>>>
>>> This will reset write pointers of all read-only zones that may exist on the
>>> device and make the data stored in those zones unreadable. R/O zones need
>>> to be
>>> skipped in this loop.
>>
>> And offline zones need to be skipped as well.
>
> I see. That can be done thanks to get_zones_wp() which can show the
> state of the zone at specific position.
I do not think so: a zone wp is invalid for read-only and offline zones. So you
cannot rely on the wp value to detect these states. Even a valid wp value would
not tell you if the zone is read only or offline anyway. You need to track these
states with flags set when doing the first report zone on startup and when doing
a report zone after an IO error.
>
> Sam
--
Damien Le Moal
Western Digital Research
[PATCH v6 2/4] block: introduce zone append write for zoned devices, Sam Li, 2023/03/10
[PATCH v6 3/4] qemu-iotests: test zone append operation, Sam Li, 2023/03/10
[PATCH v6 4/4] block: add some trace events for zone append, Sam Li, 2023/03/10