[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] block: ignore flush requests when storage i
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] block: ignore flush requests when storage is clean |
Date: |
Tue, 21 Jun 2016 10:57:04 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 21.06.2016 um 10:17 hat Denis V. Lunev geschrieben:
> On 06/21/2016 10:45 AM, Kevin Wolf wrote:
> >Am 21.06.2016 um 09:32 hat Paolo Bonzini geschrieben:
> >>
> >>On 20/06/2016 17:19, Denis V. Lunev wrote:
> >>>+ /* Check if storage is actually dirty before flushing to disk */
> >>>+ if (!bs->dirty) {
> >>>+ goto flush_parent;
> >>>+ }
> >>>+ bs->dirty = false;
> >>>+
> >>This should be cleared after the flush is complete. If you have
> >>
> >> write begin
> >> write end
> >> flush #1 begin
> >> flush #2 begin
> >>
> >>Then the second flush must only return after the first has finished.
> >I think clearing bs->dirty after the flush completion wouldn't
> >necessarily be right either if there are concurrent writes in flight, as
> >only completed writes are guaranteed to be flushed by it.
> >
> >Kevin
> this is not a problem if flush 2 will return after flush 1.
> This will mean that all writes prior to both flushes
> will land to the disk.
We need to be careful in cases like this:
start + complete write #1
start flush #1
start + complete write #2
start flush #2
complete flush #1
complete flush #2
Here letting flush #2 wait for flush #1 isn't enough because that one
only guarantees to flush write #1, but not write #2. However, flush #2
is required to flush write #2, too.
> Keeping this in mind dirty should be cleared before
> flush operation start.
Yes, if you do it like this, so that flush #2 ends up being an actual
flush instead of just waiting for flush #1, we're good.
Kevin