Re: [PATCH v2] block/file-posix: fix wps checking in raw_co_prw

2023-06-07 Thread Sam Li
Damien Le Moal 于2023年6月8日周四 09:29写道: > > On 6/8/23 03:57, Sam Li wrote: > > If the write operation fails and the wps is NULL, then accessing it will > > lead to data corruption. > > > > Solving the issue by adding a nullptr checking in get_zones_wp() where > >

[PATCH v2] block/file-posix: fix wps checking in raw_co_prw

2023-06-07 Thread Sam Li
If the write operation fails and the wps is NULL, then accessing it will lead to data corruption. Solving the issue by adding a nullptr checking in get_zones_wp() where the wps is used. This issue is found by Peter Maydell using the Coverity Tool (CID 1512459). Signed-off-by: Sam Li --- block

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

2023-06-05 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 | 110 +++ tests/qemu-iotests/tests/zoned-qcow2.out | 87 ++ 2 files changed, 197 insertions(+) create mode

[RFC 3/4] qcow2: add zoned emulation capability

2023-06-05 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 | 629 +- block/qcow2.h | 2 + 2 files changed, 629 insertions(+), 2

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

2023-06-05 Thread Sam Li
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 passed through by virtio-blk device to the guest. Signed-off-by: Sam Li --- docs/system/qemu-block-drivers.rst.inc | 31

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

2023-06-05 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 zone_nr_conv=0 -o max_append_sectors=512 -o max_open_zones=0 -o max_active_zones=0 -o zoned_profile=zbc Signed-off-by: Sam Li --- block/qcow2.c

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

2023-06-05 Thread Sam Li
,file.filename=../qemu/test.qcow2 \ -device virtio-blk-pci,drive=drive1 \ 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 2/2] block/file-posix: fix wps checking in raw_co_prw

2023-06-04 Thread Sam Li
If the write operation fails and the wps is NULL, then accessing it will lead to data corruption. Solving the issue by adding a nullptr checking in get_zones_wp() where the wps is used. This issue is found by Peter Maydell using the Coverity Tool (CID 1512459). Signed-off-by: Sam Li --- block

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

2023-06-04 Thread Sam Li
-by: Sam Li --- 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 ac1ed54811..0d9d179a35 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1232,7 +1232,6 @@ static int hdev_get_max_hw_transfer(int

Re: [PULL v2 02/16] block/file-posix: introduce helper functions for sysfs attributes

2023-06-02 Thread Sam Li
Matthew Rosato 于2023年6月3日周六 02:41写道: > > On 6/2/23 2:18 PM, Sam Li wrote: > > Matthew Rosato 于2023年6月1日周四 02:21写道: > >> > >> On 5/15/23 12:04 PM, Stefan Hajnoczi wrote: > >>> From: Sam Li > >>> > >>> Use get_s

Re: [PULL v2 02/16] block/file-posix: introduce helper functions for sysfs attributes

2023-06-02 Thread Sam Li
Matthew Rosato 于2023年6月1日周四 02:21写道: > > On 5/15/23 12:04 PM, Stefan Hajnoczi wrote: > > From: Sam Li > > > > Use get_sysfs_str_val() to get the string value of device > > zoned model. Then get_sysfs_zoned_model() can convert it to > > BlockZoneModel type of

Re: [PULL v2 10/16] block: introduce zone append write for zoned devices

2023-06-02 Thread Sam Li
Peter Maydell 于2023年6月3日周六 01:52写道: > > On Fri, 2 Jun 2023 at 18:35, Sam Li wrote: > > > > Peter Maydell 于2023年6月3日周六 01:30写道: > > > > > > On Fri, 2 Jun 2023 at 18:23, Sam Li wrote: > > > > Thanks for spotting this. You are right that bs->wp

Re: [PULL v2 10/16] block: introduce zone append write for zoned devices

2023-06-02 Thread Sam Li
Peter Maydell 于2023年6月3日周六 01:30写道: > > On Fri, 2 Jun 2023 at 18:23, Sam Li wrote: > > > > Peter Maydell 于2023年6月3日周六 00:52写道: > > > > > > On Mon, 15 May 2023 at 17:06, Stefan Hajnoczi wrote: > > > > > > > > From: Sam Li

Re: [PULL v2 10/16] block: introduce zone append write for zoned devices

2023-06-02 Thread Sam Li
Peter Maydell 于2023年6月3日周六 00:52写道: > > On Mon, 15 May 2023 at 17:06, Stefan Hajnoczi wrote: > > > > From: Sam Li > > > > A zone append command is a write operation that specifies the first > > logical block of a zone as the write position. When writing to

[PATCH v11 3/4] virtio-blk: add some trace events for zoned emulation

2023-05-07 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- hw/block/trace-events | 7 +++ hw/block/virtio-blk.c | 12 2 files changed, 19 insertions(+) diff --git a/hw/block/trace-events b/hw/block/trace-events index 2c45a62bd5..34be8b9135 100644 --- a/hw/block/trace-events +++ b

[PATCH v11 2/4] block: add accounting for zone append operation

2023-05-07 Thread Sam Li
Taking account of the new zone append write operation for zoned devices, BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read, write, flush). Signed-off-by: Sam Li --- block/qapi-sysemu.c| 11 ++ block/qapi.c | 18 ++ hw/block/virtio-blk.c

[PATCH v11 4/4] docs/zoned-storage:add zoned emulation use case

2023-05-07 Thread Sam Li
Add the documentation about the example of using virtio-blk driver to pass the zoned block devices through to the guest. Signed-off-by: Sam Li --- docs/devel/zoned-storage.rst | 17 + 1 file changed, 17 insertions(+) diff --git a/docs/devel/zoned-storage.rst b/docs/devel/zoned

[PATCH v11 1/4] virtio-blk: add zoned storage emulation for zoned devices

2023-05-07 Thread Sam Li
be set if the host does support zoned block devices. Regular block devices(conventional zones) will not be set. The guest os can use blktests, fio to test those commands on zoned devices. Furthermore, using zonefs to test zone append write is also supported. Signed-off-by: Sam Li --- hw/block

[PATCH v11 0/4] Add zoned storage emulation to virtio-blk driver

2023-05-07 Thread Sam Li
checking cases [Stefan, Damien] v1: - add zoned storage emulation Sam Li (4): virtio-blk: add zoned storage emulation for zoned devices block: add accounting for zone append operation virtio-blk: add some trace events for zoned emulation docs/zoned-storage:add zoned emulation use case b

[PATCH v11 2/4] block: introduce zone append write for zoned devices

2023-05-07 Thread Sam Li
the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/block-backend.c | 61 +++ block/file-posix.c| 58

[PATCH v11 0/4] Add zone append write for zoned device

2023-05-07 Thread Sam Li
BlockZoneWps's structure to an array of integers - use only mutex lock on locking conditions of zone wps - coding styles and clean-ups v1: - introduce zone append write Sam Li (4): file-posix: add tracking of the zone write pointers block: introduce zone append write for zoned devices qemu-iote

[PATCH v11 4/4] block: add some trace events for zone append

2023-05-07 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index aacb50d5aa..cd47167d04 100644 --- a/block/file-posix.c +++ b

[PATCH v11 1/4] file-posix: add tracking of the zone write pointers

2023-05-07 Thread Sam Li
to a zone - zone append Signed-off-by: Sam Li --- block/file-posix.c | 177 ++- include/block/block-common.h | 14 +++ include/block/block_int-common.h | 5 + 3 files changed, 193 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file

[PATCH v11 3/4] qemu-iotests: test zone append operation

2023-05-07 Thread Sam Li
The patch tests zone append writes by reporting the zone wp after the completion of the call. "zap -p" option can print the sector offset value after completion, which should be the start sector where the append write begins. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --

[PATCH v20 0/8] Add support for zoned device

