Write to Byte
Editorial Calendar

Categories
Previous Editions
Columns
Features
Audio



Resources
BYTE Forums
WebTools
Java Resources
Downloads
History Of Byte

BYTE Humor
Ian Shoales' Page

Print Archives
By Issue   By Topic

About Us
Byte Editorial Staff
Sales Staff
Privacy Policy




Search DDJ

DDJ Links

ARTICLES
SOURCE CODE
DEVSEARCHER
TECHNETCAST
BOOK REVIEWS
OP-EDS
COMMUNITY UNIVERSITY
MICROPROCESSOR RESOURCES
HISTORY OF COMPUTING
MAILINGLISTS




Serving With Linux

BYTE Magazine > Serving With Linux > 2000 > May

How Does A File System Work?

(Journaling File Systems For Linux:  Page 2 of 7 )

In This Article
Journaling File Systems For Linux

How Does A File System Work?

Extent-Based Allocation

How Journaling File Systems Solve The Problem

Options For Linux

Source

Another Option
A file system stores data on the storage device by managing the allocation of each file's blocks (or chunks of the file's content) within the file system.

This is done by maintaining the location of each block for each file in a table that itself resides on the disk. Early DOS and Windows readers might remember the dreaded FAT. Each file system uses a different method for allocation and retrieval of file blocks.

There are two common types of file-system space allocation strategies: block allocation and extent allocation. Block-based allocation creates incremental disk space for a file each time it is extended, whereas extent-based allocation creates a large series of contiguous blocks each time the file exhausts the space available in its last extent.

The block-based allocation mechanism used by traditional Unix files provides a flexible and efficient block-allocation policy. Disk blocks are allocated on the go, which means a minimal number of file-system blocks are allocated to a file in an attempt to conserve storage space. When a file is extended, blocks are allocated from a free block map, so that blocks are sometimes allocated in a random order. This can cause excessive disk seeking, and later reads from the file system will result in the disk mechanism seeking to all of the random block locations that were allocated during the extension of the file.

Random block allocation can be avoided by optimizing the block-allocation policy so that it attempts to allocate a sequential series of blocks. By using a smarter block allocation, large sequential allocations can be achieved. This results in greatly reduced disk seeking. Continuous file-system block allocation will, however, eventually end up with file blocks fragmented across the file system, and file-system access will eventually revert back to a random nature.

The block allocation scheme must also write information about where each new block is allocated every time the file is extended. If the file is being extended one block at a time, a lot of extra disk I/O will be required to write the file-system block structure information. File-system block structure information is known as metadata. File-system metadata is always written synchronously to the storage device, which means operations that change the size of a file need to wait for each metadata operation to complete. As a result, metadata operations can significantly slow overall file-system performance.


 Page 2 of 7 


BYTE Forums
Want to talk about this article?

 Serving With Linux
 


CMPnet


 

 

www4