From d4d3e76aed2961dc4333634274b8c5f8f2230e2f Mon Sep 17 00:00:00 2001 From: GangCao Date: Thu, 7 May 2020 13:22:04 -0400 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. Backport this fix (https://github.com/spdk/spdk/commit/9c6d4649eb6076b3540a971cb73e54490836dd3c) to the SPDK LTS 20.01.2 release. Change-Id: I30f6201bbfbb7885379b1b0ae19b64a1673e487f Signed-off-by: suhua Signed-off-by: GangCao Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2261 Tested-by: Tomasz Zawadzki Reviewed-by: Tomasz Zawadzki Reviewed-by: Changpeng Liu Reviewed-by: Xiaodong 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 b80015377..6e8fc7d07 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;