Hello, This series closes the biggest gap in the journal so far: directory blocks were not journaled.
I was focused on the disk pager and missed that directory blocks are metadata edited through the directory's file pager, not the disk cache. Their edits reached disk outside the journal, so after a crash a directory entry could name an inode whose creation was never committed. Patch 1 adds journal entry points for metadata blocks that live outside the disk cache: the block is reserved before the edit, and its image is copied into the transaction as soon as the edit is done, instead of by the stop-time sweep. dir.c uses them in direnter, dirremove and dirrewrite. Patch 2 stops diskfs_file_update from syncing a journaled directory's pages, its indirect blocks and its inode. After patch 1, every directory edit sent the block to the journal only to be intercepted: over a large Debian upgrade, 84225 of 84505 intercepts were directory blocks. With patch 2 the total dropped to 294 and the intercept pool, which patch 1 grows to 2048 chunks, can shrink back to 1024. Tested with large upgrades, tar -xf and rm -rf of a Linux kernel tree, and crash recovery after kill -9 of the translator and after killing qemu and generally using and developing on it for the past weeks and e2fsck was clean. More work is in progress to sidestep other syncs that are not neccessary with a journal, so that the intercept cache can eventually go away. Furthermore some other ext2 patches are underway for the code in ext2 that can leave fsck dirty during a crash (for instance pre-allocated blocks stay on disk and fsck finds them during recovery). I will send them all when ready. Milos Nikic (2): ext2fs: Journal directory blocks in writeback mode ext2fs: Leave journaled metadata to the journal in diskfs_file_update ext2fs/dir.c | 126 ++++++++++++++++++++++++++++++++++++-- ext2fs/journal.c | 153 ++++++++++++++++++++++++++++++++++++++++++++--- ext2fs/journal.h | 24 ++++++++ ext2fs/pager.c | 42 ++++++++----- 4 files changed, 318 insertions(+), 27 deletions(-) -- 2.56.0
