raw-posix: refactor AIO support

Currently the raw-posix.c code contains a lot of knowledge about the
asynchronous I/O scheme that is mostly implemented in posix-aio-compat.c.
All this code does not really belong here and is getting a bit in the
way of implementing native AIO on Linux.

So instead move all the guts of the AIO implementation into
posix-aio-compat.c (which might need a better name, btw).

There's now a very small interface between the AIO providers and raw-posix.c:

 - an init routine is called from raw_open_common to return an AIO context
   for this drive.  An AIO implementation may either re-use one context
   for all drives, or use a different one for each as the Linux native
   AIO support will do.
 - an submit routine is called from the aio_reav/writev methods to submit
   an AIO request

There are no indirect calls involved in this interface as we need to
decide which one to call manually.  We will only call the Linux AIO native
init function if we were requested to by vl.c, and we will only call
the native submit function if we are asked to and the request is properly
aligned.  That's also the reason why the alignment check actually does
the inverse move and now goes into raw-posix.c.

The old posix-aio-compat.h headers is removed now that most of it's
content is private to posix-aio-compat.c, and instead we add a new
block/raw-posix-aio.h headers is created containing only the tiny interface
between raw-posix.c and the AIO implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
4 files changed
tree: fb402ed4b586edc26b7f4e55b378736fd36111b1
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. fpu/
  6. gdb-xml/
  7. hw/
  8. linux-user/
  9. pc-bios/
  10. slirp/
  11. target-alpha/
  12. target-arm/
  13. target-cris/
  14. target-i386/
  15. target-m68k/
  16. target-microblaze/
  17. target-mips/
  18. target-ppc/
  19. target-sh4/
  20. target-sparc/
  21. tcg/
  22. tests/
  23. .gitignore
  24. a.out.h
  25. acl.c
  26. acl.h
  27. aes.c
  28. aes.h
  29. aio.c
  30. alpha-dis.c
  31. alpha.ld
  32. arm-dis.c
  33. arm-semi.c
  34. arm.ld
  35. balloon.h
  36. block.c
  37. block.h
  38. block_int.h
  39. bswap.h
  40. bt-host.c
  41. bt-host.h
  42. bt-vhci.c
  43. buffered_file.c
  44. buffered_file.h
  45. cache-utils.c
  46. cache-utils.h
  47. Changelog
  48. cmd.c
  49. cmd.h
  50. cocoa.m
  51. CODING_STYLE
  52. configure
  53. console.c
  54. console.h
  55. COPYING
  56. COPYING.LIB
  57. cpu-all.h
  58. cpu-common.h
  59. cpu-defs.h
  60. cpu-exec.c
  61. create_config
  62. cris-dis.c
  63. curses.c
  64. curses_keys.h
  65. cutils.c
  66. d3des.c
  67. d3des.h
  68. def-helper.h
  69. device_tree.c
  70. device_tree.h
  71. dis-asm.h
  72. disas.c
  73. disas.h
  74. dma-helpers.c
  75. dma.h
  76. dyngen-exec.h
  77. elf.h
  78. elf_ops.h
  79. envlist.c
  80. envlist.h
  81. exec-all.h
  82. exec.c
  83. feature_to_c.sh
  84. gdbstub.c
  85. gdbstub.h
  86. gen-icount.h
  87. host-utils.c
  88. host-utils.h
  89. hostregs_helper.h
  90. hpet.h
  91. hppa-dis.c
  92. hppa.ld
  93. hxtool
  94. i386-dis.c
  95. i386.ld
  96. ia64.ld
  97. ioport-user.c
  98. ioport.c
  99. ioport.h
  100. keymaps.c
  101. keymaps.h
  102. kvm-all.c
  103. kvm.h
  104. libfdt_env.h
  105. LICENSE
  106. loader.c
  107. m68k-dis.c
  108. m68k-semi.c
  109. m68k.ld
  110. MAINTAINERS
  111. Makefile
  112. Makefile.hw
  113. Makefile.target
  114. microblaze-dis.c
  115. migration-exec.c
  116. migration-fd.c
  117. migration-tcp.c
  118. migration-unix.c
  119. migration.c
  120. migration.h
  121. mips-dis.c
  122. mips.ld
  123. module.c
  124. module.h
  125. monitor.c
  126. monitor.h
  127. nbd.c
  128. nbd.h
  129. net-checksum.c
  130. net.c
  131. net.h
  132. osdep.c
  133. osdep.h
  134. path.c
  135. pci-ids.txt
  136. posix-aio-compat.c
  137. ppc-dis.c
  138. ppc.ld
  139. ppc64.ld
  140. qemu-aio.h
  141. qemu-binfmt-conf.sh
  142. qemu-char.c
  143. qemu-char.h
  144. qemu-common.h
  145. qemu-config.c
  146. qemu-config.h
  147. qemu-doc.texi
  148. qemu-img-cmds.hx
  149. qemu-img.c
  150. qemu-img.texi
  151. qemu-io.c
  152. qemu-lock.h
  153. qemu-log.h
  154. qemu-malloc.c
  155. qemu-monitor.hx
  156. qemu-nbd.c
  157. qemu-nbd.texi
  158. qemu-option.c
  159. qemu-option.h
  160. qemu-options.hx
  161. qemu-sockets.c
  162. qemu-tech.texi
  163. qemu-thread.c
  164. qemu-thread.h
  165. qemu-timer.h
  166. qemu-tool.c
  167. qemu.sasl
  168. qemu_socket.h
  169. readline.c
  170. readline.h
  171. README
  172. rules.mak
  173. s390-dis.c
  174. s390.ld
  175. savevm.c
  176. sdl.c
  177. sdl_keysym.h
  178. sdl_zoom.c
  179. sdl_zoom.h
  180. sdl_zoom_template.h
  181. sh4-dis.c
  182. softmmu-semi.h
  183. softmmu_defs.h
  184. softmmu_exec.h
  185. softmmu_header.h
  186. softmmu_template.h
  187. sparc-dis.c
  188. sparc.ld
  189. sparc64.ld
  190. sys-queue.h
  191. sysemu.h
  192. tap-win32.c
  193. targphys.h
  194. texi2pod.pl
  195. thunk.c
  196. thunk.h
  197. TODO
  198. translate-all.c
  199. uboot_image.h
  200. usb-bsd.c
  201. usb-linux.c
  202. usb-stub.c
  203. VERSION
  204. vgafont.h
  205. vl.c
  206. vnc-auth-sasl.c
  207. vnc-auth-sasl.h
  208. vnc-auth-vencrypt.c
  209. vnc-auth-vencrypt.h
  210. vnc-tls.c
  211. vnc-tls.h
  212. vnc.c
  213. vnc.h
  214. vnc_keysym.h
  215. vnchextile.h
  216. x86_64.ld
  217. x_keymap.c
  218. x_keymap.h