udf: enable error print in udf_read_tagged().
PATCH 1/1 udf: enable error print in udf_read_tagged().
While reading metadata, if a problem occurs, Print out only one of the five case.(It also does not show a checksum properly.) Because Currently it was disable by undef udf_debug.
If there is a problem with scratched disc or loader, the user needs to know which error happened.
--- fs/udf/misc.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
fs/udf/misc.c +10 -7
@@ -204,6 +204,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, {struct tag *tag_p;struct buffer_head *bh =NULL ; +u8 checksum;/* Read the block */ if (block ==0xFFFFFFFF )
@@ -211,7 +212,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, bh =udf_tread (sb, block);if (!bh) { -udf_debug ("block=%d, location=%d: read failed\n" , +printk (KERN_ERR "block=%d, location=%d: read failed\n" , block, location);return NULL ; }
@@ -221,22 +222,24 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, *ident =le16_to_cpu (tag_p->tagIdent);if (location !=le32_to_cpu (tag_p->tagLocation)) { -udf_debug ("location mismatch block %u, tag %u != %u\n" , +printk (KERN_ERR "location mismatch block %u, tag %u != %u\n" , block,le32_to_cpu (tag_p->tagLocation), location); goto error_out; }/* Verify the tag checksum */ -if (udf_tag_checksum (tag_p) != tag_p->tagChecksum) { -printk (KERN_ERR "udf: tag checksum failed block %d\n" , block); + checksum =udf_tag_checksum (tag_p); +if (checksum != tag_p->tagChecksum) { +printk (KERN_ERR "udf: tag checksum failed block %d, checksum 0x%02x != 0x%02x\n" , + block, checksum, tag_p->tagChecksum); goto error_out; }/* Verify the tag version */ if (tag_p->descVersion !=cpu_to_le16 (0x0002U ) && tag_p->descVersion !=cpu_to_le16 (0x0003U )) { -udf_debug ("tag version 0x%04x != 0x0002 || 0x0003 block %d\n" , -le16_to_cpu (tag_p->descVersion), block); +printk (KERN_ERR "tag version 0x%04x != 0x0002 || 0x0003 block %d\n" , +le16_to_cpu (tag_p->descVersion), block); goto error_out; }
@@ -247,7 +250,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, le16_to_cpu(tag_p->descCRCLength)))return bh; -udf_debug ("Crc failure block %d: crc = %d, crclen = %d\n" , block, +printk (KERN_ERR "Crc failure block %d: crc = %d, crclen = %d\n" , block,le16_to_cpu (tag_p->descCRC),le16_to_cpu (tag_p->descCRCLength)); error_out:
Signature · 1 line
1.7.4.4
Quoted 1 line · Namjae Jeon
While reading metadata, if a problem occurs, Print out only one of the five case.(It also does not show a checksum properly.)
[]
fs/udf/misc.c
Quoted 1 line
fs/udf/misc.c +0
-0
[]
fs/udf/misc.c struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, · line 215
Quoted 6 lines
fs/udf/misc.c +1
-1@@ -211,7 +212,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, bh =udf_tread (sb, block);if (!bh) { - udf_debug("block=%d, location=%d: read failed\n", + printk(KERN_ERR "block=%d, location=%d: read failed\n",
The other printk in this module uses a "udf: " prefix.
I suggest that
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
is added before any include and these
conversions use pr_err() instead.
2011/9/28 Joe Perches <[email protected]>:
Quoted 14 lines · Namjae Jeon
Quoted 1 line
While reading metadata, if a problem occurs, Print out only one of the five case.(It also does not show a checksum properly.)
[]
fs/udf/misc.c
Quoted 1 line
fs/udf/misc.c +0
-0[]
fs/udf/misc.c struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, · line 215
Quoted 6 lines
fs/udf/misc.c +1
-1@@ -211,7 +212,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, bh = udf_tread(sb, block); if (!bh) { - udf_debug("block=%d, location=%d: read failed\n", + printk(KERN_ERR "block=%d, location=%d: read failed\n",The other printk in this module uses a "udf: " prefix.
Quoted 4 lines
I suggest that
#definepr_fmt(fmt)KBUILD_MODNAME": " fmt
is added before any include and these
conversions usepr_err()instead.
It is good suggestion. I will try to make patch v2 included your suggestion. Thanks for your review.