All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: viro@ftp.linux.org.uk, jmoyer@redhat.com
Cc: linux-fs@vger.kernel.org, autofs@linux.kernel.org,
	linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org,
	linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org,
	Ian Kent <raven@themaw.net>, David Howells <dhowells@redhat.com>
Subject: [PATCH 13/17] autofs4: cleanup dentry operations
Date: Thu, 30 Sep 2010 19:16:02 +0100	[thread overview]
Message-ID: <20100930181602.30939.21192.stgit__37824.9191832312$1285871096$gmane$org@warthog.procyon.org.uk> (raw)
In-Reply-To: <20100930181455.30939.53914.stgit@warthog.procyon.org.uk>

From: Ian Kent <raven@themaw.net>

There are now two distinct dentry operations uses. One for dentrys
that trigger mounts and one for dentrys that do not.

Rationalize the use of these dentry operations and rename them to
reflect their function.

Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/autofs4/autofs_i.h |    7 ++-----
 fs/autofs4/inode.c    |   12 ++++--------
 fs/autofs4/root.c     |   36 ++++++++++++++++++++----------------
 3 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 8710878..8b1c0bc 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -203,11 +203,8 @@ extern const struct inode_operations autofs4_symlink_inode_operations;
 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;
-
-/* Operations methods */
-
-struct vfsmount *autofs4_d_automount(struct path *);
-int autofs4_d_manage(struct path *, bool);
+extern const struct dentry_operations autofs4_dentry_operations;
+extern const struct dentry_operations autofs4_mount_dentry_operations;
 
 /* VFS automount flags management functions */
 
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 80cdffd..8eaa723 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -251,12 +251,6 @@ static struct autofs_info *autofs4_mkroot(struct autofs_sb_info *sbi)
 	return ino;
 }
 
-static const struct dentry_operations autofs4_sb_dentry_operations = {
-	.d_automount	= autofs4_d_automount,
-	.d_manage	= autofs4_d_manage,
-	.d_release      = autofs4_dentry_release,
-};
-
 int autofs4_fill_super(struct super_block *s, void *data, int silent)
 {
 	struct inode * root_inode;
@@ -311,7 +305,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
 		goto fail_iput;
 	pipe = NULL;
 
-	root->d_op = &autofs4_sb_dentry_operations;
+	root->d_op = &autofs4_dentry_operations;
 	root->d_fsdata = ino;
 
 	/* Can this call block? */
@@ -322,8 +316,10 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
 		goto fail_dput;
 	}
 
-	if (autofs_type_trigger(sbi->type))
+	if (autofs_type_trigger(sbi->type)) {
+		root->d_op = &autofs4_mount_dentry_operations;
 		__managed_dentry_set_managed(root);
+	}
 
 	root_inode->i_fop = &autofs4_root_operations;
 	root_inode->i_op = &autofs4_dir_inode_operations;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2856a0c..cb168ba 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -31,6 +31,8 @@ static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
 static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long);
 static int autofs4_dir_open(struct inode *inode, struct file *file);
 static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
+static struct vfsmount *autofs4_d_automount(struct path *);
+static int autofs4_d_manage(struct path *, bool);
 
 const struct file_operations autofs4_root_operations = {
 	.open		= dcache_dir_open,
@@ -60,6 +62,18 @@ 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,
+};
+
 static void autofs4_add_active(struct dentry *dentry)
 {
 	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
@@ -151,18 +165,6 @@ void autofs4_dentry_release(struct dentry *de)
 	}
 }
 
-/* For dentries of directories in the root dir */
-static const struct dentry_operations autofs4_root_dentry_operations = {
-	.d_release	= autofs4_dentry_release,
-};
-
-/* For other dentries */
-static const struct dentry_operations autofs4_dentry_operations = {
-	.d_automount	= autofs4_d_automount,
-	.d_manage	= autofs4_d_manage,
-	.d_release	= autofs4_dentry_release,
-};
-
 static struct dentry *autofs4_lookup_active(struct dentry *dentry)
 {
 	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
@@ -330,7 +332,7 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)
 	return path->dentry;
 }
 
