Recent changes (master)
Subsystems (2)
The following changes since commit 69c594d81d4067fadd70fa4909e19d615efa5f1c:
optgroup: move debug code into function (2018-03-20 11:19:19 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 7ad2ddffe2bdc5e47fb86cab276db1db9e350f1b:
sg: fix sign extension (2018-03-21 20:09:36 -0600)
----------------------------------------------------------------
Bart Van Assche (3):
Add an asprintf() implementation
log: Modify the implementation such that it uses asprintf()
verify: Simplify dump_buf()
Jens Axboe (7):
debug: remove extra parens
Merge branch 'asprintf' of https://github.com/bvanassche/fio
server: process STOP/QUIT commands out-of-line
server: handle shared mem pool allocation failures Merge branch 'include_refactor' of https://github.com/sitsofe/fio
server: fix error handling for shared memory handling
sg: fix sign extension
Sitsofe Wheeler (4):
Refactor #includes and headers
Use POSIX path for poll.h and fcntl.h headers
oslib: make str* compat functions more uniform Add include-what-you-use pragmas
Makefile | 1 + arch/arch-x86.h | 2 +- arch/arch-x86_64.h | 2 +- arch/arch.h | 2 + backend.c | 12 ----- blktrace.c | 2 - cconv.c | 1 + cgroup.c | 1 - client.c | 6 +-- client.h | 6 +-- compiler/compiler.h | 3 +- configure | 40 +++++++++++++++ crc/crc32.c | 1 - crc/crc32.h | 2 + crc/crc32c-intel.c | 7 --- crc/crc32c.c | 2 - crc/crc32c.h | 2 + crc/md5.c | 1 - crc/sha1.h | 2 + crc/sha256.c | 1 - crc/sha256.h | 2 + crc/sha3.c | 1 - crc/sha512.c | 1 - crc/sha512.h | 2 + crc/test.c | 5 +- debug.c | 5 +- debug.h | 4 +- diskutil.c | 3 -- diskutil.h | 1 - engines/binject.c | 2 +- engines/e4defrag.c | 4 -- engines/falloc.c | 4 -- engines/filecreate.c | 2 - engines/ftruncate.c | 8 +-- engines/libaio.c | 2 - engines/mmap.c | 1 - engines/mtd.c | 3 -- engines/net.c | 4 +- engines/null.c | 3 -- engines/rdma.c | 2 +- engines/sg.c | 9 ++-- engines/splice.c | 3 +- engines/sync.c | 1 - eta.c | 1 - fifo.c | 1 + fifo.h | 1 - filesetup.c | 2 - fio.c | 5 -- fio.h | 1 + fio_sem.c | 2 +- fio_time.h | 3 ++ gettime-thread.c | 2 - gettime.c | 7 --- gettime.h | 2 + helpers.c | 9 +--- helpers.h | 5 +- idletime.c | 1 + idletime.h | 5 +- init.c | 2 - io_u.c | 4 -- io_u.h | 1 - io_u_queue.h | 2 + ioengines.c | 1 - ioengines.h | 5 +- iolog.c | 2 - iolog.h | 2 + json.c | 1 - json.h | 4 -- lib/bloom.c | 2 - lib/gauss.c | 1 - lib/ieee754.c | 1 - lib/lfsr.c | 1 - lib/memalign.c | 3 +- lib/memalign.h | 2 + lib/memcpy.c | 3 +- lib/num2str.c | 1 + lib/output_buffer.c | 1 - lib/output_buffer.h | 2 +- lib/pattern.c | 2 - lib/pattern.h | 2 - lib/prio_tree.c | 1 + lib/prio_tree.h | 1 - lib/rand.c | 1 - lib/rand.h | 1 - lib/strntol.h | 2 + lib/types.h | 2 +- lib/zipf.c | 6 --- lib/zipf.h | 1 + libfio.c | 1 - log.c | 97 ++++++++++--------------------------- memory.c | 3 +- options.c | 4 -- options.h | 1 - os/os-hpux.h | 2 +- os/os-solaris.h | 2 +- os/os.h | 4 +- os/windows/posix.c | 2 +- os/windows/posix/include/poll.h | 11 +++++ os/windows/posix/include/sys/poll.h | 15 ------ oslib/asprintf.c | 43 ++++++++++++++++ oslib/asprintf.h | 11 +++++ oslib/strcasestr.c | 5 +- oslib/strcasestr.h | 7 +-- oslib/strlcat.c | 4 ++ oslib/strlcat.h | 6 +++ oslib/strndup.c | 5 +- oslib/strndup.h | 9 +++- oslib/strsep.c | 7 ++- oslib/strsep.h | 4 ++ parse.c | 4 +- server.c | 55 +++++++++++++++------ server.h | 3 -- smalloc.c | 8 --- smalloc.h | 2 + stat.c | 3 -- steadystate.c | 1 - steadystate.h | 2 - t/axmap.c | 3 -- t/btrace2fio.c | 2 +- t/dedupe.c | 10 ++-- t/gen-rand.c | 12 ++--- t/genzipf.c | 1 - t/lfsr-test.c | 4 -- td_error.h | 2 + trim.c | 3 -- trim.h | 8 ++- verify.c | 29 +++++------ verify.h | 1 + workqueue.h | 7 +++ 129 files changed, 324 insertions(+), 354 deletions(-) delete mode 100644 os/windows/posix/include/sys/poll.h create mode 100644 oslib/asprintf.c create mode 100644 oslib/asprintf.h
---
Diff of recent changes:
Makefile +1 -0
@@ -104,6 +104,7 @@ endif ifdef CONFIG_RBD SOURCE += engines/rbd.c endif +SOURCE += oslib/asprintf.c ifndef CONFIG_STRSEP SOURCE += oslib/strsep.c endif
arch/arch-x86.h +1 -1
@@ -10,7 +10,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, : "memory"); } -#include "arch-x86-common.h" +#include "arch-x86-common.h" /* IWYU pragma: export */ #define FIO_ARCH (arch_x86)
arch/arch-x86_64.h +1 -1
@@ -10,7 +10,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, : "memory"); } -#include "arch-x86-common.h" +#include "arch-x86-common.h" /* IWYU pragma: export */ #define FIO_ARCH (arch_x86_64)
arch/arch.h +2 -0
@@ -34,6 +34,7 @@ extern unsigned long arch_flags;#define ARCH_CPU_CLOCK_WRAPS +/* IWYU pragma: begin_exports */ #if defined(__i386__)#include "arch-x86.h" #elif defined(__x86_64__)
@@ -66,6 +67,7 @@ extern unsigned long arch_flags;#endif #include "../lib/ffz.h" +/* IWYU pragma: end_exports */ #ifndef ARCH_HAVE_INIT static inline int arch_init (char *envp[])
backend.c +0 -12
@@ -22,29 +22,17 @@* */ #include <unistd.h> -#include <fcntl.h> #include <string.h> -#include <limits.h> #include <signal.h> -#include <time.h> -#include <locale.h> #include <assert.h> -#include <time.h> #include <inttypes.h> #include <sys/stat.h> #include <sys/wait.h> -#include <sys/ipc.h> -#include <sys/mman.h> #include <math.h> #include "fio.h" -#ifndef FIO_NO_HAVE_SHM_H -#include <sys/shm.h> -#endif -#include "hash.h" #include "smalloc.h" #include "verify.h" -#include "trim.h" #include "diskutil.h" #include "cgroup.h" #include "profile.h"
blktrace.c +0 -2
@@ -3,10 +3,8 @@*/ #include <stdio.h> #include <stdlib.h> -#include <sys/stat.h> #include <sys/ioctl.h> #include <linux/fs.h> -#include <dirent.h> #include "flist.h" #include "fio.h"
cconv.c +1 -0
@@ -1,5 +1,6 @@#include <string.h> +#include "log.h" #include "thread_options.h" static void string_to_cpu (char **dst,const uint8_t *src)
cgroup.c +0 -1
@@ -5,7 +5,6 @@#include <stdlib.h> #include <mntent.h> #include <sys/stat.h> -#include <sys/types.h> #include "fio.h" #include "flist.h" #include "cgroup.h"
client.c +2 -4
@@ -1,13 +1,11 @@#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <limits.h> #include <errno.h> #include <fcntl.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/types.h> #include <sys/stat.h> -#include <sys/wait.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h>
@@ -23,7 +21,7 @@#include "server.h" #include "flist.h" #include "hash.h" -#include "verify.h" +#include "verify-state.h" static void handle_du (struct fio_client *client,struct fio_net_cmd *cmd);static void handle_ts (struct fio_client *client,struct fio_net_cmd *cmd);
client.h +2 -4
@@ -1,7 +1,6 @@#ifndef CLIENT_H #define CLIENT_H -#include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <arpa/inet.h>
@@ -10,7 +9,6 @@#include "stat.h" struct fio_net_cmd ; -struct client_ops ;enum { Client_created =0 ,
@@ -83,6 +81,8 @@ typedef void (client_eta_op)(struct jobs_eta *je);typedef void (client_timed_out_op )(struct fio_client *);typedef void (client_jobs_eta_op )(struct fio_client *client,struct jobs_eta *je); +extern struct client_ops fio_client_ops; +struct client_ops {client_cmd_op *text;client_cmd_op *disk_util;
@@ -105,8 +105,6 @@ struct client_ops {uint32_t client_type; }; -extern struct client_ops fio_client_ops; -struct client_eta {unsigned int pending;struct jobs_eta eta;
compiler/compiler.h +2 -1
@@ -1,7 +1,7 @@#ifndef FIO_COMPILER_H #define FIO_COMPILER_H -#include <assert.h> +/* IWYU pragma: begin_exports */ #if __GNUC__ >=4 #include "compiler-gcc4.h" #elif __GNUC__ ==3
@@ -9,6 +9,7 @@#else #error Compiler too old, need gcc at least gcc 3.x#endif +/* IWYU pragma: end_exports */ #ifndef __must_check#define __must_check
configure +40 -0
@@ -784,6 +784,40 @@ fi print_config "rdmacm" "$rdmacm" ########################################## +# asprintf() and vasprintf() probes +if test "$have_asprintf" != "yes" ; then + have_asprintf="no" +fi +cat > $TMPC << EOF +#include <stdio.h> + +int main(int argc, char **argv) +{ + return asprintf(NULL, "%s", "str") == 0; +} +EOF +if compile_prog "" "" "have_asprintf"; then + have_asprintf="yes" +fi +print_config "asprintf()" "$have_asprintf" + +if test "$have_vasprintf" != "yes" ; then + have_vasprintf="no" +fi +cat > $TMPC << EOF +#include <stdio.h> + +int main(int argc, char **argv) +{ + return vasprintf(NULL, "%s", NULL) == 0; +} +EOF +if compile_prog "" "" "have_vasprintf"; then + have_vasprintf="yes" +fi +print_config "vasprintf()" "$have_vasprintf" + +########################################## # Linux fallocate probe if test "$linux_fallocate" != "yes" ; then linux_fallocate="no"
@@ -2169,6 +2203,12 @@ fi if test "$posix_pshared" = "yes" ; then output_sym "CONFIG_PSHARED" fi +if test "$have_asprintf" = "yes" ; then + output_sym "HAVE_ASPRINTF" +fi +if test "$have_vasprintf" = "yes" ; then + output_sym "HAVE_VASPRINTF" +fi if test "$linux_fallocate" = "yes" ; then output_sym "CONFIG_LINUX_FALLOCATE" fi
crc/crc32.c +0 -1
@@ -15,7 +15,6 @@along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <inttypes.h> #include "crc32.h" static const uint32_t crctab[256 ] = {
crc/crc32.h +2 -0
@@ -18,6 +18,8 @@#ifndef CRC32_H #define CRC32_H +#include <inttypes.h> +extern uint32_t fio_crc32 (const void *const ,unsigned long );#endif
crc/crc32c-intel.c +0 -7
@@ -1,10 +1,3 @@ -#include <inttypes.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> #include "crc32c.h" /*
crc/crc32c.c +0 -2
@@ -30,8 +30,6 @@* any later version. * */ -#include <inttypes.h> -#include "crc32c.h" /*
crc/crc32c.h +2 -0
@@ -18,6 +18,8 @@#ifndef CRC32C_H #define CRC32C_H +#include <inttypes.h> +#include "../arch/arch.h" #include "../lib/types.h"
crc/md5.c +0 -1
@@ -2,7 +2,6 @@* Shamelessly lifted from the 2.6 kernel (crypto/md5.c) */ #include <string.h> -#include <stdint.h> #include "md5.h" static void md5_transform (uint32_t *hash,uint32_t const *in)
crc/sha1.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_SHA1 #define FIO_SHA1 +#include <inttypes.h> +/* * Based on the Mozilla SHA1 (see mozilla-sha1/sha1.h), * optimized to do word accesses rather than byte accesses,
crc/sha256.c +0 -1
@@ -17,7 +17,6 @@* */ #include <string.h> -#include <inttypes.h> #include "../lib/bswap.h" #include "sha256.h"
crc/sha256.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_SHA256_H #define FIO_SHA256_H +#include <inttypes.h> +#define SHA256_DIGEST_SIZE 32#define SHA256_BLOCK_SIZE 64
crc/sha3.c +0 -1
@@ -13,7 +13,6 @@* */ #include <string.h> -#include <inttypes.h> #include "../os/os.h"
crc/sha512.c +0 -1
@@ -12,7 +12,6 @@*/ #include <string.h> -#include <inttypes.h> #include "../lib/bswap.h" #include "sha512.h"
crc/sha512.h +2 -0
@@ -1,6 +1,8 @@ #ifndef FIO_SHA512_H #define FIO_SHA512_H +#include <inttypes.h> + struct fio_sha512_ctx { uint64_t state[8]; uint32_t count[4];
crc/test.c +3 -2
@@ -1,11 +1,12 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "../fio.h" #include "../gettime.h" #include "../fio_time.h" -#include "../verify.h" +#include "../lib/rand.h" +#include "../os/os.h" #include "../crc/md5.h" #include "../crc/crc64.h"
debug.c +3 -2
@@ -1,7 +1,8 @@ +#include <assert.h> #include <stdarg.h> -#include <sys/types.h> -#include <unistd.h> +#include "debug.h" +#include "log.h" #ifdef FIO_INC_DEBUG void __dprint (int type,const char *str, ...)
debug.h +1 -3
@@ -1,9 +1,7 @@#ifndef FIO_DEBUG_H #define FIO_DEBUG_H -#include <assert.h> #include "lib/types.h" -#include "log.h" enum { FD_PROCESS = 0,
@@ -61,7 +59,7 @@ void __dprint(int type, const char *str, ...) __attribute__((format (printf, 2, #define dprint(type, str, args...) \ do { \ - if ((((1 << type)) & fio_debug) == 0) \ + if (((1 << type) & fio_debug) == 0) \ break; \ __dprint((type), (str), ##args); \ } while (0) \
diskutil.c +0 -3
@@ -1,13 +1,10 @@#include <stdio.h> #include <string.h> -#include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <dirent.h> #include <libgen.h> -#include <math.h> -#include <assert.h> #ifdef CONFIG_VALGRIND_DEV #include <valgrind/drd.h> #else
diskutil.h +0 -1
@@ -3,7 +3,6 @@#include "json.h" #define FIO_DU_NAME_SZ 64 -#include "lib/output_buffer.h" #include "helper_thread.h" #include "fio_sem.h"
engines/binject.c +1 -1
@@ -11,7 +11,7 @@#include <errno.h> #include <assert.h> #include <string.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/types.h> #include <sys/stat.h>
engines/e4defrag.c +0 -4
@@ -9,11 +9,7 @@#include <sys/types.h> #include <sys/stat.h> #include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/uio.h> #include <errno.h> -#include <assert.h> #include <fcntl.h> #include "../fio.h"
engines/falloc.c +0 -4
@@ -9,11 +9,7 @@* */ #include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/uio.h> #include <errno.h> -#include <assert.h> #include <fcntl.h> #include "../fio.h"
engines/filecreate.c +0 -2
@@ -5,12 +5,10 @@* of the file creation. */ #include <stdio.h> -#include <unistd.h> #include <fcntl.h> #include <errno.h> #include "../fio.h" -#include "../filehash.h" struct fc_data {enum fio_ddir stat_ddir;
engines/ftruncate.c +1 -7
@@ -6,16 +6,10 @@* DDIR_WRITE does ftruncate * */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/uio.h> #include <errno.h> -#include <assert.h> -#include <fcntl.h> +#include <unistd.h> #include "../fio.h" -#include "../filehash.h" static int fio_ftruncate_queue (struct thread_data *td,struct io_u *io_u) {
engines/libaio.c +0 -2
@@ -4,11 +4,9 @@* IO engine using the Linux native aio interface. * */ -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> -#include <assert.h> #include <libaio.h> #include "../fio.h"
engines/mmap.c +0 -1
@@ -7,7 +7,6 @@*/ #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <errno.h> #include <sys/mman.h>
engines/mtd.c +0 -3
@@ -4,17 +4,14 @@* IO engine that reads/writes from MTD character devices. * */ -#include <assert.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <errno.h> #include <sys/ioctl.h> #include <mtd/mtd-user.h> #include "../fio.h" #include "../optgroup.h" -#include "../verify.h" #include "../oslib/libmtd.h" static libmtd_t desc;
engines/net.c +1 -3
@@ -9,13 +9,11 @@#include <unistd.h> #include <signal.h> #include <errno.h> -#include <assert.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> -#include <sys/poll.h> -#include <sys/types.h> +#include <poll.h> #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h>
engines/null.c +0 -3
@@ -13,10 +13,7 @@* LD_LIBRARY_PATH=./engines ./fio examples/cpp_null.fio * */ -#include <stdio.h> #include <stdlib.h> -#include <unistd.h> -#include <errno.h> #include <assert.h> #include "../fio.h"
engines/rdma.c +1 -1
@@ -30,7 +30,7 @@#include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h>
engines/sg.c +5 -4
@@ -8,8 +8,7 @@#include <stdlib.h> #include <unistd.h> #include <errno.h> -#include <assert.h> -#include <sys/poll.h> +#include <poll.h> #include "../fio.h" #include "../optgroup.h"
@@ -456,8 +455,10 @@ static int fio_sgio_read_capacity(struct thread_data *td, unsigned int *bs,return ret; } - *bs = (buf[4 ] <<24 ) | (buf[5 ] <<16 ) | (buf[6 ] <<8 ) | buf[7 ]; - *max_lba = ((buf[0 ] <<24 ) | (buf[1 ] <<16 ) | (buf[2 ] <<8 ) | buf[3 ]) &MAX_10B_LBA ;// for some reason max_lba is being sign extended even though unsigned. + *bs = ((unsigned long ) buf[4 ] <<24 ) | ((unsigned long ) buf[5 ] <<16 ) | + ((unsigned long ) buf[6 ] <<8 ) | (unsigned long ) buf[7 ]; + *max_lba = ((unsigned long ) buf[0 ] <<24 ) | ((unsigned long ) buf[1 ] <<16 ) | + ((unsigned long ) buf[2 ] <<8 ) | (unsigned long ) buf[3 ];/* * If max lba masked by MAX_10B_LBA equals MAX_10B_LBA,
engines/splice.c +1 -2
@@ -9,8 +9,7 @@#include <stdlib.h> #include <unistd.h> #include <errno.h> -#include <assert.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/mman.h> #include "../fio.h"
engines/sync.c +0 -1
@@ -10,7 +10,6 @@#include <unistd.h> #include <sys/uio.h> #include <errno.h> -#include <assert.h> #include "../fio.h" #include "../optgroup.h"
eta.c +0 -1
@@ -2,7 +2,6 @@* Status and ETA code */ #include <unistd.h> -#include <fcntl.h> #include <string.h> #ifdef CONFIG_VALGRIND_DEV #include <valgrind/drd.h>
fifo.c +1 -0
@@ -24,6 +24,7 @@#include <string.h> #include "fifo.h" +#include "minmax.h" struct fifo *fifo_alloc (unsigned int size) {
fifo.h +0 -1
@@ -20,7 +20,6 @@* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include "minmax.h" struct fifo {unsigned char *buffer;/* the buffer holding the data */
filesetup.c +0 -2
@@ -5,8 +5,6 @@#include <dirent.h> #include <libgen.h> #include <sys/stat.h> -#include <sys/mman.h> -#include <sys/types.h> #include "fio.h" #include "smalloc.h"
fio.c +0 -5
@@ -21,12 +21,7 @@* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#include <unistd.h> -#include <locale.h> -#include <time.h> -#include "fio.h" -#include "smalloc.h" int main (int argc,char *argv[],char *envp[]) {
fio.h +1 -0
@@ -27,6 +27,7 @@#include "ioengines.h" #include "iolog.h" #include "helpers.h" +#include "minmax.h" #include "options.h" #include "profile.h" #include "fio_time.h"
fio_sem.c +1 -1
@@ -1,3 +1,4 @@ +#include <stdio.h> #include <string.h> #include <sys/mman.h> #include <assert.h>
@@ -7,7 +8,6 @@#define RUNNING_ON_VALGRIND 0#endif -#include "log.h" #include "fio_sem.h" #include "pshared.h" #include "os/os.h"
fio_time.h +3 -0
@@ -1,8 +1,11 @@#ifndef FIO_TIME_H #define FIO_TIME_H +#include <stdint.h> +/* IWYU pragma: begin_exports */ #include <time.h> #include <sys/time.h> +/* IWYU pragma: end_exports */ #include "lib/types.h" struct thread_data ;
gettime-thread.c +0 -2
@@ -1,5 +1,3 @@ -#include <unistd.h> -#include <math.h> #include <sys/time.h> #include <time.h>
gettime.c +0 -7
@@ -2,16 +2,9 @@* Clock functions */ -#include <unistd.h> #include <math.h> -#include <sys/time.h> -#include <time.h> #include "fio.h" -#include "fio_sem.h" -#include "smalloc.h" - -#include "hash.h" #include "os/os.h" #if defined(ARCH_HAVE_CPU_CLOCK )
gettime.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_GETTIME_H #define FIO_GETTIME_H +#include <sys/time.h> +#include "arch/arch.h" /*
helpers.c +1 -8
@@ -1,13 +1,6 @@ -#include <stdlib.h> #include <errno.h> -#include <sys/socket.h> -#include <sys/time.h> -#include <netinet/in.h> -#include <unistd.h> -#include "compiler/compiler.h" -#include "arch/arch.h" -#include "os/os.h" +#include "helpers.h" #ifndef CONFIG_LINUX_FALLOCATE int fallocate (int fd,int mode,off_t offset,off_t len)
helpers.h +2 -3
@@ -1,10 +1,9 @@#ifndef FIO_HELPERS_H #define FIO_HELPERS_H -#include "compiler/compiler.h" -#include <sys/types.h> -#include <time.h> + +#include "os/os.h" extern int fallocate (int fd,int mode,off_t offset,off_t len);extern int posix_fallocate (int fd,off_t offset,off_t len);
idletime.c +1 -0
@@ -1,4 +1,5 @@#include <math.h> +#include "fio.h" #include "json.h" #include "idletime.h"
idletime.h +3 -2
@@ -1,8 +1,9 @@#ifndef FIO_IDLETIME_H #define FIO_IDLETIME_H -#include "fio.h" -#include "lib/output_buffer.h" +#include <sys/time.h> +#include <sys/types.h> +#include "os/os.h" #define CALIBRATE_RUNS 10#define CALIBRATE_SCALE 1000
init.c +0 -2
@@ -4,13 +4,11 @@#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <fcntl.h> #include <ctype.h> #include <string.h> #include <errno.h> #include <sys/ipc.h> #include <sys/types.h> -#include <sys/stat.h> #include <dlfcn.h> #ifdef CONFIG_VALGRIND_DEV #include <valgrind/drd.h>
io_u.c +0 -4
@@ -1,12 +1,8 @@#include <unistd.h> -#include <fcntl.h> #include <string.h> -#include <signal.h> -#include <time.h> #include <assert.h> #include "fio.h" -#include "hash.h" #include "verify.h" #include "trim.h" #include "lib/rand.h"
io_u.h +0 -1
@@ -3,7 +3,6 @@#include "compiler/compiler.h" #include "os/os.h" -#include "log.h" #include "io_ddir.h" #include "debug.h" #include "file.h"
io_u_queue.h +2 -0
@@ -2,6 +2,8 @@#define FIO_IO_U_QUEUE #include <assert.h> +#include <stddef.h> +#include "lib/types.h" struct io_u ;
ioengines.c +0 -1
@@ -9,7 +9,6 @@* generic io engine that could be used for other projects. * */ -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h>
ioengines.h +3 -2
@@ -1,9 +1,10 @@#ifndef FIO_IOENGINE_H #define FIO_IOENGINE_H +#include <stddef.h> +#include "compiler/compiler.h" -#include "os/os.h" -#include "file.h" +#include "flist.h" #include "io_u.h" #define FIO_IOOPS_VERSION 23
iolog.c +0 -2
@@ -4,7 +4,6 @@*/ #include <stdio.h> #include <stdlib.h> -#include <libgen.h> #include <assert.h> #include <sys/types.h> #include <sys/stat.h>
@@ -15,7 +14,6 @@#include "flist.h" #include "fio.h" -#include "verify.h" #include "trim.h" #include "filelock.h" #include "smalloc.h"
iolog.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_IOLOG_H #define FIO_IOLOG_H +#include <stdio.h> +#include "lib/rbtree.h" #include "lib/ieee754.h" #include "flist.h"
json.c +0 -1
@@ -1,6 +1,5 @@#include <stdlib.h> #include <string.h> -#include <stdio.h> #include <errno.h> #include <stdarg.h> #include "json.h"
json.h +0 -4
@@ -3,10 +3,6 @@#include "lib/output_buffer.h" -struct json_object ; -struct json_array ; -struct json_pair ; -#define JSON_TYPE_STRING 0#define JSON_TYPE_INTEGER 1#define JSON_TYPE_FLOAT 2
lib/bloom.c +0 -2
@@ -1,9 +1,7 @@#include <stdlib.h> -#include <inttypes.h> #include "bloom.h" #include "../hash.h" -#include "../minmax.h" #include "../crc/xxhash.h" #include "../crc/murmur3.h" #include "../crc/crc32c.h"
lib/gauss.c +0 -1
@@ -1,6 +1,5 @@#include <math.h> #include <string.h> -#include <stdio.h> #include "../hash.h" #include "gauss.h"
lib/ieee754.c +0 -1
@@ -5,7 +5,6 @@* * Below code was granted to the public domain. */ -#include <inttypes.h> #include "ieee754.h" uint64_t pack754 (long double f,unsigned bits,unsigned expbits)
lib/lfsr.c +0 -1
@@ -1,5 +1,4 @@#include <stdio.h> -#include <math.h> #include "lfsr.h" #include "../compiler/compiler.h"
lib/memalign.c +1 -2
@@ -1,6 +1,5 @@ -#include <stdlib.h> #include <assert.h> -#include <inttypes.h> +#include <stdlib.h> #include "memalign.h"
lib/memalign.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_MEMALIGN_H #define FIO_MEMALIGN_H +#include <inttypes.h> +extern void *fio_memalign (size_t alignment,size_t size);extern void fio_memfree (void *ptr,size_t size);
lib/memcpy.c +2 -1
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
@@ -6,7 +7,7 @@#include "rand.h" #include "../fio_time.h" #include "../gettime.h" -#include "../fio.h" +#include "../os/os.h" #define BUF_SIZE 32 * 1024 * 1024ULL
lib/num2str.c +1 -0
@@ -1,3 +1,4 @@ +#include <assert.h> #include <stdlib.h> #include <stdio.h> #include <string.h>
lib/output_buffer.c +0 -1
@@ -1,4 +1,3 @@ -#include <stdio.h> #include <string.h> #include <stdlib.h>
lib/output_buffer.h +1 -1
@@ -1,7 +1,7 @@ #ifndef FIO_OUTPUT_BUFFER_H #define FIO_OUTPUT_BUFFER_H -#include <unistd.h> +#include <stddef.h> struct buf_output { char *buf;
lib/pattern.c +0 -2
@@ -4,8 +4,6 @@#include <limits.h> #include <errno.h> #include <assert.h> -#include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <unistd.h>
lib/pattern.h +0 -2
@@ -1,8 +1,6 @@#ifndef FIO_PARSE_PATTERN_H #define FIO_PARSE_PATTERN_H -struct pattern_fmt ; -/** * Pattern format description. The input for 'parse_pattern'. * Describes format with its name and callback, which should
lib/prio_tree.c +1 -0
@@ -11,6 +11,7 @@* 02Feb2004 Initial version */ +#include <assert.h> #include <stdlib.h> #include <limits.h>
lib/prio_tree.h +0 -1
@@ -2,7 +2,6 @@#define _LINUX_PRIO_TREE_H#include <inttypes.h> -#include "../hash.h" struct prio_tree_node {struct prio_tree_node *left;
lib/rand.c +0 -1
@@ -34,7 +34,6 @@*/ #include <string.h> -#include <assert.h> #include "rand.h" #include "pattern.h" #include "../hash.h"
lib/rand.h +0 -1
@@ -4,7 +4,6 @@#include <inttypes.h> #include <assert.h> #include "types.h" -#include "../arch/arch.h" #define FRAND32_MAX (-1U)#define FRAND64_MAX (-1ULL)
lib/strntol.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_STRNTOL_H #define FIO_STRNTOL_H +#include <stdint.h> +long strntol (const char *str,size_t sz,char **end,int base);#endif
lib/types.h +1 -1
@@ -10,7 +10,7 @@ typedef int bool;#define true 1#endif #else -#include <stdbool.h> +#include <stdbool.h> /* IWYU pragma: export */ #endif #endif
lib/zipf.c +0 -6
@@ -1,11 +1,5 @@#include <math.h> #include <string.h> -#include <inttypes.h> -#include <stdio.h> -#include <unistd.h> -#include <sys/types.h> -#include <fcntl.h> -#include "ieee754.h" #include "zipf.h" #include "../minmax.h" #include "../hash.h"
lib/zipf.h +1 -0
@@ -3,6 +3,7 @@#include <inttypes.h> #include "rand.h" +#include "types.h" struct zipf_state {uint64_t nranges;
libfio.c +0 -1
@@ -23,7 +23,6 @@*/ #include <string.h> -#include <sys/types.h> #include <signal.h> #include <stdint.h> #include <locale.h>
log.c +26 -71
148 lines not on this page · raw message
memory.c +1 -2
@@ -1,11 +1,10 @@/* * Memory helpers */ -#include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> +#include <sys/stat.h> #include "fio.h" #ifndef FIO_NO_HAVE_SHM_H
options.c +0 -4
@@ -4,16 +4,12 @@#include <ctype.h> #include <string.h> #include <assert.h> -#include <libgen.h> -#include <fcntl.h> -#include <sys/types.h> #include <sys/stat.h> #include <netinet/in.h> #include "fio.h" #include "verify.h" #include "parse.h" -#include "lib/fls.h" #include "lib/pattern.h" #include "options.h" #include "optgroup.h"
options.h +0 -1
@@ -6,7 +6,6 @@#include <string.h> #include <inttypes.h> #include "parse.h" -#include "flist.h" #include "lib/types.h" int add_option (struct fio_option *);
os/os-hpux.h +1 -1
@@ -6,7 +6,7 @@#include <errno.h> #include <unistd.h> #include <sys/ioctl.h> -#include <sys/fcntl.h> +#include <fcntl.h> #include <sys/fadvise.h> #include <sys/mman.h> #include <sys/mpctl.h>
os/os-solaris.h +1 -1
@@ -7,7 +7,7 @@#include <malloc.h> #include <unistd.h> #include <sys/types.h> -#include <sys/fcntl.h> +#include <fcntl.h> #include <sys/pset.h> #include <sys/mman.h> #include <sys/dkio.h>
os/os.h +3 -1
@@ -8,7 +8,7 @@#include <unistd.h> #include <stdlib.h> -#include "../arch/arch.h" +#include "../arch/arch.h" /* IWYU pragma: export */ #include "../lib/types.h" enum {
@@ -27,6 +27,7 @@ enum { os_nr, }; +/* IWYU pragma: begin_exports */ #if defined(__ANDROID__)#include "os-android.h" #elif defined(__linux__)
@@ -67,6 +68,7 @@ typedef struct aiocb os_aiocb_t;#ifndef CONFIG_STRLCAT #include "../oslib/strlcat.h" #endif +/* IWYU pragma: end_exports */ #ifdef MSG_DONTWAIT #define OS_MSG_DONTWAIT MSG_DONTWAIT
os/windows/posix.c +1 -1
@@ -18,7 +18,7 @@#include <sys/mman.h> #include <sys/uio.h> #include <sys/resource.h> -#include <sys/poll.h> +#include <poll.h> #include <sys/wait.h> #include <setjmp.h>
os/windows/posix/include/poll.h +11 -0
@@ -1,4 +1,15 @@#ifndef POLL_H #define POLL_H +typedef int nfds_t ; + +struct pollfd +{ +int fd; +short events; +short revents; +}; + +int poll (struct pollfd fds[],nfds_t nfds,int timeout); +#endif /* POLL_H */
os/windows/posix/include/sys/poll.h deleted +0 -15
@@ -1,15 +0,0 @@ -#ifndef SYS_POLL_H -#define SYS_POLL_H - -typedef int nfds_t ; - -struct pollfd -{ -int fd; -short events; -short revents; -}; - -int poll (struct pollfd fds[],nfds_t nfds,int timeout); - -#endif /* SYS_POLL_H */
oslib/asprintf.c new file +43 -0
43 lines not on this page · raw message
oslib/asprintf.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef FIO_ASPRINTF_H +#define FIO_ASPRINTF_H + +#ifndef HAVE_VASPRINTF +int vasprintf (char **strp,const char *fmt,va_list ap); +#endif +#ifndef HAVE_ASPRINTF +int asprintf (char **strp,const char *fmt, ...); +#endif + +#endif /* FIO_ASPRINTF_H */
oslib/strcasestr.c +3 -2
@@ -1,7 +1,8 @@ +#ifndef CONFIG_STRCASESTR +#include <ctype.h> #include <stddef.h> - -#ifndef CONFIG_STRCASESTR +#include "strcasestr.h" char *strcasestr (const char *s1,const char *s2) {
oslib/strcasestr.h +2 -5
@@ -1,8 +1,4 @@ -#ifdef CONFIG_STRCASESTR - -#include <string.h> - -#else +#ifndef CONFIG_STRCASESTR #ifndef FIO_STRCASESTR_H #define FIO_STRCASESTR_H
@@ -10,4 +6,5 @@char *strcasestr (const char *haystack,const char *needle);#endif +#endif
oslib/strlcat.c +4 -0
@@ -1,3 +1,5 @@ +#ifndef CONFIG_STRLCAT +#include <string.h> #include "strlcat.h"
@@ -22,3 +24,5 @@ size_t strlcat(char *dst, const char *src, size_t size) return dstlen + srclen; } + +#endif
oslib/strlcat.h +6 -0
@@ -1,6 +1,12 @@ +#ifndef CONFIG_STRLCAT +#ifndef FIO_STRLCAT_H #define FIO_STRLCAT_H +#include <stddef.h> +size_t strlcat (char *dst,const char *src,size_t size);#endif + +#endif
oslib/strndup.c +3 -2
@@ -1,8 +1,9 @@ +#ifndef CONFIG_HAVE_STRNDUP +#include <stdlib.h> +#include <string.h> #include "strndup.h" -#ifndef CONFIG_HAVE_STRNDUP -char *strndup (const char *s,size_t n) {char *str =malloc (n +1 );
oslib/strndup.h +7 -2
@@ -1,7 +1,12 @@ -#include <string.h> -#ifndef CONFIG_HAVE_STRNDUP +#ifndef FIO_STRNDUP_LIB_H +#define FIO_STRNDUP_LIB_H + +#include <stddef.h> +char *strndup (const char *s,size_t n);#endif + +#endif
oslib/strsep.c +6 -1
@@ -1,4 +1,7 @@ -#include <stdio.h> +#ifndef CONFIG_STRSEP + +#include <stddef.h> +#include "strsep.h" char *strsep (char **stringp,const char *delim) {
@@ -27,3 +30,5 @@ char *strsep(char **stringp, const char *delim) } while (sc != 0); }while (1 ); } + +#endif
oslib/strsep.h +4 -0
@@ -1,6 +1,10 @@ +#ifndef CONFIG_STRSEP +#ifndef FIO_STRSEP_LIB_H #define FIO_STRSEP_LIB_H char *strsep (char **,const char *);#endif + +#endif
parse.c +1 -3
@@ -3,18 +3,16 @@*/ #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <ctype.h> #include <string.h> #include <errno.h> #include <limits.h> -#include <stdlib.h> -#include <math.h> #include <float.h> #include "compiler/compiler.h" #include "parse.h" #include "debug.h" +#include "log.h" #include "options.h" #include "optgroup.h" #include "minmax.h"
server.c +40 -15
158 lines not on this page · raw message
server.h +0 -3
@@ -7,7 +7,6 @@#include <netinet/in.h> #include "stat.h" -#include "os/os.h" #include "diskutil.h" #define FIO_NET_PORT 8765
@@ -217,8 +216,6 @@ extern int fio_server_parse_host(const char *, int, struct in_addr *, struct in6extern const char *fio_server_op (unsigned int );extern void fio_server_got_signal (int ); -struct thread_stat ; -struct group_run_stats ;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 );
smalloc.c +0 -8
@@ -3,15 +3,8 @@* that can be shared across processes and threads */ #include <sys/mman.h> -#include <stdio.h> -#include <stdlib.h> #include <assert.h> #include <string.h> -#include <unistd.h> -#include <inttypes.h> -#include <sys/types.h> -#include <limits.h> -#include <fcntl.h> #ifdef CONFIG_VALGRIND_DEV #include <valgrind/valgrind.h> #else
@@ -22,7 +15,6 @@#include "fio.h" #include "fio_sem.h" -#include "arch/arch.h" #include "os/os.h" #include "smalloc.h" #include "log.h"
smalloc.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_SMALLOC_H #define FIO_SMALLOC_H +#include <stddef.h> +extern void *smalloc (size_t );extern void *scalloc (size_t ,size_t );extern void sfree (void *);
stat.c +0 -3
@@ -1,10 +1,7 @@#include <stdio.h> #include <string.h> #include <sys/time.h> -#include <sys/types.h> #include <sys/stat.h> -#include <dirent.h> -#include <libgen.h> #include <math.h> #include "fio.h"
steadystate.c +0 -1
@@ -2,7 +2,6 @@#include "fio.h" #include "steadystate.h" -#include "helper_thread.h" bool steadystate_enabled = false;
steadystate.h +0 -2
@@ -1,9 +1,7 @@#ifndef FIO_STEADYSTATE_H #define FIO_STEADYSTATE_H -#include "stat.h" #include "thread_options.h" -#include "lib/ieee754.h" extern void steadystate_free (struct thread_data *);extern void steadystate_check (void );
t/axmap.c +0 -3
@@ -1,8 +1,5 @@#include <stdio.h> #include <stdlib.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> #include <inttypes.h> #include "../lib/lfsr.h"
t/btrace2fio.c +1 -1
@@ -1,5 +1,4 @@#include <stdio.h> -#include <stdio.h> #include <unistd.h> #include <inttypes.h> #include <math.h>
@@ -12,6 +11,7 @@#include "../blktrace_api.h" #include "../os/os.h" #include "../log.h" +#include "../minmax.h" #include "../oslib/linux-dev-lookup.h" #define TRACE_FIFO_SIZE 8192
t/dedupe.c +3 -7
@@ -3,16 +3,12 @@* just scans the filename for extents of the given size, checksums them, * and orders them up. */ +#include <fcntl.h> +#include <inttypes.h> #include <stdio.h> -#include <stdio.h> +#include <string.h> #include <unistd.h> -#include <inttypes.h> -#include <assert.h> -#include <sys/types.h> #include <sys/stat.h> -#include <sys/ioctl.h> -#include <fcntl.h> -#include <string.h> #include "../flist.h" #include "../log.h"
t/gen-rand.c +3 -9
@@ -1,17 +1,11 @@ +#include <math.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <inttypes.h> -#include <assert.h> -#include <math.h> -#include <string.h> #include "../lib/types.h" -#include "../log.h" -#include "../lib/lfsr.h" -#include "../lib/axmap.h" -#include "../smalloc.h" -#include "../minmax.h" #include "../lib/rand.h" +#include "../log.h" int main (int argc,char *argv[]) {
t/genzipf.c +0 -1
@@ -14,7 +14,6 @@*/ #include <stdio.h> #include <stdlib.h> -#include <fcntl.h> #include <string.h> #include <unistd.h>
t/lfsr-test.c +0 -4
@@ -1,11 +1,7 @@#include <stdio.h> #include <stdlib.h> -#include <time.h> #include <math.h> #include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> #include "../lib/lfsr.h" #include "../gettime.h"
td_error.h +2 -0
@@ -1,6 +1,8 @@#ifndef FIO_TD_ERROR_H #define FIO_TD_ERROR_H +#include "io_ddir.h" +/* * What type of errors to continue on when continue_on_error is used, * and what type of errors to ignore when ignore_error is used.
trim.c +0 -3
@@ -1,11 +1,8 @@/* * TRIM/DISCARD support */ -#include <unistd.h> -#include <fcntl.h> #include <string.h> #include <assert.h> -#include <pthread.h> #include "fio.h" #include "trim.h"
trim.h +6 -2
@@ -1,9 +1,13 @@#ifndef FIO_TRIM_H #define FIO_TRIM_H -#include "fio.h" -#ifdef FIO_HAVE_TRIM +#include "flist.h" +#include "iolog.h" +#include "compiler/compiler.h" +#include "lib/types.h" +#include "os/os.h" +extern bool __must_check get_next_trim (struct thread_data *td,struct io_u *io_u);extern bool io_u_should_trim (struct thread_data *td,struct io_u *io_u);
verify.c +12 -17
@@ -245,33 +245,23 @@ struct vcont {static void dump_buf (char *buf,unsigned int len,unsigned long long offset,const char *type,struct fio_file *f) { -char *ptr, fname[DUMP_BUF_SZ ]; -size_t buf_left =DUMP_BUF_SZ ; +char *ptr, *fname; +char sep[2 ] = {FIO_OS_PATH_SEPARATOR ,0 };int ret, fd; ptr =strdup (f->file_name); -memset (fname,0 ,sizeof (fname)); -if (aux_path) -sprintf (fname,"%s%c" , aux_path,FIO_OS_PATH_SEPARATOR ); - -strncpy (fname +strlen (fname),basename (ptr), buf_left -1 ); - - buf_left -=strlen (fname); -if (buf_left <=0 ) { +if (asprintf (&fname,"%s%s%s.%llu.%s" , aux_path ? :"" , + aux_path ? sep :"" ,basename (ptr), offset, type) <0 ) {if (!fio_did_warn (FIO_WARN_VERIFY_BUF )) -log_err ("fio: verify failure dump buffer too small\n" ); -free (ptr); -return ; +log_err ("fio: not enough memory for dump buffer filename\n" ); + goto free_ptr; } -snprintf (fname +strlen (fname), buf_left,".%llu.%s" , offset, type); - fd =open (fname,O_CREAT |O_TRUNC |O_WRONLY ,0644 );if (fd <0 ) {perror ("open verify buf file" ); -free (ptr); -return ; + goto free_fname; }while (len) {
@@ -288,6 +278,11 @@ static void dump_buf(char *buf, unsigned int len, unsigned long long offset,close (fd);log_err (" %s data dumped as %s\n" , type, fname); + +free_fname: +free (fname); + +free_ptr:free (ptr); }
verify.h +1 -0
@@ -2,6 +2,7 @@#define FIO_VERIFY_H #include <stdint.h> +#include "compiler/compiler.h" #include "verify-state.h" #define FIO_HDR_MAGIC 0xacca
workqueue.h +7 -0
@@ -1,7 +1,14 @@ #ifndef FIO_RATE_H #define FIO_RATE_H +#include <inttypes.h> +#include <pthread.h> + #include "flist.h" +#include "lib/types.h" + +struct sk_out; +struct thread_data; struct workqueue_work { struct flist_head list;