A storage device and data processing method thereof

By using data mapping tables and main controllers to move host data in the storage device, the problem of low read performance of memory chips is solved, and the read performance and service life of the storage system are improved.

CN118426707BActive Publication Date: 2024-11-05合肥康芯威存储技术有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410888187.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-11-05
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

The reading performance of existing memory chips is poor, resulting in slow operation of the storage system.

Method used

By introducing a data mapping table and a main controller in the storage device, the continuous values ​​of the data mapping segment are counted and the host data is moved according to the continuous values, ensuring that the host data in the data mapping segment is continuous, thereby improving the reading performance.

Benefits of technology

When the host performs continuous reading operations, the read performance of the storage device is significantly improved and the service life is extended.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118426707B_ABST
    Figure CN118426707B_ABST
Patent Text Reader

Abstract

The present invention provides a storage device and a data processing method thereof. The storage device comprises: a flash memory, comprising a plurality of blocks, for storing a data mapping table and host data, wherein the data mapping table stores mapping information of logical addresses and physical addresses of host data, and the data mapping table comprises a plurality of data mapping fragments; and a main controller, electrically connected to the flash memory, for reading the plurality of data mapping fragments and counting the continuous values ​​of the plurality of data mapping fragments, wherein in the data mapping fragments, if the physical addresses corresponding to two adjacent logical addresses are also adjacent, the two adjacent host data are continuous, and the continuous value is represented by the number of two adjacent host data in the data mapping fragments that are continuous; the main controller moves the host data in the block based on the continuous values ​​of the plurality of data mapping fragments, so that the host data corresponding to the plurality of data mapping fragments are continuous. The present invention improves the reading efficiency of the host data in the storage device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of static memory, and in particular to a storage device and a data processing method thereof. Background Art

[0002] Memory chips are the specific application of the concept of embedded system chips in the storage industry. Both system chips and memory chips embed software in a single chip to achieve multi-function, high performance and support for multiple protocols, multiple hardware and different applications. Memory chips are widely used in computers, mobile devices, the Internet of Things and other fields to store various data, such as operating systems, applications, music, videos, photos, etc.

[0003] The performance of data stored in the flash memory of the storage chip is affected by the data reading performance. Currently, the reading performance of the storage chip is poor, which may cause the storage system to run slowly. Therefore, there is room for improvement. Summary of the invention

[0004] The present invention provides a storage device and a data processing method thereof, so as to improve the technical problem in the prior art that the reading performance of a storage chip is poor and the storage system runs slowly.

[0005] The present invention provides a storage device, comprising:

[0006] A flash memory, comprising a plurality of blocks, for storing a data mapping table and host data, wherein the data mapping table stores mapping information between a logical address and a physical address of the host data, and the data mapping table comprises a plurality of data mapping segments; and

[0007] a main controller electrically connected to the flash memory, for reading a plurality of the data mapping segments, and counting continuous values ​​of the plurality of the data mapping segments, wherein in the data mapping segments, if the physical addresses corresponding to two adjacent logical addresses are also adjacent, then the two adjacent host data are continuous, and the continuous value is represented by the number of two adjacent host data in the data mapping segments that are continuous;

[0008] The main controller moves the host data in the block based on the continuous values ​​of the plurality of data mapping segments, so that the host data corresponding to the plurality of data mapping segments are continuous.

[0009] In one embodiment of the present invention, when the continuity value of a certain data mapping segment is less than a continuity threshold, the main controller moves the host data associated with the data mapping segment so that the host data corresponding to the data mapping segment is continuous;

[0010] When the continuity value of a certain data mapping segment is greater than or equal to a continuity threshold, the main controller does not move the host data associated with the data mapping segment.

[0011] In one embodiment of the present invention, when the continuity value of a certain data mapping segment is less than a continuity threshold, the main controller reads the host data at the corresponding physical address according to the order of the logical addresses in the data mapping segment, and moves the host data to a block according to the order of reading, so that the host data associated with the data mapping segment is continuous.

[0012] In one embodiment of the present invention, the flash memory includes a system block and a user block, the system block is used to store firmware, the firmware is used to move host data associated with a certain data mapping segment when the continuous value of the data mapping segment is less than a continuous threshold, and the firmware is used to not move host data associated with the data mapping segment when the continuous value of the data mapping segment is greater than or equal to the continuous threshold;

[0013] The user block is used to store a data mapping table and host data, and the main controller is used to read, write and erase the host data on the user block.

[0014] In one embodiment of the present invention, when the capacity of the host data in a block written at a certain time reaches 1 / N of the total capacity of the flash memory, the main controller counts the continuous values ​​of multiple data mapping fragments, and moves the host data in the block based on the continuous values ​​of multiple data mapping fragments, where N is a positive integer, 4≤N≤10.

[0015] In one embodiment of the present invention, the master controller reads the host data on an associated page in the data mapping segment for a time T, satisfying:

[0016] T = (1~M / L) Tr + Tdma;

[0017] Among them, M is the amount of data associated with a page in the data mapping segment, L is the unit data amount corresponding to each physical address, M / L is the number of physical addresses required to associate a page in the data mapping segment, Tr is the time for the page on the block to prepare the host data after receiving the read command from the main controller, Tdma is the time for the host data to be output to the main controller along with the clock signal, and Tdma is positively correlated with the amount of host data read by the main controller.

[0018] In one embodiment of the present invention, the plurality of data mapping fragments are arranged in a segment management order;

[0019] The main controller is used for counting the continuous values ​​of the plurality of data mapping segments according to the segment management order, and for moving the host data in the block based on the continuous values ​​of the plurality of data mapping segments.

[0020] The present invention also provides a data processing method of a storage device, comprising:

[0021] Storing a data mapping table and host data in multiple blocks of the flash memory, wherein the data mapping table stores mapping information of logical addresses and physical addresses of the host data, and the data mapping table includes multiple data mapping fragments;

[0022] In the data mapping segment, host data whose physical addresses corresponding to two adjacent logical addresses are also adjacent are recorded as continuous, and the number of two adjacent host data in the data mapping segment that are continuous is recorded and recorded as a continuous value;

[0023] Reading a plurality of the data mapping fragments, and counting continuous values ​​of the plurality of the data mapping fragments;

[0024] The host data in the block is moved according to the continuous values ​​of the plurality of data mapping segments, so that the host data corresponding to the plurality of data mapping segments are continuous.

[0025] In one embodiment of the present invention, the step of moving the host data in the block according to the continuous values ​​of the plurality of data mapping segments so that the host data in the plurality of data mapping segments are continuous includes:

[0026] When the continuity value of a certain data mapping segment is less than a continuity threshold, the host data associated with the data mapping segment is moved so that the host data corresponding to the data mapping segment is continuous;

[0027] When the continuity value of a certain data mapping segment is greater than or equal to the continuity threshold, the host data associated with the data mapping segment is not moved.

[0028] In one embodiment of the present invention, when the continuity value of a certain data mapping segment is less than a continuity threshold, the step of moving the host data associated with the data mapping segment includes:

[0029] When the continuity value of a certain data mapping segment is less than the continuity threshold, reading the host data at the corresponding physical address according to the sequence of the logical addresses in the data mapping segment;

[0030] The host data is moved to a block in the order of reading, so that the host data associated with the data mapping segment is continuous.

[0031] Beneficial effects of the present invention: A storage device and a data processing method thereof proposed by the present invention can have very good reading performance when the host performs continuous reading operations on the storage device, and can improve the performance and service life of the storage device. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0033] Figure 1 A schematic diagram of the structure of a storage device provided in one embodiment of the present invention.

[0034] Figure 2 A diagram of mapping information between logical addresses and physical addresses in a data mapping table provided in one embodiment of the present invention.

[0035] Figure 3 A schematic diagram of moving host data in a block provided by an embodiment of the present invention.

[0036] Figure 4 A schematic diagram of moving host data in a block is provided according to another embodiment of the present invention.

[0037] Figure 5 A schematic diagram of moving host data in a block is provided according to another embodiment of the present invention.

[0038] Figure 6 A schematic diagram of the structure of a system block and a user block in a flash memory provided by an embodiment of the present invention.

[0039] Figure 7 A schematic diagram of the steps of a data processing method for a storage device provided by an embodiment of the present invention.

[0040] Figure 8 An embodiment of the present invention provides Figure 6 Schematic diagram of step S40 in FIG.

[0041] Fig. 9 An embodiment of the present invention provides Figure 7 Schematic diagram of step S410 in FIG.

[0042] Description of Figure Numbers

[0043] 10. Host; 20. Storage device; 30. Main controller; 31. Central processing unit; 32. Dynamic random access memory unit; 40. Flash memory; 41. Block; 410. System block; 411. User block; 42. Page. DETAILED DESCRIPTION

[0044] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0045] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0046] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0047] See also Figures 1 to 9 The present invention proposes a storage device and a data processing method thereof, which can be applied to storage devices such as eMMC (Embedded Multi Media Card), SSD (Solid State Disk), and UFS (Univeral Flash Storage). The present invention can move host data in block 41, where host data refers to application data written by the host 10, thereby improving the reading efficiency of the host data in the storage device 20 by the host 10, thereby further improving the performance and service life of the storage device 20. A detailed description is given below through specific embodiments.

[0048] See also Figure 1 and Figure 2In one embodiment of the present invention, a storage device 20 is provided. The storage device 20 is provided with a bus interface. The storage device 20 is electrically connected to a host 10 through the bus interface. The host 10 can write host data and send instructions to the storage device 20, or the host 10 can read host data and receive instructions from the storage device 20. The host 10 can be a communication device such as a personal computer (PC), a tablet computer (Pad), a mobile phone (Cell Phone), etc.

