From: Kevin Winchester <kjwinchester@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Eric Van Hensbergen <ericvh@gmail.com>,
Ron Minnich <rminnich@sandia.gov>,
Latchesar Ionkov <lucho@ionkov.net>,
v9fs-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Kevin Winchester <kjwinchester@gmail.com>
Subject: [patch 2/2] 9p util semaphore to mutex
Date: Sun, 09 Dec 2007 13:15:11 -0400 [thread overview]
Message-ID: <20071209171613.670807836@gmail.com> (raw)
In-Reply-To: 20071209171509.601451827@gmail.com
[-- Attachment #1: 9p-util-sem-to-mutex.patch --]
[-- Type: text/plain, Size: 1537 bytes --]
Convert the semaphore to a mutex in net/9p/util.c
Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
---
net/9p/util.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: v2.6.24-rc4/net/9p/util.c
===================================================================
--- v2.6.24-rc4.orig/net/9p/util.c
+++ v2.6.24-rc4/net/9p/util.c
@@ -33,7 +33,7 @@
#include <net/9p/9p.h>
struct p9_idpool {
- struct semaphore lock;
+ struct mutex lock;
struct idr pool;
};
@@ -45,7 +45,7 @@ struct p9_idpool *p9_idpool_create(void)
if (!p)
return ERR_PTR(-ENOMEM);
- init_MUTEX(&p->lock);
+ mutex_init(&p->lock);
idr_init(&p->pool);
return p;
@@ -76,14 +76,14 @@ retry:
if (idr_pre_get(&p->pool, GFP_KERNEL) == 0)
return 0;
- if (down_interruptible(&p->lock) == -EINTR) {
+ if (mutex_lock_interruptible(&p->lock) == -EINTR) {
P9_EPRINTK(KERN_WARNING, "Interrupted while locking\n");
return -1;
}
/* no need to store exactly p, we just need something non-null */
error = idr_get_new(&p->pool, p, &i);
- up(&p->lock);
+ mutex_unlock(&p->lock);
if (error == -EAGAIN)
goto retry;
@@ -104,12 +104,12 @@ EXPORT_SYMBOL(p9_idpool_get);
void p9_idpool_put(int id, struct p9_idpool *p)
{
- if (down_interruptible(&p->lock) == -EINTR) {
+ if (mutex_lock_interruptible(&p->lock) == -EINTR) {
P9_EPRINTK(KERN_WARNING, "Interrupted while locking\n");
return;
}
idr_remove(&p->pool, id);
- up(&p->lock);
+ mutex_unlock(&p->lock);
}
EXPORT_SYMBOL(p9_idpool_put);
--
next prev parent reply other threads:[~2007-12-09 17:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071209171509.601451827@gmail.com>
2007-12-09 17:15 ` [patch 1/2] echoaudio semaphore to mutex Kevin Winchester
2007-12-10 9:06 ` Giuliano Pochini
2007-12-17 10:15 ` Takashi Iwai
2007-12-09 17:15 ` Kevin Winchester [this message]
2007-12-12 2:06 ` [patch 2/2] 9p util " Andrew Morton
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=20071209171613.670807836@gmail.com \
--to=kjwinchester@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ericvh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=mingo@elte.hu \
--cc=rminnich@sandia.gov \
--cc=v9fs-developer@lists.sourceforge.net \
/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