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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/897
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szczepaniak <maciej.szczepaniak@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2020-01-21 13:30:30 +01:00 committed by Tomasz Zawadzki
parent 3a228b6c75
commit 4a3bf3a942
2 changed files with 9 additions and 6 deletions

View File

@ -294,6 +294,7 @@ ftl_io_init_internal(const struct ftl_io_init_opts *opts)
io->rwb_batch = opts->rwb_batch; io->rwb_batch = opts->rwb_batch;
io->band = opts->band; io->band = opts->band;
io->md = opts->md; io->md = opts->md;
io->iov = &io->iov_buf[0];
if (parent) { if (parent) {
if (parent->flags & FTL_IO_VECTOR_LBA) { 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); ftl_io_init(io, dev, _ftl_user_cb, cb_ctx, 0, type);
io->lba.single = lba; io->lba.single = lba;
io->user_fn = cb_fn; io->user_fn = cb_fn;
io->iov = iov;
if (ftl_io_init_iovec(io, iov, iov_cnt, num_blocks)) { io->iov_cnt = iov_cnt;
ftl_io_free(io); io->num_blocks = num_blocks;
return NULL;
}
ftl_trace_lba_io_init(io->dev, io); ftl_trace_lba_io_init(io->dev, io);
return io; return io;

View File

@ -167,7 +167,11 @@ struct ftl_io {
/* Number of blocks */ /* Number of blocks */
size_t num_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 */ /* Metadata */
void *md; void *md;