Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Feb 4, 2023

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 7d7a704638a1e957c845c04eeac82bdeda0c674c:

lib/pattern: fix formatting (2023-01-31 10:44:54 -0500)

are available in the Git repository at:

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

for you to fetch changes up to d72b10e3ca2f7e3b7ef4e54ea98e4e964a67192d:

fio: add FIO_RO_NEEDS_RW_OPEN ioengine flag (2023-02-03 13:26:32 -0500)

----------------------------------------------------------------
Horshack (1):
Add -replay_skip support for fio-generated I/O logs

Vincent Fu (2):
Merge branch 'master' of https://github.com/horshack-dpreview/fio
fio: add FIO_RO_NEEDS_RW_OPEN ioengine flag

 engines/sg.c |  2 +-
 filesetup.c  |  2 +-
 ioengines.h  |  2 ++
 iolog.c      | 20 ++++++++++++++------
 4 files changed, 18 insertions(+), 8 deletions(-)

---

Diff of recent changes:

engines/sg.c +1 -1
index 24783374..0bb5be4a 100644
@@ -1428,7 +1428,7 @@ static struct ioengine_ops ioengine = {
 	.open_file	= fio_sgio_open,
 	.close_file	= fio_sgio_close,
 	.get_file_size	= fio_sgio_get_file_size,
-	.flags		= FIO_SYNCIO | FIO_RAWIO,
+	.flags		= FIO_SYNCIO | FIO_RAWIO | FIO_RO_NEEDS_RW_OPEN,
 	.options	= options,
 	.option_struct_size	= sizeof(struct sg_options)
 };
filesetup.c +1 -1
index 1d3cc5ad..cb7047c5 100644
@@ -768,7 +768,7 @@ open_again:
 		else
 			from_hash = file_lookup_open(f, flags);
 	} else if (td_read(td)) {
-		if (f->filetype == FIO_TYPE_CHAR && !read_only)
+		if (td_ioengine_flagged(td, FIO_RO_NEEDS_RW_OPEN) && !read_only)
 			flags |= O_RDWR;
 		else
 			flags |= O_RDONLY;
ioengines.h +2 -0
index d43540d0..2cb9743e 100644
@@ -89,6 +89,8 @@ enum fio_ioengine_flags {
 			= 1 << 16,	/* async ioengine with commit function that sets issue_time */
 	FIO_SKIPPABLE_IOMEM_ALLOC
 			= 1 << 17,	/* skip iomem_alloc & iomem_free if job sets mem/iomem */
+	FIO_RO_NEEDS_RW_OPEN
+			= 1 << 18,	/* open files in rw mode even if we have a read job */
 };
 
 /*
iolog.c +14 -6
index 62f2f524..3b296cd7 100644
@@ -492,17 +492,25 @@ static bool read_iolog(struct thread_data *td)
 			 */
 			if (!strcmp(act, "wait"))
 				rw = DDIR_WAIT;
-			else if (!strcmp(act, "read"))
+			else if (!strcmp(act, "read")) {
+				if (td->o.replay_skip & (1u << DDIR_READ))
+					continue;
 				rw = DDIR_READ;
-			else if (!strcmp(act, "write"))
+			} else if (!strcmp(act, "write")) {
+				if (td->o.replay_skip & (1u << DDIR_WRITE))
+					continue;
 				rw = DDIR_WRITE;
-			else if (!strcmp(act, "sync"))
+			} else if (!strcmp(act, "sync")) {
+				if (td->o.replay_skip & (1u << DDIR_SYNC))
+					continue;
 				rw = DDIR_SYNC;
-			else if (!strcmp(act, "datasync"))
+			} else if (!strcmp(act, "datasync"))
 				rw = DDIR_DATASYNC;
-			else if (!strcmp(act, "trim"))
+			else if (!strcmp(act, "trim")) {
+				if (td->o.replay_skip & (1u << DDIR_TRIM))
+					continue;
 				rw = DDIR_TRIM;
-			else {
+			} else {
 				log_err("fio: bad iolog file action: %s\n",
 									act);
 				continue;