From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEJxn-0005rj-Vo for qemu-devel@nongnu.org; Fri, 14 Feb 2014 09:42:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEJxi-0007qF-0S for qemu-devel@nongnu.org; Fri, 14 Feb 2014 09:41:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEJxh-0007pV-Ob for qemu-devel@nongnu.org; Fri, 14 Feb 2014 09:41:53 -0500 Date: Fri, 14 Feb 2014 09:41:46 -0500 From: Jeff Cody Message-ID: <20140214144146.GF10167@localhost.localdomain> References: <925f4c0a62291c070991d1b3e75a770de986a686.1391541706.git.jcody@redhat.com> <20140214142128.GF17391@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140214142128.GF17391@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] block: gluster - code movements, state storage changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, bharata@linux.vnet.ibm.com On Fri, Feb 14, 2014 at 03:21:28PM +0100, Stefan Hajnoczi wrote: > On Tue, Feb 04, 2014 at 02:26:58PM -0500, Jeff Cody wrote: > > @@ -291,23 +311,17 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, > > > > filename = qemu_opt_get(opts, "filename"); > > > > + s->filename = g_strdup(filename); > > It's not obvious to me that copying the filename is necessary. > block/raw-posix.c does this: > > raw_s->fd = qemu_open(state->bs->filename, raw_s->open_flags); > > Why didn't you use bs->filename? > Back when the raw-posix reopen was implemented, the .bdrv_file_open used the char * filename instead of options parameters. Now that the filename is explicitly parsed via the options, I thought it made logical sense to cache the filename into the protocol state variable, for later use by reopen. That way if the bs->filename was changed in some manner, the protocol would have the variable as originally intended to be passed to the .bdrv_file_open() method. In reality, I should be able to just use bs->filename instead, as it does not get modified; this just seemed to make a bit more sense.