On Mar 21, 2023, at 7:33 PM, Zhang Yi <yi.zhang@xxxxxxxxxxxxxxx> wrote: > This patch set add a new journal option 'JBD2_CYCLE_RECORD' and always > enable on ext4. It saves journal head for a clean unmounted file system > in the journal super block, which could let us record journal > transactions between each mount continuously. It could help us to do > journal backtrack and find root cause from a corrupted filesystem. > Current filesystem's corruption analysis is difficult and less useful > information, especially on the real products. It is useful to some > extent, especially for the cases of doing fuzzy tests and deploy in some > shout-runing products. Another interesting side benefit of this change is that it gets a step closer to the "lazy ext4" (log-structured optimization) that had been described some time ago at FAST: https://lwn.net/Articles/720226/ https://www.usenix.org/system/files/conference/fast17/fast17-aghayev.pdf https://lists.openwall.net/linux-ext4/2017/04/11/1 Essentially, free space in the filesystem (or a large external device) could be used as a continuous journal, and metadata would only rarely be checkpointed to the actual filesystem. If the "journal" is close to wrapping to the start, either the meta/data is checkpointed (if it is no longer actively used or can make a large write), or re-journaled to the end of the journal. At remount time, the full journal is read into memory (discarding old copies of blocks) and this is used to identify the current metadata rather than reading from the filesystem itself. This would allow e.g. very efficient flash caching of metadata (and also journaled data for small writes) for an HDD (or QLC) device. Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP