Commit 6962541e authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: move btrfs_debug_check_extent_io_range into extent-io-tree.c

This helper is used by a lot of the core extent_io_tree helpers, so
temporarily export it and move it into extent-io-tree.c in order to make
it straightforward to migrate the helpers in batches.
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 ec39e39b
......@@ -4,6 +4,7 @@
#include <trace/events/btrfs.h>
#include "ctree.h"
#include "extent-io-tree.h"
#include "btrfs_inode.h"
static struct kmem_cache *extent_state_cache;
......@@ -43,6 +44,24 @@ static inline void btrfs_extent_state_leak_debug_check(void)
kmem_cache_free(extent_state_cache, state);
}
}
void __btrfs_debug_check_extent_io_range(const char *caller,
struct extent_io_tree *tree, u64 start,
u64 end)
{
struct inode *inode = tree->private_data;
u64 isize;
if (!inode || !is_data_inode(inode))
return;
isize = i_size_read(inode);
if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) {
btrfs_debug_rl(BTRFS_I(inode)->root->fs_info,
"%s: ino %llu isize %llu odd range [%llu,%llu]",
caller, btrfs_ino(BTRFS_I(inode)), isize, start, end);
}
}
#else
#define btrfs_leak_debug_add_state(state) do {} while (0)
#define btrfs_leak_debug_del_state(state) do {} while (0)
......
......@@ -269,4 +269,14 @@ static inline bool extent_state_in_tree(const struct extent_state *state)
return !RB_EMPTY_NODE(&state->rb_node);
}
#ifdef CONFIG_BTRFS_DEBUG
void __btrfs_debug_check_extent_io_range(const char *caller,
struct extent_io_tree *tree, u64 start,
u64 end);
#define btrfs_debug_check_extent_io_range(tree, start, end) \
__btrfs_debug_check_extent_io_range(__func__, (tree), (start), (end))
#else
#define btrfs_debug_check_extent_io_range(c, s, e) do {} while (0)
#endif
#endif /* BTRFS_EXTENT_IO_TREE_H */
......@@ -80,29 +80,9 @@ void btrfs_extent_buffer_leak_debug_check(struct btrfs_fs_info *fs_info)
}
spin_unlock_irqrestore(&fs_info->eb_leak_lock, flags);
}
#define btrfs_debug_check_extent_io_range(tree, start, end) \
__btrfs_debug_check_extent_io_range(__func__, (tree), (start), (end))
static inline void __btrfs_debug_check_extent_io_range(const char *caller,
struct extent_io_tree *tree, u64 start, u64 end)
{
struct inode *inode = tree->private_data;
u64 isize;
if (!inode || !is_data_inode(inode))
return;
isize = i_size_read(inode);
if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) {
btrfs_debug_rl(BTRFS_I(inode)->root->fs_info,
"%s: ino %llu isize %llu odd range [%llu,%llu]",
caller, btrfs_ino(BTRFS_I(inode)), isize, start, end);
}
}
#else
#define btrfs_leak_debug_add_eb(eb) do {} while (0)
#define btrfs_leak_debug_del_eb(eb) do {} while (0)
#define btrfs_debug_check_extent_io_range(c, s, e) do {} while (0)
#endif
struct tree_entry {
......
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