All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mark Trumpold" <markt@netqa.com>
To: qemu-devel@nongnu.org
Cc: markt@tachyon.net
Subject: [Qemu-devel] 'qemu-nbd' explicit flush
Date: Tue, 21 May 2013 20:01:10 +0000	[thread overview]
Message-ID: <W6608617779258491369166470@atl4webmail21> (raw)

Hello all,

I am using ‘qemu-nbd’ and ‘qemu-img’ from the command line to provide ‘qcow2’ loop filesystems.  For performance, I have '--cache=writeback' set for the qemu-nbd device.

I am having trouble flushing all caches to disk at will; specifically before snapshotting the underlying filesystem that hold the ‘qcow2’ images.

Environment:
    Qemu 1.2.0
    Debian 6.0.5
    Linux kernel 3.3.1 with Qemu patch to enable kernel flushing:
        http://thread.gmane.org/gmane.linux.drivers.nbd.general/1108

Usage example:
    'qemu-nbd --cache=writeback -c /dev/nbd0 /images/my-qcow.img'
    'mount /dev/nbd0 /my-mount-point'

Everything does flush correctly when I first unmount and then disconnect the device; however, in my case I am not able to unmount things before snapshotting.

I tried several approaches externally to flush the device.  For example:
    'mount -o remount,ro /dev/nbd0'
    'blockdev --flushbufs /dev/nbd0'

I have been looking at the Qemu source code and in user space 'nbd.c' in routine 'nbd_trip' I see the case 'NBD_CMD_FLUSH' which looks to be called from the NBD socket interface.  Here I see 'bdrv_co_flush(exp->bs)' which looks promising; however, I don't know how to setup the 'bs' pointer for the call.

Ideally, I would like to add a command line parm to 'qemu-nbd.c' to explicitely do the flush, but so far no luck.

I've been struggling with this for some time.  Any guidance would be greatly appreciated.

Thank you,
Mark Trumpold

             reply	other threads:[~2013-05-21 20:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 20:01 Mark Trumpold [this message]
2013-05-22  9:47 ` [Qemu-devel] 'qemu-nbd' explicit flush Stefan Hajnoczi
2013-05-22 11:07   ` Paolo Bonzini
2013-05-22 16:10 Mark Trumpold
2013-05-23 21:58 Mark Trumpold
2013-05-24  9:05 ` Stefan Hajnoczi
2013-05-25 17:42   ` Mark Trumpold
2013-05-27 12:36     ` Stefan Hajnoczi
2013-05-24 12:10 ` Paolo Bonzini
2013-05-23 23:35 Mark Trumpold
2013-05-24  9:06 ` Stefan Hajnoczi
2013-05-28 18:00 Mark Trumpold
2013-05-29  7:42 ` Stefan Hajnoczi
2013-05-29 15:29   ` Mark Trumpold
2013-06-07 14:00   ` Mark Trumpold

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=W6608617779258491369166470@atl4webmail21 \
    --to=markt@netqa.com \
    --cc=markt@tachyon.net \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.