Journaled File System(JFS)

The JFS file system is a 64-bit file system created by IBM and ported to Linux in 1999. A stable version was released in 2001. The first implementation was the Linux Kernel 2.4.18.

JFS was originally released in 1990 with AIX version 3.1. It is sometimes referred to as JFS1.

The file name size limit is 255 characters. To support large files and a larger partition (more addressing values), the file system is 64-bit. The file and space limitations are as follows:

File size: 4 PB
File system: 32 PB

To recover from an improper shut down, the file system uses journals to track metadata for files and performs a recovery when a system is restarted from an improper shutdown. Metadata can be restored so information is recovered instead of lost. Of course, this is where the file system gets its name.

A B+ Tree is used to track directories/files and extent locations. The B+ Tree allows for the searches to be performed much faster than most other stored data in files.

The JFS file system allows for the use of Dynamic Inode Allocation. The Inodes are 512 bytes each with 32 Inodes on a 16KB extent. Every file system has a limited number of Inodes, but with Dynamic Inode Allocation, more can be created beyond the standard limit. When Inodes are used up, files cannot be added until files have been deleted and Inodes freed.

Extents are used to help prevent fragmentation. When Extents are used, a “reserved” free space is kept after files. These contiguous free blocks are to allow the file to grow and not cause fragmentation by placing parts of a file in non-contiguous spaces. When files are spread out, or fragmented, system performance can be affected.

Allocating space on the file system is accomplished by using Extents. To manage the free space on the file system, B+ Trees are used to track these spaces. Other file systems use a bitmap to track free and used space. Two B+ Trees are used to track free space on a JFS file system. One tree is used to store the starting block of the free extents, while the second B+ Tree indexes the number of free extents for each starting block. To write a file, the file system can check for a free space with enough contiguous extents, and then find the starting block to begin writing.

NOTE: Bitmaps are used to track used and unused space. These bitmaps are not images, but a file where each bit represents an addressable block. Each bit is either on (1) or off (0) to represent if it is used or free.

To provide more storage, Compression can be used (on AIX only) to compress files so more data can fit than without it being compressed.

JFS also allows for Concurrent I/O (CIO) for shared access of read and writes to a file. Normally, when a file is read or written to, the file is in a "lock" mode to prevent other processes from performing any I/O. With CIO, locks are a shared lock, which means that other I/O can be performed. Read and writes are normally done in a serial fashion. When requests are sent from applications to read or write, the requests are fulfilled as they come - first come first serve, or first in, first out (FIFO). When read or writes are performed, then to improve performance, Direct I/O is used.

JFS obtains faster throughput by using Allocation Groups. These are sections of a disk volume where a read/write can occur simultaneously with other Allocation Groups in the same disk volume. The process works better when the volume spans multiple disks. Allocation Groups may store files within the group which are related. The relation may be that they are from the directory and be from the same application. When a file is opened, the Allocation Group as a whole is locked to prevent the files within the group from being allocated elsewhere. Another allocation option is Sparse Files, where files are spread out over the disk.