Whamcloud - gitweb
LU-8130 libcfs: don't include rhashtable if unavailable 20/34020/2
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 14 Dec 2018 22:43:41 +0000 (15:43 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 19 Mar 2019 06:02:30 +0000 (06:02 +0000)
Don't include <linux/rhashtable.h> if it is not available.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I80b2ee63fb2a438399359f8052a5063429dd6506
Reviewed-on: https://review.whamcloud.com/34020
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-hash.h

index d437331..7c553ff 100644 (file)
@@ -405,6 +405,16 @@ shrinker_count_objects, [
 ]) # LIBCFS_SHRINKER_COUNT
 
 #
+# Kernel version 3.16 added rhashtable.h in 7e1e77636e36075eb
+#
+AC_DEFUN([LIBCFS_LINUX_RHASHTABLE_H],[
+LB_CHECK_LINUX_HEADER([linux/rhashtable.h], [
+       AC_DEFINE(HAVE_LINUX_RHASHTABLE_H, 1,
+               [linux/rhashtable.h is present])
+])
+]) # LIBCFS_LINUX_RHASHTABLE_H
+
+#
 # Kernel version 3.17 changed hlist_add_after to
 # hlist_add_behind
 #
@@ -969,6 +979,8 @@ LIBCFS_KTIME_AFTER
 LIBCFS_KTIME_BEFORE
 LIBCFS_KTIME_COMPARE
 LIBCFS_SHRINKER_COUNT
+# 3.16
+LIBCFS_LINUX_RHASHTABLE_H
 # 3.17
 LIBCFS_HLIST_ADD_AFTER
 LIBCFS_TIMESPEC64
index 1227ec8..4f6df47 100644 (file)
@@ -24,7 +24,6 @@
 #define __LIBCFS_LINUX_HASH_H__
 
 #include <linux/dcache.h>
-#include <linux/rhashtable.h>
 
 u64 cfs_hashlen_string(const void *salt, const char *name);
 
@@ -38,6 +37,8 @@ u64 cfs_hashlen_string(const void *salt, const char *name);
 #endif
 #endif /* !HAVE_STRINGHASH */
 
+#ifdef HAVE_LINUX_RHASHTABLE_H
+#include <linux/rhashtable.h>
 #ifndef HAVE_RHASHTABLE_LOOKUP_GET_INSERT_FAST
 /**
  * rhashtable_lookup_get_insert_fast - lookup and insert object into hash table
@@ -73,5 +74,6 @@ static inline void *rhashtable_lookup_get_insert_fast(
        return ret;
 }
 #endif /* !HAVE_RHASHTABLE_LOOKUP_GET_INSERT_FAST */
+#endif /* HAVE_LINUX_RHASHTABLE_H */
 
 #endif /* __LIBCFS_LINUX_MISC_H__ */