[Qemu-block] [PATCH 3/7] gluster: Query current size in do_truncate()

2018-02-13 Thread Max Reitz
Instead of expecting the current size to be 0, query it and allocate only the area [current_size, offset) if preallocation is requested. Signed-off-by: Max Reitz --- block/gluster.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Daniel P . Berrangé
On Tue, Feb 13, 2018 at 11:43:55AM +, Dr. David Alan Gilbert wrote: > * Kevin Wolf (kw...@redhat.com) wrote: > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > > On Thu, Jan 11, 2018 at 01:46:38PM +0100, Max Reitz wrote: > > > > On 2018-01-08 14:52, Eric Blake wrote: > > > > >

Re: [Qemu-block] [PATCH v4 34/39] qcow2: Rename l2_table in count_contiguous_clusters_unallocated()

2018-02-13 Thread Kevin Wolf
Am 05.02.2018 um 15:33 hat Alberto Garcia geschrieben: > This function doesn't need any changes to support L2 slices, but since > it's now dealing with slices intead of full tables, the l2_table s/intead/instead/ > variable is renamed for clarity. > > Signed-off-by: Alberto Garcia

[Qemu-block] [PATCH 0/7] block: Preallocated truncation for gluster and sheepdog

2018-02-13 Thread Max Reitz
As far as I can see, these are the only protocols beside file-posix that support preallocated creation. In contrast to file-posix, however, they have not supported preallocated truncation so far. This series brings their truncation code to feature parity with their creation code in this regard.

[Qemu-block] [PATCH 7/7] sheepdog: Allow fully preallocated truncation

2018-02-13 Thread Max Reitz
Signed-off-by: Max Reitz --- block/sheepdog.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index d300fb69c0..ac02b10fe0 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2180,15 +2180,16 @@

[Qemu-block] [PATCH 5/7] sheepdog: Make sd_prealloc() take a BDS

2018-02-13 Thread Max Reitz
We want to use this function in sd_truncate() later on, so taking a filename is not exactly ideal. Signed-off-by: Max Reitz --- block/sheepdog.c | 29 + 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/block/sheepdog.c

[Qemu-block] [PATCH 4/7] gluster: Add preallocated truncation

2018-02-13 Thread Max Reitz
By using qemu_do_cluster_truncate() in qemu_cluster_truncate(), we now automatically have preallocated truncation. Signed-off-by: Max Reitz --- block/gluster.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/block/gluster.c

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Dr. David Alan Gilbert
* Kevin Wolf (kw...@redhat.com) wrote: > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > On Thu, Jan 11, 2018 at 01:46:38PM +0100, Max Reitz wrote: > > > On 2018-01-08 14:52, Eric Blake wrote: > > > > On 01/07/2018 06:23 AM, Richard Palethorpe wrote: > > > >> Add QAPI wrapper

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Kevin Wolf
Am 13.02.2018 um 12:51 hat Daniel P. Berrangé geschrieben: > On Tue, Feb 13, 2018 at 11:43:55AM +, Dr. David Alan Gilbert wrote: > > * Kevin Wolf (kw...@redhat.com) wrote: > > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > > > On Thu, Jan 11, 2018 at 01:46:38PM +0100, Max

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Daniel P . Berrangé
On Tue, Feb 13, 2018 at 02:20:00PM +0100, Kevin Wolf wrote: > Am 13.02.2018 um 12:51 hat Daniel P. Berrangé geschrieben: > > On Tue, Feb 13, 2018 at 11:43:55AM +, Dr. David Alan Gilbert wrote: > > > * Kevin Wolf (kw...@redhat.com) wrote: > > > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange

Re: [Qemu-block] [PATCH v4 00/39] Allow configuring the qcow2 L2 cache entry size

2018-02-13 Thread Kevin Wolf
Am 05.02.2018 um 17:31 hat Max Reitz geschrieben: > On 2018-02-05 15:33, Alberto Garcia wrote: > > this is the new revision of the patch series to allow configuring the > > entry size of the qcow2 L2 cache. Follow this link for the full > > description from the first version: > > > >

Re: [Qemu-block] [PATCH v4 37/39] iotests: Test valid values of l2-cache-entry-size

