TW202006553A - Methods for internal data movement of a flash memory and apparatuses using the same - Google Patents

Methods for internal data movement of a flash memory and apparatuses using the same Download PDF

Info

Publication number
TW202006553A
TW202006553A TW108139908A TW108139908A TW202006553A TW 202006553 A TW202006553 A TW 202006553A TW 108139908 A TW108139908 A TW 108139908A TW 108139908 A TW108139908 A TW 108139908A TW 202006553 A TW202006553 A TW 202006553A
Authority
TW
Taiwan
Prior art keywords
data
write
channel
mode
internal
Prior art date
Application number
TW108139908A
Other languages
Chinese (zh)
Other versions
TWI726475B (en
Inventor
林聖嵂
Original Assignee
慧榮科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Publication of TW202006553A publication Critical patent/TW202006553A/en
Application granted granted Critical
Publication of TWI726475B publication Critical patent/TWI726475B/en

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method for internal data movement, performed by a processing unit of a solid state disk (SSD), includes: receiving an internal data movement command, which instructs the SSD to move data of a source location of an input/output (I/O) channel to a new location of the I/O channel; performing a copyback procedure to move data of the source location of the I/O channel to a destination location of the I/O channel; and replying to the host with a completion element (CE) according to an execution result of the copyback procedure.

Description

快閃記憶體的資料內部搬移方法以及使用該方法的裝置Method for internally transferring data of flash memory and device using the method

本發明關連於一種快閃記憶體,特別是一種快閃記憶體的資料內部搬移方法以及使用該方法的裝置。The invention relates to a flash memory, in particular to a method for internally transferring data of a flash memory and a device using the method.

快閃記憶體裝置通常分為NOR快閃裝置與NAND快閃裝置。NOR快閃裝置為隨機存取裝置,主裝置(Host)可於位址腳位上提供存取NOR快閃裝置的任意位址,並即時地由NOR快閃裝置的資料腳位上獲得儲存於該位址上的使用者資料。相反地,NAND快閃裝置並非隨機存取,而是序列存取。NAND快閃裝置無法像NOR快閃裝置一樣,可以存取任何隨機位址,主裝置反而需要寫入序列的位元組(Bytes)到NAND快閃裝置中,用以定義請求命令(Command)的類型(如,讀取、寫入、抹除等),以及此命令上的位址。位址可指向一個頁面(在快閃記憶體中的一個寫入作業的最小資料塊)或一個區塊(在快閃記憶體中的一個抹除作業的最小資料塊)。實際上,NAND快閃裝置通常從記憶體單元(Memory Cells)上讀取或寫入完整的數頁資料。當一整頁的資料從陣列讀取到裝置中的緩存器(Buffer)後,藉由使用提取訊號(Strobe Signal)順序地敲出(Clock Out)內容,讓主單元可逐位元組或字元組(Words)存取資料。Flash memory devices are generally divided into NOR flash devices and NAND flash devices. The NOR flash device is a random access device. The host device (Host) can provide any address for accessing the NOR flash device on the address pin, and the data pin of the NOR flash device is instantly obtained and stored in the User data at this address. In contrast, NAND flash devices are not random access, but sequential access. The NAND flash device cannot access any random address like the NOR flash device. Instead, the master device needs to write the sequence of bytes (Bytes) to the NAND flash device to define the command Type (eg, read, write, erase, etc.), and the address on this command. The address can point to a page (the smallest data block of a write operation in the flash memory) or a block (the smallest data block of an erase operation in the flash memory). In fact, NAND flash devices usually read or write complete pages of data from memory cells. After a whole page of data is read from the array to the buffer in the device, by using the Strobe Signal to sequentially knock out the content, the main unit can be byte by byte or word Tuples (Words) access data.

開放通道固態硬碟(Open-Channel Solid State Disk)系統包括開放通道固態硬碟(裝置端)以及主裝置,並不在裝置端實施快閃記憶體翻譯層(FTL,Flash Translation Layer),反而在主裝置實施快閃記憶體翻譯層。不同於傳統的固態硬碟,開放通道固態硬碟讓主裝置知道固態硬碟內部的操作參數,並允許主裝置依據操作參數對開放通道固態硬碟進行操作,即進行資料的管理。然而,目前的開放通道固態硬碟只包含三種基本的存取命令:抹除;讀取;及寫入。當主裝置執行一連串讀取及寫入才能完成的存取程序時,例如垃圾收集(GC,Garbage Collection)、耗損平均(Wear Leveling)等時,需要透過開放通道固態硬碟的存取介面傳輸資料,耗費大量存取介面的頻寬。The Open-Channel Solid State Disk (Open-Channel Solid State Disk) system includes an open-channel solid state disk (device side) and a main device. Instead of implementing a Flash Translation Layer (FTL) on the device side, it is located on the main The device implements a flash memory translation layer. Unlike traditional solid state drives, open channel solid state drives let the host device know the internal operating parameters of the solid state drive, and allow the host device to operate the open channel solid state drives based on the operating parameters, that is, to manage data. However, current open channel SSDs only contain three basic access commands: erase; read; and write. When the host device executes a series of access procedures that can be completed by reading and writing, such as garbage collection (GC, Garbage Collection), wear leveling (Wear Leveling), etc., it is necessary to transfer data through the access interface of the open channel solid state drive , Which consumes a lot of bandwidth of the access interface.

因此,需要一種快閃記憶體的資料內部搬移方法以及使用該方法的裝置,用以解決如上所述的問題。Therefore, a method for internally transferring data in a flash memory and a device using the method are needed to solve the above-mentioned problems.

有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。In view of this, how to mitigate or eliminate the above-mentioned deficiencies in related fields is really a problem to be solved.

本發明提出一種快閃記憶體的資料內部搬移方法,由固態硬碟的處理單元執行,包含:接收內部搬移命令,指示將輸出入通道的來源位置的資料搬移到輸出入通道的新位置;執行輸出入通道的複製回寫程序,用於將輸出入通道的來源位置的資料搬移到輸出入通道的目的地位置;以及依據複製回寫程序的執行結果回覆完成元件給主裝置。The invention proposes a method for internally moving data in a flash memory, which is executed by a processing unit of a solid-state hard disk, and includes: receiving an internal moving command and instructing to move the data of the source position of the input/output channel to a new position of the input/output channel; execution The copy-back writing program of the I/O channel is used to move the data of the source position of the input-output channel to the destination position of the I/O channel; and reply the completed component to the main device according to the execution result of the copy-back writing program.

本發明另提出一種快閃記憶體的資料內部搬移裝置,包含:快閃控制器;以及處理單元。快閃控制器耦接儲存單元,並且儲存單元包含輸出入通道。處理單元耦接快閃控制器,用於從主裝置接收內部搬移命令,指示將輸出入通道的來源位置的資料搬移到輸出入通道的新位置;指示快閃控制器執行輸出入通道的複製回寫程序,用於將輸出入通道的來源位置的資料搬移到輸出入通道的目的地位置;以及依據複製回寫程序的執行結果回覆完成元件給主裝置。The invention also provides a data internal transfer device of a flash memory, including: a flash controller; and a processing unit. The flash controller is coupled to the storage unit, and the storage unit includes input and output channels. The processing unit is coupled to the flash controller, and is used to receive an internal move command from the main device, instruct to move the data of the source position of the I/O channel to the new position of the I/O channel; instruct the flash controller to execute the copy back of the I/O channel Write program, used to move the data of the source position of the I/O channel to the destination position of the I/O channel; and reply the completed component to the host device according to the execution result of the copy-back write program.

本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。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 of the invention, and its purpose is to describe the basic spirit of the invention, but it is not intended to limit the invention. The actual content of the invention must refer to the scope of the following claims.

必須了解的是,使用於本說明書中的”包含”、”包括”等詞,係用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。It must be understood that the terms "comprising" and "including" used in this specification are used to indicate the existence of specific technical features, values, method steps, work processes, components and/or components, but do not exclude Add more technical features, values, method steps, job processing, components, components, or any combination of the above.

於權利要求中使用如”第一”、"第二"、"第三"等詞係用來修飾權利要求中的元件,並非用來表示之間具有優先權順序,先行關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。The terms such as "first", "second", and "third" are used in the claims to modify the elements in the claims, not to indicate that there is a priority order, prior relationship, or is an element Prior to another component, or the time sequence when performing method steps, is only used to distinguish components with the same name.

第1圖係依據本發明實施例之開放通道固態硬碟系統100架構示意圖。開放通道固態硬碟系統100架構包含主裝置110、資料緩衝器(Data Buffer)120及開放通道固態硬碟(SSD,Solid State Disk)130。主裝置110運作時可依據其需求而建立佇列(Queue)、實體儲存對照表(Storage Mapping Table,又稱為L2P Logical-to-Physical表)及使用紀錄。此系統架構可實施於個人電腦、筆記型電腦(Laptop PC)、平板電腦、手機、數位相機、數位攝影機等電子產品。資料緩衝器120、佇列、實體儲存對照表及使用紀錄可實施於隨機存取記憶體(RAM, Random Access Memory)中的特定區域。主裝置110透過開放通道固態硬碟快速非揮發記憶體(NVMe, Non-Volatile Memory express)介面與開放通道固態硬碟130溝通。主裝置110可使用多種方式實施,例如使用通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器),並且在執行指令(Instructions)、宏碼(Macrocode)或微碼(Microcode)時,提供之後描述的功能。主裝置110可包含運算邏輯單元(ALU,Arithmetic and Logic Unit)以及位移器(Bit Shifter)。運算邏輯單元負責執行布林運算(如AND、OR、NOT、NAND、NOR、XOR、XNOR等)或數學運算(如加、減、乘、除等),而位移器負責位移運算及位元旋轉。開放通道SSD NVMe規格,例如:版本1.2,公開於2016年四月,支援數個輸出入通道(I/O Channels),每一輸出入通道連接至一個邏輯單元編號LUNs,Logical Unit Numbers),用以分別對應到儲存單元139中的多個儲存子單元。於開放通道SSD NVMe規格中,主裝置110整合原來實施於裝置端中的快閃記憶體翻譯層(FTL, Flash Translation Layer),用以最佳化負載。傳統的快閃記憶體翻譯層將主裝置端或檔案系統認得的邏輯區塊位址(LBAs,Logical Block Addresses)映射至儲存單元139的實體位址(也稱為邏輯至實體映射)。於開放通道SSD NVMe規格中,主裝置110可指示開放通道固態硬碟130將使用者資料儲存至儲存單元139中的一個實體位址,因此,實體儲存對照表的維護由主裝置110所負責及記錄每個邏輯區塊位址的使用者資料實際儲存於儲存單元139中的哪個實體位址。FIG. 1 is a schematic diagram of the architecture of an open channel SSD system 100 according to an embodiment of the present invention. The architecture of the open channel solid state drive system 100 includes a main device 110, a data buffer (Data Buffer) 120, and an open channel solid state drive (SSD, Solid State Disk) 130. The main device 110 can create a queue, a storage mapping table (also known as an L2P Logical-to-Physical table) and a usage record according to its needs during operation. This system architecture can be implemented in personal computers, laptop computers (Laptop PC), tablet computers, mobile phones, digital cameras, digital cameras and other electronic products. The data buffer 120, the queue, the physical storage comparison table, and the usage record may be implemented in a specific area in a random access memory (RAM). The main device 110 communicates with the open channel solid state hard disk 130 through an open channel solid state hard disk fast non-volatile memory (NVMe, Non-Volatile Memory express) interface. The host device 110 can be implemented in various ways, for example, using general-purpose hardware (eg, a single processor, a multiprocessor with parallel processing capabilities, a graphics processor, or other processors with computing capabilities), and executing instructions (Instructions) , Macrocode (Macrocode) or Microcode (Microcode), provide the functions described later. The main device 110 may include an arithmetic logic unit (ALU, Arithmetic and Logic Unit) and a shifter (Bit Shifter). The arithmetic logic unit is responsible for performing Boolean operations (such as AND, OR, NOT, NAND, NOR, XOR, XNOR, etc.) or mathematical operations (such as addition, subtraction, multiplication, division, etc.), and the shifter is responsible for displacement operations and bit rotation . Open channel SSD NVMe specifications, such as version 1.2, released in April 2016, support several I/O Channels, each I/O channel is connected to a logical unit number (LUNs, Logical Unit Numbers), used In order to correspond to a plurality of storage subunits in the storage unit 139, respectively. In the open channel SSD NVMe specification, the host device 110 integrates the Flash Translation Layer (FTL) originally implemented in the device to optimize the load. The conventional flash memory translation layer maps the logical block addresses (LBAs) recognized by the host device or the file system to the physical addresses of the storage unit 139 (also called logical-to-physical mapping). In the open channel SSD NVMe specification, the main device 110 can instruct the open channel solid-state drive 130 to store user data to a physical address in the storage unit 139. Therefore, the maintenance of the physical storage comparison table is the responsibility of the main device 110 and It records the physical address in the storage unit 139 where the user data of each logical block address is actually stored.

