linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: dsterba@suse.cz, linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [RFC PATCH] Btrfs: add sha256 checksum option
Date: Thu, 27 Nov 2014 11:52:20 +0800	[thread overview]
Message-ID: <20141127035219.GB2224@localhost.localdomain> (raw)
In-Reply-To: <20141125163905.GJ26471@twin.jikos.cz>

On Tue, Nov 25, 2014 at 05:39:05PM +0100, David Sterba wrote:
> On Mon, Nov 24, 2014 at 01:23:05PM +0800, Liu Bo wrote:
> > This brings a strong-but-slow checksum algorithm, sha256.
> > 
> > Actually btrfs used sha256 at the early time, but then moved to crc32c for
> > performance purposes.
> > 
> > As crc32c is sort of weak due to its hash collision issue, we need a stronger
> > algorithm as an alternative.
> > 
> > Users can choose sha256 from mkfs.btrfs via
> > 
> > $ mkfs.btrfs -C 256 /device
> 
> There's already some good feedback so I'll try to cover what hasn't been
> mentioned yet.
> 
> I think it's better to separate the preparatory works from adding the
> algorithm itself. The former can be merged (and tested) independently.

That's a good point.

> 
> There are several checksum algorithms that trade off speed and strength
> so we may want to support more than just sha256. Easy to add but I'd
> rather see them added in all at once than one by one.
> 
> Another question is if we'd like to use different checksum for data and
> metadata. This would not cost any format change if we use the 2 bytes in
> super block csum_type.

Yes, but breaking it into meta_csum_type and data_csum_type will need a
imcompat flag.

> 
> 
> Optional/crazy/format change stuff:
> 
> * per-file checksum algorithm - unlike compression, the whole file would
>   have to use the same csum algo
>   reflink would work iff the algos match
>   snapshotting is unaffected
> 
> * per-subvolume checksum algorithm - specify the csum type at creation
>   time, or afterwards unless it's modified

I thought about this before, if we enable this, a few cases need to be dealt
with(at least),
1. convert file data's csum from one algorithm to another
2. to make different checksum length co-exist, we can either use different
   key.type for different algorithms, or pack checksum into a new structure that
   has algorithm types(and length).

thanks,
-liubo

  reply	other threads:[~2014-11-27  3:52 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24  5:23 [RFC PATCH] Btrfs: add sha256 checksum option Liu Bo
2014-11-24  5:23 ` [RFC PATCH] Btrfs-progs: support sha256 checksum algorithm Liu Bo
2014-11-24  8:23 ` [RFC PATCH] Btrfs: add sha256 checksum option Holger Hoffstätte
2014-11-24 18:55   ` Duncan
2014-11-24 19:34     ` John Williams
2014-11-25 10:30       ` Liu Bo
2014-11-25 10:52         ` Daniel Cegiełka
2014-11-25 23:17         ` John Williams
2014-11-26 12:50           ` Holger Hoffstätte
2014-11-26 17:53             ` John Williams
2014-11-25 10:28   ` Liu Bo
2014-11-24 20:07 ` Chris Mason
2014-11-24 20:58   ` Hugo Mills
2014-11-25  3:04     ` Qu Wenruo
2014-11-25  5:13     ` Zygo Blaxell
2014-11-25 11:30   ` Liu Bo
2014-11-26 13:36     ` Brendan Hide
2014-11-25 16:47   ` David Sterba
2014-11-25 19:45     ` Bardur Arantsson
2014-11-26 13:38     ` Brendan Hide
2014-11-26 13:58       ` Austin S Hemmelgarn
2014-12-01 18:37         ` David Sterba
2014-12-01 20:35           ` Austin S Hemmelgarn
2014-12-01 20:51             ` John Williams
2014-12-01 23:23               ` Alex Elsayed
2014-12-15 18:47                 ` David Sterba
2014-11-25 16:39 ` David Sterba
2014-11-27  3:52   ` Liu Bo [this message]
2014-12-01 18:51     ` David Sterba
2014-11-29 20:38   ` Alex Elsayed
2014-11-29 21:00     ` John Williams
2014-11-29 21:07       ` Alex Elsayed
2014-11-29 21:21         ` John Williams
2014-11-29 21:27           ` Alex Elsayed
2014-12-01 12:39           ` Austin S Hemmelgarn
2014-12-01 17:22             ` John Williams
2014-12-01 17:42               ` Austin S Hemmelgarn
2014-12-01 17:49                 ` John Williams
2014-12-01 19:28                   ` Alex Elsayed
2014-12-01 19:34                     ` Alex Elsayed
2014-12-01 20:26                       ` Austin S Hemmelgarn
2014-12-01 19:58                     ` John Williams
2014-12-01 20:04                       ` Alex Elsayed
2014-12-01 20:08                         ` Alex Elsayed
2014-12-01 20:46                           ` John Williams
2014-12-01 22:56                             ` Alex Elsayed
2014-12-01 23:05                             ` Alex Elsayed
2014-12-01 23:37                               ` John Williams
2014-12-01 23:46                                 ` Alex Elsayed
2014-12-02  0:03                                   ` John Williams
2014-12-02  0:15                                     ` Alex Elsayed
2014-12-02  0:30                                       ` John Williams
2014-12-02  0:34                                         ` Alex Elsayed
2014-12-02  0:11                                   ` John Williams
2014-12-01 23:48                               ` John Williams
2014-12-02  0:06                                 ` Alex Elsayed
2014-12-02  0:10                                   ` Alex Elsayed
2014-12-02  0:16                                   ` John Williams
2014-12-02  0:28       ` Christoph Anton Mitterer
2014-12-02  0:43         ` Alex Elsayed
2014-12-02  0:53           ` Christoph Anton Mitterer
2014-12-02  1:25             ` Alex Elsayed
2014-12-02  1:32               ` Alex Elsayed
2014-11-30 22:51     ` Christoph Anton Mitterer
2014-11-30 22:59     ` Christoph Anton Mitterer
2014-11-30 23:05       ` Dimitri John Ledkov
2014-12-01  2:55         ` Christoph Anton Mitterer

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=20141127035219.GB2224@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@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).