aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-10-29 15:14:37 -0400
committerChris Mason <chris.mason@oracle.com>2010-10-29 15:14:37 -0400
commit559af8211433b8c0b20e6c43c61409cb9c9c2996 (patch)
tree702ebd4c4f5b610daa36f65d814a518356a9a46b
parent411fc6bcef54f828a5458f4730c68abdf13c6bf0 (diff)
Btrfs: cleanup warnings from gcc 4.6 (nonbugs)
These are all the cases where a variable is set, but not read which are not bugs as far as I can see, but simply leftovers. Still needs more review. Found by gcc 4.6's new warnings 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/compression.c2
-rw-r--r--fs/btrfs/ctree.c20
-rw-r--r--fs/btrfs/disk-io.c11
-rw-r--r--fs/btrfs/extent-tree.c2
-rw-r--r--fs/btrfs/extent_io.c9
-rw-r--r--fs/btrfs/inode.c14
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/ordered-data.c2
-rw-r--r--fs/btrfs/root-tree.c2
-rw-r--r--fs/btrfs/super.c6
-rw-r--r--fs/btrfs/tree-defrag.c2
-rw-r--r--fs/btrfs/tree-log.c15
-rw-r--r--fs/btrfs/volumes.c4
-rw-r--r--fs/btrfs/xattr.c2
-rw-r--r--fs/btrfs/zlib.c5
15 files changed, 4 insertions, 94 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 396039b3a8a2..7845d1f7d1d9 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -163,7 +163,6 @@ fail:
163 */ 163 */
164static void end_compressed_bio_read(struct bio *bio, int err) 164static void end_compressed_bio_read(struct bio *bio, int err)
165{ 165{
166 struct extent_io_tree *tree;
167 struct compressed_bio *cb = bio->bi_private; 166 struct compressed_bio *cb = bio->bi_private;
168 struct inode *inode; 167 struct inode *inode;
169 struct page *page; 168 struct page *page;
@@ -187,7 +186,6 @@ static void end_compressed_bio_read(struct bio *bio, int err)
187 /* ok, we're the last bio for this extent, lets start 186 /* ok, we're the last bio for this extent, lets start
188 * the decompression. 187 * the decompression.
189 */ 188 */
190 tree = &BTRFS_I(inode)->io_tree;
191 ret = btrfs_zlib_decompress_biovec(cb->compressed_pages, 189 ret = btrfs_zlib_decompress_biovec(cb->compressed_pages,
192 cb->start, 190 cb->start,
193 cb->orig_bio->bi_io_vec, 191 cb->orig_bio->bi_io_vec,
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 6921231e0efb..9ac171599258 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -200,7 +200,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
200 struct extent_buffer **cow_ret, u64 new_root_objectid) 200 struct extent_buffer **cow_ret, u64 new_root_objectid)
201{ 201{
202 struct extent_buffer *cow; 202 struct extent_buffer *cow;
203 u32 nritems;
204 int ret = 0; 203 int ret = 0;
205 int level; 204 int level;
206 struct btrfs_disk_key disk_key; 205 struct btrfs_disk_key disk_key;
@@ -210,7 +209,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
210 WARN_ON(root->ref_cows && trans->transid != root->last_trans); 209 WARN_ON(root->ref_cows && trans->transid != root->last_trans);
211 210
212 level = btrfs_header_level(buf); 211 level = btrfs_header_level(buf);
213 nritems = btrfs_header_nritems(buf);
214 if (level == 0) 212 if (level == 0)
215 btrfs_item_key(buf, &disk_key, 0); 213 btrfs_item_key(buf, &disk_key, 0);
216 else 214 else
@@ -1008,7 +1006,6 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1008 int wret; 1006 int wret;
1009 int pslot; 1007 int pslot;
1010 int orig_slot = path->slots[level]; 1008 int orig_slot = path->slots[level];
1011 int err_on_enospc = 0;
1012 u64 orig_ptr; 1009 u64 orig_ptr;
1013 1010
1014 if (level == 0) 1011 if (level == 0)
@@ -1071,8 +1068,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1071 BTRFS_NODEPTRS_PER_BLOCK(root) / 4) 1068 BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
1072 return 0; 1069 return 0;
1073 1070
1074 if (btrfs_header_nritems(mid) < 2) 1071 btrfs_header_nritems(mid);
1075 err_on_enospc = 1;
1076 1072
1077 left = read_node_slot(root, parent, pslot - 1); 1073 left = read_node_slot(root, parent, pslot - 1);
1078 if (left) { 1074 if (left) {
@@ -1103,8 +1099,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1103 wret = push_node_left(trans, root, left, mid, 1); 1099 wret = push_node_left(trans, root, left, mid, 1);
1104 if (wret < 0) 1100 if (wret < 0)
1105 ret = wret; 1101 ret = wret;
1106 if (btrfs_header_nritems(mid) < 2) 1102 btrfs_header_nritems(mid);
1107 err_on_enospc = 1;
1108 } 1103 }
1109 1104
1110 /* 1105 /*
@@ -1224,14 +1219,12 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
1224 int wret; 1219 int wret;
1225 int pslot; 1220 int pslot;
1226 int orig_slot = path->slots[level]; 1221 int orig_slot = path->slots[level];
1227 u64 orig_ptr;
1228 1222
1229 if (level == 0) 1223 if (level == 0)
1230 return 1; 1224 return 1;
1231 1225
1232 mid = path->nodes[level]; 1226 mid = path->nodes[level];
1233 WARN_ON(btrfs_header_generation(mid) != trans->transid); 1227 WARN_ON(btrfs_header_generation(mid) != trans->transid);
1234 orig_ptr = btrfs_node_blockptr(mid, orig_slot);
1235 1228
1236 if (level < BTRFS_MAX_LEVEL - 1) 1229 if (level < BTRFS_MAX_LEVEL - 1)
1237 parent = path->nodes[level + 1]; 1230 parent = path->nodes[level + 1];
@@ -2567,7 +2560,6 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
2567{ 2560{
2568 struct btrfs_disk_key disk_key; 2561 struct btrfs_disk_key disk_key;
2569 struct extent_buffer *right = path->nodes[0]; 2562 struct extent_buffer *right = path->nodes[0];
2570 int slot;
2571 int i; 2563 int i;
2572 int push_space = 0; 2564 int push_space = 0;
2573 int push_items = 0; 2565 int push_items = 0;
@@ -2579,8 +2571,6 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
2579 u32 this_item_size; 2571 u32 this_item_size;
2580 u32 old_left_item_size; 2572 u32 old_left_item_size;
2581 2573
2582 slot = path->slots[1];
2583
2584 if (empty) 2574 if (empty)
2585 nr = min(right_nritems, max_slot); 2575 nr = min(right_nritems, max_slot);
2586 else 2576 else
@@ -3349,7 +3339,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
3349{ 3339{
3350 int ret = 0; 3340 int ret = 0;
3351 int slot; 3341 int slot;
3352 int slot_orig;
3353 struct extent_buffer *leaf; 3342 struct extent_buffer *leaf;
3354 struct btrfs_item *item; 3343 struct btrfs_item *item;
3355 u32 nritems; 3344 u32 nritems;
@@ -3359,7 +3348,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
3359 unsigned int size_diff; 3348 unsigned int size_diff;
3360 int i; 3349 int i;
3361 3350
3362 slot_orig = path->slots[0];
3363 leaf = path->nodes[0]; 3351 leaf = path->nodes[0];
3364 slot = path->slots[0]; 3352 slot = path->slots[0];
3365 3353
@@ -3464,7 +3452,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
3464{ 3452{
3465 int ret = 0; 3453 int ret = 0;
3466 int slot; 3454 int slot;
3467 int slot_orig;
3468 struct extent_buffer *leaf; 3455 struct extent_buffer *leaf;
3469 struct btrfs_item *item; 3456 struct btrfs_item *item;
3470 u32 nritems; 3457 u32 nritems;
@@ -3473,7 +3460,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
3473 unsigned int old_size; 3460 unsigned int old_size;
3474 int i; 3461 int i;
3475 3462
3476 slot_orig = path->slots[0];
3477 leaf = path->nodes[0]; 3463 leaf = path->nodes[0];
3478 3464
3479 nritems = btrfs_header_nritems(leaf); 3465 nritems = btrfs_header_nritems(leaf);
@@ -3806,7 +3792,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
3806 struct btrfs_key *cpu_key, u32 *data_size, 3792 struct btrfs_key *cpu_key, u32 *data_size,
3807 int nr) 3793 int nr)
3808{ 3794{
3809 struct extent_buffer *leaf;
3810 int ret = 0; 3795 int ret = 0;
3811 int slot; 3796 int slot;
3812 int i; 3797 int i;
@@ -3823,7 +3808,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
3823 if (ret < 0) 3808 if (ret < 0)
3824 goto out; 3809 goto out;
3825 3810
3826 leaf = path->nodes[0];
3827 slot = path->slots[0]; 3811 slot = path->slots[0];
3828 BUG_ON(slot < 0); 3812 BUG_ON(slot < 0);
3829 3813
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 77e5dabfd45a..e163424c7fce 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -338,7 +338,6 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
338 struct extent_io_tree *tree; 338 struct extent_io_tree *tree;
339 u64 start = (u64)page->index << PAGE_CACHE_SHIFT; 339 u64 start = (u64)page->index << PAGE_CACHE_SHIFT;
340 u64 found_start; 340 u64 found_start;
341 int found_level;
342 unsigned long len; 341 unsigned long len;
343 struct extent_buffer *eb; 342 struct extent_buffer *eb;
344 int ret; 343 int ret;
@@ -369,8 +368,6 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
369 WARN_ON(1); 368 WARN_ON(1);
370 goto err; 369 goto err;
371 } 370 }
372 found_level = btrfs_header_level(eb);
373
374 csum_tree_block(root, eb, 0); 371 csum_tree_block(root, eb, 0);
375err: 372err:
376 free_extent_buffer(eb); 373 free_extent_buffer(eb);
@@ -543,11 +540,9 @@ int btrfs_congested_async(struct btrfs_fs_info *info, int iodone)
543 540
544static void run_one_async_start(struct btrfs_work *work) 541static void run_one_async_start(struct btrfs_work *work)
545{ 542{
546 struct btrfs_fs_info *fs_info;
547 struct async_submit_bio *async; 543 struct async_submit_bio *async;
548 544
549 async = container_of(work, struct async_submit_bio, work); 545 async = container_of(work, struct async_submit_bio, work);
550 fs_info = BTRFS_I(async->inode)->root->fs_info;
551 async->submit_bio_start(async->inode, async->rw, async->bio, 546 async->submit_bio_start(async->inode, async->rw, async->bio,
552 async->mirror_num, async->bio_flags, 547 async->mirror_num, async->bio_flags,
553 async->bio_offset); 548 async->bio_offset);
@@ -860,12 +855,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
860 u32 blocksize, u64 parent_transid) 855 u32 blocksize, u64 parent_transid)
861{ 856{
862 struct extent_buffer *buf = NULL; 857 struct extent_buffer *buf = NULL;
863 struct inode *btree_inode = root->fs_info->btree_inode;
864 struct extent_io_tree *io_tree;
865 int ret; 858 int ret;
866 859
867 io_tree = &BTRFS_I(btree_inode)->io_tree;
868
869 buf = btrfs_find_create_tree_block(root, bytenr, blocksize); 860 buf = btrfs_find_create_tree_block(root, bytenr, blocksize);
870 if (!buf) 861 if (!buf)
871 return NULL; 862 return NULL;
@@ -1387,7 +1378,6 @@ static int bio_ready_for_csum(struct bio *bio)
1387 u64 start = 0; 1378 u64 start = 0;
1388 struct page *page; 1379 struct page *page;
1389 struct extent_io_tree *io_tree = NULL; 1380 struct extent_io_tree *io_tree = NULL;
1390 struct btrfs_fs_info *info = NULL;
1391 struct bio_vec *bvec; 1381 struct bio_vec *bvec;
1392 int i; 1382 int i;
1393 int ret; 1383 int ret;
@@ -1406,7 +1396,6 @@ static int bio_ready_for_csum(struct bio *bio)
1406 buf_len = page->private >> 2; 1396 buf_len = page->private >> 2;
1407 start = page_offset(page) + bvec->bv_offset; 1397 start = page_offset(page) + bvec->bv_offset;
1408 io_tree = &BTRFS_I(page->mapping->host)->io_tree; 1398 io_tree = &BTRFS_I(page->mapping->host)->io_tree;
1409 info = BTRFS_I(page->mapping->host)->root->fs_info;
1410 } 1399 }
1411 /* are we fully contained in this bio? */ 1400 /* are we fully contained in this bio? */
1412 if (buf_len <= length) 1401 if (buf_len <= length)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 59c8daaacf0c..df754108b952 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5719,7 +5719,6 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,
5719 u64 generation; 5719 u64 generation;
5720 u64 refs; 5720 u64 refs;
5721 u64 flags; 5721 u64 flags;
5722 u64 last = 0;
5723 u32 nritems; 5722 u32 nritems;
5724 u32 blocksize; 5723 u32 blocksize;
5725 struct btrfs_key key; 5724 struct btrfs_key key;
@@ -5787,7 +5786,6 @@ reada:
5787 generation); 5786 generation);
5788 if (ret) 5787 if (ret)
5789 break; 5788 break;
5790 last = bytenr + blocksize;
5791 nread++; 5789 nread++;
5792 } 5790 }
5793 wc->reada_slot = slot; 5791 wc->reada_slot = slot;
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 7dc31c39ca59..3b7eaee0f912 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1857,10 +1857,8 @@ static int submit_one_bio(int rw, struct bio *bio, int mirror_num,
1857 struct page *page = bvec->bv_page; 1857 struct page *page = bvec->bv_page;
1858 struct extent_io_tree *tree = bio->bi_private; 1858 struct extent_io_tree *tree = bio->bi_private;
1859 u64 start; 1859 u64 start;
1860 u64 end;
1861 1860
1862 start = ((u64)page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset; 1861 start = ((u64)page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset;
1863 end = start + bvec->bv_len - 1;
1864 1862
1865 bio->bi_private = NULL; 1863 bio->bi_private = NULL;
1866 1864
@@ -2160,7 +2158,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
2160 u64 last_byte = i_size_read(inode); 2158 u64 last_byte = i_size_read(inode);
2161 u64 block_start; 2159 u64 block_start;
2162 u64 iosize; 2160 u64 iosize;
2163 u64 unlock_start;
2164 sector_t sector; 2161 sector_t sector;
2165 struct extent_state *cached_state = NULL; 2162 struct extent_state *cached_state = NULL;
2166 struct extent_map *em; 2163 struct extent_map *em;
@@ -2285,7 +2282,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
2285 if (tree->ops && tree->ops->writepage_end_io_hook) 2282 if (tree->ops && tree->ops->writepage_end_io_hook)
2286 tree->ops->writepage_end_io_hook(page, start, 2283 tree->ops->writepage_end_io_hook(page, start,
2287 page_end, NULL, 1); 2284 page_end, NULL, 1);
2288 unlock_start = page_end + 1;
2289 goto done; 2285 goto done;
2290 } 2286 }
2291 2287
@@ -2296,7 +2292,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
2296 if (tree->ops && tree->ops->writepage_end_io_hook) 2292 if (tree->ops && tree->ops->writepage_end_io_hook)
2297 tree->ops->writepage_end_io_hook(page, cur, 2293 tree->ops->writepage_end_io_hook(page, cur,
2298 page_end, NULL, 1); 2294 page_end, NULL, 1);
2299 unlock_start = page_end + 1;
2300 break; 2295 break;
2301 } 2296 }
2302 em = epd->get_extent(inode, page, pg_offset, cur, 2297 em = epd->get_extent(inode, page, pg_offset, cur,
@@ -2343,7 +2338,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
2343 2338
2344 cur += iosize; 2339 cur += iosize;
2345 pg_offset += iosize; 2340 pg_offset += iosize;
2346 unlock_start = cur;
2347 continue; 2341 continue;
2348 } 2342 }
2349 /* leave this out until we have a page_mkwrite call */ 2343 /* leave this out until we have a page_mkwrite call */
@@ -2429,7 +2423,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
2429 pgoff_t index; 2423 pgoff_t index;
2430 pgoff_t end; /* Inclusive */ 2424 pgoff_t end; /* Inclusive */
2431 int scanned = 0; 2425 int scanned = 0;
2432 int range_whole = 0;
2433 2426
2434 pagevec_init(&pvec, 0); 2427 pagevec_init(&pvec, 0);
2435 if (wbc->range_cyclic) { 2428 if (wbc->range_cyclic) {
@@ -2438,8 +2431,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
2438 } else { 2431 } else {
2439 index = wbc->range_start >> PAGE_CACHE_SHIFT; 2432 index = wbc->range_start >> PAGE_CACHE_SHIFT;
2440 end = wbc->range_end >> PAGE_CACHE_SHIFT; 2433 end = wbc->range_end >> PAGE_CACHE_SHIFT;
2441 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
2442 range_whole = 1;
2443 scanned = 1; 2434 scanned = 1;
2444 } 2435 }
2445retry: 2436retry:
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0aa24717cd58..609f3bbbd1ed 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -319,8 +319,6 @@ static noinline int compress_file_range(struct inode *inode,
319 struct btrfs_root *root = BTRFS_I(inode)->root; 319 struct btrfs_root *root = BTRFS_I(inode)->root;
320 struct btrfs_trans_handle *trans; 320 struct btrfs_trans_handle *trans;
321 u64 num_bytes; 321 u64 num_bytes;
322 u64 orig_start;
323 u64 disk_num_bytes;
324 u64 blocksize = root->sectorsize; 322 u64 blocksize = root->sectorsize;
325 u64 actual_end; 323 u64 actual_end;
326 u64 isize = i_size_read(inode); 324 u64 isize = i_size_read(inode);
@@ -335,8 +333,6 @@ static noinline int compress_file_range(struct inode *inode,
335 int i; 333 int i;
336 int will_compress; 334 int will_compress;
337 335
338 orig_start = start;
339
340 actual_end = min_t(u64, isize, end + 1); 336 actual_end = min_t(u64, isize, end + 1);
341again: 337again:
342 will_compress = 0; 338 will_compress = 0;
@@ -371,7 +367,6 @@ again:
371 total_compressed = min(total_compressed, max_uncompressed); 367 total_compressed = min(total_compressed, max_uncompressed);
372 num_bytes = (end - start + blocksize) & ~(blocksize - 1); 368 num_bytes = (end - start + blocksize) & ~(blocksize - 1);
373 num_bytes = max(blocksize, num_bytes); 369 num_bytes = max(blocksize, num_bytes);
374 disk_num_bytes = num_bytes;
375 total_in = 0; 370 total_in = 0;
376 ret = 0; 371 ret = 0;
377 372
@@ -467,7 +462,6 @@ again:
467 if (total_compressed >= total_in) { 462 if (total_compressed >= total_in) {
468 will_compress = 0; 463 will_compress = 0;
469 } else { 464 } else {
470 disk_num_bytes = total_compressed;
471 num_bytes = total_in; 465 num_bytes = total_in;
472 } 466 }
473 } 467 }
@@ -757,8 +751,6 @@ static noinline int cow_file_range(struct inode *inode,
757 u64 disk_num_bytes; 751 u64 disk_num_bytes;
758 u64 cur_alloc_size; 752 u64 cur_alloc_size;
759 u64 blocksize = root->sectorsize; 753 u64 blocksize = root->sectorsize;
760 u64 actual_end;
761 u64 isize = i_size_read(inode);
762 struct btrfs_key ins; 754 struct btrfs_key ins;
763 struct extent_map *em; 755 struct extent_map *em;
764 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 756 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
@@ -770,8 +762,6 @@ static noinline int cow_file_range(struct inode *inode,
770 btrfs_set_trans_block_group(trans, inode); 762 btrfs_set_trans_block_group(trans, inode);
771 trans->block_rsv = &root->fs_info->delalloc_block_rsv; 763 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
772 764
773 actual_end = min_t(u64, isize, end + 1);
774
775 num_bytes = (end - start + blocksize) & ~(blocksize - 1); 765 num_bytes = (end - start + blocksize) & ~(blocksize - 1);
776 num_bytes = max(blocksize, num_bytes); 766 num_bytes = max(blocksize, num_bytes);
777 disk_num_bytes = num_bytes; 767 disk_num_bytes = num_bytes;
@@ -2274,7 +2264,6 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)
2274{ 2264{
2275 struct btrfs_path *path; 2265 struct btrfs_path *path;
2276 struct extent_buffer *leaf; 2266 struct extent_buffer *leaf;
2277 struct btrfs_item *item;
2278 struct btrfs_key key, found_key; 2267 struct btrfs_key key, found_key;
2279 struct btrfs_trans_handle *trans; 2268 struct btrfs_trans_handle *trans;
2280 struct inode *inode; 2269 struct inode *inode;
@@ -2312,7 +2301,6 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)
2312 2301
2313 /* pull out the item */ 2302 /* pull out the item */
2314 leaf = path->nodes[0]; 2303 leaf = path->nodes[0];
2315 item = btrfs_item_nr(leaf, path->slots[0]);
2316 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); 2304 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
2317 2305
2318 /* make sure the item matches what we want */ 2306 /* make sure the item matches what we want */
@@ -5701,7 +5689,6 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
5701 struct btrfs_root *root = BTRFS_I(inode)->root; 5689 struct btrfs_root *root = BTRFS_I(inode)->root;
5702 struct btrfs_dio_private *dip; 5690 struct btrfs_dio_private *dip;
5703 struct bio_vec *bvec = bio->bi_io_vec; 5691 struct bio_vec *bvec = bio->bi_io_vec;
5704 u64 start;
5705 int skip_sum; 5692 int skip_sum;
5706 int write = rw & REQ_WRITE; 5693 int write = rw & REQ_WRITE;
5707 int ret = 0; 5694 int ret = 0;
@@ -5727,7 +5714,6 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
5727 dip->inode = inode; 5714 dip->inode = inode;
5728 dip->logical_offset = file_offset; 5715 dip->logical_offset = file_offset;
5729 5716
5730 start = dip->logical_offset;
5731 dip->bytes = 0; 5717 dip->bytes = 0;
5732 do { 5718 do {
5733 dip->bytes += bvec->bv_len; 5719 dip->bytes += bvec->bv_len;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8079ebfeaf50..60f662c4778b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -708,7 +708,6 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
708 char *sizestr; 708 char *sizestr;
709 char *devstr = NULL; 709 char *devstr = NULL;
710 int ret = 0; 710 int ret = 0;
711 int namelen;
712 int mod = 0; 711 int mod = 0;
713 712
714 if (root->fs_info->sb->s_flags & MS_RDONLY) 713 if (root->fs_info->sb->s_flags & MS_RDONLY)
@@ -722,7 +721,6 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
722 return PTR_ERR(vol_args); 721 return PTR_ERR(vol_args);
723 722
724 vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; 723 vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
725 namelen = strlen(vol_args->name);
726 724
727 mutex_lock(&root->fs_info->volume_mutex); 725 mutex_lock(&root->fs_info->volume_mutex);
728 sizestr = vol_args->name; 726 sizestr = vol_args->name;
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index e56c72bc5add..f4621f6deca1 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -526,7 +526,6 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
526{ 526{
527 u64 end; 527 u64 end;
528 u64 orig_end; 528 u64 orig_end;
529 u64 wait_end;
530 struct btrfs_ordered_extent *ordered; 529 struct btrfs_ordered_extent *ordered;
531 int found; 530 int found;
532 531
@@ -537,7 +536,6 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
537 if (orig_end > INT_LIMIT(loff_t)) 536 if (orig_end > INT_LIMIT(loff_t))
538 orig_end = INT_LIMIT(loff_t); 537 orig_end = INT_LIMIT(loff_t);
539 } 538 }
540 wait_end = orig_end;
541again: 539again:
542 /* start IO across the range first to instantiate any delalloc 540 /* start IO across the range first to instantiate any delalloc
543 * extents 541 * extents
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 2d958be761c8..6a1086e83ffc 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -181,7 +181,6 @@ int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
181int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid) 181int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid)
182{ 182{
183 struct btrfs_root *dead_root; 183 struct btrfs_root *dead_root;
184 struct btrfs_item *item;
185 struct btrfs_root_item *ri; 184 struct btrfs_root_item *ri;
186 struct btrfs_key key; 185 struct btrfs_key key;
187 struct btrfs_key found_key; 186 struct btrfs_key found_key;
@@ -214,7 +213,6 @@ again:
214 nritems = btrfs_header_nritems(leaf); 213 nritems = btrfs_header_nritems(leaf);
215 slot = path->slots[0]; 214 slot = path->slots[0];
216 } 215 }
217 item = btrfs_item_nr(leaf, slot);
218 btrfs_item_key_to_cpu(leaf, &key, slot); 216 btrfs_item_key_to_cpu(leaf, &key, slot);
219 if (btrfs_key_type(&key) != BTRFS_ROOT_ITEM_KEY) 217 if (btrfs_key_type(&key) != BTRFS_ROOT_ITEM_KEY)
220 goto next; 218 goto next;
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d7fb2733d028..0002e6d1a16f 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -61,6 +61,8 @@ static void btrfs_put_super(struct super_block *sb)
61 61
62 ret = close_ctree(root); 62 ret = close_ctree(root);
63 sb->s_fs_info = NULL; 63 sb->s_fs_info = NULL;
64
65 (void)ret; /* FIXME: need to fix VFS to return error? */
64} 66}
65 67
66enum { 68enum {
@@ -445,7 +447,6 @@ static int btrfs_fill_super(struct super_block *sb,
445{ 447{
446 struct inode *inode; 448 struct inode *inode;
447 struct dentry *root_dentry; 449 struct dentry *root_dentry;
448 struct btrfs_super_block *disk_super;
449 struct btrfs_root *tree_root; 450 struct btrfs_root *tree_root;
450 struct btrfs_key key; 451 struct btrfs_key key;
451 int err; 452 int err;
@@ -467,7 +468,6 @@ static int btrfs_fill_super(struct super_block *sb,
467 return PTR_ERR(tree_root); 468 return PTR_ERR(tree_root);
468 } 469 }
469 sb->s_fs_info = tree_root; 470 sb->s_fs_info = tree_root;
470 disk_super = &tree_root->fs_info->super_copy;
471 471
472 key.objectid = BTRFS_FIRST_FREE_OBJECTID; 472 key.objectid = BTRFS_FIRST_FREE_OBJECTID;
473 key.type = BTRFS_INODE_ITEM_KEY; 473 key.type = BTRFS_INODE_ITEM_KEY;
@@ -580,7 +580,6 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
580 char *subvol_name = NULL; 580 char *subvol_name = NULL;
581 u64 subvol_objectid = 0; 581 u64 subvol_objectid = 0;
582 int error = 0; 582 int error = 0;
583 int found = 0;
584 583
585 if (!(flags & MS_RDONLY)) 584 if (!(flags & MS_RDONLY))
586 mode |= FMODE_WRITE; 585 mode |= FMODE_WRITE;
@@ -616,7 +615,6 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
616 goto error_close_devices; 615 goto error_close_devices;
617 } 616 }
618 617
619 found = 1;
620 btrfs_close_devices(fs_devices); 618 btrfs_close_devices(fs_devices);
621 } else { 619 } else {
622 char b[BDEVNAME_SIZE]; 620 char b[BDEVNAME_SIZE];
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
index f7ac8e013ed7..992ab425599d 100644
--- a/fs/btrfs/tree-defrag.c
+++ b/fs/btrfs/tree-defrag.c
@@ -36,7 +36,6 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
36 int ret = 0; 36 int ret = 0;
37 int wret; 37 int wret;
38 int level; 38 int level;
39 int orig_level;
40 int is_extent = 0; 39 int is_extent = 0;
41 int next_key_ret = 0; 40 int next_key_ret = 0;
42 u64 last_ret = 0; 41 u64 last_ret = 0;
@@ -64,7 +63,6 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
64 return -ENOMEM; 63 return -ENOMEM;
65 64
66 level = btrfs_header_level(root->node); 65 level = btrfs_header_level(root->node);
67 orig_level = level;
68 66
69 if (level == 0) 67 if (level == 0)
70 goto out; 68 goto out;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 224fb5b3daad..a29f19384a27 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -786,7 +786,6 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
786{ 786{
787 struct inode *dir; 787 struct inode *dir;
788 int ret; 788 int ret;
789 struct btrfs_key location;
790 struct btrfs_inode_ref *ref; 789 struct btrfs_inode_ref *ref;
791 struct btrfs_dir_item *di; 790 struct btrfs_dir_item *di;
792 struct inode *inode; 791 struct inode *inode;
@@ -795,10 +794,6 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
795 unsigned long ref_ptr; 794 unsigned long ref_ptr;
796 unsigned long ref_end; 795 unsigned long ref_end;
797 796
798 location.objectid = key->objectid;
799 location.type = BTRFS_INODE_ITEM_KEY;
800 location.offset = 0;
801
802 /* 797 /*
803 * it is possible that we didn't log all the parent directories 798 * it is possible that we didn't log all the parent directories
804 * for a given inode. If we don't find the dir, just don't 799 * for a given inode. If we don't find the dir, just don't
@@ -1583,7 +1578,6 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
1583 struct btrfs_path *path; 1578 struct btrfs_path *path;
1584 struct btrfs_root *root = wc->replay_dest; 1579 struct btrfs_root *root = wc->replay_dest;
1585 struct btrfs_key key; 1580 struct btrfs_key key;
1586 u32 item_size;
1587 int level; 1581 int level;
1588 int i; 1582 int i;
1589 int ret; 1583 int ret;
@@ -1601,7 +1595,6 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
1601 nritems = btrfs_header_nritems(eb); 1595 nritems = btrfs_header_nritems(eb);
1602 for (i = 0; i < nritems; i++) { 1596 for (i = 0; i < nritems; i++) {
1603 btrfs_item_key_to_cpu(eb, &key, i); 1597 btrfs_item_key_to_cpu(eb, &key, i);
1604 item_size = btrfs_item_size_nr(eb, i);
1605 1598
1606 /* inode keys are done during the first stage */ 1599 /* inode keys are done during the first stage */
1607 if (key.type == BTRFS_INODE_ITEM_KEY && 1600 if (key.type == BTRFS_INODE_ITEM_KEY &&
@@ -1668,7 +1661,6 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
1668 struct walk_control *wc) 1661 struct walk_control *wc)
1669{ 1662{
1670 u64 root_owner; 1663 u64 root_owner;
1671 u64 root_gen;
1672 u64 bytenr; 1664 u64 bytenr;
1673 u64 ptr_gen; 1665 u64 ptr_gen;
1674 struct extent_buffer *next; 1666 struct extent_buffer *next;
@@ -1698,7 +1690,6 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
1698 1690
1699 parent = path->nodes[*level]; 1691 parent = path->nodes[*level];
1700 root_owner = btrfs_header_owner(parent); 1692 root_owner = btrfs_header_owner(parent);
1701 root_gen = btrfs_header_generation(parent);
1702 1693
1703 next = btrfs_find_create_tree_block(root, bytenr, blocksize); 1694 next = btrfs_find_create_tree_block(root, bytenr, blocksize);
1704 1695
@@ -1749,7 +1740,6 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
1749 struct walk_control *wc) 1740 struct walk_control *wc)
1750{ 1741{
1751 u64 root_owner; 1742 u64 root_owner;
1752 u64 root_gen;
1753 int i; 1743 int i;
1754 int slot; 1744 int slot;
1755 int ret; 1745 int ret;
@@ -1757,8 +1747,6 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
1757 for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) { 1747 for (i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) {
1758 slot = path->slots[i]; 1748 slot = path->slots[i];
1759 if (slot + 1 < btrfs_header_nritems(path->nodes[i])) { 1749 if (slot + 1 < btrfs_header_nritems(path->nodes[i])) {
1760 struct extent_buffer *node;
1761 node = path->nodes[i];
1762 path->slots[i]++; 1750 path->slots[i]++;
1763 *level = i; 1751 *level = i;
1764 WARN_ON(*level == 0); 1752 WARN_ON(*level == 0);
@@ -1771,7 +1759,6 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
1771 parent = path->nodes[*level + 1]; 1759 parent = path->nodes[*level + 1];
1772 1760
1773 root_owner = btrfs_header_owner(parent); 1761 root_owner = btrfs_header_owner(parent);
1774 root_gen = btrfs_header_generation(parent);
1775 wc->process_func(root, path->nodes[*level], wc, 1762 wc->process_func(root, path->nodes[*level], wc,
1776 btrfs_header_generation(path->nodes[*level])); 1763 btrfs_header_generation(path->nodes[*level]));
1777 if (wc->free) { 1764 if (wc->free) {
@@ -2729,7 +2716,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
2729 struct btrfs_key max_key; 2716 struct btrfs_key max_key;
2730 struct btrfs_root *log = root->log_root; 2717 struct btrfs_root *log = root->log_root;
2731 struct extent_buffer *src = NULL; 2718 struct extent_buffer *src = NULL;
2732 u32 size;
2733 int err = 0; 2719 int err = 0;
2734 int ret; 2720 int ret;
2735 int nritems; 2721 int nritems;
@@ -2793,7 +2779,6 @@ again:
2793 break; 2779 break;
2794 2780
2795 src = path->nodes[0]; 2781 src = path->nodes[0];
2796 size = btrfs_item_size_nr(src, path->slots[0]);
2797 if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { 2782 if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) {
2798 ins_nr++; 2783 ins_nr++;
2799 goto next_slot; 2784 goto next_slot;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 28681e729b1d..91851b555e2e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1901,7 +1901,6 @@ int btrfs_balance(struct btrfs_root *dev_root)
1901 u64 size_to_free; 1901 u64 size_to_free;
1902 struct btrfs_path *path; 1902 struct btrfs_path *path;
1903 struct btrfs_key key; 1903 struct btrfs_key key;
1904 struct btrfs_chunk *chunk;
1905 struct btrfs_root *chunk_root = dev_root->fs_info->chunk_root; 1904 struct btrfs_root *chunk_root = dev_root->fs_info->chunk_root;
1906 struct btrfs_trans_handle *trans; 1905 struct btrfs_trans_handle *trans;
1907 struct btrfs_key found_key; 1906 struct btrfs_key found_key;
@@ -1965,9 +1964,6 @@ int btrfs_balance(struct btrfs_root *dev_root)
1965 if (found_key.objectid != key.objectid) 1964 if (found_key.objectid != key.objectid)
1966 break; 1965 break;
1967 1966
1968 chunk = btrfs_item_ptr(path->nodes[0],
1969 path->slots[0],
1970 struct btrfs_chunk);
1971 /* chunk zero is special */ 1967 /* chunk zero is special */
1972 if (found_key.offset == 0) 1968 if (found_key.offset == 0)
1973 break; 1969 break;
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 88ecbb215878..698fdd2c739c 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -178,7 +178,6 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
178 struct inode *inode = dentry->d_inode; 178 struct inode *inode = dentry->d_inode;
179 struct btrfs_root *root = BTRFS_I(inode)->root; 179 struct btrfs_root *root = BTRFS_I(inode)->root;
180 struct btrfs_path *path; 180 struct btrfs_path *path;
181 struct btrfs_item *item;
182 struct extent_buffer *leaf; 181 struct extent_buffer *leaf;
183 struct btrfs_dir_item *di; 182 struct btrfs_dir_item *di;
184 int ret = 0, slot, advance; 183 int ret = 0, slot, advance;
@@ -234,7 +233,6 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
234 } 233 }
235 advance = 1; 234 advance = 1;
236 235
237 item = btrfs_item_nr(leaf, slot);
238 btrfs_item_key_to_cpu(leaf, &found_key, slot); 236 btrfs_item_key_to_cpu(leaf, &found_key, slot);
239 237
240 /* check to make sure this item is what we want */ 238 /* check to make sure this item is what we want */
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 3e2b90eaa239..b9cd5445f71c 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -199,8 +199,6 @@ int btrfs_zlib_compress_pages(struct address_space *mapping,
199 int nr_pages = 0; 199 int nr_pages = 0;
200 struct page *in_page = NULL; 200 struct page *in_page = NULL;
201 struct page *out_page = NULL; 201 struct page *out_page = NULL;
202 int out_written = 0;
203 int in_read = 0;
204 unsigned long bytes_left; 202 unsigned long bytes_left;
205 203
206 *out_pages = 0; 204 *out_pages = 0;
@@ -233,9 +231,6 @@ int btrfs_zlib_compress_pages(struct address_space *mapping,
233 workspace->def_strm.avail_out = PAGE_CACHE_SIZE; 231 workspace->def_strm.avail_out = PAGE_CACHE_SIZE;
234 workspace->def_strm.avail_in = min(len, PAGE_CACHE_SIZE); 232 workspace->def_strm.avail_in = min(len, PAGE_CACHE_SIZE);
235 233
236 out_written = 0;
237 in_read = 0;
238
239 while (workspace->def_strm.total_in < len) { 234 while (workspace->def_strm.total_in < len) {
240 ret = zlib_deflate(&workspace->def_strm, Z_SYNC_FLUSH); 235 ret = zlib_deflate(&workspace->def_strm, Z_SYNC_FLUSH);
241 if (ret != Z_OK) { 236 if (ret != Z_OK) {