Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync
@ 2020-05-02  0:29 Jaegeuk Kim
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits Jaegeuk Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jaegeuk Kim @ 2020-05-02  0:29 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

Signed-off-by: Jaegeuk Kim <jaegeuk@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"					\
+"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),
-- 
2.26.2.526.g744177e7f7-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits
  2020-05-02  0:29 [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Jaegeuk Kim
@ 2020-05-02  0:29 ` Jaegeuk Kim
  2020-05-06  6:36   ` Chao Yu
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags Jaegeuk Kim
  2020-05-06  6:35 ` [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Chao Yu
  2 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2020-05-02  0:29 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 tools/f2fs_io/f2fs_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index c84b6ab..9be99f0 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -192,7 +192,7 @@ static void do_set_verity(int argc, char **argv, const struct cmd_desc *cmd)
 
 static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
 {
-	long flag;
+	long flag = 0;
 	int ret, fd;
 	int exist = 0;
 
@@ -239,7 +239,7 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
 
 static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd)
 {
-	long flag;
+	long flag = 0;
 	int ret, fd;
 
 	if (argc != 3) {
-- 
2.26.2.526.g744177e7f7-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags
  2020-05-02  0:29 [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Jaegeuk Kim
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits Jaegeuk Kim
@ 2020-05-02  0:29 ` Jaegeuk Kim
  2020-05-06  6:40   ` Chao Yu
  2020-05-06  6:35 ` [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Chao Yu
  2 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2020-05-02  0:29 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 tools/f2fs_io/f2fs_io.c | 28 ++++++++++++++++++++++++++++
 tools/f2fs_io/f2fs_io.h | 12 ++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 9be99f0..d1889ff 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -186,6 +186,10 @@ static void do_set_verity(int argc, char **argv, const struct cmd_desc *cmd)
 "f2fs_io getflags [file]\n\n"					\
 "get a flag given the file\n"					\
 "flag can show \n"						\
+"  encryption\n"						\
+"  nocow(pinned)\n"						\
+"  inline_data\n"						\
+"  verity\n"							\
 "  casefold\n"							\
 "  compression\n"						\
 "  nocompression\n"
@@ -222,6 +226,30 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
 		printf("nocompression");
 		exist = 1;
 	}
+	if (flag & FS_ENCRYPT_FL) {
+		if (exist)
+			printf(",");
+		printf("encrypt");
+		exist = 1;
+	}
+	if (flag & FS_VERITY_FL) {
+		if (exist)
+			printf(",");
+		printf("verity");
+		exist = 1;
+	}
+	if (flag & FS_INLINE_DATA_FL) {
+		if (exist)
+			printf(",");
+		printf("inline_data");
+		exist = 1;
+	}
+	if (flag & FS_NOCOW_FL) {
+		if (exist)
+			printf(",");
+		printf("nocow(pinned)");
+		exist = 1;
+	}
 	if (!exist)
 		printf("none");
 	printf("\n");
diff --git a/tools/f2fs_io/f2fs_io.h b/tools/f2fs_io/f2fs_io.h
index c6ea7ff..2c828bc 100644
--- a/tools/f2fs_io/f2fs_io.h
+++ b/tools/f2fs_io/f2fs_io.h
@@ -110,6 +110,18 @@ typedef u32	__be32;
 #define F2FS_IOC_FSGETXATTR		FS_IOC_FSGETXATTR
 #define F2FS_IOC_FSSETXATTR		FS_IOC_FSSETXATTR
 
+#ifndef FS_ENCRYPT_FL
+#define FS_ENCRYPT_FL			0x00000800 /* Encrypted file */
+#endif
+#ifndef FS_VERITY_FL
+#define FS_VERITY_FL			0x00100000 /* Verity protected inode */
+#endif
+#ifndef FS_INLINE_DATA_FL
+#define FS_INLINE_DATA_FL		0x10000000 /* Reserved for ext4 */
+#endif
+#ifndef FS_NOCOW_FL
+#define FS_NOCOW_FL			0x00800000 /* Do not cow file */
+#endif
 #ifndef FS_NOCOMP_FL
 #define FS_NOCOMP_FL			0x00000400 /* Don't compress */
 #endif
-- 
2.26.2.526.g744177e7f7-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync
  2020-05-02  0:29 [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Jaegeuk Kim
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits Jaegeuk Kim
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags Jaegeuk Kim
@ 2020-05-06  6:35 ` Chao Yu
  2020-05-06 14:39   ` Jaegeuk Kim
  2 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2020-05-06  6:35 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-f2fs-devel

On 2020/5/2 8:29, Jaegeuk Kim wrote:
> Signed-off-by: Jaegeuk Kim <jaegeuk@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?

> +"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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits Jaegeuk Kim
@ 2020-05-06  6:36   ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2020-05-06  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-f2fs-devel

On 2020/5/2 8:29, Jaegeuk Kim wrote:
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags
  2020-05-02  0:29 ` [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags Jaegeuk Kim
@ 2020-05-06  6:40   ` Chao Yu
  2020-05-06 14:40     ` Jaegeuk Kim
  0 siblings, 1 reply; 9+ messages in thread
From: Chao Yu @ 2020-05-06  6:40 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-f2fs-devel

On 2020/5/2 8:29, Jaegeuk Kim wrote:
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  tools/f2fs_io/f2fs_io.c | 28 ++++++++++++++++++++++++++++
>  tools/f2fs_io/f2fs_io.h | 12 ++++++++++++
>  2 files changed, 40 insertions(+)
> 
> diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
> index 9be99f0..d1889ff 100644
> --- a/tools/f2fs_io/f2fs_io.c
> +++ b/tools/f2fs_io/f2fs_io.c
> @@ -186,6 +186,10 @@ static void do_set_verity(int argc, char **argv, const struct cmd_desc *cmd)
>  "f2fs_io getflags [file]\n\n"					\
>  "get a flag given the file\n"					\
>  "flag can show \n"						\
> +"  encryption\n"						\
> +"  nocow(pinned)\n"						\
> +"  inline_data\n"						\
> +"  verity\n"							\
>  "  casefold\n"							\
>  "  compression\n"						\
>  "  nocompression\n"
> @@ -222,6 +226,30 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
>  		printf("nocompression");
>  		exist = 1;
>  	}
> +	if (flag & FS_ENCRYPT_FL) {
> +		if (exist)
> +			printf(",");
> +		printf("encrypt");
> +		exist = 1;
> +	}
> +	if (flag & FS_VERITY_FL) {
> +		if (exist)
> +			printf(",");
> +		printf("verity");
> +		exist = 1;
> +	}
> +	if (flag & FS_INLINE_DATA_FL) {
> +		if (exist)
> +			printf(",");
> +		printf("inline_data");
> +		exist = 1;
> +	}
> +	if (flag & FS_NOCOW_FL) {
> +		if (exist)
> +			printf(",");
> +		printf("nocow(pinned)");
> +		exist = 1;
> +	}
>  	if (!exist)
>  		printf("none");
>  	printf("\n");
> diff --git a/tools/f2fs_io/f2fs_io.h b/tools/f2fs_io/f2fs_io.h
> index c6ea7ff..2c828bc 100644
> --- a/tools/f2fs_io/f2fs_io.h
> +++ b/tools/f2fs_io/f2fs_io.h
> @@ -110,6 +110,18 @@ typedef u32	__be32;
>  #define F2FS_IOC_FSGETXATTR		FS_IOC_FSGETXATTR
>  #define F2FS_IOC_FSSETXATTR		FS_IOC_FSSETXATTR
>  
> +#ifndef FS_ENCRYPT_FL
> +#define FS_ENCRYPT_FL			0x00000800 /* Encrypted file */
> +#endif
> +#ifndef FS_VERITY_FL
> +#define FS_VERITY_FL			0x00100000 /* Verity protected inode */
> +#endif
> +#ifndef FS_INLINE_DATA_FL
> +#define FS_INLINE_DATA_FL		0x10000000 /* Reserved for ext4 */

/* Inline data regular/symlink */

> +#endif
> +#ifndef FS_NOCOW_FL
> +#define FS_NOCOW_FL			0x00800000 /* Do not cow file */
> +#endif
>  #ifndef FS_NOCOMP_FL
>  #define FS_NOCOMP_FL			0x00000400 /* Don't compress */
>  #endif
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync
  2020-05-06  6:35 ` [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Chao Yu
@ 2020-05-06 14:39   ` Jaegeuk Kim
  2020-05-07  2:45     ` Chao Yu
  0 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2020-05-06 14:39 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel

On 05/06, Chao Yu wrote:
> On 2020/5/2 8:29, Jaegeuk Kim wrote:
> > Signed-off-by: Jaegeuk Kim <jaegeuk@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

> 
> > +"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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags
  2020-05-06  6:40   ` Chao Yu
@ 2020-05-06 14:40     ` Jaegeuk Kim
  0 siblings, 0 replies; 9+ messages in thread
From: Jaegeuk Kim @ 2020-05-06 14:40 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel

On 05/06, Chao Yu wrote:
> On 2020/5/2 8:29, Jaegeuk Kim wrote:
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  tools/f2fs_io/f2fs_io.c | 28 ++++++++++++++++++++++++++++
> >  tools/f2fs_io/f2fs_io.h | 12 ++++++++++++
> >  2 files changed, 40 insertions(+)
> > 
> > diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
> > index 9be99f0..d1889ff 100644
> > --- a/tools/f2fs_io/f2fs_io.c
> > +++ b/tools/f2fs_io/f2fs_io.c
> > @@ -186,6 +186,10 @@ static void do_set_verity(int argc, char **argv, const struct cmd_desc *cmd)
> >  "f2fs_io getflags [file]\n\n"					\
> >  "get a flag given the file\n"					\
> >  "flag can show \n"						\
> > +"  encryption\n"						\
> > +"  nocow(pinned)\n"						\
> > +"  inline_data\n"						\
> > +"  verity\n"							\
> >  "  casefold\n"							\
> >  "  compression\n"						\
> >  "  nocompression\n"
> > @@ -222,6 +226,30 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
> >  		printf("nocompression");
> >  		exist = 1;
> >  	}
> > +	if (flag & FS_ENCRYPT_FL) {
> > +		if (exist)
> > +			printf(",");
> > +		printf("encrypt");
> > +		exist = 1;
> > +	}
> > +	if (flag & FS_VERITY_FL) {
> > +		if (exist)
> > +			printf(",");
> > +		printf("verity");
> > +		exist = 1;
> > +	}
> > +	if (flag & FS_INLINE_DATA_FL) {
> > +		if (exist)
> > +			printf(",");
> > +		printf("inline_data");
> > +		exist = 1;
> > +	}
> > +	if (flag & FS_NOCOW_FL) {
> > +		if (exist)
> > +			printf(",");
> > +		printf("nocow(pinned)");
> > +		exist = 1;
> > +	}
> >  	if (!exist)
> >  		printf("none");
> >  	printf("\n");
> > diff --git a/tools/f2fs_io/f2fs_io.h b/tools/f2fs_io/f2fs_io.h
> > index c6ea7ff..2c828bc 100644
> > --- a/tools/f2fs_io/f2fs_io.h
> > +++ b/tools/f2fs_io/f2fs_io.h
> > @@ -110,6 +110,18 @@ typedef u32	__be32;
> >  #define F2FS_IOC_FSGETXATTR		FS_IOC_FSGETXATTR
> >  #define F2FS_IOC_FSSETXATTR		FS_IOC_FSSETXATTR
> >  
> > +#ifndef FS_ENCRYPT_FL
> > +#define FS_ENCRYPT_FL			0x00000800 /* Encrypted file */
> > +#endif
> > +#ifndef FS_VERITY_FL
> > +#define FS_VERITY_FL			0x00100000 /* Verity protected inode */
> > +#endif
> > +#ifndef FS_INLINE_DATA_FL
> > +#define FS_INLINE_DATA_FL		0x10000000 /* Reserved for ext4 */
> 
> /* Inline data regular/symlink */

Done.

> 
> > +#endif
> > +#ifndef FS_NOCOW_FL
> > +#define FS_NOCOW_FL			0x00800000 /* Do not cow file */
> > +#endif
> >  #ifndef FS_NOCOMP_FL
> >  #define FS_NOCOMP_FL			0x00000400 /* Don't compress */
> >  #endif
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync
  2020-05-06 14:39   ` Jaegeuk Kim
@ 2020-05-07  2:45     ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2020-05-07  2:45 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel

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 <jaegeuk@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02  0:29 [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Jaegeuk Kim
2020-05-02  0:29 ` [f2fs-dev] [PATCH 2/3] f2fs_io: don't give garbage data in upper 32bits Jaegeuk Kim
2020-05-06  6:36   ` Chao Yu
2020-05-02  0:29 ` [f2fs-dev] [PATCH 3/3] f2fs_io: show more flags Jaegeuk Kim
2020-05-06  6:40   ` Chao Yu
2020-05-06 14:40     ` Jaegeuk Kim
2020-05-06  6:35 ` [f2fs-dev] [PATCH 1/3] f2fs_io: add fsync Chao Yu
2020-05-06 14:39   ` Jaegeuk Kim
2020-05-07  2:45     ` Chao Yu

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git