]> www.infradead.org Git - users/hch/block.git/commitdiff
blk-wbt: use the write cache flag from the queue bdi-cleanup
authorChristoph Hellwig <hch@lst.de>
Fri, 17 Jul 2020 10:03:49 +0000 (12:03 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 17 Jul 2020 12:21:15 +0000 (14:21 +0200)
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 <hch@lst.de>
block/blk-settings.c
block/blk-wbt.c
block/blk-wbt.h

index 9a2c23cd97007355154316c40a92297af2e94acc..c54d420800dfe26aa7a7b7e9e38cf2a7bb037796 100644 (file)
@@ -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);
 
index 0fa615eefd52639cc25490d9534310f27b1f5da7..0aff2da160741eb046d4291d6364a4f5edfb6155 100644 (file)
@@ -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;
 }
index 16bdc85b8df92eba6a94250d83fd0e3e7ab4a837..85af931a53a4d38c16130e1ef9c9ebdfe12cdfe8 100644 (file)
@@ -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;