Skip to contentSkip to conversation

f2fs_io: support unset subcommand for pinfile

PATCH In review Chao Yu 2 participants 3 messages Mar 29, 2024 – Apr 10, 2024

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs_io: support unset subcommand for pinfile

This patch adds unset subcommand for pinfile command.

Usage: f2fs_io pinfile unset [target_file]

---
 man/f2fs_io.8           |  2 +-
 tools/f2fs_io/f2fs_io.c | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
man/f2fs_io.8 +1 -1
index f097bde..b9c9dc8 100644
@@ -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
tools/f2fs_io/f2fs_io.c +9 -2
index b8e4f02..a7b593a 100644
@@ -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;
 
Signature · 8 lines
2.40.1



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

Ping,

Missed to check this patch?

Quoted 42 lines · Chao Yu

This patch adds unset subcommand for pinfile command.

Usage: f2fs_io pinfile unset [target_file]

---
  man/f2fs_io.8           |  2 +-
  tools/f2fs_io/f2fs_io.c | 11 +++++++++--
  2 files changed, 10 insertions(+), 3 deletions(-)
man/f2fs_io.8 +1 -1
index f097bde..b9c9dc8 100644
@@ -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
tools/f2fs_io/f2fs_io.c +2 -2
index b8e4f02..a7b593a 100644
@@ -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",

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

Quoted 10 lines
tools/f2fs_io/f2fs_io.c +7 -0
+					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;
 

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

Reviewed-by
#2 lore raw
Quoted 50 lines · Chao Yu

Ping,

Missed to check this patch?

Quoted 44 lines · Chao Yu

This patch adds unset subcommand for pinfile command.

Usage: f2fs_io pinfile unset [target_file]

---
  man/f2fs_io.8           |  2 +-
  tools/f2fs_io/f2fs_io.c | 11 +++++++++--
  2 files changed, 10 insertions(+), 3 deletions(-)
man/f2fs_io.8 +1 -1
index f097bde..b9c9dc8 100644
@@ -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
tools/f2fs_io/f2fs_io.c +4 -2
index b8e4f02..a7b593a 100644
@@ -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")) {
Quoted 9 lines

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

Quoted 8 lines
tools/f2fs_io/f2fs_io.c +5 -0
+             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;
 

Thanks,

Quoted 5 lines

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

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