If direct-io encounters an error, it currently returns that error even if it
performed some I/O.
Change it so that if there is an error and we read or wrote something, return
the number of bytes written/read. Only return the error code if zero bytes
were written/read.