public void AllocatePlaneToWriteTransaction(InternalWriteRequest internalReq) { if (myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN] != 0) { if ((internalReq.State & myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN]) != myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN]) { myFTL.TotalPageReads++; myFTL.PageReadsForWorkload++; myFTL.PageReadsForUpdate++; InternalReadRequest update = new InternalReadRequest(); myFTL.AddressMapper.ConvertPPNToPageAddress(myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.PPN[internalReq.LPN], update.TargetPageAddress); update.TargetFlashChip = myFTL.FlashChips[update.TargetPageAddress.OverallFlashChipID]; update.LPN = internalReq.LPN; update.PPN = myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.PPN[internalReq.LPN]; update.State = ((myFTL.AddressMapper.AddressMappingDomains[internalReq.RelatedIORequest.StreamID].MappingTable.State[internalReq.LPN] ^ internalReq.State) & 0x7fffffff); update.SizeInSubpages = FTL.SizeInSubpages(update.State); update.SizeInByte = update.SizeInSubpages * FTL.SubPageCapacity; update.BodyTransferCycles = update.SizeInByte / FTL.ChannelWidthInByte; update.Type = InternalRequestType.Read; update.IsUpdate = true; update.RelatedWrite = internalReq; update.RelatedIORequest = internalReq.RelatedIORequest; internalReq.UpdateRead = update; internalReq.State = (internalReq.State | update.State); internalReq.SizeInSubpages = FTL.SizeInSubpages(internalReq.State); } } myFTL.AddressMapper.AllocatePlaneForWrite(internalReq.RelatedIORequest.StreamID, internalReq); }
private void createFlashOperationRequest(ulong lpn, uint sizeInSubpages, uint state, IORequest currentIORequest) { if (currentIORequest.Type == IORequestType.Read) { InternalReadRequest subRequest = new InternalReadRequest(); myFTL.TotalPageReads++; myFTL.PageReadsForWorkload++; if (myFTL.AddressMapper.AddressMappingDomains[currentIORequest.StreamID].MappingTable.State[lpn] == 0) { for (var LPN = myFTL.currentActiveWriteLPNs[currentIORequest.StreamID].First; LPN != null; LPN = LPN.Next) { if (LPN.Value == lpn) { return; } } throw new Exception("Accessing an unwritten logical address for read!"); } myFTL.AddressMapper.ConvertPPNToPageAddress(myFTL.AddressMapper.AddressMappingDomains[currentIORequest.StreamID].MappingTable.PPN[lpn], subRequest.TargetPageAddress); subRequest.TargetFlashChip = myFTL.FlashChips[subRequest.TargetPageAddress.OverallFlashChipID]; subRequest.LPN = lpn; subRequest.PPN = myFTL.AddressMapper.AddressMappingDomains[currentIORequest.StreamID].MappingTable.PPN[lpn]; subRequest.SizeInSubpages = sizeInSubpages; subRequest.SizeInByte = sizeInSubpages * FTL.SubPageCapacity; subRequest.BodyTransferCycles = subRequest.SizeInByte / FTL.ChannelWidthInByte; subRequest.State = (myFTL.AddressMapper.AddressMappingDomains[currentIORequest.StreamID].MappingTable.State[lpn] & 0x7fffffff); subRequest.Type = InternalRequestType.Read; subRequest.RelatedIORequest = currentIORequest; //Arash: I have omitted a section of original code to ignore simultaneous read of same memory location currentIORequest.InternalRequestList.AddLast(subRequest); } else //currentRequest.Type == IORequestType.Write { InternalWriteRequest subRequest = new InternalWriteRequest(); myFTL.currentActiveWriteLPNs[currentIORequest.StreamID].AddLast(lpn); myFTL.TotalPageProgams++; myFTL.PageProgramsForWorkload++; subRequest.LPN = lpn; subRequest.PPN = 0; subRequest.SizeInSubpages = sizeInSubpages; subRequest.SizeInByte = sizeInSubpages * FTL.SubPageCapacity; subRequest.BodyTransferCycles = subRequest.SizeInByte / FTL.ChannelWidthInByte; subRequest.State = state; subRequest.Type = InternalRequestType.Write; subRequest.RelatedIORequest = currentIORequest; //The above line should be positioned before AllocateLocation. AllocatePlaneToWriteTransaction(subRequest); currentIORequest.InternalRequestList.AddLast(subRequest); } }
/// <summary> /// Provides communication between controller and flash chip for a multiplane or interleaved read command execution. /// </summary> /// <param name="internalReqList">The list of internal requests that are executed in multiplane or interleaved mode.</param> public abstract void SendAdvCommandToChipRD(InternalReadRequest firstInternalReq, InternalReadRequest secondInternalReq);