linux/fs/btrfs
Zheng Yan 1a40e23b95 Btrfs: update space balancing code
This patch updates the space balancing code to utilize the new
backref format.  Before, btrfs-vol -b would break any COW links
on data blocks or metadata.  This was slow and caused the amount
of space used to explode if a large number of snapshots were present.

The new code can keeps the sharing of all data extents and
most of the tree blocks.

To maintain the sharing of data extents, the space balance code uses
a seperate inode hold data extent pointers, then updates the references
to point to the new location.

To maintain the sharing of tree blocks, the space balance code uses
reloc trees to relocate tree blocks in reference counted roots.
There is one reloc tree for each subvol, and all reloc trees share
same root key objectid. Reloc trees are snapshots of the latest
committed roots of subvols (root->commit_root).

To relocate a tree block referenced by a subvol, there are two steps.
COW the block through subvol's reloc tree, then update block pointer in
the subvol to point to the new block. Since all reloc trees share
same root key objectid, doing special handing for tree blocks
owned by them is easy. Once a tree block has been COWed in one
reloc tree, we can use the resulting new block directly when the
same block is required to COW again through other reloc trees.
In this way, relocated tree blocks are shared between reloc trees,
so they are also shared between subvols.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-26 10:09:34 -04:00
..
acl.c Btrfs: optimize btrget/set/removexattr 2008-09-25 11:04:07 -04:00
async-thread.c Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
async-thread.h Btrfs: Give all the worker threads descriptive names 2008-09-25 11:04:06 -04:00
bit-radix.c Btrfs: trivial include fixups 2007-07-11 10:00:37 -04:00
bit-radix.h Btrfs: add GPLv2 2007-06-12 09:07:21 -04:00
btrfs_inode.h Btrfs: Dir fsync optimizations 2008-09-25 11:04:07 -04:00
compat.h Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
COPYING Btrfs: add GPLv2 2007-06-12 09:07:21 -04:00
crc32c.h Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
ctree.c Btrfs: update space balancing code 2008-09-26 10:09:34 -04:00
ctree.h Btrfs: update space balancing code 2008-09-26 10:09:34 -04:00
dir-item.c Btrfs: Add a write ahead tree log to optimize synchronous operations 2008-09-25 11:04:07 -04:00
disk-io.c Btrfs: update space balancing code 2008-09-26 10:09:34 -04:00
disk-io.h Btrfs: Tree logging fixes 2008-09-25 11:04:07 -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_io.c Btrfs: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
extent_io.h Btrfs: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
extent_map.c Btrfs: Fix add_extent_mapping to check for duplicates across the whole range 2008-09-25 11:04:06 -04:00
extent_map.h Btrfs: Fix some data=ordered related data corruptions 2008-09-25 11:04:05 -04:00
extent-tree.c Btrfs: update space balancing code 2008-09-26 10:09:34 -04:00
file-item.c Btrfs: Fix variable init during csum creation 2008-09-25 11:04:07 -04:00
file.c Btrfs: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
free-space-cache.c Btrfs: Fix allocation completions in tree log replay 2008-09-25 15:41:59 -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: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
INSTALL Btrfs: Documentation update 2007-06-22 14:49:31 -04:00
ioctl.c Btrfs: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
ioctl.h Btrfs: transaction ioctls 2008-09-25 11:04:03 -04:00
locking.c btrfs_search_slot: reduce lock contention by cowing in two stages 2008-09-25 11:04:06 -04:00
locking.h btrfs_search_slot: reduce lock contention by cowing in two stages 2008-09-25 11:04:06 -04:00
Makefile Update Btrfs files for in-kernel usage 2008-09-25 15:41:59 -04:00
ordered-data.c Btrfs: extent_map and data=ordered fixes for space balancing 2008-09-26 10:05:38 -04:00
ordered-data.h Btrfs: Fix nodatacow for the new data=ordered mode 2008-09-25 11:04:06 -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: Full back reference support 2008-09-25 11:04:07 -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 shared reference cache 2008-09-26 10:04:53 -04:00
ref-cache.h Btrfs: Add shared reference cache 2008-09-26 10:04:53 -04:00
root-tree.c Btrfs: update space balancing code 2008-09-26 10:09:34 -04:00
struct-funcs.c Btrfs: unaligned access fixes 2008-09-25 11:04:00 -04:00
super.c Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
sysfs.c Remove Btrfs compat code for older kernels 2008-09-25 15:41:59 -04:00
TODO Btrfs: add GPLv2 2007-06-12 09:07:21 -04:00
transaction.c Btrfs: update space balancing code 2008-09-26 10:09:34 -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 a write ahead tree log to optimize synchronous operations 2008-09-25 11:04:07 -04:00
tree-log.c Btrfs: Full back reference support 2008-09-25 11:04:07 -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: update space balancing code 2008-09-26 10:09:34 -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