Skip to content

Commit c2a9c7a

Browse files
asjkdave
authored andcommitted
btrfs: check if the device is flush capable
The block layer call chain from submit_bio will check if the write cache is enabled for the given queue before submitting the flush. This will add a code to fail fast if its not. Signed-off-by: Anand Jain <[email protected]> Reviewed-by: David Sterba <[email protected]> [ updated changelog to reflect current code stat, blkdev_issue_flush is not used yet ] Signed-off-by: David Sterba <[email protected]>
1 parent 13e88e1 commit c2a9c7a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/btrfs/disk-io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,9 +3518,13 @@ static void btrfs_end_empty_barrier(struct bio *bio)
35183518
*/
35193519
static int write_dev_flush(struct btrfs_device *device, int wait)
35203520
{
3521+
struct request_queue *q = bdev_get_queue(device->bdev);
35213522
struct bio *bio;
35223523
int ret = 0;
35233524

3525+
if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
3526+
return 0;
3527+
35243528
if (wait) {
35253529
bio = device->flush_bio;
35263530
if (!bio)

0 commit comments

Comments
 (0)