]> git.karo-electronics.de Git - linux-beck.git/commitdiff
bcache: Advertise that flushes are supported
authorKent Overstreet <kmo@daterainc.com>
Thu, 11 Jul 2013 01:44:40 +0000 (18:44 -0700)
committerKent Overstreet <kmo@daterainc.com>
Fri, 12 Jul 2013 07:22:46 +0000 (00:22 -0700)
Whoops - bcache's flush/FUA was mostly correct, but flushes get filtered
out unless we say we support them...

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: linux-stable <stable@vger.kernel.org> # >= v3.10
drivers/md/bcache/request.c
drivers/md/bcache/super.c

index b6e74d3c8faf9403ce6c4ee47495b309db1497f5..786a1a4f74d853fafe3ab2ae263d2ecf780134aa 100644 (file)
@@ -488,6 +488,12 @@ static void bch_insert_data_loop(struct closure *cl)
                bch_queue_gc(op->c);
        }
 
+       /*
+        * Journal writes are marked REQ_FLUSH; if the original write was a
+        * flush, it'll wait on the journal write.
+        */
+       bio->bi_rw &= ~(REQ_FLUSH|REQ_FUA);
+
        do {
                unsigned i;
                struct bkey *k;
@@ -710,7 +716,7 @@ static struct search *search_alloc(struct bio *bio, struct bcache_device *d)
        s->task                 = current;
        s->orig_bio             = bio;
        s->write                = (bio->bi_rw & REQ_WRITE) != 0;
-       s->op.flush_journal     = (bio->bi_rw & REQ_FLUSH) != 0;
+       s->op.flush_journal     = (bio->bi_rw & (REQ_FLUSH|REQ_FUA)) != 0;
        s->op.skip              = (bio->bi_rw & REQ_DISCARD) != 0;
        s->recoverable          = 1;
        s->start_time           = jiffies;
index cff2d182dfb0fb357871a65230614517b2eb9fc0..728fdc673f31bdf2c3837d62ba82b1ec9903aef0 100644 (file)
@@ -806,6 +806,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
        set_bit(QUEUE_FLAG_NONROT,      &d->disk->queue->queue_flags);
        set_bit(QUEUE_FLAG_DISCARD,     &d->disk->queue->queue_flags);
 
+       blk_queue_flush(q, REQ_FLUSH|REQ_FUA);
+
        return 0;
 }