From: Matthias Kaehlcke <matthias@kaehlcke.net>
To: zippel@linux-m68k.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [patch 1/2] HFS: Convert bitmap_lock in a mutex
Date: Sun, 11 May 2008 20:15:30 +0200 [thread overview]
Message-ID: <20080511181530.GB21359@traven> (raw)
In-Reply-To: <20080511174332.994796915@kaehlcke.net>
Apple Macintosh file system: The semaphore bitmap_lock is used as a mutex.
Convert it to the mutex API
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
--
Index: linux-2.6/fs/hfs/bitmap.c
===================================================================
--- linux-2.6.orig/fs/hfs/bitmap.c 2008-05-11 20:10:11.000000000 +0200
+++ linux-2.6/fs/hfs/bitmap.c 2008-05-11 20:10:18.000000000 +0200
@@ -145,7 +145,7 @@
if (!*num_bits)
return 0;
- down(&HFS_SB(sb)->bitmap_lock);
+ mutex_lock(&HFS_SB(sb)->bitmap_lock);
bitmap = HFS_SB(sb)->bitmap;
pos = hfs_find_set_zero_bits(bitmap, HFS_SB(sb)->fs_ablocks, goal, num_bits);
@@ -162,7 +162,7 @@
HFS_SB(sb)->free_ablocks -= *num_bits;
hfs_bitmap_dirty(sb);
out:
- up(&HFS_SB(sb)->bitmap_lock);
+ mutex_unlock(&HFS_SB(sb)->bitmap_lock);
return pos;
}
@@ -205,7 +205,7 @@
if ((start + count) > HFS_SB(sb)->fs_ablocks)
return -2;
- down(&HFS_SB(sb)->bitmap_lock);
+ mutex_lock(&HFS_SB(sb)->bitmap_lock);
/* bitmap is always on a 32-bit boundary */
curr = HFS_SB(sb)->bitmap + (start / 32);
len = count;
@@ -236,7 +236,7 @@
}
out:
HFS_SB(sb)->free_ablocks += len;
- up(&HFS_SB(sb)->bitmap_lock);
+ mutex_unlock(&HFS_SB(sb)->bitmap_lock);
hfs_bitmap_dirty(sb);
return 0;
Index: linux-2.6/fs/hfs/hfs_fs.h
===================================================================
--- linux-2.6.orig/fs/hfs/hfs_fs.h 2008-05-11 20:10:11.000000000 +0200
+++ linux-2.6/fs/hfs/hfs_fs.h 2008-05-11 20:14:08.000000000 +0200
@@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <linux/types.h>
+#include <linux/mutex.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
@@ -139,7 +140,7 @@
struct nls_table *nls_io, *nls_disk;
- struct semaphore bitmap_lock;
+ struct mutex bitmap_lock;
unsigned long flags;
Index: linux-2.6/fs/hfs/super.c
===================================================================
--- linux-2.6.orig/fs/hfs/super.c 2008-05-11 20:10:11.000000000 +0200
+++ linux-2.6/fs/hfs/super.c 2008-05-11 20:10:18.000000000 +0200
@@ -372,7 +372,7 @@
sb->s_op = &hfs_super_operations;
sb->s_flags |= MS_NODIRATIME;
- init_MUTEX(&sbi->bitmap_lock);
+ mutex_init(&sbi->bitmap_lock);
res = hfs_mdb_get(sb);
if (res) {
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
La posibilidad de realizar un suenyo es lo
que hace que la vida sea interesante
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
next prev parent reply other threads:[~2008-05-11 18:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-11 17:43 [patch 0/2] HFS: Convert bitmap_lock and extents_lock in mutexes matthias
2008-05-11 17:43 ` [patch 1/2] HFS: Convert bitmap_lock in a mutex matthias
2008-05-11 18:15 ` Matthias Kaehlcke [this message]
2008-05-11 17:43 ` [patch 2/2] HFS: Convert extents_lock " matthias
2008-05-11 18:16 ` Matthias Kaehlcke
2008-05-11 18:06 ` [patch 0/2] HFS: Convert bitmap_lock and extents_lock in mutexes Matthias Kaehlcke
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=20080511181530.GB21359@traven \
--to=matthias@kaehlcke.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zippel@linux-m68k.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