Recent changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit e5b8f91cc6229a5f8b38f1338fad29c800fef179:

  Implement sigaction for Windows. (2012-02-22 21:11:35 +0100)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Jens Axboe (4):
      Remove holes in verify_header structure
      Fix // comment
      verify: put all header verification in one place
      client: exit if no jobs were sent and client is idle

 client.c |   20 +++++++++++++++++---
 verify.c |   29 +++++++++++------------------
 verify.h |    9 +++------
 3 files changed, 31 insertions(+), 27 deletions(-)

---

Diff of recent changes:

diff --git a/client.c b/client.c
index ace70d3..8c85d2b 100644
--- a/client.c
+++ b/client.c
@@ -48,6 +48,7 @@ struct fio_client {
 	unsigned int jobs;
 	int error;
 	int ipv6;
+	int sent_job;
 
 	struct flist_head eta_list;
 	struct client_eta *eta_in_flight;
@@ -481,6 +482,7 @@ static int fio_client_send_ini(struct fio_client *client, const char *filename)
 		return 1;
 	}
 
+	client->sent_job = 1;
 	ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_JOB, buf, sb.st_size, 0);
 	free(buf);
 	close(fd);
@@ -497,6 +499,8 @@ int fio_clients_send_ini(const char *filename)
 
 		if (fio_client_send_ini(client, filename))
 			remove_client(client);
+
+		client->sent_job = 1;
 	}
 
 	return !nr_clients;
@@ -978,8 +982,6 @@ static int fio_client_timed_out(void)
 
 int fio_handle_clients(void)
 {
-	struct fio_client *client;
-	struct flist_head *entry;
 	struct pollfd *pfds;
 	int i, ret = 0, retval = 0;
 
@@ -992,15 +994,27 @@ int fio_handle_clients(void)
 	init_group_run_stat(&client_gs);
 
 	while (!exit_backend && nr_clients) {
+		struct flist_head *entry, *tmp;
+		struct fio_client *client;
+
 		i = 0;
-		flist_for_each(entry, &client_list) {
+		flist_for_each_safe(entry, tmp, &client_list) {
 			client = flist_entry(entry, struct fio_client, list);
 
+			if (!client->sent_job &&
+			    flist_empty(&client->cmd_list)) {
+				remove_client(client);
+				continue;
+			}
+
 			pfds[i].fd = client->fd;
 			pfds[i].events = POLLIN;
 			i++;
 		}
 
+		if (!nr_clients)
+			break;
+
 		assert(i == nr_clients);
 
 		do {
diff --git a/verify.c b/verify.c
index f40d7e1..6621966 100644
--- a/verify.c
+++ b/verify.c
@@ -337,7 +337,7 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
 		if (size > (len - i))
 			size = len - i;
 		if (memcmp(buf + i, pattern + mod, size))
-			// Let the slow compare find the first mismatch byte.
+			/* Let the slow compare find the first mismatch byte. */
 			break;
 		mod = 0;
 	}
@@ -646,11 +646,14 @@ static int verify_trimmed_io_u(struct thread_data *td, struct io_u *io_u)
 	return ret;
 }
 
-static int verify_hdr_crc(struct verify_header *hdr)
+static int verify_header(struct verify_header *hdr)
 {
 	void *p = hdr;
 	uint32_t crc;
 
+	if (hdr->magic != FIO_HDR_MAGIC)
+		return 0;
+
 	crc = crc32c(p, sizeof(*hdr) - sizeof(hdr->crc32));
 	if (crc == hdr->crc32)
 		return 1;
@@ -692,18 +695,10 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
 			memswp(p, p + td->o.verify_offset, header_size);
 		hdr = p;
 
-		if (hdr->fio_magic == FIO_HDR_MAGIC2) {
-			if (!verify_hdr_crc(hdr)) {
-				log_err("fio: bad crc on verify header.\n");
-				return EILSEQ;
-			}
-		} else if (hdr->fio_magic == FIO_HDR_MAGIC) {
-			log_err("fio: v1 headers no longer supported.\n");
-			log_err("fio: re-run the write workload.\n");
-			return EILSEQ;
-		} else {
-			log_err("verify: bad magic header %x, wanted %x at file %s offset %llu, length %u\n",
-				hdr->fio_magic, FIO_HDR_MAGIC2,
+		if (!verify_header(hdr)) {
+			log_err("verify: bad magic header %x, wanted %x at "
+				"file %s offset %llu, length %u\n",
+				hdr->magic, FIO_HDR_MAGIC,
 				io_u->file->file_name,
 				io_u->offset + hdr_num * hdr->len, hdr->len);
 			return EILSEQ;
@@ -860,12 +855,10 @@ static void populate_hdr(struct thread_data *td, struct io_u *io_u,
 
 	p = (void *) hdr;
 
-	hdr->fio_magic = FIO_HDR_MAGIC2;
-	hdr->len = header_len;
+	hdr->magic = FIO_HDR_MAGIC;
 	hdr->verify_type = td->o.verify;
-	hdr->pad1 = 0;
+	hdr->len = header_len;
 	hdr->rand_seed = io_u->rand_seed;
-	hdr->pad2 = 0;
 	hdr->crc32 = crc32c(p, sizeof(*hdr) - sizeof(hdr->crc32));
 
 	data_len = header_len - hdr_size(hdr);
diff --git a/verify.h b/verify.h
index ec7365c..7c238c8 100644
--- a/verify.h
+++ b/verify.h
@@ -3,8 +3,7 @@
 
 #include <stdint.h>
 
-#define FIO_HDR_MAGIC	0xf00baaef
-#define FIO_HDR_MAGIC2	0xf00dbeef
+#define FIO_HDR_MAGIC	0xacca
 
 enum {
 	VERIFY_NONE = 0,		/* no verification */
@@ -29,12 +28,10 @@ enum {
  * data.
  */
 struct verify_header {
-	uint32_t fio_magic;
+	uint16_t magic;
+	uint16_t verify_type;
 	uint32_t len;
-	uint32_t verify_type;
-	uint32_t pad1;
 	uint64_t rand_seed;
-	uint32_t pad2;
 	uint32_t crc32;
 };
 
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux