Add support for VSOCK to engine/net.c * configure: add option to enable/disable vsock support * engines/net.c: add vsock support The VSOCK address family facilitates communication between virtual machines and the host they are running on. The addressing is formed by 2 integers: <CID, port> - CID: Context ID, it is the ID assigned to the VM 0, 1, 2 CIDs are reserved: 0 - hypervisor CID (rarely used) 1 - local communication (loopback) 2 - host CID (the guest can always reach the host using CID=2) - port: port number on 32bit to reach a specific process * examples: add 3 simple job files for vsock (one sender, one receiver and one that uses vsock loopback interface similar to examples/netio.fio) * fio.1: add vsock to supported protocols together with the required parameters * HOWTO.rst: add vsock to supported protocols together with the required parameters Signed-off-by: Marco Pinna <marco.pinn95@gmail.com>
fio: replace malloc+memset with calloc Clean up the code base by replacing malloc+memset with calloc. This patch was generated from the Coccinelle script below. The script below is inspired by similar scripts used elsewhere: https://lore.kernel.org/linux-btrfs/cover.1443546000.git.silvio.fricke@gmail.com/ https://github.com/coccinelle/coccinellery/blob/master/simple_kzalloc/simple_kzalloc1.cocci @@ expression x,y; statement s; type T; @@ -x = malloc(y * sizeof(T)); +x = calloc(y, sizeof(T)); ( if (!x) s | if (x == NULL) s | ) -memset(x, 0, y * sizeof(T)); @@ expression x,y,z; statement s; @@ -x = malloc(y * sizeof(z)); +x = calloc(y, sizeof(z)); ( if (!x) s | if (x == NULL) s | ) -memset(x, 0, y * sizeof(z)); @@ expression e,x; statement s; @@ -x = malloc(e); +x = calloc(1, e); ( if (!x) s | if (x == NULL) s | ) -memset(x, 0, e); Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Optimize the code that copies strings Using strncpy() to copy strings is suboptimal because strncpy writes a bunch of additional unnecessary null bytes. Use snprintf() instead of strncpy(). An additional advantage of snprintf() is that it guarantees that the output string is '\0'-terminated. This patch is an improvement for commit 32e31c8c5f7b ("Fix string copy compilation warnings"). Cc: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Introduce enum fio_q_status Introduce a new enumeration type fio_q_status. This patch does not change any functionality but makes it clear which variables and return values represent a queuing status value. Bump FIO_IOOPS_VERSION because this patch changes the I/O engine API. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Use POSIX path for poll.h and fcntl.h headers musl complains when using include paths like <sys/poll.h> rather than POSIX's <poll.h> so change the poll.h include path and update the windows poll.h compatibility shim to match. Allegedly sys/poll.h was needed for GLIBCs that were older than 2.3 according to https://www.winehq.org/pipermail/wine-patches/2014-June/132877.html but I can still see that path in an ancient Red Hat 5.0 glibc-devel-2.0.7-32.i386.rpm ... Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Add missing trailing \n in log_err/info() Callers need trailing \n in case of fwrite(3) (if not syslog(3)). These are the ones that seem to need trailing \n not followed by another log function call as consequence. Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Don't malloc/memcpy ioengine_ops on td initialization The only reason load_ioengine() needs to malloc extra space for struct ioengine_ops and memcpy from the original ops is because td has per-thread/process ioengine private data which is a part of this structure. If data (and dlhandle) are separated from struct ioengine_ops, load_ioengine() no longer needs to malloc, as the rest of structure fields such as function pointers and string literal are static. Td only needs a pointer to the original ops. Also avoid memcpying a list_head from the original ops. This commit moves/renames data and dlhandle to struct thread_data as thread_data::io_ops_data and thread_data::io_ops_dlhandle. engines/*.c which access ioengine private data by dereferencing td->io_ops->... are modified accordingly, but nothing more than that. Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>