From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46772 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzrQG-0000Bk-MA for qemu-devel@nongnu.org; Wed, 16 Mar 2011 10:10:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzrQF-0001wo-KG for qemu-devel@nongnu.org; Wed, 16 Mar 2011 10:10:00 -0400 Received: from verein.lst.de ([213.95.11.211]:49330 helo=newverein.lst.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzrQF-0001wk-BL for qemu-devel@nongnu.org; Wed, 16 Mar 2011 10:09:59 -0400 Date: Wed, 16 Mar 2011 15:09:58 +0100 From: Christoph Hellwig Message-ID: <20110316140958.GB21877@lst.de> References: <20110315141049.GA30627@lst.de> <20110315141644.GA30803@lst.de> <87y64fhfjw.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y64fhfjw.fsf@rustcorp.com.au> Subject: [Qemu-devel] Re: [PATCH, RFC] virtio_blk: add cache control support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rusty Russell Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, prerna@linux.vnet.ibm.com, Christoph Hellwig On Wed, Mar 16, 2011 at 02:39:39PM +1030, Rusty Russell wrote: > > + if (strncmp(buf, "write through", sizeof("write through") - 1) == 0) { > > + ; > > + } else if (strncmp(buf, "write back", sizeof("write back") - 1) == 0) { > > Is there a reason we're not letting gcc and/or strcmp do the > optimization work here? I'm happ to switch strcmp. > > + vdev->config->set(vdev, offsetof(struct virtio_blk_config, features), > > + &features, sizeof(features)); > > + > > + vdev->config->get(vdev, offsetof(struct virtio_blk_config, features), > > + &features2, sizeof(features2)); > > + > > + if ((features & VIRTIO_BLK_RT_WCE) != > > + (features2 & VIRTIO_BLK_RT_WCE)) > > + return -EIO; > > This seems like a debugging check you left in. Or do you suspect > some issues? No, it's intentional. config space writes can't return errors, so we need to check that the value has really changed. I'll add a comment explaining it.