diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2009-04-08 19:27:12 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-04-08 19:27:12 -0400 |
commit | 9c47008d13add50ec4597a8b9eee200c515282c8 (patch) | |
tree | debd8ebb2fef2687d4548a177505ec30bda95503 /drivers/md/dm.c | |
parent | 577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff) |
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 'drivers/md/dm.c')
-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, | |||
700 | clone->bi_io_vec->bv_len = clone->bi_size; | 700 | clone->bi_io_vec->bv_len = clone->bi_size; |
701 | clone->bi_flags |= 1 << BIO_CLONED; | 701 | clone->bi_flags |= 1 << BIO_CLONED; |
702 | 702 | ||
703 | if (bio_integrity(bio)) { | ||
704 | bio_integrity_clone(clone, bio, GFP_NOIO); | ||
705 | bio_integrity_trim(clone, | ||
706 | bio_sector_offset(bio, idx, offset), len); | ||
707 | } | ||
708 | |||
703 | return clone; | 709 | return clone; |
704 | } | 710 | } |
705 | 711 | ||
@@ -721,6 +727,14 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector, | |||
721 | clone->bi_size = to_bytes(len); | 727 | clone->bi_size = to_bytes(len); |
722 | clone->bi_flags &= ~(1 << BIO_SEG_VALID); | 728 | clone->bi_flags &= ~(1 << BIO_SEG_VALID); |
723 | 729 | ||
730 | if (bio_integrity(bio)) { | ||
731 | bio_integrity_clone(clone, bio, GFP_NOIO); | ||
732 | |||
733 | if (idx != bio->bi_idx || clone->bi_size < bio->bi_size) | ||
734 | bio_integrity_trim(clone, | ||
735 | bio_sector_offset(bio, idx, 0), len); | ||
736 | } | ||
737 | |||
724 | return clone; | 738 | return clone; |
725 | } | 739 | } |
726 | 740 | ||
@@ -1193,6 +1207,7 @@ static void free_dev(struct mapped_device *md) | |||
1193 | mempool_destroy(md->tio_pool); | 1207 | mempool_destroy(md->tio_pool); |
1194 | mempool_destroy(md->io_pool); | 1208 | mempool_destroy(md->io_pool); |
1195 | bioset_free(md->bs); | 1209 | bioset_free(md->bs); |
1210 | blk_integrity_unregister(md->disk); | ||
1196 | del_gendisk(md->disk); | 1211 | del_gendisk(md->disk); |
1197 | free_minor(minor); | 1212 | free_minor(minor); |
1198 | 1213 | ||