From e6bbe23277e6a310b974cd22bec7e39931b613ab Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Wed, 22 Aug 2018 16:51:50 -0700 Subject: [PATCH] util: Move definition of SPDK_SEC_TO_USEC to util.h This was defined in two places, so consolidate the definitions. Change-Id: I0bbb262b97e90d1064bcc50ee201928f6ca9518a Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/423182 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- include/spdk/util.h | 2 ++ lib/bdev/bdev.c | 5 ++--- lib/event/reactor.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/spdk/util.h b/include/spdk/util.h index f7a36a611..43d3b8d5b 100644 --- a/include/spdk/util.h +++ b/include/spdk/util.h @@ -51,6 +51,8 @@ extern "C" { #define SPDK_CONTAINEROF(ptr, type, member) ((type *)((uintptr_t)ptr - offsetof(type, member))) +#define SPDK_SEC_TO_USEC 1000000ULL + static inline uint32_t spdk_u32log2(uint32_t x) { diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 416d9c0be..fd9256f34 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -62,7 +62,6 @@ int __itt_init_ittlib(const char *, __itt_group_id); #define NOMEM_THRESHOLD_COUNT 8 #define ZERO_BUFFER_SIZE 0x100000 #define SPDK_BDEV_QOS_TIMESLICE_IN_USEC 1000 -#define SPDK_BDEV_SEC_TO_USEC 1000000ULL #define SPDK_BDEV_QOS_MIN_IO_PER_TIMESLICE 1 #define SPDK_BDEV_QOS_MIN_BYTE_PER_TIMESLICE 512 #define SPDK_BDEV_QOS_MIN_IOS_PER_SEC 10000 @@ -1416,14 +1415,14 @@ spdk_bdev_qos_update_max_quota_per_timeslice(struct spdk_bdev_qos *qos) if (qos->iops_rate_limit > 0) { max_ios_per_timeslice = qos->iops_rate_limit * SPDK_BDEV_QOS_TIMESLICE_IN_USEC / - SPDK_BDEV_SEC_TO_USEC; + SPDK_SEC_TO_USEC; qos->max_ios_per_timeslice = spdk_max(max_ios_per_timeslice, SPDK_BDEV_QOS_MIN_IO_PER_TIMESLICE); } if (qos->byte_rate_limit > 0) { max_byte_per_timeslice = qos->byte_rate_limit * SPDK_BDEV_QOS_TIMESLICE_IN_USEC / - SPDK_BDEV_SEC_TO_USEC; + SPDK_SEC_TO_USEC; qos->max_byte_per_timeslice = spdk_max(max_byte_per_timeslice, SPDK_BDEV_QOS_MIN_BYTE_PER_TIMESLICE); } diff --git a/lib/event/reactor.c b/lib/event/reactor.c index a8b55b334..4ecf65b83 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -46,7 +46,6 @@ #define SPDK_REACTOR_SPIN_TIME_USEC 1000 #define SPDK_EVENT_BATCH_SIZE 8 -#define SPDK_SEC_TO_USEC 1000000ULL enum spdk_poller_state { /* The poller is registered with a reactor but not currently executing its fn. */