From: Brian J. Murrell Date: Thu, 17 Dec 2009 13:58:11 +0000 (-0500) Subject: b=21532 various build fixes for rhel4 and sles9 X-Git-Tag: v1_8_1_58~9 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3a1b4dee1ea3efbb7d367e0af4915391b6917c1d;p=fs%2Flustre-release.git b=21532 various build fixes for rhel4 and sles9 various build fixes for rhel4 and sles9 including: - configure checks for and backports of: * atomic_inc_not_zero * atomic_cmpxchg - don't include linux/pagevec.h in llite/lloop.c as it causes some duplicate definitions when it's later included by another source file - use LPU64 portability formats --- diff --git a/lnet/klnds/qswlnd/qswlnd_cb.c b/lnet/klnds/qswlnd/qswlnd_cb.c index a018dc9..109e236 100644 --- a/lnet/klnds/qswlnd/qswlnd_cb.c +++ b/lnet/klnds/qswlnd/qswlnd_cb.c @@ -44,7 +44,7 @@ kqswnal_unmap_tx (kqswnal_tx_t *ktx) if (ktx->ktx_nmappedpages == 0) return; - + CDEBUG(D_NET, "%p unloading %d frags starting at %d\n", ktx, ktx->ktx_nfrag, ktx->ktx_firsttmpfrag); @@ -57,7 +57,7 @@ kqswnal_unmap_tx (kqswnal_tx_t *ktx) } int -kqswnal_map_tx_kiov (kqswnal_tx_t *ktx, int offset, int nob, +kqswnal_map_tx_kiov (kqswnal_tx_t *ktx, int offset, int nob, unsigned int niov, lnet_kiov_t *kiov) { int nfrags = ktx->ktx_nfrag; diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index f925966..d01d8e0 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1685,6 +1685,38 @@ LB_LINUX_TRY_COMPILE([ ]) ]) +AC_DEFUN([LC_ATOMIC_CMPXCHG], +[AC_MSG_CHECKING([if kernel has atomic_cmpxchg]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + #ifndef atomic_cmpxchg + #error missing atomic_cmpxchg + #endif +],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_ATOMIC_CMPXCHG, 1, [kernel has atomic_cmpxchg]) +],[ + AC_MSG_RESULT([no]) +]) +]) + +AC_DEFUN([LC_ATOMIC_INC_NOT_ZERO], +[AC_MSG_CHECKING([if kernel has atomic_inc_not_zero]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + #ifndef atomic_inc_not_zero + #error missing atomic_inc_not_zero + #endif +],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_ATOMIC_INC_NOT_ZERO, 1, [kernel has atomic_inc_not_zero]) +],[ + AC_MSG_RESULT([no]) +]) +]) + # # LC_PROG_LINUX # @@ -1748,6 +1780,8 @@ AC_DEFUN([LC_PROG_LINUX], # 2.6.15 LC_INODE_I_MUTEX + LC_ATOMIC_CMPXCHG + LC_ATOMIC_INC_NOT_ZERO # 2.6.16 LC_SECURITY_PLUG # for SLES10 SP2 diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 9ffd18a..78ca298 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -626,5 +626,33 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #else #define ll_update_time(file) inode_update_time(file->f_mapping->host, 1) #endif + +/* Needed for sles9 */ +#ifndef HAVE_ATOMIC_CMPXCHG +#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) +#endif + +/* Needed for rhel4 and sles9 */ +#ifndef HAVE_ATOMIC_INC_NOT_ZERO +/** + * atomic_add_unless - add unless the number is a given value + * @v: pointer of type atomic_t + * @a: the amount to add to v... + * @u: ...unless v is equal to u. + * + * Atomically adds @a to @v, so long as it was not @u. + * Returns non-zero if @v was not @u, and zero otherwise. + */ +#define atomic_add_unless(v, a, u) \ +({ \ + int c, old; \ + c = atomic_read(v); \ + while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ + c = old; \ + c != (u); \ +}) +#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#endif /* !atomic_inc_not_zero */ + #endif /* __KERNEL__ */ #endif /* _COMPAT25_H */ diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c index 1aad475..7de218e 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -104,7 +104,6 @@ #include #include #include -#include #include diff --git a/lustre/utils/ll_decode_filter_fid.c b/lustre/utils/ll_decode_filter_fid.c index e5441bf..533521a 100644 --- a/lustre/utils/ll_decode_filter_fid.c +++ b/lustre/utils/ll_decode_filter_fid.c @@ -49,6 +49,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { @@ -74,7 +75,7 @@ int main(int argc, char *argv[]) "(%d bytes), recompile?\n", argv[i], size); } else { - printf("%s: objid=%llu group=%llu inode=%llu generation=%u stripe=%u\n", + printf("%s: objid="LPU64" group="LPU64" inode="LPU64" generation=%u stripe=%u\n", argv[i], ff->ff_objid, ff->ff_group, ff->ff_fid.id, ff->ff_fid.generation, ff->ff_fid.f_type);