Commit d82a6f1d authored by Josef Bacik's avatar Josef Bacik

Btrfs: kill BTRFS_I(inode)->block_group

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: default avatarJosef Bacik <josef@redhat.com>
parent 7e2355ba
...@@ -120,9 +120,6 @@ struct btrfs_inode { ...@@ -120,9 +120,6 @@ struct btrfs_inode {
*/ */
u64 index_cnt; 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 /* the fsync log has some corner cases that mean we have to check
* directories to see if any unlinks have been done before * directories to see if any unlinks have been done before
* the directory was logged. See tree-log.c for all the * the directory was logged. See tree-log.c for all the
......
...@@ -2512,8 +2512,7 @@ int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end, ...@@ -2512,8 +2512,7 @@ int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
int btrfs_writepages(struct address_space *mapping, int btrfs_writepages(struct address_space *mapping,
struct writeback_control *wbc); struct writeback_control *wbc);
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
struct btrfs_root *new_root, struct btrfs_root *new_root, u64 new_dirid);
u64 new_dirid, u64 alloc_hint);
int btrfs_merge_bio_hook(struct page *page, unsigned long offset, int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
size_t size, struct bio *bio, unsigned long bio_flags); size_t size, struct bio *bio, unsigned long bio_flags);
......
...@@ -5319,6 +5319,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, ...@@ -5319,6 +5319,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
btrfs_add_free_space(block_group, offset, btrfs_add_free_space(block_group, offset,
search_start - offset); search_start - offset);
BUG_ON(offset > search_start); BUG_ON(offset > search_start);
btrfs_put_block_group(block_group);
break; break;
loop: loop:
failed_cluster_refill = false; failed_cluster_refill = false;
...@@ -5411,14 +5412,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, ...@@ -5411,14 +5412,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
ret = -ENOSPC; ret = -ENOSPC;
} else if (!ins->objectid) { } else if (!ins->objectid) {
ret = -ENOSPC; ret = -ENOSPC;
} } else if (ins->objectid) {
/* 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);
ret = 0; ret = 0;
} }
......
This diff is collapsed.
...@@ -413,8 +413,7 @@ static noinline int create_subvol(struct btrfs_root *root, ...@@ -413,8 +413,7 @@ static noinline int create_subvol(struct btrfs_root *root,
btrfs_record_root_in_trans(trans, new_root); btrfs_record_root_in_trans(trans, new_root);
ret = btrfs_create_subvol_root(trans, new_root, new_dirid, ret = btrfs_create_subvol_root(trans, new_root, new_dirid);
BTRFS_I(dir)->block_group);
/* /*
* insert the directory item * insert the directory item
*/ */
......
...@@ -241,7 +241,6 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root, ...@@ -241,7 +241,6 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,
h->transid = cur_trans->transid; h->transid = cur_trans->transid;
h->transaction = cur_trans; h->transaction = cur_trans;
h->blocks_used = 0; h->blocks_used = 0;
h->block_group = 0;
h->bytes_reserved = 0; h->bytes_reserved = 0;
h->delayed_ref_updates = 0; h->delayed_ref_updates = 0;
h->use_count = 1; h->use_count = 1;
......
...@@ -47,7 +47,6 @@ struct btrfs_transaction { ...@@ -47,7 +47,6 @@ struct btrfs_transaction {
struct btrfs_trans_handle { struct btrfs_trans_handle {
u64 transid; u64 transid;
u64 block_group;
u64 bytes_reserved; u64 bytes_reserved;
unsigned long use_count; unsigned long use_count;
unsigned long blocks_reserved; unsigned long blocks_reserved;
...@@ -70,19 +69,6 @@ struct btrfs_pending_snapshot { ...@@ -70,19 +69,6 @@ struct btrfs_pending_snapshot {
struct list_head list; struct list_head list;
}; };
static inline void btrfs_set_trans_block_group(struct btrfs_trans_handle *trans,
struct inode *inode)
{
trans->block_group = BTRFS_I(inode)->block_group;
}
static inline void btrfs_update_inode_block_group(
struct btrfs_trans_handle *trans,
struct inode *inode)
{
BTRFS_I(inode)->block_group = trans->block_group;
}
static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans, static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
struct inode *inode) struct inode *inode)
{ {
......
...@@ -158,8 +158,6 @@ int __btrfs_setxattr(struct btrfs_trans_handle *trans, ...@@ -158,8 +158,6 @@ int __btrfs_setxattr(struct btrfs_trans_handle *trans,
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
btrfs_set_trans_block_group(trans, inode);
ret = do_setxattr(trans, inode, name, value, size, flags); ret = do_setxattr(trans, inode, name, value, size, flags);
if (ret) if (ret)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment