two small integrity cleanups
Subsystems (2)
Found these while coming up with the fixes just sent.
PATCH 1/2 bio-integrity: move the bio integrity profile check earlier in bio_integrity_prep
This makes the code more obvious, and moves the most likely branch first in the function.
Signed-off-by Christoph Hellwig <[email protected]>
--- block/bio-integrity.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
block/bio-integrity.c +3 -3
@@ -246,6 +246,9 @@ bool bio_integrity_prep(struct bio *bio)blk_status_t status; bi =bdev_get_integrity (bio->bi_bdev); +if (!bi) +return true; + q =bdev_get_queue (bio->bi_bdev);if (bio_op (bio) !=REQ_OP_READ &&bio_op (bio) !=REQ_OP_WRITE )return true;
@@ -257,9 +260,6 @@ bool bio_integrity_prep(struct bio *bio)if (bio_integrity (bio))return true; -if (bi ==NULL ) -return true; -if (bio_data_dir (bio) ==READ ) {if (!bi->profile->verify_fn || !(bi->flags &BLK_INTEGRITY_VERIFY ))
Signature · 1 line
2.11.0
PATCH 2/2 dm-crypt: don't mess with BIP_BLOCK_INTEGRITY
In reply to Christoph HellwigThis flag is never set right after calling bio_integrity_alloc, so don't clear it and confuse the reader.
Signed-off-by Christoph Hellwig <[email protected]>
--- drivers/md/dm-crypt.c | 3 --- 1 file changed, 3 deletions(-)
drivers/md/dm-crypt.c +0 -3
@@ -933,9 +933,6 @@ static int dm_crypt_integrity_io_alloc(struct dm_crypt_io *io, struct bio *bio) bip->bip_iter.bi_size = tag_len; bip->bip_iter.bi_sector = io->cc->start + io->sector; -/* We own the metadata, do not let bio_free to release it */ - bip->bip_flags &= ~BIP_BLOCK_INTEGRITY ; - ret =bio_integrity_add_page (bio,virt_to_page (io->integrity_metadata), tag_len,offset_in_page (io->integrity_metadata));if (unlikely (ret != tag_len))
Signature · 1 line
2.11.0
Jens Axboe
maintainerQuoted 1 line · Christoph Hellwig
Found these while coming up with the fixes just sent.
Added for 4.14.
Signature · 1 line
Jens Axboe
Martin K. Petersen
Reviewed-byChristoph,
Quoted 1 line
Found these while coming up with the fixes just sent.
Also OK.
Reviewed-by Martin K. Petersen <[email protected]>
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering