linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zach Brown <zab@redhat.com>
To: linux-btrfs@vger.kernel.org, Eric Sandeen <sandeen@redhat.com>
Subject: [PATCH 06/12] btrfs-progs: remove dead block group checking
Date: Mon,  7 Oct 2013 14:42:59 -0700	[thread overview]
Message-ID: <1381182185-10896-7-git-send-email-zab@redhat.com> (raw)
In-Reply-To: <1381182185-10896-1-git-send-email-zab@redhat.com>

Don't carry around dead code.  If its needed again, it's only a few git
commands away.  This was found by static analysis.

Signed-off-by: Zach Brown <zab@redhat.com>
---
 cmds-check.c | 50 --------------------------------------------------
 1 file changed, 50 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index c91cc4a..ebba58e 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -4937,55 +4937,6 @@ static void free_corrupt_block(struct cache_extent *cache)
 
 FREE_EXTENT_CACHE_BASED_TREE(corrupt_blocks, free_corrupt_block);
 
-static int check_block_group(struct btrfs_trans_handle *trans,
-			      struct btrfs_fs_info *info,
-			      struct map_lookup *map,
-			      int *reinit)
-{
-	struct btrfs_key key;
-	struct btrfs_path path;
-	int ret;
-
-	key.objectid = map->ce.start;
-	key.offset = map->ce.size;
-	key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;
-
-	btrfs_init_path(&path);
-	ret = btrfs_search_slot(NULL, info->extent_root,
-				&key, &path, 0, 0);
-	btrfs_release_path(&path);
-	if (ret <= 0)
-		goto out;
-
-	ret = btrfs_make_block_group(trans, info->extent_root, 0, map->type,
-			       BTRFS_FIRST_CHUNK_TREE_OBJECTID,
-			       key.objectid, key.offset);
-	*reinit = 1;
-out:
-	return ret;
-}
-
-static int check_block_groups(struct btrfs_trans_handle *trans,
-			      struct btrfs_fs_info *info, int *reinit)
-{
-	struct cache_extent *ce;
-	struct map_lookup *map;
-	struct btrfs_mapping_tree *map_tree = &info->mapping_tree;
-
-	/* this isn't quite working */
-	return 0;
-
-	ce = search_cache_extent(&map_tree->cache_tree, 0);
-	while (1) {
-		if (!ce)
-			break;
-		map = container_of(ce, struct map_lookup, ce);
-		check_block_group(trans, info, map, reinit);
-		ce = next_cache_extent(ce);
-	}
-	return 0;
-}
-
 static void reset_cached_block_groups(struct btrfs_fs_info *fs_info)
 {
 	struct btrfs_block_group_cache *cache;
@@ -5047,7 +4998,6 @@ static int check_extent_refs(struct btrfs_trans_handle *trans,
 			cache = next_cache_extent(cache);
 		}
 		prune_corrupt_blocks(trans, root->fs_info);
-		check_block_groups(trans, root->fs_info, &reinit);
 		if (reinit)
 			btrfs_read_block_groups(root->fs_info->extent_root);
 		reset_cached_block_groups(root->fs_info);
-- 
1.7.11.7


  parent reply	other threads:[~2013-10-07 21:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-07 21:42 [RFC] another round of static analysis fixes Zach Brown
2013-10-07 21:42 ` [PATCH 01/12] btrfs-progs: check path alloc in corrupt block Zach Brown
2013-10-07 21:42 ` [PATCH 02/12] btrfs-progs: check fopen failure in cmds-send Zach Brown
2013-10-08  8:41   ` Stefan Behrens
2013-10-08 16:44     ` Zach Brown
2013-10-08 17:19     ` Zach Brown
2013-10-07 21:42 ` [PATCH 03/12] btrfs-progs: don't overrun name in find-collisions Zach Brown
2013-10-07 21:42 ` [PATCH 04/12] btrfs-progs: don't overflow read buffer in image Zach Brown
2013-10-07 21:42 ` [PATCH 05/12] btrfs-progs: check link_subvol name base Zach Brown
2013-10-07 21:42 ` Zach Brown [this message]
2013-10-07 21:43 ` [PATCH 07/12] btrfs-progs: free eb in fixup_chunk_tree_block() Zach Brown
2013-10-07 21:43 ` [PATCH 08/12] btrfs-progs: don't leak path in verify_space_cache Zach Brown
2013-10-08  5:18   ` chandan
2013-10-07 21:43 ` [PATCH 09/12] btrfs-progs: don't deref pipefd[-1] Zach Brown
2013-10-07 21:45   ` Eric Sandeen
2013-10-07 21:47     ` Zach Brown
2013-10-07 21:43 ` [PATCH 10/12] btrfs-progs: don't overflow colors[] in fragments Zach Brown
2013-10-07 21:43 ` [PATCH 11/12] btrfs-progs: remove unused variables Zach Brown
2013-10-07 21:43 ` [PATCH 12/12] btrfs-progs: free leaked roots in calc-size Zach Brown
2013-10-08 16:38 ` [RFC] another round of static analysis fixes David Sterba
2013-10-08 17:20   ` Zach Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381182185-10896-7-git-send-email-zab@redhat.com \
    --to=zab@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).