rv6
rv6 copied to clipboard
FS types whose size are not known at compile time
In Lfs,
- Based on the max number of inodes
n
,- The size of the in-memory
Imap
should be(n + 255) / 256 * 4
bytes to store the mapping for all inodes.
- The size of the in-memory
- Based on the total number of segments
s
of the disk,- The size of the in-memory
SegTable
should be(s + 7) / 8
bytes to store the mapping for all segments.
- The size of the in-memory
The problem is, n
or s
are not known at compile time, and hence, the size of the in-memory Imap
or SegTable
are also not known at compile time. Note that the Ufs also had a similar problem and solved this by limiting the max number of inodes to 200 for all disks.
To solve this, we should
- Allocate the
Imap
andSegTable
at a page instead of placing it on theKernel
. (At booting or every time we mount a disk) - Make the
Imap
orSegTable
big enough so that anyn
ors
should work.- We should have a reasonable limit for
n
ors
. - This could be a small waste of memory if
n
orb
is actually small for the disk.
- We should have a reasonable limit for