From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFGN4-0000pQ-1r for qemu-devel@nongnu.org; Tue, 21 Jun 2016 03:45:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFGN2-0002g8-3b for qemu-devel@nongnu.org; Tue, 21 Jun 2016 03:45:17 -0400 Date: Tue, 21 Jun 2016 09:45:07 +0200 From: Kevin Wolf Message-ID: <20160621074507.GA4520@noname.redhat.com> References: <1466435958-308-1-git-send-email-den@openvz.org> <45cce6cb-af87-9e2f-eeb2-4d4f258a3dc9@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45cce6cb-af87-9e2f-eeb2-4d4f258a3dc9@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/1] block: ignore flush requests when storage is clean List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: "Denis V. Lunev" , qemu-block@nongnu.org, qemu-devel@nongnu.org, Fam Zheng , Evgeny Yakovlev , Max Reitz , Stefan Hajnoczi 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