]) # LC_FILE_LLSEEK_SIZE_5ARG
#
-# LC_HAVE_DENTRY_D_ALIAS_HLIST
+# LC_LLITE_DATA_IS_LIST
#
# 3.6 switch i_dentry/d_alias from list to hlist
#
-AC_DEFUN([LC_HAVE_DENTRY_D_ALIAS_HLIST], [
+# In the upstream kernels d_alias first changes
+# to a hlist and then in later version, 3.11, gets
+# moved to the union d_u. Due to some distros having
+# d_alias in the d_u union as a struct list, which
+# has never existed upstream stream, we can't test
+# if d_alias is a list or hlist directly. If ever
+# i_dentry and d_alias even up different combos then
+# the build will fail. In that case then we will need
+# to separate out the i_dentry and d_alias test below.
+#
+AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'hlist'],
-i_dentry_d_alias_hlist, [
+LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
+i_dentry_d_alias_list, [
#include <linux/fs.h>
- #include <linux/list.h>
],[
struct inode inode;
- struct dentry dentry;
- struct hlist_head head;
- struct hlist_node node;
- inode.i_dentry = head;
- dentry.d_alias = node;
+ INIT_LIST_HEAD(&inode.i_dentry);
],[
- AC_DEFINE(HAVE_DENTRY_D_ALIAS_HLIST, 1,
- [have i_dentry/d_alias uses hlist])
+ AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
+ [both i_dentry/d_alias uses list])
])
EXTRA_KCFLAGS="$tmp_flags"
-]) # LC_HAVE_DENTRY_D_ALIAS_HLIST
+]) # LC_DATA_FOR_LLITE_IS_LIST
#
# LC_DENTRY_OPEN_USE_PATH
#include <linux/list.h>
#include <linux/fs.h>
],[
+ struct hlist_head *head = NULL;
struct inode *inode;
- struct dentry *dentry;
- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
+
+ hlist_for_each_entry(inode, head, i_hash) {
continue;
}
],[
]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
#
+# LC_HAVE_DENTRY_D_U_D_ALIAS
+#
+# 3.11 kernel moved d_alias to the union d_u in struct dentry
+#
+# Some distros move d_alias to d_u but it is still a struct list
+#
+AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
+AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
+ LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
+ d_alias, [
+ #include <linux/list.h>
+ #include <linux/dcache.h>
+ ],[
+ struct dentry de;
+ INIT_LIST_HEAD(&de.d_u.d_alias);
+ ],[
+ AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
+ [list dentry.d_u.d_alias exist])
+ ])
+],[
+ LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
+ d_alias, [
+ #include <linux/list.h>
+ #include <linux/dcache.h>
+ ],[
+ struct dentry de;
+ INIT_HLIST_NODE(&de.d_u.d_alias);
+ ],[
+ AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
+ [hlist dentry.d_u.d_alias exist])
+ ])
+])
+]) # LC_HAVE_DENTRY_D_U_D_ALIAS
+
+#
+# LC_HAVE_DENTRY_D_CHILD
+#
+# 3.11 kernel d_child has been moved out of the union d_u
+# in struct dentry
+#
+AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
+LB_CHECK_COMPILE([if 'dentry.d_child' exist],
+d_child, [
+ #include <linux/list.h>
+ #include <linux/dcache.h>
+],[
+ struct dentry de;
+ INIT_LIST_HEAD(&de.d_child);
+],[
+ AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
+ [dentry.d_child exist])
+])
+]) # LC_HAVE_DENTRY_D_CHILD
+
+#
# LC_KIOCB_KI_LEFT
#
# 3.12 ki_left removed from struct kiocb
[kernel has truncate_inode_pages_final])
])
]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
+
#
# LC_VFS_RENAME_6ARGS
#
LC_FILE_LLSEEK_SIZE_5ARG
# 3.6
- LC_HAVE_DENTRY_D_ALIAS_HLIST
+ LC_DATA_FOR_LLITE_IS_LIST
LC_DENTRY_OPEN_USE_PATH
LC_HAVE_IOP_ATOMIC_OPEN
LC_HAVE_DIR_CONTEXT
LC_D_COMPARE_5ARGS
LC_HAVE_DCOUNT
+ LC_HAVE_DENTRY_D_U_D_ALIAS
+ LC_HAVE_DENTRY_D_CHILD
# 3.12
LC_OLDSIZE_TRUNCATE_PAGECACHE
#define clear_inode(i) end_writeback(i)
#endif
-#ifdef HAVE_DENTRY_D_ALIAS_HLIST
+#ifndef HAVE_DENTRY_D_CHILD
+#define d_child d_u.d_child
+#endif
+
+#ifdef HAVE_DENTRY_D_U_D_ALIAS
+#define d_alias d_u.d_alias
+#endif
+
+#ifndef DATA_FOR_LLITE_IS_LIST
#define ll_d_hlist_node hlist_node
#define ll_d_hlist_empty(list) hlist_empty(list)
#define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
#define ll_d_hlist_for_each(tmp, i_dentry) hlist_for_each(tmp, i_dentry)
-#ifdef HAVE_HLIST_FOR_EACH_3ARG
-#define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \
- p = NULL; hlist_for_each_entry(dentry, i_dentry, alias)
-#else
-#define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \
- hlist_for_each_entry(dentry, p, i_dentry, alias)
-#endif
+# ifdef HAVE_HLIST_FOR_EACH_3ARG
+# define ll_d_hlist_for_each_entry(dentry, p, i_dentry) \
+ p = NULL; hlist_for_each_entry(dentry, i_dentry, d_alias)
+# else
+# define ll_d_hlist_for_each_entry(dentry, p, i_dentry) \
+ hlist_for_each_entry(dentry, p, i_dentry, d_alias)
+# endif
#define DECLARE_LL_D_HLIST_NODE_PTR(name) struct ll_d_hlist_node *name
#else
#define ll_d_hlist_node list_head
#define ll_d_hlist_empty(list) list_empty(list)
#define ll_d_hlist_entry(ptr, type, name) list_entry(ptr.next, type, name)
#define ll_d_hlist_for_each(tmp, i_dentry) list_for_each(tmp, i_dentry)
-#define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \
- list_for_each_entry(dentry, i_dentry, alias)
+#define ll_d_hlist_for_each_entry(dentry, p, i_dentry) \
+ list_for_each_entry(dentry, i_dentry, d_alias)
#define DECLARE_LL_D_HLIST_NODE_PTR(name) /* nothing */
-#endif
+#endif /* !DATA_FOR_LLITE_IS_LIST */
#ifndef QUOTA_OK
# define QUOTA_OK 0
PFID(ll_inode2fid(inode)), inode);
ll_lock_dcache(inode);
- ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
+ ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry) {
CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p "
"inode %p flags %d\n", dentry->d_name.len,
dentry->d_name.name, dentry, dentry->d_parent,
return;
list_for_each(tmp, &dentry->d_subdirs) {
- struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child);
+ struct dentry *d = list_entry(tmp, struct dentry, d_child);
lustre_dump_dentry(d, recur - 1);
}
}
DECLARE_LL_D_HLIST_NODE_PTR(p);
ll_lock_dcache(dir);
- ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_alias) {
+ ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry) {
spin_lock(&dentry->d_lock);
if (!list_empty(&dentry->d_subdirs)) {
struct dentry *child;
list_for_each_entry_safe(child, tmp_subdir,
&dentry->d_subdirs,
- d_u.d_child) {
+ d_child) {
if (child->d_inode == NULL)
d_lustre_invalidate(child, 1);
}
discon_alias = invalid_alias = NULL;
ll_lock_dcache(inode);
- ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_alias) {
+ ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry) {
LASSERT(alias != dentry);
spin_lock(&alias->d_lock);