public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Mark Harmstone <mark@harmstone.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org, wqu@suse.com, boris@bur.io
Subject: Re: [PATCH v3] btrfs: add BTRFS_IOC_GET_CSUMS ioctl
Date: Wed, 15 Apr 2026 18:43:45 +0200	[thread overview]
Message-ID: <20260415164345.GR12792@twin.jikos.cz> (raw)
In-Reply-To: <e1861274-8d36-4a79-8092-aa7e2ba39240@harmstone.com>

On Wed, Apr 15, 2026 at 02:56:49PM +0100, Mark Harmstone wrote:
> >> When using the --reflink option added in btrfs-progs v6.16.1, we can forgo
> >> reading the data entirely, resulting a ~2200% speed-up on the same test
> >> (128s to 6s).
> > 
> > Repeated mkfs is a specific use case, normaly it happens just once but I
> > understand that for preparing various images the time savings are
> > significiant.
> > 
> > Once this ioctl is available I think the deduplication tools will make
> > use of it as an initial filter before actually doing the real
> > deduplication of extents.
> 
> IIRC the mathematics of the birthday paradox is that for an n-bit hash, 
> you need 2^(n/2) sectors to have a 50% chance of a collision.
> 
> For the 32-bit hashes, that means a 50% chance of a collision every 256 
> MB. For the 256-bit hashes, that's 2^140 bytes... whatever that works 
> out as. So the dedupe logic would no doubt be that for larger hash sizes 
> GET_CSUMS itself will be sufficient.

It's used as a hint in the initial filter (e.g. in
https://github.com/lakshmipathi/dduper), the final deduplication does
full byte compariison (memcmp() inside vfs_dedupe_file_range_compare()).

  reply	other threads:[~2026-04-15 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 17:14 [PATCH v3] btrfs: add BTRFS_IOC_GET_CSUMS ioctl Mark Harmstone
2026-04-13 22:17 ` Qu Wenruo
2026-04-14 12:57   ` Mark Harmstone
2026-04-14  2:07 ` David Sterba
2026-04-15 13:56   ` Mark Harmstone
2026-04-15 16:43     ` David Sterba [this message]
2026-04-15 16:52       ` Mark Harmstone

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=20260415164345.GR12792@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mark@harmstone.com \
    --cc=wqu@suse.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