[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/33] qcow2: Pass discard type to qcow2_discard_clus
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 01/33] qcow2: Pass discard type to qcow2_discard_clusters() |
Date: |
Fri, 13 Sep 2013 13:50:31 +0200 |
The function will be used internally instead of only being called for
guest discard requests.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/qcow2-cluster.c | 8 ++++----
block/qcow2.c | 2 +-
block/qcow2.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 2d5aa92..b0d688e 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1338,7 +1338,7 @@ int qcow2_decompress_cluster(BlockDriverState *bs,
uint64_t cluster_offset)
* clusters.
*/
static int discard_single_l2(BlockDriverState *bs, uint64_t offset,
- unsigned int nb_clusters)
+ unsigned int nb_clusters, enum qcow2_discard_type type)
{
BDRVQcowState *s = bs->opaque;
uint64_t *l2_table;
@@ -1367,7 +1367,7 @@ static int discard_single_l2(BlockDriverState *bs,
uint64_t offset,
l2_table[l2_index + i] = cpu_to_be64(0);
/* Then decrease the refcount */
- qcow2_free_any_clusters(bs, old_offset, 1, QCOW2_DISCARD_REQUEST);
+ qcow2_free_any_clusters(bs, old_offset, 1, type);
}
ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
@@ -1379,7 +1379,7 @@ static int discard_single_l2(BlockDriverState *bs,
uint64_t offset,
}
int qcow2_discard_clusters(BlockDriverState *bs, uint64_t offset,
- int nb_sectors)
+ int nb_sectors, enum qcow2_discard_type type)
{
BDRVQcowState *s = bs->opaque;
uint64_t end_offset;
@@ -1402,7 +1402,7 @@ int qcow2_discard_clusters(BlockDriverState *bs, uint64_t
offset,
/* Each L2 table is handled by its own loop iteration */
while (nb_clusters > 0) {
- ret = discard_single_l2(bs, offset, nb_clusters);
+ ret = discard_single_l2(bs, offset, nb_clusters, type);
if (ret < 0) {
goto fail;
}
diff --git a/block/qcow2.c b/block/qcow2.c
index 578792f..147822e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1582,7 +1582,7 @@ static coroutine_fn int qcow2_co_discard(BlockDriverState
*bs,
qemu_co_mutex_lock(&s->lock);
ret = qcow2_discard_clusters(bs, sector_num << BDRV_SECTOR_BITS,
- nb_sectors);
+ nb_sectors, QCOW2_DISCARD_REQUEST);
qemu_co_mutex_unlock(&s->lock);
return ret;
}
diff --git a/block/qcow2.h b/block/qcow2.h
index 1000239..9c33b98 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -450,7 +450,7 @@ uint64_t
qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m);
int qcow2_discard_clusters(BlockDriverState *bs, uint64_t offset,
- int nb_sectors);
+ int nb_sectors, enum qcow2_discard_type type);
int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors);
/* qcow2-snapshot.c functions */
--
1.8.1.4
- [Qemu-devel] [PULL 00/33] Block patches, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 03/33] raw-win32.c: Fix incorrect handling behaviour of small block files, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 04/33] block: Image file option amendment, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 06/33] qcow2-cluster: Expand zero clusters, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 05/33] qcow2-cache: Empty cache, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 07/33] qcow2: Save refcount order in BDRVQcowState, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 01/33] qcow2: Pass discard type to qcow2_discard_clusters(),
Kevin Wolf <=
- [Qemu-devel] [PULL 02/33] qcow2: Discard VM state in active L1 after creating snapshot, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 11/33] qemu-iotests: add infrastructure of fd passing via SCM, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 10/33] qemu-iotests: add unix socket help program, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 09/33] qemu-iotest: qcow2 image option amendment, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 08/33] qcow2: Implement bdrv_amend_options, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 12/33] qemu-iotests: add tests for runtime fd passing via SCM rights, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 13/33] qemu-iotests: New test case in 061, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 15/33] snapshot: distinguish id and name in snapshot delete, Kevin Wolf, 2013/09/13