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 (9c6d4649eb)
to the SPDK LTS 20.01.2 release.

Change-Id: I30f6201bbfbb7885379b1b0ae19b64a1673e487f
Signed-off-by: suhua <suhua1@kingsoft.com>
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2261
Tested-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
This commit is contained in:
GangCao 2020-05-07 13:22:04 -04:00 committed by Tomasz Zawadzki
parent 09377fc41f
commit d4d3e76aed

View File

@ -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;