]> www.infradead.org Git - users/hch/block.git/commitdiff
block: correctly report cache type
authorChristoph Hellwig <hch@lst.de>
Tue, 25 Jun 2024 07:07:13 +0000 (09:07 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 25 Jun 2024 08:54:12 +0000 (10:54 +0200)
Check the features flag and the override flag, 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>
block/blk-sysfs.c

index 1a984179f3acc5c19f1698ac0fb204709177cba4..6db65886e7ed5a2c3c8be1842fb93bcdacd37530 100644 (file)
@@ -453,7 +453,8 @@ 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)
+       if (!(q->limits.features & BLK_FEAT_WRITE_CACHE) ||
+           (q->limits.flags & BLK_FLAG_WRITE_CACHE_DISABLED))
                return sprintf(page, "write through\n");
        return sprintf(page, "write back\n");
 }