Commit 6750ad71 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

ext2: stop passing buffer_head to ext2_get_blocks

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 6c31f495
...@@ -618,7 +618,7 @@ static void ext2_splice_branch(struct inode *inode, ...@@ -618,7 +618,7 @@ static void ext2_splice_branch(struct inode *inode,
*/ */
static int ext2_get_blocks(struct inode *inode, static int ext2_get_blocks(struct inode *inode,
sector_t iblock, unsigned long maxblocks, sector_t iblock, unsigned long maxblocks,
struct buffer_head *bh_result, u32 *bno, bool *new, bool *boundary,
int create) int create)
{ {
int err = -EIO; int err = -EIO;
...@@ -644,7 +644,6 @@ static int ext2_get_blocks(struct inode *inode, ...@@ -644,7 +644,6 @@ static int ext2_get_blocks(struct inode *inode,
/* Simplest case - block found, no allocation needed */ /* Simplest case - block found, no allocation needed */
if (!partial) { if (!partial) {
first_block = le32_to_cpu(chain[depth - 1].key); first_block = le32_to_cpu(chain[depth - 1].key);
clear_buffer_new(bh_result); /* What's this do? */
count++; count++;
/*map more blocks*/ /*map more blocks*/
while (count < maxblocks && count <= blocks_to_boundary) { while (count < maxblocks && count <= blocks_to_boundary) {
...@@ -699,7 +698,6 @@ static int ext2_get_blocks(struct inode *inode, ...@@ -699,7 +698,6 @@ static int ext2_get_blocks(struct inode *inode,
mutex_unlock(&ei->truncate_mutex); mutex_unlock(&ei->truncate_mutex);
if (err) if (err)
goto cleanup; goto cleanup;
clear_buffer_new(bh_result);
goto got_it; goto got_it;
} }
} }
...@@ -745,15 +743,16 @@ static int ext2_get_blocks(struct inode *inode, ...@@ -745,15 +743,16 @@ static int ext2_get_blocks(struct inode *inode,
mutex_unlock(&ei->truncate_mutex); mutex_unlock(&ei->truncate_mutex);
goto cleanup; goto cleanup;
} }
} else } else {
set_buffer_new(bh_result); *new = true;
}
ext2_splice_branch(inode, iblock, partial, indirect_blks, count); ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
mutex_unlock(&ei->truncate_mutex); mutex_unlock(&ei->truncate_mutex);
got_it: got_it:
map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); *bno = le32_to_cpu(chain[depth-1].key);
if (count > blocks_to_boundary) if (count > blocks_to_boundary)
set_buffer_boundary(bh_result); *boundary = true;
err = count; err = count;
/* Clean up and exit */ /* Clean up and exit */
partial = chain + depth - 1; /* the whole chain */ partial = chain + depth - 1; /* the whole chain */
...@@ -765,16 +764,26 @@ static int ext2_get_blocks(struct inode *inode, ...@@ -765,16 +764,26 @@ static int ext2_get_blocks(struct inode *inode,
return err; return err;
} }
int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) int ext2_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create)
{ {
unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
int ret = ext2_get_blocks(inode, iblock, max_blocks, bool new = false, boundary = false;
bh_result, create); u32 bno;
if (ret > 0) { int ret;
bh_result->b_size = (ret << inode->i_blkbits);
ret = 0; ret = ext2_get_blocks(inode, iblock, max_blocks, &bno, &new, &boundary,
} create);
return ret; if (ret <= 0)
return ret;
map_bh(bh_result, inode->i_sb, bno);
bh_result->b_size = (ret << inode->i_blkbits);
if (new)
set_buffer_new(bh_result);
if (boundary)
set_buffer_boundary(bh_result);
return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment