@@ -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
@@ -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]);
This patch supports to set or clear nocow flag in f2fs_io Signed-off-by: Chao Yu <chao@kernel.org> --- man/f2fs_io.8 | 4 ++-- tools/f2fs_io/f2fs_io.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-)