linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] namespace.c: cleanup in mark_mounts_for_expiry()
@ 2005-05-20 13:54 Miklos Szeredi
  2005-05-20 14:47 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2005-05-20 13:54 UTC (permalink / raw)
  To: akpm, viro; +Cc: dhowells, linux-kernel, linux-fsdevel

[ fell in love with that function, now can't let go... ]

This patch simplifies mark_mounts_for_expiry() by using detach_mnt()
instead of duplicating everything it does.

It should be an equivalent transformation except for righting the
dput/mntput order.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>

Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c	2005-05-20 15:44:59.000000000 +0200
+++ linux/fs/namespace.c	2005-05-20 15:45:21.000000000 +0200
@@ -880,24 +880,13 @@ void mark_mounts_for_expiry(struct list_
 		/* check that it is still dead: the count should now be 2 - as
 		 * contributed by the vfsmount parent and the mntget above */
 		if (atomic_read(&mnt->mnt_count) == 2) {
-			struct vfsmount *xdmnt;
-			struct dentry *xdentry;
+			struct nameidata old_nd;
 
 			/* delete from the namespace */
 			list_del_init(&mnt->mnt_list);
-			list_del_init(&mnt->mnt_child);
-			list_del_init(&mnt->mnt_hash);
-			mnt->mnt_mountpoint->d_mounted--;
-
-			xdentry = mnt->mnt_mountpoint;
-			mnt->mnt_mountpoint = mnt->mnt_root;
-			xdmnt = mnt->mnt_parent;
-			mnt->mnt_parent = mnt;
-
+			detach_mnt(mnt, &old_nd);
 			spin_unlock(&vfsmount_lock);
-
-			mntput(xdmnt);
-			dput(xdentry);
+			path_release(&old_nd);
 
 			/* now lay it to rest if this was the last ref on the
 			 * superblock */

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-24  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-20 13:54 [PATCH] namespace.c: cleanup in mark_mounts_for_expiry() Miklos Szeredi
2005-05-20 14:47 ` Al Viro
2005-05-20 16:16   ` Miklos Szeredi
2005-05-24  8:20     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).