[PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature

zhaoxin\RockCuioc posted 1 patch 3 years, 5 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201119085437.5333-1-RockCui-oc@zhaoxin.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
There is a newer version of this series
hw/block/virtio-blk.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature
Posted by zhaoxin\RockCuioc 3 years, 5 months ago
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


Re: [PATCH] virtio-blk: seg_max do not subtract 2 if host has VIRTIO_RING_F_INDIRECT_DESC feature
Posted by no-reply@patchew.org 3 years, 5 months ago
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