mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: "tytso@mit.edu" <tytso@mit.edu>,
	"adilger.kernel@dilger.ca" <adilger.kernel@dilger.ca>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Daejun Park <daejun7.park@samsung.com>
Subject: [PATCH 0/2] ext4: reduce fast-commit write amplification for scattered writes
Date: Thu, 11 Jun 2026 13:47:33 +0900	[thread overview]
Message-ID: <20260611044733epcms2p38013ae683a283555526f70e4eab6d2a9@epcms2p3> (raw)
In-Reply-To: <CGME20260611044733epcms2p38013ae683a283555526f70e4eab6d2a9@epcms2p3>

ext4 fast commit tracks a single coalesced logical range per inode.  When
an inode is dirtied at several disjoint offsets between two commits (e.g.
sparse/scattered random writes), that range is widened to span [min, max]
of all the touched offsets, and ext4_fc_write_inode_data() then re-logs
every extent inside that span -- including the unmodified ones.  On sparse
allocation this inflates fast-commit traffic and frequently overflows the
fast-commit area, forcing a fallback to a full jbd2 commit.

This series replaces the single range with a small, bounded set of disjoint
ranges so that only the actually-modified regions are logged, while keeping
the per-inode memory cost negligible:

  1/2 tracks up to EXT4_FC_MAX_RANGES (16) disjoint ranges, merging the two
      closest ranges when the set would overflow -- so the worst case
      degrades gracefully to the old single-span behaviour.  The on-disk
      fast-commit (TLV) format is unchanged.

  2/2 allocates that array lazily: the first range is kept inline, the array
      is allocated only when a second disjoint range appears, and on an
      allocation failure we fall back to the inline single range.  The
      per-inode fast-commit footprint drops from ~140 to 20 bytes.

Measured on a sparse random-write workload (1 GiB span, R disjoint dirty
regions per fsync, 300 fsyncs, bare-metal NVMe):

  - fast-commit blocks per commit (R=16):  18.6 -> 1.0
  - full-commit fallback rate     (R=16):  22%  -> 2%   (on a small fs)
  - mean fsync latency:  R=16  -10%,  R=64  -14%
  - p99  fsync latency:  R=16  -31%

The p99 improvement comes from eliminating the full-commit fallback spikes.

Testing: crash recovery (power loss -> fast-commit replay -> verify every
fsync'd block, then e2fsck) is clean; the ext4/generic fast-commit xfstests
show no regression; the unchanged on-disk format means e2fsprogs needs no
update.  Both patches are checkpatch --strict clean.

Based on v6.17-rc3.

Daejun Park (2):
  ext4: track multiple disjoint fast-commit ranges per inode
  ext4: allocate the fast-commit range array lazily

 fs/ext4/ext4.h        |  40 +++++++--
 fs/ext4/fast_commit.c | 196 +++++++++++++++++++++++++++++++++++-------
 fs/ext4/super.c       |   1 +
 3 files changed, 199 insertions(+), 38 deletions(-)

-- 
2.43.0


       reply	other threads:[~2026-06-11  4:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260611044733epcms2p38013ae683a283555526f70e4eab6d2a9@epcms2p3>
2026-06-11  4:47 ` Daejun Park [this message]
2026-07-21 14:44   ` Theodore Tso
     [not found]   ` <CGME20260611044733epcms2p38013ae683a283555526f70e4eab6d2a9@epcms2p1>
2026-07-22  2:53     ` Daejun Park
2026-06-11  4:48 ` [PATCH 1/2] ext4: track multiple disjoint fast-commit ranges per inode Daejun Park
2026-06-11  4:49 ` [PATCH 2/2] ext4: allocate the fast-commit range array lazily Daejun Park

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=20260611044733epcms2p38013ae683a283555526f70e4eab6d2a9@epcms2p3 \
    --to=daejun7.park@samsung.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®