summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@gmail.com>2014-04-09 15:37:06 +0100
committerChris Mason <clm@fb.com>2014-06-09 17:20:45 -0700
commit1f21ef0a34c37de0daf66fce7141b23b88630f29 (patch)
tree121878e59b61dc0b524934b84753984f99eb837c /fs/btrfs/disk-io.c
parent35045bf2fd7c030f2583dbd80a2015f427778bf1 (diff)
downloadop-kernel-dev-1f21ef0a34c37de0daf66fce7141b23b88630f29.zip
op-kernel-dev-1f21ef0a34c37de0daf66fce7141b23b88630f29.tar.gz
Btrfs: check if items are ordered when a leaf is marked dirty
To ease finding bugs during development related to modifying btree leaves in such a way that it makes its items not sorted by key anymore. Since this is an expensive check, it's only enabled if CONFIG_BTRFS_FS_CHECK_INTEGRITY is set, which isn't meant to be enabled for regular users. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f4e7082..e54f0cd 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3738,6 +3738,12 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
__percpu_counter_add(&root->fs_info->dirty_metadata_bytes,
buf->len,
root->fs_info->dirty_metadata_batch);
+#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
+ if (btrfs_header_level(buf) == 0 && check_leaf(root, buf)) {
+ btrfs_print_leaf(root, buf);
+ ASSERT(0);
+ }
+#endif
}
static void __btrfs_btree_balance_dirty(struct btrfs_root *root,
OpenPOWER on IntegriCloud