summaryrefslogtreecommitdiffstats
path: root/block/blk-wbt.h
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-05-09 11:08:47 +0200
committerJens Axboe <axboe@kernel.dk>2018-05-09 16:33:00 +0200
commit934031a12980511c020acf7d91f9035e34d0b5b8 (patch)
tree510dde2e8e992a1a7bf4f112de5e2a419ceab823 /block/blk-wbt.h
parentblk-wbt: throttle discards like background writes (diff)
downloadlinux-934031a12980511c020acf7d91f9035e34d0b5b8.tar.xz
linux-934031a12980511c020acf7d91f9035e34d0b5b8.zip
block: move some wbt helpers to blk-wbt.c
A few helpers are only used from blk-wbt.c, so move them there, and put wbt_track() behind the CONFIG_BLK_WBT typedef. This is in preparation for changing how the wbt flags are tracked. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-wbt.h')
-rw-r--r--block/blk-wbt.h33
1 files changed, 8 insertions, 25 deletions
diff --git a/block/blk-wbt.h b/block/blk-wbt.h
index d6a125e49db5..5bdae205e5df 100644
--- a/block/blk-wbt.h
+++ b/block/blk-wbt.h
@@ -35,31 +35,6 @@ enum {
WBT_STATE_ON_MANUAL = 2,
};
-static inline void wbt_clear_state(struct blk_issue_stat *stat)
-{
- stat->stat &= ~BLK_STAT_RES_MASK;
-}
-
-static inline enum wbt_flags wbt_stat_to_mask(struct blk_issue_stat *stat)
-{
- return (stat->stat & BLK_STAT_RES_MASK) >> BLK_STAT_RES_SHIFT;
-}
-
-static inline void wbt_track(struct blk_issue_stat *stat, enum wbt_flags wb_acct)
-{
- stat->stat |= ((u64) wb_acct) << BLK_STAT_RES_SHIFT;
-}
-
-static inline bool wbt_is_tracked(struct blk_issue_stat *stat)
-{
- return (stat->stat >> BLK_STAT_RES_SHIFT) & WBT_TRACKED;
-}
-
-static inline bool wbt_is_read(struct blk_issue_stat *stat)
-{
- return (stat->stat >> BLK_STAT_RES_SHIFT) & WBT_READ;
-}
-
struct rq_wait {
wait_queue_head_t wait;
atomic_t inflight;
@@ -113,6 +88,11 @@ static inline unsigned int wbt_inflight(struct rq_wb *rwb)
#ifdef CONFIG_BLK_WBT
+static inline void wbt_track(struct blk_issue_stat *stat, enum wbt_flags flags)
+{
+ stat->stat |= ((u64)flags) << BLK_STAT_RES_SHIFT;
+}
+
void __wbt_done(struct rq_wb *, enum wbt_flags);
void wbt_done(struct rq_wb *, struct blk_issue_stat *);
enum wbt_flags wbt_wait(struct rq_wb *, struct bio *, spinlock_t *);
@@ -131,6 +111,9 @@ u64 wbt_default_latency_nsec(struct request_queue *);
#else
+static inline void wbt_track(struct blk_issue_stat *stat, enum wbt_flags flags)
+{
+}
static inline void __wbt_done(struct rq_wb *rwb, enum wbt_flags flags)
{
}