From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFGsG-00015c-LD for qemu-devel@nongnu.org; Tue, 21 Jun 2016 04:17:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFGsC-0001HM-Iv for qemu-devel@nongnu.org; Tue, 21 Jun 2016 04:17:32 -0400 Received: from mail-db5eur01on0119.outbound.protection.outlook.com ([104.47.2.119]:63840 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFGsC-0001Gz-8w for qemu-devel@nongnu.org; Tue, 21 Jun 2016 04:17:28 -0400 References: <1466435958-308-1-git-send-email-den@openvz.org> <45cce6cb-af87-9e2f-eeb2-4d4f258a3dc9@redhat.com> <20160621074507.GA4520@noname.redhat.com> From: "Denis V. Lunev" Message-ID: <5768F811.5080105@openvz.org> Date: Tue, 21 Jun 2016 11:17:21 +0300 MIME-Version: 1.0 In-Reply-To: <20160621074507.GA4520@noname.redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit 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: Kevin Wolf , Paolo Bonzini Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Fam Zheng , Evgeny Yakovlev , Max Reitz , Stefan Hajnoczi 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. Keeping this in mind dirty should be cleared before flush operation start. Den