From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O48vq-00043D-RG for qemu-devel@nongnu.org; Tue, 20 Apr 2010 04:35:46 -0400 Received: from [140.186.70.92] (port=37744 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O48vp-00042u-CA for qemu-devel@nongnu.org; Tue, 20 Apr 2010 04:35:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O48vn-0006N2-JH for qemu-devel@nongnu.org; Tue, 20 Apr 2010 04:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62554) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O48vn-0006MZ-Ab for qemu-devel@nongnu.org; Tue, 20 Apr 2010 04:35:43 -0400 Message-ID: <4BCD6739.6070507@redhat.com> Date: Tue, 20 Apr 2010 10:35:05 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1271692601-6881-1-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1271692601-6881-1-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2] block: Cache total_sectors to reduce bdrv_getlength calls List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Jan Kiszka , qemu-devel@nongnu.org, Christoph Hellwig Am 19.04.2010 17:56, schrieb Stefan Hajnoczi: > The BlockDriver bdrv_getlength function is called from the I/O code path > when checking that the request falls within the device. Unfortunately > this involves an lseek system call in the raw protocol; every read or > write request will incur this lseek cost. > > Jan Kiszka identified this issue and its > latency overhead. This patch caches device length in the existing > total_sectors variable so lseek calls can be avoided for fixed size > devices. > > Growable devices fall back to the full bdrv_getlength code path because > I have not added logic to detect extending the size of the device in a > write. > > Signed-off-by: Stefan Hajnoczi > --- > v2: > - Introduced refresh_total_sectors() to clean up total_sectors updates > - Added error handling for refresh_total_sectors() callers Looks good, applied to the block branch. Kevin