summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1998-03-21 03:27:48 +0000
committerTheodore Ts'o <tytso@mit.edu>1998-03-21 03:27:48 +0000
commit2bc4d4f7e52ae1af9fb1a3dcff7c8752145d5a5c (patch)
treeb6f24931b3d8b5d8bbbbb0774b6fedf81ba849f6
parentba0af7566347b3c2366cbb18715f465f70089019 (diff)
downloade2fsprogs-2bc4d4f7e52ae1af9fb1a3dcff7c8752145d5a5c.tar.gz
ChangeLog, resize2fs.c:
resize2fs.c (inode_scan_and_fix): If we are expanding the filesystem, temporarily set rfs->old_fs->super->s_blocks_count to ultimate size of the filesystem, to avoid catching an error on the block iterator.
-rw-r--r--resize/ChangeLog8
-rw-r--r--resize/resize2fs.c19
2 files changed, 27 insertions, 0 deletions
diff --git a/resize/ChangeLog b/resize/ChangeLog
index c7f8cfb9..d91240a2 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,3 +1,11 @@
+1998-03-20 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * resize2fs.c (inode_scan_and_fix): If we are expanding the
+ filesystem, temporarily set
+ rfs->old_fs->super->s_blocks_count to ultimate size of the
+ filesystem, to avoid catching an error on the block
+ iterator.
+
Mon Mar 9 12:02:47 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
* main.c: Use a local version.h file.
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 982e7d2f..1b6d082d 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -696,6 +696,12 @@ static void init_block_alloc(ext2_resize_t rfs)
{
rfs->alloc_state = AVOID_OLD;
rfs->new_blk = rfs->new_fs->super->s_first_data_block;
+#if 0
+ /* HACK for testing */
+ if (rfs->new_fs->super->s_blocks_count >
+ rfs->old_fs->super->s_blocks_count)
+ rfs->new_blk = rfs->old_fs->super->s_blocks_count;
+#endif
}
static blk_t get_new_block(ext2_resize_t rfs)
@@ -922,12 +928,24 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
int group;
char *block_buf = 0;
ino_t start_to_move;
+ blk_t orig_size;
if ((rfs->old_fs->group_desc_count <=
rfs->new_fs->group_desc_count) &&
!rfs->bmap)
return 0;
+ /*
+ * Save the original size of the old filesystem, and
+ * temporarily set the size to be the new size if the new size
+ * is larger. We need to do this to avoid catching an error
+ * by the block iterator routines
+ */
+ orig_size = rfs->old_fs->super->s_blocks_count;
+ if (orig_size < rfs->new_fs->super->s_blocks_count)
+ rfs->old_fs->super->s_blocks_count =
+ rfs->new_fs->super->s_blocks_count;
+
retval = ext2fs_open_inode_scan(rfs->old_fs, 0, &scan);
if (retval) goto errout;
@@ -1024,6 +1042,7 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
io_channel_flush(rfs->old_fs->io);
errout:
+ rfs->old_fs->super->s_blocks_count = orig_size;
if (rfs->bmap) {
ext2fs_free_extent_table(rfs->bmap);
rfs->bmap = 0;