Method and device for realizing transparent compression using ZNS standard
By introducing the Zone concept into storage devices, transparent compression and decompression of data is achieved, which solves the problem of addressing complexity after data compression, improves storage density, and maintains the consistency of the host and storage device protocols.
Patent Information
- Application Number
- CN202011297534.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-18
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2040-11-18
AI Technical Summary
After data compression, the addressing and management complexity of existing storage devices increases, which affects the access efficiency of the host, and the protocol needs to be modified to support access to compressed data.
By introducing the concept of Zone, write and read data are transparently compressed and decompressed in the storage device, using existing write commands, append commands, and read commands to maintain the uncompressed data length and starting address to ensure that the host No need to be aware of the data compression and decompression process.
It improves the data storage density, reduces the complexity of the host's management of compressed data, maintains the protocol consistency between the host and the storage device, and achieves transparent access to compressed data.
Smart Images

Figure CN114546245B
Abstract
Description
Technical Field
[0001] The present application relates to a storage device, and more particularly to a method and a storage device thereof for providing transparent compression using ZNS (Zoned NameSpace, storage zone namespace). Background Art
[0002] Figure 1 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 solid-state storage device 102 through, for example, 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 (NVM Express), 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] Data is usually stored and read on a storage medium in pages. Data is erased in blocks. A block (also called a physical block) contains multiple pages. A page on a storage medium (called a physical page) has a specified size, such as 17664 bytes. A physical page can also have other sizes.
[0008] In a storage device, a Flash Translation Layer (FTL) is used to maintain mapping information from logical addresses to physical addresses. The FTL is implemented by software, firmware, and / or hardware as part of an ASIC, for example, running in a CPU of a control component.
[0009] Figure 2 This is a schematic diagram of FTL.
[0010] The storage device provides a logical address space to the host. The host uses the logical address to access the storage device. The FTL maps the logical address provided by the host to a physical address.
[0011] The logical address constitutes the storage space of the solid-state storage device perceived by the upper-layer software such as the operating system. The smallest unit addressable by the logical address is called, for example, a logical block (LogicalBlock) or a sector (sector) (for simplicity, unless otherwise specified, the use of logical blocks and sectors in the following text is interchangeable), and the logical address that addresses the logical block is also called a logical block address (LBA, LogicalBlockAddress). The logical block has a specified size, for example, 512B (bytes), 2KB, 4KB or 16KB, etc. The physical address is the address of the physical storage unit (for example, a physical page) of the NVM used to access the storage device. In the related art, address mapping can also be implemented using the intermediate address form. For example, the logical address is mapped to an intermediate address, and the intermediate address is further mapped to a physical address.
[0012] The table structure that stores the mapping information from logical addresses to physical addresses is called an FTL table. The FTL table is an important metadata in a storage device. Usually, the entries of the FTL table record the address mapping relationship in units of logical blocks in the storage device. Optionally, each entry of the FTL table represents multiple logical blocks to balance the size of the FTL table with the management granularity of the storage space, for example, 8 logical blocks with consecutive logical addresses.
[0013] The FTL table includes, for example, multiple FTL entries, each FTL entry corresponds to one or more consecutive logical blocks, and the value of the FTL entry records the address of the storage space provided for the one or more consecutive logical blocks (for clarity, the storage space is referred to as an NVM data frame, and the address of the storage space is referred to as an NVM data frame address).
[0014] The FTL table is stored in, for example, DRAM 110 (see also Figure 1 ) or SRAM. According to the accessed logical address, the index of the corresponding FTL entry is obtained, and the NVM data frame providing storage space for the logical block is obtained from the FTL entry.
[0015] The NVM data frame address is, for example, a physical address for accessing a physical page of an NVM chip, a physical address for accessing a plurality of combined physical pages of an NVM chip (a combined physical page is, for example, a physical page located on a plurality of planes of the same or different logical units (LUNs)), or a physical address for accessing a portion of a data unit within a physical page of an NVM chip.
[0016] The FTL of some storage devices is provided by the host coupled to the storage device, the host's memory stores the FTL table, and the host's CPU executes software to provide the FTL. Some storage management devices arranged between the host and the storage device provide the FTL.
[0017] Protocols such as NVMe (in https: / / nvmexpress.org / wp-content / uploads / NVM-Express- 1_4-2019.06.10-Ratified.pdf Available) defines how the host and storage device exchange data. The NVMe organization is also discussing Zone (storage area) and ZNS (Zoned NameSpace, storage area namespace) (available in https: / / nvmexpress.org / wp-content / uploads / NVM-Express-1.4-Ratified-TPs-1.zip A zone is a continuous range of logical block addresses (LBA) managed as a single unit, and a ZNS is a namespace that includes multiple zones. Some zones need to be written sequentially in the order of logical addresses. The host ensures that the IO commands provided to the zones meet the requirements.
[0018] Figure 3A This is a schematic diagram of Zone.
[0019] The storage device provides a logical address space (LBA range) of, for example, 1000GB. The logical address space includes multiple (n+1) zones, each of which occupies a logical address space corresponding to its number. The host can regard the zone as a storage object and access the specified logical address space of the storage device based on the zone number and the offset value within the zone. The size of the logical address space occupied by the zone is called the zone size. Figure 3A In the example, the Zone size is, for example, 512MB.
[0020] Continue to view Figure 3A Zone 0 includes storage space (or logical address range) (310, 320 and 340). Storage space 310 is the storage space that Zone 0 has been written to, and storage space 320 has not been written to data yet and can be written to data. However, due to reasons such as storage space alignment, the host may not write data to storage space 340. The maximum number of logical blocks that can be written to a Zone is called the Zone Capacity (ZoneCapacity), such as the size indicated by storage space 310 and storage space 320. Therefore, the Zone capacity is not greater than the Zone size. WP (WritePointer) indicates the starting position of the Zone's storage space 320.
[0021] When writing data to a zone, data is always written to a storage space of a specified size with a continuous address starting from the location indicated by WP.
[0022] Figure 3B-Figure 3D Shows a schematic diagram of writing data to a zone.
[0023] The host uses two commands (write command and append command) to write data to the Zone. Figure 3B shows the write command, Figure 3C Shows the append command.
[0024] The write command indicates writing data to the zone. The write command indicates the starting address of the written data, which should be consistent with the current WP. The data is written to the continuous logical address space of the zone starting from the position indicated by the current WP. Each zone is limited to only process one write command at a time. After a write command is processed, the next write command can be issued to the zone. Figure 3B , the square represents the logical address space of the Zone. The right direction is the positive direction. The leftmost end has the starting logical address of the Zone (recorded as Zone_sLBA). W0, W1 and W2 each represent a write command issued to the Zone. The write command W0 writes 4KB of data to the Zone. When the write command W0 is received, WP indicates the logical address Zone_sLBA of the Zone. After the write command W0 is processed, the 4KB logical address range of the Zone starting from the logical address 0 is written with data, and WP is updated to point to the logical address Zone_sLBA+4KB (WP0). Next, the write command W1 is received (the size of the data to be written is 8KB). After the write command W1 is processed, the 8KB logical address range of the Zone starting from the logical address Zone_sLBA+4KB is written with data, and WP is updated to point to the logical address Zone_sLBA+12KB (WP1). Next, a write command W2 is received (the size of the data to be written is 16KB). After the write command W2 is processed, data is written into the 16KB logical address range of Zone starting from the logical address Zone_sLBA+12KB, and WP is updated to point to the logical address Zone_sLBA+28KB (WP2).
[0025] The append command instructs to write data to the continuous logical address space of the Zone starting from the position indicated by the current WP. The number of append commands processed by each Zone at the same time is not limited. The host is allowed to send multiple append commands to the Zone at the same time, or send an append command to the Zone before the previous append command is processed. Figure 3C, three append commands (AP0, AP1 and AP2) are provided to the Zone concurrently. For example, the initial position indicated by WP is the starting logical address of the Zone (recorded as Zone_sLBA). When using the append command, the host does not care about the logical address where the data corresponding to the append command is written, so the specific value of the logical address where the data is written is not indicated in the append command. Instead, the storage device determines the logical address of the service append command according to the position of WP when processing the append command, and returns the determined logical address to the host after the append command is processed or submitted, so that the host knows the storage location of the data corresponding to the append command in the Zone, and the host can use the storage location to retrieve the written data. See . Figure 3C , the storage device receives three append commands (AP0, AP1 and AP2), and the storage device determines the processing order of the three append commands. As an example, the storage device decides to process the three append commands in the order of AP0, AP1 and AP2. How the storage device processes write commands and append commands internally is not the concern of this application. As an example, the storage device writes the data corresponding to the append command AP0 to the 4KB continuous logical address space starting at the logical address Zone_sLBA, writes the data corresponding to the append command AP1 to the 8KB continuous logical address space starting at the logical address Zone_sLBA+4KB, and writes the data corresponding to the append command AP2 to the 16KB continuous logical address space starting at the logical address Zone_sLBA+12KB.
[0026] Regardless of whether it is a write command or an append command, after processing or submitting it, the storage device returns the starting address of the logical address space carrying the data corresponding to the write command or the append command (recorded as sLBA) to the host. Figure 3D , records the distribution of the data corresponding to the three commands obtained by the host in the Zone after the three commands (write commands or append commands) are processed. As an example, the sector size of the Zone is 512B, and the starting address of the Zone is Zone_sLBA. The starting address of the logical address space occupied by the write command W0 (or the append command AP0) is Zone_sLBA+0 (in units of sectors), and the length is 8 (in units of sectors); the starting address of the logical address space occupied by the write command W1 (or the append command AP1) is Zone_sLBA+8, and the length is 16; the starting address of the logical address space occupied by the write command W2 (or the append command AP2) is Zone_sLBA+24, and the length is 32.
[0027] Optionally, the host records the starting address (recorded as sLBA) of the logical address space of the data corresponding to each write command / append command. Still optionally, the host also records the length of the data corresponding to each write command / append command (or the length of the logical address space storing the data). The data corresponding to the write command / append command is also referred to as an object as a whole, and its attributes include the starting address and length of the logical address space storing the object, so that the object can be obtained according to the attributes of the object.
[0028] To read data from a zone, the host sends a read command to the storage device, which indicates the starting address and length. The storage device reads the data of the specified length starting from the starting address and provides it to the host as a response to the read command. Summary of the invention
[0029] Data can be compressed. By compressing data, the data storage density of the storage device is increased. Therefore, it is desirable to provide a storage device with data compression capability. However, compression changes the size of the data, thereby introducing additional complexity to the addressing and management of the data. It is desirable to eliminate or minimize the impact of the complexity introduced by compression on the host, so that the host can access the storage device in an existing manner, while the storage device provides compression and / or decompression of the data, and the compression and / or decompression of the data by the storage device is transparent to the host. Thus, the host does not need to perceive that the data is compressed and / or decompressed inside the storage device, nor does it need to modify the protocol, but uses existing write commands, append commands, and / or read commands to access the storage device.
[0030] The introduction of Zone provides further support for achieving this purpose of the invention. In order to access the Zone, the host maintains the starting address (sLBA) and (uncompressed) length of the corresponding data (object) of the write command / append command, and uses the starting address (sLBA) and (uncompressed) length in the read command to read the object from the storage device. According to the storage device of the embodiment of the present application, the semantics of the write command, append command and / or read command provided to the host are not changed, but the object is compressed / decompressed internally, and the compressed data is stored on the NVM, which improves the data storage density without introducing additional complexity for accessing the compressed data to the host.
[0031] According to a first aspect of the present application, a first method for processing IO commands according to the first aspect of the present application is provided, including: obtaining a first command for writing data; allocating a first logical address index and a first size for the data to be written by the first command, the first logical address index and the first size defining a first logical address space, the first size being the size of the first logical address space, and the first size being able to accommodate uncompressed data to be written by the first command; compressing the data to be written by the first command to obtain compressed data; storing the compressed data in an NVM; and recording an address in the NVM storing the compressed data in association with the first logical address index.
[0032] According to the first method for processing IO commands in the first aspect of the present application, a second method for processing IO commands in the first aspect of the present application is provided, the method also including: sending a processing result of the first command, indicating the first logical address index in the processing result of the first command.
[0033] According to the first or second method for processing IO commands according to the first aspect of the present application, a second method for processing IO commands according to the third aspect of the present application is provided, wherein the first logical address index is generated according to a write pointer; the method also includes: updating the write pointer.
[0034] According to the third method for processing IO commands according to the first aspect of the present application, a fourth method for processing IO commands according to the first aspect of the present application is provided, wherein the write pointer is used as the first logical address index, and the write pointer is updated according to the compressed data size; or the key generated according to the write pointer is used as the first logical address index, and the write pointer is updated according to the compressed data size.
[0035] According to the third or fourth method for processing IO commands according to the first aspect of the present application, a fifth method for processing IO commands according to the first aspect of the present application is provided, wherein if the first command carries a first logical address for a first logical address space, and the first logical address is the same as the write pointer, the first logical address is used as the first logical address index; if the first logical address is different from the write pointer, the processing result of the first command is sent, and an error is indicated in the processing result of the first command.
[0036] According to one of the first to sixth methods of processing IO commands according to the first aspect of the present application, a sixth method of processing IO commands according to the first aspect of the present application is provided, wherein the compressed data includes one or more segments, the size of each segment can be accommodated in a sector, and each segment can be decompressed independently.
[0037] According to one of the first to seventh methods of processing IO commands according to the first aspect of the present application, a sixth method of processing IO commands according to the first aspect of the present application is provided, wherein the logical address index of the logical address space and the size of the logical address space are different dimensions that define the logical address space.
[0038] According to one of the third to seventh methods for processing IO commands in the first aspect of the present application, an eighth method for processing IO commands in the first aspect of the present application is provided, which also includes: obtaining a second command for writing data; allocating a second logical address index and a second size to the data to be written by the second command according to the updated write pointer, the second logical address index and the second size define a second logical address space, the second size is the size of the second logical address space, and the second size can accommodate the uncompressed data to be written by the second command; wherein the second logical address index is generated according to the updated write pointer; wherein even if the difference between the second logical address index and the first logical index is less than the first size, the second logical address space does not overlap with the first logical address space.
[0039] According to the eighth method for processing IO commands in the first aspect of the present application, a ninth method for processing IO commands in the first aspect of the present application is provided, which also includes: compressing the data to be written by the second command to obtain second compressed data; storing the second compressed data in the NVM; recording the address of the NVM storing the second compressed data in association with the second logical address index; and updating the write pointer according to the size of the second compressed data.
[0040] According to one of the first to ninth methods of processing IO commands according to the first aspect of the present application, a tenth method of processing IO commands according to the first aspect of the present application is provided, wherein the logical address index not associated with the NVM address is an invalid logical address index; and the logical index associated with the NVM address is a valid logical address index.
[0041] According to the tenth method for processing IO commands according to the first aspect of the present application, an eleventh method for processing IO commands according to the first aspect of the present application is provided, wherein the sum of the sizes of all logical address spaces defined by all valid logical address indexes of the storage area is accumulated to obtain the storage area capacity of the storage area.
[0042] According to the eleventh method for processing IO commands according to the first aspect of the present application, a twelfth method for processing IO commands according to the first aspect of the present application is provided, wherein the number of all available logical address indexes of the storage area is used as the storage area size of the storage area.
[0043] According to one of the tenth to twelfth methods for processing IO commands according to the first aspect of the present application, a thirteenth method for processing IO commands according to the first aspect of the present application is provided, which also includes: obtaining a third command for reading data, wherein the third command indicates a third logical address and a third length; if the third address is a valid logical address index, reading third compressed data from the NVM according to the third address; decompressing the third compressed data to obtain third decompressed data; and using a portion of the third data starting from the beginning that is equal to the third length as a processing result of the third command.
[0044] According to the thirteenth method for processing IO commands according to the first aspect of the present application, a fourteenth method for processing IO commands according to the first aspect of the present application is provided, which also includes: if the third address is not a valid logical address index, sending the processing result of the third command, and indicating that there is an error in the third command in the processing result of the third command.
[0045] According to the thirteenth or fourteenth method for processing IO commands according to the first aspect of the present application, there is provided a fifteenth method for processing IO commands according to the first aspect of the present application, which also includes: if the size of the third decompressed data is smaller than the third length, fourth compressed data on the NVM following the third compressed data is read out according to the address of the third compressed data at the NVM; decompressing the fourth compressed data to obtain fourth decompressed data; repeating the above process until the sum of the sizes of all the decompressed data read out is not smaller than the third length; and taking the part of all the decompressed data read out as a whole, starting from the beginning and equal to the third length, as the processing result of the third command.
[0046] According to one of the tenth to fifteenth methods for processing IO commands of the first aspect of the present application, a sixteenth method for processing IO commands according to the first aspect of the present application is provided, which also includes: obtaining a fourth command for reading data, wherein the fourth command indicates multiple logical addresses and multiple lengths corresponding to each of the multiple logical addresses; if the first logical address of the multiple logical addresses is a valid logical address index, reading compressed data from the NVM according to the first logical address, and decompressing it to obtain complete data of a fourth logical address space corresponding to the first logical address; according to the multiple logical addresses indicated by the fourth command and the multiple lengths corresponding to each of the multiple logical addresses, obtaining multiple segments of data from the complete data of the first logical address space as the processing result of the fourth command.
[0047] According to the second aspect of the present application, a first method for processing IO commands according to the second aspect of the present application is provided, including: obtaining a third command for reading data, wherein the third command indicates a third logical address and a third length; if the third address is a valid logical address index, reading third compressed data from the NVM according to the third address; decompressing the third compressed data to obtain third decompressed data; and using a portion of the third data starting from the beginning that is equal to the third length as a processing result of the third command.
[0048] According to the first method for processing IO commands according to the second aspect of the present application, a second method for processing IO commands according to the second aspect of the present application is provided, which also includes: if the third address is not a valid logical address index, sending the processing result of the third command, and indicating that there is an error in the third command in the processing result of the third command.
[0049] According to the first or second method for processing IO commands according to the second aspect of the present application, a third method for processing IO commands according to the second aspect of the present application is provided, wherein the length of the third compressed data read from the NVM according to the third address is obtained from the NVM according to the third address, or is determined according to the distance between the third address and the next valid logical address.
[0050] According to the first or second method for processing IO commands according to the second aspect of the present application, a fourth method for processing IO commands according to the second aspect of the present application is provided, which also includes: if the size of the third decompressed data is smaller than the third length, fourth compressed data after the third compressed data on the NVM is read out according to the address of the third compressed data on the NVM; decompressing the fourth compressed data to obtain fourth decompressed data; repeating the above process until the sum of the sizes of all the decompressed data read out is not smaller than the third length; and taking the part of all the decompressed data read out as a whole, starting from the beginning and equal to the third length, as the processing result of the third command.
[0051] According to one of the first to fourth methods of processing IO commands according to the second aspect of the present application, a fifth method of processing IO commands according to the second aspect of the present application is provided, which also includes: obtaining a fourth command for reading data, wherein the fourth command indicates multiple logical addresses and multiple lengths corresponding to each of the multiple logical addresses; if the first logical address of the multiple logical addresses is a valid logical address index, reading compressed data from the NVM according to the first logical address, and decompressing it to obtain complete data of a fourth logical address space corresponding to the first logical address; according to the multiple logical addresses indicated by the fourth command and the multiple lengths corresponding to each of the multiple logical addresses, obtaining multiple segments of data from the complete data of the first logical address space as the processing result of the fourth command.
[0052] According to one of the first to fifth methods for processing IO commands according to the second aspect of the present application, a sixth method for processing IO commands according to the second aspect of the present application is provided, which also includes: obtaining a fifth command for reading data, wherein the fourth command indicates a fifth logical address and a fifth length; if the fifth address is a valid logical address index, reading the fifth compressed data from the NVM according to the fifth address; decompressing the fifth compressed data to obtain the fifth decompressed data; if the length of the fifth decompressed data is less than the fifth length, also obtaining the next valid logical address index adjacent to the fifth address from the FTL table according to the fifth address, and reading the sixth compressed data from the NVM according to the next valid logical address index address; taking all the decompressed data read out as a whole and the part equal to the fifth length starting from the beginning as the processing result of the fifth command.
[0053] According to the sixth method for processing IO commands of the second aspect of the present application, a seventh method for processing IO commands according to the second aspect of the present application is provided, wherein if the sum of the length of the fifth decompressed data and the length of the fifth decompressed data is less than the fifth length, the next valid logical address index is further obtained, and the compressed data is read from the NVM according to the obtained valid logical address index address, and the sum of the lengths of all the decompressed data directly read out is not less than the fifth length.
[0054] According to one of the first to seventh methods of processing IO commands according to the second aspect of the present application, an eighth method of processing IO commands according to the second aspect of the present application is provided, which also includes: obtaining a first command for writing data; allocating a first logical address index and a first size to the data to be written by the first command, the first logical address index and the first size defining a first logical address space, the first size is the size of the first logical address space, and the first size can accommodate the uncompressed data to be written by the first command; compressing the data to be written by the first command to obtain compressed data; storing the compressed data in NVM; and recording the address of the compressed data stored in NVM in association with the first logical address index.
[0055] According to a third aspect of the present application, a first storage system according to the third aspect of the present application is provided, wherein the storage system comprises a host and a storage device; the host issues a command for writing data to the storage device; the storage device executes one of the methods for processing IO commands according to the first aspect of the present application to process the command for writing data; the host obtains the processing result of the command for writing data provided by the storage device, and records the logical address index indicated by the processing result of the command for writing data as the logical address corresponding to the command for writing data; and the host also records the data length corresponding to the command for writing data.
[0056] According to the first storage system of the third aspect of the present application, a second storage system according to the third aspect of the present application is provided, wherein the host issues a command for reading data to the storage device; the storage device executes a method described in one of the methods for processing IO commands according to the second aspect of the present application to process the command for reading data; and the host obtains the processing result of the command for reading data provided by the storage device.
[0057] According to the fourth aspect of the present application, an information processing device is provided, comprising a memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, one of the methods for processing IO commands provided in the first aspect or the second aspect of the present application is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0059] Figure 1 A block diagram of a storage device of the prior art is shown;
[0060] Figure 2 This is a schematic diagram of FTL;
[0061] Figure 3A It is a schematic diagram of Zone;
[0062] Figure 3B-Figure 3D Shows a schematic diagram of writing data to a Zone;
[0063] Figure 4A A schematic diagram of transparent compression provided according to an embodiment of the present application is shown;
[0064] Figure 4BA schematic diagram of address space mapping according to an embodiment of the present application is shown;
[0065] Figure 5A is a schematic diagram of a logical address space of the prior art;
[0066] Figure 5B is a schematic diagram of a logical address space according to an embodiment of the present application;
[0067] Fig. 6A A flowchart showing reading compressed data according to an embodiment of the present application is shown;
[0068] Figure 6B A flowchart showing reading compressed data according to another embodiment of the present application; and
[0069] Figure 7 A schematic diagram showing the Zone capacity of a compressed ZNS according to an embodiment of the present application is shown;
[0070] Figure 8 A schematic diagram of a storage device providing a hybrid NS according to an embodiment of the present application is shown;
[0071] Fig. 9 A schematic diagram of using a hybrid NS according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0072] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings 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 those skilled in the art without creative work are within the scope of protection of the present application.
[0073] Figure 4A A schematic diagram of transparent compression provided according to an embodiment of the present application is shown.
[0074] exist Figure 4A In the figure, two commands (CMD1 and CMD2) are taken as examples to show the process of storage devices compressing the data corresponding to the commands. Figure 4A Steps 410 to 418 shown on the left side of FIG. 4 are the method used to process two commands. Command CMD1 is to write 128KB of data (D1), and command CMD2 is to write 60KB of data (D2).
[0075] It can be understood that the command instructing to write data to the storage device includes, for example, a write command and an append command, and the write command indicates an address carrying the write data.
[0076] In response to receiving the command (CMD1 and CMD2) (410), the data to be written by the command is compressed (412). The data D1 of the command CMD1 is compressed to obtain compressed data (CD1), whose size is 16KB, and the data D2 of the command CMD2 is compressed to obtain compressed data (CD2), whose size is 4KB. It can be understood that the size of the compressed data may not be an integer multiple of the logical block size (for example, 3.7KB). In this case, the compressed data is aligned with the logical block size as the boundary (for example, the logical block size is 512 bytes, and 8 logical blocks are allocated for 3.7KB of compressed data). In one example, the data (for example, D1) corresponding to the command (for example, CMD1) is compressed as a whole, and the compressed data as a whole can be decompressed, while part of the compressed data cannot be decompressed. In another example, the data corresponding to the command (for example, D1) is compressed in segments to obtain one or more segments, the size of each segment can be accommodated in 1 sector, and each segment can be decompressed independently.
[0077] A logical address space (414) is allocated to the uncompressed data (D1 and D2) to accommodate the data. For a write command, the start address of the allocated logical address space is the address indicated in the write command. For an append command, the start address of the allocated logical address space is, for example, the start address of the currently writable logical address space, or for ZNS, is, for example, the logical address indicated by WP.
[0078] According to an embodiment of the present application, the starting address of the allocated logical address space is referred to as a logical address index. Only the logical address index will be used to index the FTL table. Other addresses of the allocated logical address space except the starting address are not used to index the FTL table. The allocated logical address space is defined by two dimensions: the logical address index and the size of the allocated logical address space. Only the logical address index is used to describe the starting address of the logical address space allocated for the data to be written by the command, and other logical addresses of the logical address space are not used to describe the starting address of the logical address space. The capacity of the logical address space allocated for the data to be written by the command is defined only by the dimension of the size of the allocated logical address space, so that the difference between the logical address indexes of the logical address spaces allocated for two adjacent commands does not represent the capacity of the logical address space allocated for the previous command.
[0079] According to an embodiment of the present application, the difference between the logical address indexes of the logical address spaces allocated to two adjacent commands represents the size of the compressed data corresponding to the previous command (aligned by the logical block size). It can be appreciated that according to an embodiment of the present application, the logical address space index corresponding to the next command needs to be known only after the compressed data size of the data to be written of a command is obtained.
[0080] For example, the starting address of the currently writable logical address space (or WP for ZNS, or the logical address indicated by CMD1 as a write command) is recorded as sLBA, and a logical address space with a length of 256 logical blocks (logical block size is 512B) starting from sLBA is allocated to CD1.
[0081] Generally, the size of the data (uncompressed) to be written by the command is recorded as DS, and the logical block size is recorded as SS. The length of the logical address range allocated for the uncompressed data to be written is (The DS / SS result is rounded up.) Therefore, according to the embodiment of the present application, what is distributed in the logical address space is the uncompressed write data, and the size occupied by the write data in the logical address space corresponds to the size of the uncompressed data.
[0082] The logical address allocated to CMD2 is recorded as sLBA2, sLBA2=sLBA+32, where 32 is the number of logical blocks occupied by the compressed data CD1 corresponding to CMD1. The logical address space allocated to CMD2 starts from sLBA+32 and has a length of 120 logical blocks.
[0083] For append commands, after allocating the logical address space, WP needs to be updated. Generally, the size of the data to be written by the command after compression is recorded as CS, and the logical block size is recorded as SS. The increment of WP after allocating the logical address space is (The CS / SS result is rounded up.) The increment of WP also represents the increment of the logical address index for the next command after the logical address space is allocated for the command.
[0084] Physical addresses for the NVM are also allocated for the compressed data (CD1 and CD2). The size of the allocated physical address range must be sufficient to accommodate the compressed data. For example, starting from the physical address indicated by sPBA in the NVM, a storage space of 16KB in length is allocated to store the compressed data CD1, and the next 4KB of storage space is allocated to store the compressed data CD2. Those skilled in the art will appreciate that the physical storage space for storing compressed data has other distribution methods, for example, located in different NVMs or different physical blocks. And the starting address of the allocated logical address range and the corresponding physical address are recorded in the FTL table.
[0085] The compressed data (CD1 and CD2) are written to the NVM indicated by the assigned physical address (416). The logical address index assigned in step 414 is also returned to the host (418) to inform the host of the logical address space assigned for the command (CMD1 or CMD2). The host can record these assigned logical address indexes to retrieve the corresponding data (D1 or D2) in the future using these assigned logical address indexes. The host is also informed that the command processing is completed.
[0086] It should be noted that according to an embodiment of the present application, data compression is transparent to the host. The host does not need additional processing to access the compressed data in the NVM. There is no need to modify the protocol used by the host to access the storage device. From the host's point of view, the data D1 corresponding to the command CMD1 is written to the logical address sLBA, and the data length is 128KB, while the data D2 corresponding to the command CMD2 is written to the logical address sLBA+32, and the data length is 60KB. The host reads out 128KB of data starting from the logical address sLBA, and will obtain data D1, while the host reads out 60KB of data starting from the logical address sLBA+32, and will obtain data D2.
[0087] Step 416 does not necessarily occur before step 418. The storage device may use a cache to record the data (CD1 and CD2) to be written to the NVM, and inform the host that the command (CMD1 and CMD2) processing is completed before the data CD1 and / or CD2 are written to the NVM. Optionally, the host provides an additional flush command to instruct the storage device to write the cached data (CD1 and CD2) to the NVM.
[0088] Figure 4B A schematic diagram of address space mapping according to an embodiment of the present application is shown.
[0089] See also Figure 4A After processing commands CMD1 and CMD2, the entry of the FTL table records the NVM address corresponding to the logical address index sLBA (i.e., sLBA+0) (the NVM address stores the compressed data CD1, which is 16KB in size), and the entry of the FTL table also records the NVM address corresponding to the logical address index sLBA+32 (the NVM address stores the compressed data CD2, which is 4KB in size). The entry of the FTL table also records the NVM address corresponding to the logical address index sLBA+40 (the NVM address stores the corresponding command CMD3 ( Figure 4B The compressed data CD2) is not shown in the figure.
[0090] Figure 4BThe physical address space indicates the data stored in the NVM, which is addressed by the physical address (i.e., the NVM address). Optionally, the NVM also provides additional storage space to accommodate metadata of the data, which metadata includes, for example, the logical address of the corresponding data, the length of the compressed data, and / or the length of the data before compression. According to the length of the compressed data, it is known, for example, starting from the NVM address recorded in the FTL table entry, how much data in the physical address range belongs to the compressed data obtained from the same data.
[0091] Figure 4B The logical address space indicates the data written or read by the host to the logical address index of the storage device. Data D1 occupies an address space range of 128KB in the logical address space, and data D2 occupies an address space range of 60KB in the logical address space. Data D1 in the logical address space corresponds to compressed data CD1 in the physical address space, data D2 in the logical address space corresponds to compressed data CD2 in the physical address space, and data D3 in the logical address space corresponds to compressed data CD3 in the physical address space. Thus, according to an embodiment of the present application, the data written by the user to the storage device occupies the logical address space with its original size, and occupies the physical address space with its compressed size.
[0092] It should be pointed out that according to an embodiment of the present application, the logical address space does not correspond one-to-one to the physical address space. The size of the logical address space exceeds the size of the physical address space. The logical address space allocated to the data corresponding to each command is defined by two dimensions: the logical address space index (the starting address of the logical address space) and the size of the logical address space. Only the logical address space index is used as an index of the FTL table, and other logical addresses of the logical address space cannot be used as indexes of the FTL table. Optionally, in some implementations, the position of the FTL table entry in the FTL table implies the logical address index corresponding to the entry, but some entries are not used or are not filled with valid NVM addresses because they do not have a corresponding logical address space index. For example, see Figure 4B , the FTL table entries corresponding to logical address indexes sLBA+1 to sLBA+31 are not used or are not filled with valid NVM addresses.
[0093] Figure 5A It is a schematic diagram of the logical address space of the prior art.
[0094] Figure 5B It is a schematic diagram of a logical address space according to an embodiment of the present application.
[0095] pass Figure 5A and Figure 5BThe comparison shows the distribution of the data written by each command in the logical address space of the prior art and the logical address space according to the embodiment of the present application after processing three commands (CMD1, CMD2 and CMD3). CMD1 indicates that the size of the written data (D1) is 128KB, CMD2 indicates that the size of the written data (D2) is 60KB, and CMD3 indicates that the size of the written data (D3) is 32KB. The three commands are processed in the order of CMD1, CMD2 and CMD3, and the starting addresses of the logical address spaces corresponding to the three commands are recorded as sLBA1, sLBA2 and sLBA3 respectively. The logical block size is 512B. The starting address of the overall logical address space is sLBA.
[0096] See also Figure 5A According to the prior art, the logical address space is a 1-dimensional space, and the distribution of data in the space is described by the logical address. The data corresponding to the command CMD1 occupies the range of logical addresses sLBA+0 to sLBA+255 (256 logical blocks) in the logical address space, and the starting address sLBA1=sLBA+0. The data corresponding to the command CMD2 occupies the range of logical addresses sLBA+256 to sLBA+315 (120 logical blocks) in the logical address space, and the starting address sLBA2=sLBA+256. The data corresponding to the command CMD3 occupies the range of logical addresses sLBA+316 to sLBA+379 (64 logical blocks) in the logical address space, and the starting address sLBA3=sLBA+316.
[0097] See also Figure 5B , for the same three commands (CMD1, CMD2 and CMD3), according to an embodiment of the present application, the logical address space is a two-dimensional space, and the logical address space that accommodates the data corresponding to each command is expressed by two dimensions, one dimension is the logical address index of the logical address space, and the other dimension is the size of the logical address space. Since the logical address index and the size of the logical address space are two (orthogonal) dimensions, these two dimensions are not additive, and the result of adding the numerical values of the two dimensions cannot be used for addressing the logical address space. The logical address space occupied by the data corresponding to the command CMD1 is represented by <logical address index sLBA+0, size 128KB>, and the logical address space occupied by the data corresponding to the command CMD2 is represented by <logical address index sLBA+32, size 60KB>. In the logical address space, the data corresponding to each command starts from the position described by the logical address index and extends in the direction described by the size dimension of the logical address space, rather than extending in the direction of the next element of the logical address index dimension.
[0098] According to an embodiment of the present application, the element values of the logical address index dimension of the logical address space do not need to be continuous. Figure 5BIn the example, the first element of the logical address index dimension of the logical address space is sLBA+0, the second element is sLBA+32, and the third element is sLBA+40. For other values such as sLBA+1 to sLBA+31, they are not elements of the logical address index dimension, do not have corresponding logical address space size dimensions, and cannot be used to read data.
[0099] In one embodiment, in the logical address index dimension of the logical address space, the numerical difference between adjacent elements (for example, 32=sLBA2-sLBA1) represents the number of logical blocks occupied by the data corresponding to the previous element in the pair of adjacent elements after compression (for example, 32 represents occupying 32 logical blocks). The numerical value of each element is the sum of the number of logical blocks occupied by the data corresponding to all elements before the element after compression. Thus, the value of the logical address index can be used to index the FTL table of the prior art, and the FTL of the prior art can be used to map the logical address index according to the embodiment of the present application to the physical address. The values not used by the logical address index (such as sLBA+1 to sLBA+31) cannot find the results in the FTL table, or are marked as corresponding to a specified value such as "null value".
[0100] In another embodiment, the value of the logical address index is not a numerical value but an index such as a "key", and the FTL obtains the corresponding physical address by mapping the "key" to the "value".
[0101] See again Figure 5A and Figure 5B In the respective charts, in both implementations, for the three commands after processing, the host records the logical address space start address (sLBA1, sLBA2 and sLBA3) and data length corresponding to each command (CMD1, CMD2 and CMD3). Therefore, in both implementations, the operation form implemented by the host is the same (only the value of the start address is different, and the value comes from the parameter returned by the storage device without the need for the host to calculate), so according to the embodiment of the present application, data compression is provided in a manner transparent to the host without requiring the host to introduce additional operations.
[0102] Fig. 6A A flowchart of reading compressed data according to an embodiment of the present application is shown.
[0103] The host sends a read command to the storage device to retrieve the data written to the storage device (610). The read command indicates, for example, two parameters, the starting address (denoted as sLBA) and the length of the data to be read. The starting address sLBA in the read command is the starting address of the logical address space for storing the written data, which is maintained by the host and received from the storage device for the write command previously issued by the host. According to an embodiment of the present application, the starting address returned by the storage device is a logical address index, and the host regards it as the starting address of the logical address space, so that the host does not need to change the processing method of the starting address in the prior art.
[0104] In response to receiving the read command, the storage device extracts the start address sLBA and the length from the read command, and checks whether the start address sLBA is a valid logical address index (615). For example, the obtained sLBA is identified as a valid logical address index by searching the FTL table. The valid logical address index is recorded in the FTL table. On the contrary, if there is no record in the FTL table, or the FTL table indicates that the physical address corresponding to the logical address index is a specified value such as a null value, it is identified that the obtained sLBA is not a valid logical address index. In response to sLBA not being a valid logical address index (615), the storage device indicates to the host that there is an error in the read command (618).
[0105] In response to the obtained sLBA being a valid logical address index (615), the compressed data stored in the NVM corresponding to the sLBA is obtained (620). For example, the FTL table is accessed according to the sLBA to obtain the corresponding physical address, and the NVM is accessed according to the physical address to read out the data, and the read data is compressed data. Optionally, in order to read out the data from the NVM, it is also necessary to obtain the length of the compressed data, because according to the embodiment of the present application, the physical address space corresponding to each entry of the FTL table has a variable size (see also Figure 4B , the size of compressed data CD1 is 16KB, and the size of compressed data CD2 is 4KB). In one example, length information is obtained from a specified position of the storage area indicated by the physical address (e.g., the front or out-of-band storage area), and the length information indicates the number of sectors of the compressed data to be read in the physical address space. It can be understood that when writing data to the NVM, the length information is also written to the NVM. In another example, the next valid logical address index (denoted as sLBA+a) after the logical address index sLBA obtained in step 610 is searched in the FTL table, and the difference (a) between the two logical address indexes corresponds to the number of sectors of the compressed data in the physical address space. For example, see also Figure 5B, the logical address index corresponding to CMD1 is sLBA1, and in the FTL table, the next valid logical address index after sLBA1 is sLBA2, and the difference 32 between sLBA2 and sLBA1 represents the number of sectors (32) in the physical address space after the data corresponding to CMD1 is compressed. In still another example, the compressed data of one or more sectors is read out according to the physical address corresponding to sLBA until it is recognized (for example, according to the end mark or the decompression is successful) that the compressed data corresponding to the uncompressed data has been read out completely. The compressed data obtained in step 620 is decompressed (625).
[0106] In still another example, the compressed data stored in the NVM is compressed in segments, and the compressed data of a sector is read out starting from the physical address corresponding to the sLBA, and the compressed data is decompressed (625), and the decompressed data is compared with the length obtained from the read command in step 610 to see if they are consistent. If the decompressed data is less than the length indicated by the read command, the next sector is read out from the next position of the physical address corresponding to the sLBA, and the compressed data in the sector is decompressed (625), and it is identified whether the accumulated decompressed data length reaches the length obtained from the read command. If it still does not reach the length of the data to be read indicated by the read command, the above process is repeated to read and decompress the compressed data from one or more other sectors (625), until the accumulated decompressed data reaches the length of the data to be read.
[0107] It should be noted that the length of data to be read by the read command (the length obtained in step 610, denoted as L) may be different from the length of data written by the previous write command. Figure 5B , the data length written by command CMD1 is 128KB, and the corresponding logical address index is sLBA1. The read command provided by the host may indicate the logical address sLBA1, but the length is, for example, 58KB. The length of the data to be read indicated in the read command is the length of the data starting from the starting address sLBA indicated by the read command. Therefore, in step 650, the decompressed data with a length of L (for example, 50KB) from the beginning is provided to the host as the processing result of the read command.
[0108] Some read commands provided by the host to the storage device have different formats. For example, the read command does not carry length information, but implies the length of the data to be read, such as each read command to read data with a fixed length. In other cases, the read command indicates that multiple non-contiguous copies of data are to be read. Figure 6B shows how such a read command is handled.
[0109] Figure 6B A flowchart of reading compressed data according to another embodiment of the present application is shown.
[0110] As an example, the read command 680 indicates to read 2KB of data from the logical address sLBA+0, 2KB of data from the logical address sLBA+5, and 3KB of data from the logical address sLBA+50. The size of each logical block is 512B, for example.
[0111] The FTL table records the logical address indexes (sLBA+0 and sLBA+32), and also records the physical addresses of the NVMs corresponding to the logical address indexes. The NVM stores the compressed data corresponding to the two logical address indexes (compressed data CD1 of 16KB and compressed data CD2 of 4KB). The pre-compression data corresponding to the compressed data CD1 is 128KB.<sLBA+0,128KB> Represented.
[0112] The read command 680 indicates three addresses to be read, which are respectively<sLBA+0,2KB> (682),<sLBA+5,2KB> (684) and<sLBA+50,3KB> (686). According to an embodiment of the present application, the first address among the multiple addresses to be read according to the read command 680<sLBA+0,2KB> (682), the address sLBA+0 indicated by it is used as a logical address index, and is used to access the FTL table to obtain the physical address of the compressed data CD1. The other addresses to be read by the read command 680 are not used as logical address indexes.
[0113] See also Figure 6B , read out the compressed data CD1, and decompress it to get the corresponding logical address space<sLBA+0,128KB> Data D1.
[0114] The multiple addresses to be read will be read using the read command 680<sLBA+0,2KB> (682),<sLBA+5,2KB> (684) and<sLBA+50,3KB> (686), linearly map the addresses to the logical address space of data D1 according to their relative positions and lengths relative to the starting address of data D1 in the logical address space<sLBA+0,128KB> The logical address space size dimension. For example, three addresses<sLBA+0,2KB> (682),<sLBA+5,2KB> (684) and<sLBA+50,3KB> (686) In the dimension of the logical address space size, the data in the range from 0 to 2KB, the data in the range from 2.5KB to 2KB, and the data in the range from 25KB to 3KB are respectively corresponded. The data in these ranges are obtained from the data D1 and provided to the host as the processing result of the read command 680.
[0115] Due to compression, the logical address space provided by the storage device is expanded.
[0116] When the host accesses the ZNS that complies with the NVMe protocol, each Zone provides the host with a logical address space that can be written sequentially, and the host maintains the starting address of the logical address space for each command returned by the ZNS. According to an embodiment of the present application, the host does not need to perform additional operations, and a ZNS with compression capability (referred to as compressed ZNS for short) is provided to the host in a manner that is transparent to the host. According to an embodiment of the present application, in order to provide a compressed ZNS, for example, Figure 4A and Figure 4B The method provided by the embodiment shown processes the command (write command or append command) provided by the host to the compressed ZNS, and uses the logical address index returned by the host as the starting address of the logical address space used for the command. The logical address space with a two-dimensional structure according to the embodiment of the present application is used as the logical address space of the Zone presented to the host. However, the host does not need to be aware that the logical address space provided according to the embodiment of the present application has two dimensions, but adopts a method such as the prior art of accessing a one-dimensional logical address space to retrieve the data written to the storage device using the starting address and the data length. From the host's point of view, see also Figure 5B , it writes data D1 to the logical address space of the storage device starting from sLBA+0 and with a length of 128KB, writes data D2 to the logical address space of the storage device starting from sLBA+32 and with a length of 60KB, and writes data D3 to the logical address space of the storage device starting from sLBA+40 and with a length of 32KB. Although, if the host calculates the difference between the starting addresses of the logical address spaces storing data D1 and D2, it will find that the two starting addresses are only 32 logical blocks apart, and it will be confused as to why 32 logical blocks can accommodate 128KB of data, but this does not affect the host's access to the data written to the ZNS of the storage device. And the host can know that the data in the ZNS is compressed.
[0117] Figure 7 A schematic diagram showing the Zone capacity of a compressed ZNS according to an embodiment of the present application is shown.
[0118] According to the NVMe protocol, ZNS has attributes including Zone size and Zone capacity. The value of Zone size represents the number of logical blocks in the Zone, while the value of Zone capacity represents the maximum number of logical blocks that can be used to write user data when the Zone is empty. Zone capacity is an important parameter for the host to manage Zones. For example, the host determines the timing of resetting or recycling the Zone, and / or the selection of the Zone to be recycled, based on the Zone capacity or the proportion of the amount of invalid data in the Zone in the Zone capacity. Zone capacity also affects the host's choice of strategy for managing the Zone.
[0119] According to an embodiment of the present application, the zone size provided by the storage device to the host is, for example, the number of available logical address indexes, and the zone capacity is the sum of the sizes of the logical address spaces allocated to each data after the zone is full (represented by, for example, the number of logical blocks). Since the data is compressed, the value of the zone capacity can exceed the zone size.
[0120] Figure 7 The number of logical address indexes available for a zone is m (respectively denoted as sLBA0, sLBA1, ... sLBA (m-1) ), where the logical address indexes (sLBA0, sLBA32 and sLBA40) are allocated logical address spaces for accommodating data (D1, D2 and D3) respectively. The zone size attribute value of the zone is m. Optionally, the available logical address indexes include unused logical address indexes. Figure 7 The number of logical address indices that can be used to index the FTL table for the Zone shown can be less than m, for example, Figure 7 In the example, the logical address index sLBA+1 cannot be used to index the FTL table, and it is not a valid logical address index.
[0121] As an example, a flat array is used to hold the FTL table of a ZNS. When creating a ZNS, by specifying the zone size m, it is determined that m elements are reserved in the FTL table for each zone of the created ZNS to hold the logical address index (corresponding to sLBA0, sLBA1, ... sLBA (m-1) ), these m elements are initialized to specified values or empty values to indicate that they are not yet valid logical address indexes.
[0122] In response to processing a command to write data to a zone of the ZNS, the physical address of the NVM containing the compressed data of the command is recorded in the FTL table element corresponding to the logical address index (denoted as sLBA_i) assigned to the command. The (uncompressed) size of the data to be written by the command (denoted as Di) is denoted as data_length(sLBA_i). The size of the compressed data (denoted as CDi) obtained after compressing the data Di is denoted as CSi, and the logical block size is denoted as SS. The next valid logical address index of the zone is From sLBA_i+1 to The logical address indexes in the range are not valid logical address indexes. For a non-valid logical address index (e.g., sLBA_j), the corresponding logical address space size is 0 (data_length(sLBA_j)=0). Therefore, the zone capacity of the zone is It is also equal to the number of sectors occupied by all user data written by the host to the zone. As data is written to the zone, its zone capacity increases accordingly until the zone is full, and its zone capacity reaches the maximum value and does not change until the zone is reset or recycled.
[0123] Since the Zone capacity is equal to the number of sectors occupied by all user data written by the host to the Zone, the elements of the Zone address space maintained by the host (e.g., sectors) correspond one-to-one to the logical blocks of the logical address space provided by the storage device for the Zone. The addresses that the host can use in the read command to access the Zone correspond one-to-one to the valid logical address index of the storage device for the Zone, and the valid logical address can be used to index the entries of the FTL table. The data compression rate of the Zone is obtained by dividing the Zone capacity by the Zone size, and the data compression rate of the Zone can be greater than 1.
[0124] Figure 8 A schematic diagram of a storage device providing a hybrid NS according to an embodiment of the present application is shown.
[0125] The NVMe protocol defines a namespace. A namespace can be considered a logical storage device. A storage device can provide multiple namespaces at the same time.
[0126] See also Figure 8 The storage device provides namespaces (NS0 and NS1). Namespace NS0 is a compressed ZNS according to an embodiment of the present application, and as an example, includes Zone0 and Zone1. Namespace NS1 is a namespace according to the prior art.
[0127] As an example, the FTL table is an array of flat structures, so the index of the FTL table entry is its storage location in memory. The FTL table provides m entries for Zone0 and Zone1 respectively. Therefore, the zone size of Zone0 and Zone1 is m. The FTL table provides n-2m-1 entries for NS1, each entry corresponds to a logical address space of, for example, 4KB, so the capacity of NS1 is 4K*(n-2m-1).
[0128] Zone0 and Zone1 are compressed, and the index of the FTL table entry for Zone0 or Zone1 is the logical address index for Zone0 or Zone1. Figure 8In Zone0, for example, the FTL table entries indexed by sLBA+0, sLBA+4, and sLBA+5 record valid NVM addresses, so sLBA+0, sLBA+4, and sLBA+5 are valid logical address indexes, while logical address indexes such as sLBA+1 to sLBA+3 are not valid. For Zone0, each entry in the FTL table corresponds to a physical storage space of, for example, 4KB in size. The physical address space corresponding to the sLBA+0 logical address index stores part of the compressed data CD1. Since the size of the compressed data CD1 is 16KB, it occupies four consecutive 4KB physical address spaces, which correspond to the four logical address indexes sLBA+0 to sLBA+3 (FTL table entries), and the compressed data CD1 is only indexed by the logical address index sLBA+0, which makes the logical address indexes sLBA+1 to sLBA+3 unavailable. These logical address indexes are marked as unavailable by setting null values or specified values in the FTL table entries corresponding to these indexes. Therefore, the host can only access the compressed data CD1 through the logical address index sLBA+0, but cannot access the compressed data CD1 through the logical address indexes sLBA+1 to sLBA+3.
[0129] Therefore, in ZNS, the size of the compressed data corresponding to the valid logical address index also determines the position of the next valid logical address index in the FTL table. Figure 8 In Zone0, the logical address index sLBA+0 indexes the 16KB compressed data CD1, so that the next valid logical address index is sLBA+4, which indexes the 4KB compressed data CD2, and the next valid logical address index is sLBA+5, which indexes the compressed data CD3.
[0130] In ZNS, compressed data is stored in the physical address space, while from the perspective of the host or user, uncompressed data is stored in the logical address space. The host obtains uncompressed data using the starting address and data length of the logical address space in a conventional manner. Therefore, although the stored data is compressed in NS0, the host does not need additional adjustments to access the compressed data, so the ZNS according to the embodiment of the present application is transparent to the host. The logical space corresponding to the compressed data CD1 accommodates data D1 (size is 128KB). The logical space corresponding to the compressed data CD2 accommodates data D2 (size is 60KB). The logical space corresponding to the compressed data CD3 accommodates data D3.
[0131] In comparison, the physical address space and logical address space of namespace NS1 correspond one-to-one, and the 4KB area of the physical address space corresponds to the 4KB area of the logical address space. The logical address space of namespace NS1 is defined by the logical address range, that is, by the index of the FTL table entry, so that the logical address space of namespace NS1 extends from sLBA+2m to sLBA+n. Users who access the logical address space of namespace NS1 (for example, sLBA+2m to sLBA+n) will obtain the data of the logical address space corresponding to each entry of the FTL table indexed by the logical address sLBA+2m to sLBA+n. The logical address space of NS0 does not extend from the logical address sLBA0 to sLBA+2m-1, but is a combination of the logical address spaces corresponding to all valid logical address indexes from sLBA+0 to sLBA+2m-1. Thus, when a user accesses the logical address space of namespace NS0 (for example, sLBA0 to sLBA+2m-1), the user will obtain the logical address space that accommodates data D1, the logical address space that accommodates data D2, the logical address space that accommodates data D3, and the logical address space corresponding to the last valid logical address index from sLBA+0 to sLBA+2m-1. Thus, as an example, if the capacity of namespace NS0 is C0, if the host issues a read command indicating the starting address sLBA0 and the size C0, when processing the command, data D1 will be read out starting from sLBA+0 as the logical address index, and then the next valid logical address index (sLBA+4) will be obtained from the entry for NS0 in the FTL table, and the data D2 corresponding to the valid logical address will be obtained, and so on, until the last valid logical address index in the entry for NS0 in the FTL table is obtained, and the corresponding data is obtained, and the sum of the lengths of all these data is C0. It can be understood that after obtaining data D1 or compressed data CD1 according to the effective logical address index sLBA+0, the position of the next effective logical address index in the FTL table can be determined according to the size of the compressed data CD1 (the position of the next effective logical address index is incremented by 100 relative to the position of the current effective logical address index). CS1 is the size of the compressed data CD1, and SS is the logical block size. Optionally, the FTL table is traversed starting from the current valid logical address index (eg, sLBA+0), and the valid logical address index can also be identified according to the value of the FTL table entry.
[0132] Thus, according to an embodiment of the present application, the storage device provides multiple namespaces with different attributes at the same time, for example, namespace NS0 has high storage capacity or high density (due to data compression) (relative to NS1), while namespace NS1 has high performance and better QoS (Quality of Service) (relative to NS0). Users can record data in different namespaces according to their needs.
[0133] Fig. 9 A schematic diagram of using a hybrid NS according to an embodiment of the present application is shown.
[0134] The creation, use, and recycling of Zones require host management, and the host also needs to ensure that data written to the Zone is written in address order, because the Zone does not support random writing. However, some scenarios or data themselves require random writing, for example, Zone capacity. Zone capacity is metadata that describes the Zone. In the process of writing data to the Zone according to the embodiment of the present application, the Zone capacity may change as the data is written. Using random writing can better update metadata such as Zone capacity.
[0135] See also Fig. 9 The namespace NS0 provided by the storage device is a compressed ZNS. The host creates and uses a zone in the namespace NS (remembered as host Zone0). The namespace NS1 of the storage device is a namespace that supports random writes. The host records the metadata for host Zone0 in the namespace NS1. This fully utilizes the high storage density of namespace NS0 and the better performance of namespace NS1.
[0136] See also Fig. 9 According to an embodiment of the present application, host Zone 0 is also provided. Host Zone 0 is also compressed. As an example, host Zone 0 managed by the host is mapped to two zones (Zone 0 and Zone 1) of the storage device. Depending on the requirements of the application, the desired zone capacity of the host may be different from the zone capacity provided by the storage device. The host can combine two or more zones of the storage device into a single host zone. When a single host zone is created or recycled, the zones of all storage devices that provide the host zone are created or recycled together. In order to provide host zones, the host also manages the mapping of host zones to storage device zones. Fig. 9In the example, the logical address index range used by the host Zone0 is all the available logical address indexes of the storage devices Zone0 and Zone1 (sLBA+0 to sLBA+2m-1), so that according to the logical address index of the host Zone0 being accessed, it is determined which Zone of the storage device provides the logical address index, and the Zone of the storage device is accessed using the logical address index according to the aforementioned embodiment of the present application.
[0137] 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. A method for processing IO commands, characterized in that: include: Obtaining a first command for writing data; Allocating a first logical address index and a first size to the data to be written by the first command, wherein the first logical address index and the first size define a first logical address space, and the first size is the size of the first logical address space, and the first size can accommodate the uncompressed data to be written by the first command; compressing the data to be written by the first command to obtain compressed data; Storing the compressed data in NVM; as well as recording an address in the NVM storing the compressed data in association with the first logical address index; wherein the compressed data is written to the NVM indicated by the assigned physical address; the data written to the NVM occupies the logical address space with its original size and occupies the physical address space with its compressed size; The allocated logical address index is returned to the host to inform the host of the logical address space allocated for the command, where the logical address space is defined by two dimensions: the logical address space index and the size of the logical address space.
2. The method according to claim 1, wherein: The method further includes: sending a processing result of the first command, and indicating the first logical address index in the processing result of the first command.
3. The method according to claim 1, wherein the first logical address index is generated according to a write pointer; The method further comprises: The write pointer is updated.
4. The method according to claim 3, wherein Using the write pointer as the first logical address index, and updating the write pointer according to the compressed data size; or A key generated according to the write pointer is used as the first logical address index, and the write pointer is updated according to the compressed data size.
5. The method according to claim 3 or 4, wherein: If the first command carries a first logical address for a first logical address space, and the first logical address is the same as the write pointer, the first logical address is used as the first logical address index; if the first logical address is different from the write pointer, the processing result of the first command is sent, and an error is indicated in the processing result of the first command.
6. The method according to claim 5, wherein: The compressed data includes one or more segments, each segment is sized to fit into a sector, and each segment can be decompressed independently.
7. The method according to claim 3 or 4, further comprising: Obtaining a second command for writing data; According to the updated write pointer, a second logical address index and a second size are allocated to the data to be written by the second command, the second logical address index and the second size define a second logical address space, the second size is the size of the second logical address space, and the second size can accommodate the uncompressed data to be written by the second command; wherein the second logical address index is generated according to the updated write pointer; wherein even if the difference between the second logical address index and the first logical index is smaller than the first size, the second logical address space does not overlap with the first logical address space.
8. The method according to claim 7, further comprising: compressing the data to be written by the second command to obtain second compressed data; storing the second compressed data in the NVM; recording an address in the NVM storing the second compressed data in association with the second logical address index; as well as The write pointer is updated according to the size of the second compressed data.
9. The method according to claim 8, wherein A logical address index that is not associated with an NVM address is an invalid logical address index; and The logical index associated with the NVM address is a valid logical address index; And the sum of the sizes of all logical address spaces defined by all valid logical address indexes of the storage area is accumulated to obtain the storage area capacity of the storage area.
10. The method according to claim 9, wherein: The number of all available logical address indexes of the storage area is used as the storage area size of the storage area.
11. The method according to claim 9, wherein: Also includes: Obtaining a third command for reading data, wherein the third command indicates a third logical address and a third length; If the third address is a valid logical address index, reading the third compressed data from the NVM according to the third address; Decompressing the third compressed data to obtain third decompressed data; The portion of the third data starting from the beginning and equal to the third length is taken as the processing result of the third command.
12. The method according to claim 11, wherein: Also includes: If the third address is not a valid logical address index, a processing result of the third command is sent, and an error is indicated in the processing result of the third command.
13. The method according to claim 12, wherein: Also includes: If the size of the third decompressed data is smaller than the third length, further reading fourth compressed data on the NVM following the third compressed data according to the address of the third compressed data on the NVM; decompressing the fourth compressed data to obtain fourth decompressed data; Repeat the above process until the sum of the sizes of all the decompressed data read out is not less than the third length; The portion of all the decompressed data read out as a whole and equal to the third length starting from the beginning is taken as the processing result of the third command.
14. The method according to claim 13, wherein: Also includes: acquiring a fourth command for reading data, wherein the fourth command indicates a plurality of logical addresses and a plurality of lengths corresponding to each of the plurality of logical addresses; If a first logical address of the plurality of logical addresses is a valid logical address index, reading compressed data from the NVM according to the first logical address, and decompressing the data to obtain complete data of a fourth logical address space corresponding to the first logical address; According to the multiple logical addresses indicated by the fourth command and the multiple lengths corresponding to each of the multiple logical addresses, multiple segments of data are obtained from the complete data of the first logical address space as the processing result of the fourth command.
15. A method for processing IO commands, characterized in that: include: Obtaining a third command for reading data, wherein the third command indicates a third logical address and a third length; If the third address is a valid logical address index, reading the third compressed data from the NVM according to the third address; Decompressing the third compressed data to obtain third decompressed data; taking a portion of the third data starting from the beginning and equal to the third length as a processing result of the third command; wherein the compressed data is written to the NVM indicated by the assigned physical address; the data written to the NVM occupies the logical address space with its original size and occupies the physical address space with its compressed size; The allocated logical address index is returned to the host to inform the host of the logical address space allocated for the command, where the logical address space is defined by two dimensions: the logical address space index and the size of the logical address space.
16. The method for processing IO commands according to claim 15, wherein: The method further includes: if the third address is not a valid logical address index, sending a processing result of the third command, and indicating in the processing result of the third command that an error exists in the third command.
17. The method for processing IO commands according to claim 15 or 16, wherein: The length of the third compressed data read from the NVM according to the third address is obtained from the NVM according to the third address, or is determined according to the distance between the third address and the next valid logical address.
18. The method for processing IO commands according to claim 15 or 16, wherein: Also includes: If the size of the third decompressed data is smaller than the third length, further reading fourth compressed data on the NVM following the third compressed data according to the address of the third compressed data on the NVM; decompressing the fourth compressed data to obtain fourth decompressed data; Repeat the above process until the sum of the sizes of all the decompressed data read out is not less than the third length; The portion of all the decompressed data read out as a whole and equal to the third length starting from the beginning is taken as the processing result of the third command.
19. The method for processing IO commands according to claim 18, wherein: Also includes: acquiring a fourth command for reading data, wherein the fourth command indicates a plurality of logical addresses and a plurality of lengths corresponding to each of the plurality of logical addresses; If a first logical address of the plurality of logical addresses is a valid logical address index, reading compressed data from the NVM according to the first logical address, and decompressing the data to obtain complete data of a fourth logical address space corresponding to the first logical address; According to the multiple logical addresses indicated by the fourth command and the multiple lengths corresponding to each of the multiple logical addresses, multiple segments of data are obtained from the complete data of the first logical address as the processing result of the fourth command.
20. The method for processing IO commands according to claim 19, wherein: Also includes: Obtaining a fifth command for reading data, wherein the fourth command indicates a fifth logical address and a fifth length; If the fifth address is a valid logical address index, reading the fifth compressed data from the NVM according to the fifth address; decompressing the fifth compressed data to obtain fifth decompressed data; If the length of the fifth decompressed data is less than the fifth length, the next valid logical address index adjacent to the fifth address is obtained from the FTL table according to the fifth address, and the sixth compressed data is read from the NVM according to the next valid logical address index address; all the decompressed data read out are taken as a whole and the part equal to the fifth length starting from the beginning is taken as the processing result of the fifth command.
21. The method for processing IO commands according to claim 20, wherein: If the sum of the length of the fifth decompressed data and the length of the fifth decompressed data is less than the fifth length, continue to obtain the next valid logical address index, read the compressed data from the NVM according to the obtained valid logical address index address, and the sum of the lengths of all the decompressed data directly read out is not less than the fifth length.
22. The method for processing IO commands according to claim 20, wherein: Also includes: Obtaining a first command for writing data; Allocating a first logical address index and a first size to the data to be written by the first command, wherein the first logical address index and the first size define a first logical address space, and the first size is the size of the first logical address space, and the first size can accommodate the uncompressed data to be written by the first command; compressing the data to be written by the first command to obtain compressed data; Storing the compressed data in NVM; And the address of the NVM storing the compressed data is recorded in association with the first logical address index.
23. A storage system, characterized in that: Wherein the storage system comprises a host and a storage device; The host sends a command for writing data to the storage device; The storage device executes the method according to any one of claims 1 to 22 to process the command for writing data; The host obtains a processing result of the command for writing data provided by the storage device, and records a logical address index indicated by the processing result of the command for writing data as a logical address corresponding to the command for writing data; and The recording host also records the data length corresponding to the command for writing data.
24. The storage system according to claim 23, wherein: The host sends a command for reading data to the storage device; The storage device executes the method according to any one of claims 1 to 22 to process the command for reading data; The host obtains a processing result of the command for reading data provided by the storage device.
25. 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 22 is implemented.