開放通道固態硬碟130包含處理單元133。處理單元133可採用開放通道SSD NVMe通訊協定與主裝置110溝通,用以接收包含實體位址的資料存取命令,並且依據資料存取命令指示快閃控制器135執行抹除、讀取或寫入。於此須注意的是,處理單元133可使用輕簡型通用目的處理器(Lightweight General-Purpose Processor)實施。The open channel SSD 130 includes a processing unit 133. The processing unit 133 can communicate with the host device 110 using the open channel SSD NVMe protocol to receive data access commands including physical addresses, and instruct the flash controller 135 to perform erasing, reading, or writing according to the data access commands Into. It should be noted here that the processing unit 133 may be implemented using a light-weight general-purpose processor (Lightweight General-Purpose Processor).

開放通道固態硬碟130另包含快閃控制器135、存取介面137及儲存單元139,並且快閃控制器135透過存取介面137與儲存單元139溝通,詳細來說,可採用雙倍資料率(Double Data Rate,DDR)通訊協定,例如,開放NAND快閃(Open NAND Flash Interface,ONFI)、雙倍資料率開關(DDR Toggle)或其他介面。開放通道固態硬碟130的快閃控制器135透過存取介面137寫入使用者資料到儲存單元139中的指定位址(目的位址),以及從儲存單元139中的指定位址(來源位址)讀取使用者資料。存取介面137使用數個電子訊號來協調快閃控制器135與儲存單元139間的資料與命令傳遞,包含資料線(Data Line)、時脈訊號(Clock Signal)與控制訊號(Control Signal)。資料線可用以傳遞命令、位址、讀出及寫入的資料;控制訊號線可用以傳遞晶片致能(Chip Enable, CE)、位址提取致能(Address Latch Enable,ALE)、命令提取致能(Command Latch Enable,CLE)、寫入致能(Write Enable,WE)等控制訊號。處理單元133與快閃控制器135可分開存在或整合於同一晶片中。The open channel SSD 130 further includes a flash controller 135, an access interface 137, and a storage unit 139, and the flash controller 135 communicates with the storage unit 139 through the access interface 137. In detail, a double data rate can be used (Double Data Rate, DDR) communication protocol, such as Open NAND Flash Interface (ONFI), Double Data Rate Switch (DDR Toggle), or other interfaces. The flash controller 135 of the open channel SSD 130 writes user data to the specified address (destination address) in the storage unit 139 through the access interface 137, and the specified address (source bit) from the storage unit 139 Address) to read user data. The access interface 137 uses several electronic signals to coordinate the transfer of data and commands between the flash controller 135 and the storage unit 139, including the data line (Data Line), clock signal (Clock Signal) and control signal (Control Signal). The data line can be used to transfer commands, addresses, read and write data; the control signal line can be used to transfer Chip Enable (CE), Address Latch Enable (ALE), and command extraction Control signals such as Command Latch Enable (CLE) and Write Enable (WE). The processing unit 133 and the flash controller 135 may exist separately or be integrated in the same chip.

於系統開機(System Boot)時,主裝置110從開放通道固態硬碟130獲得控制開放通道固態硬碟130運作時所需的操作參數,例如,區塊數目、壞塊(Bad Block)數目、滯後時間(latency)、輸出入通道總數等。During system boot, the main device 110 obtains from the open channel SSD 130 the operating parameters required to control the operation of the open channel SSD 130, such as the number of blocks, the number of bad blocks, and the lag Time (latency), total number of input and output channels, etc.

儲存單元139可包含多個儲存子單元,每個儲存子單元,各自使用關聯的存取子介面與快閃控制器135進行溝通。一或多個儲存子單元可封裝在一個晶粒(Die)之中。第2圖係依據本發明實施例之存取介面與儲存單元的方塊圖。開放通道固態硬碟130可包含j+1個存取子介面137_0至137_j,每一個存取子介面連接i+1個儲存子單元。存取子介面及其後連接的儲存子單元又可統稱為輸出入通道,並可以邏輯單元編號識別。換句話說,i+1個儲存子單元共享一個存取子介面。例如,當開放通道固態硬碟130包含4個輸出入(j=3)且每一個輸出入連接4個儲存單元(i=3)時,開放通道固態硬碟130一共擁有16個儲存子單元139_0_0至139_j_i。快閃控制器135可驅動存取子介面137_0至137_j中之一者,從指定的儲存子單元讀取資料。每個儲存子單元擁有獨立的晶片致能(CE)控制訊號。換句話說,當欲對指定的儲存子單元進行資料讀取時,需要驅動關聯的存取子介面來致能此儲存子單元的晶片致能控制訊號。第3圖係依據本發明實施例之一個存取子介面與多個儲存子單元的連接示意圖。快閃控制器135可透過存取子介面137_0使用獨立的晶片致能控制訊號320_0_0至320_0_i從連接的儲存子單元139_0_0至139_0_i中選擇出其中一者,接著,透過共享的資料線310_0從選擇出的儲存子單元的指定位址讀取資料。The storage unit 139 may include a plurality of storage subunits, and each storage subunit uses its associated access subinterface to communicate with the flash controller 135. One or more storage subunits can be packaged in a die. FIG. 2 is a block diagram of an access interface and a storage unit according to an embodiment of the invention. The open channel SSD 130 may include j+1 accessor interfaces 137_0 to 137_j, and each accessor interface is connected to i+1 storage subunits. The access sub-interface and subsequent storage sub-units can be collectively referred to as I/O channels, and can be identified by the logical unit number. In other words, i+1 storage subunits share an accessor interface. For example, when the open channel SSD 130 includes 4 I/Os (j=3) and each input/output is connected to 4 storage units (i=3), the open channel SSD 130 has a total of 16 storage subunits 139_0_0 To 139_j_i. The flash controller 135 can drive one of the access sub-interfaces 137_0 to 137_j to read data from the designated storage sub-unit. Each storage subunit has an independent chip enable (CE) control signal. In other words, when reading data from the specified storage subunit, the associated access subinterface needs to be driven to enable the chip enable control signal of the storage subunit. FIG. 3 is a schematic diagram of connection between an access sub-interface and a plurality of storage sub-units according to an embodiment of the present invention. The flash controller 135 can select one of the connected storage subunits 139_0_0 to 139_0_i using the independent chip enable control signals 320_0_0 to 320_0_i through the access sub-interface 137_0, and then select from the selected through the shared data line 310_0 To read data at the specified address of the storage subunit.

第4圖係儲存單元139的示意圖。儲存單元139包含多個資料平面(Data Planes)410_0至410_m、430_0至430_m、450_0至450_m及470_0至470_m,每一資料平面或多個資料平面置於一個邏輯單元編號中。資料平面410_0至410_m及共享的存取子介面稱為輸出入通道410,資料平面430_0至430_m及共享的存取子介面稱為輸出入通道430,資料平面450_0至450_m及共享的存取子介面稱為輸出入通道450,及資料平面470_0至470_m及共享的存取子介面稱為輸出入通道470,其中,m可為2的次方的整數(例如2、4、8、16、32等),輸出入通道410、430、450及470可使用邏輯單元編號識別。資料平面410_0至470_m中之每一者包含多個實體區塊(Physical Blocks),每個實體區塊包含多個頁面(Pages)P#0至P#(n),每個頁面包含多個區段(Sectors)(例如,4個、8個等),其中,n可為767或1535等。每個頁面包含多個NAND記憶體單元(Memory Cells),並且NAND記憶體單元可為單層式單元(Single-Level Cells, SLCs)、多層式單元(Multi-Level Cells, MLCs)、三層式單元(Triple-Level Cells, TLCs)或四層式單元(Quad-Level Cells, QLCs)。於一些實施例中,當每一個NAND記憶體單元為單層式單元而可記錄2個狀態時,資料平面410_0至470_0中的頁面P#0可虛擬形成超頁面(Super Page)490_0,資料平面410_0至470_0中的頁面P#1可虛擬形成超頁面490_1,依此類推。於另一些實施例中,當每一個NAND記憶體單元為多層式單元而可記錄4個狀態時,一個實體字元線可包含頁面P#0(可稱為最低位元頁面,MSB,Most Significant Bit page)、頁面P#1(可稱為最高位元頁面,LSB,Least Significant Bit page),依此類推。於更另一些實施例中,當每一個NAND記憶體單元為三層式單元而可記錄8個狀態時,一個實體字元線可包含頁面P#0(可稱為最低位元頁面,MSB page)、頁面P#1(可稱為中間位元頁面,CSB,Center Significant Bit page)及頁面P#2(可稱為最高位元頁面,LSB page)。當每一個NAND記憶體單元為四層式單元而可記錄16個狀態時,除了MSB、CSB以及LSB頁面之外,更包括TSB(可稱為頂部位元,TSB,Top Significant Bit)頁面。FIG. 4 is a schematic diagram of the storage unit 139. The storage unit 139 includes multiple data planes (Data Planes) 410_0 to 410_m, 430_0 to 430_m, 450_0 to 450_m, and 470_0 to 470_m. Each data plane or multiple data planes are placed in a logical unit number. The data planes 410_0 to 410_m and the shared access sub-interface are called I/O channels 410, the data planes 430_0 to 430_m and the shared access sub-interfaces are called I/O channels 430, the data planes 450_0 to 450_m and the shared access sub-interfaces Called I/O channel 450, and the data planes 470_0 to 470_m and the shared access sub-interface are called I/O channels 470, where m can be an integer to the power of 2 (eg 2, 4, 8, 16, 32, etc. ), I/O channels 410, 430, 450 and 470 can be identified using logical unit numbers. Each of the data planes 410_0 to 470_m includes multiple physical blocks, each physical block includes multiple pages (Pages) P#0 to P#(n), and each page includes multiple areas Sectors (for example, 4, 8, etc.), where n may be 767, 1535, or the like. Each page contains multiple NAND memory cells (Memory Cells), and NAND memory cells can be single-level cells (Single-Level Cells, SLCs), multi-level cells (Multi-Level Cells, MLCs), three-tier type Cells (Triple-Level Cells, TLCs) or quad-level cells (Quad-Level Cells, QLCs). In some embodiments, when each NAND memory cell is a single-layer cell and can record two states, the page P#0 in the data plane 410_0 to 470_0 can virtually form a Super Page (Super Page) 490_0, the data plane Pages P#1 in 410_0 to 470_0 can be virtually formed as a super page 490_1, and so on. In other embodiments, when each NAND memory cell is a multi-layer cell and can record 4 states, a physical word line may include page P#0 (which may be called the lowest bit page, MSB, Most Significant Bit page), page P#1 (may be called the highest bit page, LSB, Least Significant Bit page), and so on. In still other embodiments, when each NAND memory cell is a three-layer cell and can record 8 states, a physical word line may include page P#0 (which may be called the lowest bit page, MSB page ), page P#1 (may be called Center Significant Bit page, CSB, Center Significant Bit page) and page P#2 (may be called the highest bit page, LSB page). When each NAND memory cell is a four-layer cell and can record 16 states, in addition to the MSB, CSB, and LSB pages, it also includes a TSB (top significant bit) page.

儲存單元139運作時,頁面可為資料管理或編程的最小單位,大小例如為16KB,此時實體位址可表示為頁面編號;或者,頁面可包含多個區段,大小例如為4KB,則區段可為資料管理的最小單位,此時實體位址可表示為頁面的區段編號(Sector numbers)或此區段在頁面的偏移量(Offset)。區塊為資料抹除的最小單位。When the storage unit 139 is in operation, the page can be the smallest unit for data management or programming. The size is, for example, 16KB. At this time, the physical address can be expressed as a page number; The segment can be the smallest unit of data management. In this case, the physical address can be expressed as the sector number of the page (Sector numbers) or the offset of the sector on the page (Offset). The block is the smallest unit for erasing data.

實體區塊可依據其使用狀態而區分成主動區塊、資料區塊以及閒置區塊。主動區塊表示正在進行資料寫入的實體區塊,即尚未寫入區塊結束(End of Block)資訊的實體區塊。資料區塊為已寫入區塊結束資訊的實體區塊,即不再寫入任何使用者資料。閒置區塊可被選取而成為主動區塊,閒置區塊不儲存任何有效的使用者資料。通常閒置區塊被選取後,需執行抹除動作方可成為主動區塊。Physical blocks can be divided into active blocks, data blocks, and idle blocks according to their usage status. The active block represents a physical block that is currently writing data, that is, a physical block that has not yet written End of Block information. The data block is a physical block that has written end-of-block information, that is, no user data is written. The idle block can be selected to become an active block, and the idle block does not store any valid user data. Generally, after an idle block is selected, an erase operation is required to become an active block.

於一些實施例中,主裝置110傳送給開放通道固態硬碟130的實體位址可包含邏輯單元編號、資料平面編號、實體區塊編號、實體頁面編號及區段編號等資訊,用以指出欲讀取或寫入的使用者資料位於特定輸出入通道中的特定資料平面中的特定實體區塊中的特定實體頁面中的特定區段。於一些實施例中,有時會以行(Column)編號取代區段編號。於另一些實施例中,主裝置110傳送給開放通道固態硬碟130的實體位址可包含邏輯單元編號、資料平面編號及實體區塊編號等資訊,用以指出欲抹除特定輸出入通道中的特定資料平面中的特定資料區塊。In some embodiments, the physical address sent by the main device 110 to the open channel SSD 130 may include logical unit number, data plane number, physical block number, physical page number, and section number, etc., to indicate the desired The read or written user data is located in a specific section in a specific physical page in a specific physical block in a specific data plane in a specific data channel in a specific input and output channel. In some embodiments, sometimes the column number is replaced by the column number. In other embodiments, the physical address sent by the main device 110 to the open channel SSD 130 may include information such as the logical unit number, data plane number, and physical block number to indicate that a specific input/output channel is to be erased Specific data blocks in the specific data plane of.

第5圖係命令佇列示意圖。佇列可包含遞交佇列(Submission Queue)510及完成佇列(Completion Queue)530,分別用以暫存主裝置指令以及完成元件(Completion Element)。遞交佇列510及完成佇列530中之每一者包含多筆條目的集合。遞交佇列510中的每一筆條目儲存一個主裝置指令,例如:輸出入命令(以下稱為資料存取命令)或管理命令,而完成佇列530中的每一筆條目儲存關聯至一個資料存取命令或管理命令的完成元件,此完成元件的功能類似確認訊息。集合中的條目依序存放。集合的操作基本原則是由結束位置新增條目(可稱為入列),並且由開始位置移除條目(可稱為出列)。也就是說,第一個新增至遞交佇列510或完成佇列530的命令或訊息,也將會是第一個被移出的。主裝置110可寫入資料存取命令(Data Access Command,例如,抹除、讀取、寫入命令等)至遞交佇列510,並且處理單元133從遞交佇列510讀取(或稱為提取Fetch)最早到達的資料存取命令並執行。於資料存取命令執行完成後,處理單元133寫入完成元件至完成佇列530,主裝置110可讀取或提取完成元件而判斷資料存取命令的執行結果。Figure 5 is a schematic diagram of the command queue. The queue may include a submission queue (Submission Queue) 510 and a completion queue (Completion Queue) 530, which are used to temporarily store a master device command and a completion element (Completion Element), respectively. Each of the submission queue 510 and the completion queue 530 includes a collection of multiple entries. Each entry in the submission queue 510 stores a host device command, such as an input/output command (hereinafter referred to as a data access command) or a management command, and each entry in the completion queue 530 is stored and associated with a data access The completion component of a command or management command. This completion component functions like a confirmation message. The items in the collection are stored sequentially. The basic principle of the operation of the collection is to add an entry from the end position (may be referred to as enqueue), and remove an entry from the start position (may be referred to as dequeue). In other words, the first command or message added to the submission queue 510 or the completion queue 530 will also be the first to be removed. The host device 110 may write a data access command (eg, erase, read, write command, etc.) to the submission queue 510, and the processing unit 133 reads from the submission queue 510 (or called extraction) Fetch) The earliest arriving data access command and execute it. After the execution of the data access command is completed, the processing unit 133 writes the completion element to the completion queue 530, and the host device 110 can read or extract the completion element to determine the execution result of the data access command.

第6圖係資料存取命令的執行步驟的流程圖。主裝置110產生並寫入資料存取命令(例如,抹除、讀取、寫入命令等)至遞交佇列510(步驟S1110),其中,資料存取命令包含實體位址的資訊,並且,實體位址指向特定的區塊、頁面或區段位址。接著,主裝置110發出遞交門鈴(Submission Doorbell)給處理單元133(步驟S1120),用以通知處理單元133關於遞交佇列510中已寫入一個資料存取命令的資訊,並更新遞交佇列510的佇列尾(Tail)的值。處理單元133接收到遞交門鈴後(步驟S1310),從遞交佇列510讀取(最早到達的)資料存取命令(步驟S1320),並且依據資料存取命令指示快閃控制器135,用以完成指定的作業(例如,抹除、資料讀取、寫入等)(步驟S1330)。指定作業完成後,處理單元133產生並寫入完成元件至完成佇列530(步驟S1340)用以通知主裝置110相應於特定資料存取命令的作業的執行狀態資訊,並且發出中斷給主裝置(步驟S1350)。接收中斷後(步驟S1130),主裝置110從完成佇列530讀取(最早到達的)完成元件(步驟S1130),接著,發出完成門鈴給處理單元133(步驟S1140)。接收完成門鈴後(S1360),處理單元133更新完成佇列530的佇列頭(Head)的值。Figure 6 is a flow chart of the execution steps of the data access command. The host device 110 generates and writes a data access command (eg, erase, read, write command, etc.) to the submission queue 510 (step S1110), where the data access command includes information of the physical address, and, The physical address points to a specific block, page or section address. Next, the main device 110 issues a submission doorbell (Submission Doorbell) to the processing unit 133 (step S1120), to notify the processing unit 133 that the data in the submission queue 510 has written a data access command, and update the submission queue 510 The value of Tail at the end of the queue. After receiving the delivery doorbell (step S1310), the processing unit 133 reads the (earliest arriving) data access command from the delivery queue 510 (step S1320), and instructs the flash controller 135 according to the data access command to complete The designated operation (for example, erasing, data reading, writing, etc.) (step S1330). After the designated operation is completed, the processing unit 133 generates and writes the completion element to the completion queue 530 (step S1340) to notify the host device 110 of the execution status information of the operation corresponding to the specific data access command, and issues an interrupt to the host device ( Step S1350). After receiving the interrupt (step S1130), the main device 110 reads the (earliest arriving) completion element from the completion queue 530 (step S1130), and then sends a completion doorbell to the processing unit 133 (step S1140). After receiving the doorbell (S1360), the processing unit 133 updates the value of the head of the completed queue 530.

於步驟S1120及S1140,主裝置110可設定相應寄存器(registers)來向處理單元133發出遞交門鈴及結束門鈴。In steps S1120 and S1140, the host device 110 may set up corresponding registers to issue the doorbell delivery and end doorbell to the processing unit 133.

一筆資料存取命令可處理多筆使用者資料,例如:64筆,則完成元件中可包括64個位元的執行回覆表,每個位元分別表示每一筆使用者資料的執行結果,例如:”0”表示成功,”1”表示失敗。資料存取命令包含操作碼欄位,用以儲存資料存取命令的類型(例如,抹除、讀取、寫入等)。完成元件包含狀態欄位,用以儲存對應的資料存取命令的執行狀態(例如,成功、失敗等)。另外,處理單元133可亂序或依優先權的順序來執行資料存取命令,因此,資料存取命令及完成元件都包含命令識別碼(Command Identifier),用以讓主裝置110可將每一個完成元件關聯至特定資料存取命令。A data access command can process multiple user data, for example: 64, then the completion component can include a 64-bit execution response table, each bit represents the execution result of each user data, such as: "0" means success, "1" means failure. The data access command includes an operation code field to store the type of the data access command (for example, erase, read, write, etc.). The completion component includes a status field for storing the execution status (for example, success, failure, etc.) of the corresponding data access command. In addition, the processing unit 133 can execute the data access commands out of order or in order of priority. Therefore, both the data access command and the completion element include a command identifier (Command Identifier), so that the main device 110 can use each Complete component access to specific data access commands.

舉例來說,一個閒置區塊在寫入前需要被抹除以成為主動區塊,主裝置110可寫入抹除命令至遞交佇列510(步驟S1110)用以指示開放通道固態硬碟130(詳細來說為處理單元133)針對特定輸出入通道中的特定閒置區塊執行抹除作業。處理單元133因應抹除命令而指示快閃控制器135通過驅動存取介面137以完成於儲存單元139中指定的抹除作業(步驟S1330)。當抹除作業完成,處理單元133寫入完成元件至完成佇列530(步驟S1340)用以通知主裝置110關於相應抹除作業已經完成的資訊。For example, an idle block needs to be erased to become an active block before writing, and the master device 110 can write an erase command to submit the queue 510 (step S1110) to instruct the open channel SSD 130 ( In detail, the processing unit 133) performs an erasing operation on a specific idle block in a specific input/output channel. In response to the erase command, the processing unit 133 instructs the flash controller 135 to drive the access interface 137 to complete the erase operation specified in the storage unit 139 (step S1330). When the erasing operation is completed, the processing unit 133 writes the completion element to the completion queue 530 (step S1340) to notify the main device 110 that the corresponding erasing operation has been completed.

舉例來說,主裝置110可寫入讀取命令至遞交佇列510(步驟S1110)用以指示開放通道固態硬碟130從特定輸出入通道中的特定資料平面中的特定實體區塊中的特定實體頁面(的特定區段)讀取使用者資料。處理單元133因應讀取命令而指示快閃控制器135通過驅動存取介面137從儲存單元139中指定的實體位址讀取使用者資料,並且將使用者資料儲存至讀取命令所指定的資料緩衝區120(步驟S1330)。當讀取作業完成,處理單元133寫入完成元件至完成佇列530(步驟S1340)用以通知主裝置110關於相應讀取作業已經完成的資訊。For example, the host device 110 may write a read command to the submission queue 510 (step S1110) to instruct the open channel SSD 130 to output a specific data in a specific physical block in a specific data plane in a specific channel of the channel The physical page (specific section) reads user data. The processing unit 133 instructs the flash controller 135 to read the user data from the physical address specified in the storage unit 139 through the drive access interface 137 in response to the read command, and stores the user data to the data specified by the read command The buffer 120 (step S1330). When the reading operation is completed, the processing unit 133 writes the completion element to the completion queue 530 (step S1340) to notify the host device 110 that the corresponding reading operation has been completed.

