linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH v4 3/5] btrfs: tree-checker: Enhance output for btrfs_check_leaf
Date: Wed, 11 Oct 2017 19:56:15 +0200	[thread overview]
Message-ID: <20171011175615.GA3521@twin.jikos.cz> (raw)
In-Reply-To: <ddcf3b2b-5c56-055a-4a6d-6bc4ba76d4eb@suse.com>

On Wed, Oct 11, 2017 at 06:41:32PM +0300, Nikolay Borisov wrote:
> 
> 
> On  9.10.2017 04:51, Qu Wenruo wrote:
> > Enhance the output to print:
> > 1) Reason
> > 2) Bad value
> >    If reason can't explain enough
> > 3) Good value (range)
> > 
> > Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
> > ---
> >  fs/btrfs/tree-checker.c | 27 +++++++++++++++++++++------
> >  1 file changed, 21 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> > index b4ced8d3ce2a..7bba195ecc8b 100644
> > --- a/fs/btrfs/tree-checker.c
> > +++ b/fs/btrfs/tree-checker.c
> > @@ -233,8 +233,9 @@ int btrfs_check_leaf(struct btrfs_root *root, struct extent_buffer *leaf)
> >  			eb = btrfs_root_node(check_root);
> >  			/* if leaf is the root, then it's fine */
> >  			if (leaf != eb) {
> > -				CORRUPT("non-root leaf's nritems is 0",
> > -					leaf, check_root, 0);
> > +				generic_err(check_root, leaf, 0,
> > +					"invalid nritems, have %u shouldn't be 0 for non-root leaf",
> > +					nritems);
> 
> I'm a bit confused by what this error messages wants to convey. Even
> reading the previous version with CORRUPT() it still didn't make sense.
> So what we want to say here is we shouldn't have empty leaf nodes. So
> Something along the line of "Unexpected empty leaf".
> 
> Why would the (leaf != eb) check not trigger, given that we call
> btrfs_check_leaf when we now that the item is a leaf (level is 0 )?

I've merged the patches, with more adjusmtents to the wording, so any
updates please send as separate patches.

> 
> 
> >  				free_extent_buffer(eb);
> >  				return -EUCLEAN;
> >  			}
> > @@ -265,7 +266,11 @@ int btrfs_check_leaf(struct btrfs_root *root, struct extent_buffer *leaf)
> >  
> >  		/* Make sure the keys are in the right order */
> >  		if (btrfs_comp_cpu_keys(&prev_key, &key) >= 0) {
> > -			CORRUPT("bad key order", leaf, root, slot);
> > +			generic_err(root, leaf, slot,
> > +				"bad key order, prev key (%llu %u %llu) current key (%llu %u %llu)",
> > +				prev_key.objectid, prev_key.type,
> > +				prev_key.offset, key.objectid, key.type,
> > +				key.offset);
> >  			return -EUCLEAN;
> >  		}
> >  
> > @@ -280,7 +285,10 @@ int btrfs_check_leaf(struct btrfs_root *root, struct extent_buffer *leaf)
> >  			item_end_expected = btrfs_item_offset_nr(leaf,
> >  								 slot - 1);
> >  		if (btrfs_item_end_nr(leaf, slot) != item_end_expected) {
> > -			CORRUPT("slot offset bad", leaf, root, slot);
> > +			generic_err(root, leaf, slot,
> > +				"discontinious item end, have %u expect %u",
> 
> s/discontinious/unexpected ?

I've changed that to 'unexpected item end, ...'

  reply	other threads:[~2017-10-11 17:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09  1:51 [PATCH v4 0/5] Enhance tree block validation checker Qu Wenruo
2017-10-09  1:51 ` [PATCH v4 1/5] btrfs: Move leaf and node validation checker to tree-checker.ch Qu Wenruo
2017-10-09  1:51 ` [PATCH v4 2/5] btrfs: tree-checker: Enhance btrfs_check_node output Qu Wenruo
2017-10-09  1:51 ` [PATCH v4 3/5] btrfs: tree-checker: Enhance output for btrfs_check_leaf Qu Wenruo
2017-10-11 15:41   ` Nikolay Borisov
2017-10-11 17:56     ` David Sterba [this message]
2017-10-12  0:28     ` Qu Wenruo
2017-10-12  5:57       ` Nikolay Borisov
2017-10-09  1:51 ` [PATCH v4 4/5] btrfs: tree-checker: Enhance output for check_csum_item Qu Wenruo
2017-10-09  1:51 ` [PATCH v4 5/5] btrfs: tree-checker: Enhance output for check_extent_data_item Qu Wenruo
2017-10-11 17:57 ` [PATCH v4 0/5] Enhance tree block validation checker David Sterba

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=20171011175615.GA3521@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.com \
    /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).