Block layer patches
Subsystems (2)
The following changes since commit 028f2361d0c2d28d6f918fe618f389228ac22b60:
Merge tag 'pull-target-arm-20220609' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-06-09 06:47:03 -0700)
are available in the Git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 7f9a8b3342ff00d3398fdc08264948762d748edb:
nbd: Drop dead code spotted by Coverity (2022-06-09 18:07:17 +0200)
----------------------------------------------------------------
Block layer patches
- Add vduse-blk export
- Dirty bitmaps: Fix and improve bitmap merge
- gluster: correctly set max_pdiscard
- rbd: report a better error when namespace does not exist
- aio_wait_kick: add missing memory barrier
- Code cleanups
----------------------------------------------------------------
Emanuele Giuseppe Esposito (1):
aio_wait_kick: add missing memory barrier
Eric Blake (1):
nbd: Drop dead code spotted by Coverity
Fabian Ebner (1):
block/gluster: correctly set max_pdiscard
Stefan Hajnoczi (3):
block: drop unused bdrv_co_drain() API
block: get rid of blk->guest_block_size
qsd: document vduse-blk exports
Stefano Garzarella (1):
block/rbd: report a better error when namespace does not exist
Vladimir Sementsov-Ogievskiy (3):
block: block_dirty_bitmap_merge(): fix error path
block: improve block_dirty_bitmap_merge(): don't allocate extra bitmap
block: simplify handling of try to merge different sized bitmaps
Xie Yongji (8):
block: Support passing NULL ops to blk_set_dev_ops() block/export: Fix incorrect length passed to vu_queue_push() block/export: Abstract out the logic of virtio-blk I/O process
linux-headers: Add vduse.h
libvduse: Add VDUSE (vDPA Device in Userspace) library
vduse-blk: Implement vduse-blk export
vduse-blk: Add vduse-blk resize support
libvduse: Add support for reconnecting
qapi/block-export.json | 28 +- docs/tools/qemu-storage-daemon.rst | 21 + meson_options.txt | 4 + block/export/vduse-blk.h | 20 + block/export/virtio-blk-handler.h | 37 + include/block/aio-wait.h | 2 + include/block/block-io.h | 1 - include/block/block_int-io.h | 2 +- include/qemu/hbitmap.h | 15 +- include/sysemu/block-backend-io.h | 1 - linux-headers/linux/vduse.h | 306 ++++++ subprojects/libvduse/include/atomic.h | 1 + subprojects/libvduse/include/compiler.h | 1 + subprojects/libvduse/libvduse.h | 247 +++++ block/backup.c | 6 +- block/block-backend.c | 12 +- block/dirty-bitmap.c | 26 +- block/export/export.c | 6 + block/export/vduse-blk.c | 341 +++++++ block/export/vhost-user-blk-server.c | 261 +---- block/export/virtio-blk-handler.c | 240 +++++ block/gluster.c | 2 +- block/io.c | 15 - block/monitor/bitmap-qmp-cmds.c | 40 +- block/nbd.c | 8 +- block/rbd.c | 24 + hw/block/virtio-blk.c | 1 - hw/block/xen-block.c | 1 - hw/ide/core.c | 1 - hw/scsi/scsi-disk.c | 1 - hw/scsi/scsi-generic.c | 1 - storage-daemon/qemu-storage-daemon.c | 9 + subprojects/libvduse/libvduse.c | 1392 +++++++++++++++++++++++++++ util/aio-wait.c | 16 +- util/hbitmap.c | 25 +- MAINTAINERS | 9 + block/export/meson.build | 7 +- meson.build | 34 + scripts/meson-buildoptions.sh | 7 + scripts/update-linux-headers.sh | 2 +- subprojects/libvduse/linux-headers/linux | 1 + subprojects/libvduse/meson.build | 10 + subprojects/libvduse/standard-headers/linux | 1 + 43 files changed, 2830 insertions(+), 355 deletions(-) create mode 100644 block/export/vduse-blk.h create mode 100644 block/export/virtio-blk-handler.h create mode 100644 linux-headers/linux/vduse.h create mode 120000 subprojects/libvduse/include/atomic.h create mode 120000 subprojects/libvduse/include/compiler.h create mode 100644 subprojects/libvduse/libvduse.h create mode 100644 block/export/vduse-blk.c create mode 100644 block/export/virtio-blk-handler.c create mode 100644 subprojects/libvduse/libvduse.c create mode 120000 subprojects/libvduse/linux-headers/linux create mode 100644 subprojects/libvduse/meson.build create mode 120000 subprojects/libvduse/standard-headers/linux
[PULL 09/18] linux-headers: Add vduse.h
From: Xie Yongji <[email protected]>
This adds vduse header to linux headers so that the relevant VDUSE API can be used in subsequent patches.
Message-Id: <[email protected]>
--- linux-headers/linux/vduse.h | 306 ++++++++++++++++++++++++++++++++ scripts/update-linux-headers.sh | 2 +- 2 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 linux-headers/linux/vduse.h
linux-headers/linux/vduse.h new file +306 -0
@@ -0,0 +1,306 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _VDUSE_H_ +#define _VDUSE_H_ + +#include <linux/types.h> + +#define VDUSE_BASE 0x81 + +/* The ioctls for control device (/dev/vduse/control) */ + +#define VDUSE_API_VERSION 0 + +/* +* Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION). +* This is used for future extension. +*/ +#define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64) + +/* Set the version of VDUSE API that userspace supported. */ +#define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64) + +/** +* struct vduse_dev_config - basic configuration of a VDUSE device +* @name: VDUSE device name, needs to be NUL terminated +* @vendor_id: virtio vendor id +* @device_id: virtio device id +* @features: virtio features +* @vq_num: the number of virtqueues +* @vq_align: the allocation alignment of virtqueue's metadata +* @reserved: for future use, needs to be initialized to zero +* @config_size: the size of the configuration space +* @config: the buffer of the configuration space +* +* Structure used by VDUSE_CREATE_DEV ioctl to create VDUSE device. +*/ +struct vduse_dev_config { +#define VDUSE_NAME_MAX 256 +char name[VDUSE_NAME_MAX ]; +__u32 vendor_id; +__u32 device_id; +__u64 features; +__u32 vq_num; +__u32 vq_align; +__u32 reserved[13 ]; +__u32 config_size; +__u8 config[]; +}; + +/* Create a VDUSE device which is represented by a char device (/dev/vduse/$NAME) */ +#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config) + +/* +* Destroy a VDUSE device. Make sure there are no more references +* to the char device (/dev/vduse/$NAME). +*/ +#define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX]) + +/* The ioctls for VDUSE device (/dev/vduse/$NAME) */ + +/** +* struct vduse_iotlb_entry - entry of IOTLB to describe one IOVA region [start, last] +* @offset: the mmap offset on returned file descriptor +* @start: start of the IOVA region +* @last: last of the IOVA region +* @perm: access permission of the IOVA region +* +* Structure used by VDUSE_IOTLB_GET_FD ioctl to find an overlapped IOVA region. +*/ +struct vduse_iotlb_entry { +__u64 offset; +__u64 start; +__u64 last; +#define VDUSE_ACCESS_RO 0x1 +#define VDUSE_ACCESS_WO 0x2 +#define VDUSE_ACCESS_RW 0x3 +__u8 perm; +}; + +/* +* Find the first IOVA region that overlaps with the range [start, last] +* and return the corresponding file descriptor. Return -EINVAL means the +* IOVA region doesn't exist. Caller should set start and last fields. +*/ +#define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry) + +/* +* Get the negotiated virtio features. It's a subset of the features in +* struct vduse_dev_config which can be accepted by virtio driver. It's +* only valid after FEATURES_OK status bit is set. +*/ +#define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64) + +/** +* struct vduse_config_data - data used to update configuration space +* @offset: the offset from the beginning of configuration space +* @length: the length to write to configuration space +* @buffer: the buffer used to write from +* +* Structure used by VDUSE_DEV_SET_CONFIG ioctl to update device +* configuration space. +*/ +struct vduse_config_data { +__u32 offset; +__u32 length; +__u8 buffer[]; +}; + +/* Set device configuration space */ +#define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data) + +/* +* Inject a config interrupt. It's usually used to notify virtio driver +* that device configuration space has changed. +*/ +#define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13) + +/** +* struct vduse_vq_config - basic configuration of a virtqueue +* @index: virtqueue index +* @max_size: the max size of virtqueue +* @reserved: for future use, needs to be initialized to zero +* +* Structure used by VDUSE_VQ_SETUP ioctl to setup a virtqueue. +*/ +struct vduse_vq_config { +__u32 index; +__u16 max_size; +__u16 reserved[13 ]; +}; + +/* +* Setup the specified virtqueue. Make sure all virtqueues have been +* configured before the device is attached to vDPA bus. +*/ +#define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config) + +/** +* struct vduse_vq_state_split - split virtqueue state +* @avail_index: available index +*/ +struct vduse_vq_state_split { +__u16 avail_index; +}; + +/** +* struct vduse_vq_state_packed - packed virtqueue state +* @last_avail_counter: last driver ring wrap counter observed by device +* @last_avail_idx: device available index +* @last_used_counter: device ring wrap counter +* @last_used_idx: used index +*/ +struct vduse_vq_state_packed { +__u16 last_avail_counter; +__u16 last_avail_idx; +__u16 last_used_counter; +__u16 last_used_idx; +}; + +/** +* struct vduse_vq_info - information of a virtqueue +* @index: virtqueue index +* @num: the size of virtqueue +* @desc_addr: address of desc area +* @driver_addr: address of driver area +* @device_addr: address of device area +* @split: split virtqueue state +* @packed: packed virtqueue state +* @ready: ready status of virtqueue +* +* Structure used by VDUSE_VQ_GET_INFO ioctl to get virtqueue's information. +*/ +struct vduse_vq_info { +__u32 index; +__u32 num; +__u64 desc_addr; +__u64 driver_addr; +__u64 device_addr; +union { +struct vduse_vq_state_split split; +struct vduse_vq_state_packed packed; + }; +__u8 ready; +}; + +/* Get the specified virtqueue's information. Caller should set index field. */ +#define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info) + +/** +* struct vduse_vq_eventfd - eventfd configuration for a virtqueue +* @index: virtqueue index +* @fd: eventfd, -1 means de-assigning the eventfd +* +* Structure used by VDUSE_VQ_SETUP_KICKFD ioctl to setup kick eventfd. +*/ +struct vduse_vq_eventfd { +__u32 index; +#define VDUSE_EVENTFD_DEASSIGN -1 +int fd; +}; + +/* +* Setup kick eventfd for specified virtqueue. The kick eventfd is used +* by VDUSE kernel module to notify userspace to consume the avail vring. +*/ +#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd) + +/* +* Inject an interrupt for specific virtqueue. It's used to notify virtio driver +* to consume the used vring. +*/ +#define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32) + +/* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */ + +/** +* enum vduse_req_type - request type +* @VDUSE_GET_VQ_STATE: get the state for specified virtqueue from userspace +* @VDUSE_SET_STATUS: set the device status +* @VDUSE_UPDATE_IOTLB: Notify userspace to update the memory mapping for +* specified IOVA range via VDUSE_IOTLB_GET_FD ioctl +*/ +enum vduse_req_type { +VDUSE_GET_VQ_STATE , +VDUSE_SET_STATUS , +VDUSE_UPDATE_IOTLB , +}; + +/** +* struct vduse_vq_state - virtqueue state +* @index: virtqueue index +* @split: split virtqueue state +* @packed: packed virtqueue state +*/ +struct vduse_vq_state { +__u32 index; +union { +struct vduse_vq_state_split split; +struct vduse_vq_state_packed packed; + }; +}; + +/** +* struct vduse_dev_status - device status +* @status: device status +*/ +struct vduse_dev_status { +__u8 status; +}; + +/** +* struct vduse_iova_range - IOVA range [start, last] +* @start: start of the IOVA range +* @last: last of the IOVA range +*/ +struct vduse_iova_range { +__u64 start; +__u64 last; +}; + +/** +* struct vduse_dev_request - control request +* @type: request type +* @request_id: request id +* @reserved: for future use +* @vq_state: virtqueue state, only index field is available +* @s: device status +* @iova: IOVA range for updating +* @padding: padding +* +* Structure used by read(2) on /dev/vduse/$NAME. +*/ +struct vduse_dev_request { +__u32 type; +__u32 request_id; +__u32 reserved[4 ]; +union { +struct vduse_vq_state vq_state; +struct vduse_dev_status s; +struct vduse_iova_range iova; +__u32 padding[32 ]; + }; +}; + +/** +* struct vduse_dev_response - response to control request +* @request_id: corresponding request id +* @result: the result of request +* @reserved: for future use, needs to be initialized to zero +* @vq_state: virtqueue state +* @padding: padding +* +* Structure used by write(2) on /dev/vduse/$NAME. +*/ +struct vduse_dev_response { +__u32 request_id; +#define VDUSE_REQ_RESULT_OK 0x00 +#define VDUSE_REQ_RESULT_FAILED 0x01 +__u32 result; +__u32 reserved[4 ]; +union { +struct vduse_vq_state vq_state; +__u32 padding[32 ]; + }; +}; + +#endif /* _VDUSE_H_ */
scripts/update-linux-headers.sh +1 -1
@@ -161,7 +161,7 @@ done rm -rf "$output/linux-headers/linux" mkdir -p "$output/linux-headers/linux" for header in kvm.h vfio.h vfio_ccw.h vfio_zdev.h vhost.h \ - psci.h psp-sev.h userfaultfd.h mman.h; do + psci.h psp-sev.h userfaultfd.h mman.h vduse.h; do cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux" done
Signature · 1 line
2.35.3
[PULL 14/18] qsd: document vduse-blk exports
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Document vduse-blk exports in qemu-storage-daemon --help and the qemu-storage-daemon(1) man page.
Based-on: <[email protected]>
Message-Id: <[email protected]>
--- docs/tools/qemu-storage-daemon.rst | 21 +++++++++++++++++++++ storage-daemon/qemu-storage-daemon.c | 9 +++++++++ 2 files changed, 30 insertions(+)
docs/tools/qemu-storage-daemon.rst +21 -0
@@ -77,6 +77,7 @@ Standard options: --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,addr.type=unix,addr.path=<socket-path>[,writable=on|off][,logical-block-size=<block-size>][,num-queues=<num-queues>] --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,addr.type=fd,addr.str=<fd>[,writable=on|off][,logical-block-size=<block-size>][,num-queues=<num-queues>] --export [type=]fuse,id=<id>,node-name=<node-name>,mountpoint=<file>[,growable=on|off][,writable=on|off][,allow-other=on|off|auto] + --export [type=]vduse-blk,id=<id>,node-name=<node-name>[,writable=on|off][,num-queues=<num-queues>][,queue-size=<queue-size>][,logical-block-size=<block-size>] is a block export definition. ``node-name`` is the block node that should be exported. ``writable`` determines whether or not the export allows write
@@ -110,6 +111,26 @@ Standard options: ``allow-other`` to auto (the default) will try enabling this option, and on error fall back to disabling it. + The ``vduse-blk`` export type uses the ``id`` as the VDUSE device name. + ``num-queues`` sets the number of virtqueues (the default is 1). + ``queue-size`` sets the virtqueue descriptor table size (the default is 256). + + The instantiated VDUSE device must then be added to the vDPA bus using the + vdpa(8) command from the iproute2 project:: + + # vdpa dev add name <id> mgmtdev vduse + + The device can be removed from the vDPA bus later as follows:: + + # vdpa dev del <id> + + For more information about attaching vDPA devices to the host with + virtio_vdpa.ko or attaching them to guests with vhost_vdpa.ko, see + https://vdpa-dev.gitlab.io/. + + For more information about VDUSE, see + https://docs.kernel.org/userspace-api/vduse.html. + .. option:: --monitor MONITORDEF is a QMP monitor definition. See the :manpage:`qemu(1)` manual page for
storage-daemon/qemu-storage-daemon.c +9 -0
@@ -121,6 +121,15 @@ static void help(void)" vhost-user-blk device over file descriptor\n" "\n"#endif /* CONFIG_VHOST_USER_BLK_SERVER */ +#ifdef CONFIG_VDUSE_BLK_EXPORT +" --export [type=]vduse-blk,id=<id>,node-name=<node-name>\n" +" [,writable=on|off][,num-queues=<num-queues>]\n" +" [,queue-size=<queue-size>]\n" +" [,logical-block-size=<logical-block-size>]\n" +" export the specified block node as a vduse-blk\n" +" device using the id as the VDUSE device name\n" +"\n" +#endif /* CONFIG_VDUSE_BLK_EXPORT */ " --monitor [chardev=]name[,mode=control][,pretty[=on|off]]\n" " configure a QMP monitor\n" "\n"
Signature · 1 line
2.35.3
[PULL 15/18] block/rbd: report a better error when namespace does not exist
In reply to Kevin WolfFrom: Stefano Garzarella <[email protected]>
If the namespace does not exist, rbd_create() fails with -ENOENT and QEMU reports a generic "error rbd create: No such file or directory":
$ qemu-img create rbd:rbd/namespace/image 1M
Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
qemu-img: rbd:rbd/namespace/image: error rbd create: No such file or directoryUnfortunately rados_ioctx_set_namespace() does not fail if the namespace does not exist, so let's use rbd_namespace_exists() in qemu_rbd_connect() to check if the namespace exists, reporting a more understandable error:
$ qemu-img create rbd:rbd/namespace/image 1M
Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
qemu-img: rbd:rbd/namespace/image: namespace 'namespace' does not existMessage-Id: <[email protected]>
--- block/rbd.c | 24 ++++++++++++++++++++++++ meson.build | 6 ++++++ 2 files changed, 30 insertions(+)
block/rbd.c +24 -0
@@ -831,6 +831,26 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,error_setg_errno (errp, -r,"error opening pool %s" , opts->pool); goto failed_shutdown; } + +#ifdef HAVE_RBD_NAMESPACE_EXISTS +if (opts->has_q_namespace &&strlen (opts->q_namespace) >0 ) { +bool exists; + + r =rbd_namespace_exists (*io_ctx, opts->q_namespace, &exists); +if (r <0 ) { +error_setg_errno (errp, -r,"error checking namespace" ); + goto failed_ioctx_destroy; + } + +if (!exists) { +error_setg (errp,"namespace '%s' does not exist" , + opts->q_namespace); + r = -ENOENT ; + goto failed_ioctx_destroy; + } + } +#endif +/* * Set the namespace after opening the io context on the pool, * if nspace == NULL or if nspace == "", it is just as we did nothing
@@ -840,6 +860,10 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx, r =0 ; goto out; +#ifdef HAVE_RBD_NAMESPACE_EXISTS +failed_ioctx_destroy: +rados_ioctx_destroy (*io_ctx); +#endif failed_shutdown:rados_shutdown (*cluster); out:
meson.build +6 -0
@@ -1894,6 +1894,12 @@ config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs')) config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util)) config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul')) config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>')) +if rbd.found() + config_host_data.set('HAVE_RBD_NAMESPACE_EXISTS', + cc.has_function('rbd_namespace_exists', + dependencies: rbd, + prefix: '#include <rbd/librbd.h>')) +endif if rdma.found() config_host_data.set('HAVE_IBV_ADVISE_MR', cc.has_function('ibv_advise_mr',
Signature · 1 line
2.35.3
[PULL 08/18] block/export: Abstract out the logic of virtio-blk I/O process
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
Abstract the common logic of virtio-blk I/O process to a function named virtio_blk_process_req(). It's needed for the following commit.
Message-Id: <[email protected]>
--- block/export/virtio-blk-handler.h | 37 ++++ block/export/vhost-user-blk-server.c | 259 +++------------------------ block/export/virtio-blk-handler.c | 240 +++++++++++++++++++++++++ MAINTAINERS | 2 + block/export/meson.build | 2 +- 5 files changed, 301 insertions(+), 239 deletions(-) create mode 100644 block/export/virtio-blk-handler.h create mode 100644 block/export/virtio-blk-handler.c
block/export/virtio-blk-handler.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Handler for virtio-blk I/O +* +* Copyright (C) 2022 Bytedance Inc. and/or its affiliates. All rights reserved. +* +* Author: +* Xie Yongji <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or +* later. See the COPYING file in the top-level directory. +*/ + +#ifndef VIRTIO_BLK_HANDLER_H +#define VIRTIO_BLK_HANDLER_H + +#include "sysemu/block-backend.h" + +#define VIRTIO_BLK_SECTOR_BITS 9 +#define VIRTIO_BLK_SECTOR_SIZE (1ULL << VIRTIO_BLK_SECTOR_BITS) + +#define VIRTIO_BLK_MAX_DISCARD_SECTORS 32768 +#define VIRTIO_BLK_MAX_WRITE_ZEROES_SECTORS 32768 + +typedef struct { +BlockBackend *blk; +const char *serial; +uint32_t logical_block_size; +bool writable; +}VirtioBlkHandler ; + +int coroutine_fn virtio_blk_process_req(VirtioBlkHandler *handler, +struct iovec *in_iov, +struct iovec *out_iov, +unsigned int in_num, +unsigned int out_num); + +#endif /* VIRTIO_BLK_HANDLER_H */
block/export/vhost-user-blk-server.c +21 -238
338 lines not on this page · raw message
block/export/virtio-blk-handler.c new file +240 -0
240 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -3568,6 +3568,8 @@ M: Coiby Xu <[email protected]> S: Maintained F: block/export/vhost-user-blk-server.c F: block/export/vhost-user-blk-server.h +F: block/export/virtio-blk-handler.c +F: block/export/virtio-blk-handler.h F: include/qemu/vhost-user-server.h F: tests/qtest/libqos/vhost-user-blk.c F: tests/qtest/libqos/vhost-user-blk.h
block/export/meson.build +1 -1
@@ -1,7 +1,7 @@ blockdev_ss.add(files('export.c')) if have_vhost_user_blk_server - blockdev_ss.add(files('vhost-user-blk-server.c')) + blockdev_ss.add(files('vhost-user-blk-server.c', 'virtio-blk-handler.c')) endif blockdev_ss.add(when: fuse, if_true: files('fuse.c'))
Signature · 1 line
2.35.3
[PULL 18/18] nbd: Drop dead code spotted by Coverity
In reply to Kevin WolfFrom: Eric Blake <[email protected]>
CID 1488362 points out that the second 'rc >= 0' check is now dead code.
Message-Id: <[email protected]>
--- block/nbd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
block/nbd.c +2 -6
@@ -521,12 +521,8 @@ static int coroutine_fn nbd_co_send_request(BlockDriverState *bs,if (qiov) {qio_channel_set_cork (s->ioc, true); rc =nbd_send_request (s->ioc, request); -if (rc >=0 ) { -if (qio_channel_writev_all (s->ioc, qiov->iov, qiov->niov, -NULL ) <0 ) { - rc = -EIO ; - } - }else if (rc >=0 ) { +if (rc >=0 &&qio_channel_writev_all (s->ioc, qiov->iov, qiov->niov, +NULL ) <0 ) { rc = -EIO ; }qio_channel_set_cork (s->ioc, false);
Signature · 1 line
2.35.3
[PULL 03/18] block: block_dirty_bitmap_merge(): fix error path
In reply to Kevin WolfFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
At the end we ignore failure of bdrv_merge_dirty_bitmap() and report success. And still set errp. That's wrong.
Message-Id: <[email protected]>
--- block/monitor/bitmap-qmp-cmds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
block/monitor/bitmap-qmp-cmds.c +4 -1
@@ -309,7 +309,10 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target, }/* Merge into dst; dst is unchanged on failure. */ -bdrv_merge_dirty_bitmap (dst, anon, backup, errp); +if (!bdrv_merge_dirty_bitmap (dst, anon, backup, errp)) { + dst =NULL ; + goto out; + } out:bdrv_release_dirty_bitmap (anon);
Signature · 1 line
2.35.3
[PULL 17/18] aio_wait_kick: add missing memory barrier
In reply to Kevin WolfFrom: Emanuele Giuseppe Esposito <[email protected]>
It seems that aio_wait_kick always required a memory barrier or atomic operation in the caller, but nobody actually took care of doing it.
Let's put the barrier in the function instead, and pair it with another one in AIO_WAIT_WHILE. Read aio_wait_kick() comment for further explanation.
Message-Id: <[email protected]>
--- include/block/aio-wait.h | 2 ++ util/aio-wait.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
include/block/aio-wait.h +2 -0
@@ -81,6 +81,8 @@ extern AioWait global_aio_wait;AioContext *ctx_ = (ctx); \/* Increment wait_->num_waiters before evaluating cond. */ \qatomic_inc (&wait_->num_waiters); \ +/* Paired with smp_mb in aio_wait_kick(). */ \ +smp_mb (); \if (ctx_ &&in_aio_context_home_thread (ctx_)) { \while ((cond)) { \aio_poll (ctx_, true); \
util/aio-wait.c +15 -1
@@ -35,7 +35,21 @@ static void dummy_bh_cb(void *opaque)void aio_wait_kick (void ) { -/* The barrier (or an atomic op) is in the caller. */ +/* +* Paired with smp_mb in AIO_WAIT_WHILE. Here we have: +* write(condition); +* aio_wait_kick() { +* smp_mb(); +* read(num_waiters); +* } +* +* And in AIO_WAIT_WHILE: +* write(num_waiters); +* smp_mb(); +* read(condition); +*/ +smp_mb (); +if (qatomic_read (&global_aio_wait.num_waiters)) {aio_bh_schedule_oneshot (qemu_get_aio_context (), dummy_bh_cb,NULL ); }
Signature · 1 line
2.35.3
[PULL 11/18] vduse-blk: Implement vduse-blk export
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
This implements a VDUSE block backends based on the libvduse library. We can use it to export the BDSs for both VM and container (host) usage.
The new command-line syntax is:
$ qemu-storage-daemon \
--blockdev file,node-name=drive0,filename=test.img \
--export vduse-blk,node-name=drive0,id=vduse-export0,writable=onAfter the qemu-storage-daemon started, we need to use the "vdpa" command to attach the device to vDPA bus:
$ vdpa dev add name vduse-export0 mgmtdev vduse
Also the device must be removed via the "vdpa" command before we stop the qemu-storage-daemon.
Message-Id: <[email protected]>
--- qapi/block-export.json | 28 +++- meson_options.txt | 2 + block/export/vduse-blk.h | 20 +++ block/export/export.c | 6 + block/export/vduse-blk.c | 307 ++++++++++++++++++++++++++++++++++ MAINTAINERS | 4 +- block/export/meson.build | 5 + meson.build | 13 ++ scripts/meson-buildoptions.sh | 4 + 9 files changed, 385 insertions(+), 4 deletions(-) create mode 100644 block/export/vduse-blk.h create mode 100644 block/export/vduse-blk.c
qapi/block-export.json +25 -3
@@ -177,6 +177,23 @@ '*allow-other': 'FuseExportAllowOther' }, 'if': 'CONFIG_FUSE' } +## +# @BlockExportOptionsVduseBlk: +# +# A vduse-blk block export. +# +# @num-queues: the number of virtqueues. Defaults to 1. +# @queue-size: the size of virtqueue. Defaults to 256. +# @logical-block-size: Logical block size in bytes. Range [512, PAGE_SIZE] +# and must be power of 2. Defaults to 512 bytes. +# +# Since: 7.1 +## +{ 'struct': 'BlockExportOptionsVduseBlk', + 'data': { '*num-queues': 'uint16', + '*queue-size': 'uint16', + '*logical-block-size': 'size'} } + ## # @NbdServerAddOptions: #
@@ -280,6 +297,7 @@ # @nbd: NBD export # @vhost-user-blk: vhost-user-blk export (since 5.2) # @fuse: FUSE export (since: 6.0) +# @vduse-blk: vduse-blk export (since 7.1) # # Since: 4.2 ##
@@ -287,7 +305,8 @@ 'data': [ 'nbd', { 'name': 'vhost-user-blk', 'if': 'CONFIG_VHOST_USER_BLK_SERVER' }, - { 'name': 'fuse', 'if': 'CONFIG_FUSE' } ] } + { 'name': 'fuse', 'if': 'CONFIG_FUSE' }, + { 'name': 'vduse-blk', 'if': 'CONFIG_VDUSE_BLK_EXPORT' } ] } ## # @BlockExportOptions:
@@ -295,7 +314,8 @@ # Describes a block export, i.e. how single node should be exported on an # external interface. # -# @id: A unique identifier for the block export (across all export types) +# @id: A unique identifier for the block export (across the host for vduse-blk +# export type or across all export types for other types) # # @node-name: The node name of the block node to be exported (since: 5.2) #
@@ -331,7 +351,9 @@ 'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk', 'if': 'CONFIG_VHOST_USER_BLK_SERVER' }, 'fuse': { 'type': 'BlockExportOptionsFuse', - 'if': 'CONFIG_FUSE' } + 'if': 'CONFIG_FUSE' }, + 'vduse-blk': { 'type': 'BlockExportOptionsVduseBlk', + 'if': 'CONFIG_VDUSE_BLK_EXPORT' } } } ##
meson_options.txt +2 -0
@@ -255,6 +255,8 @@ option('virtiofsd', type: 'feature', value: 'auto', description: 'build virtiofs daemon (virtiofsd)') option('libvduse', type: 'feature', value: 'auto', description: 'build VDUSE Library') +option('vduse_blk_export', type: 'feature', value: 'auto', + description: 'VDUSE block export support') option('capstone', type: 'feature', value: 'auto', description: 'Whether and how to find the capstone library')
block/export/vduse-blk.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Export QEMU block device via VDUSE +* +* Copyright (C) 2022 Bytedance Inc. and/or its affiliates. All rights reserved. +* +* Author: +* Xie Yongji <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or +* later. See the COPYING file in the top-level directory. +*/ + +#ifndef VDUSE_BLK_H +#define VDUSE_BLK_H + +#include "block/export.h" + +extern const BlockExportDriver blk_exp_vduse_blk; + +#endif /* VDUSE_BLK_H */
block/export/export.c +6 -0
@@ -26,6 +26,9 @@#ifdef CONFIG_VHOST_USER_BLK_SERVER #include "vhost-user-blk-server.h" #endif +#ifdef CONFIG_VDUSE_BLK_EXPORT +#include "vduse-blk.h" +#endif static const BlockExportDriver *blk_exp_drivers[] = { &blk_exp_nbd,
@@ -35,6 +38,9 @@ static const BlockExportDriver *blk_exp_drivers[] = {#ifdef CONFIG_FUSE &blk_exp_fuse,#endif +#ifdef CONFIG_VDUSE_BLK_EXPORT + &blk_exp_vduse_blk, +#endif };/* Only accessed from the main thread */
block/export/vduse-blk.c new file +307 -0
307 lines not on this page · raw message
MAINTAINERS +3 -1
@@ -3582,10 +3582,12 @@ L: [email protected] S: Supported F: block/export/fuse.c -VDUSE library +VDUSE library and block device exports M: Xie Yongji <[email protected]> S: Maintained F: subprojects/libvduse/ +F: block/export/vduse-blk.c +F: block/export/vduse-blk.h Replication M: Wen Congyang <[email protected]>
block/export/meson.build +5 -0
@@ -5,3 +5,8 @@ if have_vhost_user_blk_server endif blockdev_ss.add(when: fuse, if_true: files('fuse.c')) + +if have_vduse_blk_export + blockdev_ss.add(files('vduse-blk.c', 'virtio-blk-handler.c')) + blockdev_ss.add(libvduse) +endif
meson.build +13 -0
@@ -1542,6 +1542,17 @@ if have_libvduse libvduse = libvduse_proj.get_variable('libvduse_dep') endif +have_vduse_blk_export = (have_libvduse and targetos == 'linux') +if get_option('vduse_blk_export').enabled() + if targetos != 'linux' + error('vduse_blk_export requires linux') + elif not have_libvduse + error('vduse_blk_export requires libvduse support') + endif +elif get_option('vduse_blk_export').disabled() + have_vduse_blk_export = false +endif + # libbpf libbpf = dependency('libbpf', required: get_option('bpf'), method: 'pkg-config') if libbpf.found() and not cc.links('''
@@ -1783,6 +1794,7 @@ config_host_data.set('CONFIG_VHOST_CRYPTO', have_vhost_user_crypto) config_host_data.set('CONFIG_VHOST_VDPA', have_vhost_vdpa) config_host_data.set('CONFIG_VMNET', vmnet.found()) config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server) +config_host_data.set('CONFIG_VDUSE_BLK_EXPORT', have_vduse_blk_export) config_host_data.set('CONFIG_PNG', png.found()) config_host_data.set('CONFIG_VNC', vnc.found()) config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
@@ -3822,6 +3834,7 @@ if have_block summary_info += {'qed support': get_option('qed').allowed()} summary_info += {'parallels support': get_option('parallels').allowed()} summary_info += {'FUSE exports': fuse} + summary_info += {'VDUSE block exports': have_vduse_blk_export} endif summary(summary_info, bool_yn: true, section: 'Block layer support')
scripts/meson-buildoptions.sh +4 -0
@@ -159,6 +159,8 @@ meson_options_help() { printf "%s\n" ' vhost-user vhost-user backend support' printf "%s\n" ' vhost-user-blk-server' printf "%s\n" ' build vhost-user-blk server' + printf "%s\n" ' vduse-blk-export' + printf "%s\n" ' VDUSE block export support' printf "%s\n" ' vhost-vdpa vhost-vdpa kernel backend support' printf "%s\n" ' virglrenderer virgl rendering support' printf "%s\n" ' virtfs virtio-9p support'
@@ -425,6 +427,8 @@ _meson_option_parse() { --disable-vhost-user) printf "%s" -Dvhost_user=disabled ;; --enable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=enabled ;; --disable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=disabled ;; + --enable-vduse-blk-export) printf "%s" -Dvduse_blk_export=enabled ;; + --disable-vduse-blk-export) printf "%s" -Dvduse_blk_export=disabled ;; --enable-vhost-vdpa) printf "%s" -Dvhost_vdpa=enabled ;; --disable-vhost-vdpa) printf "%s" -Dvhost_vdpa=disabled ;; --enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;;
Signature · 1 line
2.35.3
[PULL 06/18] block: Support passing NULL ops to blk_set_dev_ops()
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
This supports passing NULL ops to blk_set_dev_ops() so that we can remove stale ops in some cases.
Message-Id: <[email protected]>
--- block/block-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/block-backend.c +1 -1
@@ -1058,7 +1058,7 @@ void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, blk->dev_opaque = opaque;/* Are we currently quiesced? Should we enforce this right now? */ -if (blk->quiesce_counter && ops->drained_begin) { +if (blk->quiesce_counter && ops && ops->drained_begin) { ops->drained_begin (opaque); } }
Signature · 1 line
2.35.3
[PULL 12/18] vduse-blk: Add vduse-blk resize support
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
To support block resize, this uses vduse_dev_update_config() to update the capacity field in configuration space and inject config interrupt on the block resize callback.
Message-Id: <[email protected]>
--- block/export/vduse-blk.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
block/export/vduse-blk.c +20 -0
@@ -184,6 +184,23 @@ static void blk_aio_detach(void *opaque) vblk_exp->export.ctx =NULL ; } +static void vduse_blk_resize (void *opaque) +{ +BlockExport *exp = opaque; +VduseBlkExport *vblk_exp =container_of (exp, VduseBlkExport, export); +struct virtio_blk_config config; + + config.capacity = +cpu_to_le64 (blk_getlength (exp->blk) >>VIRTIO_BLK_SECTOR_BITS ); +vduse_dev_update_config (vblk_exp->dev,sizeof (config.capacity), + offsetof(struct virtio_blk_config , capacity), + (char *)&config.capacity); +} + +static const BlockDevOps vduse_block_ops = { + .resize_cb = vduse_blk_resize, +}; +static int vduse_blk_exp_create (BlockExport *exp,BlockExportOptions *opts,Error **errp) {
@@ -279,6 +296,8 @@ static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,blk_add_aio_context_notifier (exp->blk, blk_aio_attached, blk_aio_detach, vblk_exp); +blk_set_dev_ops (exp->blk, &vduse_block_ops, exp); +return 0 ; }
@@ -288,6 +307,7 @@ static void vduse_blk_exp_delete(BlockExport *exp)blk_remove_aio_context_notifier (exp->blk, blk_aio_attached, blk_aio_detach, vblk_exp); +blk_set_dev_ops (exp->blk,NULL ,NULL );vduse_dev_destroy (vblk_exp->dev); }
Signature · 1 line
2.35.3
[PULL 13/18] libvduse: Add support for reconnecting
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
To support reconnecting after restart or crash, VDUSE backend might need to resubmit inflight I/Os. This stores the metadata such as the index of inflight I/O's descriptors to a shm file so that VDUSE backend can restore them during reconnecting.
Message-Id: <[email protected]>
--- subprojects/libvduse/libvduse.h | 12 ++ block/export/vduse-blk.c | 14 ++ subprojects/libvduse/libvduse.c | 235 +++++++++++++++++++++++++++++++- 3 files changed, 256 insertions(+), 5 deletions(-)
subprojects/libvduse/libvduse.h +12 -0
@@ -173,6 +173,18 @@ int vduse_dev_update_config(VduseDev *dev, uint32_t size,*/ int vduse_dev_setup_queue (VduseDev *dev,int index,int max_size); +/** +* vduse_set_reconnect_log_file: +* @dev: VDUSE device +* @file: filename of reconnect log +* +* Specify the file to store log for reconnecting. It should +* be called before vduse_dev_setup_queue(). +* +* Returns: 0 on success, -errno on failure. +*/ +int vduse_set_reconnect_log_file (VduseDev *dev,const char *filename); +/** * vduse_dev_create_by_fd: * @fd: passed file descriptor
block/export/vduse-blk.c +14 -0
@@ -30,6 +30,7 @@ typedef struct VduseBlkExport {VirtioBlkHandler handler;VduseDev *dev;uint16_t num_queues; +char *recon_file; } VduseBlkExport; typedef struct VduseBlkReq {
@@ -107,6 +108,8 @@ static void vduse_blk_enable_queue(VduseDev *dev, VduseVirtq *vq)aio_set_fd_handler (vblk_exp->export.ctx,vduse_queue_get_fd (vq), true, on_vduse_vq_kick,NULL ,NULL ,NULL , vq); +/* Make sure we don't miss any kick afer reconnecting */ +eventfd_write (vduse_queue_get_fd (vq),1 ); }static void vduse_blk_disable_queue (VduseDev *dev,VduseVirtq *vq)
@@ -286,6 +289,15 @@ static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,return -ENOMEM ; } + vblk_exp->recon_file =g_strdup_printf ("%s/vduse-blk-%s" , +g_get_tmp_dir (), exp->id); +if (vduse_set_reconnect_log_file (vblk_exp->dev, vblk_exp->recon_file)) { +error_setg (errp,"failed to set reconnect log file" ); +vduse_dev_destroy (vblk_exp->dev); +g_free (vblk_exp->recon_file); +return -EINVAL ; + } +for (i =0 ; i < num_queues; i++) {vduse_dev_setup_queue (vblk_exp->dev, i, queue_size); }
@@ -309,6 +321,8 @@ static void vduse_blk_exp_delete(BlockExport *exp) vblk_exp);blk_set_dev_ops (exp->blk,NULL ,NULL );vduse_dev_destroy (vblk_exp->dev); +unlink (vblk_exp->recon_file); +g_free (vblk_exp->recon_file); }static void vduse_blk_exp_request_shutdown (BlockExport *exp)
subprojects/libvduse/libvduse.c +230 -5
342 lines not on this page · raw message
Signature · 1 line
2.35.3
[PULL 16/18] block/gluster: correctly set max_pdiscard
In reply to Kevin WolfFrom: Fabian Ebner <[email protected]>
On 64-bit platforms, assigning SIZE_MAX to the int64_t max_pdiscard results in a negative value, and the following assertion would trigger down the line (it's not the same max_pdiscard, but computed from the other one):
qemu-system-x86_64: ../block/io.c:3166: bdrv_co_pdiscard: Assertion `max_pdiscard >= bs->bl.request_alignment' failed.
On 32-bit platforms, it's fine to keep using SIZE_MAX.
The assertion in qemu_gluster_co_pdiscard() is checking that the value of 'bytes' can safely be passed to glfs_discard_async(), which takes a size_t for the argument in question, so it is kept as is. And since max_pdiscard is still <= SIZE_MAX, relying on max_pdiscard is still fine.
Message-Id: <[email protected]>
--- block/gluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/gluster.c +1 -1
@@ -891,7 +891,7 @@ out:static void qemu_gluster_refresh_limits (BlockDriverState *bs,Error **errp) { bs->bl.max_transfer =GLUSTER_MAX_TRANSFER ; - bs->bl.max_pdiscard =SIZE_MAX ; + bs->bl.max_pdiscard =MIN (SIZE_MAX ,INT64_MAX ); } static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
Signature · 1 line
2.35.3
[PULL 10/18] libvduse: Add VDUSE (vDPA Device in Userspace) library
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
VDUSE [1] is a linux framework that makes it possible to implement software-emulated vDPA devices in userspace. This adds a library as a subproject to help implementing VDUSE backends in QEMU.
[1] https://www.kernel.org/doc/html/latest/userspace-api/vduse.html
Message-Id: <[email protected]>
--- meson_options.txt | 2 + subprojects/libvduse/include/atomic.h | 1 + subprojects/libvduse/include/compiler.h | 1 + subprojects/libvduse/libvduse.h | 235 ++++ subprojects/libvduse/libvduse.c | 1167 +++++++++++++++++++ MAINTAINERS | 5 + meson.build | 15 + scripts/meson-buildoptions.sh | 3 + subprojects/libvduse/linux-headers/linux | 1 + subprojects/libvduse/meson.build | 10 + subprojects/libvduse/standard-headers/linux | 1 + 11 files changed, 1441 insertions(+) create mode 120000 subprojects/libvduse/include/atomic.h create mode 120000 subprojects/libvduse/include/compiler.h create mode 100644 subprojects/libvduse/libvduse.h create mode 100644 subprojects/libvduse/libvduse.c create mode 120000 subprojects/libvduse/linux-headers/linux create mode 100644 subprojects/libvduse/meson.build create mode 120000 subprojects/libvduse/standard-headers/linux
meson_options.txt +2 -0
@@ -253,6 +253,8 @@ option('virtfs', type: 'feature', value: 'auto', description: 'virtio-9p support') option('virtiofsd', type: 'feature', value: 'auto', description: 'build virtiofs daemon (virtiofsd)') +option('libvduse', type: 'feature', value: 'auto', + description: 'build VDUSE Library') option('capstone', type: 'feature', value: 'auto', description: 'Whether and how to find the capstone library')
subprojects/libvduse/include/atomic.h new file +1 -0
@@ -0,0 +1 @@ +../../../include/qemu/atomic.h
subprojects/libvduse/include/compiler.h new file +1 -0
@@ -0,0 +1 @@ +../../../include/qemu/compiler.h
subprojects/libvduse/libvduse.h new file +235 -0
235 lines not on this page · raw message
subprojects/libvduse/libvduse.c new file +1167 -0
1,167 lines not on this page · raw message
MAINTAINERS +5 -0
@@ -3582,6 +3582,11 @@ L: [email protected] S: Supported F: block/export/fuse.c +VDUSE library +M: Xie Yongji <[email protected]> +S: Maintained +F: subprojects/libvduse/ + Replication M: Wen Congyang <[email protected]> M: Xie Changlong <[email protected]>
meson.build +15 -0
@@ -1527,6 +1527,21 @@ if get_option('fuse_lseek').allowed() endif endif +have_libvduse = (targetos == 'linux') +if get_option('libvduse').enabled() + if targetos != 'linux' + error('libvduse requires linux') + endif +elif get_option('libvduse').disabled() + have_libvduse = false +endif + +libvduse = not_found +if have_libvduse + libvduse_proj = subproject('libvduse') + libvduse = libvduse_proj.get_variable('libvduse_dep') +endif + # libbpf libbpf = dependency('libbpf', required: get_option('bpf'), method: 'pkg-config') if libbpf.found() and not cc.links('''
scripts/meson-buildoptions.sh +3 -0
@@ -109,6 +109,7 @@ meson_options_help() { printf "%s\n" ' libssh ssh block device support' printf "%s\n" ' libudev Use libudev to enumerate host devices' printf "%s\n" ' libusb libusb support for USB passthrough' + printf "%s\n" ' libvduse build VDUSE Library' printf "%s\n" ' linux-aio Linux AIO support' printf "%s\n" ' linux-io-uring Linux io_uring support' printf "%s\n" ' live-block-migration'
@@ -302,6 +303,8 @@ _meson_option_parse() { --disable-libudev) printf "%s" -Dlibudev=disabled ;; --enable-libusb) printf "%s" -Dlibusb=enabled ;; --disable-libusb) printf "%s" -Dlibusb=disabled ;; + --enable-libvduse) printf "%s" -Dlibvduse=enabled ;; + --disable-libvduse) printf "%s" -Dlibvduse=disabled ;; --enable-linux-aio) printf "%s" -Dlinux_aio=enabled ;; --disable-linux-aio) printf "%s" -Dlinux_aio=disabled ;; --enable-linux-io-uring) printf "%s" -Dlinux_io_uring=enabled ;;
subprojects/libvduse/linux-headers/linux new file +1 -0
@@ -0,0 +1 @@ +../../../linux-headers/linux/
subprojects/libvduse/meson.build new file +10 -0
@@ -0,0 +1,10 @@ +project('libvduse', 'c', + license: 'GPL-2.0-or-later', + default_options: ['c_std=gnu99']) + +libvduse = static_library('vduse', + files('libvduse.c'), + c_args: '-D_GNU_SOURCE') + +libvduse_dep = declare_dependency(link_with: libvduse, + include_directories: include_directories('.'))
subprojects/libvduse/standard-headers/linux new file +1 -0
@@ -0,0 +1 @@ +../../../include/standard-headers/linux/
Signature · 1 line
2.35.3
[PULL 04/18] block: improve block_dirty_bitmap_merge(): don't allocate extra bitmap
In reply to Kevin WolfFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
We don't need extra bitmap. All we need is to backup the original bitmap when we do first merge. So, drop extra temporary bitmap and work directly with target and backup.
Still to keep old semantics, that on failure target is unchanged and user don't need to restore, we need a local_backup variable and do restore ourselves on failure path.
Message-Id: <[email protected]>
--- block/monitor/bitmap-qmp-cmds.c | 41 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-)
block/monitor/bitmap-qmp-cmds.c +21 -20
@@ -261,8 +261,9 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target, HBitmap **backup, Error **errp) {BlockDriverState *bs; -BdrvDirtyBitmap *dst, *src, *anon; +BdrvDirtyBitmap *dst, *src;BlockDirtyBitmapOrStrList *lst; +HBitmap *local_backup =NULL ;GLOBAL_STATE_CODE ();
@@ -271,12 +272,6 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,return NULL ; } - anon =bdrv_create_dirty_bitmap (bs,bdrv_dirty_bitmap_granularity (dst), -NULL , errp); -if (!anon) { -return NULL ; - } -for (lst = bms; lst; lst = lst->next) {switch (lst->value->type) {const char *name, *node;
@@ -285,8 +280,7 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target, src =bdrv_find_dirty_bitmap (bs, name);if (!src) {error_setg (errp,"Dirty bitmap '%s' not found" , name); - dst =NULL ; - goto out; + goto fail; }break ;case QTYPE_QDICT :
@@ -294,29 +288,36 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target, name = lst->value->u.external.name; src =block_dirty_bitmap_lookup (node, name,NULL , errp);if (!src) { - dst =NULL ; - goto out; + goto fail; }break ;default :abort (); } -if (!bdrv_merge_dirty_bitmap (anon, src,NULL , errp)) { - dst =NULL ; - goto out; +/* We do backup only for first merge operation */ +if (!bdrv_merge_dirty_bitmap (dst, src, + local_backup ?NULL : &local_backup, + errp)) + { + goto fail; } } -/* Merge into dst; dst is unchanged on failure. */ -if (!bdrv_merge_dirty_bitmap (dst, anon, backup, errp)) { - dst =NULL ; - goto out; +if (backup) { + *backup = local_backup; + }else { +hbitmap_free (local_backup); } - out: -bdrv_release_dirty_bitmap (anon);return dst; + +fail: +if (local_backup) { +bdrv_restore_dirty_bitmap (dst, local_backup); + } + +return NULL ; } void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
Signature · 1 line
2.35.3
[PULL 07/18] block/export: Fix incorrect length passed to vu_queue_push()
In reply to Kevin WolfFrom: Xie Yongji <[email protected]>
Now the req->size is set to the correct value only when handling VIRTIO_BLK_T_GET_ID request. This patch fixes it.
Message-Id: <[email protected]>
--- block/export/vhost-user-blk-server.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
block/export/vhost-user-blk-server.c +2 -3
@@ -60,8 +60,7 @@ static void vu_blk_req_complete(VuBlkReq *req) {VuDev *vu_dev = &req->server->vu_dev; -/* IO size with 1 extra status byte */ -vu_queue_push (vu_dev, req->vq, &req->elem, req->size +1 ); +vu_queue_push (vu_dev, req->vq, &req->elem, req->size);vu_queue_notify (vu_dev, req->vq);free (req);
@@ -207,6 +206,7 @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque) goto err; } + req->size =iov_size (in_iov, in_num);/* We always touch the last byte, so just see how big in_iov is. */ req->in = (void *)in_iov[in_num -1 ].iov_base + in_iov[in_num -1 ].iov_len
@@ -267,7 +267,6 @@ static void coroutine_fn vu_blk_virtio_process_req(void *opaque) VIRTIO_BLK_ID_BYTES);snprintf (elem->in_sg[0 ].iov_base, size,"%s" ,"vhost_user_blk" ); req->in->status =VIRTIO_BLK_S_OK ; - req->size = elem->in_sg[0 ].iov_len;break ; }case VIRTIO_BLK_T_DISCARD :
Signature · 1 line
2.35.3
[PULL 05/18] block: simplify handling of try to merge different sized bitmaps
In reply to Kevin WolfFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
We have too much logic to simply check that bitmaps are of the same size. Let's just define that hbitmap_merge() and bdrv_dirty_bitmap_merge_internal() require their argument bitmaps be of same size, this simplifies things.
Let's look through the callers:
For backup_init_bcs_bitmap() we already assert that merge can't fail.
In bdrv_reclaim_dirty_bitmap_locked() we gracefully handle the error that can't happen: successor always has same size as its parent, drop this logic.
In bdrv_merge_dirty_bitmap() we already has assertion and separate check. Make the check explicit and improve error message.
Message-Id: <[email protected]>
--- include/block/block_int-io.h | 2 +- include/qemu/hbitmap.h | 15 ++------------- block/backup.c | 6 ++---- block/dirty-bitmap.c | 26 +++++++++++--------------- util/hbitmap.c | 25 +++++++------------------ 5 files changed, 23 insertions(+), 51 deletions(-)
include/block/block_int-io.h +1 -1
@@ -102,7 +102,7 @@ bool blk_dev_is_tray_open(BlockBackend *blk);void bdrv_set_dirty (BlockDriverState *bs,int64_t offset,int64_t bytes);void bdrv_clear_dirty_bitmap (BdrvDirtyBitmap *bitmap,HBitmap **out); -bool bdrv_dirty_bitmap_merge_internal (BdrvDirtyBitmap *dest, +void bdrv_dirty_bitmap_merge_internal (BdrvDirtyBitmap *dest,const BdrvDirtyBitmap *src,HBitmap **backup,bool lock);
include/qemu/hbitmap.h +2 -13
@@ -76,20 +76,9 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size);* * Store result of merging @a and @b into @result. * @result is allowed to be equal to @a or @b. -* -* Return true if the merge was successful, -* false if it was not attempted. -*/ -bool hbitmap_merge (const HBitmap *a,const HBitmap *b,HBitmap *result); - -/** -* hbitmap_can_merge: -* -* hbitmap_can_merge(a, b) && hbitmap_can_merge(a, result) is sufficient and -* necessary for hbitmap_merge will not fail. -* +* All bitmaps must have same size. */ -bool hbitmap_can_merge (const HBitmap *a,const HBitmap *b); +void hbitmap_merge (const HBitmap *a,const HBitmap *b,HBitmap *result);/** * hbitmap_empty:
block/backup.c +2 -4
@@ -228,15 +228,13 @@ out:static void backup_init_bcs_bitmap (BackupBlockJob *job) { -bool ret;uint64_t estimate;BdrvDirtyBitmap *bcs_bitmap =block_copy_dirty_bitmap (job->bcs);if (job->sync_mode ==MIRROR_SYNC_MODE_BITMAP ) {bdrv_clear_dirty_bitmap (bcs_bitmap,NULL ); - ret =bdrv_dirty_bitmap_merge_internal (bcs_bitmap, job->sync_bitmap, -NULL , true); -assert (ret); +bdrv_dirty_bitmap_merge_internal (bcs_bitmap, job->sync_bitmap,NULL , + true); }else if (job->sync_mode ==MIRROR_SYNC_MODE_TOP ) {/* * We can't hog the coroutine to initialize this thoroughly.
block/dirty-bitmap.c +11 -15
@@ -309,10 +309,7 @@ BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BdrvDirtyBitmap *parent,return NULL ; } -if (!hbitmap_merge (parent->bitmap, successor->bitmap, parent->bitmap)) { -error_setg (errp,"Merging of parent and successor bitmap failed" ); -return NULL ; - } +hbitmap_merge (parent->bitmap, successor->bitmap, parent->bitmap); parent->disabled = successor->disabled; parent->busy = false;
@@ -912,13 +909,15 @@ bool bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src, goto out; } -if (!hbitmap_can_merge (dest->bitmap, src->bitmap)) { -error_setg (errp,"Bitmaps are incompatible and can't be merged" ); +if (bdrv_dirty_bitmap_size (src) !=bdrv_dirty_bitmap_size (dest)) { +error_setg (errp,"Bitmaps are of different sizes (destination size is %" + PRId64", source size is %" PRId64") and can't be merged" , +bdrv_dirty_bitmap_size (dest),bdrv_dirty_bitmap_size (src)); goto out; } - ret =bdrv_dirty_bitmap_merge_internal (dest, src, backup, false); -assert (ret); +bdrv_dirty_bitmap_merge_internal (dest, src, backup, false); + ret = true; out:bdrv_dirty_bitmaps_unlock (dest->bs);
@@ -932,17 +931,16 @@ out:/** * bdrv_dirty_bitmap_merge_internal: merge src into dest. * Does NOT check bitmap permissions; not suitable for use as public API. +* @dest, @src and @backup (if not NULL) must have same size. * * @backup: If provided, make a copy of dest here prior to merge. * @lock: If true, lock and unlock bitmaps on the way in/out. -* returns true if the merge succeeded; false if unattempted. */ -bool bdrv_dirty_bitmap_merge_internal (BdrvDirtyBitmap *dest, +void bdrv_dirty_bitmap_merge_internal (BdrvDirtyBitmap *dest,const BdrvDirtyBitmap *src,HBitmap **backup,bool lock) { -bool ret;IO_CODE ();assert (!bdrv_dirty_bitmap_readonly (dest));
@@ -959,9 +957,9 @@ bool bdrv_dirty_bitmap_merge_internal(BdrvDirtyBitmap *dest,if (backup) { *backup = dest->bitmap; dest->bitmap =hbitmap_alloc (dest->size,hbitmap_granularity (*backup)); - ret =hbitmap_merge (*backup, src->bitmap, dest->bitmap); +hbitmap_merge (*backup, src->bitmap, dest->bitmap); }else { - ret =hbitmap_merge (dest->bitmap, src->bitmap, dest->bitmap); +hbitmap_merge (dest->bitmap, src->bitmap, dest->bitmap); }if (lock) {
@@ -970,6 +968,4 @@ bool bdrv_dirty_bitmap_merge_internal(BdrvDirtyBitmap *dest,bdrv_dirty_bitmaps_unlock (src->bs); } } - -return ret; }
util/hbitmap.c +7 -18
@@ -873,11 +873,6 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size) } } -bool hbitmap_can_merge (const HBitmap *a,const HBitmap *b) -{ -return (a->orig_size == b->orig_size); -} -/** * hbitmap_sparse_merge: performs dst = dst | src * works with differing granularities.
@@ -901,28 +896,24 @@ static void hbitmap_sparse_merge(HBitmap *dst, const HBitmap *src)* Given HBitmaps A and B, let R := A (BITOR) B. * Bitmaps A and B will not be modified, * except when bitmap R is an alias of A or B. -* -* @return true if the merge was successful, -* false if it was not attempted. +* Bitmaps must have same size. */ -bool hbitmap_merge (const HBitmap *a,const HBitmap *b,HBitmap *result) +void hbitmap_merge (const HBitmap *a,const HBitmap *b,HBitmap *result) {int i;uint64_t j; -if (!hbitmap_can_merge (a, b) || !hbitmap_can_merge (a, result)) { -return false; - } -assert (hbitmap_can_merge (b, result)); +assert (a->orig_size == result->orig_size); +assert (b->orig_size == result->orig_size);if ((!hbitmap_count (a) && result == b) || (!hbitmap_count (b) && result == a)) { -return true; +return ; }if (!hbitmap_count (a) && !hbitmap_count (b)) {hbitmap_reset_all (result); -return true; +return ; }if (a->granularity != b->granularity) {
@@ -935,7 +926,7 @@ bool hbitmap_merge(const HBitmap *a, const HBitmap *b, HBitmap *result)if (b != result) {hbitmap_sparse_merge (result, b); } -return true; +return ; }/* This merge is O(size), as BITS_PER_LONG and HBITMAP_LEVELS are constant.
@@ -951,8 +942,6 @@ bool hbitmap_merge(const HBitmap *a, const HBitmap *b, HBitmap *result)/* Recompute the dirty count */ result->count =hb_count_between (result,0 , result->size -1 ); - -return true; }char *hbitmap_sha256 (const HBitmap *bitmap,Error **errp)
Signature · 1 line
2.35.3
[PULL 01/18] block: drop unused bdrv_co_drain() API
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
bdrv_co_drain() has not been used since commit 9a0cec664eef ("mirror:
use bdrv_drained_begin/bdrv_drained_end") in 2016. Remove it so there are fewer drain scenarios to worry about.
Use bdrv_drained_begin()/bdrv_drained_end() instead. They are "mixed" functions that can be called from coroutine context. Unlike bdrv_co_drain(), these functions provide control of the length of the drained section, which is usually the right thing.
Message-Id: <[email protected]>
--- include/block/block-io.h | 1 - block/io.c | 15 --------------- 2 files changed, 16 deletions(-)
include/block/block-io.h +0 -1
@@ -270,7 +270,6 @@ void bdrv_drained_end_no_poll(BlockDriverState *bs, int *drained_end_counter); cond); })void bdrv_drain (BlockDriverState *bs); -void coroutine_fn bdrv_co_drain(BlockDriverState *bs); int generated_co_wrapper bdrv_truncate(BdrvChild *child, int64_t offset, bool exact,
block/io.c +0 -15
@@ -588,21 +588,6 @@ void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent)BDRV_POLL_WHILE (child->bs,qatomic_read (&drained_end_counter) >0 ); } -/* -* Wait for pending requests to complete on a single BlockDriverState subtree, -* and suspend block driver's internal I/O until next request arrives. -* -* Note that unlike bdrv_drain_all(), the caller must hold the BlockDriverState -* AioContext. -*/ -void coroutine_fn bdrv_co_drain(BlockDriverState *bs) -{ -IO_OR_GS_CODE (); -assert (qemu_in_coroutine ()); -bdrv_drained_begin (bs); -bdrv_drained_end (bs); -} -void bdrv_drain (BlockDriverState *bs) {IO_OR_GS_CODE ();
Signature · 1 line
2.35.3
[PULL 02/18] block: get rid of blk->guest_block_size
In reply to Kevin WolfFrom: Stefan Hajnoczi <[email protected]>
Commit 1b7fd729559c ("block: rename buffer_alignment to guest_block_size") noted:
At this point, the field is set by the device emulation, but completely ignored by the block layer.
The last time the value of buffer_alignment/guest_block_size was actually used was before commit 339064d50639 ("block: Don't use guest sector size for qemu_blockalign()").
This value has not been used since 2013. Get rid of it.
Message-Id: <[email protected]>
--- include/sysemu/block-backend-io.h | 1 - block/block-backend.c | 10 ---------- block/export/vhost-user-blk-server.c | 1 - hw/block/virtio-blk.c | 1 - hw/block/xen-block.c | 1 - hw/ide/core.c | 1 - hw/scsi/scsi-disk.c | 1 - hw/scsi/scsi-generic.c | 1 - 8 files changed, 17 deletions(-)
include/sysemu/block-backend-io.h +0 -1
@@ -72,7 +72,6 @@ void blk_error_action(BlockBackend *blk, BlockErrorAction action,void blk_iostatus_set_err (BlockBackend *blk,int error);int blk_get_max_iov (BlockBackend *blk);int blk_get_max_hw_iov (BlockBackend *blk); -void blk_set_guest_block_size (BlockBackend *blk,int align);void blk_io_plug (BlockBackend *blk);void blk_io_unplug (BlockBackend *blk);
block/block-backend.c +0 -10
@@ -56,9 +56,6 @@ struct BlockBackend {const BlockDevOps *dev_ops;void *dev_opaque; -/* the block size for which the guest device expects atomicity */ -int guest_block_size; -/* If the BDS tree is removed, some of its options are stored here (which * can be used to restore those options in the new BDS on insert) */ BlockBackendRootState root_state;
@@ -998,7 +995,6 @@ void blk_detach_dev(BlockBackend *blk, DeviceState *dev) blk->dev =NULL ; blk->dev_ops =NULL ; blk->dev_opaque =NULL ; - blk->guest_block_size =512 ;blk_set_perm (blk,0 ,BLK_PERM_ALL , &error_abort);blk_unref (blk); }
@@ -2100,12 +2096,6 @@ int blk_get_max_iov(BlockBackend *blk)return blk->root->bs->bl.max_iov; } -void blk_set_guest_block_size (BlockBackend *blk,int align) -{ -IO_CODE (); - blk->guest_block_size = align; -} -void *blk_try_blockalign (BlockBackend *blk,size_t size) {IO_CODE ();
block/export/vhost-user-blk-server.c +0 -1
@@ -495,7 +495,6 @@ static int vu_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,return -EINVAL ; } vexp->blk_size = logical_block_size; -blk_set_guest_block_size (exp->blk, logical_block_size);if (vu_opts->has_num_queues) { num_queues = vu_opts->num_queues;
hw/block/virtio-blk.c +0 -1
@@ -1228,7 +1228,6 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) s->change =qemu_add_vm_change_state_handler (virtio_blk_dma_restart_cb, s);blk_set_dev_ops (s->blk, &virtio_block_ops, s); -blk_set_guest_block_size (s->blk, s->conf.conf.logical_block_size);blk_iostatus_enable (s->blk);
hw/block/xen-block.c +0 -1
@@ -243,7 +243,6 @@ static void xen_block_realize(XenDevice *xendev, Error **errp) }blk_set_dev_ops (blk, &xen_block_dev_ops, blockdev); -blk_set_guest_block_size (blk, conf->logical_block_size);if (conf->discard_granularity ==-1 ) { conf->discard_granularity = conf->physical_block_size;
hw/ide/core.c +0 -1
@@ -2548,7 +2548,6 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind, s->smart_selftest_count =0 ;if (kind ==IDE_CD ) {blk_set_dev_ops (blk, &ide_cd_block_ops, s); -blk_set_guest_block_size (blk,2048 ); }else {if (!blk_is_inserted (s->blk)) {error_setg (errp,"Device needs media, but drive is empty" );
hw/scsi/scsi-disk.c +0 -1
@@ -2419,7 +2419,6 @@ static void scsi_realize(SCSIDevice *dev, Error **errp) }else {blk_set_dev_ops (s->qdev.conf.blk, &scsi_disk_block_ops, s); } -blk_set_guest_block_size (s->qdev.conf.blk, s->qdev.blocksize);blk_iostatus_enable (s->qdev.conf.blk);
hw/scsi/scsi-generic.c +0 -1
@@ -321,7 +321,6 @@ static void scsi_read_complete(void * opaque, int ret) s->blocksize =ldl_be_p (&r->buf[8 ]); s->max_lba =ldq_be_p (&r->buf[0 ]); } -blk_set_guest_block_size (s->conf.blk, s->blocksize);/* * Patch MODE SENSE device specific parameters if the BDS is opened
Signature · 1 line
2.35.3
Quoted 15 lines · Kevin Wolf
The following changes since commit
028f2361d0c2d28d6f918fe618f389228ac22b60:Merge tag 'pull-target-arm-20220609' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-06-09 06:47:03 -0700)are available in the Git repository at:
git://repo.or.cz/qemu/kevin.gittags/for-upstreamfor you to fetch changes up to
7f9a8b3342ff00d3398fdc08264948762d748edb:nbd: Drop dead code spotted by Coverity (2022-06-09 18:07:17 +0200)
----------------------------------------------------------------
Block layer patches
Quoted 6 lines
- Add vduse-blk export
- Dirty bitmaps: Fix and improve bitmap merge
- gluster: correctly setmax_pdiscard
- rbd: report a better error when namespace does not exist
-aio_wait_kick: add missing memory barrier
- Code cleanups
Several sets of compile failures:
https://gitlab.com/qemu-project/qemu/-/jobs/2571008901
../subprojects/libvduse/libvduse.c:578:20: error: unused function 'vring_used_flags_set_bit' [-Werror,-Wunused-function] static inline void vring_used_flags_set_bit(VduseVirtq *vq, int mask)
^
../subprojects/libvduse/libvduse.c:587:20: error: unused function 'vring_used_flags_unset_bit' [-Werror,-Wunused-function]
static inline void vring_used_flags_unset_bit(VduseVirtq *vq, int mask)
^https://gitlab.com/qemu-project/qemu/-/jobs/2571008908
../meson.build:1652:2: ERROR: Tried to use 'add_global_arguments' after a build target has been declared.
https://gitlab.com/qemu-project/qemu/-/jobs/2571008833
../subprojects/libvduse/libvduse.c:325:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
325 | munmap((void *)dev->regions[i].mmap_addr,
| ^../subprojects/libvduse/libvduse.c: In function 'vduse_dev_create':../subprojects/libvduse/libvduse.c:1318:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=]
1318 | fprintf(stderr, "Failed to set api version %lu: %s\n",
| ~~^
| |
| long unsigned int
| %llu
1319 | version, strerror(errno));
| ~~~~~~~
| |
| uint64_t {aka long long unsigned int}r~
Am 09.06.2022 um 22:18 hat Richard Henderson geschrieben:
Quoted 16 lines · Kevin Wolf
Quoted 15 lines
The following changes since commit
028f2361d0c2d28d6f918fe618f389228ac22b60:Merge tag 'pull-target-arm-20220609' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-06-09 06:47:03 -0700)are available in the Git repository at:
git://repo.or.cz/qemu/kevin.gittags/for-upstreamfor you to fetch changes up to
7f9a8b3342ff00d3398fdc08264948762d748edb:nbd: Drop dead code spotted by Coverity (2022-06-09 18:07:17 +0200)
----------------------------------------------------------------
Block layer patches
Quoted 8 lines
Quoted 6 lines
- Add vduse-blk export
- Dirty bitmaps: Fix and improve bitmap merge
- gluster: correctly setmax_pdiscard
- rbd: report a better error when namespace does not exist
-aio_wait_kick: add missing memory barrier
- Code cleanupsSeveral sets of compile failures:
Hi Yongji,
the vduse-blk code fails to compile with clang as shown below. As you already sent another series to fix up other bugs introduced in the series, maybe it would be better if you can send a new version with all of the necessary fixes squashed in instead of me trying to make minimal fixes to get it to compile with clang.
Kevin
Quoted 39 lines
https://gitlab.com/qemu-project/qemu/-/jobs/2571008901
../subprojects/libvduse/libvduse.c:578:20: error: unused function 'vring_used_flags_set_bit' [-Werror,-Wunused-function] static inline voidvring_used_flags_set_bit(VduseVirtq *vq, int mask)^ ../subprojects/libvduse/libvduse.c:587:20: error: unused function 'vring_used_flags_unset_bit' [-Werror,-Wunused-function] static inline void vring_used_flags_unset_bit(VduseVirtq *vq, int mask) ^https://gitlab.com/qemu-project/qemu/-/jobs/2571008908
../meson.build:1652:2: ERROR: Tried to use '
add_global_arguments' after a build target has been declared.https://gitlab.com/qemu-project/qemu/-/jobs/2571008833
../subprojects/libvduse/libvduse.c:325:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
325 | munmap((void *)dev->regions[i].mmap_addr,
| ^../subprojects/libvduse/libvduse.c: In function 'vduse_dev_create':../subprojects/libvduse/libvduse.c:1318:54: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=]1318 | fprintf(stderr, "Failed to set api version %lu: %s\n", | ~~^ | | | long unsigned int | %llu 1319 | version, strerror(errno)); | ~~~~~~~ | | | uint64_t {aka long long unsigned int}r~
Quoted 27 lines · Kevin Wolf
Am 09.06.2022 um 22:18 hat Richard Henderson geschrieben:
Quoted 16 lines · Kevin Wolf
Quoted 15 lines
The following changes since commit
028f2361d0c2d28d6f918fe618f389228ac22b60:Merge tag 'pull-target-arm-20220609' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-06-09 06:47:03 -0700)are available in the Git repository at:
git://repo.or.cz/qemu/kevin.gittags/for-upstreamfor you to fetch changes up to
7f9a8b3342ff00d3398fdc08264948762d748edb:nbd: Drop dead code spotted by Coverity (2022-06-09 18:07:17 +0200)
----------------------------------------------------------------
Block layer patchesQuoted 8 lines
Quoted 6 lines
- Add vduse-blk export
- Dirty bitmaps: Fix and improve bitmap merge
- gluster: correctly setmax_pdiscard
- rbd: report a better error when namespace does not exist
-aio_wait_kick: add missing memory barrier
- Code cleanupsSeveral sets of compile failures:
Quoted 8 lines
Hi Yongji,
the vduse-blk code fails to compile with clang as shown below. As you already sent another series to fix up other bugs introduced in the series, maybe it would be better if you can send a new version with all of the necessary fixes squashed in instead of me trying to make minimal fixes to get it to compile with clang.
OK, I have sent a new version including the fix.
Thanks.
Yongji