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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to