Hi, On 17 October 2017 at 00:44, Scott Forman (scforman) <scforman@xxxxxxxxx> wrote: > > I am running into a new problem when I check for write errors after calling io_getevents() that I am hoping you can help me out with. > > Comparing it to your function fio_libaio_event() in engines/libaio.c, I am finding that (ev->res != io_u->xfer_buflen) and that (ev->res > io_u->xfer_buflen). The value of ev->res, which I believe is the result of the write, is equal to the value of the count parameter passed to io_prep_pwrite(), so it seems like the write succeeded. This sounds strange - a long write? I'd expect ev->res to be less than or equal to the length of the buffer you passed in for that I/O but you're saying that it's greater? Are you sure you've got the ev->res you're looking at matches to the I/O you're checking against? Or was that a typo? > So I was surprised to find the io_u->xfer_buflen value (or in my case, the struct iocb.u.c.nbytes value) less than what it was set to in io_prep_pwrite(). Do you know what might be causing this? If ev->res is LESS than io_u->xfer_buflen then you have a short I/O which happens when less I/O than you wanted is serviced. I actually gave an example of when this could happen originally: > On 4/3/17, 11:17 PM, "Sitsofe Wheeler" <sitsofe@xxxxxxxxx> wrote: > > On 4 April 2017 at 01:48, Scott Forman (scforman) <scforman@xxxxxxxxx> wrote: > > > > In looking further at fio_libaio_event(), I am wondering if it is possible to get the errno value if one of the events have an error (i.e. if ev->res != io_u->xfer_buflen). > [...] > > > Also, if ev->res is less than io_u->xfer_buflen, then io_u->resid is set to (io_u->xfer_buflen - ev->res). Does that mean that there will be another attempt to write out the io_u->resid bytes? > > Not necessarily. For example what happens if you *perform a write that > goes past the end of the file* [emphasis added] - would you want to retry that even > though it returned back as being short? Is the fact it came back short > a definite error? You may also find https://github.com/littledan/linux-aio handy if very C++ oriented. -- Sitsofe | http://sucs.org/~sits/ -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html