Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 1999 22:25:18 -0400 (EDT)
From:      Christopher Sedore <cmsedore@mailbox.syr.edu>
To:        hackers@freebsd.org
Subject:   aio_suspend() functionality
Message-ID:  <Pine.SOL.3.95.990421215301.26724A-100000@rodan.syr.edu>

next in thread | raw e-mail | index | archive | help

I sent a message a day or two ago asking if anyone had looked into
changing the behavior of aio_suspend so that it did not require a list of
aiocb's, but rather would accept an array of null pointers, and then fill
them in for you when an operation completed. 

A patch to vfs_aio.c that does just this is available at
ftp://ftp.maxwell.syr.edu/freebsd/vfs_aio.c-aio_suspend-patch

Why would one care about this?  If one were going to have hundreds (or
thousands) of outstanding asynchronous IO requests, it isn't very
efficient to handle them buy building arrays of pointers to control blocks
and then polling each one to determine whether or not it has completed,
particularly since the kernel already has them in a handy list. 

It essentially allows you to use aiocb's as fire and forget: malloc one
(possibly "growing it" to keep your own state), give it to the OS with
aio_read/aio_write, then simply poll for completed events using
aio_suspend.  When an operation completes, you'll get the pointer to the
aiocb back.  

This patch is against FreeBSD 3.1-STABLE  It works in my testing, and
is not entirely backwardly compatible with the old aio_suspend (it won't
behave the same way if you pass in an array of all NULL pointers,
otherwise it should be functionally equivalent).  

The patch will generate a warning during compiling because the upper
layers pointing to aio_suspend expect the array of pointers to be a const,
and I deconstify it. 

-Chris



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.3.95.990421215301.26724A-100000>