2018-02-13 Thread Kevin Wolf
Am 05.02.2018 um 15:33 hat Alberto Garcia geschrieben: > The l2-cache-entry-size setting can only contain values that are > powers of two between 512 and the cluster size. > > Signed-off-by: Alberto Garcia > Reviewed-by: Eric Blake > Reviewed-by: Max Reitz

Re: [Qemu-block] [PATCH v4 37/39] iotests: Test valid values of l2-cache-entry-size

2018-02-13 Thread Alberto Garcia
On Tue 13 Feb 2018 01:32:17 PM CET, Kevin Wolf wrote: >> +# Invalid cache entry sizes >> +$QEMU_IO -c "open -o l2-cache-entry-size=256 $TEST_IMG" \ >> +2>&1 | _filter_testdir | _filter_imgfmt >> +$QEMU_IO -c "open -o l2-cache-entry-size=300 $TEST_IMG" \ >> +2>&1 | _filter_testdir |

[Qemu-block] [PATCH 6/7] sheepdog: Pass old and new size to sd_prealloc()

2018-02-13 Thread Max Reitz
sd_prealloc() will now preallocate the area [old_size, new_size). As before, it rounds to buf_size and may thus overshoot and preallocate areas that were not requested to be preallocated. For image creation, this is no change in behavior. For truncation, this is in accordance with the

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Kevin Wolf
Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > On Thu, Jan 11, 2018 at 01:46:38PM +0100, Max Reitz wrote: > > On 2018-01-08 14:52, Eric Blake wrote: > > > On 01/07/2018 06:23 AM, Richard Palethorpe wrote: > > >> Add QAPI wrapper functions for the existing snapshot functionality.

Re: [Qemu-block] qcow2 images corruption

2018-02-13 Thread Kevin Wolf
Am 07.02.2018 um 18:06 hat Nicolas Ecarnot geschrieben: > TL; DR : qcow2 images keep getting corrupted. Any workaround? Not without knowing the cause. The first thing to make sure is that the image isn't touched by a second process while QEMU is running a VM. The classic one is using 'qemu-img

Re: [Qemu-block] [Qemu-devel] [PATCH 1/7] gluster: Move glfs_close() to create's clean-up

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: glfs_close() is a classical clean-up operation, as can be seen by the fact that it is executed even if the truncation before it failed. Also, moving it to clean-up makes it more clear that if it fails, we do not want it to overwrite the current ret value

Re: [Qemu-block] [PATCH v4 25/39] qcow2: Update zero_single_l2() to support L2 slices

2018-02-13 Thread Eric Blake
On 02/05/2018 08:33 AM, Alberto Garcia wrote: zero_single_l2() limits the number of clusters to be zeroed to the amount that fits inside an L2 table. Since we'll be loading L2 slices instead of full tables we need to update that limit. The function is renamed to zero_in_l2_slice() for clarity.

Re: [Qemu-block] [PATCH v4 00/39] Allow configuring the qcow2 L2 cache entry size

2018-02-13 Thread Max Reitz
On 2018-02-05 15:33, Alberto Garcia wrote: > this is the new revision of the patch series to allow configuring the > entry size of the qcow2 L2 cache. Follow this link for the full > description from the first version: > >https://lists.gnu.org/archive/html/qemu-block/2017-10/msg00458.html >

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Denis V. Lunev
On 02/13/2018 05:48 PM, Daniel P. Berrangé wrote: > On Tue, Feb 13, 2018 at 03:45:21PM +0100, Kevin Wolf wrote: >> Am 13.02.2018 um 15:36 hat Daniel P. Berrangé geschrieben: >>> On Tue, Feb 13, 2018 at 05:30:02PM +0300, Roman Kagan wrote: On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf

Re: [Qemu-block] [Qemu-devel] [PATCH 7/7] sheepdog: Allow fully preallocated truncation

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: Signed-off-by: Max Reitz --- block/sheepdog.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) Reviewed-by: Eric Blake -- Eric Blake, Principal Software Engineer Red Hat, Inc.

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Daniel P . Berrangé
On Tue, Feb 13, 2018 at 03:43:10PM +0100, Kevin Wolf wrote: > Am 13.02.2018 um 15:30 hat Roman Kagan geschrieben: > > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: > > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > > > Then you could just use the regular migrate QMP

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Daniel P . Berrangé
On Tue, Feb 13, 2018 at 04:23:21PM +0100, Kevin Wolf wrote: > Am 13.02.2018 um 15:58 hat Daniel P. Berrangé geschrieben: > > On Tue, Feb 13, 2018 at 03:43:10PM +0100, Kevin Wolf wrote: > > > Am 13.02.2018 um 15:30 hat Roman Kagan geschrieben: > > > > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Kevin Wolf
Am 13.02.2018 um 15:30 hat Roman Kagan geschrieben: > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > > Then you could just use the regular migrate QMP commands for loading > > > and saving snapshots. > > > > Yes, you

