Commit e675df2a authored by Baolin Wang's avatar Baolin Wang Committed by Jens Axboe

blk-throttle: Define readable macros instead of static variables

The 'throtl_grp_quantum' and 'throtl_quantum' are both read-only
variables, thus better to use readable macros instead of static
variables, which can also save some spaces for .bss area.
Signed-off-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ff8b22c0
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
#include "blk-cgroup-rwstat.h" #include "blk-cgroup-rwstat.h"
/* Max dispatch from a group in 1 round */ /* Max dispatch from a group in 1 round */
static int throtl_grp_quantum = 8; #define THROTL_GRP_QUANTUM 8
/* Total max dispatch from all groups in one round */ /* Total max dispatch from all groups in one round */
static int throtl_quantum = 32; #define THROTL_QUANTUM 32
/* Throttling is performed over a slice and after that slice is renewed */ /* Throttling is performed over a slice and after that slice is renewed */
#define DFL_THROTL_SLICE_HD (HZ / 10) #define DFL_THROTL_SLICE_HD (HZ / 10)
...@@ -1175,8 +1175,8 @@ static int throtl_dispatch_tg(struct throtl_grp *tg) ...@@ -1175,8 +1175,8 @@ static int throtl_dispatch_tg(struct throtl_grp *tg)
{ {
struct throtl_service_queue *sq = &tg->service_queue; struct throtl_service_queue *sq = &tg->service_queue;
unsigned int nr_reads = 0, nr_writes = 0; unsigned int nr_reads = 0, nr_writes = 0;
unsigned int max_nr_reads = throtl_grp_quantum*3/4; unsigned int max_nr_reads = THROTL_GRP_QUANTUM * 3 / 4;
unsigned int max_nr_writes = throtl_grp_quantum - max_nr_reads; unsigned int max_nr_writes = THROTL_GRP_QUANTUM - max_nr_reads;
struct bio *bio; struct bio *bio;
/* Try to dispatch 75% READS and 25% WRITES */ /* Try to dispatch 75% READS and 25% WRITES */
...@@ -1226,7 +1226,7 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq) ...@@ -1226,7 +1226,7 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
if (sq->nr_queued[0] || sq->nr_queued[1]) if (sq->nr_queued[0] || sq->nr_queued[1])
tg_update_disptime(tg); tg_update_disptime(tg);
if (nr_disp >= throtl_quantum) if (nr_disp >= THROTL_QUANTUM)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment