[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/16] vvfat: Fix size of temporary qcow file
From: |
Kevin Wolf |
Subject: |
[PULL 11/16] vvfat: Fix size of temporary qcow file |
Date: |
Fri, 14 Jan 2022 14:52:21 +0100 |
The size of the qcow size was calculated so that only the FAT partition
would fit on it, but not the whole disk. However, offsets relative to
the whole disk are used to access it, so increase its size to be large
enough for that.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20211209151815.23495-1-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vvfat.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 5dacc6cfac..36e73d4c64 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1230,6 +1230,7 @@ static int vvfat_open(BlockDriverState *bs, QDict
*options, int flags,
dirname, cyls, heads, secs));
s->sector_count = cyls * heads * secs - s->offset_to_bootsector;
+ bs->total_sectors = cyls * heads * secs;
if (qemu_opt_get_bool(opts, "rw", false)) {
if (!bdrv_is_read_only(bs)) {
@@ -1250,8 +1251,6 @@ static int vvfat_open(BlockDriverState *bs, QDict
*options, int flags,
}
}
- bs->total_sectors = cyls * heads * secs;
-
if (init_directories(s, dirname, heads, secs, errp)) {
ret = -EIO;
goto fail;
@@ -3147,8 +3146,8 @@ static int enable_write_target(BlockDriverState *bs,
Error **errp)
}
opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512,
- &error_abort);
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE,
+ bs->total_sectors * BDRV_SECTOR_SIZE, &error_abort);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:", &error_abort);
ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp);
--
2.31.1
- [PULL 01/16] block_int: make bdrv_backing_overridden static, (continued)
- [PULL 01/16] block_int: make bdrv_backing_overridden static, Kevin Wolf, 2022/01/14
- [PULL 04/16] softmmu: fix device deletion events with -device JSON syntax, Kevin Wolf, 2022/01/14
- [PULL 03/16] include/sysemu/blockdev.h: remove drive_get_max_devs, Kevin Wolf, 2022/01/14
- [PULL 06/16] qemu-storage-daemon: Add vhost-user-blk help, Kevin Wolf, 2022/01/14
- [PULL 05/16] docs: Correct 'vhost-user-blk' spelling, Kevin Wolf, 2022/01/14
- [PULL 08/16] block-backend: prevent dangling BDS pointers across aio_poll(), Kevin Wolf, 2022/01/14
- [PULL 07/16] qapi/block: Restrict vhost-user-blk to CONFIG_VHOST_USER_BLK_SERVER, Kevin Wolf, 2022/01/14
- [PULL 10/16] iotests/308: Fix for CAP_DAC_OVERRIDE, Kevin Wolf, 2022/01/14
- [PULL 12/16] vvfat: Fix vvfat_write() for writes before the root directory, Kevin Wolf, 2022/01/14
- [PULL 11/16] vvfat: Fix size of temporary qcow file,
Kevin Wolf <=
- [PULL 16/16] iotests/testrunner.py: refactor test_field_width, Kevin Wolf, 2022/01/14
- [PULL 09/16] iotests/stream-error-on-reset: New test, Kevin Wolf, 2022/01/14
- [PULL 15/16] block: drop BLK_PERM_GRAPH_MOD, Kevin Wolf, 2022/01/14
- [PULL 13/16] iotests: Test qemu-img convert of zeroed data cluster, Kevin Wolf, 2022/01/14
- [PULL 14/16] qemu-img: make is_allocated_sectors() more efficient, Kevin Wolf, 2022/01/14
- Re: [PULL 00/16] Block layer patches, Peter Maydell, 2022/01/15