From: Christoph Hellwig Date: Fri, 17 Jul 2020 10:03:49 +0000 (+0200) Subject: blk-wbt: use the write cache flag from the queue X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fbdi-cleanup;p=users%2Fhch%2Fblock.git blk-wbt: use the write cache flag from the queue There is no good reason to duplicate the write cache information, given that the queue is easily available and used in other places close to this code. Signed-off-by: Christoph Hellwig --- diff --git a/block/blk-settings.c b/block/blk-settings.c index 9a2c23cd9700..c54d420800df 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -789,8 +789,6 @@ void blk_queue_write_cache(struct request_queue *q, bool wc, bool fua) blk_queue_flag_set(QUEUE_FLAG_FUA, q); else blk_queue_flag_clear(QUEUE_FLAG_FUA, q); - - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); } EXPORT_SYMBOL_GPL(blk_queue_write_cache); diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 0fa615eefd52..0aff2da16074 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -147,7 +147,8 @@ static void wbt_rqw_done(struct rq_wb *rwb, struct rq_wait *rqw, */ if (wb_acct & WBT_DISCARD) limit = rwb->wb_background; - else if (rwb->wc && !wb_recent_wait(rwb)) + else if (test_bit(QUEUE_FLAG_WC, &rwb->rqos.q->queue_flags) && + !wb_recent_wait(rwb)) limit = 0; else limit = rwb->wb_normal; @@ -623,13 +624,6 @@ static void wbt_requeue(struct rq_qos *rqos, struct request *rq) } } -void wbt_set_write_cache(struct request_queue *q, bool write_cache_on) -{ - struct rq_qos *rqos = wbt_rq_qos(q); - if (rqos) - RQWB(rqos)->wc = write_cache_on; -} - /* * Enable wbt if defaults are configured that way */ @@ -833,7 +827,6 @@ int wbt_init(struct request_queue *q) rwb->last_comp = rwb->last_issue = jiffies; rwb->win_nsec = RWB_WINDOW_NSEC; rwb->enable_state = WBT_STATE_ON_DEFAULT; - rwb->wc = 1; rwb->rq_depth.default_depth = RWB_DEF_DEPTH; wbt_update_limits(rwb); @@ -846,7 +839,5 @@ int wbt_init(struct request_queue *q) rwb->min_lat_nsec = wbt_default_latency_nsec(q); wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); - return 0; } diff --git a/block/blk-wbt.h b/block/blk-wbt.h index 16bdc85b8df9..85af931a53a4 100644 --- a/block/blk-wbt.h +++ b/block/blk-wbt.h @@ -59,8 +59,6 @@ struct rq_wb { u64 sync_issue; void *sync_cookie; - unsigned int wc; - unsigned long last_issue; /* last non-throttled issue */ unsigned long last_comp; /* last non-throttled comp */ unsigned long min_lat_nsec; @@ -94,8 +92,6 @@ void wbt_enable_default(struct request_queue *); u64 wbt_get_min_lat(struct request_queue *q); void wbt_set_min_lat(struct request_queue *q, u64 val); -void wbt_set_write_cache(struct request_queue *, bool); - u64 wbt_default_latency_nsec(struct request_queue *); #else @@ -113,9 +109,6 @@ static inline void wbt_disable_default(struct request_queue *q) static inline void wbt_enable_default(struct request_queue *q) { } -static inline void wbt_set_write_cache(struct request_queue *q, bool wc) -{ -} static inline u64 wbt_get_min_lat(struct request_queue *q) { return 0;