diff options
author | Kevin Wolf <kwolf@redhat.com> | 2013-06-19 13:44:20 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-06-24 10:25:17 +0200 |
commit | 0b919fae31f4f80f78ebeab8388dc3a03cc5e4ed (patch) | |
tree | d28c579aa6c160de1efe1d46cf91c1c80f794e3f /block/qcow2.c | |
parent | 67af674e478054086f972811dd0a11289afa39a9 (diff) |
qcow2: Batch discards
This optimises the discard operation for freed clusters by batching
discard requests (both snapshot deletion and bdrv_discard end up
updating the refcounts cluster by cluster).
Note that we don't discard asynchronously, but keep s->lock held. This
is to avoid that a freed cluster is reallocated and written to while the
discard is still in flight.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index ef8a2cac39..9383990193 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -486,6 +486,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags) } QLIST_INIT(&s->cluster_allocs); + QTAILQ_INIT(&s->discards); /* read qcow2 extensions */ if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL)) { |