diff options
author | Matthias Kaehlcke <matthias@kaehlcke.net> | 2008-07-25 04:46:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:33 -0400 |
commit | 895c23f8c39c0c8d7b536bb2566d4aa968d78be2 (patch) | |
tree | 3744aca0dc59f075e53af348062ad11efdb21192 /fs/hfsplus | |
parent | 39f8d472f280dee6503a364d1d911b9e20ce3ec9 (diff) |
hfsplus: convert the extents_lock in a mutex
Apple Extended HFS file system: The semaphore extents lock is used as a
mutex. Convert it to the mutex API.
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r-- | fs/hfsplus/extents.c | 14 | ||||
-rw-r--r-- | fs/hfsplus/hfsplus_fs.h | 3 | ||||
-rw-r--r-- | fs/hfsplus/inode.c | 4 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 12e899cd7886..fec8f61227ff 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
@@ -199,16 +199,16 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
199 | goto done; | 199 | goto done; |
200 | } | 200 | } |
201 | 201 | ||
202 | down(&HFSPLUS_I(inode).extents_lock); | 202 | mutex_lock(&HFSPLUS_I(inode).extents_lock); |
203 | res = hfsplus_ext_read_extent(inode, ablock); | 203 | res = hfsplus_ext_read_extent(inode, ablock); |
204 | if (!res) { | 204 | if (!res) { |
205 | dblock = hfsplus_ext_find_block(HFSPLUS_I(inode).cached_extents, ablock - | 205 | dblock = hfsplus_ext_find_block(HFSPLUS_I(inode).cached_extents, ablock - |
206 | HFSPLUS_I(inode).cached_start); | 206 | HFSPLUS_I(inode).cached_start); |
207 | } else { | 207 | } else { |
208 | up(&HFSPLUS_I(inode).extents_lock); | 208 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); |
209 | return -EIO; | 209 | return -EIO; |
210 | } | 210 | } |
211 | up(&HFSPLUS_I(inode).extents_lock); | 211 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); |
212 | 212 | ||
213 | done: | 213 | done: |
214 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); | 214 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); |
@@ -355,7 +355,7 @@ int hfsplus_file_extend(struct inode *inode) | |||
355 | return -ENOSPC; | 355 | return -ENOSPC; |
356 | } | 356 | } |
357 | 357 | ||
358 | down(&HFSPLUS_I(inode).extents_lock); | 358 | mutex_lock(&HFSPLUS_I(inode).extents_lock); |
359 | if (HFSPLUS_I(inode).alloc_blocks == HFSPLUS_I(inode).first_blocks) | 359 | if (HFSPLUS_I(inode).alloc_blocks == HFSPLUS_I(inode).first_blocks) |
360 | goal = hfsplus_ext_lastblock(HFSPLUS_I(inode).first_extents); | 360 | goal = hfsplus_ext_lastblock(HFSPLUS_I(inode).first_extents); |
361 | else { | 361 | else { |
@@ -408,7 +408,7 @@ int hfsplus_file_extend(struct inode *inode) | |||
408 | goto insert_extent; | 408 | goto insert_extent; |
409 | } | 409 | } |
410 | out: | 410 | out: |
411 | up(&HFSPLUS_I(inode).extents_lock); | 411 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); |
412 | if (!res) { | 412 | if (!res) { |
413 | HFSPLUS_I(inode).alloc_blocks += len; | 413 | HFSPLUS_I(inode).alloc_blocks += len; |
414 | mark_inode_dirty(inode); | 414 | mark_inode_dirty(inode); |
@@ -465,7 +465,7 @@ void hfsplus_file_truncate(struct inode *inode) | |||
465 | if (blk_cnt == alloc_cnt) | 465 | if (blk_cnt == alloc_cnt) |
466 | goto out; | 466 | goto out; |
467 | 467 | ||
468 | down(&HFSPLUS_I(inode).extents_lock); | 468 | mutex_lock(&HFSPLUS_I(inode).extents_lock); |
469 | hfs_find_init(HFSPLUS_SB(sb).ext_tree, &fd); | 469 | hfs_find_init(HFSPLUS_SB(sb).ext_tree, &fd); |
470 | while (1) { | 470 | while (1) { |
471 | if (alloc_cnt == HFSPLUS_I(inode).first_blocks) { | 471 | if (alloc_cnt == HFSPLUS_I(inode).first_blocks) { |
@@ -492,7 +492,7 @@ void hfsplus_file_truncate(struct inode *inode) | |||
492 | hfs_brec_remove(&fd); | 492 | hfs_brec_remove(&fd); |
493 | } | 493 | } |
494 | hfs_find_exit(&fd); | 494 | hfs_find_exit(&fd); |
495 | up(&HFSPLUS_I(inode).extents_lock); | 495 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); |
496 | 496 | ||
497 | HFSPLUS_I(inode).alloc_blocks = blk_cnt; | 497 | HFSPLUS_I(inode).alloc_blocks = blk_cnt; |
498 | out: | 498 | out: |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 9e59537b43d5..f027a905225f 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define _LINUX_HFSPLUS_FS_H | 11 | #define _LINUX_HFSPLUS_FS_H |
12 | 12 | ||
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/mutex.h> | ||
14 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
15 | #include "hfsplus_raw.h" | 16 | #include "hfsplus_raw.h" |
16 | 17 | ||
@@ -154,7 +155,7 @@ struct hfsplus_sb_info { | |||
154 | 155 | ||
155 | 156 | ||
156 | struct hfsplus_inode_info { | 157 | struct hfsplus_inode_info { |
157 | struct semaphore extents_lock; | 158 | struct mutex extents_lock; |
158 | u32 clump_blocks, alloc_blocks; | 159 | u32 clump_blocks, alloc_blocks; |
159 | sector_t fs_blocks; | 160 | sector_t fs_blocks; |
160 | /* Allocation extents from catalog record or volume header */ | 161 | /* Allocation extents from catalog record or volume header */ |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 67e1c8b467c4..cc3b5e24339b 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -163,7 +163,7 @@ static struct dentry *hfsplus_file_lookup(struct inode *dir, struct dentry *dent | |||
163 | 163 | ||
164 | inode->i_ino = dir->i_ino; | 164 | inode->i_ino = dir->i_ino; |
165 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); | 165 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); |
166 | init_MUTEX(&HFSPLUS_I(inode).extents_lock); | 166 | mutex_init(&HFSPLUS_I(inode).extents_lock); |
167 | HFSPLUS_I(inode).flags = HFSPLUS_FLG_RSRC; | 167 | HFSPLUS_I(inode).flags = HFSPLUS_FLG_RSRC; |
168 | 168 | ||
169 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | 169 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); |
@@ -316,7 +316,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode) | |||
316 | inode->i_nlink = 1; | 316 | inode->i_nlink = 1; |
317 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; | 317 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; |
318 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); | 318 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); |
319 | init_MUTEX(&HFSPLUS_I(inode).extents_lock); | 319 | mutex_init(&HFSPLUS_I(inode).extents_lock); |
320 | atomic_set(&HFSPLUS_I(inode).opencnt, 0); | 320 | atomic_set(&HFSPLUS_I(inode).opencnt, 0); |
321 | HFSPLUS_I(inode).flags = 0; | 321 | HFSPLUS_I(inode).flags = 0; |
322 | memset(HFSPLUS_I(inode).first_extents, 0, sizeof(hfsplus_extent_rec)); | 322 | memset(HFSPLUS_I(inode).first_extents, 0, sizeof(hfsplus_extent_rec)); |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index ce97a54518d8..3859118531c7 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -34,7 +34,7 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino) | |||
34 | return inode; | 34 | return inode; |
35 | 35 | ||
36 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); | 36 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); |
37 | init_MUTEX(&HFSPLUS_I(inode).extents_lock); | 37 | mutex_init(&HFSPLUS_I(inode).extents_lock); |
38 | HFSPLUS_I(inode).flags = 0; | 38 | HFSPLUS_I(inode).flags = 0; |
39 | HFSPLUS_I(inode).rsrc_inode = NULL; | 39 | HFSPLUS_I(inode).rsrc_inode = NULL; |
40 | atomic_set(&HFSPLUS_I(inode).opencnt, 0); | 40 | atomic_set(&HFSPLUS_I(inode).opencnt, 0); |