bdev/qos: Factor out check for QoS limits into a helper function
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com> Change-Id: I139f78bb6fc2ccfce871c1f6a81dd1e25c51a826 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13766 Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
c682c78992
commit
f79af9ab19
@ -2164,13 +2164,11 @@ bdev_io_do_submit(struct spdk_bdev_channel *bdev_ch, struct spdk_bdev_io *bdev_i
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
bdev_qos_io_submit(struct spdk_bdev_channel *ch, struct spdk_bdev_qos *qos)
|
||||
static bool
|
||||
bdev_qos_queue_io(struct spdk_bdev_qos *qos, struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io = NULL, *tmp = NULL;
|
||||
int i, submitted_ios = 0;
|
||||
int i;
|
||||
|
||||
TAILQ_FOREACH_SAFE(bdev_io, &qos->queued, internal.link, tmp) {
|
||||
if (bdev_qos_io_to_limit(bdev_io) == true) {
|
||||
for (i = 0; i < SPDK_BDEV_QOS_NUM_RATE_LIMIT_TYPES; i++) {
|
||||
if (!qos->rate_limits[i].queue_io) {
|
||||
@ -2179,7 +2177,7 @@ bdev_qos_io_submit(struct spdk_bdev_channel *ch, struct spdk_bdev_qos *qos)
|
||||
|
||||
if (qos->rate_limits[i].queue_io(&qos->rate_limits[i],
|
||||
bdev_io) == true) {
|
||||
return submitted_ios;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < SPDK_BDEV_QOS_NUM_RATE_LIMIT_TYPES; i++) {
|
||||
@ -2191,6 +2189,20 @@ bdev_qos_io_submit(struct spdk_bdev_channel *ch, struct spdk_bdev_qos *qos)
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
bdev_qos_io_submit(struct spdk_bdev_channel *ch, struct spdk_bdev_qos *qos)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io = NULL, *tmp = NULL;
|
||||
int submitted_ios = 0;
|
||||
|
||||
TAILQ_FOREACH_SAFE(bdev_io, &qos->queued, internal.link, tmp) {
|
||||
if (bdev_qos_queue_io(qos, bdev_io)) {
|
||||
return submitted_ios;
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&qos->queued, bdev_io, internal.link);
|
||||
bdev_io_do_submit(ch, bdev_io);
|
||||
submitted_ios++;
|
||||
|
Loading…
Reference in New Issue
Block a user