Skip to contentSkip to conversation

autofs4: Merge the remaining dentry ops tables

PATCH New David Howells 1 participant 1 message Jan 15, 2011 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 autofs4: Merge the remaining dentry ops tables

Merge the remaining autofs4 dentry ops tables. It doesn't matter if d_automount and d_manage are present on something that's not mountable or holdable as these ops are only used if the appropriate flags are set in dentry->d_flags.

---

 fs/autofs4/autofs_i.h |    1 -
 fs/autofs4/inode.c    |    4 +---
 fs/autofs4/root.c     |   13 ++-----------
 3 files changed, 3 insertions(+), 15 deletions(-)
fs/autofs4/autofs_i.h +0 -1
index c28085c..1f016bf 100644
@@ -207,7 +207,6 @@ extern const struct inode_operations autofs4_dir_inode_operations;
 extern const struct file_operations autofs4_dir_operations;
 extern const struct file_operations autofs4_root_operations;
 extern const struct dentry_operations autofs4_dentry_operations;
-extern const struct dentry_operations autofs4_mount_dentry_operations;
 
 /* VFS automount flags management functions */
 
fs/autofs4/inode.c +1 -3
index 3ecd2e2..2e80cf0 100644
@@ -304,10 +304,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
 		goto fail_dput;
 	}
 
-	if (autofs_type_trigger(sbi->type)) {
-		d_set_d_op(root, &autofs4_mount_dentry_operations);
+	if (autofs_type_trigger(sbi->type))
 		__managed_dentry_set_managed(root);
-	}
 
 	root_inode->i_fop = &autofs4_root_operations;
 	root_inode->i_op = &autofs4_dir_inode_operations;
fs/autofs4/root.c +2 -11
index dbd9551..0db9d53 100644
@@ -66,13 +66,7 @@ const struct inode_operations autofs4_dir_inode_operations = {
 	.rmdir		= autofs4_dir_rmdir,
 };
 
-/* For dentries that don't initiate mounting */
 const struct dentry_operations autofs4_dentry_operations = {
-	.d_release	= autofs4_dentry_release,
-};
-
-/* For dentries that do initiate mounting */
-const struct dentry_operations autofs4_mount_dentry_operations = {
 	.d_automount	= autofs4_d_automount,
 	.d_manage	= autofs4_d_manage,
 	.d_release	= autofs4_dentry_release,
@@ -512,10 +506,8 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
 			return ERR_PTR(-ENOENT);
 
 		/* Mark entries in the root as mount triggers */
-		if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) {
-			d_set_d_op(dentry, &autofs4_mount_dentry_operations);
+		if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent))
 			__managed_dentry_set_managed(dentry);
-		}
 
 		ino = autofs4_init_ino(NULL, sbi, 0555);
 		if (!ino)
@@ -848,8 +840,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
 int is_autofs4_dentry(struct dentry *dentry)
 {
 	return dentry && dentry->d_inode &&
-		(dentry->d_op == &autofs4_mount_dentry_operations ||
-		 dentry->d_op == &autofs4_dentry_operations) &&
+		dentry->d_op == &autofs4_dentry_operations &&
 		dentry->d_fsdata != NULL;
 }