Hi Paolo, Thanks. I found a function called bdrv_invalidate_cache() in qcow2.c. After migration, it will be called to invalidate the cache of the block device? On Fri, Jun 27, 2014 at 5:49 PM, Paolo Bonzini wrote: > Il 27/06/2014 21:41, Xiongzi Ge ha scritto: > > >> When I studied the code, I found in migration.c, >> bdrv_clear_incoming_migration_all(); >> >> the cache of the bdrv devices will be deleted. >> >> Is this the one for the functions to be called after migration? >> >> Does the bdrv device need to be reopen or load state in block.c? >> >> I would like to find this function to add my new code. >> > > This function is not going to do anything if your code is in "raw" format. > In particular, it has *nothing* to do with the guest OS's cache. That > cache is managed by the guest OS and, as I have already told you multiple > times, there is *nothing* that QEMU can do about it. > > All you can do is use O_DIRECT in the guest. > > Paolo >