From: Andreas Dilger <adilger@sun.com>
To: Theodore Tso <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] have e2fsck/problem.c verify problem.h error codes
Date: Tue, 28 Apr 2009 13:03:03 -0600 [thread overview]
Message-ID: <20090428190303.GB18963@webber.adilger.int> (raw)
In-Reply-To: <20090428020805.GF22104@mit.edu>
On Apr 27, 2009 22:08 -0400, Theodore Ts'o wrote:
> On Mon, Apr 27, 2009 at 04:59:24PM -0600, Andreas Dilger wrote:
> > We've hit a number of cases where the error codes in problem.h have
> > been assigned duplicate values compared to problems in our own e2fsck
> > patches, and this can lead to confusing and difficult to find bugs
> > in e2fsck (e.g. wrong problem messages, incorrect repair action, etc).
> >
> > Attached is a test case for the problem.c file to ensure that the
> > problem table is sorted and does not contain any duplicate values.
> > Having the problem table sorted allows the correctness checking to be
> > very simple, and if it ever became important for performance we could
> > use binary searching of the problem table for the specific problem code.
>
> Hmm, I wonder if we should be doing this a different way. Maybe what
> we should do is to have a single file, call it problem_codes.in, that
> has a format somewhat like this:
>
> DEFINE_PROBLEM(PR_1_ROOT_NO_DIR, 0x010001, "@r is not a @d. ",
> PROMPT_CLEAR, 0)
I was wondering the same, but that would involve a huge amount of
code churn and it probably isn't something you'd accept from someone
else in the end... It would still likely be desirable to have some
indicator of which phase the problem is related to.
> ... which then generates problem_code.h and problem_code.c. That way
> there is a single place where these things are defined, and it
> wouldn't be that hard to create a perl script which looks for multiply
> assigned problem assignments.
>
> In the short term, we can also code up the test script much more
> simply:
>
> awk '/^#define/ {print $3}' < e2fsck/problem.h | sort | uniq -d
Sure, but my patch exists now, and doesn't add any overhead to the
runtime. The fact that the test keeps the table sorted also allows
the ability to do a binary search on the table, should we want to.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next prev parent reply other threads:[~2009-04-28 19:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 22:59 [PATCH 1/2] have e2fsck/problem.c verify problem.h error codes Andreas Dilger
2009-04-28 2:08 ` Theodore Tso
2009-04-28 19:03 ` Andreas Dilger [this message]
2009-05-03 1:11 ` Theodore Tso
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=20090428190303.GB18963@webber.adilger.int \
--to=adilger@sun.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).