X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fsg.c;h=b9033b8f7c2a0c8528b35d28f776ef62062028ad;hp=27139760ba5bd14354c0e8a6e8c5bec666938463;hb=e1161c325f7866bae879e686d1c673ca32ab09ae;hpb=36167d82e5f49dee91c6d2cd426068edee90e36f;ds=sidebyside diff --git a/engines/sg.c b/engines/sg.c index 27139760..b9033b8f 100644 --- a/engines/sg.c +++ b/engines/sg.c @@ -95,9 +95,9 @@ static int fio_sgio_getevents(struct thread_data *td, int min, int max, ret = poll(sd->pfds, td->nr_files, -1); if (ret < 0) { - td_verror(td, errno); if (!r) - r = -1; + r = -errno; + td_verror(td, errno, "poll"); break; } else if (!ret) continue; @@ -117,8 +117,8 @@ re_read: if (ret < 0) { if (errno == EAGAIN) continue; - td_verror(td, errno); - r = -1; + r = -errno; + td_verror(td, errno, "read"); break; } else if (ret) { p += ret; @@ -162,7 +162,7 @@ static int fio_sgio_ioctl_doio(struct thread_data *td, ret = ioctl(f->fd, SG_IO, hdr); if (ret < 0) - return ret; + return -errno; return FIO_Q_COMPLETED; } @@ -179,7 +179,7 @@ static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync) if (sync) { ret = read(f->fd, hdr, sizeof(*hdr)); if (ret < 0) - return errno; + return -errno; return FIO_Q_COMPLETED; } @@ -253,7 +253,7 @@ static int fio_sgio_queue(struct thread_data *td, struct io_u *io_u) } if (io_u->error) { - td_verror(td, io_u->error); + td_verror(td, io_u->error, "xfer"); return FIO_Q_COMPLETED; } @@ -339,14 +339,14 @@ static int fio_sgio_init(struct thread_data *td) if (td->filetype == FIO_TYPE_BD) { if (ioctl(f->fd, BLKSSZGET, &bs) < 0) { - td_verror(td, errno); + td_verror(td, errno, "ioctl"); goto err; } } else if (td->filetype == FIO_TYPE_CHAR) { int version; if (ioctl(f->fd, SG_GET_VERSION_NUM, &version) < 0) { - td_verror(td, errno); + td_verror(td, errno, "ioctl"); goto err; }