Skip to content

Commit

Permalink
Btrfs: cleanup warnings from gcc 4.6 (nonbugs)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Kleen authored and Chris Mason committed Oct 29, 2010
1 parent 411fc6b commit 559af82
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 94 deletions.
2 changes: 0 additions & 2 deletions fs/btrfs/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ static int check_compressed_csum(struct inode *inode,
*/
static void end_compressed_bio_read(struct bio *bio, int err)
{
struct extent_io_tree *tree;
struct compressed_bio *cb = bio->bi_private;
struct inode *inode;
struct page *page;
Expand All @@ -187,7 +186,6 @@ static void end_compressed_bio_read(struct bio *bio, int err)
/* ok, we're the last bio for this extent, lets start
* the decompression.
*/
tree = &BTRFS_I(inode)->io_tree;
ret = btrfs_zlib_decompress_biovec(cb->compressed_pages,
cb->start,
cb->orig_bio->bi_io_vec,
Expand Down
20 changes: 2 additions & 18 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
struct extent_buffer **cow_ret, u64 new_root_objectid)
{
struct extent_buffer *cow;
u32 nritems;
int ret = 0;
int level;
struct btrfs_disk_key disk_key;
Expand All @@ -210,7 +209,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
WARN_ON(root->ref_cows && trans->transid != root->last_trans);

level = btrfs_header_level(buf);
nritems = btrfs_header_nritems(buf);
if (level == 0)
btrfs_item_key(buf, &disk_key, 0);
else
Expand Down Expand Up @@ -1008,7 +1006,6 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
int wret;
int pslot;
int orig_slot = path->slots[level];
int err_on_enospc = 0;
u64 orig_ptr;

if (level == 0)
Expand Down Expand Up @@ -1071,8 +1068,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
return 0;

if (btrfs_header_nritems(mid) < 2)
err_on_enospc = 1;
btrfs_header_nritems(mid);

left = read_node_slot(root, parent, pslot - 1);
if (left) {
Expand Down Expand Up @@ -1103,8 +1099,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
wret = push_node_left(trans, root, left, mid, 1);
if (wret < 0)
ret = wret;
if (btrfs_header_nritems(mid) < 2)
err_on_enospc = 1;
btrfs_header_nritems(mid);
}

/*
Expand Down Expand Up @@ -1224,14 +1219,12 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
int wret;
int pslot;
int orig_slot = path->slots[level];
u64 orig_ptr;

if (level == 0)
return 1;

mid = path->nodes[level];
WARN_ON(btrfs_header_generation(mid) != trans->transid);
orig_ptr = btrfs_node_blockptr(mid, orig_slot);

if (level < BTRFS_MAX_LEVEL - 1)
parent = path->nodes[level + 1];
Expand Down Expand Up @@ -2567,7 +2560,6 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
{
struct btrfs_disk_key disk_key;
struct extent_buffer *right = path->nodes[0];
int slot;
int i;
int push_space = 0;
int push_items = 0;
Expand All @@ -2579,8 +2571,6 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
u32 this_item_size;
u32 old_left_item_size;

slot = path->slots[1];

if (empty)
nr = min(right_nritems, max_slot);
else
Expand Down Expand Up @@ -3349,7 +3339,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
{
int ret = 0;
int slot;
int slot_orig;
struct extent_buffer *leaf;
struct btrfs_item *item;
u32 nritems;
Expand All @@ -3359,7 +3348,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
unsigned int size_diff;
int i;

slot_orig = path->slots[0];
leaf = path->nodes[0];
slot = path->slots[0];

Expand Down Expand Up @@ -3464,7 +3452,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
{
int ret = 0;
int slot;
int slot_orig;
struct extent_buffer *leaf;
struct btrfs_item *item;
u32 nritems;
Expand All @@ -3473,7 +3460,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
unsigned int old_size;
int i;

slot_orig = path->slots[0];
leaf = path->nodes[0];

nritems = btrfs_header_nritems(leaf);
Expand Down Expand Up @@ -3806,7 +3792,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
struct btrfs_key *cpu_key, u32 *data_size,
int nr)
{
struct extent_buffer *leaf;
int ret = 0;
int slot;
int i;
Expand All @@ -3823,7 +3808,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
if (ret < 0)
goto out;

leaf = path->nodes[0];
slot = path->slots[0];
BUG_ON(slot < 0);

Expand Down
11 changes: 0 additions & 11 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
struct extent_io_tree *tree;
u64 start = (u64)page->index << PAGE_CACHE_SHIFT;
u64 found_start;
int found_level;
unsigned long len;
struct extent_buffer *eb;
int ret;
Expand Down Expand Up @@ -369,8 +368,6 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
WARN_ON(1);
goto err;
}
found_level = btrfs_header_level(eb);

csum_tree_block(root, eb, 0);
err:
free_extent_buffer(eb);
Expand Down Expand Up @@ -543,11 +540,9 @@ int btrfs_congested_async(struct btrfs_fs_info *info, int iodone)

static void run_one_async_start(struct btrfs_work *work)
{
struct btrfs_fs_info *fs_info;
struct async_submit_bio *async;

async = container_of(work, struct async_submit_bio, work);
fs_info = BTRFS_I(async->inode)->root->fs_info;
async->submit_bio_start(async->inode, async->rw, async->bio,
async->mirror_num, async->bio_flags,
async->bio_offset);
Expand Down Expand Up @@ -860,12 +855,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
u32 blocksize, u64 parent_transid)
{
struct extent_buffer *buf = NULL;
struct inode *btree_inode = root->fs_info->btree_inode;
struct extent_io_tree *io_tree;
int ret;

io_tree = &BTRFS_I(btree_inode)->io_tree;

buf = btrfs_find_create_tree_block(root, bytenr, blocksize);
if (!buf)
return NULL;
Expand Down Expand Up @@ -1387,7 +1378,6 @@ static int bio_ready_for_csum(struct bio *bio)
u64 start = 0;
struct page *page;
struct extent_io_tree *io_tree = NULL;
struct btrfs_fs_info *info = NULL;
struct bio_vec *bvec;
int i;
int ret;
Expand All @@ -1406,7 +1396,6 @@ static int bio_ready_for_csum(struct bio *bio)
buf_len = page->private >> 2;
start = page_offset(page) + bvec->bv_offset;
io_tree = &BTRFS_I(page->mapping->host)->io_tree;
info = BTRFS_I(page->mapping->host)->root->fs_info;
}
/* are we fully contained in this bio? */
if (buf_len <= length)
Expand Down
2 changes: 0 additions & 2 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5719,7 +5719,6 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,
u64 generation;
u64 refs;
u64 flags;
u64 last = 0;
u32 nritems;
u32 blocksize;
struct btrfs_key key;
Expand Down Expand Up @@ -5787,7 +5786,6 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,
generation);
if (ret)
break;
last = bytenr + blocksize;
nread++;
}
wc->reada_slot = slot;
Expand Down
9 changes: 0 additions & 9 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1857,10 +1857,8 @@ static int submit_one_bio(int rw, struct bio *bio, int mirror_num,
struct page *page = bvec->bv_page;
struct extent_io_tree *tree = bio->bi_private;
u64 start;
u64 end;

start = ((u64)page->index << PAGE_CACHE_SHIFT) + bvec->bv_offset;
end = start + bvec->bv_len - 1;

bio->bi_private = NULL;

Expand Down Expand Up @@ -2160,7 +2158,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
u64 last_byte = i_size_read(inode);
u64 block_start;
u64 iosize;
u64 unlock_start;
sector_t sector;
struct extent_state *cached_state = NULL;
struct extent_map *em;
Expand Down Expand Up @@ -2285,7 +2282,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
if (tree->ops && tree->ops->writepage_end_io_hook)
tree->ops->writepage_end_io_hook(page, start,
page_end, NULL, 1);
unlock_start = page_end + 1;
goto done;
}

Expand All @@ -2296,7 +2292,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
if (tree->ops && tree->ops->writepage_end_io_hook)
tree->ops->writepage_end_io_hook(page, cur,
page_end, NULL, 1);
unlock_start = page_end + 1;
break;
}
em = epd->get_extent(inode, page, pg_offset, cur,
Expand Down Expand Up @@ -2343,7 +2338,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,

cur += iosize;
pg_offset += iosize;
unlock_start = cur;
continue;
}
/* leave this out until we have a page_mkwrite call */
Expand Down Expand Up @@ -2429,7 +2423,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
pgoff_t index;
pgoff_t end; /* Inclusive */
int scanned = 0;
int range_whole = 0;

pagevec_init(&pvec, 0);
if (wbc->range_cyclic) {
Expand All @@ -2438,8 +2431,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
} else {
index = wbc->range_start >> PAGE_CACHE_SHIFT;
end = wbc->range_end >> PAGE_CACHE_SHIFT;
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
range_whole = 1;
scanned = 1;
}
retry:
Expand Down
14 changes: 0 additions & 14 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ static noinline int compress_file_range(struct inode *inode,
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
u64 num_bytes;
u64 orig_start;
u64 disk_num_bytes;
u64 blocksize = root->sectorsize;
u64 actual_end;
u64 isize = i_size_read(inode);
Expand All @@ -335,8 +333,6 @@ static noinline int compress_file_range(struct inode *inode,
int i;
int will_compress;

orig_start = start;

actual_end = min_t(u64, isize, end + 1);
again:
will_compress = 0;
Expand Down Expand Up @@ -371,7 +367,6 @@ static noinline int compress_file_range(struct inode *inode,
total_compressed = min(total_compressed, max_uncompressed);
num_bytes = (end - start + blocksize) & ~(blocksize - 1);
num_bytes = max(blocksize, num_bytes);
disk_num_bytes = num_bytes;
total_in = 0;
ret = 0;

Expand Down Expand Up @@ -467,7 +462,6 @@ static noinline int compress_file_range(struct inode *inode,
if (total_compressed >= total_in) {
will_compress = 0;
} else {
disk_num_bytes = total_compressed;
num_bytes = total_in;
}
}
Expand Down Expand Up @@ -757,8 +751,6 @@ static noinline int cow_file_range(struct inode *inode,
u64 disk_num_bytes;
u64 cur_alloc_size;
u64 blocksize = root->sectorsize;
u64 actual_end;
u64 isize = i_size_read(inode);
struct btrfs_key ins;
struct extent_map *em;
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
Expand All @@ -770,8 +762,6 @@ static noinline int cow_file_range(struct inode *inode,
btrfs_set_trans_block_group(trans, inode);
trans->block_rsv = &root->fs_info->delalloc_block_rsv;

actual_end = min_t(u64, isize, end + 1);

num_bytes = (end - start + blocksize) & ~(blocksize - 1);
num_bytes = max(blocksize, num_bytes);
disk_num_bytes = num_bytes;
Expand Down Expand Up @@ -2274,7 +2264,6 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)
{
struct btrfs_path *path;
struct extent_buffer *leaf;
struct btrfs_item *item;
struct btrfs_key key, found_key;
struct btrfs_trans_handle *trans;
struct inode *inode;
Expand Down Expand Up @@ -2312,7 +2301,6 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)

/* pull out the item */
leaf = path->nodes[0];
item = btrfs_item_nr(leaf, path->slots[0]);
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);

/* make sure the item matches what we want */
Expand Down Expand Up @@ -5701,7 +5689,6 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_dio_private *dip;
struct bio_vec *bvec = bio->bi_io_vec;
u64 start;
int skip_sum;
int write = rw & REQ_WRITE;
int ret = 0;
Expand All @@ -5727,7 +5714,6 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
dip->inode = inode;
dip->logical_offset = file_offset;

start = dip->logical_offset;
dip->bytes = 0;
do {
dip->bytes += bvec->bv_len;
Expand Down
2 changes: 0 additions & 2 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,6 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
char *sizestr;
char *devstr = NULL;
int ret = 0;
int namelen;
int mod = 0;

if (root->fs_info->sb->s_flags & MS_RDONLY)
Expand All @@ -722,7 +721,6 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
return PTR_ERR(vol_args);

vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
namelen = strlen(vol_args->name);

mutex_lock(&root->fs_info->volume_mutex);
sizestr = vol_args->name;
Expand Down
2 changes: 0 additions & 2 deletions fs/btrfs/ordered-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
{
u64 end;
u64 orig_end;
u64 wait_end;
struct btrfs_ordered_extent *ordered;
int found;

Expand All @@ -537,7 +536,6 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
if (orig_end > INT_LIMIT(loff_t))
orig_end = INT_LIMIT(loff_t);
}
wait_end = orig_end;
again:
/* start IO across the range first to instantiate any delalloc
* extents
Expand Down
Loading

0 comments on commit 559af82

Please sign in to comment.