[0049] See also Figure 1 In one embodiment of the present invention, the storage device 20 may include a main controller 30 and a flash memory 40. Among them, the flash memory 40 is a non-volatile memory, which is usually used to store host data and system programs. The main controller 30 is mainly used to operate and manage the flash memory 40, and the main controller 30 also provides functions such as cache, memory array and interleave. The main controller 30 is electrically connected to the flash memory 40. The main controller 30 can control many functions of the flash memory 40, such as bad block management, wear leveling, error checking and correction (ECC, Error Checking and Correcting), etc. The main controller 30 can greatly improve the read, write and move operation performance of the host data in the flash memory 40.

[0050] See also Figure 1 In one embodiment of the present invention, inside the storage device 20, a flash memory interface is provided on the main controller 30, and the main controller 30 and the flash memory 40 are electrically connected through the flash memory interface. The main controller 30 may include a central processing unit (CPU) 31 and a dynamic random access memory unit (DRAM) 32. The central processing unit 31 is the computing core and control core of the storage device 20, and the dynamic random access memory unit 32 is an internal memory that directly exchanges data with the central processing unit 31, also known as the main memory (internal memory). In the storage device 20, the flash memory 40 is not a memory that directly exchanges data with the central processing unit 31, so the flash memory 40 is an auxiliary memory (external memory).

[0051] Specifically, when the host 10 writes host data to the storage device 20, the host data of the host 10 is first stored in the dynamic random access memory unit 32, and the dynamic random access memory unit 32 then sends the host data of the host 10 to the flash memory 40. When the host 10 reads data from the storage device 20, the host data in the flash memory 40 is first stored in the dynamic random access memory unit 32, and the dynamic random access memory unit 32 then sends the host data in the flash memory 40 to the host 10.

[0052] Specifically, when the host 10 sends or receives instructions to the storage device 20, the main controller 30 first caches the host data involved in the sending or receiving instructions through the dynamic random access memory unit 32, and then processes the host data accordingly based on the sending or receiving instructions.

[0053] See also Figure 1 and Figure 2 In one embodiment of the present invention, the flash memory 40 may include a plurality of blocks 41, and the blocks 41 may be used to store the data mapping table and the host data written by the host 10, and a block 41 may also include a plurality of pages 42. Figure 2 As shown, the data mapping table stores the mapping information of the logical address and the physical address of the host data. The logical address refers to the relative address used in the user program, also known as the virtual address. The logical address is generated by the central processing unit 31 and is used to access the data in the flash memory 40. The physical address is the actual address in the flash memory 40, also known as the real address. By querying the mapping information in the data mapping table using the logical address, the corresponding physical address can be found, and then the host data at the corresponding physical address in the flash memory 40 can be read, written, moved, etc. The data mapping table records the mapping relationship between all logical addresses and physical addresses in the storage device 20. Since the data mapping table is relatively large, the storage device 20 manages the data mapping table in segments. The data mapping table may include multiple data mapping segments, such as data mapping segment 1, data mapping segment 2, data mapping segment 3, ..., data mapping segment X.

[0054] Specifically, the dynamic random access memory unit 32 can be used to store temporary data for program execution, so the data mapping table is stored in the dynamic random access memory unit 32 for convenient and quick access. In addition, the data mapping table can be stored in the flash memory 40 to prevent data loss after the storage device 20 is powered off, and the central processing unit 31 can also periodically update the data mapping table in the flash memory 40.

[0055] See also Figure 2 and Figure 3In one embodiment of the present invention, the main controller 30 can read multiple data mapping segments and count the continuous values ​​of the data mapping segments. In a data mapping segment, if the physical addresses corresponding to two adjacent logical addresses are also adjacent, then the two adjacent host data are continuous. The continuous value is represented by the number of adjacent host data in the data mapping segment that are continuous. For example, Figure 2 In the data mapping fragment, the logical addresses are 1, 2, 3, 4, 5, 6, etc., and the physical addresses are 2, 3, 5, 88, 17, 62. The numbers involved in the logical addresses and physical addresses only represent the sequence relationship, and do not represent the specific logical addresses and physical addresses. Figure 2 In the example, the logical addresses are in a continuous sequence, but the physical addresses corresponding to the logical addresses are not in a continuous sequence. Logical address 2 corresponds to physical address 3, and logical address 3 corresponds to physical address 5. Therefore, the data of these two hosts are not continuous.

