From: Andi Kleen <andi@firstfloor.org>
To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [12/23] BTRFS: Clean up unused variables -- bugs
Date: Thu, 10 Jun 2010 13:10:48 +0200 (CEST) [thread overview]
Message-ID: <20100610111048.24CCFB1A2B@basil.firstfloor.org> (raw)
In-Reply-To: <20100610110.764742110@firstfloor.org>
These are all the cases where a variable is set, but not
read which are really bugs.
- Couple of incorrect error handling fixed.
- One incorrect use of a allocation policy
- Some other things
Still needs more review.
Found by gcc 4.6's new warnings
Cc: chris.mason@oracle.com
cc: linux-btrfs@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
fs/btrfs/dir-item.c | 2 +-
fs/btrfs/extent-tree.c | 3 +--
fs/btrfs/extent_io.c | 2 ++
fs/btrfs/inode.c | 6 +++---
fs/btrfs/relocation.c | 4 +++-
fs/btrfs/tree-log.c | 2 +-
6 files changed, 11 insertions(+), 8 deletions(-)
Index: linux-2.6.35-rc2-gcc/fs/btrfs/extent-tree.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/fs/btrfs/extent-tree.c
+++ linux-2.6.35-rc2-gcc/fs/btrfs/extent-tree.c
@@ -3337,8 +3337,7 @@ struct btrfs_block_rsv *btrfs_alloc_bloc
btrfs_init_block_rsv(block_rsv);
alloc_target = btrfs_get_alloc_profile(root, 0);
- block_rsv->space_info = __find_space_info(fs_info,
- BTRFS_BLOCK_GROUP_METADATA);
+ block_rsv->space_info = __find_space_info(fs_info, alloc_target);
return block_rsv;
}
Index: linux-2.6.35-rc2-gcc/fs/btrfs/dir-item.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/fs/btrfs/dir-item.c
+++ linux-2.6.35-rc2-gcc/fs/btrfs/dir-item.c
@@ -427,5 +427,5 @@ int btrfs_delete_one_dir_name(struct btr
ret = btrfs_truncate_item(trans, root, path,
item_len - sub_item_len, 1);
}
- return 0;
+ return ret;
}
Index: linux-2.6.35-rc2-gcc/fs/btrfs/extent_io.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/fs/btrfs/extent_io.c
+++ linux-2.6.35-rc2-gcc/fs/btrfs/extent_io.c
@@ -2825,6 +2825,8 @@ int extent_prepare_write(struct extent_i
NULL, 1,
end_bio_extent_preparewrite, 0,
0, 0);
+ if (ret && !err)
+ err = ret;
iocount++;
block_start = block_start + iosize;
} else {
Index: linux-2.6.35-rc2-gcc/fs/btrfs/inode.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/fs/btrfs/inode.c
+++ linux-2.6.35-rc2-gcc/fs/btrfs/inode.c
@@ -1372,7 +1372,7 @@ int btrfs_merge_bio_hook(struct page *pa
if (map_length < length + size)
return 1;
- return 0;
+ return ret;
}
/*
@@ -2672,7 +2672,7 @@ static int check_path_shared(struct btrf
{
struct extent_buffer *eb;
int level;
- int ret;
+ int ret = 0;
u64 refs;
for (level = 0; level < BTRFS_MAX_LEVEL; level++) {
@@ -2686,7 +2686,7 @@ static int check_path_shared(struct btrf
if (refs > 1)
return 1;
}
- return 0;
+ return ret; /* XXX callers? */
}
/*
Index: linux-2.6.35-rc2-gcc/fs/btrfs/tree-log.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/fs/btrfs/tree-log.c
+++ linux-2.6.35-rc2-gcc/fs/btrfs/tree-log.c
@@ -2273,7 +2273,7 @@ fail:
}
btrfs_end_log_trans(root);
- return 0;
+ return err;
}
/* see comments for btrfs_del_dir_entries_in_log */
Index: linux-2.6.35-rc2-gcc/fs/btrfs/relocation.c
===================================================================
--- linux-2.6.35-rc2-gcc.orig/fs/btrfs/relocation.c
+++ linux-2.6.35-rc2-gcc/fs/btrfs/relocation.c
@@ -3098,6 +3098,8 @@ static int add_tree_block(struct reloc_c
BUG_ON(item_size != sizeof(struct btrfs_extent_item_v0));
ret = get_ref_objectid_v0(rc, path, extent_key,
&ref_owner, NULL);
+ if (ret < 0)
+ return ret;
BUG_ON(ref_owner >= BTRFS_MAX_LEVEL);
level = (int)ref_owner;
/* FIXME: get real generation */
@@ -4142,7 +4144,7 @@ int btrfs_reloc_clone_csums(struct inode
btrfs_add_ordered_sum(inode, ordered, sums);
}
btrfs_put_ordered_extent(ordered);
- return 0;
+ return ret;
}
void btrfs_reloc_cow_block(struct btrfs_trans_handle *trans,
next prev parent reply other threads:[~2010-06-10 11:13 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 11:10 [PATCH] [0/23] Fix gcc 4.6 set but unused variable warnings Andi Kleen
2010-06-10 11:10 ` [PATCH] [1/23] x86: percpu: Avoid warnings of unused variables in per cpu Andi Kleen
2010-06-10 11:14 ` Tejun Heo
2010-06-10 12:09 ` Ingo Molnar
2010-06-10 17:43 ` Justin P. Mattock
2010-06-10 18:10 ` Andi Kleen
2010-06-10 18:26 ` Justin P. Mattock
2010-06-10 20:10 ` Justin P. Mattock
2010-06-10 12:24 ` [tip:x86/urgent] percpu, x86: " tip-bot for Andi Kleen
2010-06-10 11:10 ` [PATCH] [2/23] IRQ: Move alloc_desk_mask variables inside ifdef Andi Kleen
2010-06-10 11:10 ` [PATCH] [3/23] x86: Avoid unused by set variables in rdmsr Andi Kleen
2010-06-10 11:10 ` [PATCH] [4/23] pagemap: Avoid unused-but-set variable Andi Kleen
2010-06-18 23:28 ` Andrew Morton
2010-06-19 7:44 ` Andi Kleen
2010-06-10 11:10 ` [PATCH] [5/23] x86 boot: Set ax register in boot vga query Andi Kleen
2010-06-10 17:13 ` H. Peter Anvin
2010-06-10 23:42 ` [tip:x86/urgent] x86, setup: " tip-bot for Andi Kleen
2010-06-10 11:10 ` [PATCH] [6/23] perf: Fix set but unused variables in perf Andi Kleen
2010-06-10 11:10 ` [PATCH] [7/23] x86: fix set but not read variables Andi Kleen
2010-06-10 11:10 ` [PATCH] [8/23] KGDB: Remove set but unused newPC Andi Kleen
2010-07-30 11:59 ` Jason Wessel
2010-06-10 11:10 ` [PATCH] [9/23] PRINTK: Use stable variable to dump kmsg buffer Andi Kleen
2010-06-10 11:10 ` [PATCH] [10/23] SCHED: Only allocate per cpu cpu mask buffer with offstack cpumasks Andi Kleen
2010-06-10 14:43 ` Peter Zijlstra
2010-06-10 14:52 ` Andi Kleen
2010-06-10 14:55 ` Peter Zijlstra
2010-06-10 15:06 ` Andi Kleen
2010-06-10 15:19 ` Peter Zijlstra
2010-06-10 15:34 ` Andi Kleen
2010-06-10 11:10 ` [PATCH] [11/23] KVM: Fix KVM_SET_SIGNAL_MASK Andi Kleen
2010-06-10 14:16 ` Avi Kivity
2010-06-10 11:10 ` Andi Kleen [this message]
2010-06-10 11:10 ` [PATCH] [13/23] BTRFS: Clean up unused variables -- nonbugs Andi Kleen
2010-06-10 11:10 ` [PATCH] [14/23] NFSD: Fix initialized but not read warnings Andi Kleen
2010-06-10 11:10 ` [PATCH] [15/23] EXT4: Fix initialized but not read variables Andi Kleen
2010-06-14 17:20 ` tytso
2010-06-10 11:10 ` [PATCH] [16/23] XFS: Fix gcc 4.6 set but not read and unused statement warnings Andi Kleen
2010-06-11 16:20 ` Christoph Hellwig
2010-06-11 16:36 ` Andi Kleen
2010-06-14 4:27 ` Dave Chinner
2010-06-14 7:43 ` Andi Kleen
2010-06-14 13:37 ` Dave Chinner
2010-06-14 14:37 ` Andi Kleen
2010-06-14 22:24 ` Dave Chinner
2010-06-15 7:02 ` Andi Kleen
2010-06-15 7:40 ` Christoph Hellwig
2010-06-15 7:46 ` Andi Kleen
2010-06-10 11:10 ` [PATCH] [17/23] EXT3: Fix set but unused variables Andi Kleen
2010-06-14 17:21 ` tytso
2010-06-14 17:27 ` tytso
2010-06-15 14:01 ` Jan Kara
2010-06-10 11:10 ` [PATCH] [18/23] ACPI: Fix unused but set variables in ACPI Andi Kleen
2010-06-10 11:10 ` [PATCH] [19/23] KVM: Fix unused but set warnings Andi Kleen
2010-06-10 14:19 ` Avi Kivity
2010-06-10 11:10 ` [PATCH] [20/23] MM: " Andi Kleen
2010-06-10 11:10 ` [PATCH] [21/23] kernel/*: " Andi Kleen
2010-06-10 11:10 ` [PATCH] [22/23] BLOCK: Fix unused but set variables in blk-merge Andi Kleen
2010-06-10 11:10 ` [PATCH] [23/23] FS: Fix unused but set warnings Andi Kleen
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=20100610111048.24CCFB1A2B@basil.firstfloor.org \
--to=andi@firstfloor.org \
--cc=akpm@linux-foundation.org \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome