aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2008-06-30 14:04:41 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-07-03 07:21:13 -0400
commit7ba1ba12eeef0aa7113beb16410ef8b7c748e18b (patch)
tree4629aabe88bf095d58eabd2f451207695bb35b08 /block/blk-core.c
parent51d654e1d885607a6edd02b337105fa5c28b6d33 (diff)
block: Block layer data integrity support
Some block devices support verifying the integrity of requests by way of checksums or other protection information that is submitted along with the I/O. This patch implements support for generating and verifying integrity metadata, as well as correctly merging, splitting and cloning bios and requests that have this extra information attached. See Documentation/block/data-integrity.txt for more information. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 1905aaba49fb..e0fb0bcc0c17 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -143,6 +143,10 @@ static void req_bio_endio(struct request *rq, struct bio *bio,
143 143
144 bio->bi_size -= nbytes; 144 bio->bi_size -= nbytes;
145 bio->bi_sector += (nbytes >> 9); 145 bio->bi_sector += (nbytes >> 9);
146
147 if (bio_integrity(bio))
148 bio_integrity_advance(bio, nbytes);
149
146 if (bio->bi_size == 0) 150 if (bio->bi_size == 0)
147 bio_endio(bio, error); 151 bio_endio(bio, error);
148 } else { 152 } else {
@@ -1381,6 +1385,9 @@ end_io:
1381 */ 1385 */
1382 blk_partition_remap(bio); 1386 blk_partition_remap(bio);
1383 1387
1388 if (bio_integrity_enabled(bio) && bio_integrity_prep(bio))
1389 goto end_io;
1390
1384 if (old_sector != -1) 1391 if (old_sector != -1)
1385 blk_add_trace_remap(q, bio, old_dev, bio->bi_sector, 1392 blk_add_trace_remap(q, bio, old_dev, bio->bi_sector,
1386 old_sector); 1393 old_sector);