.release = blk_release_queue,
};
-static void blk_wb_stat_get(void *data, struct blk_rq_stat *stat)
-{
- blk_queue_stat_get(data, stat);
-}
-
-static void blk_wb_stat_clear(void *data)
-{
- blk_stat_clear(data);
-}
-
-static bool blk_wb_stat_is_current(struct blk_rq_stat *stat)
-{
- return blk_stat_is_current(stat);
-}
-
-static struct wb_stat_ops wb_stat_ops = {
- .get = blk_wb_stat_get,
- .is_current = blk_wb_stat_is_current,
- .clear = blk_wb_stat_clear,
-};
-
static void blk_wb_init(struct request_queue *q)
{
#ifndef CONFIG_BLK_WBT_MQ
/*
* If this fails, we don't get throttling
*/
- wbt_init(q, &wb_stat_ops);
+ wbt_init(q);
}
int blk_register_queue(struct gendisk *disk)
* waited or still has writes in flights, consider us doing
* just writes as well.
*/
- if ((stat[1].nr_samples && rwb->stat_ops->is_current(stat)) ||
+ if ((stat[1].nr_samples && blk_stat_is_current(stat)) ||
wb_recent_wait(rwb) || wbt_inflight(rwb))
return LAT_UNKNOWN_WRITES;
return LAT_UNKNOWN;
{
struct blk_rq_stat stat[2];
- rwb->stat_ops->get(rwb->ops_data, stat);
+ blk_queue_stat_get(rwb->queue, stat);
return __latency_exceeded(rwb, stat);
}
rwb->scale_step--;
rwb->unknown_cnt = 0;
- rwb->stat_ops->clear(rwb->ops_data);
+ blk_stat_clear(rwb->queue);
rwb->scaled_max = calc_wb_limits(rwb);
rwb->scaled_max = false;
rwb->unknown_cnt = 0;
- rwb->stat_ops->clear(rwb->ops_data);
+ blk_stat_clear(rwb->queue);
calc_wb_limits(rwb);
rwb_trace_step(rwb, "step down");
}
}
EXPORT_SYMBOL_GPL(wbt_disable);
-int wbt_init(struct request_queue *q, struct wb_stat_ops *ops)
+int wbt_init(struct request_queue *q)
{
struct rq_wb *rwb;
int i;
BUILD_BUG_ON(RWB_WINDOW_NSEC > BLK_STAT_NSEC);
BUILD_BUG_ON(WBT_NR_BITS > BLK_STAT_RES_BITS);
- if (!ops->get || !ops->is_current || !ops->clear)
- return -EINVAL;
-
rwb = kzalloc(sizeof(*rwb), GFP_KERNEL);
if (!rwb)
return -ENOMEM;
rwb->last_comp = rwb->last_issue = jiffies;
rwb->queue = q;
rwb->win_nsec = RWB_WINDOW_NSEC;
- rwb->stat_ops = ops;
- rwb->ops_data = q;
wbt_update_limits(rwb);
/*
return (stat->time >> BLK_STAT_SHIFT) & WBT_READ;
}
-struct wb_stat_ops {
- void (*get)(void *, struct blk_rq_stat *);
- bool (*is_current)(struct blk_rq_stat *);
- void (*clear)(void *);
-};
-
struct rq_wait {
wait_queue_head_t wait;
atomic_t inflight;
unsigned long min_lat_nsec;
struct request_queue *queue;
struct rq_wait rq_wait[WBT_NUM_RWQ];
-
- struct wb_stat_ops *stat_ops;
- void *ops_data;
};
static inline unsigned int wbt_inflight(struct rq_wb *rwb)
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 *);
-int wbt_init(struct request_queue *, struct wb_stat_ops *);
+int wbt_init(struct request_queue *);
void wbt_exit(struct request_queue *);
void wbt_update_limits(struct rq_wb *);
void wbt_requeue(struct rq_wb *, struct blk_issue_stat *);
{
return 0;
}
-static inline int wbt_init(struct request_queue *q, struct wb_stat_ops *ops)
+static inline int wbt_init(struct request_queue *q)
{
return -EINVAL;
}