bdev: Move bdev_ch_retry_io up in file
This simplifies changes in next patches Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Change-Id: Icc51ed55153dc55a210395bfa92969932c80207e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11164 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
parent
fbed59665c
commit
44f337e3ce
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
|
||||
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* Copyright (c) 2021, 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -966,6 +966,40 @@ spdk_bdev_io_put_aux_buf(struct spdk_bdev_io *bdev_io, void *buf)
|
||||
_bdev_io_put_buf(bdev_io, buf, len);
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch)
|
||||
{
|
||||
struct spdk_bdev *bdev = bdev_ch->bdev;
|
||||
struct spdk_bdev_shared_resource *shared_resource = bdev_ch->shared_resource;
|
||||
struct spdk_bdev_io *bdev_io;
|
||||
|
||||
if (shared_resource->io_outstanding > shared_resource->nomem_threshold) {
|
||||
/*
|
||||
* Allow some more I/O to complete before retrying the nomem_io queue.
|
||||
* Some drivers (such as nvme) cannot immediately take a new I/O in
|
||||
* the context of a completion, because the resources for the I/O are
|
||||
* not released until control returns to the bdev poller. Also, we
|
||||
* may require several small I/O to complete before a larger I/O
|
||||
* (that requires splitting) can be submitted.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
while (!TAILQ_EMPTY(&shared_resource->nomem_io)) {
|
||||
bdev_io = TAILQ_FIRST(&shared_resource->nomem_io);
|
||||
TAILQ_REMOVE(&shared_resource->nomem_io, bdev_io, internal.link);
|
||||
bdev_io->internal.ch->io_outstanding++;
|
||||
shared_resource->io_outstanding++;
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
|
||||
bdev_io->internal.error.nvme.cdw0 = 0;
|
||||
bdev_io->num_retries++;
|
||||
bdev->fn_table->submit_request(spdk_bdev_io_get_io_channel(bdev_io), bdev_io);
|
||||
if (bdev_io->internal.status == SPDK_BDEV_IO_STATUS_NOMEM) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_bdev_io_unset_bounce_buf(struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
@ -5298,40 +5332,6 @@ spdk_bdev_queue_io_wait(struct spdk_bdev *bdev, struct spdk_io_channel *ch,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch)
|
||||
{
|
||||
struct spdk_bdev *bdev = bdev_ch->bdev;
|
||||
struct spdk_bdev_shared_resource *shared_resource = bdev_ch->shared_resource;
|
||||
struct spdk_bdev_io *bdev_io;
|
||||
|
||||
if (shared_resource->io_outstanding > shared_resource->nomem_threshold) {
|
||||
/*
|
||||
* Allow some more I/O to complete before retrying the nomem_io queue.
|
||||
* Some drivers (such as nvme) cannot immediately take a new I/O in
|
||||
* the context of a completion, because the resources for the I/O are
|
||||
* not released until control returns to the bdev poller. Also, we
|
||||
* may require several small I/O to complete before a larger I/O
|
||||
* (that requires splitting) can be submitted.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
while (!TAILQ_EMPTY(&shared_resource->nomem_io)) {
|
||||
bdev_io = TAILQ_FIRST(&shared_resource->nomem_io);
|
||||
TAILQ_REMOVE(&shared_resource->nomem_io, bdev_io, internal.link);
|
||||
bdev_io->internal.ch->io_outstanding++;
|
||||
shared_resource->io_outstanding++;
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
|
||||
bdev_io->internal.error.nvme.cdw0 = 0;
|
||||
bdev_io->num_retries++;
|
||||
bdev->fn_table->submit_request(spdk_bdev_io_get_io_channel(bdev_io), bdev_io);
|
||||
if (bdev_io->internal.status == SPDK_BDEV_IO_STATUS_NOMEM) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
bdev_io_complete(void *ctx)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user