Re: [Qemu-block] [PATCH v3 2/2] block: move I/O request processing to block/io.c

2015-04-27 Thread Eric Blake
On 04/27/2015 09:53 AM, Stefan Hajnoczi wrote: > The block.c file has grown to over 6000 lines. It is time to split this > file so there are fewer conflicts and the code is easier to maintain. > > Extract I/O request processing code: > * Read > * Write > * Zero writes and making the image empt

Re: [Qemu-block] [PATCH v3 0/2] block: move I/O request processing to block/io.c

2015-04-27 Thread Eric Blake
On 04/27/2015 09:53 AM, Stefan Hajnoczi wrote: > Note: This series is based on my block-next branch: > https://github.com/stefanha/qemu.git block-next > > This series splits block.c because the file has grown too large. This helps > separate the core block layer into BlockDriverState graph operat

Re: [Qemu-block] [PATCH v3 1/2] block: replace bdrv_states iteration with bdrv_next()

2015-04-27 Thread Alberto Garcia
On Mon 27 Apr 2015 05:53:10 PM CEST, Stefan Hajnoczi wrote: > The next patch will move bdrv_drain_all() and bdrv_flush_all() out of > block.c so it's necessary to switch to the public bdrv_next() > interface. > > Signed-off-by: Stefan Hajnoczi Reviewed-by: Alberto Garcia Note: not a conseque

[Qemu-block] [PATCH v3 1/2] block: replace bdrv_states iteration with bdrv_next()

2015-04-27 Thread Stefan Hajnoczi
The bdrv_states list is a static variable in block.c. bdrv_drain_all() and bdrv_flush_all() use this variable to iterate over all drives. The next patch will move bdrv_drain_all() and bdrv_flush_all() out of block.c so it's necessary to switch to the public bdrv_next() interface. Signed-off-by:

[Qemu-block] [PATCH v3 2/2] block: move I/O request processing to block/io.c

2015-04-27 Thread Stefan Hajnoczi
The block.c file has grown to over 6000 lines. It is time to split this file so there are fewer conflicts and the code is easier to maintain. Extract I/O request processing code: * Read * Write * Zero writes and making the image empty * Flush * Discard * ioctl * Tracked requests and queuin

[Qemu-block] [PATCH v3 0/2] block: move I/O request processing to block/io.c

2015-04-27 Thread Stefan Hajnoczi
Note: This series is based on my block-next branch: https://github.com/stefanha/qemu.git block-next This series splits block.c because the file has grown too large. This helps separate the core block layer into BlockDriverState graph operations and I/O processing. Stefan Hajnoczi (2): block: r

Re: [Qemu-block] [PATCH] block/mirror: Always call block_job_sleep_ns()

2015-04-27 Thread Kevin Wolf
Am 27.04.2015 um 13:07 hat Max Reitz geschrieben: > The mirror block job is trying to take a clever shortcut if delay_ns is > 0 and skips block_job_sleep_ns() in that case. But that function must be > called in every block job iteration, because otherwise it is for example > impossible to pause the

Re: [Qemu-block] [Qemu-devel] [PATCH v4 0/3] block: Fix unaligned bdrv_aio_write_zeroes

2015-04-27 Thread Fam Zheng
On Mon, 04/27 15:23, Paolo Bonzini wrote: > > > On 27/04/2015 15:18, Fam Zheng wrote: > > An unaligned zero write causes NULL deferencing in bdrv_co_do_pwritev. That > > path is reachable from bdrv_co_write_zeroes and bdrv_aio_write_zeroes. > > > > You can easily trigger through the former with

Re: [Qemu-block] [PATCH v4 0/3] block: Fix unaligned bdrv_aio_write_zeroes

2015-04-27 Thread Paolo Bonzini
On 27/04/2015 15:18, Fam Zheng wrote: > An unaligned zero write causes NULL deferencing in bdrv_co_do_pwritev. That > path is reachable from bdrv_co_write_zeroes and bdrv_aio_write_zeroes. > > You can easily trigger through the former with qemu-io, as the test case added > by 61815d6e0aa. For bd

[Qemu-block] [PATCH v4 1/3] Revert "block: Fix unaligned zero write"

2015-04-27 Thread Fam Zheng
This reverts commit fc3959e4669a1c2149b91ccb05101cfc7ae1fc05. The core write code already handles the case, so remove this duplication. Signed-off-by: Fam Zheng --- block.c | 45 ++--- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/block.c

[Qemu-block] [PATCH v4 3/3] qemu-iotests: Test unaligned sub-block zero write

2015-04-27 Thread Fam Zheng
Test zero write in byte range 512~1024 for 4k alignment. Signed-off-by: Fam Zheng --- tests/qemu-iotests/033 | 13 + tests/qemu-iotests/033.out | 30 ++ 2 files changed, 43 insertions(+) diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 ind

