How does a file system like FastFile work?

125 Views Asked by At

I have 2 questions concerning the node array used by this file system which have i nodes to save the files.

Each i-node consists of

  • a user ID (2 bytes)
  • three timestamps (4 bytes each)
  • protection bits (2 bytes)
  • a reference count (2 bytes)
  • a file type (2 bytes)
  • size (4 bytes)

In addition, node-i contains

  • 13 direct indexes
  • an index to a level 1 index table
  • an index to a level 2 index table
  • an index to a level 3 index table

The system also stores the first 436 bytes of each file on node-i.

So, the questions are:

  1. Let's assume that a sector of the disk has 512 bytes, and that any auxiliary index table occupies an entire sector, what is the maximum size of a file in this system?
  2. Is there any benefit to the first 436 bytes of the file being stored on node-i?
1

There are 1 best solutions below

0
Ronald On

Storing the first bytes of the file in the inode speeds up reads for files that can entirely fit in the inode itself. This is called inlining.

Because you mentioned 4 bytes (32 bits) are reserved for the file size, I'd expect 2^32 - 1 to be the max amount of sectors in a file.

From man newfs in OpenBSD:

The maximum size of an FFS file system is 2,147,483,647 (2^31 - 1) of 512-byte blocks, slightly less than 1 TB. FFS2 file systems can be as large as 64 PB.