[0056] See also Figure 2 and Figure 3 In one embodiment of the present invention, when the storage device 20 is in an idle state, the main controller 30 can move the host data in the block 41 based on the continuous values ​​of the multiple data mapping segments, so that the host data in the multiple data mapping segments are continuous. The idle state of the storage device 20 means that there is no read or write operation between the host 10 and the storage device 20. Figure 3 As shown, Figure 3 This is the case where the host data on the same block 41 corresponding to two adjacent logical addresses are not continuous. If the host data on the physical addresses corresponding to the two adjacent logical addresses are A and B, then the host data A and B are not adjacent. If the host data A and B in the first block 41 are to be moved so that the corresponding host data A and B in the data mapping segment are continuous, the following operations need to be performed.

[0057] First, the central processing unit 31 reads the host data A and B in the first block 41 into the dynamic random access memory unit 32. Secondly, for the host data A and B cached on the dynamic random access memory unit 32, the central processing unit 31 writes the host data A and B to two adjacent physical addresses on the second block 41, so that the host data A and B are continuous. In the data mapping segment, the logical addresses corresponding to the host data A and B have not changed, and the physical addresses corresponding to the host data A and B have changed. The mapping information of the host data A and B in the data mapping segment has been updated, that is, the host data A and B on the first block 41 have become invalid data, and the host data A and B on the second block 41 have become valid data.

[0058] In addition, it is worth mentioning that Figure 3After the host data A and B on the first block 41 are moved, if the first block 41 needs to be erased, the following operations need to be performed. Figure 4 As shown, all host data on the first block 41 are moved, and then all host data on the first block 41 become invalid data. Then the first block 41 is erased so that there are multiple free pages 42 on the first block 41 to wait for new host data to be written.

[0059] See also Figure 5 In one embodiment of the present invention, the main controller 30 may move the host data in the block 41 based on the continuous values ​​of the multiple data mapping segments, so that the host data in the multiple data mapping segments are continuous. Figure 5 This is the case where the host data on different blocks 41 corresponding to two adjacent logical addresses are not continuous. If the host data on the physical addresses corresponding to the two adjacent logical addresses are A and B, then the host data A and B are not adjacent. If the host data A in the first block 41 and the host data B in the second block 41 are to be moved so that the corresponding host data A and B in the data mapping segment are continuous, the following operations need to be performed.

[0060] First, the central processing unit 31 reads the host data A in the first block 41 and the host data B in the second block 41 into the dynamic random access memory unit 32. Secondly, for the host data A and B cached on the dynamic random access memory unit 32, the central processing unit 31 writes the host data A and B to two adjacent physical addresses on the third block 41, so that the host data A and B are continuous. In the data mapping segment, the logical addresses corresponding to the host data A and B have not changed, and the physical addresses corresponding to the host data A and B have changed. The mapping information of the host data A and B in the data mapping segment has been updated, that is, the host data A on the first block 41 and the host data B in the second block 41 have become invalid data, and the host data A and B on the third block 41 have become valid data.

[0061] See also Figure 1 , Figure 3 and Figure 5 In one embodiment of the present invention, when the continuity value of a certain data mapping segment is less than the continuity threshold, the main controller 30 moves the host data associated with the data mapping segment so that the host data corresponding to the data mapping segment is continuous. When the continuity value of a certain data mapping segment is greater than or equal to the continuity threshold, the main controller 30 does not move the host data associated with the data mapping segment.

[0062] Specifically, assuming that the capacity of a data mapping segment is 8KB (KiloByte), and a physical address requires 4B (Byte) to record, a data mapping segment will record 2048 physical addresses. If the continuity threshold is set to 80%, when the continuity value of the data mapping segment is greater than or equal to 1639 (2048*80%=1638.4), that is, the number of continuous physical addresses corresponding to the logical address is greater than or equal to 1639, the current data mapping segment is considered to be continuous, and there is no need to move the host data associated with the data mapping segment. On the contrary, when the continuity value of the data mapping segment is less than 1639, that is, the number of continuous physical addresses corresponding to the logical address is less than 1639, the current data mapping segment is considered to be discontinuous, and the host data associated with the data mapping segment needs to be moved so that all host data corresponding to the current data mapping segment is continuous.

[0063] See also Figure 1 , Figure 3 and Figure 5 In one embodiment of the present invention, when the continuity value of a data mapping segment is less than the continuity threshold, the main controller 30 reads the host data at the corresponding physical address according to the sequence of logical addresses in the data mapping segment, and moves the host data to a block 41 according to the sequence of reading, so that the host data associated with the data mapping segment is continuous.

[0064] Specifically, Figure 3 and Figure 5 As shown, when the continuity value of a data mapping segment is less than the continuity threshold, first, the host data at the physical address corresponding to the logical address can be read into the dynamic random access memory unit 32 according to the order of the logical addresses in the data mapping segment for caching. Then, the host data in the dynamic random access memory unit 32 is moved to a block 41 according to the order of the logical address reading, so that the host data associated with the data mapping segment is continuous.

