diff options
Diffstat (limited to 'fs/btrfs/disk-io.h')
-rw-r--r-- | fs/btrfs/disk-io.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index be69ce1b07a2..b71acd6e1e5b 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -63,14 +63,40 @@ struct buffer_head *btrfs_read_dev_super(struct block_device *bdev); | |||
63 | int btrfs_commit_super(struct btrfs_root *root); | 63 | int btrfs_commit_super(struct btrfs_root *root); |
64 | struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, | 64 | struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, |
65 | u64 bytenr, u32 blocksize); | 65 | u64 bytenr, u32 blocksize); |
66 | struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root, | 66 | struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root, |
67 | struct btrfs_key *location); | 67 | struct btrfs_key *location); |
68 | int btrfs_init_fs_root(struct btrfs_root *root); | ||
69 | int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, | ||
70 | struct btrfs_root *root); | ||
68 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, | 71 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, |
69 | struct btrfs_key *location); | 72 | struct btrfs_key *location); |
70 | int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info); | 73 | int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info); |
71 | void btrfs_btree_balance_dirty(struct btrfs_root *root); | 74 | void btrfs_btree_balance_dirty(struct btrfs_root *root); |
72 | void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root); | 75 | void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root); |
73 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root); | 76 | void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info, |
77 | struct btrfs_root *root); | ||
78 | void btrfs_free_fs_root(struct btrfs_root *root); | ||
79 | |||
80 | /* | ||
81 | * This function is used to grab the root, and avoid it is freed when we | ||
82 | * access it. But it doesn't ensure that the tree is not dropped. | ||
83 | * | ||
84 | * If you want to ensure the whole tree is safe, you should use | ||
85 | * fs_info->subvol_srcu | ||
86 | */ | ||
87 | static inline struct btrfs_root *btrfs_grab_fs_root(struct btrfs_root *root) | ||
88 | { | ||
89 | if (atomic_inc_not_zero(&root->refs)) | ||
90 | return root; | ||
91 | return NULL; | ||
92 | } | ||
93 | |||
94 | static inline void btrfs_put_fs_root(struct btrfs_root *root) | ||
95 | { | ||
96 | if (atomic_dec_and_test(&root->refs)) | ||
97 | kfree(root); | ||
98 | } | ||
99 | |||
74 | void btrfs_mark_buffer_dirty(struct extent_buffer *buf); | 100 | void btrfs_mark_buffer_dirty(struct extent_buffer *buf); |
75 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, | 101 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, |
76 | int atomic); | 102 | int atomic); |