Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jyun-An Chen" <jun930436@gmail.com>, linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: Re: [PATCH] ext4: stop walking the whole fsmap meta_list for every extent
Date: Fri, 04 Dec 2026 13:42:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-249887@kernel.org> (raw)
In-Reply-To: <20261204132915.73095-1-jun930436@gmail.com>

> ext4_getfsmap_datadev_helper() is called once per free extent and
> ext4_getfsmap_meta_helper() once per block group that starts with used
> blocks.  Both walk the entire remaining gfi_meta_list on every call,
> although the list is sorted by fmr_physical (list_sort() in
> ext4_getfsmap_find_fixed_metadata(), and entries are only ever removed
> afterwards).  A GETFSMAP query therefore costs
> O(free extents * fixed metadata extents).
> 
> For example, a 4 TiB filesystem (default mkfs, flex_bg=16) has 6210
> merged fixed metadata extents; with 200k free-space fragments near the
> start of the device, a single GETFSMAP call returns 408k records.
> GETFSMAP needs no privileges.
> 
> Stop each walk at the first extent that starts beyond both the current
> range (fsb for the free-extent case, fs_end for the metadata case) and
> gfi_next_fsblk.  Because the list is sorted, no later extent can satisfy
> either branch, and since neither branch runs again, gfi_next_fsblk and
> the local fsb cannot change for the rest of the walk.  The output is
> therefore unchanged.
> 
> Time for one GETFSMAP call returning all records, measured in QEMU
> (TCG, arm64) with and without this patch:
> 
>   image                                   before     after
>   4 TiB, 200k free fragments near start   92.7 s     3.6 s
>   1 TiB, 200k free fragments near start    3.6 s     0.94 s
>   4 TiB, mostly allocated (meta_helper)   17.2 s    13.0 s
> 
> Assisted-by: Claude Code:claude-opus-5-5
> Signed-off-by: Jyun-An Chen <jun930436@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204132915.73095-1-jun930436@gmail.com?part=1

      reply	other threads:[~2026-12-04 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 13:29 [PATCH] ext4: stop walking the whole fsmap meta_list for every extent Jyun-An Chen
2026-12-04 13:42 ` sashiko-bot [this message]

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=sashiko-outbox-249887@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jun930436@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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