Commit 4a3bf3a9 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

lib/ftl: use user's iovec instead of copying it



There's no need to copy user's iovec, as it's bound to be valid until
request's completion.  Storing a pointer to user's iovec is both faster
and simplifies the IO allocation path.

Change-Id: Ia5b37fcbc230edac6f52989c8ef09655af8ec178
Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/897


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarMaciej Szczepaniak <maciej.szczepaniak@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 3a228b6c
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -294,6 +294,7 @@ ftl_io_init_internal(const struct ftl_io_init_opts *opts)
	io->rwb_batch = opts->rwb_batch;
	io->band = opts->band;
	io->md = opts->md;
	io->iov = &io->iov_buf[0];

	if (parent) {
		if (parent->flags & FTL_IO_VECTOR_LBA) {
@@ -406,11 +407,9 @@ ftl_io_user_init(struct spdk_io_channel *_ioch, uint64_t lba, size_t num_blocks,
	ftl_io_init(io, dev, _ftl_user_cb, cb_ctx, 0, type);
	io->lba.single = lba;
	io->user_fn = cb_fn;

	if (ftl_io_init_iovec(io, iov, iov_cnt, num_blocks)) {
		ftl_io_free(io);
		return NULL;
	}
	io->iov = iov;
	io->iov_cnt = iov_cnt;
	io->num_blocks = num_blocks;

	ftl_trace_lba_io_init(io->dev, io);
	return io;
+5 −1
Original line number Diff line number Diff line
@@ -167,7 +167,11 @@ struct ftl_io {
	/* Number of blocks */
	size_t					num_blocks;

	struct iovec				iov[FTL_IO_MAX_IOVEC];
	/* IO vector pointer */
	struct iovec				*iov;

	/* IO vector buffer for internal requests */
	struct iovec				iov_buf[FTL_IO_MAX_IOVEC];

	/* Metadata */
	void					*md;