Re: [Qemu-block] [Qemu-devel] [PATCH 4/7] gluster: Add preallocated truncation

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: By using qemu_do_cluster_truncate() in qemu_cluster_truncate(), we now automatically have preallocated truncation. Signed-off-by: Max Reitz --- block/gluster.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-)

Re: [Qemu-block] [Qemu-devel] [PATCH 2/7] gluster: Pull truncation from qemu_gluster_create

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: Pull out the truncation code from the qemu_cluster_create() function so we can later reuse it in qemu_gluster_truncate(). Signed-off-by: Max Reitz --- block/gluster.c | 74 +++--

Re: [Qemu-block] [Qemu-devel] [PATCH 3/7] gluster: Query current size in do_truncate()

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: Instead of expecting the current size to be 0, query it and allocate only the area [current_size, offset) if preallocation is requested. Signed-off-by: Max Reitz --- block/gluster.c | 21 +++-- 1 file changed, 19

Re: [Qemu-block] [Qemu-devel] [PATCH 6/7] sheepdog: Pass old and new size to sd_prealloc()

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: sd_prealloc() will now preallocate the area [old_size, new_size). As before, it rounds to buf_size and may thus overshoot and preallocate areas that were not requested to be preallocated. For image creation, this is no change in behavior. For

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Denis V. Lunev
On 02/13/2018 05:59 PM, Dr. David Alan Gilbert wrote: > * Daniel P. Berrangé (berra...@redhat.com) wrote: >> On Tue, Feb 13, 2018 at 03:45:21PM +0100, Kevin Wolf wrote: >>> Am 13.02.2018 um 15:36 hat Daniel P. Berrangé geschrieben: On Tue, Feb 13, 2018 at 05:30:02PM +0300, Roman Kagan wrote:

Re: [Qemu-block] qcow2 images corruption

2018-02-13 Thread Nicolas Ecarnot
Hello Kevin, Le 13/02/2018 à 10:41, Kevin Wolf a écrit : Am 07.02.2018 um 18:06 hat Nicolas Ecarnot geschrieben: TL; DR : qcow2 images keep getting corrupted. Any workaround? Not without knowing the cause. Actually, my main concern is mostly about finding the cause rather than correcting

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Dr. David Alan Gilbert
* Roman Kagan (rka...@virtuozzo.com) wrote: > On Tue, Feb 13, 2018 at 03:05:03PM +, Dr. David Alan Gilbert wrote: > > * Denis V. Lunev (d...@virtuozzo.com) wrote: > > > On 02/13/2018 05:59 PM, Dr. David Alan Gilbert wrote: > > > > * Daniel P. Berrangé (berra...@redhat.com) wrote: > > > >> That

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Kevin Wolf
Am 13.02.2018 um 15:58 hat Daniel P. Berrangé geschrieben: > On Tue, Feb 13, 2018 at 03:43:10PM +0100, Kevin Wolf wrote: > > Am 13.02.2018 um 15:30 hat Roman Kagan geschrieben: > > > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: > > > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange

Re: [Qemu-block] [PATCH 0/7] block: Preallocated truncation for gluster and sheepdog