-struct vfsmount *autofs4_d_automount(struct path *path)
+static struct vfsmount *autofs4_d_automount(struct path *path)
 {
 	struct dentry *dentry = path->dentry;
 	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
@@ -499,7 +501,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
 	if (active)
 		return active;
 	else {
-		dentry->d_op = &autofs4_root_dentry_operations;
+		dentry->d_op = &autofs4_dentry_operations;
 
 		/*
 		 * A dentry that is not within the root can never trigger
@@ -512,7 +514,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
 
 		/* Mark entries in the root as mount triggers */
 		if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) {
-			dentry->d_op = &autofs4_dentry_operations;
+			dentry->d_op = &autofs4_mount_dentry_operations;
 			__managed_dentry_set_managed(dentry);
 		}
 
@@ -572,6 +574,8 @@ static int autofs4_dir_symlink(struct inode *dir,
 	}
 	d_add(dentry, inode);
 
+	dentry->d_op = &autofs4_dentry_operations;
+
 	dentry->d_fsdata = ino;
 	ino->dentry = dget(dentry);
 	atomic_inc(&ino->count);
@@ -786,7 +790,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_root_dentry_operations ||
+		(dentry->d_op == &autofs4_mount_dentry_operations ||
 		 dentry->d_op == &autofs4_dentry_operations) &&
 		dentry->d_fsdata != NULL;
 }


  parent reply	other threads:[~2010-09-30 18:24 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 18:14 [PATCH 00/17] Introduce automounter dentry ops David Howells
2010-09-30 18:14 ` David Howells
2010-09-30 18:15 ` [PATCH 01/17] Add a dentry op to handle automounting rather than abusing follow_link() David Howells
2010-09-30 18:15 ` [PATCH 02/17] AFS: Use d_automount() " David Howells
2010-09-30 18:15 ` [PATCH 03/17] NFS: " David Howells
2010-09-30 18:15 ` [PATCH 04/17] CIFS: " David Howells
2010-09-30 18:15 ` David Howells
2010-09-30 18:15 ` [PATCH 05/17] Remove the automount through follow_link() kludge code from pathwalk David Howells
2010-09-30 18:15 ` David Howells
     [not found]   ` <20100930181521.30939.31415.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-10-08 23:41     ` Valerie Aurora
2010-10-08 23:41       ` Valerie Aurora
2010-10-10  1:16       ` Ian Kent
2010-10-10  1:16         ` Ian Kent
2010-09-30 18:15 ` [PATCH 06/17] Add an AT_NO_AUTOMOUNT flag to suppress terminal automount David Howells
2010-10-01  8:55   ` Ian Kent
2010-10-01  8:55     ` Ian Kent
2010-09-30 18:15 ` David Howells
2010-09-30 18:15 ` [PATCH 07/17] Make dentry::d_mounted into a more general field for special function dirs David Howells
2010-09-30 18:15 ` [PATCH 08/17] Make follow_down() handle d_manage() David Howells
2010-09-30 18:15 ` David Howells
     [not found]   ` <20100930181536.30939.6776.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-10-09  0:28     ` Valerie Aurora
2010-10-09  0:28       ` Valerie Aurora
2010-10-09  0:28       ` Valerie Aurora
2010-09-30 18:15 ` [PATCH 09/17] autofs4: add d_automount() dentry operation David Howells
2010-09-30 18:15 ` [PATCH 10/17] autofs4: add d_manage() " David Howells
2010-09-30 18:15 ` David Howells
2010-09-30 18:15 ` [PATCH 11/17] autofs4: removed unused code David Howells
2010-09-30 18:15 ` [PATCH 12/17] autofs4: cleanup inode operations David Howells
2010-09-30 18:15 ` David Howells
2010-09-30 18:16 ` David Howells [this message]
     [not found] ` <20100930181455.30939.53914.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-09-30 18:15   ` [PATCH 01/17] Add a dentry op to handle automounting rather than abusing follow_link() David Howells
2010-09-30 18:15     ` David Howells
2010-09-30 18:15   ` [PATCH 02/17] AFS: Use d_automount() " David Howells
2010-09-30 18:15     ` David Howells
2010-09-30 18:15   ` [PATCH 03/17] NFS: " David Howells
2010-09-30 18:15     ` David Howells
2010-09-30 18:15   ` [PATCH 07/17] Make dentry::d_mounted into a more general field for special function dirs David Howells
2010-09-30 18:15     ` David Howells
     [not found]     ` <20100930181531.30939.10438.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2010-10-08 23:57       ` Valerie Aurora
2010-10-08 23:57         ` Valerie Aurora
2010-09-30 18:15   ` [PATCH 09/17] autofs4: add d_automount() dentry operation David Howells
2010-09-30 18:15     ` David Howells
2010-09-30 18:15   ` [PATCH 11/17] autofs4: removed unused code David Howells
2010-09-30 18:15     ` David Howells
2010-09-30 18:16   ` [PATCH 13/17] autofs4: cleanup dentry operations David Howells
2010-09-30 18:16     ` David Howells
2010-09-30 18:16   ` [PATCH 14/17] autofs4: cleanup autofs4_free_ino() David Howells
2010-09-30 18:16     ` David Howells
2010-09-30 18:16   ` [PATCH 17/17] autofs4 - bump version David Howells
2010-09-30 18:16     ` David Howells
2010-10-01  7:57   ` [autofs] [PATCH 00/17] Introduce automounter dentry ops Stef Bon
2010-10-01 11:49     ` Ian Kent
2010-09-30 18:16 ` [PATCH 14/17] autofs4: cleanup autofs4_free_ino() David Howells
2010-09-30 18:16 ` [PATCH 15/17] autofs4 - fix wait validation David Howells
2010-09-30 18:16 ` David Howells
2010-09-30 18:16 ` [PATCH 16/17] autofs4 - add v4 pseudo direct mount support David Howells
2010-09-30 18:16 ` David Howells
2010-09-30 18:16 ` [PATCH 17/17] autofs4 - bump version David Howells
     [not found] ` <4CA59482.1040508-/E4qUF3RmbfcqV2Q6a4srg@public.gmane.org>
2010-10-01  8:31   ` [autofs] [PATCH 00/17] Introduce automounter dentry ops David Howells
     [not found]     ` <8948.1285921904-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-01 18:01       ` Stef Bon
     [not found]     ` <AANLkTinoJCY=Fy_0UPWdasJg3GE5WQP0pQA8cLnir1BL-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-04  9:23       ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20100930181602.30939.21192.stgit__37824.9191832312$1285871096$gmane$org@warthog.procyon.org.uk' \
    --to=dhowells@redhat.com \
    --cc=autofs@linux.kernel.org \
    --cc=jmoyer@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=raven@themaw.net \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.