linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan K <shadow_7@gmx.net>
To: kent.overstreet@gmail.com
Cc: linux-bcache@vger.kernel.org, linux-bcachefs@vger.kernel.org
Subject: Re: how does the caching works in bcachefs
Date: Thu, 09 Jul 2020 15:20:14 +0200	[thread overview]
Message-ID: <2900215.XKtEbqh0OK@t460-skr> (raw)
In-Reply-To: <20200708220220.GA109921@zaphod.evilpiepirate.org>

Hi and thanks!

> LRU, same as bcache.
do you plan to change this , since LRU is not very efficient (in comparison to other), maybe 2Q or ARC[1-4]

> [...]
> And you can pin specific files/folders to a device, by setting foreground target
> to that device and setting background target and promote target to nothing.
ok thank you very much! That must be documented somewhere ;-)


[1] https://en.ru.is/media/skjol-td/cache_comparison.pdf
[2] https://dbs.uni-leipzig.de/file/ARC.pdf
[3] http://people.cs.vt.edu/~butta/docs/sigmetrics05_kernelPrefetch.pdf
[4] http://www.vldb.org/conf/1994/P439.PDF

On Thursday, July 9, 2020 12:37:29 AM CEST kent.overstreet@gmail.com wrote:
> On Wed, Jul 08, 2020 at 11:46:00PM +0200, Stefan K wrote:
> > Hello,
> >
> > short question: how does the caching works with bcachefs? Is it like  "first
> > in first out" or is it more complex like the ARC system in zfs?
>
> LRU, same as bcache.
>
> > The same with the write-cache,  will be everything written to the SSD/NVMe
> > (Cache) and then to the HDD? When will will the filesystem say "its written to
> > disk"? And what happens with the data on the write cache if we have a
> > powerfail?
>
> Disks that are used as caches are treated no differently from other disks by the
> filesystem. If you want bcachefs to not rely on a specific disk, you can set its
> durability to 0, and then it'll basically only be used as a writethrough cache.
>
> >
> > And can I say have this file/folder always in the cache, while it works "normal" ?
>
> Yes.
>
> So caching is configured differently, specifically so that it can be configured
> on a per file/directory basis. Instead of having a notion of "cache device",
> there are options for
>  - foregroud target: which device or group of devices are used for foreground
>    writes
>  - background target: if enabled, the rebalance thread will in the background
>    move data to this target in the background, leaving a cached copy on the
>    foreground target
>  - promote target: if enabled, when data is read and it doesn't exist in this
>    target, a cached copy will be added there
>
> So these options can be set to get you writeback mode, by setting foreground
> target and promote target to your SSD and background target to your HDD.
>
> And you can pin specific files/folders to a device, by setting foreground target
> to that device and setting background target and promote target to nothing.
>

  reply	other threads:[~2020-07-09 13:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 21:46 how does the caching works in bcachefs Stefan K
2020-07-08 22:37 ` kent.overstreet
2020-07-09 13:20   ` Stefan K [this message]
2020-07-09 16:08     ` kent.overstreet
2020-07-16 21:07       ` Nix

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=2900215.XKtEbqh0OK@t460-skr \
    --to=shadow_7@gmx.net \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-bcachefs@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 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).