Commit 414f0dab0970795f043f2396fe9449f69b49b20c
1 parent
53c37487
Use AIO only if host supports it (based on OpenBSD patches by Todd T. Fries)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5010 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
59 additions
and
0 deletions
block-raw-posix.c
... | ... | @@ -28,7 +28,9 @@ |
28 | 28 | #endif |
29 | 29 | #include "block_int.h" |
30 | 30 | #include <assert.h> |
31 | +#ifdef CONFIG_AIO | |
31 | 32 | #include <aio.h> |
33 | +#endif | |
32 | 34 | |
33 | 35 | #ifdef CONFIG_COCOA |
34 | 36 | #include <paths.h> |
... | ... | @@ -418,6 +420,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset, |
418 | 420 | #endif |
419 | 421 | |
420 | 422 | |
423 | +#ifdef CONFIG_AIO | |
421 | 424 | /***********************************************************/ |
422 | 425 | /* Unix AIO using POSIX AIO */ |
423 | 426 | |
... | ... | @@ -688,6 +691,37 @@ static void raw_aio_cancel(BlockDriverAIOCB *blockacb) |
688 | 691 | } |
689 | 692 | } |
690 | 693 | |
694 | +# else /* CONFIG_AIO */ | |
695 | + | |
696 | +void qemu_aio_init(void) | |
697 | +{ | |
698 | +} | |
699 | + | |
700 | +void qemu_aio_poll(void) | |
701 | +{ | |
702 | +} | |
703 | + | |
704 | +void qemu_aio_flush(void) | |
705 | +{ | |
706 | +} | |
707 | + | |
708 | +void qemu_aio_wait_start(void) | |
709 | +{ | |
710 | +} | |
711 | + | |
712 | +void qemu_aio_wait(void) | |
713 | +{ | |
714 | +#if !defined(QEMU_IMG) && !defined(QEMU_NBD) | |
715 | + qemu_bh_poll(); | |
716 | +#endif | |
717 | +} | |
718 | + | |
719 | +void qemu_aio_wait_end(void) | |
720 | +{ | |
721 | +} | |
722 | + | |
723 | +#endif /* CONFIG_AIO */ | |
724 | + | |
691 | 725 | static void raw_close(BlockDriverState *bs) |
692 | 726 | { |
693 | 727 | BDRVRawState *s = bs->opaque; |
... | ... | @@ -792,10 +826,12 @@ BlockDriver bdrv_raw = { |
792 | 826 | raw_create, |
793 | 827 | raw_flush, |
794 | 828 | |
829 | +#ifdef CONFIG_AIO | |
795 | 830 | .bdrv_aio_read = raw_aio_read, |
796 | 831 | .bdrv_aio_write = raw_aio_write, |
797 | 832 | .bdrv_aio_cancel = raw_aio_cancel, |
798 | 833 | .aiocb_size = sizeof(RawAIOCB), |
834 | +#endif | |
799 | 835 | .protocol_name = "file", |
800 | 836 | .bdrv_pread = raw_pread, |
801 | 837 | .bdrv_pwrite = raw_pwrite, |
... | ... | @@ -1144,10 +1180,12 @@ BlockDriver bdrv_host_device = { |
1144 | 1180 | NULL, |
1145 | 1181 | raw_flush, |
1146 | 1182 | |
1183 | +#ifdef CONFIG_AIO | |
1147 | 1184 | .bdrv_aio_read = raw_aio_read, |
1148 | 1185 | .bdrv_aio_write = raw_aio_write, |
1149 | 1186 | .bdrv_aio_cancel = raw_aio_cancel, |
1150 | 1187 | .aiocb_size = sizeof(RawAIOCB), |
1188 | +#endif | |
1151 | 1189 | .bdrv_pread = raw_pread, |
1152 | 1190 | .bdrv_pwrite = raw_pwrite, |
1153 | 1191 | .bdrv_getlength = raw_getlength, | ... | ... |
configure
... | ... | @@ -106,6 +106,7 @@ darwin_user="no" |
106 | 106 | build_docs="no" |
107 | 107 | uname_release="" |
108 | 108 | curses="yes" |
109 | +aio="yes" | |
109 | 110 | nptl="yes" |
110 | 111 | mixemu="no" |
111 | 112 | |
... | ... | @@ -334,6 +335,8 @@ for opt do |
334 | 335 | ;; |
335 | 336 | --enable-mixemu) mixemu="yes" |
336 | 337 | ;; |
338 | + --disable-aio) aio="no" | |
339 | + ;; | |
337 | 340 | *) echo "ERROR: unknown option $opt"; show_help="yes" |
338 | 341 | ;; |
339 | 342 | esac |
... | ... | @@ -436,6 +439,7 @@ echo " --fmod-inc path to FMOD includes" |
436 | 439 | echo " --enable-uname-release=R Return R for uname -r in usermode emulation" |
437 | 440 | echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" |
438 | 441 | echo " --disable-vde disable support for vde network" |
442 | +echo " --disable-aio disable AIO support" | |
439 | 443 | echo "" |
440 | 444 | echo "NOTE: The object files are built at the place where configure is launched" |
441 | 445 | exit 1 |
... | ... | @@ -863,6 +867,19 @@ EOF |
863 | 867 | fi |
864 | 868 | fi # test "$curses" |
865 | 869 | |
870 | +########################################## | |
871 | +# AIO probe | |
872 | +if test "$aio" = "yes" ; then | |
873 | + aio=no | |
874 | + cat > $TMPC << EOF | |
875 | +#include <aio.h> | |
876 | +int main(void) { return aio_write(NULL); } | |
877 | +EOF | |
878 | + if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then | |
879 | + aio=yes | |
880 | + fi | |
881 | +fi | |
882 | + | |
866 | 883 | # Check if tools are available to build documentation. |
867 | 884 | if [ -x "`which texi2html 2>/dev/null`" ] && \ |
868 | 885 | [ -x "`which pod2man 2>/dev/null`" ]; then |
... | ... | @@ -934,6 +951,7 @@ echo "Documentation $build_docs" |
934 | 951 | echo "uname -r $uname_release" |
935 | 952 | echo "NPTL support $nptl" |
936 | 953 | echo "vde support $vde" |
954 | +echo "AIO support $aio" | |
937 | 955 | |
938 | 956 | if test $sdl_too_old = "yes"; then |
939 | 957 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
... | ... | @@ -1179,6 +1197,9 @@ if test "$brlapi" = "yes" ; then |
1179 | 1197 | echo "#define CONFIG_BRLAPI 1" >> $config_h |
1180 | 1198 | echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak |
1181 | 1199 | fi |
1200 | +if test "$aio" = "yes" ; then | |
1201 | + echo "#define CONFIG_AIO 1" >> $config_h | |
1202 | +fi | |
1182 | 1203 | |
1183 | 1204 | # XXX: suppress that |
1184 | 1205 | if [ "$bsd" = "yes" ] ; then | ... | ... |