summaryrefslogtreecommitdiffstats
path: root/fs/autofs/autofs_i.h
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2022-07-08 03:43:12 +0200
committerakpm <akpm@linux-foundation.org>2022-07-18 02:31:42 +0200
commita4a87303874c1a7d49cc18a8fe33676b0002ffbf (patch)
tree5e8cfd0542d3ac231095d07b392f656c71b604c7 /fs/autofs/autofs_i.h
parentautofs: make dentry info count consistent (diff)
downloadlinux-a4a87303874c1a7d49cc18a8fe33676b0002ffbf.tar.xz
linux-a4a87303874c1a7d49cc18a8fe33676b0002ffbf.zip
autofs: use dentry info count instead of simple_empty()
The dentry info. field count is used to check if a dentry is in use during expire. But, to be used for this the count field must account for the presence of child dentries in a directory dentry. Therefore it can also be used to check for an empty directory dentry which can be done without having to to take an additional lock or account for the presence of a readdir cursor dentry as is done by simple_empty(). Link: https://lkml.kernel.org/r/165724459238.30914.1504611159945950108.stgit@donald.themaw.net Signed-off-by: Ian Kent <raven@themaw.net> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: David Howells <dhowells@redhat.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/autofs/autofs_i.h')
-rw-r--r--fs/autofs/autofs_i.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index 918826eaceea..0117d6e06300 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -148,6 +148,11 @@ static inline int autofs_oz_mode(struct autofs_sb_info *sbi)
task_pgrp(current) == sbi->oz_pgrp);
}
+static inline bool autofs_empty(struct autofs_info *ino)
+{
+ return ino->count < 2;
+}
+
struct inode *autofs_get_inode(struct super_block *, umode_t);
void autofs_free_ino(struct autofs_info *);