Spaces:
Sleeping
Sleeping
File size: 515 Bytes
0a735c8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
class FTL:
def __init__(self):
self.lba_to_phys = {}
self.phys_to_lba = {}
def map(self, lba, phys):
self.lba_to_phys[lba] = phys
self.phys_to_lba[phys] = lba
def get_phys(self, lba):
return self.lba_to_phys.get(lba, None)
def get_lba(self, phys):
return self.phys_to_lba.get(phys, None)
def invalidate(self, lba):
phys = self.lba_to_phys.pop(lba, None)
if phys:
self.phys_to_lba.pop(phys, None)
|