Whamcloud - gitweb
libext2: advance group in ext2fs_open2 during swapping
authorEric Sandeen <sandeen@redhat.com>
Thu, 10 Nov 2011 12:02:04 +0000 (07:02 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 10 Nov 2011 12:02:04 +0000 (07:02 -0500)
Without this change, we go back to getting group descriptor
"0" each time we go around the "for i" loop.  It must properly
advance through the filesystem.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/openfs.c

index 0cefe3f..40a52c5 100644 (file)
@@ -356,8 +356,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
                        goto cleanup;
 #ifdef WORDS_BIGENDIAN
                for (j=0; j < groups_per_block; j++) {
-                       /* The below happens to work... be careful. */
-                       gdp = ext2fs_group_desc(fs, fs->group_desc, j);
+                       gdp = ext2fs_group_desc(fs, fs->group_desc,
+                                               i * groups_per_block + j);
                        ext2fs_swap_group_desc2(fs, gdp);
                }
 #endif