vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1;
uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
- assert(end / VHOST_LOG_CHUNK < dev->log_size);
- assert(start / VHOST_LOG_CHUNK < dev->log_size);
if (end < start) {
return;
}
+ assert(end / VHOST_LOG_CHUNK < dev->log_size);
+
for (;from < to; ++from) {
vhost_log_chunk_t log;
int bit;
r = ioctl(dev->control, VHOST_SET_LOG_BASE, &log_base);
assert(r >= 0);
for (i = 0; i < dev->n_mem_sections; ++i) {
- vhost_sync_dirty_bitmap(dev, &dev->mem_sections[i],
- 0, (target_phys_addr_t)~0x0ull);
+ /* Sync only the range covered by the old log */
+ vhost_sync_dirty_bitmap(dev, &dev->mem_sections[i], 0,
+ dev->log_size * VHOST_LOG_CHUNK - 1);
}
if (dev->log) {
g_free(dev->log);