This patch supports to set or clear nocow flag in f2fs_io Signed-off-by: Chao Yu <c...@kernel.org> --- man/f2fs_io.8 | 4 ++-- tools/f2fs_io/f2fs_io.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/man/f2fs_io.8 b/man/f2fs_io.8 index e58244c..5041c1b 100644 --- a/man/f2fs_io.8 +++ b/man/f2fs_io.8 @@ -16,11 +16,11 @@ Get the flags associated with the specified file. .TP \fBsetflags\fR \fI[flag] [file]\fR Set an f2fs file on specified file. The flag can be casefold, -compression, nocompression, and immutable. +compression, nocompression, immutable, and nocow. .TP \fBclearflags\fR \fI[flag] [file]\fR Clear the specified flag on the target file, which can be compression, - nocompression and immutable. + nocompression, immutable, and nocow. .TP \fBshutdown\fR \fIshutdown filesystem\fR Freeze and stop all IOs for the file system mounted on diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c index 00bfc7a..76f8e84 100644 --- a/tools/f2fs_io/f2fs_io.c +++ b/tools/f2fs_io/f2fs_io.c @@ -291,7 +291,8 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd) " casefold\n" \ " compression\n" \ " nocompression\n" \ -" immutable\n" +" immutable\n" \ +" nocow\n" static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd) { @@ -319,6 +320,8 @@ static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd) flag |= FS_NOCOMP_FL; else if (!strcmp(argv[1], "immutable")) flag |= FS_IMMUTABLE_FL; + else if (!strcmp(argv[1], "nocow")) + flag |= FS_NOCOW_FL; ret = ioctl(fd, F2FS_IOC_SETFLAGS, &flag); printf("set a flag on %s ret=%d, flags=%s\n", argv[2], ret, argv[1]); @@ -332,7 +335,8 @@ static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd) "flag can be\n" \ " compression\n" \ " nocompression\n" \ -" immutable\n" +" immutable\n" \ +" nocow\n" static void do_clearflags(int argc, char **argv, const struct cmd_desc *cmd) { @@ -358,6 +362,8 @@ static void do_clearflags(int argc, char **argv, const struct cmd_desc *cmd) flag &= ~FS_NOCOMP_FL; else if (!strcmp(argv[1], "immutable")) flag &= ~FS_IMMUTABLE_FL; + else if (!strcmp(argv[1], "nocow")) + flag &= ~FS_NOCOW_FL; ret = ioctl(fd, F2FS_IOC_SETFLAGS, &flag); printf("clear a flag on %s ret=%d, flags=%s\n", argv[2], ret, argv[1]); -- 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel