Btrfs: Add BH_Defrag to mark buffers that are in need of defragging

This allows the tree walking code to defrag only the newly allocated
buffers, it seems to be a good balance between perfect defragging and the
performance hit of repeatedly reallocating blocks.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason
2007-08-10 14:42:37 -04:00
committed by David Woodhouse
parent e9d0b13b5b
commit f2183bde1a
4 changed files with 18 additions and 11 deletions

View File

@@ -1015,6 +1015,7 @@ check_failed:
ins->objectid = search_start;
ins->offset = 0;
start_found = 0;
path->reada = 1;
ret = btrfs_search_slot(trans, root, ins, path, 0, 0);
if (ret < 0)
@@ -1264,6 +1265,7 @@ struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
WARN_ON(buffer_dirty(buf));
set_buffer_uptodate(buf);
set_buffer_checked(buf);
set_buffer_defrag(buf);
set_radix_bit(&trans->transaction->dirty_pages, buf->b_page->index);
return buf;
}