public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yasushi Saito <ysaito@hpl.hp.com>
To: linux-aio@kvack.org, linux-kernel@vger.kernel.org
Cc: suparna@in.ibm.com, Janet Morgan <janetmor@us.ibm.com>,
	ysaito@hpl.hp.com
Subject: [PATCH 1/2]  aio: add vectored I/O support
Date: Thu, 14 Oct 2004 13:10:01 -0700	[thread overview]
Message-ID: <416EDD19.3010200@hpl.hp.com> (raw)

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;
             }
         }
     }




             reply	other threads:[~2004-10-14 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14 20:10 Yasushi Saito [this message]
2004-10-16  3:13 ` [PATCH 1/2] aio: add vectored I/O support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=416EDD19.3010200@hpl.hp.com \
    --to=ysaito@hpl.hp.com \
    --cc=janetmor@us.ibm.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suparna@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox