Btrfs: check if items are ordered when a leaf is marked dirty
[linux-2.6-block.git] / fs / btrfs / disk-io.c
index f4e708239c09302e1ae84c59df2109cb135731b4..e54f0cd5cdf69ca87329abb0e35168fe9ac44626 100644 (file)
@@ -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,