[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175279461882.716436.17411002969175844004.stgit@frogsfrogsfrogs>
Date: Thu, 17 Jul 2025 16:47:43 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: joannelkoong@...il.com, miklos@...redi.hu, John@...ves.net,
linux-fsdevel@...r.kernel.org, bernd@...ernd.com, linux-ext4@...r.kernel.org,
neal@...pa.dev
Subject: [PATCH 09/10] fuse2fs: skip the gdt write in op_destroy if syncfs is
working
From: Darrick J. Wong <djwong@...nel.org>
As an umount-time performance enhancement, don't bother to write the
group descriptor tables in op_destroy if we know that op_syncfs will do
it for us. That only happens if iomap is enabled.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 66baca72ad49d1..3bded0fdd21e2a 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -263,6 +263,7 @@ struct fuse2fs {
uint8_t noblkdev;
uint8_t can_hardlink;
uint8_t iomap_passthrough_options;
+ uint8_t write_gdt_on_destroy;
enum fuse2fs_opstate opstate;
int blocklog;
@@ -1212,9 +1213,11 @@ static void op_destroy(void *p EXT2FS_ATTR((unused)))
if (fs->super->s_error_count)
fs->super->s_state |= EXT2_ERROR_FS;
ext2fs_mark_super_dirty(fs);
- err = ext2fs_set_gdt_csum(fs);
- if (err)
- translate_error(fs, 0, err);
+ if (ff->write_gdt_on_destroy) {
+ err = ext2fs_set_gdt_csum(fs);
+ if (err)
+ translate_error(fs, 0, err);
+ }
err = ext2fs_flush2(fs, 0);
if (err)
@@ -5129,6 +5132,15 @@ static int op_syncfs(const char *path)
}
}
+ /*
+ * When iomap is enabled, the kernel will call syncfs right before
+ * calling the destroy method. If any syncfs succeeds, then we know
+ * that there will be a last syncfs and that it will write the GDT, so
+ * destroy doesn't need to waste time doing that.
+ */
+ if (fuse2fs_iomap_enabled(ff))
+ ff->write_gdt_on_destroy = 0;
+
out_unlock:
fuse2fs_finish(ff, ret);
return ret;
@@ -6631,6 +6643,7 @@ int main(int argc, char *argv[])
.iomap_dev = FUSE_IOMAP_DEV_NULL,
#endif
.can_hardlink = 1,
+ .write_gdt_on_destroy = 1,
};
errcode_t err;
FILE *orig_stderr = stderr;
Powered by blists - more mailing lists