diff options
author | Badari Pulavarty <pbadari@us.ibm.com> | 2006-10-01 02:28:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:28 -0400 |
commit | 027445c37282bc1ed26add45e573ad2d3e4860a5 (patch) | |
tree | 93eab101a938ffebaea64703033c8649df4d73f0 /fs/read_write.c | |
parent | 9ea0f9499d15c49df23e7aac4332d830c40e12d0 (diff) |
[PATCH] Vectorize aio_read/aio_write fileop methods
This patch vectorizes aio_read() and aio_write() methods to prepare for
collapsing all aio & vectored operations into one interface - which is
aio_read()/aio_write().
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Michael Holzheu <HOLZHEU@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index d4cb3183c99c..679dd535380f 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -227,14 +227,20 @@ static void wait_on_retry_sync_kiocb(struct kiocb *iocb) | |||
227 | 227 | ||
228 | ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) | 228 | ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) |
229 | { | 229 | { |
230 | struct iovec iov = { .iov_base = buf, .iov_len = len }; | ||
230 | struct kiocb kiocb; | 231 | struct kiocb kiocb; |
231 | ssize_t ret; | 232 | ssize_t ret; |
232 | 233 | ||
233 | init_sync_kiocb(&kiocb, filp); | 234 | init_sync_kiocb(&kiocb, filp); |
234 | kiocb.ki_pos = *ppos; | 235 | kiocb.ki_pos = *ppos; |
235 | while (-EIOCBRETRY == | 236 | kiocb.ki_left = len; |
236 | (ret = filp->f_op->aio_read(&kiocb, buf, len, kiocb.ki_pos))) | 237 | |
238 | for (;;) { | ||
239 | ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos); | ||
240 | if (ret != -EIOCBRETRY) | ||
241 | break; | ||
237 | wait_on_retry_sync_kiocb(&kiocb); | 242 | wait_on_retry_sync_kiocb(&kiocb); |
243 | } | ||
238 | 244 | ||
239 | if (-EIOCBQUEUED == ret) | 245 | if (-EIOCBQUEUED == ret) |
240 | ret = wait_on_sync_kiocb(&kiocb); | 246 | ret = wait_on_sync_kiocb(&kiocb); |
@@ -279,14 +285,20 @@ EXPORT_SYMBOL(vfs_read); | |||
279 | 285 | ||
280 | ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) | 286 | ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) |
281 | { | 287 | { |
288 | struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = len }; | ||
282 | struct kiocb kiocb; | 289 | struct kiocb kiocb; |
283 | ssize_t ret; | 290 | ssize_t ret; |
284 | 291 | ||
285 | init_sync_kiocb(&kiocb, filp); | 292 | init_sync_kiocb(&kiocb, filp); |
286 | kiocb.ki_pos = *ppos; | 293 | kiocb.ki_pos = *ppos; |
287 | while (-EIOCBRETRY == | 294 | kiocb.ki_left = len; |
288 | (ret = filp->f_op->aio_write(&kiocb, buf, len, kiocb.ki_pos))) | 295 | |
296 | for (;;) { | ||
297 | ret = filp->f_op->aio_write(&kiocb, &iov, 1, kiocb.ki_pos); | ||
298 | if (ret != -EIOCBRETRY) | ||
299 | break; | ||
289 | wait_on_retry_sync_kiocb(&kiocb); | 300 | wait_on_retry_sync_kiocb(&kiocb); |
301 | } | ||
290 | 302 | ||
291 | if (-EIOCBQUEUED == ret) | 303 | if (-EIOCBQUEUED == ret) |
292 | ret = wait_on_sync_kiocb(&kiocb); | 304 | ret = wait_on_sync_kiocb(&kiocb); |