From 9c6d4649eb6076b3540a971cb73e54490836dd3c Mon Sep 17 00:00:00 2001 From: suhua Date: Fri, 21 Feb 2020 09:50:12 +0800 Subject: [PATCH] vhost: Fix the issue of virtual machine device parameter max_segments always equal to 1 Solve the problem that the /sys/block/vd../max_segments is always 1 in the virtual machine,and avoid the problem of low sequential read and write performance caused by this limitation in the general block device layer of some lower kernels. Signed-off-by: suhua Change-Id: I3289b4c6c74d9225f34e117f444f310bf8bc8ea2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/975 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu --- lib/vhost/vhost_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c index b80015377e..6e8fc7d07e 100644 --- a/lib/vhost/vhost_blk.c +++ b/lib/vhost/vhost_blk.c @@ -919,6 +919,7 @@ vhost_blk_get_config(struct spdk_vhost_dev *vdev, uint8_t *config, uint32_t blk_size; uint64_t blkcnt; + memset(&blkcfg, 0, sizeof(blkcfg)); bvdev = to_blk_dev(vdev); assert(bvdev != NULL); bdev = bvdev->bdev; @@ -949,7 +950,6 @@ vhost_blk_get_config(struct spdk_vhost_dev *vdev, uint8_t *config, } } - memset(&blkcfg, 0, sizeof(blkcfg)); blkcfg.blk_size = blk_size; /* minimum I/O size in blocks */ blkcfg.min_io_size = 1;