TWI822516B - Method and computer program product and apparatus for executing host write commands - Google Patents
Method and computer program product and apparatus for executing host write commands Download PDFInfo
- Publication number
- TWI822516B TWI822516B TW111147881A TW111147881A TWI822516B TW I822516 B TWI822516 B TW I822516B TW 111147881 A TW111147881 A TW 111147881A TW 111147881 A TW111147881 A TW 111147881A TW I822516 B TWI822516 B TW I822516B
- Authority
- TW
- Taiwan
- Prior art keywords
- write command
- host
- logical address
- random
- queue
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000004590 computer program Methods 0.000 title claims abstract description 6
- 238000012545 processing Methods 0.000 claims abstract description 30
- 230000008569 process Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000013519 translation Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- CXOXHMZGEKVPMT-UHFFFAOYSA-N clobazam Chemical compound O=C1CC(=O)N(C)C2=CC=C(Cl)C=C2N1C1=CC=CC=C1 CXOXHMZGEKVPMT-UHFFFAOYSA-N 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000004242 micellar liquid chromatography Methods 0.000 description 1
- 229940044442 onfi Drugs 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000004809 thin layer chromatography Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Abstract
Description
本發明涉及儲存裝置,尤指一種執行主機寫入命令的方法、電腦程式產品及裝置。 The present invention relates to a storage device, and in particular, to a method, computer program product and device for executing a host write command.
閃存通常分為NOR閃存與NAND閃存。NOR閃存為隨機存取裝置,主機端(Host Side)可於位址腳位上提供任何存取NOR閃存的位址,並及時地從NOR閃存的資料腳位上獲得儲存於該位址上的資料。相反地,NAND閃存並非隨機存取,而是序列存取。NAND閃存無法像NOR閃存一樣,可以存取任何隨機位址,主機端反而需要寫入序列的位元組(Bytes)的值到NAND閃存中,用於定義請求命令(Command)的類型(如,讀取、寫入、丟棄、抹除等),以及用在此命令上的位址。位址可指向一個頁面(閃存中寫入作業的最小資料塊)或一個區塊(閃存中抹除作業的最小資料塊)。 Flash memory is usually divided into NOR flash memory and NAND flash memory. NOR flash memory is a random access device. The host side can provide any address to access the NOR flash memory on the address pin and obtain the data stored at that address from the data pin of the NOR flash memory in a timely manner. material. On the contrary, NAND flash memory does not have random access, but sequential access. NAND flash memory cannot access any random address like NOR flash memory. Instead, the host needs to write a sequence of Bytes values into the NAND flash memory to define the type of request command (Command) (for example, read, write, discard, erase, etc.), and the address used on this command. The address can point to a page (the smallest block of data for a write operation in flash memory) or a block (the smallest block of data for an erase operation in flash memory).
然而,在預存模式(Cache Mode)下,欲循序寫入或者隨機寫入的資料可先暫存在閃存控制器中的隨機存取記憶體一段時間,直到適當的時機再寫入閃存模組。然而,寫入暫存資料到閃存模組的時間點和長度,將影響整體的系統效能。因此,本發明提出一種執行主機寫入命令的方法、電腦程式產品及裝置。 However, in Cache Mode, data to be written sequentially or randomly can be temporarily stored in the random access memory in the flash memory controller for a period of time until the appropriate time is reached and then written to the flash memory module. However, the time and length of writing temporary data to the flash memory module will affect the overall system performance. Therefore, the present invention provides a method, computer program product and device for executing a host write command.
有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。 In view of this, how to alleviate or eliminate the deficiencies in the above-mentioned related fields is a problem that needs to be solved.
本說明書涉及一種執行主機寫入命令的方法,由處理單元執行,包含:提供順序寫入命令佇列、隨機寫入命令佇列和標註佇列;從主機端接收主機寫入命令;以及當偵測到主機寫入命令中攜帶的第一邏輯位址區間和至少一個順序寫入命令中攜帶的第二邏輯位址區間和/或至少一個隨機寫入命令中攜帶的第三邏輯位址區間衝突時,推入紀錄至標註佇列,以及依據主機寫入命令所攜帶的所述第一邏輯位址區間的長度,將主機寫入命令推入順序寫入命令佇列或者隨機寫入命令佇列,使得在條件滿足時能依據此紀錄的內容,較主機寫入命令早寫入衝突的順序寫入命令所指出的第二邏輯位址區間和/或衝突的隨機寫入命令所指出的第三邏輯位址區間的使用者資料至閃存模組。 This specification relates to a method for executing host write commands, which is executed by a processing unit and includes: providing a sequential write command queue, a random write command queue, and a label queue; receiving a host write command from the host; and when detecting It is detected that the first logical address range carried in the host write command conflicts with the second logical address range carried in at least one sequential write command and/or the third logical address range carried in at least one random write command. When the record is pushed to the mark queue, and the host write command is pushed into the sequential write command queue or the random write command queue according to the length of the first logical address interval carried by the host write command. , so that when the conditions are met, based on the content of this record, the second logical address range indicated by the conflicting sequence write command and/or the third logical address interval indicated by the conflicting random write command can be written earlier than the host write command. User data in the logical address range to the flash memory module.
順序寫入命令佇列儲存多個順序寫入命令,隨機寫入命令佇列儲存多個隨機寫入命令,此紀錄指出衝突的順序寫入命令和/或衝突的隨機寫入命令需要較主機寫入命令優先被處理的資訊。 The sequential write command queue stores multiple sequential write commands, and the random write command queue stores multiple random write commands. This record indicates that conflicting sequential write commands and/or conflicting random write commands require more time than the host writes. Information that input commands are processed with priority.
本說明書另涉及一種電腦程式產品,包含程式碼。當處理單元執行所述程式碼時,實施如上所述的執行主機寫入命令的方法。 This manual also relates to a computer program product, including program code. When the processing unit executes the program code, the method of executing the host write command as described above is implemented.
本說明書還涉及一種執行主機命令的裝置,包含:主機介面;隨機存取記憶體;和處理單元。隨機存取記憶體配置空間給順序寫入命令佇列、隨機寫入命令佇列和標註佇列。處理單元設置以通過主機介面從主機端接收主機寫入命令;以及當偵測到主機寫入命令中攜帶的第一邏輯位址區間和至少一個所述順序寫入命令中攜帶的第二邏輯位址區間和/或至少一個隨機寫入命令中攜帶的第三邏輯位址區間衝突時,推入紀錄至標註佇列,以及依據主機寫入命令所攜帶的第一邏輯位址區間的長度,將主機寫入命令推入順序寫入命令佇列或者隨機寫入命令佇列,使得在條件滿足時能依據紀錄的內容,較主機寫入命令早寫入衝突的順序寫入命令所指出的第二邏輯位址區間和/或衝突的隨機寫入命令所指出的第三邏輯位址區間的使用者資 料至閃存模組。 This specification also relates to a device for executing host commands, including: a host interface; a random access memory; and a processing unit. The random access memory allocates space for the sequential write command queue, the random write command queue, and the label queue. The processing unit is configured to receive a host write command from the host through the host interface; and when detecting a first logical address range carried in the host write command and at least one second logical bit carried in the sequential write command When the address range and/or the third logical address range carried in at least one random write command conflict, the record is pushed to the mark queue, and the record is pushed according to the length of the first logical address range carried in the host write command. The host write command pushes the sequential write command queue or the random write command queue, so that when the conditions are met, based on the content of the record, the conflicting sequential write command can be written earlier than the host write command. The user information of the logical address range and/or the third logical address range indicated by the conflicting random write command Supplied to the flash memory module.
上述實施例的優點之一,通過如上所述的方法,可在不發生髒寫入的情況下提升資料寫入效能。 One of the advantages of the above embodiment is that through the above method, data writing performance can be improved without dirty writing occurring.
本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。 Other advantages of the present invention will be explained in more detail in conjunction with the following description and drawings.
10:電子裝置 10: Electronic devices
110:主機端 110: Host side
130:閃存控制器 130:Flash controller
131:主機介面 131:Host interface
132:匯流排 132:Bus
134:處理單元 134: Processing unit
135,135#0~135#7:搜索引擎 135,135#0~135#7: Search engine
136:隨機存取記憶體 136: Random access memory
138:直接記憶體存取控制器 138: Direct Memory Access Controller
139:閃存介面 139:Flash memory interface
150:閃存模組 150:Flash memory module
151:介面 151:Interface
153#0~153#15:NAND閃存單元 153#0~153#15: NAND flash memory unit
CH#0~CH#3:通道
CE#0~CE#3:致能訊號
310:順序寫入命令佇列 310: Sequentially write command queue
330:隨機寫入命令佇列 330: Random write command queue
610:命令排程模組 610:Command scheduling module
630:資料寫入模組 630: Data writing module
650:標註佇列 650: Mark queue
S710~S760:方法步驟 S710~S760: Method steps
S810~S850:方法步驟 S810~S850: Method steps
圖1為依據本發明實施例的電子裝置的系統架構圖。 FIG. 1 is a system architecture diagram of an electronic device according to an embodiment of the present invention.
圖2為依據本發明實施例的閃存模組的示意圖。 FIG. 2 is a schematic diagram of a flash memory module according to an embodiment of the present invention.
圖3為依據本發明實施例的隨機更新命令佇列和順序更新命令佇列的示意圖。 FIG. 3 is a schematic diagram of a random update command queue and a sequential update command queue according to an embodiment of the present invention.
圖4為依據本發明實施例的初始入列結果的示意圖。 FIG. 4 is a schematic diagram of an initial enqueuing result according to an embodiment of the present invention.
圖5為依據本發明實施例的中間入列結果的示意圖。 FIG. 5 is a schematic diagram of an intermediate enqueuing result according to an embodiment of the present invention.
圖6為依據本發明實施例的韌體轉換層的方塊圖。 FIG. 6 is a block diagram of a firmware conversion layer according to an embodiment of the present invention.
圖7為依據本發明實施例的主機寫入命令的處理方法的流程圖。 FIG. 7 is a flow chart of a method for processing a host write command according to an embodiment of the present invention.
圖8為依據本發明實施例的主機寫入命令的資料寫入方法的流程圖。 FIG. 8 is a flow chart of a data writing method of a host write command according to an embodiment of the present invention.
圖9至圖13為依據本發明實施例的中間入列結果的示意圖。 9 to 13 are schematic diagrams of intermediate enqueuing results according to embodiments of the present invention.
以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。 The following description is a preferred implementation manner for completing the invention, and its purpose is to describe the basic spirit of the invention, but is not intended to limit the invention. For the actual invention, reference must be made to the following claims.
必須了解的是,使用於本說明書中的「包含」、「包括」等詞,用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。 It must be understood that the words "including" and "including" used in this specification are used to indicate the existence of specific technical features, numerical values, method steps, work processes, components and/or components, but do not exclude the possibility of adding further technical features, values, method steps, processes, components, components, or any combination of the above.
於權利要求中使用如「第一」、「第二」、「第三」等詞是用來修飾權利要求中的元件,並非用來表示之間具有優先順序,前置關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。 The use of words such as "first", "second" and "third" in the claims is used to modify the elements in the claims, and is not used to indicate a priority, precedence relationship, or a single element. Prior to another element, or the chronological order in which method steps are performed, it is only used to distinguish elements with the same name.
必須了解的是,當元件描述為「連接」或「耦接」至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為「直接連接」或「直接耦接」至另一元件時,其中不存在任何中間元件。使用來描述元件之間關係的其他語詞也可類似方式解讀,例如「介於」相對於「直接介於」,或者是「鄰接」相對於「直接鄰接」等等。 It must be understood that when an element is described as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, and intervening elements may also be present. In contrast, when an element is described as being "directly connected" or "directly coupled" to another element, there are no intervening elements present. Other words used to describe the relationship between elements could be interpreted in a similar fashion, such as "between" versus "directly between," or "adjacent" versus "directly adjacent," etc.
參考圖1。電子裝置10包含主機端(Host Side)110、閃存控制器130及閃存模組150,並且閃存控制器130及閃存模組150可合稱為裝置端(Device Side)。電子裝置10可實施於個人電腦、筆記型電腦(Laptop PC)、平板電腦、手機、數位相機、數位攝影機、智慧電視、智慧電冰箱、車用電子系統(Automotive Electronics System)等電子產品之中。主機端110與閃存控制器130的主機介面(Host Interface)137可以通用序列匯流排(Universal Serial Bus,USB)、先進技術附著(advanced technology attachment,ATA)、序列先進技術附著(serial advanced technology attachment,SATA)、快速周邊元件互聯(peripheral component interconnect express,PCI-E)、通用快閃記憶儲存(Universal Flash Storage UFS)、嵌入式多媒體卡(Embedded Multi-Media Card eMMC)等通訊協定彼此溝通。閃存控制器130的閃存介面(Flash Interface)139與閃存模組150可以雙倍資料率(Double Data Rate DDR)通訊協定彼此溝通,例如,開放NAND快閃(Open NAND Flash Interface ONFI)、雙倍資料率開關(DDR Toggle)或其他通訊協定。閃存控制器130包含處理單元134,可使用多種方式實施,如使用通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器),並且在執行軟體以及/或韌體指令時,提供之後描述的功能。處理單元134通過主機介面131接收主機命令,例如讀取命令(Read Command)、寫入命令(Write Command)、丟棄命令(Discard
Command)、抹寫命令(Erase Command)等,依據主機命令的類型和其中攜帶參數產生主機資料更新命令(Host Data-update Command),排程並執行這些命令。閃存控制器130另包含隨機存取記憶體(Random Access Memory,RAM)136,可實施為動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)、靜態隨機存取記憶體(Static Random Access Memory,SRAM)或上述兩者的結合,用於配置空間作為資料緩存器(Data Buffer),儲存從主機端110讀取並即將寫入閃存模組150的使用者資料(也可稱為主機資料),以及從閃存模組150讀取並即將輸出給主機端110的使用者資料。隨機存取記憶體136另可儲存執行過程中需要的資料,例如,變數、資料表、主機-閃存對照表(Host-to-Flash/H2F Table)、閃存-主機對照表(Flash-to-Host/F2H Table)、佇列等。閃存介面139包含NAND閃存控制器(NAND Flash Controller NFC),提供存取閃存模組150時需要的功能,例如命令序列器(Command Sequencer)、低密度奇偶校驗(Low Density Parity Check LDPC)等。
Refer to Figure 1. The
閃存控制器130中可配置匯流排架構(Bus Architecture)132,用於讓元件之間彼此耦接以傳遞資料、位址、控制訊號等,這些元件包含主機介面131、處理單元134、RAM 136、直接記憶體存取(Direct Memory Access,DMA)控制器138、閃存介面139等。DMA控制器138可依據處理單元134的指令,通過匯流排架構132在元件間遷移資料,例如,將主機介面131或閃存介面139中特定資料緩存器(Data Buffer)的資料搬到RAM 136中的特定位址,將RAM 136中特定位址的資料搬到將主機介面131或閃存介面139中的特定資料緩存器等。
The
閃存模組150提供大量的儲存空間,通常是數百個千兆位元組(Gigabytes,GB),甚至是數個萬億位元組(Terabytes,TB),
用於儲存大量的使用者資料,例如高解析度圖片、影片等。閃存模組150中包含控制電路以及記憶體陣列,記憶體陣列中的記憶單元可組態為單層式單元(Single Level Cells,SLCs)、多層式單元(Multiple Level Cells,MLCs)三層式單元(Triple Level Cells,TLCs)、四層式單元(Quad-Level Cells QLCs)或上述的任意組合。處理單元134通過閃存介面139寫入使用者資料到閃存模組150中的指定位址(目的位址),以及從閃存模組150中的指定位址(來源位址)讀取使用者資料。閃存介面139使用數個電子訊號來協調閃存控制器130與閃存模組150間的資料與命令傳遞,包含資料線(Data Line)、時脈訊號(Clock Signal)與控制訊號(Control Signal)。資料線可用於傳遞命令、位址、讀出及寫入的資料;控制訊號線可用於傳遞晶片致能(Chip Enable,CE)、位址提取致能(Address Latch Enable,ALE)、命令提取致能(Command Latch Enable,CLE)、寫入致能(Write Enable,WE)等控制訊號。
The
參考圖2,閃存模組150中的介面151可包含四個輸出入通道(I/O channels,以下簡稱通道)CH#0至CH#3,每一個通道連接四個NAND閃存單元,例如,通道CH#0連接NAND閃存單元153#0、153#4、153#8及153#12。每個NAND閃存單元可封裝為獨立的芯片(die)。閃存介面139可通過介面151發出致能訊號CE#0至CE#3中的一個來致能NAND閃存單元153#0至153#3、153#4至153#7、153#8至153#11、或153#12至153#15,接著以並行的方式從致能的NAND閃存單元讀取使用者資料,或者寫入使用者資料至致能的NAND閃存單元。
Referring to Figure 2, the
在一些實施例中,閃存控制器130可設置專屬的搜索引擎135,包含如寄存器、比較器、輸出邏輯等數位電路,用於讓處理單元134驅動以判斷一個主機寫入命令的邏輯位址區間是否和順序寫入命令佇列310或隨機寫入命令佇列330中紀錄的邏輯位址區間發生衝突(或
者部分重疊)。由於邏輯位址區間的比對需要大量的運算時間,讓處理單元134在設定一個主機寫入命令的邏輯位址區間到搜索引擎135的輸入寄存器之後,就可以離開去執行其他的操作。在一段預設的時間後,處理單元134可讀取搜索引擎135的輸出寄存器的值,以判斷搜索是否結束,判斷輸入的邏輯位址區間是否和順序寫入命令佇列310或隨機寫入命令佇列330中紀錄的邏輯位址區間發生衝突,以及順序寫入命令佇列310或隨機寫入命令佇列330中發生衝突的節點。在另一些實施例中,多個邏輯位址區間的比對可使用搜索程式碼實施,並且在處理單元134載入並執行搜索程式碼時,完成如上所述的判斷,以及輸出搜索結果。
In some embodiments, the
參考圖3,RAM 136配置空間給順序寫入命令佇列(Sequential-write Command Queue,SCQ)310,用於依照到達閃存控制器130的時間順序儲存主機端110發送的順序主機寫入命令,例如邏輯區塊位址長度(Logical Block Address,LBA Length)大於1的主機資料更新命令。RAM 136還配置空間給隨機寫入命令佇列(Random-write Command Queue,RCQ)330,用於依照到達閃存控制器130的時間順序儲存主機端110發送的隨機主機寫入命令,例如LBA長度等於1的主機寫入命令。順序寫入命令佇列310和隨機寫入命令佇列330中的任何一個可儲存數百或者數千筆的主機寫入命令。順序寫入命令佇列310和隨機寫入命令佇列330可為循環式佇列(Cyclical Queue),其操作基本原則是由結束位置(如指標T所指的位置)新增主機寫入命令(可稱為入列),並且由開始位置(如指標H所指的位置)移出主機寫入命令(可稱為出列)。也就是說,第一個新增至佇列的命令,也將會是第一個被移出和處理的,符合先進先出(First-In First-Out,FIFO)的原則。
Referring to Figure 3, the
舉例來說,處理單元134在執行韌體轉換層(Firmware Translation Layer,FTL)的程式碼時,完成如下的主機寫入命令的入列:首先,
通過主機介面131依序從主機端110收到8個主機寫入命令:W0={LBA#0~499,D0};W1={LBA#1000~1499,D1};W2={LBA#2000~2499,D2};W3={LBA#3000~3499,D3};W4={LBA#500,D4};W5={LBA#1500,D5};W6={LBA#2500,D6};W7={LBA#3500,D7}。主機寫入命令W0指示寫入邏輯位址LBA#0~499的資料D0,主機寫入命令W1指示寫入邏輯位址LBA#1000~1499的資料D1,主機寫入命令W2指示寫入邏輯位址LBA#2000~2499的資料D2,主機寫入命令W3指示寫入邏輯位址LBA#3000~3499的資料D3,主機寫入命令W4指示寫入邏輯位址LBA#500的資料D4,主機寫入命令W5指示寫入邏輯位址LBA#1500的資料D5,主機寫入命令W6指示寫入邏輯位址LBA#2500的資料D6,主機寫入命令W7指示寫入邏輯位址LBA#3500的資料D7。參考圖4的入列結果示意圖,接著,FTL依據資料的LBA長度將主機寫入命令W0至W3(可稱為順序寫入命令)推入順序寫入命令佇列310,以及將主機寫入命令W4至W7(可稱為隨機寫入命令)推入隨機寫入命令佇列330。
For example, when the processing unit 134 executes the program code of the Firmware Translation Layer (FTL), it completes the enqueuing of the host write command as follows: First,
Eight host write commands are received sequentially from the
為了提昇閃存模組150的資料寫入效能,閃存控制器130可使用特定政策來處理順序寫入命令和隨機寫入命令。然而,這可能造成主機寫入命令的資料的實際寫入順序和主機端發出的順序不同,因而發生髒寫入(Dirty Write)的情況。例如,接續圖4所示的範例,FTL通過主機介面131收到主機寫入命令W8={LBA#100,D8},指示寫入邏輯位址LBA#100的資料D8。主機寫入命令W8的入列結果如圖5所示。假設閃存控制器130採取隨機寫入優先(Random-write First)的原則來移出和處理順序寫入命令佇列310和隨機寫入命令佇列330中的主機寫入命令:也就是說,閃存控制器130先執行完主機寫入命令W4~W8之後,再執行主機寫入命令W0~W3。因為主機寫入命令W0的執行晚於主機寫入命令W8,造成閃存模組150中所儲存的邏
輯位址LBA#100的資料是D0,並不是主機端110期望的資料D8,發生髒寫入的情況。
In order to improve the data writing performance of the
參考圖6,為了在不發生髒寫入的情況下提升資料寫入效能,本發明實施例提出在FTL中設置獨立執行的命令排程模組610和資料寫入模組630,以及在RAM 136中配置空間來儲存標註佇列(Mark Queue)650。
Referring to Figure 6, in order to improve the data writing performance without dirty writing, the embodiment of the present invention proposes to set up an independently executed
命令排程模組610包含程式碼,用於在被處理單元134執行時,偵測每個通過主機介面131從主機端110所接收到的主機寫入命令的邏輯位址區間(可稱為第一邏輯位址區間)是否和順序寫入命令佇列310中的至少一個順序寫入命令中攜帶的邏輯位址區間(可稱為第二邏輯位址區間)和/或隨機寫入命令佇列330中至少一個隨機寫入命令中攜帶的邏輯位址區間(可稱為第三邏輯位址區間)衝突。一但發現衝突,則命令排程模組610在標註佇列650中推入一個紀錄,用於指出衝突的順序寫入命令和/或衝突的隨機寫入命令需要較接收到的主機寫入命令優先被處理的資訊,以及根據主機寫入命令所攜帶的邏輯位址區間的長度,將接收到的主機寫入命令推入順序寫入命令佇列310或者隨機寫入命令佇列330,使得在特定條件滿足時能依據標註佇列650的此紀錄的內容,較此主機寫入命令早寫入衝突的順序寫入命令所指出的邏輯位址區間和/或衝突的隨機寫入命令所指出的邏輯位址區間的使用者資料至閃存模組150。
The
資料寫入模組630包含程式碼,用於在被處理單元134執行時依據標註佇列650中的紀錄的內容,從順序寫入命令佇列310獲取衝突的順序寫入命令及之前的順序寫入命令中所攜帶的邏輯位址區間(可稱為第一邏輯位址區間),和/或從隨機寫入命令佇列330獲取衝突的隨機寫入命令及之前的隨機寫入命令中所攜帶的邏輯位址區間(可稱為第二邏輯位址區間);從隨機存取記憶體136的指定位址(可稱為第一位址)讀取第一邏輯位址區間的使用者資料,和/或從隨機
存取記憶體136的指定位址(可稱為第二位址)讀取第二邏輯位址區間的使用者資料;以及寫入第一邏輯位址區間的使用者資料,和/或第二邏輯位址區間的使用者資料至閃存模組150。資料寫入模組630會在滿足特定條件時被觸發,完成實際的資料寫入操作。此外,為了讓不同主機命令的延遲時間(Latency)儘可能一致且滿足規範的要求,資料寫入模組630也可控制一次寫入閃存模組150的資料量。
The
標註佇列650可實施為符合先進先出原則的循環式佇列,用於儲存多筆紀錄。每筆紀錄儲存順序寫入命令佇列310或隨機寫入命令佇列330的特定節點及其之前節點的所有主機寫入命令所關聯的使用者資料需要優先被寫入到閃存模組150的資訊。
The
資料寫入模組630的觸發條件可為:從主機端110接收到進入休眠模式(Sleep Mode)、省電模式(Power Saving Mode)或其他類似模式的指令,但還沒有從主機端110接收到離開休眠模式、省電模式或其他類似模式的指令的期間;或者順序寫入命令佇列310、隨機寫入命令佇列330或標註佇列650中被佔用的節點數超過特定閾值。閾值可設為順序寫入命令佇列310、隨機寫入命令佇列330或標註佇列650的指定百分比的節點總數,例如,可設為60%到90%中的任意百分比。
The trigger condition of the
參考圖7所示的主機寫入命令的處理方法流程圖,此方法由處理單元134在載入和執行命令排程模組610時實施,用以反覆地從主機端110接收主機寫入命令,依據欲寫入資料的邏輯位址長度將主機寫入命令推入順序寫入命令佇列310或隨機寫入命令佇列330,並且視情況推入紀錄到標註佇列650。詳細說明如下:
Referring to the flow chart of the host write command processing method shown in Figure 7, this method is implemented by the processing unit 134 when loading and executing the
步驟S710:通過主機介面131從主機端110接收主機寫入命令,包含開始邏輯位址和長度等資訊,此開始邏輯位址和長度可定義一段連續的邏輯位址區間。除了主機寫入命令外,命令排程模組610還通過主機介面131從主機端110接收此主機寫入命令所指示寫入的使用
者資料,並且驅動DMA控制器138將使用者資料儲存到RAM 136中的指定位址。
Step S710: Receive a host write command from the
步驟S720:判斷主機寫入命令中攜帶的任何邏輯位址是否和順序寫入命令佇列310或隨機寫入命令佇列330中紀錄的邏輯位址衝突。如果是,則流程繼續進行步驟S730的處理;否則,流程繼續進行步驟S740的處理。命令排程模組610可驅動專屬的搜索引擎135,或者載入並執行搜索程式碼來完成判斷。
Step S720: Determine whether any logical address carried in the host write command conflicts with the logical address recorded in the sequential
步驟S730:推入至少一個記錄到標註佇列650。新入列的紀錄數目等於和順序寫入命令佇列310及隨機寫入命令佇列330中發生衝突的主機寫入命令的數目。每個新增加的紀錄關聯於順序寫入命令佇列310或隨機寫入命令佇列330中的發生衝突的一個主機寫入命令,並且這些紀錄依據衝突的主機寫入命令的入列時間從先到後依序入列到標註佇列650。
Step S730: Push at least one record to the
步驟S740:依據主機寫入命令中所攜帶的長度判斷此主機寫入命令是否為順序寫入命令。例如,如果長度大於預設閾值,則判斷此主機寫入命令為順序寫入命令.流程繼續進行步驟S750的處理。如果長度等於或小於預設閾值,則判斷此主機寫入命令不是順序寫入命令(也就是隨機寫入命令).流程繼續進行步驟S760的處理。在一些實施例中.預設閾值可設為1。 Step S740: Determine whether the host write command is a sequential write command based on the length carried in the host write command. For example, if the length is greater than the preset threshold, the host write command is judged to be a sequential write command. The flow continues with the processing of step S750. If the length is equal to or less than the preset threshold, it is determined that the host write command is not a sequential write command (that is, a random write command). The flow continues with the processing of step S760. In some embodiments. The preset threshold can be set to 1.
步驟S750:將此主機寫入命令推入順序寫入命令佇列310。除了此順序寫入命令外,還可以在入列節點中紀錄RAM 136中的位址,用於儲存此順序寫入命令的欲寫入的使用者資料。
Step S750: Push the host write command into the sequential
步驟S760:將此主機寫入命令推入隨機寫入命令佇列330。除了此隨機寫入命令外,還可以在入列節點中紀錄RAM 136的位址,用於儲存此隨機寫入命令的欲寫入的使用者資料。
Step S760: Push the host write command into the random
參考圖8所示的主機寫入命令的資料寫入方法的流程圖,此方法由處理單元134在載入和執行資料寫入模組630時實施,用以參考順序
寫入命令佇列310和隨機寫入命令佇列330的主機寫入命令,以及標註佇列650的紀錄來完成實際的資料寫入操作。詳細說明如下:
Referring to the flow chart of the data writing method of the host write command shown in FIG. 8 , this method is implemented by the processing unit 134 when loading and executing the
步驟S810:判斷標註佇列650中是否存在任何的紀錄。如果是,代表已經存在需要優先被處理的主機寫入命令,則流程繼續進行步驟S820的處理;否則,代表不存在需要優先被處理的主機寫入命令,流程繼續進行步驟S830的處理。
Step S810: Determine whether there are any records in the
步驟S820:參考標註佇列650中的內容,以從順序寫入命令佇列310或隨機寫入命令佇列330中獲取需要優先被處理的主機寫入命令。
Step S820: Refer to the content in the
步驟S830:依據特定政策從順序寫入命令佇列310或隨機寫入命令佇列330中獲取主機寫入命令。特定政策可以指,例如,順序寫入命令優先、隨機寫入命令優先、到達時間優先或其他類似的排程政策。
Step S830: Obtain the host write command from the sequential
步驟S840:通過DMA控制器138從RAM 136的指定位址讀取相應於獲取的主機寫入命令的使用者資料,並且驅動閃存介面139以寫入使用者資料到閃存模組150。
Step S840: Read the user data corresponding to the obtained host write command from the specified address of the
步驟S850:判斷閃存控制器130是否還有運算資源可以執行後續的資料寫入操作。如果是,則流程繼續進行步驟S810的處理;否則,流程結束,直到下一次觸發條件成立。閃存控制器130還有運算資源的情況,例如:閃存控制器130還沒有從主機端110接到指令,指示閃存控制器130離開休眠模式、省電模式或其他類似模式;或者,沒有比寫入操作更高優先級的任務,正等待閃存控制器130執行。
Step S850: Determine whether the
以下舉出更多使用個案來說明圖7和圖8所示方法的運行:接續圖4所示的範例,當接收到主機寫入命令W8後(步驟S710),命令排程模組610偵測到主機寫入命令W8中攜帶的邏輯位址LBA#100和順序寫入命令佇列310的第0個節點中的主機寫入命令W0中攜帶的邏輯位址區間LBA#0~499發生衝突(步驟S720中“是”的路徑),推入紀錄:M0=Q0[0]到標註佇列650,其中Q0[0]代表順序寫入命令佇列
310中的第0個節點(步驟S730),並且將主機寫入命令W8推入隨機寫入命令佇列330(步驟S760)。執行後的佇列內容如圖9所示。
The following are more use cases to illustrate the operation of the methods shown in Figures 7 and 8: Continuing the example shown in Figure 4, after receiving the host write command W8 (step S710), the
接著,當接收到主機寫入命令W9={LBA#1200~1299,D9}後(步驟S710),命令排程模組610偵測到主機寫入命令W9中攜帶的邏輯位址區間LBA#1200~1299和順序寫入命令佇列310的第1個節點中的主機寫入命令W1中攜帶的邏輯位址區間LBA#1000~1499發生衝突(步驟S720中“是”的路徑),推入紀錄:M1=Q0[1]到標註佇列650,其中Q0[1]代表順序寫入命令佇列310中的第1個節點(步驟S730),並且將主機寫入命令W8推入順序寫入命令佇列310(步驟S750)。執行後的佇列內容如圖10所示。
Next, after receiving the host write command W9={LBA#1200~1299,D9} (step S710), the
接著,當接收到主機寫入命令W10={LBA#2300~2799,D10}後(步驟S710),命令排程模組610偵測到主機寫入命令W10中攜帶的邏輯位址區間LBA#2300~2799和順序寫入命令佇列310的第2個節點中的主機寫入命令W2中攜帶的邏輯位址區間LBA#2000~2499以及隨機寫入命令佇列330的第2個節點中的主機寫入命令W6中攜帶的邏輯位址LBA#2500發生衝突(步驟S720中“是”的路徑),推入紀錄:M2=Q0[2]+Q1[2]到標註佇列650,其中Q0[2]代表順序寫入命令佇列310中的第2個節點,Q1[2]代表隨機寫入命令佇列330中的第2個節點(步驟S730),並且將主機寫入命令W10推入順序寫入命令佇列310(步驟S750)。執行後的佇列內容如圖11所示。
Next, after receiving the host write command W10={LBA#2300~2799,D10} (step S710), the
接著,假設觸發資料寫入操作的條件滿足,資料寫入模組630發現標註佇列650中存在紀錄(步驟S810中“是”的路徑),根據預設的最大寫入資料量從順序寫入命令佇列310推出主機寫入命令W0和W1,而主機寫入命令W0和W1的待寫入資料是標註佇列650的最上面兩個紀錄M0和M1所指出需要優先寫入的資料,從RAM 136的指定位置依序讀取主機寫入命令W0和W1所指示寫入的使用者資料D0和D1(步驟S820)。資料寫入模組630驅動閃存介面139以依序寫入
使用資料D0和D1到閃存模組150(步驟S840)。執行後的佇列內容如圖12所示。
Next, assuming that the conditions for triggering the data writing operation are met, the
接著,當接收到主機寫入命令W11={LBA#4000~4499,D11}後(步驟S710),命令排程模組610偵測到主機寫入命令W11中攜帶的邏輯位址區間LBA#4000~4499沒有和順序寫入命令佇列310以及隨機寫入命令佇列330中的任何主機寫入命令中攜帶的邏輯位址區間或邏輯位址發生衝突(步驟S720中“否”的路徑)將主機寫入命令W11推入順序寫入命令佇列310(步驟S750)。執行後的佇列內容如圖13所示。
Next, after receiving the host write command W11={LBA#4000~4499,D11} (step S710), the
本發明所述的方法中的全部或部分步驟可以計算機指令實現,例如儲存裝置中的韌體轉換層(Firmware Translation Layer,FTL)、特定硬體的驅動程式等。此外,也可實現於其他類型程式。所屬技術領域具有通常知識者可將本發明實施例的方法撰寫成計算機指令,為求簡潔不再加以描述。依據本發明實施例方法實施的計算機指令可儲存於適當的電腦可讀取媒體,亦可置於可通過網路(例如,網際網路,或其他適當載具)存取的網路伺服器。 All or part of the steps in the method of the present invention can be implemented by computer instructions, such as a firmware translation layer (FTL) in a storage device, a driver for a specific hardware, etc. In addition, it can also be implemented in other types of programs. Those with ordinary skill in the art can write the methods of the embodiments of the present invention as computer instructions, which will not be described again for the sake of simplicity. Computer instructions implemented according to the methods of embodiments of the present invention can be stored in appropriate computer-readable media, or placed in a network server accessible through a network (such as the Internet, or other appropriate vehicles).
電腦可讀取儲存媒體包含揮發性和非揮發性、可卸載和不可卸載的媒體,其以任何方法或技術來實現資訊的儲存,如電腦可讀取指令、資料結構、程式模組、或其他資料。電腦可讀取儲存媒體包含但不限於RAM、ROM、EEPROM、閃存或其他記憶體、CD-ROM、DVD、藍光碟或其他光儲存體、磁卡、磁帶、磁碟或其他磁性儲存體,或者其他可以用以儲存讓指令執行系統所需要和存取的資訊的載具。需要注意的是,電腦可讀取儲存媒體可以是紙張或者其他適當媒體,用以印出程式碼,使其程式碼能夠通過電性方式獲取,例如通過光學掃描紙張或其他媒體,接著在必需的情況下,編譯、解譯或以其他適當方法處理後,接著再儲存到電腦的記憶體中。 Computer-readable storage media includes volatile and non-volatile, removable and non-removable media that use any method or technology to store information, such as computer-readable instructions, data structures, program modules, or other material. Computer-readable storage media includes but is not limited to RAM, ROM, EEPROM, flash memory or other memory, CD-ROM, DVD, Blu-ray disk or other optical storage, magnetic card, tape, magnetic disk or other magnetic storage, or other A vehicle that can be used to store information needed and accessed by the command execution system. It should be noted that the computer-readable storage medium can be paper or other appropriate media, which is used to print out the program code so that the program code can be obtained electronically, such as by optically scanning the paper or other media, and then printing the program code when necessary. In this case, it is compiled, interpreted, or otherwise processed by other appropriate methods, and then stored in the computer's memory.
雖然圖1至圖2中包含了以上描述的元件,但不排除在不違反發明的 精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然圖7至圖8的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。 Although the above-described elements are included in Figures 1 to 2, it does not exclude the possibility of In spirit, using more other add-on components has achieved better technical results. In addition, although the flowcharts of Figures 7 to 8 are executed in a specified order, those skilled in the art can modify the order of these steps without violating the spirit of the invention and achieving the same effect. Therefore, The present invention is not limited to the use of only the sequence described above. In addition, those skilled in the art can also integrate several steps into one step, or in addition to these steps, perform more steps sequentially or in parallel, and the invention is not limited thereby.
雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用以限縮本發明。相反地,此發明涵蓋了熟習此技藝人士顯而易見的修改與相似設置。所以,申請權利要求範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。 Although the present invention is described using the above embodiments, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, this invention covers modifications and similar arrangements which will be obvious to one skilled in the art. Therefore, the scope of the claims of the application must be interpreted in the broadest manner to include all obvious modifications and similar arrangements.
S710~S760:方法步驟 S710~S760: Method steps
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW111147881A TWI822516B (en) | 2022-12-14 | 2022-12-14 | Method and computer program product and apparatus for executing host write commands |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW111147881A TWI822516B (en) | 2022-12-14 | 2022-12-14 | Method and computer program product and apparatus for executing host write commands |
Publications (1)
Publication Number | Publication Date |
---|---|
TWI822516B true TWI822516B (en) | 2023-11-11 |
Family
ID=89722667
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW111147881A TWI822516B (en) | 2022-12-14 | 2022-12-14 | Method and computer program product and apparatus for executing host write commands |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI822516B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201828307A (en) * | 2017-01-19 | 2018-08-01 | 大陸商鵬鼎控股(深圳)股份有限公司 | Resistance material |
TW202134861A (en) * | 2020-02-07 | 2021-09-16 | 美商谷歌有限責任公司 | Interleaving memory requests to accelerate memory accesses |
CN113874826A (en) * | 2019-06-14 | 2021-12-31 | 美光科技公司 | Multi-pass data programming in a memory subsystem having multiple dies and planes |
US20220057953A1 (en) * | 2020-08-18 | 2022-02-24 | SK Hynix Inc. | Memory controller and method of operating the same |
-
2022
- 2022-12-14 TW TW111147881A patent/TWI822516B/en active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201828307A (en) * | 2017-01-19 | 2018-08-01 | 大陸商鵬鼎控股(深圳)股份有限公司 | Resistance material |
CN113874826A (en) * | 2019-06-14 | 2021-12-31 | 美光科技公司 | Multi-pass data programming in a memory subsystem having multiple dies and planes |
TW202134861A (en) * | 2020-02-07 | 2021-09-16 | 美商谷歌有限責任公司 | Interleaving memory requests to accelerate memory accesses |
US20220057953A1 (en) * | 2020-08-18 | 2022-02-24 | SK Hynix Inc. | Memory controller and method of operating the same |
US11494106B2 (en) * | 2020-08-18 | 2022-11-08 | SK Hynix Inc. | Memory controller and method of ordering sequential data and random data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107430493B (en) | Sequential write stream management | |
EP2715729B1 (en) | Apparatus including memory system controllers and related methods | |
TWI512609B (en) | Methods for scheduling read commands and apparatuses using the same | |
KR20140032789A (en) | Controller of nonvolatile memory device and command scheduling method thereof | |
CN108932106B (en) | Solid state disk access method and device using same | |
CN111796759A (en) | Computer readable storage medium and method for fragment data reading on multiple planes | |
US20220300203A1 (en) | Method and apparatus for executing host commands | |
US9733832B2 (en) | Buffer memory accessing method, memory controller and memory storage device | |
TWI822516B (en) | Method and computer program product and apparatus for executing host write commands | |
TWI822517B (en) | Method and computer program product and apparatus for executing host write commands | |
TWI613656B (en) | Methods for priority writes in a ssd (solid state disk) system and apparatuses using the same | |
TWI747660B (en) | Method and apparatus and computer program product for reading data from multiple flash dies | |
US11494113B2 (en) | Computer program product and method and apparatus for scheduling execution of host commands | |
CN113495850B (en) | Method, apparatus and computer readable storage medium for managing garbage collection program | |
TWI758745B (en) | Computer program product and method and apparatus for scheduling executions of host commands | |
CN114625307A (en) | Computer readable storage medium, and data reading method and device of flash memory chip | |
TWI818762B (en) | Method and computer program product and apparatus for scheduling and executing host data-update commands | |
TWI835027B (en) | Method and computer program product and apparatus for updating host-to-flash address mapping table | |
TWI805505B (en) | Method and computer program product and apparatus for scheduling and executing host data-update commands | |
TWI774277B (en) | Method and apparatus for executing host commands | |
TWI814647B (en) | Method and computer program product and apparatus for executing host commands | |
TWI740446B (en) | Computer program product and method and apparatus for managing garbage collection (gc) processes | |
TWI810876B (en) | Method and computer program product and apparatus for data access in response to host discard commands | |
TWI749490B (en) | Computer program product and method and apparatus for programming flash administration tables | |
TW202321921A (en) | Method and computer program product and apparatus for updating host-to-flash address mapping table |