Exemplo n.º 1
0
 public InternalCleanRequestFast(InternalRequestType type, IntegerPageAddress targetPageAddress, bool isEmergency, bool isFast)
     : base(type, targetPageAddress, isEmergency, isFast)
 {
     InternalWriteRequestList = new InternalWriteRequestLinkedList();
     this.IsEmergency         = isEmergency;
     this.IsFast = isFast;
 }
Exemplo n.º 2
0
 public IntegerPageAddress(IntegerPageAddress addressToCopy)
 {
     this.ChannelID          = addressToCopy.ChannelID;
     this.LocalFlashChipID   = addressToCopy.LocalFlashChipID;
     this.DieID              = addressToCopy.DieID;
     this.PlaneID            = addressToCopy.PlaneID;
     this.BlockID            = addressToCopy.BlockID;
     this.PageID             = addressToCopy.PageID;
     this.OverallFlashChipID = addressToCopy.OverallFlashChipID;
 }
Exemplo n.º 3
0
 public bool EqualsForInterleaved(IntegerPageAddress referenceAddress)
 {
     if ((this.DieID == referenceAddress.DieID) ||
         (this.LocalFlashChipID != referenceAddress.LocalFlashChipID) ||
         (this.ChannelID != referenceAddress.ChannelID) ||
         (this.OverallFlashChipID != referenceAddress.OverallFlashChipID)
         )
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
 public bool EqualsForMultiplaneErase(IntegerPageAddress referenceAddress, bool BAConstraint)
 {
     if (((this.BlockID != referenceAddress.BlockID) && BAConstraint) ||
         (this.PlaneID == referenceAddress.PlaneID) ||
         (this.DieID != referenceAddress.DieID) ||
         (this.LocalFlashChipID != referenceAddress.LocalFlashChipID) ||
         (this.ChannelID != referenceAddress.ChannelID) ||
         (this.OverallFlashChipID != referenceAddress.OverallFlashChipID)
         )
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 5
0
 public FlashChipPlane(uint channelID, uint overallChipID, uint localChipID, uint dieID, uint planeID,
                       uint BlocksNoPerPlane, uint PagesNoPerBlock)
 {
     this.PlaneGlobalAddress = new IntegerPageAddress(channelID, localChipID, dieID, planeID, 0, 0, overallChipID);
     this.BlockNo            = BlocksNoPerPlane;
     this.FreePagesNo        = BlocksNoPerPlane * PagesNoPerBlock;
     this.Blocks             = new FlashChipBlock[BlocksNoPerPlane];
     for (uint i = 0; i < BlocksNoPerPlane; i++)
     {
         this.Blocks[i] = new FlashChipBlock(PagesNoPerBlock, i);
     }
     this.ReadCount            = 0;
     this.ProgamCount          = 0;
     this.EraseCount           = 0;
     this.CurrentActiveBlockID = 0;
     this.CurrentActiveBlock   = this.Blocks[0];
 }
Exemplo n.º 6
0
 public InternalRequest(InternalRequestType type, uint sizeInSubpages, uint sizeInByte, uint bodyTransferCycles, IntegerPageAddress targetPageAddress)
 {
     this.Type                            = type;
     this.SizeInSubpages                  = sizeInSubpages;
     this.SizeInByte                      = sizeInByte;
     this.BodyTransferCycles              = bodyTransferCycles;
     TargetPageAddress.ChannelID          = targetPageAddress.ChannelID;
     TargetPageAddress.LocalFlashChipID   = targetPageAddress.LocalFlashChipID;
     TargetPageAddress.DieID              = targetPageAddress.DieID;
     TargetPageAddress.PlaneID            = targetPageAddress.PlaneID;
     TargetPageAddress.BlockID            = targetPageAddress.BlockID;
     TargetPageAddress.PageID             = targetPageAddress.PageID;
     TargetPageAddress.OverallFlashChipID = targetPageAddress.OverallFlashChipID;
 }
Exemplo n.º 7
0
        public void prepare()
        {
            IntegerPageAddress tempAddress = new IntegerPageAddress(0, 0, 0, 0, 0, 0, 0);

            switch (InitialSSDStatus)
            {
            case InitialStatus.SteadyState:
                double validPagesAverage    = ((double)initialPercentageOfValidPages / 100) * FTL.PagesNoPerBlock;
                double validPagesStdDev     = ((double)initialPercentagesOfValidPagesStdDev / 100) * FTL.PagesNoPerBlock;
                uint   totalAvailableBlocks = FTL.BlockNoPerPlane - (FTL.GarbageCollector.EmergencyThreshold_PlaneFreePages / FTL.PagesNoPerBlock) - 1;
                for (uint channelID = 0; channelID < FTL.ChannelCount; channelID++)
                {
                    for (uint chipID = 0; chipID < FTL.ChipNoPerChannel; chipID++)
                    {
                        for (uint dieID = 0; dieID < FTL.DieNoPerChip; dieID++)
                        {
                            for (uint planeID = 0; planeID < FTL.PlaneNoPerDie; planeID++)
                            {
                                FlashChipPlane targetPlane = FTL.ChannelInfos[channelID].FlashChips[chipID].Dies[dieID].Planes[planeID];
                                for (uint blockID = 0; blockID < totalAvailableBlocks; blockID++)
                                {
                                    double randomValue = pageStatusRandomGenerator.Normal(validPagesAverage, validPagesStdDev);
                                    if (randomValue < 0)
                                    {
                                        randomValue = validPagesAverage + (validPagesAverage - randomValue);
                                    }
                                    uint numberOfValidPages = Convert.ToUInt32(randomValue);    // * FTL.PagesNoPerBlock);
                                    if (numberOfValidPages > FTL.PagesNoPerBlock)
                                    {
                                        numberOfValidPages = FTL.PagesNoPerBlock;
                                    }
                                    for (uint pageID = 0; pageID < numberOfValidPages; pageID++)
                                    {
                                        FTL.MakePageValid(channelID, chipID, dieID, planeID, blockID, pageID);
                                    }
                                    for (uint pageID = numberOfValidPages; pageID < FTL.PagesNoPerBlock; pageID++)
                                    {
                                        FTL.MakePageInvalid(channelID, chipID, dieID, planeID, blockID, pageID);
                                    }

                                    if (FTL.ChannelInfos[channelID].FlashChips[chipID].Dies[dieID].Planes[planeID].Blocks[blockID].FreePageNo != 0)
                                    {
                                        throw new Exception("Huh for free pages");
                                    }
                                    if (FTL.ChannelInfos[channelID].FlashChips[chipID].Dies[dieID].Planes[planeID].Blocks[blockID].LastWrittenPageNo != 255)
                                    {
                                        throw new Exception("Huh for last written page no");
                                    }
                                }
                            }
                        }
                    }
                }
                break;

            case InitialStatus.Empty:
                break;

            default:
                throw new Exception("Unhandled initial status!");
            }
        }
 public InternalCleanRequest(InternalRequestType type, IntegerPageAddress targetPageAddress, bool isEmergency, bool isFast, InternalRequestExecutionType execType)
     : this(type, targetPageAddress, isEmergency, isFast)
 {
     this.ExecutionType = execType;
 }
Exemplo n.º 9
0
        public void Segment(uint streamID)
        {
            if (Locked)
            {
                return;
            }

            Locked = true;
            while (myHandler.Flows[streamID].DeviceInternalQueue.Count > 0)
            {
                IORequest currentRequest = myHandler.Flows[streamID].DeviceInternalQueue.First.Value;
                myHandler.Flows[streamID].DeviceInternalQueue.RemoveFirst();
                SegmentIORequestNoCache(currentRequest);
                IntegerPageAddress addr = null;
                foreach (InternalRequest ir in currentRequest.InternalRequestList)
                {
                    addr = ir.TargetPageAddress;
                    if (ir.Type == InternalRequestType.Read)
                    {
                        if (!myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests.ContainsKey(currentRequest))
                        {
                            myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests.Add(currentRequest, 1);
                        }
                        else
                        {
                            myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests[currentRequest] = ((int)myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests[currentRequest]) + 1;
                        }
                        if (!myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests.ContainsKey(currentRequest))
                        {
                            myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests.Add(currentRequest, 1);
                        }
                        else
                        {
                            myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests[currentRequest]
                                = ((int)myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests[currentRequest]) + 1;
                        }
                        if (!myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests.ContainsKey(currentRequest))
                        {
                            myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests.Add(currentRequest, 1);
                        }
                        else
                        {
                            myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests[currentRequest]
                                = ((int)myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests[currentRequest]) + 1;
                        }

                        myHandler.Flows[streamID].ReadQueue.AddLast(ir as InternalReadRequest);
                        myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadCount++;
                        myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadCount++;
                        myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadCount++;
                    }
                    else
                    {
                        if (!myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingWriteRequests.ContainsKey(currentRequest))
                        {
                            myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingWriteRequests.Add(currentRequest, 1);
                        }
                        else
                        {
                            myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingWriteRequests[currentRequest] = ((int)myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingWriteRequests[currentRequest]) + 1;
                        }
                        if (!myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingWriteRequests.ContainsKey(currentRequest))
                        {
                            myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingWriteRequests.Add(currentRequest, 1);
                        }
                        else
                        {
                            myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingWriteRequests[currentRequest]
                                = ((int)myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingWriteRequests[currentRequest]) + 1;
                        }
                        if (!myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingWriteRequests.ContainsKey(currentRequest))
                        {
                            myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingWriteRequests.Add(currentRequest, 1);
                        }
                        else
                        {
                            myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingWriteRequests[currentRequest]
                                = ((int)myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingWriteRequests[currentRequest]) + 1;
                        }

                        myHandler.Flows[streamID].WriteQueue.AddLast(ir as InternalWriteRequest);
                        myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingWriteCount++;
                        myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingWriteCount++;
                        myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingWriteCount++;
                        if ((ir as InternalWriteRequest).UpdateRead != null)
                        {
                            addr = (ir as InternalWriteRequest).UpdateRead.TargetPageAddress;
                            if (!myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests.ContainsKey(currentRequest))
                            {
                                myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests.Add(currentRequest, 1);
                            }
                            else
                            {
                                myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests[currentRequest] = ((int)myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadRequests[currentRequest]) + 1;
                            }
                            if (!myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests.ContainsKey(currentRequest))
                            {
                                myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests.Add(currentRequest, 1);
                            }
                            else
                            {
                                myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests[currentRequest]
                                    = ((int)myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadRequests[currentRequest]) + 1;
                            }
                            if (!myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests.ContainsKey(currentRequest))
                            {
                                myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests.Add(currentRequest, 1);
                            }
                            else
                            {
                                myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests[currentRequest]
                                    = ((int)myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadRequests[currentRequest]) + 1;
                            }

                            myHandler.Flows[streamID].ReadQueue.AddLast((ir as InternalWriteRequest).UpdateRead);
                            myFTL.ResourceAccessTable.ChannelEntries[addr.ChannelID].WaitingReadCount++;
                            myFTL.ResourceAccessTable.DieEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID].WaitingReadCount++;
                            myFTL.ResourceAccessTable.PlaneEntries[addr.ChannelID][addr.LocalFlashChipID][addr.DieID][addr.PlaneID].WaitingReadCount++;
                        }
                    }
                    (myFTL.IOScheduler as IOSchedulerRPB).UpdateGCQueuePriority(ir.TargetPageAddress);
                }
            }
            Locked = false;

            myFTL.IOScheduler.Schedule((uint)myHandler.Flows[streamID].PriorityClass, streamID);
        }