Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udf: Promote some debugging messages to udf_error

If there is a problem with a scratched disc or loader, it's valuable to know
which error occurred.

Convert some debug messages to udf_error, neaten those messages too.
Add the calculated tag checksum and the read checksum to error message.
Make udf_error a public function and move the logging prototypes together.

Original-patch-by: NamJae Jeon <linkinjeon@gmail.com>
Reviewed-by: NamJae Jeon <linkinjeon@gmail.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Joe Perches and committed by
Jan Kara
7e273e3b 40bfa16d

+18 -10
+9 -4
fs/udf/misc.c
··· 204 204 { 205 205 struct tag *tag_p; 206 206 struct buffer_head *bh = NULL; 207 + u8 checksum; 207 208 208 209 /* Read the block */ 209 210 if (block == 0xFFFFFFFF) ··· 212 211 213 212 bh = udf_tread(sb, block); 214 213 if (!bh) { 215 - udf_debug("block=%d, location=%d: read failed\n", 214 + udf_error(sb, __func__, "read failed, block=%u, location=%d\n", 216 215 block, location); 217 216 return NULL; 218 217 } ··· 228 227 } 229 228 230 229 /* Verify the tag checksum */ 231 - if (udf_tag_checksum(tag_p) != tag_p->tagChecksum) { 232 - printk(KERN_ERR "udf: tag checksum failed block %d\n", block); 230 + checksum = udf_tag_checksum(tag_p); 231 + if (checksum != tag_p->tagChecksum) { 232 + udf_error(sb, __func__, 233 + "tag checksum failed, block %u: 0x%02x != 0x%02x\n", 234 + block, checksum, tag_p->tagChecksum); 233 235 goto error_out; 234 236 } 235 237 236 238 /* Verify the tag version */ 237 239 if (tag_p->descVersion != cpu_to_le16(0x0002U) && 238 240 tag_p->descVersion != cpu_to_le16(0x0003U)) { 239 - udf_debug("tag version 0x%04x != 0x0002 || 0x0003 block %d\n", 241 + udf_error(sb, __func__, 242 + "tag version 0x%04x != 0x0002 || 0x0003, block %u\n", 240 243 le16_to_cpu(tag_p->descVersion), block); 241 244 goto error_out; 242 245 }
+2 -4
fs/udf/super.c
··· 92 92 static unsigned int udf_count_free(struct super_block *); 93 93 static int udf_statfs(struct dentry *, struct kstatfs *); 94 94 static int udf_show_options(struct seq_file *, struct vfsmount *); 95 - static void udf_error(struct super_block *sb, const char *function, 96 - const char *fmt, ...); 97 95 98 96 struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi) 99 97 { ··· 2094 2096 return -EINVAL; 2095 2097 } 2096 2098 2097 - static void udf_error(struct super_block *sb, const char *function, 2098 - const char *fmt, ...) 2099 + void udf_error(struct super_block *sb, const char *function, 2100 + const char *fmt, ...) 2099 2101 { 2100 2102 va_list args; 2101 2103
+7 -2
fs/udf/udfdecl.h
··· 29 29 #define udf_debug(f, a...) /**/ 30 30 #endif 31 31 32 + __attribute__((format(printf, 3, 4))) 33 + extern void udf_warning(struct super_block *, const char *, const char *, ...); 34 + 35 + __attribute__((format(printf, 3, 4))) 36 + extern void udf_error(struct super_block *sb, const char *function, 37 + const char *fmt, ...); 38 + 32 39 #define udf_info(f, a...) \ 33 40 printk(KERN_INFO "UDF-fs INFO " f, ##a); 34 41 ··· 119 112 120 113 /* super.c */ 121 114 122 - __attribute__((format(printf, 3, 4))) 123 - extern void udf_warning(struct super_block *, const char *, const char *, ...); 124 115 static inline void udf_updated_lvid(struct super_block *sb) 125 116 { 126 117 struct buffer_head *bh = UDF_SB(sb)->s_lvid_bh;