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.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 756dbbf0eaf..4cec9101568 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -508,8 +508,8 @@ static void udf_table_free_blocks(struct super_block * sb,
508 { 508 {
509 i = -1; 509 i = -1;
510 oepos.block = epos.block; 510 oepos.block = epos.block;
511 udf_release_data(oepos.bh); 511 brelse(oepos.bh);
512 atomic_inc(&epos.bh->b_count); 512 get_bh(epos.bh);
513 oepos.bh = epos.bh; 513 oepos.bh = epos.bh;
514 oepos.offset = 0; 514 oepos.offset = 0;
515 } 515 }
@@ -546,8 +546,8 @@ static void udf_table_free_blocks(struct super_block * sb,
546 adsize = sizeof(long_ad); 546 adsize = sizeof(long_ad);
547 else 547 else
548 { 548 {
549 udf_release_data(oepos.bh); 549 brelse(oepos.bh);
550 udf_release_data(epos.bh); 550 brelse(epos.bh);
551 goto error_return; 551 goto error_return;
552 } 552 }
553 553
@@ -556,7 +556,7 @@ static void udf_table_free_blocks(struct super_block * sb,
556 char *sptr, *dptr; 556 char *sptr, *dptr;
557 int loffset; 557 int loffset;
558 558
559 udf_release_data(oepos.bh); 559 brelse(oepos.bh);
560 oepos = epos; 560 oepos = epos;
561 561
562 /* Steal a block from the extent being free'd */ 562 /* Steal a block from the extent being free'd */
@@ -567,7 +567,7 @@ static void udf_table_free_blocks(struct super_block * sb,
567 if (!(epos.bh = udf_tread(sb, 567 if (!(epos.bh = udf_tread(sb,
568 udf_get_lb_pblock(sb, epos.block, 0)))) 568 udf_get_lb_pblock(sb, epos.block, 0))))
569 { 569 {
570 udf_release_data(oepos.bh); 570 brelse(oepos.bh);
571 goto error_return; 571 goto error_return;
572 } 572 }
573 aed = (struct allocExtDesc *)(epos.bh->b_data); 573 aed = (struct allocExtDesc *)(epos.bh->b_data);
@@ -658,8 +658,8 @@ static void udf_table_free_blocks(struct super_block * sb,
658 } 658 }
659 } 659 }
660 660
661 udf_release_data(epos.bh); 661 brelse(epos.bh);
662 udf_release_data(oepos.bh); 662 brelse(oepos.bh);
663 663
664error_return: 664error_return:
665 sb->s_dirt = 1; 665 sb->s_dirt = 1;
@@ -723,7 +723,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
723 else 723 else
724 alloc_count = 0; 724 alloc_count = 0;
725 725
726 udf_release_data(epos.bh); 726 brelse(epos.bh);
727 727
728 if (alloc_count && UDF_SB_LVIDBH(sb)) 728 if (alloc_count && UDF_SB_LVIDBH(sb))
729 { 729 {
@@ -789,9 +789,9 @@ static int udf_table_new_block(struct super_block * sb,
789 spread = nspread; 789 spread = nspread;
790 if (goal_epos.bh != epos.bh) 790 if (goal_epos.bh != epos.bh)
791 { 791 {
792 udf_release_data(goal_epos.bh); 792 brelse(goal_epos.bh);
793 goal_epos.bh = epos.bh; 793 goal_epos.bh = epos.bh;
794 atomic_inc(&goal_epos.bh->b_count); 794 get_bh(goal_epos.bh);
795 } 795 }
796 goal_epos.block = epos.block; 796 goal_epos.block = epos.block;
797 goal_epos.offset = epos.offset - adsize; 797 goal_epos.offset = epos.offset - adsize;
@@ -800,11 +800,11 @@ static int udf_table_new_block(struct super_block * sb,
800 } 800 }
801 } 801 }
802 802
803 udf_release_data(epos.bh); 803 brelse(epos.bh);
804 804
805 if (spread == 0xFFFFFFFF) 805 if (spread == 0xFFFFFFFF)
806 { 806 {
807 udf_release_data(goal_epos.bh); 807 brelse(goal_epos.bh);
808 mutex_unlock(&sbi->s_alloc_mutex); 808 mutex_unlock(&sbi->s_alloc_mutex);
809 return 0; 809 return 0;
810 } 810 }
@@ -820,7 +820,7 @@ static int udf_table_new_block(struct super_block * sb,
820 820
821 if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) 821 if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
822 { 822 {
823 udf_release_data(goal_epos.bh); 823 brelse(goal_epos.bh);
824 mutex_unlock(&sbi->s_alloc_mutex); 824 mutex_unlock(&sbi->s_alloc_mutex);
825 *err = -EDQUOT; 825 *err = -EDQUOT;
826 return 0; 826 return 0;
@@ -830,7 +830,7 @@ static int udf_table_new_block(struct super_block * sb,
830 udf_write_aext(table, &goal_epos, goal_eloc, goal_elen, 1); 830 udf_write_aext(table, &goal_epos, goal_eloc, goal_elen, 1);
831 else 831 else
832 udf_delete_aext(table, goal_epos, goal_eloc, goal_elen); 832 udf_delete_aext(table, goal_epos, goal_eloc, goal_elen);
833 udf_release_data(goal_epos.bh); 833 brelse(goal_epos.bh);
834 834
835 if (UDF_SB_LVIDBH(sb)) 835 if (UDF_SB_LVIDBH(sb))
836 { 836 {
@@ -915,11 +915,14 @@ inline int udf_new_block(struct super_block * sb,
915 struct inode * inode, 915 struct inode * inode,
916 uint16_t partition, uint32_t goal, int *err) 916 uint16_t partition, uint32_t goal, int *err)
917{ 917{
918 int ret;
919
918 if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) 920 if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP)
919 { 921 {
920 return udf_bitmap_new_block(sb, inode, 922 ret = udf_bitmap_new_block(sb, inode,
921 UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap, 923 UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap,
922 partition, goal, err); 924 partition, goal, err);
925 return ret;
923 } 926 }
924 else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) 927 else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE)
925 { 928 {