Skip to content

Commit 78887d0

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: correctly report cache type
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: 1122c0c ("block: move cache control settings out of queue->flags") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 573d5ab commit 78887d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

block/blk-sysfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,
453453

454454
static ssize_t queue_wc_show(struct request_queue *q, char *page)
455455
{
456-
if (q->limits.features & BLK_FLAG_WRITE_CACHE_DISABLED)
457-
return sprintf(page, "write through\n");
458-
return sprintf(page, "write back\n");
456+
if (blk_queue_write_cache(q))
457+
return sprintf(page, "write back\n");
458+
return sprintf(page, "write through\n");
459459
}
460460

461461
static ssize_t queue_wc_store(struct request_queue *q, const char *page,

0 commit comments

Comments
 (0)