All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs-tools: apportion atomic write's total delay to its operations
@ 2025-03-31 20:28 ` Daeho Jeong
  0 siblings, 0 replies; 4+ messages in thread
From: Daeho Jeong @ 2025-03-31 20:28 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

To utilize the delay option of atomic write more useful, need to
apportion it to each operation of it.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 tools/f2fs_io/f2fs_io.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 57a931d..292dcb3 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -769,24 +769,30 @@ static void do_write_with_advice(int argc, char **argv,
 		}
 	}
 
+	total_time = get_current_us();
 	if (atomic_commit || atomic_abort) {
 		int ret;
 
 		if (argc == 8)
-			useconds = atoi(argv[7]) * 1000;
+			useconds = atoi(argv[7]) * 1000 / (count + 2);
+
+		if (useconds)
+			usleep(useconds);
 
 		if (replace)
 			ret = ioctl(fd, F2FS_IOC_START_ATOMIC_REPLACE);
 		else
 			ret = ioctl(fd, F2FS_IOC_START_ATOMIC_WRITE);
 
+		if (useconds)
+			usleep(useconds);
+
 		if (ret < 0) {
 			fputs("setting atomic file mode failed\n", stderr);
 			exit(1);
 		}
 	}
 
-	total_time = get_current_us();
 	for (i = 0; i < count; i++) {
 		uint64_t ret;
 
@@ -804,10 +810,10 @@ static void do_write_with_advice(int argc, char **argv,
 		if (ret != buf_size)
 			break;
 		written += ret;
-	}
 
-	if (useconds)
-		usleep(useconds);
+		if (useconds)
+			usleep(useconds);
+	}
 
 	if (atomic_commit) {
 		int ret;
-- 
2.49.0.472.ge94155a9ec-goog



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

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

end of thread, other threads:[~2025-04-07  2:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 20:28 [f2fs-dev] [PATCH] f2fs-tools: apportion atomic write's total delay to its operations Daeho Jeong
2025-03-31 20:28 ` Daeho Jeong
2025-04-07  2:12 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-04-07  2:12   ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.