舉例來說,主裝置110可儲存欲寫入的使用者資料於資料緩衝區120,並儲存寫入命令至遞交佇列510(步驟S1110)用以指示開放通道固態硬碟130寫入使用者資料至特定輸出入通道中的特定資料平面中的特定主動區塊中的特定實體頁面(的特定區段),其中,寫入命令包含資料緩衝區120中儲存欲寫入的使用者資料的位址資訊。處理單元133因應寫入命令而從資料緩衝區120中的指定位址讀取欲寫入的使用者資料,並指示快閃控制器135通過驅動存取介面137將使用者資料編程至儲存單元139中寫入命令所指定的實體位址(步驟S1330)。當寫入作業完成,處理單元133寫入完成元件至完成佇列530(步驟S1340)用以通知主裝置110關於相應寫入作業已經完成的資訊。For example, the host device 110 may store the user data to be written in the data buffer 120, and store the write command to the submission queue 510 (step S1110) to instruct the open channel solid state hard disk 130 to write the user data To a specific physical page (a specific section) in a specific active block in a specific data plane in a specific I/O channel, where the write command includes the address in the data buffer 120 where the user data to be written is stored News. The processing unit 133 reads the user data to be written from the specified address in the data buffer 120 in response to the write command, and instructs the flash controller 135 to program the user data to the storage unit 139 through the drive access interface 137 The physical address specified by the write command in step (step S1330). When the writing operation is completed, the processing unit 133 writes the completion element to the completion queue 530 (step S1340) to notify the host device 110 that the corresponding writing operation has been completed.

經過多次的存取後,一個實體頁面可能包含有效及無效區段(又稱為過期區段),其中,有效區段儲存有效的使用者資料,無效區段儲存無效的(舊的)使用者資料。於一些實施方式中,當主裝置110偵測到儲存單元139的可用空間不足時,可使用如上所述的讀取命令指示處理單元133讀取並蒐集有效區段中的使用者資料,接著,主裝置110使用如上所述的寫入命令指示處理單元133重新寫入蒐集起來的有效的使用者資料至閒置區塊或主動區塊的空實體頁面,使得這些包含無效的使用者資料的資料區塊可變更成為閒置區塊,於抹除後,即可提供資料儲存空間。如上所述的程序稱為垃圾收集(GC,Garbage Collection)。After multiple accesses, a physical page may contain valid and invalid segments (also known as expired segments), where valid segments store valid user data and invalid segments store invalid (old) usage者资料。 Information. In some embodiments, when the main device 110 detects that the available space of the storage unit 139 is insufficient, it can use the read command as described above to instruct the processing unit 133 to read and collect the user data in the valid section, and then, The host device 110 instructs the processing unit 133 to rewrite the collected valid user data to the empty physical page of the idle block or the active block using the write command as described above, so that these data areas containing invalid user data The block can be changed to an idle block, and after erasing, data storage space can be provided. The program described above is called Garbage Collection (GC).

第7圖係依據一些實施方式之垃圾回收示意圖。假設資料區塊的一個實體頁面包括四個區段,每一區段可儲存一筆使用者資料:經過多次存取後,資料區塊710中的實體頁面P1的第0個區段711儲存有效的使用者資料,其餘儲存無效的使用者資料。資料區塊730中的實體頁面P2的第1個區段733儲存有效的使用者資料,其餘儲存無效的使用者資料。資料區塊750中的實體頁面P3的第2個及第3個區段755及757儲存有效的使用者資料,其餘儲存無效的使用者資料。為了將實體頁面P1至P3中的有效的使用者資料蒐集起來並儲存至實體區塊770中的新實體頁面P4,可執行垃圾回收程序,包含一連串的讀取及寫入命令。Figure 7 is a schematic diagram of garbage collection according to some embodiments. Assume that a physical page of the data block includes four sections, and each section can store a piece of user data: after multiple accesses, the 0th section 711 of the physical page P1 in the data block 710 is stored and valid The user data of, the rest stores invalid user data. The first section 733 of the physical page P2 in the data block 730 stores valid user data, and the rest stores invalid user data. The second and third sections 755 and 757 of the physical page P3 in the data block 750 store valid user data, and the rest store invalid user data. In order to collect and store valid user data in the physical pages P1 to P3 and store them in the new physical page P4 in the physical block 770, a garbage collection process may be performed, including a series of read and write commands.

此外,由於經過一定次數的抹除(例如,500次、1000次、5000次等),儲存單元139中的實體區塊便會因為不良的資料保存(Data Retention)能力而被列為壞塊而不再使用。為了延長實體區塊的服務壽命,主裝置110持續監督每個實體區塊的抹除次數。當一個資料區塊的抹除次數超過抹除閥值時,主裝置110可使用如上所述的讀取命令指示處理單元133讀取這個資料區塊(來源區塊)中的使用者資料。接著,主裝置110選擇一個抹除次數最少的閒置區塊作為目的區塊,並且使用如上所述的寫入命令指示處理單元133寫入之前的讀取的使用者資料寫至選擇的目的區塊中的可用實體頁面。如上所述的程序稱為耗損平均(Wear Leveling)。第8圖係依據一些實施方式之耗損平均示意圖。假設資料區塊810的抹除次數已經超過抹除閥值,而閒置區塊830的抹除次數是此輸出入通道中所有實體區塊中最少的:主裝置110啟動耗損平均,將資料區塊810中的實體頁面P5至P6的使用者資料搬移至閒置區塊830中的實體頁面P7至P8,其中,耗損平均程序包含一連串的讀取及寫入命令。In addition, due to a certain number of erasures (for example, 500 times, 1000 times, 5000 times, etc.), the physical block in the storage unit 139 is classified as a bad block due to poor data retention (Data Retention) capability No longer use. In order to extend the service life of physical blocks, the main device 110 continuously monitors the number of erasures of each physical block. When the number of erasures of a data block exceeds the erasure threshold, the main device 110 may use the read command as described above to instruct the processing unit 133 to read the user data in this data block (source block). Then, the main device 110 selects an idle block with the least number of erasures as the destination block, and uses the write command as described above to instruct the processing unit 133 to write the read user data before writing to the selected destination block Available entity pages in. The procedure described above is called Wear Leveling. Figure 8 is a schematic diagram of the average loss according to some embodiments. Suppose that the number of erasures of data block 810 has exceeded the erasure threshold, and the number of erasures of idle block 830 is the least of all physical blocks in the output channel: the master device 110 starts to wear out the average and divides the data block The user data of the physical pages P5 to P6 in 810 is moved to the physical pages P7 to P8 in the idle block 830, where the average wearout procedure includes a series of read and write commands.

此外,主裝置110可記錄每一資料區塊的讀取次數並以讀取次數作為耗損平均程序啟動的條件。例如:在一個月中,資料區塊810的讀取次數最低且抹除次數未超過抹除閥值,主裝置110可選取所有閒置區塊中或同一輸出入通道的所有閒置區塊中具有最高抹除次數的閒置區塊,例如:閒置區塊830,作為目的區塊,並將資料區塊810作為來源區塊,啟動耗損平均程序以將資料區塊810的使用者資料(或稱冷資料)搬移至閒置區塊830,其中,耗損平均程序包含一連串的讀取及寫入命令。In addition, the host device 110 can record the number of readings of each data block and use the number of readings as a condition for starting the wear-out average program. For example, in a month, the data block 810 has the lowest number of reads and the number of erasures does not exceed the erasure threshold, the main device 110 may select all idle blocks or the highest value among all idle blocks of the same input/output channel The idle block of the erase count, for example, the idle block 830 is used as the destination block, and the data block 810 is used as the source block, and the wear-average process is started to use the user data (or cold data) of the data block 810 ) Moved to the idle block 830, wherein the wear-out average process includes a series of read and write commands.

然而,使用如上所述的讀取及寫入命令來完成垃圾收集或耗損平均程序,會讓佇列耗費大量空間儲存一連串的讀取及寫入命令以及完成元件,並且資料緩衝器120也需要耗費大量頻寬傳輸從儲存單元139讀取的資料以及傳輸欲寫入儲存單元139的資料,以及耗費大量空間儲存從儲存單元139讀取的資料。此外,主裝置110及處理單元133亦需要耗費大量運算資源處理這一連串的讀取及寫入命令,而這將使開放通道固態硬碟130無法維持適當的運算資源以及時回應主裝置110的資料存取命令,造成開放通道固態硬碟130的系統效能低落。However, using the read and write commands as described above to complete the garbage collection or wear-out averaging process will cause the queue to consume a lot of space to store a series of read and write commands and completion elements, and the data buffer 120 also needs to be consumed A large amount of bandwidth transmits the data read from the storage unit 139 and the data to be written to the storage unit 139, and consumes a large amount of space to store the data read from the storage unit 139. In addition, the main device 110 and the processing unit 133 also need to consume a large amount of computing resources to process the series of read and write commands, and this will make the open channel SSD 130 unable to maintain proper computing resources to respond to the data of the main device 110 in time The access command causes the system performance of the open channel SSD 130 to be low.

為了解決如上所述實施方式的缺陷,本發明實施例提出一種快閃記憶體的資料內部搬移方法,此資料內部搬移方法適用於實體儲存對照表由主裝置110負責維護的系統,例如:開放通道固態硬碟系統100。第9圖係依據本發明實施例之快閃記憶體的資料內部搬移方法流程圖。主裝置110可週期性地監督每一個輸出入通道的使用狀態,例如,可用閒置區塊的數量、每一實體區塊的抹除次數或讀取次數等等。當主裝置110偵測到開放通道固態硬碟130中的一個輸出入通道的使用狀態滿足資料搬移的條件後,產生內部搬移(Internal Movement)命令並寫入至遞交佇列510(步驟S9110),用以指示開放通道固態硬碟130將特定輸出入通道中的來源區塊的使用者資料搬移至相同輸出入通道中的目的區塊,其中,資料搬移的條件可以是閒置區塊的數量低於閒置閥值或是資料區塊(來源區塊)的抹除次數或讀取次數分別高於抹除閥值或讀取閥值。另外,較佳僅搬移有效的使用者資料至目的區塊,但為了較高的執行效率或大部份使用者資料皆為有效時,可搬移全部的使用者資料至目的區塊。In order to solve the defects of the above-mentioned embodiments, an embodiment of the present invention provides a method for internally moving data in a flash memory. This method for internally moving data is suitable for a system where the physical storage comparison table is maintained by the main device 110, for example: open channel Solid State Drive System 100. FIG. 9 is a flowchart of a method for internally moving data in a flash memory according to an embodiment of the present invention. The main device 110 may periodically monitor the usage status of each input/output channel, for example, the number of available idle blocks, the number of erases or reads of each physical block, and so on. When the main device 110 detects that the usage status of an input/output channel in the open channel SSD 130 satisfies the conditions for data transfer, an internal movement command is generated and written to the submission queue 510 (step S9110), It is used to instruct the open channel SSD 130 to move the user data of the source block in a specific input and output channel to the target block in the same input and output channel, where the condition for data transfer may be that the number of idle blocks is lower than The idle threshold or the number of erasing or reading of the data block (source block) is higher than the erasing threshold or reading threshold, respectively. In addition, it is better to move only valid user data to the destination block, but for higher execution efficiency or when most of the user data are valid, all user data can be moved to the destination block.

寫入內部搬移命令至遞交佇列510後,主裝置110發出遞交門鈴給處理單元133(步驟S1120),用以通知處理單元133關於遞交佇列510中已寫入一個資料存取命令的資訊。處理單元133接收遞交門鈴後(步驟S1310),從遞交佇列510讀取內部搬移命令(步驟S9310),並且因應內部搬移命令而指示快閃控制器135通過驅動存取介面137在特定輸出入通道的來源區塊和目的區塊之間啟動複製回寫程序(CopyBack Procedure)(步驟S9320)。雖然在最理想的情況下,處理單元133於步驟S9310讀取的最早到達的資料存取命令為內部搬移命令,但是,當遞交佇列510中存在其他較早到達的資料存取命令時,處理單元133會花一段時間讀取並執行完這些較早到達的資料存取命令後,才接著於步驟S9310讀取並執行內部搬移命令。雖然本發明實施例於第6圖中無法沒有顯示這些較早到達的資料存取命令的讀取與執行,但是本發明並不因此受限。當處理單元133完成內部搬移作業後,處理單元133寫入完成元件至完成佇列530(步驟S9330)用以通知主裝置110關於相應內部搬移命令已經完成的資訊。於步驟S1130,主裝置110可執行中斷服務處理程序(ISR,Interrupt Service Routine),用以讀取完成佇列530中完成元件,並且因應已執行的內部搬移作業更新實體儲存對照表。例如,將實體儲存對照表中的一個邏輯區塊位址原先關聯的實體位址(也就是來源區塊)更新為新的實體位址(也就是目的區塊)。雖然在最理想的情況下,處理單元133於步驟S1130讀取的最早到達的確認訊息相應於內部搬移命令,但是,當完成佇列530中存在其他較早到達的確認訊息時,處理單元133會花一段時間讀取這些較早到達的確認訊息並執行相應處理後,才接著於步驟S1130讀取相應於內部搬移命令的確認訊息,並據以更新實體儲存對照表。雖然本發明實施例於第6圖中無法沒有顯示這些較早到達的確認訊息的讀取與相應處理,但是本發明並不因此受限。在另一實施例中,主裝置110於步驟S9110或步驟S9110之前即更新實體儲存對照表,而非等到步驟S1130或步驟S1130之後再更新實體儲存對照表。在另一實施例中,主裝置110於步驟S1130時更會判斷目的區塊是否已寫滿使用者資料並寫入區塊結束資訊,如果是,則更新實體儲存對照表,如果不是,則不更新實體儲存對照表。After writing the internal transfer command to the delivery queue 510, the host device 110 issues a delivery doorbell to the processing unit 133 (step S1120) to notify the processing unit 133 that information about a data access command has been written in the delivery queue 510. After the processing unit 133 receives the doorbell for delivery (step S1310), it reads the internal transfer command from the delivery queue 510 (step S9310), and instructs the flash controller 135 to drive the access interface 137 in the specific input and output channel in response to the internal transfer command A copy back procedure is initiated between the source block and the destination block of (Step S9320). Although in the most ideal case, the earliest arriving data access command read by the processing unit 133 in step S9310 is an internal transfer command, but when there are other earlier arriving data access commands in the submission queue 510, the process The unit 133 will take a while to read and execute the data access commands that arrive earlier, and then read and execute the internal move command in step S9310. Although the embodiment of the present invention does not show the reading and execution of these earlier data access commands in FIG. 6, the present invention is not so limited. After the processing unit 133 completes the internal transfer operation, the processing unit 133 writes the completion element to the completion queue 530 (step S9330) to notify the host device 110 that the corresponding internal transfer command has been completed. In step S1130, the host device 110 can execute an interrupt service process (ISR, Interrupt Service Routine) to read the completed elements in the completion queue 530, and update the physical storage comparison table in response to the executed internal transfer operation. For example, the previously associated physical address (that is, the source block) of a logical block address in the physical storage comparison table is updated to a new physical address (that is, the destination block). Although in the most ideal case, the earliest arrival confirmation message read by the processing unit 133 in step S1130 corresponds to the internal move command, but when there are other earlier arrival confirmation messages in the completion queue 530, the processing unit 133 will It takes a while to read these earlier arrival confirmation messages and perform corresponding processing, and then reads the confirmation message corresponding to the internal move command in step S1130, and accordingly updates the physical storage comparison table. Although the embodiment of the present invention does not show the reading and corresponding processing of these earlier arrival confirmation messages in FIG. 6, the present invention is not so limited. In another embodiment, the main device 110 updates the physical storage comparison table before step S9110 or step S9110, instead of updating the physical storage comparison table after step S1130 or step S1130. In another embodiment, the main device 110 further determines whether the destination block is filled with user data and writes end-of-block information in step S1130. If it is, the physical storage comparison table is updated. If it is not, it is not. Update the physical storage comparison table.

內部搬移命令可使用結構化格式定義。第10圖係依據本發明實施例的內部搬移命令的資料格式圖。內部搬移命令可為64位元組命令。內部搬移命令1000的第0雙字組的第0位元組紀錄操作碼(opcode)1010,用以通知開放通道固態硬碟130此為內部搬移命令。內部搬移命令1000的第0雙字組的第2至3位元組紀錄命令識別碼1030,此命令識別碼1030較佳為依序產生,作為內部搬移命令1000識別的依據,也用以讓完成佇列530中的一個對應的完成元件關聯至內部搬移命令1000。內部搬移命令1000以區段為基本單元指示開放通道固態硬碟130執行特定輸出入通道的資料搬移作業,但不以此為限。The internal move command can be defined using a structured format. FIG. 10 is a data format diagram of an internal move command according to an embodiment of the present invention. The internal move command can be a 64-byte command. The 0th byte of the 0th double word of the internal move command 1000 records an opcode 1010 to notify the open channel solid state drive 130 that this is an internal move command. The 2nd to 3rd bytes of the 0th double word of the internal move command 1000 record the command identification code 1030. This command identification code 1030 is preferably generated sequentially, as the basis for the internal move command 1000 to identify, and also used to complete A corresponding completed element in the queue 530 is associated with the internal move command 1000. The internal transfer command 1000 uses the segment as the basic unit to instruct the open channel solid state hard disk 130 to perform the data transfer operation of a specific input and output channel, but it is not limited to this.

內部搬移命令1000的第12雙字組的第0至5位元紀錄搬移區段數量1080,最大值為64,因此,一個內部搬移命令1000可指示開放通道固態硬碟130於資料搬移作業中搬移特定輸出入通道中至多64個區段的使用者資料。The 0th to 5th bits of the 12th double word of the internal move command 1000 record the number of moved segments 1080, the maximum value is 64. Therefore, an internal move command 1000 can instruct the open channel SSD 130 to move in the data move operation User data for up to 64 sectors in specific input and output channels.

內部搬移命令1000的第10至11雙字組紀錄實體區段(Physical Sector)資訊1070。如果實體區塊的實體位址以32位元表示,且搬移區段數量1080的值為1,則內部搬移命令1000的第10雙字組紀錄使用者資料儲存於來源區塊的區段位址(來源位址),第11雙字組紀錄使用者資料儲存於目的區塊的區段位址(目的位址)。藉由複製回寫程序,處理單元133可將來源位址的使用者資料編程至目的位址。The 10th to 11th double words of the internal transfer command 1000 record physical sector information 1070. If the physical address of the physical block is represented by 32 bits, and the value of the number of moving blocks 1080 is 1, then the 10th double word of the internal moving command 1000 records the user data stored in the block address of the source block ( Source address), the 11th double-word record user data is stored in the segment address of the destination block (destination address). By copying the write-back procedure, the processing unit 133 can program the user data of the source address to the destination address.

若搬移區段數量1080的值大於1,或實體區塊的實體位址以64位元表示,則實體區段資訊1070紀錄資料緩衝器120的記憶體位址,此時,來源位址以及目的位址以成對地(Paired)存在資料緩衝器120中。於步驟S9310中,處理單元133從遞交佇列510讀取內部搬移命令1000並依據實體區段資訊1070的記錄以及搬移區段數量1080的值,自資料緩衝器120取得成對的來源位址以及目的位址,藉由複製回寫程序,處理單元133可將多個來源位址的多個使用者資料編程至多個指定的目的位址。If the value of the number of moving segments 1080 is greater than 1, or the physical address of the physical block is represented by 64 bits, the physical segment information 1070 records the memory address of the data buffer 120. At this time, the source address and the destination bit The addresses are stored in the data buffer 120 in pairs. In step S9310, the processing unit 133 reads the internal transfer command 1000 from the submission queue 510 and obtains the paired source address and the source address from the data buffer 120 according to the record of the physical segment information 1070 and the value of the transfer segment number 1080 For the destination address, by copying and writing back the program, the processing unit 133 can program multiple user data of multiple source addresses to multiple specified destination addresses.

在另一實施例中,內部搬移命令1000的第6至7雙字組以實體區域頁面紀錄(PRP,Physical Region Page Entry)或碎片收集清單(SGL,Scatter Gather List)記錄主要記憶體位址1050,且內部搬移命令1000的第8至9雙字組以實體區域頁面紀錄或碎片收集清單記錄延伸記憶體位址1060。當搬移區段數量1080的值大於1時,實體區段資訊1070可紀錄第一筆來源位址,主要記憶體位址1050可紀錄第一筆目的位址。在另一實施例中,主要記憶體位址1050可紀錄第一筆來源位址,延申記憶體位址1060可紀錄第一筆目的位址。在另一實施例中,主要記憶體位址1050可紀錄第一筆成對的來源位址以及目的位址,當主要記憶體位址1050所涵蓋的記憶體空間無法紀錄所有成對的來源位址以及目的位址時,延申記憶體位址1060可紀錄剩餘的成對的來源位址以及目的位址。In another embodiment, the 6th to 7th double words of the internal move command 1000 record the main memory address 1050 with a physical region page entry (PRP) or a Scatter Gather List (SGL). And the 8th to 9th double words of the internal move command 1000 record the extended memory address 1060 in the physical area page record or the debris collection list. When the value of the moving segment number 1080 is greater than 1, the physical segment information 1070 can record the first source address, and the main memory address 1050 can record the first destination address. In another embodiment, the main memory address 1050 can record the first source address, and the extended memory address 1060 can record the first destination address. In another embodiment, the main memory address 1050 can record the first paired source address and destination address. When the memory space covered by the main memory address 1050 cannot record all paired source addresses and For the destination address, the extended memory address 1060 can record the remaining paired source and destination addresses.

內部搬移命令1000的第12雙字組的第24-25位元紀錄寫入模式(M1)1020,第12雙字組的第26-27位元紀錄讀取模式(M2)1040。寫入模式及讀取模式各可包含二個狀態,例如:預設模式及SLC模式。當其指出為SLC模式時,處理單元133指示快閃控制器135通過驅動存取介面137以SLC模式讀取或寫入一個頁面的資料。當其指出為預設模式時,處理單元133指示快閃控制器135通過驅動存取介面137以預設模式讀取或寫入一個頁面的資料。預設模式以TLC為例,此頁面可以是MSB頁面、CSB頁面或LSB頁面。於另一些實施例中,寫入模式可包含四個狀態,例如:SLC模式;MLC模式;TLC模式;及QLC模式。另外,寫入模式的數目較佳與儲存單元139的編程方式有關,例如:儲存單元139為QLC並採用三段編程(3-Pass Programming)方式,第一段編程僅寫入MSB頁面,第二段編程再寫入CSB頁面以及LSB頁面,第三段編程再寫入TSB頁面,則寫入模式可包含三個模式,包括:SLC模式、TLC模式及QLC模式(預設模式)。當其指出QLC模式時,處理單元133指示快閃控制器135通過驅動存取介面137要求特定輸出入通道於每個記憶體單元寫入MSB頁面、CSB頁面、LSB頁面或TSB頁面的使用者資料。上述設定可也套用至讀取模式中。需注意的是,讀取模式與寫入模式的設定值可不同,例如:讀取模式是SLC模式但寫入模式是預設模式。假設儲存單元139為QLC,主裝置110可以多個輸出內部搬移命令1000而將4筆使用者資料以SLC模式自來源區塊的來源位址中讀出,並依序以QLC模式編程至目的區塊的目的位址。The 24-25th bit of the internal move command 1000 records the write mode (M1) 1020, and the 26-27th bit records the read mode (M2) 1040 of the 12th double word. The write mode and the read mode can each include two states, for example: preset mode and SLC mode. When it indicates the SLC mode, the processing unit 133 instructs the flash controller 135 to read or write data of one page in the SLC mode through the drive access interface 137. When it is indicated as the preset mode, the processing unit 133 instructs the flash controller 135 to read or write data of one page in the preset mode through the drive access interface 137. The preset mode takes TLC as an example. This page can be an MSB page, a CSB page, or an LSB page. In other embodiments, the write mode may include four states, for example: SLC mode; MLC mode; TLC mode; and QLC mode. In addition, the number of write modes is preferably related to the programming method of the storage unit 139. For example, the storage unit 139 is a QLC and adopts a 3-pass programming method. The first-stage programming only writes to the MSB page, and the second Segment programming and then writing to CSB page and LSB page, the third segment programming and then writing to TSB page, the writing mode can include three modes, including: SLC mode, TLC mode and QLC mode (default mode). When it indicates the QLC mode, the processing unit 133 instructs the flash controller 135 to request a specific I/O channel to write the user data of the MSB page, CSB page, LSB page or TSB page to each memory unit through the driver access interface 137 . The above settings can also be applied to the reading mode. It should be noted that the setting values of the reading mode and the writing mode may be different. For example, the reading mode is the SLC mode but the writing mode is the default mode. Assuming that the storage unit 139 is QLC, the host device 110 can output multiple internal transfer commands 1000 to read 4 user data from the source address of the source block in SLC mode, and sequentially program the QLC mode to the destination area The destination address of the block.

