Skip to content

Commit

Permalink
bcache: Advertise that flushes are supported
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kent Overstreet committed Jul 12, 2013
1 parent d2a65ce commit 54d12f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/md/bcache/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions drivers/md/bcache/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 54d12f2

Please sign in to comment.