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:
parent
3a228b6c75
commit
4a3bf3a942
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user