linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Btrfs partial csum support
@ 2015-07-10  4:09 Qu Wenruo
  2015-07-10  4:09 ` [RFC PATCH 1/2] btrfs: csum: Introduce partial csum for tree block Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qu Wenruo @ 2015-07-10  4:09 UTC (permalink / raw)
  To: linux-btrfs

This patchset will add partial csum support for btrfs.

Partial csum will take full advantage of the 32 bytes csum space inside
the tree block, while still maintain backward compatibility on old
kernels.

The overall idea is like the following on 16K leaf:
[Old tree block csum]
0     4     8    12    16    20    24    28    32
-------------------------------------------------
|csum |   unused, all 0				|
-------------------------------------------------
Csum is the crc32 of the whole tree block data.

[New tree block csum]
-------------------------------------------------
|csum0|csum1|csum2|csum3|csum4|csum5|csum6|csum7|
-------------------------------------------------
Where csum0 is the same as the old one, crc32 of the whole tree block
data.

And csum1~csum7 will restore crc32 of each eighth part.
Take example of 16K leafsize, then:
csum1: crc32 of BTRFS_CSUM_SIZE~4K
csum2: crc32 of 4K~6K
...
csum7: crc32 of 14K~16K


When nodesize is small, like 4K, partial csum is completely useless.
But when nodesize grows up, like 32K, each partial csum will just covers
a page, making scrub able to judge which page is OK even without reading
out the whole tree block.

And add the possibility to fix case like corruption happens at all
mirror but in different part.
Such case should be more possible if nodesize goes up beyond 16K.

Qu Wenruo (1):
  btrfs: csum: Introduce partial csum for tree block.

Zhao Lei (1):
  btrfs: scrub: Add support partial csum

 fs/btrfs/disk-io.c |  74 ++++++++++++-------
 fs/btrfs/scrub.c   | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 255 insertions(+), 26 deletions(-)

-- 
2.4.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-20  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-10  4:09 [RFC PATCH 0/2] Btrfs partial csum support Qu Wenruo
2015-07-10  4:09 ` [RFC PATCH 1/2] btrfs: csum: Introduce partial csum for tree block Qu Wenruo
2015-07-10  4:09 ` [RFC PATCH 2/2] btrfs: scrub: Add support partial csum Qu Wenruo
2015-07-20  8:12 ` [RFC PATCH 0/2] Btrfs partial csum support Qu Wenruo

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).