[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block/raw-posix: use seek_hole ahead of fiemap
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] block/raw-posix: use seek_hole ahead of fiemap |
Date: |
Thu, 25 Sep 2014 08:21:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Please copy Kevin & Stefan for block patches. Doing that for you. I
also copy Max, who left his fingerprints on commit 4f11aa8.
Tony Breeds <address@hidden> writes:
> The command
> qemu-img convert -O raw inputimage.qcow2 outputimage.raw
>
> intermittently creates corrupted output images, when the input image is not
> yet fully synchronized to disk. This patch preferese the use of seek_hole
> checks to determine if the sector is present in the disk image.
>
> While we're there modify try_fiemap() to set FIEMAP_FLAG_SYNC.
>
> Reported-By: Michael Steffens <address@hidden>
> CC: Pádraig Brady <address@hidden>
> Signed-off-by: Tony Breeds <address@hidden>
> ---
> block/raw-posix.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index a253697..b438c54 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -1472,7 +1472,7 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t
> start, off_t *data,
>
> f.fm.fm_start = start;
> f.fm.fm_length = (int64_t)nb_sectors * BDRV_SECTOR_SIZE;
> - f.fm.fm_flags = 0;
> + f.fm.fm_flags = FIEMAP_FLAG_SYNC;
> f.fm.fm_extent_count = 1;
> f.fm.fm_reserved = 0;
> if (ioctl(s->fd, FS_IOC_FIEMAP, &f) == -1) {
> @@ -1561,9 +1561,9 @@ static int64_t coroutine_fn
> raw_co_get_block_status(BlockDriverState *bs,
>
> start = sector_num * BDRV_SECTOR_SIZE;
>
> - ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
> + ret = try_seek_hole(bs, start, &data, &hole, pnum);
> if (ret < 0) {
> - ret = try_seek_hole(bs, start, &data, &hole, pnum);
> + ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
> if (ret < 0) {
> /* Assume everything is allocated. */
> data = 0;
Re: [Qemu-devel] [PATCH] block/raw-posix: use seek_hole ahead of fiemap, Eric Blake, 2014/09/25