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:
- 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?
- Is there any benefit to the first 436 bytes of the file being stored on node-i?
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 - 1to be the max amount of sectors in a file.From
man newfsin OpenBSD: