Btrfs: Add run time btree defrag, and an ioctl to force btree defrag
This adds two types of btree defrag, a run time form that tries to defrag recently allocated blocks in the btree when they are still in ram, and an ioctl that forces defrag of all btree blocks. File data blocks are not defragged yet, but this can make a huge difference in sequential btree reads. Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
committed by
David Woodhouse
parent
3c69faecb8
commit
6702ed490c
@@ -512,7 +512,7 @@ static int prepare_pages(struct btrfs_root *root,
|
||||
if (isize >= PAGE_CACHE_SIZE || pos + write_bytes < inode->i_size ||
|
||||
pos + write_bytes - start_pos > BTRFS_MAX_INLINE_DATA_SIZE(root)) {
|
||||
err = btrfs_alloc_extent(trans, root, inode->i_ino,
|
||||
num_blocks, hint_block, (u64)-1,
|
||||
num_blocks, 0, hint_block, (u64)-1,
|
||||
&ins, 1);
|
||||
if (err)
|
||||
goto failed_truncate;
|
||||
|
Reference in New Issue
Block a user