remarkable-linux/fs/btrfs
Chris Mason d20f7043fa Btrfs: move data checksumming into a dedicated tree
Btrfs stores checksums for each data block.  Until now, they have
been stored in the subvolume trees, indexed by the inode that is
referencing the data block.  This means that when we read the inode,
we've probably read in at least some checksums as well.

But, this has a few problems:

* The checksums are indexed by logical offset in the file.  When
compression is on, this means we have to do the expensive checksumming
on the uncompressed data.  It would be faster if we could checksum
the compressed data instead.

* If we implement encryption, we'll be checksumming the plain text and
storing that on disk.  This is significantly less secure.

* For either compression or encryption, we have to get the plain text
back before we can verify the checksum as correct.  This makes the raid
layer balancing and extent moving much more expensive.

* It makes the front end caching code more complex, as we have touch
the subvolume and inodes as we cache extents.

* There is potentitally one copy of the checksum in each subvolume
referencing an extent.

The solution used here is to store the extent checksums in a dedicated
tree.  This allows us to index the checksums by phyiscal extent
start and length.  It means:

* The checksum is against the data stored on disk, after any compression
or encryption is done.

* The checksum is stored in a central location, and can be verified without
following back references, or reading inodes.

This makes compression significantly faster by reducing the amount of
data that needs to be checksummed.  It will also allow much faster
raid management code in general.

The checksums are indexed by a key with a fixed objectid (a magic value
in ctree.h) and offset set to the starting byte of the extent.  This
allows us to copy the checksum items into the fsync log tree directly (or
any other tree), without having to invent a second format for them.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-12-08 16:58:54 -05:00
..
acl.c Btrfs: optimize btrget/set/removexattr 2008-09-25 11:04:07 -04:00
async-thread.c Btrfs: Check kthread_should_stop() before schedule() in worker_loop 2008-11-12 14:36:58 -05:00
async-thread.h Btrfs: Add ordered async work queues 2008-11-06 22:03:00 -05:00
btrfs_inode.h Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
compat.h Btrfs: compat code fixes 2008-11-20 10:22:27 -05:00
compression.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
compression.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
COPYING Btrfs: add GPLv2 2007-06-12 09:07:21 -04:00
crc32c.h Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
ctree.c Btrfs: make things static and include the right headers 2008-12-02 09:54:17 -05:00
ctree.h Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
dir-item.c Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
disk-io.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
disk-io.h Btrfs: mount ro and remount support 2008-11-12 14:34:12 -05:00
export.c Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
export.h NFS support for btrfs - v3 2008-09-25 11:04:06 -04:00
extent-tree.c Btrfs: make things static and include the right headers 2008-12-02 09:54:17 -05:00
extent_io.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
extent_io.h Btrfs: Optimize compressed writeback and reads 2008-11-06 22:02:51 -05:00
extent_map.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
extent_map.h Btrfs: Fix csum error for compressed data 2008-11-10 07:34:43 -05:00
file-item.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
file.c Btrfs: fix shadowed variable declarations 2008-12-02 06:36:09 -05:00
free-space-cache.c Btrfs: make things static and include the right headers 2008-12-02 09:54:17 -05:00
hash.h Switch btrfs_name_hash() to crc32c 2008-09-25 11:04:06 -04:00
inode-item.c Btrfs: make things static and include the right headers 2008-12-02 09:54:17 -05:00
inode-map.c Btrfs: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
inode.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
INSTALL Btrfs: Documentation update 2007-06-22 14:49:31 -04:00
ioctl.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
ioctl.h Btrfs: Allow subvolumes and snapshots anywhere in the directory tree 2008-11-17 21:02:50 -05:00
locking.c Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
locking.h btrfs_search_slot: reduce lock contention by cowing in two stages 2008-09-25 11:04:06 -04:00
Makefile Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
ordered-data.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
ordered-data.h Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
orphan.c Btrfs: Create orphan inode records to prevent lost files after a crash 2008-09-25 11:04:05 -04:00
print-tree.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
print-tree.h Btrfs: Create extent_buffer interface for large blocksizes 2008-09-25 11:03:56 -04:00
ref-cache.c Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
ref-cache.h Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
root-tree.c Btrfs: make things static and include the right headers 2008-12-02 09:54:17 -05:00
struct-funcs.c Btrfs: Fix sparse endian warnings in struct-funcs.c 2008-12-02 11:18:37 -05:00
super.c Btrfs: corret fmode_t annotations 2008-12-02 06:36:09 -05:00
sysfs.c Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
transaction.c Btrfs: remove unneeded total_trans 2008-12-02 06:36:10 -05:00
transaction.h Btrfs: Allow subvolumes and snapshots anywhere in the directory tree 2008-11-17 21:02:50 -05:00
tree-defrag.c Btrfs: nuke fs wide allocation mutex V2 2008-10-29 14:49:05 -04:00
tree-log.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
tree-log.h Btrfs: Add a write ahead tree log to optimize synchronous operations 2008-09-25 11:04:07 -04:00
version.h Update Btrfs files for in-kernel usage 2008-09-25 15:41:59 -04:00
version.sh Btrfs: Fixes for 2.6.28-rc API changes 2008-11-19 21:17:22 -05:00
volumes.c Btrfs: move data checksumming into a dedicated tree 2008-12-08 16:58:54 -05:00
volumes.h Btrfs: corret fmode_t annotations 2008-12-02 06:36:09 -05:00
xattr.c Btrfs: optimize btrget/set/removexattr 2008-09-25 11:04:07 -04:00
xattr.h Btrfs: optimize btrget/set/removexattr 2008-09-25 11:04:07 -04:00
zlib.c Btrfs: make things static and include the right headers 2008-12-02 09:54:17 -05:00