bdev: simplify spdk_bdev_free_io() flow
Because of the addition of io_channel support to the bdev layer, there is no longer a need to re-run a completed I/O through the submission event pipeline; it can be freed directly. Change-Id: I2b9163c87293345acf0e85f6d0c1032f30209659 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
4a95a81e69
commit
4600aaf68f
@ -411,32 +411,11 @@ spdk_bdev_cleanup_pending_rbuf_io(struct spdk_bdev *bdev)
|
|||||||
static void
|
static void
|
||||||
__submit_request(struct spdk_bdev *bdev, struct spdk_bdev_io *bdev_io)
|
__submit_request(struct spdk_bdev *bdev, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
if (bdev_io->status == SPDK_BDEV_IO_STATUS_PENDING) {
|
assert(bdev_io->status == SPDK_BDEV_IO_STATUS_PENDING);
|
||||||
if (bdev_io->type == SPDK_BDEV_IO_TYPE_RESET) {
|
if (bdev_io->type == SPDK_BDEV_IO_TYPE_RESET) {
|
||||||
spdk_bdev_cleanup_pending_rbuf_io(bdev);
|
spdk_bdev_cleanup_pending_rbuf_io(bdev);
|
||||||
}
|
|
||||||
bdev->fn_table->submit_request(bdev_io);
|
|
||||||
} else {
|
|
||||||
struct spdk_bdev_io *child_io, *tmp;
|
|
||||||
|
|
||||||
TAILQ_FOREACH_SAFE(child_io, &bdev_io->child_io, link, tmp) {
|
|
||||||
/*
|
|
||||||
* Make sure no references to the parent I/O remain, since it is being
|
|
||||||
* returned to the free pool.
|
|
||||||
*/
|
|
||||||
child_io->parent = NULL;
|
|
||||||
TAILQ_REMOVE(&bdev_io->child_io, child_io, link);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Child I/O may have an rbuf that needs to be returned to a pool
|
|
||||||
* on a different core, so free it through the request submission
|
|
||||||
* process rather than calling put_io directly here.
|
|
||||||
*/
|
|
||||||
spdk_bdev_free_io(child_io);
|
|
||||||
}
|
|
||||||
|
|
||||||
spdk_bdev_put_io(bdev_io);
|
|
||||||
}
|
}
|
||||||
|
bdev->fn_table->submit_request(bdev_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -786,7 +765,7 @@ spdk_bdev_reset(struct spdk_bdev *bdev, enum spdk_bdev_reset_type reset_type,
|
|||||||
int
|
int
|
||||||
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
|
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
int rc;
|
struct spdk_bdev_io *child_io, *tmp;
|
||||||
|
|
||||||
if (!bdev_io) {
|
if (!bdev_io) {
|
||||||
SPDK_ERRLOG("bdev_io is NULL\n");
|
SPDK_ERRLOG("bdev_io is NULL\n");
|
||||||
@ -798,13 +777,25 @@ spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = spdk_bdev_io_submit(bdev_io);
|
TAILQ_FOREACH_SAFE(child_io, &bdev_io->child_io, link, tmp) {
|
||||||
if (rc < 0) {
|
/*
|
||||||
spdk_bdev_put_io(bdev_io);
|
* Make sure no references to the parent I/O remain, since it is being
|
||||||
SPDK_ERRLOG("free_request failure\n");
|
* returned to the free pool.
|
||||||
|
*/
|
||||||
|
child_io->parent = NULL;
|
||||||
|
TAILQ_REMOVE(&bdev_io->child_io, child_io, link);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Child I/O may have an rbuf that needs to be returned to a pool
|
||||||
|
* on a different core, so free it through the request submission
|
||||||
|
* process rather than calling put_io directly here.
|
||||||
|
*/
|
||||||
|
spdk_bdev_free_io(child_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
spdk_bdev_put_io(bdev_io);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user