From: Liu Yuan <namei.unix@gmail.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] bdrv_co_flush_to_disk() don't flush as expected
Date: Fri, 18 Jan 2013 23:43:14 +0800 [thread overview]
Message-ID: <50F96D92.6080301@gmail.com> (raw)
Hi List,
Recently I found bdrv_co_flush_to_disk() doesn't work as expected. As
it is advertised
/*
* Flushes all data that was already written to the OS all the way
down to
* the disk (for example raw-posix calls fsync()).
*/
int coroutine_fn (*bdrv_co_flush_to_disk)(BlockDriverState *bs);
The fsync(2) or similar flush requests in the guest OS will trigger this
handler of the attached disk.
But I noticed that this handler isn't called at all when guest is
running if I attach another disk as 'cache=writeback', for e.g
# start up the guest
$ qemu-system-x86_64 --enable-kvm -drive
file=~/images/test1,if=virtio,cache=writeback -smp 2 -cpu host -m 1024
-drive file=sheepdog:test,if=virtio,cache=writeback
# write to the /dev/vdb of the guest
# sudo dd if=/dev/urandom of=/dev/vdb bs=4M count=1 oflag=direct,sync
This doesn't trigger flush for vdb device. I also write a small program
to call fsync(2) to the device, no flush neither.
Only the poweroff of the guest will trigger the flush request for vdb.
So is this expected behavior and I am missing something?
Thanks,
Yuan
next reply other threads:[~2013-01-18 15:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 15:43 Liu Yuan [this message]
2013-01-18 15:56 ` [Qemu-devel] bdrv_co_flush_to_disk() don't flush as expected Stefan Hajnoczi
2013-01-18 16:13 ` Liu Yuan
2013-01-18 16:28 ` Liu Yuan
2013-01-18 18:06 ` Liu Yuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50F96D92.6080301@gmail.com \
--to=namei.unix@gmail.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).