diff options
author | Christoph Hellwig <hch@tuxera.com> | 2010-09-30 23:43:31 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-09-30 23:43:31 -0400 |
commit | 6af502de224c3742936d54eee7e3690c09822934 (patch) | |
tree | 9988331693952348503d64764ff81dc3b5d801ab /fs/hfsplus/extents.c | |
parent | dd73a01a30d729e8fa6f829c4582650e258e36f9 (diff) |
hfsplus: fix HFSPLUS_I calling convention
HFSPLUS_I doesn't return a pointer to the hfsplus-specific inode
information like all other FOO_I macros, but dereference the pointer in a way
that made it look like a direct struct derefence. This only works as long
as the HFSPLUS_I macro is used directly and prevents us from keepig a local
hfsplus_inode_info pointer. Fix the calling convention and introduce a local
hip variable in all functions that use it constantly.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/extents.c')
-rw-r--r-- | fs/hfsplus/extents.c | 171 |
1 files changed, 92 insertions, 79 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 181969814344..b1017eaa4fdc 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
@@ -85,27 +85,32 @@ static u32 hfsplus_ext_lastblock(struct hfsplus_extent *ext) | |||
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, struct hfs_find_data *fd) |
87 | { | 87 | { |
88 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | ||
88 | int res; | 89 | int res; |
89 | 90 | ||
90 | hfsplus_ext_build_key(fd->search_key, inode->i_ino, HFSPLUS_I(inode).cached_start, | 91 | hfsplus_ext_build_key(fd->search_key, inode->i_ino, hip->cached_start, |
91 | HFSPLUS_IS_RSRC(inode) ? HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA); | 92 | HFSPLUS_IS_RSRC(inode) ? |
93 | HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA); | ||
94 | |||
92 | res = hfs_brec_find(fd); | 95 | res = hfs_brec_find(fd); |
93 | if (HFSPLUS_I(inode).flags & HFSPLUS_FLG_EXT_NEW) { | 96 | if (hip->flags & HFSPLUS_FLG_EXT_NEW) { |
94 | if (res != -ENOENT) | 97 | if (res != -ENOENT) |
95 | return; | 98 | return; |
96 | hfs_brec_insert(fd, HFSPLUS_I(inode).cached_extents, sizeof(hfsplus_extent_rec)); | 99 | hfs_brec_insert(fd, hip->cached_extents, |
97 | HFSPLUS_I(inode).flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); | 100 | sizeof(hfsplus_extent_rec)); |
101 | hip->flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); | ||
98 | } else { | 102 | } else { |
99 | if (res) | 103 | if (res) |
100 | return; | 104 | return; |
101 | hfs_bnode_write(fd->bnode, HFSPLUS_I(inode).cached_extents, fd->entryoffset, fd->entrylength); | 105 | hfs_bnode_write(fd->bnode, hip->cached_extents, |
102 | HFSPLUS_I(inode).flags &= ~HFSPLUS_FLG_EXT_DIRTY; | 106 | fd->entryoffset, fd->entrylength); |
107 | hip->flags &= ~HFSPLUS_FLG_EXT_DIRTY; | ||
103 | } | 108 | } |
104 | } | 109 | } |
105 | 110 | ||
106 | void hfsplus_ext_write_extent(struct inode *inode) | 111 | void hfsplus_ext_write_extent(struct inode *inode) |
107 | { | 112 | { |
108 | if (HFSPLUS_I(inode).flags & HFSPLUS_FLG_EXT_DIRTY) { | 113 | if (HFSPLUS_I(inode)->flags & HFSPLUS_FLG_EXT_DIRTY) { |
109 | struct hfs_find_data fd; | 114 | struct hfs_find_data fd; |
110 | 115 | ||
111 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); | 116 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); |
@@ -136,30 +141,34 @@ static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd, | |||
136 | 141 | ||
137 | static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct inode *inode, u32 block) | 142 | static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct inode *inode, u32 block) |
138 | { | 143 | { |
144 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | ||
139 | int res; | 145 | int res; |
140 | 146 | ||
141 | if (HFSPLUS_I(inode).flags & HFSPLUS_FLG_EXT_DIRTY) | 147 | if (hip->flags & HFSPLUS_FLG_EXT_DIRTY) |
142 | __hfsplus_ext_write_extent(inode, fd); | 148 | __hfsplus_ext_write_extent(inode, fd); |
143 | 149 | ||
144 | res = __hfsplus_ext_read_extent(fd, HFSPLUS_I(inode).cached_extents, inode->i_ino, | 150 | res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, |
145 | block, HFSPLUS_IS_RSRC(inode) ? HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA); | 151 | block, HFSPLUS_IS_RSRC(inode) ? |
152 | HFSPLUS_TYPE_RSRC : | ||
153 | HFSPLUS_TYPE_DATA); | ||
146 | if (!res) { | 154 | if (!res) { |
147 | HFSPLUS_I(inode).cached_start = be32_to_cpu(fd->key->ext.start_block); | 155 | hip->cached_start = be32_to_cpu(fd->key->ext.start_block); |
148 | HFSPLUS_I(inode).cached_blocks = hfsplus_ext_block_count(HFSPLUS_I(inode).cached_extents); | 156 | hip->cached_blocks = hfsplus_ext_block_count(hip->cached_extents); |
149 | } else { | 157 | } else { |
150 | HFSPLUS_I(inode).cached_start = HFSPLUS_I(inode).cached_blocks = 0; | 158 | hip->cached_start = hip->cached_blocks = 0; |
151 | HFSPLUS_I(inode).flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); | 159 | hip->flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); |
152 | } | 160 | } |
153 | return res; | 161 | return res; |
154 | } | 162 | } |
155 | 163 | ||
156 | static int hfsplus_ext_read_extent(struct inode *inode, u32 block) | 164 | static int hfsplus_ext_read_extent(struct inode *inode, u32 block) |
157 | { | 165 | { |
166 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | ||
158 | struct hfs_find_data fd; | 167 | struct hfs_find_data fd; |
159 | int res; | 168 | int res; |
160 | 169 | ||
161 | if (block >= HFSPLUS_I(inode).cached_start && | 170 | if (block >= hip->cached_start && |
162 | block < HFSPLUS_I(inode).cached_start + HFSPLUS_I(inode).cached_blocks) | 171 | block < hip->cached_start + hip->cached_blocks) |
163 | return 0; | 172 | return 0; |
164 | 173 | ||
165 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); | 174 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); |
@@ -174,6 +183,7 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
174 | { | 183 | { |
175 | struct super_block *sb = inode->i_sb; | 184 | struct super_block *sb = inode->i_sb; |
176 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | 185 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); |
186 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | ||
177 | int res = -EIO; | 187 | int res = -EIO; |
178 | u32 ablock, dblock, mask; | 188 | u32 ablock, dblock, mask; |
179 | int shift; | 189 | int shift; |
@@ -182,10 +192,10 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
182 | shift = sbi->alloc_blksz_shift - sb->s_blocksize_bits; | 192 | shift = sbi->alloc_blksz_shift - sb->s_blocksize_bits; |
183 | ablock = iblock >> sbi->fs_shift; | 193 | ablock = iblock >> sbi->fs_shift; |
184 | 194 | ||
185 | if (iblock >= HFSPLUS_I(inode).fs_blocks) { | 195 | if (iblock >= hip->fs_blocks) { |
186 | if (iblock > HFSPLUS_I(inode).fs_blocks || !create) | 196 | if (iblock > hip->fs_blocks || !create) |
187 | return -EIO; | 197 | return -EIO; |
188 | if (ablock >= HFSPLUS_I(inode).alloc_blocks) { | 198 | if (ablock >= hip->alloc_blocks) { |
189 | res = hfsplus_file_extend(inode); | 199 | res = hfsplus_file_extend(inode); |
190 | if (res) | 200 | if (res) |
191 | return res; | 201 | return res; |
@@ -193,24 +203,24 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
193 | } else | 203 | } else |
194 | create = 0; | 204 | create = 0; |
195 | 205 | ||
196 | if (ablock < HFSPLUS_I(inode).first_blocks) { | 206 | if (ablock < hip->first_blocks) { |
197 | dblock = hfsplus_ext_find_block(HFSPLUS_I(inode).first_extents, ablock); | 207 | dblock = hfsplus_ext_find_block(hip->first_extents, ablock); |
198 | goto done; | 208 | goto done; |
199 | } | 209 | } |
200 | 210 | ||
201 | if (inode->i_ino == HFSPLUS_EXT_CNID) | 211 | if (inode->i_ino == HFSPLUS_EXT_CNID) |
202 | return -EIO; | 212 | return -EIO; |
203 | 213 | ||
204 | mutex_lock(&HFSPLUS_I(inode).extents_lock); | 214 | mutex_lock(&hip->extents_lock); |
205 | res = hfsplus_ext_read_extent(inode, ablock); | 215 | res = hfsplus_ext_read_extent(inode, ablock); |
206 | if (!res) { | 216 | if (!res) { |
207 | dblock = hfsplus_ext_find_block(HFSPLUS_I(inode).cached_extents, ablock - | 217 | dblock = hfsplus_ext_find_block(hip->cached_extents, |
208 | HFSPLUS_I(inode).cached_start); | 218 | ablock - hip->cached_start); |
209 | } else { | 219 | } else { |
210 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); | 220 | mutex_unlock(&hip->extents_lock); |
211 | return -EIO; | 221 | return -EIO; |
212 | } | 222 | } |
213 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); | 223 | mutex_unlock(&hip->extents_lock); |
214 | 224 | ||
215 | done: | 225 | done: |
216 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); | 226 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); |
@@ -218,8 +228,8 @@ done: | |||
218 | map_bh(bh_result, sb, (dblock << sbi->fs_shift) + sbi->blockoffset + (iblock & mask)); | 228 | map_bh(bh_result, sb, (dblock << sbi->fs_shift) + sbi->blockoffset + (iblock & mask)); |
219 | if (create) { | 229 | if (create) { |
220 | set_buffer_new(bh_result); | 230 | set_buffer_new(bh_result); |
221 | HFSPLUS_I(inode).phys_size += sb->s_blocksize; | 231 | hip->phys_size += sb->s_blocksize; |
222 | HFSPLUS_I(inode).fs_blocks++; | 232 | hip->fs_blocks++; |
223 | inode_add_bytes(inode, sb->s_blocksize); | 233 | inode_add_bytes(inode, sb->s_blocksize); |
224 | mark_inode_dirty(inode); | 234 | mark_inode_dirty(inode); |
225 | } | 235 | } |
@@ -348,6 +358,7 @@ int hfsplus_file_extend(struct inode *inode) | |||
348 | { | 358 | { |
349 | struct super_block *sb = inode->i_sb; | 359 | struct super_block *sb = inode->i_sb; |
350 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | 360 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); |
361 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | ||
351 | u32 start, len, goal; | 362 | u32 start, len, goal; |
352 | int res; | 363 | int res; |
353 | 364 | ||
@@ -360,17 +371,17 @@ int hfsplus_file_extend(struct inode *inode) | |||
360 | return -ENOSPC; | 371 | return -ENOSPC; |
361 | } | 372 | } |
362 | 373 | ||
363 | mutex_lock(&HFSPLUS_I(inode).extents_lock); | 374 | mutex_lock(&hip->extents_lock); |
364 | if (HFSPLUS_I(inode).alloc_blocks == HFSPLUS_I(inode).first_blocks) | 375 | if (hip->alloc_blocks == hip->first_blocks) |
365 | goal = hfsplus_ext_lastblock(HFSPLUS_I(inode).first_extents); | 376 | goal = hfsplus_ext_lastblock(hip->first_extents); |
366 | else { | 377 | else { |
367 | res = hfsplus_ext_read_extent(inode, HFSPLUS_I(inode).alloc_blocks); | 378 | res = hfsplus_ext_read_extent(inode, hip->alloc_blocks); |
368 | if (res) | 379 | if (res) |
369 | goto out; | 380 | goto out; |
370 | goal = hfsplus_ext_lastblock(HFSPLUS_I(inode).cached_extents); | 381 | goal = hfsplus_ext_lastblock(hip->cached_extents); |
371 | } | 382 | } |
372 | 383 | ||
373 | len = HFSPLUS_I(inode).clump_blocks; | 384 | len = hip->clump_blocks; |
374 | start = hfsplus_block_allocate(sb, sbi->total_blocks, goal, &len); | 385 | start = hfsplus_block_allocate(sb, sbi->total_blocks, goal, &len); |
375 | if (start >= sbi->total_blocks) { | 386 | if (start >= sbi->total_blocks) { |
376 | start = hfsplus_block_allocate(sb, goal, 0, &len); | 387 | start = hfsplus_block_allocate(sb, goal, 0, &len); |
@@ -381,41 +392,41 @@ int hfsplus_file_extend(struct inode *inode) | |||
381 | } | 392 | } |
382 | 393 | ||
383 | dprint(DBG_EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len); | 394 | dprint(DBG_EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len); |
384 | if (HFSPLUS_I(inode).alloc_blocks <= HFSPLUS_I(inode).first_blocks) { | 395 | |
385 | if (!HFSPLUS_I(inode).first_blocks) { | 396 | if (hip->alloc_blocks <= hip->first_blocks) { |
397 | if (!hip->first_blocks) { | ||
386 | dprint(DBG_EXTENT, "first extents\n"); | 398 | dprint(DBG_EXTENT, "first extents\n"); |
387 | /* no extents yet */ | 399 | /* no extents yet */ |
388 | HFSPLUS_I(inode).first_extents[0].start_block = cpu_to_be32(start); | 400 | hip->first_extents[0].start_block = cpu_to_be32(start); |
389 | HFSPLUS_I(inode).first_extents[0].block_count = cpu_to_be32(len); | 401 | hip->first_extents[0].block_count = cpu_to_be32(len); |
390 | res = 0; | 402 | res = 0; |
391 | } else { | 403 | } else { |
392 | /* try to append to extents in inode */ | 404 | /* try to append to extents in inode */ |
393 | res = hfsplus_add_extent(HFSPLUS_I(inode).first_extents, | 405 | res = hfsplus_add_extent(hip->first_extents, |
394 | HFSPLUS_I(inode).alloc_blocks, | 406 | hip->alloc_blocks, |
395 | start, len); | 407 | start, len); |
396 | if (res == -ENOSPC) | 408 | if (res == -ENOSPC) |
397 | goto insert_extent; | 409 | goto insert_extent; |
398 | } | 410 | } |
399 | if (!res) { | 411 | if (!res) { |
400 | hfsplus_dump_extent(HFSPLUS_I(inode).first_extents); | 412 | hfsplus_dump_extent(hip->first_extents); |
401 | HFSPLUS_I(inode).first_blocks += len; | 413 | hip->first_blocks += len; |
402 | } | 414 | } |
403 | } else { | 415 | } else { |
404 | res = hfsplus_add_extent(HFSPLUS_I(inode).cached_extents, | 416 | res = hfsplus_add_extent(hip->cached_extents, |
405 | HFSPLUS_I(inode).alloc_blocks - | 417 | hip->alloc_blocks - hip->cached_start, |
406 | HFSPLUS_I(inode).cached_start, | ||
407 | start, len); | 418 | start, len); |
408 | if (!res) { | 419 | if (!res) { |
409 | hfsplus_dump_extent(HFSPLUS_I(inode).cached_extents); | 420 | hfsplus_dump_extent(hip->cached_extents); |
410 | HFSPLUS_I(inode).flags |= HFSPLUS_FLG_EXT_DIRTY; | 421 | hip->flags |= HFSPLUS_FLG_EXT_DIRTY; |
411 | HFSPLUS_I(inode).cached_blocks += len; | 422 | hip->cached_blocks += len; |
412 | } else if (res == -ENOSPC) | 423 | } else if (res == -ENOSPC) |
413 | goto insert_extent; | 424 | goto insert_extent; |
414 | } | 425 | } |
415 | out: | 426 | out: |
416 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); | 427 | mutex_unlock(&hip->extents_lock); |
417 | if (!res) { | 428 | if (!res) { |
418 | HFSPLUS_I(inode).alloc_blocks += len; | 429 | hip->alloc_blocks += len; |
419 | mark_inode_dirty(inode); | 430 | mark_inode_dirty(inode); |
420 | } | 431 | } |
421 | return res; | 432 | return res; |
@@ -424,13 +435,13 @@ insert_extent: | |||
424 | dprint(DBG_EXTENT, "insert new extent\n"); | 435 | dprint(DBG_EXTENT, "insert new extent\n"); |
425 | hfsplus_ext_write_extent(inode); | 436 | hfsplus_ext_write_extent(inode); |
426 | 437 | ||
427 | memset(HFSPLUS_I(inode).cached_extents, 0, sizeof(hfsplus_extent_rec)); | 438 | memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); |
428 | HFSPLUS_I(inode).cached_extents[0].start_block = cpu_to_be32(start); | 439 | hip->cached_extents[0].start_block = cpu_to_be32(start); |
429 | HFSPLUS_I(inode).cached_extents[0].block_count = cpu_to_be32(len); | 440 | hip->cached_extents[0].block_count = cpu_to_be32(len); |
430 | hfsplus_dump_extent(HFSPLUS_I(inode).cached_extents); | 441 | hfsplus_dump_extent(hip->cached_extents); |
431 | HFSPLUS_I(inode).flags |= HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW; | 442 | hip->flags |= HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW; |
432 | HFSPLUS_I(inode).cached_start = HFSPLUS_I(inode).alloc_blocks; | 443 | hip->cached_start = hip->alloc_blocks; |
433 | HFSPLUS_I(inode).cached_blocks = len; | 444 | hip->cached_blocks = len; |
434 | 445 | ||
435 | res = 0; | 446 | res = 0; |
436 | goto out; | 447 | goto out; |
@@ -439,13 +450,15 @@ insert_extent: | |||
439 | void hfsplus_file_truncate(struct inode *inode) | 450 | void hfsplus_file_truncate(struct inode *inode) |
440 | { | 451 | { |
441 | struct super_block *sb = inode->i_sb; | 452 | struct super_block *sb = inode->i_sb; |
453 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | ||
442 | struct hfs_find_data fd; | 454 | struct hfs_find_data fd; |
443 | u32 alloc_cnt, blk_cnt, start; | 455 | u32 alloc_cnt, blk_cnt, start; |
444 | int res; | 456 | int res; |
445 | 457 | ||
446 | dprint(DBG_INODE, "truncate: %lu, %Lu -> %Lu\n", inode->i_ino, | 458 | dprint(DBG_INODE, "truncate: %lu, %Lu -> %Lu\n", |
447 | (long long)HFSPLUS_I(inode).phys_size, inode->i_size); | 459 | inode->i_ino, (long long)hip->phys_size, inode->i_size); |
448 | if (inode->i_size > HFSPLUS_I(inode).phys_size) { | 460 | |
461 | if (inode->i_size > hip->phys_size) { | ||
449 | struct address_space *mapping = inode->i_mapping; | 462 | struct address_space *mapping = inode->i_mapping; |
450 | struct page *page; | 463 | struct page *page; |
451 | void *fsdata; | 464 | void *fsdata; |
@@ -462,48 +475,48 @@ void hfsplus_file_truncate(struct inode *inode) | |||
462 | return; | 475 | return; |
463 | mark_inode_dirty(inode); | 476 | mark_inode_dirty(inode); |
464 | return; | 477 | return; |
465 | } else if (inode->i_size == HFSPLUS_I(inode).phys_size) | 478 | } else if (inode->i_size == hip->phys_size) |
466 | return; | 479 | return; |
467 | 480 | ||
468 | blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >> | 481 | blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >> |
469 | HFSPLUS_SB(sb)->alloc_blksz_shift; | 482 | HFSPLUS_SB(sb)->alloc_blksz_shift; |
470 | alloc_cnt = HFSPLUS_I(inode).alloc_blocks; | 483 | alloc_cnt = hip->alloc_blocks; |
471 | if (blk_cnt == alloc_cnt) | 484 | if (blk_cnt == alloc_cnt) |
472 | goto out; | 485 | goto out; |
473 | 486 | ||
474 | mutex_lock(&HFSPLUS_I(inode).extents_lock); | 487 | mutex_lock(&hip->extents_lock); |
475 | hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); | 488 | hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); |
476 | while (1) { | 489 | while (1) { |
477 | if (alloc_cnt == HFSPLUS_I(inode).first_blocks) { | 490 | if (alloc_cnt == hip->first_blocks) { |
478 | hfsplus_free_extents(sb, HFSPLUS_I(inode).first_extents, | 491 | hfsplus_free_extents(sb, hip->first_extents, |
479 | alloc_cnt, alloc_cnt - blk_cnt); | 492 | alloc_cnt, alloc_cnt - blk_cnt); |
480 | hfsplus_dump_extent(HFSPLUS_I(inode).first_extents); | 493 | hfsplus_dump_extent(hip->first_extents); |
481 | HFSPLUS_I(inode).first_blocks = blk_cnt; | 494 | hip->first_blocks = blk_cnt; |
482 | break; | 495 | break; |
483 | } | 496 | } |
484 | res = __hfsplus_ext_cache_extent(&fd, inode, alloc_cnt); | 497 | res = __hfsplus_ext_cache_extent(&fd, inode, alloc_cnt); |
485 | if (res) | 498 | if (res) |
486 | break; | 499 | break; |
487 | start = HFSPLUS_I(inode).cached_start; | 500 | start = hip->cached_start; |
488 | hfsplus_free_extents(sb, HFSPLUS_I(inode).cached_extents, | 501 | hfsplus_free_extents(sb, hip->cached_extents, |
489 | alloc_cnt - start, alloc_cnt - blk_cnt); | 502 | alloc_cnt - start, alloc_cnt - blk_cnt); |
490 | hfsplus_dump_extent(HFSPLUS_I(inode).cached_extents); | 503 | hfsplus_dump_extent(hip->cached_extents); |
491 | if (blk_cnt > start) { | 504 | if (blk_cnt > start) { |
492 | HFSPLUS_I(inode).flags |= HFSPLUS_FLG_EXT_DIRTY; | 505 | hip->flags |= HFSPLUS_FLG_EXT_DIRTY; |
493 | break; | 506 | break; |
494 | } | 507 | } |
495 | alloc_cnt = start; | 508 | alloc_cnt = start; |
496 | HFSPLUS_I(inode).cached_start = HFSPLUS_I(inode).cached_blocks = 0; | 509 | hip->cached_start = hip->cached_blocks = 0; |
497 | HFSPLUS_I(inode).flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); | 510 | hip->flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); |
498 | hfs_brec_remove(&fd); | 511 | hfs_brec_remove(&fd); |
499 | } | 512 | } |
500 | hfs_find_exit(&fd); | 513 | hfs_find_exit(&fd); |
501 | mutex_unlock(&HFSPLUS_I(inode).extents_lock); | 514 | mutex_unlock(&hip->extents_lock); |
502 | 515 | ||
503 | HFSPLUS_I(inode).alloc_blocks = blk_cnt; | 516 | hip->alloc_blocks = blk_cnt; |
504 | out: | 517 | out: |
505 | HFSPLUS_I(inode).phys_size = inode->i_size; | 518 | hip->phys_size = inode->i_size; |
506 | HFSPLUS_I(inode).fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; | 519 | hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; |
507 | inode_set_bytes(inode, HFSPLUS_I(inode).fs_blocks << sb->s_blocksize_bits); | 520 | inode_set_bytes(inode, hip->fs_blocks << sb->s_blocksize_bits); |
508 | mark_inode_dirty(inode); | 521 | mark_inode_dirty(inode); |
509 | } | 522 | } |