Re: Discard option

"Coly Li" <[email protected]> Tue, 21 Oct 2025 12:10:09 +0800
Newsgroups org.kernel.vger.linux-bcache
Message-ID <bylrai4kufkldmprnlbuypfftgaah2umvggux2uheu7jjcwzgx@bgcigj3znw4d>
On Tue, Oct 21, 2025 at 04:58:21AM +0800, Pierre Juhen wrote:
> Hi Coli,
> 
> I assume this email is irrelevant to the patch “bcache: avoid redundant access RB tree in read_dirty”, am I correct?
> 
> Yes you are;  sorry, I picked a message and forgot to change the title
> 
> The discard option is not recommended. Indeed in next merge window I will submit a patch series to drop the discard option.
> 
> OK, I will boot on a Live USB Key to wipe the caching device and create a
> new one without discard option.
> 
> But should I keep the discard mount option in fstab for the logical volumes
> inside bcache ?
> 

Just not enable the bcache internal discard is fine. Bcache handles outside
discard bios properly, if this is a file system mounted on top of a bcache
device, it is fine to keep discard option of the file system.


> 
> _______________
> 
> Le 21/10/2025 à 03:18, Coly Li a écrit :
> > > 2025年10月21日 00:39,Pierre Juhen <[email protected]> 写道:
> > > 
> > > Hi
> > > I am on kernel 6.16.12.
> > > I have had errors with bcache recently, And I lost my fronted 3 or 4 times :
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: journal_read_bucket() 128: bad csum, 32768 bytes, offset 0
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: journal_read_bucket() 64: bad csum, 22928 bytes, offset 0
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: journal_read_bucket() 32: bad csum, 4848 bytes, offset 2
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: journal_read_bucket() 48: bad csum, 14096 bytes, offset 0
> > > oct. 20 15:37:40 pierre.juhen (udev-worker)[461]: nvme0n1p3: Process 'bcache-register /dev/nvme0n1p3' failed with exit code 1.
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: prio_read() bad csum reading priorities
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: bch_cache_set_error() error on 448f191c-28df-4396-bc44-14d1f77c9005: IO error reading priorities, disabling caching
> > > oct. 20 15:37:40 pierre.juhen kernel: bcache: register_bcache() error : failed to register device
> > > 
> > I assume this email is irrelevant to the patch “bcache: avoid redundant access RB tree in read_dirty”, am I correct?
> > 
> > 
> > > I had to reconfigure everything after a disk problem.
> > > I have been running bcache for years now, without any problems.
> > > The only difference might be that I configured the frontend with the discard option.
> > The discard option is not recommended. Indeed in next merge window I will submit a patch series to drop the discard option.
> > 
> > 
> > > The logical volume using bcache have also a discard option in fstab.
> > > The frontend is on a Samsung 980 nvme disk.
> > Try not to enable discard on cache device. This option will disappear soon.
> > 
> > I don’t know whether discard option of Samsung 980 nvme disk may change the content of discarded LBA or not, from NVMe spec, it could be zero-filled or undefined.
> > Anyway in current code discard doesn’t help performance, I suggest to not enable discard and see whether the issue still shows up.
> > 
> > My suggestion is: always use default configuration, all our test case and performance optimization are for default configurations.
> > 
> > Thanks.
> > 
> > Coly Li
> >