From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrj9p-0005uD-PO for qemu-devel@nongnu.org; Mon, 11 May 2015 04:33:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yrj9m-0000xP-Ij for qemu-devel@nongnu.org; Mon, 11 May 2015 04:33:49 -0400 Message-ID: <55506962.5050506@redhat.com> Date: Mon, 11 May 2015 10:33:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430830009-29839-1-git-send-email-famz@redhat.com> <1430830009-29839-2-git-send-email-famz@redhat.com> <5548C071.1050805@redhat.com> <20150506014533.GA9341@fam-t430.nay.redhat.com> <5549D809.5070804@redhat.com> <20150506095048.GA9991@ad.nay.redhat.com> <5549EB23.70300@redhat.com> <20150511080226.GB11990@fam-t430.nay.redhat.com> In-Reply-To: <20150511080226.GB11990@fam-t430.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4] block: Fix dirty bitmap in bdrv_co_discard List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, qemu-devel@nongnu.org, Stefan Hajnoczi , jsnow@redhat.com, wangxiaolong@ucloud.cn On 11/05/2015 10:02, Fam Zheng wrote: > > /* > * ... > * > * 'pnum' is set to the number of sectors (including and immediately following > * the specified sector) that are known to be in the same > * allocated/unallocated state. > * > * 'nb_sectors' is the max value 'pnum' should be set to. If nb_sectors goes > * beyond the end of the disk image it will be clamped. > */ > static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, > > So we currently don't coalesce the sequential dirty sectors. > > Was that intentional? The idea, I think, is that for some drivers bdrv_co_get_block_status is O(nb_sectors). It's okay to let a driver return *pnum > nb_sectors. You do need to audit the callers, though. It would be nice also to add TODOs whenever the code is fine but it could explot *pnum > nb_sectors to get better performance. Paolo