From: Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: Linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH]loop cleanup in fs/namespace.c - repost
Date: Wed, 21 Nov 2007 20:57:24 +0300 [thread overview]
Message-ID: <47447184.6040805@gmail.com> (raw)
Hi list,
Apparently, the following two C language constructs
while (condition) {
// DO HARD WORK
}
and
repeat:
if (condition) {
// DO HARD WORK
goto repeat;
}
are equivalent, but the latter one looks quite cumbersome and is not idiomatic. However, the mntput_no_expire() routine in fs/namespace.c is implemented using the goto-based approach.
The patch given below replaces the goto-loop by a while-based one. Besides, it removes the export for the same routine, because there are no users for it outside of the core VFS code.
Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
---
diff --git a/fs/namespace.c b/fs/namespace.c
index 0608388..38b4b4a 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -278,8 +278,7 @@ static inline void __mntput(struct vfsmo
void mntput_no_expire(struct vfsmount *mnt)
{
-repeat:
- if (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {
+ while (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {
if (likely(!mnt->mnt_pinned)) {
spin_unlock(&vfsmount_lock);
__mntput(mnt);
@@ -290,12 +289,9 @@ repeat:
spin_unlock(&vfsmount_lock);
acct_auto_close_mnt(mnt);
security_sb_umount_close(mnt);
- goto repeat;
}
}
-EXPORT_SYMBOL(mntput_no_expire);
-
void mnt_pin(struct vfsmount *mnt)
{
spin_lock(&vfsmount_lock);
next reply other threads:[~2007-11-21 17:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-21 17:57 Dmitri Vorobiev [this message]
2007-11-21 19:06 ` [PATCH]loop cleanup in fs/namespace.c - repost Zach Brown
2007-11-21 19:54 ` Dmitri Vorobiev
2007-11-21 20:46 ` Zach Brown
2007-11-21 22:49 ` [PATCH] [2.6.24-rc3-mm1] loop " Dmitri Vorobiev
2007-11-21 23:24 ` Andrew Morton
2007-11-21 23:47 ` Dmitri Vorobiev
2007-11-26 10:30 ` Al Viro
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=47447184.6040805@gmail.com \
--to=dmitri.vorobiev@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).