qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] raw: Fix BlockLimits passthrough
Date: Tue, 04 Feb 2014 12:29:16 +0100	[thread overview]
Message-ID: <52F0CF0C.2020304@redhat.com> (raw)
In-Reply-To: <1391511710-12723-1-git-send-email-kwolf@redhat.com>

On 02/04/14 12:01, Kevin Wolf wrote:
> raw copies over the BlockLimits of bs->file during bdrv_open().
> However, since commit d34682cd it is immediately overwritten during
> bdrv_refresh_limits(). This caused all fields except for
> opt_transfer_length and opt_mem_alignment (which happen to be correctly
> inherited in generic code) to be zeroed.
> 
> Move the BlockLimit assignment to a .bdrv_refresh_limits() callback to
> make it work again for all fields.
> 
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/raw_bsd.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/block/raw_bsd.c b/block/raw_bsd.c
> index 978ae7a..af8706d 100644
> --- a/block/raw_bsd.c
> +++ b/block/raw_bsd.c
> @@ -90,6 +90,12 @@ static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
>      return bdrv_get_info(bs->file, bdi);
>  }
>  
> +static int raw_refresh_limits(BlockDriverState *bs)
> +{
> +    bs->bl = bs->file->bl;
> +    return 0;
> +}
> +
>  static int raw_truncate(BlockDriverState *bs, int64_t offset)
>  {
>      return bdrv_truncate(bs->file, offset);
> @@ -150,7 +156,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
>                      Error **errp)
>  {
>      bs->sg = bs->file->sg;
> -    bs->bl = bs->file->bl;
>      return 0;
>  }
>  
> @@ -182,6 +187,7 @@ static BlockDriver bdrv_raw = {
>      .bdrv_getlength       = &raw_getlength,
>      .has_variable_length  = true,
>      .bdrv_get_info        = &raw_get_info,
> +    .bdrv_refresh_limits  = &raw_refresh_limits,
>      .bdrv_is_inserted     = &raw_is_inserted,
>      .bdrv_media_changed   = &raw_media_changed,
>      .bdrv_eject           = &raw_eject,
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

      reply	other threads:[~2014-02-04 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04 11:01 [Qemu-devel] [PATCH] raw: Fix BlockLimits passthrough Kevin Wolf
2014-02-04 11:29 ` Laszlo Ersek [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=52F0CF0C.2020304@redhat.com \
    --to=lersek@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pl@kamp.de \
    --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).