diff options
author | Tejun Heo <tj@kernel.org> | 2010-09-03 05:56:19 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-10 06:35:38 -0400 |
commit | d87f4c14f27dc82d215108d8392a7d26687148a1 (patch) | |
tree | 55f2a81f3df5d70fd85c4428089f6fe28540bcf4 /drivers/md/dm-snap.c | |
parent | 3a2edd0d6ddbd5fa3b389ea6db811285415ce6c8 (diff) |
dm: implement REQ_FLUSH/FUA support for bio-based dm
This patch converts bio-based dm to support REQ_FLUSH/FUA instead of
now deprecated REQ_HARDBARRIER.
* -EOPNOTSUPP handling logic dropped.
* Preflush is handled as before but postflush is dropped and replaced
with passing down REQ_FUA to member request_queues. This replaces
one array wide cache flush w/ member specific FUA writes.
* __split_and_process_bio() now calls __clone_and_map_flush() directly
for flushes and guarantees all FLUSH bio's going to targets are zero
` length.
* It's now guaranteed that all FLUSH bio's which are passed onto dm
targets are zero length. bio_empty_barrier() tests are replaced
with REQ_FLUSH tests.
* Empty WRITE_BARRIERs are replaced with WRITE_FLUSHes.
* Dropped unlikely() around REQ_FLUSH tests. Flushes are not unlikely
enough to be marked with unlikely().
* Block layer now filters out REQ_FLUSH/FUA bio's if the request_queue
doesn't support cache flushing. Advertise REQ_FLUSH | REQ_FUA
capability.
* Request based dm isn't converted yet. dm_init_request_based_queue()
resets flush support to 0 for now. To avoid disturbing request
based dm code, dm->flush_error is added for bio based dm while
requested based dm continues to use dm->barrier_error.
Lightly tested linear, stripe, raid1, snap and crypt targets. Please
proceed with caution as I'm not familiar with the code base.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: dm-devel@redhat.com
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r-- | drivers/md/dm-snap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 5974d3094d97..eed210152b75 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -1587,7 +1587,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio, | |||
1587 | chunk_t chunk; | 1587 | chunk_t chunk; |
1588 | struct dm_snap_pending_exception *pe = NULL; | 1588 | struct dm_snap_pending_exception *pe = NULL; |
1589 | 1589 | ||
1590 | if (unlikely(bio_empty_barrier(bio))) { | 1590 | if (bio->bi_rw & REQ_FLUSH) { |
1591 | bio->bi_bdev = s->cow->bdev; | 1591 | bio->bi_bdev = s->cow->bdev; |
1592 | return DM_MAPIO_REMAPPED; | 1592 | return DM_MAPIO_REMAPPED; |
1593 | } | 1593 | } |
@@ -1691,7 +1691,7 @@ static int snapshot_merge_map(struct dm_target *ti, struct bio *bio, | |||
1691 | int r = DM_MAPIO_REMAPPED; | 1691 | int r = DM_MAPIO_REMAPPED; |
1692 | chunk_t chunk; | 1692 | chunk_t chunk; |
1693 | 1693 | ||
1694 | if (unlikely(bio_empty_barrier(bio))) { | 1694 | if (bio->bi_rw & REQ_FLUSH) { |
1695 | if (!map_context->target_request_nr) | 1695 | if (!map_context->target_request_nr) |
1696 | bio->bi_bdev = s->origin->bdev; | 1696 | bio->bi_bdev = s->origin->bdev; |
1697 | else | 1697 | else |
@@ -2135,7 +2135,7 @@ static int origin_map(struct dm_target *ti, struct bio *bio, | |||
2135 | struct dm_dev *dev = ti->private; | 2135 | struct dm_dev *dev = ti->private; |
2136 | bio->bi_bdev = dev->bdev; | 2136 | bio->bi_bdev = dev->bdev; |
2137 | 2137 | ||
2138 | if (unlikely(bio_empty_barrier(bio))) | 2138 | if (bio->bi_rw & REQ_FLUSH) |
2139 | return DM_MAPIO_REMAPPED; | 2139 | return DM_MAPIO_REMAPPED; |
2140 | 2140 | ||
2141 | /* Only tell snapshots if this is a write */ | 2141 | /* Only tell snapshots if this is a write */ |