aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 14bff3fe56d4..ce6b75964b71 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,6 +292,14 @@ static inline unsigned bio_segments(struct bio *bio)
292 */ 292 */
293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
294 294
295enum bip_flags {
296 BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
297 BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
298 BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
299 BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
300 BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */
301};
302
295#if defined(CONFIG_BLK_DEV_INTEGRITY) 303#if defined(CONFIG_BLK_DEV_INTEGRITY)
296 304
297static inline struct bio_integrity_payload *bio_integrity(struct bio *bio) 305static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
@@ -323,13 +331,15 @@ struct bio_integrity_payload {
323 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ 331 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
324}; 332};
325 333
326enum bip_flags { 334static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
327 BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ 335{
328 BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */ 336 struct bio_integrity_payload *bip = bio_integrity(bio);
329 BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */ 337
330 BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */ 338 if (bip)
331 BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */ 339 return bip->bip_flags & flag;
332}; 340
341 return false;
342}
333 343
334static inline sector_t bip_get_seed(struct bio_integrity_payload *bip) 344static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
335{ 345{
@@ -701,9 +711,9 @@ extern void bio_integrity_init(void);
701 711
702#else /* CONFIG_BLK_DEV_INTEGRITY */ 712#else /* CONFIG_BLK_DEV_INTEGRITY */
703 713
704static inline int bio_integrity(struct bio *bio) 714static inline void *bio_integrity(struct bio *bio)
705{ 715{
706 return 0; 716 return NULL;
707} 717}
708 718
709static inline bool bio_integrity_enabled(struct bio *bio) 719static inline bool bio_integrity_enabled(struct bio *bio)
@@ -754,6 +764,11 @@ static inline void bio_integrity_init(void)
754 return; 764 return;
755} 765}
756 766
767static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
768{
769 return false;
770}
771
757#endif /* CONFIG_BLK_DEV_INTEGRITY */ 772#endif /* CONFIG_BLK_DEV_INTEGRITY */
758 773
759#endif /* CONFIG_BLOCK */ 774#endif /* CONFIG_BLOCK */