block: add a bdev_write_cache helper
Add a helper to check the write cache flag based on the block_device instead of having to poke into the block layer internal request_queue. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: David Sterba <dsterba@suse.com> [btrfs] Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20220415045258.199825-13-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
10f0d2a517
commit
08e688fdb8
5 changed files with 10 additions and 10 deletions
|
|
@ -1331,6 +1331,11 @@ static inline bool bdev_nonrot(struct block_device *bdev)
|
|||
return blk_queue_nonrot(bdev_get_queue(bdev));
|
||||
}
|
||||
|
||||
static inline bool bdev_write_cache(struct block_device *bdev)
|
||||
{
|
||||
return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
|
||||
}
|
||||
|
||||
static inline enum blk_zoned_model bdev_zoned_model(struct block_device *bdev)
|
||||
{
|
||||
struct request_queue *q = bdev_get_queue(bdev);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue