Filesystem

Record Blocking

We saw in O Buffering that blocks are used when it comes to I/O for secondary memory. We also see that records are used to organize a file (File Organization). So we need to translate records (logical) into blocks (physical). How do we do that?

Why don't we just use blocks instead of records everything, since data is stored in blocks anyways?

It’s because we are at different levels of Abstractions. Easier to work with:

  • Records represent data in a structured format, preserving semantics of fields (e.g., name, age, address in a customer record).
  • Blocks are lower-level storage units that hold raw data without inherent structure or semantics.

Using only blocks for everything would lose the context and structure of the data, making it harder to interpret and manipulate efficiently.

There are many ways to design this:

  1. Fixed blocking: Fixed-length records, storing integral number in a block
  2. Variable-length spanned blocking: Variable-length records are used, some records span two blocks with a continuation pointer
  3. Variable-length unspanned blocking: Variable-length records are used, but no spanning is used (wasted space)

In practice

Filesystems primarily used fixed blocking for storing files.