Professional Documents
Culture Documents
CSC3150
Dr. John C.S. Lui
Abstract
Introduction to Minix File System
Messages
Input parameters
Reply value
status
status
status
status
status
status
File descriptor
New File descriptor
status
status
status
new position
status
status
File descriptor
File descriptor
bytes read
status
status
Always OK
Real time
status
Always OK
status
status
Always OK
bytes written
(no reply)
(see text)
FS layout
I-nodes
~
~
~
~
Boot
block
I-node
bit map
Zone
bit map
Data
....
....
Present
in memory
but not
on disk
Present
on disk
and in
memory
Numer of nodes
Number of zones
Number of i-node bit map blocks
Number of zone bit map blocks
First data zone
Log 2(zone size/block size)
Maximum file size
Magic number
Pointer to i-node bit map block
Bit Maps
I-nodes
in Minix, i-node is a 32-bytes structure. Figure
5.32.
32 bytes
Mode
Uid
File Size
Time of last
modification
Link
Gid
Zone 0 number
Zone 1 number
Zone 2 number
Zone 3 number
Zone 4 number
Zone 5 number
Zone 6 number
Indirect
Double Indirect
Block Cache
Hash table
Rear (MRU)
Front (LRU)
10
11
12
/bin
/user
Unmounted FS
/
/bal
After mounting
/
/lib
/ast
/jim
/ast/f1
/bin
/user
.....
/ast/f2
/user/bal
/user/ast
/user/ast/f2
(a)
(b)
(c)
Figure 5.34: (a) Root file system. (b) An unmounted file system.
(c) The result of mounting the file system of (b) on /user
13
14
File Descriptors
15
Process table
File position
i-node pointer
Parent
Child
~
~
~
~
~
~
~
~
~
~
~
~
Figure 5.35: How file positions are shared between a parent and a child
16
17
18
19
20
21
22
23
24
Block Management
It has six
get_block
put_block
alloc_zone
free_zone
rw_block
invalidate
25
26
I-node management
put_inode
alloc_inode
wipe_inode
free_inode
rw_inode
dup_inode
27
28
Super-block management
put_inode
alloc_inode
wipe_inode
free_inode
rw_inode
dup_inode
29
30
get fd() looks for free le descriptor and free lp
slots.
31
FS main program
32
33
34
35
Entry point
do_read
do_write
read_write
Special
files
dev_io
read_map
Look up
disk address
pipe_check
get_block
rw_block
rw_user
put_block
User-FS
transfer
Return block
to cache
rw_dev
sendrec
36
dev_io
Get final
directory
dev_io
dev_io
dev_io
dev_io
dev_io
dev_io
dev_io
Look up
disk address
Find block
in cache
Load
i-node
Return block
to cache
37