bdev: save mgmt_ch that spdk_bdev_io was allocated from
This avoids having to dereference the spdk_bdev_io's channel in the spdk_bdev_free_io() path. Cleaning up after hotplug events should ensure that all associated bdev_ios have been freed (not just completed) before the bdev channels have been freed, but this patch gives us some more wiggle room in this area. Results in a small (1-2%) performance degradation on a bdevperf microbenchmark, but should result in no noticeable difference on any real world workload. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Id8b88300fc53e8c0b83309a738a4c3bd2aeaff52 Reviewed-on: https://review.gerrithub.io/394399 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
cd31a31f03
commit
b5f4a259bd
@ -274,6 +274,9 @@ struct spdk_bdev_io {
|
||||
/** The bdev I/O channel that this was submitted on. */
|
||||
struct spdk_bdev_channel *ch;
|
||||
|
||||
/** The mgmt channel that this I/O was allocated from. */
|
||||
struct spdk_bdev_mgmt_channel *mgmt_ch;
|
||||
|
||||
/** bdev allocated memory associated with this request */
|
||||
void *buf;
|
||||
|
||||
|
@ -283,7 +283,7 @@ spdk_bdev_io_put_buf(struct spdk_bdev_io *bdev_io)
|
||||
assert(bdev_io->u.bdev.iovcnt == 1);
|
||||
|
||||
buf = bdev_io->buf;
|
||||
ch = spdk_io_channel_get_ctx(bdev_io->ch->mgmt_channel);
|
||||
ch = bdev_io->mgmt_ch;
|
||||
|
||||
if (bdev_io->buf_len <= SPDK_BDEV_SMALL_BUF_MAX_SIZE) {
|
||||
pool = g_bdev_mgr.buf_small_pool;
|
||||
@ -754,13 +754,15 @@ spdk_bdev_get_io(struct spdk_io_channel *_ch)
|
||||
}
|
||||
}
|
||||
|
||||
bdev_io->mgmt_ch = ch;
|
||||
|
||||
return bdev_io;
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_bdev_put_io(struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
struct spdk_bdev_mgmt_channel *ch = spdk_io_channel_get_ctx(bdev_io->ch->mgmt_channel);
|
||||
struct spdk_bdev_mgmt_channel *ch = bdev_io->mgmt_ch;
|
||||
|
||||
if (bdev_io->buf != NULL) {
|
||||
spdk_bdev_io_put_buf(bdev_io);
|
||||
|
Loading…
Reference in New Issue
Block a user