Skip to content

Commit

Permalink
btrfs: check if the device is flush capable
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
asj authored and kdave committed Apr 18, 2017
1 parent 13e88e1 commit c2a9c7a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3518,9 +3518,13 @@ static void btrfs_end_empty_barrier(struct bio *bio)
*/
static int write_dev_flush(struct btrfs_device *device, int wait)
{
struct request_queue *q = bdev_get_queue(device->bdev);
struct bio *bio;
int ret = 0;

if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
return 0;

if (wait) {
bio = device->flush_bio;
if (!bio)
Expand Down

0 comments on commit c2a9c7a

Please sign in to comment.