Chapter 12 File-System Implementation Silberschatz - Operating System…
Silberschatz - Operating System Concepts 9th
File System Structure
Basic file system
Logical file system
Partitions and Mounting
Each partition can be either “raw,” containing no file system, or “cooked,” containing a file system. Raw disk is used where no file system is appropriate.
Virtual File System
The VFS layer serves two important functions:
It separates file-system-generic operations from their implementation by defining a clean VFS interface. Several implementations for the VFS interface may coexist on the same machine, allowing transparent access to different types of file systems mounted locally.
It provides a mechanism for uniquely representing a file throughout a network. The VFS is based on a file-representation structure, called a vnode, that contains a numerical designator for a network-wide unique file.This network-wide uniqueness is required for support of network file systems. The kernel maintains one vnode structure for each active node.
boot control block (per volume) can contain information needed by the system to boot an operating system from that volume.
A volume control block contains volume details,such as the number of blocks in the partition, the size of the blocks, a free-block count and free-block pointers, and a free- FCB count and FCB pointers
A directory structure (per file system) is used to organize the files
A per-file FCB contains many details about the file. It has a unique identifier number to allow association with a directory entry
To create a new file, we must first search the directory to be sure that no existing file has the same name. Then, we add a new entry at the end of the directory
Takes a value computed from the file name and returns a pointer to the file name in the linear list.
solves all problems of contiguous allocation. With linked allocation, each file is a linked list of disk blocks; the disk blocks may be scattered anywhere on the disk.
Bringing all the pointers together into one location: the index block.
An index block is normally one disk block. Thus, it can be read and written directly by itself. To allow for large files, we can link together several index blocks
Uses a first-level index block to point to a set of second-level index blocks, which in turn point to the file blocks.
Used in UNIX -based file systems, is to keep the first, say, 15 pointers of the index block in the file’s inode.
Is defined by the disk address and length of the first block.
The problem can be seen as a particular application of the general dynamic storage-allocation problem.
approach stores the addresses of n free blocks in the first free block. The first n−1 of these blocks are actually free. The last block contains the addresses of another n free blocks, and so on.
These entries can be stored in a balanced tree, rather than a linked list, for efficient lookup, insertion, and deletion
link together all the free disk blocks, keeping a pointer to the first free block in a special location on the disk and caching it in memory.
Is a log of all block activity, in time order, in counting format. When ZFS decides to allocate or free space from a metaslab, it loads the associated space map into memory in a balanced-tree structure, indexed by offset, and replays the log into that structure
Each block is represented by 1 bit. If the block is free, the bit is 1; if the block is allocated, the bit is 0.
Efficiency and Performance
The efficient use of disk space depends heavily on the disk-allocation and directory algorithms in use
Originally, many data structures were of fixed length, allocated at system startup. These structures included the process table and the open-file table. When the process table became full, no more processes could be created.
Once a seek is performed, the track is read into the disk cache starting at the sector under the disk head.The disk controller then transfers any sector requests to the operating system.Once blocks make it from the disk controller into main memory, the operating system may cache the blocks there.
Log-Structured File Systems
These logging algorithms have been applied successfully to the problem of consistency checking. The resulting implementations are known as log-based transaction-oriented
Backup and Restore
System programs can be used to backup data from disk to another storage device, such as a magnetic tape or other hard disk. Recovery from the loss of an individual file, or of an entire disk, may then be a matter of restoring the data from backup.
Compares the data in the directory structure with the data blocks on disk and tries to fix any inconsistencies it finds.
The NFS Protocol
The NFS protocol provides a set of RPC s for remote file operations. The procedures support the following operations:
Searching for a file within a directory
Reading a set of directory entries
Manipulating links and directories
Accessing file attributes
Reading and writing files
In NFS involves the parsing of a path name such as /usr/local/dir1/file.txt into separate directory entries, or components
The Mount Protocol
Establishes the initial logical connection between a server and a client.
Includes the name of the remote directory to be mounted and the name of the server machine storing it. The mount request is mapped to the corresponding RPC and is forwarded to the mount server running on the specific server machine.
A remote file operation can be translated directly to the corresponding RPC . Conceptually, NFS adheres to the remote-service paradigm; but in practice, buffering and caching techniques are employed for the sake of performance.
system programs can be used to backup data from disk to another storage device, such as a magnetic tape or other hard disk. Recovery from the loss of an individual file, or of an entire disk, may then be a matter of restoring the data from backup.
Daniela Porras Quiros