Cancelling AIO
Cancelling AIO
- Subject: Cancelling AIO
- From: Lamont Cranston <email@hidden>
- Date: Tue, 20 Apr 2004 12:02:23 -0700 (PDT)
I have the following code in a userland AIO test app to clean up file I/O and close a file:
// cancel any pending aio requests.
retval = aio_cancel( file, NULL );
if ( retval == AIO_NOTCANCELED )
{
// Requests could not be cancelled. Go through the
// AIO list and wait for completion.
for( i = 0; i < aiocb_list_size; i++ )
{
if ( !aiocb_list[i] )
continue;
while( aio_error( aiocb_list[i] ) == EINPROGRESS )
continue;
aio_return( aiocb_list[i] );
}
}
close( file );
----------------------------------------
This code is common to file and raw disk I/O. I am having problems with raw disk I/O. I know that aio_cancel() does not work with raw disks (so the for loop will always execute), but does that mean I can't make the call at all? While running a series of AIO tests in which rdisks are opened and closed, eventually aio_read() and aio_write() begin to fail because aio_max_requests_per_process and aio_max_requests have been exceeded. I make sure that these are set to twice what I need via sysctl() calls. If I take out the aio_cancel() call and just run the for loop, everything works.
For file I/O, do I need to call aio_return() even if requests are cancelled via aio_cancel() (i.e. should I run the for loop regardless)?
Thanks
Yahoo! Photos: High-quality 4x6 digital prints for 25"
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.