From patchwork Wed Mar 17 03:45:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 86255 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2H3lQOS009869 for ; Wed, 17 Mar 2010 03:47:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539Ab0CQDrH (ORCPT ); Tue, 16 Mar 2010 23:47:07 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:56100 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752396Ab0CQDrE (ORCPT ); Tue, 16 Mar 2010 23:47:04 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 3AC00170091; Wed, 17 Mar 2010 11:47:03 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o2H3joxD027219; Wed, 17 Mar 2010 11:45:51 +0800 Received: from [10.167.141.99] (unknown [10.167.141.99]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 7EBC4D490B; Wed, 17 Mar 2010 11:49:19 +0800 (CST) Message-ID: <4BA05040.4000101@cn.fujitsu.com> Date: Wed, 17 Mar 2010 11:45:04 +0800 From: Xiao Guangrong User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Avi Kivity CC: KVM list , LKML Subject: [PATCH] KVM: cleanup kvm_get_dirty_log() Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 17 Mar 2010 03:47:26 +0000 (UTC) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index bcd08b8..497ae14 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -767,8 +767,7 @@ int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log, int *is_dirty) { struct kvm_memory_slot *memslot; - int r, i; - int n; + int r, n; unsigned long any = 0; r = -EINVAL; @@ -782,8 +781,7 @@ int kvm_get_dirty_log(struct kvm *kvm, n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; - for (i = 0; !any && i < n/sizeof(long); ++i) - any = memslot->dirty_bitmap[i]; + any = !bitmap_empty(memslot->dirty_bitmap, memslot->npages); r = -EFAULT; if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n))