rv6 icon indicating copy to clipboard operation
rv6 copied to clipboard

FS types whose size are not known at compile time

Open travis1829 opened this issue 2 years ago • 0 comments

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.
  • 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 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 and SegTable at a page instead of placing it on the Kernel. (At booting or every time we mount a disk)
  • Make the Imap or SegTable big enough so that any n or s should work.
    • We should have a reasonable limit for n or s.
    • This could be a small waste of memory if n or b is actually small for the disk.

travis1829 avatar Mar 08 '22 04:03 travis1829