Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Apr 14, 2016

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 2a442a30385a3b3a338148be46661f4ea3d9eed1:

Modify RDMA engine to print strerror messages. (2016-04-04 10:06:03 -0600)

are available in the git repository at:

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

for you to fetch changes up to bb7816439c44f6f98debd8afd167da14d612574c:

client: bool conversion (2016-04-13 15:53:06 -0600)

----------------------------------------------------------------
Jens Axboe (4):
Fix verify state for multiple files
Cleanup last write logging
t/fio-verify-state: pretty up output a bit
client: bool conversion

 backend.c        |  52 +++++++++++++-----
 client.c         |   4 +-
 client.h         |   6 +--
 file.h           |   7 +++
 fio.h            |   7 ---
 gfio.c           |   2 +-
 init.c           |   4 +-
 io_u.c           |  41 ++++++++------
 server.c         |   4 +-
 server.h         |   2 +-
 t/verify-state.c |  77 ++++++++++++++------------
 verify-state.h   |  34 +++++-------
 verify.c         | 162 ++++++++++++++++++++++++++-----------------------------
 13 files changed, 216 insertions(+), 186 deletions(-)

---

Diff of recent changes:

backend.c +40 -12
index e093f75..1723b8f 100644
@@ -1070,6 +1070,41 @@ reap:
 		bytes_done[i] = td->bytes_done[i] - bytes_done[i];
 }
 
+static void free_file_completion_logging(struct thread_data *td)
+{
+	struct fio_file *f;
+	unsigned int i;
+
+	for_each_file(td, f, i) {
+		if (!f->last_write_comp)
+			break;
+		sfree(f->last_write_comp);
+	}
+}
+
+static int init_file_completion_logging(struct thread_data *td,
+					unsigned int depth)
+{
+	struct fio_file *f;
+	unsigned int i;
+
+	if (td->o.verify == VERIFY_NONE || !td->o.verify_state_save)
+		return 0;
+
+	for_each_file(td, f, i) {
+		f->last_write_comp = scalloc(depth, sizeof(uint64_t));
+		if (!f->last_write_comp)
+			goto cleanup;
+	}
+
+	return 0;
+
+cleanup:
+	free_file_completion_logging(td);
+	log_err("fio: failed to alloc write comp data\n");
+	return 1;
+}
+
 static void cleanup_io_u(struct thread_data *td)
 {
 	struct io_u *io_u;
@@ -1088,8 +1123,7 @@ static void cleanup_io_u(struct thread_data *td)
 	io_u_qexit(&td->io_u_freelist);
 	io_u_qexit(&td->io_u_all);
 
-	if (td->last_write_comp)
-		sfree(td->last_write_comp);
+	free_file_completion_logging(td);
 }
 
 static int init_io_u(struct thread_data *td)
@@ -1206,13 +1240,8 @@ static int init_io_u(struct thread_data *td)
 		p += max_bs;
 	}
 
-	if (td->o.verify != VERIFY_NONE) {
-		td->last_write_comp = scalloc(max_units, sizeof(uint64_t));
-		if (!td->last_write_comp) {
-			log_err("fio: failed to alloc write comp data\n");
-			return 1;
-		}
-	}
+	if (init_file_completion_logging(td, max_units))
+		return 1;
 
 	return 0;
 }
@@ -1964,12 +1993,11 @@ static int fio_verify_load_state(struct thread_data *td)
 
 	if (is_backend) {
 		void *data;
-		int ver;
 
 		ret = fio_server_get_verify_state(td->o.name,
-					td->thread_number - 1, &data, &ver);
+					td->thread_number - 1, &data);
 		if (!ret)
-			verify_convert_assign_state(td, data, ver);
+			verify_assign_state(td, data);
 	} else
 		ret = verify_load_state(td, "local");
 
client.c +2 -2
index 6bc1145..d502a4b 100644
@@ -347,7 +347,7 @@ err:
 	return NULL;
 }
 
