[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 6/7] sheepdog: Pass old and new siz

From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 6/7] sheepdog: Pass old and new size to sd_prealloc()
Date: Tue, 13 Feb 2018 09:04:12 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 02/13/2018 07:03 AM, Max Reitz wrote:
sd_prealloc() will now preallocate the area [old_size, new_size).  As
before, it rounds to buf_size and may thus overshoot and preallocate
areas that were not requested to be preallocated.  For image creation,
this is no change in behavior.  For truncation, this is in accordance
with the documentation for preallocated truncation.

Signed-off-by: Max Reitz <address@hidden>
  block/sheepdog.c | 16 +++++-----------
  1 file changed, 5 insertions(+), 11 deletions(-)

@@ -1847,19 +1847,13 @@ static int sd_prealloc(BlockDriverState *bs, Error 
blk_set_allow_write_beyond_eof(blk, true); - vdi_size = blk_getlength(blk);
-    if (vdi_size < 0) {
-        ret = vdi_size;
-        goto out;
-    }

@@ -2119,7 +2113,7 @@ static int sd_create(const char *filename, QemuOpts *opts,
              goto out;
- ret = sd_prealloc(bs, errp);
+        ret = sd_prealloc(bs, 0, s->inode.vdi_size, errp);

Nice - you also got rid of a potential failure in blk_getlength().

Reviewed-by: Eric Blake <address@hidden>

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]