diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-01-01 23:59:43 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-01 23:59:43 -0500 |
commit | 815a1130687ffac2c3e91513ce64aab629d6a54d (patch) | |
tree | 9abc15c6e1e44a5e5fcf1feb0f9328b09657ad59 /fs/ext4/inode.c | |
parent | 8e1a4857cd92e32e642b3e7184c7f6bf85c96e2e (diff) | |
download | kernel_goldelico_gta04-815a1130687ffac2c3e91513ce64aab629d6a54d.zip kernel_goldelico_gta04-815a1130687ffac2c3e91513ce64aab629d6a54d.tar.gz kernel_goldelico_gta04-815a1130687ffac2c3e91513ce64aab629d6a54d.tar.bz2 |
ext4: remove ext4_new_blocks() and call ext4_mb_new_blocks() directly
There was only one caller of the compatibility function
ext4_new_blocks(), in balloc.c's ext4_alloc_blocks(). Change it to
call ext4_mb_new_blocks() directly, and remove ext4_new_blocks()
altogether. This cleans up the code, by removing two extra functions
from the call chain, and hopefully saving some stack usage.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 5b0881216..5120243 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -547,6 +547,7 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, int indirect_blks, int blks, ext4_fsblk_t new_blocks[4], int *err) { + struct ext4_allocation_request ar; int target, i; unsigned long count = 0, blk_allocated = 0; int index = 0; @@ -595,10 +596,17 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, if (!target) goto allocated; /* Now allocate data blocks */ - count = target; - /* allocating blocks for data blocks */ - current_block = ext4_new_blocks(handle, inode, iblock, - goal, &count, err); + memset(&ar, 0, sizeof(ar)); + ar.inode = inode; + ar.goal = goal; + ar.len = target; + ar.logical = iblock; + if (S_ISREG(inode->i_mode)) + /* enable in-core preallocation only for regular files */ + ar.flags = EXT4_MB_HINT_DATA; + + current_block = ext4_mb_new_blocks(handle, &ar, err); + if (*err && (target == blks)) { /* * if the allocation failed and we didn't allocate @@ -614,7 +622,7 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, */ new_blocks[index] = current_block; } - blk_allocated += count; + blk_allocated += ar.len; } allocated: /* total number of blocks allocated for direct blocks */ |