* [Qemu-devel] [PULL 00/19] Block patches
@ 2010-06-15 14:19 Kevin Wolf
2010-06-15 14:26 ` Anthony Liguori
0 siblings, 1 reply; 36+ messages in thread
From: Kevin Wolf @ 2010-06-15 14:19 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
The following changes since commit fd42deeb4cb42f90084046e3ebdb4383953195e3:
Gerd Hoffmann (1):
Add exit notifiers.
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
Blue Swirl (1):
block: fix a warning and possible truncation
Christoph Hellwig (3):
cow: use pread/pwrite
cow: stop using mmap
cow: use qemu block API
Jan Kiszka (1):
xen: Fix build error due to missing include
Jes Sorensen (1):
Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE
Kevin Wolf (5):
vpc: Read/write multiple sectors at once
qcow2: Allow get_refcount to return errors
qcow2: Allow alloc_clusters_noref to return errors
qcow2: Return real error code in load_refcount_block
qcow2: Restore L1 entry on l2_allocate failure
Markus Armbruster (7):
Fix regression for "-drive file="
block: Move error actions from DriveInfo to BlockDriverState
block: Decouple block device "commit all" from DriveInfo
monitor: Make "commit FOO" complain when FOO doesn't exist
block: New bdrv_next()
block: Decouple savevm from DriveInfo
blockdev: Give drives internal linkage
Miguel Di Ciurcio Filho (1):
savevm: Really verify if a drive supports snapshots
block.c | 49 ++++++++++++++++++-
block.h | 11 ++++
block/cow.c | 127 ++++++++++++++++++++++++++----------------------
block/qcow2-cluster.c | 1 +
block/qcow2-refcount.c | 70 +++++++++++++++++++++++----
block/vpc.c | 41 +++++++++++----
block_int.h | 1 +
blockdev.c | 39 +++++---------
blockdev.h | 12 -----
hw/fdc.c | 4 +-
hw/ide/core.c | 2 +-
hw/scsi-disk.c | 2 +-
hw/virtio-blk.c | 3 +-
hw/xen_backend.h | 1 +
qemu-char.c | 7 +--
qemu-common.h | 3 -
qemu-malloc.c | 5 --
savevm.c | 90 +++++++++++++++++++---------------
18 files changed, 291 insertions(+), 177 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2010-06-15 14:19 Kevin Wolf
@ 2010-06-15 14:26 ` Anthony Liguori
0 siblings, 0 replies; 36+ messages in thread
From: Anthony Liguori @ 2010-06-15 14:26 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On 06/15/2010 09:19 AM, Kevin Wolf wrote:
> The following changes since commit fd42deeb4cb42f90084046e3ebdb4383953195e3:
> Gerd Hoffmann (1):
> Add exit notifiers.
>
> are available in the git repository at:
>
> git://repo.or.cz/qemu/kevin.git for-anthony
>
Merged. Thanks.
Regards,
Anthony Liguori
> Blue Swirl (1):
> block: fix a warning and possible truncation
>
> Christoph Hellwig (3):
> cow: use pread/pwrite
> cow: stop using mmap
> cow: use qemu block API
>
> Jan Kiszka (1):
> xen: Fix build error due to missing include
>
> Jes Sorensen (1):
> Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE
>
> Kevin Wolf (5):
> vpc: Read/write multiple sectors at once
> qcow2: Allow get_refcount to return errors
> qcow2: Allow alloc_clusters_noref to return errors
> qcow2: Return real error code in load_refcount_block
> qcow2: Restore L1 entry on l2_allocate failure
>
> Markus Armbruster (7):
> Fix regression for "-drive file="
> block: Move error actions from DriveInfo to BlockDriverState
> block: Decouple block device "commit all" from DriveInfo
> monitor: Make "commit FOO" complain when FOO doesn't exist
> block: New bdrv_next()
> block: Decouple savevm from DriveInfo
> blockdev: Give drives internal linkage
>
> Miguel Di Ciurcio Filho (1):
> savevm: Really verify if a drive supports snapshots
>
> block.c | 49 ++++++++++++++++++-
> block.h | 11 ++++
> block/cow.c | 127 ++++++++++++++++++++++++++----------------------
> block/qcow2-cluster.c | 1 +
> block/qcow2-refcount.c | 70 +++++++++++++++++++++++----
> block/vpc.c | 41 +++++++++++----
> block_int.h | 1 +
> blockdev.c | 39 +++++---------
> blockdev.h | 12 -----
> hw/fdc.c | 4 +-
> hw/ide/core.c | 2 +-
> hw/scsi-disk.c | 2 +-
> hw/virtio-blk.c | 3 +-
> hw/xen_backend.h | 1 +
> qemu-char.c | 7 +--
> qemu-common.h | 3 -
> qemu-malloc.c | 5 --
> savevm.c | 90 +++++++++++++++++++---------------
> 18 files changed, 291 insertions(+), 177 deletions(-)
>
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PULL 00/19] Block patches
@ 2011-10-21 17:18 Kevin Wolf
2011-10-24 16:19 ` Anthony Liguori
0 siblings, 1 reply; 36+ messages in thread
From: Kevin Wolf @ 2011-10-21 17:18 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
The following changes since commit c2e2343e1faae7bbc77574c12a25881b1b696808:
hw/arm_gic.c: Fix save/load of irq_target array (2011-10-21 17:19:56 +0200)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
Alex Jia (1):
fix memory leak in aio_write_f
Kevin Wolf (5):
xen_disk: Always set feature-barrier = 1
fdc: Fix floppy port I/O
qemu-img: Don't allow preallocation and compression at the same time
qcow2: Fix bdrv_write_compressed error handling
pc: Fix floppy drives with if=none
Paolo Bonzini (12):
sheepdog: add coroutine_fn markers
add socket_set_block
block: rename bdrv_co_rw_bh
block: unify flush implementations
block: add bdrv_co_discard and bdrv_aio_discard support
vmdk: fix return values of vmdk_parent_open
vmdk: clean up open
block: add a CoMutex to synchronous read drivers
block: take lock around bdrv_read implementations
block: take lock around bdrv_write implementations
block: change flush to co_flush
block: change discard to co_discard
Stefan Hajnoczi (1):
block: drop redundant bdrv_flush implementation
block.c | 258 ++++++++++++++++++++++++++++++-------------------
block.h | 5 +
block/blkdebug.c | 6 -
block/blkverify.c | 9 --
block/bochs.c | 15 +++-
block/cloop.c | 15 +++-
block/cow.c | 34 ++++++-
block/dmg.c | 15 +++-
block/nbd.c | 28 +++++-
block/parallels.c | 15 +++-
block/qcow.c | 17 +---
block/qcow2-cluster.c | 6 +-
block/qcow2.c | 72 ++++++--------
block/qed.c | 6 -
block/raw-posix.c | 23 +----
block/raw-win32.c | 4 +-
block/raw.c | 23 ++---
block/rbd.c | 4 +-
block/sheepdog.c | 14 ++--
block/vdi.c | 6 +-
block/vmdk.c | 82 ++++++++++------
block/vpc.c | 34 ++++++-
block/vvfat.c | 28 +++++-
block_int.h | 9 +-
hw/fdc.c | 14 +++
hw/fdc.h | 9 ++-
hw/pc.c | 25 +++--
hw/pc.h | 3 +-
hw/pc_piix.c | 5 +-
hw/xen_disk.c | 5 +-
oslib-posix.c | 7 ++
oslib-win32.c | 6 +
qemu-img.c | 11 ++
qemu-io.c | 1 +
qemu_socket.h | 1 +
trace-events | 1 +
36 files changed, 524 insertions(+), 292 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2011-10-21 17:18 Kevin Wolf
@ 2011-10-24 16:19 ` Anthony Liguori
0 siblings, 0 replies; 36+ messages in thread
From: Anthony Liguori @ 2011-10-24 16:19 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On 10/21/2011 12:18 PM, Kevin Wolf wrote:
> The following changes since commit c2e2343e1faae7bbc77574c12a25881b1b696808:
>
> hw/arm_gic.c: Fix save/load of irq_target array (2011-10-21 17:19:56 +0200)
>
> are available in the git repository at:
> git://repo.or.cz/qemu/kevin.git for-anthony
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Alex Jia (1):
> fix memory leak in aio_write_f
>
> Kevin Wolf (5):
> xen_disk: Always set feature-barrier = 1
> fdc: Fix floppy port I/O
> qemu-img: Don't allow preallocation and compression at the same time
> qcow2: Fix bdrv_write_compressed error handling
> pc: Fix floppy drives with if=none
>
> Paolo Bonzini (12):
> sheepdog: add coroutine_fn markers
> add socket_set_block
> block: rename bdrv_co_rw_bh
> block: unify flush implementations
> block: add bdrv_co_discard and bdrv_aio_discard support
> vmdk: fix return values of vmdk_parent_open
> vmdk: clean up open
> block: add a CoMutex to synchronous read drivers
> block: take lock around bdrv_read implementations
> block: take lock around bdrv_write implementations
> block: change flush to co_flush
> block: change discard to co_discard
>
> Stefan Hajnoczi (1):
> block: drop redundant bdrv_flush implementation
>
> block.c | 258 ++++++++++++++++++++++++++++++-------------------
> block.h | 5 +
> block/blkdebug.c | 6 -
> block/blkverify.c | 9 --
> block/bochs.c | 15 +++-
> block/cloop.c | 15 +++-
> block/cow.c | 34 ++++++-
> block/dmg.c | 15 +++-
> block/nbd.c | 28 +++++-
> block/parallels.c | 15 +++-
> block/qcow.c | 17 +---
> block/qcow2-cluster.c | 6 +-
> block/qcow2.c | 72 ++++++--------
> block/qed.c | 6 -
> block/raw-posix.c | 23 +----
> block/raw-win32.c | 4 +-
> block/raw.c | 23 ++---
> block/rbd.c | 4 +-
> block/sheepdog.c | 14 ++--
> block/vdi.c | 6 +-
> block/vmdk.c | 82 ++++++++++------
> block/vpc.c | 34 ++++++-
> block/vvfat.c | 28 +++++-
> block_int.h | 9 +-
> hw/fdc.c | 14 +++
> hw/fdc.h | 9 ++-
> hw/pc.c | 25 +++--
> hw/pc.h | 3 +-
> hw/pc_piix.c | 5 +-
> hw/xen_disk.c | 5 +-
> oslib-posix.c | 7 ++
> oslib-win32.c | 6 +
> qemu-img.c | 11 ++
> qemu-io.c | 1 +
> qemu_socket.h | 1 +
> trace-events | 1 +
> 36 files changed, 524 insertions(+), 292 deletions(-)
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PULL 00/19] Block patches
@ 2012-09-24 14:26 Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 01/19] blockdev: preserve readonly and snapshot states across media changes Kevin Wolf
` (19 more replies)
0 siblings, 20 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
The following changes since commit d3e8f95753114a827f9cd8e819b1d5cc8333f76b:
w32: Add implementation of gmtime_r, localtime_r (2012-09-23 17:09:30 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
Jeff Cody (18):
block: correctly set the keep_read_only flag
block: make bdrv_set_enable_write_cache() modify open_flags
block: Framework for reopening files safely
block: move aio initialization into a helper function
block: move open flag parsing in raw block drivers to helper functions
block: do not parse BDRV_O_CACHE_WB in block drivers
block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c
block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c
block: raw-posix image file reopen
block: raw image file reopen
block: qed image file reopen
block: qcow2 image file reopen
block: qcow image file reopen
block: vmdk image file reopen
block: vdi image file reopen
block: vpc image file reopen
block: convert bdrv_commit() to use bdrv_reopen()
block: remove keep_read_only flag from BlockDriverState struct
Kevin Shanahan (1):
blockdev: preserve readonly and snapshot states across media changes
block.c | 299 ++++++++++++++++++++++++++++++++++++++++++++---------
block.h | 18 +++
block/iscsi.c | 4 -
block/qcow.c | 10 ++
block/qcow2.c | 10 ++
block/qed.c | 9 ++
block/raw-posix.c | 225 ++++++++++++++++++++++++++++++----------
block/raw-win32.c | 40 ++++----
block/raw.c | 10 ++
block/rbd.c | 6 -
block/sheepdog.c | 14 +--
block/vdi.c | 7 ++
block/vmdk.c | 35 ++++++
block/vpc.c | 7 ++
block_int.h | 9 ++-
blockdev.c | 2 +
16 files changed, 563 insertions(+), 142 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 01/19] blockdev: preserve readonly and snapshot states across media changes
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 02/19] block: correctly set the keep_read_only flag Kevin Wolf
` (18 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Kevin Shanahan <kmshanah@disenchant.net>
If readonly=on is given at device creation time, the ->readonly flag
needs to be set in the block driver state for this device so that
readonly-ness is preserved across media changes (qmp change command).
Similarly, to preserve the snapshot property requires ->open_flags to
be correct.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 7c83baa..e5d450f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -527,6 +527,8 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
if_name[type], mediastr, unit_id);
}
dinfo->bdrv = bdrv_new(dinfo->id);
+ dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
+ dinfo->bdrv->read_only = ro;
dinfo->devaddr = devaddr;
dinfo->type = type;
dinfo->bus = bus_id;
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 02/19] block: correctly set the keep_read_only flag
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 01/19] blockdev: preserve readonly and snapshot states across media changes Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 03/19] block: make bdrv_set_enable_write_cache() modify open_flags Kevin Wolf
` (17 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
I believe the bs->keep_read_only flag is supposed to reflect
the initial open state of the device. If the device is initially
opened R/O, then commit operations, or reopen operations changing
to R/W, are prohibited.
Currently, the keep_read_only flag is only accurate for the active
layer, and its backing file. Subsequent images end up always having
the keep_read_only flag set.
For instance, what happens now:
[ base ] kro = 1, ro = 1
|
v
[ snap-1 ] kro = 1, ro = 1
|
v
[ snap-2 ] kro = 0, ro = 1
|
v
[ active ] kro = 0, ro = 0
What we want:
[ base ] kro = 0, ro = 1
|
v
[ snap-1 ] kro = 0, ro = 1
|
v
[ snap-2 ] kro = 0, ro = 1
|
v
[ active ] kro = 0, ro = 0
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 14 +++++++-------
block.h | 1 +
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/block.c b/block.c
index e78039b..4c0e7f5 100644
--- a/block.c
+++ b/block.c
@@ -668,7 +668,7 @@ static int bdrv_open_common(BlockDriverState *bs, const char *filename,
open_flags |= BDRV_O_RDWR;
}
- bs->keep_read_only = bs->read_only = !(open_flags & BDRV_O_RDWR);
+ bs->read_only = !(open_flags & BDRV_O_RDWR);
/* Open the image, either directly or using a protocol */
if (drv->bdrv_file_open) {
@@ -808,6 +808,12 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
goto unlink_and_fail;
}
+ if (flags & BDRV_O_RDWR) {
+ flags |= BDRV_O_ALLOW_RDWR;
+ }
+
+ bs->keep_read_only = !(flags & BDRV_O_ALLOW_RDWR);
+
/* Open the image */
ret = bdrv_open_common(bs, filename, flags, drv);
if (ret < 0) {
@@ -837,12 +843,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
bdrv_close(bs);
return ret;
}
- if (bs->is_temporary) {
- bs->backing_hd->keep_read_only = !(flags & BDRV_O_RDWR);
- } else {
- /* base image inherits from "parent" */
- bs->backing_hd->keep_read_only = bs->keep_read_only;
- }
}
if (!bdrv_key_required(bs)) {
diff --git a/block.h b/block.h
index 2e2be11..4d919c2 100644
--- a/block.h
+++ b/block.h
@@ -80,6 +80,7 @@ typedef struct BlockDevOps {
#define BDRV_O_COPY_ON_READ 0x0400 /* copy read backing sectors into image */
#define BDRV_O_INCOMING 0x0800 /* consistency hint for incoming migration */
#define BDRV_O_CHECK 0x1000 /* open solely for consistency check */
+#define BDRV_O_ALLOW_RDWR 0x2000 /* allow reopen to change from r/o to r/w */
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH)
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 03/19] block: make bdrv_set_enable_write_cache() modify open_flags
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 01/19] blockdev: preserve readonly and snapshot states across media changes Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 02/19] block: correctly set the keep_read_only flag Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 04/19] block: Framework for reopening files safely Kevin Wolf
` (16 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
bdrv_set_enable_write_cache() sets the bs->enable_write_cache flag,
but without the flag recorded in bs->open_flags, then next time
a reopen() is performed the enable_write_cache setting may be
inadvertently lost.
This will set the flag in open_flags, so it is preserved across
reopens.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 4c0e7f5..458bcc9 100644
--- a/block.c
+++ b/block.c
@@ -2168,6 +2168,13 @@ int bdrv_enable_write_cache(BlockDriverState *bs)
void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce)
{
bs->enable_write_cache = wce;
+
+ /* so a reopen() will preserve wce */
+ if (wce) {
+ bs->open_flags |= BDRV_O_CACHE_WB;
+ } else {
+ bs->open_flags &= ~BDRV_O_CACHE_WB;
+ }
}
int bdrv_is_encrypted(BlockDriverState *bs)
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 04/19] block: Framework for reopening files safely
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (2 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 03/19] block: make bdrv_set_enable_write_cache() modify open_flags Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 05/19] block: move aio initialization into a helper function Kevin Wolf
` (15 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
This is based on Supriya Kannery's bdrv_reopen() patch series.
This provides a transactional method to reopen multiple
images files safely.
Image files are queue for reopen via bdrv_reopen_queue(), and the
reopen occurs when bdrv_reopen_multiple() is called. Changes are
staged in bdrv_reopen_prepare() and in the equivalent driver level
functions. If any of the staged images fails a prepare, then all
of the images left untouched, and the staged changes for each image
abandoned.
Block drivers are passed a reopen state structure, that contains:
* BDS to reopen
* flags for the reopen
* opaque pointer for any driver-specific data that needs to be
persistent from _prepare to _commit/_abort
* reopen queue pointer, if the driver needs to queue additional
BDS for a reopen
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
block.h | 17 +++++
block_int.h | 8 ++
3 files changed, 257 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 458bcc9..c7c1a3b 100644
--- a/block.c
+++ b/block.c
@@ -863,6 +863,238 @@ unlink_and_fail:
return ret;
}
+typedef struct BlockReopenQueueEntry {
+ bool prepared;
+ BDRVReopenState state;
+ QSIMPLEQ_ENTRY(BlockReopenQueueEntry) entry;
+} BlockReopenQueueEntry;
+
+/*
+ * Adds a BlockDriverState to a simple queue for an atomic, transactional
+ * reopen of multiple devices.
+ *
+ * bs_queue can either be an existing BlockReopenQueue that has had QSIMPLE_INIT
+ * already performed, or alternatively may be NULL a new BlockReopenQueue will
+ * be created and initialized. This newly created BlockReopenQueue should be
+ * passed back in for subsequent calls that are intended to be of the same
+ * atomic 'set'.
+ *
+ * bs is the BlockDriverState to add to the reopen queue.
+ *
+ * flags contains the open flags for the associated bs
+ *
+ * returns a pointer to bs_queue, which is either the newly allocated
+ * bs_queue, or the existing bs_queue being used.
+ *
+ */
+BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue,
+ BlockDriverState *bs, int flags)
+{
+ assert(bs != NULL);
+
+ BlockReopenQueueEntry *bs_entry;
+ if (bs_queue == NULL) {
+ bs_queue = g_new0(BlockReopenQueue, 1);
+ QSIMPLEQ_INIT(bs_queue);
+ }
+
+ if (bs->file) {
+ bdrv_reopen_queue(bs_queue, bs->file, flags);
+ }
+
+ bs_entry = g_new0(BlockReopenQueueEntry, 1);
+ QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
+
+ bs_entry->state.bs = bs;
+ bs_entry->state.flags = flags;
+
+ return bs_queue;
+}
+
+/*
+ * Reopen multiple BlockDriverStates atomically & transactionally.
+ *
+ * The queue passed in (bs_queue) must have been built up previous
+ * via bdrv_reopen_queue().
+ *
+ * Reopens all BDS specified in the queue, with the appropriate
+ * flags. All devices are prepared for reopen, and failure of any
+ * device will cause all device changes to be abandonded, and intermediate
+ * data cleaned up.
+ *
+ * If all devices prepare successfully, then the changes are committed
+ * to all devices.
+ *
+ */
+int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp)
+{
+ int ret = -1;
+ BlockReopenQueueEntry *bs_entry, *next;
+ Error *local_err = NULL;
+
+ assert(bs_queue != NULL);
+
+ bdrv_drain_all();
+
+ QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
+ if (bdrv_reopen_prepare(&bs_entry->state, bs_queue, &local_err)) {
+ error_propagate(errp, local_err);
+ goto cleanup;
+ }
+ bs_entry->prepared = true;
+ }
+
+ /* If we reach this point, we have success and just need to apply the
+ * changes
+ */
+ QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) {
+ bdrv_reopen_commit(&bs_entry->state);
+ }
+
+ ret = 0;
+
+cleanup:
+ QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) {
+ if (ret && bs_entry->prepared) {
+ bdrv_reopen_abort(&bs_entry->state);
+ }
+ g_free(bs_entry);
+ }
+ g_free(bs_queue);
+ return ret;
+}
+
+
+/* Reopen a single BlockDriverState with the specified flags. */
+int bdrv_reopen(BlockDriverState *bs, int bdrv_flags, Error **errp)
+{
+ int ret = -1;
+ Error *local_err = NULL;
+ BlockReopenQueue *queue = bdrv_reopen_queue(NULL, bs, bdrv_flags);
+
+ ret = bdrv_reopen_multiple(queue, &local_err);
+ if (local_err != NULL) {
+ error_propagate(errp, local_err);
+ }
+ return ret;
+}
+
+
+/*
+ * Prepares a BlockDriverState for reopen. All changes are staged in the
+ * 'opaque' field of the BDRVReopenState, which is used and allocated by
+ * the block driver layer .bdrv_reopen_prepare()
+ *
+ * bs is the BlockDriverState to reopen
+ * flags are the new open flags
+ * queue is the reopen queue
+ *
+ * Returns 0 on success, non-zero on error. On error errp will be set
+ * as well.
+ *
+ * On failure, bdrv_reopen_abort() will be called to clean up any data.
+ * It is the responsibility of the caller to then call the abort() or
+ * commit() for any other BDS that have been left in a prepare() state
+ *
+ */
+int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
+ Error **errp)
+{
+ int ret = -1;
+ Error *local_err = NULL;
+ BlockDriver *drv;
+
+ assert(reopen_state != NULL);
+ assert(reopen_state->bs->drv != NULL);
+ drv = reopen_state->bs->drv;
+
+ /* if we are to stay read-only, do not allow permission change
+ * to r/w */
+ if (!(reopen_state->bs->open_flags & BDRV_O_ALLOW_RDWR) &&
+ reopen_state->flags & BDRV_O_RDWR) {
+ error_set(errp, QERR_DEVICE_IS_READ_ONLY,
+ reopen_state->bs->device_name);
+ goto error;
+ }
+
+
+ ret = bdrv_flush(reopen_state->bs);
+ if (ret) {
+ error_set(errp, ERROR_CLASS_GENERIC_ERROR, "Error (%s) flushing drive",
+ strerror(-ret));
+ goto error;
+ }
+
+ if (drv->bdrv_reopen_prepare) {
+ ret = drv->bdrv_reopen_prepare(reopen_state, queue, &local_err);
+ if (ret) {
+ if (local_err != NULL) {
+ error_propagate(errp, local_err);
+ } else {
+ error_set(errp, QERR_OPEN_FILE_FAILED,
+ reopen_state->bs->filename);
+ }
+ goto error;
+ }
+ } else {
+ /* It is currently mandatory to have a bdrv_reopen_prepare()
+ * handler for each supported drv. */
+ error_set(errp, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+ drv->format_name, reopen_state->bs->device_name,
+ "reopening of file");
+ ret = -1;
+ goto error;
+ }
+
+ ret = 0;
+
+error:
+ return ret;
+}
+
+/*
+ * Takes the staged changes for the reopen from bdrv_reopen_prepare(), and
+ * makes them final by swapping the staging BlockDriverState contents into
+ * the active BlockDriverState contents.
+ */
+void bdrv_reopen_commit(BDRVReopenState *reopen_state)
+{
+ BlockDriver *drv;
+
+ assert(reopen_state != NULL);
+ drv = reopen_state->bs->drv;
+ assert(drv != NULL);
+
+ /* If there are any driver level actions to take */
+ if (drv->bdrv_reopen_commit) {
+ drv->bdrv_reopen_commit(reopen_state);
+ }
+
+ /* set BDS specific flags now */
+ reopen_state->bs->open_flags = reopen_state->flags;
+ reopen_state->bs->enable_write_cache = !!(reopen_state->flags &
+ BDRV_O_CACHE_WB);
+ reopen_state->bs->read_only = !(reopen_state->flags & BDRV_O_RDWR);
+}
+
+/*
+ * Abort the reopen, and delete and free the staged changes in
+ * reopen_state
+ */
+void bdrv_reopen_abort(BDRVReopenState *reopen_state)
+{
+ BlockDriver *drv;
+
+ assert(reopen_state != NULL);
+ drv = reopen_state->bs->drv;
+ assert(drv != NULL);
+
+ if (drv->bdrv_reopen_abort) {
+ drv->bdrv_reopen_abort(reopen_state);
+ }
+}
+
+
void bdrv_close(BlockDriverState *bs)
{
bdrv_flush(bs);
diff --git a/block.h b/block.h
index 4d919c2..b1095d8 100644
--- a/block.h
+++ b/block.h
@@ -97,6 +97,15 @@ typedef enum {
BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP
} BlockQMPEventAction;
+typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;
+
+typedef struct BDRVReopenState {
+ BlockDriverState *bs;
+ int flags;
+ void *opaque;
+} BDRVReopenState;
+
+
void bdrv_iostatus_enable(BlockDriverState *bs);
void bdrv_iostatus_reset(BlockDriverState *bs);
void bdrv_iostatus_disable(BlockDriverState *bs);
@@ -131,6 +140,14 @@ int bdrv_parse_cache_flags(const char *mode, int *flags);
int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags);
int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
BlockDriver *drv);
+BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue,
+ BlockDriverState *bs, int flags);
+int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp);
+int bdrv_reopen(BlockDriverState *bs, int bdrv_flags, Error **errp);
+int bdrv_reopen_prepare(BDRVReopenState *reopen_state,
+ BlockReopenQueue *queue, Error **errp);
+void bdrv_reopen_commit(BDRVReopenState *reopen_state);
+void bdrv_reopen_abort(BDRVReopenState *reopen_state);
void bdrv_close(BlockDriverState *bs);
int bdrv_attach_dev(BlockDriverState *bs, void *dev);
void bdrv_attach_dev_nofail(BlockDriverState *bs, void *dev);
diff --git a/block_int.h b/block_int.h
index 4452f6f..22b3d93 100644
--- a/block_int.h
+++ b/block_int.h
@@ -139,6 +139,13 @@ struct BlockDriver {
int instance_size;
int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename);
int (*bdrv_probe_device)(const char *filename);
+
+ /* For handling image reopen for split or non-split files */
+ int (*bdrv_reopen_prepare)(BDRVReopenState *reopen_state,
+ BlockReopenQueue *queue, Error **errp);
+ void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
+ void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
+
int (*bdrv_open)(BlockDriverState *bs, int flags);
int (*bdrv_file_open)(BlockDriverState *bs, const char *filename, int flags);
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
@@ -336,6 +343,7 @@ struct BlockDriverState {
/* long-running background operation */
BlockJob *job;
+
};
int get_tmp_filename(char *filename, int size);
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 05/19] block: move aio initialization into a helper function
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (3 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 04/19] block: Framework for reopening files safely Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 06/19] block: move open flag parsing in raw block drivers to helper functions Kevin Wolf
` (14 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
Move AIO initialization for raw-posix block driver into a helper function.
In addition to just code motion, the aio_ctx pointer is checked for NULL,
prior to calling laio_init(), to make sure laio_init() is only run once.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 53 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 6be20b1..5981d04 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -185,6 +185,38 @@ static int raw_normalize_devicepath(const char **filename)
}
#endif
+#ifdef CONFIG_LINUX_AIO
+static int raw_set_aio(void **aio_ctx, int *use_aio, int bdrv_flags)
+{
+ int ret = -1;
+ assert(aio_ctx != NULL);
+ assert(use_aio != NULL);
+ /*
+ * Currently Linux do AIO only for files opened with O_DIRECT
+ * specified so check NOCACHE flag too
+ */
+ if ((bdrv_flags & (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) ==
+ (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) {
+
+ /* if non-NULL, laio_init() has already been run */
+ if (*aio_ctx == NULL) {
+ *aio_ctx = laio_init();
+ if (!*aio_ctx) {
+ goto error;
+ }
+ }
+ *use_aio = 1;
+ } else {
+ *use_aio = 0;
+ }
+
+ ret = 0;
+
+error:
+ return ret;
+}
+#endif
+
static int raw_open_common(BlockDriverState *bs, const char *filename,
int bdrv_flags, int open_flags)
{
@@ -240,25 +272,10 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
}
#ifdef CONFIG_LINUX_AIO
- /*
- * Currently Linux do AIO only for files opened with O_DIRECT
- * specified so check NOCACHE flag too
- */
- if ((bdrv_flags & (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) ==
- (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) {
-
- s->aio_ctx = laio_init();
- if (!s->aio_ctx) {
- goto out_free_buf;
- }
- s->use_aio = 1;
- } else
-#endif
- {
-#ifdef CONFIG_LINUX_AIO
- s->use_aio = 0;
-#endif
+ if (raw_set_aio(&s->aio_ctx, &s->use_aio, bdrv_flags)) {
+ goto out_close;
}
+#endif
#ifdef CONFIG_XFS
if (platform_test_xfs_fd(s->fd)) {
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 06/19] block: move open flag parsing in raw block drivers to helper functions
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (4 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 05/19] block: move aio initialization into a helper function Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 07/19] block: do not parse BDRV_O_CACHE_WB in block drivers Kevin Wolf
` (13 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
Code motion, to move parsing of open flags into a helper function.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 38 ++++++++++++++++++++++++--------------
block/raw-win32.c | 43 +++++++++++++++++++++++--------------------
2 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 5981d04..155205f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -185,6 +185,28 @@ static int raw_normalize_devicepath(const char **filename)
}
#endif
+static void raw_parse_flags(int bdrv_flags, int *open_flags)
+{
+ assert(open_flags != NULL);
+
+ *open_flags |= O_BINARY;
+ *open_flags &= ~O_ACCMODE;
+ if (bdrv_flags & BDRV_O_RDWR) {
+ *open_flags |= O_RDWR;
+ } else {
+ *open_flags |= O_RDONLY;
+ }
+
+ /* Use O_DSYNC for write-through caching, no flags for write-back caching,
+ * and O_DIRECT for no caching. */
+ if ((bdrv_flags & BDRV_O_NOCACHE)) {
+ *open_flags |= O_DIRECT;
+ }
+ if (!(bdrv_flags & BDRV_O_CACHE_WB)) {
+ *open_flags |= O_DSYNC;
+ }
+}
+
#ifdef CONFIG_LINUX_AIO
static int raw_set_aio(void **aio_ctx, int *use_aio, int bdrv_flags)
{
@@ -228,20 +250,8 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
return ret;
}
- s->open_flags = open_flags | O_BINARY;
- s->open_flags &= ~O_ACCMODE;
- if (bdrv_flags & BDRV_O_RDWR) {
- s->open_flags |= O_RDWR;
- } else {
- s->open_flags |= O_RDONLY;
- }
-
- /* Use O_DSYNC for write-through caching, no flags for write-back caching,
- * and O_DIRECT for no caching. */
- if ((bdrv_flags & BDRV_O_NOCACHE))
- s->open_flags |= O_DIRECT;
- if (!(bdrv_flags & BDRV_O_CACHE_WB))
- s->open_flags |= O_DSYNC;
+ s->open_flags = open_flags;
+ raw_parse_flags(bdrv_flags, &s->open_flags);
s->fd = -1;
fd = qemu_open(filename, s->open_flags, 0644);
diff --git a/block/raw-win32.c b/block/raw-win32.c
index c56bf83..335c06a 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -77,6 +77,26 @@ static int set_sparse(int fd)
NULL, 0, NULL, 0, &returned, NULL);
}
+static void raw_parse_flags(int flags, int *access_flags, DWORD *overlapped)
+{
+ assert(access_flags != NULL);
+ assert(overlapped != NULL);
+
+ if (flags & BDRV_O_RDWR) {
+ *access_flags = GENERIC_READ | GENERIC_WRITE;
+ } else {
+ *access_flags = GENERIC_READ;
+ }
+
+ *overlapped = FILE_ATTRIBUTE_NORMAL;
+ if (flags & BDRV_O_NOCACHE) {
+ *overlapped |= FILE_FLAG_NO_BUFFERING;
+ }
+ if (!(flags & BDRV_O_CACHE_WB)) {
+ *overlapped |= FILE_FLAG_WRITE_THROUGH;
+ }
+}
+
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
@@ -85,17 +105,8 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
s->type = FTYPE_FILE;
- if (flags & BDRV_O_RDWR) {
- access_flags = GENERIC_READ | GENERIC_WRITE;
- } else {
- access_flags = GENERIC_READ;
- }
+ raw_parse_flags(flags, &access_flags, &overlapped);
- overlapped = FILE_ATTRIBUTE_NORMAL;
- if (flags & BDRV_O_NOCACHE)
- overlapped |= FILE_FLAG_NO_BUFFERING;
- if (!(flags & BDRV_O_CACHE_WB))
- overlapped |= FILE_FLAG_WRITE_THROUGH;
s->hfile = CreateFile(filename, access_flags,
FILE_SHARE_READ, NULL,
OPEN_EXISTING, overlapped, NULL);
@@ -374,18 +385,10 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
}
s->type = find_device_type(bs, filename);
- if (flags & BDRV_O_RDWR) {
- access_flags = GENERIC_READ | GENERIC_WRITE;
- } else {
- access_flags = GENERIC_READ;
- }
+ raw_parse_flags(flags, &access_flags, &overlapped);
+
create_flags = OPEN_EXISTING;
- overlapped = FILE_ATTRIBUTE_NORMAL;
- if (flags & BDRV_O_NOCACHE)
- overlapped |= FILE_FLAG_NO_BUFFERING;
- if (!(flags & BDRV_O_CACHE_WB))
- overlapped |= FILE_FLAG_WRITE_THROUGH;
s->hfile = CreateFile(filename, access_flags,
FILE_SHARE_READ, NULL,
create_flags, overlapped, NULL);
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 07/19] block: do not parse BDRV_O_CACHE_WB in block drivers
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (5 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 06/19] block: move open flag parsing in raw block drivers to helper functions Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 08/19] block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c Kevin Wolf
` (12 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,
and in the bs->open_flags.
This patch removes the code, leaving the behaviour behind as if
BDRV_O_CACHE_WB was set.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/iscsi.c | 4 ----
block/raw-posix.c | 3 ---
block/raw-win32.c | 3 ---
block/rbd.c | 6 ------
block/sheepdog.c | 14 ++++++--------
5 files changed, 6 insertions(+), 24 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 0b96165..70cf700 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -268,10 +268,6 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num,
acb->task->xfer_dir = SCSI_XFER_WRITE;
acb->task->cdb_size = 16;
acb->task->cdb[0] = 0x8a;
- if (!(bs->open_flags & BDRV_O_CACHE_WB)) {
- /* set FUA on writes when cache mode is write through */
- acb->task->cdb[1] |= 0x04;
- }
lba = sector_qemu2lun(sector_num, iscsilun);
*(uint32_t *)&acb->task->cdb[2] = htonl(lba >> 32);
*(uint32_t *)&acb->task->cdb[6] = htonl(lba & 0xffffffff);
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 155205f..288e7ff 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -202,9 +202,6 @@ static void raw_parse_flags(int bdrv_flags, int *open_flags)
if ((bdrv_flags & BDRV_O_NOCACHE)) {
*open_flags |= O_DIRECT;
}
- if (!(bdrv_flags & BDRV_O_CACHE_WB)) {
- *open_flags |= O_DSYNC;
- }
}
#ifdef CONFIG_LINUX_AIO
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 335c06a..78c8306 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -92,9 +92,6 @@ static void raw_parse_flags(int flags, int *access_flags, DWORD *overlapped)
if (flags & BDRV_O_NOCACHE) {
*overlapped |= FILE_FLAG_NO_BUFFERING;
}
- if (!(flags & BDRV_O_CACHE_WB)) {
- *overlapped |= FILE_FLAG_WRITE_THROUGH;
- }
}
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
diff --git a/block/rbd.c b/block/rbd.c
index 5a0f79f..015a9db 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -487,12 +487,6 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
rados_conf_set(s->cluster, "rbd_cache", "false");
} else {
rados_conf_set(s->cluster, "rbd_cache", "true");
- if (!(flags & BDRV_O_CACHE_WB)) {
- r = rados_conf_set(s->cluster, "rbd_cache_max_dirty", "0");
- if (r < 0) {
- rados_conf_set(s->cluster, "rbd_cache", "false");
- }
- }
}
if (strstr(conf, "conf=") == NULL) {
diff --git a/block/sheepdog.c b/block/sheepdog.c
index e0753ee..4742f8a 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1114,14 +1114,12 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
goto out;
}
- if (flags & BDRV_O_CACHE_WB) {
- s->cache_enabled = 1;
- s->flush_fd = connect_to_sdog(s->addr, s->port);
- if (s->flush_fd < 0) {
- error_report("failed to connect");
- ret = s->flush_fd;
- goto out;
- }
+ s->cache_enabled = 1;
+ s->flush_fd = connect_to_sdog(s->addr, s->port);
+ if (s->flush_fd < 0) {
+ error_report("failed to connect");
+ ret = s->flush_fd;
+ goto out;
}
if (snapid || tag[0] != '\0') {
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 08/19] block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (6 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 07/19] block: do not parse BDRV_O_CACHE_WB in block drivers Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 09/19] block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c Kevin Wolf
` (11 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
Rather than check for a non-NULL aligned_buf to determine if
raw_aio_submit needs to check for alignment, check for the presence
of BDRV_O_NOCACHE in the bs->open_flags.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 288e7ff..1e727eb 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -354,7 +354,7 @@ static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs,
* boundary. Check if this is the case or tell the low-level
* driver that it needs to copy the buffer.
*/
- if (s->aligned_buf) {
+ if ((bs->open_flags & BDRV_O_NOCACHE)) {
if (!qiov_is_aligned(bs, qiov)) {
type |= QEMU_AIO_MISALIGNED;
#ifdef CONFIG_LINUX_AIO
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 09/19] block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (7 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 08/19] block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 10/19] block: raw-posix image file reopen Kevin Wolf
` (10 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
The aligned_buf pointer and aligned_buf size are no longer used in
raw_posix.c, so remove all references to them.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 21 +--------------------
1 files changed, 1 insertions(+), 20 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 1e727eb..0ffb3d0 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -133,8 +133,6 @@ typedef struct BDRVRawState {
int use_aio;
void *aio_ctx;
#endif
- uint8_t *aligned_buf;
- unsigned aligned_buf_size;
#ifdef CONFIG_XFS
bool is_xfs : 1;
#endif
@@ -259,23 +257,10 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
return ret;
}
s->fd = fd;
- s->aligned_buf = NULL;
-
- if ((bdrv_flags & BDRV_O_NOCACHE)) {
- /*
- * Allocate a buffer for read/modify/write cycles. Chose the size
- * pessimistically as we don't know the block size yet.
- */
- s->aligned_buf_size = 32 * MAX_BLOCKSIZE;
- s->aligned_buf = qemu_memalign(MAX_BLOCKSIZE, s->aligned_buf_size);
- if (s->aligned_buf == NULL) {
- goto out_close;
- }
- }
/* We're falling back to POSIX AIO in some cases so init always */
if (paio_init() < 0) {
- goto out_free_buf;
+ goto out_close;
}
#ifdef CONFIG_LINUX_AIO
@@ -292,8 +277,6 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
return 0;
-out_free_buf:
- qemu_vfree(s->aligned_buf);
out_close:
qemu_close(fd);
return -errno;
@@ -402,8 +385,6 @@ static void raw_close(BlockDriverState *bs)
if (s->fd >= 0) {
qemu_close(s->fd);
s->fd = -1;
- if (s->aligned_buf != NULL)
- qemu_vfree(s->aligned_buf);
}
}
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 10/19] block: raw-posix image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (8 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 09/19] block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 11/19] block: raw " Kevin Wolf
` (9 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
This is derived from the Supriya Kannery's reopen patches.
This contains the raw-posix driver changes for the bdrv_reopen_*
functions. All changes are staged into a temporary scratch buffer
during the prepare() stage, and copied over to the live structure
during commit(). Upon abort(), all changes are abandoned, and the
live structures are unmodified.
The _prepare() will create an extra fd - either by means of a dup,
if possible, or opening a new fd if not (for instance, access
control changes). Upon _commit(), the original fd is closed and
the new fd is used. Upon _abort(), the duplicate/new fd is closed.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 114 insertions(+), 0 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 0ffb3d0..28d439f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -138,6 +138,14 @@ typedef struct BDRVRawState {
#endif
} BDRVRawState;
+typedef struct BDRVRawReopenState {
+ int fd;
+ int open_flags;
+#ifdef CONFIG_LINUX_AIO
+ int use_aio;
+#endif
+} BDRVRawReopenState;
+
static int fd_open(BlockDriverState *bs);
static int64_t raw_getlength(BlockDriverState *bs);
@@ -290,6 +298,109 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
return raw_open_common(bs, filename, flags, 0);
}
+static int raw_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ BDRVRawState *s;
+ BDRVRawReopenState *raw_s;
+ int ret = 0;
+
+ assert(state != NULL);
+ assert(state->bs != NULL);
+
+ s = state->bs->opaque;
+
+ state->opaque = g_malloc0(sizeof(BDRVRawReopenState));
+ raw_s = state->opaque;
+
+#ifdef CONFIG_LINUX_AIO
+ raw_s->use_aio = s->use_aio;
+
+ /* we can use s->aio_ctx instead of a copy, because the use_aio flag is
+ * valid in the 'false' condition even if aio_ctx is set, and raw_set_aio()
+ * won't override aio_ctx if aio_ctx is non-NULL */
+ if (raw_set_aio(&s->aio_ctx, &raw_s->use_aio, state->flags)) {
+ return -1;
+ }
+#endif
+
+ raw_parse_flags(state->flags, &raw_s->open_flags);
+
+ raw_s->fd = -1;
+
+ int fcntl_flags = O_APPEND | O_ASYNC | O_NONBLOCK;
+#ifdef O_NOATIME
+ fcntl_flags |= O_NOATIME;
+#endif
+
+ if ((raw_s->open_flags & ~fcntl_flags) == (s->open_flags & ~fcntl_flags)) {
+ /* dup the original fd */
+ /* TODO: use qemu fcntl wrapper */
+#ifdef F_DUPFD_CLOEXEC
+ raw_s->fd = fcntl(s->fd, F_DUPFD_CLOEXEC, 0);
+#else
+ raw_s->fd = dup(s->fd);
+ if (raw_s->fd != -1) {
+ qemu_set_cloexec(raw_s->fd);
+ }
+#endif
+ if (raw_s->fd >= 0) {
+ ret = fcntl_setfl(raw_s->fd, raw_s->open_flags);
+ if (ret) {
+ qemu_close(raw_s->fd);
+ raw_s->fd = -1;
+ }
+ }
+ }
+
+ /* If we cannot use fcntl, or fcntl failed, fall back to qemu_open() */
+ if (raw_s->fd == -1) {
+ assert(!(raw_s->open_flags & O_CREAT));
+ raw_s->fd = qemu_open(state->bs->filename, raw_s->open_flags);
+ if (raw_s->fd == -1) {
+ ret = -1;
+ }
+ }
+ return ret;
+}
+
+
+static void raw_reopen_commit(BDRVReopenState *state)
+{
+ BDRVRawReopenState *raw_s = state->opaque;
+ BDRVRawState *s = state->bs->opaque;
+
+ s->open_flags = raw_s->open_flags;
+
+ qemu_close(s->fd);
+ s->fd = raw_s->fd;
+#ifdef CONFIG_LINUX_AIO
+ s->use_aio = raw_s->use_aio;
+#endif
+
+ g_free(state->opaque);
+ state->opaque = NULL;
+}
+
+
+static void raw_reopen_abort(BDRVReopenState *state)
+{
+ BDRVRawReopenState *raw_s = state->opaque;
+
+ /* nothing to do if NULL, we didn't get far enough */
+ if (raw_s == NULL) {
+ return;
+ }
+
+ if (raw_s->fd >= 0) {
+ qemu_close(raw_s->fd);
+ raw_s->fd = -1;
+ }
+ g_free(state->opaque);
+ state->opaque = NULL;
+}
+
+
/* XXX: use host sector size if necessary with:
#ifdef DIOCGSECTORSIZE
{
@@ -740,6 +851,9 @@ static BlockDriver bdrv_file = {
.instance_size = sizeof(BDRVRawState),
.bdrv_probe = NULL, /* no probe for protocols */
.bdrv_file_open = raw_open,
+ .bdrv_reopen_prepare = raw_reopen_prepare,
+ .bdrv_reopen_commit = raw_reopen_commit,
+ .bdrv_reopen_abort = raw_reopen_abort,
.bdrv_close = raw_close,
.bdrv_create = raw_create,
.bdrv_co_discard = raw_co_discard,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 11/19] block: raw image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (9 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 10/19] block: raw-posix image file reopen Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 12/19] block: qed " Kevin Wolf
` (8 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
These are the stubs for the file reopen drivers for the raw format.
There is currently nothing that needs to be done by the raw driver
in reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/block/raw.c b/block/raw.c
index ff34ea4..253e949 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -9,6 +9,14 @@ static int raw_open(BlockDriverState *bs, int flags)
return 0;
}
+/* We have nothing to do for raw reopen, stubs just return
+ * success */
+static int raw_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ return 0;
+}
+
static int coroutine_fn raw_co_readv(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov)
{
@@ -115,6 +123,8 @@ static BlockDriver bdrv_raw = {
.bdrv_open = raw_open,
.bdrv_close = raw_close,
+ .bdrv_reopen_prepare = raw_reopen_prepare,
+
.bdrv_co_readv = raw_co_readv,
.bdrv_co_writev = raw_co_writev,
.bdrv_co_is_allocated = raw_co_is_allocated,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 12/19] block: qed image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (10 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 11/19] block: raw " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 13/19] block: qcow2 " Kevin Wolf
` (7 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
These are the stubs for the file reopen drivers for the qed format.
There is currently nothing that needs to be done by the qed driver
in reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qed.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/block/qed.c b/block/qed.c
index 21cb239..6c182ca 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -505,6 +505,14 @@ out:
return ret;
}
+/* We have nothing to do for QED reopen, stubs just return
+ * success */
+static int bdrv_qed_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ return 0;
+}
+
static void bdrv_qed_close(BlockDriverState *bs)
{
BDRVQEDState *s = bs->opaque;
@@ -1564,6 +1572,7 @@ static BlockDriver bdrv_qed = {
.bdrv_rebind = bdrv_qed_rebind,
.bdrv_open = bdrv_qed_open,
.bdrv_close = bdrv_qed_close,
+ .bdrv_reopen_prepare = bdrv_qed_reopen_prepare,
.bdrv_create = bdrv_qed_create,
.bdrv_co_is_allocated = bdrv_qed_co_is_allocated,
.bdrv_make_empty = bdrv_qed_make_empty,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 13/19] block: qcow2 image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (11 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 12/19] block: qed " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 14/19] block: qcow " Kevin Wolf
` (6 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
These are the stubs for the file reopen drivers for the qcow2 format.
There is currently nothing that needs to be done by the qcow2 driver
in reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 8f183f1..aa5e603 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -52,6 +52,7 @@ typedef struct {
uint32_t magic;
uint32_t len;
} QCowExtension;
+
#define QCOW2_EXT_MAGIC_END 0
#define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA
#define QCOW2_EXT_MAGIC_FEATURE_TABLE 0x6803f857
@@ -558,6 +559,14 @@ static int qcow2_set_key(BlockDriverState *bs, const char *key)
return 0;
}
+/* We have nothing to do for QCOW2 reopen, stubs just return
+ * success */
+static int qcow2_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ return 0;
+}
+
static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *pnum)
{
@@ -1679,6 +1688,7 @@ static BlockDriver bdrv_qcow2 = {
.bdrv_probe = qcow2_probe,
.bdrv_open = qcow2_open,
.bdrv_close = qcow2_close,
+ .bdrv_reopen_prepare = qcow2_reopen_prepare,
.bdrv_create = qcow2_create,
.bdrv_co_is_allocated = qcow2_co_is_allocated,
.bdrv_set_key = qcow2_set_key,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 14/19] block: qcow image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (12 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 13/19] block: qcow2 " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 15/19] block: vmdk " Kevin Wolf
` (5 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
These are the stubs for the file reopen drivers for the qcow format.
There is currently nothing that needs to be done by the qcow driver
in reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/block/qcow.c b/block/qcow.c
index 7b5ab87..b239c82 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -197,6 +197,15 @@ static int qcow_open(BlockDriverState *bs, int flags)
return ret;
}
+
+/* We have nothing to do for QCOW reopen, stubs just return
+ * success */
+static int qcow_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ return 0;
+}
+
static int qcow_set_key(BlockDriverState *bs, const char *key)
{
BDRVQcowState *s = bs->opaque;
@@ -868,6 +877,7 @@ static BlockDriver bdrv_qcow = {
.bdrv_probe = qcow_probe,
.bdrv_open = qcow_open,
.bdrv_close = qcow_close,
+ .bdrv_reopen_prepare = qcow_reopen_prepare,
.bdrv_create = qcow_create,
.bdrv_co_readv = qcow_co_readv,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 15/19] block: vmdk image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (13 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 14/19] block: qcow " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 16/19] block: vdi " Kevin Wolf
` (4 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
This patch supports reopen for VMDK image files. VMDK extents are added
to the existing reopen queue, so that the transactional model of reopen
is maintained with multiple image files.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vmdk.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index bba4c61..f2e861b 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -300,6 +300,40 @@ static int vmdk_is_cid_valid(BlockDriverState *bs)
return 1;
}
+/* Queue extents, if any, for reopen() */
+static int vmdk_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ BDRVVmdkState *s;
+ int ret = -1;
+ int i;
+ VmdkExtent *e;
+
+ assert(state != NULL);
+ assert(state->bs != NULL);
+
+ if (queue == NULL) {
+ error_set(errp, ERROR_CLASS_GENERIC_ERROR,
+ "No reopen queue for VMDK extents");
+ goto exit;
+ }
+
+ s = state->bs->opaque;
+
+ assert(s != NULL);
+
+ for (i = 0; i < s->num_extents; i++) {
+ e = &s->extents[i];
+ if (e->file != state->bs->file) {
+ bdrv_reopen_queue(queue, e->file, state->flags);
+ }
+ }
+ ret = 0;
+
+exit:
+ return ret;
+}
+
static int vmdk_parent_open(BlockDriverState *bs)
{
char *p_name;
@@ -1646,6 +1680,7 @@ static BlockDriver bdrv_vmdk = {
.instance_size = sizeof(BDRVVmdkState),
.bdrv_probe = vmdk_probe,
.bdrv_open = vmdk_open,
+ .bdrv_reopen_prepare = vmdk_reopen_prepare,
.bdrv_read = vmdk_co_read,
.bdrv_write = vmdk_co_write,
.bdrv_close = vmdk_close,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 16/19] block: vdi image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (14 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 15/19] block: vmdk " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 17/19] block: vpc " Kevin Wolf
` (3 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
There is currently nothing that needs to be done for VDI reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vdi.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/block/vdi.c b/block/vdi.c
index 550cf58..f35b12e 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -454,6 +454,12 @@ static int vdi_open(BlockDriverState *bs, int flags)
return -1;
}
+static int vdi_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ return 0;
+}
+
static int coroutine_fn vdi_co_is_allocated(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *pnum)
{
@@ -761,6 +767,7 @@ static BlockDriver bdrv_vdi = {
.bdrv_probe = vdi_probe,
.bdrv_open = vdi_open,
.bdrv_close = vdi_close,
+ .bdrv_reopen_prepare = vdi_reopen_prepare,
.bdrv_create = vdi_create,
.bdrv_co_is_allocated = vdi_co_is_allocated,
.bdrv_make_empty = vdi_make_empty,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 17/19] block: vpc image file reopen
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (15 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 16/19] block: vdi " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 18/19] block: convert bdrv_commit() to use bdrv_reopen() Kevin Wolf
` (2 subsequent siblings)
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
There is currently nothing that needs to be done for VPC image
file reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vpc.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/block/vpc.c b/block/vpc.c
index c0b82c4..b6bf52f 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -265,6 +265,12 @@ static int vpc_open(BlockDriverState *bs, int flags)
return err;
}
+static int vpc_reopen_prepare(BDRVReopenState *state,
+ BlockReopenQueue *queue, Error **errp)
+{
+ return 0;
+}
+
/*
* Returns the absolute byte offset of the given sector in the image file.
* If the sector is not allocated, -1 is returned instead.
@@ -783,6 +789,7 @@ static BlockDriver bdrv_vpc = {
.bdrv_probe = vpc_probe,
.bdrv_open = vpc_open,
.bdrv_close = vpc_close,
+ .bdrv_reopen_prepare = vpc_reopen_prepare,
.bdrv_create = vpc_create,
.bdrv_read = vpc_co_read,
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 18/19] block: convert bdrv_commit() to use bdrv_reopen()
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (16 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 17/19] block: vpc " Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 19/19] block: remove keep_read_only flag from BlockDriverState struct Kevin Wolf
2012-09-25 23:26 ` [Qemu-devel] [PULL 00/19] Block patches Anthony Liguori
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
Currently, bdrv_commit() reopens images r/w itself, via risky
_delete() and _open() calls. Use the new safe method for drive reopen.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 48 +++++-------------------------------------------
1 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/block.c b/block.c
index c7c1a3b..84544d2 100644
--- a/block.c
+++ b/block.c
@@ -1501,13 +1501,11 @@ int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix)
int bdrv_commit(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
- BlockDriver *backing_drv;
int64_t sector, total_sectors;
int n, ro, open_flags;
- int ret = 0, rw_ret = 0;
+ int ret = 0;
uint8_t *buf;
char filename[1024];
- BlockDriverState *bs_rw, *bs_ro;
if (!drv)
return -ENOMEDIUM;
@@ -1516,42 +1514,18 @@ int bdrv_commit(BlockDriverState *bs)
return -ENOTSUP;
}
- if (bs->backing_hd->keep_read_only) {
- return -EACCES;
- }
-
if (bdrv_in_use(bs) || bdrv_in_use(bs->backing_hd)) {
return -EBUSY;
}
- backing_drv = bs->backing_hd->drv;
ro = bs->backing_hd->read_only;
strncpy(filename, bs->backing_hd->filename, sizeof(filename));
open_flags = bs->backing_hd->open_flags;
if (ro) {
- /* re-open as RW */
- bdrv_delete(bs->backing_hd);
- bs->backing_hd = NULL;
- bs_rw = bdrv_new("");
- rw_ret = bdrv_open(bs_rw, filename, open_flags | BDRV_O_RDWR,
- backing_drv);
- if (rw_ret < 0) {
- bdrv_delete(bs_rw);
- /* try to re-open read-only */
- bs_ro = bdrv_new("");
- ret = bdrv_open(bs_ro, filename, open_flags & ~BDRV_O_RDWR,
- backing_drv);
- if (ret < 0) {
- bdrv_delete(bs_ro);
- /* drive not functional anymore */
- bs->drv = NULL;
- return ret;
- }
- bs->backing_hd = bs_ro;
- return rw_ret;
+ if (bdrv_reopen(bs->backing_hd, open_flags | BDRV_O_RDWR, NULL)) {
+ return -EACCES;
}
- bs->backing_hd = bs_rw;
}
total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
@@ -1588,20 +1562,8 @@ ro_cleanup:
g_free(buf);
if (ro) {
- /* re-open as RO */
- bdrv_delete(bs->backing_hd);
- bs->backing_hd = NULL;
- bs_ro = bdrv_new("");
- ret = bdrv_open(bs_ro, filename, open_flags & ~BDRV_O_RDWR,
- backing_drv);
- if (ret < 0) {
- bdrv_delete(bs_ro);
- /* drive not functional anymore */
- bs->drv = NULL;
- return ret;
- }
- bs->backing_hd = bs_ro;
- bs->backing_hd->keep_read_only = 0;
+ /* ignoring error return here */
+ bdrv_reopen(bs->backing_hd, open_flags & ~BDRV_O_RDWR, NULL);
}
return ret;
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [Qemu-devel] [PATCH 19/19] block: remove keep_read_only flag from BlockDriverState struct
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (17 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 18/19] block: convert bdrv_commit() to use bdrv_reopen() Kevin Wolf
@ 2012-09-24 14:26 ` Kevin Wolf
2012-09-25 23:26 ` [Qemu-devel] [PULL 00/19] Block patches Anthony Liguori
19 siblings, 0 replies; 36+ messages in thread
From: Kevin Wolf @ 2012-09-24 14:26 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
From: Jeff Cody <jcody@redhat.com>
The keep_read_only flag is no longer used, in favor of the bdrv
flag BDRV_O_ALLOW_RDWR.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 2 --
block_int.h | 1 -
2 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 84544d2..751ebdc 100644
--- a/block.c
+++ b/block.c
@@ -812,8 +812,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
flags |= BDRV_O_ALLOW_RDWR;
}
- bs->keep_read_only = !(flags & BDRV_O_ALLOW_RDWR);
-
/* Open the image */
ret = bdrv_open_common(bs, filename, flags, drv);
if (ret < 0) {
diff --git a/block_int.h b/block_int.h
index 22b3d93..ac4245c 100644
--- a/block_int.h
+++ b/block_int.h
@@ -275,7 +275,6 @@ struct BlockDriverState {
int64_t total_sectors; /* if we are reading a disk image, give its
size in sectors */
int read_only; /* if true, the media is read only */
- int keep_read_only; /* if true, the media was requested to stay read only */
int open_flags; /* flags used to open the file, re-used for re-open */
int encrypted; /* if true, the media is encrypted */
int valid_key; /* if true, a valid encryption key has been set */
--
1.7.6.5
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
` (18 preceding siblings ...)
2012-09-24 14:26 ` [Qemu-devel] [PATCH 19/19] block: remove keep_read_only flag from BlockDriverState struct Kevin Wolf
@ 2012-09-25 23:26 ` Anthony Liguori
19 siblings, 0 replies; 36+ messages in thread
From: Anthony Liguori @ 2012-09-25 23:26 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
Kevin Wolf <kwolf@redhat.com> writes:
> The following changes since commit d3e8f95753114a827f9cd8e819b1d5cc8333f76b:
>
> w32: Add implementation of gmtime_r, localtime_r (2012-09-23 17:09:30 +0000)
>
> are available in the git repository at:
>
> git://repo.or.cz/qemu/kevin.git for-anthony
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Jeff Cody (18):
> block: correctly set the keep_read_only flag
> block: make bdrv_set_enable_write_cache() modify open_flags
> block: Framework for reopening files safely
> block: move aio initialization into a helper function
> block: move open flag parsing in raw block drivers to helper functions
> block: do not parse BDRV_O_CACHE_WB in block drivers
> block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c
> block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c
> block: raw-posix image file reopen
> block: raw image file reopen
> block: qed image file reopen
> block: qcow2 image file reopen
> block: qcow image file reopen
> block: vmdk image file reopen
> block: vdi image file reopen
> block: vpc image file reopen
> block: convert bdrv_commit() to use bdrv_reopen()
> block: remove keep_read_only flag from BlockDriverState struct
>
> Kevin Shanahan (1):
> blockdev: preserve readonly and snapshot states across media changes
>
> block.c | 299 ++++++++++++++++++++++++++++++++++++++++++++---------
> block.h | 18 +++
> block/iscsi.c | 4 -
> block/qcow.c | 10 ++
> block/qcow2.c | 10 ++
> block/qed.c | 9 ++
> block/raw-posix.c | 225 ++++++++++++++++++++++++++++++----------
> block/raw-win32.c | 40 ++++----
> block/raw.c | 10 ++
> block/rbd.c | 6 -
> block/sheepdog.c | 14 +--
> block/vdi.c | 7 ++
> block/vmdk.c | 35 ++++++
> block/vpc.c | 7 ++
> block_int.h | 9 ++-
> blockdev.c | 2 +
> 16 files changed, 563 insertions(+), 142 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PULL 00/19] Block patches
@ 2014-03-07 13:32 Kevin Wolf
2014-03-08 12:40 ` Peter Maydell
0 siblings, 1 reply; 36+ messages in thread
From: Kevin Wolf @ 2014-03-07 13:32 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
The following changes since commit f55ea6297cc0224fe4934b90ff5343b620b14669:
block/gluster: Add missing argument to qemu_gluster_init() call (2014-03-04 20:20:57 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 4089f7c6a0d91020ca60ce8300784c93dd9ddcbe:
block: qemu-iotests 085 - live snapshots tests (2014-03-07 11:36:12 +0100)
----------------------------------------------------------------
Block patches
----------------------------------------------------------------
Benoît Canet (1):
block: make bdrv_swap rebuild the bs graph node list field.
Bharata B Rao (2):
gluster: Change licence to GPLv2+
gluster: Remove unused defines and header include
Jeff Cody (2):
block: mirror - remove code cruft that has no function
block: qemu-iotests 085 - live snapshots tests
Kevin Wolf (8):
qemu-img convert: Fix progress output
qemu-iotests: Test progress output for conversion
iscsi: Use bs->sg for everything else than disks
block: Fix bs->request_alignment assertion for bs->sg=1
blockdev: Fail blockdev-add with encrypted images
blockdev: Fix NULL pointer dereference in blockdev-add
qemu-iotests: Test a few blockdev-add error cases
block: Fix error path segfault in bdrv_open()
Max Reitz (5):
block: Keep "filename" option after parsing
block/raw-posix: Implement bdrv_parse_filename()
block/raw-posix: Strip "file:" prefix on creation
block/raw-win32: Implement bdrv_parse_filename()
block/raw-win32: Strip "file:" prefix on creation
Peter Maydell (1):
hw/ide/ahci.h: Avoid shifting left into sign bit
block.c | 34 ++++++--
block/gluster.c | 16 +---
block/iscsi.c | 9 +--
block/mirror.c | 3 -
block/raw-posix.c | 14 ++++
block/raw-win32.c | 14 ++++
blockdev.c | 15 +++-
hw/ide/ahci.h | 10 +--
qemu-img.c | 20 ++---
tests/qemu-iotests/051 | 9 +++
tests/qemu-iotests/051.out | 15 ++++
tests/qemu-iotests/085 | 192 +++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/085.out | 55 +++++++++++++
tests/qemu-iotests/086 | 65 +++++++++++++++
tests/qemu-iotests/086.out | 18 +++++
tests/qemu-iotests/087 | 122 ++++++++++++++++++++++++++++
tests/qemu-iotests/087.out | 40 ++++++++++
tests/qemu-iotests/group | 3 +
18 files changed, 608 insertions(+), 46 deletions(-)
create mode 100755 tests/qemu-iotests/085
create mode 100644 tests/qemu-iotests/085.out
create mode 100755 tests/qemu-iotests/086
create mode 100644 tests/qemu-iotests/086.out
create mode 100755 tests/qemu-iotests/087
create mode 100644 tests/qemu-iotests/087.out
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-03-07 13:32 Kevin Wolf
@ 2014-03-08 12:40 ` Peter Maydell
0 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2014-03-08 12:40 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers
On 7 March 2014 13:32, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit f55ea6297cc0224fe4934b90ff5343b620b14669:
>
> block/gluster: Add missing argument to qemu_gluster_init() call (2014-03-04 20:20:57 +0000)
>
> are available in the git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 4089f7c6a0d91020ca60ce8300784c93dd9ddcbe:
>
> block: qemu-iotests 085 - live snapshots tests (2014-03-07 11:36:12 +0100)
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PULL 00/19] Block patches
@ 2014-12-12 17:09 Stefan Hajnoczi
2014-12-15 11:11 ` Peter Maydell
0 siblings, 1 reply; 36+ messages in thread
From: Stefan Hajnoczi @ 2014-12-12 17:09 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi
The following changes since commit 99c9c3cb24e566258a0a141178934f9cb5198842:
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-12-11' into staging (2014-12-11 18:27:02 +0000)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 82595da8dedde128d8004ec47441aeb720c08704:
linux-aio: simplify removal of completed iocbs from the list (2014-12-12 16:57:55 +0000)
----------------------------------------------------------------
----------------------------------------------------------------
Fam Zheng (2):
qemu-iotests: Remove traling whitespaces in *.out
block: Don't add trailing space in "Formating..." message
Gary R Hook (1):
block migration: fix return value
Gonglei (1):
block/rbd: fix memory leak
Jeff Cody (4):
block: vhdx - remove redundant comments
block: vhdx - update PAYLOAD_BLOCK_UNMAPPED value to match 1.00 spec
block: vhdx - change .vhdx_create default block state to ZERO
block: vhdx - set .bdrv_has_zero_init to bdrv_has_zero_init_1
Max Reitz (5):
vmdk: Fix error for JSON descriptor file names
iotests: Add test for vmdk JSON file names
qemu-io: Add sigraise command
iotests: Filter for "Killed" in qemu-io output
iotests: Fix test 039
Paolo Bonzini (5):
linux-aio: queue requests that cannot be submitted
linux-aio: track whether the queue is blocked
linux-aio: rename LaioQueue idx field to "n"
linux-aio: drop return code from laio_io_unplug and ioq_submit
linux-aio: simplify removal of completed iocbs from the list
Stefan Hajnoczi (1):
block: drop unused bdrv_clear_incoming_migration_all() prototype
block-migration.c | 10 +-
block.c | 6 +-
block/linux-aio.c | 99 ++++++-------
block/raw-aio.h | 2 +-
block/rbd.c | 8 +-
block/vhdx.c | 18 ++-
block/vhdx.h | 3 +-
block/vmdk.c | 10 +-
include/block/block.h | 3 +-
include/qemu/option.h | 2 +-
include/qemu/queue.h | 11 ++
qemu-doc.texi | 6 +-
qemu-io-cmds.c | 46 ++++++
tests/qemu-iotests/001.out | 2 +-
tests/qemu-iotests/002.out | 2 +-
tests/qemu-iotests/003.out | 2 +-
tests/qemu-iotests/004.out | 2 +-
tests/qemu-iotests/005.out | 2 +-
tests/qemu-iotests/006.out | 2 +-
tests/qemu-iotests/007.out | 2 +-
tests/qemu-iotests/008.out | 2 +-
tests/qemu-iotests/009.out | 2 +-
tests/qemu-iotests/010.out | 2 +-
tests/qemu-iotests/011.out | 2 +-
tests/qemu-iotests/012.out | 2 +-
tests/qemu-iotests/013.out | 2 +-
tests/qemu-iotests/014.out | 2 +-
tests/qemu-iotests/015.out | 2 +-
tests/qemu-iotests/016.out | 2 +-
tests/qemu-iotests/017.out | 2 +-
tests/qemu-iotests/018.out | 2 +-
tests/qemu-iotests/019.out | 4 +-
tests/qemu-iotests/020.out | 4 +-
tests/qemu-iotests/021.out | 2 +-
tests/qemu-iotests/022.out | 2 +-
tests/qemu-iotests/023.out | 16 +--
tests/qemu-iotests/024.out | 6 +-
tests/qemu-iotests/025.out | 2 +-
tests/qemu-iotests/026.out | 300 +++++++++++++++++++--------------------
tests/qemu-iotests/027.out | 2 +-
tests/qemu-iotests/028.out | 6 +-
tests/qemu-iotests/029.out | 8 +-
tests/qemu-iotests/031.out | 4 +-
tests/qemu-iotests/032.out | 2 +-
tests/qemu-iotests/033.out | 2 +-
tests/qemu-iotests/034.out | 4 +-
tests/qemu-iotests/035.out | 2 +-
tests/qemu-iotests/036.out | 6 +-
tests/qemu-iotests/037.out | 4 +-
tests/qemu-iotests/038.out | 4 +-
tests/qemu-iotests/039 | 18 ++-
tests/qemu-iotests/039.out | 18 +--
tests/qemu-iotests/042.out | 2 +-
tests/qemu-iotests/043.out | 52 +++----
tests/qemu-iotests/046.out | 4 +-
tests/qemu-iotests/047.out | 2 +-
tests/qemu-iotests/048.out | 4 +-
tests/qemu-iotests/049.out | 112 +++++++--------
tests/qemu-iotests/050.out | 6 +-
tests/qemu-iotests/051.out | 6 +-
tests/qemu-iotests/052.out | 2 +-
tests/qemu-iotests/053.out | 2 +-
tests/qemu-iotests/054.out | 4 +-
tests/qemu-iotests/059 | 6 +
tests/qemu-iotests/059.out | 4 +
tests/qemu-iotests/060.out | 22 +--
tests/qemu-iotests/061.out | 44 +++---
tests/qemu-iotests/062.out | 2 +-
tests/qemu-iotests/066.out | 2 +-
tests/qemu-iotests/067.out | 2 +-
tests/qemu-iotests/068.out | 2 +-
tests/qemu-iotests/069.out | 4 +-
tests/qemu-iotests/071.out | 8 +-
tests/qemu-iotests/072.out | 2 +-
tests/qemu-iotests/073.out | 4 +-
tests/qemu-iotests/077.out | 2 +-
tests/qemu-iotests/080.out | 24 ++--
tests/qemu-iotests/081.out | 6 +-
tests/qemu-iotests/082.out | 14 +-
tests/qemu-iotests/084.out | 4 +-
tests/qemu-iotests/086.out | 2 +-
tests/qemu-iotests/087.out | 6 +-
tests/qemu-iotests/088.out | 2 +-
tests/qemu-iotests/089.out | 4 +-
tests/qemu-iotests/090.out | 2 +-
tests/qemu-iotests/091.out | 2 +-
tests/qemu-iotests/092.out | 8 +-
tests/qemu-iotests/095.out | 6 +-
tests/qemu-iotests/097.out | 24 ++--
tests/qemu-iotests/098.out | 16 +--
tests/qemu-iotests/099.out | 4 +-
tests/qemu-iotests/100.out | 14 +-
tests/qemu-iotests/103.out | 2 +-
tests/qemu-iotests/104.out | 4 +-
tests/qemu-iotests/107.out | 2 +-
tests/qemu-iotests/108.out | 12 +-
tests/qemu-iotests/common.filter | 2 +-
util/qemu-option.c | 10 +-
98 files changed, 619 insertions(+), 527 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-12-12 17:09 Stefan Hajnoczi
@ 2014-12-15 11:11 ` Peter Maydell
0 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2014-12-15 11:11 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: QEMU Developers
On 12 December 2014 at 17:09, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit 99c9c3cb24e566258a0a141178934f9cb5198842:
>
> Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-12-11' into staging (2014-12-11 18:27:02 +0000)
>
> are available in the git repository at:
>
> git://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to 82595da8dedde128d8004ec47441aeb720c08704:
>
> linux-aio: simplify removal of completed iocbs from the list (2014-12-12 16:57:55 +0000)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PULL 00/19] Block patches
@ 2014-12-19 16:34 Kevin Wolf
2014-12-22 11:14 ` Peter Maydell
2015-01-05 11:55 ` Stefan Hajnoczi
0 siblings, 2 replies; 36+ messages in thread
From: Kevin Wolf @ 2014-12-19 16:34 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
The following changes since commit dfa9c2a0f4d0a0c8b2c1449ecdbb1297427e1560:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-12-15 16:43:42 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 55873077d9e00c4da12ba1068bd9566fc6c32388:
iotests: Filter out "I/O thread spun..." warning (2014-12-19 17:17:47 +0100)
----------------------------------------------------------------
Block patches for 2.3
----------------------------------------------------------------
Fam Zheng (8):
qemu-iotests: Remove 091 from quick group
qemu-iotests: Speed up make check-block
tests/Makefile: Add check-block to make check
qapi: Fix document for BlockStats.node-name
qapi: Comment version info in TransactionAction
qmp: Add command 'blockdev-backup'
block: Add blockdev-backup to transaction
qemu-iotests: Test blockdev-backup in 055
Kevin Wolf (1):
Merge remote-tracking branch 'mreitz/block' into queue-block
Max Reitz (7):
checkpatch: Brace handling on multi-line condition
block: Get full backing filename from string
block: JSON filenames and relative backing files
block: Relative backing file for image creation
block/vmdk: Relative backing file for creation
iotests: Add test for relative backing file names
iotests: Filter out "I/O thread spun..." warning
Paolo Bonzini (3):
block: mark AioContext as recursive
block: do not allocate an iovec per read of a growable/zero_after_eof BDS
block: replace g_new0 with g_new for bottom half allocation.
Vladimir Sementsov-Ogievskiy (1):
block: fix spoiling all dirty bitmaps by mirror and migration
async.c | 11 +-
block-migration.c | 5 +-
block.c | 81 ++++++++++++---
block/backup.c | 28 ++++++
block/mirror.c | 11 +-
block/qapi.c | 7 +-
block/vmdk.c | 13 ++-
blockdev.c | 133 ++++++++++++++++++++++++
include/block/block.h | 12 ++-
qapi-schema.json | 8 ++
qapi/block-core.json | 56 ++++++++++-
qmp-commands.hx | 42 ++++++++
scripts/checkpatch.pl | 13 ++-
tests/Makefile | 2 +-
tests/qemu-iotests-quick.sh | 2 +-
tests/qemu-iotests/055 | 211 ++++++++++++++++++++++++++++++++-------
tests/qemu-iotests/055.out | 4 +-
tests/qemu-iotests/067 | 3 +-
tests/qemu-iotests/071 | 2 +-
tests/qemu-iotests/071.out | 8 +-
tests/qemu-iotests/081 | 2 +-
tests/qemu-iotests/087 | 3 +-
tests/qemu-iotests/087.out | 1 -
tests/qemu-iotests/099 | 2 +-
tests/qemu-iotests/110 | 94 +++++++++++++++++
tests/qemu-iotests/110.out | 19 ++++
tests/qemu-iotests/check | 1 +
tests/qemu-iotests/common.filter | 1 +
tests/qemu-iotests/group | 3 +-
29 files changed, 692 insertions(+), 86 deletions(-)
create mode 100755 tests/qemu-iotests/110
create mode 100644 tests/qemu-iotests/110.out
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-12-19 16:34 Kevin Wolf
@ 2014-12-22 11:14 ` Peter Maydell
2014-12-22 12:07 ` Peter Maydell
2015-01-05 11:55 ` Stefan Hajnoczi
1 sibling, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2014-12-22 11:14 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers
On 19 December 2014 at 16:34, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit dfa9c2a0f4d0a0c8b2c1449ecdbb1297427e1560:
>
> Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-12-15 16:43:42 +0000)
>
> are available in the git repository at:
>
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 55873077d9e00c4da12ba1068bd9566fc6c32388:
>
> iotests: Filter out "I/O thread spun..." warning (2014-12-19 17:17:47 +0100)
>
> ----------------------------------------------------------------
> Block patches for 2.3
Hi. I'm afraid this fails "make check" on MacOSX:
/Users/pm215/src/qemu/tests/qemu-iotests-quick.sh
/Users/pm215/src/qemu/tests/qemu-iotests/common.config: line 158:
/bin/true: No such file or directory
check: failed to source common.config
On OSX "true" is /usr/bin/true. common.config should just use
"true" here I think, and let the shell figure out where it is
(typically a builtin, obviously).
thanks
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-12-22 11:14 ` Peter Maydell
@ 2014-12-22 12:07 ` Peter Maydell
2014-12-22 12:22 ` Peter Maydell
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2014-12-22 12:07 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers
On 22 December 2014 at 11:14, Peter Maydell <peter.maydell@linaro.org> wrote:
> Hi. I'm afraid this fails "make check" on MacOSX:
> /Users/pm215/src/qemu/tests/qemu-iotests-quick.sh
> /Users/pm215/src/qemu/tests/qemu-iotests/common.config: line 158:
> /bin/true: No such file or directory
> check: failed to source common.config
>
> On OSX "true" is /usr/bin/true. common.config should just use
> "true" here I think, and let the shell figure out where it is
> (typically a builtin, obviously).
common.rc and common.filter also have this bug. With those
fixed, 'make check-block' now runs two tests (most are skipped
with "not suitable for this OS: Darwin"), of which 058 fails:
===begin===
058 [12:01:48] [12:01:49] - output mismatch (see 058.out.bad)
--- /Users/pm215/src/qemu/tests/qemu-iotests/058.out 2014-02-17
23:38:30.000000000 +0000
+++ 058.out.bad 2014-12-22 12:01:49.000000000 +0000
@@ -1,44 +1,37 @@
QA output created by 058
== preparing image ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-wrote 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
cluster_size=65536 lazy_refcounts=off
+wite [-bcCpqz] [-P patten ] off len -- wites a numbe of bytes at a
specified offset
+wite [-bcCpqz] [-P patten ] off len -- wites a numbe of bytes at a
specified offset
+wite [-bcCpqz] [-P patten ] off len -- wites a numbe of bytes at a
specified offset
+wite [-bcCpqz] [-P patten ] off len -- wites a numbe of bytes at a
specified offset
No errors were found on the image.
+Image end offset: 393216
== verifying the image file with patterns ==
-read 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+ead [-abCpqv] [-P patten [-s off] [-l len]] off len -- eads a numbe
of bytes at a specified offset
+ead [-abCpqv] [-P patten [-s off] [-l len]] off len -- eads a numbe
of bytes at a specified offset
== verifying the exported snapshot with patterns, method 1 ==
-read 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+ead [-abCpqv] [-P patten [-s off] [-l len]] off len -- eads a numbe
of bytes at a specified offset
+ead [-abCpqv] [-P patten [-s off] [-l len]] off len -- eads a numbe
of bytes at a specified offset
== verifying the exported snapshot with patterns, method 2 ==
-read 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+ead [-abCpqv] [-P patten [-s off] [-l len]] off len -- eads a numbe
of bytes at a specified offset
+ead [-abCpqv] [-P patten [-s off] [-l len]] off len -- eads a numbe
of bytes at a specified offset
+qemu-img: Could not open '-l': Could not open '-l': No such file or directory
== verifying the converted snapshot with patterns, method 1 ==
-read 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io: can't open device .converted: Could not open '.converted':
No such file or directory
+no file open, try 'help open'
+qemu-io: can't open device .converted: Could not open '.converted':
No such file or directory
+no file open, try 'help open'
+qemu-img: Could not open '-l': Could not open '-l': No such file or directory
== verifying the converted snapshot with patterns, method 2 ==
-read 4096/4096 bytes at offset 4096
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-read 4096/4096 bytes at offset 8192
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io: can't open device .converted: Could not open '.converted':
No such file or directory
+no file open, try 'help open'
+qemu-io: can't open device .converted: Could not open '.converted':
No such file or directory
+no file open, try 'help open'
*** done
===endit===
Something very odd is happening here: why are all the "r"s apparently
missing from those error messages?
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-12-22 12:07 ` Peter Maydell
@ 2014-12-22 12:22 ` Peter Maydell
2014-12-23 2:15 ` Fam Zheng
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2014-12-22 12:22 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers
On 22 December 2014 at 12:07, Peter Maydell <peter.maydell@linaro.org> wrote:
> Something very odd is happening here: why are all the "r"s apparently
> missing from those error messages?
Looks like the result of using GNU sed-isms in some of the filters. On OSX:
$ echo "art trick" | sed -e 's/\r//g'
at tick
On Linux with GNU sed:
$ echo "art trick" | sed -e 's/\r//g'
art trick
This likely breaks on the BSDs too. I suspect these scripts need
a careful overhaul before we can add them to 'make check' :-(
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-12-22 12:22 ` Peter Maydell
@ 2014-12-23 2:15 ` Fam Zheng
0 siblings, 0 replies; 36+ messages in thread
From: Fam Zheng @ 2014-12-23 2:15 UTC (permalink / raw)
To: Peter Maydell; +Cc: Kevin Wolf, QEMU Developers
On Mon, 12/22 12:22, Peter Maydell wrote:
> On 22 December 2014 at 12:07, Peter Maydell <peter.maydell@linaro.org> wrote:
> > Something very odd is happening here: why are all the "r"s apparently
> > missing from those error messages?
>
> Looks like the result of using GNU sed-isms in some of the filters. On OSX:
>
> $ echo "art trick" | sed -e 's/\r//g'
> at tick
>
> On Linux with GNU sed:
> $ echo "art trick" | sed -e 's/\r//g'
> art trick
>
> This likely breaks on the BSDs too. I suspect these scripts need
> a careful overhaul before we can add them to 'make check' :-(
>
Oops! Thanks Peter, I'll take care of it and respin. We should drop these
patches from this PULL for now.
Fam
^ permalink raw reply [flat|nested] 36+ messages in thread
* [Qemu-devel] [PULL 00/19] Block patches
@ 2015-01-05 11:51 Stefan Hajnoczi
0 siblings, 0 replies; 36+ messages in thread
From: Stefan Hajnoczi @ 2015-01-05 11:51 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi
The following changes since commit ab0302ee764fd702465aef6d88612cdff4302809:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20141223' into staging (2014-12-23 15:05:22 +0000)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:
migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)
----------------------------------------------------------------
----------------------------------------------------------------
Fam Zheng (7):
qemu-iotests: Remove 091 from quick group
qemu-iotests: Speed up make check-block
qapi: Fix document for BlockStats.node-name
qapi: Comment version info in TransactionAction
qmp: Add command 'blockdev-backup'
block: Add blockdev-backup to transaction
qemu-iotests: Test blockdev-backup in 055
Max Reitz (7):
checkpatch: Brace handling on multi-line condition
block: Get full backing filename from string
block: JSON filenames and relative backing files
block: Relative backing file for image creation
block/vmdk: Relative backing file for creation
iotests: Add test for relative backing file names
iotests: Filter out "I/O thread spun..." warning
Paolo Bonzini (3):
block: mark AioContext as recursive
block: do not allocate an iovec per read of a growable/zero_after_eof
BDS
block: replace g_new0 with g_new for bottom half allocation.
Vladimir Sementsov-Ogievskiy (2):
block: fix spoiling all dirty bitmaps by mirror and migration
migration/block: fix pending() return value
async.c | 11 +-
block.c | 81 ++++++++++++---
block/backup.c | 28 ++++++
block/mirror.c | 11 +-
block/qapi.c | 7 +-
block/vmdk.c | 13 ++-
blockdev.c | 133 ++++++++++++++++++++++++
include/block/block.h | 12 ++-
migration/block.c | 9 +-
qapi-schema.json | 8 ++
qapi/block-core.json | 56 ++++++++++-
qmp-commands.hx | 42 ++++++++
scripts/checkpatch.pl | 13 ++-
tests/qemu-iotests-quick.sh | 2 +-
tests/qemu-iotests/055 | 211 ++++++++++++++++++++++++++++++++-------
tests/qemu-iotests/055.out | 4 +-
tests/qemu-iotests/067 | 3 +-
tests/qemu-iotests/071 | 2 +-
tests/qemu-iotests/071.out | 8 +-
tests/qemu-iotests/081 | 2 +-
tests/qemu-iotests/087 | 3 +-
tests/qemu-iotests/087.out | 1 -
tests/qemu-iotests/099 | 2 +-
tests/qemu-iotests/110 | 94 +++++++++++++++++
tests/qemu-iotests/110.out | 19 ++++
tests/qemu-iotests/check | 1 +
tests/qemu-iotests/common.filter | 1 +
tests/qemu-iotests/group | 3 +-
28 files changed, 693 insertions(+), 87 deletions(-)
create mode 100755 tests/qemu-iotests/110
create mode 100644 tests/qemu-iotests/110.out
--
2.1.0
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Qemu-devel] [PULL 00/19] Block patches
2014-12-19 16:34 Kevin Wolf
2014-12-22 11:14 ` Peter Maydell
@ 2015-01-05 11:55 ` Stefan Hajnoczi
1 sibling, 0 replies; 36+ messages in thread
From: Stefan Hajnoczi @ 2015-01-05 11:55 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Fri, Dec 19, 2014 at 4:34 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit dfa9c2a0f4d0a0c8b2c1449ecdbb1297427e1560:
>
> Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-12-15 16:43:42 +0000)
>
> are available in the git repository at:
>
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 55873077d9e00c4da12ba1068bd9566fc6c32388:
>
> iotests: Filter out "I/O thread spun..." warning (2014-12-19 17:17:47 +0100)
Taking over from Kevin since he is on vacation.
I dropped the patch that adds qemu-iotests to make check for now.
Once Fam has resolved the issues we can merge that patch again.
I've sent a new pull request.
Stefan
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2015-01-05 11:56 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-24 14:26 [Qemu-devel] [PULL 00/19] Block patches Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 01/19] blockdev: preserve readonly and snapshot states across media changes Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 02/19] block: correctly set the keep_read_only flag Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 03/19] block: make bdrv_set_enable_write_cache() modify open_flags Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 04/19] block: Framework for reopening files safely Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 05/19] block: move aio initialization into a helper function Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 06/19] block: move open flag parsing in raw block drivers to helper functions Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 07/19] block: do not parse BDRV_O_CACHE_WB in block drivers Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 08/19] block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 09/19] block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 10/19] block: raw-posix image file reopen Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 11/19] block: raw " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 12/19] block: qed " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 13/19] block: qcow2 " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 14/19] block: qcow " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 15/19] block: vmdk " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 16/19] block: vdi " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 17/19] block: vpc " Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 18/19] block: convert bdrv_commit() to use bdrv_reopen() Kevin Wolf
2012-09-24 14:26 ` [Qemu-devel] [PATCH 19/19] block: remove keep_read_only flag from BlockDriverState struct Kevin Wolf
2012-09-25 23:26 ` [Qemu-devel] [PULL 00/19] Block patches Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2015-01-05 11:51 Stefan Hajnoczi
2014-12-19 16:34 Kevin Wolf
2014-12-22 11:14 ` Peter Maydell
2014-12-22 12:07 ` Peter Maydell
2014-12-22 12:22 ` Peter Maydell
2014-12-23 2:15 ` Fam Zheng
2015-01-05 11:55 ` Stefan Hajnoczi
2014-12-12 17:09 Stefan Hajnoczi
2014-12-15 11:11 ` Peter Maydell
2014-03-07 13:32 Kevin Wolf
2014-03-08 12:40 ` Peter Maydell
2011-10-21 17:18 Kevin Wolf
2011-10-24 16:19 ` Anthony Liguori
2010-06-15 14:19 Kevin Wolf
2010-06-15 14:26 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).