2018-02-13 Thread Kevin Wolf
Am 13.02.2018 um 14:03 hat Max Reitz geschrieben: > As far as I can see, these are the only protocols beside file-posix that > support preallocated creation. In contrast to file-posix, however, they > have not supported preallocated truncation so far. This series brings > their truncation code

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Kevin Wolf
Am 13.02.2018 um 15:36 hat Daniel P. Berrangé geschrieben: > On Tue, Feb 13, 2018 at 05:30:02PM +0300, Roman Kagan wrote: > > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: > > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > > > Then you could just use the regular

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Denis V. Lunev
On 02/13/2018 05:43 PM, Kevin Wolf wrote: > Am 13.02.2018 um 15:30 hat Roman Kagan geschrieben: >> On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: >>> Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: Then you could just use the regular migrate QMP commands for loading

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote: > On Tue, Feb 13, 2018 at 03:45:21PM +0100, Kevin Wolf wrote: > > Am 13.02.2018 um 15:36 hat Daniel P. Berrangé geschrieben: > > > On Tue, Feb 13, 2018 at 05:30:02PM +0300, Roman Kagan wrote: > > > > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Kevin Wolf
Am 13.02.2018 um 16:30 hat Daniel P. Berrangé geschrieben: > On Tue, Feb 13, 2018 at 04:23:21PM +0100, Kevin Wolf wrote: > > Am 13.02.2018 um 15:58 hat Daniel P. Berrangé geschrieben: > > > On Tue, Feb 13, 2018 at 03:43:10PM +0100, Kevin Wolf wrote: > > > > Am 13.02.2018 um 15:30 hat Roman Kagan

Re: [Qemu-block] [PATCH v4 24/39] qcow2: Update discard_single_l2() to support L2 slices

2018-02-13 Thread Eric Blake
On 02/05/2018 08:33 AM, Alberto Garcia wrote: discard_single_l2() limits the number of clusters to be discarded to the amount that fits inside an L2 table. Since we'll be loading L2 slices instead of full tables we need to update that limit. The function is renamed to discard_in_l2_slice() for

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Daniel P . Berrangé
On Tue, Feb 13, 2018 at 03:45:21PM +0100, Kevin Wolf wrote: > Am 13.02.2018 um 15:36 hat Daniel P. Berrangé geschrieben: > > On Tue, Feb 13, 2018 at 05:30:02PM +0300, Roman Kagan wrote: > > > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: > > > > Am 11.01.2018 um 14:04 hat Daniel P.

Re: [Qemu-block] [PATCH v4 31/39] qcow2: Update qcow2_truncate() to support L2 slices

2018-02-13 Thread Eric Blake
On 02/05/2018 08:33 AM, Alberto Garcia wrote: The qcow2_truncate() code is mostly independent from whether we're using L2 slices or full L2 tables, but in full and falloc preallocation modes new L2 tables are allocated using qcow2_alloc_cluster_link_l2(). Therefore the code needs to be modified

Re: [Qemu-block] [Qemu-devel] [PATCH 5/7] sheepdog: Make sd_prealloc() take a BDS

2018-02-13 Thread Eric Blake
On 02/13/2018 07:03 AM, Max Reitz wrote: We want to use this function in sd_truncate() later on, so taking a filename is not exactly ideal. Signed-off-by: Max Reitz --- block/sheepdog.c | 29 + 1 file changed, 21 insertions(+), 8 deletions(-)

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Denis V. Lunev
On 02/13/2018 06:27 PM, Dr. David Alan Gilbert wrote: > * Roman Kagan (rka...@virtuozzo.com) wrote: >> On Tue, Feb 13, 2018 at 03:05:03PM +, Dr. David Alan Gilbert wrote: >>> * Denis V. Lunev (d...@virtuozzo.com) wrote: On 02/13/2018 05:59 PM, Dr. David Alan Gilbert wrote: > * Daniel

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Daniel P . Berrangé
On Tue, Feb 13, 2018 at 05:30:02PM +0300, Roman Kagan wrote: > On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: > > Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: > > > Then you could just use the regular migrate QMP commands for loading > > > and saving snapshots. > > > >

Re: [Qemu-block] [PATCH v4 27/39] qcow2: Update qcow2_update_snapshot_refcount() to support L2 slices

2018-02-13 Thread Eric Blake
On 02/05/2018 08:33 AM, Alberto Garcia wrote: qcow2_update_snapshot_refcount() increases the refcount of all clusters of a given snapshot. In order to do that it needs to load all its L2 tables and iterate over their entries. Since we'll be loading L2 slices instead of full tables we need to add

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Dr. David Alan Gilbert
* Denis V. Lunev (d...@virtuozzo.com) wrote: > On 02/13/2018 05:59 PM, Dr. David Alan Gilbert wrote: > > * Daniel P. Berrangé (berra...@redhat.com) wrote: > >> On Tue, Feb 13, 2018 at 03:45:21PM +0100, Kevin Wolf wrote: > >>> Am 13.02.2018 um 15:36 hat Daniel P. Berrangé geschrieben: > On

