Commit e3367a23 authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

bdev/nvme: set max_num_segments based on controller limit



Fixes issue #3269.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I48f8ef47841123c451421c53ad68714eff26722c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21952


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
parent 6f3e2778
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -4046,6 +4046,21 @@ nvme_disk_create(struct spdk_bdev *disk, const char *base_name,
	if (opts && opts->io_queue_requests) {
		disk->max_num_segments = opts->io_queue_requests / 2;
	}
	if (spdk_nvme_ctrlr_get_flags(ctrlr) & SPDK_NVME_CTRLR_SGL_SUPPORTED) {
		/* The nvme driver will try to split I/O that have too many
		 * SGEs, but it doesn't work if that last SGE doesn't end on
		 * an aggregate total that is block aligned. The bdev layer has
		 * a more robust splitting framework, so use that instead for
		 * this case. (See issue #3269.)
		 */
		uint16_t max_sges = spdk_nvme_ctrlr_get_max_sges(ctrlr);

		if (disk->max_num_segments == 0) {
			disk->max_num_segments = max_sges;
		} else {
			disk->max_num_segments = spdk_min(disk->max_num_segments, max_sges);
		}
	}
	disk->optimal_io_boundary = spdk_nvme_ns_get_optimal_io_boundary(ns);

	nguid = spdk_nvme_ns_get_nguid(ns);
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ DEFINE_STUB_V(spdk_nvme_ctrlr_set_remove_cb, (struct spdk_nvme_ctrlr *ctrlr,
		spdk_nvme_remove_cb remove_cb, void *remove_ctx));

DEFINE_STUB(spdk_nvme_ctrlr_get_flags, uint64_t, (struct spdk_nvme_ctrlr *ctrlr), 0);
DEFINE_STUB(spdk_nvme_ctrlr_get_max_sges, uint16_t, (const struct spdk_nvme_ctrlr *ctrlr), 0);

DEFINE_STUB(accel_channel_create, int, (void *io_device, void *ctx_buf), 0);
DEFINE_STUB_V(accel_channel_destroy, (void *io_device, void *ctx_buf));