[Qemu-block] [PATCH for-2.3 1/4] ide: fix cmd_write_pio when nsectors 1
We need to adjust the sector being written to prior to calling ide_transfer_start, otherwise we'll write to the same sector again. Signed-off-by: John Snow js...@redhat.com --- hw/ide/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index ef52f35..0e9da64 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -846,6 +846,7 @@ static void ide_sector_write_cb(void *opaque, int ret) s-nsector -= n; s-io_buffer_offset += 512 * n; +ide_set_sector(s, ide_get_sector(s) + n); if (s-nsector == 0) { /* no more sectors to write */ ide_transfer_stop(s); @@ -857,7 +858,6 @@ static void ide_sector_write_cb(void *opaque, int ret) ide_transfer_start(s, s-io_buffer, n1 * BDRV_SECTOR_SIZE, ide_sector_write); } -ide_set_sector(s, ide_get_sector(s) + n); if (win2k_install_hack ((++s-irq_count % 16) == 0)) { /* It seems there is a bug in the Windows 2000 installer HDD -- 2.1.0
[Qemu-block] [PATCH for-2.3 4/4] ahci-test: improve rw buffer patterns
My pattern was cyclical every 256 bytes, so it missed a fairly obvious failure case. Add some rand() pepper into the test pattern, and for large patterns that exceed 256 sectors, start writing an ID per-sector so that we never generate identical sector patterns. Signed-off-by: John Snow js...@redhat.com --- tests/ahci-test.c | 36 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 169e83b..ea62e24 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -68,6 +68,32 @@ static void string_bswap16(uint16_t *s, size_t bytes) } } +static void generate_pattern(void *buffer, size_t len, size_t cycle_len) +{ +int i, j; +unsigned char *tx = (unsigned char *)buffer; +unsigned char p; +size_t *sx; + +/* Write an indicative pattern that varies and is unique per-cycle */ +p = rand() % 256; +for (i = j = 0; i len; i++, j++) { +tx[i] = p; +if (j % cycle_len == 0) { +p = rand() % 256; +} +} + +/* force uniqueness by writing an id per-cycle */ +for (i = 0; i len / cycle_len; i++) { +j = i * cycle_len; +if (j + sizeof(*sx) = len) { +sx = (size_t *)tx[j]; +*sx = i; +} +} +} + /*** Test Setup Teardown ***/ /** @@ -736,7 +762,6 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci, unsigned bufsize, { uint64_t ptr; uint8_t port; -unsigned i; unsigned char *tx = g_malloc(bufsize); unsigned char *rx = g_malloc0(bufsize); @@ -752,9 +777,7 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci, unsigned bufsize, g_assert(ptr); /* Write some indicative pattern to our buffer. */ -for (i = 0; i bufsize; i++) { -tx[i] = (bufsize - i); -} +generate_pattern(tx, bufsize, AHCI_SECTOR_SIZE); memwrite(ptr, tx, bufsize); /* Write this buffer to disk, then read it back to the DMA buffer. */ @@ -865,7 +888,6 @@ static void test_dma_fragmented(void) size_t bufsize = 4096; unsigned char *tx = g_malloc(bufsize); unsigned char *rx = g_malloc0(bufsize); -unsigned i; uint64_t ptr; ahci = ahci_boot_and_enable(); @@ -873,9 +895,7 @@ static void test_dma_fragmented(void) ahci_port_clear(ahci, px); /* create pattern */ -for (i = 0; i bufsize; i++) { -tx[i] = (bufsize - i); -} +generate_pattern(tx, bufsize, AHCI_SECTOR_SIZE); /* Create a DMA buffer in guest memory, and write our pattern to it. */ ptr = guest_alloc(ahci-parent-alloc, bufsize); -- 2.1.0
Re: [Qemu-block] [Qemu-devel] [PATCH v2 2/3] block: Introduce BDS.growing
On 03/19/2015 01:03 PM, Max Reitz wrote: This flag is set if the BDS's size can be increased by writing beyond its end. Signed-off-by: Max Reitz mre...@redhat.com --- block.c | 4 block/blkdebug.c | 2 ++ block/blkverify.c | 2 ++ block/iscsi.c | 2 ++ block/nbd.c | 2 ++ block/qcow2.c | 5 + block/quorum.c| 5 + block/raw_bsd.c | 1 + include/block/block_int.h | 3 +++ 9 files changed, 26 insertions(+) Reviewed-by: Eric Blake ebl...@redhat.com -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-block] [PATCH v5 05/13] block: Move BDS close notifiers into BB
On 03/03/2015 01:13 PM, Max Reitz wrote: The only remaining user of the BDS close notifiers is NBD which uses them to determine when a BDS tree is being ejected. This patch removes the BDS-level close notifiers and adds a notifier list to the BlockBackend structure that is invoked whenever a BDS is removed. Symmetrically to that, another notifier list is added that is invoked whenever a BDS is inserted. The dataplane implementations for virtio-blk and virtio-scsi use both notifier types for setting up and removing op blockers. This is not only important for setting up the op blockers on insertion, but also for removing them on ejection since bdrv_delete() asserts that there are no op blockers set up. Signed-off-by: Max Reitz mre...@redhat.com --- block.c | 7 block/block-backend.c | 19 +++--- blockdev-nbd.c | 36 +-- hw/block/dataplane/virtio-blk.c | 77 +++-- hw/scsi/virtio-scsi.c | 59 +++ include/block/block.h | 1 - include/block/block_int.h | 2 -- include/hw/virtio/virtio-scsi.h | 10 ++ include/sysemu/block-backend.h | 3 +- nbd.c | 13 +++ 10 files changed, 159 insertions(+), 68 deletions(-) Reviewed-by: Eric Blake ebl...@redhat.com -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-block] [Qemu-devel] [PULL 0/3] Block patches for 2.3.0-rc1
On 19 March 2015 at 15:16, Kevin Wolf kw...@redhat.com wrote: The following changes since commit cd232acfa0d70002fed89e9293f04afda577a513: Update version for v2.3.0-rc0 release (2015-03-17 18:58:33 +) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to fetch changes up to 5b347c541017b9ced10e8e9bce02d25bcf04c7af: block: Fix blockdev-backup not to use funky error class (2015-03-19 16:02:59 +0100) Block patches for 2.3.0-rc1 Applied, thanks. -- PMM
[Qemu-block] [PATCH v2 1/3] iotests: Make nested read in 072 and 089 read-only
iotests 072 and 089 create a nested qcow2-in-qcow2 image. This should be opened read-only, for one because it is indeed read only, and also because writing to it would probably turn out bad (the outer qcow2 image cannot grow on demand, so no clusters can be allocated for the inner one). Signed-off-by: Max Reitz mre...@redhat.com --- tests/qemu-iotests/072 | 2 +- tests/qemu-iotests/089 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072 index e4a723d..7bcf9f8 100755 --- a/tests/qemu-iotests/072 +++ b/tests/qemu-iotests/072 @@ -55,7 +55,7 @@ $QEMU_IO -c 'write -P 42 0 512' -c 'write -P 23 512 512' \ $QEMU_IMG convert -f raw -O $IMGFMT $TEST_IMG.base $TEST_IMG -$QEMU_IO -c open -o driver=$IMGFMT,file.driver=$IMGFMT,file.file.filename=$TEST_IMG \ +$QEMU_IO -c open -r -o driver=$IMGFMT,file.driver=$IMGFMT,file.file.filename=$TEST_IMG \ -c 'read -P 42 0 512' -c 'read -P 23 512 512' \ -c 'read -P 66 1024 512' | _filter_qemu_io diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089 index 3e0038d..af22e1f 100755 --- a/tests/qemu-iotests/089 +++ b/tests/qemu-iotests/089 @@ -69,7 +69,7 @@ $QEMU_IMG convert -f raw -O $IMGFMT $TEST_IMG.base $TEST_IMG $QEMU_IO_PROG --cache $CACHEMODE \ -c 'read -P 42 0 512' -c 'read -P 23 512 512' \ - -c 'read -P 66 1024 512' json:{ + -c 'read -P 66 1024 512' -r json:{ \driver\: \$IMGFMT\, \file\: { \driver\: \$IMGFMT\, -- 2.1.0
Re: [Qemu-block] [PATCH v5 09/13] block: Add list of all BlockDriverStates
On 03/03/2015 01:13 PM, Max Reitz wrote: Signed-off-by: Max Reitz mre...@redhat.com --- block.c | 10 ++ include/block/block_int.h | 2 ++ 2 files changed, 12 insertions(+) Might be nice to mention in the commit message why it is useful. But the code looked good enough for: Reviewed-by: Eric Blake ebl...@redhat.com -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature
[Qemu-block] [PULL 1/3] raw-posix: Deprecate host floppy passthrough
From: Markus Armbruster arm...@redhat.com Raise your hand if you have a physical floppy drive in a computer you've powered on in 2015. Okay, I see we got a few weirdos in the audience. That's okay, weirdos are welcome here. Kidding aside, media change detection doesn't fully work, isn't going to be fixed, and floppy passthrough just isn't earning its keep anymore. Deprecate block driver host_floppy now, so we can drop it after a grace period. Signed-off-by: Markus Armbruster arm...@redhat.com Reviewed-by: Gerd Hoffmann kra...@redhat.com Reviewed-by: Eric Blake ebl...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com Signed-off-by: Kevin Wolf kw...@redhat.com --- block/raw-posix.c| 2 ++ qapi/block-core.json | 2 ++ qemu-doc.texi| 5 +++-- qemu-options.hx | 3 +-- qmp-commands.hx | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index f0b4488..844ac21 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -2387,6 +2387,8 @@ static int floppy_open(BlockDriverState *bs, QDict *options, int flags, s-fd = -1; s-fd_media_changed = 1; +error_report(Host floppy pass-through is deprecated); +error_printf(Support for it will be removed in a future release.\n); return 0; } diff --git a/qapi/block-core.json b/qapi/block-core.json index 42c8850..ac839af 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -218,6 +218,7 @@ # 'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow', # 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat' # 2.2: 'archipelago' added, 'cow' dropped +# 2.3: 'host_floppy' deprecated # # @backing_file: #optional the name of the backing file (for copy-on-write) # @@ -1245,6 +1246,7 @@ # Drivers that are supported in block device operations. # # @host_device, @host_cdrom, @host_floppy: Since 2.1 +# @host_floppy: deprecated since 2.3 # # Since: 2.0 ## diff --git a/qemu-doc.texi b/qemu-doc.texi index 8aa6dbf..0125bc7 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -736,8 +736,7 @@ devices. We describe here the usage for QEMU version = 0.8.3. On Linux, you can directly use the host device filename instead of a disk image filename provided you have enough privileges to access -it. For example, use @file{/dev/cdrom} to access to the CDROM or -@file{/dev/fd0} for the floppy. +it. For example, use @file{/dev/cdrom} to access to the CDROM. @table @code @item CD @@ -749,6 +748,8 @@ You can specify a floppy device even if no floppy is loaded. Floppy removal is currently not detected accurately (if you change floppy without doing floppy access while the floppy is not loaded, the guest OS will think that the same floppy is loaded). +Use of the host's floppy device is deprecated, and support for it will +be removed in a future release. @item Hard disks Hard disks can be used. Normally you must specify the whole disk (@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can diff --git a/qemu-options.hx b/qemu-options.hx index c513352..ffaf327 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -419,8 +419,7 @@ STEXI @item -fdb @var{file} @findex -fda @findex -fdb -Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). You can -use the host floppy by using @file{/dev/fd0} as filename (@pxref{host_drives}). +Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). ETEXI DEF(hda, HAS_ARG, QEMU_OPTION_hda, diff --git a/qmp-commands.hx b/qmp-commands.hx index 0663924..faf75da 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2154,7 +2154,7 @@ Each json-object contain the following: - drv: driver format name (json-string) - Possible values: blkdebug, bochs, cloop, dmg, file, file, ftp, ftps, host_cdrom, -host_device, host_floppy, http, https, +host_device, http, https, nbd, parallels, qcow, qcow2, raw, tftp, vdi, vmdk, vpc, vvfat - backing_file: backing file name (json-string, optional) -- 1.8.3.1