From: Kevin Wolf <kwolf@redhat.com>
To: Liu Yuan <namei.unix@gmail.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org,
MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] sheepdog: implement direct write semantics
Date: Mon, 07 Jan 2013 14:23:45 +0100 [thread overview]
Message-ID: <50EACC61.2020603@redhat.com> (raw)
In-Reply-To: <50E7DC9B.4080309@gmail.com>
Am 05.01.2013 08:56, schrieb Liu Yuan:
> On 01/05/2013 01:29 PM, Liu Yuan wrote:
>> On 01/05/2013 12:40 PM, Liu Yuan wrote:
>>> 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
>>>
>>
>> I tried the old QEMU and v1.1.0 and v1.1.2, they still worked as I
>> expected. So I guess generic block layer got changed a bit and the
>> 'flags' meaning turned different than old code, which did indeed allow
>> block drivers to interpret the 'flags' passed from bdrv_file_open().
>>
>> With the current upstream code, it seems that BDRV_O_CACHE_WB is always
>> enabled and makes 'flags' completely unusable for block drivers to get
>> the indications of user by specifying 'cache=' field.
>>
>> So is there other means to allow block drivers to rely on, in order to
>> interpret the 'cache semantics'?
>>
>
> I found the commit:e1e9b0ac 'always open drivers in writeback mode'.
> This is really undesired for network block drivers such as Sheepdog,
> which implement its own cache mechanism that support
> writeback/writethrough/directio behavior and then want to interpret
> these flags on its own.
>
> Is there any means for block drivers to get the semantics of 'cache=xxx'
> from users?
No, and in theory they shouldn't have to care.
Why do you want to handle writethrough semantics in the block driver
rather than letting qemu care for sending the right flushes?
Kevin
next prev parent reply other threads:[~2013-01-07 13:24 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-19 18:29 [Qemu-devel] [PATCH] sheepdog: implement direct write semantics Liu Yuan
2012-12-25 7:47 ` MORITA Kazutaka
2012-12-25 8:26 ` Liu Yuan
2012-12-25 8:45 ` Liu Yuan
2013-01-03 13:43 ` Liu Yuan
2013-01-04 16:38 ` Stefan Hajnoczi
2013-01-05 4:40 ` Liu Yuan
2013-01-05 5:29 ` Liu Yuan
2013-01-05 7:56 ` Liu Yuan
2013-01-07 12:31 ` Stefan Hajnoczi
2013-01-08 5:28 ` Liu Yuan
2013-01-07 13:23 ` Kevin Wolf [this message]
2013-01-08 5:42 ` Liu Yuan
2013-01-08 9:40 ` Stefan Hajnoczi
2013-01-08 9:45 ` Liu Yuan
2013-01-08 10:00 ` Kevin Wolf
2013-01-08 10:39 ` Liu Yuan
2013-01-08 10:51 ` Kevin Wolf
2013-01-08 11:08 ` Liu Yuan
2013-01-08 11:19 ` Kevin Wolf
2013-01-08 11:35 ` Liu Yuan
2013-01-08 12:12 ` Kevin Wolf
2013-01-08 13:18 ` Liu Yuan
2013-01-08 13:23 ` Liu Yuan
2013-01-09 10:25 ` Paolo Bonzini
2013-01-09 10:36 ` Liu Yuan
2013-01-09 10:40 ` Paolo Bonzini
2013-01-09 10:46 ` Liu Yuan
2013-01-09 10:58 ` Liu Yuan
2013-01-09 11:10 ` Paolo Bonzini
2013-01-09 12:07 ` Liu Yuan
2013-01-09 12:10 ` Liu Yuan
2013-01-09 12:16 ` Liu Yuan
2013-01-09 12:42 ` Kevin Wolf
2013-01-09 13:04 ` Liu Yuan
2013-01-09 15:10 ` Paolo Bonzini
2013-01-10 5:38 ` Liu Yuan
2013-01-11 7:52 ` MORITA Kazutaka
2013-01-11 8:07 ` Liu Yuan
2013-01-11 9:00 ` Paolo Bonzini
2013-01-11 9:04 ` Liu Yuan
2013-01-11 9:34 ` Paolo Bonzini
2013-01-11 9:38 ` Liu Yuan
2013-01-11 9:40 ` Paolo Bonzini
2013-01-11 9:32 ` Kevin Wolf
2013-01-10 15:25 ` Jamie Lokier
2013-01-10 15:31 ` Paolo Bonzini
2013-01-10 17:22 ` Jamie Lokier
2013-01-09 11:10 ` Kevin Wolf
2013-01-09 10:23 ` Paolo Bonzini
2013-01-10 15:12 ` Jamie Lokier
2013-01-10 15:21 ` Kevin Wolf
2013-01-10 8:03 ` [Qemu-devel] [PATCH v2] " Liu Yuan
2013-01-10 9:04 ` Stefan Hajnoczi
2013-01-11 7:35 ` MORITA Kazutaka
2013-01-11 9:23 ` Kevin Wolf
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=50EACC61.2020603@redhat.com \
--to=kwolf@redhat.com \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=namei.unix@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).