qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Supriya Kannery <supriyak@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Christoph Hellwig <hch@lst.de>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [RFC Patch 4/7]Qemu: Framework for reopening image files safely
Date: Tue, 14 Feb 2012 19:04:27 +0530	[thread overview]
Message-ID: <4F3A62E3.7030902@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120207100836.GB29427@stefanha-thinkpad.localdomain>

On 02/07/2012 03:38 PM, Stefan Hajnoczi wrote:
> On Wed, Feb 01, 2012 at 08:36:58AM +0530, Supriya Kannery wrote:
>> Struct BDRVReopenState along with three reopen related functions
>> introduced for handling reopening of images safely. This can be
>> extended by each of the block drivers to reopen respective
>> image files.
>>

>> +int bdrv_reopen_prepare(BlockDriverState *bs, BDRVReopenState **prs, int flags)
>> +{
>> +     BlockDriver *drv = bs->drv;
>> +
>> +     return drv->bdrv_reopen_prepare(bs, prs, flags);
>
> Indentation should be 4 spaces.  I suggest configuring your editor so
> this is always correct and done automatically.
>

ok

>> -    ret = bdrv_open(bs, bs->filename, bdrv_flags, drv);
>> -    if (ret<  0) {
>> -        /* Reopen failed. Try to open with original flags */
>> -        qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
>> -        ret = bdrv_open(bs, bs->filename, open_flags, drv);
>> +    /* Use driver specific reopen() if available */
>> +    if (drv->bdrv_reopen_prepare) {
>> +        ret = bdrv_reopen_prepare(bs,&reopen_state, bdrv_flags);
>> +         if (ret<  0) {
>
> Indentation
>
>> +            bdrv_reopen_abort(bs, reopen_state);
>> +            qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
>> +            return ret;
>> +        }
>> +
>> +        bdrv_reopen_commit(bs, reopen_state);
>> +        bs->open_flags = bdrv_flags;
>
> Is bs->open_flags not assigned inside bdrv_reopen_*()?
>

No, Since it is generic for all the drivers, placed it here.

>> +
>> +    } else {
>> +       open_flags = bs->open_flags;
>> +       bdrv_close(bs);
>> +
>> +       ret = bdrv_open(bs, bs->filename, bdrv_flags, drv);
>>           if (ret<  0) {
>> -            /* Reopen failed with orig and modified flags */
>> -            abort();
>> +            /* Reopen failed. Try to open with original flags */
>> +            qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
>> +            ret = bdrv_open(bs, bs->filename, open_flags, drv);
>> +            if (ret<  0) {
>> +                /* Reopen failed with orig and modified flags */
>> +                bs->drv = NULL;
>
> This should be a post-condition of bdrv_open().  If you have found a
> case where bs->drv != NULL after bdrv_open() fails, then please fix that
> code path instead of assigning NULL here.
>

ok, will check on this

-thanks for reviewing, Supriya

  reply	other threads:[~2012-02-14 13:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01  3:05 [Qemu-devel] [RFC Patch 0/7]Qemu: Dynamic host pagecache change Supriya Kannery
2012-02-01  3:06 ` [Qemu-devel] [RFC Patch 1/7]Qemu: Enhance "info block" to display host cache setting Supriya Kannery
2012-02-08 12:00   ` Luiz Capitulino
2012-02-13 13:19     ` Supriya Kannery
2012-02-01  3:06 ` [Qemu-devel] [RFC Patch 2/7]Qemu: Error classes for file reopen and data sync failure Supriya Kannery
2012-02-07  7:56   ` Stefan Hajnoczi
2012-02-13 13:13     ` Supriya Kannery
2012-02-01  3:06 ` [Qemu-devel] [RFC Patch 3/7]Qemu: Cmd "block_set_hostcache" for dynamic cache change Supriya Kannery
2012-02-02  0:09   ` Michael Roth
2012-02-02 10:14     ` Kevin Wolf
2012-02-08 12:07   ` Luiz Capitulino
2012-02-13 13:21     ` Supriya Kannery
2012-02-01  3:06 ` [Qemu-devel] [RFC Patch 4/7]Qemu: Framework for reopening image files safely Supriya Kannery
2012-02-07 10:08   ` Stefan Hajnoczi
2012-02-14 13:34     ` Supriya Kannery [this message]
2012-02-08 15:07   ` Kevin Wolf
2012-02-13 13:49     ` Supriya Kannery
2012-02-01  3:07 ` [Qemu-devel] [RFC Patch 5/7]Qemu: raw-posix image file reopen Supriya Kannery
2012-02-02  0:15   ` Michael Roth
2012-02-13 13:12     ` Supriya Kannery
2012-02-07 10:17   ` Stefan Hajnoczi
2012-02-14 13:36     ` Supriya Kannery
2012-02-08 14:54   ` Kevin Wolf
2012-02-13 13:28     ` Supriya Kannery
2012-02-01  3:07 ` [Qemu-devel] [RFC Patch 6/7]Qemu: raw-win32 " Supriya Kannery
2012-02-08 15:02   ` Kevin Wolf
2012-02-13 13:29     ` Supriya Kannery
2012-02-01  3:07 ` [Qemu-devel] [RFC Patch 7/7]Qemu: vmdk " Supriya Kannery
2012-02-01 22:41 ` [Qemu-devel] [RFC Patch 0/7]Qemu: Dynamic host pagecache change Eric Blake
2012-02-02  9:12   ` Kevin Wolf

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=4F3A62E3.7030902@linux.vnet.ibm.com \
    --to=supriyak@linux.vnet.ibm.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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).