From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] f2fs_io: support unset subcommand for pinfile
Date: Fri, 29 Mar 2024 18:25:42 +0800 [thread overview]
Message-ID: <20240329102542.3577458-1-chao@kernel.org> (raw)
This patch adds unset subcommand for pinfile command.
Usage: f2fs_io pinfile unset [target_file]
Signed-off-by: Chao Yu <chao@kernel.org>
---
man/f2fs_io.8 | 2 +-
tools/f2fs_io/f2fs_io.c | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/man/f2fs_io.8 b/man/f2fs_io.8
index f097bde..b9c9dc8 100644
--- a/man/f2fs_io.8
+++ b/man/f2fs_io.8
@@ -44,7 +44,7 @@ going down with metadata flush
going down with fsck mark
.RE
.TP
-\fBpinfile\fR \fI[get|set] [file]\fR
+\fBpinfile\fR \fI[get|set|unset] [file]\fR
Get or set the pinning status on a file.
.TP
\fBfadvise\fR \fI[advice] [offset] [length] [file]\fR
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index b8e4f02..a7b593a 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -442,7 +442,7 @@ static void do_fadvise(int argc, char **argv, const struct cmd_desc *cmd)
#define pinfile_desc "pin file control"
#define pinfile_help \
-"f2fs_io pinfile [get|set] [file]\n\n" \
+"f2fs_io pinfile [get|set|unset] [file]\n\n" \
"get/set pinning given the file\n" \
static void do_pinfile(int argc, char **argv, const struct cmd_desc *cmd)
@@ -464,7 +464,14 @@ static void do_pinfile(int argc, char **argv, const struct cmd_desc *cmd)
ret = ioctl(fd, F2FS_IOC_SET_PIN_FILE, &pin);
if (ret != 0)
die_errno("F2FS_IOC_SET_PIN_FILE failed");
- printf("set_pin_file: %u blocks moved in %s\n", ret, argv[2]);
+ printf("%s pinfile: %u blocks moved in %s\n",
+ argv[1], ret, argv[2]);
+ } else if (!strcmp(argv[1], "unset")) {
+ pin = 0;
+ ret = ioctl(fd, F2FS_IOC_SET_PIN_FILE, &pin);
+ if (ret != 0)
+ die_errno("F2FS_IOC_SET_PIN_FILE failed");
+ printf("%s pinfile in %s\n", argv[1], argv[2]);
} else if (!strcmp(argv[1], "get")) {
unsigned int flags;
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2024-03-29 10:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 10:25 Chao Yu [this message]
2024-04-10 3:24 ` [f2fs-dev] [PATCH] f2fs_io: support unset subcommand for pinfile Chao Yu
2024-04-10 17:55 ` Daeho Jeong
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=20240329102542.3577458-1-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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