diff options
author | codeworkx <codeworkx@cyanogenmod.com> | 2012-09-22 09:48:20 +0200 |
---|---|---|
committer | codeworkx <codeworkx@cyanogenmod.com> | 2012-09-22 14:02:16 +0200 |
commit | 2489007e7d740ccbc3e0a202914e243ad5178787 (patch) | |
tree | b8e6380ea7b1da63474ad68a5dba997e01146043 /fs/ext4 | |
parent | 5f67568eb31e3a813c7c52461dcf66ade15fc2e7 (diff) | |
download | kernel_samsung_smdk4412-2489007e7d740ccbc3e0a202914e243ad5178787.tar.gz kernel_samsung_smdk4412-2489007e7d740ccbc3e0a202914e243ad5178787.tar.bz2 kernel_samsung_smdk4412-2489007e7d740ccbc3e0a202914e243ad5178787.zip |
merge opensource jb u5
Change-Id: I1aaec157aa196f3448eff8636134fce89a814cf2
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/dir.c | 4 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 5 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 6 | ||||
-rw-r--r-- | fs/ext4/inode.c | 11 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 7 | ||||
-rw-r--r-- | fs/ext4/namei.c | 14 | ||||
-rw-r--r-- | fs/ext4/super.c | 58 |
7 files changed, 101 insertions, 4 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 164c56092e5..f00b0a00cfd 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -90,6 +90,10 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, else return 0; + /* for debugging, sangwoo2.lee */ + print_bh(dir->i_sb, bh, 0, EXT4_BLOCK_SIZE(dir->i_sb)); + /* for debugging */ + if (filp) ext4_error_file(filp, function, line, bh ? bh->b_blocknr : 0, "bad entry in directory: %s - offset=%u(%u), " diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 1a34c1c8460..73490d9ecc3 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1931,6 +1931,11 @@ extern __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 group, struct ext4_group_desc *gdp); extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group, struct ext4_group_desc *gdp); +/* for debugging, sangwoo2.lee */ +extern void print_bh(struct super_block *sb, struct buffer_head *bh, int start, int len); +extern void print_block_data(struct super_block *sb, sector_t blocknr, unsigned char *data_to_dump, int start, int len); +/* for debugging */ + static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) { diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 21bb2f61e50..b5c25ba59f7 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -285,8 +285,12 @@ out: if (!fatal) fatal = err; ext4_mark_super_dirty(sb); - } else + } else { + /* for debugging, sangwoo2.lee */ + print_bh(sb, bitmap_bh, 0, EXT4_BLOCK_SIZE(sb)); + /* for debugging */ ext4_error(sb, "bit already cleared for inode %lu", ino); + } error_return: brelse(bitmap_bh); diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 55d3e5167c0..83cd4cf6253 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1182,6 +1182,11 @@ static int __check_block_validity(struct inode *inode, const char *func, { if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, map->m_len)) { + /* for debugging, sangwoo2.lee */ + printk(KERN_ERR "printing inode..\n"); + print_block_data(inode->i_sb, 0, (unsigned char *)inode, 0, EXT4_INODE_SIZE(inode->i_sb)); + /* for debugging */ + ext4_error_inode(inode, func, line, map->m_pblk, "lblock %lu mapped to illegal pblock " "(length %d)", (unsigned long) map->m_lblk, @@ -4941,6 +4946,12 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) if (inode->i_mode == 0 || !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) { /* this inode is deleted */ + /* for debugging, sangwoo2.lee */ + printk(KERN_ERR "iloc info, offset : %lu, group# : %u\n", iloc.offset, iloc.block_group); + printk(KERN_ERR "sb info, inodes per group : %lu, inode size : %d\n", EXT4_SB(sb)->s_inodes_per_group, EXT4_SB(sb)->s_inode_size); + print_bh(sb, iloc.bh, 0, EXT4_BLOCK_SIZE(sb)); + /* for debugging */ + ret = -ESTALE; goto bad_inode; } diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 0f1be7f1637..d37c2e37e8c 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -731,6 +731,10 @@ void ext4_mb_generate_buddy(struct super_block *sb, grp->bb_fragments = fragments; if (free != grp->bb_free) { + /* for more specific debugging, sangwoo2.lee */ + print_block_data(sb, 0, bitmap, 0, EXT4_BLOCK_SIZE(sb)); + /* for more specific debugging */ + ext4_grp_locked_error(sb, group, 0, 0, "%u blocks in bitmap, %u in gd", free, grp->bb_free); @@ -1338,6 +1342,9 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, blocknr = ext4_group_first_block_no(sb, e4b->bd_group); blocknr += block; + /* for debugging, sangwoo2.lee */ + print_block_data(sb, blocknr, EXT4_MB_BITMAP(e4b), 0, EXT4_BLOCK_SIZE(sb)); + /* for debugging */ ext4_grp_locked_error(sb, e4b->bd_group, inode ? inode->i_ino : 0, blocknr, diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 3d36d5a1e19..5767c504d00 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1031,17 +1031,25 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru inode = NULL; if (bh) { __u32 ino = le32_to_cpu(de->inode); - brelse(bh); if (!ext4_valid_inum(dir->i_sb, ino)) { + /* for debugging, sangwoo2.lee */ + printk(KERN_ERR "Name of directory entry has bad inode# : %s\n", de->name); + print_bh(dir->i_sb, bh, 0, EXT4_BLOCK_SIZE(dir->i_sb)); + /* for debugging */ + brelse(bh); + EXT4_ERROR_INODE(dir, "bad inode number: %u", ino); return ERR_PTR(-EIO); } + brelse(bh); + inode = ext4_iget(dir->i_sb, ino); if (IS_ERR(inode)) { if (PTR_ERR(inode) == -ESTALE) { + /* In case of -ESTALE, printing debugging data is already done in ext4_iget */ EXT4_ERROR_INODE(dir, - "deleted inode referenced: %u", - ino); + "deleted inode referenced: %u at parent inode : %lu", + ino, dir->i_ino); return ERR_PTR(-EIO); } else { return ERR_CAST(inode); diff --git a/fs/ext4/super.c b/fs/ext4/super.c index df121b20b0d..e10a393a76a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -433,6 +433,7 @@ void __ext4_error(struct super_block *sb, const char *function, printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n", sb->s_id, function, line, current->comm, &vaf); va_end(args); + save_error_info(sb, function, line); ext4_handle_error(sb); } @@ -3721,8 +3722,16 @@ no_journal: return 0; cantfind_ext4: + + /* for debugging, sangwoo2.lee */ + /* If you wanna use the flag 'MS_SILENT', call 'print_bh' function within below 'if'. */ + printk("printing data of superblock-bh\n"); + print_bh(sb, bh, 0, EXT4_BLOCK_SIZE(sb)); + /* for debugging */ + if (!silent) ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); + goto failed_mount; failed_mount4: @@ -4821,6 +4830,55 @@ out: #endif +/* for debugging, sangwoo2.lee */ +void print_bh(struct super_block *sb, struct buffer_head *bh, int start, int len) +{ + print_block_data(sb, bh->b_blocknr, bh->b_data, start, len); +} + +void print_block_data(struct super_block *sb, sector_t blocknr, unsigned char *data_to_dump, int start, int len) +{ + int i, j; + int bh_offset = (start / 16) * 16; + char row_data[17] = { 0, }; + char row_hex[50] = { 0, }; + char ch; + + printk(KERN_ERR "As EXT4-fs error, printing data in hex\n"); + printk(KERN_ERR " [partition info] s_id : %s, start block# : %llu\n", sb->s_id, sb->s_bdev->bd_part->start_sect); + printk(KERN_ERR " dump block# : %llu, start offset(byte) : %d, length(byte) : %d\n", blocknr, start, len); + printk(KERN_ERR "-----------------------------------------------------------------------------\n"); + + for (i = 0; i < (len + 15) / 16; i++) + { + for (j = 0; j < 16; j++) + { + ch = *(data_to_dump + bh_offset + j); + if (start <= bh_offset + j && start + len > bh_offset + j) + { + if (isascii(ch) && isprint(ch)) + sprintf(row_data + j, "%c", ch); + else + sprintf(row_data + j, "."); + + sprintf(row_hex + (j * 3), "%2.2x ", ch); + } + else + { + sprintf(row_data + j, " "); + sprintf(row_hex + (j * 3), "-- "); + } + } + + printk(KERN_ERR "0x%4.4x : %s | %s\n", bh_offset, row_hex, row_data); + bh_offset += 16; + + } + printk(KERN_ERR "-----------------------------------------------------------------------------\n"); +} +/* for debugging */ + + static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { |