Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Filipe Manana and committed by
Chris Mason
1f21ef0a 35045bf2

+6
+6
fs/btrfs/disk-io.c
··· 3738 3738 __percpu_counter_add(&root->fs_info->dirty_metadata_bytes, 3739 3739 buf->len, 3740 3740 root->fs_info->dirty_metadata_batch); 3741 + #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 3742 + if (btrfs_header_level(buf) == 0 && check_leaf(root, buf)) { 3743 + btrfs_print_leaf(root, buf); 3744 + ASSERT(0); 3745 + } 3746 + #endif 3741 3747 } 3742 3748 3743 3749 static void __btrfs_btree_balance_dirty(struct btrfs_root *root,