[Qemu-block] [PULL 07/55] iotests: Use virtio-blk in 155

2018-02-13 Thread Kevin Wolf
From: Max Reitz Only a few select machine types support floppy drives and there is actually nothing preventing us from using virtio here, so let's do it. Reported-by: Christian Borntraeger Signed-off-by: Max Reitz Tested-by:

[Qemu-block] [PULL 13/55] sheepdog: Make sd_prealloc() take a BDS

2018-02-13 Thread Kevin Wolf
From: Max Reitz We want to use this function in sd_truncate() later on, so taking a filename is not exactly ideal. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- block/sheepdog.c | 29

[Qemu-block] [PULL 22/55] qcow2: Remove BDS parameter from qcow2_cache_entry_mark_dirty()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function was only using the BlockDriverState parameter to pass it to qcow2_cache_get_table_idx(). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL 27/55] qcow2: Remove BDS parameter from qcow2_cache_is_table_offset()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function was only using the BlockDriverState parameter to pass it to qcow2_cache_get_table_addr(). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL 46/55] qcow2: Update expand_zero_clusters_in_l1() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia expand_zero_clusters_in_l1() expands zero clusters as a necessary step to downgrade qcow2 images to a version that doesn't support metadata zero clusters. This function takes an L1 table (which may or may not be active) and iterates over all its L2 tables

[Qemu-block] [PULL 18/55] qcow2: Add table size field to Qcow2Cache

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia The table size in the qcow2 cache is currently equal to the cluster size. This doesn't allow us to use the cache memory efficiently, particularly with large cluster sizes, so we need to be able to have smaller cache tables that are independent from the

[Qemu-block] [PULL 12/55] gluster: Add preallocated truncation

2018-02-13 Thread Kevin Wolf
From: Max Reitz By using qemu_do_cluster_truncate() in qemu_cluster_truncate(), we now automatically have preallocated truncation. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf ---

[Qemu-block] [PULL 17/55] qcow2: Fix documentation of get_cluster_table()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function has not been returning the offset of the L2 table since commit 3948d1d4876065160583e79533bf604481063833 Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz

[Qemu-block] [PULL 29/55] qcow2: Add l2_slice_size field to BDRVQcow2State

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia The BDRVQcow2State structure contains an l2_size field, which stores the number of 64-bit entries in an L2 table. For efficiency reasons we want to be able to load slices instead of full L2 tables, so we need to know how many entries an L2 slice can hold.

[Qemu-block] [PULL 39/55] qcow2: Update handle_alloc() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia handle_alloc() loads an L2 table and limits the number of checked clusters to the amount that fits inside that table. Since we'll be loading L2 slices instead of full tables we need to update that limit. Apart from that, this function doesn't need any

[Qemu-block] [PULL 44/55] qcow2: Read refcount before L2 table in expand_zero_clusters_in_l1()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia At the moment it doesn't really make a difference whether we call qcow2_get_refcount() before of after reading the L2 table, but if we want to support L2 slices we'll need to read the refcount first. This patch simply changes the order of those two

[Qemu-block] [PULL 48/55] qcow2: Rename l2_table in qcow2_alloc_compressed_cluster_offset()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function doesn't need any changes to support L2 slices, but since it's now dealing with slices instead of full tables, the l2_table variable is renamed for clarity. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL 53/55] iotests: Test valid values of l2-cache-entry-size

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia The l2-cache-entry-size setting can only contain values that are powers of two between 512 and the cluster size. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Denis Plotnikov
On 13.02.2018 18:05, Dr. David Alan Gilbert wrote: * Denis V. Lunev (d...@virtuozzo.com) wrote: On 02/13/2018 05:59 PM, Dr. David Alan Gilbert wrote: * Daniel P. Berrangé (berra...@redhat.com) wrote: On Tue, Feb 13, 2018 at 03:45:21PM +0100, Kevin Wolf wrote: Am 13.02.2018 um 15:36 hat

[Qemu-block] block_status automatically added flags

