summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2017-04-06 11:22:53 +0800
committerDavid Sterba <dsterba@suse.com>2017-04-18 16:13:27 +0200
commitc2a9c7ab475bc3aaf06521a39ac65bc48c8cad4f (patch)
treef605531dbf3f58c262ddeec51239619b044696d3 /fs/btrfs/disk-io.c
parent13e88e1560d6014838e2dd9f8b9cf8ec9a8d86e6 (diff)
downloadop-kernel-dev-c2a9c7ab475bc3aaf06521a39ac65bc48c8cad4f.zip
op-kernel-dev-c2a9c7ab475bc3aaf06521a39ac65bc48c8cad4f.tar.gz
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 <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> [ updated changelog to reflect current code stat, blkdev_issue_flush is not used yet ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e070e46..ba7bd65 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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)
OpenPOWER on IntegriCloud