diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-06-10 18:54:53 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-06-10 18:54:53 -0400 |
commit | 4a2a9b70c89891a146bcb9cee3f29572ca2e1370 (patch) | |
tree | 07be3d72c24cf56d31129c1b3daaab2872aeca10 /lib/ext2fs/mkjournal.c | |
parent | b0ecb787ef9fde414791b644fa074450b28d4060 (diff) | |
download | e2fsprogs-4a2a9b70c89891a146bcb9cee3f29572ca2e1370.tar.gz |
libext2fs: allocate clusters to files in expand_dir.c and mkjournal.c
Teach ext2fs_expand_dir() and ext2fs_add_journal_inode() about
allocating blocks when clustered allocation is enabled.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/ext2fs/mkjournal.c')
-rw-r--r-- | lib/ext2fs/mkjournal.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c index 242c5376..de4d51c9 100644 --- a/lib/ext2fs/mkjournal.c +++ b/lib/ext2fs/mkjournal.c @@ -232,10 +232,16 @@ static int mkjournal_proc(ext2_filsys fs, es->goal = *blocknr; return 0; } - retval = ext2fs_new_block2(fs, es->goal, 0, &new_blk); - if (retval) { - es->err = retval; - return BLOCK_ABORT; + if (blockcnt && + (EXT2FS_B2C(fs, es->goal) == EXT2FS_B2C(fs, es->goal+1))) + new_blk = es->goal+1; + else { + es->goal &= ~EXT2FS_CLUSTER_MASK(fs); + retval = ext2fs_new_block2(fs, es->goal, 0, &new_blk); + if (retval) { + es->err = retval; + return BLOCK_ABORT; + } } if (blockcnt >= 0) es->num_blocks--; |