2018-02-13 Thread Vladimir Sementsov-Ogievskiy
Hi Eric! I'm now testing my nbd block status realization (block_status part, not about dirty bitmaps), and faced into the following effect. I created empty qcow2 image and wrote to the first sector, so qemu-io -c map x reports: 64 KiB (0x1) bytes allocated at offset 0 bytes (0x0)

[Qemu-block] [PULL 10/55] gluster: Pull truncation from qemu_gluster_create

2018-02-13 Thread Kevin Wolf
From: Max Reitz Pull out the truncation code from the qemu_cluster_create() function so we can later reuse it in qemu_gluster_truncate(). Signed-off-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf ---

[Qemu-block] [PULL 02/55] qemu-img.texi: Clean up parameter list

2018-02-13 Thread Kevin Wolf
From: Fam Zheng Split options out of the "@table @var" section and create a "@table @option", then use whitespaces and blank lines consistently. Suggested-by: Kevin Wolf Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi

[Qemu-block] [PULL 28/55] qcow2: Add offset_to_l1_index()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia Similar to offset_to_l2_index(), this function returns the index in the L1 table for a given guest offset. This is only used in a couple of places and it's not a particularly complex calculation, but it makes the code a bit more readable. Although in the

[Qemu-block] [PULL 32/55] qcow2: Prepare l2_allocate() for adding L2 slice support

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia Adding support for L2 slices to l2_allocate() needs (among other things) an extra loop that iterates over all slices of a new L2 table. Putting all changes in one patch would make it hard to read because all semantic changes would be mixed with pure

[Qemu-block] [PULL 40/55] qcow2: Update discard_single_l2() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia discard_single_l2() limits the number of clusters to be discarded to the amount that fits inside an L2 table. Since we'll be loading L2 slices instead of full tables we need to update that limit. The function is renamed to discard_in_l2_slice() for clarity.

[Qemu-block] [PULL 34/55] qcow2: Refactor get_cluster_table()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia After the previous patch we're now always using l2_load() in get_cluster_table() regardless of whether a new L2 table has to be allocated or not. This patch refactors that part of the code to use one single l2_load() call. Signed-off-by: Alberto Garcia

[Qemu-block] [PULL 42/55] qcow2: Prepare qcow2_update_snapshot_refcount() for adding L2 slice support

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia Adding support for L2 slices to qcow2_update_snapshot_refcount() needs (among other things) an extra loop that iterates over all slices of each L2 table. Putting all changes in one patch would make it hard to read because all semantic changes would be

[Qemu-block] [PULL 36/55] qcow2: Update qcow2_get_cluster_offset() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia qcow2_get_cluster_offset() checks how many contiguous bytes are available at a given offset. The returned number of bytes is limited by the amount that can be addressed without having to load more than one L2 table. Since we'll be loading L2 slices instead

Re: [Qemu-block] qcow2 images corruption

2018-02-13 Thread Nicolas Ecarnot
Le 13/02/2018 à 16:26, Nicolas Ecarnot a écrit : >> It would be good if you could make the 'qemu-img check' output available >> somewhere. > I found this : https://github.com/ShijunDeng/qcow2-dump and the transcript (beautiful colors when viewed with "more") is attached : -- Nicolas ECARNOT

[Qemu-block] [PULL 06/55] block: early check for blockers on drive-mirror

2018-02-13 Thread Kevin Wolf
From: Paolo Bonzini Even if an op blocker is present for BLOCK_OP_TYPE_MIRROR_SOURCE, it is checked a bit late and the result is that the target is created even if drive-mirror subsequently fails. Add an early check to avoid this. Signed-off-by: Paolo Bonzini

[Qemu-block] [PULL 00/55] Block layer patches

2018-02-13 Thread Kevin Wolf
The following changes since commit fb68096da3d35e64c88cd610c1fa42766c58e92a: Revert "tests: use memfd in vhost-user-test" (2018-02-13 09:51:52 +) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to fetch changes up to

[Qemu-block] [PULL 26/55] qcow2: Remove BDS parameter from qcow2_cache_discard()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function was only using the BlockDriverState parameter to pass it to qcow2_cache_get_table_idx() and qcow2_cache_table_release(). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia

[Qemu-block] [PULL 41/55] qcow2: Update zero_single_l2() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia zero_single_l2() limits the number of clusters to be zeroed to the amount that fits inside an L2 table. Since we'll be loading L2 slices instead of full tables we need to update that limit. The function is renamed to zero_in_l2_slice() for clarity. Apart

[Qemu-block] [PULL 43/55] qcow2: Update qcow2_update_snapshot_refcount() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia qcow2_update_snapshot_refcount() increases the refcount of all clusters of a given snapshot. In order to do that it needs to load all its L2 tables and iterate over their entries. Since we'll be loading L2 slices instead of full tables we need to add an

[Qemu-block] [PULL 47/55] qcow2: Update qcow2_truncate() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia The qcow2_truncate() code is mostly independent from whether we're using L2 slices or full L2 tables, but in full and falloc preallocation modes new L2 tables are allocated using qcow2_alloc_cluster_link_l2(). Therefore the code needs to be modified to

[Qemu-block] [PULL 51/55] qcow2: Rename l2_table in count_cow_clusters()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function doesn't need any changes to support L2 slices, but since it's now dealing with slices intead of full tables, the l2_table variable is renamed for clarity. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Eric Blake
On 02/13/2018 08:48 AM, Daniel P. Berrangé wrote: No, that's policy decision that doesn't matter from QMP pov. If the mgmt app wants the snapshot to be wrt to the initial time, it can simply invoke the "stop" QMP command before doing the live migration and "cont" afterwards. That would be

Re: [Qemu-block] qcow2 images corruption

2018-02-13 Thread Nicolas Ecarnot
Le 13/02/2018 à 16:26, Nicolas Ecarnot a écrit : It would be good if you could make the 'qemu-img check' output available somewhere. I found this : https://github.com/ShijunDeng/qcow2-dump and the transcript (beautiful colors when viewed with "more") is attached : -- Nicolas ECARNOT Le

[Qemu-block] [PULL 01/55] iotests: Fix CID for VMDK afl image

2018-02-13 Thread Kevin Wolf
From: Fam Zheng This reverts commit 76bf133c4 which updated the reference output, and fixed the reference image, because the code path we want to exercise is actually the invalid image size. The descriptor block in the image, which includes the CID to verify, has been invalid

[Qemu-block] [PULL 04/55] docs: Document share-rw property more thoroughly

2018-02-13 Thread Kevin Wolf
From: Fam Zheng Suggested-by: Stefan Hajnoczi Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Reviewed-by: Kashyap Chamarthy Signed-off-by: Kevin Wolf ---

[Qemu-block] [PULL 25/55] qcow2: Remove BDS parameter from qcow2_cache_clean_unused()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function was only using the BlockDriverState parameter to pass it to qcow2_cache_table_release(). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL 19/55] qcow2: Remove BDS parameter from qcow2_cache_get_table_addr()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function was only using the BlockDriverState parameter to get the cache table size (since it was equal to the cluster size). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia Reviewed-by:

[Qemu-block] [PULL 50/55] qcow2: Rename l2_table in count_contiguous_clusters_unallocated()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function doesn't need any changes to support L2 slices, but since it's now dealing with slices instead of full tables, the l2_table variable is renamed for clarity. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL 49/55] qcow2: Rename l2_table in count_contiguous_clusters()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function doesn't need any changes to support L2 slices, but since it's now dealing with slices intead of full tables, the l2_table variable is renamed for clarity. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

Re: [Qemu-block] [Qemu-devel] [PATCH 1/2] Add save-snapshot, load-snapshot and delete-snapshot to QAPI

2018-02-13 Thread Denis Plotnikov
On 13.02.2018 17:43, Kevin Wolf wrote: Am 13.02.2018 um 15:30 hat Roman Kagan geschrieben: On Tue, Feb 13, 2018 at 11:50:24AM +0100, Kevin Wolf wrote: Am 11.01.2018 um 14:04 hat Daniel P. Berrange geschrieben: Then you could just use the regular migrate QMP commands for loading and saving

[Qemu-block] [PULL 23/55] qcow2: Remove BDS parameter from qcow2_cache_put()

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This function was only using the BlockDriverState parameter to pass it to qcow2_cache_get_table_idx(). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake

[Qemu-block] [PULL 38/55] qcow2: Update handle_copied() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia handle_copied() loads an L2 table and limits the number of checked clusters to the amount that fits inside that table. Since we'll be loading L2 slices instead of full tables we need to update that limit. Apart from that, this function doesn't need any

