From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfHLb-00059D-Ep for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:31:35 -0500 Received: from [199.232.76.173] (port=49492 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfHLa-00058z-Eb for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:31:34 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfHLY-00017C-5H for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:31:34 -0500 Received: from mail-iw0-f194.google.com ([209.85.223.194]:46951) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfHLX-000178-SN for qemu-devel@nongnu.org; Wed, 10 Feb 2010 13:31:32 -0500 Received: by iwn32 with SMTP id 32so527339iwn.14 for ; Wed, 10 Feb 2010 10:31:31 -0800 (PST) Message-ID: <4B72FB80.7050505@codemonkey.ws> Date: Wed, 10 Feb 2010 12:31:28 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] block: saner flags filtering in bdrv_open2 References: <20100128141912.GA3454@lst.de> In-Reply-To: <20100128141912.GA3454@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org 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 > 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); > > > >