summaryrefslogtreecommitdiff
path: root/resize
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-11-03 19:46:49 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-11-03 19:46:49 +0000
commit80c0fc3492278168448017e79730905aa5b9b62b (patch)
treeda9e69c17ffd625e25eecc6ba91c8bea68f9e93a /resize
parent08b213017f8371ce4b56ad4d368eb0f92211d04e (diff)
downloade2fsprogs-80c0fc3492278168448017e79730905aa5b9b62b.tar.gz
Many files:
resize2fs.c, ext2_block_move.c ext2_inode_move.c: Only include printf statements if RESIZE2FS_DEBUG is defined. main.c: Don't read in the bitmaps since resize2fs.c does that. e2label.c, mke2fs.c: Adjust header files.
Diffstat (limited to 'resize')
-rw-r--r--resize/ChangeLog7
-rw-r--r--resize/Makefile.pq3
-rw-r--r--resize/ext2_block_move.c4
-rw-r--r--resize/ext2_inode_move.c4
-rw-r--r--resize/main.c7
-rw-r--r--resize/resize2fs.c12
6 files changed, 28 insertions, 9 deletions
diff --git a/resize/ChangeLog b/resize/ChangeLog
index bb559ee1..3a957f9e 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,3 +1,10 @@
+Mon Nov 3 14:45:06 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * resize2fs.c, ext2_block_move.c ext2_inode_move.c: Only include
+ printf statements if RESIZE2FS_DEBUG is defined.
+
+ * main.c: Don't read in the bitmaps since resize2fs.c does that.
+
Sun Oct 19 20:40:42 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
* resize2fs.h: Add #ifdef's for HAVE_SYS_TYPES_H and HAVE_SYS_TIME_H.
diff --git a/resize/Makefile.pq b/resize/Makefile.pq
index c383c875..5421c6d8 100644
--- a/resize/Makefile.pq
+++ b/resize/Makefile.pq
@@ -5,8 +5,7 @@ OBJFILE=RESIZE.LST
OBJS= extent.obj \
ext2_block_move.obj \
ext2_inode_move.obj \
- resize2fs.obj \
- sim_progress.obj
+ resize2fs.obj
ALL:: $(OBJS)
diff --git a/resize/ext2_block_move.c b/resize/ext2_block_move.c
index ec60edf7..3170e95b 100644
--- a/resize/ext2_block_move.c
+++ b/resize/ext2_block_move.c
@@ -34,9 +34,11 @@ static int process_block(ext2_filsys fs, blk_t *block_nr,
if (new) {
*block_nr = new;
ret |= BLOCK_CHANGED;
+#ifdef RESIZE2FS_DEBUG
if (pb->flags & RESIZE_DEBUG_BMOVE)
printf("ino=%ld, blockcnt=%d, %u->%u\n", pb->ino,
blockcnt, block, new);
+#endif
}
if (pb->is_dir) {
@@ -125,9 +127,11 @@ errcode_t ext2fs_block_move(ext2_resize_t rfs)
if (retval) goto errout;
if (!size)
break;
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_BMOVE)
printf("Moving %d blocks %u->%u\n", size,
old, new);
+#endif
do {
c = size;
if (c > fs->inode_blocks_per_group)
diff --git a/resize/ext2_inode_move.c b/resize/ext2_inode_move.c
index 5d26b153..3ec74b8a 100644
--- a/resize/ext2_inode_move.c
+++ b/resize/ext2_inode_move.c
@@ -56,10 +56,12 @@ static int check_and_change_inodes(ino_t dir, int entry,
if (!new)
return 0;
+#ifdef RESIZE2FS_DEBUG
if (is->flags & RESIZE_DEBUG_INODEMAP)
printf("Inode translate (dir=%ld, name=%.*s, %u->%ld)\n",
dir, dirent->name_len, dirent->name,
dirent->inode, new);
+#endif
dirent->inode = new;
@@ -251,8 +253,10 @@ errcode_t ext2fs_inode_move(ext2_resize_t rfs)
if (LINUX_S_ISDIR(inode.i_mode))
rfs->new_fs->group_desc[group].bg_used_dirs_count++;
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_INODEMAP)
printf("Inode moved %ld->%ld\n", ino, new);
+#endif
ext2fs_add_extent_entry(imap, ino, new);
}
diff --git a/resize/main.c b/resize/main.c
index b5e5a7fc..7765052b 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -104,13 +104,6 @@ void main (int argc, char ** argv)
printf ("Couldn't find valid filesystem superblock.\n");
exit (1);
}
- retval = ext2fs_read_bitmaps(fs);
- if (retval) {
- com_err (program_name, retval,
- "while trying to read the bitmaps", device_name);
- ext2fs_close (fs);
- exit (1);
- }
retval = resize_fs(fs, new_size, flags);
if (retval) {
com_err(program_name, retval, "while trying to resize %s",
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 66e0b20e..1345708d 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -574,10 +574,12 @@ static errcode_t move_itables(ext2_resize_t rfs)
new = fs->group_desc[i].bg_inode_table;
diff = new - old;
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
printf("Itable move group %d block "
"%u->%u (diff %d)\n",
i, old, new, diff);
+#endif
if (!diff)
continue;
@@ -596,8 +598,10 @@ static errcode_t move_itables(ext2_resize_t rfs)
if (*cp)
break;
n = n >> EXT2_BLOCK_SIZE_BITS(fs->super);
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
printf("%d blocks of zeros...\n", n);
+#endif
num = fs->inode_blocks_per_group;
if (n > diff)
num -= n;
@@ -622,8 +626,10 @@ static errcode_t move_itables(ext2_resize_t rfs)
}
ext2fs_flush(rfs->new_fs);
io_channel_flush(fs->io);
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
printf("Inode table move finished.\n");
+#endif
if (progress)
ext2fs_progress_close(progress);
return 0;
@@ -631,11 +637,15 @@ static errcode_t move_itables(ext2_resize_t rfs)
backout:
if (progress)
ext2fs_progress_close(progress);
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
printf("Error: %s; now backing out!\n", error_message(retval));
+#endif
while (--i >= 0) {
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
printf("Group %d block %u->%u\n", i, new, old);
+#endif
old = rfs->old_fs->group_desc[i].bg_inode_table;
new = fs->group_desc[i].bg_inode_table;
@@ -746,11 +756,13 @@ errcode_t resize_fs(ext2_filsys fs, blk_t new_size, int flags)
if (retval)
goto errout;
+#ifdef RESIZE2FS_DEBUG
if (rfs->flags & RESIZE_DEBUG_BMOVE)
printf("Number of free blocks: %d/%d, Needed: %d\n",
rfs->old_fs->super->s_free_blocks_count,
rfs->new_fs->super->s_free_blocks_count,
rfs->needed_blocks);
+#endif
retval = ext2fs_block_move(rfs);
if (retval)