]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: read bitmaps asynchronously during initialization
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Sep 2025 22:24:25 +0000 (15:24 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 9 Mar 2026 02:14:03 +0000 (19:14 -0700)
The kernel reads the bitmaps asynchronously when the filesystem is
mounted.  Do this as well in fuse2fs to reduce mount times.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
misc/fuse2fs.c

index 5ac685882a26e409f4fa45cc3dcc0a91435f9887..e03c2d9b0f833af5511158e757475f2ea8876717 100644 (file)
@@ -981,6 +981,21 @@ static int fuse2fs_setup_logging(struct fuse2fs *ff)
        return 0;
 }
 
+static int fuse2fs_read_bitmaps(struct fuse2fs *ff)
+{
+       errcode_t err;
+
+       err = ext2fs_read_inode_bitmap(ff->fs);
+       if (err)
+               return translate_error(ff->fs, 0, err);
+
+       err = ext2fs_read_block_bitmap(ff->fs);
+       if (err)
+               return translate_error(ff->fs, 0, err);
+
+       return 0;
+}
+
 static void *op_init(struct fuse_conn_info *conn
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
                        , struct fuse_config *cfg EXT2FS_ATTR((unused))
@@ -1028,6 +1043,10 @@ static void *op_init(struct fuse_conn_info *conn
                uuid_unparse(fs->super->s_uuid, uuid);
                log_printf(ff, "%s %s.\n", _("mounted filesystem"), uuid);
        }
+
+       if (global_fs->flags & EXT2_FLAG_RW)
+               fuse2fs_read_bitmaps(ff);
+
        return ff;
 }
 
@@ -5019,16 +5038,6 @@ int main(int argc, char *argv[])
  _("Warning: fuse2fs does not support using the journal.\n"
    "There may be file system corruption or data loss if\n"
    "the file system is not gracefully unmounted.\n"));
-               err = ext2fs_read_inode_bitmap(global_fs);
-               if (err) {
-                       translate_error(global_fs, 0, err);
-                       goto out;
-               }
-               err = ext2fs_read_block_bitmap(global_fs);
-               if (err) {
-                       translate_error(global_fs, 0, err);
-                       goto out;
-               }
        }
 
        if (!(global_fs->super->s_state & EXT2_VALID_FS))