diff options
Diffstat (limited to 'fs/udf/inode.c')
| -rw-r--r-- | fs/udf/inode.c | 305 |
1 files changed, 162 insertions, 143 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index f746b9f1c03c..6b4409f50196 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
| @@ -112,6 +112,7 @@ no_delete: | |||
| 112 | */ | 112 | */ |
| 113 | void udf_clear_inode(struct inode *inode) | 113 | void udf_clear_inode(struct inode *inode) |
| 114 | { | 114 | { |
| 115 | struct udf_inode_info *iinfo; | ||
| 115 | if (!(inode->i_sb->s_flags & MS_RDONLY)) { | 116 | if (!(inode->i_sb->s_flags & MS_RDONLY)) { |
| 116 | lock_kernel(); | 117 | lock_kernel(); |
| 117 | /* Discard preallocation for directories, symlinks, etc. */ | 118 | /* Discard preallocation for directories, symlinks, etc. */ |
| @@ -120,8 +121,9 @@ void udf_clear_inode(struct inode *inode) | |||
| 120 | unlock_kernel(); | 121 | unlock_kernel(); |
| 121 | write_inode_now(inode, 1); | 122 | write_inode_now(inode, 1); |
| 122 | } | 123 | } |
| 123 | kfree(UDF_I(inode)->i_ext.i_data); | 124 | iinfo = UDF_I(inode); |
| 124 | UDF_I(inode)->i_ext.i_data = NULL; | 125 | kfree(iinfo->i_ext.i_data); |
| 126 | iinfo->i_ext.i_data = NULL; | ||
| 125 | } | 127 | } |
| 126 | 128 | ||
| 127 | static int udf_writepage(struct page *page, struct writeback_control *wbc) | 129 | static int udf_writepage(struct page *page, struct writeback_control *wbc) |
| @@ -161,6 +163,7 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
| 161 | { | 163 | { |
| 162 | struct page *page; | 164 | struct page *page; |
| 163 | char *kaddr; | 165 | char *kaddr; |
| 166 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 164 | struct writeback_control udf_wbc = { | 167 | struct writeback_control udf_wbc = { |
| 165 | .sync_mode = WB_SYNC_NONE, | 168 | .sync_mode = WB_SYNC_NONE, |
| 166 | .nr_to_write = 1, | 169 | .nr_to_write = 1, |
| @@ -169,11 +172,11 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
| 169 | /* from now on we have normal address_space methods */ | 172 | /* from now on we have normal address_space methods */ |
| 170 | inode->i_data.a_ops = &udf_aops; | 173 | inode->i_data.a_ops = &udf_aops; |
| 171 | 174 | ||
| 172 | if (!UDF_I(inode)->i_lenAlloc) { | 175 | if (!iinfo->i_lenAlloc) { |
| 173 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 176 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
| 174 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 177 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
| 175 | else | 178 | else |
| 176 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 179 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
| 177 | mark_inode_dirty(inode); | 180 | mark_inode_dirty(inode); |
| 178 | return; | 181 | return; |
| 179 | } | 182 | } |
| @@ -183,21 +186,21 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
| 183 | 186 | ||
| 184 | if (!PageUptodate(page)) { | 187 | if (!PageUptodate(page)) { |
| 185 | kaddr = kmap(page); | 188 | kaddr = kmap(page); |
| 186 | memset(kaddr + UDF_I(inode)->i_lenAlloc, 0x00, | 189 | memset(kaddr + iinfo->i_lenAlloc, 0x00, |
| 187 | PAGE_CACHE_SIZE - UDF_I(inode)->i_lenAlloc); | 190 | PAGE_CACHE_SIZE - iinfo->i_lenAlloc); |
| 188 | memcpy(kaddr, UDF_I(inode)->i_ext.i_data + | 191 | memcpy(kaddr, iinfo->i_ext.i_data + iinfo->i_lenEAttr, |
| 189 | UDF_I(inode)->i_lenEAttr, UDF_I(inode)->i_lenAlloc); | 192 | iinfo->i_lenAlloc); |
| 190 | flush_dcache_page(page); | 193 | flush_dcache_page(page); |
| 191 | SetPageUptodate(page); | 194 | SetPageUptodate(page); |
| 192 | kunmap(page); | 195 | kunmap(page); |
| 193 | } | 196 | } |
| 194 | memset(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 0x00, | 197 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00, |
| 195 | UDF_I(inode)->i_lenAlloc); | 198 | iinfo->i_lenAlloc); |
| 196 | UDF_I(inode)->i_lenAlloc = 0; | 199 | iinfo->i_lenAlloc = 0; |
| 197 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 200 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
| 198 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 201 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
| 199 | else | 202 | else |
| 200 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 203 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
| 201 | 204 | ||
| 202 | inode->i_data.a_ops->writepage(page, &udf_wbc); | 205 | inode->i_data.a_ops->writepage(page, &udf_wbc); |
| 203 | page_cache_release(page); | 206 | page_cache_release(page); |
| @@ -219,6 +222,7 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
| 219 | loff_t f_pos = udf_ext0_offset(inode) >> 2; | 222 | loff_t f_pos = udf_ext0_offset(inode) >> 2; |
| 220 | int size = (udf_ext0_offset(inode) + inode->i_size) >> 2; | 223 | int size = (udf_ext0_offset(inode) + inode->i_size) >> 2; |
| 221 | struct fileIdentDesc cfi, *sfi, *dfi; | 224 | struct fileIdentDesc cfi, *sfi, *dfi; |
| 225 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 222 | 226 | ||
| 223 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 227 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
| 224 | alloctype = ICBTAG_FLAG_AD_SHORT; | 228 | alloctype = ICBTAG_FLAG_AD_SHORT; |
| @@ -226,19 +230,19 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
| 226 | alloctype = ICBTAG_FLAG_AD_LONG; | 230 | alloctype = ICBTAG_FLAG_AD_LONG; |
| 227 | 231 | ||
| 228 | if (!inode->i_size) { | 232 | if (!inode->i_size) { |
| 229 | UDF_I(inode)->i_alloc_type = alloctype; | 233 | iinfo->i_alloc_type = alloctype; |
| 230 | mark_inode_dirty(inode); | 234 | mark_inode_dirty(inode); |
| 231 | return NULL; | 235 | return NULL; |
| 232 | } | 236 | } |
| 233 | 237 | ||
| 234 | /* alloc block, and copy data to it */ | 238 | /* alloc block, and copy data to it */ |
| 235 | *block = udf_new_block(inode->i_sb, inode, | 239 | *block = udf_new_block(inode->i_sb, inode, |
| 236 | UDF_I(inode)->i_location.partitionReferenceNum, | 240 | iinfo->i_location.partitionReferenceNum, |
| 237 | UDF_I(inode)->i_location.logicalBlockNum, err); | 241 | iinfo->i_location.logicalBlockNum, err); |
| 238 | if (!(*block)) | 242 | if (!(*block)) |
| 239 | return NULL; | 243 | return NULL; |
| 240 | newblock = udf_get_pblock(inode->i_sb, *block, | 244 | newblock = udf_get_pblock(inode->i_sb, *block, |
| 241 | UDF_I(inode)->i_location.partitionReferenceNum, | 245 | iinfo->i_location.partitionReferenceNum, |
| 242 | 0); | 246 | 0); |
| 243 | if (!newblock) | 247 | if (!newblock) |
| 244 | return NULL; | 248 | return NULL; |
| @@ -257,14 +261,14 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
| 257 | dfibh.soffset = dfibh.eoffset = 0; | 261 | dfibh.soffset = dfibh.eoffset = 0; |
| 258 | dfibh.sbh = dfibh.ebh = dbh; | 262 | dfibh.sbh = dfibh.ebh = dbh; |
| 259 | while ((f_pos < size)) { | 263 | while ((f_pos < size)) { |
| 260 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 264 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
| 261 | sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, | 265 | sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, |
| 262 | NULL, NULL, NULL); | 266 | NULL, NULL, NULL); |
| 263 | if (!sfi) { | 267 | if (!sfi) { |
| 264 | brelse(dbh); | 268 | brelse(dbh); |
| 265 | return NULL; | 269 | return NULL; |
| 266 | } | 270 | } |
| 267 | UDF_I(inode)->i_alloc_type = alloctype; | 271 | iinfo->i_alloc_type = alloctype; |
| 268 | sfi->descTag.tagLocation = cpu_to_le32(*block); | 272 | sfi->descTag.tagLocation = cpu_to_le32(*block); |
| 269 | dfibh.soffset = dfibh.eoffset; | 273 | dfibh.soffset = dfibh.eoffset; |
| 270 | dfibh.eoffset += (sfibh.eoffset - sfibh.soffset); | 274 | dfibh.eoffset += (sfibh.eoffset - sfibh.soffset); |
| @@ -272,23 +276,23 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
| 272 | if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, | 276 | if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, |
| 273 | sfi->fileIdent + | 277 | sfi->fileIdent + |
| 274 | le16_to_cpu(sfi->lengthOfImpUse))) { | 278 | le16_to_cpu(sfi->lengthOfImpUse))) { |
| 275 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 279 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
| 276 | brelse(dbh); | 280 | brelse(dbh); |
| 277 | return NULL; | 281 | return NULL; |
| 278 | } | 282 | } |
| 279 | } | 283 | } |
| 280 | mark_buffer_dirty_inode(dbh, inode); | 284 | mark_buffer_dirty_inode(dbh, inode); |
| 281 | 285 | ||
| 282 | memset(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 0, | 286 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0, |
| 283 | UDF_I(inode)->i_lenAlloc); | 287 | iinfo->i_lenAlloc); |
| 284 | UDF_I(inode)->i_lenAlloc = 0; | 288 | iinfo->i_lenAlloc = 0; |
| 285 | eloc.logicalBlockNum = *block; | 289 | eloc.logicalBlockNum = *block; |
| 286 | eloc.partitionReferenceNum = | 290 | eloc.partitionReferenceNum = |
| 287 | UDF_I(inode)->i_location.partitionReferenceNum; | 291 | iinfo->i_location.partitionReferenceNum; |
| 288 | elen = inode->i_size; | 292 | elen = inode->i_size; |
| 289 | UDF_I(inode)->i_lenExtents = elen; | 293 | iinfo->i_lenExtents = elen; |
| 290 | epos.bh = NULL; | 294 | epos.bh = NULL; |
| 291 | epos.block = UDF_I(inode)->i_location; | 295 | epos.block = iinfo->i_location; |
| 292 | epos.offset = udf_file_entry_alloc_offset(inode); | 296 | epos.offset = udf_file_entry_alloc_offset(inode); |
| 293 | udf_add_aext(inode, &epos, eloc, elen, 0); | 297 | udf_add_aext(inode, &epos, eloc, elen, 0); |
| 294 | /* UniqueID stuff */ | 298 | /* UniqueID stuff */ |
| @@ -304,6 +308,7 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
| 304 | int err, new; | 308 | int err, new; |
| 305 | struct buffer_head *bh; | 309 | struct buffer_head *bh; |
| 306 | unsigned long phys; | 310 | unsigned long phys; |
| 311 | struct udf_inode_info *iinfo; | ||
| 307 | 312 | ||
| 308 | if (!create) { | 313 | if (!create) { |
| 309 | phys = udf_block_map(inode, block); | 314 | phys = udf_block_map(inode, block); |
| @@ -321,9 +326,10 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
| 321 | if (block < 0) | 326 | if (block < 0) |
| 322 | goto abort_negative; | 327 | goto abort_negative; |
| 323 | 328 | ||
| 324 | if (block == UDF_I(inode)->i_next_alloc_block + 1) { | 329 | iinfo = UDF_I(inode); |
| 325 | UDF_I(inode)->i_next_alloc_block++; | 330 | if (block == iinfo->i_next_alloc_block + 1) { |
| 326 | UDF_I(inode)->i_next_alloc_goal++; | 331 | iinfo->i_next_alloc_block++; |
| 332 | iinfo->i_next_alloc_goal++; | ||
| 327 | } | 333 | } |
| 328 | 334 | ||
| 329 | err = 0; | 335 | err = 0; |
| @@ -380,20 +386,22 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
| 380 | struct super_block *sb = inode->i_sb; | 386 | struct super_block *sb = inode->i_sb; |
| 381 | kernel_lb_addr prealloc_loc = {}; | 387 | kernel_lb_addr prealloc_loc = {}; |
| 382 | int prealloc_len = 0; | 388 | int prealloc_len = 0; |
| 389 | struct udf_inode_info *iinfo; | ||
| 383 | 390 | ||
| 384 | /* The previous extent is fake and we should not extend by anything | 391 | /* The previous extent is fake and we should not extend by anything |
| 385 | * - there's nothing to do... */ | 392 | * - there's nothing to do... */ |
| 386 | if (!blocks && fake) | 393 | if (!blocks && fake) |
| 387 | return 0; | 394 | return 0; |
| 388 | 395 | ||
| 396 | iinfo = UDF_I(inode); | ||
| 389 | /* Round the last extent up to a multiple of block size */ | 397 | /* Round the last extent up to a multiple of block size */ |
| 390 | if (last_ext->extLength & (sb->s_blocksize - 1)) { | 398 | if (last_ext->extLength & (sb->s_blocksize - 1)) { |
| 391 | last_ext->extLength = | 399 | last_ext->extLength = |
| 392 | (last_ext->extLength & UDF_EXTENT_FLAG_MASK) | | 400 | (last_ext->extLength & UDF_EXTENT_FLAG_MASK) | |
| 393 | (((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) + | 401 | (((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) + |
| 394 | sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); | 402 | sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); |
| 395 | UDF_I(inode)->i_lenExtents = | 403 | iinfo->i_lenExtents = |
| 396 | (UDF_I(inode)->i_lenExtents + sb->s_blocksize - 1) & | 404 | (iinfo->i_lenExtents + sb->s_blocksize - 1) & |
| 397 | ~(sb->s_blocksize - 1); | 405 | ~(sb->s_blocksize - 1); |
| 398 | } | 406 | } |
| 399 | 407 | ||
| @@ -470,9 +478,9 @@ out: | |||
| 470 | } | 478 | } |
| 471 | 479 | ||
| 472 | /* last_pos should point to the last written extent... */ | 480 | /* last_pos should point to the last written extent... */ |
| 473 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 481 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 474 | last_pos->offset -= sizeof(short_ad); | 482 | last_pos->offset -= sizeof(short_ad); |
| 475 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 483 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 476 | last_pos->offset -= sizeof(long_ad); | 484 | last_pos->offset -= sizeof(long_ad); |
| 477 | else | 485 | else |
| 478 | return -1; | 486 | return -1; |
| @@ -495,11 +503,12 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
| 495 | uint32_t newblocknum, newblock; | 503 | uint32_t newblocknum, newblock; |
| 496 | sector_t offset = 0; | 504 | sector_t offset = 0; |
| 497 | int8_t etype; | 505 | int8_t etype; |
| 498 | int goal = 0, pgoal = UDF_I(inode)->i_location.logicalBlockNum; | 506 | struct udf_inode_info *iinfo = UDF_I(inode); |
| 507 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; | ||
| 499 | int lastblock = 0; | 508 | int lastblock = 0; |
| 500 | 509 | ||
| 501 | prev_epos.offset = udf_file_entry_alloc_offset(inode); | 510 | prev_epos.offset = udf_file_entry_alloc_offset(inode); |
| 502 | prev_epos.block = UDF_I(inode)->i_location; | 511 | prev_epos.block = iinfo->i_location; |
| 503 | prev_epos.bh = NULL; | 512 | prev_epos.bh = NULL; |
| 504 | cur_epos = next_epos = prev_epos; | 513 | cur_epos = next_epos = prev_epos; |
| 505 | b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; | 514 | b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; |
| @@ -649,24 +658,23 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
| 649 | if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) | 658 | if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) |
| 650 | newblocknum = laarr[c].extLocation.logicalBlockNum + offset; | 659 | newblocknum = laarr[c].extLocation.logicalBlockNum + offset; |
| 651 | else { /* otherwise, allocate a new block */ | 660 | else { /* otherwise, allocate a new block */ |
| 652 | if (UDF_I(inode)->i_next_alloc_block == block) | 661 | if (iinfo->i_next_alloc_block == block) |
| 653 | goal = UDF_I(inode)->i_next_alloc_goal; | 662 | goal = iinfo->i_next_alloc_goal; |
| 654 | 663 | ||
| 655 | if (!goal) { | 664 | if (!goal) { |
| 656 | if (!(goal = pgoal)) /* XXX: what was intended here? */ | 665 | if (!(goal = pgoal)) /* XXX: what was intended here? */ |
| 657 | goal = UDF_I(inode)-> | 666 | goal = iinfo->i_location.logicalBlockNum + 1; |
| 658 | i_location.logicalBlockNum + 1; | ||
| 659 | } | 667 | } |
| 660 | 668 | ||
| 661 | newblocknum = udf_new_block(inode->i_sb, inode, | 669 | newblocknum = udf_new_block(inode->i_sb, inode, |
| 662 | UDF_I(inode)->i_location.partitionReferenceNum, | 670 | iinfo->i_location.partitionReferenceNum, |
| 663 | goal, err); | 671 | goal, err); |
| 664 | if (!newblocknum) { | 672 | if (!newblocknum) { |
| 665 | brelse(prev_epos.bh); | 673 | brelse(prev_epos.bh); |
| 666 | *err = -ENOSPC; | 674 | *err = -ENOSPC; |
| 667 | return NULL; | 675 | return NULL; |
| 668 | } | 676 | } |
| 669 | UDF_I(inode)->i_lenExtents += inode->i_sb->s_blocksize; | 677 | iinfo->i_lenExtents += inode->i_sb->s_blocksize; |
| 670 | } | 678 | } |
| 671 | 679 | ||
| 672 | /* if the extent the requsted block is located in contains multiple | 680 | /* if the extent the requsted block is located in contains multiple |
| @@ -691,14 +699,14 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
| 691 | brelse(prev_epos.bh); | 699 | brelse(prev_epos.bh); |
| 692 | 700 | ||
| 693 | newblock = udf_get_pblock(inode->i_sb, newblocknum, | 701 | newblock = udf_get_pblock(inode->i_sb, newblocknum, |
| 694 | UDF_I(inode)->i_location.partitionReferenceNum, 0); | 702 | iinfo->i_location.partitionReferenceNum, 0); |
| 695 | if (!newblock) | 703 | if (!newblock) |
| 696 | return NULL; | 704 | return NULL; |
| 697 | *phys = newblock; | 705 | *phys = newblock; |
| 698 | *err = 0; | 706 | *err = 0; |
| 699 | *new = 1; | 707 | *new = 1; |
| 700 | UDF_I(inode)->i_next_alloc_block = block; | 708 | iinfo->i_next_alloc_block = block; |
| 701 | UDF_I(inode)->i_next_alloc_goal = newblocknum; | 709 | iinfo->i_next_alloc_goal = newblocknum; |
| 702 | inode->i_ctime = current_fs_time(inode->i_sb); | 710 | inode->i_ctime = current_fs_time(inode->i_sb); |
| 703 | 711 | ||
| 704 | if (IS_SYNC(inode)) | 712 | if (IS_SYNC(inode)) |
| @@ -1027,6 +1035,7 @@ void udf_truncate(struct inode *inode) | |||
| 1027 | { | 1035 | { |
| 1028 | int offset; | 1036 | int offset; |
| 1029 | int err; | 1037 | int err; |
| 1038 | struct udf_inode_info *iinfo; | ||
| 1030 | 1039 | ||
| 1031 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | 1040 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || |
| 1032 | S_ISLNK(inode->i_mode))) | 1041 | S_ISLNK(inode->i_mode))) |
| @@ -1035,25 +1044,24 @@ void udf_truncate(struct inode *inode) | |||
| 1035 | return; | 1044 | return; |
| 1036 | 1045 | ||
| 1037 | lock_kernel(); | 1046 | lock_kernel(); |
| 1038 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 1047 | iinfo = UDF_I(inode); |
| 1048 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | ||
| 1039 | if (inode->i_sb->s_blocksize < | 1049 | if (inode->i_sb->s_blocksize < |
| 1040 | (udf_file_entry_alloc_offset(inode) + | 1050 | (udf_file_entry_alloc_offset(inode) + |
| 1041 | inode->i_size)) { | 1051 | inode->i_size)) { |
| 1042 | udf_expand_file_adinicb(inode, inode->i_size, &err); | 1052 | udf_expand_file_adinicb(inode, inode->i_size, &err); |
| 1043 | if (UDF_I(inode)->i_alloc_type == | 1053 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
| 1044 | ICBTAG_FLAG_AD_IN_ICB) { | 1054 | inode->i_size = iinfo->i_lenAlloc; |
| 1045 | inode->i_size = UDF_I(inode)->i_lenAlloc; | ||
| 1046 | unlock_kernel(); | 1055 | unlock_kernel(); |
| 1047 | return; | 1056 | return; |
| 1048 | } else | 1057 | } else |
| 1049 | udf_truncate_extents(inode); | 1058 | udf_truncate_extents(inode); |
| 1050 | } else { | 1059 | } else { |
| 1051 | offset = inode->i_size & (inode->i_sb->s_blocksize - 1); | 1060 | offset = inode->i_size & (inode->i_sb->s_blocksize - 1); |
| 1052 | memset(UDF_I(inode)->i_ext.i_data + | 1061 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr + offset, |
| 1053 | UDF_I(inode)->i_lenEAttr + offset, | ||
| 1054 | 0x00, inode->i_sb->s_blocksize - | 1062 | 0x00, inode->i_sb->s_blocksize - |
| 1055 | offset - udf_file_entry_alloc_offset(inode)); | 1063 | offset - udf_file_entry_alloc_offset(inode)); |
| 1056 | UDF_I(inode)->i_lenAlloc = inode->i_size; | 1064 | iinfo->i_lenAlloc = inode->i_size; |
| 1057 | } | 1065 | } |
| 1058 | } else { | 1066 | } else { |
| 1059 | block_truncate_page(inode->i_mapping, inode->i_size, | 1067 | block_truncate_page(inode->i_mapping, inode->i_size, |
| @@ -1074,6 +1082,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1074 | struct buffer_head *bh = NULL; | 1082 | struct buffer_head *bh = NULL; |
| 1075 | struct fileEntry *fe; | 1083 | struct fileEntry *fe; |
| 1076 | uint16_t ident; | 1084 | uint16_t ident; |
| 1085 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 1077 | 1086 | ||
| 1078 | /* | 1087 | /* |
| 1079 | * Set defaults, but the inode is still incomplete! | 1088 | * Set defaults, but the inode is still incomplete! |
| @@ -1087,7 +1096,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1087 | * i_nlink = 1 | 1096 | * i_nlink = 1 |
| 1088 | * i_op = NULL; | 1097 | * i_op = NULL; |
| 1089 | */ | 1098 | */ |
| 1090 | bh = udf_read_ptagged(inode->i_sb, UDF_I(inode)->i_location, 0, &ident); | 1099 | bh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 0, &ident); |
| 1091 | if (!bh) { | 1100 | if (!bh) { |
| 1092 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", | 1101 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", |
| 1093 | inode->i_ino); | 1102 | inode->i_ino); |
| @@ -1110,7 +1119,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1110 | struct buffer_head *ibh = NULL, *nbh = NULL; | 1119 | struct buffer_head *ibh = NULL, *nbh = NULL; |
| 1111 | struct indirectEntry *ie; | 1120 | struct indirectEntry *ie; |
| 1112 | 1121 | ||
| 1113 | ibh = udf_read_ptagged(inode->i_sb, UDF_I(inode)->i_location, 1, | 1122 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, |
| 1114 | &ident); | 1123 | &ident); |
| 1115 | if (ident == TAG_IDENT_IE) { | 1124 | if (ident == TAG_IDENT_IE) { |
| 1116 | if (ibh) { | 1125 | if (ibh) { |
| @@ -1124,7 +1133,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1124 | &ident))) { | 1133 | &ident))) { |
| 1125 | if (ident == TAG_IDENT_FE || | 1134 | if (ident == TAG_IDENT_FE || |
| 1126 | ident == TAG_IDENT_EFE) { | 1135 | ident == TAG_IDENT_EFE) { |
| 1127 | memcpy(&UDF_I(inode)->i_location, | 1136 | memcpy(&iinfo->i_location, |
| 1128 | &loc, | 1137 | &loc, |
| 1129 | sizeof(kernel_lb_addr)); | 1138 | sizeof(kernel_lb_addr)); |
| 1130 | brelse(bh); | 1139 | brelse(bh); |
| @@ -1163,50 +1172,51 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1163 | long convtime_usec; | 1172 | long convtime_usec; |
| 1164 | int offset; | 1173 | int offset; |
| 1165 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1174 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
| 1175 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 1166 | 1176 | ||
| 1167 | fe = (struct fileEntry *)bh->b_data; | 1177 | fe = (struct fileEntry *)bh->b_data; |
| 1168 | efe = (struct extendedFileEntry *)bh->b_data; | 1178 | efe = (struct extendedFileEntry *)bh->b_data; |
| 1169 | 1179 | ||
| 1170 | if (fe->icbTag.strategyType == cpu_to_le16(4)) | 1180 | if (fe->icbTag.strategyType == cpu_to_le16(4)) |
| 1171 | UDF_I(inode)->i_strat4096 = 0; | 1181 | iinfo->i_strat4096 = 0; |
| 1172 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ | 1182 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ |
| 1173 | UDF_I(inode)->i_strat4096 = 1; | 1183 | iinfo->i_strat4096 = 1; |
| 1174 | 1184 | ||
| 1175 | UDF_I(inode)->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & | 1185 | iinfo->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & |
| 1176 | ICBTAG_FLAG_AD_MASK; | 1186 | ICBTAG_FLAG_AD_MASK; |
| 1177 | UDF_I(inode)->i_unique = 0; | 1187 | iinfo->i_unique = 0; |
| 1178 | UDF_I(inode)->i_lenEAttr = 0; | 1188 | iinfo->i_lenEAttr = 0; |
| 1179 | UDF_I(inode)->i_lenExtents = 0; | 1189 | iinfo->i_lenExtents = 0; |
| 1180 | UDF_I(inode)->i_lenAlloc = 0; | 1190 | iinfo->i_lenAlloc = 0; |
| 1181 | UDF_I(inode)->i_next_alloc_block = 0; | 1191 | iinfo->i_next_alloc_block = 0; |
| 1182 | UDF_I(inode)->i_next_alloc_goal = 0; | 1192 | iinfo->i_next_alloc_goal = 0; |
| 1183 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { | 1193 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
| 1184 | UDF_I(inode)->i_efe = 1; | 1194 | iinfo->i_efe = 1; |
| 1185 | UDF_I(inode)->i_use = 0; | 1195 | iinfo->i_use = 0; |
| 1186 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1196 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
| 1187 | sizeof(struct extendedFileEntry))) { | 1197 | sizeof(struct extendedFileEntry))) { |
| 1188 | make_bad_inode(inode); | 1198 | make_bad_inode(inode); |
| 1189 | return; | 1199 | return; |
| 1190 | } | 1200 | } |
| 1191 | memcpy(UDF_I(inode)->i_ext.i_data, | 1201 | memcpy(iinfo->i_ext.i_data, |
| 1192 | bh->b_data + sizeof(struct extendedFileEntry), | 1202 | bh->b_data + sizeof(struct extendedFileEntry), |
| 1193 | inode->i_sb->s_blocksize - | 1203 | inode->i_sb->s_blocksize - |
| 1194 | sizeof(struct extendedFileEntry)); | 1204 | sizeof(struct extendedFileEntry)); |
| 1195 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { | 1205 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
| 1196 | UDF_I(inode)->i_efe = 0; | 1206 | iinfo->i_efe = 0; |
| 1197 | UDF_I(inode)->i_use = 0; | 1207 | iinfo->i_use = 0; |
| 1198 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1208 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
| 1199 | sizeof(struct fileEntry))) { | 1209 | sizeof(struct fileEntry))) { |
| 1200 | make_bad_inode(inode); | 1210 | make_bad_inode(inode); |
| 1201 | return; | 1211 | return; |
| 1202 | } | 1212 | } |
| 1203 | memcpy(UDF_I(inode)->i_ext.i_data, | 1213 | memcpy(iinfo->i_ext.i_data, |
| 1204 | bh->b_data + sizeof(struct fileEntry), | 1214 | bh->b_data + sizeof(struct fileEntry), |
| 1205 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1215 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
| 1206 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { | 1216 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { |
| 1207 | UDF_I(inode)->i_efe = 0; | 1217 | iinfo->i_efe = 0; |
| 1208 | UDF_I(inode)->i_use = 1; | 1218 | iinfo->i_use = 1; |
| 1209 | UDF_I(inode)->i_lenAlloc = le32_to_cpu( | 1219 | iinfo->i_lenAlloc = le32_to_cpu( |
| 1210 | ((struct unallocSpaceEntry *)bh->b_data)-> | 1220 | ((struct unallocSpaceEntry *)bh->b_data)-> |
| 1211 | lengthAllocDescs); | 1221 | lengthAllocDescs); |
| 1212 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1222 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
| @@ -1214,7 +1224,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1214 | make_bad_inode(inode); | 1224 | make_bad_inode(inode); |
| 1215 | return; | 1225 | return; |
| 1216 | } | 1226 | } |
| 1217 | memcpy(UDF_I(inode)->i_ext.i_data, | 1227 | memcpy(iinfo->i_ext.i_data, |
| 1218 | bh->b_data + sizeof(struct unallocSpaceEntry), | 1228 | bh->b_data + sizeof(struct unallocSpaceEntry), |
| 1219 | inode->i_sb->s_blocksize - | 1229 | inode->i_sb->s_blocksize - |
| 1220 | sizeof(struct unallocSpaceEntry)); | 1230 | sizeof(struct unallocSpaceEntry)); |
| @@ -1238,12 +1248,12 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1238 | inode->i_nlink = 1; | 1248 | inode->i_nlink = 1; |
| 1239 | 1249 | ||
| 1240 | inode->i_size = le64_to_cpu(fe->informationLength); | 1250 | inode->i_size = le64_to_cpu(fe->informationLength); |
| 1241 | UDF_I(inode)->i_lenExtents = inode->i_size; | 1251 | iinfo->i_lenExtents = inode->i_size; |
| 1242 | 1252 | ||
| 1243 | inode->i_mode = udf_convert_permissions(fe); | 1253 | inode->i_mode = udf_convert_permissions(fe); |
| 1244 | inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; | 1254 | inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; |
| 1245 | 1255 | ||
| 1246 | if (UDF_I(inode)->i_efe == 0) { | 1256 | if (iinfo->i_efe == 0) { |
| 1247 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << | 1257 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << |
| 1248 | (inode->i_sb->s_blocksize_bits - 9); | 1258 | (inode->i_sb->s_blocksize_bits - 9); |
| 1249 | 1259 | ||
| @@ -1271,10 +1281,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1271 | inode->i_ctime = sbi->s_record_time; | 1281 | inode->i_ctime = sbi->s_record_time; |
| 1272 | } | 1282 | } |
| 1273 | 1283 | ||
| 1274 | UDF_I(inode)->i_unique = le64_to_cpu(fe->uniqueID); | 1284 | iinfo->i_unique = le64_to_cpu(fe->uniqueID); |
| 1275 | UDF_I(inode)->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); | 1285 | iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); |
| 1276 | UDF_I(inode)->i_lenAlloc = le32_to_cpu(fe->lengthAllocDescs); | 1286 | iinfo->i_lenAlloc = le32_to_cpu(fe->lengthAllocDescs); |
| 1277 | offset = sizeof(struct fileEntry) + UDF_I(inode)->i_lenEAttr; | 1287 | offset = sizeof(struct fileEntry) + iinfo->i_lenEAttr; |
| 1278 | } else { | 1288 | } else { |
| 1279 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << | 1289 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << |
| 1280 | (inode->i_sb->s_blocksize_bits - 9); | 1290 | (inode->i_sb->s_blocksize_bits - 9); |
| @@ -1297,10 +1307,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1297 | 1307 | ||
| 1298 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1308 | if (udf_stamp_to_time(&convtime, &convtime_usec, |
| 1299 | lets_to_cpu(efe->createTime))) { | 1309 | lets_to_cpu(efe->createTime))) { |
| 1300 | UDF_I(inode)->i_crtime.tv_sec = convtime; | 1310 | iinfo->i_crtime.tv_sec = convtime; |
| 1301 | UDF_I(inode)->i_crtime.tv_nsec = convtime_usec * 1000; | 1311 | iinfo->i_crtime.tv_nsec = convtime_usec * 1000; |
| 1302 | } else { | 1312 | } else { |
| 1303 | UDF_I(inode)->i_crtime = sbi->s_record_time; | 1313 | iinfo->i_crtime = sbi->s_record_time; |
| 1304 | } | 1314 | } |
| 1305 | 1315 | ||
| 1306 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1316 | if (udf_stamp_to_time(&convtime, &convtime_usec, |
| @@ -1311,11 +1321,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1311 | inode->i_ctime = sbi->s_record_time; | 1321 | inode->i_ctime = sbi->s_record_time; |
| 1312 | } | 1322 | } |
| 1313 | 1323 | ||
| 1314 | UDF_I(inode)->i_unique = le64_to_cpu(efe->uniqueID); | 1324 | iinfo->i_unique = le64_to_cpu(efe->uniqueID); |
| 1315 | UDF_I(inode)->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); | 1325 | iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); |
| 1316 | UDF_I(inode)->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); | 1326 | iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); |
| 1317 | offset = sizeof(struct extendedFileEntry) + | 1327 | offset = sizeof(struct extendedFileEntry) + |
| 1318 | UDF_I(inode)->i_lenEAttr; | 1328 | iinfo->i_lenEAttr; |
| 1319 | } | 1329 | } |
| 1320 | 1330 | ||
| 1321 | switch (fe->icbTag.fileType) { | 1331 | switch (fe->icbTag.fileType) { |
| @@ -1328,7 +1338,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1328 | case ICBTAG_FILE_TYPE_REALTIME: | 1338 | case ICBTAG_FILE_TYPE_REALTIME: |
| 1329 | case ICBTAG_FILE_TYPE_REGULAR: | 1339 | case ICBTAG_FILE_TYPE_REGULAR: |
| 1330 | case ICBTAG_FILE_TYPE_UNDEF: | 1340 | case ICBTAG_FILE_TYPE_UNDEF: |
| 1331 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1341 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
| 1332 | inode->i_data.a_ops = &udf_adinicb_aops; | 1342 | inode->i_data.a_ops = &udf_adinicb_aops; |
| 1333 | else | 1343 | else |
| 1334 | inode->i_data.a_ops = &udf_aops; | 1344 | inode->i_data.a_ops = &udf_aops; |
| @@ -1375,9 +1385,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1375 | 1385 | ||
| 1376 | static int udf_alloc_i_data(struct inode *inode, size_t size) | 1386 | static int udf_alloc_i_data(struct inode *inode, size_t size) |
| 1377 | { | 1387 | { |
| 1378 | UDF_I(inode)->i_ext.i_data = kmalloc(size, GFP_KERNEL); | 1388 | struct udf_inode_info *iinfo = UDF_I(inode); |
| 1389 | iinfo->i_ext.i_data = kmalloc(size, GFP_KERNEL); | ||
| 1379 | 1390 | ||
| 1380 | if (!UDF_I(inode)->i_ext.i_data) { | 1391 | if (!iinfo->i_ext.i_data) { |
| 1381 | printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " | 1392 | printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " |
| 1382 | "no free memory\n", inode->i_ino); | 1393 | "no free memory\n", inode->i_ino); |
| 1383 | return -ENOMEM; | 1394 | return -ENOMEM; |
| @@ -1448,10 +1459,11 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1448 | int err = 0; | 1459 | int err = 0; |
| 1449 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1460 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
| 1450 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; | 1461 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; |
| 1462 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 1451 | 1463 | ||
| 1452 | bh = udf_tread(inode->i_sb, | 1464 | bh = udf_tread(inode->i_sb, |
| 1453 | udf_get_lb_pblock(inode->i_sb, | 1465 | udf_get_lb_pblock(inode->i_sb, |
| 1454 | UDF_I(inode)->i_location, 0)); | 1466 | iinfo->i_location, 0)); |
| 1455 | if (!bh) { | 1467 | if (!bh) { |
| 1456 | udf_debug("bread failure\n"); | 1468 | udf_debug("bread failure\n"); |
| 1457 | return -EIO; | 1469 | return -EIO; |
| @@ -1466,14 +1478,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1466 | struct unallocSpaceEntry *use = | 1478 | struct unallocSpaceEntry *use = |
| 1467 | (struct unallocSpaceEntry *)bh->b_data; | 1479 | (struct unallocSpaceEntry *)bh->b_data; |
| 1468 | 1480 | ||
| 1469 | use->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); | 1481 | use->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc); |
| 1470 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), | 1482 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), |
| 1471 | UDF_I(inode)->i_ext.i_data, inode->i_sb->s_blocksize - | 1483 | iinfo->i_ext.i_data, inode->i_sb->s_blocksize - |
| 1472 | sizeof(struct unallocSpaceEntry)); | 1484 | sizeof(struct unallocSpaceEntry)); |
| 1473 | crclen = sizeof(struct unallocSpaceEntry) + | 1485 | crclen = sizeof(struct unallocSpaceEntry) + |
| 1474 | UDF_I(inode)->i_lenAlloc - sizeof(tag); | 1486 | iinfo->i_lenAlloc - sizeof(tag); |
| 1475 | use->descTag.tagLocation = cpu_to_le32( | 1487 | use->descTag.tagLocation = cpu_to_le32( |
| 1476 | UDF_I(inode)->i_location. | 1488 | iinfo->i_location. |
| 1477 | logicalBlockNum); | 1489 | logicalBlockNum); |
| 1478 | use->descTag.descCRCLength = cpu_to_le16(crclen); | 1490 | use->descTag.descCRCLength = cpu_to_le16(crclen); |
| 1479 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + | 1491 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + |
| @@ -1538,9 +1550,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1538 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); | 1550 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); |
| 1539 | } | 1551 | } |
| 1540 | 1552 | ||
| 1541 | if (UDF_I(inode)->i_efe == 0) { | 1553 | if (iinfo->i_efe == 0) { |
| 1542 | memcpy(bh->b_data + sizeof(struct fileEntry), | 1554 | memcpy(bh->b_data + sizeof(struct fileEntry), |
| 1543 | UDF_I(inode)->i_ext.i_data, | 1555 | iinfo->i_ext.i_data, |
| 1544 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1556 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
| 1545 | fe->logicalBlocksRecorded = cpu_to_le64( | 1557 | fe->logicalBlocksRecorded = cpu_to_le64( |
| 1546 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1558 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
| @@ -1556,14 +1568,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1556 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); | 1568 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); |
| 1557 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1569 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
| 1558 | fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1570 | fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
| 1559 | fe->uniqueID = cpu_to_le64(UDF_I(inode)->i_unique); | 1571 | fe->uniqueID = cpu_to_le64(iinfo->i_unique); |
| 1560 | fe->lengthExtendedAttr = cpu_to_le32(UDF_I(inode)->i_lenEAttr); | 1572 | fe->lengthExtendedAttr = cpu_to_le32(iinfo->i_lenEAttr); |
| 1561 | fe->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); | 1573 | fe->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc); |
| 1562 | fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); | 1574 | fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); |
| 1563 | crclen = sizeof(struct fileEntry); | 1575 | crclen = sizeof(struct fileEntry); |
| 1564 | } else { | 1576 | } else { |
| 1565 | memcpy(bh->b_data + sizeof(struct extendedFileEntry), | 1577 | memcpy(bh->b_data + sizeof(struct extendedFileEntry), |
| 1566 | UDF_I(inode)->i_ext.i_data, | 1578 | iinfo->i_ext.i_data, |
| 1567 | inode->i_sb->s_blocksize - | 1579 | inode->i_sb->s_blocksize - |
| 1568 | sizeof(struct extendedFileEntry)); | 1580 | sizeof(struct extendedFileEntry)); |
| 1569 | efe->objectSize = cpu_to_le64(inode->i_size); | 1581 | efe->objectSize = cpu_to_le64(inode->i_size); |
| @@ -1571,26 +1583,26 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1571 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1583 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
| 1572 | (blocksize_bits - 9)); | 1584 | (blocksize_bits - 9)); |
| 1573 | 1585 | ||
| 1574 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_atime.tv_sec || | 1586 | if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec || |
| 1575 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_atime.tv_sec && | 1587 | (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec && |
| 1576 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_atime.tv_nsec)) | 1588 | iinfo->i_crtime.tv_nsec > inode->i_atime.tv_nsec)) |
| 1577 | UDF_I(inode)->i_crtime = inode->i_atime; | 1589 | iinfo->i_crtime = inode->i_atime; |
| 1578 | 1590 | ||
| 1579 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_mtime.tv_sec || | 1591 | if (iinfo->i_crtime.tv_sec > inode->i_mtime.tv_sec || |
| 1580 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_mtime.tv_sec && | 1592 | (iinfo->i_crtime.tv_sec == inode->i_mtime.tv_sec && |
| 1581 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_mtime.tv_nsec)) | 1593 | iinfo->i_crtime.tv_nsec > inode->i_mtime.tv_nsec)) |
| 1582 | UDF_I(inode)->i_crtime = inode->i_mtime; | 1594 | iinfo->i_crtime = inode->i_mtime; |
| 1583 | 1595 | ||
| 1584 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_ctime.tv_sec || | 1596 | if (iinfo->i_crtime.tv_sec > inode->i_ctime.tv_sec || |
| 1585 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_ctime.tv_sec && | 1597 | (iinfo->i_crtime.tv_sec == inode->i_ctime.tv_sec && |
| 1586 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) | 1598 | iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) |
| 1587 | UDF_I(inode)->i_crtime = inode->i_ctime; | 1599 | iinfo->i_crtime = inode->i_ctime; |
| 1588 | 1600 | ||
| 1589 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) | 1601 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) |
| 1590 | efe->accessTime = cpu_to_lets(cpu_time); | 1602 | efe->accessTime = cpu_to_lets(cpu_time); |
| 1591 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) | 1603 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) |
| 1592 | efe->modificationTime = cpu_to_lets(cpu_time); | 1604 | efe->modificationTime = cpu_to_lets(cpu_time); |
| 1593 | if (udf_time_to_stamp(&cpu_time, UDF_I(inode)->i_crtime)) | 1605 | if (udf_time_to_stamp(&cpu_time, iinfo->i_crtime)) |
| 1594 | efe->createTime = cpu_to_lets(cpu_time); | 1606 | efe->createTime = cpu_to_lets(cpu_time); |
| 1595 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) | 1607 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) |
| 1596 | efe->attrTime = cpu_to_lets(cpu_time); | 1608 | efe->attrTime = cpu_to_lets(cpu_time); |
| @@ -1599,13 +1611,13 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1599 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); | 1611 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); |
| 1600 | efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1612 | efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
| 1601 | efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1613 | efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
| 1602 | efe->uniqueID = cpu_to_le64(UDF_I(inode)->i_unique); | 1614 | efe->uniqueID = cpu_to_le64(iinfo->i_unique); |
| 1603 | efe->lengthExtendedAttr = cpu_to_le32(UDF_I(inode)->i_lenEAttr); | 1615 | efe->lengthExtendedAttr = cpu_to_le32(iinfo->i_lenEAttr); |
| 1604 | efe->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); | 1616 | efe->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc); |
| 1605 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); | 1617 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); |
| 1606 | crclen = sizeof(struct extendedFileEntry); | 1618 | crclen = sizeof(struct extendedFileEntry); |
| 1607 | } | 1619 | } |
| 1608 | if (UDF_I(inode)->i_strat4096) { | 1620 | if (iinfo->i_strat4096) { |
| 1609 | fe->icbTag.strategyType = cpu_to_le16(4096); | 1621 | fe->icbTag.strategyType = cpu_to_le16(4096); |
| 1610 | fe->icbTag.strategyParameter = cpu_to_le16(1); | 1622 | fe->icbTag.strategyParameter = cpu_to_le16(1); |
| 1611 | fe->icbTag.numEntries = cpu_to_le16(2); | 1623 | fe->icbTag.numEntries = cpu_to_le16(2); |
| @@ -1629,7 +1641,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1629 | else if (S_ISSOCK(inode->i_mode)) | 1641 | else if (S_ISSOCK(inode->i_mode)) |
| 1630 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET; | 1642 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET; |
| 1631 | 1643 | ||
| 1632 | icbflags = UDF_I(inode)->i_alloc_type | | 1644 | icbflags = iinfo->i_alloc_type | |
| 1633 | ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | | 1645 | ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | |
| 1634 | ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | | 1646 | ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | |
| 1635 | ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | | 1647 | ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | |
| @@ -1644,8 +1656,8 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1644 | fe->descTag.descVersion = cpu_to_le16(2); | 1656 | fe->descTag.descVersion = cpu_to_le16(2); |
| 1645 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); | 1657 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); |
| 1646 | fe->descTag.tagLocation = cpu_to_le32( | 1658 | fe->descTag.tagLocation = cpu_to_le32( |
| 1647 | UDF_I(inode)->i_location.logicalBlockNum); | 1659 | iinfo->i_location.logicalBlockNum); |
| 1648 | crclen += UDF_I(inode)->i_lenEAttr + UDF_I(inode)->i_lenAlloc - | 1660 | crclen += iinfo->i_lenEAttr + iinfo->i_lenAlloc - |
| 1649 | sizeof(tag); | 1661 | sizeof(tag); |
| 1650 | fe->descTag.descCRCLength = cpu_to_le16(crclen); | 1662 | fe->descTag.descCRCLength = cpu_to_le16(crclen); |
| 1651 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), | 1663 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), |
| @@ -1709,17 +1721,18 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1709 | struct allocExtDesc *aed; | 1721 | struct allocExtDesc *aed; |
| 1710 | int8_t etype; | 1722 | int8_t etype; |
| 1711 | uint8_t *ptr; | 1723 | uint8_t *ptr; |
| 1724 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 1712 | 1725 | ||
| 1713 | if (!epos->bh) | 1726 | if (!epos->bh) |
| 1714 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - | 1727 | ptr = iinfo->i_ext.i_data + epos->offset - |
| 1715 | udf_file_entry_alloc_offset(inode) + | 1728 | udf_file_entry_alloc_offset(inode) + |
| 1716 | UDF_I(inode)->i_lenEAttr; | 1729 | iinfo->i_lenEAttr; |
| 1717 | else | 1730 | else |
| 1718 | ptr = epos->bh->b_data + epos->offset; | 1731 | ptr = epos->bh->b_data + epos->offset; |
| 1719 | 1732 | ||
| 1720 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 1733 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 1721 | adsize = sizeof(short_ad); | 1734 | adsize = sizeof(short_ad); |
| 1722 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 1735 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 1723 | adsize = sizeof(long_ad); | 1736 | adsize = sizeof(long_ad); |
| 1724 | else | 1737 | else |
| 1725 | return -1; | 1738 | return -1; |
| @@ -1769,7 +1782,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1769 | cpu_to_le32(le32_to_cpu( | 1782 | cpu_to_le32(le32_to_cpu( |
| 1770 | aed->lengthAllocDescs) + adsize); | 1783 | aed->lengthAllocDescs) + adsize); |
| 1771 | } else { | 1784 | } else { |
| 1772 | UDF_I(inode)->i_lenAlloc += adsize; | 1785 | iinfo->i_lenAlloc += adsize; |
| 1773 | mark_inode_dirty(inode); | 1786 | mark_inode_dirty(inode); |
| 1774 | } | 1787 | } |
| 1775 | } | 1788 | } |
| @@ -1779,7 +1792,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1779 | else | 1792 | else |
| 1780 | udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, | 1793 | udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, |
| 1781 | epos->block.logicalBlockNum, sizeof(tag)); | 1794 | epos->block.logicalBlockNum, sizeof(tag)); |
| 1782 | switch (UDF_I(inode)->i_alloc_type) { | 1795 | switch (iinfo->i_alloc_type) { |
| 1783 | case ICBTAG_FLAG_AD_SHORT: | 1796 | case ICBTAG_FLAG_AD_SHORT: |
| 1784 | sad = (short_ad *)sptr; | 1797 | sad = (short_ad *)sptr; |
| 1785 | sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | | 1798 | sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | |
| @@ -1813,7 +1826,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1813 | etype = udf_write_aext(inode, epos, eloc, elen, inc); | 1826 | etype = udf_write_aext(inode, epos, eloc, elen, inc); |
| 1814 | 1827 | ||
| 1815 | if (!epos->bh) { | 1828 | if (!epos->bh) { |
| 1816 | UDF_I(inode)->i_lenAlloc += adsize; | 1829 | iinfo->i_lenAlloc += adsize; |
| 1817 | mark_inode_dirty(inode); | 1830 | mark_inode_dirty(inode); |
| 1818 | } else { | 1831 | } else { |
| 1819 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1832 | aed = (struct allocExtDesc *)epos->bh->b_data; |
| @@ -1840,15 +1853,16 @@ int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, | |||
| 1840 | uint8_t *ptr; | 1853 | uint8_t *ptr; |
| 1841 | short_ad *sad; | 1854 | short_ad *sad; |
| 1842 | long_ad *lad; | 1855 | long_ad *lad; |
| 1856 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 1843 | 1857 | ||
| 1844 | if (!epos->bh) | 1858 | if (!epos->bh) |
| 1845 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - | 1859 | ptr = iinfo->i_ext.i_data + epos->offset - |
| 1846 | udf_file_entry_alloc_offset(inode) + | 1860 | udf_file_entry_alloc_offset(inode) + |
| 1847 | UDF_I(inode)->i_lenEAttr; | 1861 | iinfo->i_lenEAttr; |
| 1848 | else | 1862 | else |
| 1849 | ptr = epos->bh->b_data + epos->offset; | 1863 | ptr = epos->bh->b_data + epos->offset; |
| 1850 | 1864 | ||
| 1851 | switch (UDF_I(inode)->i_alloc_type) { | 1865 | switch (iinfo->i_alloc_type) { |
| 1852 | case ICBTAG_FLAG_AD_SHORT: | 1866 | case ICBTAG_FLAG_AD_SHORT: |
| 1853 | sad = (short_ad *)ptr; | 1867 | sad = (short_ad *)ptr; |
| 1854 | sad->extLength = cpu_to_le32(elen); | 1868 | sad->extLength = cpu_to_le32(elen); |
| @@ -1916,15 +1930,16 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
| 1916 | uint8_t *ptr; | 1930 | uint8_t *ptr; |
| 1917 | short_ad *sad; | 1931 | short_ad *sad; |
| 1918 | long_ad *lad; | 1932 | long_ad *lad; |
| 1933 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
| 1919 | 1934 | ||
| 1920 | if (!epos->bh) { | 1935 | if (!epos->bh) { |
| 1921 | if (!epos->offset) | 1936 | if (!epos->offset) |
| 1922 | epos->offset = udf_file_entry_alloc_offset(inode); | 1937 | epos->offset = udf_file_entry_alloc_offset(inode); |
| 1923 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - | 1938 | ptr = iinfo->i_ext.i_data + epos->offset - |
| 1924 | udf_file_entry_alloc_offset(inode) + | 1939 | udf_file_entry_alloc_offset(inode) + |
| 1925 | UDF_I(inode)->i_lenEAttr; | 1940 | iinfo->i_lenEAttr; |
| 1926 | alen = udf_file_entry_alloc_offset(inode) + | 1941 | alen = udf_file_entry_alloc_offset(inode) + |
| 1927 | UDF_I(inode)->i_lenAlloc; | 1942 | iinfo->i_lenAlloc; |
| 1928 | } else { | 1943 | } else { |
| 1929 | if (!epos->offset) | 1944 | if (!epos->offset) |
| 1930 | epos->offset = sizeof(struct allocExtDesc); | 1945 | epos->offset = sizeof(struct allocExtDesc); |
| @@ -1934,7 +1949,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
| 1934 | lengthAllocDescs); | 1949 | lengthAllocDescs); |
| 1935 | } | 1950 | } |
| 1936 | 1951 | ||
| 1937 | switch (UDF_I(inode)->i_alloc_type) { | 1952 | switch (iinfo->i_alloc_type) { |
| 1938 | case ICBTAG_FLAG_AD_SHORT: | 1953 | case ICBTAG_FLAG_AD_SHORT: |
| 1939 | sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc); | 1954 | sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc); |
| 1940 | if (!sad) | 1955 | if (!sad) |
| @@ -1942,7 +1957,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
| 1942 | etype = le32_to_cpu(sad->extLength) >> 30; | 1957 | etype = le32_to_cpu(sad->extLength) >> 30; |
| 1943 | eloc->logicalBlockNum = le32_to_cpu(sad->extPosition); | 1958 | eloc->logicalBlockNum = le32_to_cpu(sad->extPosition); |
| 1944 | eloc->partitionReferenceNum = | 1959 | eloc->partitionReferenceNum = |
| 1945 | UDF_I(inode)->i_location.partitionReferenceNum; | 1960 | iinfo->i_location.partitionReferenceNum; |
| 1946 | *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK; | 1961 | *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK; |
| 1947 | break; | 1962 | break; |
| 1948 | case ICBTAG_FLAG_AD_LONG: | 1963 | case ICBTAG_FLAG_AD_LONG: |
| @@ -1955,7 +1970,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
| 1955 | break; | 1970 | break; |
| 1956 | default: | 1971 | default: |
| 1957 | udf_debug("alloc_type = %d unsupported\n", | 1972 | udf_debug("alloc_type = %d unsupported\n", |
| 1958 | UDF_I(inode)->i_alloc_type); | 1973 | iinfo->i_alloc_type); |
| 1959 | return -1; | 1974 | return -1; |
| 1960 | } | 1975 | } |
| 1961 | 1976 | ||
| @@ -1990,15 +2005,17 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 1990 | int adsize; | 2005 | int adsize; |
| 1991 | int8_t etype; | 2006 | int8_t etype; |
| 1992 | struct allocExtDesc *aed; | 2007 | struct allocExtDesc *aed; |
| 2008 | struct udf_inode_info *iinfo; | ||
| 1993 | 2009 | ||
| 1994 | if (epos.bh) { | 2010 | if (epos.bh) { |
| 1995 | get_bh(epos.bh); | 2011 | get_bh(epos.bh); |
| 1996 | get_bh(epos.bh); | 2012 | get_bh(epos.bh); |
| 1997 | } | 2013 | } |
| 1998 | 2014 | ||
| 1999 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 2015 | iinfo = UDF_I(inode); |
| 2016 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | ||
| 2000 | adsize = sizeof(short_ad); | 2017 | adsize = sizeof(short_ad); |
| 2001 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 2018 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 2002 | adsize = sizeof(long_ad); | 2019 | adsize = sizeof(long_ad); |
| 2003 | else | 2020 | else |
| 2004 | adsize = 0; | 2021 | adsize = 0; |
| @@ -2025,7 +2042,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 2025 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2042 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
| 2026 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2043 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
| 2027 | if (!oepos.bh) { | 2044 | if (!oepos.bh) { |
| 2028 | UDF_I(inode)->i_lenAlloc -= (adsize * 2); | 2045 | iinfo->i_lenAlloc -= (adsize * 2); |
| 2029 | mark_inode_dirty(inode); | 2046 | mark_inode_dirty(inode); |
| 2030 | } else { | 2047 | } else { |
| 2031 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2048 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
| @@ -2044,7 +2061,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 2044 | } else { | 2061 | } else { |
| 2045 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2062 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
| 2046 | if (!oepos.bh) { | 2063 | if (!oepos.bh) { |
| 2047 | UDF_I(inode)->i_lenAlloc -= adsize; | 2064 | iinfo->i_lenAlloc -= adsize; |
| 2048 | mark_inode_dirty(inode); | 2065 | mark_inode_dirty(inode); |
| 2049 | } else { | 2066 | } else { |
| 2050 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2067 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
| @@ -2076,14 +2093,16 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
| 2076 | loff_t lbcount = 0, bcount = | 2093 | loff_t lbcount = 0, bcount = |
| 2077 | (loff_t) block << blocksize_bits; | 2094 | (loff_t) block << blocksize_bits; |
| 2078 | int8_t etype; | 2095 | int8_t etype; |
| 2096 | struct udf_inode_info *iinfo; | ||
| 2079 | 2097 | ||
| 2080 | if (block < 0) { | 2098 | if (block < 0) { |
| 2081 | printk(KERN_ERR "udf: inode_bmap: block < 0\n"); | 2099 | printk(KERN_ERR "udf: inode_bmap: block < 0\n"); |
| 2082 | return -1; | 2100 | return -1; |
| 2083 | } | 2101 | } |
| 2084 | 2102 | ||
| 2103 | iinfo = UDF_I(inode); | ||
| 2085 | pos->offset = 0; | 2104 | pos->offset = 0; |
| 2086 | pos->block = UDF_I(inode)->i_location; | 2105 | pos->block = iinfo->i_location; |
| 2087 | pos->bh = NULL; | 2106 | pos->bh = NULL; |
| 2088 | *elen = 0; | 2107 | *elen = 0; |
| 2089 | 2108 | ||
| @@ -2091,7 +2110,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
| 2091 | etype = udf_next_aext(inode, pos, eloc, elen, 1); | 2110 | etype = udf_next_aext(inode, pos, eloc, elen, 1); |
| 2092 | if (etype == -1) { | 2111 | if (etype == -1) { |
| 2093 | *offset = (bcount - lbcount) >> blocksize_bits; | 2112 | *offset = (bcount - lbcount) >> blocksize_bits; |
| 2094 | UDF_I(inode)->i_lenExtents = lbcount; | 2113 | iinfo->i_lenExtents = lbcount; |
| 2095 | return -1; | 2114 | return -1; |
| 2096 | } | 2115 | } |
| 2097 | lbcount += *elen; | 2116 | lbcount += *elen; |