[Qemu-block] [PATCH v4 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-04-27 Thread Fam Zheng
For zero write, qiov passed by callers (qemu-io "write -z" and scsi-disk "write same") is NULL. Commit fc3959e466 fixed bdrv_co_write_zeroes which is the common case for this bug, but it still exists in bdrv_aio_write_zeroes. A simpler fix would be in bdrv_co_do_pwritev which is the NULL dereferen

[Qemu-block] [PATCH v4 0/3] block: Fix unaligned bdrv_aio_write_zeroes

2015-04-27 Thread Fam Zheng
An unaligned zero write causes NULL deferencing in bdrv_co_do_pwritev. That path is reachable from bdrv_co_write_zeroes and bdrv_aio_write_zeroes. You can easily trigger through the former with qemu-io, as the test case added by 61815d6e0aa. For bdrv_aio_write_zeroes, in common cases there's alway

Re: [Qemu-block] [PATCH] block/mirror: Always call block_job_sleep_ns()

2015-04-27 Thread Fam Zheng
On Mon, 04/27 13:07, Max Reitz wrote: > The mirror block job is trying to take a clever shortcut if delay_ns is > 0 and skips block_job_sleep_ns() in that case. But that function must be > called in every block job iteration, because otherwise it is for example > impossible to pause the job. > > S

Re: [Qemu-block] qemu exit with pending I/O

2015-04-27 Thread Paolo Bonzini
On 27/04/2015 14:23, Peter Lieven wrote: > Am 27.04.2015 um 14:11 schrieb Paolo Bonzini: >> >> On 27/04/2015 13:51, Peter Lieven wrote: The reason to do this, is that while I/O is pending you do not know if the I/O has been completed or not. >>> But if I consider a raw image, quitting w

Re: [Qemu-block] [PATCH] block/mirror: Always call block_job_sleep_ns()

2015-04-27 Thread Paolo Bonzini
On 27/04/2015 13:07, Max Reitz wrote: > The mirror block job is trying to take a clever shortcut if delay_ns is > 0 and skips block_job_sleep_ns() in that case. But that function must be > called in every block job iteration, because otherwise it is for example > impossible to pause the job. > >

Re: [Qemu-block] [Qemu-devel] [PATCH v3 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-04-27 Thread Fam Zheng
On Mon, 04/27 12:45, Paolo Bonzini wrote: > > > On 27/04/2015 07:40, Fam Zheng wrote: > > + > > +if (!qiov) { > > Perhaps "if (!qiov && bytes >= align)"? Yes, that's right, we don't want 0 aligned_bytes here. Fam > > Paolo > > > +uint64_t aligned_bytes = bytes & ~(align - 1); >

Re: [Qemu-block] qemu exit with pending I/O

2015-04-27 Thread Peter Lieven
Am 27.04.2015 um 14:11 schrieb Paolo Bonzini: On 27/04/2015 13:51, Peter Lieven wrote: The reason to do this, is that while I/O is pending you do not know if the I/O has been completed or not. But if I consider a raw image, quitting without a clean shutdown can also leave an inconsistent state

Re: [Qemu-block] qemu exit with pending I/O

2015-04-27 Thread Paolo Bonzini
On 27/04/2015 13:51, Peter Lieven wrote: >> The reason to do this, is that while I/O is pending you do not know if >> the I/O has been completed or not. > > But if I consider a raw image, quitting without a clean shutdown can > also leave an inconsistent state? But you know that all I/O submitt

Re: [Qemu-block] qemu exit with pending I/O

2015-04-27 Thread Peter Lieven
Am 27.04.2015 um 12:47 schrieb Paolo Bonzini: On 16/04/2015 10:46, Peter Lieven wrote: I just run tests with the new libiscsi branch that allows async reconnects. I found that I cannot quit qemu while qemu is waiting for a reconnect to the storage. E.g. I start qemu and then shut down the stor

Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/4] qemu-iotests: Test that "stop" doesn't drain block jobs

2015-04-27 Thread Max Reitz
On 27.04.2015 07:14, Fam Zheng wrote: On Fri, 04/24 17:43, Max Reitz wrote: On 03.04.2015 16:05, Fam Zheng wrote: Signed-off-by: Fam Zheng --- tests/qemu-iotests/129 | 86 ++ tests/qemu-iotests/129.out | 5 +++ tests/qemu-iotests/group |

[Qemu-block] [PATCH] block/mirror: Always call block_job_sleep_ns()

2015-04-27 Thread Max Reitz
The mirror block job is trying to take a clever shortcut if delay_ns is 0 and skips block_job_sleep_ns() in that case. But that function must be called in every block job iteration, because otherwise it is for example impossible to pause the job. Signed-off-by: Max Reitz --- This makes test 129 p

Re: [Qemu-block] qemu exit with pending I/O

2015-04-27 Thread Paolo Bonzini
On 16/04/2015 10:46, Peter Lieven wrote: > > > I just run tests with the new libiscsi branch that allows async > reconnects. I found that > I cannot quit qemu while qemu is waiting for a reconnect to the storage. > E.g. > I start qemu and then shut down the storage. Qemu will then loop forever

Re: [Qemu-block] [PATCH v3 2/3] block: Fix NULL deference for unaligned write if qiov is NULL

2015-04-27 Thread Paolo Bonzini
On 27/04/2015 07:40, Fam Zheng wrote: > + > +if (!qiov) { Perhaps "if (!qiov && bytes >= align)"? Paolo > +uint64_t aligned_bytes = bytes & ~(align - 1); > + > +assert((offset & (align - 1)) == 0); > +ret = bdrv_aligned_pwritev(bs, &req, offset, aligned_bytes, > +

Re: [Qemu-block] [PATCH COLO v3 01/14] docs: block replication's description

2015-04-27 Thread Stefan Hajnoczi
On Fri, Apr 24, 2015 at 11:36:35AM +0200, Paolo Bonzini wrote: > > > On 24/04/2015 11:38, Wen Congyang wrote: > >> > > >> > That can be done with drive-mirror. But I think it's too early for that. > > Do you mean use drive-mirror instead of quorum? > > Only before starting up a new secondary.