bdev: pass mgmt_channel to spdk_bdev_get_io()

This prepares for some upcoming changes which will
add a per-thread bdev_io cache.

While here, remove spdk_bdev_get_io() from the
internal bdev API.  This function is not meant
to be called outside of bdev.c.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9f764a88a079fac936931c46d615999454013732

Reviewed-on: https://review.gerrithub.io/392529
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2017-12-20 08:29:52 -07:00
parent 45697d33ff
commit f1f14e5583
2 changed files with 13 additions and 14 deletions

View File

@ -412,7 +412,6 @@ void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev);
*/ */
void spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb, uint64_t len); void spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb, uint64_t len);
struct spdk_bdev_io *spdk_bdev_get_io(void);
void spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, void spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io,
enum spdk_bdev_io_status status); enum spdk_bdev_io_status status);

View File

@ -641,8 +641,8 @@ spdk_bdev_finish(spdk_bdev_fini_cb cb_fn, void *cb_arg)
spdk_bdev_module_finish_iter(NULL); spdk_bdev_module_finish_iter(NULL);
} }
struct spdk_bdev_io * static struct spdk_bdev_io *
spdk_bdev_get_io(void) spdk_bdev_get_io(struct spdk_io_channel *_ch)
{ {
struct spdk_bdev_io *bdev_io; struct spdk_bdev_io *bdev_io;
@ -956,7 +956,7 @@ spdk_bdev_read_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("spdk_bdev_io memory allocation failed duing read\n"); SPDK_ERRLOG("spdk_bdev_io memory allocation failed duing read\n");
return -ENOMEM; return -ENOMEM;
@ -1004,7 +1004,7 @@ int spdk_bdev_readv_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("spdk_bdev_io memory allocation failed duing read\n"); SPDK_ERRLOG("spdk_bdev_io memory allocation failed duing read\n");
return -ENOMEM; return -ENOMEM;
@ -1053,7 +1053,7 @@ spdk_bdev_write_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed duing write\n"); SPDK_ERRLOG("bdev_io memory allocation failed duing write\n");
return -ENOMEM; return -ENOMEM;
@ -1106,7 +1106,7 @@ spdk_bdev_writev_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed duing writev\n"); SPDK_ERRLOG("bdev_io memory allocation failed duing writev\n");
return -ENOMEM; return -ENOMEM;
@ -1158,7 +1158,7 @@ spdk_bdev_write_zeroes_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channe
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed duing write_zeroes\n"); SPDK_ERRLOG("bdev_io memory allocation failed duing write_zeroes\n");
@ -1240,7 +1240,7 @@ spdk_bdev_unmap_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed duing unmap\n"); SPDK_ERRLOG("bdev_io memory allocation failed duing unmap\n");
return -ENOMEM; return -ENOMEM;
@ -1291,7 +1291,7 @@ spdk_bdev_flush_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
return -EINVAL; return -EINVAL;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed duing flush\n"); SPDK_ERRLOG("bdev_io memory allocation failed duing flush\n");
return -ENOMEM; return -ENOMEM;
@ -1380,7 +1380,7 @@ spdk_bdev_reset(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
struct spdk_bdev_io *bdev_io; struct spdk_bdev_io *bdev_io;
struct spdk_bdev_channel *channel = spdk_io_channel_get_ctx(ch); struct spdk_bdev_channel *channel = spdk_io_channel_get_ctx(ch);
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed duing reset\n"); SPDK_ERRLOG("bdev_io memory allocation failed duing reset\n");
return -ENOMEM; return -ENOMEM;
@ -1429,7 +1429,7 @@ spdk_bdev_nvme_admin_passthru(struct spdk_bdev_desc *desc, struct spdk_io_channe
return -EBADF; return -EBADF;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed during nvme_admin_passthru\n"); SPDK_ERRLOG("bdev_io memory allocation failed during nvme_admin_passthru\n");
return -ENOMEM; return -ENOMEM;
@ -1467,7 +1467,7 @@ spdk_bdev_nvme_io_passthru(struct spdk_bdev_desc *desc, struct spdk_io_channel *
return -EBADF; return -EBADF;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed during nvme_admin_passthru\n"); SPDK_ERRLOG("bdev_io memory allocation failed during nvme_admin_passthru\n");
return -ENOMEM; return -ENOMEM;
@ -1505,7 +1505,7 @@ spdk_bdev_nvme_io_passthru_md(struct spdk_bdev_desc *desc, struct spdk_io_channe
return -EBADF; return -EBADF;
} }
bdev_io = spdk_bdev_get_io(); bdev_io = spdk_bdev_get_io(channel->mgmt_channel);
if (!bdev_io) { if (!bdev_io) {
SPDK_ERRLOG("bdev_io memory allocation failed during nvme_admin_passthru\n"); SPDK_ERRLOG("bdev_io memory allocation failed during nvme_admin_passthru\n");
return -ENOMEM; return -ENOMEM;