linux/fs/btrfs
Chris Mason c8b978188c Btrfs: Add zlib compression support
This is a large change for adding compression on reading and writing,
both for inline and regular extents.  It does some fairly large
surgery to the writeback paths.

Compression is off by default and enabled by mount -o compress.  Even
when the -o compress mount option is not used, it is possible to read
compressed extents off the disk.

If compression for a given set of pages fails to make them smaller, the
file is flagged to avoid future compression attempts later.

* While finding delalloc extents, the pages are locked before being sent down
to the delalloc handler.  This allows the delalloc handler to do complex things
such as cleaning the pages, marking them writeback and starting IO on their
behalf.

* Inline extents are inserted at delalloc time now.  This allows us to compress
the data before inserting the inline extent, and it allows us to insert
an inline extent that spans multiple pages.

* All of the in-memory extent representations (extent_map.c, ordered-data.c etc)
are changed to record both an in-memory size and an on disk size, as well
as a flag for compression.

From a disk format point of view, the extent pointers in the file are changed
to record the on disk size of a given extent and some encoding flags.
Space in the disk format is allocated for compression encoding, as well
as encryption and a generic 'other' field.  Neither the encryption or the
'other' field are currently used.

In order to limit the amount of data read for a single random read in the
file, the size of a compressed extent is limited to 128k.  This is a
software only limit, the disk format supports u64 sized compressed extents.

In order to limit the ram consumed while processing extents, the uncompressed
size of a compressed extent is limited to 256k.  This is a software only limit
and will be subject to tuning later.

Checksumming is still done on compressed extents, and it is done on the
uncompressed version of the data.  This way additional encodings can be
layered on without having to figure out which encoding to checksum.

Compression happens at delalloc time, which is basically singled threaded because
it is usually done by a single pdflush thread.  This makes it tricky to
spread the compression load across all the cpus on the box.  We'll have to
look at parallel pdflush walks of dirty inodes at a later time.

Decompression is hooked into readpages and it does spread across CPUs nicely.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-10-29 14:49:59 -04:00
..
COPYING Btrfs: add GPLv2 2007-06-12 09:07:21 -04:00
INSTALL Btrfs: Documentation update 2007-06-22 14:49:31 -04:00
Makefile Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
acl.c Btrfs: optimize btrget/set/removexattr 2008-09-25 11:04:07 -04:00
async-thread.c Btrfs: fix multi-device code to use raid policies set by mkfs 2008-09-30 19:36:34 -04:00
async-thread.h Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
btrfs_inode.h Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
compat.h Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
compression.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
compression.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
crc32c.h Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
ctree.c Btrfs: Remove offset field from struct btrfs_extent_ref 2008-10-09 11:46:24 -04:00
ctree.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
dir-item.c Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
disk-io.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
disk-io.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04: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: Add zlib compression support 2008-10-29 14:49:59 -04:00
extent_io.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
extent_io.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
extent_map.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
extent_map.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
file-item.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
file.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
free-space-cache.c Btrfs: make tree_search_offset more flexible in its searching 2008-10-10 10:24:32 -04:00
hash.h Switch btrfs_name_hash() to crc32c 2008-09-25 11:04:06 -04:00
inode-item.c Btrfs: Implement new dir index format 2008-09-25 11:04:05 -04: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: Add zlib compression support 2008-10-29 14:49:59 -04:00
ioctl.c Btrfs: Don't call security_inode_mkdir during subvol creation 2008-10-10 10:23:22 -04:00
ioctl.h Btrfs: transaction ioctls 2008-09-25 11:04:03 -04: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
ordered-data.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
ordered-data.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04: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: add and improve comments 2008-09-29 15:18:18 -04:00
struct-funcs.c Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
super.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
sysfs.c Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
transaction.c Btrfs: remove last_log_alloc allocator optimization 2008-10-03 12:24:01 -04:00
transaction.h Btrfs: Record dirty pages tree-log pages in an extent_io tree 2008-09-25 11:04:07 -04:00
tree-defrag.c Btrfs: add and improve comments 2008-09-29 15:18:18 -04:00
tree-log.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04: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: Update version.sh to v0.16 2008-09-25 11:04:06 -04:00
volumes.c Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
volumes.h Btrfs: Fix the multi-bio code to save the original bio for completion 2008-09-25 11:04:06 -04: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: Add zlib compression support 2008-10-29 14:49:59 -04:00