26.07.2013 Views

File Systems and Disk Layout I/O: The Big Picture

File Systems and Disk Layout I/O: The Big Picture

File Systems and Disk Layout I/O: The Big Picture

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Basics of Directories<br />

A directory is a set of file names, supporting lookup by symbolic name.<br />

In Nachos, each directory is a file containing<br />

a set of mappings from name-><strong>File</strong>Hdr.<br />

Directory(entries)<br />

sector = Find(name)<br />

Add(name, sector)<br />

Remove(name)<br />

Each directory entry is a fixed-size<br />

slot with space for a <strong>File</strong>NameMaxLen byte name.<br />

Entries or slots are found by a linear scan.<br />

directory<br />

fileHdr<br />

A directory entry may hold a pointer to another directory,<br />

forming a hierarchical name space.<br />

11100010<br />

00101101<br />

10111101<br />

0<br />

rain: 32<br />

hail: 48<br />

wind: 18<br />

0<br />

snow: 62<br />

A Nachos <strong>File</strong>system On <strong>Disk</strong><br />

An allocation bitmap file maintains<br />

free/allocated state of each physical<br />

block; its <strong>File</strong>Hdr is always stored in<br />

sector 0.<br />

sector 0<br />

10011010<br />

00110001<br />

00010101<br />

00101110<br />

00011001<br />

01000100<br />

allocation<br />

bitmap file<br />

once upo<br />

n a time<br />

/n in a l<br />

<strong>and</strong> far<br />

far away<br />

, lived th<br />

sector 1<br />

directory<br />

file<br />

0<br />

rain: 32<br />

hail: 48<br />

sector 32<br />

A directory maintains the<br />

name-><strong>File</strong>Hdr mappings for<br />

all existing files; its <strong>File</strong>Hdr is<br />

always stored in sector 1.<br />

wind: 18<br />

0<br />

snow: 62<br />

Every box in this diagram<br />

represents a disk sector.<br />

7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!