diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2009-04-09 01:27:12 +0200 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-04-09 01:27:12 +0200 |
commit | 9c47008d13add50ec4597a8b9eee200c515282c8 (patch) | |
tree | debd8ebb2fef2687d4548a177505ec30bda95503 /drivers/md/dm.c | |
parent | Linux 2.6.30-rc1 (diff) | |
download | linux-9c47008d13add50ec4597a8b9eee200c515282c8.tar.xz linux-9c47008d13add50ec4597a8b9eee200c515282c8.zip |
dm: add integrity support
This patch provides support for data integrity passthrough in the device
mapper.
- If one or more component devices support integrity an integrity
profile is preallocated for the DM device.
- If all component devices have compatible profiles the DM device is
flagged as capable.
- Handle integrity metadata when splitting and cloning bios.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/md/dm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 788ba96a6256..25d86e2c01f2 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -700,6 +700,12 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector, clone->bi_io_vec->bv_len = clone->bi_size; clone->bi_flags |= 1 << BIO_CLONED; + if (bio_integrity(bio)) { + bio_integrity_clone(clone, bio, GFP_NOIO); + bio_integrity_trim(clone, + bio_sector_offset(bio, idx, offset), len); + } + return clone; } @@ -721,6 +727,14 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector, clone->bi_size = to_bytes(len); clone->bi_flags &= ~(1 << BIO_SEG_VALID); + if (bio_integrity(bio)) { + bio_integrity_clone(clone, bio, GFP_NOIO); + + if (idx != bio->bi_idx || clone->bi_size < bio->bi_size) + bio_integrity_trim(clone, + bio_sector_offset(bio, idx, 0), len); + } + return clone; } @@ -1193,6 +1207,7 @@ static void free_dev(struct mapped_device *md) mempool_destroy(md->tio_pool); mempool_destroy(md->io_pool); bioset_free(md->bs); + blk_integrity_unregister(md->disk); del_gendisk(md->disk); free_minor(minor); |