Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bvanassche/fio
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/bvanassche/fio:
  Introduce enum fio_q_status
  Remove dead code from fio_io_sync()
  gfapi: Make fio_gf_queue() set the I/O unit error status instead of returning -EINVAL
  Change return type of td_io_commit() into void
  Simplify num2str()
  Introduce enum n2s_unit
  Declare stat_calc_lat_nu() static
  • Loading branch information
axboe committed Apr 20, 2018
2 parents 6897af4 + d3b0718 commit 4634d05
Show file tree
Hide file tree
Showing 36 changed files with 126 additions and 107 deletions.
29 changes: 11 additions & 18 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static void cleanup_pending_aio(struct thread_data *td)
static bool fio_io_sync(struct thread_data *td, struct fio_file *f)
{
struct io_u *io_u = __get_io_u(td);
int ret;
enum fio_q_status ret;

if (!io_u)
return true;
Expand All @@ -283,26 +283,23 @@ static bool fio_io_sync(struct thread_data *td, struct fio_file *f)

requeue:
ret = td_io_queue(td, io_u);
if (ret < 0) {
td_verror(td, io_u->error, "td_io_queue");
put_io_u(td, io_u);
return true;
} else if (ret == FIO_Q_QUEUED) {
if (td_io_commit(td))
return true;
switch (ret) {
case FIO_Q_QUEUED:
td_io_commit(td);
if (io_u_queued_complete(td, 1) < 0)
return true;
} else if (ret == FIO_Q_COMPLETED) {
break;
case FIO_Q_COMPLETED:
if (io_u->error) {
td_verror(td, io_u->error, "td_io_queue");
return true;
}

if (io_u_sync_complete(td, io_u) < 0)
return true;
} else if (ret == FIO_Q_BUSY) {
if (td_io_commit(td))
return true;
break;
case FIO_Q_BUSY:
td_io_commit(td);
goto requeue;
}

Expand Down Expand Up @@ -453,8 +450,6 @@ int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret,
enum fio_ddir ddir, uint64_t *bytes_issued, int from_verify,
struct timespec *comp_time)
{
int ret2;

switch (*ret) {
case FIO_Q_COMPLETED:
if (io_u->error) {
Expand Down Expand Up @@ -530,9 +525,7 @@ int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret,
if (!from_verify)
unlog_io_piece(td, io_u);
requeue_io_u(td, &io_u);
ret2 = td_io_commit(td);
if (ret2 < 0)
*ret = ret2;
td_io_commit(td);
break;
default:
assert(*ret < 0);
Expand Down Expand Up @@ -605,7 +598,7 @@ static bool in_flight_overlap(struct io_u_queue *q, struct io_u *io_u)
return overlap;
}

static int io_u_submit(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status io_u_submit(struct thread_data *td, struct io_u *io_u)
{
/*
* Check for overlap if the user asked us to, and we have
Expand Down
3 changes: 2 additions & 1 deletion engines/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ static struct fio_option options[] = {
};


static int fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
static enum fio_q_status
fio_cpuio_queue(struct thread_data *td, struct io_u fio_unused *io_u)
{
struct cpu_options *co = td->eo;

Expand Down
3 changes: 2 additions & 1 deletion engines/dev-dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ static int fio_devdax_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}

static int fio_devdax_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_devdax_queue(struct thread_data *td, struct io_u *io_u)
{
fio_ro_check(td, io_u);
io_u->error = 0;
Expand Down
3 changes: 2 additions & 1 deletion engines/e4defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ static void fio_e4defrag_cleanup(struct thread_data *td)
}


static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u)
{

int ret;
Expand Down
3 changes: 2 additions & 1 deletion engines/falloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static int open_file(struct thread_data *td, struct fio_file *f)
#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
#endif
static int fio_fallocate_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_fallocate_queue(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
int ret;
Expand Down
3 changes: 2 additions & 1 deletion engines/filecreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ static int open_file(struct thread_data *td, struct fio_file *f)
return 0;
}

static int queue_io(struct thread_data *td, struct io_u fio_unused *io_u)
static enum fio_q_status
queue_io(struct thread_data *td, struct io_u fio_unused *io_u)
{
return FIO_Q_COMPLETED;
}
Expand Down
3 changes: 2 additions & 1 deletion engines/ftruncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

#include "../fio.h"

static int fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
int ret;
Expand Down
2 changes: 1 addition & 1 deletion engines/fusion-aw.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct fas_data {
size_t sector_size;
};

static int queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status queue(struct thread_data *td, struct io_u *io_u)
{
struct fas_data *d = FILE_ENG_DATA(io_u->file);
int rc;
Expand Down
4 changes: 2 additions & 2 deletions engines/glusterfs_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ static void gf_async_cb(glfs_fd_t * fd, ssize_t ret, void *data)
iou->io_complete = 1;
}

static int fio_gf_async_queue(struct thread_data fio_unused * td,
struct io_u *io_u)
static enum fio_q_status fio_gf_async_queue(struct thread_data fio_unused * td,
struct io_u *io_u)
{
struct gf_data *g = td->io_ops_data;
int r;
Expand Down
5 changes: 3 additions & 2 deletions engines/glusterfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static int fio_gf_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}

static int fio_gf_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status fio_gf_queue(struct thread_data *td, struct io_u *io_u)
{
struct gf_data *g = td->io_ops_data;
int ret = 0;
Expand All @@ -47,7 +47,8 @@ static int fio_gf_queue(struct thread_data *td, struct io_u *io_u)
ret = glfs_fdatasync(g->fd);
else {
log_err("unsupported operation.\n");
return -EINVAL;
io_u->error = EINVAL;
return FIO_Q_COMPLETED;
}
dprint(FD_FILE, "fio len %lu ret %d\n", io_u->xfer_buflen, ret);
if (io_u->file && ret >= 0 && ddir_rw(io_u->ddir))
Expand Down
3 changes: 2 additions & 1 deletion engines/guasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ static int fio_guasi_getevents(struct thread_data *td, unsigned int min,
return n;
}

static int fio_guasi_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_guasi_queue(struct thread_data *td, struct io_u *io_u)
{
struct guasi_data *ld = td->io_ops_data;

Expand Down
3 changes: 2 additions & 1 deletion engines/libaio.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
return r < 0 ? r : events;
}

static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
{
struct libaio_data *ld = td->io_ops_data;

Expand Down
3 changes: 2 additions & 1 deletion engines/libhdfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ static int fio_hdfsio_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}

static int fio_hdfsio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_hdfsio_queue(struct thread_data *td, struct io_u *io_u)
{
struct hdfsio_data *hd = td->io_ops_data;
struct hdfsio_options *options = td->eo;
Expand Down
3 changes: 2 additions & 1 deletion engines/libpmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ static int fio_libpmem_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}

static int fio_libpmem_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_libpmem_queue(struct thread_data *td, struct io_u *io_u)
{
fio_ro_check(td, io_u);
io_u->error = 0;
Expand Down
3 changes: 2 additions & 1 deletion engines/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ static int fio_mmapio_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}

static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_mmapio_queue(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
struct fio_mmap_data *fmd = FILE_ENG_DATA(f);
Expand Down
3 changes: 2 additions & 1 deletion engines/mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ static int fio_mtd_is_bad(struct thread_data *td,
return ret;
}

static int fio_mtd_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_mtd_queue(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
struct fio_mtd_data *fmd = FILE_ENG_DATA(f);
Expand Down
7 changes: 4 additions & 3 deletions engines/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ static int fio_netio_recv(struct thread_data *td, struct io_u *io_u)
return ret;
}

static int __fio_netio_queue(struct thread_data *td, struct io_u *io_u,
enum fio_ddir ddir)
static enum fio_q_status
__fio_netio_queue(struct thread_data *td, struct io_u *io_u, enum fio_ddir ddir)
{
struct netio_data *nd = td->io_ops_data;
struct netio_options *o = td->eo;
Expand Down Expand Up @@ -687,7 +687,8 @@ static int __fio_netio_queue(struct thread_data *td, struct io_u *io_u,
return FIO_Q_COMPLETED;
}

static int fio_netio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_netio_queue(struct thread_data *td, struct io_u *io_u)
{
struct netio_options *o = td->eo;
int ret;
Expand Down
7 changes: 4 additions & 3 deletions engines/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ static int null_commit(struct thread_data *td, struct null_data *nd)
return 0;
}

static int null_queue(struct thread_data *td, struct null_data *nd,
struct io_u *io_u)
static enum fio_q_status
null_queue(struct thread_data *td, struct null_data *nd, struct io_u *io_u)
{
fio_ro_check(td, io_u);

Expand Down Expand Up @@ -118,7 +118,8 @@ static int fio_null_commit(struct thread_data *td)
return null_commit(td, td->io_ops_data);
}

static int fio_null_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_null_queue(struct thread_data *td, struct io_u *io_u)
{
return null_queue(td, td->io_ops_data, io_u);
}
Expand Down
3 changes: 2 additions & 1 deletion engines/pmemblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ static int fio_pmemblk_get_file_size(struct thread_data *td, struct fio_file *f)
return 0;
}

static int fio_pmemblk_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_pmemblk_queue(struct thread_data *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
fio_pmemblk_file_t pmb = FILE_ENG_DATA(f);
Expand Down
4 changes: 2 additions & 2 deletions engines/posixaio.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ static struct io_u *fio_posixaio_event(struct thread_data *td, int event)
return pd->aio_events[event];
}

static int fio_posixaio_queue(struct thread_data *td,
struct io_u *io_u)
static enum fio_q_status fio_posixaio_queue(struct thread_data *td,
struct io_u *io_u)
{
struct posixaio_data *pd = td->io_ops_data;
os_aiocb_t *aiocb = &io_u->aiocb;
Expand Down
3 changes: 2 additions & 1 deletion engines/rados.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ static void fio_rados_cleanup(struct thread_data *td)
}
}

static int fio_rados_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_rados_queue(struct thread_data *td, struct io_u *io_u)
{
struct rados_data *rados = td->io_ops_data;
struct fio_rados_iou *fri = io_u->engine_data;
Expand Down
3 changes: 2 additions & 1 deletion engines/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ static int fio_rbd_getevents(struct thread_data *td, unsigned int min,
return events;
}

static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_rbd_queue(struct thread_data *td, struct io_u *io_u)
{
struct rbd_data *rbd = td->io_ops_data;
struct fio_rbd_iou *fri = io_u->engine_data;
Expand Down
3 changes: 2 additions & 1 deletion engines/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us,
return i;
}

static int fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u)
{
struct rdmaio_data *rd = td->io_ops_data;

Expand Down
8 changes: 5 additions & 3 deletions engines/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ static int fio_sgio_getevents(struct thread_data *td, unsigned int min,
return r;
}

static int fio_sgio_ioctl_doio(struct thread_data *td,
struct fio_file *f, struct io_u *io_u)
static enum fio_q_status
fio_sgio_ioctl_doio(struct thread_data *td, struct fio_file *f,
struct io_u *io_u)
{
struct sgio_data *sd = td->io_ops_data;
struct sg_io_hdr *hdr = &io_u->hdr;
Expand Down Expand Up @@ -377,7 +378,8 @@ static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}

static int fio_sgio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_sgio_queue(struct thread_data *td, struct io_u *io_u)
{
struct sg_io_hdr *hdr = &io_u->hdr;
int ret, do_sync = 0;
Expand Down
3 changes: 2 additions & 1 deletion engines/skeleton_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ static int fio_skeleton_cancel(struct thread_data *td, struct io_u *io_u)
* io_u->xfer_buflen. Residual data count may be set in io_u->resid
* for a short read/write.
*/
static int fio_skeleton_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_skeleton_queue(struct thread_data *td, struct io_u *io_u)
{
/*
* Double sanity check to catch errant write on a readonly setup
Expand Down
3 changes: 2 additions & 1 deletion engines/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u)
return io_u->xfer_buflen;
}

static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
static enum fio_q_status
fio_spliceio_queue(struct thread_data *td, struct io_u *io_u)
{
struct spliceio_data *sd = td->io_ops_data;
int ret = 0;
Expand Down
Loading

0 comments on commit 4634d05

Please sign in to comment.