bdev/qos: add the QoS parameters for the bdev channel

This patch adds the QoS parameters on the bdev channel.

Change-Id: I0cb9bf9e9cdbbe61c70c4a3df4eeb8be774793a0
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/393129
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
GangCao 2017-12-27 21:18:12 -05:00 committed by Jim Harris
parent b94155c853
commit 5d9d13a95c

View File

@ -55,12 +55,13 @@
int __itt_init_ittlib(const char *, __itt_group_id); int __itt_init_ittlib(const char *, __itt_group_id);
#endif #endif
#define SPDK_BDEV_IO_POOL_SIZE (64 * 1024) #define SPDK_BDEV_IO_POOL_SIZE (64 * 1024)
#define SPDK_BDEV_IO_CACHE_SIZE 256 #define SPDK_BDEV_IO_CACHE_SIZE 256
#define BUF_SMALL_POOL_SIZE 8192 #define BUF_SMALL_POOL_SIZE 8192
#define BUF_LARGE_POOL_SIZE 1024 #define BUF_LARGE_POOL_SIZE 1024
#define NOMEM_THRESHOLD_COUNT 8 #define NOMEM_THRESHOLD_COUNT 8
#define ZERO_BUFFER_SIZE 0x100000 #define ZERO_BUFFER_SIZE 0x100000
#define SPDK_BDEV_QOS_TIMESLICE_IN_US 1000
typedef TAILQ_HEAD(, spdk_bdev_io) bdev_io_tailq_t; typedef TAILQ_HEAD(, spdk_bdev_io) bdev_io_tailq_t;
typedef STAILQ_HEAD(, spdk_bdev_io) bdev_io_stailq_t; typedef STAILQ_HEAD(, spdk_bdev_io) bdev_io_stailq_t;
@ -134,7 +135,7 @@ struct spdk_bdev_channel {
struct spdk_io_channel *channel; struct spdk_io_channel *channel;
/* Channel for the bdev manager */ /* Channel for the bdev manager */
struct spdk_io_channel *mgmt_channel; struct spdk_io_channel *mgmt_channel;
struct spdk_bdev_io_stat stat; struct spdk_bdev_io_stat stat;
@ -142,6 +143,32 @@ struct spdk_bdev_channel {
uint32_t flags; uint32_t flags;
/*
* Rate limiting on this channel.
* Queue of IO awaiting issue because of a QoS rate limiting happened
* on this channel.
*/
bdev_io_tailq_t qos_io;
/*
* Rate limiting on this channel.
* Maximum allowed IOs to be issued in one timeslice (e.g., 1ms) and
* only valid for the master channel which manages the outstanding IOs.
*/
uint64_t qos_max_ios_per_timeslice;
/*
* Rate limiting on this channel.
* Submitted IO in one timeslice (e.g., 1ms)
*/
uint64_t io_submitted_this_timeslice;
/*
* Rate limiting on this channel.
* Periodic running QoS poller in millisecond.
*/
struct spdk_poller *qos_poller;
/* Per-device channel */ /* Per-device channel */
struct spdk_bdev_module_channel *module_ch; struct spdk_bdev_module_channel *module_ch;
@ -914,6 +941,10 @@ _spdk_bdev_channel_create(struct spdk_bdev_channel *ch, void *io_device)
memset(&ch->stat, 0, sizeof(ch->stat)); memset(&ch->stat, 0, sizeof(ch->stat));
TAILQ_INIT(&ch->queued_resets); TAILQ_INIT(&ch->queued_resets);
TAILQ_INIT(&ch->qos_io);
ch->qos_max_ios_per_timeslice = 0;
ch->io_submitted_this_timeslice = 0;
ch->qos_poller = NULL;
ch->flags = 0; ch->flags = 0;
ch->module_ch = shared_ch; ch->module_ch = shared_ch;
@ -1034,6 +1065,7 @@ _spdk_bdev_channel_destroy(struct spdk_bdev_channel *ch)
mgmt_channel = spdk_io_channel_get_ctx(ch->mgmt_channel); mgmt_channel = spdk_io_channel_get_ctx(ch->mgmt_channel);
_spdk_bdev_abort_queued_io(&ch->queued_resets, ch); _spdk_bdev_abort_queued_io(&ch->queued_resets, ch);
_spdk_bdev_abort_queued_io(&ch->qos_io, ch);
_spdk_bdev_abort_queued_io(&shared_ch->nomem_io, ch); _spdk_bdev_abort_queued_io(&shared_ch->nomem_io, ch);
_spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_small, ch); _spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_small, ch);
_spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_large, ch); _spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_large, ch);
@ -1622,6 +1654,7 @@ _spdk_bdev_reset_freeze_channel(struct spdk_io_channel_iter *i)
channel->flags |= BDEV_CH_RESET_IN_PROGRESS; channel->flags |= BDEV_CH_RESET_IN_PROGRESS;
_spdk_bdev_abort_queued_io(&shared_ch->nomem_io, channel); _spdk_bdev_abort_queued_io(&shared_ch->nomem_io, channel);
_spdk_bdev_abort_queued_io(&channel->qos_io, channel);
_spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_small, channel); _spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_small, channel);
_spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_large, channel); _spdk_bdev_abort_buf_io(&mgmt_channel->need_buf_large, channel);