From: Christoph Hellwig Date: Wed, 9 Aug 2017 15:48:08 +0000 (+0200) Subject: bio-integrity: move the bio integrity profile check earlier in bio_integrity_prep X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9346beb9d0ee3be5282bfcb9a33d974e62dd9b25;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Jens Axboe --- diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 83e92beb3c9f..5fa9a740fd99 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -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))