block/qcow2: Use bdrv_truncate for size amend
PATCH 1/1 block/qcow2: Use bdrv_truncate for size amend
When amending the size option for a qcow2 image, use bdrv_truncate instead of qcow2_truncate directly, since the latter will not adjust the total_sectors count in the BDS structure (whereas the former will).
---
Depends on (follow-up to):
- block/qcow2: Image file option amendment (series, v5)
--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/qcow2.c +1 -1
@@ -1997,7 +1997,7 @@ static int qcow2_amend_options(BlockDriverState *bs, }if (new_size) { - ret =qcow2_truncate (bs, new_size); + ret =bdrv_truncate (bs, new_size);if (ret <0 ) {return ret; }
Signature · 1 line
1.8.3.1
Quoted 17 lines · Max Reitz
When amending the size option for a qcow2 image, use
bdrv_truncateinstead ofqcow2_truncatedirectly, since the latter will not adjust thetotal_sectorscount in the BDS structure (whereas the former will).Signed-off-by Max Reitz <[email protected]>---
Depends on (follow-up to):
- block/qcow2: Image file option amendment (series, v5)--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/qcow2.c +0
-0
block/qcow2.c static int qcow2_amend_options(BlockDriverState *bs, · line 2003
Quoted 8 lines
block/qcow2.c +1
-1@@ -1997,7 +1997,7 @@ static int qcow2_amend_options(BlockDriverState *bs, }if (new_size) { - ret =qcow2_truncate (bs, new_size); + ret =bdrv_truncate (bs, new_size);if (ret <0 ) {return ret; }
It seems this patch was already squashed into 9296b3ed7050cc6e0645fbc3b0aea74406d7eeb2 ("qcow2: Implement bdrv_amend_options").
Quoted 20 lines · Stefan Hajnoczi
Quoted 19 lines · Max Reitz
When amending the size option for a qcow2 image, use
bdrv_truncateinstead ofqcow2_truncatedirectly, since the latter will not adjust thetotal_sectorscount in the BDS structure (whereas the former will).Signed-off-by Max Reitz <[email protected]>---
Depends on (follow-up to):
- block/qcow2: Image file option amendment (series, v5)--- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/qcow2.c +0
-0@@ -1997,7 +1997,7 @@ static int qcow2_amend_options(BlockDriverState *bs, }
Quoted 9 lines
block/qcow2.c static int qcow2_amend_options(BlockDriverState *bs, · line 2003
Quoted 6 lines
block/qcow2.c +1
-1if (new_size) { - ret =qcow2_truncate (bs, new_size); + ret =bdrv_truncate (bs, new_size);if (ret <0 ) {return ret; }It seems this patch was already squashed into
9296b3ed7050cc6e0645fbc3b0aea74406d7eeb2("qcow2: Implementbdrv_amend_options").
Yes, as Kevin stated in his reply to that series:
Quoted 4 lines
Thanks, applied to the block branch with the following changes:
- Updated patch 5 with
[PATCH] block/qcow2: Usebdrv_truncatefor size amend
Max