Linux bcachefs list
 help / color / mirror / Atom feed
From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: Kent Overstreet <kent.overstreet@gmail.com>,
	linux-bcachefs@vger.kernel.org
Subject: Re: Are reflinks always O(n)?
Date: Mon, 4 Jul 2022 12:03:04 -0400	[thread overview]
Message-ID: <YsMP/+P72sK/nUls@itl-email> (raw)
In-Reply-To: <20220704145608.3673qxxy5ubchvkn@moria.home.lan>

[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]

On Mon, Jul 04, 2022 at 10:56:08AM -0400, Kent Overstreet wrote:
> On Thu, Jun 30, 2022 at 01:00:29AM -0400, Demi Marie Obenour wrote:
> > In bcachefs, is creating a reflink O(n) in the size of the file, or in
> > the number of currently unshared extents that need to be moved into the
> > reflink btree?  The former would be annoying, but the latter is
> > proportional to the number of modifications to the file since it was
> > last reflinked, which is fine for my use-case so long as unlinking a
> > heavily reflinked file is also fast.  My reading of “bcachefs:
> > Principles of Operation” suggests the latter.
> > 
> > Basically, if a file is already reflinked, is reflinking it *again*
> > cheap?
> 
> It's about the same. Reflinking a file doesn't change the number of extents, it
> just makes them indirect, and then to reflink the file a second time we have to
> bump the refcount on all those indirect extents.

Thanks for the information.  This could be annoying for large, heavily
fragmented files that are frequently reflinked.  What makes this tricky
is that at the time of snapshot creation, Qubes OS does not know if the
snapshot will be sparse or dense.  For instance, renaming a qube (VM)
is done by cloning the qube and then deleting the original.  That the
clone will be sparse is only known when the deletion API call is made,
which is too late to use a different method of cloning the file.
Therefore, something that performs well in both cases is highly
desirable.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-07-04 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30  5:00 Are reflinks always O(n)? Demi Marie Obenour
2022-07-04 14:56 ` Kent Overstreet
2022-07-04 16:03   ` Demi Marie Obenour [this message]

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=YsMP/+P72sK/nUls@itl-email \
    --to=demi@invisiblethingslab.com \
    --cc=kent.overstreet@gmail.com \
    --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