From: Jan Kara <jack@suse.cz>
To: Joe Perches <joe@perches.com>
Cc: Jan Kara <jack@suse.cz>, NamJae Jeon <linkinjeon@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] udf: Promote some debugging messages to udf_error
Date: Mon, 10 Oct 2011 19:32:19 +0200 [thread overview]
Message-ID: <20111010173219.GI3944@quack.suse.cz> (raw)
In-Reply-To: <e72525141cf56c5add8c3fda53f89641bd09a848.1318233879.git.joe@perches.com>
On Mon 10-10-11 01:08:02, Joe Perches wrote:
> 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>
> Signed-off-by: Joe Perches <joe@perches.com>
I have now tested this patch and found out it's not such a good idea as
it seems at the first sight. UDF uses udf_read_tagged() to probe whether
some structure is in some location (because some structures can be placed
at several places in the filesystem and the only way to determine where the
structure is to load blocks from all the places and check block headers).
So as a result of this patch normal UDF mount produces about 20 error
messages... So I've altered this patch to change only some messages in
udf_read_tagged(). The result is below.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---
>From 7e273e3b41e32716dc122b293b5f15635af495ff Mon Sep 17 00:00:00 2001
From: Joe Perches <joe@perches.com>
Date: Mon, 10 Oct 2011 01:08:02 -0700
Subject: [PATCH] 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>
---
fs/udf/misc.c | 13 +++++++++----
fs/udf/super.c | 6 ++----
fs/udf/udfdecl.h | 9 +++++++--
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 9215700..a85fa7c 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,
{
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",
+ udf_error(sb, __func__, "read failed, block=%u, location=%d\n",
block, location);
return NULL;
}
@@ -227,15 +228,19 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
}
/* 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) {
+ udf_error(sb, __func__,
+ "tag checksum failed, block %u: 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",
+ udf_error(sb, __func__,
+ "tag version 0x%04x != 0x0002 || 0x0003, block %u\n",
le16_to_cpu(tag_p->descVersion), block);
goto error_out;
}
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 7b27b06..80f47ce 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -92,8 +92,6 @@ static void udf_close_lvid(struct super_block *);
static unsigned int udf_count_free(struct super_block *);
static int udf_statfs(struct dentry *, struct kstatfs *);
static int udf_show_options(struct seq_file *, struct vfsmount *);
-static void udf_error(struct super_block *sb, const char *function,
- const char *fmt, ...);
struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi)
{
@@ -2096,8 +2094,8 @@ error_out:
return -EINVAL;
}
-static void udf_error(struct super_block *sb, const char *function,
- const char *fmt, ...)
+void udf_error(struct super_block *sb, const char *function,
+ const char *fmt, ...)
{
va_list args;
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index dbd52d4..81e66af 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -29,6 +29,13 @@ do { \
#define udf_debug(f, a...) /**/
#endif
+__attribute__((format(printf, 3, 4)))
+extern void udf_warning(struct super_block *, const char *, const char *, ...);
+
+__attribute__((format(printf, 3, 4)))
+extern void udf_error(struct super_block *sb, const char *function,
+ const char *fmt, ...);
+
#define udf_info(f, a...) \
printk(KERN_INFO "UDF-fs INFO " f, ##a);
@@ -112,8 +119,6 @@ struct extent_position {
/* super.c */
-__attribute__((format(printf, 3, 4)))
-extern void udf_warning(struct super_block *, const char *, const char *, ...);
static inline void udf_updated_lvid(struct super_block *sb)
{
struct buffer_head *bh = UDF_SB(sb)->s_lvid_bh;
--
1.7.1
next prev parent reply other threads:[~2011-10-10 17:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 13:53 [PATCH 1/2 v3] udf : enable error print in udf_read_tagged() Namjae Jeon
2011-10-05 22:08 ` Jan Kara
2011-10-05 22:19 ` Joe Perches
2011-10-06 21:41 ` Jan Kara
2011-10-09 3:16 ` NamJae Jeon
2011-10-09 3:29 ` Joe Perches
2011-10-09 4:44 ` NamJae Jeon
2011-10-09 4:56 ` Joe Perches
2011-10-09 6:25 ` NamJae Jeon
2011-10-09 14:07 ` NamJae Jeon
2011-10-10 8:08 ` [PATCH 0/6] udf: Change some KERN_<level>s and logging neatening Joe Perches
2011-10-10 8:08 ` [PATCH 1/6] udf: Promote some debugging messages to udf_error Joe Perches
2011-10-10 10:06 ` NamJae Jeon
2011-10-10 17:32 ` Jan Kara [this message]
2011-10-10 8:08 ` [PATCH 2/6] udf: Rename udf_error to udf_err Joe Perches
2011-10-10 10:18 ` NamJae Jeon
2011-10-10 8:08 ` [PATCH 3/6] udf: Rename udf_warn to udf_warn Joe Perches
2011-10-10 10:18 ` NamJae Jeon
2011-10-10 18:25 ` Paul Bolle
2011-10-10 18:27 ` Joe Perches
2011-10-10 8:08 ` [PATCH 4/6] udf: Convert printks to pr_<level> Joe Perches
2011-10-10 10:21 ` NamJae Jeon
2011-10-10 14:59 ` Jan Kara
2011-10-10 15:20 ` Joe Perches
2011-10-10 15:23 ` Joe Perches
2011-10-10 16:41 ` Jan Kara
2011-10-10 17:25 ` Joe Perches
2011-10-10 17:40 ` Jan Kara
2011-10-10 8:08 ` [PATCH 5/6] udf: Neaten logging output, use vsprintf extension %pV Joe Perches
2011-10-10 10:22 ` NamJae Jeon
2011-10-10 15:04 ` Jan Kara
2011-10-10 15:20 ` Joe Perches
2011-10-10 8:08 ` [PATCH 6/6] udf: Neaten udf_debug uses Joe Perches
2011-10-10 10:23 ` NamJae Jeon
2011-10-10 10:24 ` [PATCH 0/6] udf: Change some KERN_<level>s and logging neatening NamJae Jeon
2011-10-10 17:47 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111010173219.GI3944@quack.suse.cz \
--to=jack@suse.cz \
--cc=joe@perches.com \
--cc=linkinjeon@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome