Skip to contentSkip to conversation

An issue in block-migration

Qemu-devel Yaodong Yang 2 participants 2 messages Oct 3, 2013 – Oct 10, 2013

lore
Share & tools
lore
#0 lore raw

Hi all,

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?

Thanks!
Yaodong

#1 lore raw
Quoted 5 lines · Yaodong Yang

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