On 2020/5/6 22:39, Jaegeuk Kim wrote: > On 05/06, Chao Yu wrote: >> On 2020/5/2 8:29, Jaegeuk Kim wrote: >>> Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org> >>> --- >>> tools/f2fs_io/f2fs_io.c | 25 +++++++++++++++++++++++++ >>> 1 file changed, 25 insertions(+) >>> >>> diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c >>> index c1edef1..c84b6ab 100644 >>> --- a/tools/f2fs_io/f2fs_io.c >>> +++ b/tools/f2fs_io/f2fs_io.c >>> @@ -130,6 +130,30 @@ static void full_write(int fd, const void *buf, size_t >>> count) >>> } >>> } >>> >>> +#define fsync_desc "fsync" >>> +#define fsync_help \ >>> +"f2fs_io fsync [file]\n\n" \ >> >> What about supporting fdatasync via an additional argument here? > > I prefer to add another command "fdatasync" for simplicity. :P
LGTM as well. :) Thanks > >> >>> +"fsync given the file\n" \ >>> + >>> +static void do_fsync(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 (fsync(fd) != 0) >>> + die_errno("fsync failed"); >>> + >>> + printf("fsync a file\n"); >>> + exit(0); >>> +} >>> + >>> #define set_verity_desc "Set fs-verity" >>> #define set_verity_help \ >>> "f2fs_io set_verity [file]\n\n" \ >>> @@ -780,6 +804,7 @@ static void do_reserve_cblocks(int argc, char **argv, >>> const struct cmd_desc *cmd >>> static void do_help(int argc, char **argv, const struct cmd_desc *cmd); >>> const struct cmd_desc cmd_list[] = { >>> _CMD(help), >>> + CMD(fsync), >>> CMD(set_verity), >>> CMD(getflags), >>> CMD(setflags), >>> > . > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel