Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KU3ux-0004xT-Se for qemu-devel@nongnu.org; Fri, 15 Aug 2008 14:20:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KU3ux-0004wk-99 for qemu-devel@nongnu.org; Fri, 15 Aug 2008 14:20:55 -0400 Received: from [199.232.76.173] (port=57070 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KU3ux-0004wU-0q for qemu-devel@nongnu.org; Fri, 15 Aug 2008 14:20:55 -0400 Received: from savannah.gnu.org ([199.232.41.3]:36334 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KU3uw-0003vm-Np for qemu-devel@nongnu.org; Fri, 15 Aug 2008 14:20:54 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KU3uv-0006UU-OM for qemu-devel@nongnu.org; Fri, 15 Aug 2008 18:20:53 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KU3uv-0006UQ-0B for qemu-devel@nongnu.org; Fri, 15 Aug 2008 18:20:53 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Fri, 15 Aug 2008 18:20:53 +0000 Subject: [Qemu-devel] [5010] Use AIO only if host supports it (based on OpenBSD patches by Todd T . Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5010 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5010 Author: blueswir1 Date: 2008-08-15 18:20:52 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Use AIO only if host supports it (based on OpenBSD patches by Todd T. Fries) Modified Paths: -------------- trunk/block-raw-posix.c trunk/configure Modified: trunk/block-raw-posix.c =================================================================== --- trunk/block-raw-posix.c 2008-08-15 18:14:44 UTC (rev 5009) +++ trunk/block-raw-posix.c 2008-08-15 18:20:52 UTC (rev 5010) @@ -28,7 +28,9 @@ #endif #include "block_int.h" #include +#ifdef CONFIG_AIO #include +#endif #ifdef CONFIG_COCOA #include @@ -418,6 +420,7 @@ #endif +#ifdef CONFIG_AIO /***********************************************************/ /* Unix AIO using POSIX AIO */ @@ -688,6 +691,37 @@ } } +# else /* CONFIG_AIO */ + +void qemu_aio_init(void) +{ +} + +void qemu_aio_poll(void) +{ +} + +void qemu_aio_flush(void) +{ +} + +void qemu_aio_wait_start(void) +{ +} + +void qemu_aio_wait(void) +{ +#if !defined(QEMU_IMG) && !defined(QEMU_NBD) + qemu_bh_poll(); +#endif +} + +void qemu_aio_wait_end(void) +{ +} + +#endif /* CONFIG_AIO */ + static void raw_close(BlockDriverState *bs) { BDRVRawState *s = bs->opaque; @@ -792,10 +826,12 @@ raw_create, raw_flush, +#ifdef CONFIG_AIO .bdrv_aio_read = raw_aio_read, .bdrv_aio_write = raw_aio_write, .bdrv_aio_cancel = raw_aio_cancel, .aiocb_size = sizeof(RawAIOCB), +#endif .protocol_name = "file", .bdrv_pread = raw_pread, .bdrv_pwrite = raw_pwrite, @@ -1144,10 +1180,12 @@ NULL, raw_flush, +#ifdef CONFIG_AIO .bdrv_aio_read = raw_aio_read, .bdrv_aio_write = raw_aio_write, .bdrv_aio_cancel = raw_aio_cancel, .aiocb_size = sizeof(RawAIOCB), +#endif .bdrv_pread = raw_pread, .bdrv_pwrite = raw_pwrite, .bdrv_getlength = raw_getlength, Modified: trunk/configure =================================================================== --- trunk/configure 2008-08-15 18:14:44 UTC (rev 5009) +++ trunk/configure 2008-08-15 18:20:52 UTC (rev 5010) @@ -106,6 +106,7 @@ build_docs="no" uname_release="" curses="yes" +aio="yes" nptl="yes" mixemu="no" @@ -334,6 +335,8 @@ ;; --enable-mixemu) mixemu="yes" ;; + --disable-aio) aio="no" + ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; esac @@ -436,6 +439,7 @@ echo " --enable-uname-release=R Return R for uname -r in usermode emulation" echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo " --disable-vde disable support for vde network" +echo " --disable-aio disable AIO support" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1 @@ -863,6 +867,19 @@ fi fi # test "$curses" +########################################## +# AIO probe +if test "$aio" = "yes" ; then + aio=no + cat > $TMPC << EOF +#include +int main(void) { return aio_write(NULL); } +EOF + if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then + aio=yes + fi +fi + # Check if tools are available to build documentation. if [ -x "`which texi2html 2>/dev/null`" ] && \ [ -x "`which pod2man 2>/dev/null`" ]; then @@ -934,6 +951,7 @@ echo "uname -r $uname_release" echo "NPTL support $nptl" echo "vde support $vde" +echo "AIO support $aio" if test $sdl_too_old = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -1179,6 +1197,9 @@ echo "#define CONFIG_BRLAPI 1" >> $config_h echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak fi +if test "$aio" = "yes" ; then + echo "#define CONFIG_AIO 1" >> $config_h +fi # XXX: suppress that if [ "$bsd" = "yes" ] ; then