diff options
author | Christoph Hellwig <hch@lst.de> | 2017-08-09 11:48:08 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-08-09 12:00:29 -0400 |
commit | 9346beb9d0ee3be5282bfcb9a33d974e62dd9b25 (patch) | |
tree | 1115856c8a64082f87689569f70f01ad1ce91d04 /block/bio-integrity.c | |
parent | d424681cc9ebaaeac2b6af842d2f497ba7ccf349 (diff) |
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 <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio-integrity.c')
-rw-r--r-- | block/bio-integrity.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) | |||
246 | blk_status_t status; | 246 | blk_status_t status; |
247 | 247 | ||
248 | bi = bdev_get_integrity(bio->bi_bdev); | 248 | bi = bdev_get_integrity(bio->bi_bdev); |
249 | if (!bi) | ||
250 | return true; | ||
251 | |||
249 | q = bdev_get_queue(bio->bi_bdev); | 252 | q = bdev_get_queue(bio->bi_bdev); |
250 | if (bio_op(bio) != REQ_OP_READ && bio_op(bio) != REQ_OP_WRITE) | 253 | if (bio_op(bio) != REQ_OP_READ && bio_op(bio) != REQ_OP_WRITE) |
251 | return true; | 254 | return true; |
@@ -257,9 +260,6 @@ bool bio_integrity_prep(struct bio *bio) | |||
257 | if (bio_integrity(bio)) | 260 | if (bio_integrity(bio)) |
258 | return true; | 261 | return true; |
259 | 262 | ||
260 | if (bi == NULL) | ||
261 | return true; | ||
262 | |||
263 | if (bio_data_dir(bio) == READ) { | 263 | if (bio_data_dir(bio) == READ) { |
264 | if (!bi->profile->verify_fn || | 264 | if (!bi->profile->verify_fn || |
265 | !(bi->flags & BLK_INTEGRITY_VERIFY)) | 265 | !(bi->flags & BLK_INTEGRITY_VERIFY)) |