Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
qemu.19805
0157-qcow2-Resize-the-cache-upon-image-r.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0157-qcow2-Resize-the-cache-upon-image-r.patch of Package qemu.19805
From: Leonid Bloch <lbloch@janustech.com> Date: Wed, 26 Sep 2018 19:04:45 +0300 Subject: qcow2: Resize the cache upon image resizing Include-If: %if 0%{?suse_version} == 1315 The caches are now recalculated upon image resizing. This is done because the new default behavior of assigning L2 cache relatively to the image size, implies that the cache will be adapted accordingly after an image resize. Signed-off-by: Leonid Bloch <lbloch@janustech.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 45b4949c7bcdcd998cb42f5c517e80a2657cfd33) [LM: BSC#1139926] Signed-off-by: Lin Ma <lma@suse.com> --- block/qcow2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 735d7945d5615426ed92579ed930..2f23cd1283ccabc38185dc360d79 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3112,6 +3112,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, uint64_t old_length; int64_t new_l1_size; int ret; + QDict *options; if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA && prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL) @@ -3326,6 +3327,8 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, } } + bs->total_sectors = offset / BDRV_SECTOR_SIZE; + /* write updated header.size */ offset = cpu_to_be64(offset); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), @@ -3336,6 +3339,15 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + + /* Update cache sizes */ + options = qdict_clone_shallow(bs->options); + ret = qcow2_update_options(bs, options, s->flags, errp); + QDECREF(options); + if (ret < 0) { + error_setg_errno(errp, -ret, "Failed to update the cache size"); + return ret; + } return 0; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor