LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org
Cc: viro@zeniv.linux.org.uk, linuxram@us.ibm.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [patch 2/6] vfs: pnode cleanup
Date: Thu, 13 Mar 2008 22:26:43 +0100	[thread overview]
Message-ID: <20080313212733.921047238@szeredi.hu> (raw)
In-Reply-To: <20080313212641.989467982@szeredi.hu>

[-- Attachment #1: pnode_cleanup.patch --]
[-- Type: text/plain, Size: 3547 bytes --]

From: Miklos Szeredi <mszeredi@suse.cz>

Clean up mnt->mnt_slave_list being initialized too many times.

Move set_mnt_shared from pnode.h to pnode.c.  Change
CLEAR_MNT_SHARED() to clear_mnt_shared() function, and move to
pnode.c.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
 fs/namespace.c |    2 +-
 fs/pnode.c     |   23 ++++++++++++++++-------
 fs/pnode.h     |    9 ++-------
 3 files changed, 19 insertions(+), 15 deletions(-)

Index: linux/fs/pnode.c
===================================================================
--- linux.orig/fs/pnode.c	2008-03-13 20:45:15.000000000 +0100
+++ linux/fs/pnode.c	2008-03-13 20:45:49.000000000 +0100
@@ -27,6 +27,17 @@ static inline struct vfsmount *next_slav
 	return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave);
 }
 
+void set_mnt_shared(struct vfsmount *mnt)
+{
+	mnt->mnt_flags &= ~MNT_PNODE_MASK;
+	mnt->mnt_flags |= MNT_SHARED;
+}
+
+void clear_mnt_shared(struct vfsmount *mnt)
+{
+	mnt->mnt_flags &= ~MNT_SHARED;
+}
+
 static int __peer_group_id(struct vfsmount *mnt)
 {
 	struct vfsmount *m;
@@ -89,20 +100,18 @@ static int do_make_slave(struct vfsmount
 		list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
 			slave_mnt->mnt_master = master;
 		list_move(&mnt->mnt_slave, &master->mnt_slave_list);
-		list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
-		INIT_LIST_HEAD(&mnt->mnt_slave_list);
+		list_splice_init(&mnt->mnt_slave_list,
+				 master->mnt_slave_list.prev);
 	} else {
-		struct list_head *p = &mnt->mnt_slave_list;
-		while (!list_empty(p)) {
-                        slave_mnt = list_first_entry(p,
+		while (!list_empty(&mnt->mnt_slave_list)) {
+			slave_mnt = list_first_entry(&mnt->mnt_slave_list,
 					struct vfsmount, mnt_slave);
 			list_del_init(&slave_mnt->mnt_slave);
 			slave_mnt->mnt_master = NULL;
 		}
 	}
 	mnt->mnt_master = master;
-	CLEAR_MNT_SHARED(mnt);
-	INIT_LIST_HEAD(&mnt->mnt_slave_list);
+	clear_mnt_shared(mnt);
 	return 0;
 }
 
Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c	2008-03-13 20:45:49.000000000 +0100
+++ linux/fs/namespace.c	2008-03-13 20:45:49.000000000 +0100
@@ -537,7 +537,7 @@ static struct vfsmount *clone_mnt(struct
 		if (flag & CL_SLAVE) {
 			list_add(&mnt->mnt_slave, &old->mnt_slave_list);
 			mnt->mnt_master = old;
-			CLEAR_MNT_SHARED(mnt);
+			clear_mnt_shared(mnt);
 		} else if (!(flag & CL_PRIVATE)) {
 			if ((flag & CL_PROPAGATION) || IS_MNT_SHARED(old))
 				list_add(&mnt->mnt_share, &old->mnt_share);
Index: linux/fs/pnode.h
===================================================================
--- linux.orig/fs/pnode.h	2008-03-13 20:45:15.000000000 +0100
+++ linux/fs/pnode.h	2008-03-13 20:45:49.000000000 +0100
@@ -14,7 +14,6 @@
 #define IS_MNT_SHARED(mnt) (mnt->mnt_flags & MNT_SHARED)
 #define IS_MNT_SLAVE(mnt) (mnt->mnt_master)
 #define IS_MNT_NEW(mnt)  (!mnt->mnt_ns)
-#define CLEAR_MNT_SHARED(mnt) (mnt->mnt_flags &= ~MNT_SHARED)
 #define IS_MNT_UNBINDABLE(mnt) (mnt->mnt_flags & MNT_UNBINDABLE)
 
 #define CL_EXPIRE    		0x01
@@ -24,12 +23,8 @@
 #define CL_PROPAGATION 		0x10
 #define CL_PRIVATE 		0x20
 
-static inline void set_mnt_shared(struct vfsmount *mnt)
-{
-	mnt->mnt_flags &= ~MNT_PNODE_MASK;
-	mnt->mnt_flags |= MNT_SHARED;
-}
-
+void set_mnt_shared(struct vfsmount *);
+void clear_mnt_shared(struct vfsmount *);
 void change_mnt_propagation(struct vfsmount *, int);
 int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *,
 		struct list_head *);

--

  parent reply	other threads:[~2008-03-13 21:28 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 21:26 [patch 0/6] vfs: mountinfo update Miklos Szeredi
2008-03-13 21:26 ` [patch 1/6] vfs: mountinfo -mm fix Miklos Szeredi
2008-03-13 21:26 ` Miklos Szeredi [this message]
2008-03-19 11:16   ` [patch 2/6] vfs: pnode cleanup Al Viro
2008-03-19 11:48     ` Miklos Szeredi
2008-03-13 21:26 ` [patch 3/6] vfs: mountinfo stable peer group id Miklos Szeredi
2008-03-19 11:48   ` Al Viro
2008-03-19 16:41     ` Miklos Szeredi
2008-03-19 18:20       ` Al Viro
2008-03-19 18:37         ` Miklos Szeredi
2008-03-20 21:43           ` Al Viro
2008-03-21  8:57             ` Miklos Szeredi
2008-03-22  3:49             ` Al Viro
2008-03-22  3:54               ` Al Viro
2008-03-22  4:11               ` Al Viro
2008-03-22  4:56                 ` Al Viro
2008-03-30 19:33                 ` Ram Pai
2008-03-24  8:50             ` Ram Pai
2008-03-24  8:54               ` Christoph Hellwig
2008-03-24  9:53               ` Al Viro
2008-03-22 16:27           ` Al Viro
2008-03-24  8:19             ` Ram Pai
2008-03-24  9:34               ` Al Viro
2008-03-13 21:26 ` [patch 4/6] vfs: mountinfo show dominating " Miklos Szeredi
2008-03-19 11:37   ` Al Viro
2008-03-19 12:03     ` Miklos Szeredi
2008-03-19 12:19       ` Miklos Szeredi
2008-03-19 12:41         ` Al Viro
2008-03-19 13:07           ` Miklos Szeredi
2008-03-13 21:26 ` [patch 5/6] vfs: optimization to /proc/<pid>/mountinfo patch Miklos Szeredi
2008-03-19 11:56   ` Al Viro
2008-03-19 16:56     ` Miklos Szeredi
2008-03-13 21:26 ` [patch 6/6] vfs: mountinfo: only show mounts under tasks root Miklos Szeredi
2008-03-19 12:12   ` Al Viro
2008-03-19 12:25     ` Miklos Szeredi
2008-03-13 22:53 ` [patch 0/6] vfs: mountinfo update Andrew Morton
2008-03-14  8:17   ` Miklos Szeredi
2008-03-14 19:29     ` Ram Pai

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=20080313212733.921047238@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [patch 2/6] vfs: pnode cleanup' \
    /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

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).