第11圖係完成元件的資料格式圖。完成元件1100可為16位元組訊息。完成元件1100的第3雙字組的第0至1位元組紀錄命令識別碼1130,其內容應與內部搬移命令1000的命令識別碼1030一致,用以讓此完成元件1100關聯至特定內部搬移命令1000。完成元件1100的第0至1雙字組儲存執行回覆表1110,用以記錄每一使用者資料的存取結果。完成元件1100的第3雙字組的第17至31位元紀錄狀態欄位1120,用以記錄內部搬移命令1000的執行結果。Figure 11 is the data format diagram of the completed component. The completion element 1100 may be a 16-byte message. The 0 to 1 byte of the third double word of the completed component 1100 records the command identification code 1130, and its content should be the same as the command identification code 1030 of the internal move command 1000 to allow the completed device 1100 to be associated with a specific internal move Command 1000. The 0 to 1 double-word storage execution reply table 1110 of the completion element 1100 is used to record the access result of each user data. The 17th to 31st bit record status field 1120 of the third double word of the completion element 1100 is used to record the execution result of the internal transfer command 1000.

在步驟S9110之前,主裝置110系統可儲存多筆使用紀錄,每筆紀錄儲存一個輸出入通道的實體區塊的使用狀態的資訊。於每次開放通道固態硬碟130執行完資料存取作業(例如,抹除、讀取、寫入、內部搬移等),主裝置110可更新相應使用紀錄中的使用狀態的資訊,並判定是否滿足相應輸出入通道的資料搬移條件。例如,將相應輸出入通道的閒置區塊的數量減1,將相應輸出入通道的一個實體區塊的抹除次數加1,或將相應輸出入通道的一個資料區塊的讀取次數加1等。於一些實施例中,當使用紀錄指出相應輸出入通道的閒置區塊的數量低於閒置閥值時,代表閒置區塊的數量太少,需要啟動垃圾收集程序,以增加閒置區塊的數量。於一些實施例中,當使用紀錄指出相應輸出入通道的一個實體區塊的抹除次數高於抹除閥值時,主裝置啟動耗損平均程序以避免使用者資料遇到資料保存的問題。Before step S9110, the system of the main device 110 may store multiple usage records, and each record stores information on the usage status of a physical block of the input and output channels. After each open channel SSD 130 performs data access operations (eg, erase, read, write, internal transfer, etc.), the main device 110 can update the usage status information in the corresponding usage record and determine whether Meet the data movement conditions of the corresponding input and output channels. For example, the number of idle blocks of the corresponding I/O channel is decreased by 1, the number of erases of a physical block of the corresponding I/O channel is increased by 1, or the number of reads of a data block of the corresponding I/O channel is increased by 1. Wait. In some embodiments, when the usage record indicates that the number of idle blocks of the corresponding input/output channel is lower than the idle threshold, it means that the number of idle blocks is too small, and a garbage collection process needs to be started to increase the number of idle blocks. In some embodiments, when the usage record indicates that the number of erasures of a physical block of the corresponding input/output channel is higher than the erasure threshold, the main device starts the wear-out averaging process to prevent user data from encountering data storage problems.

在執行資料讀取或寫入的過程中,可能遇到讀取失敗或寫入失敗的情況。當遇到上述清況時,完成元件1100的狀態欄位1120會被設為”1”,讀取失敗或寫入失敗的使用者資料所對應在執行回覆表的位元也會設為”1”。此時,主裝置110必須先判斷此失敗為讀取失敗或寫入失敗,如果是讀取失敗,則啟動錯誤管理程序,例如:RAID,以修復來源位址的使用者資料;如果是寫入失敗,則重新為使用者資料決定一個新的目的位址。During the process of reading or writing data, you may encounter a failure to read or write. When the above situation is encountered, the status field 1120 of the completed component 1100 will be set to "1", and the bit corresponding to the user data that fails to read or write to the execution reply table will also be set to "1" ". At this time, the main device 110 must first determine whether the failure is a read failure or a write failure. If it is a read failure, an error management process such as RAID is started to repair the user data at the source address; if it is a write If it fails, a new destination address is determined for the user data.

由上述的描述中可知,內部搬移過程中如果發生會失敗的情況,則主裝置110需耗費大量時間及運算資源以判斷原因並修正此錯誤。為解決如上所述的缺陷,於另一些實施例,主裝置110不為每一個來源位址的使用者資料決定一個目的位址,而是讓開放通道固態硬碟130決定,之後,開放通道固態硬碟130再將決定的目的位址依據內部搬移命令1000的指示上傳至主裝置110所指定的資料緩衝器120的記憶體位址,例如:主要記憶體位址1050、延伸記憶體位址1060或實體區段資訊1070所指定的記憶體位址。最後,透過完成元件1100通知主裝置110目的位址已完成上傳,之後,主裝置110可依據目的位址更新實體儲存對照表。As can be seen from the above description, if a failure occurs during the internal transfer process, the main device 110 needs to spend a lot of time and computing resources to determine the cause and correct the error. In order to solve the above-mentioned defects, in other embodiments, the main device 110 does not determine a destination address for each source address user data, but allows the open channel SSD 130 to determine, after which, the open channel SSD The hard disk 130 uploads the determined destination address to the memory address of the data buffer 120 designated by the host device 110 according to the instruction of the internal move command 1000, for example, the main memory address 1050, the extended memory address 1060, or the physical area The memory address specified by segment information 1070. Finally, the completion device 1100 notifies the host device 110 that the destination address has been uploaded. After that, the host device 110 can update the physical storage comparison table according to the destination address.

當需要進行多個區段的使用者資料搬移時,詳細來說,於步驟S9110前,主裝置110可儲存多筆使用者資料的來源位址至資料緩衝區120,並將來源位址在資料緩衝區120的記憶體位址儲存至內部搬移命令1000中的主要記憶體位址1050、延伸記憶體位址1060或實體區段資訊1070其中一個,主要記憶體位址1050、延伸記憶體位址1060或實體區段資訊1070中的另一個則供開放通道固態硬碟130上傳使用者資料的目的位址。在步驟S9110,將內部搬移命令1000寫入至遞交佇列510。來源位址可使用邏輯單元編號、資料平面編號、實體區塊編號、實體頁面編號及區段編號表示。於步驟S9310,處理單元133讀取並判斷內部搬移命令1000的操作碼1010,接著再讀取內部搬移命令1000的搬移區段數量1080、主要記憶體位址1050、延申記憶體位址1060或實體區段資訊1070的值,再至資料緩衝器120的記憶體位址取得多筆使用者資料的來源位址。接著,於步驟S9320,處理單元133為每一個使用者資料決定一個目的位址,例如:選取具有抹除次數的閒置區塊作為目的區塊,並指示快閃控制器135通過驅動存取介面137對特定輸出入通道的來源區塊和目的區塊執行複製回寫程序。當寫入任何一個目的位址失敗時,處理單元133將使用者資料編程至下一個頁面(的第一個區段);或直接將此實體字元線的所有剩餘頁面寫入虛假資料(Dummy Data),再將使用者資料編程至下一個實體字元線的MSB頁面(的第一個區段),或是,重新指示快閃控制器135通過驅動存取介面137要求對特定輸出入通道的來源區塊和目的區塊執行複製回寫程序,將使用者資料搬移至下一個實體字元線的MSB頁面,或是,將使用者資料編程至另一個目的區塊。於步驟S9330,當複製回寫程序成功執行完畢後,處理單元133可儲存所有使用者資料的目的位址至資料緩衝區120,寫入完成元件1100至完成佇列530。於步驟S1130,主裝置110收到完成元件1100之後,依據搬移區段數量1080、主要記憶體位址1050、延伸記憶體位址1060或實體區段資訊1070的值從資料緩衝區120讀取所有的目的位址,並據以更新實體儲存對照表。When user data of multiple sectors needs to be moved, in detail, before step S9110, the host device 110 can store the source addresses of multiple pieces of user data to the data buffer 120, and place the source addresses in the data The memory address of the buffer 120 is stored in one of the main memory address 1050, the extended memory address 1060, or the physical segment information 1070 in the internal move command 1000, the main memory address 1050, the extended memory address 1060, or the physical segment The other of the information 1070 is the destination address for the open channel SSD 130 to upload user data. In step S9110, the internal transfer command 1000 is written to the delivery queue 510. The source address can be represented by logical unit number, data plane number, physical block number, physical page number, and section number. In step S9310, the processing unit 133 reads and determines the operation code 1010 of the internal transfer command 1000, and then reads the number of transfer sections 1080 of the internal transfer command 1000, the main memory address 1050, the extended memory address 1060, or the physical area The value of the segment information 1070, and then the memory address of the data buffer 120 to obtain the source address of multiple pieces of user data. Next, in step S9320, the processing unit 133 determines a destination address for each user data, for example, selects an idle block with the number of erasures as the destination block, and instructs the flash controller 135 to access the interface 137 through the driver The copy-write-back procedure is executed on the source block and the destination block of a specific input/output channel. When writing to any destination address fails, the processing unit 133 programs the user data to the next page (the first section); or directly writes all the remaining pages of this physical character line to dummy data (Dummy Data), and then program the user data to the MSB page of the next physical character line (the first section), or re-instruct the flash controller 135 to request a specific input/output channel through the driver access interface 137 The source block and the destination block of the program perform a copy-back process to move the user data to the MSB page of the next physical character line, or program the user data to another destination block. In step S9330, after the copy-back procedure is successfully executed, the processing unit 133 can store the destination addresses of all user data in the data buffer 120, and write the completion element 1100 to the completion queue 530. In step S1130, after receiving the completed component 1100, the host device 110 reads all the destinations from the data buffer 120 according to the values of the number of moved segments 1080, the main memory address 1050, the extended memory address 1060, or the physical segment information 1070 Address and update the physical storage comparison table accordingly.

當只需要一個區段的使用者資料搬移時,詳細來說,於步驟S9110,主裝置110可儲存一個來源位址至內部搬移命令1000中的實體區段資訊1070,並設定主要記憶體位址1050的值以供開放通道固態硬碟130上傳使用者資料的目的位址,並且寫入內部搬移命令1000至遞交佇列510。於步驟S9310,處理單元133讀取內部搬移命令1000中的實體區段資訊1070的來源位址時,為此來源位址決定一個目的位址,並指示快閃控制器135通過驅動存取介面137要求特定輸出入通道執行複製回寫程序。於步驟S9330,當此複製回寫程序成功執行完畢後,處理單元133上傳使用者資料的目的位址至主要記憶體位址1050所對應的記憶體位址寫入完成元件1100至完成佇列530。於步驟S1130,主裝置110讀取完成元件1100並依據主要記憶體位址1050的值從資料緩衝區120讀取目的位址,並據以更新實體儲存對照表。When the user data of only one sector needs to be moved, in detail, in step S9110, the host device 110 may store a source address to the physical sector information 1070 in the internal migration command 1000, and set the main memory address 1050 The value is used for the open channel SSD 130 to upload the user data destination address, and write the internal transfer command 1000 to the delivery queue 510. In step S9310, when the processing unit 133 reads the source address of the physical sector information 1070 in the internal move command 1000, it determines a destination address for the source address and instructs the flash controller 135 to access the interface 137 through the driver Require specific I/O channels to execute copy-back writing procedures. In step S9330, when the copy-and-write-back procedure is successfully executed, the processing unit 133 uploads the destination address of the user data to the memory address writing completion element 1100 to the completion queue 530 corresponding to the main memory address 1050. In step S1130, the host device 110 reads the completed element 1100 and reads the destination address from the data buffer 120 according to the value of the main memory address 1050, and accordingly updates the physical storage comparison table.