2023-05-07 Thread Sam Li
- address review comments * modify interfaces of APIs v1: - add block layer APIs resembling Linux ZoneBlockDevice ioctls Sam Li (8): block/block-common: add zoned device structs block/file-posix: introduce helper functions for sysfs attributes block/block-backend: add block layer APIs resemb

[PATCH v20 6/8] iotests: test new zone operations

2023-05-07 Thread Sam Li
The new block layer APIs of zoned block devices can be tested by: $ tests/qemu-iotests/check zoned Run each zone operation on a newly created null_blk device and see whether it outputs the same zone information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Acked-by: Kevin Wolf Message-id

[PATCH v20 5/8] block: add zoned BlockDriver check to block layer

2023-05-07 Thread Sam Li
Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-6-faithilike...@gmail.com [Adjust commit message prefix

[PATCH v20 1/8] block/block-common: add zoned device structs

2023-05-07 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-2-faithilike...@gmail.com [Adjust commit message prefix as suggested by Philippe Mathieu-Daudé

[PATCH v20 2/8] block/file-posix: introduce helper functions for sysfs attributes

2023-05-07 Thread Sam Li
Use get_sysfs_str_val() to get the string value of device zoned model. Then get_sysfs_zoned_model() can convert it to BlockZoneModel type of QEMU. Use get_sysfs_long_val() to get the long value of zoned device information. Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan

[PATCH v20 8/8] docs/zoned-storage: add zoned device documentation

2023-05-07 Thread Sam Li
Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-9-faithilike...@gmail.com [Add index-api.rst to fix

[PATCH v20 7/8] block: add some trace events for new block layer APIs

2023-05-07 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-8-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff

[PATCH v20 3/8] block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2023-05-07 Thread Sam Li
, filename=/dev/nullb0 -c "zrp offset nr_zones" Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-4-faithilike...@gmail.com [Adjust commit message prefix as suggested by Philip

[PATCH v20 4/8] block/raw-format: add zone operations to pass through requests

2023-05-07 Thread Sam Li
raw-format driver usually sits on top of file-posix driver. It needs to pass through requests of zone commands. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id

[PATCH v10 0/4] Add zone append write for zoned device

2023-04-27 Thread Sam Li
integers - use only mutex lock on locking conditions of zone wps - coding styles and clean-ups v1: - introduce zone append write Sam Li (4): file-posix: add tracking of the zone write pointers block: introduce zone append write for zoned devices qemu-iotests: test zone append operation b

[PATCH v10 3/4] qemu-iotests: test zone append operation

2023-04-27 Thread Sam Li
The patch tests zone append writes by reporting the zone wp after the completion of the call. "zap -p" option can print the sector offset value after completion, which should be the start sector where the append write begins. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --

[PATCH v10 4/4] block: add some trace events for zone append

2023-04-27 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 8fc7f73d2c..5f1745ede8 100644 --- a/block/file-posix.c +++ b

[PATCH v10 2/4] block: introduce zone append write for zoned devices

2023-04-27 Thread Sam Li
the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/block-backend.c | 61 +++ block/file-posix.c| 58

[PATCH v10 1/4] file-posix: add tracking of the zone write pointers

2023-04-27 Thread Sam Li
to a zone - zone append Signed-off-by: Sam Li --- block/file-posix.c | 177 ++- include/block/block-common.h | 14 +++ include/block/block_int-common.h | 5 + 3 files changed, 193 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file

[PATCH v19 8/8] docs/zoned-storage: add zoned device documentation

2023-04-27 Thread Sam Li
Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-9-faithilike...@gmail.com [Add index-api.rst to fix

[PATCH v19 6/8] iotests: test new zone operations

2023-04-27 Thread Sam Li
The new block layer APIs of zoned block devices can be tested by: $ tests/qemu-iotests/check zoned Run each zone operation on a newly created null_blk device and see whether it outputs the same zone information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Acked-by: Kevin Wolf Message-id

[PATCH v19 5/8] block: add zoned BlockDriver check to block layer

2023-04-27 Thread Sam Li
Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-6-faithilike...@gmail.com [Adjust commit message prefix

[PATCH v19 2/8] block/file-posix: introduce helper functions for sysfs attributes

2023-04-27 Thread Sam Li
Use get_sysfs_str_val() to get the string value of device zoned model. Then get_sysfs_zoned_model() can convert it to BlockZoneModel type of QEMU. Use get_sysfs_long_val() to get the long value of zoned device information. Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan

[PATCH v19 7/8] block: add some trace events for new block layer APIs

2023-04-27 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-8-faithilike...@gmail.com Signed-off-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff

[PATCH v19 4/8] block/raw-format: add zone operations to pass through requests

2023-04-27 Thread Sam Li
raw-format driver usually sits on top of file-posix driver. It needs to pass through requests of zone commands. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id

[PATCH v19 3/8] block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2023-04-27 Thread Sam Li
, filename=/dev/nullb0 -c "zrp offset nr_zones" Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-4-faithilike...@gmail.com [Adjust commit message prefix as suggested by Philip

[PATCH v19 0/8] Add support for zoned device

2023-04-27 Thread Sam Li
ice ioctls Sam Li (8): block/block-common: add zoned device structs block/file-posix: introduce helper functions for sysfs attributes block/block-backend: add block layer APIs resembling Linux ZonedBlockDevice ioctls block/raw-format: add zone operations to pass through requests block:

[PATCH v19 1/8] block/block-common: add zoned device structs

2023-04-27 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf Message-id: 20230324090605.28361-2-faithilike...@gmail.com [Adjust commit message prefix as suggested by Philippe Mathieu-Daudé

Re: [PATCH] block/file-posix: use unsigned int for zones consistently

2023-04-10 Thread Sam Li
ned comparisons. > > In practice I don't think zoned devices are likely to exceed MAX_INT > zones any time soon, so this is mostly a code cleanup. > > Cc: Sam Li > Cc: Dmitry Fomichev > Cc: Damien Le Moal > Signed-off-by: Stefan Hajnoczi > --- > block/file-p

Re: [PATCH v9 1/4] file-posix: add tracking of the zone write pointers

2023-04-10 Thread Sam Li
Stefan Hajnoczi 于2023年4月10日周一 21:04写道: > > On Fri, Apr 07, 2023 at 04:16:54PM +0800, Sam Li wrote: > > Since Linux doesn't have a user API to issue zone append operations to > > zoned devices from user space, the file-posix driver is modified to add > > zone append emulat

[PATCH v10 4/5] virtio-blk: add some trace events for zoned emulation

2023-04-07 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- hw/block/trace-events | 7 +++ hw/block/virtio-blk.c | 12 2 files changed, 19 insertions(+) diff --git a/hw/block/trace-events b/hw/block/trace-events index 2c45a62bd5..34be8b9135 100644 --- a/hw/block/trace-events +++ b

[PATCH v10 2/5] virtio-blk: add zoned storage emulation for zoned devices

2023-04-07 Thread Sam Li
be set if the host does support zoned block devices. Regular block devices(conventional zones) will not be set. The guest os can use blktests, fio to test those commands on zoned devices. Furthermore, using zonefs to test zone append write is also supported. Signed-off-by: Sam Li --- hw/block

[PATCH v10 0/5] Add zoned storage emulation to virtio-blk driver

2023-04-07 Thread Sam Li
- use qemuio_from_buffer to write status bit [Stefan] - avoid using req->elem directly [Stefan] - fix error checkings and memory leak [Stefan] v2: - change units of emulated zone op coresponding to block layer APIs - modify error checking cases [Stefan, Damien] v1: - add zoned storage emulation

[PATCH v10 3/5] block: add accounting for zone append operation

2023-04-07 Thread Sam Li
Taking account of the new zone append write operation for zoned devices, BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read, write, flush). Signed-off-by: Sam Li --- block/qapi-sysemu.c| 11 ++ block/qapi.c | 18 ++ hw/block/virtio-blk.c

[PATCH v10 5/5] docs/zoned-storage:add zoned emulation use case

2023-04-07 Thread Sam Li
Add the documentation about the example of using virtio-blk driver to pass the zoned block devices through to the guest. Signed-off-by: Sam Li --- docs/devel/zoned-storage.rst | 17 + 1 file changed, 17 insertions(+) diff --git a/docs/devel/zoned-storage.rst b/docs/devel/zoned

[PATCH v10 1/5] include: update virtio_blk headers to v6.3-rc1

2023-04-07 Thread Sam Li
Use scripts/update-linux-headers.sh to update headers to 6.3-rc1. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev --- include/standard-headers/drm/drm_fourcc.h| 12 +++ include/standard-headers/linux/ethtool.h | 48 - include/standard-headers

[PATCH v9 3/4] qemu-iotests: test zone append operation

2023-04-07 Thread Sam Li
The patch tests zone append writes by reporting the zone wp after the completion of the call. "zap -p" option can print the sector offset value after completion, which should be the start sector where the append write begins. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --

[PATCH v9 4/4] block: add some trace events for zone append

2023-04-07 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 4e26641ce0..da986a33fd 100644 --- a/block/file-posix.c +++ b

[PATCH v9 2/4] block: introduce zone append write for zoned devices

2023-04-07 Thread Sam Li
the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/block-backend.c | 60 +++ block/file-posix.c| 58

[PATCH v9 0/4] Add zone append write for zoned device

2023-04-07 Thread Sam Li
integers - use only mutex lock on locking conditions of zone wps - coding styles and clean-ups v1: - introduce zone append write Sam Li (4): file-posix: add tracking of the zone write pointers block: introduce zone append write for zoned devices qemu-iotests: test zone append operation b

[PATCH v9 1/4] file-posix: add tracking of the zone write pointers

2023-04-07 Thread Sam Li
to a zone - zone append Signed-off-by: Sam Li --- block/file-posix.c | 173 ++- include/block/block-common.h | 14 +++ include/block/block_int-common.h | 5 + 3 files changed, 189 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file

Re: [PATCH v9 0/5] Add zoned storage emulation to virtio-blk driver

2023-04-04 Thread Sam Li
Stefan Hajnoczi 于2023年4月3日周一 20:18写道: > > On Wed, 29 Mar 2023 at 01:01, Michael S. Tsirkin wrote: > > > > On Mon, Mar 27, 2023 at 10:45:48PM +0800, Sam Li wrote: > > > > virtio bits look ok. > > > > Reviewed-by: Michael S. Tsirkin > > > > m

[PATCH v8 4/4] block: add some trace events for zone append

2023-04-04 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index a7130b1024..825301467e 100644 --- a/block/file-posix.c +++ b

[PATCH v8 3/4] qemu-iotests: test zone append operation

2023-04-04 Thread Sam Li
The patch tests zone append writes by reporting the zone wp after the completion of the call. "zap -p" option can print the sector offset value after completion, which should be the start sector where the append write begins. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --

[PATCH v8 1/4] file-posix: add tracking of the zone write pointers

2023-04-04 Thread Sam Li
to a zone - zone append Signed-off-by: Sam Li --- block/file-posix.c | 168 ++- include/block/block-common.h | 14 +++ include/block/block_int-common.h | 5 + 3 files changed, 184 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file

[PATCH v8 0/4] Add zone append write for zoned device

2023-04-04 Thread Sam Li
ET_ALL related problems v2: - split patch to two patches for better reviewing - change BlockZoneWps's structure to an array of integers - use only mutex lock on locking conditions of zone wps - coding styles and clean-ups v1: - introduce zone append write Sam Li (4): file-posix: add tracking of

[PATCH v8 2/4] block: introduce zone append write for zoned devices

2023-04-04 Thread Sam Li
the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev --- block/block-backend.c | 60 +++ block/file-posix.c| 56 + block/io.c

Re: [PATCH v7 1/4] file-posix: add tracking of the zone write pointers

2023-04-04 Thread Sam Li
Stefan Hajnoczi 于2023年4月4日周二 01:04写道: > > On Thu, Mar 23, 2023 at 01:19:04PM +0800, Sam Li wrote: > > Since Linux doesn't have a user API to issue zone append operations to > > zoned devices from user space, the file-posix driver is modified to add > > zone append emulat

[PATCH v9 3/5] block: add accounting for zone append operation

2023-03-27 Thread Sam Li
Taking account of the new zone append write operation for zoned devices, BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read, write, flush). Signed-off-by: Sam Li --- block/qapi-sysemu.c| 11 ++ block/qapi.c | 18 ++ hw/block/virtio-blk.c

[PATCH v9 5/5] docs/zoned-storage:add zoned emulation use case

2023-03-27 Thread Sam Li
Add the documentation about the example of using virtio-blk driver to pass the zoned block devices through to the guest. Signed-off-by: Sam Li --- docs/devel/zoned-storage.rst | 17 + 1 file changed, 17 insertions(+) diff --git a/docs/devel/zoned-storage.rst b/docs/devel/zoned

[PATCH v9 2/5] virtio-blk: add zoned storage emulation for zoned devices

2023-03-27 Thread Sam Li
be set if the host does support zoned block devices. Regular block devices(conventional zones) will not be set. The guest os can use blktests, fio to test those commands on zoned devices. Furthermore, using zonefs to test zone append write is also supported. Signed-off-by: Sam Li --- hw/block

[PATCH v9 4/5] virtio-blk: add some trace events for zoned emulation

2023-03-27 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- hw/block/trace-events | 7 +++ hw/block/virtio-blk.c | 12 2 files changed, 19 insertions(+) diff --git a/hw/block/trace-events b/hw/block/trace-events index 2c45a62bd5..34be8b9135 100644 --- a/hw/block/trace-events +++ b

[PATCH v9 1/5] include: update virtio_blk headers to v6.3-rc1

2023-03-27 Thread Sam Li
Use scripts/update-linux-headers.sh to update headers to 6.3-rc1. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev --- include/standard-headers/drm/drm_fourcc.h| 12 +++ include/standard-headers/linux/ethtool.h | 48 - include/standard-headers

[PATCH v9 0/5] Add zoned storage emulation to virtio-blk driver

2023-03-27 Thread Sam Li
age emulation Sam Li (5): include: update virtio_blk headers to v6.3-rc1 virtio-blk: add zoned storage emulation for zoned devices block: add accounting for zone append operation virtio-blk: add some trace events for zoned emulation docs/zoned-storage:add zoned emulation use case block/q

[PATCH v9 4/5] virtio-blk: add some trace events for zoned emulation

2023-03-24 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- hw/block/trace-events | 7 +++ hw/block/virtio-blk.c | 12 2 files changed, 19 insertions(+) diff --git a/hw/block/trace-events b/hw/block/trace-events index 2c45a62bd5..34be8b9135 100644 --- a/hw/block/trace-events +++ b

[PATCH v18 3/8] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2023-03-24 Thread Sam Li
, filename=/dev/nullb0 -c "zrp offset nr_zones" Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev Acked-by: Kevin Wolf --- block/block-backend.c | 133 + block/file-posix.c

[PATCH v9 1/5] include: update virtio_blk headers to v6.3-rc1

2023-03-24 Thread Sam Li
Use scripts/update-linux-headers.sh to update headers to 6.3-rc1. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev --- include/standard-headers/drm/drm_fourcc.h| 12 +++ include/standard-headers/linux/ethtool.h | 48 - include/standard-headers

Re: [PATCH v17 6/8] qemu-iotests: test new zone operations

2023-03-24 Thread Sam Li
Stefan Hajnoczi 于2023年3月24日周五 03:31写道: > > On Thu, Mar 23, 2023 at 01:08:32PM +0800, Sam Li wrote: > > The new block layer APIs of zoned block devices can be tested by: > > $ tests/qemu-iotests/check zoned > > Run each zone operation on a newly created null_blk de

[PATCH v18 5/8] config: add check to block layer

2023-03-24 Thread Sam Li
Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev --- block.c | 19 +++ block/file-posix.c | 12

[PATCH v9 0/5] Add zoned storage emulation to virtio-blk driver

2023-03-24 Thread Sam Li
lem directly [Stefan] - fix error checkings and memory leak [Stefan] v2: - change units of emulated zone op coresponding to block layer APIs - modify error checking cases [Stefan, Damien] v1: - add zoned storage emulation Sam Li (5): include: update virtio_blk headers to v6.3-rc1 virtio-blk:

[PATCH v9 3/5] block: add accounting for zone append operation

2023-03-24 Thread Sam Li
Taking account of the new zone append write operation for zoned devices, BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read, write, flush). Signed-off-by: Sam Li --- block/qapi-sysemu.c| 11 ++ block/qapi.c | 18 ++ hw/block/virtio-blk.c

[PATCH v18 4/8] raw-format: add zone operations to pass through requests

2023-03-24 Thread Sam Li
raw-format driver usually sits on top of file-posix driver. It needs to pass through requests of zone commands. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev --- block/raw-format.c | 17

[PATCH v18 7/8] block: add some trace events for new block layer APIs

2023-03-24 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev --- block/file-posix.c | 3 +++ block/trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 5fa80933c9..65efe5147e 100644 --- a/block/file-posix.c +++ b

[PATCH v18 1/8] include: add zoned device structs

2023-03-24 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev --- include/block/block-common.h | 43 1 file changed, 43 insertions(+) diff --git a/include/block/block-common.h b

[PATCH v9 5/5] docs/zoned-storage:add zoned emulation use case

2023-03-24 Thread Sam Li
Add the documentation about the example of using virtio-blk driver to pass the zoned block devices through to the guest. Signed-off-by: Sam Li --- docs/devel/zoned-storage.rst | 17 + 1 file changed, 17 insertions(+) diff --git a/docs/devel/zoned-storage.rst b/docs/devel/zoned

[PATCH v18 5/8] config: add check to block layer

2023-03-24 Thread Sam Li
Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev --- block.c | 19 +++ block/file-posix.c | 12

[PATCH v18 0/8] Add support for zoned device

2023-03-24 Thread Sam Li
w comments * fix zone report bugs * fix the qemu-io code path * use thread pool to avoid blocking ioctl() calls v2: - add qemu-io sub-commands - address review comments * modify interfaces of APIs v1: - add block layer APIs resembling Linux ZoneBlockDevice ioctls Sam Li (8): include:

[PATCH v9 1/5] include: update virtio_blk headers to v6.3-rc1

2023-03-24 Thread Sam Li
Use scripts/update-linux-headers.sh to update headers to 6.3-rc1. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev --- include/standard-headers/drm/drm_fourcc.h| 12 +++ include/standard-headers/linux/ethtool.h | 48 - include/standard-headers

[PATCH v18 2/8] file-posix: introduce helper functions for sysfs attributes

2023-03-24 Thread Sam Li
Use get_sysfs_str_val() to get the string value of device zoned model. Then get_sysfs_zoned_model() can convert it to BlockZoneModel type of QEMU. Use get_sysfs_long_val() to get the long value of zoned device information. Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan

[PATCH v9 2/5] virtio-blk: add zoned storage emulation for zoned devices

2023-03-24 Thread Sam Li
be set if the host does support zoned block devices. Regular block devices(conventional zones) will not be set. The guest os can use blktests, fio to test those commands on zoned devices. Furthermore, using zonefs to test zone append write is also supported. Signed-off-by: Sam Li --- hw/block

[PATCH v18 6/8] qemu-iotests: test new zone operations

2023-03-24 Thread Sam Li
The new block layer APIs of zoned block devices can be tested by: $ tests/qemu-iotests/check zoned Run each zone operation on a newly created null_blk device and see whether it outputs the same zone information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests

Re: [PATCH v9 5/5] docs/zoned-storage:add zoned emulation use case

2023-03-24 Thread Sam Li
Sam Li 于2023年3月24日周五 18:54写道: > > Add the documentation about the example of using virtio-blk driver > to pass the zoned block devices through to the guest. > > Signed-off-by: Sam Li > --- > docs/devel/zoned-storage.rst | 17 + > 1 file changed, 17 inse

[PATCH v18 8/8] docs/zoned-storage: add zoned device documentation

2023-03-24 Thread Sam Li
Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev --- docs/devel/zoned-storage.rst | 43 ++ docs/system/qemu-block

Re: [PATCH v8 2/4] virtio-blk: add zoned storage emulation for zoned devices

2023-03-23 Thread Sam Li
Matias Bjørling 于2023年3月23日周四 21:39写道: > > On 23/03/2023 06.28, Sam Li wrote: > > This patch extends virtio-blk emulation to handle zoned device commands > > by calling the new block layer APIs to perform zoned device I/O on > > behalf of the guest. It supports Report Zo

Re: [PATCH v8 0/4] Add zoned storage emulation to virtio-blk driver

2023-03-23 Thread Sam Li
Matias Bjørling 于2023年3月23日周四 21:26写道: > > On 23/03/2023 06.28, Sam Li wrote: > > This patch adds zoned storage emulation to the virtio-blk driver. > > > > The patch implements the virtio-blk ZBD support standardization that is > > recently accepted by virtio-sp

[PATCH v8 1/4] include: update virtio_blk headers to v6.3-rc1

2023-03-22 Thread Sam Li
Use scripts/update-linux-headers.sh to update headers to 6.3-rc1. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Dmitry Fomichev --- include/standard-headers/drm/drm_fourcc.h| 12 +++ include/standard-headers/linux/ethtool.h | 48 - include/standard-headers

[PATCH v8 2/4] virtio-blk: add zoned storage emulation for zoned devices

2023-03-22 Thread Sam Li
be set if the host does support zoned block devices. Regular block devices(conventional zones) will not be set. The guest os can use blktests, fio to test those commands on zoned devices. Furthermore, using zonefs to test zone append write is also supported. Signed-off-by: Sam Li --- hw/block

[PATCH v8 3/4] block: add accounting for zone append operation

2023-03-22 Thread Sam Li
Taking account of the new zone append write operation for zoned devices, BLOCK_ACCT_ZONE_APPEND enum is introduced as other I/O request type (read, write, flush). Signed-off-by: Sam Li --- block/qapi-sysemu.c| 11 +++ block/qapi.c | 18 +++ hw/block/virtio

[PATCH v8 4/4] virtio-blk: add some trace events for zoned emulation

2023-03-22 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- hw/block/trace-events | 7 +++ hw/block/virtio-blk.c | 12 2 files changed, 19 insertions(+) diff --git a/hw/block/trace-events b/hw/block/trace-events index 2c45a62bd5..34be8b9135 100644 --- a/hw/block/trace-events +++ b

[PATCH v8 0/4] Add zoned storage emulation to virtio-blk driver

2023-03-22 Thread Sam Li
eak [Stefan] v2: - change units of emulated zone op coresponding to block layer APIs - modify error checking cases [Stefan, Damien] v1: - add zoned storage emulation Sam Li (4): include: update virtio_blk headers to v6.3-rc1 virtio-blk: add zoned storage emulation for zoned devices block:

[PATCH v7 2/4] block: introduce zone append write for zoned devices

2023-03-22 Thread Sam Li
the device will respond with the position where the data has been written in the zone. Signed-off-by: Sam Li Reviewed-by: Dmitry Fomichev --- block/block-backend.c | 60 +++ block/file-posix.c| 58 ++ block/io.c

<    1   2   3   4   5   >