qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Sam Li <faithilikerun@gmail.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel@nongnu.org, hare@suse.de,
	Hanna Reitz <hreitz@redhat.com>,
	dmitry.fomichev@wdc.com, qemu-block@nongnu.org,
	Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Eric Blake <eblake@redhat.com>
Subject: Re: [PATCH v2 2/4] qcow2: add configurations for zoned format extension
Date: Mon, 28 Aug 2023 19:22:18 +0900	[thread overview]
Message-ID: <aeeeaf19-ce27-a3a2-7be0-9acbae24bb5e@kernel.org> (raw)
In-Reply-To: <CAAAx-8KHyTNDKL6FvAifZmH6LW46U5ccM+c=Rp0Hf=XpbErczg@mail.gmail.com>

On 8/28/23 19:18, Sam Li wrote:
> Damien Le Moal <dlemoal@kernel.org> 于2023年8月28日周一 18:13写道:
>>
>> On 8/28/23 18:22, Sam Li wrote:
>>> Stefan Hajnoczi <stefanha@redhat.com> 于2023年8月21日周一 21:31写道:
>>>>
>>>> On Mon, Aug 14, 2023 at 04:58:00PM +0800, Sam Li wrote:
>>>>> diff --git a/block/qcow2.h b/block/qcow2.h
>>>>> index f789ce3ae0..3694c8d217 100644
>>>>> --- a/block/qcow2.h
>>>>> +++ b/block/qcow2.h
>>>>> @@ -236,6 +236,20 @@ typedef struct Qcow2CryptoHeaderExtension {
>>>>>      uint64_t length;
>>>>>  } QEMU_PACKED Qcow2CryptoHeaderExtension;
>>>>>
>>>>> +typedef struct Qcow2ZonedHeaderExtension {
>>>>> +    /* Zoned device attributes */
>>>>> +    uint8_t zoned_profile;
>>>>> +    uint8_t zoned;
>>>>> +    uint16_t reserved16;
>>>>> +    uint32_t zone_size;
>>>>> +    uint32_t zone_capacity;
>>>>
>>>> Should zone capacity be stored individually for each zone (alongside the
>>>> write pointer and other per zone metadata) instead of as a global value
>>>> for all zones? My understanding is that NVMe ZNS does not have a global
>>>> value and each zone could have a different zone capacity value.
>>>
>>> Though zone capacity is per-zone attribute, it remains same for all
>>> zones in most cases. Referring to the NVMe ZNS spec, zone capacity
>>> changes associate to RESET_ZONE op when the variable zone capacity bit
>>> is '1'. It hasn't specifically tell what it is changed to. Current ZNS
>>> emulation doesn't change zone capacity as well.
>>>
>>> If the Variable Zone Capacity bit is cleared to ‘0’ in the Zone
>>> Operation Characteristics field in the Zoned
>>> Namespace Command Set specific Identify Namespace data structure, then
>>> this field does not change without a change to the format of the zoned
>>> namespace.
>>>
>>> If the Variable Zone Capacity bit is set to ‘1’ in the Zone Operation
>>> Characteristics field in the Zoned
>>> Namespace Command Set specific Identify Namespace data structure, then
>>> the zone capacity may
>>> change upon successful completion of a Zone Management Send command
>>> specifying the Zone Send
>>> Action of Reset Zone.
>>
>> Regardless of the variable zone capacity feature, zone capacity is per zone and
>> may be different between zones. That is why it is reported per zone in zone
>> report. The IO path code should not assume that the zone capacity is the same
>> for all zones.
> 
> How is zone capacity changed, by devices or commands? Can you give
> some example please?

If the device does not support variable zone capacity, the zone capacity is
fixed at device manufacturing time and never changes. It is reported per zone
and you have to make things work with whatever value you see. The user cannot
change device zone capacity.

For you qcow2 zoned image, the equivalent is to fix the zone capacity when the
image is created and not allowing to change it. And for simplicity, the same
zone capacity value can be used for all zones, so having the zone capacity
value in the header is OK.

> 
>>
>> For this particular case though, given that this is QCow2 emulation, limiting
>> ourselves to the same zone capacity for all zones is I think fine. But that
>> should be clearly stated somewhere may be...
> 
> I see. The qcow2 documentaion can add that.
> 
>>
>>>
>>>>
>>>>> +    uint32_t nr_zones;
>>>>
>>>> Is this field necessary since it can be derived from other image
>>>> options: nr_zones = DIV_ROUND_UP(total_length, zone_capacity)?
>>>
>>> It can be dropped. I added this for reducing duplication. Thanks!
>>
>> --
>> Damien Le Moal
>> Western Digital Research
>>

-- 
Damien Le Moal
Western Digital Research



  reply	other threads:[~2023-08-28 10:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14  8:57 [PATCH v2 0/4] Add full zoned storage emulation to qcow2 driver Sam Li
2023-08-14  8:57 ` [PATCH v2 1/4] docs/qcow2: add the zoned format feature Sam Li
2023-08-14  8:58 ` [PATCH v2 2/4] qcow2: add configurations for zoned format extension Sam Li
2023-08-16 19:31   ` Stefan Hajnoczi
2023-08-21 13:13   ` Markus Armbruster
2023-08-28  9:05     ` Sam Li
2023-08-21 13:31   ` Stefan Hajnoczi
2023-08-28  9:22     ` Sam Li
2023-08-28 10:12       ` Damien Le Moal
2023-08-28 10:18         ` Sam Li
2023-08-28 10:22           ` Damien Le Moal [this message]
2023-08-28 10:40             ` Sam Li
2023-08-28 14:42     ` Sam Li
2023-08-14  8:58 ` [PATCH v2 3/4] qcow2: add zoned emulation capability Sam Li
2023-08-16 21:07   ` Stefan Hajnoczi
2023-08-22 19:48   ` Stefan Hajnoczi
2023-08-28 11:55     ` Sam Li
2023-08-29  6:06       ` Damien Le Moal
2023-08-29  6:27         ` Sam Li
2023-08-29  7:14           ` Damien Le Moal
2023-08-29  7:27             ` Sam Li
2023-08-14  8:58 ` [PATCH v2 4/4] iotests: test the zoned format feature for qcow2 file Sam Li
2023-08-22 19:50   ` Stefan Hajnoczi
2023-08-16  7:37 ` [PATCH v2 0/4] Add full zoned storage emulation to qcow2 driver Klaus Jensen
2023-08-16  8:14   ` Sam Li
2023-08-16 18:03     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeeeaf19-ce27-a3a2-7be0-9acbae24bb5e@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=armbru@redhat.com \
    --cc=dmitry.fomichev@wdc.com \
    --cc=eblake@redhat.com \
    --cc=faithilikerun@gmail.com \
    --cc=hare@suse.de \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).