#define READ_ONCE ACCESS_ONCE
#endif
-#ifdef HAVE_BLK_INTEGRITY_ENABLED
+#if IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)
static inline unsigned short blk_integrity_interval(struct blk_integrity *bi)
{
#ifdef HAVE_INTERVAL_EXP_BLK_INTEGRITY
return bi->interval;
#else
return bi->sector_size;
-#endif
+#endif /* !HAVE_INTERVAL_EXP_BLK_INTEGRITY */
}
static inline const char *blk_integrity_name(struct blk_integrity *bi)
return bi->name;
#endif
}
+
+static inline unsigned int bip_size(struct bio_integrity_payload *bip)
+{
+#ifdef HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
+ return bip->bip_iter.bi_size;
#else
+ return bip->bip_size;
+#endif
+}
+#else /* !CONFIG_BLK_DEV_INTEGRITY */
static inline unsigned short blk_integrity_interval(struct blk_integrity *bi)
{
return 0;
/* gcc8 dislikes when strcmp() is called against NULL */
return "";
}
-#endif
+#endif /* !CONFIG_BLK_DEV_INTEGRITY */
-static inline unsigned int bip_size(struct bio_integrity_payload *bip)
-{
-#ifdef HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
- return bip->bip_iter.bi_size;
-#else
- return bip->bip_size;
-#endif
-}
-
-#ifdef HAVE_BLK_INTEGRITY_ENABLED
#ifndef INTEGRITY_FLAG_READ
#define INTEGRITY_FLAG_READ BLK_INTEGRITY_VERIFY
#endif
static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw)
{
+#if IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)
struct blk_integrity *bi = bdev_get_integrity(bdev);
if (bi == NULL)
if (rw == 1 && bi->generate_fn != NULL &&
(bi->flags & INTEGRITY_FLAG_WRITE))
return true;
-#endif
+#endif /* !HAVE_INTERVAL_EXP_BLK_INTEGRITY */
+#endif /* !CONFIG_BLK_DEV_INTEGRITY */
return false;
}
-#else
-static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw)
-{
- return false;
-}
-#endif /* HAVE_BLK_INTEGRITY_ENABLED */
#ifdef HAVE_PAGEVEC_INIT_ONE_PARAM
#define ll_pagevec_init(pvec, n) pagevec_init(pvec)