aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-io-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2022-09-09 17:53:25 -0400
committerDavid Sterba <dsterba@suse.com>2022-09-26 12:28:03 +0200
commit6962541e964ff3004515dad65de92ec63ff4c182 (patch)
tree7e2509072fd6adc47d87ca814cb0794a36e8aac9 /fs/btrfs/extent-io-tree.c
parentec39e39bbf97105c5ae95af485663a927dd07565 (diff)
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: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-io-tree.c')
-rw-r--r--fs/btrfs/extent-io-tree.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
index 4688f67fd8e6..b487a9e4aaa7 100644
--- a/fs/btrfs/extent-io-tree.c
+++ b/fs/btrfs/extent-io-tree.c
@@ -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)