diff options
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/inode.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 4fd1d809738c..1bd2c42f3b48 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -53,8 +53,7 @@ static int udf_update_inode(struct inode *, int); | |||
53 | static void udf_fill_inode(struct inode *, struct buffer_head *); | 53 | static void udf_fill_inode(struct inode *, struct buffer_head *); |
54 | static int udf_sync_inode(struct inode *inode); | 54 | static int udf_sync_inode(struct inode *inode); |
55 | static int udf_alloc_i_data(struct inode *inode, size_t size); | 55 | static int udf_alloc_i_data(struct inode *inode, size_t size); |
56 | static struct buffer_head *inode_getblk(struct inode *, sector_t, int *, | 56 | static sector_t inode_getblk(struct inode *, sector_t, int *, int *); |
57 | sector_t *, int *); | ||
58 | static int8_t udf_insert_aext(struct inode *, struct extent_position, | 57 | static int8_t udf_insert_aext(struct inode *, struct extent_position, |
59 | struct kernel_lb_addr, uint32_t); | 58 | struct kernel_lb_addr, uint32_t); |
60 | static void udf_split_extents(struct inode *, int *, int, int, | 59 | static void udf_split_extents(struct inode *, int *, int, int, |
@@ -310,7 +309,6 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
310 | struct buffer_head *bh_result, int create) | 309 | struct buffer_head *bh_result, int create) |
311 | { | 310 | { |
312 | int err, new; | 311 | int err, new; |
313 | struct buffer_head *bh; | ||
314 | sector_t phys = 0; | 312 | sector_t phys = 0; |
315 | struct udf_inode_info *iinfo; | 313 | struct udf_inode_info *iinfo; |
316 | 314 | ||
@@ -323,7 +321,6 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
323 | 321 | ||
324 | err = -EIO; | 322 | err = -EIO; |
325 | new = 0; | 323 | new = 0; |
326 | bh = NULL; | ||
327 | iinfo = UDF_I(inode); | 324 | iinfo = UDF_I(inode); |
328 | 325 | ||
329 | down_write(&iinfo->i_data_sem); | 326 | down_write(&iinfo->i_data_sem); |
@@ -332,13 +329,10 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
332 | iinfo->i_next_alloc_goal++; | 329 | iinfo->i_next_alloc_goal++; |
333 | } | 330 | } |
334 | 331 | ||
335 | err = 0; | ||
336 | 332 | ||
337 | bh = inode_getblk(inode, block, &err, &phys, &new); | 333 | phys = inode_getblk(inode, block, &err, &new); |
338 | BUG_ON(bh); | 334 | if (!phys) |
339 | if (err) | ||
340 | goto abort; | 335 | goto abort; |
341 | BUG_ON(!phys); | ||
342 | 336 | ||
343 | if (new) | 337 | if (new) |
344 | set_buffer_new(bh_result); | 338 | set_buffer_new(bh_result); |
@@ -547,11 +541,10 @@ out: | |||
547 | return err; | 541 | return err; |
548 | } | 542 | } |
549 | 543 | ||
550 | static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | 544 | static sector_t inode_getblk(struct inode *inode, sector_t block, |
551 | int *err, sector_t *phys, int *new) | 545 | int *err, int *new) |
552 | { | 546 | { |
553 | static sector_t last_block; | 547 | static sector_t last_block; |
554 | struct buffer_head *result = NULL; | ||
555 | struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]; | 548 | struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]; |
556 | struct extent_position prev_epos, cur_epos, next_epos; | 549 | struct extent_position prev_epos, cur_epos, next_epos; |
557 | int count = 0, startnum = 0, endnum = 0; | 550 | int count = 0, startnum = 0, endnum = 0; |
@@ -566,6 +559,8 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
566 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; | 559 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; |
567 | int lastblock = 0; | 560 | int lastblock = 0; |
568 | 561 | ||
562 | *err = 0; | ||
563 | *new = 0; | ||
569 | prev_epos.offset = udf_file_entry_alloc_offset(inode); | 564 | prev_epos.offset = udf_file_entry_alloc_offset(inode); |
570 | prev_epos.block = iinfo->i_location; | 565 | prev_epos.block = iinfo->i_location; |
571 | prev_epos.bh = NULL; | 566 | prev_epos.bh = NULL; |
@@ -635,8 +630,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
635 | brelse(cur_epos.bh); | 630 | brelse(cur_epos.bh); |
636 | brelse(next_epos.bh); | 631 | brelse(next_epos.bh); |
637 | newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); | 632 | newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); |
638 | *phys = newblock; | 633 | return newblock; |
639 | return NULL; | ||
640 | } | 634 | } |
641 | 635 | ||
642 | last_block = block; | 636 | last_block = block; |
@@ -664,7 +658,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
664 | brelse(cur_epos.bh); | 658 | brelse(cur_epos.bh); |
665 | brelse(next_epos.bh); | 659 | brelse(next_epos.bh); |
666 | *err = ret; | 660 | *err = ret; |
667 | return NULL; | 661 | return 0; |
668 | } | 662 | } |
669 | c = 0; | 663 | c = 0; |
670 | offset = 0; | 664 | offset = 0; |
@@ -729,7 +723,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
729 | if (!newblocknum) { | 723 | if (!newblocknum) { |
730 | brelse(prev_epos.bh); | 724 | brelse(prev_epos.bh); |
731 | *err = -ENOSPC; | 725 | *err = -ENOSPC; |
732 | return NULL; | 726 | return 0; |
733 | } | 727 | } |
734 | iinfo->i_lenExtents += inode->i_sb->s_blocksize; | 728 | iinfo->i_lenExtents += inode->i_sb->s_blocksize; |
735 | } | 729 | } |
@@ -761,10 +755,10 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
761 | 755 | ||
762 | newblock = udf_get_pblock(inode->i_sb, newblocknum, | 756 | newblock = udf_get_pblock(inode->i_sb, newblocknum, |
763 | iinfo->i_location.partitionReferenceNum, 0); | 757 | iinfo->i_location.partitionReferenceNum, 0); |
764 | if (!newblock) | 758 | if (!newblock) { |
765 | return NULL; | 759 | *err = -EIO; |
766 | *phys = newblock; | 760 | return 0; |
767 | *err = 0; | 761 | } |
768 | *new = 1; | 762 | *new = 1; |
769 | iinfo->i_next_alloc_block = block; | 763 | iinfo->i_next_alloc_block = block; |
770 | iinfo->i_next_alloc_goal = newblocknum; | 764 | iinfo->i_next_alloc_goal = newblocknum; |
@@ -775,7 +769,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
775 | else | 769 | else |
776 | mark_inode_dirty(inode); | 770 | mark_inode_dirty(inode); |
777 | 771 | ||
778 | return result; | 772 | return newblock; |
779 | } | 773 | } |
780 | 774 | ||
781 | static void udf_split_extents(struct inode *inode, int *c, int offset, | 775 | static void udf_split_extents(struct inode *inode, int *c, int offset, |