[0065] See also Figure 1 , Figure 3 and Figure 5 In one embodiment of the present invention, when the capacity of the host data in a certain write block 41 reaches 1 / N of the total capacity of the flash memory 40, the main controller 30 counts the continuous values ​​of multiple data mapping fragments, and moves the host data in the block 41 based on the continuous values ​​of the multiple data mapping fragments, where N is a positive integer, 4≤N≤10.

[0066] Specifically, when N is 5, when the host 10 writes random data in excess of 1 / 5 of the total capacity of the flash memory 40, the main controller 30 can count the continuous values ​​of multiple data mapping fragments, and move the host data in the block 41 based on the continuous values ​​of the multiple data mapping fragments.

[0067] See also Figure 1 , Figure 3 and Figure 5 In one embodiment of the present invention, the master controller 30 has a read time T for the host data associated with a page 42 in the data mapping segment, which satisfies:

[0068] T = (1~M / L) Tr + Tdma;

[0069] Wherein, M is the amount of data associated with a page 42 in the data mapping segment, L is the unit data amount corresponding to each physical address, M / L is the number of physical addresses required for an associated page 42 in the data mapping segment, Tr is the time for the page 42 on the block 41 to prepare the host data after receiving the read command from the main controller 30, Tdma is the time for the host data to be output to the main controller 30 along with the clock signal, and Tdma is positively correlated with the amount of host data read by the main controller 30. In the data mapping segment, if all the host data associated with a page 42 are continuous and the physical addresses are distributed on the same page 42, the continuous value associated with a page 42 in the corresponding data mapping segment is M / L-1, and only one page 42 needs to be read, and the reading time T is Tr+Tdma. In the data mapping segment, if all the host data associated with a page 42 are discontinuous and the physical addresses are distributed on different pages 42, the continuous value associated with a page 42 in the corresponding data mapping segment is 0, and M / L pages 42 need to be read, and the reading time T is (M / L)Tr+Tdma.

[0070] Specifically, the purpose of achieving continuity by moving host data is to improve the reading performance, and page 42 is the unit of host data reading. For example, the amount of partial data associated with a page 42 in the data mapping segment is 16KB, and the unit data amount corresponding to each physical address is 4KB. Then, when the amount of partial data associated with a page 42 in the data mapping segment is 16KB, the number of physical addresses required is 4. Specifically, when reading 16KB of data on a page 42 associated with a data mapping segment, 16KB of host data will be mapped to 4 physical addresses. If these 4 physical addresses are on different pages 42 of four blocks 41, the continuous value of 16KB of data on a page 42 associated with the corresponding data mapping segment is 0, then 4 pages 42 need to be read at this time, and the total time consumed to read 16KB of data is (Tr+4KBTdma)*4=4Tr+16KBTdma. After the main controller 30 moves the 16KB host data, so that the four physical addresses are on the same page 42 of the same block 41, the continuous value of 16KB data on a page 42 associated with the corresponding data mapping segment is 3, then only one page 42 needs to be read at this time, and the total time consumed to read the 16KB data is Tr+16KB Tdma, saving 3 Tr times. It can be seen that the reading time of the host data on the same page 42 is much shorter than the reading time of the host data on different pages 42. The present invention improves the reading efficiency of the host data in the storage device 20 by the host 10, and can improve the performance and service life of the storage device 20.

[0071] In addition, it is worth mentioning that when the flash memory 40 reads non-adjacent pages 42 on the same block 41, it can only process serially, that is, after reading one page 42, it reads another page 42. When reading discontinuous pages 42, for example, reading pages 42 numbered N, N+2, and N+4, it is impossible to prepare data in advance during the data transmission process. Specifically, only after the host data on the page 42 numbered N is read, the page 42 numbered N+2 starts to prepare data, and then the host data on the page 42 numbered N+2 can be read.

[0072] When the flash memory 40 reads consecutive pages 42 of the same block 41, a certain degree of parallel processing solution is provided, that is, during the process of reading a page 42, the next page 42 can be prepared for data. When reading consecutive pages 42, for example, reading pages 42 numbered N, N+1, and N+2, data preparation can be performed in advance during the data transmission process. Specifically, during the reading of the host data on the page 42 numbered N, the page 42 numbered N+1 begins to prepare data, that is, the Tr of the page 42 numbered N+1 can be performed at the same time as the Tdma of the page 42 numbered N, thereby saving reading time. The reading time for consecutive pages 42 will be much shorter than the reading time for discontinuous pages 42. By moving data, the host data is stored continuously, so that the reading performance can be greatly improved when the host data is read subsequently.

[0073] See also Figure 1 , Figure 3 and Figure 5 In one embodiment of the present invention, the number of data mapping segments may be multiple, and the storage device 20 may manage the multiple data mapping segments in segments. The main controller 30 may count the continuous values ​​of the multiple data mapping segments in sequence according to the segment management order, and move the host data in the block 41 based on the continuous values ​​of the multiple data mapping segments. The main controller 30 counts the continuous values ​​of the multiple data mapping segments and moves them according to the segment management order, thereby improving the read performance of the host data corresponding to the multiple data mapping segments.

