diff options
Diffstat (limited to 'fs/hfsplus/extents.c')
| -rw-r--r-- | fs/hfsplus/extents.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index fbb212fbb1ef..a7aafb35b624 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
| @@ -227,10 +227,8 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
| 227 | u32 ablock, dblock, mask; | 227 | u32 ablock, dblock, mask; |
| 228 | sector_t sector; | 228 | sector_t sector; |
| 229 | int was_dirty = 0; | 229 | int was_dirty = 0; |
| 230 | int shift; | ||
| 231 | 230 | ||
| 232 | /* Convert inode block to disk allocation block */ | 231 | /* Convert inode block to disk allocation block */ |
| 233 | shift = sbi->alloc_blksz_shift - sb->s_blocksize_bits; | ||
| 234 | ablock = iblock >> sbi->fs_shift; | 232 | ablock = iblock >> sbi->fs_shift; |
| 235 | 233 | ||
| 236 | if (iblock >= hip->fs_blocks) { | 234 | if (iblock >= hip->fs_blocks) { |
| @@ -498,11 +496,13 @@ int hfsplus_file_extend(struct inode *inode) | |||
| 498 | goto insert_extent; | 496 | goto insert_extent; |
| 499 | } | 497 | } |
| 500 | out: | 498 | out: |
| 501 | mutex_unlock(&hip->extents_lock); | ||
| 502 | if (!res) { | 499 | if (!res) { |
| 503 | hip->alloc_blocks += len; | 500 | hip->alloc_blocks += len; |
| 501 | mutex_unlock(&hip->extents_lock); | ||
| 504 | hfsplus_mark_inode_dirty(inode, HFSPLUS_I_ALLOC_DIRTY); | 502 | hfsplus_mark_inode_dirty(inode, HFSPLUS_I_ALLOC_DIRTY); |
| 503 | return 0; | ||
| 505 | } | 504 | } |
| 505 | mutex_unlock(&hip->extents_lock); | ||
| 506 | return res; | 506 | return res; |
| 507 | 507 | ||
| 508 | insert_extent: | 508 | insert_extent: |
| @@ -556,11 +556,13 @@ void hfsplus_file_truncate(struct inode *inode) | |||
| 556 | 556 | ||
| 557 | blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >> | 557 | blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >> |
| 558 | HFSPLUS_SB(sb)->alloc_blksz_shift; | 558 | HFSPLUS_SB(sb)->alloc_blksz_shift; |
| 559 | |||
| 560 | mutex_lock(&hip->extents_lock); | ||
| 561 | |||
| 559 | alloc_cnt = hip->alloc_blocks; | 562 | alloc_cnt = hip->alloc_blocks; |
| 560 | if (blk_cnt == alloc_cnt) | 563 | if (blk_cnt == alloc_cnt) |
| 561 | goto out; | 564 | goto out_unlock; |
| 562 | 565 | ||
| 563 | mutex_lock(&hip->extents_lock); | ||
| 564 | res = hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); | 566 | res = hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); |
| 565 | if (res) { | 567 | if (res) { |
| 566 | mutex_unlock(&hip->extents_lock); | 568 | mutex_unlock(&hip->extents_lock); |
| @@ -592,10 +594,10 @@ void hfsplus_file_truncate(struct inode *inode) | |||
| 592 | hfs_brec_remove(&fd); | 594 | hfs_brec_remove(&fd); |
| 593 | } | 595 | } |
| 594 | hfs_find_exit(&fd); | 596 | hfs_find_exit(&fd); |
| 595 | mutex_unlock(&hip->extents_lock); | ||
| 596 | 597 | ||
| 597 | hip->alloc_blocks = blk_cnt; | 598 | hip->alloc_blocks = blk_cnt; |
| 598 | out: | 599 | out_unlock: |
| 600 | mutex_unlock(&hip->extents_lock); | ||
| 599 | hip->phys_size = inode->i_size; | 601 | hip->phys_size = inode->i_size; |
| 600 | hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> | 602 | hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> |
| 601 | sb->s_blocksize_bits; | 603 | sb->s_blocksize_bits; |
