aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-04-09 00:27:12 +0100
committerAlasdair G Kergon <agk@redhat.com>2009-04-09 00:27:12 +0100
commit9c47008d13add50ec4597a8b9eee200c515282c8 (patch)
treedebd8ebb2fef2687d4548a177505ec30bda95503 /drivers/md/dm.c
parent577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff)
downloadkernel_samsung_smdk4412-9c47008d13add50ec4597a8b9eee200c515282c8.zip
kernel_samsung_smdk4412-9c47008d13add50ec4597a8b9eee200c515282c8.tar.gz
kernel_samsung_smdk4412-9c47008d13add50ec4597a8b9eee200c515282c8.tar.bz2
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.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 788ba96..25d86e2 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);