bdev: add _bdev_io_increment_outstanding()

In the next patches we'll need to increment the io_outstanding from a
few more places, so it'll be good to have a dedicated function for that.
Also, move _bdev_io_decrement_outstanding() up, so that both functions
are near each other.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I1af5dbe288f7f701c8ba5e85406f02330ae21a39
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17759
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Konrad Sztyber 2023-04-24 12:14:10 +02:00 committed by David Ko
parent 444d4e8c35
commit 1280245cb2

View File

@ -1017,6 +1017,24 @@ bdev_io_needs_sequence_exec(struct spdk_bdev_desc *desc, struct spdk_bdev_io *bd
return !desc->accel_sequence_supported[bdev_io->type] || bdev_io->internal.split;
}
static inline void
_bdev_io_increment_outstanding(struct spdk_bdev_channel *bdev_ch,
struct spdk_bdev_shared_resource *shared_resource)
{
bdev_ch->io_outstanding++;
shared_resource->io_outstanding++;
}
static inline void
_bdev_io_decrement_outstanding(struct spdk_bdev_channel *bdev_ch,
struct spdk_bdev_shared_resource *shared_resource)
{
assert(bdev_ch->io_outstanding > 0);
assert(shared_resource->io_outstanding > 0);
bdev_ch->io_outstanding--;
shared_resource->io_outstanding--;
}
static void
bdev_io_submit_sequence_cb(void *ctx, int status)
{
@ -1375,10 +1393,8 @@ static inline void
bdev_ch_resubmit_io(struct spdk_bdev_channel *bdev_ch, struct spdk_bdev_io *bdev_io)
{
struct spdk_bdev *bdev = bdev_ch->bdev;
struct spdk_bdev_shared_resource *shared_resource = bdev_ch->shared_resource;
bdev_io->internal.ch->io_outstanding++;
shared_resource->io_outstanding++;
_bdev_io_increment_outstanding(bdev_io->internal.ch, bdev_ch->shared_resource);
bdev_io->internal.error.nvme.cdw0 = 0;
bdev_io->num_retries++;
bdev_submit_request(bdev, spdk_bdev_io_get_io_channel(bdev_io), bdev_io);
@ -1426,16 +1442,6 @@ bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch)
}
}
static inline void
_bdev_io_decrement_outstanding(struct spdk_bdev_channel *bdev_ch,
struct spdk_bdev_shared_resource *shared_resource)
{
assert(bdev_ch->io_outstanding > 0);
assert(shared_resource->io_outstanding > 0);
bdev_ch->io_outstanding--;
shared_resource->io_outstanding--;
}
static inline bool
_bdev_io_handle_no_mem(struct spdk_bdev_io *bdev_io, enum bdev_io_retry_state state)
{