Received: from eggs.gnu.org ([2001:4830:134:3::10]:35317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUBti-0002Qd-Gd for qemu-devel@nongnu.org; Thu, 10 Oct 2013 04:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUBta-0005Gc-1n for qemu-devel@nongnu.org; Thu, 10 Oct 2013 04:47:06 -0400 Date: Thu, 10 Oct 2013 10:46:37 +0200 From: Stefan Hajnoczi Message-ID: <20131010084637.GB10516@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] An issue in block-migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yaodong Yang Cc: Paolo Bonzini , qemu-devel@nongnu.org, qemu-discuss@nongnu.org On Thu, Oct 03, 2013 at 04:23:45AM +0000, Yaodong Yang wrote: > In block-migration.c file, line 435, if (bdrv_get_dirty(bmds->bs, sector)) { > > It looks like this "if statement" is used to check whether a chunk is dirty or not. If it is dirty, system will migrate a whole chunk, 1MB data, to the destination. Otherwise, the cur_dirty will increase by 1MB/512B sectors. > > However, in my understanding, this function, bdrv_get_dirty(bmds->bs, sector), only check this sector (512B) is dirty or not, rather than a whole chunk (1MB). Could someone tell me the reason? See block-migration.c:set_dirty_tracking(): bdrv_set_dirty_tracking(bmds->bs, enable ? BLOCK_SIZE : 0); The dirty bitmap granularity is set to BLOCK_SIZE. Any write in the open range [sector, sector + BLOCK_SIZE / BDRV_SECTOR_SIZE) will mark the bit dirty. Stefan