linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: search_tree ioctl performance improvements and cleanups
@ 2025-06-12  4:31 Sun YangKai
  2025-06-12  4:31 ` [PATCH 1/3] btrfs: narrow loop variable scope in copy_to_sk() Sun YangKai
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Sun YangKai @ 2025-06-12  4:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Sun YangKai

This series optimizes the search_tree ioctl path used by tools like compsize
and cleans up related code:

Patch 1: Narrow loop variable scope

Patch 2: Early exit for out-of-range keys

    Replaces continue with early exit when keys exceed max_key

    Provides measurable performance improvements:
    Cold cache: 34.61s → 30.40s (about 12% improvement)
    Hot cache: 14.19s → 10.57s (about 25% improvement)

Patch 3: Simplify key range checking

    Replaces key_in_sk() helper with direct comparisons

    Adds WARN_ON for min_key validation (safe due to forward search)

    Maintains equivalent functionality with cleaner implementation

These changes optimize a critical path for filesystem analysis tools while
improving code maintainability. The performance gains are particularly
noticeable when scanning large filesystems.

Thanks,
Sun YangKai

Sun YangKai (3):
  btrfs: narrow loop variable scope in copy_to_sk()
  btrfs: early exit the searching process in search_tree ioctl
  btrfs: replace key_in_sk() with a simple btrfs_key compare

 fs/btrfs/ioctl.c | 55 +++++++++++++++++-------------------------------
 1 file changed, 19 insertions(+), 36 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-08-12 12:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12  4:31 [PATCH 0/3] btrfs: search_tree ioctl performance improvements and cleanups Sun YangKai
2025-06-12  4:31 ` [PATCH 1/3] btrfs: narrow loop variable scope in copy_to_sk() Sun YangKai
2025-06-12  4:31 ` [PATCH 2/3] btrfs: early exit the searching process in search_tree ioctl Sun YangKai
2025-06-12  4:31 ` [PATCH 3/3] btrfs: replace key_in_sk() with a simple btrfs_key compare Sun YangKai
2025-06-19 13:43   ` David Sterba
2025-06-19 14:31     ` Sun YangKai
2025-06-19 13:51 ` [PATCH 0/3] btrfs: search_tree ioctl performance improvements and cleanups David Sterba
2025-07-26 13:51 ` [PATCH v2 " Sun YangKai
2025-07-26 13:51   ` [PATCH v2 1/3] btrfs: narrow loop variable scope in copy_to_sk() Sun YangKai
2025-07-26 13:51   ` [PATCH v2 2/3] btrfs: early exit the searching process in search_tree ioctl Sun YangKai
2025-07-26 13:51   ` [PATCH v2 3/3] btrfs: replace key_in_sk() with a simple btrfs_key compare Sun YangKai
2025-08-12 12:05   ` [PATCH v2 0/3] btrfs: search_tree ioctl performance improvements and cleanups Sun YangKai

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).