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 | |
parent | 8e1a4857cd92e32e642b3e7184c7f6bf85c96e2e (diff) |
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')
-rw-r--r-- | fs/ext4/balloc.c | 20 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 3 | ||||
-rw-r--r-- | fs/ext4/inode.c | 18 |
3 files changed, 13 insertions, 28 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 152c390f3c3f..10ce275ebbf1 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -741,26 +741,6 @@ ext4_fsblk_t ext4_new_meta_block(handle_t *handle, struct inode *inode, | |||
741 | return ext4_new_meta_blocks(handle, inode, goal, &count, errp); | 741 | return ext4_new_meta_blocks(handle, inode, goal, &count, errp); |
742 | } | 742 | } |
743 | 743 | ||
744 | /* | ||
745 | * ext4_new_blocks() -- allocate data blocks | ||
746 | * | ||
747 | * @handle: handle to this transaction | ||
748 | * @inode: file inode | ||
749 | * @goal: given target block(filesystem wide) | ||
750 | * @count: total number of blocks need | ||
751 | * @errp: error code | ||
752 | * | ||
753 | * Return 1st allocated block numberon success, *count stores total account | ||
754 | * error stores in errp pointer | ||
755 | */ | ||
756 | |||
757 | ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | ||
758 | ext4_lblk_t iblock, ext4_fsblk_t goal, | ||
759 | unsigned long *count, int *errp) | ||
760 | { | ||
761 | return do_blk_alloc(handle, inode, iblock, goal, count, errp, 0); | ||
762 | } | ||
763 | |||
764 | /** | 744 | /** |
765 | * ext4_count_free_blocks() -- count filesystem free blocks | 745 | * ext4_count_free_blocks() -- count filesystem free blocks |
766 | * @sb: superblock | 746 | * @sb: superblock |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 8370ffd2d62f..74cb395e689f 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1002,9 +1002,6 @@ extern ext4_fsblk_t ext4_new_meta_block(handle_t *handle, struct inode *inode, | |||
1002 | ext4_fsblk_t goal, int *errp); | 1002 | ext4_fsblk_t goal, int *errp); |
1003 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, | 1003 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, |
1004 | ext4_fsblk_t goal, unsigned long *count, int *errp); | 1004 | ext4_fsblk_t goal, unsigned long *count, int *errp); |
1005 | extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | ||
1006 | ext4_lblk_t iblock, ext4_fsblk_t goal, | ||
1007 | unsigned long *count, int *errp); | ||
1008 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); | 1005 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); |
1009 | extern int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); | 1006 | extern int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); |
1010 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, | 1007 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 5b088121686a..5120243024fb 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, | |||
547 | int indirect_blks, int blks, | 547 | int indirect_blks, int blks, |
548 | ext4_fsblk_t new_blocks[4], int *err) | 548 | ext4_fsblk_t new_blocks[4], int *err) |
549 | { | 549 | { |
550 | struct ext4_allocation_request ar; | ||
550 | int target, i; | 551 | int target, i; |
551 | unsigned long count = 0, blk_allocated = 0; | 552 | unsigned long count = 0, blk_allocated = 0; |
552 | int index = 0; | 553 | int index = 0; |
@@ -595,10 +596,17 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, | |||
595 | if (!target) | 596 | if (!target) |
596 | goto allocated; | 597 | goto allocated; |
597 | /* Now allocate data blocks */ | 598 | /* Now allocate data blocks */ |
598 | count = target; | 599 | memset(&ar, 0, sizeof(ar)); |
599 | /* allocating blocks for data blocks */ | 600 | ar.inode = inode; |
600 | current_block = ext4_new_blocks(handle, inode, iblock, | 601 | ar.goal = goal; |
601 | goal, &count, err); | 602 | ar.len = target; |
603 | ar.logical = iblock; | ||
604 | if (S_ISREG(inode->i_mode)) | ||
605 | /* enable in-core preallocation only for regular files */ | ||
606 | ar.flags = EXT4_MB_HINT_DATA; | ||
607 | |||
608 | current_block = ext4_mb_new_blocks(handle, &ar, err); | ||
609 | |||
602 | if (*err && (target == blks)) { | 610 | if (*err && (target == blks)) { |
603 | /* | 611 | /* |
604 | * if the allocation failed and we didn't allocate | 612 | * if the allocation failed and we didn't allocate |
@@ -614,7 +622,7 @@ static int ext4_alloc_blocks(handle_t *handle, struct inode *inode, | |||
614 | */ | 622 | */ |
615 | new_blocks[index] = current_block; | 623 | new_blocks[index] = current_block; |
616 | } | 624 | } |
617 | blk_allocated += count; | 625 | blk_allocated += ar.len; |
618 | } | 626 | } |
619 | allocated: | 627 | allocated: |
620 | /* total number of blocks allocated for direct blocks */ | 628 | /* total number of blocks allocated for direct blocks */ |