From: Stefan Weil <weil@mail.berlios.de>
To: Christoph Hellwig <hch@lst.de>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Add new block driver for the VDI format
Date: Sun, 05 Jul 2009 16:02:29 +0200 [thread overview]
Message-ID: <4A50B275.7030100@mail.berlios.de> (raw)
In-Reply-To: <20090705080523.GA31550@lst.de>
Christoph Hellwig schrieb:
> On Fri, Jul 03, 2009 at 09:29:46PM +0200, Stefan Weil wrote:
>> +/* Enable debug messages. */
>> +//~ #define CONFIG_VDI_DEBUG
>> +
>> +/* Support experimental write operations on VDI images. */
>> +#define CONFIG_VDI_WRITE
>> +
>> +/* Support snapshot images. */
>> +//~ #define CONFIG_VDI_SNAPSHOT
>> +
>> +/* Enable (currently) unsupported features. */
>> +//~ #define CONFIG_VDI_UNSUPPORTED
>> +
>> +/* Support non-standard cluster (block) size. */
>> +//~ #define CONFIG_VDI_CLUSTER_SIZE
>
> I don't think we should keep these defines (except for the debug one)
> around. CONFIG_VDI_UNSUPPORTED adds methods to the method table that
> aren't actually implemented so the code will fail to compile if it's
> set. Similar for CONFIG_VDI_SNAPSHOT except that it implements a single
> useless stub. CONFIG_VDI_CLUSTER_SIZE just adds a harmless option
> so it should just be unconditional, too.
>
> I also don't see a reason for the CONFIG_VDI_WRITE ifdef as it's
> apparently good enough to be enable by default.
>
CONFIG_VDI_UNSUPPORTED and CONFIG_VDI_SNAPSHOT document
code parts which are still missing or unfinished.
For the same reason, they are undefined, so the unfinished
code is deactivated.
CONFIG_VDI_CLUSTER_SIZE is a harmless option but its code
is unfinished, too. For this reason, it is deactivated by
default.
CONFIG_VDI_WRITE is enabled by default. Users who want to disable
writes can use it to do so.
>> +static int vdi_check(BlockDriverState *bs)
>> +{
>> + /* TODO: missing code. */
>> + logout("\n");
>> + return -ENOTSUP;
>> +}
>
> No need to implement this, not having the method gives the same result.
Not having the method would hide the fact that the
method might be implemented.
vdi_check is unfinished code, and there is even a comment
which says that there remains something to do.
>
>> +static int vdi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
>> +{
>> + /* TODO: unchecked code. */
>> + BDRVVdiState *s = (BDRVVdiState *)bs->opaque;
>> + logout("\n");
>> + bdi->cluster_size = s->cluster_size;
>> + bdi->vm_state_offset = -1;
>> + return -ENOTSUP;
>> +}
>
> If you return a negative value the result is ignored, so either at least
> implement a stub one or just leave out the method.
Again this function exists to document an open question.
If someone can say that the function is complete, the TODO
comment will be removed and it will return zero.
As long as I don't know that it works, it would be dangerous
to return success.
>> +static int vdi_make_empty(BlockDriverState *bs)
>> +{
>> + /* TODO: missing code. */
>> + logout("\n");
>> + return -ENOTSUP;
>> +}
>
> Again, no need to implement an empty method here.
There is the same need for this function like for vdi_check:
the function is just a hook to implement more code.
>
>> + /* Performance is terrible right now with cache=writethrough due mainly
>> + * to reference count updates. If the user does not explicitly specify
>> + * a caching type, force to writeback caching.
>> + * TODO: This was copied from qcow2.c, maybe it is true for vdi, too.
>> + */
>> + if ((flags & BDRV_O_CACHE_DEF)) {
>> + flags |= BDRV_O_CACHE_WB;
>> + flags &= ~BDRV_O_CACHE_DEF;
>> + }
>
> And it looks like we're going to change it for qcow2, too..
Therefore it was marked with a TODO comment.
To summarize my answer: the code is complete enough to be useful
(create / read / write are implemented). It can be further extended
and optimized, and therefore there are TODO comments and code parts
which show those incomplete or missing parts.
I am glad you had no real objections, so I hope the patches can soon
be commited.
By the way - is it possible to check new block drivers like this one
using qemu-io (can I use an existing test sequence)?
Regards,
Stefan
next prev parent reply other threads:[~2009-07-05 14:02 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 19:24 [Qemu-devel] [PATCH] RFC: Add new block driver for the VDI format Stefan Weil
2009-07-03 19:29 ` [Qemu-devel] [PATCH] Check availability of uuid header / lib Stefan Weil
2009-07-03 19:29 ` [Qemu-devel] [PATCH] Add new block driver for the VDI format Stefan Weil
2009-07-05 8:05 ` Christoph Hellwig
2009-07-05 14:02 ` Stefan Weil [this message]
2009-07-06 10:25 ` Christoph Hellwig
2009-07-06 17:19 ` Stefan Weil
2009-07-05 14:44 ` Kevin Wolf
2009-07-06 13:37 ` [Qemu-devel] [PATCH] RFC: " Anthony Liguori
2009-07-06 21:10 ` Stefan Weil
2009-07-06 21:28 ` Anthony Liguori
2009-07-07 7:55 ` Kevin Wolf
2009-07-07 9:04 ` Jamie Lokier
2009-07-07 10:30 ` Christoph Hellwig
2009-07-07 10:33 ` Kevin Wolf
2009-08-02 14:27 ` Avi Kivity
2009-08-03 2:25 ` Anthony Liguori
2009-08-03 13:02 ` Avi Kivity
2009-08-03 15:20 ` Christoph Hellwig
2009-07-23 15:58 ` [Qemu-devel] [PATCH] RFC: Add new block driver for the VDI format (aio version) Stefan Weil
2009-07-23 20:27 ` [Qemu-devel] [PATCH] Check availability of uuid header / lib Stefan Weil
2009-07-24 6:32 ` Christoph Egger
2009-10-01 18:13 ` Stefan Weil
2009-10-02 8:32 ` Christoph Egger
2009-10-01 18:10 ` [Qemu-devel] [PATCH] Check availability of uuid header / library Stefan Weil
2009-07-23 20:29 ` [Qemu-devel] [PATCH] Add new block driver for the VDI format (use aio) Stefan Weil
2009-07-24 9:18 ` Kevin Wolf
2009-07-24 16:20 ` Stefan Weil
2009-07-27 8:00 ` Kevin Wolf
2009-07-27 9:23 ` Jamie Lokier
2009-07-28 6:37 ` Amit Shah
2009-07-28 8:34 ` Jamie Lokier
2009-07-28 8:56 ` Daniel P. Berrange
2009-07-28 9:03 ` Jamie Lokier
2009-07-28 9:11 ` Kevin Wolf
2009-07-31 15:04 ` Christoph Hellwig
2009-07-31 19:53 ` Stefan Weil
2009-07-31 15:25 ` Anthony Liguori
2009-07-31 18:27 ` Stefan Weil
2009-07-31 19:45 ` [Qemu-devel] [PATCH] Add new block driver for the VDI format (only aio supported) Stefan Weil
2009-07-23 20:30 ` [Qemu-devel] [PATCH] add support for new option of vdi format Stefan Weil
2009-07-23 20:34 ` [Qemu-devel] " Stefan Weil
2009-07-31 14:59 ` [Qemu-devel] " Christoph Hellwig
2009-08-13 16:53 ` 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=4A50B275.7030100@mail.berlios.de \
--to=weil@mail.berlios.de \
--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 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).