linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: "Roger L. Beckermeyer III" <beckerlee3@gmail.com>,
	dsterba@suse.cz, oleg@redhat.com, mhiramat@kernel.org,
	linux-kernel@vger.kernel.org, josef@toxicpanda.com,
	linux-btrfs@vger.kernel.org, lkp@intel.com
Subject: Re: [PATCH 1/6] rbtree: add rb_find_add_cached() to rbtree.h
Date: Mon, 16 Dec 2024 23:22:25 +0100	[thread overview]
Message-ID: <20241216222225.GF9803@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <ad36347a-14a5-41d4-82d5-f557a0a7f08c@gmx.com>

On Tue, Dec 17, 2024 at 08:43:26AM +1030, Qu Wenruo wrote:
> 
> 
> 在 2024/12/13 19:36, Peter Zijlstra 写道:
> > On Thu, Dec 12, 2024 at 10:46:18AM -0600, Roger L. Beckermeyer III wrote:
> > > Adds rb_find_add_cached() as a helper function for use with
> > > red-black trees. Used in btrfs to reduce boilerplate code.
> > > 
> > > Suggested-by: Josef Bacik <josef@toxicpanda.com>
> > > Signed-off-by: Roger L. Beckermeyer III <beckerlee3@gmail.com>
> > 
> > Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> I guess it's fine to merge this change through btrfs tree?

Yeah, I think so. I don't think there's anything else pending for this
file -- its not touched much.

> 
> Just curious about the existing cmp() and less() functions, as they only
> accept the exist node as const.
> 
> I'm wondering if this is intentional to allow the less/cmp() functions
> to modify the new node if needed.
> As I normally assume such cmp()/less() should never touch any node nor
> its entries.

Oh yeah, they probably should not. I think it's just because the
callchain as a whole does not have const on the new node (for obvious
raisins), and I failed to put it on for the comparators.

You could add it (and fix up the whole tree) and see if anything comes
apart.

  reply	other threads:[~2024-12-16 22:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1733850317.git.beckerlee3@gmail.com>
2024-12-12 16:46 ` [PATCH 1/6] rbtree: add rb_find_add_cached() to rbtree.h Roger L. Beckermeyer III
2024-12-13  7:21   ` Qu Wenruo
2024-12-13  9:05     ` Peter Zijlstra
2024-12-13  9:06   ` Peter Zijlstra
2024-12-16 22:13     ` Qu Wenruo
2024-12-16 22:22       ` Peter Zijlstra [this message]
2024-12-16 22:40         ` Qu Wenruo

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=20241216222225.GF9803@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=beckerlee3@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=oleg@redhat.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).