[Qemu-block] [PULL 35/55] qcow2: Update get_cluster_table() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This patch updates get_cluster_table() to return L2 slices instead of full L2 tables. The code itself needs almost no changes, it only needs to call offset_to_l2_slice_index() instead of offset_to_l2_index(). This patch also renames all the relevant

[Qemu-block] [PULL 33/55] qcow2: Update l2_allocate() to support L2 slices

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This patch updates l2_allocate() to support the qcow2 cache returning L2 slices instead of full L2 tables. The old code simply gets an L2 table from the cache and initializes it with zeroes or with the contents of an existing table. With a cache that

[Qemu-block] [PULL 45/55] qcow2: Prepare expand_zero_clusters_in_l1() for adding L2 slice support

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia Adding support for L2 slices to expand_zero_clusters_in_l1() needs (among other things) an extra loop that iterates over all slices of each L2 table. Putting all changes in one patch would make it hard to read because all semantic changes would be mixed

[Qemu-block] [PULL 54/55] iotests: Test downgrading an image using a small L2 slice size

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia expand_zero_clusters_in_l1() is used when downgrading qcow2 images from v3 to v2 (compat=0.10). This is one of the functions that needed more changes to support L2 slices, so this patch extends iotest 061 to test downgrading a qcow2 image using a smaller

[Qemu-block] [PULL 52/55] qcow2: Allow configuring the L2 slice size

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia Now that the code is ready to handle L2 slices we can finally add an option to allow configuring their size. An L2 slice is the portion of an L2 table that is read by the qcow2 cache. Until now the cache was always reading full L2 tables, and since the L2

[Qemu-block] [PULL 55/55] iotests: Add l2-cache-entry-size to iotest 137

2018-02-13 Thread Kevin Wolf
From: Alberto Garcia This test tries reopening a qcow2 image with valid and invalid options. This patch adds l2-cache-entry-size to the set. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz

Re: [Qemu-block] block_status automatically added flags

2018-02-13 Thread Eric Blake
On 02/13/2018 11:36 AM, Vladimir Sementsov-Ogievskiy wrote: Hi Eric! I'm now testing my nbd block status realization (block_status part, not about dirty bitmaps), and faced into the following effect. I created empty qcow2 image and wrote to the first sector, so qemu-io -c map x reports:

[Qemu-block] [PATCH v8 15/21] sheepdog: Switch to .bdrv_co_block_status()

2018-02-13 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the sheepdog driver accordingly. Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fam Zheng Reviewed-by: Jeff

[Qemu-block] [PATCH v8 21/21] block: Drop unused .bdrv_co_get_block_status()

2018-02-13 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Now that all drivers have been updated to provide the byte-based .bdrv_co_block_status(), we can delete the sector-based interface. Signed-off-by: Eric Blake Reviewed-by: Vladimir

[Qemu-block] [PATCH v8 19/21] vpc: Switch to .bdrv_co_block_status()

2018-02-13 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the vpc driver accordingly. Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fam Zheng --- v7: tweak commit

Re: [Qemu-block] [PATCH v4] ssh: switch from libssh2 to libssh

2018-02-13 Thread Max Reitz
On 2018-01-18 17:44, Pino Toscano wrote: > Rewrite the implementation of the ssh block driver to use libssh instead > of libssh2. The libssh library has various advantages over libssh2: > - easier API for authentication (for example for using ssh-agent) > - easier API for known_hosts handling > -

Re: [Qemu-block] [PATCH v4] ssh: switch from libssh2 to libssh

2018-02-13 Thread Eric Blake
On 02/13/2018 12:49 PM, Max Reitz wrote: On 2018-01-18 17:44, Pino Toscano wrote: Rewrite the implementation of the ssh block driver to use libssh instead of libssh2. The libssh library has various advantages over libssh2: - easier API for authentication (for example for using ssh-agent) -

Re: [Qemu-block] [PATCH v6 3/9] block: Add VFIO based NVMe driver

2018-02-13 Thread Eric Blake
On 01/16/2018 12:08 AM, Fam Zheng wrote: This is a new protocol driver that exclusively opens a host NVMe controller through VFIO. It achieves better latency than linux-aio by completely bypassing host kernel vfs/block layer. $rw-$bs-$iodepth linux-aio nvme://

  1   2   >