linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Nikolay Borisov <nborisov@suse.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org, dsterba@suse.cz,
	Filipe Manana <fdmanana@gmail.com>
Subject: Re: [PATCH v2 1/3] btrfs: tree-checker: Fix false panic for sanity test
Date: Wed, 15 Nov 2017 16:43:00 +0100	[thread overview]
Message-ID: <20171115154300.GP28899@twin.jikos.cz> (raw)
In-Reply-To: <8bf83e81-290d-7568-2d95-6fc7d1f209d2@gmx.com>

On Wed, Nov 08, 2017 at 04:03:35PM +0800, Qu Wenruo wrote:
> >> +int btrfs_check_leaf_full(struct btrfs_root *root, struct extent_buffer *leaf)
> >> +{
> >> +	return check_leaf(root, leaf, true);
> >> +}
> >> +
> >> +int btrfs_check_leaf_relaxed(struct btrfs_root *root,
> >> +			     struct extent_buffer *leaf)
> >> +{
> >> +	return check_leaf(root, leaf, false);
> >> +}
> > 
> > Presumably the compiler will figure it out but such trivial function are
> > usually defined straight into the header file so that the compiler
> > inlines them.
> 
> In that case, the function check_leaf() must be exported, so that we can
> inline it in header.
> 
> But exporting check_leaf() increases the possibility for caller to use
> it incorrectly, so I prefer no to export any internal used function.
> 
> 
> And compiler may or may not inline check_leaf() into
> btrfs_check_leaf_relaxed() function, but it doesn't matter.
> 
> If optimization can be done by compiler, then let compiler to do it.
> 
> What we should do is to ensure the abstraction/interface design is good
> enough, other than doing possible "over-optimization".

Though my original idea was closer to what Nikolay says, I'm fine with
the way you've actually implement it. We don't need the extended
check_leaf version that's hidden in the .c file.

The function inlining possibilities will be limited, but this is not a
performance critical code where the effects of inlining could be
observale in practice (I think, no numbers to back that).

  reply	other threads:[~2017-11-15 15:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  0:54 [PATCH v2 0/3] tree-checker bug fix and enhancement Qu Wenruo
2017-11-08  0:54 ` [PATCH v2 1/3] btrfs: tree-checker: Fix false panic for sanity test Qu Wenruo
2017-11-08  7:55   ` Nikolay Borisov
2017-11-08  8:03     ` Qu Wenruo
2017-11-15 15:43       ` David Sterba [this message]
2017-11-15 16:15   ` David Sterba
2017-11-16 22:30   ` Liu Bo
2017-11-08  0:54 ` [PATCH v2 2/3] btrfs: tree-checker: Add checker for dir item Qu Wenruo
2017-11-08  7:59   ` Nikolay Borisov
2017-11-08  8:17     ` Qu Wenruo
2017-11-16  1:57     ` Liu Bo
2017-11-15 16:15   ` David Sterba
2017-11-08  0:54 ` [PATCH v2 3/3] btrfs: Cleanup existing name_len checks Qu Wenruo
2017-11-15 16:15   ` 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=20171115154300.GP28899@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=fdmanana@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.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).