Whamcloud - gitweb
LU-11096 osd: wrap new blk integrity stuff 25/32725/9
authorAlex Zhuravlev <bzzz@whamcloud.com>
Thu, 9 Aug 2018 22:26:35 +0000 (18:26 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 23 Aug 2018 07:19:18 +0000 (07:19 +0000)
to be able to build Lustre against kernels with no blk integrity.

Change-Id: I050020e94524f4519fdf46a22f0d847979754291
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/32725
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_compat.h
lustre/osd-ldiskfs/osd_handler.c

index a94ff13..3930c6f 100644 (file)
@@ -698,6 +698,7 @@ static inline struct timespec current_time(struct inode *inode)
 #define READ_ONCE ACCESS_ONCE
 #endif
 
 #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
 static inline unsigned short blk_integrity_interval(struct blk_integrity *bi)
 {
 #ifdef HAVE_INTERVAL_EXP_BLK_INTEGRITY
@@ -717,5 +718,16 @@ static inline const char *blk_integrity_name(struct blk_integrity *bi)
        return bi->name;
 #endif
 }
        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 */
 
 #endif /* _LUSTRE_COMPAT_H */
index f964d92..7c34b67 100644 (file)
@@ -2164,11 +2164,9 @@ static void osd_conf_get(const struct lu_env *env,
 {
        struct osd_device *d = osd_dt_dev(dev);
        struct super_block *sb = osd_sb(d);
 {
        struct osd_device *d = osd_dt_dev(dev);
        struct super_block *sb = osd_sb(d);
-       struct block_device *bdev = sb->s_bdev;
-       struct blk_integrity *bi = bdev_get_integrity(bdev);
-       unsigned short interval;
-       int ea_overhead;
+       struct blk_integrity *bi = bdev_get_integrity(sb->s_bdev);
        const char *name;
        const char *name;
+       int ea_overhead;
 
        /*
         * XXX should be taken from not-yet-existing fs abstraction layer.
 
        /*
         * XXX should be taken from not-yet-existing fs abstraction layer.
@@ -2226,7 +2224,7 @@ static void osd_conf_get(const struct lu_env *env,
 
        param->ddp_t10_cksum_type = 0;
        if (bi) {
 
        param->ddp_t10_cksum_type = 0;
        if (bi) {
-               interval = blk_integrity_interval(bi);
+               unsigned short interval = blk_integrity_interval(bi);
                name = blk_integrity_name(bi);
                /*
                 * Expected values:
                name = blk_integrity_name(bi);
                /*
                 * Expected values: