* [PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature
@ 2020-11-19 8:54 zhaoxin\RockCuioc
2020-11-19 9:06 ` no-reply
0 siblings, 1 reply; 2+ messages in thread
From: zhaoxin\RockCuioc @ 2020-11-19 8:54 UTC (permalink / raw)
To: qemu-devel; +Cc: RockCui, CobeChen, flyfan
This patch modify virtio-blk seg_max when host has VIRTIO_RING_F_INDIRECT_DESC feature, when read/write virtio-blk disk in direct mode,
this patch can make the bio reach 512k but not 504k if the user buffer physical segments are all discontinuous,when use ceph the size of 504k
will affect performance.This patch should be used in guest kernel version>=4.14, kernel after this version virtio driver does not judge
total_sg and vring num if the host supports indirect descriptor tables.
Signed-off-by: zhaoxin\RockCuioc <RockCui-oc@zhaoxin.com>
---
hw/block/virtio-blk.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index bac2d6f..40bbbd7 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -932,7 +932,11 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
blk_get_geometry(s->blk, &capacity);
memset(&blkcfg, 0, sizeof(blkcfg));
virtio_stq_p(vdev, &blkcfg.capacity, capacity);
- virtio_stl_p(vdev, &blkcfg.seg_max,
+ if virtio_host_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC)
+ virtio_stl_p(vdev, &blkcfg.seg_max,
+ s->conf.seg_max_adjust ? s->conf.queue_size: 128);
+ else
+ virtio_stl_p(vdev, &blkcfg.seg_max,
s->conf.seg_max_adjust ? s->conf.queue_size - 2 : 128 - 2);
virtio_stw_p(vdev, &blkcfg.geometry.cylinders, conf->cyls);
virtio_stl_p(vdev, &blkcfg.blk_size, blk_size);
--
2.10.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature
2020-11-19 8:54 [PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature zhaoxin\RockCuioc
@ 2020-11-19 9:06 ` no-reply
0 siblings, 0 replies; 2+ messages in thread
From: no-reply @ 2020-11-19 9:06 UTC (permalink / raw)
To: RockCui-oc; +Cc: RockCui, CobeChen, qemu-devel, flyfan
Patchew URL: https://patchew.org/QEMU/20201119085437.5333-1-RockCui-oc@zhaoxin.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20201119085437.5333-1-RockCui-oc@zhaoxin.com
Subject: [PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/20201119085437.5333-1-RockCui-oc@zhaoxin.com -> patchew/20201119085437.5333-1-RockCui-oc@zhaoxin.com
Switched to a new branch 'test'
166948e virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature
=== OUTPUT BEGIN ===
ERROR: spaces required around that ':' (ctx:VxW)
#26: FILE: hw/block/virtio-blk.c:937:
+ s->conf.seg_max_adjust ? s->conf.queue_size: 128);
^
total: 1 errors, 0 warnings, 12 lines checked
Commit 166948ef3ae9 (virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature) has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20201119085437.5333-1-RockCui-oc@zhaoxin.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-19 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-19 8:54 [PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature zhaoxin\RockCuioc
2020-11-19 9:06 ` no-reply
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.