FServe / vram /ftl.py
Factor Studios
Upload 37 files
e9bc512 verified
raw
history blame contribute delete
515 Bytes
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)