summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-10-19 11:37:00 -0600
committerJens Axboe <axboe@kernel.dk>2017-10-19 11:37:00 -0600
commit16f1477ebeeef4170f1f16eb66ad565daecdc7a8 (patch)
tree657edf154f598bf303ec680a245d460779f50f9b
parent9974ae56e3da12c27d5ff55c54962c98397017f5 (diff)
blk-wbt: add wbt_any_inflight()
Some callsites care about the specific number of writes inflight, others only care if any writes are inflight or not. In preparation for increasing the number of wait buckets, add wbt_any_inflight() to avoid iterating and checking more buckets than we need. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-wbt.c23
-rw-r--r--block/blk-wbt.h10
2 files changed, 22 insertions, 11 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 1345935c7ee6..2512442873d4 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -277,6 +277,27 @@ enum {
LAT_EXCEEDED,
};
+static bool wbt_any_inflight(struct rq_wb *rwb)
+{
+ unsigned int i;
+
+ for (i = 0; i < WBT_NUM_RWQ; i++)
+ if (atomic_read(&rwb->rq_wait[i].inflight))
+ return true;
+
+ return false;
+}
+
+static unsigned int wbt_inflight(struct rq_wb *rwb)
+{
+ unsigned int i, ret = 0;
+
+ for (i = 0; i < WBT_NUM_RWQ; i++)
+ ret += atomic_read(&rwb->rq_wait[i].inflight);
+
+ return ret;
+}
+
static int latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat)
{
struct backing_dev_info *bdi = rwb->queue->backing_dev_info;
@@ -309,7 +330,7 @@ static int latency_exceeded(struct rq_wb *rwb, struct blk_rq_stat *stat)
* just writes as well.
*/
if (stat[WRITE].nr_samples || wb_recent_wait(rwb) ||
- wbt_inflight(rwb))
+ wbt_any_inflight(rwb))
return LAT_UNKNOWN_WRITES;
return LAT_UNKNOWN;
}
diff --git a/block/blk-wbt.h b/block/blk-wbt.h
index df6de50c5d59..e7c086374e20 100644
--- a/block/blk-wbt.h
+++ b/block/blk-wbt.h
@@ -96,16 +96,6 @@ struct rq_wb {
struct rq_wait rq_wait[WBT_NUM_RWQ];
};
-static inline unsigned int wbt_inflight(struct rq_wb *rwb)
-{
- unsigned int i, ret = 0;
-
- for (i = 0; i < WBT_NUM_RWQ; i++)
- ret += atomic_read(&rwb->rq_wait[i].inflight);
-
- return ret;
-}
-
#ifdef CONFIG_BLK_WBT
void __wbt_done(struct rq_wb *, enum wbt_flags);