aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-09-18 21:28:39 -0400
committerDave Chinner <david@fromorbit.com>2016-09-18 21:28:39 -0400
commit6750ad71986d286a666e6245f160b89f4c15e7b0 (patch)
tree37fa454400249f8f204e7c9104bcc6259ceaa297 /fs/ext2
parent6c31f495d19975b7d2e824ee614934d5db113afe (diff)
ext2: stop passing buffer_head to ext2_get_blocks
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/inode.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index d5c7d09919f3..2a69ab2e7bb0 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -618,7 +618,7 @@ static void ext2_splice_branch(struct inode *inode,
618 */ 618 */
619static int ext2_get_blocks(struct inode *inode, 619static int ext2_get_blocks(struct inode *inode,
620 sector_t iblock, unsigned long maxblocks, 620 sector_t iblock, unsigned long maxblocks,
621 struct buffer_head *bh_result, 621 u32 *bno, bool *new, bool *boundary,
622 int create) 622 int create)
623{ 623{
624 int err = -EIO; 624 int err = -EIO;
@@ -644,7 +644,6 @@ static int ext2_get_blocks(struct inode *inode,
644 /* Simplest case - block found, no allocation needed */ 644 /* Simplest case - block found, no allocation needed */
645 if (!partial) { 645 if (!partial) {
646 first_block = le32_to_cpu(chain[depth - 1].key); 646 first_block = le32_to_cpu(chain[depth - 1].key);
647 clear_buffer_new(bh_result); /* What's this do? */
648 count++; 647 count++;
649 /*map more blocks*/ 648 /*map more blocks*/
650 while (count < maxblocks && count <= blocks_to_boundary) { 649 while (count < maxblocks && count <= blocks_to_boundary) {
@@ -699,7 +698,6 @@ static int ext2_get_blocks(struct inode *inode,
699 mutex_unlock(&ei->truncate_mutex); 698 mutex_unlock(&ei->truncate_mutex);
700 if (err) 699 if (err)
701 goto cleanup; 700 goto cleanup;
702 clear_buffer_new(bh_result);
703 goto got_it; 701 goto got_it;
704 } 702 }
705 } 703 }
@@ -745,15 +743,16 @@ static int ext2_get_blocks(struct inode *inode,
745 mutex_unlock(&ei->truncate_mutex); 743 mutex_unlock(&ei->truncate_mutex);
746 goto cleanup; 744 goto cleanup;
747 } 745 }
748 } else 746 } else {
749 set_buffer_new(bh_result); 747 *new = true;
748 }
750 749
751 ext2_splice_branch(inode, iblock, partial, indirect_blks, count); 750 ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
752 mutex_unlock(&ei->truncate_mutex); 751 mutex_unlock(&ei->truncate_mutex);
753got_it: 752got_it:
754 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); 753 *bno = le32_to_cpu(chain[depth-1].key);
755 if (count > blocks_to_boundary) 754 if (count > blocks_to_boundary)
756 set_buffer_boundary(bh_result); 755 *boundary = true;
757 err = count; 756 err = count;
758 /* Clean up and exit */ 757 /* Clean up and exit */
759 partial = chain + depth - 1; /* the whole chain */ 758 partial = chain + depth - 1; /* the whole chain */
@@ -765,16 +764,26 @@ cleanup:
765 return err; 764 return err;
766} 765}
767 766
768int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) 767int ext2_get_block(struct inode *inode, sector_t iblock,
768 struct buffer_head *bh_result, int create)
769{ 769{
770 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; 770 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
771 int ret = ext2_get_blocks(inode, iblock, max_blocks, 771 bool new = false, boundary = false;
772 bh_result, create); 772 u32 bno;
773 if (ret > 0) { 773 int ret;
774 bh_result->b_size = (ret << inode->i_blkbits); 774
775 ret = 0; 775 ret = ext2_get_blocks(inode, iblock, max_blocks, &bno, &new, &boundary,
776 } 776 create);
777 return ret; 777 if (ret <= 0)
778 return ret;
779
780 map_bh(bh_result, inode->i_sb, bno);
781 bh_result->b_size = (ret << inode->i_blkbits);
782 if (new)
783 set_buffer_new(bh_result);
784 if (boundary)
785 set_buffer_boundary(bh_result);
786 return 0;
778 787
779} 788}
780 789