Skip to content

Commit

Permalink
Btrfs: Allocator fix variety pack
Browse files Browse the repository at this point in the history
* Force chunk allocation when find_free_extent has to do a full scan
* Record the max key at the start of defrag so it doesn't run forever
* Block groups might not be contiguous, make a forward search for the
  next block group in extent-tree.c
* Get rid of extra checks for total fs size
* Fix relocate_one_reference to avoid relocating the same file data block
  twice when referenced by an older transaction
* Use the open device count when allocating chunks so that we don't
  try to allocate from devices that don't exist

Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
chrismason-xx committed Sep 25, 2008
1 parent 515dc32 commit 0ef3e66
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 97 deletions.
2 changes: 1 addition & 1 deletion fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
other = btrfs_node_blockptr(parent, i - 1);
close = close_blocks(blocknr, other, blocksize);
}
if (close && i < end_slot - 2) {
if (!close && i < end_slot - 2) {
other = btrfs_node_blockptr(parent, i + 1);
close = close_blocks(blocknr, other, blocksize);
}
Expand Down
2 changes: 2 additions & 0 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ struct btrfs_space_info {
u64 bytes_used;
u64 bytes_pinned;
int full;
int force_alloc;
struct list_head list;
};

Expand Down Expand Up @@ -589,6 +590,7 @@ struct btrfs_root {
int ref_cows;
int track_dirty;
struct btrfs_key defrag_progress;
struct btrfs_key defrag_max;
int defrag_running;
int defrag_level;
char *name;
Expand Down
Loading

0 comments on commit 0ef3e66

Please sign in to comment.