ChangeLog, debugfs.8.in, debugfs.c:
Add a -V option which displays the current version.
ChangeLog, unix.c:
unix.c (e2fsck_update_progress): Remove unused variables.
ChangeLog, inode.c:
inode.c (get_next_blockgroup): Fix bug where if get_next_blockgroup()
is called early because of a missing inode table in a block group, the
current_inode counter wasn't incremented correctly.
ChangeLog, tst_uuid.c:
tst_uuid.c (main): Fixed bogus declaration of the main's argv parameter.
ChangeLog, test_icount.c:
test_icount.c (main): Fix main() declaration so that it returns int,
not void.
Many files:
fsck.c (ignore): Remove unused variable cp.
chattr.c (fatal_error):
tune2fs.c (usage):
lsattr.c (usage):
dumpe2fs.c (usage):
badblocks.c (usage): Remove volatile from declaration.
fsck.c: Change use of strdup to be string_copy, since we don't trust
what glibc is doing with strdup. (Whatever it is, it isn't pretty.)
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 0edee7f..7c9c8bc 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -210,6 +210,9 @@
scan->current_block = scan->fs->
group_desc[scan->current_group].bg_inode_table;
+ scan->current_inode = scan->current_group *
+ EXT2_INODES_PER_GROUP(scan->fs->super);
+
scan->bytes_left = 0;
scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
scan->blocks_left = scan->fs->inode_blocks_per_group;
@@ -221,7 +224,6 @@
{
scan->current_group = group - 1;
scan->groups_left = scan->fs->group_desc_count - group;
- scan->current_inode = group * EXT2_INODES_PER_GROUP(scan->fs->super);
return get_next_blockgroup(scan);
}
@@ -344,6 +346,27 @@
return 0;
}
+#if 0
+/*
+ * Returns 1 if the entire inode_buffer has a non-zero size and
+ * contains all zeros. (Not just deleted inodes, since that means
+ * that part of the inode table was used at one point; we want all
+ * zeros, which means that the inode table is pristine.)
+ */
+static inline int is_empty_scan(ext2_inode_scan scan)
+{
+ int i;
+
+ if (scan->bytes_left == 0)
+ return 0;
+
+ for (i=0; i < scan->bytes_left; i++)
+ if (scan->ptr[i])
+ return 0;
+ return 1;
+}
+#endif
+
errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
struct ext2_inode *inode)
{
@@ -356,7 +379,7 @@
* Do we need to start reading a new block group?
*/
if (scan->inodes_left <= 0) {
- retry:
+ force_new_group:
if (scan->done_group) {
retval = (scan->done_group)
(scan->fs, scan, scan->current_group,
@@ -378,7 +401,7 @@
*/
if (scan->current_block == 0) {
if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) {
- goto retry;
+ goto force_new_group;
} else
return EXT2_ET_MISSING_INODE_TABLE;
}
@@ -395,6 +418,14 @@
retval = get_next_blocks(scan);
if (retval)
return retval;
+#if 0
+ /*
+ * XXX test Need check for used inode somehow.
+ * (Note: this is hard.)
+ */
+ if (is_empty_scan(scan))
+ goto force_new_group;
+#endif
}
retval = 0;