diff options
author | Matthias Kaehlcke <matthias@kaehlcke.net> | 2008-07-25 04:46:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:33 -0400 |
commit | 39f8d472f280dee6503a364d1d911b9e20ce3ec9 (patch) | |
tree | 43c05018acca3e30234b914e4bf80439915a2807 /fs | |
parent | 3084b72de73a6f8af0f16989ffb348068bd066d4 (diff) |
hfs: convert extents_lock in a mutex
Apple Macintosh file system: The semaphore extens_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')
-rw-r--r-- | fs/hfs/btree.c | 2 | ||||
-rw-r--r-- | fs/hfs/extent.c | 14 | ||||
-rw-r--r-- | fs/hfs/hfs_fs.h | 2 | ||||
-rw-r--r-- | fs/hfs/inode.c | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index f6621a785202..9b9d6395bad3 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c | |||
@@ -40,7 +40,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke | |||
40 | { | 40 | { |
41 | struct hfs_mdb *mdb = HFS_SB(sb)->mdb; | 41 | struct hfs_mdb *mdb = HFS_SB(sb)->mdb; |
42 | HFS_I(tree->inode)->flags = 0; | 42 | HFS_I(tree->inode)->flags = 0; |
43 | init_MUTEX(&HFS_I(tree->inode)->extents_lock); | 43 | mutex_init(&HFS_I(tree->inode)->extents_lock); |
44 | switch (id) { | 44 | switch (id) { |
45 | case HFS_EXT_CNID: | 45 | case HFS_EXT_CNID: |
46 | hfs_inode_read_fork(tree->inode, mdb->drXTExtRec, mdb->drXTFlSize, | 46 | hfs_inode_read_fork(tree->inode, mdb->drXTExtRec, mdb->drXTFlSize, |
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c index c176f67ba0a5..2c16316d2917 100644 --- a/fs/hfs/extent.c +++ b/fs/hfs/extent.c | |||
@@ -343,16 +343,16 @@ int hfs_get_block(struct inode *inode, sector_t block, | |||
343 | goto done; | 343 | goto done; |
344 | } | 344 | } |
345 | 345 | ||
346 | down(&HFS_I(inode)->extents_lock); | 346 | mutex_lock(&HFS_I(inode)->extents_lock); |
347 | res = hfs_ext_read_extent(inode, ablock); | 347 | res = hfs_ext_read_extent(inode, ablock); |
348 | if (!res) | 348 | if (!res) |
349 | dblock = hfs_ext_find_block(HFS_I(inode)->cached_extents, | 349 | dblock = hfs_ext_find_block(HFS_I(inode)->cached_extents, |
350 | ablock - HFS_I(inode)->cached_start); | 350 | ablock - HFS_I(inode)->cached_start); |
351 | else { | 351 | else { |
352 | up(&HFS_I(inode)->extents_lock); | 352 | mutex_unlock(&HFS_I(inode)->extents_lock); |
353 | return -EIO; | 353 | return -EIO; |
354 | } | 354 | } |
355 | up(&HFS_I(inode)->extents_lock); | 355 | mutex_unlock(&HFS_I(inode)->extents_lock); |
356 | 356 | ||
357 | done: | 357 | done: |
358 | map_bh(bh_result, sb, HFS_SB(sb)->fs_start + | 358 | map_bh(bh_result, sb, HFS_SB(sb)->fs_start + |
@@ -375,7 +375,7 @@ int hfs_extend_file(struct inode *inode) | |||
375 | u32 start, len, goal; | 375 | u32 start, len, goal; |
376 | int res; | 376 | int res; |
377 | 377 | ||
378 | down(&HFS_I(inode)->extents_lock); | 378 | mutex_lock(&HFS_I(inode)->extents_lock); |
379 | if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) | 379 | if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) |
380 | goal = hfs_ext_lastblock(HFS_I(inode)->first_extents); | 380 | goal = hfs_ext_lastblock(HFS_I(inode)->first_extents); |
381 | else { | 381 | else { |
@@ -425,7 +425,7 @@ int hfs_extend_file(struct inode *inode) | |||
425 | goto insert_extent; | 425 | goto insert_extent; |
426 | } | 426 | } |
427 | out: | 427 | out: |
428 | up(&HFS_I(inode)->extents_lock); | 428 | mutex_unlock(&HFS_I(inode)->extents_lock); |
429 | if (!res) { | 429 | if (!res) { |
430 | HFS_I(inode)->alloc_blocks += len; | 430 | HFS_I(inode)->alloc_blocks += len; |
431 | mark_inode_dirty(inode); | 431 | mark_inode_dirty(inode); |
@@ -487,7 +487,7 @@ void hfs_file_truncate(struct inode *inode) | |||
487 | if (blk_cnt == alloc_cnt) | 487 | if (blk_cnt == alloc_cnt) |
488 | goto out; | 488 | goto out; |
489 | 489 | ||
490 | down(&HFS_I(inode)->extents_lock); | 490 | mutex_lock(&HFS_I(inode)->extents_lock); |
491 | hfs_find_init(HFS_SB(sb)->ext_tree, &fd); | 491 | hfs_find_init(HFS_SB(sb)->ext_tree, &fd); |
492 | while (1) { | 492 | while (1) { |
493 | if (alloc_cnt == HFS_I(inode)->first_blocks) { | 493 | if (alloc_cnt == HFS_I(inode)->first_blocks) { |
@@ -514,7 +514,7 @@ void hfs_file_truncate(struct inode *inode) | |||
514 | hfs_brec_remove(&fd); | 514 | hfs_brec_remove(&fd); |
515 | } | 515 | } |
516 | hfs_find_exit(&fd); | 516 | hfs_find_exit(&fd); |
517 | up(&HFS_I(inode)->extents_lock); | 517 | mutex_unlock(&HFS_I(inode)->extents_lock); |
518 | 518 | ||
519 | HFS_I(inode)->alloc_blocks = blk_cnt; | 519 | HFS_I(inode)->alloc_blocks = blk_cnt; |
520 | out: | 520 | out: |
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index ad6528819117..9955232fdf8c 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h | |||
@@ -54,7 +54,7 @@ struct hfs_inode_info { | |||
54 | struct list_head open_dir_list; | 54 | struct list_head open_dir_list; |
55 | struct inode *rsrc_inode; | 55 | struct inode *rsrc_inode; |
56 | 56 | ||
57 | struct semaphore extents_lock; | 57 | struct mutex extents_lock; |
58 | 58 | ||
59 | u16 alloc_blocks, clump_blocks; | 59 | u16 alloc_blocks, clump_blocks; |
60 | sector_t fs_blocks; | 60 | sector_t fs_blocks; |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 97f8446c4ff4..dc4ec640e875 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -150,7 +150,7 @@ struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, int mode) | |||
150 | if (!inode) | 150 | if (!inode) |
151 | return NULL; | 151 | return NULL; |
152 | 152 | ||
153 | init_MUTEX(&HFS_I(inode)->extents_lock); | 153 | mutex_init(&HFS_I(inode)->extents_lock); |
154 | INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list); | 154 | INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list); |
155 | hfs_cat_build_key(sb, (btree_key *)&HFS_I(inode)->cat_key, dir->i_ino, name); | 155 | hfs_cat_build_key(sb, (btree_key *)&HFS_I(inode)->cat_key, dir->i_ino, name); |
156 | inode->i_ino = HFS_SB(sb)->next_id++; | 156 | inode->i_ino = HFS_SB(sb)->next_id++; |
@@ -281,7 +281,7 @@ static int hfs_read_inode(struct inode *inode, void *data) | |||
281 | 281 | ||
282 | HFS_I(inode)->flags = 0; | 282 | HFS_I(inode)->flags = 0; |
283 | HFS_I(inode)->rsrc_inode = NULL; | 283 | HFS_I(inode)->rsrc_inode = NULL; |
284 | init_MUTEX(&HFS_I(inode)->extents_lock); | 284 | mutex_init(&HFS_I(inode)->extents_lock); |
285 | INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list); | 285 | INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list); |
286 | 286 | ||
287 | /* Initialize the inode */ | 287 | /* Initialize the inode */ |