From: Alex Zhuravlev Date: Thu, 9 Aug 2018 22:26:35 +0000 (-0400) Subject: LU-11096 osd: wrap new blk integrity stuff X-Git-Tag: 2.11.55~53 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c8505c2e70d03ba20edf9fcbf431888e87a21147 LU-11096 osd: wrap new blk integrity stuff to be able to build Lustre against kernels with no blk integrity. Change-Id: I050020e94524f4519fdf46a22f0d847979754291 Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/32725 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index a94ff13..3930c6f 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -698,6 +698,7 @@ static inline struct timespec current_time(struct inode *inode) #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 @@ -717,5 +718,16 @@ static inline const char *blk_integrity_name(struct blk_integrity *bi) 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 */ diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index f964d92..7c34b67 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -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 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; + int ea_overhead; /* * 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) { - interval = blk_integrity_interval(bi); + unsigned short interval = blk_integrity_interval(bi); name = blk_integrity_name(bi); /* * Expected values: