[Samba] AIO settings

William Jojo jojowil at hvcc.edu
Tue Aug 2 15:13:57 GMT 2005



On Wed, 27 Jul 2005, Jeremy Allison wrote:

> On Wed, Jul 27, 2005 at 04:37:07PM -0400, William Jojo wrote:
> >
> > /*
> >  * sigevent structure, referred to (but not used) in asynchronous i/o.
> >  *
> >  * WARNING: The unix98 sigevent is available to user programs, but this
> >  *          does not itself guarantee that the kernel supports unix98 aio.
> >  *
> >  */
> >
> > Real-time signals in aio are not supported....yet...So now my question is
> > can we do this another way?
>
> No. Polling would be a complete waste of time (IMGO).
>
> > I'm mocking up a process_aio_queue that doesn't use the signal portion but
> > I'm having a hard time linking it to async_processing() which appears to
> > be linked to oplock handling (or if you have another
> > preference/recommendation).
>
> There's no good way to fix this without signals - Samba may wait in select
> or up to 30 seconds or so for an incoming smb request, if this was filled
> with polling for aio completion you might as well be running DOS.
>
> > I've set up a test with aio and hundreds of aiocb's of 64K in flight,
> > without the signal processing and it's working great in my test bed.
> >
> > What I'd like to do is trip the async_processing() more frequently and put
> > more mid's in flight or some variation thereof as the smbd code path will
> > allow. Do you have any pointers on achieving such a goal?
>
> IBM needs to fix the AIX kernel so this works correctly.
>

Whoops! The problem is in configure!

AIX has legacy (AIX original) AIO *and* POSIX AIO support. But they keep
the function names the same for compatibility.

aio_return, aio_error and aio_fsync were failing their tests (which I
hadn't previously noticed).

Legacy AIO never had aio_return, aio_error or aio_fsync functions, so the
test in configure is very bad as it sets up a loop to test for all the
functions, but never actually includes "aio.h". For AIX, if it *had*
included that, the aio_* functions are encapsualted around _posix_aio_*
equivalents unless you expressly ask for Legacy.

<snip>

static ssize_t  aio_return(struct aiocb *__aiocbp)
{
        extern ssize_t _posix_aio_return(struct aiocb *);
        return _posix_aio_return(__aiocbp);
}

</snip>

This is the reason handle_aio_write_completed() failed with -1 and ENOSYS.
At the VFS layer, sys_aio_return() was if-def'd out to the dummy handler.

Sorry, Jeremy, I should have noticed that before.

The AC_CHECK_FUNCS in configure.in are the issue.

Attached is diff for configure.in that more effectively processes the AIO
checks for individual functions. This diff is against the configure.in in
the "rc1" code base.


Cheers,

Bill


> Jeremy.
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/listinfo/samba
>
-------------- next part --------------
--- configure.in.orig	2005-08-01 07:22:44.000000000 -0400
+++ configure.in.aix	2005-08-02 10:43:30.000000000 -0400
@@ -4165,6 +4165,7 @@
 [ case "$withval" in
   yes)
 
+	AC_MSG_RESULT(yes)
 	case "$host_os" in
 	*)
 		AC_CHECK_LIB(rt,aio_read,[AIO_LIBS="$ACL_LIBS -lrt"])
@@ -4192,6 +4193,94 @@
 			AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
 			LIBS="$LIBS -lrt"
 		fi
+
+		if test x"$samba_cv_HAVE_AIO" = x"yes"; then
+			AC_MSG_CHECKING(for aio_read)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_read(&a); }],
+[AC_DEFINE(HAVE_AIO_READ, 1, [Have aio_read]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_write)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_write(&a); }],
+[AC_DEFINE(HAVE_AIO_WRITE, 1, [Have aio_write]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_fsync)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_fsync(1, &a); }],
+[AC_DEFINE(HAVE_AIO_FSYNC, 1, [Have aio_fsync]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_return)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_return(&a); }],
+[AC_DEFINE(HAVE_AIO_RETURN, 1, [Have aio_return]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_error)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_error(&a); }],
+[AC_DEFINE(HAVE_AIO_ERROR, 1, [Have aio_error]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_cancel)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_cancel(1, &a); }],
+[AC_DEFINE(HAVE_AIO_CANCEL, 1, [Have aio_cancel]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_suspend)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
+[AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+		fi
+
+		if test x"$samba_cv_HAVE_AIO64" = x"yes"; then
+			AC_MSG_CHECKING(for aio_read64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_read64(&a); }],
+[AC_DEFINE(HAVE_AIO_READ64, 1, [Have aio_read64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_write64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_write64(&a); }],
+[AC_DEFINE(HAVE_AIO_WRITE64, 1, [Have aio_write64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_fsync64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_fsync64(1, &a); }],
+[AC_DEFINE(HAVE_AIO_FSYNC64, 1, [Have aio_fsync64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_return64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_return64(&a); }],
+[AC_DEFINE(HAVE_AIO_RETURN64, 1, [Have aio_return64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_error64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_error64(&a); }],
+[AC_DEFINE(HAVE_AIO_ERROR64, 1, [Have aio_error64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_cancel64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_cancel64(1, &a); }],
+[AC_DEFINE(HAVE_AIO_CANCEL64, 1, [Have aio_cancel64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+
+			AC_MSG_CHECKING(for aio_suspend64)
+			AC_LINK_IFELSE([#include <aio.h>
+int main() { struct aiocb a; return aio_suspend64(&a, 1, NULL); }],
+[AC_DEFINE(HAVE_AIO_SUSPEND64, 1, [Have aio_suspend64]) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)])
+		fi
             ;;
         esac
         ;;
@@ -4204,9 +4293,6 @@
   AC_MSG_RESULT(no)
 )
 
-AC_CHECK_FUNCS(aio_cancel aio_cancel64 aio_error aio_error64 aio_fsync aio_fsync64 aio_read aio_read64)
-AC_CHECK_FUNCS(aio_return aio_return64 aio_suspend aio_suspend64 aio_write aio_write64)
-
 #################################################
 # check for sendfile support
 


More information about the samba mailing list