qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Supriya Kannery <supriyak@linux.vnet.ibm.com>
To: jcody@redhat.com
Cc: Kevin Wolf <kwolf@redhat.com>,
	Shrinidhi Joshi <spjoshi31@gmail.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] [v2 Patch 1/9]block: Framework for reopening image files safely
Date: Tue, 14 Aug 2012 15:54:25 +0530	[thread overview]
Message-ID: <502A2759.4020806@linux.vnet.ibm.com> (raw)
In-Reply-To: <5023B4E2.2020106@redhat.com>

On 08/09/2012 06:32 PM, Jeff Cody wrote:
> On 08/09/2012 05:20 AM, Kevin Wolf wrote:
>> Am 09.08.2012 06:26, schrieb Jeff Cody:
>>> On 07/30/2012 05:34 PM, Supriya Kannery wrote:

>>>> +
>>>> +void bdrv_reopen(BlockDriverState *bs, int bdrv_flags, Error **errp)
>>>> +{
>>>> +    BlockDriver *drv = bs->drv;
>>>> +    int ret = 0;
>>>> +    BDRVReopenState *reopen_state = NULL;
>>>> +
>>>
>>> We should assert if drv is NULL:
>>>
>>>      assert(drv != NULL);
>>>
>>>
>>>> +    /* Quiesce IO for the given block device */
>>>> +    bdrv_drain_all();
>>>> +    ret = bdrv_flush(bs);
>>>> +    if (ret != 0) {
>>>> +        error_set(errp, QERR_IO_ERROR);
>>>> +        return;
>>>> +    }
>>>> +
>>>
>>> We also need to reopen bs->file, so maybe something like this:
>>>
>>>      /* open any file images */
>>>      if (bs->file) {
>>>          bdrv_reopen(bs->file, bdrv_flags, errp);
>>>          if (errp&&  *errp) {
>>>              goto exit;
>>>          }
>>>      }
>>>
>>> This will necessitate making the handlers in the raw.c file just stubs
>>> (I'll respond to that patch as well).
>>
>> Doesn't this break the transactional semantics? I think you should only
>> prepare the bs->file reopen here and commit it when committing this one.
>>
> 
> Yes, it would, so if everything stayed as it is now, that would be the
> right way to do it... but one thing that would be nice (I also mention
> this in my comments on patch 0/9) is that it become transactional for
> multiple BlockDriverStates to be reopened.  That would obviously change
> the interface a bit, so that multiple BDS entries could be queued, but
> then it shouldn't be any different to queue the bs->file as well as the
> bs.
> 
> All prepare() stages would happen on queued items, and only
> progress to commit() if all prepare() stages passed, as you mentioned.

  Yes, will work on to get the transactional semantics applied to bs->file 
reopen as well.

> 
> One other thing, and perhaps this is nit-picking some - but the
> prepare() functions all modify the 'live' structures, after backing them
> up into stashes.  So, on abort, the structures are restored from the
> stashes, and on commit the stashes are discarded.  Conceptually, it
> seems cleaner to this the opposite way - prepare() does it work into
> temporary stashes, and the commit() then copies the data over from the
> stash to the live structure, and abort() would just discard the stashes.
> 
> 
  prepare()/commit() and abort() are from the perspective of new changes 
to be tried on respective block driver state. Once block driver is ready for the
state change, then commit() means we are commiting these new changes to driver
state. Similarly abort() means we are aborting these new changes half way
and getting back to old stashed state. This is the intended logic.

- thanks, Supriya

  reply	other threads:[~2012-08-14 10:24 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 21:34 [Qemu-devel] [v2 Patch 0/9]block: Image file reopen and dynamic host pagecache change Supriya Kannery
2012-07-30 21:34 ` [Qemu-devel] [v2 Patch 1/9]block: Framework for reopening image files safely Supriya Kannery
2012-08-01 15:51   ` Stefan Hajnoczi
2012-08-02 20:19   ` Luiz Capitulino
2012-08-14  8:54     ` Supriya Kannery
2012-08-08 21:13   ` Jeff Cody
2012-08-14  9:21     ` Supriya Kannery
2012-08-09  4:26   ` Jeff Cody
2012-08-09  9:20     ` Kevin Wolf
2012-08-09 13:02       ` Jeff Cody
2012-08-14 10:24         ` Supriya Kannery [this message]
2012-07-30 21:34 ` [Qemu-devel] [v2 Patch 2/9]block: raw-posix image file reopen Supriya Kannery
2012-07-31 17:17   ` Eric Blake
2012-08-01  6:18     ` Kevin Wolf
2012-08-03 22:32     ` Jeff Cody
2012-08-14 10:53     ` Supriya Kannery
2012-08-09  4:26   ` Jeff Cody
2012-08-10 13:45   ` Corey Bryant
2012-08-14 11:13     ` Supriya Kannery
2012-08-14 11:35       ` Kevin Wolf
2012-07-30 21:34 ` [Qemu-devel] [v2 Patch 3/9]block: raw-win32 " Supriya Kannery
2012-07-30 21:35 ` [Qemu-devel] [v2 Patch 4/9]block: vmdk " Supriya Kannery
2012-07-31 17:43   ` Eric Blake
2012-07-30 21:35 ` [Qemu-devel] [v2 Patch 5/9]block: qcow2 " Supriya Kannery
2012-08-09  4:26   ` Jeff Cody
2012-08-09  9:37     ` Kevin Wolf
2012-07-30 21:35 ` [Qemu-devel] [v2 Patch 7/9]block: qed " Supriya Kannery
2012-07-30 21:36 ` [Qemu-devel] [v2 Patch 9/9]block: Enhance "info block" to display host cache setting Supriya Kannery
2012-07-31 17:47   ` Eric Blake
2012-07-31 20:33 ` [Qemu-devel] [v2 Patch 0/9]block: Image file reopen and dynamic host pagecache change Jeff Cody
2012-08-01 17:11   ` Supriya Kannery
2012-08-01 18:36 ` [Qemu-devel] [v2 Patch 6/9]block: qcow image file reopen Supriya Kannery
2012-08-01 18:44 ` [Qemu-devel] [v2 Patch 8/9]block: Cmd "block_set_hostcache" for dynamic cache change Supriya Kannery
2012-08-01 19:21   ` Eric Blake
2012-08-02 20:36   ` Luiz Capitulino
2012-08-31 19:32   ` Jeff Cody
2012-08-09  4:26 ` [Qemu-devel] [v2 Patch 0/9]block: Image file reopen and dynamic host pagecache change Jeff Cody

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=502A2759.4020806@linux.vnet.ibm.com \
    --to=supriyak@linux.vnet.ibm.com \
    --cc=hch@lst.de \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=spjoshi31@gmail.com \
    --cc=stefanha@gmail.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).