qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Fam Zheng <famz@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block: Round up total_sectors
Date: Wed, 6 Nov 2013 14:08:39 +0100	[thread overview]
Message-ID: <20131106130839.GB2981@irqsave.net> (raw)
In-Reply-To: <1383738486-21045-1-git-send-email-famz@redhat.com>

Le Wednesday 06 Nov 2013 à 19:48:06 (+0800), Fam Zheng a écrit :
> Since b94a2610, bdrv_getlength() is omitted when probing image. VMDK
> monolithicFlat is broken by that because a file < 512 bytes can't be
> read with its total_sectors truncated to 0. This patch round up the size
> to BDRV_SECTOR_SIZE, when a image size is not sector aligned.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block.c b/block.c
> index 58efb5b..f706634 100644
> --- a/block.c
> +++ b/block.c
> @@ -640,7 +640,7 @@ static int refresh_total_sectors(BlockDriverState *bs, int64_t hint)
>          if (length < 0) {
>              return length;
>          }
> -        hint = length >> BDRV_SECTOR_BITS;
> +        hint = DIV_ROUND_UP(length, BDRV_SECTOR_SIZE);
>      }
>  
>      bs->total_sectors = hint;
> -- 
> 1.8.3.1
> 
> 

Reviewed-by: Benoit Canet <benoit@irqsave.net>

      reply	other threads:[~2013-11-06 13:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 11:48 [Qemu-devel] [PATCH] block: Round up total_sectors Fam Zheng
2013-11-06 13:08 ` Benoît Canet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131106130839.GB2981@irqsave.net \
    --to=benoit.canet@irqsave.net \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).