From 0181b00b9c910b31a16c8fc7eb66664acaf5157e Mon Sep 17 00:00:00 2001 From: yangsheng Date: Wed, 30 Sep 2009 15:37:40 +0000 Subject: [PATCH] Branch b1_8 b=17153 i=adilger, johann Fixed the build failed for rhel4/sles9 with -Werror. --- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 5 +++++ lustre/include/lustre/lustre_user.h | 2 +- lustre/llite/llite_internal.h | 2 +- lustre/llite/llite_lib.c | 2 +- lustre/utils/obd.c | 2 +- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index f65eefd..6e66130 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1182,6 +1182,26 @@ AC_DEFUN([LC_REGISTER_SHRINKER], AC_DEFINE(HAVE_REGISTER_SHRINKER, 1, [kernel exports register_shrinker]) ],[ + AC_MSG_CHECKING([if kernel using gfp_t for shrinker second paramter]) + tmp_flags="$EXTRA_KCFLAGS" + EXTRA_KCFLAGS="-Werror" + LB_LINUX_TRY_COMPILE([ + #include + ],[ + struct shrinker *scb(int nts, gfp_t mask) { + return 0; + } + shrinter_t fp = scb; + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(SHRINKER_MASK_T, gfp_t, + [kernel using gfp_t for shrinker callback]) + ],[ + AC_MSG_RESULT([no]) + AC_DEFINE(SHRINKER_MASK_T, unsigned int, + [kernel using unsigned for shrinker callback]) + ]) + EXTRA_KCFLAGS="$tmp_flags" ]) ]) diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 724c7cc..7311cf3 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -253,6 +253,8 @@ static inline int cleanup_group_info(void) #if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH) #define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock) extern void __d_rehash(struct dentry *dentry, int lock); +#else +extern void d_rehash_cond(struct dentry*, int lock); #endif #if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE) @@ -484,6 +486,9 @@ int ll_unregister_blkdev(unsigned int dev, const char *name) #endif #ifdef HAVE_REGISTER_SHRINKER + +#define SHRINKER_MASK_T gfp_t + typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask); static inline diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 3bb1e64..b50a5f4 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -290,7 +290,7 @@ typedef struct lu_fid lustre_fid; /* scanf input parse format -- strip '[' first. e.g. sscanf(fidstr, SFID, RFID(&fid)); */ -#define SFID "0x%llx:0x%x:0x%x" +#define SFID "0x%"LPF64"x:0x%x:0x%x" #define RFID(fid) \ &((fid)->f_seq), \ &((fid)->f_oid), \ diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index bab694a..77f1de7 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -814,7 +814,7 @@ void ll_lli_init(struct ll_inode_info *lli); int ll_fill_super(struct super_block *sb); void ll_put_super(struct super_block *sb); void ll_kill_super(struct super_block *sb); -int ll_shrink_cache(int nr_to_scan, gfp_t gfp_mask); +int ll_shrink_cache(int nr_to_scan, SHRINKER_MASK_T gfp_mask); struct inode *ll_inode_from_lock(struct ldlm_lock *lock); void ll_clear_inode(struct inode *inode); int ll_setattr_raw(struct inode *inode, struct iattr *attr); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 926aff70..b58b1df 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1299,7 +1299,7 @@ void ll_put_super(struct super_block *sb) EXIT; } /* client_put_super */ -int ll_shrink_cache(int nr_to_scan, gfp_t gfp_mask) +int ll_shrink_cache(int nr_to_scan, SHRINKER_MASK_T gfp_mask) { struct ll_sb_info *sbi; int count = 0; diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index b400074..96783ca 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -3196,7 +3196,7 @@ int jt_get_obj_version(int argc, char **argv) } obd_ioctl_unpack(&data, buf, sizeof rawbuf); - printf("0x%llx\n", version); + printf(LPX64"\n", version); return 0; } -- 1.8.3.1