TW202340939A - Method and computer program product and apparatus for data access in response to host discard commands - Google Patents
Method and computer program product and apparatus for data access in response to host discard commands Download PDFInfo
- Publication number
- TW202340939A TW202340939A TW111112363A TW111112363A TW202340939A TW 202340939 A TW202340939 A TW 202340939A TW 111112363 A TW111112363 A TW 111112363A TW 111112363 A TW111112363 A TW 111112363A TW 202340939 A TW202340939 A TW 202340939A
- Authority
- TW
- Taiwan
- Prior art keywords
- discard
- host
- extended
- logical address
- command
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 238000004590 computer program Methods 0.000 title claims abstract description 6
- 230000017702 response to host Effects 0.000 title 1
- 238000012545 processing Methods 0.000 claims abstract description 74
- 230000004044 response Effects 0.000 claims description 18
- 230000001174 ascending effect Effects 0.000 claims description 4
- 238000009434 installation Methods 0.000 abstract 1
- 230000008569 process Effects 0.000 description 23
- 238000004891 communication Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000013507 mapping Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 230000006870 function Effects 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
- 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
- 230000007812 deficiency Effects 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 229940044442 onfi Drugs 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000004809 thin layer chromatography Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Abstract
Description
本發明涉及儲存裝置,尤指一種因應主機丟棄命令的資料存取方法、產品電腦程式及裝置。The present invention relates to storage devices, and in particular, to a data access method, product computer program and device in response to a host discard command.
閃存通常分為NOR閃存與NAND閃存。NOR閃存為隨機存取裝置,中央處理器(Host)可於位址腳位上提供任何存取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 central processor (Host) can provide any address to access the NOR flash memory on the address pin, and obtain the data stored at the 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 central processor needs to write a sequence of Bytes values to the NAND flash memory to define the type of request command (Command) (such as , 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). In order to improve the execution performance of the flash memory controller, the present invention proposes a data access method, product computer program and device in response to a host discard 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 data access method in response to a host discard command, which is executed by a processing unit and includes: configuring space in a random access memory for an extended discard table, including a plurality of items, and each of the items records that it has been discarded The logical address of the user data; receiving a host discard command from the host end, indicating the first logical address of the user data that is no longer used; adding a new item containing the first logical address to the extended format Discard table; and set the start address register and end address register in the performance engine to redefine the address range of the extended discard table stored in the random access memory, so that the performance engine can borrow The extended discard table is searched from the address range in the random access memory to determine whether user data at a specific logical address is no longer in use.
本說明書另涉及一種電腦程式產品,包含程式碼。當處理單元執行所述程式碼時,實施如上所述的因應主機丟棄命令的資料存取方法。This manual also relates to a computer program product, including program code. When the processing unit executes the program code, the data access method in response to the host discard command as described above is implemented.
本說明書更另涉及一種因應主機丟棄命令的資料存取裝置,包含:隨機存取記憶體;性能引擎;和處理單元。隨機存取記憶體用於配置空間給擴展式丟棄表,其包含多個項目,而每個所述項目記載已經丟棄的使用者資料的邏輯位址。性能引擎包含開始位址寄存器和結束位址寄存器,用於定義所述隨機存取記憶體中儲存所述擴展式丟棄表的位址範圍。處理單元用於從主機端接收主機丟棄命令,其指出不再使用的使用者資料的第一邏輯位址;新增包含所述第一邏輯位址的新項目至所述擴展式丟棄表;以及設定所述性能引擎中的所述開始位址寄存器和所述結束位址寄存器,用於重新定義所述隨機存取記憶體中儲存的所述擴展式丟棄表的位址範圍,使得所述性能引擎藉由在所述隨機存取記憶體中的所述位址範圍搜索所述擴展式丟棄表以判斷特定邏輯位址的使用者資料是否已經不再使用。This specification further relates to a data access device that responds to a host discard command, including: a random access memory; a performance engine; and a processing unit. The random access memory is used to allocate space for the extended discard table, which contains a plurality of entries, and each entry records a logical address of discarded user data. The performance engine includes a start address register and an end address register, which are used to define an address range in the random access memory where the extended discard table is stored. The processing unit is configured to receive a host discard command from the host, which indicates a first logical address of user data that is no longer used; add a new entry including the first logical address to the extended discard table; and Setting the start address register and the end address register in the performance engine are used to redefine the address range of the extended discard table stored in the random access memory, so that the performance The engine determines whether the user data at a specific logical address is no longer in use by searching the extended discard table in the address range in the random access memory.
上述實施例的優點之一,通過性能引擎的設置和擴展式丟棄表的使用,避免處理單元耗費過多的運算資源來判斷主機寫入命令所要寫入的使用者資料的邏輯位址或者主機讀取命令所要讀取的使用者資料的邏輯位址是否落入之前已經丟棄的邏輯位址區間。One of the advantages of the above embodiment is that through the setting of the performance engine and the use of the extended discard table, the processing unit is prevented from consuming too much computing resources to determine the logical address of the user data to be written by the host write command or the host read. Whether the logical address of the user data to be read by the command falls within the previously discarded logical address range.
本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。Other advantages of the present invention will be explained in more detail in conjunction with the following description and drawings.
以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。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 "include" 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 that there is a priority, precedence relationship between them, or that they are one 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 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," "adjacent" versus "directly adjacent," etc.
參考圖1。電子裝置10包含主機端(Host Side)110、閃存控制器130及閃存模組150,並且閃存控制器130及閃存模組150可合稱為裝置端(Device Side)。電子裝置10可實施於個人電腦、筆記型電腦(Laptop PC)、平板電腦、手機、數位相機、數位攝影機等電子產品之中。主機端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)等,排程並執行這些命令。閃存控制器130另包含隨機存取記憶體(Random Access Memory, RAM)136,可實施為動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)、靜態隨機存取記憶體(Static Random Access Memory,SRAM)或上述兩者的結合,用於配置空間作為資料緩衝區,儲存從主機端110讀取並即將寫入閃存模組150的使用者資料(也可稱為主機資料),以及從閃存模組150讀取並即將輸出給主機端110的使用者資料。隨機存取記憶體136另可儲存執行過程中需要的資料,例如,變數、資料表、主機與閃存位址對照表(Host-to-Flash Address Mapping Table,簡稱H2F表)、閃存與主機位址對照表(Flash-to-Host Address Mapping Table,簡稱F2H表)等。閃存介面139包含NAND閃存控制器(NAND Flash Controller,NFC),提供存取閃存模組150時需要的功能,例如命令序列器(Command Sequencer)、低密度奇偶校驗(Low Density Parity Check,LDPC)等。Refer to Figure 1. The
在一些實施例中,處理單元134可服從eMMC的規範,例如於2019年1月發表的
EMBEDDED MULTI-MEDIA CARD (e•MMC), ELECTRICAL STANDARD (5.1)的第6.6.12節,通過主機介面131從主機端110接收丟棄命令(Discard Command)。在另一些實施例中,處理單元134可服從UFS的規範,例如於2020年1月發表的UNIVERSAL FLASH STORAGE (UFS), Version 3.1的第11.3.26節,通過主機介面131從主機端110接收解除映射命令(UNMAP Command)。如果解除映射命令中的單元描述符(Unit Descriptor)的參數”bProvisioningType”設為”02h”時,代表這是一個丟棄命令。主機端110可發送如上所述的主機丟棄命令給閃存控制器130,用以指出不再使用的使用者資料的邏輯位址,例如以主頁面編號(Host Page Number)、邏輯區塊位址(Logical Block Address,LBA)等方式表示。不同於主機抹除命令,閃存控制器130於執行主機丟棄命令時,不需要將用以儲存指定邏輯位址的資料的記憶單元進行實體的抹除,只需要標記此邏輯位址的資料已經不存在。在合適的時候,閃存控制器130執行垃圾回收程序來搜集相應於標記的邏輯位址的實體記憶單元並進行抹除。
In some embodiments, the
閃存控制器130中可配置匯流排架構(Bus Architecture)132,用於讓元件之間彼此耦接以傳遞資料、位址、控制訊號等,這些元件包含主機介面131、處理單元134、RAM 136、性能引擎(Performance Engine)137、直接記憶體存取(Direct Memory Access,DMA)控制器138、閃存介面139等。於一些實施例中,主機介面131、處理單元134、RAM 136、性能引擎137、DMA控制器138與閃存介面139可通過單一匯流排彼此耦接。於另一些實施例中,閃存控制器130中可配置高速匯流排,用於讓處理單元134、性能引擎137、DMA控制器138與RAM 136彼此耦接,並且配置低速匯流排,用於讓處理單元134、DMA控制器138、主機介面131與閃存介面139彼此耦接。DMA控制器138可依據處理單元134的指令,通過匯流排架構132在元件間搬移資料,例如,將主機介面131或閃存介面139中特定資料緩存器(Data Buffer)的資料搬到RAM 136中的特定位址,將RAM 136中特定位址的資料搬到將主機介面131或閃存介面139中的特定資料緩存器等。The
匯流排包含並行的物理線,連接閃存控制器130中兩個以上的組件。匯流排是一種共享的傳輸媒體,在任意的時間上,只能有兩個裝置可以使用這些線來彼此溝通,用於傳遞資料。資料及控制訊號能夠在組件間分別沿資料和控制線進行雙向傳播,但另一方面,位址訊號只能沿位址線進行單向傳播。例如,當處理單元134想要讀取RAM 136的特定位址上的資料時,處理單元134在位址線上傳送此位址給RAM 136。接著,此位址的資料會在資料線上回覆給處理單元134。為了完成資料讀取操作,控制訊號會使用控制線進行傳遞。The bus includes parallel physical lines that connect two or more components in 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可在RAM 136中配置空間給丟棄佇列(Discard Queue)。丟棄佇列包含多個節點,而每個節點用來儲存一個主機丟棄命令所指示的丟棄使用者資料的邏輯位址區間的資訊。表1顯示範例的丟棄佇列:
表1
為了降低處理單元134的負擔以提升閃存控制器130的整體效能,閃存控制器130可在RAM 136中配置空間給擴展式丟棄表(Expanded Discard Table),並使用專用的性能引擎137來搜索擴展式丟棄表。擴展式丟棄表可包含1024個項目,每個項目記載已經丟棄的使用者資料的邏輯位址,或者空值(NULL value)。需要注意的是,本領域技術人員可依據系統的需要在RAM 136中配置更多或更少的空間來儲存擴展式丟棄表,本發明並不限於在擴展式丟棄表只能包含1024個項目。表2顯示範例的擴展式丟棄表:
表2
參考圖3。性能引擎137可包含開始位址寄存器322和結束位址寄存器324,用於讓處理單元134定義擴展式丟棄表在RAM 136中的位址區間。由於擴展式丟棄表所儲存的項目數量是可變動的,因此每當更新完擴展式丟棄表的內容,處理單元134就要重新設定開始位址寄存器322和結束位址寄存器324,用於讓搜索電路310能夠在開始位址寄存器322和結束位址寄存器324所規範的RAM 136的位址區間進行搜索。例如,因應表2的內容,開始位址寄存器322儲存記憶體位址“ExpDiscardTable_start”, 結束位址寄存器324儲存ExpDiscardTable_star+107。性能引擎137可包含八個目標寄存器330#0~330#7,用於讓處理單元134指示搜索電路310在擴展式丟棄表中搜索最多八個主頁面編號。性能引擎137可包含八個結果寄存器350#0~350#7,用於讓搜索電路310可分別儲存對應於目標寄存器330#0~330#7的搜索結果。例如,結果寄存器350#0儲存目標寄存器330#0所指示的主頁面編號的搜索結果,結果寄存器350#1儲存目標寄存器330#1所指示的主頁面編號的搜索結果,依此類推。舉例來說,結果寄存器可為16位元的寄存器,其中的第15位元儲存是否命中的資訊,如果命中時,第14至第0位元儲存擴展式丟棄表中命中的項目編號。處理單元134可讀取結果寄存器350#0~350#7中任意一個的值來獲取相應目標寄存器中的主頁面編號是否出現在擴展式丟棄表中的資訊,以及,如果命中的話,此主頁面編號存在擴展式丟棄表中的哪個項目。需要注意的是,本領域技術人員可依據系統的需要在性能引擎137中配置更多或更少對的目標寄存器和結果寄存器,本發明並不限於在性能引擎137中只能包含八對的目標寄存器和結果寄存器。所屬技術領域人員可使用習知的電路來實作搜索電路310,用於讓搜索電路310在擴展式丟棄表中完成線性搜索(Linear Search)、二元搜索(Binary Search)、指數搜索(Exponential Search)、費波南西搜索(Fibonacci Search)等。Refer to Figure 3. The
在一些實施例中,處理單元134和性能引擎137之間可使用專用導線連接,用於讓處理單元134通過專用導線設定開始位址寄存器322、結束位址寄存器324和目標寄存器330#0~330#7,並且從結果寄存器350#0~350#7讀取搜索結果。In some embodiments, dedicated wires may be used to connect the
在另一些實施例中,處理單元134可通過共享的匯流排架構132設定性能引擎137中的開始位址寄存器322、結束位址寄存器324和目標寄存器330#0~330#7,並且從性能引擎137中的結果寄存器350#0~350#7讀取搜索結果。In other embodiments, the
在一些實施例中,性能引擎137和RAM 136之間可使用專用導線連接,用於讓性能引擎137通過專用導線讀取RAM 136中特定位址的值。In some embodiments, a dedicated wire may be used to connect the
在另一些實施例中,性能引擎137可通過共享的匯流排架構132和DAM控制器138讀取RAM 136中特定位址的值。In other embodiments, the
因應擴展式丟棄表和性能引擎137的技術方案,本發明實施例提出一種主機丟棄命令的執行方法,由處理單元134載入和執行相關韌體或軟體指令時實施。此方法反覆執行,用於處理從主機端110接收到的主機丟棄命令。參考圖4,詳細步驟說明如下:In response to the technical solution of the extended discard table and the
步驟S410:通過主機介面131從主機端110接收第一個(下一個)主機丟棄命令,主機丟棄命令用以指出不再使用的使用者資料的邏輯位址。Step S410: Receive the first (next) host discard command from the
步驟S420:根據主機丟棄命令所指示的丟棄使用者資料的邏輯位址更新RAM 136中儲存的擴展式丟棄表的內容。更新後的擴展式丟棄表的項目會依據邏輯位址做升冪或降冪的排序。Step S420: Update the contents of the extended discard table stored in the
步驟S430:根據更新後的擴展式丟棄表設定性能引擎137中的開始位址寄存器322和結束位址寄存器324。Step S430: Set the
假設在一個迴圈中的步驟S420執行前,擴展式丟棄表如表2所示:在處理單元134接收到指示丟棄主頁面P#400~P#403的使用者資料時(步驟S410),表2的擴展式丟棄表可更新成為下表3所示(步驟S420):
表3
因應擴展式丟棄表和性能引擎137的技術方案,本發明實施例提出一種主機寫入命令執行後的擴展式丟棄表的更新方法,由處理單元134載入和執行相關韌體或軟體指令時實施。此方法反覆執行,用於在每個主機寫入命令執行後適應性地更新擴展式丟棄表。參考圖5,詳細步驟說明如下:In response to the technical solutions of the extended discard table and the
步驟S510:執行第一個(下一個)主機寫入命令,用於將指定邏輯位址的使用者資料通過閃存介面139寫入閃存模組150。Step S510: Execute the first (next) host write command to write the user data at the specified logical address into the
步驟S520:判斷寫入使用者資料的邏輯位址是否出現在擴展式丟棄表中。如果是,則流程繼續進行步驟S530的處理;否則,流程繼續進行步驟S510的處理。處理單元134可將邏輯位址設定到性能引擎137中的目標寄存器330#0~330#7,並且驅動性能引擎137搜索擴展式丟棄表以判斷這些邏輯位址是否出現在擴展式丟棄表中。需要注意的是,處理單元134設定目標寄存器330#0~330#7和驅動性能引擎137後,就可以接著處理其他的任務。一段預設的時間後,處理單元134檢查性能引擎137中的結果寄存器350#0~350#7以判斷這些邏輯位址是否出現在擴展式丟棄表中。當所有的邏輯位址都判斷完成後,處理單元134才繼續進行下個步驟的處理。Step S520: Determine whether the logical address to which the user data is written appears in the extended discard table. If yes, the process continues to the process of step S530; otherwise, the process continues to the process of step S510. The
步驟S530:刪除出現在擴展式丟棄表中的邏輯位址的相應項目。Step S530: Delete the corresponding entry of the logical address appearing in the extended discard table.
步驟S540:根據更新後的擴展式丟棄表設定性能引擎137中的結束位址寄存器324。Step S540: Set the
假設在一個迴圈中的步驟S510執行前,擴展式丟棄表如表2所示:在處理單元134執行完主頁面P#200~P#203的使用者資料的主機寫入命令時(步驟S510),處理單元134將邏輯位址P#200~P#203設定到性能引擎137中的目標寄存器330#0~330#3,並且驅動性能引擎137搜索擴展式丟棄表以判斷這些邏輯位址是否出現在擴展式丟棄表中(步驟S520)。當發現邏輯位址P#200~P#203都出現在擴展式丟棄表時(步驟S520中“是”的路徑),處理單元134可更新擴展式丟棄表成為下表4所示(步驟S530):
表4
因應擴展式丟棄表和性能引擎137的技術方案,本發明實施例提出一種主機讀取命令的執行方法,由處理單元134載入和執行相關韌體或軟體指令時實施。此方法反覆執行,用於在每個主機讀取命令執行時根據擴展式丟棄表的內容選擇性地回覆虛假資料或者真實的使用者資料給主機端110。參考圖6,詳細步驟說明如下:In response to the technical solutions of the extended discard table and
步驟S610:提取第一個(下一個)主機寫入命令,指示閃存控制器130讀取指定邏輯位址的使用者資料。Step S610: Extract the first (next) host write command to instruct the
步驟S620:判斷欲讀取的使用者資料的任何邏輯位址是否出現在擴展式丟棄表中。如果是,則流程繼續進行步驟S630的處理;否則,流程繼續進行步驟S640的處理。處理單元134可將邏輯位址設定到性能引擎137中的目標寄存器330#0~330#7,並且驅動性能引擎137搜索擴展式丟棄表以判斷這些邏輯位址是否出現在擴展式丟棄表中。需要注意的是,處理單元134設定目標寄存器330#0~330#7和驅動性能引擎137後,就可以接著處理其他的任務。一段預設的時間後,處理單元134檢查性能引擎137中的結果寄存器350#0~350#7以判斷這些邏輯位址是否出現在擴展式丟棄表中。當所有的邏輯位址都判斷完成後,處理單元134才繼續進行下個步驟的處理。Step S620: Determine whether any logical address of the user data to be read appears in the extended discard table. If yes, the process continues to the process of step S630; otherwise, the process continues to the process of step S640. The
步驟S632:對於出現在擴展式丟棄表中的邏輯位址,驅動主機介面131回覆虛假值給主機端110。Step S632: For the logical address appearing in the extended discard table, the
步驟S634:驅動閃存介面139從閃存模組150讀取其他沒有出現在擴展式丟棄表中的邏輯位址的使用者資料,並且驅動主機介面131回覆讀出的使用者資料給主機端110。Step S634: The driver
步驟S640:驅動閃存介面139從閃存模組150讀取指定邏輯位址的使用者資料,並且驅動主機介面131回覆讀出的使用者資料給主機端110。Step S640: drive the
在一些實施例中,閃存控制器130可在RAM 136中配置空間給擴展式丟棄表和丟棄佇列。如果一個主機丟棄命令所指示的丟棄使用者資料的邏輯位址長度超過或者等於指定數目時(例如,超過或者等於32時),將主機丟棄命令中攜帶的資訊儲存在丟棄佇列中的一個節點。如果一個主機丟棄命令所指示的丟棄使用者資料的邏輯位址長度低於指定數目時,將主機丟棄命令中攜帶的資訊儲存在擴展式丟棄表中的一個或者多個連續項目。例如,當先前接收到的4個丟棄命令分別指示將主頁面P#100~P#131、P#200~P#203、P#300~P#363和P#500~P#507的使用者資料丟棄時,這4個丟棄命令所指示的資訊會記錄在如下表5所示的丟棄佇列和如下表6所示的擴展式丟棄表:
表5
因應丟棄佇列、擴展式丟棄表和性能引擎137的技術方案,本發明實施例提出一種主機丟棄命令的執行方法,由處理單元134載入和執行相關韌體或軟體指令時實施。此方法反覆執行,用於處理從主機端110接收到的主機丟棄命令。參考圖7,其和圖4的不同在於圖7在步驟S410之後插入步驟S710的判斷,並且在判斷成立後加上步驟S720的處理,詳細說明如下:In response to the technical solutions of the discard queue, the extended discard table and the
步驟S710:判斷主機丟棄命令所指示丟棄的使用者資料的邏輯位址長度是否超過或者等於指定數目(例如,32)。如果是,則流程繼續進行步驟S720的處理;否則,流程繼續進行步驟S420的處理。Step S710: Determine whether the logical address length of the user data discarded as instructed by the host discard command exceeds or is equal to a specified number (for example, 32). If yes, the process continues to the process of step S720; otherwise, the process continues to the process of step S420.
步驟S720:根據主機丟棄命令所指示的丟棄使用者資料的邏輯位址更新RAM 136中儲存的丟棄佇列的內容。Step S720: Update the content of the discard queue stored in the
圖7中的步驟S410至S430的技術細節可參考圖4的相應說明,為求簡明不再贅述。For technical details of steps S410 to S430 in Figure 7 , reference can be made to the corresponding description in Figure 4 , and will not be described again for the sake of simplicity.
因應丟棄佇列、擴展式丟棄表和性能引擎137的技術方案,本發明實施例提出一種主機寫入命令執行後的丟棄佇列和擴展式丟棄表的更新方法,由處理單元134載入和執行相關韌體或軟體指令時實施。此方法反覆執行,用於在每個主機寫入命令執行後適應性地更新丟棄佇列和擴展式丟棄表。參考圖8,其和圖5的不同在於,圖8在步驟S510之後新增了步驟S810的判斷,並且在判斷成立後加上步驟S820的處理。詳細說明如下:In response to the technical solutions of the discard queue, the extended discard table and the
步驟S810:判斷寫入使用者資料的邏輯位址是否出現在丟棄佇列中。如果是,則流程繼續進行步驟S820的處理;否則,流程繼續進行步驟S510的處理。Step S810: Determine whether the logical address to which the user data is written appears in the discard queue. If yes, the process continues to the process of step S820; otherwise, the process continues to the process of step S510.
步驟S820:更新丟棄佇列中的內容已反映主機寫入命令執行結果。假設在一個迴圈中的步驟S510執行前,丟棄佇列如表5所示:在處理單元134執行完主頁面P#100~P#131的使用者資料的主機寫入命令時(步驟S510),處理單元134可刪除丟棄佇列中的第0個節點而成為下表7所示(步驟S820):
表7
圖8中的步驟S510、S530至S430的技術細節可參考圖5的相應說明,為求簡明不再贅述。在這裡需要注意的是,在性能引擎137的協助下,步驟S520至S540的操作可與步驟S810至S820的操作並行執行。For the technical details of steps S510, S530 to S430 in Figure 8, please refer to the corresponding description in Figure 5, and will not be described again for the sake of simplicity. It should be noted here that, with the assistance of the
因應丟棄佇列、擴展式丟棄表和性能引擎137的技術方案,本發明實施例提出一種主機讀取命令的執行方法,由處理單元134載入和執行相關韌體或軟體指令時實施。此方法反覆執行,用於在每個主機讀取命令執行時根據丟棄佇列和擴展式丟棄表的內容選擇性地回覆虛假資料或者真實的使用者資料給主機端110。參考圖9,其和圖6的不同在於其分別以步驟S910、S922、S924取代圖6的步驟S620、S632、S634,詳細說明如下:In response to the technical solutions of the discard queue, the extended discard table and the
步驟S910:判斷欲讀取的使用者資料的邏輯位址是否出現在擴展式丟棄表和丟棄佇列的至少一者之中。如果是,則流程繼續進行步驟S922的處理;否則,流程繼續進行步驟S640的處理。處理單元134可將邏輯位址設定到性能引擎137中的目標寄存器330#0~330#7,並且驅動性能引擎137搜索擴展式丟棄表以判斷這些邏輯位址是否出現在擴展式丟棄表中。需要注意的是,處理單元134設定目標寄存器330#0~330#7和驅動性能引擎137後,就可以接著搜索丟棄佇列,用於判斷這些邏輯位址是否出現在丟棄佇列中。一段預設的時間後,處理單元134檢查性能引擎137中的結果寄存器350#0~350#7以判斷這些邏輯位址是否出現在擴展式丟棄表中。當所有的邏輯位址都判斷完成後,處理單元134才繼續進行下個步驟的處理。Step S910: Determine whether the logical address of the user data to be read appears in at least one of the extended discard table and the discard queue. If yes, the flow continues to the processing of step S922; otherwise, the flow continues to the processing of step S640. The
步驟S922:對於出現在擴展式丟棄表或者丟棄佇列中的每個邏輯位址,驅動主機介面131回覆虛假值給主機端110。Step S922: For each logical address appearing in the extended discard table or discard queue, the
步驟S924:驅動閃存介面139從閃存模組150讀取其他沒有出現在擴展式丟棄表和丟棄佇列中的邏輯位址的使用者資料,並且驅動主機介面131回覆讀出的使用者資料給主機端110。Step S924: Drive the
本發明所述的方法中的全部或部分步驟可以計算機指令實現,例如儲存裝置中的韌體轉換層(Firmware Translation Layer,FTL)、特定硬體的驅動程式等。此外,也可實現於其他類型程式。所屬技術領域具有通常知識者可將本發明實施例的方法撰寫成計算機指令,為求簡潔不再加以描述。依據本發明實施例方法實施的計算機指令可儲存於適當的電腦可讀取媒體,例如DVD、CD-ROM、USB碟、硬碟,亦可置於可通過網路(例如,網際網路,或其他適當載具)存取的網路伺服器。All or part of the steps in the method described in 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 the embodiments of the present invention can be stored in appropriate computer-readable media, such as DVD, CD-ROM, USB disk, hard disk, or can also be placed in a computer that can be accessed through a network (for example, the Internet, or A web server accessible by other appropriate vehicles).
雖然圖1至圖3中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然圖4至圖9的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。Although the above-described elements are included in FIGS. 1 to 3 , it does not rule out that more other additional elements may be used to achieve better technical effects without violating the spirit of the invention. In addition, although the flowcharts of Figures 4 to 9 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.
10:電子裝置
110:主機端
130:閃存控制器
131:主機介面
132:匯流排
134:處理單元
136:隨機存取記憶體
137:性能引擎
138:直接記憶體存取控制器
139:閃存介面
150:閃存模組
151:介面
153#0~153#15:NAND閃存單元
CH#0~CH#3:通道
CE#0~CE#3:致能訊號
310:搜索電路
322:開始位址寄存器
324:結束位址寄存器
330#0~330#7:目標寄存器
350#0~350#7:結果寄存器
S410~S430:方法步驟
S510~S540:方法步驟
S610~S640:方法步驟
S710~S720:方法步驟
S810~S820:方法步驟
S910~S924:方法步驟
10: Electronic devices
110: Host side
130:Flash controller
131:Host interface
132:Bus
134: Processing unit
136: Random access memory
137:Performance engine
138: Direct Memory Access Controller
139:Flash memory interface
150:Flash memory module
151:
圖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 block diagram of a performance engine and a random access memory according to an embodiment of the present invention.
圖4為依據本發明實施例的執行主機丟棄命令的方法流程圖。Figure 4 is a flow chart of a method for executing a host discard command according to an embodiment of the present invention.
圖5為依據本發明實施例的主機寫入命令執行後的擴展式丟棄表的更新方法的流程圖。FIG. 5 is a flow chart of a method for updating the extended discard table after the host write command is executed according to an embodiment of the present invention.
圖6為依據本發明實施例的執行主機讀取命令的方法流程圖。FIG. 6 is a flow chart of a method for executing a host read command according to an embodiment of the present invention.
圖7為依據本發明實施例的執行主機丟棄命令的方法流程圖。Figure 7 is a flow chart of a method for executing a host discard command according to an embodiment of the present invention.
圖8為依據本發明實施例的主機寫入命令執行後的丟棄命令和擴展式丟棄表的更新方法的流程圖。FIG. 8 is a flow chart of a discard command and an update method of an extended discard table after the host write command is executed according to an embodiment of the present invention.
圖9為依據本發明實施例的執行主機讀取命令的方法流程圖。FIG. 9 is a flow chart of a method for executing a host read command according to an embodiment of the present invention.
S410~S430:方法步驟 S410~S430: Method steps
Claims (15)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW111112363A TWI810876B (en) | 2022-03-31 | 2022-03-31 | Method and computer program product and apparatus for data access in response to host discard commands |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW111112363A TWI810876B (en) | 2022-03-31 | 2022-03-31 | Method and computer program product and apparatus for data access in response to host discard commands |
Publications (2)
Publication Number | Publication Date |
---|---|
TWI810876B TWI810876B (en) | 2023-08-01 |
TW202340939A true TW202340939A (en) | 2023-10-16 |
Family
ID=88585488
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW111112363A TWI810876B (en) | 2022-03-31 | 2022-03-31 | Method and computer program product and apparatus for data access in response to host discard commands |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI810876B (en) |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI235915B (en) * | 2003-03-13 | 2005-07-11 | Ritek Corp | Device and method for recording the status of block of a nonvolatile memory |
WO2008057557A2 (en) * | 2006-11-06 | 2008-05-15 | Rambus Inc. | Memory system supporting nonvolatile physical memory |
JP5405513B2 (en) * | 2011-03-22 | 2014-02-05 | 株式会社東芝 | MEMORY SYSTEM, NONVOLATILE MEMORY DEVICE, NONVOLATILE MEMORY DEVICE CONTROL METHOD, AND PROGRAM |
US9323667B2 (en) * | 2012-04-12 | 2016-04-26 | Violin Memory Inc. | System and method for managing trim operations in a flash memory system using mapping tables and block status tables |
TWI639920B (en) * | 2017-11-17 | 2018-11-01 | 財團法人工業技術研究院 | Memory controller, control method for the memory controller, memory and control method for the memory |
TWI692690B (en) * | 2017-12-05 | 2020-05-01 | 慧榮科技股份有限公司 | Method for accessing flash memory module and associated flash memory controller and electronic device |
-
2022
- 2022-03-31 TW TW111112363A patent/TWI810876B/en active
Also Published As
Publication number | Publication date |
---|---|
TWI810876B (en) | 2023-08-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021004231A1 (en) | Data storage method for flash memory device and flash memory device | |
TWI660346B (en) | Memory management method and storage controller | |
US20170357462A1 (en) | Method and apparatus for improving performance of sequential logging in a storage device | |
KR20200025184A (en) | Nonvolatile memory device, data storage apparatus including the same and operating method thereof | |
TWI737031B (en) | Method and computer program product for reading data fragments of a page on multiple planes | |
CN110554833B (en) | Parallel processing IO commands in a memory device | |
CN115113799A (en) | Host command execution method and device | |
TWI810876B (en) | Method and computer program product and apparatus for data access in response to host discard commands | |
CN113495850B (en) | Method, apparatus and computer readable storage medium for managing garbage collection program | |
WO2023056687A1 (en) | Solid state disk and data manipulation method and apparatus therefor, and electronic device | |
CN114625307A (en) | Computer readable storage medium, and data reading method and device of flash memory chip | |
TWI835027B (en) | Method and computer program product and apparatus for updating host-to-flash address mapping table | |
TWI670599B (en) | Memory management method and storage controller | |
KR20220076803A (en) | Data storage device and operating method thereof | |
CN113778317A (en) | Computer readable storage medium, method and device for scheduling host commands | |
TWI749490B (en) | Computer program product and method and apparatus for programming flash administration tables | |
TWI758745B (en) | Computer program product and method and apparatus for scheduling executions of host commands | |
CN116931812A (en) | Data access method and storage medium and apparatus for responding to host discard command | |
TWI822516B (en) | Method and computer program product and apparatus for executing host write commands | |
TW202321921A (en) | Method and computer program product and apparatus for updating host-to-flash address mapping table | |
TWI740446B (en) | Computer program product and method and apparatus for managing garbage collection (gc) processes | |
TWI774277B (en) | Method and apparatus for executing host commands | |
TWI805505B (en) | Method and computer program product and apparatus for scheduling and executing host data-update commands | |
KR102583244B1 (en) | Storage device and operating method of storage device | |
TWI822517B (en) | Method and computer program product and apparatus for executing host write commands |