All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize
Date: Fri, 14 Jan 2011 15:06:11 -0600	[thread overview]
Message-ID: <20110114210611.GI6249@us.ibm.com> (raw)
In-Reply-To: <20110114162104.GB19184@lst.de>

* Christoph Hellwig <hch@lst.de> [2011-01-14 10:27]:
> Add a new size_changed flag in the BlockDriverState and call the
> change_cb callback to notify drivers about a size change.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c	2011-01-14 17:05:49.527003363 +0100
> +++ qemu/block.c	2011-01-14 17:07:23.206255143 +0100
> @@ -1135,6 +1135,10 @@ int bdrv_truncate(BlockDriverState *bs,
>      ret = drv->bdrv_truncate(bs, offset);
>      if (ret == 0) {
>          ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
> +        if (bs->change_cb) {
> +            bs->size_changed = 1;
> +            bs->change_cb(bs->change_opaque);
> +        }

Do we want to check to ensure the size_changed flag isn't set before
doing a second resize event?  I'm wondering if the truncate takes
$longtime and user gets impatient and issues a second resize command.
How should we respond?  Ignore it?  queue it up? 

Is there any other path that invokes bdrv_truncate?  If so, do we want
invoke the call back in those scenarios or only if the truncate is
initiated from the monitor invocation?

>      }
>      return ret;
>  }
> Index: qemu/block_int.h
> ===================================================================
> --- qemu.orig/block_int.h	2011-01-14 17:05:49.537004411 +0100
> +++ qemu/block_int.h	2011-01-14 17:06:02.539004271 +0100
> @@ -167,6 +167,7 @@ struct BlockDriverState {
>      char backing_format[16]; /* if non-zero and backing_file exists */
>      int is_temporary;
>      int media_changed;
> +    int size_changed;
> 
>      BlockDriverState *backing_hd;
>      BlockDriverState *file;

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh@us.ibm.com

  reply	other threads:[~2011-01-14 21:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 16:20 [Qemu-devel] [PATCH 0/3] allow online resizing of block devices Christoph Hellwig
2011-01-14 16:20 ` [Qemu-devel] [PATCH 1/3] block: add resize monitor command Christoph Hellwig
2011-01-17 11:28   ` Stefan Hajnoczi
2011-01-17 15:59     ` Christoph Hellwig
2011-01-17 17:36   ` Kevin Wolf
2011-01-18 12:28     ` Christoph Hellwig
2011-01-19 15:35     ` Christoph Hellwig
2011-01-19 15:49       ` Kevin Wolf
2011-01-19 15:52         ` Christoph Hellwig
2011-01-19 16:01           ` Kevin Wolf
2011-01-19 16:31             ` Christoph Hellwig
2011-01-14 16:21 ` [Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize Christoph Hellwig
2011-01-14 21:06   ` Ryan Harper [this message]
2011-01-17  9:14     ` Christoph Hellwig
2011-01-14 16:21 ` [Qemu-devel] [PATCH 3/3] virtio-blk: tell the guest about size changes Christoph Hellwig
2011-01-18 12:35 ` [Qemu-devel] [PATCH 0/3] allow online resizing of block devices Luiz Capitulino
2011-01-18 12:48   ` Christoph Hellwig
2011-01-18 13:17     ` Luiz Capitulino
2011-01-19 17:02 [Qemu-devel] [PATCH 0/3 v2] " Christoph Hellwig
2011-01-19 17:02 ` [Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize Christoph Hellwig
2011-01-20  9:14   ` Stefan Hajnoczi
2011-01-20  9:44     ` Christoph Hellwig
2011-01-21 10:41   ` Kevin Wolf
2011-01-24 12:32 [Qemu-devel] [PATCH 0/3 v3] allow online resizing of block devices Christoph Hellwig
2011-01-24 12:32 ` [Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize Christoph Hellwig

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=20110114210611.GI6249@us.ibm.com \
    --to=ryanh@us.ibm.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.