From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEKqE-0005gj-Lx for qemu-devel@nongnu.org; Fri, 14 Feb 2014 10:38:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEKq8-00023S-Lb for qemu-devel@nongnu.org; Fri, 14 Feb 2014 10:38:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEKq8-00023O-CQ for qemu-devel@nongnu.org; Fri, 14 Feb 2014 10:38:08 -0500 Date: Fri, 14 Feb 2014 16:38:03 +0100 From: Stefan Hajnoczi Message-ID: <20140214153802.GA23572@stefanha-thinkpad.redhat.com> References: <925f4c0a62291c070991d1b3e75a770de986a686.1391541706.git.jcody@redhat.com> <20140214142128.GF17391@stefanha-thinkpad.redhat.com> <20140214144146.GF10167@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140214144146.GF10167@localhost.localdomain> 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: Jeff Cody Cc: kwolf@redhat.com, Stefan Hajnoczi , qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com On Fri, Feb 14, 2014 at 09:41:46AM -0500, Jeff Cody wrote: > 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. I thought about driver-specific options that are not part of 'filename', too. IMO it's simpler to use bs->filename until we actually use driver-specific options, and then switch over to using bs->options instead of copying.