From 2489007e7d740ccbc3e0a202914e243ad5178787 Mon Sep 17 00:00:00 2001 From: codeworkx Date: Sat, 22 Sep 2012 09:48:20 +0200 Subject: merge opensource jb u5 Change-Id: I1aaec157aa196f3448eff8636134fce89a814cf2 --- fs/ext4/super.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'fs/ext4/super.c') diff --git a/fs/ext4/super.c b/fs/ext4/super.c index df121b2..e10a393 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) { -- cgit v1.1