Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Jun 20, 2017

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 594f7abb0c3e5ea4174b1d450959305f827cbdfd:

Merge branch 'dev/doc/pkg' of https://github.com/bobsaintcool/fio (2017-06-18 10:32:11 -0600)

are available in the git repository at:

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

for you to fetch changes up to b2fcbe01bdac01bc5d7f8ddea94f264b9f8c2003:

Ensure that thread_stat alignment is correct (2017-06-19 16:41:51 -0600)

----------------------------------------------------------------
Jens Axboe (1):
Update write_hint mechanism to latest API

Omri Mor (1):
Ensure that thread_stat alignment is correct

 cconv.c          |  2 ++
 engines/sync.c   | 26 --------------------------
 fio.h            |  2 +-
 ioengines.c      | 10 +++++-----
 options.c        | 46 ++++++++++++++++++++++++++++------------------
 os/os-linux.h    | 18 +++++++++++++++---
 server.h         |  2 +-
 thread_options.h |  3 +++
 8 files changed, 55 insertions(+), 54 deletions(-)

---

Diff of recent changes:

cconv.c +2 -0
index bf4c517..b8d9ddc 100644
@@ -156,6 +156,7 @@ void convert_thread_options_to_cpu(struct thread_options *o,
 	o->end_fsync = le32_to_cpu(top->end_fsync);
 	o->pre_read = le32_to_cpu(top->pre_read);
 	o->sync_io = le32_to_cpu(top->sync_io);
+	o->write_hint = le32_to_cpu(top->write_hint);
 	o->verify = le32_to_cpu(top->verify);
 	o->do_verify = le32_to_cpu(top->do_verify);
 	o->verifysort = le32_to_cpu(top->verifysort);
@@ -365,6 +366,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
 	top->end_fsync = cpu_to_le32(o->end_fsync);
 	top->pre_read = cpu_to_le32(o->pre_read);
 	top->sync_io = cpu_to_le32(o->sync_io);
+	top->write_hint = cpu_to_le32(o->write_hint);
 	top->verify = cpu_to_le32(o->verify);
 	top->do_verify = cpu_to_le32(o->do_verify);
 	top->verifysort = cpu_to_le32(o->verifysort);
engines/sync.c +0 -26
index 69d5e21..e76bbbb 100644
@@ -36,7 +36,6 @@ struct syncio_data {
 struct psyncv2_options {
 	void *pad;
 	unsigned int hipri;
-	unsigned int stream;
 };
 
 static struct fio_option options[] = {
@@ -50,29 +49,6 @@ static struct fio_option options[] = {
 		.group	= FIO_OPT_G_INVALID,
 	},
 	{
-		.name	= "stream",
-		.lname	= "Stream ID",
-		.type	= FIO_OPT_STR,
-		.off1	= offsetof(struct psyncv2_options, stream),
-		.help	= "Set expected write life time",
-		.category = FIO_OPT_C_ENGINE,
-		.group	= FIO_OPT_G_INVALID,
-		.posval = {
-			  { .ival = "short",
-			    .oval = RWF_WRITE_LIFE_SHORT,
-			  },
-			  { .ival = "medium",
-			    .oval = RWF_WRITE_LIFE_MEDIUM,
-			  },
-			  { .ival = "long",
-			    .oval = RWF_WRITE_LIFE_LONG,
-			  },
-			  { .ival = "extreme",
-			    .oval = RWF_WRITE_LIFE_EXTREME,
-			  },
-		},
-	},
-	{
 		.name	= NULL,
 	},
 };
@@ -158,8 +134,6 @@ static int fio_pvsyncio2_queue(struct thread_data *td, struct io_u *io_u)
 
 	if (o->hipri)
 		flags |= RWF_HIPRI;
-	if (o->stream)
-		flags |= o->stream;
 
 	iov->iov_base = io_u->xfer_buf;
 	iov->iov_len = io_u->xfer_buflen;
fio.h +1 -1
index 963cf03..6c06a0c 100644
@@ -149,7 +149,7 @@ struct thread_data {
 	unsigned int thread_number;
 	unsigned int subjob_number;
 	unsigned int groupid;
-	struct thread_stat ts __attribute__ ((aligned));
+	struct thread_stat ts __attribute__ ((aligned(8)));
 
 	int client_type;
 
ioengines.c +5 -5
index c90a2ca..2d55065 100644
@@ -472,13 +472,13 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
 			goto err;
 		}
 	}
-#ifdef FIO_HAVE_STREAMID
-	if (td->o.fadvise_stream &&
+#ifdef FIO_HAVE_WRITE_HINT
+	if (fio_option_is_set(&td->o, write_hint) &&
 	    (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
-		off_t stream = td->o.fadvise_stream;
+		uint64_t hint = td->o.write_hint;
 
-		if (posix_fadvise(f->fd, stream, f->io_size, POSIX_FADV_STREAMID) < 0) {
-			td_verror(td, errno, "fadvise streamid");
+		if (fcntl(f->fd, F_SET_RW_HINT, &hint) < 0) {
+			td_verror(td, errno, "fcntl write hint");
 			goto err;
 		}
 	}
options.c +28 -18

58 lines not on this page · raw message

os/os-linux.h +15 -3
index 09e7413..3e7a2fc 100644
@@ -303,11 +303,23 @@ static inline int fio_set_sched_idle(void)
 }
 #endif
 
-#ifndef POSIX_FADV_STREAMID
-#define POSIX_FADV_STREAMID	8
+#ifndef F_GET_RW_HINT
+#ifndef F_LINUX_SPECIFIC_BASE
+#define F_LINUX_SPECIFIC_BASE	1024
+#endif
+#define F_GET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 11)
+#define F_SET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 12)
+#endif
+
+#ifndef RWH_WRITE_LIFE_NONE
+#define RWH_WRITE_LIFE_NONE	0
+#define RWH_WRITE_LIFE_SHORT	1
+#define RWH_WRITE_LIFE_MEDIUM	2
+#define RWH_WRITE_LIFE_LONG	3
+#define RWH_WRITE_LIFE_EXTREME	4
 #endif
 
-#define FIO_HAVE_STREAMID
+#define FIO_HAVE_WRITE_HINT
 
 #ifndef RWF_HIPRI
 #define RWF_HIPRI	0x00000001
server.h +1 -1
index fff6804..f002f3b 100644
@@ -49,7 +49,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-	FIO_SERVER_VER			= 62,
+	FIO_SERVER_VER			= 63,
 
 	FIO_SERVER_MAX_FRAGMENT_PDU	= 1024,
 	FIO_SERVER_MAX_CMD_MB		= 2048,
thread_options.h +3 -0
index 493e92e..72d86cf 100644
@@ -102,6 +102,7 @@ struct thread_options {
 	unsigned int end_fsync;
 	unsigned int pre_read;
 	unsigned int sync_io;
+	unsigned int write_hint;
 	unsigned int verify;
 	unsigned int do_verify;
 	unsigned int verifysort;
@@ -376,6 +377,7 @@ struct thread_options_pack {
 	uint32_t end_fsync;
 	uint32_t pre_read;
 	uint32_t sync_io;
+	uint32_t write_hint;
 	uint32_t verify;
 	uint32_t do_verify;
 	uint32_t verifysort;
@@ -417,6 +419,7 @@ struct thread_options_pack {
 
 	uint32_t random_distribution;
 	uint32_t exitall_error;
+	uint32_t pad;
 
 	struct zone_split zone_split[DDIR_RWDIR_CNT][ZONESPLIT_MAX];
 	uint32_t zone_split_nr[DDIR_RWDIR_CNT];