CS124 Lec 22
CS124 Lec 22
• Writes should sometimes block each other, but operating systems vary widely
in how they handle this
• e.g. Linux prevents multiple concurrent writes to the same file
File Deletion
• File deletion is a generally straightforward operation home
• Specific implementation details depend heavily on
the file system format user1 user2
• General procedure:
A B C D
• Remove the directory entry referencing the file
• If the file system contains no other hard-links
A C
to the file, record that all of the file’s blocks are
now available for other files to use
• The file system must record what blocks are available for use when files are
created or extended
• Often called a free-space list, although many different approaches are used
to record this information
• Some file systems already have a way of doing this, e.g. FAT formats simply
mark clusters as unused in the table
8
• The file system can break this bitmap into multiple parts
• e.g. Ext2 manages a free-block bitmap for groups of blocks, with the constraint that each
group’s bitmap must always fit into one block
9
• A better use of free blocks: store the addresses of many free blocks in each
block of the linked list
• Only a subset of the free blocks are required for this information
• Still generally requires more space than bitmap approach
10
• Storage devices usually still contain the old contents of truncated/deleted files
• Called data remanence
• SSD can’t just replace block’s contents… F2.2 F3.1 F3.2 F3.3
• SSD marks the cell as “old,” then stores the new data
F3.4 F1.2'
in another cell, and updates the mapping in the FTL
13
old old
F2.2 F3.1 F3.2 F3.3 F2.2 F3.1 F3.2 F3.3
old
F1.1' F2.1' F1.3' F1.2'' F1.1' F2.1' F1.3' F1.2''
14
old old
F2.2 F3.1 F3.2 F3.3 F2.2 F3.1 F3.2 F3.3
old old
Erase! F3.4 F1.2' F3.1' F3.4'
old old
F1.1' F2.1' F1.3' F1.2'' F1.1' F2.1' F1.3' F1.2''
15
• The new version replaces the old version, so the old cell is
no longer used for storage
old
F1.1' F2.1' F1.3' F1.2''
16
• The SSD has no idea that file F3’s data no longer needs F2.2 F3.1
old
F3.2 F3.3
to be preserved
• e.g. if the SSD decides to erase bank 2, it will still move F3.2 and
F3.3 to other cells, even though the OS and the users don’t care!
old
F1.1' F2.1' F1.3' F1.2''
17
old
F1.1' F2.1' F1.3' F1.2''
18
Throughput (MB/s)
150
SLC MLC MLC
216.9 212.6 69.1
13.8 • This
10.6affects 5.3
the design of 100
170 87
SSD-friendly 38filesystems and
5.3 0.6 0.002 50
14
database
2.3
file layouts
1.4
0
of the flash devices. List price
SFS: Random Write Considered Harmful in Solid State Drives (Min et al.) Request size
20
Next Time
• Next time: notes on the Pintos filesystem assignment