])
#
+# 3.11 need to access d_count to get dentry reference count
+#
+AC_DEFUN([LC_HAVE_DCOUNT],
+[AC_MSG_CHECKING([if d_count exist])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/dcache.h>
+],[
+ struct dentry de;
+
+ d_count(&de);
+],[
+ AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
LC_HAVE_ONLY_PROCFS_SEQ
LC_BLKDEV_RELEASE_RETURN_INT
+ # 3.11
+ LC_HAVE_DCOUNT
+
#
if test x$enable_server != xno ; then
LC_FUNC_DEV_SET_RDONLY
#endif /* !HAVE_TRUNCATE_COMPLETE_PAGE */
#ifdef HAVE_DCACHE_LOCK
-# define dget_dlock(d) dget_locked(d)
-# define d_refcount(d) atomic_read(&(d)->d_count)
-#else
-# define d_refcount(d) ((d)->d_count)
+# define dget_dlock(d) dget_locked(d)
+# define d_count(d) atomic_read(&(d)->d_count)
+#elif !defined(HAVE_D_COUNT)
+# define d_count(d) ((d)->d_count)
#endif /* HAVE_DCACHE_LOCK */
#ifdef ATTR_OPEN
if (!de || IS_ERR(de))
return;
//shrink_dcache_parent(de);
- LASSERT(d_refcount(de) > 0);
+ LASSERT(d_count(de) > 0);
dput(de);
}
CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
name->len, name->name, dentry, dentry->d_flags,
- d_refcount(dentry));
+ d_count(dentry));
/* mountpoint is always valid */
if (d_mountpoint((struct dentry *)dentry))
list_empty(&de->d_subdirs) ? "" : "subdirs");
#ifdef HAVE_DCACHE_LOCK
- LASSERT(d_refcount(de) == 0);
+ LASSERT(d_count(de) == 0);
#else
/* kernel >= 2.6.38 last refcount is decreased after this function. */
- LASSERT(d_refcount(de) == 1);
+ LASSERT(d_count(de) == 1);
#endif
/* Disable this piece of code temproarily because this is called
CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n",
de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode,
- d_refcount(de));
+ d_count(de));
if (de->d_fsdata == NULL) {
struct ll_dentry_data *lld;
{
CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p "
"refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry,
- dentry->d_parent, dentry->d_inode, d_refcount(dentry));
+ dentry->d_parent, dentry->d_inode, d_count(dentry));
spin_lock_nested(&dentry->d_lock,
nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);
__d_lustre_invalidate(dentry);
- if (d_refcount(dentry) == 0)
+ if (d_count(dentry) == 0)
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
}
" flags=0x%x, fsdata=%p, %d subdirs\n", dentry,
dentry->d_name.len, dentry->d_name.name,
dentry->d_parent->d_name.len, dentry->d_parent->d_name.name,
- dentry->d_parent, dentry->d_inode, d_refcount(dentry),
+ dentry->d_parent, dentry->d_inode, d_count(dentry),
dentry->d_flags, dentry->d_fsdata, subdirs);
if (dentry->d_inode != NULL)
ll_dump_inode(dentry->d_inode);
iput(inode);
CDEBUG(D_DENTRY,
"Reuse dentry %p inode %p refc %d flags %#x\n",
- new, new->d_inode, d_refcount(new), new->d_flags);
+ new, new->d_inode, d_count(new), new->d_flags);
return new;
}
}
return ERR_PTR(rc);
d_add(de, inode);
CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
- de, de->d_inode, d_refcount(de), de->d_flags);
+ de, de->d_inode, d_count(de), de->d_flags);
return de;
}
OBD_SET_CTXT_MAGIC(save);
save->fs = get_fs();
- LASSERT(d_refcount(current->fs->pwd.dentry));
- LASSERT(d_refcount(new_ctx->pwd));
+ LASSERT(d_count(current->fs->pwd.dentry));
+ LASSERT(d_count(new_ctx->pwd));
save->pwd = dget(current->fs->pwd.dentry);
save->pwdmnt = mntget(current->fs->pwd.mnt);
save->luc.luc_umask = current_umask();