Method and equipment for realizing NVMe protocol command by using FTL table
By recording NVMe protocol command-related information and physical block information in the FTL table, the problem of implementing NVMe protocol commands and calculating VTC values in the storage device is solved, and more efficient data management and protection is achieved.
Patent Information
- Application Number
- CN202311228473.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2025-03-21
AI Technical Summary
How to implement Write Uncorrectable, Data Set Management, and Deallocate commands in the NVMe protocol in the storage device and calculate VTC values to solve the challenges of existing FTL table structures when implementing these commands.
The relevant information indicated by the host command is recorded at a specified location in the FTL table, including writing information in the non-correctable command, a data set management command and a de-allocation command, and recording physical block information in the FTL table entry, so as to realize the execution of the above command and the calculation of the VTC value.
It realizes the effective execution of Write Uncorrectable, Data Set Management and Deallocate commands in the NVMe protocol in the storage device, and improves the data protection and management capabilities of the storage device by calculating VTC values.
Smart Images

Figure CN119668492A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a method and device for implementing NVMe protocol commands using an FTL table. Background Art
[0002] Figure 1A The block diagram of the storage device is shown. The storage device 102 is coupled to the host to provide storage capacity for the host. The host and the storage device 102 can be coupled in a variety of ways, including but not limited to connecting the host and the storage device 102 through a variety of storage protocols such as SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIe), NVMe (NVM Express), Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103 , a control component 104 , one or more NVM chips 105 , and a DRAM (Dynamic Random Access Memory) 110 .
[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), XPoint memory, etc. are common NVMs.
[0004] The interface 103 may be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.
[0005] The control component 104 is used to control data transmission between the interface 103, the NVM chip 105 and the DRAM 110, and is also used for storage management, mapping of host logical addresses to flash physical addresses, erase leveling, bad block management, etc. The control component 104 can be implemented in a variety of ways, such as software, hardware, firmware, or a combination thereof. For example, the control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller, in which software is executed to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 can also be coupled to the DRAM 110 and can access the data of the DRAM 110. The data of the FTL table and / or cached IO commands can be stored in the DRAM.
[0006] The control component 104 includes a flash memory interface controller (or medium interface controller, flash memory channel controller), which is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that complies with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI" and the like.
[0007] Figure 1B A detailed block diagram showing the control components of a storage device.
[0008] The host accesses the storage device with IO commands that follow the storage protocol. The control component generates one or more media interface commands based on the IO commands from the host and provides them to the media interface controller. The media interface controller generates storage media access commands (e.g., programming commands, read commands, and erase commands) that follow the interface protocol of the NVM chip based on the media interface commands. The control component also tracks that all media interface commands generated from an IO command have been executed and indicates the processing results of the IO command to the host.
[0009] See also Figure 1BThe control components include, for example, a host interface, a host command processing unit, a storage command processing unit, a medium interface controller, and a storage medium management unit. The host interface obtains the IO command provided by the host, and generates a storage command to provide to the storage command processing unit. The storage command, for example, accesses storage space of the same size, such as 4KB. The data unit corresponding to the data accessed by a storage command recorded in the NVM chip is called a data frame. The physical page records one or more data frames. For example, the size of the physical page is 17664 bytes, and the size of the data frame is 4KB, then one physical page can store 4 data frames.
[0010] The storage medium management unit maintains the conversion of LBA (Logical Block Address) to physical address (PPA) for each storage command. For example, the storage medium management unit includes an FTL table. The FTL table can be used to maintain the mapping information from the logical address to the physical address, such as, see Figure 2A as well as Figure 2B As shown. The logical address constitutes the storage space of the storage device perceived by the upper-layer software such as the operating system, and the physical address is the address used to access the physical storage unit of the solid-state storage device. Usually, the data items of the FTL table record the address mapping relationship in the storage device in units of a specified size (such as 512 bytes, 2KB, 4KB, etc.).
[0011] For read commands, the storage medium management unit outputs the physical address corresponding to the logical address accessed by the storage command. For write commands, the storage medium management unit allocates an available physical address and records the mapping relationship between the logical address accessed and the allocated physical address. The storage medium management unit also maintains functions required to manage the NVM chip, such as garbage collection and wear leveling.
[0012] The storage command processing unit operates the media interface controller to issue a storage media access command to the NVM chip according to the physical address provided by the storage media management unit. For the purpose of clarity, the command sent by the host to the storage device is called an IO command, the command sent by the host command processing unit to the storage command processing unit is called a storage command, the command sent by the storage command processing unit to the media interface controller is called a media interface command, and the command sent by the media interface controller to the NVM chip is called a storage media access command. The storage media access command follows the interface protocol of the NVM chip. SSD (Solid State Drives) includes multiple NVM chips. Each NVM chip includes one or more LUNs (Logical UNit), and each logical unit includes multiple physical blocks (Blocks). As the storage capacity increases, the number of NVM chips / LUNs / Blocks increases, and the probability of storage media failure also increases. In order to ensure the reliability of the stored data delivered to users, enterprise-level SSDs use technologies similar to RAID (Redundant Arrays of Independent Disks) (RAID technology for short) to construct data protection units across NVM chips / logic units, so that even if a single NVM chip / logic unit fails, data can still be protected from loss. This can also handle occasional data errors that occur during the operation of storage devices.
[0013] The NVMe protocol defines the Write Uncorrectable command and the Data Set Management command. The Write Uncorrectable command is used to mark the logical address space corresponding to the specified logical address range as invalid. After executing this command, if the data in the specified logical address range is read, a read failure message is returned; a write operation is required to clear the invalid state. The host uses the Data Set Management command to indicate the properties of the logical address range, including properties such as data read or write frequency, access size, and other information used to optimize performance and reliability. The NVMe protocol also defines the Deallocate command. Summary of the invention
[0014] Since the NVMe protocol defines the Write Uncorrectable command and the Data Set Management command, how to implement the above two commands in the storage device is a problem that needs to be solved at present; and since the NVMe protocol also defines the Deallocate command, in the existing FTL table structure, based on the implementation of the above commands, how to calculate VTC (Vaild Transmission unit Count, valid transmission unit number) is also an urgent problem to be solved.
[0015] The present application hopes to provide a method to solve one or more of the above technical problems.
[0016] In a first aspect, an embodiment of the present application provides an information processing method, including:
[0017] receiving a host command sent by a host, wherein the host command complies with a storage protocol command format;
[0018] According to a first LBA carried by the host command, setting relevant information indicated by the host command in an entry of an FTL table corresponding to the first LBA, wherein the entry of the FTL table is used to record a physical address corresponding to the LBA, and the relevant information does not include the physical address corresponding to the LBA;
[0019] The host command includes at least one of a write uncorrectable command, a data set management command and a de-allocation command.
[0020] Optionally, setting the relevant information indicated by the host command in the entry corresponding to the first LBA in the FTL table includes:
[0021] If the host command is a write uncorrectable command, setting identification information at a first designated position of a corresponding entry in the FTL table, the identification information being used to indicate that an uncorrectable error exists in the data corresponding to the first LBA;
[0022] If the host command is a data set management command, setting the attribute information indicated by the data set management command at the second designated position of the corresponding entry of the FTL table;
[0023] If the host command is a de-allocation command, Trim information is recorded at the third designated position of the corresponding entry in the FTL table, and the Trim information is used to indicate that the first LBA corresponding to the entry is de-allocated.
[0024] Optionally, the method further comprises:
[0025] In response to receiving the NVMe read command sent by the host, reading the entry corresponding to the LBA indicated by the NVMe read command;
[0026] If identification information is recorded in the entry corresponding to the LBA indicated by the NVMe read command, feedback is given to the host that an uncorrectable error exists in the data to be read by the NVMe read command;
[0027] If the identification information is not recorded in the entry corresponding to the LBA indicated by the NVMe read command, data is read from the NVM chip and sent to the host as a response to the NVMe read command according to the physical address recorded in the entry corresponding to the LBA indicated by the NVMe read command.
[0028] Optionally, the method further comprises:
[0029] In response to receiving an NVMe write command sent by the host, allocating a physical address for the LBA indicated by the NVMe write command;
[0030] Record the allocated physical address in the entry in the FTL table corresponding to the LBA indicated by the NVMe write command;
[0031] Clear the identification information and Trim information in the entry corresponding to the LBA indicated by the NVMe write command.
[0032] Optionally, the attribute information set in the corresponding entry of the FTL table indicates attributes of consecutive data blocks corresponding to consecutive entries of the FTL table.
[0033] Optionally, the method further comprises:
[0034] In response to receiving an NVMe read command sent by the host, obtaining a first attribute value of a first entry corresponding to the LBA indicated by the NVMe read command;
[0035] According to the first attribute value, detecting whether there is a first entry group corresponding to the first entry, the first entry group including N entries that are consecutive in entry order and correspond to the first attribute value, the N entries including the first entry, and the value of N is greater than or equal to 2;
[0036] If the first entry group exists, determining the continuous data blocks corresponding to the first entry group;
[0037] Reading data of the continuous data block and caching it to a first cache address;
[0038] The physical address of each entry in the first entry group is updated to the first cache address while retaining the physical block information in the physical address of each entry in the first entry group.
[0039] Optionally, the method further comprises:
[0040] If the first entry group does not exist, reading the data of the data block corresponding to the first entry and caching it to a second cache address;
[0041] The physical address of the first entry is updated to the second cache address while retaining the physical block information in the physical address of the first entry.
[0042] Optionally, the method further comprises:
[0043] In response to receiving the NVMe write command sent by the host, obtaining a second attribute value of a second entry corresponding to the LBA indicated by the NVMe write command;
[0044] According to the second attribute value, detecting whether there is a second entry group corresponding to the second entry, the second entry group including M entries that are consecutive in entry order and correspond to the second attribute value, the M entries including the second entry, and the value of M is greater than or equal to 2;
[0045] If the second entry group exists, assigning continuous physical addresses, assigning physical addresses belonging to the same page stripe, or assigning physical addresses from multiple LUNs that are convenient for simultaneous writing and reading to the M entries in the second entry group;
[0046] Writing the data to be written indicated by the NVMe write command to the allocated physical address;
[0047] The corresponding physical addresses are recorded respectively in the M entries of the second entry group, and the attribute information in the M entries is kept unchanged.
[0048] Optionally, the method further comprises:
[0049] If the second entry group does not exist, assigning a physical address to the second entry;
[0050] Writing the data to be written indicated by the NVMe write command into the physical address allocated to the second entry;
[0051] The allocated physical address is recorded in the second entry, and the attribute information in the second entry is kept unchanged.
[0052] Optionally, if the host command is a de-allocation command, Trim information is recorded at a third designated position of a corresponding entry in the FTL table, including:
[0053] In response to the de-allocation command, setting the Trim information recorded in the third designated position of the corresponding entry of the FTL table from a first value to a second value, the first value of the Trim information indicating that the first LBA is in an allocated state, and the second value of the Trim information indicating that the first LBA is in a de-allocated state;
[0054] After the Trim information is set from the first value to the second value, the physical address in the corresponding entry of the FTL table is cleared.
[0055] Optionally, the method further comprises:
[0056] In response to receiving an NVMe write command sent by the host, allocating a cache for the NVMe write command;
[0057] Write the data to be written corresponding to the NVMe write command into the cache, and record the third cache address corresponding to the cache in the entry corresponding to the LBA indicated by the NVMe write command;
[0058] The physical address in the entry corresponding to the LBA indicated by the NVMe write command is cleared while retaining the physical block information in the physical address, and the identification information and / or attribute information in the entry corresponding to the LBA indicated by the NVMe write command is retained.
[0059] Optionally, the method further comprises:
[0060] In response to receiving an NVMe read command sent by the host indicating the same LBA as the NVMe write command, obtaining a third cache address corresponding to the LBA indicated by the NVMe read command;
[0061] The data written by the NVMe write command is read in the cache corresponding to the third cache address.
[0062] Optionally, each entry of the FTL table records physical block information, where the physical block information is a portion of bits of a physical address recorded in the entry; the method further includes:
[0063] Count the number of occurrences of each physical block information from the FTL table;
[0064] For each piece of physical block information, the VTC value of the physical block or large block corresponding to the physical block information is determined according to the number of occurrences of the physical block information.
[0065] Optionally, determining the VTC value of the physical block or large block corresponding to the physical block information according to the number of occurrences of the physical block information includes:
[0066] Determine a VTC table entry in the VTC table corresponding to the physical block information;
[0067] According to the number of occurrences of the physical block information, the count value in the VTC table entry is updated to obtain the VTC value of the physical block or large block corresponding to the physical block information.
[0068] In a second aspect, an embodiment of the present application provides an information processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor implements the steps of the information processing method described in the first aspect when executing the program.
[0069] According to an embodiment of the present application, by recording relevant information indicated by at least one host command among a write uncorrectable command, a data set management command and a de-allocation command at a specified position of an FTL table entry, at least one of a write uncorrectable command, a data set management command and a de-allocation command can be implemented in a storage device; by recording physical block information in an FTL table entry, VTC can be calculated based on the physical block information. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1A A block diagram representing a storage device;
[0071] Figure 1B A detailed block diagram showing the control components of a storage device;
[0072] Figure 2A A schematic diagram showing the FTL table maintaining the mapping information from logical addresses to physical addresses;
[0073] Figure 2B A schematic diagram showing how FTL table entries record physical addresses;
[0074] Figure 3 One of the schematic diagrams showing updating the physical address and identification information of an FTL table entry based on a write command according to an embodiment of the present application;
[0075] Figure 4 A second schematic diagram showing updating the physical address and identification information of an FTL table entry based on a write command according to an embodiment of the present application;
[0076] Figure 5 One of the schematic diagrams showing updating the attribute information of the FTL table entry based on the Data Set Management command in an embodiment of the present application;
[0077] Figure 6 A schematic diagram showing updating the Trim information of an FTL table entry in an embodiment of the present application;
[0078] Figure 7 A schematic diagram showing that an embodiment of the present application stores data to be written in a cache unit and records a cache address in an FTL table entry;
[0079] Fig. 8A The second schematic diagram showing updating the attribute information of the FTL table entry based on the Data Set Management command in an embodiment of the present application;
[0080] Figure 8B A schematic diagram showing updating identification information of an FTL table entry based on a Write Uncorrectable command according to an embodiment of the present application;
[0081] Figure 8C A schematic diagram showing updating the Trim information of an FTL table entry based on a de-allocation command according to an embodiment of the present application;
[0082] Fig.8D A schematic diagram showing an embodiment of the present application in which a cache unit index is written into an FTL table entry based on a write command and physical block information is retained.
[0083] Related technical terms:
[0084] FTL table: maintains the mapping information from logical addresses to physical addresses.
[0085] FTL table entry: An entry in the FTL table used to record the LBA corresponding to the PPA and other information. It is the smallest record unit in the FTL table. DETAILED DESCRIPTION
[0086] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0087] In order to solve the problem of how to implement the Write Uncorrectable command and the Data Set Management command in a storage device, an embodiment of the present application adopts a processing method of recording the relevant information indicated by the Write Uncorrectable command and the Data Set Management command in an existing FTL table, so as to implement the Write Uncorrectable command and the Data Set Management command in the storage device through the relevant information added in the FTL table.
[0088] Each entry in the FTL table records the physical address PPA corresponding to the logical address LBA. For the convenience of memory access and bus transmission, each entry has a specified size, such as 32 bits, wherein PPA occupies some bits, such as 0 to 29 bits, so that each entry in the FTL table has a portion of free space. When recording the relevant information indicated by the Write Uncorrectable command in the FTL table, the free space of each entry is used to store the relevant information indicated by the Write Uncorrectable command. For example, the Write Uncorrectable command sent by the host indicates the logical addresses LBA0 to LBA4, and the logical addresses LBA0 to LBA4 correspond to (entry) entries 0 to 4. In addition to recording PPA in entries 0 to 4, it is also necessary to record identification information (such as identification A) in a specified field (e.g., occupying 1 to 3 bits) in entries 0 to 4. Identification A is used to indicate that the corresponding LBA is written to the information corresponding to the Write Uncorrectable command.
[0089] When the storage device receives the Write Uncorrectable command sent by the host, it sets the identification information (such as identification A) in the corresponding entry of the FTL table according to the LBA indicated by the Write Uncorrectable command. When the storage device receives the NVMe write command, if the LBA corresponding to the NVMe write command has identification A set in the entry corresponding to the FTL table, in addition to allocating the PPA and recording the allocated PPA in the entry corresponding to the LBA, it also clears identification A. For example, see Figure 3 As shown, the FTL table entry 0 shown on the right records PPA0 and identification A. If an NVMe write command is received, the LBA indicated by the NVMe write command corresponds to entry 0, and the PPA allocated to the LBA indicated by the NVMe write command is PPA2, then the PPA in entry 0 needs to be modified from PPA0 to PPA2 (see Figure 3 FTL table shown on the left), and delete the marker A in entry 0.
[0090] When the host reads the LBA corresponding to the entry with the identifier A, the storage device does not provide the read data to the host, but reports feedback information to the host that the read data has an uncorrectable error.
[0091] When recording the relevant information indicated by the Data Set Management command in the FTL table, the free space of each entry is used to store the attribute information indicated by the Data Set Management command. For example, the host uses the Data Set Management command to indicate the logical addresses LBA4 to LBA6 (corresponding to entries 4 to 6). In addition to recording PPA in entries 4 to 6, the attribute information indicated by the Data Set Management command needs to be recorded in the specified fields in entries 4 to 6 (for example, occupying 1 bit or multiple bits). It should be noted that the identification information indicated by the Write Uncorrectable command (such as identification A) and the attribute information indicated by the Data Set Management command can be recorded simultaneously in one entry of the FTL table.
[0092] When the storage device receives the Data Set Management command sent by the host, it sets the attribute information in the corresponding entry of the FTL table according to the LBA and attribute information indicated by the Data Set Management command. When the storage device receives the NVMe write command, if the attribute information is set in the FTL table entry corresponding to the LBA corresponding to the NVMe write command (the corresponding entry in the FTL table), in addition to allocating the PPA and recording the allocated PPA in the FTL table entry corresponding to the LBA, the attribute information needs to be retained. For example, see Figure 4 As shown, the FTL table entry 0 on the right records PPA0, identifier A, and attribute information. If an NVMe write command is received, the LBA indicated by the NVMe write command corresponds to entry 0, and the PPA allocated to the LBA indicated by the NVMe write command is PPA2, then the PPA in entry 0 needs to be modified from PPA0 to PPA2, the identifier A in entry 0 needs to be deleted, and the attribute information needs to be retained (see Figure 4 FTL table shown on the left).
[0093] When setting the attribute information, the value of the attribute information is set in the corresponding FTL table entry based on the LBA and attribute information indicated by the Data Set Management command. Figure 5 As shown, the Data Set Management command indicates, for example, that LBA a-LBAb has attribute A, LBAx-LBA y has attribute B, and LBA m-LBA n has attributes A and B. The control component sets corresponding attribute values in the attribute information of the corresponding entry in the FTL table according to the LBA range indicated by the Data Set Management command.
[0094] As an example, the attribute information indicates the attributes of the data blocks corresponding to the continuous entries of the FTL table (referred to as continuous data blocks for short). The continuous data blocks indicated by the attribute information represent that these data blocks are, for example, most likely to be accessed as a whole. For example, the attribute information field in an entry of the FTL table includes 3 bits (represented as bit0, bit1 and bit2), with bit0 representing the continuous data block for the read command and bit1 representing the continuous data block for the write command. By having the specified value in the bit0 of the attribute information of multiple consecutive entries in the FTL table, it means that the data blocks corresponding to these multiple entries are most likely to be read out as a whole. Similarly, by having the specified value in the bit1 of the attribute information of multiple consecutive entries in the FTL table, it means that the data blocks corresponding to these multiple entries are most likely to be written or updated as a whole.
[0095] As an optional embodiment, after receiving the NVMe read command, the storage device identifies that the data blocks to be read by the NVMe read command belong to continuous data blocks based on the continuous data blocks indicated in the attribute information of the entry where the LBA accessed by the NVMe read command is located and several adjacent entries in the FTL table, such as bit0, and then reads the data of these continuous data blocks for caching, so as to improve the efficiency of subsequent data reading by pre-reading data, and the PPA in multiple entries in the FTL table can be replaced with the cache address of the cached data.
[0096] For example, after receiving an NVMe read command, if the FTL table entry (recorded as entry a) of a certain LBA (recorded as LBA_a) accessed by the NVMe read command records bit0=true, then in addition to reading the data corresponding to LBA_a, it is also necessary to read out the data corresponding to the consecutive entries in the FTL table after and / or before entry a with bit0=true, starting from entry a, and put them in the cache as pre-read data. And in these entries of the FTL table, replace PPA with the cache address storing the pre-read data.
[0097] As another example, the following table lists the bit0 of the attribute information recorded in each of the multiple consecutive entries around entry a in the FTL table. When processing the NVMe read command to access LBA_a, entry a is obtained according to LBAa. In response to the bit0 of the attribute information of entry a being true, the entries around entry a are further checked to obtain the size of the continuous data block corresponding to the read command. In the following table, within the range of entry a-1 to entry a, the bit0 of the attribute information of each entry is true, indicating that the continuous data block includes the data block corresponding to 2 entries. Since the bit0 of entry a+1 is false, the data block corresponding to entry a and entry a+1 (as well as entry a+2 and entry a+3) do not constitute a continuous data block. And accordingly, when processing continuous data blocks, only the data blocks corresponding to entry a-1 and entry a are read out.
[0098] When processing an NVMe write command, bit 0 of the attribute information of the corresponding entry in the FTL table is not concerned.
[0099] FTL table entries Attribute information bit0 Item a-2 False Item a-1 True Item a True Item a+1 False Item a+2 True Item a+3 True Item a+4 True
[0100] After receiving the NVMe write command, the storage device can further determine other entries associated with the current entry and continuous with the current entry in the order of entries, and the bit1 of the attribute information of these other continuous entries is true, when the bit1 of the attribute information of the corresponding entry in the FTL table is determined based on the NVMe write command. The NVMe write command that accesses the LBA of these entries is assigned a continuous physical address, a physical address belonging to the same page stripe, or a physical address from multiple LUNs that is easy to write and read at the same time; and the data carried by the NVMe write command is written to the assigned physical address, and the attribute information in these entries is kept unchanged; thereby realizing writing data to different physical addresses based on the write command.
[0101] As an example, after receiving an NVMe write command, if the storage device records bit1=true in the entry corresponding to a certain LBA accessed by the NVMe write command (recorded as entry b), it can further identify the entries (for example, a total of n entries) that record bit1=true continuously starting from entry b in the FTL table, and identify which of these n entries the NVMe write command is to write data to (for example, data is to be written to m of these entries, m<=n), then for these m entries, assign continuous physical addresses, or assign physical addresses belonging to the same page stripe, or assign physical addresses from multiple LUNs that are easy to write and read at the same time. Then write the data carried by the NVMe write command to the assigned physical address, record the assigned physical address in the entry of the FTL table, and keep the attribute information in these entries of the FTL table unchanged.
[0102] Bit 1 of the attribute information of the continuous multiple entries of the FTL table indicates the continuous data blocks used for the write command. The continuous data blocks used for the write command also play a role in, for example, garbage collection. For example, when a physical block or a large block is recycled, it is identified based on the FTL table that a certain data block being recycled belongs to the continuous data block used for the write command. At this time, the identified continuous data blocks used for the write command are also moved to a new physical block or a large block, even if one or more of the continuous data blocks used for the write command do not belong to the physical block or large block currently being recycled. Through such a garbage collection operation, it is realized that continuous physical blocks used for write commands are allocated continuous physical addresses, or physical addresses belonging to the same page stripe are allocated, or physical addresses from multiple LUNs that are easy to be written and read at the same time are allocated.
[0103] In addition to recording the relevant information indicated by the Write Uncorrectable command and the Data Set Management command through the FTL table, the embodiment of the present application can also record some other information, for example, record the relevant information indicated by the Deallocate command.
[0104] According to an embodiment of the present application, Trim information (as relevant information indicated by the Deallocate command) is also recorded in a designated field of the FTL table entry to indicate whether the LBA corresponding to the entry to which it belongs is de-allocated. For example, the Trim information includes 1 bit, and the specified value of the Trim information is used to indicate that the corresponding LBA is de-allocated. In response to the received de-allocation command (referred to as the Deallocate command in the NVMe specification), the storage device records the Trim information in the corresponding entry of the FTL table, and uses the free space of the entry to record the Trim information, and the Trim information represents that the corresponding FTL table entry (LBA) is de-allocated. In the FTL table entry, in addition to recording the PPA, identification information, attribute information, and Trim information can also be recorded at the same time.
[0105] In the de-allocation command, the logical address range is described. After the de-allocation command is executed, different effects can occur. For example, after executing the de-allocation command, when the logical address range indicated by the de-allocation command is read again, the result obtained is certain (before performing other write operations on the logical address range); after executing the de-allocation command, when the logical address range indicated by the de-allocation command is read again, the result obtained is all 0 (before performing other write operations on the logical address range); after executing the de-allocation command, when the logical address range indicated by the de-allocation command is read again, the result obtained can be any value (before performing other write operations on the logical address range). The execution effect of the de-allocation command can be set or selected in the de-allocation command or other commands. By using the de-allocation command, the host can inform the storage device which logical address spaces no longer store valid data, so that the storage device does not have to move invalid data when performing garbage collection.
[0106] When data is written to LBA, it means that the LBA has been allocated, and the first value of the Trim information represents the allocated state of the LBA; when a de-allocation command is applied to the LBA, it means that the LBA is "de-allocated", and the second value of the Trim information represents that the LBA is in the "de-allocated" state.
[0107] For an entry in the FTL table, for example, 1 bit may be used in the entry to record the state of the entry. For example, 1 and 0 are used to represent the states of "allocated" and "deallocated", see Figure 6 As shown, entries 0 to 3 are in the "allocated" state, and the Trim information in entries 0 to 3 records a value of 1; entries 4 to n are in the "deallocated" state, and the Trim information in entries 4 to n records a value of 0.
[0108] In response to a received write command, the storage device sets "1" in the Trim information of the FTL table entry corresponding to its LBA; when receiving a de-allocation command, it sets "0" in the Trim information of the corresponding FTL table entry according to the indicated LBA range.
[0109] According to another embodiment of the present application, a cache address is recorded in an FTL table entry. The cache address is different from the PPA, which indicates a cache of a storage device such as a DRAM. While recording the cache address, part or all of the Trim information / identification information / attribute information may also be recorded in the FTL table entry. In the case where the cache address is recorded in the FTL table, when a write command indicates that data is written to the cache, the cache address is recorded in the corresponding entry of the FTL table. For example, see Figure 7As shown, write command 1 indicates LBA4 and data DATA1 to be written, cache unit 3 is allocated for write command 1, and DATA1 is stored in cache unit 3, then the cache address indexing cache unit 3 is recorded in entry 4 (corresponding to LBA4) of the FTL table.
[0110] It should be noted that the cache address has a relatively large bit width (e.g., 10 bits), so one of the cache address and the PPA can be recorded in the FTL table entry, that is, either the cache address or the PPA can be recorded, but both the cache address and the PPA cannot be accommodated at the same time. When the index (cache address) of the cache unit is recorded in the FTL table entry, the identification information / attribute information in the entry is not changed. By storing the index of the cache unit in the entry, the cache unit can be determined based on the index of the cache unit, and then data can be obtained in the cache unit.
[0111] When the storage device receives an NVMe read command, it queries the FTL table according to the LBA indicated by the read command, obtains the FTL table entry corresponding to the LBA, and if the FTL table entry records the index of the cache unit, it obtains the data to be read from the cache unit based on the index of the cache unit. If the FTL table entry records the PPA, it obtains the data to be read from the NVM chip.
[0112] According to another embodiment of the present application, VTC is also calculated using FTL table entries. VTC represents the amount of valid data in a physical block or large block. VTC is used in, for example, garbage collection operations of a storage device to select physical blocks or large blocks to be recycled, or to determine the order in which each physical block / large block is recycled.
[0113] In order to calculate VTC, it is necessary to use the physical block information recorded in the FTL table entry, which includes, for example, the LUN number and the physical block number. The physical block information in an entry of the FTL table represents that there is a valid data in the physical block or large block corresponding to the physical block information. Therefore, the physical block information of each entry of the FTL table is accumulated to obtain the amount of valid data in each physical block / large block used.
[0114] The physical block information is part of the PPA and occupies, for example, 15 bits in size. The identification information / attribute information / Trim information in the FTL table entry will not occupy the field recording the PPA in the FTL table entry. However, since the length of the cache unit index is relatively large, for example 10 bits, when recording the index of the cache unit in the FTL table entry, it will inevitably occupy the field recording the PPA. In this application, it is necessary to ensure that when the index of the cache unit is written to the FTL table entry, the original physical block information of the PPA is not destroyed. By ensuring the integrity of the physical block information, it is further ensured that when the cache address is recorded in the FTL table entry, the VTC can still be calculated based on the physical block information.
[0115] When setting identification information and attribute information in the FTL table entry, the physical block information in the original PPA in the FTL table entry needs to be retained because the corresponding operations do not affect the validity of the data corresponding to the LBA; when executing the de-allocation command and setting the Trim information, the original PPA in the FTL table entry must be cleared as a whole without retaining the physical block information because the data corresponding to the LBA becomes invalid.
[0116] When calculating the VTC based on the physical block information, one or more FTL table entries may be obtained from the FTL table. Since the physical block information is recorded in the FTL table entry, the physical block information is then obtained from the obtained FTL table entry, and the count value in the entry corresponding to the obtained physical block information is updated in the VTC table. After the VTC table is updated based on all the entries in the FTL table, the count value corresponding to each physical block information is obtained in the VTC table as the VTC value of each physical block or large block.
[0117] Among them, the VTC table includes multiple entries, each entry records the number of valid transmission units of the physical block or large block associated with the entry. The position of the entry of the VTC table in the VTC table implies the physical block information (physical block number or large block number) associated with the entry. Therefore, the entry of the FTL table is associated with one of the entries of the VTC table according to the physical block information it indicates. Therefore, after obtaining the physical block information from the FTL table entry, the count value in the entry corresponding to the obtained physical block information can be updated in the VTC table. It can still be understood that each entry in the FTL table corresponds to a physical page or a storage space of 4KB in size, and each entry in the VTC table corresponds to a physical block, so the entries in the FTL table and the entries in the VTC table are in a many-to-one relationship.
[0118] In another embodiment, the VTC accelerator provided in Chinese patent application 202110251863.6 is used. The VTC accelerator is coupled to the FTL table, and the position of the physical block information in the FTL table entry is configured to the VTC accelerator (for example, bit15-bit29 in the 32-bit entry). The VTC accelerator automatically traverses each entry of the FTL table and updates the VTC table. The traversal of the FTL table does not affect the access to the FTL table when processing one or more NVMe commands according to the embodiment of the present application. For example, the identification information and / or attribute information is recorded in bit30-bit32 of the FTL table entry, and the cache address is recorded in bit0-bit9 of the FTL table entry, so that when the identification information, attribute information and / or cache address are set in the FTL table entry according to the embodiment of the present application, the physical block information recorded in bit15-bit29 to be used by the VTC accelerator will not be destroyed. Optionally or further, when processing a de-allocation command, in addition to setting the Trim information, the PPA of the corresponding entry is cleared (e.g., set to 0), so that the physical block information obtained by the VTC accelerator from such an entry is a specified value (e.g., 0), and the VTC accelerator will know that the specified value represents an invalid physical block or large block (or represents invalid data) without the need to update the VTC table accordingly. It can be understood that when processing an NVMe write command or writing data in the cache to the NVM chip, the FTL table entry will be updated with a new PPA, and the physical block information of the entry will be updated.
[0119] It should be noted that the physical block information in the FTL table entry indicates that there is valid data of one DU (data fragment) in the physical block or large block represented by the physical block information, so by counting the number of occurrences of each physical block information from the FTL table, the number of valid data in the physical block or large block represented by the physical block information can be obtained. The recycling order during garbage collection can be determined based on the number of valid data in the physical block or large block.
[0120] FIG. 8A to FIG. 8D The changes of FTL table entries before and after processing NVMe commands according to an embodiment of the present application are shown.
[0121] See also Fig. 8A As shown, PPA8, identification A, attribute information 1, and Trim information are recorded in entry 6 of the FTL table. When a Data Set Management command is received, and the Data Set Management command indicates the LBA corresponding to entry 6, and attribute information 2, the Data Set Management command is processed in response, and the attribute information field of entry 6 is updated to attribute information 2, while PPA8, identification A, and Trim information in entry 6 remain unchanged.
[0122] See also Figure 8B As shown, PPA8, attribute information 1, and Trim information are recorded in entry 6 of the FTL table. When a Write Uncorrectable command is received, and the command indicates the LBA corresponding to entry 6, and the identification information is identification A, in response, the Write Uncorrectable command is processed, identification A is set in the identification information field of entry 6, and PPA8, attribute information 1, and Trim information in entry 6 remain unchanged.
[0123] See also Figure 8C As shown, PPA8, identification A, attribute information 1, and Trim(1) are recorded in entry 6 of the FTL table. When a de-allocation command is received and the command indicates the LBA corresponding to entry 6, in response to the de-allocation command, the Trim information field of entry 6 is updated to Trim(0), while PPA8, identification A, and attribute information 1 in entry 6 remain unchanged. Optionally, when processing the de-allocation command, PPA8 (including its physical block information) recorded in entry 6 is also cleared.
[0124] See also Fig.8D As shown, entry 6 of the FTL table records PPA8, identifier A, attribute information and Trim information. When a write command is received, and the command indicates the LBA corresponding to entry 6 and the cache unit index, the cache unit index is written to entry 6 in response to the write command, and the physical block information of the original PPA is kept intact, and the identifier A, attribute information and Trim information in entry 6 remain unchanged.
[0125] An embodiment of the present application also provides an information processing device, including a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, each process of the above-mentioned information processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0126] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application. Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An information processing method, characterized in that: include: receiving a host command sent by a host, wherein the host command complies with a storage protocol command format; According to a first LBA carried by the host command, setting relevant information indicated by the host command in an entry of an FTL table corresponding to the first LBA, wherein the entry of the FTL table is used to record a physical address corresponding to the LBA, and the relevant information does not include the physical address corresponding to the LBA; The host command includes at least one of a write uncorrectable command, a data set management command and a de-allocation command.
2. The method according to claim 1, characterized in that The step of setting the relevant information indicated by the host command in the entry corresponding to the first LBA in the FTL table includes: If the host command is a write uncorrectable command, setting identification information at a first designated position of a corresponding entry in the FTL table, the identification information being used to indicate that an uncorrectable error exists in the data corresponding to the first LBA; If the host command is a data set management command, setting the attribute information indicated by the data set management command at the second designated position of the corresponding entry of the FTL table; If the host command is a de-allocation command, Trim information is recorded at the third designated position of the corresponding entry in the FTL table, and the Trim information is used to indicate that the first LBA corresponding to the entry is de-allocated.
3. The method according to claim 2, characterized in that The method further comprises: In response to receiving the NVMe read command sent by the host, reading the entry corresponding to the LBA indicated by the NVMe read command; If identification information is recorded in the entry corresponding to the LBA indicated by the NVMe read command, feedback is given to the host that an uncorrectable error exists in the data to be read by the NVMe read command; If the identification information is not recorded in the entry corresponding to the LBA indicated by the NVMe read command, data is read from the NVM chip and sent to the host as a response to the NVMe read command according to the physical address recorded in the entry corresponding to the LBA indicated by the NVMe read command.
4. The method according to claim 2, characterized in that: The method further comprises: In response to receiving an NVMe write command sent by the host, allocating a physical address for the LBA indicated by the NVMe write command; Record the allocated physical address in the entry in the FTL table corresponding to the LBA indicated by the NVMe write command; Clear the identification information and Trim information in the entry corresponding to the LBA indicated by the NVMe write command.
5. The method according to any one of claims 2 to 4, characterized in that: The attribute information set in the corresponding entry of the FTL table indicates the attributes of the consecutive data blocks corresponding to the consecutive entries of the FTL table.
6. The method according to claim 5, characterized in that The method further comprises: In response to receiving an NVMe read command sent by the host, obtaining a first attribute value of a first entry corresponding to the LBA indicated by the NVMe read command; According to the first attribute value, detecting whether there is a first entry group corresponding to the first entry, the first entry group including N entries that are consecutive in entry order and correspond to the first attribute value, the N entries including the first entry, and the value of N is greater than or equal to 2; If the first entry group exists, determining the continuous data blocks corresponding to the first entry group; Reading data of the continuous data block and caching it to a first cache address; The physical address of each entry in the first entry group is updated to the first cache address while retaining the physical block information in the physical address of each entry in the first entry group.
7. The method according to claim 5, characterized in that The method further comprises: In response to receiving the NVMe write command sent by the host, obtaining a second attribute value of a second entry corresponding to the LBA indicated by the NVMe write command; According to the second attribute value, detecting whether there is a second entry group corresponding to the second entry, the second entry group including M entries that are consecutive in entry order and correspond to the second attribute value, the M entries including the second entry, and the value of M is greater than or equal to 2; If the second entry group exists, assigning continuous physical addresses, assigning physical addresses belonging to the same page stripe, or assigning physical addresses from multiple LUNs that are convenient for simultaneous writing and reading to the M entries in the second entry group; Writing the data to be written indicated by the NVMe write command to the allocated physical address; The corresponding physical addresses are recorded respectively in the M entries of the second entry group, and the attribute information in the M entries is kept unchanged.
8. The method according to any one of claims 2 to 7, characterized in that: The method further comprises: In response to receiving an NVMe write command sent by the host, allocating a cache for the NVMe write command; Write the data to be written corresponding to the NVMe write command into the cache, and record the third cache address corresponding to the cache in the entry corresponding to the LBA indicated by the NVMe write command; The physical address in the entry corresponding to the LBA indicated by the NVMe write command is cleared while retaining the physical block information in the physical address, and the identification information and / or attribute information in the entry corresponding to the LBA indicated by the NVMe write command is retained.
9. The method according to any one of claims 1 to 8, characterized in that: Each entry of the FTL table records physical block information, where the physical block information is a portion of bits of a physical address recorded in the entry; the method further includes: Count the number of occurrences of each physical block information from the FTL table; For each piece of physical block information, the VTC value of the physical block or large block corresponding to the physical block information is determined according to the number of occurrences of the physical block information.
10. An information processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
VTC accelerator and VTC calculation method thereof
CN115048320A