第12圖係依據本發明實施例的廢料蒐集程序的內部搬移作業示意圖。主裝置110可寫入內部搬移命令至遞交佇列510,內部搬移命令包含多組來源區段及目的地區段的實體位置。第一組包含來源區段711及目的地區段771的實體位置,第二組包含來源區段733及目的地區段773的實體位置,第三組包含來源區段755及目的地區段775的實體位置,以及第四組包含來源區段757及目的地區段777的實體位置。接著,快閃控制器135驅動存取子介面1210執行複製回寫程序。存取子介面1210指示直接資料存取電路(DMA-Direct Memory Access Circuit)1230讀取來源區段711、733、755及757的資料,並蒐集儲存至寄存器1250,接著,指示直接資料存取電路1230將寄存器1250中一整個實體頁面的資料寫入實體塊770中的實體頁面P4(包含區段771、773、775及777)。FIG. 12 is a schematic diagram of the internal moving operation of the waste collection process according to an embodiment of the present invention. The host device 110 can write an internal move command to the delivery queue 510. The internal move command includes multiple sets of physical locations of the source and destination sectors. The first group includes the physical location of the source segment 711 and the destination segment 771, the second group includes the physical location of the source segment 733 and the destination segment 773, and the third group includes the physical location of the source segment 755 and the destination segment 775 , And the fourth group includes the physical locations of the source section 757 and the destination section 777. Next, the flash controller 135 drives the access sub-interface 1210 to execute the copy-back procedure. The access sub-interface 1210 instructs the direct data access circuit (DMA-Direct Memory Access Circuit) 1230 to read the data of the source sections 711, 733, 755 and 757, collect and store them in the register 1250, and then instruct the direct data access circuit 1230 Write the data of an entire physical page in the register 1250 to the physical page P4 (including the sections 771, 773, 775, and 777) in the physical block 770.

第13圖係依據本發明實施例的耗損平均程序的內部搬移作業示意圖。主裝置110可寫入內部搬移命令至遞交佇列510,內部搬移命令包含多組來源區段及目的地區段的實體位置。例如,第一組包含實體塊810的實體頁面P5中之第一來源區段以及實體塊830的實體頁面P7中之第一目的地區段的實體位置,第二組包含實體塊810的實體頁面P5中之第二來源區段以及實體塊830的實體頁面P7中之第二目的地區段的實體位置,依此類推。接著,快閃控制器135驅動存取子介面1310執行複製回寫程序。存取子介面1310指示直接資料存取電路1330讀取實體頁面P5及P6中八個來源區段的資料,並儲存至寄存器1350,接著,指示直接資料存取電路1330將寄存器1350中二個實體頁面的資料寫入實體塊830中的實體頁面P7及P8。FIG. 13 is a schematic diagram of the internal moving operation of the wear-out average procedure according to an embodiment of the present invention. The host device 110 can write an internal move command to the delivery queue 510. The internal move command includes multiple sets of physical locations of the source and destination sectors. For example, the first group includes the first source section in the physical page P5 of the physical block 810 and the physical location of the first destination section in the physical page P7 of the physical block 830, and the second group includes the physical page P5 of the physical block 810 The physical location of the second source segment in the second source segment and the physical location of the second destination segment in the physical page P7 of the physical block 830, and so on. Next, the flash controller 135 drives the access sub-interface 1310 to execute the copy-back procedure. The access sub-interface 1310 instructs the direct data access circuit 1330 to read the data of the eight source sections in the physical pages P5 and P6, and stores it in the register 1350, and then instructs the direct data access circuit 1330 to transfer the two entities in the register 1350 The data of the page is written into the physical pages P7 and P8 in the physical block 830.

另外,複製回寫程序的執行過程中,使用者資料不需要上傳至資料緩衝器120。快閃控制器135輸出複製回寫的讀取命令至儲存單元139的來源區塊,使得自來源位址讀取出的使用者資料暫存於儲存單元139的寄存器(快取寄存器或頁面寄存器)中。接著,快閃控制器135輸出複製回寫的編程命令至儲存單元139的目的區塊,使得暫存在寄存器1250的使用者資料被編程至目的位址。由於使用者資料不需要上傳至資料緩衝器120,因此,使用者資料自來源區塊傳送至資料緩衝器120以及自資料緩衝器120傳送至目的區塊的時間即可被節省,故能增加開放通道固態硬碟130的系統效能,達到本發明的目的。In addition, during the execution of the copy-back program, user data does not need to be uploaded to the data buffer 120. The flash controller 135 outputs a copy-back read command to the source block of the storage unit 139, so that the user data read from the source address is temporarily stored in the register (cache register or page register) of the storage unit 139 in. Next, the flash controller 135 outputs a copy-write programming command to the destination block of the storage unit 139, so that the user data temporarily stored in the register 1250 is programmed to the destination address. Since user data does not need to be uploaded to the data buffer 120, the time for user data to be transferred from the source block to the data buffer 120 and from the data buffer 120 to the destination block can be saved, so the openness can be increased The system performance of the channel SSD 130 achieves the purpose of the present invention.

雖然第1至3圖中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然第6圖及第9圖的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。Although the elements described above are included in Figures 1 to 3, it is not excluded that more other additional elements are used without violating the spirit of the invention, and a better technical effect has been achieved. In addition, although the flowcharts in Figures 6 and 9 are executed in the specified order, without violating the spirit of the invention, those skilled in the art can modify the order between these steps on the premise of achieving the same effect. Therefore, the present invention is not limited to using only the order 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 present 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 obvious modifications and similar settings for those skilled in the art. Therefore, the scope of the claims of the application must be interpreted in the broadest way to include all obvious modifications and similar settings.

100‧‧‧主裝置100‧‧‧Main device

120‧‧‧資料緩衝器120‧‧‧Data buffer

130‧‧‧固態硬碟130‧‧‧ Solid State Drive

133‧‧‧處理單元133‧‧‧ processing unit

135‧‧‧快閃控制器135‧‧‧Flash controller

137‧‧‧存取介面137‧‧‧Access interface

137_0~137_j、1210、1310‧‧‧存取子介面137_0~137_j, 1210, 1310 ‧‧‧ accessor interface

139‧‧‧儲存單元139‧‧‧storage unit

139_0_0~139_j_i‧‧‧儲存子單元139_0_0~139_j_i‧‧‧storage subunit

310_0‧‧‧資料線310_0‧‧‧Data cable

320_0_0~320_0_i‧‧‧晶片致能控制訊號320_0_0~320_0_i‧‧‧Chip enable control signal

410、430、450、470‧‧‧輸出入通道410, 430, 450, 470

410_0~410_m、430_0~430_m、450_0~450_m、470_0~470_m‧‧‧資料平面410_0~410_m, 430_0~430_m, 450_0~450_m, 470_0~470_m‧‧‧‧plane

490_0~490_n‧‧‧超頁面490_0~490_n‧‧‧Super Page

P#0~p#(n)‧‧‧實體頁面P#0~p#(n)‧‧‧Entity page

510、530‧‧‧佇列510, 530‧‧‧ queue

S1110~S1360、S9110~S9120、S9310~S9330‧‧‧方法步驟S1110~S1360, S9110~S9120, S9310~S9330

P1~P4、P5~P8‧‧‧實體頁面P1~P4, P5~P8 ‧‧‧ physical page

711、733、755、757‧‧‧區段Sections 711, 733, 755, 757‧‧‧

810、830‧‧‧實體區塊810, 830‧‧‧ physical block

1010‧‧‧操作碼1010‧‧‧Operation code

1020‧‧‧寫入模式1020‧‧‧Write mode

1030、1130‧‧‧命令識別碼1030, 1130‧‧‧ command identification code

1040‧‧‧命名空間識別碼1040‧‧‧Namespace ID

1050、1060‧‧‧記憶體位址1050, 1060‧‧‧ memory address

1070‧‧‧實體區段資訊1070‧‧‧Physical section information

1080‧‧‧搬移區段數量1080‧‧‧ Number of moving sections

1100‧‧‧完成元件1100‧‧‧Complete components

1110‧‧‧實體區域頁面紀錄1110‧‧‧Physical Area Page Record

1120‧‧‧狀態旗標1120‧‧‧ State flag

1230、1330‧‧‧直接資料存取電路1230, 1330‧‧‧ direct data access circuit

1250、1350‧‧‧寄存器1250, 1350‧‧‧‧ register

第1圖係依據本發明實施例之快閃記憶體的系統架構示意圖。FIG. 1 is a schematic diagram of a system architecture of a flash memory according to an embodiment of the present invention.

第2圖係依據本發明實施例之存取介面與儲存單元的方塊圖。FIG. 2 is a block diagram of an access interface and a storage unit according to an embodiment of the invention.

第3圖係依據本發明實施例之一個存取子介面與多個儲存子單元的連接示意圖。FIG. 3 is a schematic diagram of connection between an access sub-interface and a plurality of storage sub-units according to an embodiment of the present invention.

第4圖係儲存單元的示意圖。Figure 4 is a schematic diagram of a storage unit.

第5圖係命令佇列示意圖。Figure 5 is a schematic diagram of the command queue.

第6圖係資料存取命令的執行步驟的流程圖。Figure 6 is a flow chart of the execution steps of the data access command.

第7圖係依據一些實施方式之垃圾回收示意圖。Figure 7 is a schematic diagram of garbage collection according to some embodiments.

第8圖係依據一些實施方式之耗損平均示意圖。Figure 8 is a schematic diagram of the average loss according to some embodiments.

第9圖係依據本發明實施例之快閃記憶體的資料內部搬移方法流程圖。FIG. 9 is a flowchart of a method for internally moving data in a flash memory according to an embodiment of the present invention.

第10圖係依據本發明實施例的內部搬移命令的資料格式圖。FIG. 10 is a data format diagram of an internal move command according to an embodiment of the present invention.

第11圖係完成元件的資料格式圖。Figure 11 is the data format diagram of the completed component.

第12圖係依據本發明實施例的廢料蒐集程序的內部搬移作業示意圖。FIG. 12 is a schematic diagram of the internal moving operation of the waste collection process according to an embodiment of the present invention.

第13圖係依據本發明實施例的耗損平均程序的內部搬移作業示意圖。FIG. 13 is a schematic diagram of the internal moving operation of the wear-out average procedure according to an embodiment of the present invention.

111‧‧‧主裝置 111‧‧‧Main device

133‧‧‧處理單元 133‧‧‧ processing unit

S1120~S1140、S1310、S1350~S1360、S9110~S9120、S9310~S9330‧‧‧方法步驟 S1120~S1140, S1310, S1350~S1360, S9110~S9120, S9310~S9330‧‧‧

Claims (12)

