[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 3/8] block/export: Abstract out the logic of virtio-blk I/
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v5 3/8] block/export: Abstract out the logic of virtio-blk I/O process |
Date: |
Wed, 18 May 2022 14:13:53 +0100 |
On Wed, May 04, 2022 at 03:40:46PM +0800, Xie Yongji wrote:
> -static void vu_blk_req_complete(VuBlkReq *req)
> +static void vu_blk_req_complete(VuBlkReq *req, size_t in_len)
> {
> 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, in_len);
I think this silently fixes a bug: now the correct len value is
calculated. Before the I/O buffer wasn't counted in read requests.
Please mention this in the commit description.
> +static bool virtio_blk_sect_range_ok(BlockBackend *blk,
> + uint64_t sector, size_t size)
> +{
> + uint64_t nb_sectors;
> + uint64_t total_sectors;
> +
> + if (size % VIRTIO_BLK_SECTOR_SIZE) {
> + return false;
> + }
> +
> + nb_sectors = size >> VIRTIO_BLK_SECTOR_BITS;
> +
> + QEMU_BUILD_BUG_ON(BDRV_SECTOR_SIZE != VIRTIO_BLK_SECTOR_SIZE);
> + if (nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
> + return false;
> + }
> + if ((sector << VIRTIO_BLK_SECTOR_BITS) % blk_get_guest_block_size(blk)) {
Please use VirtioBlkHandler->logical_block_size instead (see below).
> +int coroutine_fn virtio_blk_process_req(BlockBackend *blk, bool writable,
> + const char *serial,
I suggest defining a struct instead of passing individual arguments:
typedef struct {
BlockBackend *blk;
const char *serial;
uint32_t logical_block_size;
bool writable;
} VirtioBlkHandler;
signature.asc
Description: PGP signature
- Re: [PATCH v5 2/8] block-backend: Introduce blk_get_guest_block_size(), (continued)
- [PATCH v5 6/8] vduse-blk: Implement vduse-blk export, Xie Yongji, 2022/05/04
- [PATCH v5 7/8] vduse-blk: Add vduse-blk resize support, Xie Yongji, 2022/05/04
- [PATCH v5 5/8] libvduse: Add VDUSE (vDPA Device in Userspace) library, Xie Yongji, 2022/05/04
- [PATCH v5 3/8] block/export: Abstract out the logic of virtio-blk I/O process, Xie Yongji, 2022/05/04
- Re: [PATCH v5 3/8] block/export: Abstract out the logic of virtio-blk I/O process,
Stefan Hajnoczi <=
- [PATCH v5 4/8] linux-headers: Add vduse.h, Xie Yongji, 2022/05/04
- [PATCH v5 8/8] libvduse: Add support for reconnecting, Xie Yongji, 2022/05/04
Re: [PATCH v5 0/8] Support exporting BDSs via VDUSE, Michael S. Tsirkin, 2022/05/13