aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ext2fs/alloc_tables.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-04-29 21:26:48 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-04-29 21:26:48 +0000
commita29f4d30f24d68f1f1c75548e020689ede532c05 (patch)
treef74e57c6188bc586c912a79da833236ad28f7233 /lib/ext2fs/alloc_tables.c
parentae85148246952016865e2792b49d6b68649b6063 (diff)
downloadandroid_external_e2fsprogs-a29f4d30f24d68f1f1c75548e020689ede532c05.tar.gz
android_external_e2fsprogs-a29f4d30f24d68f1f1c75548e020689ede532c05.tar.bz2
android_external_e2fsprogs-a29f4d30f24d68f1f1c75548e020689ede532c05.zip
Many files:
Checkin of e2fsprogs 1.10
Diffstat (limited to 'lib/ext2fs/alloc_tables.c')
-rw-r--r--lib/ext2fs/alloc_tables.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index 65c129f8..6a60bf76 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -42,6 +42,8 @@ errcode_t ext2fs_allocate_tables(ext2_filsys fs)
* Allocate the inode table
*/
start_blk = group_blk + 3 + fs->desc_blocks;
+ if (start_blk > last_blk)
+ start_blk = group_blk;
retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
fs->inode_blocks_per_group,
fs->block_map, &new_blk);
@@ -56,8 +58,15 @@ errcode_t ext2fs_allocate_tables(ext2_filsys fs)
/*
* Allocate the block and inode bitmaps
*/
- start_blk += fs->inode_blocks_per_group +
- ((2 * i) % (last_blk - start_blk));
+ if (fs->stride) {
+ start_blk += fs->inode_blocks_per_group;
+ start_blk += ((fs->stride * i) %
+ (last_blk - start_blk));
+ if (start_blk > last_blk)
+ /* should never happen */
+ start_blk = group_blk;
+ } else
+ start_blk = group_blk;
retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
1, fs->block_map, &new_blk);
if (retval)