一種快閃記憶體的資料內部搬移方法,由一固態硬碟中的一處理單元執行,包含: 接收一內部搬移命令,指示將一輸出入通道的一來源位置的資料搬移到上述輸出入通道的一新位置; 執行上述輸出入通道的一複製回寫程序,用於將上述輸出入通道的上述來源位置的資料搬移到上述輸出入通道的一目的地位置;以及 依據上述複製回寫程序的執行結果回覆一完成元件給上述主裝置。A method for internally transferring data from flash memory, executed by a processing unit in a solid state drive, including: Receive an internal move command, instructing to move the data of a source location of an I/O channel to a new location of the aforementioned I/O channel; Executing a copy-write-back program of the I/O channel for moving the data of the source location of the I/O channel to a destination location of the I/O channel; and According to the execution result of the copy-and-write program, a completed component is returned to the host device. 如請求項1所述的快閃記憶體的資料內部搬移方法,其中,上述目的地位置由上述主機端決定,並且上述內部搬移命令包含上述來源位置和上述目的地位置的資訊。The method for internally transferring data of a flash memory according to claim 1, wherein the destination location is determined by the host, and the internal migration command includes information of the source location and the destination location. 如請求項1所述的快閃記憶體的資料內部搬移方法,包含: 在上述複製回寫程序執行前,決定上述目的地位置;以及 在上述複製回寫程序成功執行後,利用上述完成元件通知上述主裝置關於上述目的地位置的資訊。The method for internally transferring data of the flash memory as described in claim 1 includes: Before the above copy-and-write program is executed, determine the above-mentioned destination location; and After the copy-and-write-back procedure is successfully executed, the completion element is used to notify the host device of the destination location information. 如請求項1至3中任一項所述的快閃記憶體的資料內部搬移方法,其中,上述主裝置持續監督上述輸出入通道的一使用狀態,用於決定發送上述內部搬移命令給上述固態硬碟的時間點。The method for internally transferring data in a flash memory according to any one of claims 1 to 3, wherein the master device continuously monitors a use state of the input/output channel for deciding to send the internal transfer command to the solid state The time of the hard drive. 如請求項4所述的快閃記憶體的資料內部搬移方法,其中,上述使用狀態包含一可用閒置區塊的數量、每一實體區塊的抹除次數或讀取次數。The method for internally transferring data of the flash memory according to claim 4, wherein the usage state includes a number of available idle blocks, the number of erasing or reading times of each physical block. 如請求項1至3中任一項所述的快閃記憶體的資料內部搬移方法,其中,上述內部搬移命令包含一讀取模式和一寫入模式的資訊,上述讀取模式指出一第一預設模式或一第一單層式單元模式,以及上述寫入模式指出一第二預設模式或一第二單層式單元模式。The method for internally transferring data of a flash memory according to any one of claims 1 to 3, wherein the internal transfer command includes information of a read mode and a write mode, and the read mode indicates a first The preset mode or a first single-layer unit mode, and the above-mentioned write mode indicate a second preset mode or a second single-layer unit mode. 如請求項6所述的快閃記憶體的資料內部搬移方法,包含: 依據上述內部搬移命令,以上述第一預設模式或上述第一單層式單元模式讀取上述輸出入通道的上述來源位置的資料;以及 依據上述內部搬移命令,以上述第二預設模式或上述第二單層式單元模式寫入資料至上述輸出入通道的上述目的地位置。The method for internally transferring data of the flash memory as described in claim 6 includes: Reading the data of the source position of the I/O channel in the first preset mode or the first single-layer unit mode according to the internal movement command; and According to the internal transfer command, write data to the destination position of the I/O channel in the second preset mode or the second single-layer unit mode. 一種快閃記憶體的資料內部搬移裝置,包含: 一快閃控制器,耦接一儲存單元,其中,上述儲存單元包含一輸出入通道;以及 一處理單元,耦接上述快閃控制器,用於從一主裝置接收一內部搬移命令,指示將上述輸出入通道的一來源位置的資料搬移到上述輸出入通道的一新位置;指示上述快閃控制器執行上述輸出入通道的一複製回寫程序,用於將上述輸出入通道的上述來源位置的資料搬移到上述輸出入通道的一目的地位置;以及依據上述複製回寫程序的執行結果回覆一完成元件給上述主裝置。A data internal moving device of flash memory, including: A flash controller coupled to a storage unit, wherein the storage unit includes an input and output channel; and A processing unit, coupled to the flash controller, for receiving an internal transfer command from a host device, instructing to move the data of a source position of the I/O channel to a new position of the I/O channel; indicating the fast The flash controller executes a copy-and-write-back procedure of the I/O channel to move the data of the source-position of the input-output channel to a destination-position of the input-output channel; and according to the execution result of the copy-and-write-back procedure Reply a completed component to the above master device. 如請求項8所述的快閃記憶體的資料內部搬移裝置,其中,上述目的地位置由上述主機端決定,並且上述內部搬移命令包含上述來源位置和上述目的地位置的資訊。The internal data migration device for flash memory according to claim 8, wherein the destination location is determined by the host, and the internal migration command includes information of the source location and the destination location. 如請求項8所述的快閃記憶體的資料內部搬移裝置,其中,上述處理單元在上述複製回寫程序執行前,決定上述目的地位置;以及在上述複製回寫程序成功執行後,利用上述完成元件通知上述主裝置關於上述目的地位置的資訊。The internal data transfer device of the flash memory according to claim 8, wherein the processing unit determines the destination location before the copy-write-back program is executed; and after the copy-write-back program is successfully executed, uses the above The completion component notifies the above-mentioned host device of the information about the above-mentioned destination location. 如請求項8至10中任一項所述的快閃記憶體的資料內部搬移裝置,其中,上述內部搬移命令包含一讀取模式和一寫入模式的資訊,上述讀取模式指出一第一預設模式或一第一單層式單元模式,以及上述寫入模式指出一第二預設模式或一第二單層式單元模式。The internal data transfer device for flash memory according to any one of claims 8 to 10, wherein the internal transfer command includes information of a read mode and a write mode, and the read mode indicates a first The preset mode or a first single-layer unit mode, and the above-mentioned write mode indicate a second preset mode or a second single-layer unit mode. 如請求項11所述的快閃記憶體的資料內部搬移裝置,其中,上述處理單元依據上述內部搬移命令,指示上述快閃控制器以上述第一預設模式或上述第一單層式單元模式讀取上述輸出入通道的上述來源位置的資料;以及依據上述內部搬移命令,指示上述快閃控制器以上述第二預設模式或上述第二單層式單元模式寫入資料至上述輸出入通道的上述目的地位置。The internal data transfer device for flash memory according to claim 11, wherein the processing unit instructs the flash controller to use the first preset mode or the first single-layer unit mode according to the internal transfer command Reading the data of the source location of the I/O channel; and instructing the flash controller to write data to the I/O channel in the second preset mode or the second single-layer unit mode according to the internal move command The above destination location.
TW108139908A 2017-09-22 2018-01-16 Methods for internal data movement of a flash memory and apparatuses using the same TWI726475B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US201762561824P 2017-09-22 2017-09-22
US62/561,824 2017-09-22

Publications (2)

Publication Number Publication Date
TW202006553A true TW202006553A (en) 2020-02-01
TWI726475B TWI726475B (en) 2021-05-01

Family

ID=66991786

Family Applications (2)

Application Number Title Priority Date Filing Date
TW108139908A TWI726475B (en) 2017-09-22 2018-01-16 Methods for internal data movement of a flash memory and apparatuses using the same
TW107101541A TWI679535B (en) 2017-09-22 2018-01-16 Methods for internal data movement of a flash memory and apparatuses using the same

Family Applications After (1)

Application Number Title Priority Date Filing Date
TW107101541A TWI679535B (en) 2017-09-22 2018-01-16 Methods for internal data movement of a flash memory and apparatuses using the same

Country Status (1)

Country Link
TW (2) TWI726475B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113641597A (en) * 2020-04-27 2021-11-12 慧荣科技股份有限公司 Method and apparatus for managing data storage and computer readable storage medium
TWI748507B (en) * 2020-06-08 2021-12-01 瑞昱半導體股份有限公司 Data access system, and method for operating a data access system
TWI762275B (en) * 2020-05-05 2022-04-21 慧榮科技股份有限公司 Method for performing access management of memory device with aid of dedicated bit information, memory device, electronic device, controller of memory device, and host device
TWI790568B (en) * 2021-03-15 2023-01-21 宏碁股份有限公司 Work status control method for memory device and data storage system
US11580017B2 (en) 2020-04-27 2023-02-14 Silicon Motion, Inc. Method and apparatus and computer program product for preparing logical-to-physical mapping information for host side
US11775187B2 (en) 2021-03-23 2023-10-03 Kioxia Corporation Memory system and data management method including block allocation management

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9465731B2 (en) * 2012-12-31 2016-10-11 Sandisk Technologies Llc Multi-layer non-volatile memory system having multiple partitions in a layer
TWI520153B (en) * 2013-11-05 2016-02-01 威盛電子股份有限公司 Non-volatile memory device and operation method thereof
CN103761988B (en) * 2013-12-27 2018-01-16 华为技术有限公司 Solid state hard disc and data movement method
TWI602067B (en) * 2014-05-01 2017-10-11 物聯網科技股份有限公司 Electronic apparatus interacting with external device
KR101730151B1 (en) * 2014-06-27 2017-04-25 후아웨이 테크놀러지 컴퍼니 리미티드 Method for writing data into flash memory apparatus, flash memory apparatus, and storage system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113641597A (en) * 2020-04-27 2021-11-12 慧荣科技股份有限公司 Method and apparatus for managing data storage and computer readable storage medium
TWI756854B (en) * 2020-04-27 2022-03-01 慧榮科技股份有限公司 Method and apparatus and computer program product for managing data storage
US11580017B2 (en) 2020-04-27 2023-02-14 Silicon Motion, Inc. Method and apparatus and computer program product for preparing logical-to-physical mapping information for host side
TWI762275B (en) * 2020-05-05 2022-04-21 慧榮科技股份有限公司 Method for performing access management of memory device with aid of dedicated bit information, memory device, electronic device, controller of memory device, and host device
US11630602B2 (en) 2020-05-05 2023-04-18 Silicon Motion, Inc. Method and apparatus for performing access management of a memory device with aid of dedicated bit information
TWI748507B (en) * 2020-06-08 2021-12-01 瑞昱半導體股份有限公司 Data access system, and method for operating a data access system
TWI790568B (en) * 2021-03-15 2023-01-21 宏碁股份有限公司 Work status control method for memory device and data storage system
US11775187B2 (en) 2021-03-23 2023-10-03 Kioxia Corporation Memory system and data management method including block allocation management
TWI820439B (en) * 2021-03-23 2023-11-01 日商鎧俠股份有限公司 Memory system and data management method

Also Published As

Publication number Publication date
TWI726475B (en) 2021-05-01
TW201915743A (en) 2019-04-16
TWI679535B (en) 2019-12-11

Similar Documents

Publication Publication Date Title
CN109542335B (en) Data internal moving method of flash memory and device using the same
US11593259B2 (en) Directed sanitization of memory
TWI726475B (en) Methods for internal data movement of a flash memory and apparatuses using the same
TWI506430B (en) Method of recording mapping information method, and memory controller and memory storage apparatus using the same
US8392649B2 (en) Memory storage device, controller, and method for responding to host write commands triggering data movement
TWI678618B (en) Method and apparatus for performing operations to namespaces of a flash memory device
TWI399643B (en) Flash memory storage system and controller and data writing method thereof
TWI601060B (en) Data transmitting method, memory storage device and memory control circuit unit
US9965194B2 (en) Data writing method, memory control circuit unit and memory storage apparatus which performs data arrangement operation according to usage frequency of physical erasing unit of memory storage apparatus
TW201712549A (en) Buffer memory management method, memory control circuit unit and memory storage device
TWI726314B (en) A data storage device and a data processing method
TW201426303A (en) Data reading method, memory controller and memory storage device
TWI710905B (en) Data storage device and method for loading logical-to-physical mapping table
CN112115067A (en) Flash memory physical resource set management device and method and computer readable storage medium
CN111399750B (en) Flash memory data writing method and computer readable storage medium
TWI670595B (en) Methods of proactive ecc failure handling
TWI540428B (en) Data writing method, memory controller and memory storage apparatus
TW201814489A (en) Data storage method and data storage system
US11403011B1 (en) Host memory buffer allocation management
CN108877862B (en) Data organization of page stripes and method and device for writing data into page stripes
US10346040B2 (en) Data merging management method based on data type, memory storage device and memory control circuit unit
TWI613656B (en) Methods for priority writes in a ssd (solid state disk) system and apparatuses using the same
TWI697778B (en) A data storage device and a data processing method
TWI814590B (en) Data processing method and the associated data storage device
US20240201859A1 (en) Stream Data Management in Storage Device