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)