aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-12-11 16:30:39 -0500
committerChris Mason <chris.mason@oracle.com>2008-12-11 16:30:39 -0500
commitd2fb3437e4d8d12c73c587615ad187d5288547ec (patch)
tree894e4c698970dd35226b2614b8a38fb8a96580e7 /fs/btrfs/ctree.h
parentcfc8ea87201dc9bb6aeb3fc80c61abee83e7cc06 (diff)
Btrfs: fix leaking block group on balance
The block group structs are referenced in many different places, and it's not safe to free while balancing. So, those block group structs were simply leaked instead. This patch replaces the block group pointer in the inode with the starting byte offset of the block group and adds reference counting to the block group struct. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 5b0c79d22c09..8733081d97a3 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -653,6 +653,9 @@ struct btrfs_block_group_cache {
653 653
654 /* for block groups in the same raid type */ 654 /* for block groups in the same raid type */
655 struct list_head list; 655 struct list_head list;
656
657 /* usage count */
658 atomic_t count;
656}; 659};
657 660
658struct btrfs_leaf_ref_tree { 661struct btrfs_leaf_ref_tree {
@@ -1706,10 +1709,8 @@ int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy);
1706struct btrfs_block_group_cache *btrfs_lookup_block_group(struct 1709struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
1707 btrfs_fs_info *info, 1710 btrfs_fs_info *info,
1708 u64 bytenr); 1711 u64 bytenr);
1709struct btrfs_block_group_cache *btrfs_find_block_group(struct btrfs_root *root, 1712u64 btrfs_find_block_group(struct btrfs_root *root,
1710 struct btrfs_block_group_cache 1713 u64 search_start, u64 search_hint, int owner);
1711 *hint, u64 search_start,
1712 int data, int owner);
1713struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, 1714struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
1714 struct btrfs_root *root, 1715 struct btrfs_root *root,
1715 u32 blocksize, u64 parent, 1716 u32 blocksize, u64 parent,
@@ -1770,6 +1771,7 @@ int btrfs_update_extent_ref(struct btrfs_trans_handle *trans,
1770 u64 owner_objectid); 1771 u64 owner_objectid);
1771int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, 1772int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
1772 struct btrfs_root *root); 1773 struct btrfs_root *root);
1774int btrfs_extent_readonly(struct btrfs_root *root, u64 bytenr);
1773int btrfs_free_block_groups(struct btrfs_fs_info *info); 1775int btrfs_free_block_groups(struct btrfs_fs_info *info);
1774int btrfs_read_block_groups(struct btrfs_root *root); 1776int btrfs_read_block_groups(struct btrfs_root *root);
1775int btrfs_make_block_group(struct btrfs_trans_handle *trans, 1777int btrfs_make_block_group(struct btrfs_trans_handle *trans,
@@ -2019,10 +2021,9 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root);
2019int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end); 2021int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end);
2020int btrfs_writepages(struct address_space *mapping, 2022int btrfs_writepages(struct address_space *mapping,
2021 struct writeback_control *wbc); 2023 struct writeback_control *wbc);
2022int btrfs_create_subvol_root(struct btrfs_root *new_root, struct dentry *dentry, 2024int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
2023 struct btrfs_trans_handle *trans, u64 new_dirid, 2025 struct btrfs_root *new_root, struct dentry *dentry,
2024 struct btrfs_block_group_cache *block_group); 2026 u64 new_dirid, u64 alloc_hint);
2025
2026int btrfs_merge_bio_hook(struct page *page, unsigned long offset, 2027int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
2027 size_t size, struct bio *bio, unsigned long bio_flags); 2028 size_t size, struct bio *bio, unsigned long bio_flags);
2028 2029