mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
3084b72de7
commit
39f8d472f2
4 changed files with 11 additions and 11 deletions
|
@ -40,7 +40,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
|
||||||
{
|
{
|
||||||
struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
|
struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
|
||||||
HFS_I(tree->inode)->flags = 0;
|
HFS_I(tree->inode)->flags = 0;
|
||||||
init_MUTEX(&HFS_I(tree->inode)->extents_lock);
|
mutex_init(&HFS_I(tree->inode)->extents_lock);
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case HFS_EXT_CNID:
|
case HFS_EXT_CNID:
|
||||||
hfs_inode_read_fork(tree->inode, mdb->drXTExtRec, mdb->drXTFlSize,
|
hfs_inode_read_fork(tree->inode, mdb->drXTExtRec, mdb->drXTFlSize,
|
||||||
|
|
|
@ -343,16 +343,16 @@ int hfs_get_block(struct inode *inode, sector_t block,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
down(&HFS_I(inode)->extents_lock);
|
mutex_lock(&HFS_I(inode)->extents_lock);
|
||||||
res = hfs_ext_read_extent(inode, ablock);
|
res = hfs_ext_read_extent(inode, ablock);
|
||||||
if (!res)
|
if (!res)
|
||||||
dblock = hfs_ext_find_block(HFS_I(inode)->cached_extents,
|
dblock = hfs_ext_find_block(HFS_I(inode)->cached_extents,
|
||||||
ablock - HFS_I(inode)->cached_start);
|
ablock - HFS_I(inode)->cached_start);
|
||||||
else {
|
else {
|
||||||
up(&HFS_I(inode)->extents_lock);
|
mutex_unlock(&HFS_I(inode)->extents_lock);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
up(&HFS_I(inode)->extents_lock);
|
mutex_unlock(&HFS_I(inode)->extents_lock);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
map_bh(bh_result, sb, HFS_SB(sb)->fs_start +
|
map_bh(bh_result, sb, HFS_SB(sb)->fs_start +
|
||||||
|
@ -375,7 +375,7 @@ int hfs_extend_file(struct inode *inode)
|
||||||
u32 start, len, goal;
|
u32 start, len, goal;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
down(&HFS_I(inode)->extents_lock);
|
mutex_lock(&HFS_I(inode)->extents_lock);
|
||||||
if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks)
|
if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks)
|
||||||
goal = hfs_ext_lastblock(HFS_I(inode)->first_extents);
|
goal = hfs_ext_lastblock(HFS_I(inode)->first_extents);
|
||||||
else {
|
else {
|
||||||
|
@ -425,7 +425,7 @@ int hfs_extend_file(struct inode *inode)
|
||||||
goto insert_extent;
|
goto insert_extent;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
up(&HFS_I(inode)->extents_lock);
|
mutex_unlock(&HFS_I(inode)->extents_lock);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
HFS_I(inode)->alloc_blocks += len;
|
HFS_I(inode)->alloc_blocks += len;
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
@ -487,7 +487,7 @@ void hfs_file_truncate(struct inode *inode)
|
||||||
if (blk_cnt == alloc_cnt)
|
if (blk_cnt == alloc_cnt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
down(&HFS_I(inode)->extents_lock);
|
mutex_lock(&HFS_I(inode)->extents_lock);
|
||||||
hfs_find_init(HFS_SB(sb)->ext_tree, &fd);
|
hfs_find_init(HFS_SB(sb)->ext_tree, &fd);
|
||||||
while (1) {
|
while (1) {
|
||||||
if (alloc_cnt == HFS_I(inode)->first_blocks) {
|
if (alloc_cnt == HFS_I(inode)->first_blocks) {
|
||||||
|
@ -514,7 +514,7 @@ void hfs_file_truncate(struct inode *inode)
|
||||||
hfs_brec_remove(&fd);
|
hfs_brec_remove(&fd);
|
||||||
}
|
}
|
||||||
hfs_find_exit(&fd);
|
hfs_find_exit(&fd);
|
||||||
up(&HFS_I(inode)->extents_lock);
|
mutex_unlock(&HFS_I(inode)->extents_lock);
|
||||||
|
|
||||||
HFS_I(inode)->alloc_blocks = blk_cnt;
|
HFS_I(inode)->alloc_blocks = blk_cnt;
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct hfs_inode_info {
|
||||||
struct list_head open_dir_list;
|
struct list_head open_dir_list;
|
||||||
struct inode *rsrc_inode;
|
struct inode *rsrc_inode;
|
||||||
|
|
||||||
struct semaphore extents_lock;
|
struct mutex extents_lock;
|
||||||
|
|
||||||
u16 alloc_blocks, clump_blocks;
|
u16 alloc_blocks, clump_blocks;
|
||||||
sector_t fs_blocks;
|
sector_t fs_blocks;
|
||||||
|
|
|
@ -150,7 +150,7 @@ struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, int mode)
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
init_MUTEX(&HFS_I(inode)->extents_lock);
|
mutex_init(&HFS_I(inode)->extents_lock);
|
||||||
INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list);
|
INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list);
|
||||||
hfs_cat_build_key(sb, (btree_key *)&HFS_I(inode)->cat_key, dir->i_ino, name);
|
hfs_cat_build_key(sb, (btree_key *)&HFS_I(inode)->cat_key, dir->i_ino, name);
|
||||||
inode->i_ino = HFS_SB(sb)->next_id++;
|
inode->i_ino = HFS_SB(sb)->next_id++;
|
||||||
|
@ -281,7 +281,7 @@ static int hfs_read_inode(struct inode *inode, void *data)
|
||||||
|
|
||||||
HFS_I(inode)->flags = 0;
|
HFS_I(inode)->flags = 0;
|
||||||
HFS_I(inode)->rsrc_inode = NULL;
|
HFS_I(inode)->rsrc_inode = NULL;
|
||||||
init_MUTEX(&HFS_I(inode)->extents_lock);
|
mutex_init(&HFS_I(inode)->extents_lock);
|
||||||
INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list);
|
INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list);
|
||||||
|
|
||||||
/* Initialize the inode */
|
/* Initialize the inode */
|
||||||
|
|
Loading…
Reference in a new issue