block: correctly report cache type
authorChristoph Hellwig <hch@lst.de>
Wed, 26 Jun 2024 14:26:23 +0000 (16:26 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 26 Jun 2024 15:37:35 +0000 (09:37 -0600)
Check the features flag and the override flag using the
blk_queue_write_cache, helper otherwise we're going to always
report "write through".

Fixes: 1122c0c1cc71 ("block: move cache control settings out of queue->flags")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240626142637.300624-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c

index 1a984179f3acc5c19f1698ac0fb204709177cba4..3a167abecdceae92aeaae8e9b7430d4775ba2364 100644 (file)
@@ -453,9 +453,9 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,
 
 static ssize_t queue_wc_show(struct request_queue *q, char *page)
 {
-       if (q->limits.features & BLK_FLAG_WRITE_CACHE_DISABLED)
-               return sprintf(page, "write through\n");
-       return sprintf(page, "write back\n");
+       if (blk_queue_write_cache(q))
+               return sprintf(page, "write back\n");
+       return sprintf(page, "write through\n");
 }
 
 static ssize_t queue_wc_store(struct request_queue *q, const char *page,