qcow2: Support exact L1 table growth

The L1 table grow operation includes a size calculation that bumps up
the new L1 table size in order to anticipate the size needs of vmstate
data.  This helps reduce the number of times that the L1 table has to be
grown when vmstate data is appended.

This size overhead is not necessary during image creation,
bdrv_truncate(), or snapshot goto operations.  In fact, existing
qemu-iotests that exercise table growth are no longer able to trigger it
because image creation preallocates an L1 table that is too large after
changes to qcow_create2().

This patch keeps the size calculation but also adds exact growth for
callers that do not want to inflate the L1 table size unnecessarily.

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