From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 1/1] tools/hotplug: Scan xenstore once when attaching shared images files Date: Fri, 2 Oct 2015 13:49:24 +0100 Message-ID: <1443790164.11707.89.camel@citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mike Latimer , xen-devel@lists.xen.org Cc: George.Dunlap@eu.citrix.com, wei.liu2@citrix.com, roger.pau@citrix.com, ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Thu, 2015-10-01 at 13:07 -0600, Mike Latimer wrote: > During the attachment of a loopback mounted image file, the mode of all > curent instances of this device already attached to other domains must be > checked. This requires finding all loopback devices pointing to the inode > of the shared image file, and then comparing the major and minor number of > these devices to the major and minor number of every vbd device found in the > xenstore database. > > Prior to this patch, the entire xenstore database is walked for every instance > of every loopback device pointing to the same shared image file. This process > causes the block attachment process to becomes exponentially slower with every > additional attachment of a shared image. > > Rather than scanning all of xenstore for every instance of a shared loopback > device, this patch creates a list of the major and minor numbers from all > matching loopback devices. After generating this list, Xenstore is walked > once, and major and minor numbers from every vbd are checked against the list. > If a match is found, the mode of that vbd is checked for compatibility with > the mode of the device being attached. > > Signed-off-by: Mike Latimer This looks good to me apart from one thing which is that these: [...] > then > - echo 'local' > + echo "local $d" > [...] > then > - echo 'guest' > + echo "guest $d" [...] > then > - echo 'guest' > + echo "guest $d" Are invalidating this comment on the check_sharing function regarding what it returns: # Prints one of # # 'local': the device may not be used because it is mounted in the current # (i.e. the privileged domain) in a way incompatible with the # requested mode; # 'guest': the device may not be used because it already mounted by a guest # in a way incompatible with the requested mode; or # 'ok': the device may be used. Ian.