TWI810876B - 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
- TWI810876B TWI810876B TW111112363A TW111112363A TWI810876B TW I810876 B TWI810876 B TW I810876B TW 111112363 A TW111112363 A TW 111112363A TW 111112363 A TW111112363 A TW 111112363A TW I810876 B TWI810876 B TW I810876B
- Authority
- TW
- Taiwan
- Prior art keywords
- host
- discard
- extended
- logical address
- command
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000004590 computer program Methods 0.000 title claims abstract description 6
- 230000017702 response to host Effects 0.000 title description 2
- 238000012545 processing Methods 0.000 claims abstract description 77
- 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 9
- 238000005516 engineering process Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000013507 mapping Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004891 communication Methods 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
- 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
- 238000013519 translation Methods 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
- 230000005055 memory storage Effects 0.000 description 1
- 238000004242 micellar liquid chromatography Methods 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
Images
Abstract
Description
本發明涉及儲存裝置,尤指一種因應主機丟棄命令的資料存取方法、產品電腦程式及裝置。The invention relates to a storage device, in particular to a data access method, a product computer program and a device in response to a host discarding 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 processing unit (Host) can provide any address for accessing NOR flash memory on the address pin, and obtain the data stored at the address from the data pin of NOR flash memory in time. material. In contrast, NAND flash memory is not random access, but sequential access. NAND flash memory cannot access any random address like NOR flash memory. Instead, the CPU needs to write the value of the sequence of bytes (Bytes) into 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 host discarding commands.
有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。In view of this, how to alleviate or eliminate the deficiencies in the above-mentioned related fields is a problem to be solved.
本說明書涉及一種因應主機丟棄命令的資料存取方法,由處理單元執行,包含:在隨機存取記憶體中配置空間給擴展式丟棄表,包含多個項目,而每個所述項目記載已經丟棄的使用者資料的邏輯位址;從主機端接收主機丟棄命令,指出不再使用的使用者資料的第一邏輯位址;新增包含所述第一邏輯位址的新項目至所述擴展式丟棄表;以及設定性能引擎中的開始位址寄存器和結束位址寄存器,用於重新定義所述隨機存取記憶體中儲存的所述擴展式丟棄表的位址範圍,使得所述性能引擎藉由在所述隨機存取記憶體中的所述位址範圍搜索所述擴展式丟棄表以判斷特定邏輯位址的使用者資料是否已經不再使用。This specification relates to a data access method in response to a host discarding command, executed by a processing unit, including: configuring space in a random access memory for an extended discarding table, including a plurality of items, and each item records that it has been discarded The logical address of the user data; receive the host discard command from the host end, point out the first logical address of the user data that is no longer used; add a new item including the first logical address to the extended formula discarding table; and setting a start address register and an end address register in the performance engine for redefining the address range of the extended discard table stored in the random access memory, so that the performance engine borrows The extended discard table is searched from the address range in the random access memory to determine whether the user data of a specific logical address is no longer used.
本說明書另涉及一種電腦程式產品,包含程式碼。當處理單元執行所述程式碼時,實施如上所述的因應主機丟棄命令的資料存取方法。This manual also relates to a computer program product, including program codes. When the processing unit executes the program code, the above-mentioned data access method in response to the host discarding command is implemented.
本說明書更另涉及一種因應主機丟棄命令的資料存取裝置,包含:隨機存取記憶體;性能引擎;和處理單元。隨機存取記憶體用於配置空間給擴展式丟棄表,其包含多個項目,而每個所述項目記載已經丟棄的使用者資料的邏輯位址。性能引擎包含開始位址寄存器和結束位址寄存器,用於定義所述隨機存取記憶體中儲存所述擴展式丟棄表的位址範圍。處理單元用於從主機端接收主機丟棄命令,其指出不再使用的使用者資料的第一邏輯位址;新增包含所述第一邏輯位址的新項目至所述擴展式丟棄表;以及設定所述性能引擎中的所述開始位址寄存器和所述結束位址寄存器,用於重新定義所述隨機存取記憶體中儲存的所述擴展式丟棄表的位址範圍,使得所述性能引擎藉由在所述隨機存取記憶體中的所述位址範圍搜索所述擴展式丟棄表以判斷特定邏輯位址的使用者資料是否已經不再使用。The specification further relates to a data access device for responding to a host discarding a 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 includes a plurality of entries, and each of the entries records the logical address of the 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 for storing the extended discard table. The processing unit is used for receiving a host discarding command from the host end, which indicates a first logical address of the user data that is no longer used; adding a new item including the first logical address to the extended discarding table; and Setting the start address register and the end address register in the performance engine is used to redefine the address range of the extended discard table stored in the random access memory, so that the performance The engine searches the extended discard table in the address range of the random access memory to determine whether the user data of a specific logical address is no longer used.
上述實施例的優點之一,通過性能引擎的設置和擴展式丟棄表的使用,避免處理單元耗費過多的運算資源來判斷主機寫入命令所要寫入的使用者資料的邏輯位址或者主機讀取命令所要讀取的使用者資料的邏輯位址是否落入之前已經丟棄的邏輯位址區間。One of the advantages of the above-mentioned embodiment is that through the setting of the performance engine and the use of the extended discard table, it is avoided that the processing unit consumes too much computing resources to judge the logical address of the user data to be written by the host write command or the host reads the data. 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 with the following description and drawings.
以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。The following description is a preferred implementation mode of the invention, and its purpose is to describe the basic spirit of the invention, but not to limit the invention. For the actual content of the invention, reference must be made to the scope of the claims that follow.
必須了解的是,使用於本說明書中的“包含”、“包括”等詞,用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。It must be understood that words such as "comprising" and "including" used in this specification are used to indicate the existence of specific technical features, values, method steps, operations, components and/or components, but do not exclude the possibility of adding More technical characteristics, numerical values, method steps, operation processes, components, components, or any combination of the above.
於權利要求中使用如“第一”、“第二”、“第三”等詞是用來修飾權利要求中的元件,並非用來表示之間具有優先順序,前置關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。Words such as "first", "second", and "third" used in the claims are used to modify the elements in the claims, and are not used to indicate that there is a priority order, a pre-relationship, or an element An element preceding another element, or a chronological order in performing method steps, is only used to distinguish elements with the same name.
必須了解的是,當元件描述為“連接”或“耦接”至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為“直接連接”或“直接耦接”至另一元件時,其中不存在任何中間元件。使用來描述元件之間關係的其他語詞也可類似方式解讀,例如“介於”相對於“直接介於”,或者是“鄰接”相對於“直接鄰接”等等。It must be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, 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 may be interpreted in a similar fashion, eg, "between" versus "directly between," or "adjacent" versus "directly adjacent," and so forth.
參考圖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中的特定資料緩存器等。A bus architecture (Bus Architecture) 132 can be configured in the
匯流排包含並行的物理線,連接閃存控制器130中兩個以上的組件。匯流排是一種共享的傳輸媒體,在任意的時間上,只能有兩個裝置可以使用這些線來彼此溝通,用於傳遞資料。資料及控制訊號能夠在組件間分別沿資料和控制線進行雙向傳播,但另一方面,位址訊號只能沿位址線進行單向傳播。例如,當處理單元134想要讀取RAM 136的特定位址上的資料時,處理單元134在位址線上傳送此位址給RAM 136。接著,此位址的資料會在資料線上回覆給處理單元134。為了完成資料讀取操作,控制訊號會使用控制線進行傳遞。A bus comprises parallel physical wires connecting two or more components in
閃存模組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 FIG. 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, a dedicated wire connection can be used between the
在另一些實施例中,處理單元134可通過共享的匯流排架構132設定性能引擎137中的開始位址寄存器322、結束位址寄存器324和目標寄存器330#0~330#7,並且從性能引擎137中的結果寄存器350#0~350#7讀取搜索結果。In some other embodiments, the
在一些實施例中,性能引擎137和RAM 136之間可使用專用導線連接,用於讓性能引擎137通過專用導線讀取RAM 136中特定位址的值。In some embodiments, a dedicated wire connection can be used between 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 content 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 solution of the extended discard table and the
步驟S510:執行第一個(下一個)主機寫入命令,用於將指定邏輯位址的使用者資料通過閃存介面139寫入閃存模組150。Step S510 : Execute the first (next) host write command for writing the user data of 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 written in the user data appears in the extended discard list. If yes, the flow continues to the processing of step S530; otherwise, the flow continues to the processing of step S510. The
步驟S530:刪除出現在擴展式丟棄表中的邏輯位址的相應項目。Step S530: Delete the corresponding item 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 solution of the extended discard table and the
步驟S610:提取第一個(下一個)主機寫入命令,指示閃存控制器130讀取指定邏輯位址的使用者資料。Step S610: extracting the first (next) host write command, instructing 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 list. If yes, the process continues to step S630; otherwise, the process continues to step S640. The
步驟S632:對於出現在擴展式丟棄表中的邏輯位址,驅動主機介面131回覆虛假值給主機端110。Step S632 : For the logical addresses appearing in the extended drop list, the
步驟S634:驅動閃存介面139從閃存模組150讀取其他沒有出現在擴展式丟棄表中的邏輯位址的使用者資料,並且驅動主機介面131回覆讀出的使用者資料給主機端110。Step S634 : drive the
步驟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 discarded user data indicated by the host discard command exceeds or equals a specified number (for example, 32). If yes, the process continues to step S720; otherwise, the process continues to 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 FIG. 7 , reference may be made to the corresponding description in FIG. 4 , and details are not repeated for 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 for writing the user data appears in the discarding queue. If yes, the flow continues to the processing of step S820; otherwise, the flow continues to the processing 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 FIG. 8, reference may be made to the corresponding description in FIG. 5, which will not be repeated for 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 drop list and the drop queue. If yes, the process continues to step S922; otherwise, the process continues to step S640. The
步驟S922:對於出現在擴展式丟棄表或者丟棄佇列中的每個邏輯位址,驅動主機介面131回覆虛假值給主機端110。Step S922 : For each logical address appearing in the extended discard list or the discard queue, the driving
步驟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 of the present invention can be implemented by computer instructions, such as a firmware translation layer (Firmware Translation Layer, FTL) in a storage device, a driver program for specific hardware, and the like. In addition, it can also be implemented in other types of programs. Those skilled in the art can write the methods of the embodiments of the present invention into computer instructions, which will not be described again for the sake of brevity. The computer instructions implemented according to the method of the embodiment of the present invention can be stored in an appropriate computer-readable medium, such as DVD, CD-ROM, USB disk, hard disk, and can also be placed through a network (for example, the Internet, or other appropriate means of accessing a web server.
雖然圖1至圖3中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然圖4至圖9的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。Although the elements described above are included in FIGS. 1 to 3 , it is not excluded that more additional elements may be used to achieve better technical effects without violating the spirit of the invention. In addition, although the flow charts in FIG. 4 to FIG. 9 are executed in a specified order, those skilled in the art can modify the order of these steps under the premise of achieving the same effect without violating the spirit of the invention. Therefore, The invention is not limited to using only the sequence described above. In addition, those skilled in the art may also integrate several steps into one step, or perform more steps sequentially or in parallel in addition to these steps, and the present invention is not limited thereby.
雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用以限縮本發明。相反地,此發明涵蓋了熟習此技藝人士顯而易見的修改與相似設置。所以,申請權利要求範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。Although the present invention is described using the above examples, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, the invention covers modifications and similar arrangements obvious to those skilled in the art. Therefore, 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 device
110: Host side
130: Flash memory controller
131: host interface
132: busbar
134: processing unit
136: random access memory
137: Performance engine
138: Direct memory access controller
139: Flash interface
150: Flash memory module
151:
圖1為依據本發明實施例的電子裝置的系統架構圖。FIG. 1 is a system architecture diagram of an electronic device according to an embodiment of the invention.
圖2為依據本發明實施例的閃存模組的示意圖。FIG. 2 is a schematic diagram of a flash memory module according to an embodiment of the 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為依據本發明實施例的執行主機丟棄命令的方法流程圖。Fig. 4 is a flowchart of a method for executing a host discard command according to an embodiment of the present invention.
圖5為依據本發明實施例的主機寫入命令執行後的擴展式丟棄表的更新方法的流程圖。FIG. 5 is a flowchart of a method for updating an extended discard table after a 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 invention.
圖7為依據本發明實施例的執行主機丟棄命令的方法流程圖。Fig. 7 is a flowchart 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 method for updating a discard command and an extended discard table after a host write command is executed according to an embodiment of the present invention.
圖9為依據本發明實施例的執行主機讀取命令的方法流程圖。FIG. 9 is a flowchart of a method for executing a host read command according to an embodiment of the 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 true TWI810876B (en) | 2023-08-01 |
TW202340939A 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) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200417855A (en) * | 2003-03-13 | 2004-09-16 | Ritek Corp | Device and method for recording the status of block of a nonvolatile memory |
US20120246388A1 (en) * | 2011-03-22 | 2012-09-27 | Daisuke Hashimoto | Memory system, nonvolatile storage device, control method, and medium |
US20130275660A1 (en) * | 2012-04-12 | 2013-10-17 | Violin Memory Inc. | Managing trim operations in a flash memory system |
US20140258601A1 (en) * | 2006-11-06 | 2014-09-11 | Rambus Inc. | Memory Controller Supporting Nonvolatile Physical Memory |
US20190171559A1 (en) * | 2017-12-05 | 2019-06-06 | Silicon Motion Inc. | Method for accessing flash module, associated flash controller and electronic device |
TW201923601A (en) * | 2017-11-17 | 2019-06-16 | 財團法人工業技術研究院 | Memory controller, control method for the memory controller, memory and control method for the memory |
-
2022
- 2022-03-31 TW TW111112363A patent/TWI810876B/en active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200417855A (en) * | 2003-03-13 | 2004-09-16 | Ritek Corp | Device and method for recording the status of block of a nonvolatile memory |
US20140258601A1 (en) * | 2006-11-06 | 2014-09-11 | Rambus Inc. | Memory Controller Supporting Nonvolatile Physical Memory |
US20120246388A1 (en) * | 2011-03-22 | 2012-09-27 | Daisuke Hashimoto | Memory system, nonvolatile storage device, control method, and medium |
US20130275660A1 (en) * | 2012-04-12 | 2013-10-17 | Violin Memory Inc. | Managing trim operations in a flash memory system |
TW201923601A (en) * | 2017-11-17 | 2019-06-16 | 財團法人工業技術研究院 | Memory controller, control method for the memory controller, memory and control method for the memory |
US20190171559A1 (en) * | 2017-12-05 | 2019-06-06 | Silicon Motion Inc. | Method for accessing flash module, associated flash controller and electronic device |
Also Published As
Publication number | Publication date |
---|---|
TW202340939A (en) | 2023-10-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI660346B (en) | Memory management method and storage controller | |
TW202101227A (en) | Apparatus and method and computer program product for handling flash physical-resource sets | |
CN114328303A (en) | Storage device, operation method thereof, and operation method of computing device including the same | |
US11537328B2 (en) | Method and apparatus for executing host commands | |
CN111897485A (en) | Data storage method and device, electronic equipment and storage medium | |
TWI756854B (en) | Method and apparatus and computer program product for managing data storage | |
TWI810876B (en) | Method and computer program product and apparatus for data access in response to host discard commands | |
US11494113B2 (en) | Computer program product and method and apparatus for scheduling execution of host commands | |
US11397676B2 (en) | Computer program product and method and apparatus for managing garbage collection process | |
CN114625307A (en) | Computer readable storage medium, and data reading method and device of flash memory chip | |
TWI670599B (en) | Memory management method and storage controller | |
TWI758745B (en) | Computer program product and method and apparatus for scheduling executions of host commands | |
TWI835027B (en) | Method and computer program product and apparatus for updating host-to-flash address mapping table | |
TWI749490B (en) | Computer program product and method and apparatus for programming flash administration tables | |
US20230315622A1 (en) | Method and non-transitory computer-readable storage medium and apparatus for data access in response to host discard commands | |
TWI740446B (en) | Computer program product and method and apparatus for managing garbage collection (gc) processes | |
TWI814647B (en) | Method and computer program product and apparatus for executing host commands | |
TW202321921A (en) | Method and computer program product and apparatus for updating host-to-flash address mapping table | |
TWI822516B (en) | Method and computer program product and apparatus for executing host write commands | |
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 | |
US11307766B2 (en) | Apparatus and method and computer program product for programming flash administration tables | |
TWI822517B (en) | Method and computer program product and apparatus for executing host write commands | |
TWI795680B (en) | Method and apparatus for data reads in host performance acceleration mode | |
KR102583244B1 (en) | Storage device and operating method of storage device |