ECC (Error Correction Code) method in storage equipment
By dividing it into transparent compressed area and small data block access area in a solid state hard disk, and optimizing data block mapping is used to optimize data block mapping, which solves the read, write, amplification and performance problems of SSD small data block access, and achieves more efficient hard disk access and lower power consumption.
Patent Information
- Application Number
- CN202410950424.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-11-12
AI Technical Summary
When handling small data block access, existing solid-state drives (SSDs) need to perform a large number of read-replacement-write operations, resulting in performance and power consumption problems. The read-write amplification problems caused by mismatched unit particle sizes are difficult to effectively solve. .
The storage device is divided into a general transparent compression area and a dedicated small data block access area. The data block mapping is optimized through compression and ECC encoding, and the smaller address mapping granularity and truncated ECC codewords are used to reduce read, write amplification and compression /Decompression power consumption to improve access efficiency of small data blocks.
Through transparent compression and ECC coding optimization, the utilization of physical space is maximized, read and write amplification problems are reduced, compression/decompression power consumption is reduced, small data block access performance is improved, and physical storage space is avoided.
Smart Images

Figure CN118939468A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electrostatic memory, and in particular to an ECC method in a storage device. Background Art
[0002] Solid-state drives (SSDs) have gradually become the main medium for data storage in individuals, enterprises and data centers. Compared with traditional mechanical disks (HDDs), they have greatly alleviated the pressure on the storage end and released the performance potential of the overall system. In recent years, transparent compression solutions have also begun to be used in solid-state drives. By integrating data compression functions in hard disks, the data occupancy of physical storage space is further reduced.
[0003] The main storage medium of SSD is NAND. Normally, the data blocks written to NAND generally correspond to one or more logical block addresses (LBAs). Each logical block address corresponds to a fixed size, such as 512B or 4KB. The size of LBA is specified by the host when formatting the SSD. Since NAND cannot be updated in situ, the mapping between its LBA and physical block address (PBA) is not fixed after the data is written to NAND. Therefore, a flash translation layer (FTL) is required in the SSD to record and maintain the mapping relationship between LBA and PBA.
[0004] In the current SSD design, the mapping of LBA and PBA generally adopts a fixed-size mapping unit, such as 4KB. In order to maximize the performance of the SSD, the mapping table is generally stored in the DDR inside the SSD. When the size of the LBA is smaller than the size of the mapping unit and the write request from the host is non-aligned (that is, the initial LBA or the ending LBA of the write request is not aligned with the mapping unit), a read-modify-write (RMW) operation needs to be performed inside the SSD to solve the mismatch between the LBA and the mapping unit. For example, when the LBA size is 512B and the mapping unit size is 4KB, if the host performs a 512B write operation, the SSD needs to first search the mapping table for the 4KB PBA corresponding to the LBA where the 512B data is located, then read the 4KB data from the PBA, and use the 512B data written by the host to replace the 512B data at the original corresponding position, and finally write the entire 4KB data to the NAND and update the mapping table.
[0005] In some actual scenarios, most of the read and write accesses of applications to SSDs are small data blocks, such as 200B or 400B. Since SSDs use larger mapping units, such as 4KB, a large number of read, modify and write operations are involved, which reduces the performance of the SSD and applications. Therefore, a method is needed to solve the performance problem of small data block access, which is to use mapping units of different granularities in different partitions of the hard disk, so that the granularity of the mapping unit is as close as possible to the granularity of the host accessing the data, so as to solve the read and write amplification problem caused by small data block access in the existing solution and the performance and power consumption problems caused by it. Summary of the invention
[0006] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art and to provide an ECC method in a storage device, which can solve the read-write amplification problem caused by small data block access in the existing solution and the performance and power consumption problems caused thereby.
[0007] To achieve the above object, the present invention provides the following technical solution: an ECC method in a storage device, comprising the following steps:
[0008] Step 1: The interior of the SSD is divided into a general transparent compression area and a dedicated small data block access area;
[0009] Step 2: In the general transparent compression area, the compression engine in the SSD first compresses the data blocks from the host to obtain compressed data blocks. After the compressed data blocks are closely arranged, the ECC encoding engine encodes them according to the preset default code length and writes them to the storage medium, thereby maximizing the physical space utilization of the hard disk;
[0010] Step 3: In the small data block access area, use a smaller address mapping granularity and save truncated ECC codewords to reduce the read / write amplification problem during hard disk access and the power consumption of compression / decompression;
[0011] Step 4: For the read operation of the general transparent compression area, the SSD first determines the PBA corresponding to the LBA contained in the read command according to the address mapping table, and then reads the corresponding data block from the NAND according to the PBA; after ECC decoding, the corresponding compressed data block is intercepted from the decoded data and decompressed, and finally the decompressed data is returned;
[0012] Step 5: For the read operation of the small data block access area, the SSD first determines the PBA corresponding to the LBA contained in the read command and the length of the 0 at the end of the original data according to the address mapping table, and then reads the corresponding data block from the NAND according to the PBA (that is, truncates the ECC codeword) and appends the 0 at the end of the original data to obtain a complete ECC codeword; finally, after ECC decoding, the decoded data is returned.
[0013] Preferably, in step 1, it can be known that the SSD contains a dedicated small data block access area and a general transparent compression area;
[0014] The general transparent compression area adopts an address mapping unit of 4KB, while the dedicated small data block access area adopts an address mapping unit smaller than 4KB.
[0015] Preferably, in step 2, the data block corresponding to each LBA is compressed by the compression engine to obtain a corresponding compressed data block; after the compressed data blocks are closely arranged, the ECC encoding engine encodes them according to a preset code length;
[0016] Among them, the length of each ECC codeword after encoding is the same (the length of the check data is also the same); each ECC codeword may contain different numbers of compressed data blocks depending on the compression ratio of the LBA data block. For example, the first ECC codeword in the figure contains complete compressed data blocks corresponding to LBA0 and LBA1, and contains part of the compressed data block corresponding to LBA2.
[0017] Preferably, in step 3, it can be seen that the host side performs an alignment operation on the small data blocks to be written, that is, by padding with 0, the small data blocks are aligned according to the address mapping granularity of the small data block access area, and then a write command is issued; Figure 3 It can be seen that the data block originally written by the host is a small data block, that is, the length is less than the size of an LBA. At this time, the host directly aligns the size of the small data block and the LBA by padding 0;
[0018] The ECC encoding engine in the SSD encodes the data block corresponding to the write command according to the preset code length corresponding to the small data block; Figure 3 It can be seen that the ECC encoding engine encodes the written data block according to the LBA size (the LBA size is usually the size of the address mapping granularity. In the small data block access area, the LBA size can be 512B, 1KB or 2KB, etc.) to obtain a smaller (relative to the transparent compression area) complete ECC code word.
[0019] Preferably, in step 3, it can be seen that in the encoded ECC codeword, the trailing 0 in the original data is truncated to obtain a truncated ECC codeword;
[0020] Write the truncated ECC code words into NAND in close sequence;
[0021] The address mapping table is updated according to the actual physical address occupied by the truncated ECC codeword (including the offset and length in the NAND physical page) and the length of the trailing 0 in the original data.
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] 1. The ECC method in the storage device uses a larger ECC codeword length in the transparent compression area. After the data block is compressed and closely arranged by the compression engine, it is encoded by the ECC encoding engine, thereby maximizing the physical space utilization of the hard disk; the small data block access area uses a smaller ECC codeword length, and by saving truncated ECC codewords, efficient access to small data blocks is achieved, thereby reducing the read-write amplification problem during hard disk access and avoiding the power consumption problem caused by the compression / decompression engine.
[0024] 2. The ECC method in the storage device uses truncated ECC code words to store data blocks, thereby eliminating the compression / decompression steps (and the power consumption required for compression / decompression), and also minimizes the occupation of physical storage space by truncating the operation of 0; at the same time, by using smaller ECC code words, the reading and writing of small data blocks can be limited to the corresponding single ECC code word, reducing the data read and write amplification problem in common implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The present invention is further described below in conjunction with the accompanying drawings and embodiments:
[0026] Figure 1 It is a schematic diagram of the overall logical space of the present invention;
[0027] Figure 2 A schematic diagram of writing data into a transparent compression area according to the present invention;
[0028] Figure 3 A schematic diagram of writing data into a data block access area according to the present invention;
[0029] Figure 4 A schematic diagram of the process of writing data in a small data block access area according to the present invention;
[0030] Figure 5 It is a schematic diagram of the process of reading data in the transparent compression area of the present invention. Figure 6 It is a schematic diagram of the flow of reading data in the small data block access area of the present invention. DETAILED DESCRIPTION
[0031] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.
[0032] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0033] In the description of the present invention, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0034] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0035] The present invention provides a technical solution: an ECC method in a storage device: comprising the following steps:
[0036] Step 1: The SSD is divided into a general transparent compression area and a dedicated small data block access area;
[0037] The general transparent compression area adopts an address mapping unit of 4KB, while the dedicated small data block access area adopts an address mapping unit smaller than 4KB.
[0038] pass Figure 1 It can be seen that the figure indicates two dedicated small data block access areas and one general transparent compression area, where partition 0 corresponds to the small data block access area and uses a 512B address mapping unit, partition 1 corresponds to the small data block access area and uses a 1KB address mapping unit, and partition N corresponds to the transparent compression area and uses a 4KB address mapping unit;
[0039] Step 2: In the general transparent compression area, the compression engine in the SSD first compresses the data blocks from the host to obtain compressed data blocks. After the compressed data blocks are closely arranged, the ECC encoding engine encodes them according to the preset default code length and writes them to the storage medium, thereby maximizing the physical space utilization of the hard disk;
[0040] pass Figure 2 It can be seen that the data block corresponding to each LBA is compressed by the compression engine to obtain the corresponding compressed data block; after the compressed data blocks are closely arranged, they are encoded by the ECC encoding engine according to the preset code length;
[0041] Among them, the length of each ECC codeword after encoding is the same (the length of the check data is also the same); each ECC codeword may contain different numbers of compressed data blocks depending on the compression ratio of the LBA data block. For example, the first ECC codeword in the figure contains complete compressed data blocks corresponding to LBA0 and LBA1, and contains part of the compressed data block corresponding to LBA2.
[0042] Step 3: In the small data block access area, a smaller address mapping granularity is used, and by saving truncated ECC codewords, the read-write amplification problem during hard disk access and the power consumption of compression / decompression are reduced. Specifically, the following features are included:
[0043] a. The host aligns the small data blocks to be written, that is, by padding with 0, aligning the small data blocks according to the address mapping granularity of the small data block access area, and then issues a write command; Figure 3 It can be seen that the data block originally written by the host is a small data block, that is, the length is less than the size of an LBA. At this time, the host directly aligns the size of the small data block and the LBA by padding 0.
[0044] b. The ECC encoding engine in the SSD encodes the data block corresponding to the write command according to the preset code length corresponding to the small data block; Figure 3 It can be seen that the ECC encoding engine encodes the written data block according to the LBA size (the LBA size is usually the size of the address mapping granularity. In the small data block access area, the LBA size can be 512B, 1KB or 2KB, etc.) to obtain a smaller (relative to the transparent compression area) complete ECC code word.
[0045] c. In the encoded ECC codeword, the trailing 0 in the original data is truncated to obtain a truncated ECC codeword;
[0046] d. Write the truncated ECC codewords into NAND in close sequence;
[0047] e. Update the address mapping table based on the actual physical address occupied by the truncated ECC codeword (including the offset and length in the NAND physical page) and the length of the trailing 0 in the original data;
[0048] pass Figure 4 It can be seen that by using truncated ECC code words to store data blocks, the compression / decompression steps (and the power consumption required for compression / decompression) are omitted, and the occupation of physical storage space is minimized by truncating 0 operations; at the same time, by using smaller ECC code words, the reading and writing of small data blocks can be limited to the corresponding single ECC code word, reducing the data read and write amplification problem in common implementations.
[0049] Step 4: Pass Figure 5 It can be seen that for the read operation of the general transparent compression area, the SSD first determines the PBA corresponding to the LBA contained in the read command according to the address mapping table, and then reads the corresponding data block from the NAND according to the PBA; after ECC decoding, the corresponding compressed data block is intercepted from the decoded data and decompressed, and finally the decompressed data is returned.
[0050] Step 5: Pass Figure 6 It can be seen that for the read operation of the small data block access area, the SSD first determines the PBA corresponding to the LBA contained in the read command and the length of the 0 at the end of the original data according to the address mapping table, and then reads the corresponding data block from the NAND according to the PBA (that is, truncates the ECC codeword) and appends the 0 at the end of the original data to obtain a complete ECC codeword; finally, after ECC decoding, the decoded data is returned.
[0051] In this method, the interior of the SSD is divided into a general transparent compression area and a dedicated small data block access area; the transparent compression area uses a larger ECC codeword length, and the data blocks are compressed and closely arranged by the compression engine and then encoded by the ECC encoding engine, thereby maximizing the physical space utilization of the hard disk; the small data block access area uses a smaller ECC codeword length, and by saving truncated ECC codewords, efficient access to small data blocks is achieved, thereby reducing the read-write amplification problem during hard disk access and avoiding the power consumption problem caused by the compression / decompression engine.
[0052] The embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.
Claims
1. An ECC method in a storage device, characterized in that: The following steps are involved: Step 1: The interior of the SSD is divided into a general transparent compression area and a dedicated small data block access area; Step 2: In the general transparent compression area, the compression engine in the SSD first compresses the data blocks from the host to obtain compressed data blocks. After the compressed data blocks are closely arranged, the ECC encoding engine encodes them according to the preset default code length and writes them to the storage medium, thereby maximizing the physical space utilization of the hard disk; Step 3: In the small data block access area, use a smaller address mapping granularity and save truncated ECC codewords to reduce the read / write amplification problem during hard disk access and the power consumption of compression / decompression; Step 4: For the read operation of the general transparent compression area, the SSD first determines the PBA corresponding to the LBA contained in the read command according to the address mapping table, and then reads the corresponding data block from the NAND according to the PBA; after ECC decoding, the corresponding compressed data block is intercepted from the decoded data and decompressed, and finally the decompressed data is returned; Step 5: For the read operation of the small data block access area, the SSD first determines the PBA corresponding to the LBA contained in the read command and the length of the 0 at the end of the original data according to the address mapping table, and then reads the corresponding data block from the NAND according to the PBA (that is, truncates the ECC codeword) and appends the 0 at the end of the original data to obtain a complete ECC codeword; finally, after ECC decoding, the decoded data is returned.
2. The ECC method in a storage device according to claim 1, characterized in that: It can be seen from the step 1 that the SSD contains a dedicated small data block access area and a general transparent compression area; The general transparent compression area adopts an address mapping unit of 4KB, while the dedicated small data block access area adopts an address mapping unit smaller than 4KB.
3. The ECC method in a storage device according to claim 1, characterized in that: According to the step 2, the data block corresponding to each LBA is compressed by the compression engine to obtain the corresponding compressed data block; after the compressed data blocks are closely arranged, the ECC encoding engine encodes them according to the preset code length; Among them, the length of each ECC codeword after encoding is the same (the length of the check data is also the same); each ECC codeword may contain different numbers of compressed data blocks depending on the compression ratio of the LBA data block. For example, the first ECC codeword in the figure contains complete compressed data blocks corresponding to LBA0 and LBA1, and contains part of the compressed data block corresponding to LBA2.
4. The ECC method in a storage device according to claim 1, characterized in that: From the step 3, it can be seen that the host side performs an alignment operation on the small data block to be written, that is, the small data block is aligned according to the address mapping granularity of the small data block access area by padding with 0, and then a write command is issued; the data block originally written by the host side is a small data block, that is, the length is less than the size of an LBA, at this time, the host side directly aligns the size of the small data block and the LBA by padding with 0; The ECC encoding engine in the SSD encodes the data block corresponding to the write command according to the preset code length corresponding to the small data block; the ECC encoding engine encodes the written data block according to the LBA size (the LBA size is usually the size of the address mapping granularity, and the LBA size in the small data block access area can be 512B, 1KB or 2KB) to obtain a smaller (relative to the transparent compression area) complete ECC code word.
5. The ECC method in a storage device according to claim 1, characterized in that: It can be seen from the step 3 that in the encoded ECC codeword, the trailing 0 in the original data is truncated to obtain a truncated ECC codeword; Write the truncated ECC code words into NAND in close sequence; The address mapping table is updated according to the actual physical address occupied by the truncated ECC codeword (including the offset and length in the NAND physical page) and the length of the trailing 0 in the original data.
