From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] f2fs_io: support freeze/thaw
Date: Mon, 3 Nov 2025 14:22:56 +0800 [thread overview]
Message-ID: <20251103062256.2657698-1-chao@kernel.org> (raw)
Support to freeze and thaw filesystem.
Signed-off-by: Chao Yu <chao@kernel.org>
---
man/f2fs_io.8 | 6 ++++++
tools/f2fs_io/f2fs_io.c | 48 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/man/f2fs_io.8 b/man/f2fs_io.8
index 708a583..5c3d204 100644
--- a/man/f2fs_io.8
+++ b/man/f2fs_io.8
@@ -215,6 +215,12 @@ Initialized to create files only.
.B -v
Verbose mode.
.RE
+.TP
+\fBfreeze\fR \fI[directory]\fR
+Freeze filesystem that directory belongs to.
+.TP
+\fBthaw\fR \fI[directory]\fR
+Thaw filesystem that directory belongs to.
.SH AUTHOR
This version of
.B f2fs_io
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 9baea2b..1f26c7c 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -2454,6 +2454,52 @@ static void do_test_lookup_perf(int argc, char **argv, const struct cmd_desc *cm
exit(0);
}
+#define freeze_desc "freeze filesystem"
+#define freeze_help "f2fs_io freeze [directory_path]\n\n"
+
+static void do_freeze(int argc, char **argv, const struct cmd_desc *cmd)
+{
+ int ret, fd;
+
+ if (argc != 2) {
+ fputs("Excess arguments\n\n", stderr);
+ fputs(cmd->cmd_help, stderr);
+ exit(1);
+ }
+
+ fd = xopen(argv[1], O_DIRECTORY, 0);
+
+ ret = ioctl(fd, FIFREEZE);
+ if (ret < 0)
+ die_errno("FIFREEZE failed");
+
+ printf("freeze filesystem ret=%d\n", ret);
+ exit(0);
+}
+
+#define thaw_desc "thaw filesystem"
+#define thaw_help "f2fs_io thaw [directory_path]\n\n"
+
+static void do_thaw(int argc, char **argv, const struct cmd_desc *cmd)
+{
+ int ret, fd;
+
+ if (argc != 2) {
+ fputs("Excess arguments\n\n", stderr);
+ fputs(cmd->cmd_help, stderr);
+ exit(1);
+ }
+
+ fd = xopen(argv[1], O_DIRECTORY, 0);
+
+ ret = ioctl(fd, FITHAW);
+ if (ret < 0)
+ die_errno("FITHAW failed");
+
+ printf("thaw filesystem ret=%d\n", ret);
+ exit(0);
+}
+
#define CMD_HIDDEN 0x0001
#define CMD(name) { #name, do_##name, name##_desc, name##_help, 0 }
#define _CMD(name) { #name, do_##name, NULL, NULL, CMD_HIDDEN }
@@ -2504,6 +2550,8 @@ const struct cmd_desc cmd_list[] = {
CMD(ftruncate),
CMD(test_create_perf),
CMD(test_lookup_perf),
+ CMD(freeze),
+ CMD(thaw),
{ NULL, NULL, NULL, NULL, 0 }
};
--
2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
reply other threads:[~2025-11-03 6:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251103062256.2657698-1-chao@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).