diff options
author | Andi Kleen <andi@firstfloor.org> | 2010-10-29 15:14:31 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-10-29 15:14:31 -0400 |
commit | 411fc6bcef54f828a5458f4730c68abdf13c6bf0 (patch) | |
tree | 89b91cd7e0d7633e9d6e386e388bd0493165f66c | |
parent | d0b678cb0a26783ab7238784f1e7e608e5caafa3 (diff) |
Btrfs: Fix variables set but not read (bugs found by gcc 4.6)
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.
[akpm@linux-foundation.org: fix build. Might have been bitrot]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/dir-item.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 6 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 4 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 2 |
5 files changed, 10 insertions, 6 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index e9103b3baa49..f0cad5ae5be7 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c | |||
@@ -427,5 +427,5 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans, | |||
427 | ret = btrfs_truncate_item(trans, root, path, | 427 | ret = btrfs_truncate_item(trans, root, path, |
428 | item_len - sub_item_len, 1); | 428 | item_len - sub_item_len, 1); |
429 | } | 429 | } |
430 | return 0; | 430 | return ret; |
431 | } | 431 | } |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 4c639e156296..7dc31c39ca59 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2779,6 +2779,8 @@ int extent_prepare_write(struct extent_io_tree *tree, | |||
2779 | NULL, 1, | 2779 | NULL, 1, |
2780 | end_bio_extent_preparewrite, 0, | 2780 | end_bio_extent_preparewrite, 0, |
2781 | 0, 0); | 2781 | 0, 0); |
2782 | if (ret && !err) | ||
2783 | err = ret; | ||
2782 | iocount++; | 2784 | iocount++; |
2783 | block_start = block_start + iosize; | 2785 | block_start = block_start + iosize; |
2784 | } else { | 2786 | } else { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9f08136b10c4..0aa24717cd58 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1389,7 +1389,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | |||
1389 | 1389 | ||
1390 | if (map_length < length + size) | 1390 | if (map_length < length + size) |
1391 | return 1; | 1391 | return 1; |
1392 | return 0; | 1392 | return ret; |
1393 | } | 1393 | } |
1394 | 1394 | ||
1395 | /* | 1395 | /* |
@@ -2709,8 +2709,8 @@ static int check_path_shared(struct btrfs_root *root, | |||
2709 | { | 2709 | { |
2710 | struct extent_buffer *eb; | 2710 | struct extent_buffer *eb; |
2711 | int level; | 2711 | int level; |
2712 | int ret; | ||
2713 | u64 refs = 1; | 2712 | u64 refs = 1; |
2713 | int uninitialized_var(ret); | ||
2714 | 2714 | ||
2715 | for (level = 0; level < BTRFS_MAX_LEVEL; level++) { | 2715 | for (level = 0; level < BTRFS_MAX_LEVEL; level++) { |
2716 | if (!path->nodes[level]) | 2716 | if (!path->nodes[level]) |
@@ -2723,7 +2723,7 @@ static int check_path_shared(struct btrfs_root *root, | |||
2723 | if (refs > 1) | 2723 | if (refs > 1) |
2724 | return 1; | 2724 | return 1; |
2725 | } | 2725 | } |
2726 | return 0; | 2726 | return ret; /* XXX callers? */ |
2727 | } | 2727 | } |
2728 | 2728 | ||
2729 | /* | 2729 | /* |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index fd0714475db7..045c9c2b2d7e 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3094,6 +3094,8 @@ static int add_tree_block(struct reloc_control *rc, | |||
3094 | BUG_ON(item_size != sizeof(struct btrfs_extent_item_v0)); | 3094 | BUG_ON(item_size != sizeof(struct btrfs_extent_item_v0)); |
3095 | ret = get_ref_objectid_v0(rc, path, extent_key, | 3095 | ret = get_ref_objectid_v0(rc, path, extent_key, |
3096 | &ref_owner, NULL); | 3096 | &ref_owner, NULL); |
3097 | if (ret < 0) | ||
3098 | return ret; | ||
3097 | BUG_ON(ref_owner >= BTRFS_MAX_LEVEL); | 3099 | BUG_ON(ref_owner >= BTRFS_MAX_LEVEL); |
3098 | level = (int)ref_owner; | 3100 | level = (int)ref_owner; |
3099 | /* FIXME: get real generation */ | 3101 | /* FIXME: get real generation */ |
@@ -4218,7 +4220,7 @@ int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len) | |||
4218 | btrfs_add_ordered_sum(inode, ordered, sums); | 4220 | btrfs_add_ordered_sum(inode, ordered, sums); |
4219 | } | 4221 | } |
4220 | btrfs_put_ordered_extent(ordered); | 4222 | btrfs_put_ordered_extent(ordered); |
4221 | return 0; | 4223 | return ret; |
4222 | } | 4224 | } |
4223 | 4225 | ||
4224 | void btrfs_reloc_cow_block(struct btrfs_trans_handle *trans, | 4226 | void btrfs_reloc_cow_block(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index fb102a9aee9c..224fb5b3daad 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2273,7 +2273,7 @@ fail: | |||
2273 | } | 2273 | } |
2274 | btrfs_end_log_trans(root); | 2274 | btrfs_end_log_trans(root); |
2275 | 2275 | ||
2276 | return 0; | 2276 | return err; |
2277 | } | 2277 | } |
2278 | 2278 | ||
2279 | /* see comments for btrfs_del_dir_entries_in_log */ | 2279 | /* see comments for btrfs_del_dir_entries_in_log */ |