[PATCHv3 1/2] block: move bdrv_qiov_is_aligned to file-posix

2022-09-29 Thread Keith Busch
From: Keith Busch There is only user of bdrv_qiov_is_aligned(), so move the alignment function to there and make it static. Signed-off-by: Keith Busch --- block/file-posix.c | 21 + block/io.c | 21 - include/block/block-io.h | 1 -

[PATCHv3 0/2] qemu direct io alignment fix

2022-09-29 Thread Keith Busch
From: Keith Busch Changes from v2: Split the patch so that the function move is separate from the functional change. This makes it immediately obvious what criteria is changing. (Kevin Wolf) Added received Tested-by tag in the changelog. Keith Busch (2): block: move

[PATCHv3 2/2] block: use the request length for iov alignment

2022-09-29 Thread Keith Busch
From: Keith Busch An iov length needs to be aligned to the logical block size, which may be larger than the memory alignment. Tested-by: Jens Axboe Signed-off-by: Keith Busch --- block/file-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c

Re: [PATCHv2] block: use the request length for iov alignment

2022-09-29 Thread Keith Busch
On Thu, Sep 29, 2022 at 07:59:50PM +0200, Kevin Wolf wrote: > Am 29.09.2022 um 18:09 hat Keith Busch geschrieben: > > On Fri, Sep 23, 2022 at 08:34:51AM -0700, Keith Busch wrote: > > > > > > An iov length needs to be aligned to the logical block size, which may > > > be larger than the memory

Re: [PATCH 1/2] vvfat: allow some writes to bootsector

2022-09-29 Thread Hervé Poussineau
Le 29/09/2022 à 16:10, Kevin Wolf a écrit : Am 03.09.2022 um 18:23 hat Hervé Poussineau geschrieben: 'reserved1' field in bootsector is used to mark volume dirty, or need to verify. Allow writes to bootsector which only changes the 'reserved1' field. This fixes I/O errors on Windows guests.

