diff options
Diffstat (limited to 'resize/online.c')
-rw-r--r-- | resize/online.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/resize/online.c b/resize/online.c index 5d596045..f4d24ce7 100644 --- a/resize/online.c +++ b/resize/online.c @@ -1,8 +1,8 @@ /* * online.c --- Do on-line resizing of the ext3 filesystem * - * Copyright (C) 2006 by Theodore Ts'o - * + * Copyright (C) 2006 by Theodore Ts'o + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -18,7 +18,7 @@ extern char *program_name; -errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, +errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, blk_t *new_size, int flags EXT2FS_ATTR((unused))) { #ifdef __linux__ @@ -44,7 +44,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, } /* - * If the number of descriptor blocks is going to increase, + * If the number of descriptor blocks is going to increase, * the on-line resizing inode must be present. */ new_desc_blocks = ext2fs_div_ceil( @@ -52,19 +52,19 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, fs->super->s_first_data_block, EXT2_BLOCKS_PER_GROUP(fs->super)), EXT2_DESC_PER_BLOCK(fs->super)); - printf("old desc_blocks = %lu, new_desc_blocks = %lu\n", + printf("old desc_blocks = %lu, new_desc_blocks = %lu\n", fs->desc_blocks, new_desc_blocks); - if (!(fs->super->s_feature_compat & + if (!(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE) && new_desc_blocks != fs->desc_blocks) { - com_err(program_name, 0, + com_err(program_name, 0, _("Filesystem does not support online resizing")); exit(1); } fd = open(mtpt, O_RDONLY); if (fd < 0) { - com_err(program_name, errno, + com_err(program_name, errno, _("while trying to open mountpoint %s"), mtpt); exit(1); } @@ -72,13 +72,13 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, size=sb->s_blocks_count; if (ioctl(fd, EXT2_IOC_GROUP_EXTEND, &size)) { if (errno == EPERM) - com_err(program_name, 0, + com_err(program_name, 0, _("Permission denied to resize filesystem")); else if (errno == ENOTTY) - com_err(program_name, 0, + com_err(program_name, 0, _("Kernel does not support online resizing")); - else - com_err(program_name, errno, + else + com_err(program_name, errno, _("While checking for on-line resizing support")); exit(1); } @@ -100,13 +100,13 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, printf(_("Performing an on-line resize of %s to %u (%dk) blocks.\n"), fs->device_name, *new_size, fs->blocksize / 1024); - size = fs->group_desc_count * sb->s_blocks_per_group + + size = fs->group_desc_count * sb->s_blocks_per_group + sb->s_first_data_block; if (size > *new_size) size = *new_size; if (ioctl(fd, EXT2_IOC_GROUP_EXTEND, &size)) { - com_err(program_name, errno, + com_err(program_name, errno, _("While trying to extend the last group")); exit(1); } @@ -117,7 +117,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, overhead = (int) (2 + new_fs->inode_blocks_per_group); if (ext2fs_bg_has_super(new_fs, new_fs->group_desc_count - 1)) - overhead += 1 + new_fs->desc_blocks + + overhead += 1 + new_fs->desc_blocks + new_fs->super->s_reserved_gdt_blocks; input.group = i; @@ -127,7 +127,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, input.blocks_count = sb->s_blocks_per_group; if (i == new_fs->group_desc_count-1) { input.blocks_count = new_fs->super->s_blocks_count - - sb->s_first_data_block - + sb->s_first_data_block - (i * sb->s_blocks_per_group); } input.reserved_blocks = (blk_t) (percent * input.blocks_count @@ -136,16 +136,16 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, #if 0 printf("new block bitmap is at 0x%04x\n", input.block_bitmap); printf("new inode bitmap is at 0x%04x\n", input.inode_bitmap); - printf("new inode table is at 0x%04x-0x%04x\n", + printf("new inode table is at 0x%04x-0x%04x\n", input.inode_table, input.inode_table + new_fs->inode_blocks_per_group-1); printf("new group has %u blocks\n", input.blocks_count); - printf("new group will reserve %d blocks\n", + printf("new group will reserve %d blocks\n", input.reserved_blocks); - printf("new group has %d free blocks\n", + printf("new group has %d free blocks\n", new_fs->group_desc[i].bg_free_blocks_count); printf("new group has %d free inodes (%d blocks)\n", - new_fs->group_desc[i].bg_free_inodes_count, + new_fs->group_desc[i].bg_free_inodes_count, new_fs->inode_blocks_per_group); printf("Adding group #%d\n", input.group); #endif @@ -165,8 +165,8 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, input64.unused = input.unused; if (ioctl(fd, EXT4_IOC_GROUP_ADD, &input64) < 0) { - com_err(program_name, errno, - _("While trying to add group #%d"), + com_err(program_name, errno, + _("While trying to add group #%d"), input.group); exit(1); } |