A storage device and data processing method thereof
By dynamically adjusting the storage space and address mapping of the cache unit in the storage device, reducing the number of programming erases, the problem of decreasing effective data life in the prior art is solved, and the performance and life of the storage device are improved.
Patent Information
- Application Number
- CN202411203850.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-08-30
AI Technical Summary
Existing storage devices often use garbage collection operations for invalid data in the number of programming erases, resulting in a decrease in the service life of effective data and cannot meet the needs of high performance and high reliability.
By introducing a cache unit into the storage device, the storage space of the read cache area and the write cache area is dynamically adjusted, and the mapping between logical addresses and physical addresses makes the data to be written have continuous physical addresses, reducing the programming erasing of flash blocks Number of writes to increase the amount of data storage.
It effectively reduces the number of garbage collections of invalid data, extends the storage life of effective data by storage devices, and improves the performance and life of storage devices.
Smart Images

Figure CN118732954B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of static storage technology, and in particular to a storage device and a data processing method thereof. Background Art
[0002] With the widespread application of storage devices in terminal products such as televisions, set-top boxes, tablet computers and mobile phones, the requirements for the performance and reliability of storage devices are becoming higher and higher. Maximizing the life of storage devices is an important indicator for measuring product quality. When the number of program erase cycles (PEC) of the storage unit in the storage device is fixed, how to ensure that more valid data is stored in the storage device and reduce the number of garbage collection (GC) processing times caused by invalid data in the storage device, so as to maximize the service life of the storage unit is a problem worth considering. In the prior art, the number of program erase cycles of storage devices is mostly used for garbage collection operations of invalid data, which cannot meet the usage requirements. Therefore, there is room for improvement. Summary of the invention
[0003] The present invention provides a storage device and a data processing method thereof, so as to improve the technical problem that the programming and erasing times of the storage device in the prior art are mostly used for garbage collection operations of invalid data, and the programming and erasing times are not applied to valid data, resulting in a decrease in the service life of the storage device for valid data.
[0004] The present invention provides a storage device, comprising:
[0005] Flash memory, including multiple blocks, for storing host data;
[0006] A main controller is electrically connected to the flash memory, and the main controller includes:
[0007] A cache unit for caching host data read and / or written;
[0008] A control processing unit, configured to adjust the storage space of the read cache area and the write cache area in the cache unit according to the host data to be read and / or written, and transmit the host data through the cache unit and the flash memory;
[0009] The control processing unit configures the mapping information of the logical address and the physical address of the host data to be written, so that the host data to be written has a continuous physical address;
[0010] The control processing unit writes the same amount of host data of the test data to the flash memory for multiple times, and after each writing of the host data of the test data, records the programming and erasing values of multiple blocks in the flash memory, wherein one programming and erasing value indicates that a certain block has been written and erased once;
[0011] According to the ratio of the host data of a test data volume to the corresponding programming and erasing value, the total data volume of the host data written corresponding to the maximum programming and erasing value of the flash memory is counted.
[0012] In one embodiment of the present invention, the control processing unit counts the data volume of the corresponding host data to be read and / or to be written within a certain cycle time;
[0013] When the ratio between the amount of host data to be read and the amount of host data to be written is greater than 1, reducing the storage space of the write cache area, and adding the reduced storage space of the write cache area to the storage space of the read cache area;
[0014] When the ratio between the amount of host data to be read and the amount of host data to be written is less than 1, the storage space of the read cache area is reduced, and the reduced storage space of the read cache area is added to the storage space of the write cache area.
[0015] In one embodiment of the present invention, the control processing unit corresponds the logical addresses of the host data to be written to the physical addresses of the free pages in sequence on the block, so that part of the host data to be written has a continuous physical address, and the rest of the host data to be written has another continuous physical address.
[0016] In one embodiment of the present invention, the control processing unit obtains the block corresponding to the host data to be read and to be written and records it as a target block, and respectively corresponds the logical address of the host data to be written to the physical addresses of the free pages in sequence on the target block, so that the host data to be read and to be written have continuous physical addresses.
[0017] In one embodiment of the present invention, when the read cache area in the cache unit is full, the control processing unit transfers the host data in the read cache area to the host side, or when the write cache area in the cache unit is full, the control processing unit stores the host data in the write cache area into the flash memory.
[0018] In one embodiment of the present invention, the total amount of data written to the host corresponding to the maximum programming and erasing value of the flash memory is ,satisfy:
[0019] ;
[0020] in, is the maximum programming and erasing value of the flash memory, obtained from the specification parameter information of the flash memory, is the amount of test data written by the control processing unit to the flash memory each time, It is the average value of the programming and erasing values of multiple blocks in the flash memory corresponding to the host data of one test data volume.
[0021] The present invention also provides a data processing method for a storage device, comprising:
[0022] Adjusting storage space of a read cache area and a write cache area in a cache unit according to host data to be read and / or written;
[0023] The host data to be written is configured with mapping information of a logical address and a physical address so that the host data to be written has a continuous physical address;
[0024] Transmitting host data to be read in the flash memory to the host through the cache unit;
[0025] Writing the same amount of host data of the test data to the flash memory for multiple times, and recording the programming and erasing values of multiple blocks in the flash memory after each writing of the host data of the test data, wherein one programming and erasing value indicates that a certain block has been written and erased once;
[0026] According to the ratio of the host data of a test data volume to the corresponding programming and erasing value, the total data volume of the host data written corresponding to the maximum programming and erasing value of the flash memory is counted.
[0027] In one embodiment of the present invention, the step of adjusting the storage space of the read cache area and the write cache area in the cache unit according to the host data to be read and / or written includes:
[0028] In a certain cycle time, count the data volume of the corresponding host data to be read and / or to be written;
[0029] The control processing unit adjusts the storage space of the read cache area and the write cache area in the cache unit according to the ratio between the data volume of the host data to be read and the data volume of the host data to be written within the certain cycle time.
[0030] In one embodiment of the present invention, for host data to be written, the logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on the block, so that part of the host data to be written has a continuous physical address, and the rest of the host data to be written has another continuous physical address.
[0031] In one embodiment of the present invention, for host data to be read and to be written, the block corresponding to the host data to be read is obtained and recorded as the target block, and the logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on the target block, so that the host data to be read and to be written have continuous physical addresses.
[0032] Beneficial effects of the present invention: The present invention proposes a storage device and a data processing method thereof, which reduces the number of garbage collection times of invalid data by the firmware, that is, reduces the number of programming and erasing times of blocks in the flash memory, and increases the data storage capacity of the flash memory for valid data. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] 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.
[0034] Figure 1 A schematic diagram of the structure of a test board provided in one embodiment of the present invention.
[0035] Figure 2 A schematic diagram of the structure of a storage device provided in one embodiment of the present invention.
[0036] Figure 3 A schematic diagram of a storage space of a cache unit in a storage device provided by an embodiment of the present invention.
[0037] Figure 4 A schematic diagram of a block in a storage device provided in the prior art.
[0038] Figure 5 A schematic diagram of a block in a storage device provided according to an embodiment of the present invention.
[0039] Figure 6 A schematic diagram of the steps of a data processing method for a storage device provided in one embodiment of the present invention.
[0040] Reference Numbers
[0041] 10. Test board; 11. Central processing unit; 12. Power module; 13. Chip test socket; 14. Dynamic random access memory; 15. Universal serial bus; 20. Storage device; 21. Control processing unit; 22. Universal asynchronous receiver and transmitter; 23. Instruction processing unit; 24. Logic processing unit; 25. Logical-physical conversion unit; 26. Cache unit; 260. Read cache area; 261. Write cache area; 27. Flash memory; 270. Block; 28. Main controller. DETAILED DESCRIPTION
[0042] 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.
[0043] 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.
[0044] 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.
[0045] See also Figures 1 to 6The 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 convert multiple read and write operations of random small file data into one overall operation of large file data, which can effectively reduce the program erase cycle (PEC) of the flash memory 27. In addition, based on the amount of data corresponding to the read and write operations, the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 can be adjusted, thereby reducing the program erase cycle of the flash memory 27, increasing the number of program erase cycles of valid data, and further improving the performance and service life of the storage device 20.
[0046] The following uses a specific embodiment to first describe the test board 10 and the storage device 20 in detail, and then analyze the interaction of host data and read and write instructions between the test board 10 and the storage device 20.
[0047] See also Figure 1 and Figure 2 In one embodiment of the present invention, a central processing unit 11, a power module 12, a chip test socket 13, a dynamic random access memory 14 and a universal serial bus 15 are provided on the test board 10.
[0048] Specifically, the chip test socket 13 can be used to install a storage device 20, which is provided with a bus interface or pins. The storage device 20 is electrically connected to the chip test socket 13 via the bus interface or pins, that is, an electrical connection is achieved between the storage device 20 and the test board 10.
[0049] Specifically, the central processing unit (CPU) 11 is the computing core and control core of the test board 10. The central processing unit 11 is used to write host data and send instructions to the storage device 20. For example, different read and write commands and host data of different lengths can be sent to the storage device 20 for testing, or the test board 10 can read host data and receive instructions from the storage device 20. The power module 12 can be used to power the central processing unit 11 and the storage device 20 on the chip test socket 13.
[0050] Specifically, the dynamic random access memory (DRAM) 14 stores the operating space of the system software in the entire test board 10. The universal serial bus 15 can communicate with a host computer such as a personal computer (PC), a tablet computer (Pad), a mobile phone (Cell Phone), etc. The test board 10 can download the image file (SOC Image) system program through the universal serial bus 15, and the test board 10 can also upload the test data of the storage device 20 to the host computer through the universal serial bus 15.
[0051] See also Figure 1 and Figure 2 In one embodiment of the present invention, the storage device 20 may include a main controller 28 and a flash memory 27. The flash memory 27 is a non-volatile memory, which is usually used to store host data and system programs. The main controller 28 is mainly used to operate and manage the flash memory 27, and the main controller 28 also provides functions such as a cache unit (Cache) 26, a memory array (Memory array) and interleave. The main controller 28 is electrically connected to the flash memory 27. The main controller 28 can control many functions of the flash memory 27, such as bad block management, wear leveling, error checking and correction (ECC, Error Checking and Correcting), etc. The main controller 28 can greatly improve the read, write and move operation performance of the host data in the flash memory 27.
[0052] 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 28, and the main controller 28 is electrically connected to the flash memory 27 through the flash memory interface. The main controller 28 may include a control processing unit 21, a universal asynchronous receiver and transmitter 22, an instruction processing unit 23, a logic processing unit 24, a logic-physical conversion unit 25, and a cache unit 26.
[0053] Specifically, the control processing unit (MCU, Microcontroller Unit) 21 is the computing core and control core of the storage device 20, and can be used to manage the operation of modules such as the universal asynchronous receiver and transmitter 22, the instruction processing unit 23, the logic processing unit 24, the logic-physical conversion unit 25, and the cache unit 26.
[0054] Specifically, the command processing unit (CPU) 23 is responsible for performing command exchange analysis and host data transmission with the central processing unit 11 of the test board 10. The command processing unit 23 parses the read and write commands sent by the central processing unit 11 so that the central processing unit 11 and the control processing unit 21 can perform read and write commands and host data transmission.
[0055] Specifically, the logical processing unit (LPU) 24 is responsible for managing the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26, and can use corresponding algorithms to ensure dynamic adjustment of the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to different application scenarios and usage conditions of the cache unit 26 and the flash memory 27. The logical processing unit 24 can meet the storage device 20 at different times due to different read-write ratios, so that the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 changes dynamically.
[0056] Specifically, for 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, and the logical address is generated by the central processing unit 11 and is used to access the data in the flash memory 27. The physical address is the actual address in the flash memory 27, also known as the real address. By using the logical address to query the mapping information corresponding to the host data, the corresponding physical address can be found, and then the host data at the corresponding physical address in the flash memory 27 can be read, written, moved, etc.
[0057] Specifically, the logical-physical conversion unit 25 is used to perform address conversion, and the logical address of the read-write instruction issued by the central processing unit 11 of the test board 10 corresponds to the physical address on the flash memory 27. The universal asynchronous receiver and transmitter 22 is a universal serial data bus used for asynchronous communication. The bus has bidirectional communication and can realize full-duplex transmission and reception. The flash memory 27 is the storage part of the storage device 20. The flash memory 27 can be divided into a logical unit (Die), a plane (Plane), a block (Block) 270, and a page (Page) according to the architecture from large to small. Usually, one block 270 includes 64 pages, and the storage space of one page can store 4Kbyte of data.
[0058] Specifically, when the test board 10 writes host data to the storage device 20, the test board 10 first stores the host data to be written in the cache unit 26, and the cache unit 26 then sends the host data to be written to the flash memory 27. When the test board 10 reads data from the storage device 20, the host data to be read in the flash memory 27 is first stored in the cache unit 26, and the cache unit 26 then sends the host data to be read to the test board 10.
[0059] See also Figure 1 and Figure 2 In one embodiment of the present invention, on the test board 10, the image file (SOC Image) system program can be downloaded through the universal serial bus 15, and the image file system program can be run on the central processing unit 11, so that the test board 10 can be started normally and enter the working state. On the test board 10, the image file can also be transferred to the storage device 20 on the chip test socket 13, and the image file system program can be run on the control processing unit 21, so that the storage device 20 can be started normally and enter the state to be tested.
[0060] Specifically, the test board 10 can initiate a read and write test to the storage device 20, for example, with a random logical address, or host data of different lengths and sizes, to perform a read and write test on the storage device 20. After the storage device 20 receives the read and write instructions sent by the central processing unit 11, the instruction processing unit 23 parses the corresponding read and write instructions, and the control processing unit 21 can perform statistical processing on the parsed read and write instructions through the logical-physical conversion unit 25 to confirm the logical address and data length of the host data to be read / written corresponding to the read and write commands.
[0061] Specifically, after the control processing unit 21 analyzes the parsed read / write instructions, it can confirm the data volume of the host data to be read / written corresponding to the read / write instructions, and the logic processing unit 24 adjusts the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to the ratio between the data volumes of the host data to be read / written. The control processing unit 21 establishes mapping information corresponding to the logical address and the physical address for the host data to be read / written through the logical-physical conversion unit 25.
[0062] For example, since the host data to be read has been stored in the flash memory 27, that is, in the process of establishing the mapping information between the logical address and the physical address, the physical address of the host data to be read is relatively fixed. Since the host data to be written has not been stored in the flash memory 27, that is, in the process of establishing the mapping information between the logical address and the physical address, the physical address of the host data to be read can be adjusted, and the logic processing unit 24 can configure the physical address of the host data to be read so that the host data to be written has a continuous physical address.
[0063] See also Figure 1 and Figure 2 In one embodiment of the present invention, the control processing unit 21 may write the same test data amount of host data to the flash memory 27 for multiple times, and after each writing of the test data amount of host data, record the program erase cycle (PEC) of multiple blocks 270 in the flash memory 27, where one program erase cycle value represents a block 270 that has been written and erased once. Based on the ratio of the host data of the test data amount and the corresponding program erase cycle value, the total amount of host data written corresponding to the maximum program erase cycle value of the flash memory 27 is calculated.
[0064] See also Figure 3 In one embodiment of the present invention, the control processing unit 21 analyzes the read and / or write instructions within a certain cycle time and counts the corresponding data volume of the host data to be read and / or to be written. The control processing unit 21 adjusts the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to the ratio between the data volume of the host data to be read and the data volume of the host data to be written within the cycle time.
[0065] Specifically, Figure 3 As shown, for example, if the cycle time is 1 second (s), the control processing unit 21 analyzes the read and write instructions within the 1 second cycle time, and can confirm the data volume of the host data to be read / written corresponding to the read and write instructions. The control processing unit 21 performs statistics through the logic processing unit 24, and adjusts the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to the ratio between the data volumes of the host data to be read / written.
[0066] For example, when the ratio between the amount of host data to be read and the amount of host data to be written is greater than 1, the storage space of the write cache area 261 is reduced, and the reduced storage space of the write cache area 261 is added to the storage space of the read cache area 260. When the ratio between the amount of host data to be read and the amount of host data to be written is less than 1, the storage space of the read cache area 260 is reduced, and the reduced storage space of the read cache area 260 is added to the storage space of the write cache area 261.
[0067] It can be seen that by setting the cycle time to 1 second, the control processing unit 21 can periodically dynamically adjust the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26. The advantage is that when the storage device 20 is in a situation where there are more writes than reads or more reads than writes, the storage space of the read cache area 260 and the write cache area 261 can be maximized, and the number of programming and erasing times of the block 270 can be effectively reduced.
[0068] Specific, combined Figure 3 , Figure 4 and Figure 5 According to analysis, when the storage device 20 is in a situation where the reading is less and the writing is more, the amount of host data to be written is much greater than the amount of host data to be read, for example, the ratio of the amount of host data to be written to the amount of host data to be read is greater than 10. If within the cycle time, the amount of host data to be written is much greater than the amount of host data to be read, and if the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 is the same, the storage space of the read cache area 260 will be still available, while the storage space of the write cache area 261 will not be able to accommodate more host data to be written.
[0069] In the above situation, the write cache 261 needs to first write part of the host data to be written into the flash memory 27, and then the write cache 261 caches the remaining host data to be written, and then when the storage space of the write cache 261 is full, the host data to be written in it is written into the flash memory 27. On the one hand, the write cache 261 needs to write the host data to be written into the flash memory 27 multiple times, which has the problem of time-consuming and inefficient multiple writing. On the other hand, if Figure 4 , Figure 5 As shown, in Figure 4 In the process, since the write cache 261 writes the host data to be written into the flash memory 27 for multiple times, when the physical address of the host data to be written is repeated, the corresponding block 270 needs to be erased, which increases the program erase cycle (PEC) of the block 270, essentially reducing the service life of the block 270.
[0070] Therefore, when the storage device 20 is in a situation where the reading is less and the writing is more, the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 is dynamically adjusted, so that the storage space of the read cache area 260 can be reduced, and the reduced storage space of the read cache area 260 is added to the storage space of the write cache area 261. After the storage space of the write cache area 261 is increased, the write cache area 261 can write a larger amount of host data to be written into the flash memory 27 at one time, avoiding the problem that the host data to be written is written into the flash memory 27 multiple times, and there is a problem that the block 270 needs to be garbage collected, which leads to an increase in the program erase cycle (PEC) of the block 270.
[0071] See also Figure 4 and Figure 5 In one embodiment of the present invention, the control processing unit 21 corresponds the logical addresses of the host data to be written to the physical addresses of the free pages in sequence on the block 270, so that part of the host data to be written has a continuous physical address, and the rest of the host data to be written has another continuous physical address.
[0072] Table 1. Mapping information table of logical address and physical address
[0073]
[0074] Specifically, as shown in Table 1 and Figure 4 As shown, in the prior art, in the case of randomly writing host data to the storage device 20, if the storage device 20 receives 1 read instruction and 7 write instructions within one cycle time, it can be seen from Table 1 that the page numbered 10, the page numbered 32, the pages numbered 56, 57, 58 and 59, because different host data are written on the pages with the same physical address, the pages numbered 10, 32, 56, 57, 58 and 59 need to be erased, so that the program erase value (PEC, Program Erase Cycle) of the corresponding block 270 increases, which essentially reduces the service life of the block 270.
[0075] Specifically, as shown in Table 1 and Figure 5 As shown, in this embodiment, the control processing unit 21 makes the logical addresses of the host data to be written correspond to the physical addresses of the free pages in the block 270 in a sequential order. Figure 5In the example, the page numbered 5 stores host data to be read, and the pages numbered 1, 2, 3, 4, 6, 7, ... 64 do not store host data, so the pages numbered 1, 2, 3, 4, 6, 7, ... 64 are free pages. The host data stored on the pages numbered 1, 2, 3, 4 have a continuous physical address, and the host data stored on the pages numbered 6, 7, 8, 9, 10, ... 42 have another continuous physical address. Since the host data is only written once to the page with the same physical address, there is no need to erase block 270, and the program erase cycle (PEC) of the corresponding block 270 does not increase, which essentially guarantees the service life of the block 270.
[0076] See also Figure 4 and Figure 5 In one embodiment of the present invention, the control processing unit 21 obtains the block 270 corresponding to the host data to be read and to be written and records it as the target block 270, and respectively corresponds the logical address of the host data to be written to the physical addresses of the free pages in sequence on the target block 270, so that the host data to be read and to be written have continuous physical addresses.
[0077] Specifically, as shown in Table 1 and Figure 5 As shown, in this embodiment, the block 270 corresponding to the host data to be read is obtained and recorded as the target block 270. On the target block 270, the host data to be read is stored on the page numbered 5, and the pages numbered 1, 2, 3, 4, 6, 7, ... 64 do not store host data, so the pages numbered 1, 2, 3, 4, 6, 7, ... 64 are free pages. The logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on the target block 270. The host data to be read is stored on the page numbered 5, and the host data to be written is stored on the pages numbered 1, 2, 3, 4, 6, 7, 8, 9, 10, ... 42, so the host data to be read and to be written have continuous physical addresses.
[0078] Therefore, by making the host data to be read and to be written have continuous physical addresses, the benefit is that when there is a correlation between the host data to be read and to be written, or when the host data to be read and to be written belong to the same project of the storage device 20 tested by the test board 10, the host data to be read and to be written are written into the same block 270, that is, the host data to be read and to be written have continuous physical addresses, which can improve the processing efficiency of the host data to be read and to be written. In the same cycle time, the test board 10 needs to perform a read operation on the host data to be read and a write operation on the host data to be written, thereby improving the processing efficiency of the host data to be read and to be written.
[0079] As described above, by allocating storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to the host data to be read and / or written, and configuring the mapping relationship between the logical address and the physical address of the host data to be written, so that the host data to be written has a continuous physical address, it is possible to package small file data corresponding to multiple randomly written host data to form large file data. Figure 4 and Figure 5 , which can reduce the idle and invalid pages in block 270, so that scattered host data can be transformed into continuous host data, reduce the movement of host data in block 270, and reduce the erasing process of block 270, that is, the program erase value (PEC, Program Erase Cycle) of block 270 is not consumed, which can improve the service life of the storage device 20.
[0080] See also Figure 1 , Figure 2 and Figure 3 In one embodiment of the present invention, the control processing unit 21 transfers the host data in the read cache area 260 to the test board 10 when the read cache area 260 in the cache unit 26 is full, or stores the host data in the write cache area 261 in the flash memory 27 when the write cache area 261 in the cache unit 26 is full.
[0081] See also Figure 1 , Figure 2 and Figure 3 In one embodiment of the present invention, the total amount of data written to the host corresponding to the maximum programming and erasing value of the flash memory 27 is (Total Bytes Written), satisfying:
[0082] ;
[0083] in, is the maximum programming and erasing value of the flash memory 27, obtained from the specification parameter information of the flash memory 27, To control the amount of test data written by the processing unit 21 to the flash memory 27 each time, It is the average value of the programming and erasing values of a plurality of blocks 270 in the flash memory 27 corresponding to the host data of a test data volume.
[0084] Specifically, first, in the storage device 20, the control processing unit 21 can count the program erase cycle (PEC) of the multiple blocks 270, and these program erase cycle values are stored in the table block of the flash memory 27 firmware. Secondly, the test board 10 writes XGB of host data into the storage device 20 for testing multiple times, and the amount of test data written by the test board 10 to the flash memory 27 of the storage device 20 each time can be recorded as After each time the host data of the test data amount is written to the storage device 20, the programming and erasing values of the multiple blocks 270 in the flash memory 27 are recorded. Then, the control processing unit 21 can count the host data of the test data amount, and the average programming and erasing values of the multiple blocks 270 in the flash memory 27 according to the programming and erasing values of the multiple blocks 270. . Based on the average value of the host data and programming and erasing values of the test data volume The corresponding relationship can be used to calculate the maximum programming and erasing value of flash memory 27 Corresponding to the total amount of data written to the host.
[0085] Since the host data of the same test data volume is written to the flash memory 27 multiple times, a corresponding total data volume can be calculated after each writing of the host data of the test data volume. After that, the total amount of data can be determined Is it stable at the same value? If the total data volume If the value is stabilized at the same value, the test on the storage device 20 may be terminated.
[0086] In addition, if the total data volume If the value is not stable, the storage device 20 can be tested again and the total data volume After stabilizing at the same value, the test of the storage device 20 is terminated. The reason why it is not stable at the same value is that in the storage device 20, the storage cell (Cell) of the flash memory 27 may include storage types such as single-level cell (SLC), double-level cell (MLC) and triple-level cell (TLC). When the host data is written into storage cells of different storage types, the corresponding data bits and program erase cycle (PEC) are different, resulting in a total data volume of It is not a situation where the value remains stable at the same level.
[0087] See also Figure 6In one embodiment of the present invention, the present invention proposes a data processing method for a storage device, which may include the following steps.
[0088] Step S10: adjusting the storage space of the read cache area and the write cache area in the cache unit according to the host data to be read and / or written.
[0089] Step S20: configure a mapping relationship between a logical address and a physical address for the host data to be written, so that the host data to be written has a continuous physical address.
[0090] Step S30: transmitting the host data to be read in the flash memory to the host through the cache unit.
[0091] Step S40, writing the same amount of host data of the test data into the flash memory multiple times, and recording the programming and erasing values of multiple blocks in the flash memory after writing the host data of the test data each time, wherein a programming and erasing value indicates that a block has been written and erased once.
[0092] Step S50: According to the ratio of the host data of a test data volume to the corresponding programming and erasing value, the total data volume of the host data written corresponding to the maximum programming and erasing value of the flash memory is counted.
[0093] The above steps are described in detail below through specific embodiments.
[0094] Step S10: adjusting the storage space of the read cache area and the write cache area in the cache unit according to the host data to be read and / or written.
[0095] In one embodiment of the present invention, Figure 2 As shown, the logical processing unit (LPU, Logical Processing Unit) 24 is responsible for managing the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26, and can use corresponding algorithms to ensure the dynamic adjustment of the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to different application scenarios and usage conditions of the cache unit 26 and the flash memory 27. The logical processing unit 24 can meet the storage device 20 at different times. The storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 changes dynamically.
[0096] Step S20: configure a mapping relationship between a logical address and a physical address for the host data to be written, so that the host data to be written has a continuous physical address.
[0097] In one embodiment of the present invention, since the host data to be read has been stored in the flash memory 27, that is, in the process of establishing the mapping information between the logical address and the physical address, the physical address of the host data to be read is relatively fixed. Since the host data to be written has not been stored in the flash memory 27, that is, in the process of establishing the mapping information between the logical address and the physical address, the physical address of the host data to be read can be adjusted, and the logic processing unit 24 can configure the physical address of the host data to be read so that the host data to be written has a continuous physical address.
[0098] Step S30: transmitting the host data to be read in the flash memory to the host through the cache unit.
[0099] In one embodiment of the present invention, when the test board 10 writes host data to the storage device 20, the host data of the test board 10 is first stored in the cache unit 26, and the cache unit 26 then sends the host data of the test board 10 to the flash memory 27. When the test board 10 reads data from the storage device 20, the host data in the flash memory 27 is first stored in the cache unit 26, and the cache unit 26 then sends the host data in the flash memory 27 to the test board 10.
[0100] Step S40, writing the same amount of host data of the test data into the flash memory multiple times, and recording the programming and erasing values of multiple blocks in the flash memory after writing the host data of the test data each time, wherein a programming and erasing value indicates that a block has been written and erased once.
[0101] In one embodiment of the present invention, first, in the storage device 20, the control processing unit 21 can count the program erase cycle (PEC) of the plurality of blocks 270, and these program erase cycle values are stored in the table block of the firmware of the flash memory 27. Secondly, the test board 10 writes host data of XGB test data into the storage device 20 for testing multiple times, and the amount of test data written by the test board 10 to the flash memory 27 of the storage device 20 each time can be recorded as After each time the host data of the test data amount is written to the storage device 20 , the programming and erasing values of the plurality of blocks 270 in the flash memory 27 are recorded.
[0102] Step S50: According to the ratio of the host data of a test data volume to the corresponding programming and erasing value, the total data volume of the host data written corresponding to the maximum programming and erasing value of the flash memory is counted.
[0103] In one embodiment of the present invention, the control processing unit 21 can calculate the host data of a test data amount according to the programming and erasing values of the plurality of blocks 270, and the average value of the programming and erasing values of the plurality of blocks 270 in the corresponding flash memory 27. . Based on the average value of the host data and programming and erasing values of the test data volume The corresponding relationship can be used to calculate the maximum programming and erasing value of flash memory 27 Corresponding to the total amount of data written to the host.
[0104] See also Figure 6 In one embodiment of the present invention, step S10 may include step S110 and step S120. Step S110 may be represented as counting the data volume of the corresponding host data to be read and / or to be written within a certain cycle time. Step S120 may be represented as adjusting the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to the ratio between the data volume of the host data to be read and the data volume of the host data to be written within a certain cycle time.
[0105] Specifically, Figure 3 As shown, for example, if the cycle time is 1 second (s), the control processing unit 21 analyzes the read and write instructions within the 1 second cycle time, and can confirm the data volume of the host data to be read / written corresponding to the read and write instructions. The control processing unit 21 performs statistics through the logic processing unit 24, and adjusts the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26 according to the ratio between the data volumes of the host data to be read / written.
[0106] It can be seen that by setting the cycle time to 1 second, the control processing unit 21 can periodically dynamically adjust the storage space of the read cache area 260 and the write cache area 261 in the cache unit 26. The advantage is that when the storage device 20 is in a situation where there are more writes than reads or more reads than writes, the storage space of the read cache area 260 and the write cache area 261 can be maximized, and the number of programming and erasing times of the block 270 can be effectively reduced.
[0107] See also Figure 6 In one embodiment of the present invention, in step S20, for the host data to be written, the logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on block 270, so that part of the host data to be written has a continuous physical address, and the rest of the host data to be written has another continuous physical address.
[0108] Specifically, the control processing unit 21 makes the logical addresses of the host data to be written correspond to the physical addresses of the idle pages in the block 270 in a sequential order. Figure 5In the example, the page numbered 5 stores host data to be read, and the pages numbered 1, 2, 3, 4, 6, 7, ... 64 do not store host data, so the pages numbered 1, 2, 3, 4, 6, 7, ... 64 are free pages. The host data stored on the pages numbered 1, 2, 3, 4 have a continuous physical address, and the host data stored on the pages numbered 6, 7, 8, 9, 10, ... 42 have another continuous physical address. Since the host data is only written once to the page with the same physical address, there is no need to erase block 270, and the program erase cycle (PEC) of the corresponding block 270 does not increase, which essentially guarantees the service life of the block 270.
[0109] See also Figure 6 In one embodiment of the present invention, in step S20, for the host data to be read and to be written, the block 270 corresponding to the host data to be read is obtained and recorded as the target block 270, and the logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on the target block 270, so that the host data to be read and to be written have continuous physical addresses.
[0110] Specifically, the block 270 corresponding to the host data to be read is obtained and recorded as the target block 270. On the target block 270, the host data to be read is stored on the page numbered 5, and the pages numbered 1, 2, 3, 4, 6, 7, ... 64 do not store host data, so the pages numbered 1, 2, 3, 4, 6, 7, ... 64 are free pages. The logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on the target block 270. The host data to be read is stored on the page numbered 5, and the host data to be written is stored on the pages numbered 1, 2, 3, 4, 6, 7, 8, 9, 10, ... 42, so the host data to be read and to be written have continuous physical addresses.
[0111] In summary, the present invention proposes a storage device and a data processing method thereof, which can improve the use efficiency of the cache unit read and write operations by dynamically adjusting the storage space of the read cache area and the write cache area in the cache unit. In addition, the small file data is rounded off to form large file data and written to the continuous blank pages of the block, which reduces the number of garbage collections for invalid data, that is, reduces the number of programming and erasing times of the blocks in the flash memory, and improves the data storage capacity of the flash memory for valid data.
[0112] 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: Flash memory, including multiple blocks, for storing host data; A main controller is electrically connected to the flash memory, and the main controller includes: A cache unit, used to cache host data to be read and / or written; A control processing unit, configured to adjust the storage space of the read cache area and the write cache area in the cache unit according to the amount of host data to be read and / or written, and to transmit the host data through the cache unit and the flash memory; The control processing unit configures the mapping information of the logical address and the physical address of the host data to be written, so that the host data to be written has a continuous physical address; The control processing unit writes the same amount of host data of the test data to the flash memory for multiple times, and after each writing of the host data of the test data, records the programming and erasing values of multiple blocks in the flash memory, wherein one programming and erasing value indicates that a certain block has been written and erased once; According to the ratio of the host data of a test data volume to the corresponding programming and erasing value, the total data volume of the host data written corresponding to the maximum programming and erasing value of the flash memory is counted.
2. The storage device according to claim 1, characterized in that The control processing unit counts the data volume of the corresponding host data to be read and / or written within a certain cycle time; When the ratio between the amount of host data to be read and the amount of host data to be written is greater than 1, reducing the storage space of the write cache area, and adding the reduced storage space of the write cache area to the storage space of the read cache area; When the ratio between the amount of host data to be read and the amount of host data to be written is less than 1, the storage space of the read cache area is reduced, and the reduced storage space of the read cache area is added to the storage space of the write cache area.
3. The storage device according to claim 1, characterized in that: The control processing unit corresponds the logical addresses of the host data to be written to the physical addresses of the free pages in sequence on the block, so that part of the host data to be written has a continuous physical address, and the rest of the host data to be written has another continuous physical address.
4. The storage device according to claim 3, characterized in that: The control processing unit obtains the block corresponding to the host data to be read and the host data to be written and records it as a target block, and respectively corresponds the logical address of the host data to be written to the physical addresses of the free pages in sequence on the target block, so that the host data to be read and the host data to be written have continuous physical addresses.
5. The storage device according to claim 1, characterized in that: The control processing unit transmits the host data in the read cache area to the host end when the read cache area in the cache unit is full, or stores the host data in the write cache area into the flash memory when the write cache area in the cache unit is full.
6. The storage device according to claim 1, characterized in that: The total amount of data written to the host corresponding to the maximum programming and erasing value of the flash memory is: ,satisfy: ; in, is the maximum programming and erasing value of the flash memory, obtained from the specification parameter information of the flash memory, is the amount of test data written by the control processing unit to the flash memory each time, It is the average value of the programming and erasing values of multiple blocks in the flash memory corresponding to the host data of one test data volume.
7. A data processing method for a storage device, characterized in that: include: Adjusting storage space of a read cache area and a write cache area in a cache unit according to host data to be read and / or written; The host data to be written is configured with mapping information of a logical address and a physical address so that the host data to be written has a continuous physical address; Transmitting the host data to be read in the flash memory to the host through the cache unit; Writing the same amount of host data of the test data to the flash memory for multiple times, and recording the programming and erasing values of multiple blocks in the flash memory after each writing of the host data of the test data, wherein one programming and erasing value indicates that a certain block has been written and erased once; According to the ratio of the host data of a test data volume to the corresponding programming and erasing value, the total data volume of the host data written corresponding to the maximum programming and erasing value of the flash memory is counted.
8. The data processing method of the storage device according to claim 7, characterized in that: The step of adjusting the storage space of the read cache area and the write cache area in the cache unit according to the host data to be read and / or to be written includes: In a certain cycle time, count the data volume of the corresponding host data to be read and / or to be written; During the certain cycle time, storage spaces of the read cache area and the write cache area in the cache unit are adjusted according to a ratio between the amount of host data to be read and the amount of host data to be written.
9. The data processing method of the storage device according to claim 7, characterized in that: For host data to be written, the logical addresses of the host data to be written are respectively corresponded to the physical addresses of the free pages in sequence on the block, so that part of the host data to be written has a continuous physical address, and the rest of the host data to be written has another continuous physical address.
10. The data processing method of the storage device according to claim 9, characterized in that: For host data to be read and written, the block corresponding to the host data to be read is obtained and recorded as the target block, and the logical address of the host data to be written is respectively corresponded to the physical addresses of the free pages in sequence on the target block, so that the host data to be read and written have continuous physical addresses.