Re: [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error

2022-09-29 Thread Laurent Vivier
Le 22/09/2022 à 17:37, Kevin Wolf a écrit : Am 19.09.2022 um 20:27 hat Philippe Mathieu-Daudé geschrieben: Commit d1258dd0c8 ("qcow2: autoloading dirty bitmaps") added the set_readonly_helper() GFunc handler, correctly casting the gpointer user_data in both the g_slist_foreach() caller and the

Re: [PATCHv2] block: use the request length for iov alignment

2022-09-29 Thread Kevin Wolf
Am 29.09.2022 um 18:09 hat Keith Busch geschrieben: > On Fri, Sep 23, 2022 at 08:34:51AM -0700, Keith Busch wrote: > > > > An iov length needs to be aligned to the logical block size, which may > > be larger than the memory alignment. And since this is only used with > > file-posix backing

Re: [PATCH 2/2] thread-pool: use ThreadPool from the running thread

2022-09-29 Thread Kevin Wolf
Am 09.06.2022 um 15:44 hat Emanuele Giuseppe Esposito geschrieben: > Remove usage of aio_context_acquire by always submitting work items > to the current thread's ThreadPool. > > Signed-off-by: Paolo Bonzini > Signed-off-by: Emanuele Giuseppe Esposito The thread pool is used by things outside

Re: [PATCH 1/2] linux-aio: use LinuxAioState from the running thread

2022-09-29 Thread Kevin Wolf
Am 09.06.2022 um 15:44 hat Emanuele Giuseppe Esposito geschrieben: > From: Paolo Bonzini > > Remove usage of aio_context_acquire by always submitting asynchronous > AIO to the current thread's LinuxAioState. > > Signed-off-by: Paolo Bonzini > Signed-off-by: Emanuele Giuseppe Esposito > --- >

Re: [PATCHv2] block: use the request length for iov alignment

2022-09-29 Thread Keith Busch
On Fri, Sep 23, 2022 at 08:34:51AM -0700, Keith Busch wrote: > > An iov length needs to be aligned to the logical block size, which may > be larger than the memory alignment. And since this is only used with > file-posix backing storage, move the alignment function to there, where > the value of

Re: [PATCH 2/2] vvfat: allow spaces in file names

2022-09-29 Thread Kevin Wolf
Am 03.09.2022 um 18:23 hat Hervé Poussineau geschrieben: > In R/W mode, files with spaces were never created on host side. > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1176 > Fixes: c79e243ed67683d6d06692bd7040f7394da178b0 > Signed-off-by: Hervé Poussineau Reviewed-by: Kevin Wolf

Re: [PATCH 1/2] vvfat: allow some writes to bootsector

2022-09-29 Thread Kevin Wolf
Am 03.09.2022 um 18:23 hat Hervé Poussineau geschrieben: > 'reserved1' field in bootsector is used to mark volume dirty, or need to > verify. > Allow writes to bootsector which only changes the 'reserved1' field. > > This fixes I/O errors on Windows guests. > > Resolves:

[PATCH v1 32/51] monitor: expose monitor_puts to rest of code

2022-09-29 Thread Alex Bennée
This helps us construct strings elsewhere before echoing to the monitor. It avoids having to jump through hoops like: monitor_printf(mon, "%s", s->str); It will be useful in following patches but for now convert all existing plain "%s" printfs to use the _puts api. Signed-off-by: Alex Bennée

Re: [PATCH v5 2/2] block: Refactor get_tmp_filename()

2022-09-29 Thread Markus Armbruster
Bin Meng writes: > From: Bin Meng > > At present there are two callers of get_tmp_filename() and they are > inconsistent. > > One does: > > /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ > char *tmp_filename = g_malloc0(PATH_MAX + 1); > ... > ret =

Re: [PATCH v5 1/2] block: Ignore close() failure in get_tmp_filename()

2022-09-29 Thread Markus Armbruster
Bin Meng writes: > From: Bin Meng > > The temporary file has been created and is ready for use. Checking > return value of close() does not seem useful. The file descriptor > is almost certainly closed; see close(2) under "Dealing with error > returns from close()". > > Let's simply ignore

Re: [PATCH v2] pci: Assert that capabilities never overlap

2022-09-29 Thread Markus Armbruster
Akihiko Odaki writes: > On Mon, Sep 5, 2022 at 6:26 PM Markus Armbruster wrote: >> >> Akihiko Odaki writes: >> >> > On Fri, Sep 2, 2022 at 7:23 PM Markus Armbruster wrote: >> >> >> >> Akihiko Odaki writes: >> >> >> >> > pci_add_capability appears most PCI devices. Its error handling required

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

2022-09-29 Thread Sam Li
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 Zone, four zone oparations (open, close, finish, reset), and Append Zone. The VIRTIO_BLK_F_ZONED feature bit will only

[PATCH v2 0/2] Add zoned storage emulation to virtio-blk driver

2022-09-29 Thread Sam Li
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 (2): include: update virtio_blk headers from Linux 5.19-rc2+ virtio-blk: add zoned storage emulation for zoned devices

Re: Question regarding live-migration with drive-mirror

2022-09-29 Thread Fiona Ebner
Am 28.09.22 um 20:53 schrieb Dr. David Alan Gilbert: > * Fiona Ebner (f.eb...@proxmox.com) wrote: >> Hi, >> recently one of our users provided a backtrace[0] for the following >> assertion failure during a live migration that uses drive-mirror to sync >> a local disk: >>>

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

2022-09-29 Thread 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 a zoned block device using zone append, the byte offset of the write is pointing to the write pointer of that zone. Upon completion the device will respond with the

[PATCH v2 1/2] include: update virtio_blk headers from Linux 5.19-rc2+

2022-09-29 Thread Sam Li
Use scripts/update-linux-headers.sh to update virtio-blk headers from Dmitry's "virtio-blk:add support for zoned block devices" linux patch. There is a link for more information: https://github.com/dmitry-fomichev/virtblk-zbd Signed-off-by: Sam Li --- include/standard-headers/linux/virtio_blk.h

[PATCH v2 0/2] add zone append write for zoned device

2022-09-29 Thread Sam Li
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 (2): file-posix: add the tracking of the zones wp

[PATCH v2 1/2] file-posix: add the tracking of the zones wp

2022-09-29 Thread Sam Li
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 emulation using regular writes. To do this, the file-posix driver tracks the wp location of all zones of the device. It uses an array of

Re: [PATCH v2] pci: Assert that capabilities never overlap

2022-09-29 Thread Akihiko Odaki
On Mon, Sep 5, 2022 at 7:11 PM Akihiko Odaki wrote: > > On Mon, Sep 5, 2022 at 6:26 PM Markus Armbruster wrote: > > > > Akihiko Odaki writes: > > > > > On Fri, Sep 2, 2022 at 7:23 PM Markus Armbruster > > > wrote: > > >> > > >> Akihiko Odaki writes: > > >> > > >> > pci_add_capability appears

[PATCH v10 6/7] qemu-iotests: test new zone operations

2022-09-29 Thread Sam Li
We have added new block layer APIs of zoned block devices. Test it with: Create a null_blk device, run each zone operation on it and see whether reporting right zone information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned.out | 53 ++

[PATCH v10 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-09-29 Thread Sam Li
Add a new zoned_host_device BlockDriver. The zoned_host_device option accepts only zoned host block devices. By adding zone management operations in this new BlockDriver, users can use the new block layer APIs including Report Zone and four zone management operations (open, close, finish, reset).

[PATCH v10 2/7] file-posix: introduce helper functions for sysfs attributes

2022-09-29 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 v10 1/7] include: add zoned device structs

2022-09-29 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal --- include/block/block-common.h | 43 1 file changed, 43 insertions(+) diff --git a/include/block/block-common.h b/include/block/block-common.h index fdb7306e78..36bd0e480e

[PATCH v10 7/7] docs/zoned-storage: add zoned device documentation

2022-09-29 Thread Sam Li
Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- docs/devel/zoned-storage.rst | 40 ++ docs/system/qemu-block-drivers.rst.inc | 6 2 files changed, 46 insertions(+)

[PATCH v10 5/7] config: add check to block layer

2022-09-29 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 --- block.c | 17 + block/file-posix.c | 13 + block/raw-format.c | 1 +

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

2022-09-29 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 --- block/raw-format.c | 13 + 1 file changed, 13 insertions(+) diff --git

[PATCH v10 0/7] Add support for zoned device

2022-09-29 Thread Sam Li
Zoned Block Devices (ZBDs) devide the LBA space to block regions called zones that are larger than the LBA size. It can only allow sequential writes, which reduces write amplification in SSD, leading to higher throughput and increased capacity. More details about ZBDs can be found at:

Re: [PATCH v8 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-09-29 Thread Markus Armbruster
Damien Le Moal writes: > On 9/1/22 23:57, Markus Armbruster wrote: >> Sam Li writes: >> >>> Markus Armbruster 于2022年8月31日周三 16:35写道: Sam Li writes: > Markus Armbruster 于2022年8月30日周二 19:57写道: [...] > Zoned_host_device is basically host_device + zone operations. It