bdev: count per-bdev outstanding I/O
Patch 583a24a4 [1] moved io_outstanding field to the bdev_module_channel as it was needed there. This patch re-adds another io_outstanding field to the bdev_channel. We *do* want to count outstanding I/O for particular bdevs - mostly for debug purposes. [1] 583a24a4 ("bdev: share nomem_io data between bdevs built on the same device") Change-Id: I723e72c36447f9f778f88fc1769619676cbbaf71 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/396871 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
a1ee118769
commit
09fb50530e
@ -142,6 +142,12 @@ struct spdk_bdev_channel {
|
||||
|
||||
struct spdk_bdev_io_stat stat;
|
||||
|
||||
/*
|
||||
* Count of I/O submitted through this channel and waiting for completion.
|
||||
* Incremented before submit_request() is called on an spdk_bdev_io.
|
||||
*/
|
||||
uint64_t io_outstanding;
|
||||
|
||||
bdev_io_tailq_t queued_resets;
|
||||
|
||||
uint32_t flags;
|
||||
@ -861,12 +867,14 @@ _spdk_bdev_io_submit(void *ctx)
|
||||
struct spdk_bdev_module_channel *shared_ch = bdev_ch->module_ch;
|
||||
|
||||
bdev_io->submit_tsc = spdk_get_ticks();
|
||||
bdev_ch->io_outstanding++;
|
||||
shared_ch->io_outstanding++;
|
||||
bdev_io->in_submit_request = true;
|
||||
if (spdk_likely(bdev_ch->flags == 0)) {
|
||||
if (spdk_likely(TAILQ_EMPTY(&shared_ch->nomem_io))) {
|
||||
bdev->fn_table->submit_request(ch, bdev_io);
|
||||
} else {
|
||||
bdev_ch->io_outstanding--;
|
||||
shared_ch->io_outstanding--;
|
||||
TAILQ_INSERT_TAIL(&shared_ch->nomem_io, bdev_io, link);
|
||||
}
|
||||
@ -1011,6 +1019,7 @@ _spdk_bdev_channel_create(struct spdk_bdev_channel *ch, void *io_device)
|
||||
}
|
||||
|
||||
memset(&ch->stat, 0, sizeof(ch->stat));
|
||||
ch->io_outstanding = 0;
|
||||
TAILQ_INIT(&ch->queued_resets);
|
||||
TAILQ_INIT(&ch->qos_io);
|
||||
ch->qos_max_ios_per_timeslice = 0;
|
||||
@ -1039,6 +1048,7 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
|
||||
if (ch->mgmt_channel) {
|
||||
shared_ch = ch->module_ch;
|
||||
if (shared_ch) {
|
||||
assert(ch->io_outstanding == 0);
|
||||
assert(shared_ch->ref > 0);
|
||||
shared_ch->ref--;
|
||||
if (shared_ch->ref == 0) {
|
||||
@ -1177,6 +1187,7 @@ _spdk_bdev_abort_queued_io(bdev_io_tailq_t *queue, struct spdk_bdev_channel *ch)
|
||||
* that spdk_bdev_io_complete() will do.
|
||||
*/
|
||||
if (bdev_io->type != SPDK_BDEV_IO_TYPE_RESET) {
|
||||
ch->io_outstanding++;
|
||||
ch->module_ch->io_outstanding++;
|
||||
}
|
||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||
@ -2052,6 +2063,7 @@ _spdk_bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch)
|
||||
while (!TAILQ_EMPTY(&shared_ch->nomem_io)) {
|
||||
bdev_io = TAILQ_FIRST(&shared_ch->nomem_io);
|
||||
TAILQ_REMOVE(&shared_ch->nomem_io, bdev_io, link);
|
||||
bdev_io->ch->io_outstanding++;
|
||||
shared_ch->io_outstanding++;
|
||||
bdev_io->status = SPDK_BDEV_IO_STATUS_PENDING;
|
||||
bdev->fn_table->submit_request(bdev_io->ch->channel, bdev_io);
|
||||
@ -2147,7 +2159,9 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
assert(bdev_ch->io_outstanding > 0);
|
||||
assert(shared_ch->io_outstanding > 0);
|
||||
bdev_ch->io_outstanding--;
|
||||
shared_ch->io_outstanding--;
|
||||
|
||||
if (spdk_unlikely(status == SPDK_BDEV_IO_STATUS_NOMEM)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user