summaryrefslogtreecommitdiff
path: root/block
AgeCommit message (Collapse)AuthorFilesLines
2014-01-10Merge remote-tracking branch 'bonzini/scsi-next' into stagingAnthony Liguori1-1/+10
* bonzini/scsi-next: scsi-disk: add UNMAP limits to block limits VPD page block/iscsi: use a bh to schedule co reentrance Message-id: 1387720926-11421-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-12-20commit: Remove unused checkFam Zheng1-7/+1
We support top == active for commit now, remove the check and add an assertion here. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20commit: Support commit active layerFam Zheng1-0/+11
If active is top, it will be mirrored to base, (with block/mirror.c code), then the image is switched when user completes the block job. QMP documentation is updated. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20block: Add commit_active_start()Fam Zheng1-16/+50
commit_active_start is implemented in block/mirror.c, It will create a job with "commit" type and designated base in block-commit command. This will be used for committing active layer of device. Sync mode is removed from MirrorBlockJob because there's no proper type for commit. The used information is is_none_mode. The common part of mirror_start and commit_active_start is moved to mirror_start_job(). Fix the comment wording for commit_start. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20mirror: Move base to MirrorBlockJobFam Zheng1-2/+10
This allows setting the base before entering mirror_run, commit will make use of it. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20mirror: Don't close targetFam Zheng1-1/+0
Let reference count manage target and don't call bdrv_close here. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20vmdk: Allow vmdk_create to work with protocolFam Zheng1-69/+95
This improves vmdk_create to use bdrv_* functions to replace qemu_open and other fd functions. The error handling are improved as well. One difference is that bdrv_pwrite will round up buffer to sectors, so for description file, an extra bdrv_truncate is used in the end to drop inding zeros. Notes: - A bonus bug fix is correct endian is used in initializing GD entries. - ROUND_UP and DIV_ROUND_UP are used where possible. I tested that new code produces exactly the same file as previously. Signed-off-by: Fam Zheng <famz@redhat.com> Tested-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20vmdk: Check VMFS extent line field numberFam Zheng1-2/+7
VMFS extent line in description file should be with 4 fields: RW <size> VMFS "file-name.vmdk" Check the number explicitly and report error if offset is appended as FLAT, which should be invalid format. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20block: vhdx - improve error message, and .bdrv_check implementationJeff Cody3-4/+36
If there is a dirty log file to be replayed in a VHDX image, it is replayed in .vhdx_open(). However, if the file is opened read-only, then a somewhat cryptic error message results. This adds a more helpful error message for the user. If an image file contains a log to be replayed, and is opened read-only, the user is instructed to run 'qemu-img check -r all' on the image file. Running qemu-img check -r all will cause the image file to be opened r/w, which will replay the log file. If a log file replay is detected, this is flagged, and bdrv_check will increase the corruptions_fixed count for the image. [Fixed typo in error message that was pointed out by Eric Blake <eblake@redhat.com>. --Stefan] Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20block/iscsi: Fix compilation for libiscsi 1.4.0 (API change)Stefan Weil1-1/+4
Function iscsi_read10_task got additional parameters starting with version libiscsi 1.5.0. libiscsi 1.4.0 is still widely used (Debian wheezy, jessie and other Linux distributions currently provide packages for QEMU which use it), so we still need support for this older API. Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20sheepdog: fix dynamic grow for running qcow2 formatLiu Yuan1-3/+4
When running qcow2 over sheepdog, we might meet following problem qemu-system-x86_64: shrinking is not supported And cause IO errors to Guest. This is because we abuse bs->total_sectors, which is manipulated by generic block layer and race with sheepdog code. We should directly check if offset > vdi_size to dynamically enlarge the volume instead of 'offset > bs->total_sectors', which will cause problem when following case happens: vdi_size > offset > bs->total_sectors # then trigger sd_truncate() to shrink the volume wrongly. Cc: qemu-devel@nongnu.org Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Reported-by: Hadrien KOHL <hadrien.kohl@gmail.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-16Merge remote-tracking branch 'spice/tags/pull-spice-1' into stagingAnthony Liguori4-348/+469
Collection of little cleanups anf bugfixes. nbd patches in preparation of spice-nbd. # gpg: Signature made Mon 16 Dec 2013 01:27:45 AM PST using RSA key ID D3E87138 # gpg: Can't check signature: public key not found # By Marc-André Lureau (12) and Gerd Hoffmann (4) # Via Gerd Hoffmann * spice/tags/pull-spice-1: spice: stop server for qxl hard reset spice: move spice_server_vm_{start,stop} calls into qemu_spice_display_*() spice: move qemu_spice_display_*() from spice-graphics to spice-core nbd: avoid uninitialized warnings nbd: finish any pending coroutine nbd: make nbd_client_session_close() idempotent nbd: pass export name as init argument nbd: don't change socket block during negotiate Split nbd block client code spice-char: implement chardev port event char: add qemu_chr_fe_event() include: add missing config-host.h include qmp_change_blockdev() remove unused has_format spice-char: remove unused field vscclient: do not add a socket watch if there is not data to send spice: flip streaming video mode to off by default
2013-12-16Merge remote-tracking branch 'kwolf/tags/for-anthony' into stagingAnthony Liguori3-28/+31
Block patches # gpg: Signature made Fri 13 Dec 2013 09:47:03 AM PST using RSA key ID C88F2FD6 # gpg: Can't check signature: public key not found # By Peter Lieven (2) and others # Via Kevin Wolf * kwolf/tags/for-anthony: blkdebug: Use QLIST_FOREACH_SAFE to resume IO qemu-img: make progress output more accurate during convert block: expect get_block_status errors in bdrv_make_zero block/vvfat: Fix compiler warnings for OpenBSD qapi-schema.json: Change 1.8 reference to 2.0 sheepdog: check if '-o redundancy' is passed from user Message-id: 1386956943-19474-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-12-16block/iscsi: use a bh to schedule co reentrancePeter Lieven1-1/+10
this fixes a potential segfault and performance regression. If the coroutine is reentered directly in the iscsi_co_generic_cb iscsi_process_{read,write} are interrupted and reentered any time later. One the one hand this could happen after an iscsi_close where the iscsi context is already gone (segfault). On the other hand this limits the number of processed callbacks in each aio_dispatch to one (potential performance regression). Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-12-16nbd: avoid uninitialized warningsMarc-André Lureau1-12/+9
==15815== Thread 1: ==15815== Syscall param socketcall.sendto(msg) points to uninitialised byte(s) ==15815== at 0x65AD5CB: send (send.c:31) ==15815== by 0x37F84B: nbd_wr_sync (nbd.c:145) ==15815== by 0x37F94B: write_sync (nbd.c:186) ==15815== by 0x380FA9: nbd_send_request (nbd.c:681) ==15815== by 0x1C4A2D: nbd_teardown_connection (nbd-client.c:337) ==15815== by 0x1C4AD8: nbd_client_session_close (nbd-client.c:354) ==15815== by 0x1ED2D8: close_socketpair (spicebd.c:132) ==15815== by 0x1EE265: spice_close (spicebd.c:457) ==15815== by 0x1ACBF6: bdrv_close (block.c:1519) ==15815== by 0x1AD804: bdrv_delete (block.c:1772) ==15815== by 0x1B4136: bdrv_unref (block.c:4476) ==15815== by 0x1ACCE0: bdrv_close (block.c:1541) ==15815== Address 0x7feffef98 is on thread 1's stack Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-16nbd: finish any pending coroutineMarc-André Lureau1-5/+16
Make sure all pending coroutines are finished when closing the session. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-16nbd: make nbd_client_session_close() idempotentMarc-André Lureau1-0/+5
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-16nbd: pass export name as init argumentMarc-André Lureau3-13/+14
There is no need to keep the export name around, and it seems a better fit as an argument in the init() call. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-16nbd: don't change socket block during negotiateMarc-André Lureau1-0/+1
The caller might handle non-blocking using coroutine. Leave the choice to the caller to use a blocking or non-blocking negotiate. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-16Split nbd block client codeMarc-André Lureau4-346/+452
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-13blkdebug: Use QLIST_FOREACH_SAFE to resume IOFam Zheng1-4/+4
Qemu-iotest 030 was broken. When the coroutine runs and finishes, it will remove itself from the req list, so let's use safe version of foreach to avoid use after free. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-12-13block/vvfat: Fix compiler warnings for OpenBSDStefan Weil1-21/+22
The buildbot shows these compiler warnings: block/vvfat.c: In function 'create_short_and_long_name': block/vvfat.c:620: warning: array size (8) smaller than bound length (11) block/vvfat.c:620: warning: array size (8) smaller than bound length (11) block/vvfat.c:635: warning: array size (8) smaller than bound length (11) block/vvfat.c:635: warning: array size (8) smaller than bound length (11) They are caused by tricky code where 8 characters for the name are followed by 3 characters for the extension, and some operations touch both name and extension. Using an 11 character name which includes the extension fixes the compiler warning, satisfies cppcheck, valgrind and maybe other static and dynamic code checkers, and even simplifies some parts of the code. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-12-13sheepdog: check if '-o redundancy' is passed from userLiu Yuan1-3/+5
This fix a segfault (that is caused by b3af018f3) of following command: $ qemu-img convert some_img sheepdog:some_img Cc: qemu-devel@nongnu.org Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-12-09block/iscsi: introduce bdrv_co_{readv, writev, flush_to_disk}Peter Lieven1-296/+105
this converts read, write and flush functions from aio to coroutines eliminating almost 200 lines of code. The requirement for libiscsi is bumped to version 1.4.0 which was released in may 2012. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-12-06qcow2: use start_of_cluster() and offset_into_cluster() everywhereHu Tao2-12/+12
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-05block/iscsi: set bs->bl.opt_transfer_lengthPeter Lieven1-0/+3
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-05block/iscsi: set bdi->cluster_sizePeter Lieven1-0/+7
this patch aims to set bdi->cluster_size to the internal page size of the iscsi target so that enabled callers can align requests properly. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qemu-nbd: support internal snapshot exportWenchao Xia1-0/+18
Now it is possible to directly export an internal snapshot, which can be used to probe the snapshot's contents without qemu-img convert. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04snapshot: distinguish id and name in load_tmpWenchao Xia3-6/+68
Since later this function will be used so improve it. The only caller of it now is qemu-img, and it is not impacted by introduce function bdrv_snapshot_load_tmp_by_id_or_name() that call bdrv_snapshot_load_tmp() twice to keep old search logic. bdrv_snapshot_load_tmp_by_id_or_name() return int to let caller know the errno, and errno will be used later. Also fix a typo in comments of bdrv_snapshot_delete(). Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qcow2: Zero-initialise first cluster for new imagesKevin Wolf1-16/+20
Strictly speaking, this is only required for has_zero_init() == false, but it's easy enough to just do a cluster-aligned write that is padded with zeros after the header. This fixes that after 'qemu-img create' header extensions are attempted to be parsed that are really just random leftover data. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03raw-posix: add support for write_zeroes on XFS and block devicesPaolo Bonzini2-13/+74
The code is similar to the implementation of discard and write_zeroes with UNMAP. However, failure must be propagated up to block.c. The stale page cache problem can be reproduced as follows: # modprobe scsi-debug lbpws=1 lbprz=1 # ./qemu-io /dev/sdXX qemu-io> write -P 0xcc 0 2M qemu-io> write -z 0 1M qemu-io> read -P 0x00 0 512 Pattern verification failed at offset 0, 512 bytes qemu-io> read -v 0 512 00000000: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................ ... # ./qemu-io --cache=none /dev/sdXX qemu-io> write -P 0xcc 0 2M qemu-io> write -z 0 1M qemu-io> read -P 0x00 0 512 qemu-io> read -v 0 512 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ... And similarly with discard instead of "write -z". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03raw-posix: implement write_zeroes with MAY_UNMAP for block devicesPaolo Bonzini1-0/+37
See the next commit for the description of the Linux kernel problem that is worked around in raw_open_common. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03raw-posix: implement write_zeroes with MAY_UNMAP for filesPaolo Bonzini1-2/+64
Writing zeroes to a file can be done by punching a hole if MAY_UNMAP is set. Note that in this case ENOTSUP is not ignored, but makes the block layer fall back to the generic implementation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block/iscsi: check WRITE SAME support differently depending on MAY_UNMAPPaolo Bonzini1-2/+17
The current check is right for MAY_UNMAP=1. For MAY_UNMAP=0, just try and fall back to regular writes as soon as a WRITE SAME command fails. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block/iscsi: updated copyrightPeter Lieven1-0/+1
added myself to reflect recent work on the iscsi block driver. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block/iscsi: remove .bdrv_has_zero_initPeter Lieven1-7/+0
since commit 3ac21627 the default value changed to 0. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block drivers: expose requirement for write same alignment from formatsPaolo Bonzini3-0/+6
This will let misaligned but large requests use zero clusters. This is important because the cluster size is not guest visible. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block drivers: add discard/write_zeroes properties to bdrv_get_info ↵Paolo Bonzini5-0/+9
implementation Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03vpc, vhdx: add get_infoPaolo Bonzini2-0/+24
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: handle ENOTSUP from discard in generic codePaolo Bonzini1-6/+6
Similar to write_zeroes, let the generic code receive a ENOTSUP for discard operations. Since bdrv_discard has advisory semantics, we can just swallow the error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03vmdk: Fix creating big description fileFam Zheng1-24/+38
The buffer for description file was 4096 which only covers a few hundred of extents. This changes the buffer to dynamic allocated with g_strdup_printf in order to support bigger cases. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29vmdk: Allow read only open of VMDK version 3Fam Zheng1-1/+8
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29block: Use BDRV_O_NO_BACKING where appropriateKevin Wolf2-2/+3
If you open an image temporarily just because you want to check its size or get it flushed, there's no real reason to open the whole backing file chain. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
2013-11-29blkdebug: add "remove_break" commandFam Zheng1-0/+27
This adds "remove_break" command which is the reverse of blkdebug command "break": it removes all breakpoints with given tag and resumes all the requests. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29sheepdog: support user-defined redundancy optionLiu Yuan1-1/+73
Sheepdog support two kinds of redundancy, full replication and erasure coding. # create a fully replicated vdi with x copies -o redundancy=x (1 <= x <= SD_MAX_COPIES) # create a erasure coded vdi with x data strips and y parity strips -o redundancy=x:y (x must be one of {2,4,8,16} and 1 <= y < SD_EC_MAX_STRIP) E.g, to convert a vdi into sheepdog vdi 'test' with 8:3 erasure coding scheme $ qemu-img convert -o redundancy=8:3 linux-0.2.img sheepdog:test Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29sheepdog: refactor do_sd_create()Liu Yuan1-22/+15
We can actually use BDRVSheepdogState *s to pass most of the parameters. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29COW: Extend checking allocated bits to beyond one sectorCharlie Shepherd1-10/+26
cow_co_is_allocated() only checks one sector's worth of allocated bits before returning. This is allowed but (slightly) inefficient, so extend it to check all of the file's metadata sectors. Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> [kwolf: silenced compiler warning (-Wmaybe-uninitialized for changed)] Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29COW: Speed up writesCharlie Shepherd1-38/+50
Process a whole sector's worth of COW bits by reading a sector, setting the bits after skipping any already set bits, then writing it out again. Make sure we only flush once before writing metadata, and only if we need to write metadata. Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29qapi: Change BlockDirtyInfo to listFam Zheng1-0/+5
We have multiple dirty bitmaps in BDS now, switch QAPI to allow query it (BlockInfo.dirty_bitmaps), and also drop old BlockInfo.dirty. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29block: per caller dirty bitmapFam Zheng2-18/+13
Previously a BlockDriverState has only one dirty bitmap, so only one caller (e.g. a block job) can keep track of writing. This changes the dirty bitmap to a list and creates a BdrvDirtyBitmap for each caller, the lifecycle is managed with these new functions: bdrv_create_dirty_bitmap bdrv_release_dirty_bitmap Where BdrvDirtyBitmap is a linked list wrapper structure of HBitmap. In place of bdrv_set_dirty_tracking, a BdrvDirtyBitmap pointer argument is added to these functions, since each caller has its own dirty bitmap: bdrv_get_dirty bdrv_dirty_iter_init bdrv_get_dirty_count bdrv_set_dirty and bdrv_reset_dirty prototypes are unchanged but will internally walk the list of all dirty bitmaps and set them one by one. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>