mbox series

[0/7] e2fsck: fast commit recovery path e2fsck changes

Message ID 20200319233433.117144-1-harshadshirwadkar@gmail.com
Headers show
Series e2fsck: fast commit recovery path e2fsck changes | expand

Message

Harshad Shirwadkar March 19, 2020, 11:34 p.m. UTC
This patch series adds e2fsck recovery path changes for fast commits.
Fast commit blocks are laid out in the reserved journal area. Each
block in fast commit region, corresponds to one inode. It contains
a header, a copy of the inode and any of the following tags or no
tags at all.

* EXT4_FC_TAG_ADD_DENTRY: add dentry to a directory
* EXT4_FC_TAG_DEL_DENTRY: remove dentry from a directory
* EXT4_FC_TAG_CREAT_DENTRY: new inode with corresponding dentry
* EXT4_FC_TAG_ADD_RANGE: add extent to inode
* EXT4_FC_TAG_DEL_RANGE: remove logical range from inode

High level new journal replay looks like this.

- For all fast commit blocks, invoke j_fc_replay() handler to handle
  blocks in SCAN phase.
  - In this phase, ext4 replay handler verifies that fast commit
    header is not malformed. If there's an error, it stops replay
    by marking error in replay state.
- Replay phase
  - In replay phase, for every fast commit block, fast commit tags
    are handled in following order.
    - Directory entry updates (Add / Remove / Create)
    - Data updates for inode in question.

Verified that all the tests pass:
367 tests succeeded     0 tests failed

New fast commit recovery test:
j_recover_fast_commit: : ok

Github: https://github.com/harshadjs/e2fsprogs/tree/fast-commit-submit

Harshad Shirwadkar(8):
 ext2fs: add fast_commit test
 e2fsck/jbd2: fast commit recovery changes
 e2fsck: main replay handler
 e2fsck/jbd2: add fast commit feature in jbd2
 ext2fs: make ext2fs_calculate_summary_stats() visible
 e2fsck: allow rewriting extents of a file
 e2fsck: make recovery.c identical with kernel
 e2fsck: fast commit recovery path e2fsck changes

 e2fsck/e2fsck.h                      |  26 ++
 e2fsck/extents.c                     | 160 +++++++-----
 e2fsck/jfs_user.h                    |   9 +
 e2fsck/journal.c                     | 489 ++++++++++++++++++++++++++++++++++-
 e2fsck/recovery.c                    | 113 +++++---
 lib/ext2fs/ext2_fs.h                 |  46 ++++
 lib/ext2fs/ext2fs.h                  |   1 +
 lib/ext2fs/initialize.c              |  58 +++++
 lib/ext2fs/jfs_compat.h              |   9 +
 lib/ext2fs/kernel-jbd.h              |   7 +-
 misc/tune2fs.c                       |  57 ----
 resize/resize2fs.c                   |   6 +-
 tests/j_recover_fast_commit/commands |   5 +
 tests/j_recover_fast_commit/expect   |  23 ++
 tests/j_recover_fast_commit/image.gz | Bin 0 -> 87787 bytes
 tests/j_recover_fast_commit/name     |   1 +
 tests/j_recover_fast_commit/script   |  25 ++
 17 files changed, 875 insertions(+), 160 deletions(-)

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>