Recent changes (master)

Jens Axboe <[email protected]> Tue, 24 Jun 2025 06:00:02 -0600 (MDT)
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
The following changes since commit 813445e7129240d51216e396a5ba8e19296b6581:

  backend: clean up requeued io_u's (2025-06-05 01:44:43 +0000)

are available in the Git repository at:

  git://git.kernel.dk/fio.git master

for you to fetch changes up to 7037b833e175aae32900b73bf597aad08c1d8472:

  windows: drop nanosleep and clock_gettime (2025-06-23 15:04:34 -0400)

----------------------------------------------------------------
Jens Axboe (1):
      Merge branch 'fix_real_file_size_when_pi_is_enabled' of https://github.com/SuhoSon/fio

Leonid Kozlov (1):
      parse: use minimum delimiter distance

Vincent Fu (2):
      Merge branch 'fix-random-distribution-parsing-failure' of https://github.com/leonid-kozlov/fio
      windows: drop nanosleep and clock_gettime

suho.son (1):
      io_uring: ensure accurate real_file_size setup for full device access with PI enabled

 configure          |  2 --
 engines/io_uring.c |  5 +++-
 os/os-windows.h    |  1 -
 os/windows/posix.c | 72 ------------------------------------------------------
 os/windows/posix.h |  1 -
 parse.c            |  9 ++++---
 6 files changed, 10 insertions(+), 80 deletions(-)

---

Diff of recent changes:

diff --git a/configure b/configure
index 986eb0a6..9e69dc4b 100755
--- a/configure
+++ b/configure
@@ -462,8 +462,6 @@ CYGWIN*)
   build_static="yes"
   rusage_thread="yes"
   fdatasync="yes"
-  clock_gettime="yes" # clock_monotonic probe has dependency on this
-  clock_monotonic="yes"
   sched_idle="yes"
   pthread_condattr_setclock="no"
   pthread_affinity="no"
diff --git a/engines/io_uring.c b/engines/io_uring.c
index 51228037..c87e1cd4 100644
--- a/engines/io_uring.c
+++ b/engines/io_uring.c
@@ -1610,7 +1610,10 @@ static int fio_ioring_cmd_get_file_size(struct thread_data *td,
 			return ret;
 		}
 
-		f->real_file_size = data->lba_size * nlba;
+		if (data->lba_ext)
+			f->real_file_size = data->lba_ext * nlba;
+		else
+			f->real_file_size = data->lba_size * nlba;
 		fio_file_set_size_known(f);
 
 		FILE_SET_ENG_DATA(f, data);
diff --git a/os/os-windows.h b/os/os-windows.h
index 12f33486..909c12e3 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -106,7 +106,6 @@ int fdatasync(int fildes);
 int lstat(const char * path, struct stat * buf);
 uid_t geteuid(void);
 char* ctime_r(const time_t *t, char *buf);
-int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
 ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
 ssize_t pwrite(int fildes, const void *buf, size_t nbyte,
 		off_t offset);
diff --git a/os/windows/posix.c b/os/windows/posix.c
index 3e48c3ff..4c692a1e 100644
--- a/os/windows/posix.c
+++ b/os/windows/posix.c
@@ -549,50 +549,6 @@ return 0;
 #define CLOCK_MONOTONIC_RAW 4
 #endif
 
-/*
- * Get the value of a local clock source.
- * This implementation supports 3 clocks: CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW
- * provide high-accuracy relative time, while CLOCK_REALTIME provides a
- * low-accuracy wall time.
- */
-int clock_gettime(clockid_t clock_id, struct timespec *tp)
-{
-	int rc = 0;
-
-	if (clock_id == CLOCK_MONOTONIC || clock_id == CLOCK_MONOTONIC_RAW) {
-		static LARGE_INTEGER freq = {{0,0}};
-		LARGE_INTEGER counts;
-		uint64_t t;
-
-		QueryPerformanceCounter(&counts);
-		if (freq.QuadPart == 0)
-			QueryPerformanceFrequency(&freq);
-
-		tp->tv_sec = counts.QuadPart / freq.QuadPart;
-		/* Get the difference between the number of ns stored
-		 * in 'tv_sec' and that stored in 'counts' */
-		t = tp->tv_sec * freq.QuadPart;
-		t = counts.QuadPart - t;
-		/* 't' now contains the number of cycles since the last second.
-		 * We want the number of nanoseconds, so multiply out by 1,000,000,000
-		 * and then divide by the frequency. */
-		t *= 1000000000;
-		tp->tv_nsec = t / freq.QuadPart;
-	} else if (clock_id == CLOCK_REALTIME) {
-		/* clock_gettime(CLOCK_REALTIME,...) is just an alias for gettimeofday with a
-		 * higher-precision field. */
-		struct timeval tv;
-		gettimeofday(&tv, NULL);
-		tp->tv_sec = tv.tv_sec;
-		tp->tv_nsec = tv.tv_usec * 1000;
-	} else {
-		errno = EINVAL;
-		rc = -1;
-	}
-
-	return rc;
-}
-
 int mlock(const void * addr, size_t len)
 {
 	SIZE_T min, max;
@@ -937,34 +893,6 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout)
 	return rc;
 }
 
-int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
-{
-	struct timespec tv;
-	DWORD ms_remaining;
-	DWORD ms_total = (rqtp->tv_sec * 1000) + (rqtp->tv_nsec / 1000000.0);
-
-	if (ms_total == 0)
-		ms_total = 1;
-
-	ms_remaining = ms_total;
-
-	/* Since Sleep() can sleep for less than the requested time, add a loop to
-	   ensure we only return after the requested length of time has elapsed */
-	do {
-		fio_gettime(&tv, NULL);
-		Sleep(ms_remaining);
-		ms_remaining = ms_total - mtime_since_now(&tv);
-	} while (ms_remaining > 0 && ms_remaining < ms_total);
-
-	/* this implementation will never sleep for less than the requested time */
-	if (rmtp != NULL) {
-		rmtp->tv_sec = 0;
-		rmtp->tv_nsec = 0;
-	}
-
-	return 0;
-}
-
 DIR *opendir(const char *dirname)
 {
 	struct dirent_ctx *dc = NULL;
diff --git a/os/windows/posix.h b/os/windows/posix.h
index 02a9075b..afb00d5a 100644
--- a/os/windows/posix.h
+++ b/os/windows/posix.h
@@ -3,7 +3,6 @@
 
 typedef int clockid_t;
 
-extern int clock_gettime(clockid_t clock_id, struct timespec *tp);
 extern int inet_aton(const char *, struct in_addr *);
 extern int win_to_posix_error(DWORD winerr);
 
diff --git a/parse.c b/parse.c
index 656a5025..5bb55bff 100644
--- a/parse.c
+++ b/parse.c
@@ -480,14 +480,17 @@ static size_t opt_len(const char *str)
 	char delimiter[] = {',', ':'};
 	char *postfix;
 	unsigned int i;
+	size_t candidate_len;
 
+	size_t prefix_len = strlen(str);
 	for (i = 0; i < FIO_ARRAY_SIZE(delimiter); i++) {
 		postfix = strchr(str, delimiter[i]);
-		if (postfix)
-			return (int)(postfix - str);
+		candidate_len = (size_t)(postfix - str);
+		if (postfix && candidate_len < prefix_len)
+			prefix_len = candidate_len;
 	}
 
-	return strlen(str);
+	return prefix_len;
 }
 
 static int str_match_len(const struct value_pair *vp, const char *str)