mbox series

[0/5] ext4: improve commit path performance for fast commit

Message ID 20220308105112.404498-1-harshads@google.com
Headers show
Series ext4: improve commit path performance for fast commit | expand

Message

harshad shirwadkar March 8, 2022, 10:51 a.m. UTC
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

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 <harshadshirwadkar@gmail.com>

Harshad Shirwadkar (5):
  ext4: convert i_fc_lock to spinlock
  ext4: drop i_fc_updates from inode fc info
  ext4: for committing inode, make ext4_fc_track_inode wait
  ext4: rework fast commit commit path
  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 | 228 ++++++++++++++++++++----------------------
 fs/ext4/inode.c       |   3 +-
 fs/ext4/super.c       |   2 +-
 fs/jbd2/journal.c     |   2 -
 7 files changed, 134 insertions(+), 138 deletions(-)