AIX 5L: JFS2 Logging Internals
With AIX 5L, IBM introduced JFS2 (Enhanced Journaled File System). While JFS was great, JFS2 handles massive files and high-concurrency workloads like a champ. The secret sauce? The log manager and its use of inline logs or dedicated log devices.
Extent-Based Allocation
Unlike older block-based systems, JFS2 uses extents. An extent is a contiguous sequence of blocks. This reduces fragmentation and improves I/O performance for large databases.
# Creating a JFS2 filesystem with an inline log
crfs -v jfs2 -g rootvg -m /data -a size=1G -a logname=INLINE
The Transaction Log
JFS2 doesn't log data; it logs metadata. This ensures that even after a crash, the filesystem structure remains consistent. The log records describe changes to inodes, maps, and directories.
When a metadata change occurs, the kernel writes a log record to the log buffer.
/* Simplified conceptual view of a JFS2 log record */
struct jfs2_log_record {
uint32_t transaction_id;
uint16_t record_type;
uint32_t inode_number;
uint64_t offset;
uint32_t length;
char undo_data[LOG_SIZE];
char redo_data[LOG_SIZE];
};
If the system crashes, the logredo command (run during boot) replays these records. Redo records are applied for committed transactions, and undo records are used for uncommitted ones. By keeping the log on a separate, fast disk (like a high-speed SSA array), you can significantly boost write performance for Oracle or DB2 workloads.
Aunimeda builds backend systems with optimized database architectures - PostgreSQL, Redis, ClickHouse, and more.
Contact us for backend and database engineering. See also: Custom Software Development