Upstream-Status: Inappropriate [Backport]
From e3064e90cfd0be823b2da3edff64f97756fcc245 Mon Sep 17 00:00:00 2001
From: Chris Mason <chris.mason@oracle.com>
Date: Mon, 25 Apr 2011 16:31:40 -0400
Subject: [PATCH 5/5] Temporary debugging for dragonn

Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
 btrfsck.c |    3 +++
 disk-io.c |   16 ++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/btrfsck.c b/btrfsck.c
index f760706..cb3dee0 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -855,6 +855,7 @@ static u64 count_csum_range(struct btrfs_root *root, u64 start, u64 len)
 	u64 csum_end;
 	u16 csum_size = btrfs_super_csum_size(&root->fs_info->super_copy);
 
+	return 0;
 	btrfs_init_path(&path);
 
 	key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
@@ -2666,6 +2667,8 @@ static int add_root_to_pending(struct extent_buffer *buf,
 			       struct cache_tree *nodes,
 			       struct btrfs_key *root_key)
 {
+	if (root_key->objectid == 7)
+		return 0;
 	if (btrfs_header_level(buf) > 0)
 		add_pending(nodes, seen, buf->start, buf->len);
 	else
diff --git a/disk-io.c b/disk-io.c
index dc100b0..c242364 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -614,12 +614,12 @@ struct btrfs_fs_info *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
 	u32 stripesize;
 	u64 generation;
 	struct btrfs_key key;
-	struct btrfs_root *tree_root = malloc(sizeof(struct btrfs_root));
-	struct btrfs_root *extent_root = malloc(sizeof(struct btrfs_root));
-	struct btrfs_root *chunk_root = malloc(sizeof(struct btrfs_root));
-	struct btrfs_root *dev_root = malloc(sizeof(struct btrfs_root));
-	struct btrfs_root *csum_root = malloc(sizeof(struct btrfs_root));
-	struct btrfs_fs_info *fs_info = malloc(sizeof(*fs_info));
+	struct btrfs_root *tree_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS);
+	struct btrfs_root *extent_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS);
+	struct btrfs_root *chunk_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS);
+	struct btrfs_root *dev_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS);
+	struct btrfs_root *csum_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS);
+	struct btrfs_fs_info *fs_info = kzalloc(sizeof(*fs_info), GFP_NOFS);
 	int ret;
 	struct btrfs_super_block *disk_super;
 	struct btrfs_fs_devices *fs_devices = NULL;
@@ -767,13 +767,13 @@ struct btrfs_fs_info *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
 		goto fail;
 
 	dev_root->track_dirty = 1;
-
+#if 0
 	ret = find_and_setup_root(tree_root, fs_info,
 				  BTRFS_CSUM_TREE_OBJECTID, csum_root);
 	if (ret)
 		goto fail;
 	csum_root->track_dirty = 1;
-
+#endif
 	ret = find_and_setup_log_root(tree_root, fs_info, disk_super);
 	if (ret)
 		goto fail;
-- 
1.7.2.3

