Commit 6e2401ad6f33de15ff00f78b88159f00a14f3b35

Authored by Jens Axboe
1 parent da9cbc8739

block: integrity cleanups

- No need to check for NULL bio, we'll get an immediate oops anyway.
- Make bio_integrity() a proper function.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 2 changed files with 8 additions and 5 deletions Side-by-side Diff

... ... @@ -458,7 +458,14 @@
458 458 #define bip_for_each_vec(bvl, bip, i) \
459 459 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
460 460  
461   -#define bio_integrity(bio) ((bio)->bi_integrity ? 1 : 0)
  461 +static inline int bio_integrity(struct bio *bio)
  462 +{
  463 +#if defined(CONFIG_BLK_DEV_INTEGRITY)
  464 + return bio->bi_integrity != NULL;
  465 +#else
  466 + return 0;
  467 +#endif
  468 +}
462 469  
463 470 extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
464 471 extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
include/linux/blkdev.h
... ... @@ -860,7 +860,6 @@
860 860 #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
861 861 MODULE_ALIAS("block-major-" __stringify(major) "-*")
862 862  
863   -
864 863 #if defined(CONFIG_BLK_DEV_INTEGRITY)
865 864  
866 865 #define INTEGRITY_FLAG_READ 1 /* verify data integrity on read */
... ... @@ -945,8 +944,6 @@
945 944  
946 945 static inline int blk_integrity_rq(struct request *rq)
947 946 {
948   - BUG_ON(rq->bio == NULL);
949   -
950 947 return bio_integrity(rq->bio);
951 948 }
952 949  
... ... @@ -962,7 +959,6 @@
962 959 #define blk_integrity_unregister(a) do { } while (0);
963 960  
964 961 #endif /* CONFIG_BLK_DEV_INTEGRITY */
965   -
966 962  
967 963 #else /* CONFIG_BLOCK */
968 964 /*