[0074] See also Figure 6 In one embodiment of the present invention, the flash memory 40 may include a system block 410 and a user block 411. The system block 410 is used to store firmware (FW, Fire Ware). The firmware includes an instruction to move the host data associated with a certain data mapping segment when the continuous value of the data mapping segment is less than the continuous threshold. The firmware also includes an instruction not to move the host data associated with the data mapping segment when the continuous value of the data mapping segment is greater than or equal to the continuous threshold. In the storage device 20, there is no need to optimize and improve the hardware process. Only the firmware needs to be modified to improve the reading efficiency of the host data in the storage device 20, and the performance and service life of the storage device 20 can be improved. The user block 411 is used to store the data mapping table and the host data written by the host 10. The host 10 is used to read, write and erase the host data on the user block 411.

[0075] Specifically, the system block 410 may include a firmware code configuration area, a bad block table and a bad block free area, a system block setting area, a system block pointer area, a boot area, and an encryption area. The system block 410 is a block 41 that cannot be accessed by the user, and the flash memory unit of the system block 410 is a single-level cell storage (SLC). The user block 411 may include a boot area and an encryption area, and a regular user area. The user block 411 is a block 41 that can be accessed by the user, and the flash memory unit of the user block 411 is a single-level cell storage (SLC), a double-level cell storage (MLC), and a triple-level cell storage (TLC).

[0076] See also Figure 7 In one embodiment of the present invention, a data processing method of a storage device 20 is proposed, which may include the following steps.

[0077] Step S10: storing a data mapping table and host data in a plurality of blocks of the flash memory, wherein the data mapping table stores mapping information between logical addresses and physical addresses of the host data, and the data mapping table includes a plurality of data mapping segments.

[0078] Step S20: In the data mapping segment, the host data whose physical addresses correspond to two adjacent logical addresses are recorded as continuous, and the number of two adjacent host data in the data mapping segment that are continuous is recorded and recorded as a continuous value.

[0079] Step S30: read multiple data mapping segments, and count continuous values ​​of the multiple data mapping segments.

[0080] Step S40: Move the host data in the block according to the continuous values ​​of the multiple data mapping segments, so that the host data corresponding to the multiple data mapping segments are continuous.

[0081] The following is a detailed description through specific embodiments.

[0082] Step S10: storing a data mapping table and host data in a plurality of blocks of the flash memory, wherein the data mapping table stores mapping information between logical addresses and physical addresses of the host data, and the data mapping table includes a plurality of data mapping segments.

[0083] In one embodiment of the present invention, the data mapping table stores the mapping information of the logical address and the physical address of the host data. The logical address refers to the relative address used in the user program, also known as the virtual address. The logical address is generated by the central processing unit 31 and is used to access the data in the flash memory 40. The physical address is the actual address in the flash memory 40, also known as the real address. By querying the mapping information in the data mapping table using the logical address, the corresponding physical address can be found, and then the host data at the corresponding physical address in the flash memory 40 can be read, written, moved, etc.

[0084] Specifically, the data mapping table records the mapping relationship between all logical addresses and physical addresses in the storage device 20. Since the data mapping table is relatively large, the storage device 20 manages the data mapping table in segments. The data mapping table may include multiple data mapping segments, such as data mapping segment 1, data mapping segment 2, data mapping segment 3, ..., data mapping segment X.

[0085] Step S20: In the data mapping segment, the host data whose physical addresses correspond to two adjacent logical addresses are recorded as continuous, and the number of two adjacent host data in the data mapping segment that are continuous is recorded and recorded as a continuous value.

[0086] In one embodiment of the present invention, in a data mapping segment, if the physical addresses corresponding to two adjacent logical addresses are also adjacent, then the two adjacent host data are continuous. The continuous value is represented by the number of two adjacent host data in the data mapping segment that are continuous. Figure 2 In the example, the logical addresses are in a continuous sequence, but the physical addresses corresponding to the logical addresses are not in a continuous sequence. Logical address 2 corresponds to physical address 3, and logical address 3 corresponds to physical address 5. Therefore, the data of these two hosts are not continuous.

[0087] Step S30: read multiple data mapping segments, and count continuous values ​​of the multiple data mapping segments.

[0088] In one embodiment of the present invention, multiple data map segments are read, and the continuous values ​​of the data map segments are counted. Figure 2 In the data mapping fragment, the logical addresses are 1, 2, 3, 4, 5, 6, etc., and the physical addresses are 2, 3, 5, 88, 17, 62. The numbers involved in the logical addresses and physical addresses only represent the order relationship, and do not represent the specific logical addresses and physical addresses. Figure 2 In the data mapping fragment, the continuous value of the first 6 rows is 1, and the discontinuous value of the first 6 rows is 4.

