[PATCH] Support residual io counts from io engines

We need this for requeuing support, the network engine makes this
pretty apparent (it's not unusual to see short tranfers there).

Basically we add an xfer_buf and xfer_buflen member to the io_u,
and these are the fields that the io engine MUST use. That allows
fio to increment and reset these appropriately, and simply requeue
the io_u for service of the next part of it.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/engines/mmap.c b/engines/mmap.c
index 20dcfd2..dc1fd33 100644
--- a/engines/mmap.c
+++ b/engines/mmap.c
@@ -48,9 +48,9 @@
 	struct mmapio_data *sd = td->io_ops->data;
 
 	if (io_u->ddir == DDIR_READ)
-		memcpy(io_u->buf, f->mmap + real_off, io_u->buflen);
+		memcpy(io_u->xfer_buf, f->mmap + real_off, io_u->xfer_buflen);
 	else if (io_u->ddir == DDIR_WRITE)
-		memcpy(f->mmap + real_off, io_u->buf, io_u->buflen);
+		memcpy(f->mmap + real_off, io_u->xfer_buf, io_u->xfer_buflen);
 	else if (io_u->ddir == DDIR_SYNC) {
 		if (msync(f->mmap, f->file_size, MS_SYNC))
 			io_u->error = errno;
@@ -60,9 +60,9 @@
 	 * not really direct, but should drop the pages from the cache
 	 */
 	if (td->odirect && io_u->ddir != DDIR_SYNC) {
-		if (msync(f->mmap + real_off, io_u->buflen, MS_SYNC) < 0)
+		if (msync(f->mmap + real_off, io_u->xfer_buflen, MS_SYNC) < 0)
 			io_u->error = errno;
-		if (madvise(f->mmap + real_off, io_u->buflen,  MADV_DONTNEED) < 0)
+		if (madvise(f->mmap + real_off, io_u->xfer_buflen,  MADV_DONTNEED) < 0)
 			io_u->error = errno;
 	}