summaryrefslogtreecommitdiff
path: root/resize
diff options
context:
space:
mode:
authorYongqiang Yang <xiaoqiangnk@gmail.com>2011-09-14 11:55:59 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-09-14 13:26:57 -0400
commit9f6ba888f027ba4daf57ac61a11a6dce98e42347 (patch)
tree4f02d06403067a9c44434e074fdbd034782bc374 /resize
parent478113973e003762930c0b0250d64b9092e2deb1 (diff)
downloade2fsprogs-9f6ba888f027ba4daf57ac61a11a6dce98e42347.tar.gz
resize2fs: add support for new in-kernel online resize ioctl
This is needed to support online resizing for > 32-bit file systems Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'resize')
-rw-r--r--resize/online.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/resize/online.c b/resize/online.c
index 1d8d4ecf..1b3589bc 100644
--- a/resize/online.c
+++ b/resize/online.c
@@ -51,7 +51,7 @@ 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 &
EXT2_FEATURE_COMPAT_RESIZE_INODE) &&
@@ -69,6 +69,23 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
}
size=ext2fs_blocks_count(sb);
+
+ if (ioctl(fd, EXT4_IOC_RESIZE_FS, new_size)) {
+ if (errno != ENOTTY) {
+ if (errno == EPERM)
+ com_err(program_name, 0,
+ _("Permission denied to resize filesystem"));
+ else
+ com_err(program_name, errno,
+ _("While checking for on-line resizing "
+ "support"));
+ exit(1);
+ }
+ } else {
+ close(fd);
+ return 0;
+ }
+
if (ioctl(fd, EXT2_IOC_GROUP_EXTEND, &size)) {
if (errno == EPERM)
com_err(program_name, 0,