int opcode; /* Actual command fields */
void *buf;
off_t size;
- uint64_t *tagptr;
+ uint64_t tag;
struct flist_head next; /* Other sk_entry's, if linked command */
};
entry->buf = buf;
entry->size = size;
- entry->tagptr = tagptr;
+ if (tagptr)
+ entry->tag = *tagptr;
+ else
+ entry->tag = 0;
entry->flags = flags;
return entry;
}
sfree(entry);
}
-static void entry_set_flags_tag(struct sk_entry *entry, struct flist_head *list,
- unsigned int *flags, uint64_t *tag)
+static void entry_set_flags(struct sk_entry *entry, struct flist_head *list,
+ unsigned int *flags)
{
if (!flist_empty(list))
*flags = FIO_NET_CMD_F_MORE;
else
*flags = 0;
-
- if (entry->tagptr)
- *tag = *entry->tagptr;
- else
- *tag = 0;
}
static int send_vec_entry(struct sk_out *sk_out, struct sk_entry *first)
{
unsigned int flags;
- uint64_t tag;
int ret;
- entry_set_flags_tag(first, &first->next, &flags, &tag);
+ entry_set_flags(first, &first->next, &flags);
- ret = fio_send_cmd_ext_pdu(sk_out->sk, first->opcode, first->buf, first->size, tag, flags);
+ ret = fio_send_cmd_ext_pdu(sk_out->sk, first->opcode, first->buf,
+ first->size, first->tag, flags);
while (!flist_empty(&first->next)) {
struct sk_entry *next;
next = flist_first_entry(&first->next, struct sk_entry, list);
flist_del_init(&next->list);
- entry_set_flags_tag(next, &first->next, &flags, &tag);
+ entry_set_flags(next, &first->next, &flags);
- ret += fio_send_cmd_ext_pdu(sk_out->sk, next->opcode, next->buf, next->size, tag, flags);
+ ret += fio_send_cmd_ext_pdu(sk_out->sk, next->opcode, next->buf,
+ next->size, next->tag, flags);
finish_entry(next);
}
if (entry->flags & SK_F_VEC)
ret = send_vec_entry(sk_out, entry);
else if (entry->flags & SK_F_SIMPLE) {
- uint64_t tag = 0;
-
- if (entry->tagptr)
- tag = *entry->tagptr;
-
- ret = fio_net_send_simple_cmd(sk_out->sk, entry->opcode, tag, NULL);
- } else
- ret = fio_net_send_cmd(sk_out->sk, entry->opcode, entry->buf, entry->size, entry->tagptr, NULL);
+ ret = fio_net_send_simple_cmd(sk_out->sk, entry->opcode,
+ entry->tag, NULL);
+ } else {
+ ret = fio_net_send_cmd(sk_out->sk, entry->opcode, entry->buf,
+ entry->size, &entry->tag, NULL);
+ }
fio_mutex_up(&sk_out->xmit);
}
}
-static int fio_send_iolog_gz(struct sk_entry *first, struct io_log *log)
+static int fio_append_iolog_gz(struct sk_entry *first, struct io_log *log)
{
int ret = 0;
#ifdef CONFIG_ZLIB
return ret;
}
-static int fio_send_gz_chunks(struct sk_entry *first, struct io_log *log)
+static int fio_append_gz_chunks(struct sk_entry *first, struct io_log *log)
{
struct sk_entry *entry;
struct flist_head *node;
return 0;
}
+static int fio_append_text_log(struct sk_entry *first, struct io_log *log)
+{
+ struct sk_entry *entry;
+ size_t size = log->nr_samples * log_entry_sz(log);
+
+ entry = fio_net_prep_cmd(FIO_NET_CMD_IOLOG, log->log, size,
+ NULL, SK_F_VEC | SK_F_INLINE);
+ flist_add_tail(&entry->list, &first->next);
+ return 0;
+}
+
int fio_send_iolog(struct thread_data *td, struct io_log *log, const char *name)
{
struct cmd_iolog_pdu pdu;
first = fio_net_prep_cmd(FIO_NET_CMD_IOLOG, &pdu, sizeof(pdu), NULL, SK_F_VEC | SK_F_INLINE | SK_F_COPY);
/*
- * Now append actual log entries. Compress if we can, otherwise just
- * plain text output.
+ * Now append actual log entries. If log compression was enabled on
+ * the job, just send out the compressed chunks directly. If we
+ * have a plain log, compress if we can, then send. Otherwise, send
+ * the plain text output.
*/
if (!flist_empty(&log->chunk_list))
- ret = fio_send_gz_chunks(first, log);
+ ret = fio_append_gz_chunks(first, log);
else if (use_zlib)
- ret = fio_send_iolog_gz(first, log);
- else {
- struct sk_entry *entry;
- size_t size = log->nr_samples * log_entry_sz(log);
-
- entry = fio_net_prep_cmd(FIO_NET_CMD_IOLOG, log->log, size,
- NULL, SK_F_VEC | SK_F_INLINE);
- flist_add_tail(&entry->list, &first->next);
- }
+ ret = fio_append_iolog_gz(first, log);
+ else
+ ret = fio_append_text_log(first, log);
fio_net_queue_entry(first);
return ret;
pdu.groupid = cpu_to_le32(td->groupid);
convert_thread_options_to_net(&pdu.top, &td->o);
- fio_net_queue_cmd(FIO_NET_CMD_ADD_JOB, &pdu, sizeof(pdu), NULL, SK_F_COPY);
+ fio_net_queue_cmd(FIO_NET_CMD_ADD_JOB, &pdu, sizeof(pdu), NULL,
+ SK_F_COPY);
}
void fio_server_send_start(struct thread_data *td)
verify_state_gen_name((char *) out.path, sizeof(out.path), name, me,
threadnumber);
tag = (uint64_t) (uintptr_t) rep;
- fio_net_queue_cmd(FIO_NET_CMD_SENDFILE, &out, sizeof(out), &tag, SK_F_COPY);
+ fio_net_queue_cmd(FIO_NET_CMD_SENDFILE, &out, sizeof(out), &tag,
+ SK_F_COPY);
/*
* Wait for the backend to receive the reply
}
if (rep->error) {
- log_err("fio: failure on receiving state file: %s\n", strerror(rep->error));
+ log_err("fio: failure on receiving state file: %s\n",
+ strerror(rep->error));
fail:
*datap = NULL;
sfree(rep);