diff mbox

KVM: cleanup kvm_get_dirty_log()

Message ID 4BA05040.4000101@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Xiao Guangrong March 17, 2010, 3:45 a.m. UTC
None
diff mbox

Patch

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))