[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] guest sync and bdrv_co_flush
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] guest sync and bdrv_co_flush |
Date: |
Mon, 10 Nov 2014 13:06:04 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 07.11.2014 um 09:39 hat lihuiba geschrieben:
> Hi, all
>
> I'm a user of qemu/kvm, and I'm wondering some internals of qemu/kvm, so I'd
> better post it in
> this developer's mailing list.
>
> To be specific, I'm wondering how data is flushed to disk. Intuitively, when
> the guest issues a
> SYNCHRONIZE CACHE command in the SCSI layer, qemu/kvm should call
> bdrv_co_flush
> (),
> which will eventually call the block driver's bdrv_co_flush_to_os()
> and bdrv_co_flush_to_disk().
>
> But from simple grep-ing, I didn't find any calling to bdrv_co_flush() is
> responsible for SYNCHRONIZE
> CACHE. So, can you tell me how qemu/kvm ensures guest data be written on
> persistent storage?
The relevant code is in hw/scsi/scsi-disk.c, in the function
scsi_disk_emulate_command(), for 'case SYNCHRONIZE_CACHE:'.
The call chain from there is blk_aio_flush() -> bdrv_aio_flush() ->
bdrv_aio_flush_co_entry() -> bdrv_co_flush()
Kevin