The blkdev_issue_flush() will check if the write cache is enabled
before submitting the flush. This will add a code to fail fast if
its not.

Signed-off-by: Anand Jain <[email protected]>
---
v1:
  This patch will replace
  [PATCH] btrfs: delete unused member nobarriers

v2:
  - This patch will now _not_ replace the below patch and this patch
  should be applied on top of it.
    [PATCH] btrfs: delete unused member nobarriers
  That's because, Q wc flag is not static, so we can't save its
  state into nobarries.
  - commit log is updated.

 fs/btrfs/disk-io.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b6d047250ce2..bb5816c7f5c4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3517,6 +3517,11 @@ static void btrfs_dev_issue_flush(struct work_struct 
*work)
  */
 static int write_dev_flush(struct btrfs_device *device, int wait)
 {
+       struct request_queue *q = bdev_get_queue(device->bdev);
+
+       if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
+               return 0;
+
        if (wait) {
                int ret;
 
-- 
2.10.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to