Skip to content

Commit

Permalink
Btrfs: kill BTRFS_I(inode)->block_group
Browse files Browse the repository at this point in the history
Originally this was going to be used as a way to give hints to the allocator,
but frankly we can get much better hints elsewhere and it's not even used at all
for anything usefull.  In addition to be completely useless, when we initialize
an inode we try and find a freeish block group to set as the inodes block group,
and with a completely full 40gb fs this takes _forever_, so I imagine with say
1tb fs this is just unbearable.  So just axe the thing altoghether, we don't
need it and it saves us 8 bytes in the inode and saves us 500 microseconds per
inode lookup in my testcase.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik committed May 23, 2011
1 parent 7e2355b commit d82a6f1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 110 deletions.
3 changes: 0 additions & 3 deletions fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ struct btrfs_inode {
*/
u64 index_cnt;

/* the start of block group preferred for allocations. */
u64 block_group;

/* the fsync log has some corner cases that mean we have to check
* directories to see if any unlinks have been done before
* the directory was logged. See tree-log.c for all the
Expand Down
3 changes: 1 addition & 2 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2512,8 +2512,7 @@ int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
int btrfs_writepages(struct address_space *mapping,
struct writeback_control *wbc);
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
struct btrfs_root *new_root,
u64 new_dirid, u64 alloc_hint);
struct btrfs_root *new_root, u64 new_dirid);
int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
size_t size, struct bio *bio, unsigned long bio_flags);

Expand Down
10 changes: 2 additions & 8 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5319,6 +5319,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
btrfs_add_free_space(block_group, offset,
search_start - offset);
BUG_ON(offset > search_start);
btrfs_put_block_group(block_group);
break;
loop:
failed_cluster_refill = false;
Expand Down Expand Up @@ -5411,14 +5412,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
ret = -ENOSPC;
} else if (!ins->objectid) {
ret = -ENOSPC;
}

/* we found what we needed */
if (ins->objectid) {
if (!(data & BTRFS_BLOCK_GROUP_DATA))
trans->block_group = block_group->key.objectid;

btrfs_put_block_group(block_group);
} else if (ins->objectid) {
ret = 0;
}

Expand Down
Loading

0 comments on commit d82a6f1

Please sign in to comment.