diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2008-07-11 19:27:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-07-11 19:27:31 -0400 |
commit | 654b4908bc17a6318d18f3036fecc5155de92f55 (patch) | |
tree | a77264435aa5ed0386334653fae7624ee423f8cf /fs/ext4/extents.c | |
parent | 7061eba75ceb0835ba61e7cbd757a6f9c1e4af92 (diff) |
ext4: cleanup block allocator
Move the code related to block allocation to a single function and add helper
funtions to differient allocation for data and meta data blocks
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c729b3507b4..555155d239d 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -179,8 +179,11 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, | |||
179 | return bg_start + colour + block; | 179 | return bg_start + colour + block; |
180 | } | 180 | } |
181 | 181 | ||
182 | /* | ||
183 | * Allocation for a meta data block | ||
184 | */ | ||
182 | static ext4_fsblk_t | 185 | static ext4_fsblk_t |
183 | ext4_ext_new_block(handle_t *handle, struct inode *inode, | 186 | ext4_ext_new_meta_block(handle_t *handle, struct inode *inode, |
184 | struct ext4_ext_path *path, | 187 | struct ext4_ext_path *path, |
185 | struct ext4_extent *ex, int *err) | 188 | struct ext4_extent *ex, int *err) |
186 | { | 189 | { |
@@ -690,7 +693,8 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, | |||
690 | /* allocate all needed blocks */ | 693 | /* allocate all needed blocks */ |
691 | ext_debug("allocate %d blocks for indexes/leaf\n", depth - at); | 694 | ext_debug("allocate %d blocks for indexes/leaf\n", depth - at); |
692 | for (a = 0; a < depth - at; a++) { | 695 | for (a = 0; a < depth - at; a++) { |
693 | newblock = ext4_ext_new_block(handle, inode, path, newext, &err); | 696 | newblock = ext4_ext_new_meta_block(handle, inode, path, |
697 | newext, &err); | ||
694 | if (newblock == 0) | 698 | if (newblock == 0) |
695 | goto cleanup; | 699 | goto cleanup; |
696 | ablocks[a] = newblock; | 700 | ablocks[a] = newblock; |
@@ -886,7 +890,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, | |||
886 | ext4_fsblk_t newblock; | 890 | ext4_fsblk_t newblock; |
887 | int err = 0; | 891 | int err = 0; |
888 | 892 | ||
889 | newblock = ext4_ext_new_block(handle, inode, path, newext, &err); | 893 | newblock = ext4_ext_new_meta_block(handle, inode, path, newext, &err); |
890 | if (newblock == 0) | 894 | if (newblock == 0) |
891 | return err; | 895 | return err; |
892 | 896 | ||