Commit 5a0790c2 authored by Andi Kleen's avatar Andi Kleen Committed by Theodore Ts'o

ext4: remove initialized but not read variables

No real bugs found, just removed some dead code.

Found by gcc 4.6's new warnings.
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 07a03824
...@@ -1083,7 +1083,6 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, ...@@ -1083,7 +1083,6 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
{ {
struct ext4_ext_path *curp = path; struct ext4_ext_path *curp = path;
struct ext4_extent_header *neh; struct ext4_extent_header *neh;
struct ext4_extent_idx *fidx;
struct buffer_head *bh; struct buffer_head *bh;
ext4_fsblk_t newblock; ext4_fsblk_t newblock;
int err = 0; int err = 0;
...@@ -1144,10 +1143,10 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, ...@@ -1144,10 +1143,10 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
ext4_idx_store_pblock(curp->p_idx, newblock); ext4_idx_store_pblock(curp->p_idx, newblock);
neh = ext_inode_hdr(inode); neh = ext_inode_hdr(inode);
fidx = EXT_FIRST_INDEX(neh);
ext_debug("new root: num %d(%d), lblock %d, ptr %llu\n", ext_debug("new root: num %d(%d), lblock %d, ptr %llu\n",
le16_to_cpu(neh->eh_entries), le16_to_cpu(neh->eh_max), le16_to_cpu(neh->eh_entries), le16_to_cpu(neh->eh_max),
le32_to_cpu(fidx->ei_block), idx_pblock(fidx)); le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block),
idx_pblock(EXT_FIRST_INDEX(neh)));
neh->eh_depth = cpu_to_le16(path->p_depth + 1); neh->eh_depth = cpu_to_le16(path->p_depth + 1);
err = ext4_ext_dirty(handle, inode, curp); err = ext4_ext_dirty(handle, inode, curp);
...@@ -2954,7 +2953,6 @@ static int ext4_split_unwritten_extents(handle_t *handle, ...@@ -2954,7 +2953,6 @@ static int ext4_split_unwritten_extents(handle_t *handle,
struct ext4_extent *ex1 = NULL; struct ext4_extent *ex1 = NULL;
struct ext4_extent *ex2 = NULL; struct ext4_extent *ex2 = NULL;
struct ext4_extent *ex3 = NULL; struct ext4_extent *ex3 = NULL;
struct ext4_extent_header *eh;
ext4_lblk_t ee_block, eof_block; ext4_lblk_t ee_block, eof_block;
unsigned int allocated, ee_len, depth; unsigned int allocated, ee_len, depth;
ext4_fsblk_t newblock; ext4_fsblk_t newblock;
...@@ -2971,7 +2969,6 @@ static int ext4_split_unwritten_extents(handle_t *handle, ...@@ -2971,7 +2969,6 @@ static int ext4_split_unwritten_extents(handle_t *handle,
eof_block = map->m_lblk + map->m_len; eof_block = map->m_lblk + map->m_len;
depth = ext_depth(inode); depth = ext_depth(inode);
eh = path[depth].p_hdr;
ex = path[depth].p_ext; ex = path[depth].p_ext;
ee_block = le32_to_cpu(ex->ee_block); ee_block = le32_to_cpu(ex->ee_block);
ee_len = ext4_ext_get_actual_len(ex); ee_len = ext4_ext_get_actual_len(ex);
...@@ -3058,7 +3055,6 @@ static int ext4_split_unwritten_extents(handle_t *handle, ...@@ -3058,7 +3055,6 @@ static int ext4_split_unwritten_extents(handle_t *handle,
err = PTR_ERR(path); err = PTR_ERR(path);
goto out; goto out;
} }
eh = path[depth].p_hdr;
ex = path[depth].p_ext; ex = path[depth].p_ext;
if (ex2 != &newex) if (ex2 != &newex)
ex2 = ex; ex2 = ex;
......
...@@ -3146,13 +3146,10 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, ...@@ -3146,13 +3146,10 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
int ret, retries = 0; int ret, retries = 0;
struct page *page; struct page *page;
pgoff_t index; pgoff_t index;
unsigned from, to;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
handle_t *handle; handle_t *handle;
index = pos >> PAGE_CACHE_SHIFT; index = pos >> PAGE_CACHE_SHIFT;
from = pos & (PAGE_CACHE_SIZE - 1);
to = from + len;
if (ext4_nonda_switch(inode->i_sb)) { if (ext4_nonda_switch(inode->i_sb)) {
*fsdata = (void *)FALL_BACK_TO_NONDELALLOC; *fsdata = (void *)FALL_BACK_TO_NONDELALLOC;
...@@ -5754,7 +5751,6 @@ static int ext4_expand_extra_isize(struct inode *inode, ...@@ -5754,7 +5751,6 @@ static int ext4_expand_extra_isize(struct inode *inode,
{ {
struct ext4_inode *raw_inode; struct ext4_inode *raw_inode;
struct ext4_xattr_ibody_header *header; struct ext4_xattr_ibody_header *header;
struct ext4_xattr_entry *entry;
if (EXT4_I(inode)->i_extra_isize >= new_extra_isize) if (EXT4_I(inode)->i_extra_isize >= new_extra_isize)
return 0; return 0;
...@@ -5762,7 +5758,6 @@ static int ext4_expand_extra_isize(struct inode *inode, ...@@ -5762,7 +5758,6 @@ static int ext4_expand_extra_isize(struct inode *inode,
raw_inode = ext4_raw_inode(&iloc); raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode); header = IHDR(inode, raw_inode);
entry = IFIRST(header);
/* No extended attributes present */ /* No extended attributes present */
if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) || if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) ||
......
...@@ -1999,7 +1999,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac) ...@@ -1999,7 +1999,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
ext4_group_t ngroups, group, i; ext4_group_t ngroups, group, i;
int cr; int cr;
int err = 0; int err = 0;
int bsbits;
struct ext4_sb_info *sbi; struct ext4_sb_info *sbi;
struct super_block *sb; struct super_block *sb;
struct ext4_buddy e4b; struct ext4_buddy e4b;
...@@ -2041,8 +2040,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac) ...@@ -2041,8 +2040,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
ac->ac_2order = i - 1; ac->ac_2order = i - 1;
} }
bsbits = ac->ac_sb->s_blocksize_bits;
/* if stream allocation is enabled, use global goal */ /* if stream allocation is enabled, use global goal */
if (ac->ac_flags & EXT4_MB_STREAM_ALLOC) { if (ac->ac_flags & EXT4_MB_STREAM_ALLOC) {
/* TBD: may be hot point */ /* TBD: may be hot point */
...@@ -2712,7 +2709,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, ...@@ -2712,7 +2709,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
handle_t *handle, unsigned int reserv_blks) handle_t *handle, unsigned int reserv_blks)
{ {
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
struct ext4_super_block *es;
struct ext4_group_desc *gdp; struct ext4_group_desc *gdp;
struct buffer_head *gdp_bh; struct buffer_head *gdp_bh;
struct ext4_sb_info *sbi; struct ext4_sb_info *sbi;
...@@ -2725,8 +2721,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, ...@@ -2725,8 +2721,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
sb = ac->ac_sb; sb = ac->ac_sb;
sbi = EXT4_SB(sb); sbi = EXT4_SB(sb);
es = sbi->s_es;
err = -EIO; err = -EIO;
bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group); bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group);
...@@ -2850,7 +2844,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, ...@@ -2850,7 +2844,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
int bsbits, max; int bsbits, max;
ext4_lblk_t end; ext4_lblk_t end;
loff_t size, orig_size, start_off; loff_t size, orig_size, start_off;
ext4_lblk_t start, orig_start; ext4_lblk_t start;
struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
struct ext4_prealloc_space *pa; struct ext4_prealloc_space *pa;
...@@ -2881,6 +2875,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, ...@@ -2881,6 +2875,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
size = size << bsbits; size = size << bsbits;
if (size < i_size_read(ac->ac_inode)) if (size < i_size_read(ac->ac_inode))
size = i_size_read(ac->ac_inode); size = i_size_read(ac->ac_inode);
orig_size = size;
/* max size of free chunks */ /* max size of free chunks */
max = 2 << bsbits; max = 2 << bsbits;
...@@ -2922,8 +2917,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, ...@@ -2922,8 +2917,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits; start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits;
size = ac->ac_o_ex.fe_len << bsbits; size = ac->ac_o_ex.fe_len << bsbits;
} }
orig_size = size = size >> bsbits; size = size >> bsbits;
orig_start = start = start_off >> bsbits; start = start_off >> bsbits;
/* don't cover already allocated blocks in selected range */ /* don't cover already allocated blocks in selected range */
if (ar->pleft && start <= ar->lleft) { if (ar->pleft && start <= ar->lleft) {
...@@ -3547,7 +3542,6 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, ...@@ -3547,7 +3542,6 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
ext4_group_t group; ext4_group_t group;
ext4_grpblk_t bit; ext4_grpblk_t bit;
unsigned long long grp_blk_start; unsigned long long grp_blk_start;
sector_t start;
int err = 0; int err = 0;
int free = 0; int free = 0;
...@@ -3567,10 +3561,9 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, ...@@ -3567,10 +3561,9 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
if (bit >= end) if (bit >= end)
break; break;
next = mb_find_next_bit(bitmap_bh->b_data, end, bit); next = mb_find_next_bit(bitmap_bh->b_data, end, bit);
start = ext4_group_first_block_no(sb, group) + bit;
mb_debug(1, " free preallocated %u/%u in group %u\n", mb_debug(1, " free preallocated %u/%u in group %u\n",
(unsigned) start, (unsigned) next - bit, (unsigned) ext4_group_first_block_no(sb, group) + bit,
(unsigned) group); (unsigned) next - bit, (unsigned) group);
free += next - bit; free += next - bit;
if (ac) { if (ac) {
...@@ -4494,7 +4487,6 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, ...@@ -4494,7 +4487,6 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct ext4_allocation_context *ac = NULL; struct ext4_allocation_context *ac = NULL;
struct ext4_group_desc *gdp; struct ext4_group_desc *gdp;
struct ext4_super_block *es;
unsigned long freed = 0; unsigned long freed = 0;
unsigned int overflow; unsigned int overflow;
ext4_grpblk_t bit; ext4_grpblk_t bit;
...@@ -4513,7 +4505,6 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, ...@@ -4513,7 +4505,6 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
} }
sbi = EXT4_SB(sb); sbi = EXT4_SB(sb);
es = EXT4_SB(sb)->s_es;
if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) && if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) &&
!ext4_data_block_valid(sbi, block, count)) { !ext4_data_block_valid(sbi, block, count)) {
ext4_error(sb, "Freeing blocks not in datazone - " ext4_error(sb, "Freeing blocks not in datazone - "
......
...@@ -1088,7 +1088,6 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru ...@@ -1088,7 +1088,6 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
struct dentry *ext4_get_parent(struct dentry *child) struct dentry *ext4_get_parent(struct dentry *child)
{ {
__u32 ino; __u32 ino;
struct inode *inode;
static const struct qstr dotdot = { static const struct qstr dotdot = {
.name = "..", .name = "..",
.len = 2, .len = 2,
...@@ -1097,7 +1096,6 @@ struct dentry *ext4_get_parent(struct dentry *child) ...@@ -1097,7 +1096,6 @@ struct dentry *ext4_get_parent(struct dentry *child)
struct buffer_head *bh; struct buffer_head *bh;
bh = ext4_find_entry(child->d_inode, &dotdot, &de); bh = ext4_find_entry(child->d_inode, &dotdot, &de);
inode = NULL;
if (!bh) if (!bh)
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
ino = le32_to_cpu(de->inode); ino = le32_to_cpu(de->inode);
......
...@@ -952,7 +952,6 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, ...@@ -952,7 +952,6 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,
ext4_fsblk_t n_blocks_count) ext4_fsblk_t n_blocks_count)
{ {
ext4_fsblk_t o_blocks_count; ext4_fsblk_t o_blocks_count;
ext4_group_t o_groups_count;
ext4_grpblk_t last; ext4_grpblk_t last;
ext4_grpblk_t add; ext4_grpblk_t add;
struct buffer_head *bh; struct buffer_head *bh;
...@@ -964,7 +963,6 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, ...@@ -964,7 +963,6 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,
* yet: we're going to revalidate es->s_blocks_count after * yet: we're going to revalidate es->s_blocks_count after
* taking the s_resize_lock below. */ * taking the s_resize_lock below. */
o_blocks_count = ext4_blocks_count(es); o_blocks_count = ext4_blocks_count(es);
o_groups_count = EXT4_SB(sb)->s_groups_count;
if (test_opt(sb, DEBUG)) if (test_opt(sb, DEBUG))
printk(KERN_DEBUG "EXT4-fs: extending last group from %llu uto %llu blocks\n", printk(KERN_DEBUG "EXT4-fs: extending last group from %llu uto %llu blocks\n",
......
...@@ -1392,13 +1392,9 @@ int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat, ...@@ -1392,13 +1392,9 @@ int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat,
int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat, int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat,
unsigned long ro, unsigned long incompat) unsigned long ro, unsigned long incompat)
{ {
journal_superblock_t *sb;
if (!compat && !ro && !incompat) if (!compat && !ro && !incompat)
return 1; return 1;
sb = journal->j_superblock;
/* We can support any known requested features iff the /* We can support any known requested features iff the
* superblock is in version 2. Otherwise we fail to support any * superblock is in version 2. Otherwise we fail to support any
* extended sb features. */ * extended sb features. */
...@@ -1618,7 +1614,6 @@ int jbd2_journal_flush(journal_t *journal) ...@@ -1618,7 +1614,6 @@ int jbd2_journal_flush(journal_t *journal)
int jbd2_journal_wipe(journal_t *journal, int write) int jbd2_journal_wipe(journal_t *journal, int write)
{ {
journal_superblock_t *sb;
int err = 0; int err = 0;
J_ASSERT (!(journal->j_flags & JBD2_LOADED)); J_ASSERT (!(journal->j_flags & JBD2_LOADED));
...@@ -1627,8 +1622,6 @@ int jbd2_journal_wipe(journal_t *journal, int write) ...@@ -1627,8 +1622,6 @@ int jbd2_journal_wipe(journal_t *journal, int write)
if (err) if (err)
return err; return err;
sb = journal->j_superblock;
if (!journal->j_tail) if (!journal->j_tail)
goto no_recovery; goto no_recovery;
...@@ -2202,8 +2195,6 @@ void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode) ...@@ -2202,8 +2195,6 @@ void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode)
void jbd2_journal_release_jbd_inode(journal_t *journal, void jbd2_journal_release_jbd_inode(journal_t *journal,
struct jbd2_inode *jinode) struct jbd2_inode *jinode)
{ {
int writeout = 0;
if (!journal) if (!journal)
return; return;
restart: restart:
...@@ -2220,9 +2211,6 @@ void jbd2_journal_release_jbd_inode(journal_t *journal, ...@@ -2220,9 +2211,6 @@ void jbd2_journal_release_jbd_inode(journal_t *journal,
goto restart; goto restart;
} }
/* Do we need to wait for data writeback? */
if (journal->j_committing_transaction == jinode->i_transaction)
writeout = 1;
if (jinode->i_transaction) { if (jinode->i_transaction) {
list_del(&jinode->i_list); list_del(&jinode->i_list);
jinode->i_transaction = NULL; jinode->i_transaction = NULL;
......
...@@ -285,12 +285,10 @@ int jbd2_journal_recover(journal_t *journal) ...@@ -285,12 +285,10 @@ int jbd2_journal_recover(journal_t *journal)
int jbd2_journal_skip_recovery(journal_t *journal) int jbd2_journal_skip_recovery(journal_t *journal)
{ {
int err; int err;
journal_superblock_t * sb;
struct recovery_info info; struct recovery_info info;
memset (&info, 0, sizeof(info)); memset (&info, 0, sizeof(info));
sb = journal->j_superblock;
err = do_one_pass(journal, &info, PASS_SCAN); err = do_one_pass(journal, &info, PASS_SCAN);
...@@ -299,7 +297,8 @@ int jbd2_journal_skip_recovery(journal_t *journal) ...@@ -299,7 +297,8 @@ int jbd2_journal_skip_recovery(journal_t *journal)
++journal->j_transaction_sequence; ++journal->j_transaction_sequence;
} else { } else {
#ifdef CONFIG_JBD2_DEBUG #ifdef CONFIG_JBD2_DEBUG
int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); int dropped = info.end_transaction -
be32_to_cpu(journal->j_superblock->s_sequence);
#endif #endif
jbd_debug(1, jbd_debug(1,
"JBD: ignoring %d transaction%s from the journal.\n", "JBD: ignoring %d transaction%s from the journal.\n",
...@@ -365,11 +364,6 @@ static int do_one_pass(journal_t *journal, ...@@ -365,11 +364,6 @@ static int do_one_pass(journal_t *journal,
int tag_bytes = journal_tag_bytes(journal); int tag_bytes = journal_tag_bytes(journal);
__u32 crc32_sum = ~0; /* Transactional Checksums */ __u32 crc32_sum = ~0; /* Transactional Checksums */
/* Precompute the maximum metadata descriptors in a descriptor block */
int MAX_BLOCKS_PER_DESC;
MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))
/ tag_bytes);
/* /*
* First thing is to establish what we expect to find in the log * First thing is to establish what we expect to find in the log
* (in terms of transaction IDs), and where (in terms of log * (in terms of transaction IDs), and where (in terms of log
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment