]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: optimize balance_level() path reference handling
authorSun YangKai <sunk67188@gmail.com>
Fri, 14 Nov 2025 07:24:46 +0000 (15:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:50:56 +0000 (01:50 +0100)
commit3afa17bf243cf384e8caa64e1e3fad8b543c7c83
treebfa9041b2ac08b168a44efb59418714a59c8dcaa
parent31b37b766753682ec1434bb591c5edee94649597
btrfs: optimize balance_level() path reference handling

Instead of incrementing refcount on 'left' node when it's referenced by
path, simply transfer ownership to path and set left to NULL. This
eliminates:

- Unnecessary refcount increment/decrement operations
- Redundant conditional checks for left node cleanup

The path now consistently owns the left node reference when used.

Signed-off-by: Sun YangKai <sunk67188@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c