Whamcloud - gitweb
Revert "LU-11058 test: reenable sanity 77k test"
[fs/lustre-release.git] / lustre / include / lustre_compat.h
index 3b42151..7ca150b 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>
@@ -81,12 +82,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
                path_put(&old_pwd);
 }
 
-/*
- * set ATTR_BLOCKS to a high value to avoid any risk of collision with other
- * ATTR_* attributes (see bug 13828)
- */
-#define ATTR_BLOCKS    (1 << 27)
-
 #define current_ngroups current_cred()->group_info->ngroups
 #define current_groups current_cred()->group_info->small_block
 
@@ -693,4 +688,40 @@ static inline struct timespec current_time(struct inode *inode)
 #define alloc_workqueue(name, flags, max_active) create_workqueue(name)
 #endif
 
+#ifndef READ_ONCE
+#define READ_ONCE ACCESS_ONCE
+#endif
+
+#ifdef HAVE_BLK_INTEGRITY_ENABLED
+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
+}
+#else
+static inline unsigned short blk_integrity_interval(struct blk_integrity *bi)
+{
+       return 0;
+}
+static inline const char *blk_integrity_name(struct blk_integrity *bi)
+{
+       /* gcc8 dislikes when strcmp() is called against NULL */
+       return "";
+}
+#endif
+
 #endif /* _LUSTRE_COMPAT_H */