-int fio_client_add_ini_file(void *cookie, const char *ini_file, int remote)
+int fio_client_add_ini_file(void *cookie, const char *ini_file, bool remote)
 {
 	struct fio_client *client = cookie;
 	struct client_file *cf;
@@ -789,7 +789,7 @@ static int __fio_client_send_local_ini(struct fio_client *client,
 }
 
 int fio_client_send_ini(struct fio_client *client, const char *filename,
-			int remote)
+			bool remote)
 {
 	int ret;
 
client.h +3 -3
index 7fe09d1..ddacf78 100644
@@ -22,7 +22,7 @@ enum {
 
 struct client_file {
 	char *file;
-	int remote;
+	bool remote;
 };
 
 struct fio_client {
@@ -124,12 +124,12 @@ extern int fio_clients_connect(void);
 extern int fio_start_client(struct fio_client *);
 extern int fio_start_all_clients(void);
 extern int fio_clients_send_ini(const char *);
-extern int fio_client_send_ini(struct fio_client *, const char *, int);
+extern int fio_client_send_ini(struct fio_client *, const char *, bool);
 extern int fio_handle_clients(struct client_ops *);
 extern int fio_client_add(struct client_ops *, const char *, void **);
 extern struct fio_client *fio_client_add_explicit(struct client_ops *, const char *, int, int);
 extern void fio_client_add_cmd_option(void *, const char *);
-extern int fio_client_add_ini_file(void *, const char *, int);
+extern int fio_client_add_ini_file(void *, const char *, bool);
 extern int fio_client_terminate(struct fio_client *);
 extern void fio_clients_terminate(void);
 extern struct fio_client *fio_get_client(struct fio_client *);
file.h +7 -0
index a631766..e7563b8 100644
@@ -98,6 +98,13 @@ struct fio_file {
 	uint64_t last_write;
 
 	/*
+	 * Tracks the last iodepth number of completed writes, if data
+	 * verification is enabled
+	 */
+	uint64_t *last_write_comp;
+	unsigned int last_write_idx;
+
+	/*
 	 * For use by the io engine
 	 */
 	uint64_t engine_data;
fio.h +0 -7
index 30fbde0..829cc81 100644
@@ -154,13 +154,6 @@ struct thread_data {
 	uint64_t stat_io_blocks[DDIR_RWDIR_CNT];
 	struct timeval iops_sample_time;
 
-	/*
-	 * Tracks the last iodepth number of completed writes, if data
-	 * verification is enabled
-	 */
-	uint64_t *last_write_comp;
-	unsigned int last_write_idx;
-
 	volatile int update_rusage;
 	struct fio_mutex *rusage_sem;
 	struct rusage ru_start;
gfio.c +1 -1
index 42d536e..e3bcbdf 100644
@@ -449,7 +449,7 @@ static int send_job_file(struct gui_entry *ge)
 		free(gco);
 	}
 
-	ret = fio_client_send_ini(gc->client, ge->job_file, 0);
+	ret = fio_client_send_ini(gc->client, ge->job_file, false);
 	if (!ret)
 		return 0;
 
init.c +2 -2
index cc33bf0..89e05c0 100644
@@ -2552,14 +2552,14 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
 				    !strncmp(argv[optind], "-", 1))
 					break;
 
-				if (fio_client_add_ini_file(cur_client, argv[optind], 0))
+				if (fio_client_add_ini_file(cur_client, argv[optind], false))
 					break;
 				optind++;
 			}
 			break;
 		case 'R':
 			did_arg = 1;
-			if (fio_client_add_ini_file(cur_client, optarg, 1)) {
+			if (fio_client_add_ini_file(cur_client, optarg, true)) {
 				do_exit++;
 				exit_val = 1;
 			}
io_u.c +24 -17

53 lines not on this page · raw message

server.c +2 -2
index 6416a5c..dcb7c2d 100644
@@ -1819,7 +1819,7 @@ void fio_server_send_start(struct thread_data *td)
 }
 
 int fio_server_get_verify_state(const char *name, int threadnumber,
-				void **datap, int *version)
+				void **datap)
 {
 	struct thread_io_list *s;
 	struct cmd_sendfile out;
@@ -1871,7 +1871,7 @@ fail:
 	 * the header, and the thread_io_list checksum
 	 */
 	s = rep->data + sizeof(struct verify_state_hdr);
-	if (verify_state_hdr(rep->data, s, version)) {
+	if (verify_state_hdr(rep->data, s)) {
 		ret = EILSEQ;
 		goto fail;
 	}
server.h +1 -1
index fd0a0ce..7fc3ec6 100644
@@ -211,7 +211,7 @@ extern void fio_server_send_ts(struct thread_stat *, struct group_run_stats *);
 extern void fio_server_send_gs(struct group_run_stats *);
 extern void fio_server_send_du(void);
 extern void fio_server_send_job_options(struct flist_head *, unsigned int);
-extern int fio_server_get_verify_state(const char *, int, void **, int *);
+extern int fio_server_get_verify_state(const char *, int, void **);
 
 extern struct fio_net_cmd *fio_net_recv_cmd(int sk, bool wait);
 
t/verify-state.c +44 -33

102 lines not on this page · raw message

verify-state.h +14 -20
index 0d004b0..f1dc069 100644
@@ -22,24 +22,20 @@ struct thread_rand_state {
 /*
  * For dumping current write state
  */
-struct thread_io_list {
-	uint64_t no_comps;
-	uint64_t depth;
-	uint64_t numberio;
-	uint64_t index;
-	struct thread_rand_state rand;
-	uint8_t name[64];
-	uint64_t offsets[0];
+struct file_comp {
+	uint64_t fileno;
+	uint64_t offset;
 };
 
-struct thread_io_list_v1 {
+struct thread_io_list {
 	uint64_t no_comps;
-	uint64_t depth;
+	uint32_t depth;
+	uint32_t nofiles;
 	uint64_t numberio;
 	uint64_t index;
-	struct thread_rand32_state rand;
+	struct thread_rand_state rand;
 	uint8_t name[64];
-	uint64_t offsets[0];
+	struct file_comp comps[0];
 };
 
 struct all_io_list {
@@ -47,8 +43,7 @@ struct all_io_list {
 	struct thread_io_list state[0];
 };
 
-#define VSTATE_HDR_VERSION_V1	0x01
-#define VSTATE_HDR_VERSION	0x02
+#define VSTATE_HDR_VERSION	0x03
 
 struct verify_state_hdr {
 	uint64_t version;
@@ -65,18 +60,17 @@ extern void verify_save_state(int mask);
 extern int verify_load_state(struct thread_data *, const char *);
 extern void verify_free_state(struct thread_data *);
 extern int verify_state_should_stop(struct thread_data *, struct io_u *);
-extern void verify_convert_assign_state(struct thread_data *, void *, int);
-extern int verify_state_hdr(struct verify_state_hdr *, struct thread_io_list *,
-				int *);
+extern void verify_assign_state(struct thread_data *, void *);
+extern int verify_state_hdr(struct verify_state_hdr *, struct thread_io_list *);
 
-static inline size_t __thread_io_list_sz(uint64_t depth)
+static inline size_t __thread_io_list_sz(uint32_t depth, uint32_t nofiles)
 {
-	return sizeof(struct thread_io_list) + depth * sizeof(uint64_t);
+	return sizeof(struct thread_io_list) + depth * nofiles * sizeof(struct file_comp);
 }
 
 static inline size_t thread_io_list_sz(struct thread_io_list *s)
 {
-	return __thread_io_list_sz(le64_to_cpu(s->depth));
+	return __thread_io_list_sz(le32_to_cpu(s->depth), le32_to_cpu(s->nofiles));
 }
 
 static inline struct thread_io_list *io_list_next(struct thread_io_list *s)
verify.c +76 -86

248 lines not on this page · raw message