4
The Data Structures
of BFS
4.1
What Is a Disk?
BFS views a disk as a linear array of blocks and manages all of its data struc-
tures on top of this basic abstraction. At the lowest level a raw device (such
as a SCSI or IDE disk) has a notion of a device block size, usually 512 bytes.
The concept of a block in BFS rests on top of the blocks of a raw device. The
size of file system blocks is only loosely coupled to the raw device block size.
The only restriction on the file system block size is that it must be a mul-
tiple of the underlying raw device block size. That is, if the raw device block
size is 512 bytes, then the file system can have a block size of 512, 1024, or
2048 bytes. Although it is possible to have a block size of 1536 (3
512),
this is a really poor choice because it is not a power of two. Although it is
not a strict requirement, creating a file system with a block size that is not
a power of two would have significant performance impacts. The file system
block size has implications for the virtual memory system if the system sup-
ports memory-mapped files. Further, if you wish to unify the VM system and
the buffer cache, having a file system block size that is a power of two is a
requirement (the ideal situation is when the VM page size and the file system
block size are equal).
BFS allows block sizes of 1024, 2048, 4096, or 8192 bytes. We chose not to
allow 512-byte block sizes because then certain critical file system data struc-
tures would span more than one block. Data structures spanning more than
one disk block complicated the cache management because of the require-
ments of journaling. Structures spanning more than one block also caused
noticeable performance problems. We explain the maximum block size (8192
bytes) later because it requires understanding several other structures first.
45
Practical File System Design:The Be File System
, Dominic Giampaolo
page 45
Summary :
That is, if the raw device block size is 512 bytes, then the file system can have a block size of 512, 1024, or 2048 bytes. Further, if you wish to unify the VM system and the buffer cache, having a file system block size that is a power of two is a requirement (the ideal situation is when the VM page size and the file system block size are equal).
Tags :
deice,raw,bytes,disk,512,because,structures,bfs,data,two,hae,blocks,power