Skip to contentSkip to conversation

f2fs_io: add fdatasync

PATCH Superseded LongPing Wei via Linux-f2fs-devel 1 participant 4 messages Sep 27, 2024 – Oct 8, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs_io: add fdatasync

---
 tools/f2fs_io/f2fs_io.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
tools/f2fs_io/f2fs_io.c +25 -0
index 94f0adf..8fbad3c 100644
@@ -174,6 +174,30 @@ static void do_fsync(int argc, char **argv, const struct cmd_desc *cmd)
 	exit(0);
 }
 
+#define fdatasync_desc "fdatasync"
+#define fdatasync_help						\
+"f2fs_io fdatasync [file]\n\n"					\
+"fdatasync given the file\n"					\
+
+static void do_fdatasync(int argc, char **argv, const struct cmd_desc *cmd)
+{
+	int fd;
+
+	if (argc != 2) {
+		fputs("Excess arguments\n\n", stderr);
+		fputs(cmd->cmd_help, stderr);
+		exit(1);
+	}
+
+	fd = xopen(argv[1], O_WRONLY, 0);
+
+	if (fdatasync(fd) != 0)
+		die_errno("fdatasync failed");
+
+	printf("fdatasync a file\n");
+	exit(0);
+}
+
 #define set_verity_desc "Set fs-verity"
 #define set_verity_help					\
 "f2fs_io set_verity [file]\n\n"				\
@@ -1808,6 +1832,7 @@ static void do_help(int argc, char **argv, const struct cmd_desc *cmd);
 const struct cmd_desc cmd_list[] = {
 	_CMD(help),
 	CMD(fsync),
+	CMD(fdatasync),
 	CMD(set_verity),
 	CMD(getflags),
 	CMD(setflags),
Signature · 8 lines
2.34.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw

Hi, Longping,

Missed to update manual of f2fs_io?

Quoted 41 lines · LongPing Wei
---
  tools/f2fs_io/f2fs_io.c | 25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)
tools/f2fs_io/f2fs_io.c +24 -0
index 94f0adf..8fbad3c 100644
@@ -174,6 +174,30 @@ static void do_fsync(int argc, char **argv, const struct cmd_desc *cmd)
  	exit(0);
  }
 
+#define fdatasync_desc "fdatasync"
+#define fdatasync_help						\
+"f2fs_io fdatasync [file]\n\n"					\
+"fdatasync given the file\n"					\
+
+static void do_fdatasync(int argc, char **argv, const struct cmd_desc *cmd)
+{
+	int fd;
+
+	if (argc != 2) {
+		fputs("Excess arguments\n\n", stderr);
+		fputs(cmd->cmd_help, stderr);
+		exit(1);
+	}
+
+	fd = xopen(argv[1], O_WRONLY, 0);
+
+	if (fdatasync(fd) != 0)
+		die_errno("fdatasync failed");
+
+	printf("fdatasync a file\n");
+	exit(0);
+}
+
  #define set_verity_desc "Set fs-verity"
  #define set_verity_help					\
  "f2fs_io set_verity [file]\n\n"				\

tools/f2fs_io/f2fs_io.c static void do_help(int argc, char **argv, const struct cmd_desc *cmd); · line 1838

Quoted 7 lines
tools/f2fs_io/f2fs_io.c +1 -0
@@ -1808,6 +1832,7 @@ static void do_help(int argc, char **argv, const struct cmd_desc *cmd);
  const struct cmd_desc cmd_list[] = {
  	_CMD(help),
  	CMD(fsync),
+	CMD(fdatasync),
  	CMD(set_verity),
  	CMD(getflags),
  	CMD(setflags),

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw

PATCH v2 1/1 f2fs_io: add fdatasync

---
v2: update manual of f2fs_io

---
 man/f2fs_io.8           |  6 ++++++
 tools/f2fs_io/f2fs_io.c | 25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
man/f2fs_io.8 +6 -0
index b9c9dc8..124d662 100644
@@ -11,6 +11,12 @@ administrative purposes.
 \fBset_verity\fR \fI[file]\fR
 Set the verity flags associated with the specified file.
 .TP
+\fBfsync\fR \fI[file]\fR
+fsync given the file.
+.TP
+\fBfdatasync\fR \fI[file]\fR
+fdatasync given the file.
+.TP
 \fBgetflags\fR \fI[file]\fR
 Get the flags associated with the specified file.
 .TP
tools/f2fs_io/f2fs_io.c +25 -0
index 94f0adf..8fbad3c 100644
@@ -174,6 +174,30 @@ static void do_fsync(int argc, char **argv, const struct cmd_desc *cmd)
 	exit(0);
 }
 
+#define fdatasync_desc "fdatasync"
+#define fdatasync_help						\
+"f2fs_io fdatasync [file]\n\n"					\
+"fdatasync given the file\n"					\
+
+static void do_fdatasync(int argc, char **argv, const struct cmd_desc *cmd)
+{
+	int fd;
+
+	if (argc != 2) {
+		fputs("Excess arguments\n\n", stderr);
+		fputs(cmd->cmd_help, stderr);
+		exit(1);
+	}
+
+	fd = xopen(argv[1], O_WRONLY, 0);
+
+	if (fdatasync(fd) != 0)
+		die_errno("fdatasync failed");
+
+	printf("fdatasync a file\n");
+	exit(0);
+}
+
 #define set_verity_desc "Set fs-verity"
 #define set_verity_help					\
 "f2fs_io set_verity [file]\n\n"				\
@@ -1808,6 +1832,7 @@ static void do_help(int argc, char **argv, const struct cmd_desc *cmd);
 const struct cmd_desc cmd_list[] = {
 	_CMD(help),
 	CMD(fsync),
+	CMD(fdatasync),
 	CMD(set_verity),
 	CMD(getflags),
 	CMD(setflags),
Signature · 8 lines
2.34.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel