diff options
| -rw-r--r-- | fs/udf/balloc.c | 59 | ||||
| -rw-r--r-- | fs/udf/dir.c | 6 | ||||
| -rw-r--r-- | fs/udf/directory.c | 6 | ||||
| -rw-r--r-- | fs/udf/ialloc.c | 4 | ||||
| -rw-r--r-- | fs/udf/inode.c | 70 | ||||
| -rw-r--r-- | fs/udf/misc.c | 5 | ||||
| -rw-r--r-- | fs/udf/namei.c | 32 | ||||
| -rw-r--r-- | fs/udf/super.c | 22 | ||||
| -rw-r--r-- | fs/udf/truncate.c | 22 | ||||
| -rw-r--r-- | fs/udf/udfdecl.h | 20 |
10 files changed, 130 insertions, 116 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 1237900e81b6..94d876a6d19a 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c | |||
| @@ -92,7 +92,7 @@ static int read_block_bitmap(struct super_block *sb, | |||
| 92 | loc.logicalBlockNum = bitmap->s_extPosition; | 92 | loc.logicalBlockNum = bitmap->s_extPosition; |
| 93 | loc.partitionReferenceNum = UDF_SB(sb)->s_partition; | 93 | loc.partitionReferenceNum = UDF_SB(sb)->s_partition; |
| 94 | 94 | ||
| 95 | bh = udf_tread(sb, udf_get_lb_pblock(sb, loc, block)); | 95 | bh = udf_tread(sb, udf_get_lb_pblock(sb, &loc, block)); |
| 96 | if (!bh) | 96 | if (!bh) |
| 97 | retval = -EIO; | 97 | retval = -EIO; |
| 98 | 98 | ||
| @@ -156,11 +156,13 @@ static bool udf_add_free_space(struct udf_sb_info *sbi, | |||
| 156 | static void udf_bitmap_free_blocks(struct super_block *sb, | 156 | static void udf_bitmap_free_blocks(struct super_block *sb, |
| 157 | struct inode *inode, | 157 | struct inode *inode, |
| 158 | struct udf_bitmap *bitmap, | 158 | struct udf_bitmap *bitmap, |
| 159 | struct kernel_lb_addr bloc, uint32_t offset, | 159 | struct kernel_lb_addr *bloc, |
| 160 | uint32_t offset, | ||
| 160 | uint32_t count) | 161 | uint32_t count) |
| 161 | { | 162 | { |
| 162 | struct udf_sb_info *sbi = UDF_SB(sb); | 163 | struct udf_sb_info *sbi = UDF_SB(sb); |
| 163 | struct buffer_head *bh = NULL; | 164 | struct buffer_head *bh = NULL; |
| 165 | struct udf_part_map *partmap; | ||
| 164 | unsigned long block; | 166 | unsigned long block; |
| 165 | unsigned long block_group; | 167 | unsigned long block_group; |
| 166 | unsigned long bit; | 168 | unsigned long bit; |
| @@ -169,17 +171,17 @@ static void udf_bitmap_free_blocks(struct super_block *sb, | |||
| 169 | unsigned long overflow; | 171 | unsigned long overflow; |
| 170 | 172 | ||
| 171 | mutex_lock(&sbi->s_alloc_mutex); | 173 | mutex_lock(&sbi->s_alloc_mutex); |
| 172 | if (bloc.logicalBlockNum < 0 || | 174 | partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; |
| 173 | (bloc.logicalBlockNum + count) > | 175 | if (bloc->logicalBlockNum < 0 || |
| 174 | sbi->s_partmaps[bloc.partitionReferenceNum].s_partition_len) { | 176 | (bloc->logicalBlockNum + count) > |
| 177 | partmap->s_partition_len) { | ||
| 175 | udf_debug("%d < %d || %d + %d > %d\n", | 178 | udf_debug("%d < %d || %d + %d > %d\n", |
| 176 | bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count, | 179 | bloc->logicalBlockNum, 0, bloc->logicalBlockNum, |
| 177 | sbi->s_partmaps[bloc.partitionReferenceNum]. | 180 | count, partmap->s_partition_len); |
| 178 | s_partition_len); | ||
| 179 | goto error_return; | 181 | goto error_return; |
| 180 | } | 182 | } |
| 181 | 183 | ||
| 182 | block = bloc.logicalBlockNum + offset + | 184 | block = bloc->logicalBlockNum + offset + |
| 183 | (sizeof(struct spaceBitmapDesc) << 3); | 185 | (sizeof(struct spaceBitmapDesc) << 3); |
| 184 | 186 | ||
| 185 | do { | 187 | do { |
| @@ -425,10 +427,12 @@ error_return: | |||
| 425 | static void udf_table_free_blocks(struct super_block *sb, | 427 | static void udf_table_free_blocks(struct super_block *sb, |
| 426 | struct inode *inode, | 428 | struct inode *inode, |
| 427 | struct inode *table, | 429 | struct inode *table, |
| 428 | struct kernel_lb_addr bloc, uint32_t offset, | 430 | struct kernel_lb_addr *bloc, |
| 431 | uint32_t offset, | ||
| 429 | uint32_t count) | 432 | uint32_t count) |
| 430 | { | 433 | { |
| 431 | struct udf_sb_info *sbi = UDF_SB(sb); | 434 | struct udf_sb_info *sbi = UDF_SB(sb); |
| 435 | struct udf_part_map *partmap; | ||
| 432 | uint32_t start, end; | 436 | uint32_t start, end; |
| 433 | uint32_t elen; | 437 | uint32_t elen; |
| 434 | struct kernel_lb_addr eloc; | 438 | struct kernel_lb_addr eloc; |
| @@ -438,13 +442,13 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 438 | struct udf_inode_info *iinfo; | 442 | struct udf_inode_info *iinfo; |
| 439 | 443 | ||
| 440 | mutex_lock(&sbi->s_alloc_mutex); | 444 | mutex_lock(&sbi->s_alloc_mutex); |
| 441 | if (bloc.logicalBlockNum < 0 || | 445 | partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; |
| 442 | (bloc.logicalBlockNum + count) > | 446 | if (bloc->logicalBlockNum < 0 || |
| 443 | sbi->s_partmaps[bloc.partitionReferenceNum].s_partition_len) { | 447 | (bloc->logicalBlockNum + count) > |
| 448 | partmap->s_partition_len) { | ||
| 444 | udf_debug("%d < %d || %d + %d > %d\n", | 449 | udf_debug("%d < %d || %d + %d > %d\n", |
| 445 | bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count, | 450 | bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count, |
| 446 | sbi->s_partmaps[bloc.partitionReferenceNum]. | 451 | partmap->s_partition_len); |
| 447 | s_partition_len); | ||
| 448 | goto error_return; | 452 | goto error_return; |
| 449 | } | 453 | } |
| 450 | 454 | ||
| @@ -456,8 +460,8 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 456 | if (udf_add_free_space(sbi, sbi->s_partition, count)) | 460 | if (udf_add_free_space(sbi, sbi->s_partition, count)) |
| 457 | mark_buffer_dirty(sbi->s_lvid_bh); | 461 | mark_buffer_dirty(sbi->s_lvid_bh); |
| 458 | 462 | ||
| 459 | start = bloc.logicalBlockNum + offset; | 463 | start = bloc->logicalBlockNum + offset; |
| 460 | end = bloc.logicalBlockNum + offset + count - 1; | 464 | end = bloc->logicalBlockNum + offset + count - 1; |
| 461 | 465 | ||
| 462 | epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry); | 466 | epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry); |
| 463 | elen = 0; | 467 | elen = 0; |
| @@ -483,7 +487,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 483 | start += count; | 487 | start += count; |
| 484 | count = 0; | 488 | count = 0; |
| 485 | } | 489 | } |
| 486 | udf_write_aext(table, &oepos, eloc, elen, 1); | 490 | udf_write_aext(table, &oepos, &eloc, elen, 1); |
| 487 | } else if (eloc.logicalBlockNum == (end + 1)) { | 491 | } else if (eloc.logicalBlockNum == (end + 1)) { |
| 488 | if ((0x3FFFFFFF - elen) < | 492 | if ((0x3FFFFFFF - elen) < |
| 489 | (count << sb->s_blocksize_bits)) { | 493 | (count << sb->s_blocksize_bits)) { |
| @@ -502,7 +506,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 502 | end -= count; | 506 | end -= count; |
| 503 | count = 0; | 507 | count = 0; |
| 504 | } | 508 | } |
| 505 | udf_write_aext(table, &oepos, eloc, elen, 1); | 509 | udf_write_aext(table, &oepos, &eloc, elen, 1); |
| 506 | } | 510 | } |
| 507 | 511 | ||
| 508 | if (epos.bh != oepos.bh) { | 512 | if (epos.bh != oepos.bh) { |
| @@ -563,7 +567,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 563 | elen -= sb->s_blocksize; | 567 | elen -= sb->s_blocksize; |
| 564 | 568 | ||
| 565 | epos.bh = udf_tread(sb, | 569 | epos.bh = udf_tread(sb, |
| 566 | udf_get_lb_pblock(sb, epos.block, 0)); | 570 | udf_get_lb_pblock(sb, &epos.block, 0)); |
| 567 | if (!epos.bh) { | 571 | if (!epos.bh) { |
| 568 | brelse(oepos.bh); | 572 | brelse(oepos.bh); |
| 569 | goto error_return; | 573 | goto error_return; |
| @@ -635,7 +639,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
| 635 | 639 | ||
| 636 | /* It's possible that stealing the block emptied the extent */ | 640 | /* It's possible that stealing the block emptied the extent */ |
| 637 | if (elen) { | 641 | if (elen) { |
| 638 | udf_write_aext(table, &epos, eloc, elen, 1); | 642 | udf_write_aext(table, &epos, &eloc, elen, 1); |
| 639 | 643 | ||
| 640 | if (!epos.bh) { | 644 | if (!epos.bh) { |
| 641 | iinfo->i_lenAlloc += adsize; | 645 | iinfo->i_lenAlloc += adsize; |
| @@ -707,7 +711,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb, | |||
| 707 | alloc_count = block_count; | 711 | alloc_count = block_count; |
| 708 | eloc.logicalBlockNum += alloc_count; | 712 | eloc.logicalBlockNum += alloc_count; |
| 709 | elen -= (alloc_count << sb->s_blocksize_bits); | 713 | elen -= (alloc_count << sb->s_blocksize_bits); |
| 710 | udf_write_aext(table, &epos, eloc, | 714 | udf_write_aext(table, &epos, &eloc, |
| 711 | (etype << 30) | elen, 1); | 715 | (etype << 30) | elen, 1); |
| 712 | } else | 716 | } else |
| 713 | udf_delete_aext(table, epos, eloc, | 717 | udf_delete_aext(table, epos, eloc, |
| @@ -814,7 +818,7 @@ static int udf_table_new_block(struct super_block *sb, | |||
| 814 | } | 818 | } |
| 815 | 819 | ||
| 816 | if (goal_elen) | 820 | if (goal_elen) |
| 817 | udf_write_aext(table, &goal_epos, goal_eloc, goal_elen, 1); | 821 | udf_write_aext(table, &goal_epos, &goal_eloc, goal_elen, 1); |
| 818 | else | 822 | else |
| 819 | udf_delete_aext(table, goal_epos, goal_eloc, goal_elen); | 823 | udf_delete_aext(table, goal_epos, goal_eloc, goal_elen); |
| 820 | brelse(goal_epos.bh); | 824 | brelse(goal_epos.bh); |
| @@ -828,12 +832,11 @@ static int udf_table_new_block(struct super_block *sb, | |||
| 828 | return newblock; | 832 | return newblock; |
| 829 | } | 833 | } |
| 830 | 834 | ||
| 831 | inline void udf_free_blocks(struct super_block *sb, | 835 | void udf_free_blocks(struct super_block *sb, struct inode *inode, |
| 832 | struct inode *inode, | 836 | struct kernel_lb_addr *bloc, uint32_t offset, |
| 833 | struct kernel_lb_addr bloc, uint32_t offset, | 837 | uint32_t count) |
| 834 | uint32_t count) | ||
| 835 | { | 838 | { |
| 836 | uint16_t partition = bloc.partitionReferenceNum; | 839 | uint16_t partition = bloc->partitionReferenceNum; |
| 837 | struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition]; | 840 | struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition]; |
| 838 | 841 | ||
| 839 | if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) { | 842 | if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) { |
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 19d3ae4e2ae2..2efd4d5291b6 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
| @@ -80,7 +80,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
| 80 | ret = -ENOENT; | 80 | ret = -ENOENT; |
| 81 | goto out; | 81 | goto out; |
| 82 | } | 82 | } |
| 83 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 83 | block = udf_get_lb_pblock(dir->i_sb, &eloc, offset); |
| 84 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 84 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
| 85 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 85 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 86 | epos.offset -= sizeof(struct short_ad); | 86 | epos.offset -= sizeof(struct short_ad); |
| @@ -101,7 +101,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
| 101 | if (i + offset > (elen >> dir->i_sb->s_blocksize_bits)) | 101 | if (i + offset > (elen >> dir->i_sb->s_blocksize_bits)) |
| 102 | i = (elen >> dir->i_sb->s_blocksize_bits) - offset; | 102 | i = (elen >> dir->i_sb->s_blocksize_bits) - offset; |
| 103 | for (num = 0; i > 0; i--) { | 103 | for (num = 0; i > 0; i--) { |
| 104 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset + i); | 104 | block = udf_get_lb_pblock(dir->i_sb, &eloc, offset + i); |
| 105 | tmp = udf_tgetblk(dir->i_sb, block); | 105 | tmp = udf_tgetblk(dir->i_sb, block); |
| 106 | if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp)) | 106 | if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp)) |
| 107 | bha[num++] = tmp; | 107 | bha[num++] = tmp; |
| @@ -163,7 +163,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, | |||
| 163 | } else { | 163 | } else { |
| 164 | struct kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation); | 164 | struct kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation); |
| 165 | 165 | ||
| 166 | iblock = udf_get_lb_pblock(dir->i_sb, tloc, 0); | 166 | iblock = udf_get_lb_pblock(dir->i_sb, &tloc, 0); |
| 167 | flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi); | 167 | flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi); |
| 168 | dt_type = DT_UNKNOWN; | 168 | dt_type = DT_UNKNOWN; |
| 169 | } | 169 | } |
diff --git a/fs/udf/directory.c b/fs/udf/directory.c index 0ab251d3e94a..1d2c570704c8 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c | |||
| @@ -111,7 +111,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, | |||
| 111 | (EXT_RECORDED_ALLOCATED >> 30)) | 111 | (EXT_RECORDED_ALLOCATED >> 30)) |
| 112 | return NULL; | 112 | return NULL; |
| 113 | 113 | ||
| 114 | block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset); | 114 | block = udf_get_lb_pblock(dir->i_sb, eloc, *offset); |
| 115 | 115 | ||
| 116 | (*offset)++; | 116 | (*offset)++; |
| 117 | 117 | ||
| @@ -131,7 +131,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, | |||
| 131 | if (i + *offset > (*elen >> blocksize_bits)) | 131 | if (i + *offset > (*elen >> blocksize_bits)) |
| 132 | i = (*elen >> blocksize_bits)-*offset; | 132 | i = (*elen >> blocksize_bits)-*offset; |
| 133 | for (num = 0; i > 0; i--) { | 133 | for (num = 0; i > 0; i--) { |
| 134 | block = udf_get_lb_pblock(dir->i_sb, *eloc, | 134 | block = udf_get_lb_pblock(dir->i_sb, eloc, |
| 135 | *offset + i); | 135 | *offset + i); |
| 136 | tmp = udf_tgetblk(dir->i_sb, block); | 136 | tmp = udf_tgetblk(dir->i_sb, block); |
| 137 | if (tmp && !buffer_uptodate(tmp) && | 137 | if (tmp && !buffer_uptodate(tmp) && |
| @@ -169,7 +169,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, | |||
| 169 | (EXT_RECORDED_ALLOCATED >> 30)) | 169 | (EXT_RECORDED_ALLOCATED >> 30)) |
| 170 | return NULL; | 170 | return NULL; |
| 171 | 171 | ||
| 172 | block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset); | 172 | block = udf_get_lb_pblock(dir->i_sb, eloc, *offset); |
| 173 | 173 | ||
| 174 | (*offset)++; | 174 | (*offset)++; |
| 175 | 175 | ||
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 47dbe5613f90..6eb279d5f4fb 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
| @@ -54,7 +54,7 @@ void udf_free_inode(struct inode *inode) | |||
| 54 | } | 54 | } |
| 55 | mutex_unlock(&sbi->s_alloc_mutex); | 55 | mutex_unlock(&sbi->s_alloc_mutex); |
| 56 | 56 | ||
| 57 | udf_free_blocks(sb, NULL, UDF_I(inode)->i_location, 0, 1); | 57 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | 60 | struct inode *udf_new_inode(struct inode *dir, int mode, int *err) |
| @@ -138,7 +138,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
| 138 | iinfo->i_location.logicalBlockNum = block; | 138 | iinfo->i_location.logicalBlockNum = block; |
| 139 | iinfo->i_location.partitionReferenceNum = | 139 | iinfo->i_location.partitionReferenceNum = |
| 140 | dinfo->i_location.partitionReferenceNum; | 140 | dinfo->i_location.partitionReferenceNum; |
| 141 | inode->i_ino = udf_get_lb_pblock(sb, iinfo->i_location, 0); | 141 | inode->i_ino = udf_get_lb_pblock(sb, &iinfo->i_location, 0); |
| 142 | inode->i_blocks = 0; | 142 | inode->i_blocks = 0; |
| 143 | iinfo->i_lenEAttr = 0; | 143 | iinfo->i_lenEAttr = 0; |
| 144 | iinfo->i_lenAlloc = 0; | 144 | iinfo->i_lenAlloc = 0; |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index d086479a7d0e..3c98c305d37d 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
| @@ -281,7 +281,7 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
| 281 | epos.bh = NULL; | 281 | epos.bh = NULL; |
| 282 | epos.block = iinfo->i_location; | 282 | epos.block = iinfo->i_location; |
| 283 | epos.offset = udf_file_entry_alloc_offset(inode); | 283 | epos.offset = udf_file_entry_alloc_offset(inode); |
| 284 | udf_add_aext(inode, &epos, eloc, elen, 0); | 284 | udf_add_aext(inode, &epos, &eloc, elen, 0); |
| 285 | /* UniqueID stuff */ | 285 | /* UniqueID stuff */ |
| 286 | 286 | ||
| 287 | brelse(epos.bh); | 287 | brelse(epos.bh); |
| @@ -411,11 +411,11 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | if (fake) { | 413 | if (fake) { |
| 414 | udf_add_aext(inode, last_pos, last_ext->extLocation, | 414 | udf_add_aext(inode, last_pos, &last_ext->extLocation, |
| 415 | last_ext->extLength, 1); | 415 | last_ext->extLength, 1); |
| 416 | count++; | 416 | count++; |
| 417 | } else | 417 | } else |
| 418 | udf_write_aext(inode, last_pos, last_ext->extLocation, | 418 | udf_write_aext(inode, last_pos, &last_ext->extLocation, |
| 419 | last_ext->extLength, 1); | 419 | last_ext->extLength, 1); |
| 420 | 420 | ||
| 421 | /* Managed to do everything necessary? */ | 421 | /* Managed to do everything necessary? */ |
| @@ -432,7 +432,7 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
| 432 | /* Create enough extents to cover the whole hole */ | 432 | /* Create enough extents to cover the whole hole */ |
| 433 | while (blocks > add) { | 433 | while (blocks > add) { |
| 434 | blocks -= add; | 434 | blocks -= add; |
| 435 | if (udf_add_aext(inode, last_pos, last_ext->extLocation, | 435 | if (udf_add_aext(inode, last_pos, &last_ext->extLocation, |
| 436 | last_ext->extLength, 1) == -1) | 436 | last_ext->extLength, 1) == -1) |
| 437 | return -1; | 437 | return -1; |
| 438 | count++; | 438 | count++; |
| @@ -440,7 +440,7 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
| 440 | if (blocks) { | 440 | if (blocks) { |
| 441 | last_ext->extLength = EXT_NOT_RECORDED_NOT_ALLOCATED | | 441 | last_ext->extLength = EXT_NOT_RECORDED_NOT_ALLOCATED | |
| 442 | (blocks << sb->s_blocksize_bits); | 442 | (blocks << sb->s_blocksize_bits); |
| 443 | if (udf_add_aext(inode, last_pos, last_ext->extLocation, | 443 | if (udf_add_aext(inode, last_pos, &last_ext->extLocation, |
| 444 | last_ext->extLength, 1) == -1) | 444 | last_ext->extLength, 1) == -1) |
| 445 | return -1; | 445 | return -1; |
| 446 | count++; | 446 | count++; |
| @@ -449,7 +449,7 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
| 449 | out: | 449 | out: |
| 450 | /* Do we have some preallocated blocks saved? */ | 450 | /* Do we have some preallocated blocks saved? */ |
| 451 | if (prealloc_len) { | 451 | if (prealloc_len) { |
| 452 | if (udf_add_aext(inode, last_pos, prealloc_loc, | 452 | if (udf_add_aext(inode, last_pos, &prealloc_loc, |
| 453 | prealloc_len, 1) == -1) | 453 | prealloc_len, 1) == -1) |
| 454 | return -1; | 454 | return -1; |
| 455 | last_ext->extLocation = prealloc_loc; | 455 | last_ext->extLocation = prealloc_loc; |
| @@ -550,12 +550,12 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
| 550 | elen = EXT_RECORDED_ALLOCATED | | 550 | elen = EXT_RECORDED_ALLOCATED | |
| 551 | ((elen + inode->i_sb->s_blocksize - 1) & | 551 | ((elen + inode->i_sb->s_blocksize - 1) & |
| 552 | ~(inode->i_sb->s_blocksize - 1)); | 552 | ~(inode->i_sb->s_blocksize - 1)); |
| 553 | etype = udf_write_aext(inode, &cur_epos, eloc, elen, 1); | 553 | etype = udf_write_aext(inode, &cur_epos, &eloc, elen, 1); |
| 554 | } | 554 | } |
| 555 | brelse(prev_epos.bh); | 555 | brelse(prev_epos.bh); |
| 556 | brelse(cur_epos.bh); | 556 | brelse(cur_epos.bh); |
| 557 | brelse(next_epos.bh); | 557 | brelse(next_epos.bh); |
| 558 | newblock = udf_get_lb_pblock(inode->i_sb, eloc, offset); | 558 | newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); |
| 559 | *phys = newblock; | 559 | *phys = newblock; |
| 560 | return NULL; | 560 | return NULL; |
| 561 | } | 561 | } |
| @@ -726,7 +726,7 @@ static void udf_split_extents(struct inode *inode, int *c, int offset, | |||
| 726 | if (offset) { | 726 | if (offset) { |
| 727 | if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { | 727 | if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { |
| 728 | udf_free_blocks(inode->i_sb, inode, | 728 | udf_free_blocks(inode->i_sb, inode, |
| 729 | laarr[curr].extLocation, | 729 | &laarr[curr].extLocation, |
| 730 | 0, offset); | 730 | 0, offset); |
| 731 | laarr[curr].extLength = | 731 | laarr[curr].extLength = |
| 732 | EXT_NOT_RECORDED_NOT_ALLOCATED | | 732 | EXT_NOT_RECORDED_NOT_ALLOCATED | |
| @@ -911,7 +911,7 @@ static void udf_merge_extents(struct inode *inode, | |||
| 911 | (EXT_NOT_RECORDED_ALLOCATED >> 30)) && | 911 | (EXT_NOT_RECORDED_ALLOCATED >> 30)) && |
| 912 | ((lip1->extLength >> 30) == | 912 | ((lip1->extLength >> 30) == |
| 913 | (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))) { | 913 | (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))) { |
| 914 | udf_free_blocks(inode->i_sb, inode, li->extLocation, 0, | 914 | udf_free_blocks(inode->i_sb, inode, &li->extLocation, 0, |
| 915 | ((li->extLength & | 915 | ((li->extLength & |
| 916 | UDF_EXTENT_LENGTH_MASK) + | 916 | UDF_EXTENT_LENGTH_MASK) + |
| 917 | blocksize - 1) >> blocksize_bits); | 917 | blocksize - 1) >> blocksize_bits); |
| @@ -945,7 +945,7 @@ static void udf_merge_extents(struct inode *inode, | |||
| 945 | } else if ((li->extLength >> 30) == | 945 | } else if ((li->extLength >> 30) == |
| 946 | (EXT_NOT_RECORDED_ALLOCATED >> 30)) { | 946 | (EXT_NOT_RECORDED_ALLOCATED >> 30)) { |
| 947 | udf_free_blocks(inode->i_sb, inode, | 947 | udf_free_blocks(inode->i_sb, inode, |
| 948 | li->extLocation, 0, | 948 | &li->extLocation, 0, |
| 949 | ((li->extLength & | 949 | ((li->extLength & |
| 950 | UDF_EXTENT_LENGTH_MASK) + | 950 | UDF_EXTENT_LENGTH_MASK) + |
| 951 | blocksize - 1) >> blocksize_bits); | 951 | blocksize - 1) >> blocksize_bits); |
| @@ -983,7 +983,7 @@ static void udf_update_extents(struct inode *inode, | |||
| 983 | 983 | ||
| 984 | for (i = start; i < endnum; i++) { | 984 | for (i = start; i < endnum; i++) { |
| 985 | udf_next_aext(inode, epos, &tmploc, &tmplen, 0); | 985 | udf_next_aext(inode, epos, &tmploc, &tmplen, 0); |
| 986 | udf_write_aext(inode, epos, laarr[i].extLocation, | 986 | udf_write_aext(inode, epos, &laarr[i].extLocation, |
| 987 | laarr[i].extLength, 1); | 987 | laarr[i].extLength, 1); |
| 988 | } | 988 | } |
| 989 | } | 989 | } |
| @@ -1076,7 +1076,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1076 | * i_nlink = 1 | 1076 | * i_nlink = 1 |
| 1077 | * i_op = NULL; | 1077 | * i_op = NULL; |
| 1078 | */ | 1078 | */ |
| 1079 | bh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 0, &ident); | 1079 | bh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 0, &ident); |
| 1080 | if (!bh) { | 1080 | if (!bh) { |
| 1081 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", | 1081 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", |
| 1082 | inode->i_ino); | 1082 | inode->i_ino); |
| @@ -1098,7 +1098,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1098 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { | 1098 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { |
| 1099 | struct buffer_head *ibh; | 1099 | struct buffer_head *ibh; |
| 1100 | 1100 | ||
| 1101 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, | 1101 | ibh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 1, |
| 1102 | &ident); | 1102 | &ident); |
| 1103 | if (ident == TAG_IDENT_IE && ibh) { | 1103 | if (ident == TAG_IDENT_IE && ibh) { |
| 1104 | struct buffer_head *nbh = NULL; | 1104 | struct buffer_head *nbh = NULL; |
| @@ -1109,7 +1109,7 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1109 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | 1109 | loc = lelb_to_cpu(ie->indirectICB.extLocation); |
| 1110 | 1110 | ||
| 1111 | if (ie->indirectICB.extLength && | 1111 | if (ie->indirectICB.extLength && |
| 1112 | (nbh = udf_read_ptagged(inode->i_sb, loc, 0, | 1112 | (nbh = udf_read_ptagged(inode->i_sb, &loc, 0, |
| 1113 | &ident))) { | 1113 | &ident))) { |
| 1114 | if (ident == TAG_IDENT_FE || | 1114 | if (ident == TAG_IDENT_FE || |
| 1115 | ident == TAG_IDENT_EFE) { | 1115 | ident == TAG_IDENT_EFE) { |
| @@ -1396,7 +1396,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1396 | 1396 | ||
| 1397 | bh = udf_tread(inode->i_sb, | 1397 | bh = udf_tread(inode->i_sb, |
| 1398 | udf_get_lb_pblock(inode->i_sb, | 1398 | udf_get_lb_pblock(inode->i_sb, |
| 1399 | iinfo->i_location, 0)); | 1399 | &iinfo->i_location, 0)); |
| 1400 | if (!bh) { | 1400 | if (!bh) { |
| 1401 | udf_debug("bread failure\n"); | 1401 | udf_debug("bread failure\n"); |
| 1402 | return -EIO; | 1402 | return -EIO; |
| @@ -1606,7 +1606,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1606 | return err; | 1606 | return err; |
| 1607 | } | 1607 | } |
| 1608 | 1608 | ||
| 1609 | struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr ino) | 1609 | struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino) |
| 1610 | { | 1610 | { |
| 1611 | unsigned long block = udf_get_lb_pblock(sb, ino, 0); | 1611 | unsigned long block = udf_get_lb_pblock(sb, ino, 0); |
| 1612 | struct inode *inode = iget_locked(sb, block); | 1612 | struct inode *inode = iget_locked(sb, block); |
| @@ -1615,7 +1615,7 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr ino) | |||
| 1615 | return NULL; | 1615 | return NULL; |
| 1616 | 1616 | ||
| 1617 | if (inode->i_state & I_NEW) { | 1617 | if (inode->i_state & I_NEW) { |
| 1618 | memcpy(&UDF_I(inode)->i_location, &ino, sizeof(struct kernel_lb_addr)); | 1618 | memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); |
| 1619 | __udf_read_inode(inode); | 1619 | __udf_read_inode(inode); |
| 1620 | unlock_new_inode(inode); | 1620 | unlock_new_inode(inode); |
| 1621 | } | 1621 | } |
| @@ -1623,10 +1623,10 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr ino) | |||
| 1623 | if (is_bad_inode(inode)) | 1623 | if (is_bad_inode(inode)) |
| 1624 | goto out_iput; | 1624 | goto out_iput; |
| 1625 | 1625 | ||
| 1626 | if (ino.logicalBlockNum >= UDF_SB(sb)-> | 1626 | if (ino->logicalBlockNum >= UDF_SB(sb)-> |
| 1627 | s_partmaps[ino.partitionReferenceNum].s_partition_len) { | 1627 | s_partmaps[ino->partitionReferenceNum].s_partition_len) { |
| 1628 | udf_debug("block=%d, partition=%d out of range\n", | 1628 | udf_debug("block=%d, partition=%d out of range\n", |
| 1629 | ino.logicalBlockNum, ino.partitionReferenceNum); | 1629 | ino->logicalBlockNum, ino->partitionReferenceNum); |
| 1630 | make_bad_inode(inode); | 1630 | make_bad_inode(inode); |
| 1631 | goto out_iput; | 1631 | goto out_iput; |
| 1632 | } | 1632 | } |
| @@ -1639,7 +1639,7 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr ino) | |||
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | 1641 | int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, |
| 1642 | struct kernel_lb_addr eloc, uint32_t elen, int inc) | 1642 | struct kernel_lb_addr *eloc, uint32_t elen, int inc) |
| 1643 | { | 1643 | { |
| 1644 | int adsize; | 1644 | int adsize; |
| 1645 | struct short_ad *sad = NULL; | 1645 | struct short_ad *sad = NULL; |
| @@ -1675,7 +1675,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1675 | if (!epos->block.logicalBlockNum) | 1675 | if (!epos->block.logicalBlockNum) |
| 1676 | return -1; | 1676 | return -1; |
| 1677 | nbh = udf_tgetblk(inode->i_sb, udf_get_lb_pblock(inode->i_sb, | 1677 | nbh = udf_tgetblk(inode->i_sb, udf_get_lb_pblock(inode->i_sb, |
| 1678 | epos->block, | 1678 | &epos->block, |
| 1679 | 0)); | 1679 | 0)); |
| 1680 | if (!nbh) | 1680 | if (!nbh) |
| 1681 | return -1; | 1681 | return -1; |
| @@ -1769,7 +1769,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1769 | } | 1769 | } |
| 1770 | 1770 | ||
| 1771 | int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, | 1771 | int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, |
| 1772 | struct kernel_lb_addr eloc, uint32_t elen, int inc) | 1772 | struct kernel_lb_addr *eloc, uint32_t elen, int inc) |
| 1773 | { | 1773 | { |
| 1774 | int adsize; | 1774 | int adsize; |
| 1775 | uint8_t *ptr; | 1775 | uint8_t *ptr; |
| @@ -1788,13 +1788,13 @@ int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, | |||
| 1788 | case ICBTAG_FLAG_AD_SHORT: | 1788 | case ICBTAG_FLAG_AD_SHORT: |
| 1789 | sad = (struct short_ad *)ptr; | 1789 | sad = (struct short_ad *)ptr; |
| 1790 | sad->extLength = cpu_to_le32(elen); | 1790 | sad->extLength = cpu_to_le32(elen); |
| 1791 | sad->extPosition = cpu_to_le32(eloc.logicalBlockNum); | 1791 | sad->extPosition = cpu_to_le32(eloc->logicalBlockNum); |
| 1792 | adsize = sizeof(struct short_ad); | 1792 | adsize = sizeof(struct short_ad); |
| 1793 | break; | 1793 | break; |
| 1794 | case ICBTAG_FLAG_AD_LONG: | 1794 | case ICBTAG_FLAG_AD_LONG: |
| 1795 | lad = (struct long_ad *)ptr; | 1795 | lad = (struct long_ad *)ptr; |
| 1796 | lad->extLength = cpu_to_le32(elen); | 1796 | lad->extLength = cpu_to_le32(elen); |
| 1797 | lad->extLocation = cpu_to_lelb(eloc); | 1797 | lad->extLocation = cpu_to_lelb(*eloc); |
| 1798 | memset(lad->impUse, 0x00, sizeof(lad->impUse)); | 1798 | memset(lad->impUse, 0x00, sizeof(lad->impUse)); |
| 1799 | adsize = sizeof(struct long_ad); | 1799 | adsize = sizeof(struct long_ad); |
| 1800 | break; | 1800 | break; |
| @@ -1833,7 +1833,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos, | |||
| 1833 | epos->block = *eloc; | 1833 | epos->block = *eloc; |
| 1834 | epos->offset = sizeof(struct allocExtDesc); | 1834 | epos->offset = sizeof(struct allocExtDesc); |
| 1835 | brelse(epos->bh); | 1835 | brelse(epos->bh); |
| 1836 | block = udf_get_lb_pblock(inode->i_sb, epos->block, 0); | 1836 | block = udf_get_lb_pblock(inode->i_sb, &epos->block, 0); |
| 1837 | epos->bh = udf_tread(inode->i_sb, block); | 1837 | epos->bh = udf_tread(inode->i_sb, block); |
| 1838 | if (!epos->bh) { | 1838 | if (!epos->bh) { |
| 1839 | udf_debug("reading block %d failed!\n", block); | 1839 | udf_debug("reading block %d failed!\n", block); |
| @@ -1910,11 +1910,11 @@ static int8_t udf_insert_aext(struct inode *inode, struct extent_position epos, | |||
| 1910 | get_bh(epos.bh); | 1910 | get_bh(epos.bh); |
| 1911 | 1911 | ||
| 1912 | while ((etype = udf_next_aext(inode, &epos, &oeloc, &oelen, 0)) != -1) { | 1912 | while ((etype = udf_next_aext(inode, &epos, &oeloc, &oelen, 0)) != -1) { |
| 1913 | udf_write_aext(inode, &epos, neloc, nelen, 1); | 1913 | udf_write_aext(inode, &epos, &neloc, nelen, 1); |
| 1914 | neloc = oeloc; | 1914 | neloc = oeloc; |
| 1915 | nelen = (etype << 30) | oelen; | 1915 | nelen = (etype << 30) | oelen; |
| 1916 | } | 1916 | } |
| 1917 | udf_add_aext(inode, &epos, neloc, nelen, 1); | 1917 | udf_add_aext(inode, &epos, &neloc, nelen, 1); |
| 1918 | brelse(epos.bh); | 1918 | brelse(epos.bh); |
| 1919 | 1919 | ||
| 1920 | return (nelen >> 30); | 1920 | return (nelen >> 30); |
| @@ -1947,7 +1947,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 1947 | return -1; | 1947 | return -1; |
| 1948 | 1948 | ||
| 1949 | while ((etype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) { | 1949 | while ((etype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) { |
| 1950 | udf_write_aext(inode, &oepos, eloc, (etype << 30) | elen, 1); | 1950 | udf_write_aext(inode, &oepos, &eloc, (etype << 30) | elen, 1); |
| 1951 | if (oepos.bh != epos.bh) { | 1951 | if (oepos.bh != epos.bh) { |
| 1952 | oepos.block = epos.block; | 1952 | oepos.block = epos.block; |
| 1953 | brelse(oepos.bh); | 1953 | brelse(oepos.bh); |
| @@ -1960,9 +1960,9 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 1960 | elen = 0; | 1960 | elen = 0; |
| 1961 | 1961 | ||
| 1962 | if (epos.bh != oepos.bh) { | 1962 | if (epos.bh != oepos.bh) { |
| 1963 | udf_free_blocks(inode->i_sb, inode, epos.block, 0, 1); | 1963 | udf_free_blocks(inode->i_sb, inode, &epos.block, 0, 1); |
| 1964 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 1964 | udf_write_aext(inode, &oepos, &eloc, elen, 1); |
| 1965 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 1965 | udf_write_aext(inode, &oepos, &eloc, elen, 1); |
| 1966 | if (!oepos.bh) { | 1966 | if (!oepos.bh) { |
| 1967 | iinfo->i_lenAlloc -= (adsize * 2); | 1967 | iinfo->i_lenAlloc -= (adsize * 2); |
| 1968 | mark_inode_dirty(inode); | 1968 | mark_inode_dirty(inode); |
| @@ -1979,7 +1979,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 1979 | mark_buffer_dirty_inode(oepos.bh, inode); | 1979 | mark_buffer_dirty_inode(oepos.bh, inode); |
| 1980 | } | 1980 | } |
| 1981 | } else { | 1981 | } else { |
| 1982 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 1982 | udf_write_aext(inode, &oepos, &eloc, elen, 1); |
| 1983 | if (!oepos.bh) { | 1983 | if (!oepos.bh) { |
| 1984 | iinfo->i_lenAlloc -= adsize; | 1984 | iinfo->i_lenAlloc -= adsize; |
| 1985 | mark_inode_dirty(inode); | 1985 | mark_inode_dirty(inode); |
| @@ -2046,7 +2046,7 @@ long udf_block_map(struct inode *inode, sector_t block) | |||
| 2046 | 2046 | ||
| 2047 | if (inode_bmap(inode, block, &epos, &eloc, &elen, &offset) == | 2047 | if (inode_bmap(inode, block, &epos, &eloc, &elen, &offset) == |
| 2048 | (EXT_RECORDED_ALLOCATED >> 30)) | 2048 | (EXT_RECORDED_ALLOCATED >> 30)) |
| 2049 | ret = udf_get_lb_pblock(inode->i_sb, eloc, offset); | 2049 | ret = udf_get_lb_pblock(inode->i_sb, &eloc, offset); |
| 2050 | else | 2050 | else |
| 2051 | ret = 0; | 2051 | ret = 0; |
| 2052 | 2052 | ||
diff --git a/fs/udf/misc.c b/fs/udf/misc.c index 6e164c7b549a..9215700c00a4 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c | |||
| @@ -255,11 +255,12 @@ error_out: | |||
| 255 | return NULL; | 255 | return NULL; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | struct buffer_head *udf_read_ptagged(struct super_block *sb, struct kernel_lb_addr loc, | 258 | struct buffer_head *udf_read_ptagged(struct super_block *sb, |
| 259 | struct kernel_lb_addr *loc, | ||
| 259 | uint32_t offset, uint16_t *ident) | 260 | uint32_t offset, uint16_t *ident) |
| 260 | { | 261 | { |
| 261 | return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset), | 262 | return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset), |
| 262 | loc.logicalBlockNum + offset, ident); | 263 | loc->logicalBlockNum + offset, ident); |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 265 | void udf_update_tag(char *data, int length) | 266 | void udf_update_tag(char *data, int length) |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 76cfaf79d982..6a29fa34c478 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
| @@ -171,7 +171,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
| 171 | if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, &epos, | 171 | if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, &epos, |
| 172 | &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) | 172 | &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) |
| 173 | goto out_err; | 173 | goto out_err; |
| 174 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 174 | block = udf_get_lb_pblock(dir->i_sb, &eloc, offset); |
| 175 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 175 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
| 176 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 176 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 177 | epos.offset -= sizeof(struct short_ad); | 177 | epos.offset -= sizeof(struct short_ad); |
| @@ -283,11 +283,14 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
| 283 | #endif /* UDF_RECOVERY */ | 283 | #endif /* UDF_RECOVERY */ |
| 284 | 284 | ||
| 285 | if (udf_find_entry(dir, &dentry->d_name, &fibh, &cfi)) { | 285 | if (udf_find_entry(dir, &dentry->d_name, &fibh, &cfi)) { |
| 286 | struct kernel_lb_addr loc; | ||
| 287 | |||
| 286 | if (fibh.sbh != fibh.ebh) | 288 | if (fibh.sbh != fibh.ebh) |
| 287 | brelse(fibh.ebh); | 289 | brelse(fibh.ebh); |
| 288 | brelse(fibh.sbh); | 290 | brelse(fibh.sbh); |
| 289 | 291 | ||
| 290 | inode = udf_iget(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation)); | 292 | loc = lelb_to_cpu(cfi.icb.extLocation); |
| 293 | inode = udf_iget(dir->i_sb, &loc); | ||
| 291 | if (!inode) { | 294 | if (!inode) { |
| 292 | unlock_kernel(); | 295 | unlock_kernel(); |
| 293 | return ERR_PTR(-EACCES); | 296 | return ERR_PTR(-EACCES); |
| @@ -351,11 +354,11 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
| 351 | if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, &epos, | 354 | if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, &epos, |
| 352 | &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) { | 355 | &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) { |
| 353 | block = udf_get_lb_pblock(dir->i_sb, | 356 | block = udf_get_lb_pblock(dir->i_sb, |
| 354 | dinfo->i_location, 0); | 357 | &dinfo->i_location, 0); |
| 355 | fibh->soffset = fibh->eoffset = sb->s_blocksize; | 358 | fibh->soffset = fibh->eoffset = sb->s_blocksize; |
| 356 | goto add; | 359 | goto add; |
| 357 | } | 360 | } |
| 358 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 361 | block = udf_get_lb_pblock(dir->i_sb, &eloc, offset); |
| 359 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 362 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
| 360 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 363 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 361 | epos.offset -= sizeof(struct short_ad); | 364 | epos.offset -= sizeof(struct short_ad); |
| @@ -412,7 +415,7 @@ add: | |||
| 412 | epos.offset -= sizeof(struct short_ad); | 415 | epos.offset -= sizeof(struct short_ad); |
| 413 | else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 416 | else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 414 | epos.offset -= sizeof(struct long_ad); | 417 | epos.offset -= sizeof(struct long_ad); |
| 415 | udf_write_aext(dir, &epos, eloc, elen, 1); | 418 | udf_write_aext(dir, &epos, &eloc, elen, 1); |
| 416 | } | 419 | } |
| 417 | f_pos += nfidlen; | 420 | f_pos += nfidlen; |
| 418 | 421 | ||
| @@ -724,7 +727,7 @@ static int empty_dir(struct inode *dir) | |||
| 724 | else if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, | 727 | else if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, |
| 725 | &epos, &eloc, &elen, &offset) == | 728 | &epos, &eloc, &elen, &offset) == |
| 726 | (EXT_RECORDED_ALLOCATED >> 30)) { | 729 | (EXT_RECORDED_ALLOCATED >> 30)) { |
| 727 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 730 | block = udf_get_lb_pblock(dir->i_sb, &eloc, offset); |
| 728 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 731 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
| 729 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 732 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 730 | epos.offset -= sizeof(struct short_ad); | 733 | epos.offset -= sizeof(struct short_ad); |
| @@ -788,7 +791,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 788 | 791 | ||
| 789 | retval = -EIO; | 792 | retval = -EIO; |
| 790 | tloc = lelb_to_cpu(cfi.icb.extLocation); | 793 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
| 791 | if (udf_get_lb_pblock(dir->i_sb, tloc, 0) != inode->i_ino) | 794 | if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino) |
| 792 | goto end_rmdir; | 795 | goto end_rmdir; |
| 793 | retval = -ENOTEMPTY; | 796 | retval = -ENOTEMPTY; |
| 794 | if (!empty_dir(inode)) | 797 | if (!empty_dir(inode)) |
| @@ -834,7 +837,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) | |||
| 834 | 837 | ||
| 835 | retval = -EIO; | 838 | retval = -EIO; |
| 836 | tloc = lelb_to_cpu(cfi.icb.extLocation); | 839 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
| 837 | if (udf_get_lb_pblock(dir->i_sb, tloc, 0) != inode->i_ino) | 840 | if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino) |
| 838 | goto end_unlink; | 841 | goto end_unlink; |
| 839 | 842 | ||
| 840 | if (!inode->i_nlink) { | 843 | if (!inode->i_nlink) { |
| @@ -913,7 +916,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
| 913 | iinfo->i_location.partitionReferenceNum; | 916 | iinfo->i_location.partitionReferenceNum; |
| 914 | bsize = inode->i_sb->s_blocksize; | 917 | bsize = inode->i_sb->s_blocksize; |
| 915 | iinfo->i_lenExtents = bsize; | 918 | iinfo->i_lenExtents = bsize; |
| 916 | udf_add_aext(inode, &epos, eloc, bsize, 0); | 919 | udf_add_aext(inode, &epos, &eloc, bsize, 0); |
| 917 | brelse(epos.bh); | 920 | brelse(epos.bh); |
| 918 | 921 | ||
| 919 | block = udf_get_pblock(inode->i_sb, block, | 922 | block = udf_get_pblock(inode->i_sb, block, |
| @@ -1119,7 +1122,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1119 | brelse(ofibh.sbh); | 1122 | brelse(ofibh.sbh); |
| 1120 | } | 1123 | } |
| 1121 | tloc = lelb_to_cpu(ocfi.icb.extLocation); | 1124 | tloc = lelb_to_cpu(ocfi.icb.extLocation); |
| 1122 | if (!ofi || udf_get_lb_pblock(old_dir->i_sb, tloc, 0) | 1125 | if (!ofi || udf_get_lb_pblock(old_dir->i_sb, &tloc, 0) |
| 1123 | != old_inode->i_ino) | 1126 | != old_inode->i_ino) |
| 1124 | goto end_rename; | 1127 | goto end_rename; |
| 1125 | 1128 | ||
| @@ -1158,7 +1161,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1158 | if (!dir_fi) | 1161 | if (!dir_fi) |
| 1159 | goto end_rename; | 1162 | goto end_rename; |
| 1160 | tloc = lelb_to_cpu(dir_fi->icb.extLocation); | 1163 | tloc = lelb_to_cpu(dir_fi->icb.extLocation); |
| 1161 | if (udf_get_lb_pblock(old_inode->i_sb, tloc, 0) != | 1164 | if (udf_get_lb_pblock(old_inode->i_sb, &tloc, 0) != |
| 1162 | old_dir->i_ino) | 1165 | old_dir->i_ino) |
| 1163 | goto end_rename; | 1166 | goto end_rename; |
| 1164 | 1167 | ||
| @@ -1242,6 +1245,7 @@ end_rename: | |||
| 1242 | 1245 | ||
| 1243 | static struct dentry *udf_get_parent(struct dentry *child) | 1246 | static struct dentry *udf_get_parent(struct dentry *child) |
| 1244 | { | 1247 | { |
| 1248 | struct kernel_lb_addr tloc; | ||
| 1245 | struct inode *inode = NULL; | 1249 | struct inode *inode = NULL; |
| 1246 | struct qstr dotdot = {.name = "..", .len = 2}; | 1250 | struct qstr dotdot = {.name = "..", .len = 2}; |
| 1247 | struct fileIdentDesc cfi; | 1251 | struct fileIdentDesc cfi; |
| @@ -1255,8 +1259,8 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
| 1255 | brelse(fibh.ebh); | 1259 | brelse(fibh.ebh); |
| 1256 | brelse(fibh.sbh); | 1260 | brelse(fibh.sbh); |
| 1257 | 1261 | ||
| 1258 | inode = udf_iget(child->d_inode->i_sb, | 1262 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
| 1259 | lelb_to_cpu(cfi.icb.extLocation)); | 1263 | inode = udf_iget(child->d_inode->i_sb, &tloc); |
| 1260 | if (!inode) | 1264 | if (!inode) |
| 1261 | goto out_unlock; | 1265 | goto out_unlock; |
| 1262 | unlock_kernel(); | 1266 | unlock_kernel(); |
| @@ -1279,7 +1283,7 @@ static struct dentry *udf_nfs_get_inode(struct super_block *sb, u32 block, | |||
| 1279 | 1283 | ||
| 1280 | loc.logicalBlockNum = block; | 1284 | loc.logicalBlockNum = block; |
| 1281 | loc.partitionReferenceNum = partref; | 1285 | loc.partitionReferenceNum = partref; |
| 1282 | inode = udf_iget(sb, loc); | 1286 | inode = udf_iget(sb, &loc); |
| 1283 | 1287 | ||
| 1284 | if (inode == NULL) | 1288 | if (inode == NULL) |
| 1285 | return ERR_PTR(-ENOMEM); | 1289 | return ERR_PTR(-ENOMEM); |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 81b8adc86745..627558213746 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
| @@ -820,7 +820,7 @@ static int udf_find_fileset(struct super_block *sb, | |||
| 820 | 820 | ||
| 821 | if (fileset->logicalBlockNum != 0xFFFFFFFF || | 821 | if (fileset->logicalBlockNum != 0xFFFFFFFF || |
| 822 | fileset->partitionReferenceNum != 0xFFFF) { | 822 | fileset->partitionReferenceNum != 0xFFFF) { |
| 823 | bh = udf_read_ptagged(sb, *fileset, 0, &ident); | 823 | bh = udf_read_ptagged(sb, fileset, 0, &ident); |
| 824 | 824 | ||
| 825 | if (!bh) { | 825 | if (!bh) { |
| 826 | return 1; | 826 | return 1; |
| @@ -850,7 +850,7 @@ static int udf_find_fileset(struct super_block *sb, | |||
| 850 | newfileset.logicalBlockNum = 0; | 850 | newfileset.logicalBlockNum = 0; |
| 851 | 851 | ||
| 852 | do { | 852 | do { |
| 853 | bh = udf_read_ptagged(sb, newfileset, 0, | 853 | bh = udf_read_ptagged(sb, &newfileset, 0, |
| 854 | &ident); | 854 | &ident); |
| 855 | if (!bh) { | 855 | if (!bh) { |
| 856 | newfileset.logicalBlockNum++; | 856 | newfileset.logicalBlockNum++; |
| @@ -959,7 +959,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
| 959 | udf_debug("Metadata file location: block = %d part = %d\n", | 959 | udf_debug("Metadata file location: block = %d part = %d\n", |
| 960 | addr.logicalBlockNum, addr.partitionReferenceNum); | 960 | addr.logicalBlockNum, addr.partitionReferenceNum); |
| 961 | 961 | ||
| 962 | mdata->s_metadata_fe = udf_iget(sb, addr); | 962 | mdata->s_metadata_fe = udf_iget(sb, &addr); |
| 963 | 963 | ||
| 964 | if (mdata->s_metadata_fe == NULL) { | 964 | if (mdata->s_metadata_fe == NULL) { |
| 965 | udf_warning(sb, __func__, "metadata inode efe not found, " | 965 | udf_warning(sb, __func__, "metadata inode efe not found, " |
| @@ -981,7 +981,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
| 981 | udf_debug("Mirror metadata file location: block = %d part = %d\n", | 981 | udf_debug("Mirror metadata file location: block = %d part = %d\n", |
| 982 | addr.logicalBlockNum, addr.partitionReferenceNum); | 982 | addr.logicalBlockNum, addr.partitionReferenceNum); |
| 983 | 983 | ||
| 984 | mdata->s_mirror_fe = udf_iget(sb, addr); | 984 | mdata->s_mirror_fe = udf_iget(sb, &addr); |
| 985 | 985 | ||
| 986 | if (mdata->s_mirror_fe == NULL) { | 986 | if (mdata->s_mirror_fe == NULL) { |
| 987 | if (fe_error) { | 987 | if (fe_error) { |
| @@ -1013,7 +1013,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
| 1013 | udf_debug("Bitmap file location: block = %d part = %d\n", | 1013 | udf_debug("Bitmap file location: block = %d part = %d\n", |
| 1014 | addr.logicalBlockNum, addr.partitionReferenceNum); | 1014 | addr.logicalBlockNum, addr.partitionReferenceNum); |
| 1015 | 1015 | ||
| 1016 | mdata->s_bitmap_fe = udf_iget(sb, addr); | 1016 | mdata->s_bitmap_fe = udf_iget(sb, &addr); |
| 1017 | 1017 | ||
| 1018 | if (mdata->s_bitmap_fe == NULL) { | 1018 | if (mdata->s_bitmap_fe == NULL) { |
| 1019 | if (sb->s_flags & MS_RDONLY) | 1019 | if (sb->s_flags & MS_RDONLY) |
| @@ -1125,7 +1125,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
| 1125 | .partitionReferenceNum = p_index, | 1125 | .partitionReferenceNum = p_index, |
| 1126 | }; | 1126 | }; |
| 1127 | 1127 | ||
| 1128 | map->s_uspace.s_table = udf_iget(sb, loc); | 1128 | map->s_uspace.s_table = udf_iget(sb, &loc); |
| 1129 | if (!map->s_uspace.s_table) { | 1129 | if (!map->s_uspace.s_table) { |
| 1130 | udf_debug("cannot load unallocSpaceTable (part %d)\n", | 1130 | udf_debug("cannot load unallocSpaceTable (part %d)\n", |
| 1131 | p_index); | 1131 | p_index); |
| @@ -1160,7 +1160,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
| 1160 | .partitionReferenceNum = p_index, | 1160 | .partitionReferenceNum = p_index, |
| 1161 | }; | 1161 | }; |
| 1162 | 1162 | ||
| 1163 | map->s_fspace.s_table = udf_iget(sb, loc); | 1163 | map->s_fspace.s_table = udf_iget(sb, &loc); |
| 1164 | if (!map->s_fspace.s_table) { | 1164 | if (!map->s_fspace.s_table) { |
| 1165 | udf_debug("cannot load freedSpaceTable (part %d)\n", | 1165 | udf_debug("cannot load freedSpaceTable (part %d)\n", |
| 1166 | p_index); | 1166 | p_index); |
| @@ -1201,7 +1201,7 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index) | |||
| 1201 | /* VAT file entry is in the last recorded block */ | 1201 | /* VAT file entry is in the last recorded block */ |
| 1202 | ino.partitionReferenceNum = type1_index; | 1202 | ino.partitionReferenceNum = type1_index; |
| 1203 | ino.logicalBlockNum = sbi->s_last_block - map->s_partition_root; | 1203 | ino.logicalBlockNum = sbi->s_last_block - map->s_partition_root; |
| 1204 | sbi->s_vat_inode = udf_iget(sb, ino); | 1204 | sbi->s_vat_inode = udf_iget(sb, &ino); |
| 1205 | if (!sbi->s_vat_inode) | 1205 | if (!sbi->s_vat_inode) |
| 1206 | return 1; | 1206 | return 1; |
| 1207 | 1207 | ||
| @@ -1991,7 +1991,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 1991 | /* Assign the root inode */ | 1991 | /* Assign the root inode */ |
| 1992 | /* assign inodes by physical block number */ | 1992 | /* assign inodes by physical block number */ |
| 1993 | /* perhaps it's not extensible enough, but for now ... */ | 1993 | /* perhaps it's not extensible enough, but for now ... */ |
| 1994 | inode = udf_iget(sb, rootdir); | 1994 | inode = udf_iget(sb, &rootdir); |
| 1995 | if (!inode) { | 1995 | if (!inode) { |
| 1996 | printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, " | 1996 | printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, " |
| 1997 | "partition=%d\n", | 1997 | "partition=%d\n", |
| @@ -2124,7 +2124,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, | |||
| 2124 | 2124 | ||
| 2125 | loc.logicalBlockNum = bitmap->s_extPosition; | 2125 | loc.logicalBlockNum = bitmap->s_extPosition; |
| 2126 | loc.partitionReferenceNum = UDF_SB(sb)->s_partition; | 2126 | loc.partitionReferenceNum = UDF_SB(sb)->s_partition; |
| 2127 | bh = udf_read_ptagged(sb, loc, 0, &ident); | 2127 | bh = udf_read_ptagged(sb, &loc, 0, &ident); |
| 2128 | 2128 | ||
| 2129 | if (!bh) { | 2129 | if (!bh) { |
| 2130 | printk(KERN_ERR "udf: udf_count_free failed\n"); | 2130 | printk(KERN_ERR "udf: udf_count_free failed\n"); |
| @@ -2147,7 +2147,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, | |||
| 2147 | bytes -= cur_bytes; | 2147 | bytes -= cur_bytes; |
| 2148 | if (bytes) { | 2148 | if (bytes) { |
| 2149 | brelse(bh); | 2149 | brelse(bh); |
| 2150 | newblock = udf_get_lb_pblock(sb, loc, ++block); | 2150 | newblock = udf_get_lb_pblock(sb, &loc, ++block); |
| 2151 | bh = udf_tread(sb, newblock); | 2151 | bh = udf_tread(sb, newblock); |
| 2152 | if (!bh) { | 2152 | if (!bh) { |
| 2153 | udf_debug("read failed\n"); | 2153 | udf_debug("read failed\n"); |
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index f2fad30fd145..225527cdc885 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include "udf_sb.h" | 28 | #include "udf_sb.h" |
| 29 | 29 | ||
| 30 | static void extent_trunc(struct inode *inode, struct extent_position *epos, | 30 | static void extent_trunc(struct inode *inode, struct extent_position *epos, |
| 31 | struct kernel_lb_addr eloc, int8_t etype, uint32_t elen, | 31 | struct kernel_lb_addr *eloc, int8_t etype, uint32_t elen, |
| 32 | uint32_t nelen) | 32 | uint32_t nelen) |
| 33 | { | 33 | { |
| 34 | struct kernel_lb_addr neloc = {}; | 34 | struct kernel_lb_addr neloc = {}; |
| @@ -43,12 +43,12 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos, | |||
| 43 | last_block); | 43 | last_block); |
| 44 | etype = (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30); | 44 | etype = (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30); |
| 45 | } else | 45 | } else |
| 46 | neloc = eloc; | 46 | neloc = *eloc; |
| 47 | nelen = (etype << 30) | nelen; | 47 | nelen = (etype << 30) | nelen; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | if (elen != nelen) { | 50 | if (elen != nelen) { |
| 51 | udf_write_aext(inode, epos, neloc, nelen, 0); | 51 | udf_write_aext(inode, epos, &neloc, nelen, 0); |
| 52 | if (last_block - first_block > 0) { | 52 | if (last_block - first_block > 0) { |
| 53 | if (etype == (EXT_RECORDED_ALLOCATED >> 30)) | 53 | if (etype == (EXT_RECORDED_ALLOCATED >> 30)) |
| 54 | mark_inode_dirty(inode); | 54 | mark_inode_dirty(inode); |
| @@ -106,7 +106,7 @@ void udf_truncate_tail_extent(struct inode *inode) | |||
| 106 | (unsigned)elen); | 106 | (unsigned)elen); |
| 107 | nelen = elen - (lbcount - inode->i_size); | 107 | nelen = elen - (lbcount - inode->i_size); |
| 108 | epos.offset -= adsize; | 108 | epos.offset -= adsize; |
| 109 | extent_trunc(inode, &epos, eloc, etype, elen, nelen); | 109 | extent_trunc(inode, &epos, &eloc, etype, elen, nelen); |
| 110 | epos.offset += adsize; | 110 | epos.offset += adsize; |
| 111 | if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1) | 111 | if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1) |
| 112 | printk(KERN_ERR "udf_truncate_tail_extent(): " | 112 | printk(KERN_ERR "udf_truncate_tail_extent(): " |
| @@ -152,7 +152,7 @@ void udf_discard_prealloc(struct inode *inode) | |||
| 152 | if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { | 152 | if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { |
| 153 | epos.offset -= adsize; | 153 | epos.offset -= adsize; |
| 154 | lbcount -= elen; | 154 | lbcount -= elen; |
| 155 | extent_trunc(inode, &epos, eloc, etype, elen, 0); | 155 | extent_trunc(inode, &epos, &eloc, etype, elen, 0); |
| 156 | if (!epos.bh) { | 156 | if (!epos.bh) { |
| 157 | iinfo->i_lenAlloc = | 157 | iinfo->i_lenAlloc = |
| 158 | epos.offset - | 158 | epos.offset - |
| @@ -221,7 +221,7 @@ void udf_truncate_extents(struct inode *inode) | |||
| 221 | (inode->i_size & (sb->s_blocksize - 1)); | 221 | (inode->i_size & (sb->s_blocksize - 1)); |
| 222 | if (etype != -1) { | 222 | if (etype != -1) { |
| 223 | epos.offset -= adsize; | 223 | epos.offset -= adsize; |
| 224 | extent_trunc(inode, &epos, eloc, etype, elen, byte_offset); | 224 | extent_trunc(inode, &epos, &eloc, etype, elen, byte_offset); |
| 225 | epos.offset += adsize; | 225 | epos.offset += adsize; |
| 226 | if (byte_offset) | 226 | if (byte_offset) |
| 227 | lenalloc = epos.offset; | 227 | lenalloc = epos.offset; |
| @@ -236,12 +236,12 @@ void udf_truncate_extents(struct inode *inode) | |||
| 236 | while ((etype = udf_current_aext(inode, &epos, &eloc, | 236 | while ((etype = udf_current_aext(inode, &epos, &eloc, |
| 237 | &elen, 0)) != -1) { | 237 | &elen, 0)) != -1) { |
| 238 | if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { | 238 | if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { |
| 239 | udf_write_aext(inode, &epos, neloc, nelen, 0); | 239 | udf_write_aext(inode, &epos, &neloc, nelen, 0); |
| 240 | if (indirect_ext_len) { | 240 | if (indirect_ext_len) { |
| 241 | /* We managed to free all extents in the | 241 | /* We managed to free all extents in the |
| 242 | * indirect extent - free it too */ | 242 | * indirect extent - free it too */ |
| 243 | BUG_ON(!epos.bh); | 243 | BUG_ON(!epos.bh); |
| 244 | udf_free_blocks(sb, inode, epos.block, | 244 | udf_free_blocks(sb, inode, &epos.block, |
| 245 | 0, indirect_ext_len); | 245 | 0, indirect_ext_len); |
| 246 | } else if (!epos.bh) { | 246 | } else if (!epos.bh) { |
| 247 | iinfo->i_lenAlloc = lenalloc; | 247 | iinfo->i_lenAlloc = lenalloc; |
| @@ -253,7 +253,7 @@ void udf_truncate_extents(struct inode *inode) | |||
| 253 | epos.offset = sizeof(struct allocExtDesc); | 253 | epos.offset = sizeof(struct allocExtDesc); |
| 254 | epos.block = eloc; | 254 | epos.block = eloc; |
| 255 | epos.bh = udf_tread(sb, | 255 | epos.bh = udf_tread(sb, |
| 256 | udf_get_lb_pblock(sb, eloc, 0)); | 256 | udf_get_lb_pblock(sb, &eloc, 0)); |
| 257 | if (elen) | 257 | if (elen) |
| 258 | indirect_ext_len = | 258 | indirect_ext_len = |
| 259 | (elen + sb->s_blocksize - 1) >> | 259 | (elen + sb->s_blocksize - 1) >> |
| @@ -261,7 +261,7 @@ void udf_truncate_extents(struct inode *inode) | |||
| 261 | else | 261 | else |
| 262 | indirect_ext_len = 1; | 262 | indirect_ext_len = 1; |
| 263 | } else { | 263 | } else { |
| 264 | extent_trunc(inode, &epos, eloc, etype, | 264 | extent_trunc(inode, &epos, &eloc, etype, |
| 265 | elen, 0); | 265 | elen, 0); |
| 266 | epos.offset += adsize; | 266 | epos.offset += adsize; |
| 267 | } | 267 | } |
| @@ -269,7 +269,7 @@ void udf_truncate_extents(struct inode *inode) | |||
| 269 | 269 | ||
| 270 | if (indirect_ext_len) { | 270 | if (indirect_ext_len) { |
| 271 | BUG_ON(!epos.bh); | 271 | BUG_ON(!epos.bh); |
| 272 | udf_free_blocks(sb, inode, epos.block, 0, | 272 | udf_free_blocks(sb, inode, &epos.block, 0, |
| 273 | indirect_ext_len); | 273 | indirect_ext_len); |
| 274 | } else if (!epos.bh) { | 274 | } else if (!epos.bh) { |
| 275 | iinfo->i_lenAlloc = lenalloc; | 275 | iinfo->i_lenAlloc = lenalloc; |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 35f0b9bf7b0c..9a2a9b61413e 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
| @@ -62,8 +62,6 @@ static inline size_t udf_ext0_offset(struct inode *inode) | |||
| 62 | return 0; | 62 | return 0; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset)) | ||
| 66 | |||
| 67 | /* computes tag checksum */ | 65 | /* computes tag checksum */ |
| 68 | u8 udf_tag_checksum(const struct tag *t); | 66 | u8 udf_tag_checksum(const struct tag *t); |
| 69 | 67 | ||
| @@ -124,7 +122,7 @@ extern int udf_ioctl(struct inode *, struct file *, unsigned int, | |||
| 124 | unsigned long); | 122 | unsigned long); |
| 125 | 123 | ||
| 126 | /* inode.c */ | 124 | /* inode.c */ |
| 127 | extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr); | 125 | extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); |
| 128 | extern int udf_sync_inode(struct inode *); | 126 | extern int udf_sync_inode(struct inode *); |
| 129 | extern void udf_expand_file_adinicb(struct inode *, int, int *); | 127 | extern void udf_expand_file_adinicb(struct inode *, int, int *); |
| 130 | extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); | 128 | extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); |
| @@ -140,9 +138,9 @@ extern int udf_extend_file(struct inode *, struct extent_position *, | |||
| 140 | extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *, | 138 | extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *, |
| 141 | struct kernel_lb_addr *, uint32_t *, sector_t *); | 139 | struct kernel_lb_addr *, uint32_t *, sector_t *); |
| 142 | extern int8_t udf_add_aext(struct inode *, struct extent_position *, | 140 | extern int8_t udf_add_aext(struct inode *, struct extent_position *, |
| 143 | struct kernel_lb_addr, uint32_t, int); | 141 | struct kernel_lb_addr *, uint32_t, int); |
| 144 | extern int8_t udf_write_aext(struct inode *, struct extent_position *, | 142 | extern int8_t udf_write_aext(struct inode *, struct extent_position *, |
| 145 | struct kernel_lb_addr, uint32_t, int); | 143 | struct kernel_lb_addr *, uint32_t, int); |
| 146 | extern int8_t udf_delete_aext(struct inode *, struct extent_position, | 144 | extern int8_t udf_delete_aext(struct inode *, struct extent_position, |
| 147 | struct kernel_lb_addr, uint32_t); | 145 | struct kernel_lb_addr, uint32_t); |
| 148 | extern int8_t udf_next_aext(struct inode *, struct extent_position *, | 146 | extern int8_t udf_next_aext(struct inode *, struct extent_position *, |
| @@ -160,7 +158,7 @@ extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, | |||
| 160 | extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, | 158 | extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, |
| 161 | uint32_t, uint16_t *); | 159 | uint32_t, uint16_t *); |
| 162 | extern struct buffer_head *udf_read_ptagged(struct super_block *, | 160 | extern struct buffer_head *udf_read_ptagged(struct super_block *, |
| 163 | struct kernel_lb_addr, uint32_t, | 161 | struct kernel_lb_addr *, uint32_t, |
| 164 | uint16_t *); | 162 | uint16_t *); |
| 165 | extern void udf_update_tag(char *, int); | 163 | extern void udf_update_tag(char *, int); |
| 166 | extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int); | 164 | extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int); |
| @@ -182,6 +180,14 @@ extern uint32_t udf_get_pblock_meta25(struct super_block *, uint32_t, uint16_t, | |||
| 182 | uint32_t); | 180 | uint32_t); |
| 183 | extern int udf_relocate_blocks(struct super_block *, long, long *); | 181 | extern int udf_relocate_blocks(struct super_block *, long, long *); |
| 184 | 182 | ||
| 183 | static inline uint32_t | ||
| 184 | udf_get_lb_pblock(struct super_block *sb, struct kernel_lb_addr *loc, | ||
| 185 | uint32_t offset) | ||
| 186 | { | ||
| 187 | return udf_get_pblock(sb, loc->logicalBlockNum, | ||
| 188 | loc->partitionReferenceNum, offset); | ||
| 189 | } | ||
| 190 | |||
| 185 | /* unicode.c */ | 191 | /* unicode.c */ |
| 186 | extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int); | 192 | extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int); |
| 187 | extern int udf_put_filename(struct super_block *, const uint8_t *, uint8_t *, | 193 | extern int udf_put_filename(struct super_block *, const uint8_t *, uint8_t *, |
| @@ -200,7 +206,7 @@ extern void udf_truncate_extents(struct inode *); | |||
| 200 | 206 | ||
| 201 | /* balloc.c */ | 207 | /* balloc.c */ |
| 202 | extern void udf_free_blocks(struct super_block *, struct inode *, | 208 | extern void udf_free_blocks(struct super_block *, struct inode *, |
| 203 | struct kernel_lb_addr, uint32_t, uint32_t); | 209 | struct kernel_lb_addr *, uint32_t, uint32_t); |
| 204 | extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, | 210 | extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, |
| 205 | uint32_t, uint32_t); | 211 | uint32_t, uint32_t); |
| 206 | extern int udf_new_block(struct super_block *, struct inode *, uint16_t, | 212 | extern int udf_new_block(struct super_block *, struct inode *, uint16_t, |
