public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2]  aio: add vectored I/O support
@ 2004-10-14 20:10 Yasushi Saito
  2004-10-16  3:13 ` Joel Becker
  0 siblings, 1 reply; 10+ messages in thread
From: Yasushi Saito @ 2004-10-14 20:10 UTC (permalink / raw)
  To: linux-aio, linux-kernel; +Cc: suparna, Janet Morgan, ysaito

This is a patch against 2.6.9-rc3-mm3 that add supports for vectored 
async I/O.  It adds two additional commands, IO_CMD_PREADV and 
IO_CMD_PWRITEV to libaio.h. The below is roughly what I did:

    * add "aio_readv" and "aio_writev" to struct file_operations.
    * aio_abi.h: add IOCB_CMD_PREADV and PWRITEV. \
      Also make struct iocb compatible with the latest glibc libaio.h.
    * aio.c: change kiocb to support vectored operations.
       IOCB_CMD_PREAD and PWRITE are now simply
       implemented as degenerate variations of PREADV and PWRITEV.
    * block_dev.c, file.c, {ext2,ext3,jfs,reiserfs}/file.c:
       Add implementations of aio_readv and wriitev methods, route 
aio_read and aio_write to the ...v methods.
       They are reasonably straightforward since the low-level code 
already supports vectored I/O.

This feature has been tested on ext3 and a raw block device, but it 
should also work with ext2, nfs, jfs and reiser.
The patch is divided into two parts, one that just fixes bugs in the 
existing code, and the other that adds the vectored I/O feature.  A bit 
more detailed explanation, along with a sample program, is found in 
http://www.hpl.hp.com/personal/Yasushi_Saito/linux-aiov
Comments are appreciated.

yaz

This patch fixes two bugs: (1) aio_free_ring: don't attempt to free page 
on cleanup after io_setup fails  while in do_mmap,
(2) __generic_file_aio_read: properly abort and retry when more than one 
iovec is passed and data is not yet ready.

Signed-off-by: Yasushi Saito <ysaito@hpl.hp.com>

--- .pc/aio-bugfixes.patch/fs/aio.c    2004-10-14 12:58:39 -07:00
+++ fs/aio.c    2004-10-14 12:58:39 -07:00
@@ -86,7 +86,8 @@ static void aio_free_ring(struct kioctx
     long i;
 
     for (i=0; i<info->nr_pages; i++)
-        put_page(info->ring_pages[i]);
+            if (info->ring_pages[i])
+                put_page(info->ring_pages[i]);
 
     if (info->mmap_size) {
         down_write(&ctx->mm->mmap_sem);
--- .pc/aio-bugfixes.patch/mm/filemap.c    2004-10-14 12:58:39 -07:00
+++ mm/filemap.c    2004-10-14 12:58:39 -07:00
@@ -976,9 +976,11 @@ __generic_file_aio_read(struct kiocb *io
             desc.error = 0;
             do_generic_file_read(filp,ppos,&desc,file_read_actor);
             retval += desc.written;
-            if (!retval) {
-                retval = desc.error;
-                break;
+
+            if (desc.written < iov[seg].iov_len) {
+                    if (retval == 0)
+                    retval = desc.error;
+                 break;
             }
         }
     }




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-10-17  6:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-14 20:10 [PATCH 1/2] aio: add vectored I/O support Yasushi Saito
2004-10-16  3:13 ` Joel Becker
2004-10-16  5:18   ` Avi Kivity
2004-10-16  5:37     ` Joel Becker
2004-10-16  8:43       ` Avi Kivity
2004-10-16 16:28         ` Joel Becker
2004-10-16 17:29           ` Avi Kivity
2004-10-17  0:14             ` Joel Becker
2004-10-17  6:25               ` Avi Kivity
2004-10-16 12:05       ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox