From: Jens Axboe Date: Thu, 14 Dec 2017 16:25:10 +0000 (-0700) Subject: server: cleanup iolog pdu prep X-Git-Tag: fio-3.3~10 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=f54ed5226828e8837b57902369bd61b1c4c3238a;hp=7ff0297f39d0dea72a9b004393ca3c5e5f397760 server: cleanup iolog pdu prep We don't have to memset() the whole thing, we just need to ensure that the members we don't assign are cleared. Remove the memset and initialize the pdu on the stack. Signed-off-by: Jens Axboe --- diff --git a/server.c b/server.c index 62256141..e9792027 100644 --- a/server.c +++ b/server.c @@ -1928,17 +1928,16 @@ static int fio_append_text_log(struct sk_entry *first, struct io_log *log) int fio_send_iolog(struct thread_data *td, struct io_log *log, const char *name) { - struct cmd_iolog_pdu pdu; + struct cmd_iolog_pdu pdu = { + .nr_samples = cpu_to_le64(iolog_nr_samples(log)), + .thread_number = cpu_to_le32(td->thread_number), + .log_type = cpu_to_le32(log->log_type), + .log_hist_coarseness = cpu_to_le32(log->hist_coarseness), + }; struct sk_entry *first; struct flist_head *entry; int ret = 0; - memset(&pdu, 0, sizeof(pdu)); - pdu.nr_samples = cpu_to_le64(iolog_nr_samples(log)); - pdu.thread_number = cpu_to_le32(td->thread_number); - pdu.log_type = cpu_to_le32(log->log_type); - pdu.log_hist_coarseness = cpu_to_le32(log->hist_coarseness); - if (!flist_empty(&log->chunk_list)) pdu.compressed = __cpu_to_le32(STORE_COMPRESSED); else if (use_zlib)