Re: [PATCH] qemu-io: add cvtnum() error handling for zone commands

2024-05-07 Thread Sam Li
not be represented. > > Reported-by: Peter Maydell > Cc: Sam Li > Signed-off-by: Stefan Hajnoczi > --- > qemu-io-cmds.c | 48 +++- > 1 file changed, 47 insertions(+), 1 deletion(-) Reviewed-by: Sam Li Hi Stefan, Thank you for fixing th

Re: [PATCH v7 2/4] qcow2: add configurations for zoned format extension

2024-02-19 Thread Sam Li
Markus Armbruster 于2024年2月19日周一 21:42写道: > > Sam Li writes: > > > Markus Armbruster 于2024年2月19日周一 16:56写道: > >> > >> Sam Li writes: > >> > >> > Markus Armbruster 于2024年2月19日周一 15:40写道: > >> >> > >>

Re: [PATCH v7 2/4] qcow2: add configurations for zoned format extension

2024-02-19 Thread Sam Li
Markus Armbruster 于2024年2月19日周一 16:56写道: > > Sam Li writes: > > > Markus Armbruster 于2024年2月19日周一 15:40写道: > >> > >> Sam Li writes: > >> > >> > Markus Armbruster 于2024年2月19日周一 13:05写道: > >> >> > >> >> One mo

Re: [PATCH v7 2/4] qcow2: add configurations for zoned format extension

2024-02-19 Thread Sam Li
Markus Armbruster 于2024年2月19日周一 15:40写道: > > Sam Li writes: > > > Markus Armbruster 于2024年2月19日周一 13:05写道: > >> > >> One more thing... > >> > >> Markus Armbruster writes: > >> > >> > I apologize for the delayed review. >

Re: [PATCH v7 2/4] qcow2: add configurations for zoned format extension

2024-02-19 Thread Sam Li
Markus Armbruster 于2024年2月19日周一 13:05写道: > > One more thing... > > Markus Armbruster writes: > > > I apologize for the delayed review. No problems. Thanks for reviewing! > > > > Sam Li writes: > > > >> To configure the zoned format featur

[RFC v3 5/7] hw/nvme: make the metadata of ZNS emulation persistent

2024-01-22 Thread Sam Li
zone state transition and manage zone resources. Signed-off-by: Sam Li --- block/qcow2.c|3 + hw/nvme/ctrl.c | 1115 +++--- hw/nvme/ns.c | 77 +-- hw/nvme/nvme.h | 85 +-- include/block

[RFC v3 3/7] hw/nvme: use blk_get_*() to access zone info in the block layer

2024-01-22 Thread Sam Li
The zone information is contained in the BlockLimits fileds. Add blk_get_*() functions to access the block layer and update zone info accessing in the NVMe device emulation. Signed-off-by: Sam Li --- block/block-backend.c | 72 +++ hw/nvme/ctrl.c

[RFC v3 2/7] qcow2: add zd_extension configurations to zoned metadata

2024-01-22 Thread Sam Li
Zone descriptor extension data is host definied data that is associated with each zone. Add zone descriptor extensions to zonedmeta struct. Signed-off-by: Sam Li --- block/qcow2.c| 70 +--- block/qcow2.h| 2 + include/block

[RFC v3 7/7] hw/nvme: make ZDED persistent

2024-01-22 Thread Sam Li
attributes at the following eight bit of zone type bit of write pointers for each zone. The ZDED is stored as part of zoned metadata as write pointers. Signed-off-by: Sam Li --- block/qcow2.c| 45 hw/nvme/ctrl.c | 1 + include/block

[RFC v3 0/7] Add persistence to NVMe ZNS emulation

2024-01-22 Thread Sam Li
ies [Markus] - address review comments [Markus] v1->v2: - split [v1 2/5] patch to three (doc, config, block layer API) - adapt qcow2 v6 Sam Li (7): docs/qcow2: add zd_extension_size option to the zoned format feature qcow2: add zd_extension configurations to zoned metadata hw/nvme: use bl

[RFC v3 6/7] hw/nvme: refactor zone append write using block layer APIs

2024-01-22 Thread Sam Li
Signed-off-by: Sam Li --- block/qcow2.c| 2 +- hw/nvme/ctrl.c | 190 --- include/sysemu/dma.h | 3 + system/dma-helpers.c | 17 4 files changed, 162 insertions(+), 50 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index

[RFC v3 1/7] docs/qcow2: add zd_extension_size option to the zoned format feature

2024-01-22 Thread Sam Li
The NVMe ZNS command set has the zone descriptor extension feature for associating the data to a zone. Devices that supports ZAC/ZBC have zero zone descriptor extension size. Signed-off-by: Sam Li --- docs/interop/qcow2.txt | 9 + 1 file changed, 9 insertions(+) diff --git a/docs

[RFC v3 4/7] hw/nvme: add blk_get_zone_extension to access zd_extensions

2024-01-22 Thread Sam Li
Signed-off-by: Sam Li --- block/block-backend.c | 16 hw/nvme/ctrl.c| 20 ++-- hw/nvme/ns.c | 24 hw/nvme/nvme.h| 7 --- include/sysemu/block-backend-io.h | 2

[PATCH v7 2/4] qcow2: add configurations for zoned format extension

2024-01-22 Thread Sam Li
feature, use command like this: qemu-img create -f qcow2 zbc.qcow2 -o size=768M \ -o zone.size=64M -o zone.capacity=64M -o zone.conventional_zones=0 \ -o zone.max_append_bytes=4096 -o zone.max_open_zones=6 \ -o zone.max_active_zones=8 -o zone.mode=host-managed Signed-off-by: Sam Li --- block/qcow2.c

[PATCH v7 4/4] iotests: test the zoned format feature for qcow2 file

2024-01-22 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check -qcow2 zoned-qcow2 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned-qcow2 | 147 +++ tests/qemu-iotests/tests/zoned-qcow2.out | 172 +++ 2 files

[PATCH v7 3/4] qcow2: add zoned emulation capability

2024-01-22 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. It is managed by active zone lists following LRU policy. Signed-off-by: Sam Li --- block/qcow2.c| 791 ++- block

[PATCH v7 1/4] docs/qcow2: add the zoned format feature

2024-01-22 Thread Sam Li
Add the specs for the zoned format feature of the qcow2 driver. The qcow2 file then can emulate real zoned devices, either passed through by virtio-blk device or NVMe ZNS drive to the guest given zoned information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- docs/system/qemu-block

[PATCH v7 0/4] Add full zoned storage emulation to qcow2 driver

2024-01-22 Thread Sam Li
w2 zoned extension header - address review comments (Stefan): * fix zoned_mata allocation size * use bitwise or than addition * fix wp index overflow and locking * cleanups: comments, naming Sam Li (4): docs/qcow2: add the zoned format feature qcow2: add configurations for zoned format

Re: [RFC v2 0/7] Add persistence to NVMe ZNS emulation

2024-01-22 Thread Sam Li
Klaus Jensen 于2024年1月10日周三 07:52写道: > > Hi Sam, > > This is awesome. For the hw/nvme parts, > > Acked-by: Klaus Jensen > > I'll give it a proper R-b when you drop the RFC status. Hi Klaus, Sorry for the late response. I will submit a new RFC patch series very soon. Now the zone states should

Re: [PATCH v6 0/4] Add full zoned storage emulation to qcow2 driver

2023-12-16 Thread Sam Li
Markus Armbruster 于2023年11月30日周四 09:25写道: > > Clang reports > > ../block/qcow2.c:4066:5: error: mutex 'graph_lock' is not held on every path > through here [-Werror,-Wthread-safety-analysis] > blk_co_unref(blk); > ^ > ../block/qcow2.c:3928:5: note: mutex acquired here >

Re: [PATCH v6 2/4] qcow2: add configurations for zoned format extension

2023-12-16 Thread Sam Li
Markus Armbruster 于2023年11月30日周四 09:40写道: > > Sam Li writes: > > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of conventional zones, limits on zone > >

Re: [RFC v2 0/7] Add persistence to NVMe ZNS emulation

2023-11-30 Thread Sam Li
Markus Armbruster 于2023年11月30日周四 18:11写道: > > Sam Li writes: > > > ZNS emulation follows NVMe ZNS spec but the state of namespace > > zones does not persist accross restarts of QEMU. This patch makes the > > metadata of ZNS emulation persistent by using new block layer

[RFC v2 0/7] Add persistence to NVMe ZNS emulation

2023-11-27 Thread Sam Li
=${znsimg},id=nvmezns0,format=qcow2,if=none \ -device nvme-ns,drive=nvmezns0,bus=nvme0,nsid=1,uuid=xxx \ Sorry, send this one more time due to network problems. v1->v2: - split [v1 2/5] patch to three (doc, config, block layer API) - adapt qcow2 v6 Sam Li (7): docs/qcow2: add zd_extension_s

[RFC v2 4/7] hw/nvme: add blk_get_zone_extension to access zd_extensions

2023-11-27 Thread Sam Li
Signed-off-by: Sam Li --- block/block-backend.c | 16 hw/nvme/ctrl.c| 20 ++-- hw/nvme/ns.c | 24 hw/nvme/nvme.h| 7 --- include/sysemu/block-backend-io.h | 2

[RFC v2 3/7] hw/nvme: use blk_get_*() to access zone info in the block layer

2023-11-27 Thread Sam Li
The zone information is contained in the BlockLimits fileds. Add blk_get_*() functions to access the block layer and update zone info accessing in the NVMe device emulation. Signed-off-by: Sam Li --- block/block-backend.c | 72 +++ hw/nvme/ctrl.c

[RFC v2 1/7] docs/qcow2: add zd_extension_size option to the zoned format feature

2023-11-27 Thread Sam Li
Signed-off-by: Sam Li --- docs/interop/qcow2.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt index 0f1938f056..458d05371a 100644 --- a/docs/interop/qcow2.txt +++ b/docs/interop/qcow2.txt @@ -428,6 +428,9 @@ The fields of the zoned

[RFC v2 6/7] hw/nvme: refactor zone append write using block layer APIs

2023-11-27 Thread Sam Li
Signed-off-by: Sam Li --- block/qcow2.c| 2 +- hw/nvme/ctrl.c | 190 --- include/sysemu/dma.h | 3 + system/dma-helpers.c | 17 4 files changed, 162 insertions(+), 50 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index

[RFC v2 7/7] hw/nvme: make ZDED persistent

2023-11-27 Thread Sam Li
attributes at the following eight bit of zone type bit of write pointers for each zone. The ZDED is stored as part of zoned metadata as write pointers. Signed-off-by: Sam Li --- block/qcow2.c| 45 hw/nvme/ctrl.c | 1 + include/block

[RFC v2 2/7] qcow2: add zd_extension configurations to zoned metadata

2023-11-27 Thread Sam Li
Zone descriptor data is host definied data that is associated with each zone. Add zone descriptor extensions to zonedmeta struct. Signed-off-by: Sam Li --- block/qcow2.c| 69 +--- block/qcow2.h| 2 + include/block/block_int

[RFC v2 5/7] hw/nvme: make the metadata of ZNS emulation persistent

2023-11-27 Thread Sam Li
zone state transition and manage zone resources. Signed-off-by: Sam Li --- block/qcow2.c|3 + hw/nvme/ctrl.c | 1106 +++--- hw/nvme/ns.c | 77 +-- hw/nvme/nvme.h | 85 +-- include/block

[RFC v2 0/7] Add persistence to NVMe ZNS emulation

2023-11-27 Thread Sam Li
=${znsimg},id=nvmezns0,format=qcow2,if=none \ -device nvme-ns,drive=nvmezns0,bus=nvme0,nsid=1,uuid=xxx \ v1->v2: - split [v1 2/5] patch to three (doc, config, block layer API) - adapt qcow2 v6 Sam Li (7): docs/qcow2: add zd_extension_size option to the zoned format feature qcow2: add zd_extens

[PATCH v6 1/4] docs/qcow2: add the zoned format feature

2023-11-26 Thread Sam Li
Add the specs for the zoned format feature of the qcow2 driver. The qcow2 file then can emulate real zoned devices, either passed through by virtio-blk device or NVMe ZNS drive to the guest given zoned information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- docs/system/qemu-block

[PATCH v6 2/4] qcow2: add configurations for zoned format extension

2023-11-26 Thread Sam Li
feature, use command like this: $path/to/qemu-img create -f qcow2 zbc.qcow2 -o size=768M -o zone.size=64M -o zone.capacity=64M -o zone.conventional_zones=0 -o zone.max_append_bytes=4096 -o zone.max_open_zones=10 -o zone.max_active_zones=12 -o zone.mode=host-managed Signed-off-by: Sam Li --- block

[PATCH v6 4/4] iotests: test the zoned format feature for qcow2 file

2023-11-26 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check -qcow2 zoned-qcow2 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned-qcow2 | 126 +++ tests/qemu-iotests/tests/zoned-qcow2.out | 118 + 2 files

[PATCH v6 3/4] qcow2: add zoned emulation capability

2023-11-26 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. It is managed by active zone lists following LRU policy. Signed-off-by: Sam Li --- block/qcow2.c| 741 ++- block

[PATCH v6 0/4] Add full zoned storage emulation to qcow2 driver

2023-11-26 Thread Sam Li
tefan): * fix zoned_mata allocation size * use bitwise or than addition * fix wp index overflow and locking * cleanups: comments, naming Sam Li (4): docs/qcow2: add the zoned format feature qcow2: add configurations for zoned format extension qcow2: add zoned emulation capability iotests:

Re: [PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-11-16 Thread Sam Li
Hi Eric, Eric Blake 于2023年10月30日周一 22:53写道: > > On Mon, Oct 30, 2023 at 08:18:45PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of co

Re: [PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-11-16 Thread Sam Li
Markus Armbruster 于2023年11月3日周五 17:08写道: > > Eric Blake writes: > > > On Mon, Oct 30, 2023 at 08:18:45PM +0800, Sam Li wrote: > >> To configure the zoned format feature on the qcow2 driver, it > >> requires settings as: the device size, zone model, zone

Re: [PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-11-16 Thread Sam Li
Stefan Hajnoczi 于2023年11月3日周五 11:24写道: > > On Mon, Oct 30, 2023 at 08:18:45PM +0800, Sam Li wrote: > > +typedef struct Qcow2ZoneListEntry { > > +QLIST_ENTRY(Qcow2ZoneListEntry) exp_open_zone_entry; > > +QLIST_ENTRY(Qcow2ZoneListEntry) imp_open_zone_ent

Re: [PATCH v2] block/file-posix: fix update_zones_wp() caller

2023-10-31 Thread Sam Li
Looks good, thanks! Hanna Czenczek 于2023年10月31日 周二17:24写道: > On 25.08.23 06:05, Sam Li wrote: > > When the zoned request fail, it needs to update only the wp of > the target zones for not disrupting the in-flight writes on > these other zones. The wp is updated successfully afte

Re: [PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-10-30 Thread Sam Li
Hi Eric, Eric Blake 于2023年10月30日周一 22:53写道: > > On Mon, Oct 30, 2023 at 08:18:45PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of co

Re: [PATCH v5 1/4] docs/qcow2: add the zoned format feature

2023-10-30 Thread Sam Li
Eric Blake 于2023年10月30日周一 22:05写道: > > On Mon, Oct 30, 2023 at 08:18:44PM +0800, Sam Li wrote: > > Add the specs for the zoned format feature of the qcow2 driver. > > The qcow2 file can be taken as zoned device and passed through by > > virtio-blk device or NVMe ZNS d

[PATCH v5 3/4] qcow2: add zoned emulation capability

2023-10-30 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. It is managed by active zone lists following LRU policy. Signed-off-by: Sam Li --- block/qcow2.c| 731 ++- block

[PATCH v5 4/4] iotests: test the zoned format feature for qcow2 file

2023-10-30 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check -qcow2 zoned-qcow2 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned-qcow2 | 126 +++ tests/qemu-iotests/tests/zoned-qcow2.out | 118 + 2 files

[PATCH v5 1/4] docs/qcow2: add the zoned format feature

2023-10-30 Thread Sam Li
Add the specs for the zoned format feature of the qcow2 driver. The qcow2 file can be taken as zoned device and passed through by virtio-blk device or NVMe ZNS device to the guest given zoned information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- docs/system/qemu-block

[PATCH v5 0/4] Add full zoned storage emulation to qcow2 driver

2023-10-30 Thread Sam Li
ned commands - make zone append change state to full when wp reaches end - add documentation to qcow2 zoned extension header - address review comments (Stefan): * fix zoned_mata allocation size * use bitwise or than addition * fix wp index overflow and locking * cleanups: comments, namin

[PATCH v5 2/4] qcow2: add configurations for zoned format extension

2023-10-30 Thread Sam Li
command like this: $ qemu-img create -f qcow2 test.qcow2 -o size=768M -o zone_size=64M -o zone_capacity=64M -o conventional_zones=0 -o max_append_bytes=4096 -o max_open_zones=0 -o max_active_zones=0 -o zone_model=host-managed Signed-off-by: Sam Li fix config? --- block/qcow2.c

Re: [PATCH] file-posix: fix over-writing of returning zone_append offset

2023-10-30 Thread Sam Li
iro Aota > --- > block/file-posix.c | 16 +++- > 1 file changed, 7 insertions(+), 9 deletions(-) Thanks! Reviewed-by: Sam Li > > diff --git a/block/file-posix.c b/block/file-posix.c > index 50e2b20d5c45..c39209358909 100644 > --- a/block/file-posix.c >

Re: [PATCH v2] block/file-posix: fix update_zones_wp() caller

2023-10-16 Thread Sam Li
Sam Li 于2023年8月25日周五 12:06写道: > > When the zoned request fail, it needs to update only the wp of > the target zones for not disrupting the in-flight writes on > these other zones. The wp is updated successfully after the > request completes. > > Fixed the callers with righ

Re: [PATCH v4 2/4] qcow2: add configurations for zoned format extension

2023-10-09 Thread Sam Li
Hello Eric, Eric Blake 于2023年9月28日周四 23:15写道: > > On Mon, Sep 18, 2023 at 05:53:11PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of co

Re: [PATCH v4 3/4] qcow2: add zoned emulation capability

2023-10-09 Thread Sam Li
Eric Blake 于2023年9月29日周五 03:17写道: > > On Mon, Sep 18, 2023 at 05:53:12PM +0800, Sam Li wrote: > > By adding zone operations and zoned metadata, the zoned emulation > > capability enables full emulation support of zoned device using > > a qcow2 file. The zoned device met

Re: [PATCH v4 2/4] qcow2: add configurations for zoned format extension

2023-09-25 Thread Sam Li
Markus Armbruster 于2023年9月25日周一 21:05写道: > > Sam Li writes: > > > To configure the zoned format feature on the qcow2 driver, it > > requires settings as: the device size, zone model, zone size, > > zone capacity, number of conventional zones, limits on zone > > r

Re: [PATCH v3 2/4] qcow2: add configurations for zoned format extension

2023-09-18 Thread Sam Li
Markus Armbruster 于2023年9月18日周一 22:46写道: > > Sam Li writes: > > > Markus Armbruster 于2023年9月1日周五 19:08写道: > >> > >> Sam Li writes: > >> > >> > To configure the zoned format feature on the qcow2 driver, it > >> > requires fol

[PATCH v4 4/4] iotests: test the zoned format feature for qcow2 file

2023-09-18 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check -qcow2 zoned-qcow2 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned-qcow2 | 129 ++ tests/qemu-iotests/tests/zoned-qcow2.out | 133 +++ 2 files

[PATCH v4 3/4] qcow2: add zoned emulation capability

2023-09-18 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. Signed-off-by: Sam Li --- block/qcow2.c | 709 - block/qcow2.h | 2 + block/trace-events | 2

[PATCH v4 2/4] qcow2: add configurations for zoned format extension

2023-09-18 Thread Sam Li
, use command like this: $ qemu-img create -f qcow2 test.qcow2 -o size=768M -o zone_size=64M -o zone_capacity=64M -o nr_conv_zones=0 -o max_append_sectors=512 -o max_open_zones=0 -o max_active_zones=0 -o zone_model=1 Signed-off-by: Sam Li --- block/qcow2.c| 186

[PATCH v4 0/4] Add full zoned storage emulation to qcow2 driver

2023-09-18 Thread Sam Li
overflow and locking * cleanups: comments, naming Sam Li (4): docs/qcow2: add the zoned format feature qcow2: add configurations for zoned format extension qcow2: add zoned emulation capability iotests: test the zoned format feature for qcow2 file block/qcow2.c

[PATCH v4 1/4] docs/qcow2: add the zoned format feature

2023-09-18 Thread Sam Li
Add the specs for the zoned format feature of the qcow2 driver. The qcow2 file can be taken as zoned device and passed through by virtio-blk device or NVMe ZNS device to the guest given zoned information. Signed-off-by: Sam Li --- docs/system/qemu-block-drivers.rst.inc | 33

Re: [PATCH v3 2/4] qcow2: add configurations for zoned format extension

2023-09-18 Thread Sam Li
Stefan Hajnoczi 于2023年9月14日周四 04:12写道: > > On Mon, Aug 28, 2023 at 11:09:53PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires following arguments: the device size, zoned profile, > > zone model, zone size, zone capacity

Re: [PATCH v3 2/4] qcow2: add configurations for zoned format extension

2023-09-18 Thread Sam Li
Markus Armbruster 于2023年9月1日周五 19:08写道: > > Sam Li writes: > > > To configure the zoned format feature on the qcow2 driver, it > > requires following arguments: the device size, zoned profile, > > "Zoned profile" is gone in v3. > > > zone model, zo

Re: [PATCH v2 3/4] qcow2: add zoned emulation capability

2023-08-29 Thread Sam Li
Damien Le Moal 于2023年8月29日周二 15:14写道: > > On 8/29/23 15:27, Sam Li wrote: > > Damien Le Moal 于2023年8月29日周二 14:06写道: > >> > >> On 8/28/23 20:55, Sam Li wrote: > >>>>> +/* close one implicitly open zones to make it

Re: [PATCH v2 3/4] qcow2: add zoned emulation capability

2023-08-29 Thread Sam Li
Damien Le Moal 于2023年8月29日周二 14:06写道: > > On 8/28/23 20:55, Sam Li wrote: > >>> +/* close one implicitly open zones to make it available */ > >>> +for (int i = s->zoned_header.zone_nr_conv; > >>> +i < bs->bl.n

[PATCH v3 3/4] qcow2: add zoned emulation capability

2023-08-28 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. Signed-off-by: Sam Li --- block/qcow2.c | 657 - block/qcow2.h | 2 + block/trace-events | 1

[PATCH v3 2/4] qcow2: add configurations for zoned format extension

2023-08-28 Thread Sam Li
file with zoned format, use command like this: $ qemu-img create -f qcow2 test.qcow2 -o size=768M -o zone_size=64M -o zone_capacity=64M -o nr_conv_zones=0 -o max_append_sectors=512 -o max_open_zones=0 -o max_active_zones=0 -o zone_model=1 Signed-off-by: Sam Li --- block/qcow2.c

[PATCH v3 4/4] iotests: test the zoned format feature for qcow2 file

2023-08-28 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check -qcow2 zoned-qcow2 Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned-qcow2 | 135 ++ tests/qemu-iotests/tests/zoned-qcow2.out | 140 +++ 2 files

[PATCH v3 0/4] Add full zoned storage emulation to qcow2 driver

2023-08-28 Thread Sam Li
cation size * use bitwise or than addition * fix wp index overflow and locking * cleanups: comments, naming Sam Li (4): docs/qcow2: add the zoned format feature qcow2: add configurations for zoned format extension qcow2: add zoned emulation capability iotests: test the zoned format f

[PATCH v3 1/4] docs/qcow2: add the zoned format feature

2023-08-28 Thread Sam Li
Add the specs for the zoned format feature of the qcow2 driver. The qcow2 file can be taken as zoned device and passed through by virtio-blk device or NVMe ZNS device to the guest given zoned information. Signed-off-by: Sam Li --- docs/system/qemu-block-drivers.rst.inc | 39

Re: [PATCH v2 2/4] qcow2: add configurations for zoned format extension

2023-08-28 Thread Sam Li
Stefan Hajnoczi 于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 > >

Re: [PATCH v2 3/4] qcow2: add zoned emulation capability

2023-08-28 Thread Sam Li
Stefan Hajnoczi 于2023年8月23日周三 03:48写道: > > On Mon, Aug 14, 2023 at 04:58:01PM +0800, Sam Li wrote: > > By adding zone operations and zoned metadata, the zoned emulation > > capability enables full emulation support of zoned device using > > a qcow2 file. The zoned devic

Re: [PATCH v2 2/4] qcow2: add configurations for zoned format extension

2023-08-28 Thread Sam Li
Damien Le Moal 于2023年8月28日周一 18:22写道: > > On 8/28/23 19:18, Sam Li wrote: > > Damien Le Moal 于2023年8月28日周一 18:13写道: > >> > >> On 8/28/23 18:22, Sam Li wrote: > >>> Stefan Hajnoczi 于2023年8月21日周一 21:31写道: > >>>> > >>>> On

Re: [PATCH v2 2/4] qcow2: add configurations for zoned format extension

2023-08-28 Thread Sam Li
Damien Le Moal 于2023年8月28日周一 18:13写道: > > On 8/28/23 18:22, Sam Li wrote: > > Stefan Hajnoczi 于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 > >>>

Re: [PATCH v2 2/4] qcow2: add configurations for zoned format extension

2023-08-28 Thread Sam Li
Stefan Hajnoczi 于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 > >

Re: [PATCH v2 2/4] qcow2: add configurations for zoned format extension

2023-08-28 Thread Sam Li
Markus Armbruster 于2023年8月21日周一 21:13写道: > > Sam Li writes: > > > To configure the zoned format feature on the qcow2 driver, it > > requires following arguments: the device size, zoned profile, > > zoned model, zone size, zone capacity, number of conventional > >

[PATCH v2] block/file-posix: fix update_zones_wp() caller

2023-08-24 Thread Sam Li
When the zoned request fail, it needs to update only the wp of the target zones for not disrupting the in-flight writes on these other zones. The wp is updated successfully after the request completes. Fixed the callers with right offset and nr_zones. Signed-off-by: Sam Li --- block/file

Re: [PATCH] block/file-posix: fix update_zones_wp() caller

2023-08-24 Thread Sam Li
Damien Le Moal 于2023年8月25日周五 11:32写道: > > On 8/25/23 12:05, Sam Li wrote: > > Damien Le Moal 于2023年8月25日周五 07:49写道: > >> > >> On 8/25/23 02:39, Sam Li wrote: > >>> When the zoned requests that may change wp fail, it needs to > >>> update

Re: [PATCH] block/file-posix: fix update_zones_wp() caller

2023-08-24 Thread Sam Li
Damien Le Moal 于2023年8月25日周五 07:49写道: > > On 8/25/23 02:39, Sam Li wrote: > > When the zoned requests that may change wp fail, it needs to > > update only wps of the zones within the range of the requests > > for not disrupting the other in-flight requests. The wp is

[PATCH] block/file-posix: fix update_zones_wp() caller

2023-08-24 Thread Sam Li
-by: Sam Li --- block/file-posix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index b16e9c21a1..22559d6c2d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2522,7 +2522,8 @@ out: } } else

Re: [PATCH 4/5] file-posix: Simplify raw_co_prw's 'out' zone code

2023-08-24 Thread Sam Li
Hanna Czenczek 于2023年8月24日周四 23:53写道: > > We duplicate the same condition three times here, pull it out to the top > level. > > Signed-off-by: Hanna Czenczek > --- > block/file-posix.c | 18 +- > 1 file changed, 5 insertions(+), 13 deletions(-) Reviewed-by: Sam Li

Re: [PATCH 3/5] file-posix: Fix zone update in I/O error path

2023-08-24 Thread Sam Li
e-posix.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Reviewed-by: Sam Li

Re: [PATCH 0/5] file-posix: Clean up and fix zoned checks

2023-08-24 Thread Sam Li
Hi Hanna, Hanna Czenczek 于2023年8月24日周四 23:53写道: > > Hi, > > As presented in [1] there is a bug in the zone code in raw_co_prw(), > specifically we don’t check whether there actually is zone information > before running code that assumes there is (and thus we run into a > division by zero). This

Re: [PATCH 2/5] file-posix: Check bs->bl.zoned for zone info

2023-08-24 Thread Sam Li
ng other than BLK_Z_NONE, other values and objects > like bs->wps and bs->bl.zone_size must be non-null/zero and valid; if it > is not, we cannot rely on their validity. > > Signed-off-by: Hanna Czenczek > --- > block/file-posix.c | 12 +++- > 1 file changed, 7 insertions(+), 5 deletions(-) Reviewed-by: Sam Li

Re: [PATCH 1/5] file-posix: Clear bs->bl.zoned on error

2023-08-24 Thread Sam Li
a memory leak in the last error path in > raw_refresh_zoned_limits(). > > Signed-off-by: Hanna Czenczek > --- > block/file-posix.c | 21 - > 1 file changed, 12 insertions(+), 9 deletions(-) Reviewed-by: Sam Li

Re: [PATCH v2 0/4] Add full zoned storage emulation to qcow2 driver

2023-08-16 Thread Sam Li
Klaus Jensen 于2023年8月16日周三 15:37写道: > > On Aug 14 16:57, Sam Li wrote: > > This patch series add a new extension - zoned format - to the > > qcow2 driver thereby allowing full zoned storage emulation on > > the qcow2 img file. Users can attach such a qcow2 file to the >

[RFC 4/5] hw/nvme: refactor zone append writes using block layer APIs

2023-08-16 Thread Sam Li
Signed-off-by: Sam Li --- block/block-backend.c | 8 ++ block/qcow2.c | 7 +- hw/nvme/ctrl.c| 195 ++ include/sysemu/block-backend-io.h | 1 + include/sysemu/dma.h | 3 + softmmu/dma-helpers.c

[RFC 5/5] hw/nvme: make ZDED persistent

2023-08-16 Thread Sam Li
attributes at the following eight bit of zoned bit of write pointers for each zone. The ZDED is stored as part of zoned metadata as write pointers. Signed-off-by: Sam Li --- block/qcow2.c| 44 +++- hw/nvme/ctrl.c | 6 + include

[RFC 3/5] hw/nvme: make the metadata of ZNS emulation persistent

2023-08-16 Thread Sam Li
zone state transition and manage zone resources. Signed-off-by: Sam Li --- block/block-backend.c | 15 + block/qcow2.c |3 + hw/nvme/ctrl.c| 1114 ++--- hw/nvme/ns.c | 77 +- hw/nvme/nvme.h

[RFC 2/5] qcow2: add zone device metadata with zd_extension

2023-08-16 Thread Sam Li
Zone descriptor data is host definied data that is associated with each zone. Add zone descriptor extensions to zonedmeta and blk_get_zone_extension to access zd_extensions. Signed-off-by: Sam Li --- block/block-backend.c | 15 ++ block/qcow2.c | 86

[RFC 1/5] hw/nvme: use blk_get_*() to access zone info in the block layer

2023-08-16 Thread Sam Li
The zone information is contained in the BlockLimits fileds. Add blk_get_*() functions to access the block layer and update zone info accessing in the NVMe device emulation. Signed-off-by: Sam Li --- block/block-backend.c | 56 block/qcow2.c

[RFC 0/5] Add persistence to NVMe ZNS emulation

2023-08-16 Thread Sam Li
in the command line of QEMU, use: -drive file=${znsimg},id=nvmezns0,format=qcow2,if=none \ -device nvme-ns,drive=nvmezns0,bus=nvme0,nsid=1,uuid=xxx \ Sam Li (5): hw/nvme: use blk_get_*() to access zone info in the block layer qcow2: add zone device metadata with zd_extension hw/nvme: make

[PATCH v2 4/4] iotests: test the zoned format feature for qcow2 file

2023-08-14 Thread Sam Li
The zoned format feature can be tested by: $ tests/qemu-iotests/check zoned-qcow2 Signed-off-by: Sam Li --- tests/qemu-iotests/tests/zoned-qcow2 | 135 ++ tests/qemu-iotests/tests/zoned-qcow2.out | 140 +++ 2 files changed, 275 insertions(+) create

[PATCH v2 1/4] docs/qcow2: add the zoned format feature

2023-08-14 Thread Sam Li
drive. Signed-off-by: Sam Li --- docs/system/qemu-block-drivers.rst.inc | 39 ++ 1 file changed, 39 insertions(+) diff --git a/docs/system/qemu-block-drivers.rst.inc b/docs/system/qemu-block-drivers.rst.inc index 105cb9679c..2c1620668f 100644 --- a/docs/system/qemu

[PATCH v2 0/4] Add full zoned storage emulation to qcow2 driver

2023-08-14 Thread Sam Li
use bitwise or than addition * fix wp index overflow and locking * cleanups: comments, naming Sam Li (4): docs/qcow2: add the zoned format feature qcow2: add configurations for zoned format extension qcow2: add zoned emulation capability iotests: test the zoned format feature for qcow2 f

[PATCH v2 2/4] qcow2: add configurations for zoned format extension

2023-08-14 Thread Sam Li
=0 -o zoned_profile=zbc/zns Signed-off-by: Sam Li --- block/qcow2.c| 125 +++ block/qcow2.h| 21 ++ docs/interop/qcow2.txt | 24 ++ include/block/block-common.h | 5 ++ include/block/block_int-common.h

[PATCH v2 3/4] qcow2: add zoned emulation capability

2023-08-14 Thread Sam Li
corresponding state changing. Zoned devices have a limit on zone resources, which puts constraints on write operations into zones. Signed-off-by: Sam Li --- block/qcow2.c | 676 - block/qcow2.h | 2 + docs/interop/qcow2.txt | 2 + 3

Re: [PATCH 1/2] block/file-posix: fix g_file_get_contents return path

2023-07-27 Thread Sam Li
Matthew Rosato 于2023年7月27日周四 19:46写道: > > On 7/5/23 10:54 AM, Matthew Rosato wrote: > > On 6/4/23 2:16 AM, Sam Li wrote: > >> The g_file_get_contents() function returns a g_boolean. If it fails, the > >> returned value will be 0 instead of -1. Solve the issue by ski

[PATCH v2] block/file-posix: fix g_file_get_contents return path

2023-07-27 Thread Sam Li
-by: Sam Li Reviewed-by: Matthew Rosato Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 9e8e3d8ca5..b16e9c21a1 100644 --- a/block/file-posix.c +++ b/block/file-posix.c

Re: [RFC 2/4] qcow2: add configurations for zoned format extension

2023-06-20 Thread Sam Li
Stefan Hajnoczi 于2023年6月20日周二 22:48写道: > > On Mon, Jun 19, 2023 at 10:50:31PM +0800, Sam Li wrote: > > Stefan Hajnoczi 于2023年6月19日周一 22:42写道: > > > > > > On Mon, Jun 19, 2023 at 06:32:52PM +0800, Sam Li wrote: > > > > Stefan Hajnoczi 于2023年6月19日周一 18:

Re: [RFC 2/4] qcow2: add configurations for zoned format extension

2023-06-19 Thread Sam Li
Stefan Hajnoczi 于2023年6月19日周一 22:42写道: > > On Mon, Jun 19, 2023 at 06:32:52PM +0800, Sam Li wrote: > > Stefan Hajnoczi 于2023年6月19日周一 18:10写道: > > > On Mon, Jun 05, 2023 at 06:41:06PM +0800, Sam Li wrote: > > > > diff --git a/block/qcow2.h b/block/qcow2.h >

Re: [RFC 2/4] qcow2: add configurations for zoned format extension

2023-06-19 Thread Sam Li
Stefan Hajnoczi 于2023年6月19日周一 18:10写道: > > On Mon, Jun 05, 2023 at 06:41:06PM +0800, Sam Li wrote: > > To configure the zoned format feature on the qcow2 driver, it > > requires following arguments: the device size, zoned profile, > > zoned model, zone size, zone capacity

Re: [RFC 1/4] docs/qcow2: add the zoned format feature

2023-06-13 Thread Sam Li
Stefan Hajnoczi 于2023年6月13日周二 15:04写道: > > On Mon, Jun 05, 2023 at 06:41:05PM +0800, Sam Li wrote: > > Add the specs for the zoned format feature of the qcow2 driver. Once > > the zoned_profile is set to `zbc`, then the qcow2 file can be taken > > as zoned devices and pass

  1   2   3   4   5   >