From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrLYr-000176-SR for qemu-devel@nongnu.org; Fri, 04 Jan 2013 23:40:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrLYq-0002sn-R7 for qemu-devel@nongnu.org; Fri, 04 Jan 2013 23:40:45 -0500 Received: from mail-pb0-f54.google.com ([209.85.160.54]:35085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrLYq-0002sh-Jz for qemu-devel@nongnu.org; Fri, 04 Jan 2013 23:40:44 -0500 Received: by mail-pb0-f54.google.com with SMTP id wz12so9614405pbc.41 for ; Fri, 04 Jan 2013 20:40:42 -0800 (PST) Message-ID: <50E7AEC4.5080309@gmail.com> Date: Sat, 05 Jan 2013 12:40:36 +0800 From: Liu Yuan MIME-Version: 1.0 References: <1355941771-3418-1-git-send-email-namei.unix@gmail.com> <87k3s6shdv.wl%morita.kazutaka@lab.ntt.co.jp> <50D967C3.7020109@gmail.com> <50E58B19.2050701@gmail.com> <20130104163830.GF6310@stefanha-thinkpad.hitronhub.home> In-Reply-To: <20130104163830.GF6310@stefanha-thinkpad.hitronhub.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] sheepdog: implement direct write semantics List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org, MORITA Kazutaka On 01/05/2013 12:38 AM, Stefan Hajnoczi wrote: > Hi Yuan, > BDRV_O_NOCACHE means bypass host page cache (O_DIRECT). > > BDRV_O_CACHE_WB specifies the cache semantics that the guest sees - that > means whether the disk cache is writethrough or writeback. > > In other words, BDRV_O_NOCACHE is a host performance tweak while > BDRV_O_CACHE_WB changes the cache safety of the BlockDriverState. A > protocol driver like sheepdog doesn't need to look at BDRV_O_CACHE_WB > because it is implemented in block.c (see bdrv_co_do_writev() where QEMU > will flush when after each write when !bs->enable_write_cache). Hi Stefan, Thanks for your explanation. But after more investigation, I find myself more confused: flags passed from block layer {writeback, writethrough} 0x2042 {directsync, off, none} 0x2062 {unsafe} 0x2242 So underlying driver like Sheepdog can't depend on 'flags' passed from .bdrv_file_open() to choose the right semantics (This was possible for old QEMU IIRC). If we can't rely on the 'flags' to get the cache indications of users, would you point me how to implement tristate cache control for network block driver like Sheepdog? For e.g, I want to implement following semantics: cache=writeback|none|off # enable writeback semantics for write cache=writethrough # enable writethrough semantics for write cache=directsync # disable cache completely Thanks, Yuan