diff options
Diffstat (limited to 'fs/hfsplus/extents.c')
| -rw-r--r-- | fs/hfsplus/extents.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index b1127ef2675..1ae2fe5cfa7 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
| @@ -83,7 +83,8 @@ static u32 hfsplus_ext_lastblock(struct hfsplus_extent *ext) | |||
| 83 | return be32_to_cpu(ext->start_block) + be32_to_cpu(ext->block_count); | 83 | return be32_to_cpu(ext->start_block) + be32_to_cpu(ext->block_count); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static void __hfsplus_ext_write_extent(struct inode *inode, struct hfs_find_data *fd) | 86 | static void __hfsplus_ext_write_extent(struct inode *inode, |
| 87 | struct hfs_find_data *fd) | ||
| 87 | { | 88 | { |
| 88 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | 89 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); |
| 89 | int res; | 90 | int res; |
| @@ -152,11 +153,13 @@ static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd, | |||
| 152 | return -ENOENT; | 153 | return -ENOENT; |
| 153 | if (fd->entrylength != sizeof(hfsplus_extent_rec)) | 154 | if (fd->entrylength != sizeof(hfsplus_extent_rec)) |
| 154 | return -EIO; | 155 | return -EIO; |
| 155 | hfs_bnode_read(fd->bnode, extent, fd->entryoffset, sizeof(hfsplus_extent_rec)); | 156 | hfs_bnode_read(fd->bnode, extent, fd->entryoffset, |
| 157 | sizeof(hfsplus_extent_rec)); | ||
| 156 | return 0; | 158 | return 0; |
| 157 | } | 159 | } |
| 158 | 160 | ||
| 159 | static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct inode *inode, u32 block) | 161 | static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, |
| 162 | struct inode *inode, u32 block) | ||
| 160 | { | 163 | { |
| 161 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | 164 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); |
| 162 | int res; | 165 | int res; |
| @@ -172,7 +175,8 @@ static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct in | |||
| 172 | HFSPLUS_TYPE_DATA); | 175 | HFSPLUS_TYPE_DATA); |
| 173 | if (!res) { | 176 | if (!res) { |
| 174 | hip->cached_start = be32_to_cpu(fd->key->ext.start_block); | 177 | hip->cached_start = be32_to_cpu(fd->key->ext.start_block); |
| 175 | hip->cached_blocks = hfsplus_ext_block_count(hip->cached_extents); | 178 | hip->cached_blocks = |
| 179 | hfsplus_ext_block_count(hip->cached_extents); | ||
| 176 | } else { | 180 | } else { |
| 177 | hip->cached_start = hip->cached_blocks = 0; | 181 | hip->cached_start = hip->cached_blocks = 0; |
| 178 | hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); | 182 | hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); |
| @@ -249,9 +253,12 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
| 249 | mutex_unlock(&hip->extents_lock); | 253 | mutex_unlock(&hip->extents_lock); |
| 250 | 254 | ||
| 251 | done: | 255 | done: |
| 252 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); | 256 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", |
| 257 | inode->i_ino, (long long)iblock, dblock); | ||
| 253 | mask = (1 << sbi->fs_shift) - 1; | 258 | mask = (1 << sbi->fs_shift) - 1; |
| 254 | map_bh(bh_result, sb, (dblock << sbi->fs_shift) + sbi->blockoffset + (iblock & mask)); | 259 | map_bh(bh_result, sb, |
| 260 | (dblock << sbi->fs_shift) + sbi->blockoffset + | ||
| 261 | (iblock & mask)); | ||
| 255 | if (create) { | 262 | if (create) { |
| 256 | set_buffer_new(bh_result); | 263 | set_buffer_new(bh_result); |
| 257 | hip->phys_size += sb->s_blocksize; | 264 | hip->phys_size += sb->s_blocksize; |
| @@ -342,7 +349,8 @@ found: | |||
| 342 | } | 349 | } |
| 343 | } | 350 | } |
| 344 | 351 | ||
| 345 | int hfsplus_free_fork(struct super_block *sb, u32 cnid, struct hfsplus_fork_raw *fork, int type) | 352 | int hfsplus_free_fork(struct super_block *sb, u32 cnid, |
| 353 | struct hfsplus_fork_raw *fork, int type) | ||
| 346 | { | 354 | { |
| 347 | struct hfs_find_data fd; | 355 | struct hfs_find_data fd; |
| 348 | hfsplus_extent_rec ext_entry; | 356 | hfsplus_extent_rec ext_entry; |
| @@ -497,7 +505,8 @@ void hfsplus_file_truncate(struct inode *inode) | |||
| 497 | &page, &fsdata); | 505 | &page, &fsdata); |
| 498 | if (res) | 506 | if (res) |
| 499 | return; | 507 | return; |
| 500 | res = pagecache_write_end(NULL, mapping, size, 0, 0, page, fsdata); | 508 | res = pagecache_write_end(NULL, mapping, size, |
| 509 | 0, 0, page, fsdata); | ||
| 501 | if (res < 0) | 510 | if (res < 0) |
| 502 | return; | 511 | return; |
| 503 | mark_inode_dirty(inode); | 512 | mark_inode_dirty(inode); |
| @@ -543,7 +552,8 @@ void hfsplus_file_truncate(struct inode *inode) | |||
| 543 | hip->alloc_blocks = blk_cnt; | 552 | hip->alloc_blocks = blk_cnt; |
| 544 | out: | 553 | out: |
| 545 | hip->phys_size = inode->i_size; | 554 | hip->phys_size = inode->i_size; |
| 546 | hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; | 555 | hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> |
| 556 | sb->s_blocksize_bits; | ||
| 547 | inode_set_bytes(inode, hip->fs_blocks << sb->s_blocksize_bits); | 557 | inode_set_bytes(inode, hip->fs_blocks << sb->s_blocksize_bits); |
| 548 | hfsplus_mark_inode_dirty(inode, HFSPLUS_I_ALLOC_DIRTY); | 558 | hfsplus_mark_inode_dirty(inode, HFSPLUS_I_ALLOC_DIRTY); |
| 549 | } | 559 | } |
