summaryrefslogtreecommitdiff
path: root/resize
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@whamcloud.com>2011-06-11 12:17:29 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-06-11 12:17:29 -0400
commit931b58e1cb2158c1f5218059cce92e94917ef485 (patch)
tree0198f3a4542a4489039ed048e3550e9ad093b6c5 /resize
parent534a4c3db58064caee4fc3e9e294251240d9d28a (diff)
downloade2fsprogs-931b58e1cb2158c1f5218059cce92e94917ef485.tar.gz
ext2fs: Handle internal journal over 2^32 bytes
The write_journal_inode() code is only setting the low 32-bit i_size for the journal size, even though it is possible to specify a journal up to 10M blocks in size. Trying to create a journal larger than 2GB will succeed, but an immediate e2fsck would fail. Store i_size_high for the journal inode when creating it, and load it upon access. Use s_jnl_blocks[15] to store the journal i_size_high backup. This field is currently unused, as EXT2_N_BLOCKS is 15, so it is using s_jnl_blocks[0..14], and i_size is in s_jnl_blocks[16]. Rename the "size" argument "num_blocks" for the journal creation functions to clarify this parameter is in units of filesystem blocks and not bytes. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'resize')
-rw-r--r--resize/resize2fs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 216a6264..45ea5f42 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1879,6 +1879,7 @@ static errcode_t fix_sb_journal_backup(ext2_filsys fs)
if (retval)
return retval;
memcpy(fs->super->s_jnl_blocks, inode.i_block, EXT2_N_BLOCKS*4);
+ fs->super->s_jnl_blocks[15] = inode.i_size_high;
fs->super->s_jnl_blocks[16] = inode.i_size;
fs->super->s_jnl_backup_type = EXT3_JNL_BACKUP_BLOCKS;
ext2fs_mark_super_dirty(fs);