[0089] Step S40: Move the host data in the block according to the continuous values ​​of the multiple data mapping segments, so that the host data corresponding to the multiple data mapping segments are continuous.

[0090] In one embodiment of the present invention, when the storage device 20 is in an idle state, the main controller 30 can move the host data in the block 41 based on the continuous values ​​of the multiple data mapping segments, so that the host data in the multiple data mapping segments are continuous. The idle state of the storage device 20 means that there is no read or write operation between the host 10 and the storage device 20. Figure 3 As shown, Figure 3 This is the case where the host data on the same block 41 corresponding to two adjacent logical addresses are not continuous. If the host data on the physical addresses corresponding to the two adjacent logical addresses are A and B, then the host data A and B are not adjacent. If the host data A and B in the first block 41 are to be moved so that the corresponding host data A and B in the data mapping segment are continuous, the following operations need to be performed.

[0091] First, the central processing unit 31 reads the host data A and B in the first block 41 into the dynamic random access memory unit 32. Secondly, for the host data A and B cached on the dynamic random access memory unit 32, the central processing unit 31 writes the host data A and B to two adjacent physical addresses on the second block 41, so that the host data A and B are continuous. In the data mapping segment, the logical addresses corresponding to the host data A and B have not changed, and the physical addresses corresponding to the host data A and B have changed. The mapping information of the host data A and B in the data mapping segment has been updated, that is, the host data A and B on the first block 41 have become invalid data, and the host data A and B on the second block 41 have become valid data.

[0092] See also Figure 7 In one embodiment of the present invention, step S40 may include step S410 and step S420. Step S410 may be represented as moving the host data associated with a data mapping segment when the continuous value of the data mapping segment is less than the continuous threshold, so that the host data corresponding to the data mapping segment is continuous. Step S420 may be represented as not moving the host data associated with the data mapping segment when the continuous value of the data mapping segment is greater than or equal to the continuous threshold.

[0093] Specifically, assuming that the capacity of a data mapping segment is 8KB (KiloByte), and a physical address requires 4B (Byte) to record, a data mapping segment will record 2048 physical addresses. If the continuity threshold is set to 80%, when the continuity value of the data mapping segment is greater than or equal to 1639 (2048*80%=1638.4), that is, the number of continuous physical addresses corresponding to the logical address is greater than or equal to 1639, the current data mapping segment is considered to be continuous, and there is no need to move the host data associated with the data mapping segment. On the contrary, when the continuity value of the data mapping segment is less than 1639, that is, the number of continuous physical addresses corresponding to the logical address is less than 1639, the current data mapping segment is considered to be discontinuous, and the host data associated with the data mapping segment needs to be moved so that all host data corresponding to the current data mapping segment is continuous.

[0094] See also Fig. 9 In one embodiment of the present invention, step S410 may include step S411 and step S412. Step S411 may be represented as reading the host data at the corresponding physical address according to the sequence of logical addresses in the data mapping segment when the continuity value of a certain data mapping segment is less than the continuity threshold. Step S412 may be represented as moving the host data to a block 41 according to the sequence of reading, so that the host data associated with the data mapping segment is continuous.

[0095] Specifically, Figure 3 and Figure 5 As shown, when the continuity value of a data mapping segment is less than the continuity threshold, first, the host data at the physical address corresponding to the logical address can be read into the dynamic random access memory unit 32 according to the order of the logical addresses in the data mapping segment for caching. Then, the host data in the dynamic random access memory unit 32 is moved to a block 41 according to the order of the logical address reading, so that the host data associated with the data mapping segment is continuous.

[0096] In summary, the present invention provides a storage device and a data processing method thereof, which can have very good reading performance when a host performs continuous reading operations on the storage device, and can improve the performance and service life of the storage device.

[0097] The flow chart and block diagram in the accompanying drawings illustrate the possible implementation architecture, function and operation of the method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

Claims

1. A storage device, characterized in that: include: A flash memory, comprising a plurality of blocks, for storing a data mapping table and host data, wherein the data mapping table stores mapping information of a logical address and a physical address of the host data, and the data mapping table comprises a plurality of data mapping segments; as well as a main controller electrically connected to the flash memory, for reading a plurality of the data mapping segments, and counting continuous values ​​of the plurality of the data mapping segments, wherein in the data mapping segments, if the physical addresses corresponding to two adjacent logical addresses are also adjacent, then the two adjacent host data are continuous, and the continuous value is represented by the number of two adjacent host data in the data mapping segments that are continuous; Wherein, when the storage device is in an idle state, the main controller moves the host data in the block based on the continuous values ​​of the plurality of data mapping fragments, so that the host data corresponding to the plurality of data mapping fragments are continuous; The main controller periodically updates the data mapping table in the flash memory, wherein the update of the data mapping table is represented by the logical addresses of two adjacent host data not being changed, and the physical addresses of two adjacent host data being changed; When the capacity of the host data in a block written at a certain time reaches 1 / N of the total capacity of the flash memory, the main controller counts the continuous values ​​of multiple data mapping fragments, and moves the host data in the block based on the continuous values ​​of multiple data mapping fragments, where N is a positive integer, 4≤N≤10.

