Commit e4cb7f8c authored by Daniel McNeil's avatar Daniel McNeil Committed by Linus Torvalds

[PATCH] handle partial DIO write

The fsx-linux hole fill failure problem was caused by
generic_file_aio_write_nolock() not handling the partial DIO write
correctly.  Here's a patch lets DIO do the partial write, and the fallback
to buffered is done (correctly) for what is left.  This fixes the hole
filling without retrying the entire i/o.  This patch also applies to
2.6.7-rc3 with some offset.

I tested this (on ext3) with
fsx-linux -l 500000 -r 4096 -t 4096 -w 4096 -Z -N 10000 junk  -R -W
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7553d794
......@@ -990,6 +990,13 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
}
} /* end iovec loop */
if (ret == -ENOTBLK && rw == WRITE) {
/*
* The remaining part of the request will be
* be handled by buffered I/O when we return
*/
ret = 0;
}
/*
* There may be some unwritten disk at the end of a part-written
* fs-block-sized block. Go zero that now.
......@@ -1089,13 +1096,6 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
aio_complete(iocb, ret, 0);
kfree(dio);
}
if (ret == -ENOTBLK && rw == WRITE) {
/*
* The entire request will be be handled by buffered I/O
* when we return
*/
ret = 0;
}
return ret;
}
......
......@@ -1915,7 +1915,7 @@ generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
count -= written;
}
buf = iov->iov_base;
buf = iov->iov_base + written; /* handle partial DIO write */
do {
unsigned long index;
unsigned long offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment