File-system transaction (source code)

= File-system transaction

A group of updates treated as one unit for <file-system crash consistency>. The three-record append above is one explicitly chosen group. Real <file-system journaling> can batch several <system calls> or split large work across several groups; it does not automatically make an application's several writes into one <file-system transaction>. An <atomic operation> for competing <software threads> likewise does not by itself provide <file-system transaction durability>.

Creation shows why the group must include every related change. In a toy <file-system directory> with space for one more name, creating `notes` with contents `EFGH` needs a <directory entry> mapping `notes` to newly allocated <inode> 42, an <inode allocation bitmap> marking 42 in use, that <inode> with size 4 and a reference to block 9, a <block allocation bitmap> allocating 9, and <file data block> 9 with the contents. An exposed <directory entry> must reach an allocated <inode>, and its content references must reach allocated <file data blocks>. Protecting just the <inode> leaves these relationships outside the <file-system transaction>. This simplified five-record creation excludes parent-directory growth, timestamps and allocation counters; a real <file system> must include its own additional dependencies.