summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4241ea8)
Both in core and in engines. To the extent possible, this should catch
even fio errors.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
13 files changed:
{
struct guasi_data *ld = td->io_ops->data;
{
struct guasi_data *ld = td->io_ops->data;
+ fio_ro_check(td, io_u);
+
GDBG_PRINT(("fio_guasi_queue(%p)\n", io_u));
if (ld->queued_nr == (int) td->o.iodepth)
return FIO_Q_BUSY;
GDBG_PRINT(("fio_guasi_queue(%p)\n", io_u));
if (ld->queued_nr == (int) td->o.iodepth)
return FIO_Q_BUSY;
{
struct libaio_data *ld = td->io_ops->data;
{
struct libaio_data *ld = td->io_ops->data;
+ fio_ro_check(td, io_u);
+
if (ld->iocbs_nr == (int) td->o.iodepth)
return FIO_Q_BUSY;
if (ld->iocbs_nr == (int) td->o.iodepth)
return FIO_Q_BUSY;
struct fio_file *f = io_u->file;
unsigned long long real_off = io_u->offset - f->file_offset;
struct fio_file *f = io_u->file;
unsigned long long real_off = io_u->offset - f->file_offset;
+ fio_ro_check(td, io_u);
+
if (io_u->ddir == DDIR_READ)
memcpy(io_u->xfer_buf, f->mmap + real_off, io_u->xfer_buflen);
else if (io_u->ddir == DDIR_WRITE)
if (io_u->ddir == DDIR_READ)
memcpy(io_u->xfer_buf, f->mmap + real_off, io_u->xfer_buflen);
else if (io_u->ddir == DDIR_WRITE)
struct netio_data *nd = td->io_ops->data;
int ret;
struct netio_data *nd = td->io_ops->data;
int ret;
+ fio_ro_check(td, io_u);
+
if (io_u->ddir == DDIR_WRITE) {
if (nd->use_splice)
ret = fio_netio_splice_out(td, io_u);
if (io_u->ddir == DDIR_WRITE) {
if (nd->use_splice)
ret = fio_netio_splice_out(td, io_u);
{
struct null_data *nd = td->io_ops->data;
{
struct null_data *nd = td->io_ops->data;
+ fio_ro_check(td, io_u);
+
if (td->io_ops->flags & FIO_SYNCIO)
return FIO_Q_COMPLETED;
if (nd->events)
if (td->io_ops->flags & FIO_SYNCIO)
return FIO_Q_COMPLETED;
if (nd->events)
struct aiocb *aiocb = &io_u->aiocb;
int ret;
struct aiocb *aiocb = &io_u->aiocb;
int ret;
+ fio_ro_check(td, io_u);
+
if (io_u->ddir == DDIR_READ)
ret = aio_read(aiocb);
else if (io_u->ddir == DDIR_WRITE)
if (io_u->ddir == DDIR_READ)
ret = aio_read(aiocb);
else if (io_u->ddir == DDIR_WRITE)
struct sg_io_hdr *hdr = &io_u->hdr;
int ret;
struct sg_io_hdr *hdr = &io_u->hdr;
int ret;
+ fio_ro_check(td, io_u);
+
ret = fio_sgio_doio(td, io_u, io_u->ddir == DDIR_SYNC);
if (ret < 0)
ret = fio_sgio_doio(td, io_u, io_u->ddir == DDIR_SYNC);
if (ret < 0)
*/
static int fio_skeleton_queue(struct thread_data *td, struct io_u *io_u)
{
*/
static int fio_skeleton_queue(struct thread_data *td, struct io_u *io_u)
{
+ /*
+ * Double sanity check to catch errant write on a readonly setup
+ */
+ fio_ro_check(td, io_u);
+
/*
* Could return FIO_Q_QUEUED for a queued request,
* FIO_Q_COMPLETED for a completed request, and FIO_Q_BUSY
/*
* Could return FIO_Q_QUEUED for a queued request,
* FIO_Q_COMPLETED for a completed request, and FIO_Q_BUSY
struct spliceio_data *sd = td->io_ops->data;
int ret;
struct spliceio_data *sd = td->io_ops->data;
int ret;
+ fio_ro_check(td, io_u);
+
if (io_u->ddir == DDIR_READ) {
if (sd->vmsplice_to_user) {
ret = fio_splice_read(td, io_u);
if (io_u->ddir == DDIR_READ) {
if (sd->vmsplice_to_user) {
ret = fio_splice_read(td, io_u);
struct fio_file *f = io_u->file;
int ret;
struct fio_file *f = io_u->file;
int ret;
+ fio_ro_check(td, io_u);
+
if (io_u->ddir == DDIR_READ)
ret = read(f->fd, io_u->xfer_buf, io_u->xfer_buflen);
else if (io_u->ddir == DDIR_WRITE)
if (io_u->ddir == DDIR_READ)
ret = read(f->fd, io_u->xfer_buf, io_u->xfer_buflen);
else if (io_u->ddir == DDIR_WRITE)
{
struct syslet_data *sd = td->io_ops->data;
{
struct syslet_data *sd = td->io_ops->data;
+ fio_ro_check(td, io_u);
+
if (sd->tail) {
sd->tail->next = &io_u->req.atom;
sd->tail = &io_u->req.atom;
if (sd->tail) {
sd->tail->next = &io_u->req.atom;
sd->tail = &io_u->req.atom;
#include <string.h>
#include <getopt.h>
#include <inttypes.h>
#include <string.h>
#include <getopt.h>
#include <inttypes.h>
#include "compiler/compiler.h"
#include "list.h"
#include "compiler/compiler.h"
#include "list.h"
#define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)
#define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND)
#define td_rw(td) (((td)->o.td_ddir & TD_DDIR_RW) == TD_DDIR_RW)
#define td_random(td) ((td)->o.td_ddir & TD_DDIR_RAND)
+static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u)
+{
+ assert(!(io_u->ddir == DDIR_WRITE && !td_write(td)));
+}
+
#define BLOCKS_PER_MAP (8 * sizeof(long))
#define TO_MAP_BLOCK(td, f, b) ((b) - ((f)->file_offset / (td)->o.rw_min_bs))
#define RAND_MAP_IDX(td, f, b) (TO_MAP_BLOCK(td, f, b) / BLOCKS_PER_MAP)
#define BLOCKS_PER_MAP (8 * sizeof(long))
#define TO_MAP_BLOCK(td, f, b) ((b) - ((f)->file_offset / (td)->o.rw_min_bs))
#define RAND_MAP_IDX(td, f, b) (TO_MAP_BLOCK(td, f, b) / BLOCKS_PER_MAP)
int td_io_prep(struct thread_data *td, struct io_u *io_u)
{
int td_io_prep(struct thread_data *td, struct io_u *io_u)
{
+ fio_ro_check(td, io_u);
+
if (td->io_ops->prep)
return td->io_ops->prep(td, io_u);
if (td->io_ops->prep)
return td->io_ops->prep(td, io_u);
+ fio_ro_check(td, io_u);
+
assert((io_u->flags & IO_U_F_FLIGHT) == 0);
io_u->flags |= IO_U_F_FLIGHT;
assert(io_u->file->flags & FIO_FILE_OPEN);
assert((io_u->flags & IO_U_F_FLIGHT) == 0);
io_u->flags |= IO_U_F_FLIGHT;
assert(io_u->file->flags & FIO_FILE_OPEN);
- assert(!(io_u->ddir == DDIR_WRITE && !td_write(td)));
-
io_u->error = 0;
io_u->resid = 0;
io_u->error = 0;
io_u->resid = 0;