[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176169818387.1430380.2413109895614955629.stgit@frogsfrogsfrogs>
Date: Tue, 28 Oct 2025 18:15:44 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-fsdevel@...r.kernel.org, joannelkoong@...il.com, bernd@...ernd.com,
neal@...pa.dev, miklos@...redi.hu, linux-ext4@...r.kernel.org
Subject: [PATCH 09/11] 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>
---
fuse4fs/fuse4fs.c | 19 ++++++++++++++++---
misc/fuse2fs.c | 19 ++++++++++++++++---
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index ac8696aab65af4..e6a96717dfe415 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -275,6 +275,7 @@ struct fuse4fs {
int dirsync;
int translate_inums;
int iomap_passthrough_options;
+ int write_gdt_on_destroy;
enum fuse4fs_opstate opstate;
int logfd;
@@ -1840,9 +1841,11 @@ static void op_destroy(void *userdata)
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)
@@ -6301,6 +6304,15 @@ static void op_syncfs(fuse_req_t req, fuse_ino_t ino)
}
}
+ /*
+ * 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 (fuse4fs_iomap_enabled(ff))
+ ff->write_gdt_on_destroy = 0;
+
out_unlock:
fuse4fs_finish(ff, ret);
fuse_reply_err(req, -ret);
@@ -8051,6 +8063,7 @@ int main(int argc, char *argv[])
.loop_fd = -1,
#endif
.translate_inums = 1,
+ .write_gdt_on_destroy = 1,
};
errcode_t err;
FILE *orig_stderr = stderr;
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index b6ede4bcb32c27..91b48f5d68b0db 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -268,6 +268,7 @@ struct fuse2fs {
int acl;
int dirsync;
int iomap_passthrough_options;
+ int write_gdt_on_destroy;
enum fuse2fs_opstate opstate;
int logfd;
@@ -1667,9 +1668,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)
@@ -5858,6 +5861,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;
@@ -7494,6 +7506,7 @@ int main(int argc, char *argv[])
#ifdef HAVE_FUSE_LOOPDEV
.loop_fd = -1,
#endif
+ .write_gdt_on_destroy = 1,
};
errcode_t err;
FILE *orig_stderr = stderr;
Powered by blists - more mailing lists