From patchwork Wed Nov 4 19:03:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 57750 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 nA4JCW0h006234 for ; Wed, 4 Nov 2009 19:12:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752517AbZKDTMW (ORCPT ); Wed, 4 Nov 2009 14:12:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755558AbZKDTMW (ORCPT ); Wed, 4 Nov 2009 14:12:22 -0500 Received: from cpe-66-66-77-145.rochester.res.rr.com ([66.66.77.145]:38315 "EHLO galileo.lan.jeffreymahoney.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755091AbZKDTMV (ORCPT ); Wed, 4 Nov 2009 14:12:21 -0500 X-Greylist: delayed 474 seconds by postgrey-1.27 at vger.kernel.org; Wed, 04 Nov 2009 14:12:21 EST Received: by galileo.lan.jeffreymahoney.com (Postfix, from userid 1000) id 7A5A686E; Wed, 4 Nov 2009 14:04:32 -0500 (EST) Message-Id: <20091104190432.207450064@suse.com> User-Agent: quilt/0.48-4.4 Date: Wed, 04 Nov 2009 14:03:47 -0500 From: Jeff Mahoney To: linux-btrfs@vger.kernel.org Subject: [patch 01/10] btrfs: fix btrfs_read_block_groups return value References: <20091104190346.971762946@suse.com> Content-Disposition: inline; filename=btrfs-fix-btrfs_read_block_groups-return-value Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7339,7 +7339,7 @@ int btrfs_free_block_groups(struct btrfs int btrfs_read_block_groups(struct btrfs_root *root) { struct btrfs_path *path; - int ret; + int ret, found = 0; struct btrfs_block_group_cache *cache; struct btrfs_fs_info *info = root->fs_info; struct btrfs_space_info *space_info; @@ -7357,12 +7357,13 @@ int btrfs_read_block_groups(struct btrfs while (1) { ret = find_first_block_group(root, path, &key); - if (ret > 0) { + if (ret > 0 || (found && ret == -ENOENT)) { ret = 0; - goto error; + break; } + if (ret != 0) - goto error; + break; leaf = path->nodes[0]; btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); @@ -7439,9 +7440,8 @@ int btrfs_read_block_groups(struct btrfs set_avail_alloc_bits(root->fs_info, cache->flags); if (btrfs_chunk_readonly(root, cache->key.objectid)) set_block_group_readonly(cache); + found = 1; } - ret = 0; -error: btrfs_free_path(path); return ret; }