]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: optimize away repeated calls to gettext()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 14 Dec 2019 04:30:53 +0000 (23:30 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 14 Dec 2019 04:30:53 +0000 (23:30 -0500)
Optimize _("getting next inode from scan") so it is not called for
each initialized inode in the file system, and make a similar
optimization in pass 2 for each directory block.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c
e2fsck/pass2.c

index b1469088677fd95bae7db900a760b3e03fe93df6..c9e8bf828f288c0a824170d45c85c7bf919784b1 100644 (file)
@@ -1171,6 +1171,7 @@ void e2fsck_pass1(e2fsck_t ctx)
        struct          scan_callback_struct scan_struct;
        struct ext2_super_block *sb = ctx->fs->super;
        const char      *old_op;
+       const char      *eop_next_inode = _("getting next inode from scan");
        int             imagic_fs, extent_fs, inlinedata_fs, casefold_fs;
        int             low_dtime_check = 1;
        unsigned int    inode_size = EXT2_INODE_SIZE(fs->super);
@@ -1363,7 +1364,7 @@ void e2fsck_pass1(e2fsck_t ctx)
                        if (e2fsck_mmp_update(fs))
                                fatal_error(ctx, 0);
                }
-               old_op = ehandler_operation(_("getting next inode from scan"));
+               old_op = ehandler_operation(eop_next_inode);
                pctx.errcode = ext2fs_get_next_inode_full(scan, &ino,
                                                          inode, inode_size);
                if (ino > ino_threshold)
index 8b40e93db8c335760cf362d6485b951851f15183..06f0954939472d7d2617ac82703bfc9557885e19 100644 (file)
@@ -934,6 +934,7 @@ static int check_dir_block(ext2_filsys fs,
        int     encrypted = 0;
        size_t  max_block_size;
        int     hash_flags = 0;
+       static char *eop_read_dirblock = NULL;
 
        cd = (struct check_dir_struct *) priv_data;
        ibuf = buf = cd->buf;
@@ -1004,7 +1005,9 @@ static int check_dir_block(ext2_filsys fs,
               db->blockcnt, ino);
 #endif
 
-       ehandler_operation(_("reading directory block"));
+       if (!eop_read_dirblock)
+               eop_read_dirblock = (char *) _("reading directory block");
+       ehandler_operation(eop_read_dirblock);
        if (inline_data_size) {
                memset(buf, 0, fs->blocksize - inline_data_size);
                cd->pctx.errcode = ext2fs_inline_data_get(fs, ino, 0, buf, 0);