Whamcloud - gitweb
e2fsck: don't use e2fsck_global_ctx in e2fsck_set_bitmap_type()
authorTheodore Ts'o <tytso@mit.edu>
Wed, 5 Mar 2014 00:10:26 +0000 (19:10 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 5 Mar 2014 00:11:56 +0000 (19:11 -0500)
There is no reason to use e2fsck_global_ctx in
e2fsck_set_bitmap_type(), since we can get the context structure from
fs->priv_data.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/unix.c
e2fsck/util.c

index 23316b8..155e6b4 100644 (file)
@@ -1066,9 +1066,11 @@ static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr,
                retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options,
                                      flags, 0, 0, io_ptr, ret_fs);
 
-       if (retval == 0)
+       if (retval == 0) {
+               (*ret_fs)->priv_data = ctx;
                e2fsck_set_bitmap_type(*ret_fs, EXT2FS_BMAP64_RBTREE,
                                       "default", NULL);
+       }
        return retval;
 }
 
@@ -1417,7 +1419,6 @@ failure:
        }
 
        ctx->fs = fs;
-       fs->priv_data = ctx;
        fs->now = ctx->now;
        sb = fs->super;
 
index 9f920b2..4348631 100644 (file)
@@ -792,13 +792,13 @@ void e2fsck_set_bitmap_type(ext2_filsys fs, unsigned int default_type,
                            const char *profile_name, unsigned int *old_type)
 {
        unsigned type;
+       e2fsck_t ctx = (e2fsck_t) fs->priv_data;
 
        if (old_type)
                *old_type = fs->default_bitmap_type;
-       profile_get_uint(e2fsck_global_ctx->profile, "bitmaps",
-                        profile_name, 0, default_type, &type);
-       profile_get_uint(e2fsck_global_ctx->profile, "bitmaps",
-                        "all", 0, type, &type);
+       profile_get_uint(ctx->profile, "bitmaps", profile_name, 0,
+                        default_type, &type);
+       profile_get_uint(ctx->profile, "bitmaps", "all", 0, type, &type);
        fs->default_bitmap_type = type ? type : default_type;
 }