]> Gentwo Git Trees - linux/.git/commit
btree: simplify merge logic by using btree_last() return value
authorGuan-Chun Wu <409411716@gms.tku.edu.tw>
Tue, 26 Aug 2025 16:17:41 +0000 (00:17 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 14 Sep 2025 00:32:53 +0000 (17:32 -0700)
commit3e3f55f8b73fa0e5c4df50f8b6c001f0a1f18adf
tree34f3f2cab1d68544221918a817377e04ae38aaee
parent3d5f4f15b778d6da9760d54455cc256ecf924c0a
btree: simplify merge logic by using btree_last() return value

Previously btree_merge() called btree_last() only to test existence, then
performed an extra btree_lookup() to fetch the value.  This patch changes
it to directly use the value returned by btree_last(), avoiding redundant
lookups and simplifying the merge loop.

Link: https://lkml.kernel.org/r/20250826161741.686704-1-409411716@gms.tku.edu.tw
Signed-off-by: Guan-Chun Wu <409411716@gms.tku.edu.tw>
Cc: Kuan-Wei Chiu <visitorckw@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/btree.c