Commit a4055213 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: unexport all the temporary exports for extent-io-tree.c

Now that we've moved everything we can unexport all the temporary
exports, move the random helpers, and mark everything as static again.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d8038a1f
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
static struct kmem_cache *extent_state_cache; static struct kmem_cache *extent_state_cache;
static inline bool extent_state_in_tree(const struct extent_state *state)
{
return !RB_EMPTY_NODE(&state->rb_node);
}
#ifdef CONFIG_BTRFS_DEBUG #ifdef CONFIG_BTRFS_DEBUG
static LIST_HEAD(states); static LIST_HEAD(states);
static DEFINE_SPINLOCK(leak_lock); static DEFINE_SPINLOCK(leak_lock);
...@@ -81,6 +86,12 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller, ...@@ -81,6 +86,12 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,
*/ */
static struct lock_class_key file_extent_tree_class; static struct lock_class_key file_extent_tree_class;
struct tree_entry {
u64 start;
u64 end;
struct rb_node rb_node;
};
void extent_io_tree_init(struct btrfs_fs_info *fs_info, void extent_io_tree_init(struct btrfs_fs_info *fs_info,
struct extent_io_tree *tree, unsigned int owner, struct extent_io_tree *tree, unsigned int owner,
void *private_data) void *private_data)
...@@ -124,7 +135,7 @@ void extent_io_tree_release(struct extent_io_tree *tree) ...@@ -124,7 +135,7 @@ void extent_io_tree_release(struct extent_io_tree *tree)
spin_unlock(&tree->lock); spin_unlock(&tree->lock);
} }
struct extent_state *alloc_extent_state(gfp_t mask) static struct extent_state *alloc_extent_state(gfp_t mask)
{ {
struct extent_state *state; struct extent_state *state;
...@@ -145,7 +156,7 @@ struct extent_state *alloc_extent_state(gfp_t mask) ...@@ -145,7 +156,7 @@ struct extent_state *alloc_extent_state(gfp_t mask)
return state; return state;
} }
struct extent_state *alloc_extent_state_atomic(struct extent_state *prealloc) static struct extent_state *alloc_extent_state_atomic(struct extent_state *prealloc)
{ {
if (!prealloc) if (!prealloc)
prealloc = alloc_extent_state(GFP_ATOMIC); prealloc = alloc_extent_state(GFP_ATOMIC);
...@@ -183,6 +194,16 @@ static int add_extent_changeset(struct extent_state *state, u32 bits, ...@@ -183,6 +194,16 @@ static int add_extent_changeset(struct extent_state *state, u32 bits,
return ret; return ret;
} }
static inline struct extent_state *next_state(struct extent_state *state)
{
struct rb_node *next = rb_next(&state->rb_node);
if (next)
return rb_entry(next, struct extent_state, rb_node);
else
return NULL;
}
/* /*
* Search @tree for an entry that contains @offset. Such entry would have * Search @tree for an entry that contains @offset. Such entry would have
* entry->start <= offset && entry->end >= offset. * entry->start <= offset && entry->end >= offset.
...@@ -200,7 +221,8 @@ static int add_extent_changeset(struct extent_state *state, u32 bits, ...@@ -200,7 +221,8 @@ static int add_extent_changeset(struct extent_state *state, u32 bits,
* If no such entry exists, return pointer to entry that ends before @offset * If no such entry exists, return pointer to entry that ends before @offset
* and fill parameters @node_ret and @parent_ret, ie. does not return NULL. * and fill parameters @node_ret and @parent_ret, ie. does not return NULL.
*/ */
struct rb_node *tree_search_for_insert(struct extent_io_tree *tree, u64 offset, static inline struct rb_node *tree_search_for_insert(struct extent_io_tree *tree,
u64 offset,
struct rb_node ***node_ret, struct rb_node ***node_ret,
struct rb_node **parent_ret) struct rb_node **parent_ret)
{ {
...@@ -247,7 +269,8 @@ struct rb_node *tree_search_for_insert(struct extent_io_tree *tree, u64 offset, ...@@ -247,7 +269,8 @@ struct rb_node *tree_search_for_insert(struct extent_io_tree *tree, u64 offset,
* such entry exists, then return NULL and fill @prev_ret and @next_ret. * such entry exists, then return NULL and fill @prev_ret and @next_ret.
* Otherwise return the found entry and other pointers are left untouched. * Otherwise return the found entry and other pointers are left untouched.
*/ */
struct rb_node *tree_search_prev_next(struct extent_io_tree *tree, u64 offset, static inline struct rb_node *tree_search_prev_next(struct extent_io_tree *tree,
u64 offset,
struct rb_node **prev_ret, struct rb_node **prev_ret,
struct rb_node **next_ret) struct rb_node **next_ret)
{ {
...@@ -313,7 +336,7 @@ static void extent_io_tree_panic(struct extent_io_tree *tree, int err) ...@@ -313,7 +336,7 @@ static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
* *
* This should be called with the tree lock held. * This should be called with the tree lock held.
*/ */
void merge_state(struct extent_io_tree *tree, struct extent_state *state) static void merge_state(struct extent_io_tree *tree, struct extent_state *state)
{ {
struct extent_state *other; struct extent_state *other;
struct rb_node *other_node; struct rb_node *other_node;
...@@ -353,7 +376,8 @@ void merge_state(struct extent_io_tree *tree, struct extent_state *state) ...@@ -353,7 +376,8 @@ void merge_state(struct extent_io_tree *tree, struct extent_state *state)
} }
} }
void set_state_bits(struct extent_io_tree *tree, struct extent_state *state, static void set_state_bits(struct extent_io_tree *tree,
struct extent_state *state,
u32 bits, struct extent_changeset *changeset) u32 bits, struct extent_changeset *changeset)
{ {
u32 bits_to_set = bits & ~EXTENT_CTLBITS; u32 bits_to_set = bits & ~EXTENT_CTLBITS;
...@@ -381,7 +405,8 @@ void set_state_bits(struct extent_io_tree *tree, struct extent_state *state, ...@@ -381,7 +405,8 @@ void set_state_bits(struct extent_io_tree *tree, struct extent_state *state,
* The tree lock is not taken internally. This is a utility function and * The tree lock is not taken internally. This is a utility function and
* probably isn't what you want to call (see set/clear_extent_bit). * probably isn't what you want to call (see set/clear_extent_bit).
*/ */
int insert_state(struct extent_io_tree *tree, struct extent_state *state, static int insert_state(struct extent_io_tree *tree,
struct extent_state *state,
u32 bits, struct extent_changeset *changeset) u32 bits, struct extent_changeset *changeset)
{ {
struct rb_node **node; struct rb_node **node;
...@@ -419,9 +444,10 @@ int insert_state(struct extent_io_tree *tree, struct extent_state *state, ...@@ -419,9 +444,10 @@ int insert_state(struct extent_io_tree *tree, struct extent_state *state,
/* /*
* Insert state to @tree to the location given by @node and @parent. * Insert state to @tree to the location given by @node and @parent.
*/ */
void insert_state_fast(struct extent_io_tree *tree, struct extent_state *state, static void insert_state_fast(struct extent_io_tree *tree,
struct rb_node **node, struct rb_node *parent, struct extent_state *state, struct rb_node **node,
unsigned bits, struct extent_changeset *changeset) struct rb_node *parent, unsigned bits,
struct extent_changeset *changeset)
{ {
set_state_bits(tree, state, bits, changeset); set_state_bits(tree, state, bits, changeset);
rb_link_node(&state->rb_node, parent, node); rb_link_node(&state->rb_node, parent, node);
...@@ -443,7 +469,7 @@ void insert_state_fast(struct extent_io_tree *tree, struct extent_state *state, ...@@ -443,7 +469,7 @@ void insert_state_fast(struct extent_io_tree *tree, struct extent_state *state,
* The tree locks are not taken by this function. They need to be held * The tree locks are not taken by this function. They need to be held
* by the caller. * by the caller.
*/ */
int split_state(struct extent_io_tree *tree, struct extent_state *orig, static int split_state(struct extent_io_tree *tree, struct extent_state *orig,
struct extent_state *prealloc, u64 split) struct extent_state *prealloc, u64 split)
{ {
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
...@@ -488,9 +514,9 @@ int split_state(struct extent_io_tree *tree, struct extent_state *orig, ...@@ -488,9 +514,9 @@ int split_state(struct extent_io_tree *tree, struct extent_state *orig,
* If no bits are set on the state struct after clearing things, the * If no bits are set on the state struct after clearing things, the
* struct is freed and removed from the tree * struct is freed and removed from the tree
*/ */
struct extent_state *clear_state_bit(struct extent_io_tree *tree, static struct extent_state *clear_state_bit(struct extent_io_tree *tree,
struct extent_state *state, u32 bits, struct extent_state *state,
int wake, u32 bits, int wake,
struct extent_changeset *changeset) struct extent_changeset *changeset)
{ {
struct extent_state *next; struct extent_state *next;
......
...@@ -261,51 +261,4 @@ void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start, ...@@ -261,51 +261,4 @@ void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start,
int btrfs_clean_io_failure(struct btrfs_inode *inode, u64 start, int btrfs_clean_io_failure(struct btrfs_inode *inode, u64 start,
struct page *page, unsigned int pg_offset); struct page *page, unsigned int pg_offset);
struct extent_state *alloc_extent_state_atomic(struct extent_state *prealloc);
struct extent_state *alloc_extent_state(gfp_t mask);
static inline bool extent_state_in_tree(const struct extent_state *state)
{
return !RB_EMPTY_NODE(&state->rb_node);
}
struct tree_entry {
u64 start;
u64 end;
struct rb_node rb_node;
};
struct rb_node *tree_search_for_insert(struct extent_io_tree *tree, u64 offset,
struct rb_node ***node_ret,
struct rb_node **parent_ret);
struct rb_node *tree_search_prev_next(struct extent_io_tree *tree, u64 offset,
struct rb_node **prev_ret,
struct rb_node **next_ret);
void merge_state(struct extent_io_tree *tree, struct extent_state *state);
static inline struct extent_state *next_state(struct extent_state *state)
{
struct rb_node *next = rb_next(&state->rb_node);
if (next)
return rb_entry(next, struct extent_state, rb_node);
else
return NULL;
}
struct extent_state *clear_state_bit(struct extent_io_tree *tree,
struct extent_state *state, u32 bits,
int wake,
struct extent_changeset *changeset);
int insert_state(struct extent_io_tree *tree, struct extent_state *state,
u32 bits, struct extent_changeset *changeset);
int split_state(struct extent_io_tree *tree, struct extent_state *orig,
struct extent_state *prealloc, u64 split);
int insert_state(struct extent_io_tree *tree, struct extent_state *state,
u32 bits, struct extent_changeset *changeset);
void insert_state_fast(struct extent_io_tree *tree, struct extent_state *state,
struct rb_node **node, struct rb_node *parent,
unsigned bits, struct extent_changeset *changeset);
void set_state_bits(struct extent_io_tree *tree, struct extent_state *state,
u32 bits, struct extent_changeset *changeset);
#endif /* BTRFS_EXTENT_IO_TREE_H */ #endif /* BTRFS_EXTENT_IO_TREE_H */
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