Hello all,
During my development, I noticed following bug while creating system image
(ext4):
make_ext4fs -s -l 929038336 -a system
out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
out/target/product/generic/system
error: do_inode_allocate_extents: Failed to allocate 36805 blocks
Creating filesystem with parameters:
Size: 929038336
Block size: 4096
Blocks per group: 32768
Inodes per group: 8112
Inode size: 256
Journal blocks: 3544
Label:
Blocks: 226816
Block groups: 7
Reserved block group size: 55
After debugging it looks like ext4_allocate_partial does not allocate from
group which has any data blocks used.
Following patch seems to resolve the problem but I am not sure why there is
check at first place.
If anyone can throw some light on reason for this check in
allocate.c(ext4_allocate_partial):
if (aux_info.bgs[i].data_blocks_used == 0) {
TIA,
Pradeep
diff --git a/ext4_utils/allocate.c b/ext4_utils/allocate.c
index c0b2c7e..d448a01 100644
--- a/ext4_utils/allocate.c
+++ b/ext4_utils/allocate.c
@@ -400,34 +400,32 @@ static struct region *ext4_allocate_partial(u32 len)
struct region *reg;
for (i = 0; i < aux_info.groups; i++) {
- if (aux_info.bgs[i].data_blocks_used == 0) {
- u32 bg_len = aux_info.bgs[i].free_blocks;
- u32 block;
-
- if (len <= bg_len) {
- /* If the requested length would fit in a
block group,
- use the regular allocator to try to fit it
in a partially
- used block group */
- bg_len = len;
- reg = ext4_allocate_contiguous_blocks(len);
- } else {
- block =
ext4_allocate_blocks_from_block_group(bg_len, i);
-
- if (block == EXT4_ALLOCATE_FAILED) {
- error("failed to allocate %d blocks
in block group %d", bg_len, i);
- return NULL;
- }
-
- reg = malloc(sizeof(struct region));
- reg->block = block;
- reg->len = bg_len;
- reg->next = NULL;
- reg->prev = NULL;
- reg->bg = i;
+ u32 bg_len = aux_info.bgs[i].free_blocks;
+ u32 block;
+
+ if (len <= bg_len) {
+ /* If the requested length would fit in a block
group,
+ use the regular allocator to try to fit it in a
partially
+ used block group */
+ bg_len = len;
+ reg = ext4_allocate_contiguous_blocks(len);
+ } else if(bg_len > 1) {
+ block =
ext4_allocate_blocks_from_block_group(bg_len, i);
+
+ if (block == EXT4_ALLOCATE_FAILED) {
+ error("failed to allocate %d blocks in
block group %d", bg_len, i);
+ return NULL;
}
- return reg;
- }
+ reg = malloc(sizeof(struct region));
+ reg->block = block;
+ reg->len = bg_len;
+ reg->next = NULL;
+ reg->prev = NULL;
+ reg->bg = i;
+ } else
+ continue;
+ return reg;
}
return NULL;
}
--
--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel
---
You received this message because you are subscribed to the Google Groups
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.