aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-09-03 05:56:17 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-09-10 06:35:37 -0400
commit1e87901e189c8f01750d67485009fe3827c691bf (patch)
tree13a8378830f866aff8461fb47ddfed207c8d2bd2 /block
parent4fed947cb311e5aa51781d316cefca836352f6ce (diff)
block: filter flush bio's in __generic_make_request()
There are a number of make_request based drivers which don't support cache flushes. Filter out flush bio's in __generic_make_request() so that they don't have to worry about them. All FLUSH/FUA requests with data are converted to regular IO requests and empty ones are completed immediately. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 18455c4f618a..495bdc4a23da 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1509,6 +1509,19 @@ static inline void __generic_make_request(struct bio *bio)
1509 if (bio_check_eod(bio, nr_sectors)) 1509 if (bio_check_eod(bio, nr_sectors))
1510 goto end_io; 1510 goto end_io;
1511 1511
1512 /*
1513 * Filter flush bio's early so that make_request based
1514 * drivers without flush support don't have to worry
1515 * about them.
1516 */
1517 if ((bio->bi_rw & (REQ_FLUSH | REQ_FUA)) && !q->flush_flags) {
1518 bio->bi_rw &= ~(REQ_FLUSH | REQ_FUA);
1519 if (!nr_sectors) {
1520 err = 0;
1521 goto end_io;
1522 }
1523 }
1524
1512 if ((bio->bi_rw & REQ_DISCARD) && 1525 if ((bio->bi_rw & REQ_DISCARD) &&
1513 (!blk_queue_discard(q) || 1526 (!blk_queue_discard(q) ||
1514 ((bio->bi_rw & REQ_SECURE) && 1527 ((bio->bi_rw & REQ_SECURE) &&