diff mbox series

[2/8] block: correctly report cache type

Message ID 20240626142637.300624-3-hch@lst.de (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [1/8] md: set md-specific flags for all queue limits | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_11-PR fail merge-conflict

Commit Message

Christoph Hellwig June 26, 2024, 2:26 p.m. UTC
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>
---
 block/blk-sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

John Garry June 26, 2024, 2:30 p.m. UTC | #1
On 26/06/2024 15:26, Christoph Hellwig wrote:
> 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>
diff mbox series

Patch

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 1a984179f3acc5..3a167abecdceae 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -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,