linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiang Liu <jiang.liu@linux.intel.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jiang Liu <jiang.liu@linux.intel.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fs: namespace: Simplify function commit_tree()
Date: Tue, 13 Jan 2015 13:08:06 +0800	[thread overview]
Message-ID: <1421125686-23765-1-git-send-email-jiang.liu@linux.intel.com> (raw)

Simplify function commit_tree() in fs/namespace.c, it also improves code
readability.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 fs/namespace.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index cd1e9681a0cf..c2b6f6f676ec 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -846,18 +846,11 @@ static void attach_shadowed(struct mount *mnt,
 static void commit_tree(struct mount *mnt, struct mount *shadows)
 {
 	struct mount *parent = mnt->mnt_parent;
-	struct mount *m;
-	LIST_HEAD(head);
 	struct mnt_namespace *n = parent->mnt_ns;
 
 	BUG_ON(parent == mnt);
-
-	list_add_tail(&head, &mnt->mnt_list);
-	list_for_each_entry(m, &head, mnt_list)
-		m->mnt_ns = n;
-
-	list_splice(&head, n->list.prev);
-
+	mnt->mnt_ns = n;
+	list_add_tail(&mnt->mnt_list, &n->list);
 	attach_shadowed(mnt, parent, shadows);
 	touch_mnt_namespace(n);
 }
-- 
1.7.10.4


             reply	other threads:[~2015-01-13  5:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  5:08 Jiang Liu [this message]
2015-01-13  5:28 ` [PATCH] fs: namespace: Simplify function commit_tree() Al Viro
2015-01-13  5:33   ` Jiang Liu

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=1421125686-23765-1-git-send-email-jiang.liu@linux.intel.com \
    --to=jiang.liu@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.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 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).