* [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2
@ 2010-01-28 14:19 Christoph Hellwig
2010-02-10 12:12 ` Christoph Hellwig
2010-02-10 18:31 ` Anthony Liguori
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2010-01-28 14:19 UTC (permalink / raw)
To: qemu-devel
Clean up the current mess about figuring out which flags to pass to the
driver. BDRV_O_FILE, BDRV_O_SNAPSHOT and BDRV_O_NO_BACKING are flags
only used by the block layer internally so filter them out directly.
Previously BDRV_O_NO_BACKING could accidentally be passed to the drivers,
but wasn't ever used.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu/block.c
===================================================================
--- qemu.orig/block.c 2010-01-28 15:12:52.316024386 +0100
+++ qemu/block.c 2010-01-28 15:13:33.419004083 +0100
@@ -451,13 +451,20 @@ int bdrv_open2(BlockDriverState *bs, con
bs->enable_write_cache = 1;
bs->read_only = (flags & BDRV_O_RDWR) == 0;
- if (!(flags & BDRV_O_FILE)) {
- open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO));
- if (bs->is_temporary) { /* snapshot should be writeable */
- open_flags |= BDRV_O_RDWR;
- }
- } else {
- open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
+
+ /*
+ * Clear flags that are internal to the block layer before opening the
+ * image.
+ */
+ open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
+
+ /*
+ * Snapshots should be writeable.
+ *
+ * XXX(hch): and what is the point of a snapshot during a read-only open?
+ */
+ if (!(flags & BDRV_O_FILE) && bs->is_temporary) {
+ open_flags |= BDRV_O_RDWR;
}
ret = drv->bdrv_open(bs, filename, open_flags);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2
2010-01-28 14:19 [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2 Christoph Hellwig
@ 2010-02-10 12:12 ` Christoph Hellwig
2010-02-10 18:31 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2010-02-10 12:12 UTC (permalink / raw)
To: qemu-devel
ping?
On Thu, Jan 28, 2010 at 03:19:12PM +0100, Christoph Hellwig wrote:
> Clean up the current mess about figuring out which flags to pass to the
> driver. BDRV_O_FILE, BDRV_O_SNAPSHOT and BDRV_O_NO_BACKING are flags
> only used by the block layer internally so filter them out directly.
> Previously BDRV_O_NO_BACKING could accidentally be passed to the drivers,
> but wasn't ever used.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c 2010-01-28 15:12:52.316024386 +0100
> +++ qemu/block.c 2010-01-28 15:13:33.419004083 +0100
> @@ -451,13 +451,20 @@ int bdrv_open2(BlockDriverState *bs, con
> bs->enable_write_cache = 1;
>
> bs->read_only = (flags & BDRV_O_RDWR) == 0;
> - if (!(flags & BDRV_O_FILE)) {
> - open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO));
> - if (bs->is_temporary) { /* snapshot should be writeable */
> - open_flags |= BDRV_O_RDWR;
> - }
> - } else {
> - open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
> +
> + /*
> + * Clear flags that are internal to the block layer before opening the
> + * image.
> + */
> + open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
> +
> + /*
> + * Snapshots should be writeable.
> + *
> + * XXX(hch): and what is the point of a snapshot during a read-only open?
> + */
> + if (!(flags & BDRV_O_FILE) && bs->is_temporary) {
> + open_flags |= BDRV_O_RDWR;
> }
>
> ret = drv->bdrv_open(bs, filename, open_flags);
>
---end quoted text---
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2
2010-01-28 14:19 [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2 Christoph Hellwig
2010-02-10 12:12 ` Christoph Hellwig
@ 2010-02-10 18:31 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-02-10 18:31 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: qemu-devel
On 01/28/2010 08:19 AM, Christoph Hellwig wrote:
> Clean up the current mess about figuring out which flags to pass to the
> driver. BDRV_O_FILE, BDRV_O_SNAPSHOT and BDRV_O_NO_BACKING are flags
> only used by the block layer internally so filter them out directly.
> Previously BDRV_O_NO_BACKING could accidentally be passed to the drivers,
> but wasn't ever used.
>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
>
Applied. Thanks.
Regards,
Anthony Liguori
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c 2010-01-28 15:12:52.316024386 +0100
> +++ qemu/block.c 2010-01-28 15:13:33.419004083 +0100
> @@ -451,13 +451,20 @@ int bdrv_open2(BlockDriverState *bs, con
> bs->enable_write_cache = 1;
>
> bs->read_only = (flags& BDRV_O_RDWR) == 0;
> - if (!(flags& BDRV_O_FILE)) {
> - open_flags = (flags& (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO));
> - if (bs->is_temporary) { /* snapshot should be writeable */
> - open_flags |= BDRV_O_RDWR;
> - }
> - } else {
> - open_flags = flags& ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
> +
> + /*
> + * Clear flags that are internal to the block layer before opening the
> + * image.
> + */
> + open_flags = flags& ~(BDRV_O_FILE | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
> +
> + /*
> + * Snapshots should be writeable.
> + *
> + * XXX(hch): and what is the point of a snapshot during a read-only open?
> + */
> + if (!(flags& BDRV_O_FILE)&& bs->is_temporary) {
> + open_flags |= BDRV_O_RDWR;
> }
>
> ret = drv->bdrv_open(bs, filename, open_flags);
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-10 18:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-28 14:19 [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2 Christoph Hellwig
2010-02-10 12:12 ` Christoph Hellwig
2010-02-10 18:31 ` Anthony Liguori
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.