vhost_blk: set the maximum supported data segment based on bdev
AIO backend requires aligned data buffers, and the maximum IOVs supported in bdev module is defined to 32, there are cases for Windows Guest which will send data segments more than 32, SPDK can't process such cases, so here we can set the 'seg_max' parameter based on bdev module capability. Also set the maximum segment size for those requests. Fix issue #625. Change-Id: I0ff61e55872af17115c0b6b28425e70cb8769790 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452378 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
69db40f677
commit
cf680fe47e
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
#include "spdk/bdev.h"
|
#include "spdk/bdev.h"
|
||||||
|
#include "spdk/bdev_module.h"
|
||||||
#include "spdk/conf.h"
|
#include "spdk/conf.h"
|
||||||
#include "spdk/thread.h"
|
#include "spdk/thread.h"
|
||||||
#include "spdk/likely.h"
|
#include "spdk/likely.h"
|
||||||
@ -896,6 +897,14 @@ spdk_vhost_blk_get_config(struct spdk_vhost_dev *vdev, uint8_t *config,
|
|||||||
} else {
|
} else {
|
||||||
blk_size = spdk_bdev_get_block_size(bdev);
|
blk_size = spdk_bdev_get_block_size(bdev);
|
||||||
blkcnt = spdk_bdev_get_num_blocks(bdev);
|
blkcnt = spdk_bdev_get_num_blocks(bdev);
|
||||||
|
if (spdk_bdev_get_buf_align(bdev) > 1) {
|
||||||
|
blkcfg.size_max = SPDK_BDEV_LARGE_BUF_MAX_SIZE;
|
||||||
|
blkcfg.seg_max = spdk_min(SPDK_VHOST_IOVS_MAX - 2 - 1, BDEV_IO_NUM_CHILD_IOV - 2 - 1);
|
||||||
|
} else {
|
||||||
|
blkcfg.size_max = 131072;
|
||||||
|
/* -2 for REQ and RESP and -1 for region boundary splitting */
|
||||||
|
blkcfg.seg_max = SPDK_VHOST_IOVS_MAX - 2 - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&blkcfg, 0, sizeof(blkcfg));
|
memset(&blkcfg, 0, sizeof(blkcfg));
|
||||||
@ -904,9 +913,6 @@ spdk_vhost_blk_get_config(struct spdk_vhost_dev *vdev, uint8_t *config,
|
|||||||
blkcfg.min_io_size = 1;
|
blkcfg.min_io_size = 1;
|
||||||
/* expressed in 512 Bytes sectors */
|
/* expressed in 512 Bytes sectors */
|
||||||
blkcfg.capacity = (blkcnt * blk_size) / 512;
|
blkcfg.capacity = (blkcnt * blk_size) / 512;
|
||||||
blkcfg.size_max = 131072;
|
|
||||||
/* -2 for REQ and RESP and -1 for region boundary splitting */
|
|
||||||
blkcfg.seg_max = SPDK_VHOST_IOVS_MAX - 2 - 1;
|
|
||||||
/* QEMU can overwrite this value when started */
|
/* QEMU can overwrite this value when started */
|
||||||
blkcfg.num_queues = SPDK_VHOST_MAX_VQUEUES;
|
blkcfg.num_queues = SPDK_VHOST_MAX_VQUEUES;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user