Whamcloud - gitweb
b=20339
[fs/lustre-release.git] / libcfs / include / libcfs / linux / kp30.h
index 40f15b9..ae23e8c 100644 (file)
@@ -133,8 +133,10 @@ static inline void our_cond_resched(void)
 
 #ifdef CONFIG_SMP
 #define LASSERT_SPIN_LOCKED(lock) LASSERT(spin_is_locked(lock))
+#define LINVRNT_SPIN_LOCKED(lock) LINVRNT(spin_is_locked(lock))
 #else
-#define LASSERT_SPIN_LOCKED(lock) do {} while(0)
+#define LASSERT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
+#define LINVRNT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #endif
 #define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0)
 
@@ -349,7 +351,8 @@ extern int  lwt_snapshot (cycles_t *now, int *ncpu, int *total_size,
 
 #define _LWORDSIZE BITS_PER_LONG
 
-#if defined(HAVE_U64_LONG_LONG)
+#if (defined(__KERNEL__) && defined(HAVE_KERN__U64_LONG_LONG)) || \
+    (!defined(__KERNEL__) && defined(HAVE_USER__U64_LONG_LONG))
 # define LPU64 "%Lu"
 # define LPD64 "%Ld"
 # define LPX64 "%#Lx"
@@ -402,5 +405,17 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
 }
 #endif
 
+#ifndef get_cpu
+# ifdef CONFIG_PREEMPT
+#  define cfs_get_cpu()  ({ preempt_disable(); smp_processor_id(); })
+#  define cfs_put_cpu()  preempt_enable()
+# else
+#  define cfs_get_cpu()  smp_processor_id()
+#  define cfs_put_cpu()
+# endif
+#else
+# define cfs_get_cpu()   get_cpu()
+# define cfs_put_cpu()   put_cpu()
+#endif /* get_cpu & put_cpu */
 
 #endif