aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-10-10 04:08:02 -0400
committerJan Kara <jack@suse.cz>2011-10-10 13:26:24 -0400
commit7e273e3b41e32716dc122b293b5f15635af495ff (patch)
tree5c6735944042e68af4e8681fb424c729701e4957 /fs/udf
parent40bfa16dac2adcded9e2eda58246cc3700d97de4 (diff)
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>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/misc.c13
-rw-r--r--fs/udf/super.c6
-rw-r--r--fs/udf/udfdecl.h9
3 files changed, 18 insertions, 10 deletions
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 9215700c00a4..a85fa7c55b0a 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -204,6 +204,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
204{ 204{
205 struct tag *tag_p; 205 struct tag *tag_p;
206 struct buffer_head *bh = NULL; 206 struct buffer_head *bh = NULL;
207 u8 checksum;
207 208
208 /* Read the block */ 209 /* Read the block */
209 if (block == 0xFFFFFFFF) 210 if (block == 0xFFFFFFFF)
@@ -211,7 +212,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
211 212
212 bh = udf_tread(sb, block); 213 bh = udf_tread(sb, block);
213 if (!bh) { 214 if (!bh) {
214 udf_debug("block=%d, location=%d: read failed\n", 215 udf_error(sb, __func__, "read failed, block=%u, location=%d\n",
215 block, location); 216 block, location);
216 return NULL; 217 return NULL;
217 } 218 }
@@ -227,15 +228,19 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
227 } 228 }
228 229
229 /* Verify the tag checksum */ 230 /* Verify the tag checksum */
230 if (udf_tag_checksum(tag_p) != tag_p->tagChecksum) { 231 checksum = udf_tag_checksum(tag_p);
231 printk(KERN_ERR "udf: tag checksum failed block %d\n", block); 232 if (checksum != tag_p->tagChecksum) {
233 udf_error(sb, __func__,
234 "tag checksum failed, block %u: 0x%02x != 0x%02x\n",
235 block, checksum, tag_p->tagChecksum);
232 goto error_out; 236 goto error_out;
233 } 237 }
234 238
235 /* Verify the tag version */ 239 /* Verify the tag version */
236 if (tag_p->descVersion != cpu_to_le16(0x0002U) && 240 if (tag_p->descVersion != cpu_to_le16(0x0002U) &&
237 tag_p->descVersion != cpu_to_le16(0x0003U)) { 241 tag_p->descVersion != cpu_to_le16(0x0003U)) {
238 udf_debug("tag version 0x%04x != 0x0002 || 0x0003 block %d\n", 242 udf_error(sb, __func__,
243 "tag version 0x%04x != 0x0002 || 0x0003, block %u\n",
239 le16_to_cpu(tag_p->descVersion), block); 244 le16_to_cpu(tag_p->descVersion), block);
240 goto error_out; 245 goto error_out;
241 } 246 }
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 7b27b063ff6d..80f47ce515bc 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -92,8 +92,6 @@ static void udf_close_lvid(struct super_block *);
92static unsigned int udf_count_free(struct super_block *); 92static unsigned int udf_count_free(struct super_block *);
93static int udf_statfs(struct dentry *, struct kstatfs *); 93static int udf_statfs(struct dentry *, struct kstatfs *);
94static int udf_show_options(struct seq_file *, struct vfsmount *); 94static int udf_show_options(struct seq_file *, struct vfsmount *);
95static void udf_error(struct super_block *sb, const char *function,
96 const char *fmt, ...);
97 95
98struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi) 96struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi)
99{ 97{
@@ -2096,8 +2094,8 @@ error_out:
2096 return -EINVAL; 2094 return -EINVAL;
2097} 2095}
2098 2096
2099static void udf_error(struct super_block *sb, const char *function, 2097void udf_error(struct super_block *sb, const char *function,
2100 const char *fmt, ...) 2098 const char *fmt, ...)
2101{ 2099{
2102 va_list args; 2100 va_list args;
2103 2101
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index dbd52d4b5eed..81e66afecd42 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -29,6 +29,13 @@ do { \
29#define udf_debug(f, a...) /**/ 29#define udf_debug(f, a...) /**/
30#endif 30#endif
31 31
32__attribute__((format(printf, 3, 4)))
33extern void udf_warning(struct super_block *, const char *, const char *, ...);
34
35__attribute__((format(printf, 3, 4)))
36extern void udf_error(struct super_block *sb, const char *function,
37 const char *fmt, ...);
38
32#define udf_info(f, a...) \ 39#define udf_info(f, a...) \
33 printk(KERN_INFO "UDF-fs INFO " f, ##a); 40 printk(KERN_INFO "UDF-fs INFO " f, ##a);
34 41
@@ -112,8 +119,6 @@ struct extent_position {
112 119
113/* super.c */ 120/* super.c */
114 121
115__attribute__((format(printf, 3, 4)))
116extern void udf_warning(struct super_block *, const char *, const char *, ...);
117static inline void udf_updated_lvid(struct super_block *sb) 122static inline void udf_updated_lvid(struct super_block *sb)
118{ 123{
119 struct buffer_head *bh = UDF_SB(sb)->s_lvid_bh; 124 struct buffer_head *bh = UDF_SB(sb)->s_lvid_bh;