From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9c1i-00049j-NP for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9c1Y-0007JL-GG for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:26:18 -0400 Received: from mailin.vu.nl ([130.37.164.17]:43540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9c1Y-0007Iq-8O for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:26:08 -0400 Message-ID: <520B937D.6060105@cs.vu.nl> Date: Wed, 14 Aug 2013 16:26:05 +0200 From: Kaveh Razavi MIME-Version: 1.0 References: <1376413436-5424-1-git-send-email-kaveh@cs.vu.nl> <00D703C3BB04779367573E57@nimrod.local> <520B6D29.10507@cs.vu.nl> <74C74303-33D3-4E60-B999-5F96AEEFEB6F@alex.org.uk> <520B896E.8050704@cs.vu.nl> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Introduce cache images for the QCOW2 format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On 08/14/2013 03:50 PM, Alex Bligh wrote: > Assuming the cache quota is not exhausted, how do you know how that > a VM has finished 'creating' the cache? At any point it might > read a bit more from the backing image. I was assuming on shutdown. > I'm wondering whether you could just use POSIX mandatory locking for > this, i.e. open it exclusive and r/w until the 'finish point', then > reopen RO, which would allow other VMs to share it. Any other VMs > starting before the cache was populated simply fail to get the > exclusive lock and go direct to the backing file. This is a good idea, since it relaxes the requirement for releasing the cache only on shutdown. I am not sure how the 'finish point' can be recognized. Full cache quota is one obvious scenario, but I imagine most VMs do/should not really read till that point (unless they are doing something that should not be cached anyway - e.g. file-system check). Another possibility is registering some sort of event to be executed periodically (e.g. every 30 seconds), and if the cache is not modified in a period, then that is the 'finish point'. I do not know how feasible that is with the facilities that qemu provides. Kaveh