aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2011-03-23 04:14:16 -0400
committerroot <Chris Mason chris.mason@oracle.com>2011-03-28 05:37:35 -0400
commitdb5b493ac78e46c7b6bad22cd25d8041564cd8ea (patch)
tree18f484c3d8194b80165e5400831931a3ac5c58ba /fs/btrfs/tree-log.c
parent1abe9b8a138c9988ba8f7bfded6453649a31541f (diff)
Btrfs: cleanup some BUG_ON()
This patch changes some BUG_ON() to the error return. (but, most callers still use BUG_ON()) Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 429cfcfadf90..f9425e33e358 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1828,7 +1828,8 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
1828 int orig_level; 1828 int orig_level;
1829 1829
1830 path = btrfs_alloc_path(); 1830 path = btrfs_alloc_path();
1831 BUG_ON(!path); 1831 if (!path)
1832 return -ENOMEM;
1832 1833
1833 level = btrfs_header_level(log->node); 1834 level = btrfs_header_level(log->node);
1834 orig_level = level; 1835 orig_level = level;
@@ -3114,9 +3115,11 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
3114 .stage = 0, 3115 .stage = 0,
3115 }; 3116 };
3116 3117
3117 fs_info->log_root_recovering = 1;
3118 path = btrfs_alloc_path(); 3118 path = btrfs_alloc_path();
3119 BUG_ON(!path); 3119 if (!path)
3120 return -ENOMEM;
3121
3122 fs_info->log_root_recovering = 1;
3120 3123
3121 trans = btrfs_start_transaction(fs_info->tree_root, 0); 3124 trans = btrfs_start_transaction(fs_info->tree_root, 0);
3122 BUG_ON(IS_ERR(trans)); 3125 BUG_ON(IS_ERR(trans));
@@ -3124,7 +3127,8 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
3124 wc.trans = trans; 3127 wc.trans = trans;
3125 wc.pin = 1; 3128 wc.pin = 1;
3126 3129
3127 walk_log_tree(trans, log_root_tree, &wc); 3130 ret = walk_log_tree(trans, log_root_tree, &wc);
3131 BUG_ON(ret);
3128 3132
3129again: 3133again:
3130 key.objectid = BTRFS_TREE_LOG_OBJECTID; 3134 key.objectid = BTRFS_TREE_LOG_OBJECTID;
@@ -3148,8 +3152,7 @@ again:
3148 3152
3149 log = btrfs_read_fs_root_no_radix(log_root_tree, 3153 log = btrfs_read_fs_root_no_radix(log_root_tree,
3150 &found_key); 3154 &found_key);
3151 BUG_ON(!log); 3155 BUG_ON(IS_ERR(log));
3152
3153 3156
3154 tmp_key.objectid = found_key.offset; 3157 tmp_key.objectid = found_key.offset;
3155 tmp_key.type = BTRFS_ROOT_ITEM_KEY; 3158 tmp_key.type = BTRFS_ROOT_ITEM_KEY;