2022-03-09 01:36:58

by harshad shirwadkar

[permalink] [raw]
Subject: [PATCH v2 0/5] ext4: improve commit path performance for fast commit

From: Harshad Shirwadkar <[email protected]>

This is the V2 of the patch series after handling Jan's comments on
the first version.

This patch series supersedes the patch "ext4: remove journal barrier
during fast commit" sent in Feb 2022.

This patch series reworks the fast commit's commit path to improve
overall performance of the commit path. Following optimizations have
been added in this series:

* Avoid having to lock the journal throughout the fast commit.
* Remove tracking of open handles per inode.

With the changes introduced in this patch series, now the commit path
for fast commits is as follows:

[1] Lock the journal by calling jbd2_journal_lock_updates. This
ensures that all the exsiting handles finish and no new handles
can start.
[2] Mark all the fast commit eligible inodes as undergoing fast commit
by setting "EXT4_STATE_FC_COMMITTING" state.
[3] Unlock the journal by calling jbd2_journal_unlock_updates. This allows
starting of new handles. If new handles try to start an update on
any of the inodes that are being committed, ext4_fc_track_inode()
will block until those inodes have finished the fast commit.
[4] Submit data buffers of all the committing inodes.
[5] Wait for [4] to complete.
[6] Commit all the directory entry updates in the fast commit space.
[7] Commit all the changed inodes in the fast commit space and clear
"EXT4_STATE_FC_COMMITTING" for all the inodes.
[8] Write tail tag to ensure atomicity of commits.

(The above flow has been documented in the code as well)

I verified that the patch series introduces no regressions in "quick"
and "log" groups when "fast_commit" feature is enabled.

Signed-off-by: Harshad Shirwadkar <[email protected]>

Harshad Shirwadkar (5):
ext4: convert i_fc_lock to spinlock
ext4: for committing inode, make ext4_fc_track_inode wait
ext4: rework fast commit commit path
ext4: drop i_fc_updates from inode fc info
ext4: update code documentation

fs/ext4/ext4.h | 12 +--
fs/ext4/ext4_jbd2.c | 12 +++
fs/ext4/ext4_jbd2.h | 13 +--
fs/ext4/fast_commit.c | 227 ++++++++++++++++++++----------------------
fs/ext4/inode.c | 3 +-
fs/ext4/super.c | 2 +-
fs/jbd2/journal.c | 2 -
7 files changed, 130 insertions(+), 141 deletions(-)

--
2.35.1.616.g0bdcbb4464-goog