block: mark blocks dirty on coroutine write completion

The aio write operation marks blocks dirty when the write operation
completes.  The coroutine write operation marks blocks dirty before
issuing the write operation.

It seems safest to mark the block dirty when the operation completes so
that anything tracking dirty blocks will not act before the change has
been made to the image file.

Make the coroutine write operation dirty blocks on write completion.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 file changed
tree: d8fb209a804193e100ace986c8f315fc3b3348e0
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. libcacard/
  12. linux-headers/
  13. linux-user/
  14. net/
  15. pc-bios/
  16. qapi/
  17. qga/
  18. QMP/
  19. roms/
  20. scripts/
  21. slirp/
  22. sysconfigs/
  23. target-alpha/
  24. target-arm/
  25. target-cris/
  26. target-i386/
  27. target-lm32/
  28. target-m68k/
  29. target-microblaze/
  30. target-mips/
  31. target-ppc/
  32. target-s390x/
  33. target-sh4/
  34. target-sparc/
  35. target-unicore32/
  36. target-xtensa/
  37. tcg/
  38. tests/
  39. trace/
  40. ui/
  41. .gitignore
  42. .gitmodules
  43. a.out.h
  44. acl.c
  45. acl.h
  46. aes.c
  47. aes.h
  48. aio.c
  49. alpha-dis.c
  50. alpha.ld
  51. arch_init.c
  52. arch_init.h
  53. arm-dis.c
  54. arm-semi.c
  55. arm.ld
  56. async.c
  57. balloon.c
  58. balloon.h
  59. bitmap.c
  60. bitmap.h
  61. bitops.c
  62. bitops.h
  63. block-migration.c
  64. block-migration.h
  65. block.c
  66. block.h
  67. block_int.h
  68. blockdev.c
  69. blockdev.h
  70. bswap.h
  71. bt-host.c
  72. bt-host.h
  73. bt-vhci.c
  74. buffered_file.c
  75. buffered_file.h
  76. cache-utils.c
  77. cache-utils.h
  78. Changelog
  79. check-qdict.c
  80. check-qfloat.c
  81. check-qint.c
  82. check-qjson.c
  83. check-qlist.c
  84. check-qstring.c
  85. cmd.c
  86. cmd.h
  87. CODING_STYLE
  88. compatfd.c
  89. compatfd.h
  90. compiler.h
  91. config.h
  92. configure
  93. console.c
  94. console.h
  95. COPYING
  96. COPYING.LIB
  97. coroutine-gthread.c
  98. coroutine-ucontext.c
  99. coroutine-win32.c
  100. cpu-all.h
  101. cpu-common.h
  102. cpu-defs.h
  103. cpu-exec.c
  104. cpus.c
  105. cpus.h
  106. cris-dis.c
  107. cursor.c
  108. cursor_hidden.xpm
  109. cursor_left_ptr.xpm
  110. cutils.c
  111. def-helper.h
  112. device_tree.c
  113. device_tree.h
  114. dis-asm.h
  115. disas.c
  116. disas.h
  117. dma-helpers.c
  118. dma.h
  119. dyngen-exec.h
  120. elf.h
  121. envlist.c
  122. envlist.h
  123. error.c
  124. error.h
  125. error_int.h
  126. exec-all.h
  127. exec-memory.h
  128. exec.c
  129. gdbstub.c
  130. gdbstub.h
  131. gen-icount.h
  132. HACKING
  133. hmp-commands.hx
  134. hmp.c
  135. hmp.h
  136. host-utils.c
  137. host-utils.h
  138. hpet.h
  139. hppa-dis.c
  140. hppa.ld
  141. i386-dis.c
  142. i386.ld
  143. ia64-dis.c
  144. ia64.ld
  145. input.c
  146. iohandler.c
  147. ioport-user.c
  148. ioport.c
  149. ioport.h
  150. iorange.h
  151. iov.c
  152. iov.h
  153. json-lexer.c
  154. json-lexer.h
  155. json-parser.c
  156. json-parser.h
  157. json-streamer.c
  158. json-streamer.h
  159. kvm-all.c
  160. kvm-stub.c
  161. kvm.h
  162. libfdt_env.h
  163. LICENSE
  164. linux-aio.c
  165. m68k-dis.c
  166. m68k-semi.c
  167. m68k.ld
  168. MAINTAINERS
  169. Makefile
  170. Makefile.dis
  171. Makefile.hw
  172. Makefile.objs
  173. Makefile.target
  174. Makefile.user
  175. memory.c
  176. memory.h
  177. microblaze-dis.c
  178. migration-exec.c
  179. migration-fd.c
  180. migration-tcp.c
  181. migration-unix.c
  182. migration.c
  183. migration.h
  184. mips-dis.c
  185. mips.ld
  186. module.c
  187. module.h
  188. monitor.c
  189. monitor.h
  190. nbd.c
  191. nbd.h
  192. net.c
  193. net.h
  194. notify.c
  195. notify.h
  196. os-posix.c
  197. os-win32.c
  198. osdep.c
  199. osdep.h
  200. oslib-posix.c
  201. oslib-win32.c
  202. path.c
  203. pci-ids.txt
  204. pflib.c
  205. pflib.h
  206. poison.h
  207. posix-aio-compat.c
  208. ppc-dis.c
  209. ppc.ld
  210. ppc64.ld
  211. qapi-schema-guest.json
  212. qapi-schema-test.json
  213. qapi-schema.json
  214. qbool.c
  215. qbool.h
  216. qdict-test-data.txt
  217. qdict.c
  218. qdict.h
  219. qemu-aio.h
  220. qemu-barrier.h
  221. qemu-char.c
  222. qemu-char.h
  223. qemu-common.h
  224. qemu-config.c
  225. qemu-config.h
  226. qemu-coroutine-int.h
  227. qemu-coroutine-lock.c
  228. qemu-coroutine.c
  229. qemu-coroutine.h
  230. qemu-doc.texi
  231. qemu-error.c
  232. qemu-error.h
  233. qemu-ga.c
  234. qemu-img-cmds.hx
  235. qemu-img.c
  236. qemu-img.texi
  237. qemu-io.c
  238. qemu-lock.h
  239. qemu-log.h
  240. qemu-nbd.c
  241. qemu-nbd.texi
  242. qemu-objects.h
  243. qemu-option.c
  244. qemu-option.h
  245. qemu-options.h
  246. qemu-options.hx
  247. qemu-os-posix.h
  248. qemu-os-win32.h
  249. qemu-progress.c
  250. qemu-queue.h
  251. qemu-sockets.c
  252. qemu-tech.texi
  253. qemu-thread-posix.c
  254. qemu-thread-posix.h
  255. qemu-thread-win32.c
  256. qemu-thread-win32.h
  257. qemu-thread.h
  258. qemu-timer-common.c
  259. qemu-timer.c
  260. qemu-timer.h
  261. qemu-tool.c
  262. qemu-x509.h
  263. qemu.sasl
  264. qemu_socket.h
  265. qerror.c
  266. qerror.h
  267. qfloat.c
  268. qfloat.h
  269. qint.c
  270. qint.h
  271. qjson.c
  272. qjson.h
  273. qlist.c
  274. qlist.h
  275. qmp-commands.hx
  276. qmp.c
  277. qobject.h
  278. qstring.c
  279. qstring.h
  280. range.h
  281. readline.c
  282. readline.h
  283. README
  284. rules.mak
  285. s390-dis.c
  286. s390.ld
  287. savevm.c
  288. sh4-dis.c
  289. softmmu-semi.h
  290. softmmu_defs.h
  291. softmmu_exec.h
  292. softmmu_header.h
  293. softmmu_template.h
  294. sparc-dis.c
  295. sparc.ld
  296. sparc64.ld
  297. spice-qemu-char.c
  298. sysemu.h
  299. targphys.h
  300. tcg-runtime.c
  301. test-coroutine.c
  302. test-qmp-commands.c
  303. test-visitor.c
  304. thunk.c
  305. thunk.h
  306. TODO
  307. trace-events
  308. translate-all.c
  309. uboot_image.h
  310. usb-bsd.c
  311. usb-linux.c
  312. usb-redir.c
  313. usb-stub.c
  314. user-exec.c
  315. VERSION
  316. version.rc
  317. vgafont.h
  318. vl.c
  319. x86_64.ld
  320. xen-all.c
  321. xen-mapcache.c
  322. xen-mapcache.h
  323. xen-stub.c
  324. xtensa-semi.c