aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/balloc.c')
-rw-r--r--fs/udf/balloc.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 989259655b40..7b95b3f46211 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -460,7 +460,7 @@ static void udf_table_free_blocks(struct super_block *sb,
460 460
461 epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry); 461 epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry);
462 elen = 0; 462 elen = 0;
463 epos.block = oepos.block = UDF_I_LOCATION(table); 463 epos.block = oepos.block = UDF_I(table)->i_location;
464 epos.bh = oepos.bh = NULL; 464 epos.bh = oepos.bh = NULL;
465 465
466 while (count && 466 while (count &&
@@ -539,9 +539,9 @@ static void udf_table_free_blocks(struct super_block *sb,
539 elen = EXT_RECORDED_ALLOCATED | 539 elen = EXT_RECORDED_ALLOCATED |
540 (count << sb->s_blocksize_bits); 540 (count << sb->s_blocksize_bits);
541 541
542 if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT) { 542 if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) {
543 adsize = sizeof(short_ad); 543 adsize = sizeof(short_ad);
544 } else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG) { 544 } else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG) {
545 adsize = sizeof(long_ad); 545 adsize = sizeof(long_ad);
546 } else { 546 } else {
547 brelse(oepos.bh); 547 brelse(oepos.bh);
@@ -573,7 +573,8 @@ static void udf_table_free_blocks(struct super_block *sb,
573 if (epos.offset + adsize > sb->s_blocksize) { 573 if (epos.offset + adsize > sb->s_blocksize) {
574 loffset = epos.offset; 574 loffset = epos.offset;
575 aed->lengthAllocDescs = cpu_to_le32(adsize); 575 aed->lengthAllocDescs = cpu_to_le32(adsize);
576 sptr = UDF_I_DATA(table) + epos.offset - adsize; 576 sptr = UDF_I(table)->i_ext.i_data + epos.offset
577 - adsize;
577 dptr = epos.bh->b_data + 578 dptr = epos.bh->b_data +
578 sizeof(struct allocExtDesc); 579 sizeof(struct allocExtDesc);
579 memcpy(dptr, sptr, adsize); 580 memcpy(dptr, sptr, adsize);
@@ -591,8 +592,9 @@ static void udf_table_free_blocks(struct super_block *sb,
591 aed->lengthAllocDescs) + 592 aed->lengthAllocDescs) +
592 adsize); 593 adsize);
593 } else { 594 } else {
594 sptr = UDF_I_DATA(table) + epos.offset; 595 sptr = UDF_I(table)->i_ext.i_data +
595 UDF_I_LENALLOC(table) += adsize; 596 epos.offset;
597 UDF_I(table)->i_lenAlloc += adsize;
596 mark_inode_dirty(table); 598 mark_inode_dirty(table);
597 } 599 }
598 epos.offset = sizeof(struct allocExtDesc); 600 epos.offset = sizeof(struct allocExtDesc);
@@ -606,7 +608,7 @@ static void udf_table_free_blocks(struct super_block *sb,
606 2, 1, epos.block.logicalBlockNum, 608 2, 1, epos.block.logicalBlockNum,
607 sizeof(tag)); 609 sizeof(tag));
608 610
609 switch (UDF_I_ALLOCTYPE(table)) { 611 switch (UDF_I(table)->i_alloc_type) {
610 case ICBTAG_FLAG_AD_SHORT: 612 case ICBTAG_FLAG_AD_SHORT:
611 sad = (short_ad *)sptr; 613 sad = (short_ad *)sptr;
612 sad->extLength = cpu_to_le32( 614 sad->extLength = cpu_to_le32(
@@ -637,7 +639,7 @@ static void udf_table_free_blocks(struct super_block *sb,
637 udf_write_aext(table, &epos, eloc, elen, 1); 639 udf_write_aext(table, &epos, eloc, elen, 1);
638 640
639 if (!epos.bh) { 641 if (!epos.bh) {
640 UDF_I_LENALLOC(table) += adsize; 642 UDF_I(table)->i_lenAlloc += adsize;
641 mark_inode_dirty(table); 643 mark_inode_dirty(table);
642 } else { 644 } else {
643 aed = (struct allocExtDesc *)epos.bh->b_data; 645 aed = (struct allocExtDesc *)epos.bh->b_data;
@@ -675,16 +677,16 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
675 first_block >= sbi->s_partmaps[partition].s_partition_len) 677 first_block >= sbi->s_partmaps[partition].s_partition_len)
676 return 0; 678 return 0;
677 679
678 if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT) 680 if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
679 adsize = sizeof(short_ad); 681 adsize = sizeof(short_ad);
680 else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG) 682 else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG)
681 adsize = sizeof(long_ad); 683 adsize = sizeof(long_ad);
682 else 684 else
683 return 0; 685 return 0;
684 686
685 mutex_lock(&sbi->s_alloc_mutex); 687 mutex_lock(&sbi->s_alloc_mutex);
686 epos.offset = sizeof(struct unallocSpaceEntry); 688 epos.offset = sizeof(struct unallocSpaceEntry);
687 epos.block = UDF_I_LOCATION(table); 689 epos.block = UDF_I(table)->i_location;
688 epos.bh = NULL; 690 epos.bh = NULL;
689 eloc.logicalBlockNum = 0xFFFFFFFF; 691 eloc.logicalBlockNum = 0xFFFFFFFF;
690 692
@@ -740,9 +742,9 @@ static int udf_table_new_block(struct super_block *sb,
740 742
741 *err = -ENOSPC; 743 *err = -ENOSPC;
742 744
743 if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT) 745 if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
744 adsize = sizeof(short_ad); 746 adsize = sizeof(short_ad);
745 else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG) 747 else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG)
746 adsize = sizeof(long_ad); 748 adsize = sizeof(long_ad);
747 else 749 else
748 return newblock; 750 return newblock;
@@ -757,7 +759,7 @@ static int udf_table_new_block(struct super_block *sb,
757 of the current closest match and use that when we are done. 759 of the current closest match and use that when we are done.
758 */ 760 */
759 epos.offset = sizeof(struct unallocSpaceEntry); 761 epos.offset = sizeof(struct unallocSpaceEntry);
760 epos.block = UDF_I_LOCATION(table); 762 epos.block = UDF_I(table)->i_location;
761 epos.bh = goal_epos.bh = NULL; 763 epos.bh = goal_epos.bh = NULL;
762 764
763 while (spread && 765 while (spread &&