All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Wheeler <bcache@lists.ewheeler.net>
To: Keith Busch <kbusch@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>, Coly Li <colyli@suse.de>,
	Adriano Silva <adriano_da_silva@yahoo.com.br>,
	Bcache Linux <linux-bcache@vger.kernel.org>,
	Matthias Ferdinand <bcache@mfedv.net>,
	linux-block@vger.kernel.org
Subject: Re: [RFC] Add sysctl option to drop disk flushes in bcache? (was: Bcache in writes direct with fsync)
Date: Tue, 24 May 2022 14:34:23 -0700 (PDT)	[thread overview]
Message-ID: <7759781b-dac-7f84-ff42-86f4b1983ca1@ewheeler.net> (raw)
In-Reply-To: <Yo1BRxG3nvGkQoyG@kbusch-mbp.dhcp.thefacebook.com>

On Tue, 24 May 2022, Keith Busch wrote:
> On Tue, May 24, 2022 at 01:14:18PM -0700, Eric Wheeler wrote:
> > Hi Christoph,
> > 
> > On Mon, 23 May 2022, Christoph Hellwig wrote:
> > > ... wait.
> > > 
> > > Can someone explain what this is all about?  Devices with power fail 
> > > protection will advertise that (using VWC flag in NVMe for example) and 
> > > we will never send flushes. So anything that explicitly disables flushed 
> > > will generally cause data corruption.
> > 
> > Adriano was getting 1.5ms sync-write ioping's to an NVMe through bcache 
> > (instead of the expected ~70us), so perhaps the NVMe flushes were killing 
> > performance if every write was also forcing an erase cycle.
> > 
> > The suggestion was to disable flushes in bcache as a troubleshooting step 
> > to see if that solved the problem, but with the warning that it could be 
> > unsafe.
> > 
> > Questions:
> > 
> > 1. If a user knows their disks have a non-volatile cache then is it safe 
> >    to drop flushes?
> > 
> > 2. If not, then under what circumstances is it unsafe with a non-volatile 
> >    cache?
> >   
> > 3. Since the block layer wont send flushes when the hardware reports that 
> >    the cache is non-volatile, then how do you query the device to make 
> >    sure it is reporting correctly?  For NVMe you can get VWC as:
> > 	nvme id-ctrl -H /dev/nvme0 |grep -A1 vwc
> >    
> >    ...but how do you query a block device (like a RAID LUN) to make sure 
> >    it is reporting a non-volatile cache correctly?
> 
> You can check the queue attribute, /sys/block/<disk>/queue/write_cache. If the
> value is "write through", then the device is reporting it doesn't have a
> volatile cache. If it is "write back", then it has a volatile cache.
 
Thanks, Keith!  

Is this flag influced at all when /sys/block/sdX/queue/scheduler is set 
to "none", or does the write_cache flag operate independently of the 
selected scheduler?

Does the block layer stop sending flushes at the first device in the stack 
that is set to "write back"?  For example, if a device mapper target is 
writeback will it strip flushes on the way to the backing device?

This confirms what I have suspected all along: We have an LSI MegaRAID 
SAS-3516 where the write policy is "write back" in the LUN, but the cache 
is flagged in Linux as write-through:

	]# cat /sys/block/sdb/queue/write_cache 
	write through

I guess this is the correct place to adjust that behavior!


--
Eric Wheeler


  reply	other threads:[~2022-05-24 21:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <958894243.922478.1652201375900.ref@mail.yahoo.com>
2022-05-10 16:49 ` Bcache in writes direct with fsync. Are IOPS limited? Adriano Silva
2022-05-11  6:20   ` Matthias Ferdinand
2022-05-11 12:58     ` Adriano Silva
2022-05-11 21:21       ` Matthias Ferdinand
2022-05-18  1:22   ` Eric Wheeler
2022-05-23 14:07     ` Coly Li
2022-05-26 19:15       ` Eric Wheeler
2022-05-27 17:28         ` colyli
2022-05-28  0:58           ` Eric Wheeler
2022-05-23 18:36     ` [RFC] Add sysctl option to drop disk flushes in bcache? (was: Bcache in writes direct with fsync) Eric Wheeler
2022-05-24  5:34       ` Christoph Hellwig
2022-05-24 20:14         ` Eric Wheeler
2022-05-24 20:34           ` Keith Busch
2022-05-24 21:34             ` Eric Wheeler [this message]
2022-05-25  5:20               ` Christoph Hellwig
2022-05-25 18:44                 ` Eric Wheeler
2022-05-26  9:06                   ` Christoph Hellwig
2022-05-28  1:52                 ` Eric Wheeler
2022-05-28  3:57                   ` Keith Busch
2022-05-28  4:59                   ` Christoph Hellwig
2022-05-28 12:57                     ` Adriano Silva
2022-05-29  3:18                       ` Keith Busch
2022-05-31 19:42                         ` Eric Wheeler
2022-05-31 20:22                           ` Keith Busch
2022-05-31 23:04                             ` Eric Wheeler
2022-06-01  0:36                               ` Keith Busch
2022-06-01 18:48                                 ` Eric Wheeler
     [not found]                         ` <2064546094.2440522.1653825057164@mail.yahoo.com>
     [not found]                           ` <YpTKfHHWz27Qugi+@kbusch-mbp.dhcp.thefacebook.com>
2022-06-01 19:27                             ` Adriano Silva
2022-06-01 21:11                               ` Eric Wheeler
2022-06-02  5:26                                 ` Christoph Hellwig
2022-05-25  5:17           ` Christoph Hellwig
     [not found]     ` <681726005.1812841.1653564986700@mail.yahoo.com>
2022-05-26 20:20       ` Bcache in writes direct with fsync. Are IOPS limited? Adriano Silva
2022-05-26 20:28       ` Eric Wheeler
2022-05-27  4:07         ` Adriano Silva
2022-05-28  1:27           ` Eric Wheeler
2022-05-28  7:22             ` Matthias Ferdinand
2022-05-28 12:09               ` Adriano Silva

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=7759781b-dac-7f84-ff42-86f4b1983ca1@ewheeler.net \
    --to=bcache@lists.ewheeler.net \
    --cc=adriano_da_silva@yahoo.com.br \
    --cc=bcache@mfedv.net \
    --cc=colyli@suse.de \
    --cc=hch@infradead.org \
    --cc=kbusch@kernel.org \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.