[PATCH] sem2mutex: fs/

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <[email protected]>
Cc: Eric Van Hensbergen <[email protected]>
Cc: Robert Love <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Trond Myklebust <[email protected]>
Cc: Dave Kleikamp <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Ingo Molnar 2006-03-26 01:37:12 -08:00 • committed by Linus Torvalds
commit 353ab6e97b
11 changed files with 99 additions and 89 deletions

View file

@ -6,7 +6,7 @@
#include <linux/vmalloc.h>
#include <linux/genhd.h>
#include <linux/bitops.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>
struct unique_numspace {
@ -16,7 +16,7 @@ struct unique_numspace {
struct semaphore mutex;
};
static DECLARE_MUTEX(numspace_mutex);
static DEFINE_MUTEX(numspace_mutex);
static int expand_numspace(struct unique_numspace *s)
{
@ -48,7 +48,7 @@ static int alloc_unique_number(struct unique_numspace *s)
{
int rval = 0;
down(&numspace_mutex);
mutex_lock(&numspace_mutex);
if (s->num_free < 1)
rval = expand_numspace(s);
if (!rval) {
@ -56,7 +56,7 @@ static int alloc_unique_number(struct unique_numspace *s)
--s->num_free;
__set_bit(rval, s->bits);
}
up(&numspace_mutex);
mutex_unlock(&numspace_mutex);
return rval;
}
@ -66,11 +66,11 @@ static void dealloc_unique_number(struct unique_numspace *s, int number)
int old_val;
if (number >= 0) {
down(&numspace_mutex);
mutex_lock(&numspace_mutex);
old_val = __test_and_clear_bit(number, s->bits);
if (old_val)
++s->num_free;
up(&numspace_mutex);
mutex_unlock(&numspace_mutex);
}
}