Whamcloud - gitweb
LU-10472 osc: add T10PI support for RPC checksum
[fs/lustre-release.git] / lustre / include / lustre_compat.h
index 158bbb3..a94ff13 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/bio.h>
 #include <linux/xattr.h>
 #include <linux/workqueue.h>
+#include <linux/blkdev.h>
 
 #include <libcfs/linux/linux-fs.h>
 #include <lustre_patchless_compat.h>
@@ -697,4 +698,24 @@ static inline struct timespec current_time(struct inode *inode)
 #define READ_ONCE ACCESS_ONCE
 #endif
 
+static inline unsigned short blk_integrity_interval(struct blk_integrity *bi)
+{
+#ifdef HAVE_INTERVAL_EXP_BLK_INTEGRITY
+       return bi->interval_exp ? 1 << bi->interval_exp : 0;
+#elif defined(HAVE_INTERVAL_BLK_INTEGRITY)
+       return bi->interval;
+#else
+       return bi->sector_size;
+#endif
+}
+
+static inline const char *blk_integrity_name(struct blk_integrity *bi)
+{
+#ifdef HAVE_INTERVAL_EXP_BLK_INTEGRITY
+       return bi->profile->name;
+#else
+       return bi->name;
+#endif
+}
+
 #endif /* _LUSTRE_COMPAT_H */