Method for internally moving data in flash memory and device using the method
By introducing internal data transfer methods in flash memory, the dependence of open channel solid-state drives on the access interface during garbage collection and loss averaging is reduced, the problem of large bandwidth consumption is solved, and the system efficiency is improved.
Patent Information
- Application Number
- CN202210242579.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-01-16
- Filing Date
- 2018-03-14
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2038-03-14
AI Technical Summary
When existing open channel solid-state drives perform garbage collection and average consumption, they need to transmit a large amount of data through the access interface, resulting in large bandwidth consumption and affecting system performance.
A method for internal data transfer in flash memory is proposed. Through the processing unit, the internal data transfer command is received, the copy-write back program is executed, the data is moved from the source location to the destination location, and the entity storage comparison table is updated to reduce the dependence on the access interface. .
It effectively reduces the bandwidth consumption of the access interface, improves system efficiency, and reduces the computing resource consumption of the processing unit and the main device.
Smart Images

Figure CN114546293B_ABST
Abstract
Description
[0001] This application is a divisional application. The application date of the original application is March 14, 2018; the application number is 201810209548.5; the name of the invention is: Internal data migration method of flash memory and device using the method. Technical Field
[0002] The present invention relates to a flash memory, in particular to a method for internally moving data in the flash memory and a device using the method. Background Art
[0003] Flash memory devices are usually divided into NOR flash devices and NAND flash devices. NOR flash devices are random access devices. The host device can provide any address to access the NOR flash device on the address pins and immediately obtain the user data stored at the address from the data pins of the NOR flash device. In contrast, NAND flash devices are not random access, but sequential access. NAND flash devices cannot access any random address like NOR flash devices. Instead, the host device needs to write a sequence of bytes into the NAND flash device to define the type of request command (such as read, write, erase, etc.) and the address on this command. The address can point to a page (the smallest data block for a write operation in the flash memory) or a block (the smallest data block for 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 into the buffer in the device, the contents are clocked out sequentially using a strobe signal, allowing the master unit to access the data byte by byte or word by word.
[0004] The open-channel solid state disk (OSD) system includes an open-channel solid state disk (device end) and a host device. The flash translation layer (FTL) is not implemented on the device end, but on the host device. Unlike traditional SSDs, the open-channel solid state disk allows the host device to know the operating parameters inside the SSD, and allows the host device to operate the open-channel solid state disk according to the operating parameters, that is, to manage data. However, the current open-channel solid state disk only includes three basic access commands: erase; read; and write. When the host device executes an access program that can only be completed by a series of reads and writes, such as garbage collection (GC) and wear leveling, it is necessary to transmit data through the access interface of the open-channel solid state disk, which consumes a large amount of bandwidth of the access interface.
[0005] Therefore, a method for internally moving data in a flash memory and a device using the method are needed to solve the above-mentioned problems. Summary of the invention
[0006] An embodiment of the present invention proposes a method for internally moving data of a flash memory, which is executed by a processing unit in a solid-state drive and includes the following steps: receiving an internal move command, instructing to move data at a source position of an input / output channel to a new position of the input / output channel; executing a copy-back write-back program of the input / output channel to move data at the source position of the input / output channel to a destination position of the input / output channel; and returning a completion element to the host device based on the execution result of the copy-back write-back program.
[0007] The embodiment of the present invention further provides a flash memory data internal migration device, comprising a flash controller and a processing unit. The processing unit is coupled to the flash controller, and is used to receive an internal migration command from a host device, instructing the data at the source position of the input / output channel to be moved to a new position of the input / output channel; instructing the flash controller to execute a copy-back program of the input / output channel, in order to move the data at the source position of the input / output channel to a destination position of the input / output channel; and returning a completion element to the host device according to the execution result of the copy-back program. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 FIG. 4 is a schematic diagram of a system architecture of a flash memory according to an embodiment of the present invention.
[0009] Figure 2 is a block diagram of an access interface and a storage unit according to an embodiment of the present invention.
[0010] Figure 3 It is a schematic diagram of the connection between an access sub-interface and a plurality of storage sub-units according to an embodiment of the present invention.
[0011] Figure 4 is a schematic diagram of a storage unit.
[0012] Figure 5 This is a diagram of the command queue.
[0013] Figure 6 It is a flowchart of the execution steps of data access commands.
[0014] Figure 7 is a schematic diagram of garbage collection according to some implementations.
[0015] Figure 8 is a schematic diagram of wear leveling according to some implementations.
[0016] Fig. 9 The present invention is a flowchart of a flash memory data internal migration method according to an embodiment of the present invention.
[0017] Fig.10 4 is a data format diagram of an internal move command according to an embodiment of the present invention.
[0018] Fig.11 This is the data format diagram for completing the component.
[0019] Fig.12 Schematic diagram of the internal movement operation of the waste collection process according to an embodiment of the present invention.
[0020] Fig.13 FIG. 4 is a schematic diagram of the internal migration operation of the wear leveling program according to an embodiment of the present invention.
[0021] Explanation of symbols
[0022] 110 master device; 120 data buffer;
[0023] 130 solid state drive; 133 processing unit;
[0024] 135 flash controller; 137 access interface;
[0025] 137_0~137_j access sub-interface;
[0026] 139 storage unit;
[0027] 139_0_0~139_j_i storage subunit;
[0028] 310_0 data line;
[0029] 320_0_0~320_0_i chip enable control signal;
[0030] 410, 430, 450, 470 input and output channels;
[0031] 410_0~410_m, 430_0~430_m, 450_0~450_m, 470_0~470_m data plane;
[0032] 490_0~490_n super page;
[0033] P#0~p#(n) entity page;
[0034] 510 Submission Queue;
[0035] 530 completed the queue;
[0036] S1110~S1360 method steps;
[0037] 710, 730, 750, 770 physical blocks;
[0038] P1~P4 entity pages;
[0039] Sections 711, 733, 755, 757;
[0040] 810, 830 physical blocks;
[0041] P5~P8 entity pages;
[0042] S9110~S9120, S9310~S9330 method steps;
[0043] 1000 Internal move command;
[0044] 1010 opcode;
[0045] 1020 write mode;
[0046] 1030 command identification code;
[0047] 1040 Namespace identifier;
[0048] 1050 main memory address;
[0049] 1060 extended memory address;
[0050] 1070 entity segment information;
[0051] 1080 Number of moved sections;
[0052] 1100 Completed components;
[0053] 1110 storage execution reply table;
[0054] 1120 status flag;
[0055] 1130 command identification code;
[0056] 1210 access sub-interface;
[0057] 1230 direct data access circuit;
[0058] 1250 registers;
[0059] 1310 access sub-interface;
[0060] 1330 direct data access circuit;
[0061] 1350 registers. DETAILED DESCRIPTION
[0062] The following description is a preferred implementation of the invention, which is intended to describe the basic spirit of the invention, but is not intended to limit the invention. The actual content of the invention must refer to the scope of the following claims.
[0063] It must be understood that the words "comprise", "include" and the like used in this specification are intended to indicate the existence of specific technical features, values, method steps, operation processing, elements and / or components, but do not exclude the addition of more technical features, values, method steps, operation processing, elements, components, or any combination of the above.
[0064] The words "first", "second", "third", etc. used in the claims are used to modify the elements in the claims and are not used to indicate a priority order, a prior relationship, or that one element precedes another element, or a temporal sequence in performing method steps. They are only used to distinguish elements with the same name.
[0065] Figure 11 is a schematic diagram of the architecture of an open channel solid state drive system 100 according to an embodiment of the present invention. The architecture of the open channel solid state drive system 100 includes a host device 110, a data buffer 120 and an open channel solid state drive (SSD, Solid State Disk) 130. When the host device 111 is operating, a queue, a physical storage mapping table (Storage Mapping Table, also known as L2P Logical-to-Physical table) and a usage record can be established according to its needs. This system architecture can be implemented in electronic products such as personal computers, laptop computers (Laptop PC), tablet computers, mobile phones, digital cameras, digital video cameras, etc. The data buffer 120, the queue, the physical storage mapping table and the usage record can be implemented in a specific area in a random access memory (RAM, Random Access Memory). The host device 110 communicates with the open channel solid state drive 130 through an open channel solid state drive fast non-volatile memory (NVMe, Non-Volatile Memory express) interface. The host device 110 can be implemented in a variety of ways, such as using general-purpose hardware (e.g., a single processor, a multi-processor with parallel processing capabilities, a graphics processor, or other processors with computing capabilities), and providing the functions described below when executing instructions, macrocodes, or microcodes. The host device 110 may include an arithmetic and logic unit (ALU) and a bit shifter. The arithmetic and 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.), while the bit shifter is responsible for bit shift operations and bit rotation. The open channel SSD NVMe specification, such as version 1.2, was published in April 2016, and supports multiple input / output channels (I / O Channels), each of which is connected to a logical unit number LUNs, Logical Unit Numbers), which are used to correspond to multiple storage sub-units 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 side to optimize the load. The traditional Flash Translation Layer maps the logical block addresses (LBAs) recognized by the host side or the file system to the physical addresses of the storage unit 139 (also known as logical to physical mapping).In the open channel SSD NVMe specification, the host device 110 can instruct the open channel SSD 130 to store user data at a physical address in the storage unit 139. Therefore, the maintenance of the physical storage reference table is the responsibility of the host device 110 and records at which physical address in the storage unit 139 the user data of each logical block address is actually stored.
[0066] 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 communication protocol to receive a data access command including a physical address, and instruct the flash controller 135 to perform erase, read or write according to the data access command. It should be noted that the processing unit 133 can be implemented using a lightweight general-purpose processor.
[0067] 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. Specifically, a double data rate (DDR) communication protocol may be used, such as an open NAND flash interface (ONFI), a double data rate switch (DDR Toggle), or other interfaces. The flash controller 135 of the open channel SSD 130 writes user data to a specified address (destination address) in the storage unit 139 through the access interface 137, and reads user data from a specified address (source address) in the storage unit 139. The access interface 137 uses a number of electronic signals to coordinate the data and command transmission between the flash controller 135 and the storage unit 139, including a data line, a clock signal, and a control signal. The data lines can be used to transmit commands, addresses, read and write data; the control signal lines can be used to transmit control signals such as chip enable (CE), address latch enable (ALE), command latch enable (CLE), write enable (WE), etc. The processing unit 133 and the flash controller 135 can exist separately or be integrated into the same chip.
[0068] During system boot, the host device 110 obtains the operation parameters required to control the operation of the open channel SSD 130 from the open channel SSD 130, such as the number of blocks, the number of bad blocks, latency, the total number of input and output channels, etc.
[0069] The storage unit 139 may include a plurality of storage sub-units, each storage sub-unit communicating with the flash controller 135 using an associated access sub-interface. One or more storage sub-units may be packaged in a die. Figure 2 1 is a block diagram of an access interface and a storage unit according to an embodiment of the present invention. The open channel solid state drive 130 may include j+1 access sub-interfaces 137_0 to 137_j, each access sub-interface connecting i+1 storage sub-units. The access sub-interface and the storage sub-units connected thereto may be collectively referred to as an input / output channel and may be identified by a logical unit number. In other words, i+1 storage sub-units share one access sub-interface. For example, when the open channel solid state drive 130 includes 4 input / outputs (j=3) and each input / output is connected to 4 storage units (i=3), the open channel solid state drive 130 has a total of 16 storage sub-units 139_0_0 to 139_j_i. The flash controller 135 may drive one of the access sub-interfaces 137_0 to 137_j to read data from a designated storage sub-unit. Each storage sub-unit has an independent chip enable (CE) control signal. In other words, when data is to be read from a designated storage sub-unit, the associated access sub-interface needs to be driven to enable the chip enable control signal of the storage sub-unit. Figure 3 The schematic diagram of the 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 sub-units 139_0_0 to 139_0_i through the access sub-interface 137_0 using independent chip enable control signals 320_0_0 to 320_0_i, and then read data from the designated address of the selected storage sub-unit through the shared data line 310_0.
[0070] Figure 41 is a schematic diagram of a storage unit 139. The storage unit 139 includes a plurality of 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 a plurality of data planes are placed in a logical unit number. Data planes 410_0 to 410_m and the shared access sub-interfaces are called input / output channels 410, data planes 430_0 to 430_m and the shared access sub-interfaces are called input / output channels 430, data planes 450_0 to 450_m and the shared access sub-interfaces are called input / output channels 450, and data planes 470_0 to 470_m and the shared access sub-interfaces are called input / output channels 470, where m can be an integer that is a power of 2 (e.g., 2, 4, 8, 16, 32, etc.), and input / output channels 410, 430, 450, and 470 can be identified using logical unit numbers. Each of the data planes 410_0 to 470_m includes a plurality of physical blocks, each physical block includes a plurality of pages P#0 to P#(n), each page includes a plurality of sectors (e.g., 4, 8, etc.), where n may be 767 or 1535, etc. Each page includes a plurality of NAND memory cells, and the NAND memory cells may be single-level cells (SLCs), multi-level cells (MLCs), triple-level cells (TLCs), or 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 planes 410_0 to 470_0 can virtually form a super page 490_0, and the page P#1 in the data planes 410_0 to 470_0 can virtually form a super page 490_1, and so on. In other embodiments, when each NAND memory cell is a multi-layer cell and can record four states, a physical word line can include page P#0 (which can be called the least significant bit page, MSB), page P#1 (which can be called the most significant bit page, LSB), and so on.In some other embodiments, when each NAND memory cell is a three-level cell and can record 8 states, a physical word line may include page P#0 (can be called the least significant bit page, MSB page), page P#1 (can be called the center significant bit page, CSB) and page P#2 (can be called the most significant bit page, LSB page). When each NAND memory cell is a four-level cell and can record 16 states, in addition to the MSB, CSB and LSB pages, a TSB (can be called the top significant bit, TSB) page is further included.
[0071] When the storage unit 139 is in operation, a page may be the smallest unit of data management or programming, and its size is, for example, 16KB. In this case, the physical address may be represented by a page number; or a page may include multiple sectors, and its size is, for example, 4KB. In this case, the sector may be the smallest unit of data management, and the physical address may be represented by the sector number of the page or the offset of the sector in the page. A block is the smallest unit of data erasure.
[0072] Physical blocks can be divided into active blocks, data blocks and idle blocks according to their usage status. Active blocks refer to physical blocks that are currently being written with data, i.e. physical blocks that have not yet written the end of block information. Data blocks refer to physical blocks that have already written the end of block information, i.e. no user data is written. Idle blocks can be selected to become active blocks, and idle blocks do not store any valid user data. Usually, after an idle block is selected, it needs to be erased before it can become an active block.
[0073] In some embodiments, the physical address sent by the host device 110 to the open channel SSD 130 may include information such as a logical unit number, a data plane number, a physical block number, a physical page number, and a segment number to indicate that the user data to be read or written is located in a specific segment of a specific physical page in a specific physical block in a specific data plane in a specific input / output channel. In some embodiments, the segment number is sometimes replaced by a column number. In other embodiments, the physical address sent by the host device 110 to the open channel SSD 130 may include information such as a logical unit number, a data plane number, and a physical block number to indicate that a specific data block in a specific data plane in a specific input / output channel is to be erased.
[0074] Figure 51 is a schematic diagram of a command queue. The queue 115 may include a submission queue 510 and a completion queue 530, which are used to temporarily store master device instructions and completion elements, 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 master device instruction, 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 stores a completion element associated with a data access command or a management command, and the function of this completion element is similar to a confirmation message. The entries in the collection are stored in sequence. The basic principle of the operation of the collection is to add entries from the end position (which can be called entry) and remove entries from the beginning position (which can be called 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 can write a data access command (e.g., erase, read, write command, etc.) to the submission queue 510, and the processing unit 133 reads (or fetches) the earliest data access command from the submission queue 510 and executes it. After the data access command is executed, the processing unit 133 writes a completion element to the completion queue 530, and the host device 110 can read or fetch the completion element to determine the execution result of the data access command.
[0075] Figure 61 is a flowchart of the execution steps of the data access command. The host device 110 generates and writes a data access command (e.g., erase, read, write command, etc.) to the submission queue 510 (step S1110), wherein the data access command includes information of a physical address, and the physical address points to a specific block, page or segment address. Then, the host device 110 sends a submission doorbell to the processing unit 133 (step S1120) to notify the processing unit 133 that a data access command has been written into the submission queue 510, and to update the value of the tail of the submission queue 510. After receiving the submission doorbell (step S1310), the processing unit 133 reads the (earliest arrived) data access command from the submission queue 510 (step S1320), and instructs the flash controller 135 according to the data access command to complete the specified operation (e.g., erase, read, write, etc.) (step S1330). After the designated operation is completed, the processing unit 133 generates and writes a 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 host device 110 reads the (earliest arrived) completion element from the completion queue 530 (step S1130), and then issues a completion doorbell to the processing unit 133 (step S1140). After receiving the completion doorbell (S1360), the processing unit 133 updates the value of the queue head (Head) of the completion queue 530.
[0076] In steps S1120 and S1140 , the host device 110 may set corresponding registers to send a doorbell submission and doorbell termination signal to the processing unit 133 .
[0077] A data access command can process multiple user data, for example, 64 records, and the completion element can include a 64-bit execution response table, each bit representing the execution result of each user data, for example, "0" represents success, and "1" represents failure. The data access command includes an operation code field to store the type of data access command (for example, erase, read, write, etc.). The completion element includes a status field to store the execution status of the corresponding data access command (for example, success, failure, etc.). In addition, the processing unit 133 can execute the data access command in a random order or in order of priority. Therefore, the data access command and the completion element both include a command identifier (Command Identifier) to allow the host device 110 to associate each completion element with a specific data access command.
[0078] For example, an idle block needs to be erased before writing to become an active block. The host device 110 can write an erase command to the submission queue 510 (step S1110) to instruct the open channel solid state drive 130 (more specifically, the processing unit 133) to perform an erase 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 complete the erase operation specified in the storage unit 139 by driving the access interface 137 (step S1330). When the erase operation is completed, the processing unit 133 writes a completion element to the completion queue 530 (step S1340) to notify the host device 110 of the information that the corresponding erase operation has been completed.
[0079] 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 read the user data from a specific physical page (specific segment) in a specific physical block in a specific data plane in a specific input / output channel. In response to the read command, 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, and stores the user data in the data buffer 120 specified by the read command (step S1330). When the read operation is completed, the processing unit 133 writes a completion element to the completion queue 530 (step S1340) to notify the host device 110 that the corresponding read operation has been completed.
[0080] For example, the host device 110 may store the user data to be written in the data buffer 120, and store a write command to the submission queue 510 (step S1110) to instruct the open channel solid state drive 130 to write the user data to a specific physical page (specific segment) in a specific active block in a specific data plane in a specific input / output channel, wherein the write command includes address information of the user data to be written stored in the data buffer 120. In response to the write command, the processing unit 133 reads the user data to be written from the specified address in the data buffer 120, and instructs the flash controller 135 to program the user data to the physical address specified by the write command in the storage unit 139 through the drive access interface 137 (step S1330). When the write operation is completed, the processing unit 133 writes a completion element to the completion queue 530 (step S1340) to notify the host device 110 of the completion of the corresponding write operation.
[0081] After multiple accesses, a physical page may include valid and invalid segments (also called expired segments), wherein the valid segment stores valid user data and the invalid segment stores invalid (old) user data. In some embodiments, when the host device 110 detects that the available space of the storage unit 139 is insufficient, the host device 110 may use the read command as described above to instruct the processing unit 133 to read and collect the user data in the valid segment. Then, the host device 110 may use the write command as described above to instruct the processing unit 133 to rewrite the collected valid user data to the idle block or the empty physical page of the active block, so that these data blocks containing invalid user data can be changed into idle blocks, and after being erased, data storage space can be provided. The above-mentioned procedure is called garbage collection (GC).
[0082] Figure 7 Schematic diagram of garbage collection according to some embodiments. Assume that a physical page of a data block includes four sectors, each of which can store a piece of user data: after multiple accesses, the 0th sector 711 of the physical page P1 in the data block 710 stores valid user data, and the rest stores invalid user data. The 1st sector 733 of the physical page P2 in the data block 730 stores valid user data, and the rest stores invalid user data. The 2nd and 3rd sectors 755 and 757 of the physical page P3 in the data block 750 store valid user data, and the rest stores invalid user data. In order to collect the 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 procedure can be executed, including a series of read and write commands.
[0083] In addition, after a certain number of erasures (e.g., 500 times, 1000 times, 5000 times, etc.), the physical blocks in the storage unit 139 will be listed as bad blocks and no longer used due to poor data retention capabilities. In order to extend the service life of the physical blocks, the master 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 master device 110 can 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 master 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 previously read user data to the available physical pages in the selected destination block. The above-described procedure is called wear leveling. Figure 8Schematic diagram of wear leveling according to some embodiments. Assuming that the erase count of data block 810 has exceeded the erase threshold, and the erase count of idle block 830 is the least among all physical blocks in this input / output channel: the master device 110 starts wear leveling and moves the user data of physical pages P5 to P6 in data block 810 to physical pages P7 to P8 in idle block 830, wherein the wear leveling process includes a series of read and write commands.
[0084] In addition, the host device 110 may record the number of reads of each data block and use the number of reads as a condition for starting the wear leveling process. For example, in a month, the number of reads of data block 810 is the lowest and the number of erases does not exceed the erase threshold. The host device 110 may select an idle block with the highest number of erases among all idle blocks or all idle blocks of the same input / output channel, such as idle block 830, as the destination block, and use data block 810 as the source block to start the wear leveling process to move the user data (or cold data) of data block 810 to idle block 830, wherein the wear leveling process includes a series of read and write commands.
[0085] However, using the read and write commands as described above to complete the garbage collection or wear leveling process will cause the queue 115 to consume a large amount of space to store a series of read and write commands and completion elements, and the data buffer 120 will also need to consume a large amount of bandwidth to transmit the data read from the storage unit 139 and the data to be written to the storage unit 139, and consume a large amount of space to store the data read from the storage unit 139. In addition, the host device 110 and the processing unit 133 also need to consume a large amount of computing resources to process this series of read and write commands, which will make the open channel SSD 130 unable to maintain appropriate computing resources to respond to the data access commands of the host device 110 in a timely manner, resulting in low system performance of the open channel SSD 130.
[0086] In order to solve the defects of the above-mentioned implementation methods, an embodiment of the present invention provides a method for internal data migration of a flash memory. The method is applicable to a system in which a physical storage reference table is maintained by a host device 110, such as an open channel solid state drive system 100. Fig. 91 is a flow chart of a method for internal data migration of a flash memory according to an embodiment of the present invention. The host 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, etc. When the host device 110 detects that the usage status of an input / output channel in the open-channel solid-state drive 130 meets the conditions for data migration, an internal move (InternalMovement) command is generated and written to the submission queue 510 (step S9110) to instruct the open-channel solid-state drive 130 to move the user data of the source block in the specific input / output channel to the destination block in the same input / output channel, wherein the conditions for data migration may be that the number of idle blocks is lower than the idle threshold or the number of erases or reads of the data block (source block) is higher than the erase threshold or the read threshold, respectively. In addition, it is preferred to only move valid user data to the destination block, but for higher execution efficiency or when most of the user data is valid, all user data may be moved to the destination block.
[0087] After writing the internal move command to the submission queue 510, the host device 110 sends a submission doorbell to the processing unit 133 (step S1120) to notify the processing unit 133 that a data access command has been written into the submission queue 510. After receiving the submission doorbell (step S1310), the processing unit 133 reads the internal move command from the submission queue 510 (step S9310), and in response to the internal move command, instructs the flash controller 135 to start a copy back procedure (CopyBack Procedure) between the source block and the destination block of the specific input / output channel through the driver access interface 137 (step S9320). Although in the most ideal case, the earliest data access command read by the processing unit 133 in step S9310 is the internal move command, when there are other data access commands that arrive earlier in the submission queue 510, the processing unit 133 will take some time to read and execute these data access commands that arrive earlier before reading and executing the internal move command in step S9310. Figure 6The reading and execution of these earlier arrived data access commands cannot be shown, but the present invention is not limited thereto. When the processing unit 133 completes the internal move 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 move command has been completed. In step S1130, the host device 110 can execute an interrupt service routine (ISR, Interrupt Service Routine) to read the completion element in the completion queue 530 and update the physical storage comparison table in response to the executed internal move operation. For example, the physical address (that is, the source block) originally associated with 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 confirmation message read by the processing unit 133 in step S1130 corresponds to the internal move command, when there are other confirmation messages that arrived earlier in the completion queue 530, the processing unit 133 will spend some time reading these earlier confirmation messages and performing corresponding processing before continuing to read the confirmation message corresponding to the internal move command in step S1130 and updating the physical storage comparison table accordingly. Figure 6 The reading and corresponding processing of these earlier arrived confirmation messages cannot be shown in the figure, but the present invention is not limited thereto. In another embodiment, the main device 110 updates the physical storage comparison table at or before step S9110, rather than waiting until step S1130 or after step S1130 to update the physical storage comparison table. In another embodiment, the main device 110 will further determine whether the destination block is full of user data and write the block end information at step S1130. If so, the physical storage comparison table is updated. If not, the physical storage comparison table is not updated.
[0088] Internal move commands can be defined using a structured format. Fig.10 1 is a data format diagram of an internal move command according to an embodiment of the present invention. The internal move command may be a 64-byte command. The 0th byte of the 0th double word of the internal move command 1000 records an operation code (opcode) 1010, which is used 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 a command identification code 1030. This command identification code 1030 is preferably generated in sequence as a basis for identifying the internal move command 1000, and is also used to associate a corresponding completion element in the completion queue 530 with the internal move command 1000. The internal move command 1000 uses a segment as a basic unit to instruct the open channel solid state drive 130 to perform a data move operation on a specific input / output channel, but is not limited thereto.
[0089] Bits 0 to 5 of the 12th double word of the internal move command 1000 record the number of moved sectors 1080, with a maximum value of 64. Therefore, an internal move command 1000 can instruct the open channel SSD 130 to move user data of up to 64 sectors in a specific input / output channel during a data move operation.
[0090] The 10th to 11th double words of the internal move command 1000 record the physical sector information 1070. If the physical address of the physical block is represented by 32 bits, and the value of the move sector number 1080 is 1, the 10th double word of the internal move command 1000 records the user data stored in the sector address (source address) of the source block, and the 11th double word records the user data stored in the sector address (destination address) of the destination block. Through the copy-back procedure, the processing unit 133 can program the user data of the source address to the destination address.
[0091] If the value of the number of moved 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 address are stored in pairs in the data buffer 120. In step S9310, the processing unit 133 reads the internal move command 1000 from the submission queue 510 and obtains the paired source address and destination address from the data buffer 120 according to the record of the physical segment information 1070 and the value of the number of moved segments 1080. Through the copy-back procedure, the processing unit 133 can program multiple user data of multiple source addresses to multiple specified destination addresses.
[0092] In another embodiment, the 6th to 7th double words of the internal move command 1000 record the main memory address 1050 in 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 a physical region page entry or a scatter gather list. When the value of the number of move segments 1080 is greater than 1, the physical segment information 1070 may record the first source address, and the main memory address 1050 may record the first destination address. In another embodiment, the main memory address 1050 may record the first source address, and the extended memory address 1060 may record the first destination address. In another embodiment, the main memory address 1050 may record the first pair of source address and destination address, and when the memory space covered by the main memory address 1050 cannot record all pairs of source addresses and destination addresses, the extended memory address 1060 may record the remaining pairs of source addresses and destination addresses.
[0093] The 24th-25th bits of the 12th double word of the internal move command 1000 record the write mode (M1) 1020, and the 26th-27th bits of the 12th double word record the read mode (M2) 1040. The write mode and the read mode may each include two states, for example: a preset mode and an SLC mode. When it indicates the SLC mode, the processing unit 133 instructs the flash controller 135 to read or write a page of data in the SLC mode by driving the access interface 137. When it indicates the preset mode, the processing unit 133 instructs the flash controller 135 to read or write a page of data in the preset mode by driving the access interface 137. Taking TLC as an example of the preset mode, 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: an SLC mode; an MLC mode; a TLC mode; and a 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 QLC and adopts a three-pass programming method. The first programming only writes the MSB page, the second programming writes the CSB page and the LSB page, and the third programming writes the TSB page. The write 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 input and output channel to write the user data of the MSB page, CSB page, LSB page or TSB page in each memory cell through the drive access interface 137. The above settings can also be applied to the read mode. It should be noted that the setting values of the read mode and the write mode can be different. For example, the read mode is the SLC mode but the write mode is the default mode. Assuming that the storage unit 139 is QLC, the host device 110 can output multiple internal move commands 1000 to read out four user data from the source address of the source block in SLC mode, and program them to the destination address of the destination block in sequence in QLC mode.
[0094] Fig.11 is a data format diagram of the completion element. The completion element 1100 can be a 16-byte message. The 0th to 1st bytes of the 3rd double word of the completion element 1100 record the command identification code 1130, and its content should be consistent with the command identification code 1030 of the internal move command 1000, so as to associate this completion element 1100 with the specific internal move command 1000. The 0th to 1st double word of the completion element 1100 stores the execution reply table 1110, which is used to record the access result of each user data. The 17th to 31st bits of the 3rd double word of the completion element 1100 record the status field 1120, which is used to record the execution result of the internal move command 1000.
[0095] Before step S9110, the host device 110 system may store a plurality of usage records 119, each of which stores information on the usage status of a physical block of an input / output channel. Each time the open channel solid state drive 130 performs a data access operation (e.g., erasing, reading, writing, internal transfer, etc.), the host device 110 may update the usage status information in the corresponding usage record and determine whether the data transfer condition of the corresponding input / output channel is met. For example, the number of idle blocks of the corresponding input / output channel is reduced by 1, the number of erase times of a physical block of the corresponding input / output channel is increased by 1, or the number of read times of a data block of the corresponding input / output channel is increased by 1, etc. In some embodiments, when the usage record 119 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 program needs to be started to increase the number of idle blocks. In some embodiments, when the usage record 119 indicates that the erase count of a physical block of the corresponding I / O channel is higher than the erase threshold, the host device initiates the wear leveling process to prevent the user data from encountering data retention issues.
[0096] In the process of executing data reading or writing, a read failure or a write failure may be encountered. When encountering the above situation, the status field 1120 of the completion component 1100 will be set to "1", and the bit corresponding to the user data of the read failure or the write failure in the execution response 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 program, such as RAID, is started to repair the user data at the source address; if it is a write failure, a new destination address is re-determined for the user data.
[0097] As can be seen from the above description, if a failure occurs during the internal migration process, the host device 110 needs to spend a lot of time and computing resources to determine the cause and correct the error. To solve the above defects, in other embodiments, the host device 110 does not determine a destination address for each user data of the source address, but allows the open channel solid state drive 130 to determine it. After that, the open channel solid state drive 130 uploads the determined destination address to the memory address of the data buffer 120 specified by the host device 111 according to the instruction of the internal migration command 1000, such as: the main memory address 1050, the extended memory address 1060 or the memory address specified by the physical segment information 1070. Finally, the completion component 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.
[0098] When multiple segments of user data need to be moved, in detail, before step 9110, the host device 110 can store the source addresses of multiple user data in the data buffer 120, and store the memory address of the source address in the data buffer 120 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, and the other one of the main memory address 1050, the extended memory address 1060 or the physical segment information 1070 is used as the destination address for the open channel solid state drive 130 to upload the user data. In step 9110, the internal move command 1000 is written to the submission queue 510. The source address can be represented by a logical unit number, a data plane number, a physical block number, a physical page number and a segment number. In step S9310, the processing unit 133 reads and determines the operation code 1010 of the internal move command 1000, and then reads the value of the move segment number 1080, the main memory address 1050, the extended memory address 1060 or the physical segment information 1070 of the internal move command 1000, and then obtains the source address of the plurality of user data from the memory address of the data buffer 120. Then, in step S9320, the processing unit 133 determines a destination address for each user data, for example, selecting an idle block with an erase count as the destination block, and instructing the flash controller 135 to perform a copy-back write procedure on the source block and the destination block of the specific input / output channel through the driver access interface 137. 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 dummy data (Dummy Data) to all remaining pages of this physical word line, and then programs the user data to the MSB page (the first section) of the next physical word line, or re-instructs the flash controller 135 to request to execute the copy write-back procedure on the source block and the destination block of the specific input / output channel through the driver access interface 137, and moves the user data to the MSB page of the next physical word line, or programs the user data to another destination block. In step S9330, when the copy write-back procedure is successfully executed, the processing unit 133 can store the destination addresses of all user data to the data buffer 120, and write the completion element 1100 to the completion queue 530. In step S1130 , after receiving the completion element 1100 , the host device 110 reads all destination addresses from the data buffer 120 according to the value of the moved segment quantity 1080 , the main memory address 1050 , the extended memory address 1060 or the physical segment information 1070 , and updates the physical storage reference table accordingly.
[0099] When only one sector of user data needs to be moved, in detail, in step 9110, the host device 110 can store a source address to the physical sector information 1070 in the internal move command 1000, set the value of the main memory address 1050 as the destination address for the open channel SSD 130 to upload the user data, and write the internal move command 1000 to the submission 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 request a specific input / output channel to perform a copy write-back procedure through the driver access interface 137. In step S9330, when the copy write-back procedure is successfully executed, the processing unit 133 uploads the destination address of the user data to the memory address corresponding to the main memory address 1050 and writes the completion element 1100 to the completion queue 530. In step S1130 , the host device 110 reads the completion element 1100 and reads the destination address from the data buffer 120 according to the value of the main memory address 1050 , and updates the physical storage reference table accordingly.
[0100] Fig.12 1 is a schematic diagram of an internal move operation of a garbage collection procedure according to an embodiment of the present invention. The host device 111 can write an internal move command to the submission queue 510, and the internal move command includes multiple sets of source segments and destination segments. The first set includes the physical locations of the source segment 711 and the destination segment 771, the second set includes the physical locations of the source segment 733 and the destination segment 773, the third set includes the physical locations of the source segment 755 and the destination segment 775, and the fourth set includes the physical locations of the source segment 757 and the destination segment 777. Then, 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 from the source segments 711, 733, 755 and 757, and collect and store them in the register 1250. Then, it instructs the direct data access circuit 1230 to write the data of an entire physical page in the register 1250 into the physical page P4 (including segments 771, 773, 775 and 777) in the physical block 770.
[0101] Fig.131 is a schematic diagram of the internal transfer operation of the wear leveling procedure according to an embodiment of the present invention. The main device 111 can write an internal transfer command to the submission queue 510, and the internal transfer command includes multiple sets of source segments and the physical location of the destination segments. For example, the first set includes the physical location of the first source segment in the physical page P5 of the physical block 810 and the first destination segment in the physical page P7 of the physical block 830, and the second set includes the physical location of the second source segment in the physical page P5 of the physical block 810 and the second destination segment in the physical page P7 of the physical block 830, and so on. Then, the flash controller 135 drives the access sub-interface 1310 to perform the copy write-back procedure. The access sub-interface 1310 instructs the direct data access circuit 1330 to read the data of the eight source segments in the physical pages P5 and P6 and store them in the register 1350, and then instructs the direct data access circuit 1330 to write the data of the two physical pages in the register 1350 to the physical pages P7 and P8 in the physical block 830.
[0102] In addition, during the execution of the copy-back program, the 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. Then, the flash controller 135 outputs a copy-back program 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 the user data does not need to be uploaded to the data buffer 120, the time for transmitting the user data from the source block to the data buffer 120 and from the data buffer 120 to the destination block can be saved, so that the system performance of the open channel solid state drive 130 can be increased, and the purpose of the present invention can be achieved.
[0103] Although Figures 1 to 3 The above-described elements are included, but it is not excluded that more additional elements may be used without violating the spirit of the invention to achieve better technical effects. Figure 6 and Fig. 9 The flowchart is executed in a specified order, but without violating the spirit of the invention, those skilled in the art can modify the order of these steps while achieving the same effect, so the present invention is not limited to the order described above. In addition, those skilled in the art can also integrate several steps into one step, or execute more steps sequentially or in parallel in addition to these steps, and the present invention is not limited thereto.
[0104] 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, the present invention covers obvious modifications and similar arrangements that are familiar to those skilled in the art. Therefore, the scope of the claims should be interpreted in the broadest way to include all obvious modifications and similar arrangements.
Claims
1. A method for internally moving data in a flash memory, executed by a processing unit in a solid state drive, comprising: Receiving an internal move command from a host device, instructing the solid state drive to move data from a source location of an input / output channel to a new location of the input / output channel, wherein the input / output channel includes a plurality of storage sub-units; In response to the internal move command, executing a copy write-back procedure of the input / output channel to move the data at the source location of the input / output channel to a destination location of the input / output channel; and A completion element is returned to the host device according to the execution result of the copy-back program.
2. The method for internally moving data in a flash memory as claimed in claim 1, wherein: The destination location is determined by the host device, and the internal move command includes information of the source location and the destination location.
3. The method for internally moving data in a flash memory as claimed in claim 1, wherein: Include: Before executing the copy-back procedure, determining the destination location; and After the copy-back procedure is successfully executed, the completion element is used to notify the host device of information about the destination location.
4. The method for internally moving data in a flash memory according to any one of claims 1 to 3, characterized in that: The host device continuously monitors a usage status of the input / output channel to determine a time point for sending the internal migration command to the solid state drive.
5. The method for internally moving data in a flash memory as claimed in claim 4, wherein: The usage status includes the number of available idle blocks and the number of erase times or read times of each physical block.
6. The method for internally moving data in a flash memory according to any one of claims 1 to 3, characterized in that: The internal transfer command includes information of a read mode and a write mode, the read mode indicates a first preset mode or a first single-layer cell mode, and the write mode indicates a second preset mode or a second single-layer cell mode.
7. The method for internally moving data in a flash memory as claimed in claim 6, wherein: Include: According to the internal move command, reading the data of the source position of the input / output channel in the first preset mode or the first single-layer unit mode; and According to the internal move command, data is written to the destination position of the input / output channel in the second preset mode or the second single-layer unit mode.
8. A device for internally moving data in a flash memory, comprising: A flash controller is coupled to a storage unit, wherein The storage unit includes an input / output channel, and the input / output channel includes a plurality of storage sub-units; and A processing unit is coupled to the flash controller and is used to receive an internal move command from a host device to instruct the data internal move device of the flash memory to move data from a source position of the input / output channel to a new position of the input / output channel; in response to the internal move command, instruct the flash controller to execute a copy write-back procedure of the input / output channel to move the data from the source position of the input / output channel to a destination position of the input / output channel; and return a completion element to the host device according to the execution result of the copy write-back procedure.
9. The device for internally moving data in a flash memory as claimed in claim 8, wherein: The destination location is determined by the host device, and the internal move command includes information of the source location and the destination location.
10. The device for internally moving data in a flash memory as claimed in claim 8, wherein: The processing unit determines the destination location before the copy-back procedure is executed; and after the copy-back procedure is successfully executed, the processing unit notifies the host device of information about the destination location using the completion element.
11. The device for internally moving data in a flash memory according to any one of claims 8 to 10, characterized in that: The host device continuously monitors a usage status of the input / output channel to determine a time point for sending the internal migration command to the data internal migration device of the flash memory.
12. The device for internally moving data in a flash memory as claimed in claim 11, wherein: The processing unit reads data from the source position of the input / output channel in a first preset mode or the first single-layer unit mode according to the internal move command; and writes data to the destination position of the input / output channel in a second preset mode or the second single-layer unit mode according to the internal move command.
