All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Supriya Kannery <supriyak@in.ibm.com>
Cc: qemu-devel@nongnu.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] [V2 3/3] Command "block_set" for dynamic block params change
Date: Mon, 27 Jun 2011 10:18:53 +0200	[thread overview]
Message-ID: <4E083CED.5030106@redhat.com> (raw)
In-Reply-To: <4E0213A8.2030303@in.ibm.com>

Am 22.06.2011 18:09, schrieb Supriya Kannery:
> On 06/20/2011 08:04 PM, Kevin Wolf wrote:
>> Am 17.06.2011 18:38, schrieb Supriya Kannery:
> 
>>> +		if (bdrv_is_inserted(bs)) {
>>> +			/* cache change applicable only if device inserted */
>>> +			return bdrv_change_hostcache(bs, enable);
>>> +		} else {
>>> +			qerror_report(QERR_DEVICE_NOT_INSERTED, device);
>>> +			return -1;
>>> +		}
>>
>> I'm not so sure about this one. Why shouldn't I change the cache mode
>> for a device which is currently? The next thing I want to do could be
>> inserting a medium and using it with the new cache mode.
> 
> Uninserted device has no file to be re-opened. So such a check was used 
> to avoid calling bdrv_reopen without a filename.
> 
> I agree with your point. Hostcache value change is applicable
> for devices that are not inserted as well. If device is inserted,
> request for hostcache setting change can lead to change in open_flags 
> and then reopen of file. Otherwise, the request can result in just 
> open_flags updation, which can be used for opening a file when
> a device gets inserted.
> 
> Will make the above modification in V3
> 
>>
>>> +int bdrv_reopen(BlockDriverState *bs, int bdrv_flags)
>>> +{
>>> +	BlockDriver *drv = bs->drv;
>>> +	int ret = 0;
>>> +
>>> +	/* No need to reopen as no change in flags */
>>> +	if (bdrv_flags == bs->open_flags)
>>> +		return 0;
>>
>> There could be other reasons for reopening besides changing flags, e.g.
>> invalidating cached metadata.
>>
>>> +
>>> +	/* Quiesce IO for the given block device */
>>> +	qemu_aio_flush();
>>> +	bdrv_flush(bs);
>>
>> Missing error handling.
>>
> 
> will add in V3
> 
> 
>>> +	ret = bdrv_open(bs, bs->filename, bdrv_flags, drv);
>>> +
>>> +	/*
>>> +	* A failed attempt to reopen the image file must lead to 'abort()'
>>> +	*/
>>> +	if (ret != 0) {
>>> +		qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
>>> +		abort();
>>> +	}
>>
>> Maybe we can retry with the old flags at least before aborting?
>>
>> Also I would like to see a (Linux specific) version that uses the old fd
>> for the reopen, so that we can handle files that aren't accessible with
>> their old name any more. This would mean adding a .bdrv_reopen callback
>> in raw-posix.
>>
> 
> Will work on to implement version of re-open using fd. Since for 
> block_set command processing, re-open using filename already works, is
> it ok to have the 're-open using fd' done as a separate patchset ?

Sure, it's just an obvious improvement.

>>> +	/* Reopen file with changed set of flags */
>>> +	return bdrv_reopen(bs, bdrv_flags);
>>> +}
>>
>> Hm, interesting. Now we can get a O_DIRECT | O_SYNC mode with the
>> monitor. We should probably expose the same functionality for the
>> command line, too.
>>
> 
> hostcache is indirectly set/reset from qemu commandline, using "cache="
> (none/writeback/writethrough/unsafe) option. So should we be having 
> "hostcache=xx" option added to -drive  in addition to "cache=" ?

I think that's the right thing to do in the long run. Christoph?

Kevin

      reply	other threads:[~2011-06-27  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 16:37 [Qemu-devel] [V3 0/3]block: Dynamically change hostcache setting using new "block_set" command Supriya Kannery
2011-06-17 16:37 ` [Qemu-devel] [V3 1/3] Enhance "info block" to display hostcache setting Supriya Kannery
2011-06-20 14:23   ` Kevin Wolf
2011-06-22 14:59     ` Supriya Kannery
2011-06-17 16:37 ` [Qemu-devel] [V3 2/3] Error classes for file reopen and device insertion Supriya Kannery
2011-06-20 14:23   ` Kevin Wolf
2011-06-17 16:38 ` [Qemu-devel] [V2 3/3] Command "block_set" for dynamic block params change Supriya Kannery
2011-06-17 17:23   ` [Qemu-devel] [V2 3/3] <Resend> " Supriya Kannery
2011-06-20 14:34   ` [Qemu-devel] [V2 3/3] " Kevin Wolf
2011-06-22 16:09     ` Supriya Kannery
2011-06-27  8:18       ` Kevin Wolf [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=4E083CED.5030106@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    --cc=supriyak@in.ibm.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 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.