2. The storage device according to claim 1, characterized in that When the continuity value of a certain data mapping segment is less than a continuity threshold, the main controller moves the host data associated with the data mapping segment so that the host data corresponding to the data mapping segment is continuous; When the continuity value of a certain data mapping segment is greater than or equal to a continuity threshold, the main controller does not move the host data associated with the data mapping segment.

3. The storage device according to claim 2, characterized in that: When the continuity value of a data mapping segment is less than a continuity threshold, the main controller reads the host data at the corresponding physical address according to the order of the logical addresses in the data mapping segment, and moves the host data to a block according to the order of reading, so that the host data associated with the data mapping segment is continuous.

4. The storage device according to claim 2, characterized in that: The flash memory includes a system block and a user block, the system block is used to store firmware, the firmware is used to move host data associated with a certain data mapping segment when the continuous value of the data mapping segment is less than a continuous threshold, and the firmware is used to not move host data associated with the data mapping segment when the continuous value of the data mapping segment is greater than or equal to the continuous threshold; The user block is used to store a data mapping table and host data, and the main controller is used to read, write and erase the host data on the user block.

5. The storage device according to claim 1, characterized in that: The master controller takes T time to read the host data on a page in the data mapping segment, which satisfies: T = (1~M / L) Tr + Tdma; Among them, M is the amount of data associated with a page in the data mapping segment, L is the unit data amount corresponding to each physical address, M / L is the number of physical addresses required to associate a page in the data mapping segment, Tr is the time for the page on the block to prepare the host data after receiving the read command from the main controller, Tdma is the time for the host data to be output to the main controller along with the clock signal, and Tdma is positively correlated with the amount of host data read by the main controller.

6. The storage device according to claim 1, characterized in that: The plurality of data mapping fragments are arranged in a segment management order; The main controller is used to count the continuous values ​​of the plurality of data mapping segments according to the segment management order, and to move the host data in the block based on the continuous values ​​of the plurality of data mapping segments.

7. A data processing method for a storage device, characterized in that: include: Storing a data mapping table and host data in multiple blocks of the flash memory, wherein the data mapping table stores mapping information of logical addresses and physical addresses of the host data, and the data mapping table includes multiple data mapping fragments; In the data mapping segment, host data whose physical addresses corresponding to two adjacent logical addresses are also adjacent are recorded as continuous, and the number of two adjacent host data in the data mapping segment that are continuous is recorded and recorded as a continuous value; Reading a plurality of the data mapping fragments, and counting continuous values ​​of the plurality of the data mapping fragments; In an idle state of the storage device, the host data in the block is moved according to the continuous values ​​of the plurality of data mapping segments, so that the host data corresponding to the plurality of data mapping segments are continuous; Periodically updating the data mapping table in the flash memory, wherein the updating of the data mapping table means that the logical addresses of two adjacent host data are unchanged, but the physical addresses of two adjacent host data are changed; When the capacity of the host data in a certain write block reaches 1 / N of the total capacity of the flash memory, the continuous values ​​of multiple data mapping fragments are counted, and based on the continuous values ​​of multiple data mapping fragments, the host data in the block is moved, where N is a positive integer, 4≤N≤10.

8. The data processing method of the storage device according to claim 7, characterized in that: The step of moving the host data in the block according to the continuous values ​​of the plurality of data mapping segments in the idle state of the storage device so that the host data in the plurality of data mapping segments are continuous includes: When the continuity value of a certain data mapping segment is less than a continuity threshold, the host data associated with the data mapping segment is moved so that the host data corresponding to the data mapping segment is continuous; When the continuity value of a certain data mapping segment is greater than or equal to the continuity threshold, the host data associated with the data mapping segment is not moved.

9. The data processing method of the storage device according to claim 8, characterized in that: The step of moving the host data associated with a data mapping segment when the continuity value of the data mapping segment is less than the continuity threshold comprises: When the continuity value of a certain data mapping segment is less than the continuity threshold, reading the host data at the corresponding physical address according to the sequence of the logical addresses in the data mapping segment; The host data is moved to a block in the order of reading, so that the host data associated with the data mapping segment is continuous.

Citation Information

Patent Citations

  • Method for controlling discontinuous physical addresses of DMA access and DMA controller

    CN101599049A

  • A method for managing a flash memory module and a related flash memory controller

    CN109671458A

  • Data storage device and method for updating logical-to-physical mapping table

    CN111813703A

  • Data arrangement method, device and system and computer readable storage medium

    CN113900963A

  • Namespaces Allocation in Non-Volatile Memory Devices

    US20190121547A1