From patchwork Wed Nov 4 19:03:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 57757 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA4JCjOq006315 for ; Wed, 4 Nov 2009 19:12:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757594AbZKDTMb (ORCPT ); Wed, 4 Nov 2009 14:12:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757606AbZKDTMb (ORCPT ); Wed, 4 Nov 2009 14:12:31 -0500 Received: from cpe-66-66-77-145.rochester.res.rr.com ([66.66.77.145]:38322 "EHLO galileo.lan.jeffreymahoney.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755795AbZKDTMW (ORCPT ); Wed, 4 Nov 2009 14:12:22 -0500 Received: by galileo.lan.jeffreymahoney.com (Postfix, from userid 1000) id 06341FC7; Wed, 4 Nov 2009 14:04:32 -0500 (EST) Message-Id: <20091104190432.777456189@suse.com> User-Agent: quilt/0.48-4.4 Date: Wed, 04 Nov 2009 14:03:49 -0500 From: Jeff Mahoney To: linux-btrfs@vger.kernel.org Subject: [patch 03/10] btrfs: fix btrfs_read_fs_root* return values References: <20091104190346.971762946@suse.com> Content-Disposition: inline; filename=btrfs-fix-btrfs_read_fs_root_no_name-retval Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1987,8 +1987,10 @@ struct btrfs_root *open_ctree(struct sup location.offset = (u64)-1; fs_info->fs_root = btrfs_read_fs_root_no_name(fs_info, &location); - if (!fs_info->fs_root) + if (IS_ERR(fs_info->fs_root)) { + err = PTR_ERR(fs_info->fs_root); goto fail_trans_kthread; + } return tree_root; --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6712,7 +6712,7 @@ int btrfs_cleanup_reloc_trees(struct btr location.type = BTRFS_ROOT_ITEM_KEY; reloc_root = btrfs_read_fs_root_no_name(root->fs_info, &location); - BUG_ON(!reloc_root); + BUG_ON(IS_ERR(reloc_root)); btrfs_orphan_cleanup(reloc_root); return 0; } @@ -6757,7 +6757,7 @@ static noinline int init_reloc_tree(stru reloc_root = btrfs_read_fs_root_no_radix(root->fs_info->tree_root, &root_key); - BUG_ON(!reloc_root); + BUG_ON(IS_ERR(reloc_root)); reloc_root->last_trans = trans->transid; reloc_root->commit_root = NULL; reloc_root->ref_tree = &root->fs_info->reloc_ref_tree; @@ -6976,7 +6976,7 @@ static noinline int relocate_one_extent( continue; found_root = read_ref_root(extent_root->fs_info, ref_path); - BUG_ON(!found_root); + BUG_ON(IS_ERR(found_root)); /* * for reference counted tree, only process reference paths * rooted at the latest committed root. --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3042,7 +3042,7 @@ again: log = btrfs_read_fs_root_no_radix(log_root_tree, &found_key); - BUG_ON(!log); + BUG_ON(IS_ERR(log)); tmp_key.objectid = found_key.offset; @@ -3050,7 +3050,7 @@ again: tmp_key.offset = (u64)-1; wc.replay_dest = btrfs_read_fs_root_no_name(fs_info, &tmp_key); - BUG_ON(!wc.replay_dest); + BUG_ON(IS_ERR(wc.replay_dest)); wc.replay_dest->log_root = log; btrfs_record_root_in_trans(trans, wc.replay_dest);