Data management method of storage device, storage device and storage medium
By defining storage block areas in the solid-state drive system and using partition data from a location mapping table to determine the amount of valid data, garbage collection is performed only on valid data, thus solving the problem of low garbage collection efficiency in existing technologies and achieving more efficient data management.
Patent Information
- Application Number
- CN202411296361.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2026-03-17
AI Technical Summary
Existing solid-state drive (SSD) systems employ an inefficient strategy of reading the physical logical location mapping table during garbage collection, especially since reading all entries, including invalid data, leads to wasted time and reduced efficiency.
By defining storage block areas in the storage device and using the partition data of the location mapping table to determine the amount of valid data, garbage collection operations are performed only on valid data, avoiding reading invalid data and improving garbage collection efficiency.
It improves the efficiency of waste recycling operations, reduces processing time, and ensures that all mapping tables do not need to be reread during power outage recovery, saving processing time.
Smart Images

Figure CN121680713A_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed in this application relate to the field of solid-state drive technology, and more specifically, to a data management method for a storage device, a storage device, and a storage medium. Background Technology
[0002] During the garbage collection (GC) operation of a solid-state drive (SSD) system, the physical logical location (PLO) mapping table needs to be read. The strategy for reading the PLO mapping table is usually based on the sequence number of the PLO mapping table, for example, starting from 0, until the last PLO mapping table is read. Even if some PLO mapping tables may not contain valid data, they will still be read and all entries will be compared, resulting in wasted time and affecting the overall efficiency of garbage collection. Summary of the Invention
[0003] According to embodiments of this application, this application proposes a data management method for a storage device, a storage device, and a storage medium to solve the above-mentioned problems.
[0004] The first aspect of this application discloses a data management method for a storage device, the storage device including multiple storage blocks and defining multiple location mapping tables, wherein each location mapping table records the location mapping relationship of a storage block group among the multiple storage blocks, and at least one location mapping table in the multiple location mapping tables is marked as a storage block area, the method including: obtaining partition data of the storage block area corresponding to the at least one location mapping table, wherein the partition data of each storage block area is used to characterize the effective data volume of the storage block area; and performing a data garbage collection operation on the multiple storage blocks based on the partition data of the storage block area corresponding to the at least one location mapping table.
[0005] In some embodiments, obtaining partition data of a storage block area corresponding to the at least one location mapping table includes: determining a count value corresponding to a storage block area; in response to adding new write data to the storage block area, incrementing the count value corresponding to the storage block area by a first preset value; or in response to adding invalid data to the storage block area, incrementing the count value corresponding to the storage block area by a second preset value.
[0006] In some embodiments, when the count value corresponding to the storage block area is a third preset value, there is no valid data in the storage block area.
[0007] In some embodiments, performing data garbage collection on the plurality of storage blocks based on the partition data of the storage block area corresponding to the at least one location mapping table includes: determining whether the partition data of the current storage block area meets a preset condition; in response to the partition data of the storage block area not meeting the preset condition, performing data garbage collection on the storage blocks in the storage block area; in response to the partition data of the storage block area meeting the preset condition, determining whether the partition data of the next storage block area meets the preset condition, until the data garbage collection operation on the plurality of storage blocks is completed.
[0008] In some embodiments, the preset condition is that the count value of the storage block area is a third preset value.
[0009] In some embodiments, performing a data garbage collection operation on the storage blocks in the storage block area includes: reading at least one location mapping table corresponding to the storage block area for comparison to determine information of valid data; and rewriting the valid data.
[0010] In some embodiments, in response to completing the data garbage collection operation on the storage blocks in the storage block area, the count value of the storage block area is set to a third preset value.
[0011] In some embodiments, a group of storage blocks recorded in one of the plurality of location mapping tables is marked as a storage block area.
[0012] The second aspect of this application discloses a storage device including a memory and a processor coupled to each other, wherein the processor is configured to execute program instructions stored in the memory to implement the data management method of the storage device described in the first aspect.
[0013] The third aspect of this application discloses a non-volatile computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implement the data management method of the storage device described in the first aspect.
[0014] The beneficial effects of this application are as follows: the storage device includes multiple storage blocks and defines multiple location mapping tables, wherein each location mapping table records the location mapping relationship of a storage block group among the multiple storage blocks, and at least one location mapping table in the multiple location mapping tables records a storage block group as a storage block area. Furthermore, by obtaining the partition data of the storage block area corresponding to at least one location mapping table, wherein the partition data of each storage block area is used to characterize the effective data volume of the storage block area, data garbage collection operation is performed on multiple storage blocks using the partition data of the storage block area corresponding to at least one location mapping table, thereby improving the efficiency of garbage collection operation. Attached Figure Description
[0015] The present application will be further described below with reference to the accompanying drawings and embodiments. In the drawings:
[0016] Figure 1 This is a schematic diagram of the structure of a storage device according to an embodiment of this application;
[0017] Figure 2 This is a flowchart illustrating a data management method for a storage device according to an embodiment of this application;
[0018] Figure 3 This is a schematic diagram of the structure of a storage device according to another embodiment of this application;
[0019] Figure 4 This is a schematic flowchart of a data management method for a storage device according to an embodiment of this application;
[0020] Figure 5 This is a schematic diagram of the structure of a storage device according to an embodiment of this application;
[0021] Figure 6 This is a schematic diagram of the structure of a non-volatile computer-readable storage medium according to an embodiment of this application. Detailed Implementation
[0022] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] In this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Additionally, the character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, "many" in this application means two or more. Moreover, the term "at least one" in this application means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C. Furthermore, the terms "first," "second," and "third" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features.
[0024] Currently, flash memory is used to store user data. A flash memory physical block contains multiple flash memory pages. Flash memory has the characteristic of needing to be erased before writing, and the unit of writing is a page, while the smallest unit of erasing is a block. During flash memory use, as users update data, some data in the pages that have been written to the flash memory becomes invalid. When the amount of invalid data increases, the FTL (Flash Translation Layer) will initiate a garbage collection algorithm to move the valid data in the flash memory block to a new flash memory block, thereby freeing up more available flash memory blocks.
[0025] Garbage collection algorithms select blocks with smaller amounts of valid data from all logical blocks and sequentially read all physical-to-logical tables (P2L Tables) within those blocks. These P2L Tables are then compared to logical-to-physical tables (L2PTables) to determine data validity. If valid, the data is read from the flash memory physical block, transferred to DRAM (Dynamic Random Access Memory), and rewritten to a new flash memory block. The strategy for reading P2LTables is based on their sequence number, starting from 0 (the first) until the last P2L Table is read. However, even if some P2LTables lack valid data, the algorithm still reads and compares all entries, wasting time and impacting overall garbage collection efficiency. Furthermore, upon power-up after a power outage, it's impossible to determine how many P2L Tables were processed before the power failure, requiring a restart from the first P2L Table, further affecting garbage collection efficiency.
[0026] Therefore, this application proposes a data management method for a storage device, a storage device, and a storage medium.
[0027] To enable those skilled in the art to better understand the technical solution of this application, the technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Please see Figure 1 , Figure 1This is a schematic diagram of the structure of a storage device according to an embodiment of this application. The storage device 10 includes a plurality of storage blocks 110 and defines a plurality of location mapping tables 120. Each location mapping table 120 records the location mapping relationship of a storage block group 101 among the plurality of storage blocks 110. The storage block group 101 may include a preset number of storage blocks 110. For example, the location mapping table 120 may be a physical-logical location mapping table. The location mapping table 120 records the location mapping relationship of the storage block group 101, that is, a location mapping table 120 records the location mapping relationship from the physical block address (PBA) to the logical block address (LBA) of a preset number of storage blocks 110 in a storage block group 101.
[0029] At least one of the multiple location mapping tables 120 records a group of storage blocks as a storage block area, such as... Figure 1 As shown, there exist location mapping tables P2L_0, P2L_1, P2L_2, P2L_3...P2L_n. Among them, the storage block group recorded in the location mapping table P2L_0 can be marked as a storage block area, the two storage block groups recorded in the location mapping tables P2L_0 and P2L_1 can be marked as a storage block area, and the three storage block groups recorded in the location mapping tables P2L_0, P2L_1, and P2L_2 can be marked as a storage block area. This application does not make specific limitations on this.
[0030] Please see Figure 2 , Figure 2 This is a flowchart illustrating a data management method for a storage device according to an embodiment of this application. The storage device 10 described above can be the executing entity for this method. It should be noted that if substantially the same result is achieved, the method of this application does not necessarily require the storage device 10 to perform the same task. Figure 2 The sequence of processes shown is limited.
[0031] In some possible implementations, this method can be implemented by the processor calling computer-readable instructions stored in memory, such as... Figure 2 As shown, the method may include the following steps:
[0032] S21: Obtain the partition data of the storage block area corresponding to at least one location mapping table, wherein the partition data of each storage block area is used to characterize the effective data volume of the storage block area.
[0033] Obtain partition data of at least one storage block area corresponding to a location mapping table 120, wherein the partition data of each storage block area is used to characterize the effective data volume of the storage block area. For example, the two storage block groups recorded by location mapping tables P2L_0 and P2L_1 are marked as a storage block area R, and the partition data of the storage block area R is obtained. The partition data of the storage block area R can be used to characterize the effective data volume of the storage block area, that is, the number of effective data within the range covered by location mapping tables P2L_0 and P2L_1.
[0034] S22: Based on the partition data of the storage block area corresponding to at least one location mapping table, perform data garbage collection operations on multiple storage blocks.
[0035] Taking the aforementioned storage block area R as an example, based on the partition data of the storage block area corresponding to at least one location mapping table, data garbage collection operations can be performed on multiple storage blocks 110. For example, based on the size of the partition data of storage block area R, data garbage collection operations can be performed on storage blocks 110 within the range covered by location mapping tables P2L_0 and P2L_1. It can be understood that based on the partition data of the storage block area corresponding to at least one location mapping table, data garbage collection operations can be performed on multiple storage blocks.
[0036] In this embodiment, the storage device 10 includes a plurality of storage blocks 110 and defines a plurality of location mapping tables 120. Each location mapping table 120 records the location mapping relationship of a storage block group 101 among the plurality of storage blocks 110, and at least one location mapping table 120 records a storage block group as a storage block area. Further, by obtaining the partition data of the storage block area corresponding to at least one location mapping table 120, wherein the partition data of each storage block area is used to characterize the effective data volume of the storage block area, data garbage collection operation is performed on the plurality of storage blocks using the partition data of the storage block area corresponding to at least one location mapping table, thereby improving the efficiency of the garbage collection operation.
[0037] In some embodiments, a group of storage blocks recorded in one of the multiple location mapping tables is marked as a storage block area.
[0038] Storage device 10 includes multiple storage blocks 110 and defines multiple location mapping tables 120, such as Figure 3 As shown, Figure 3This is a schematic diagram of the structure of a storage device according to another embodiment of this application. The storage device 10 contains location mapping tables P2L_0, P2L_1, P2L_2, P2L_3...P2L_n, and storage block groups 1011, 1012...101n. Each location mapping table 120 records the location mapping relationship of a storage block group 101 among multiple storage blocks 110. For example, location mapping table P2L_0 records storage block group 1011, location mapping table P2L_1 records storage block group 1012... and location mapping table P2L_n records storage block group 101n. Gray storage block 111 represents the storage block corresponding to valid data, and white storage block 112 represents the storage block corresponding to invalid data.
[0039] The storage block group recorded in one of the multiple location mapping tables 120 is marked as a storage block area. That is, the storage block group 1011 recorded in the location mapping table P2L_0 can be marked as a storage block area, the storage block group 1012 recorded in the location mapping table P2L_1 can be marked as another storage block area, and so on. The storage block group 101n recorded in the location mapping table P2L_n can be marked as yet another storage block area. The partition data of each storage block area is used to characterize the number of valid data in the corresponding storage block area.
[0040] At this time, by obtaining the partition data of the storage block area corresponding to a location mapping table 120, and based on the partition data of the storage block area corresponding to a location mapping table 120, data garbage collection operation is performed on multiple storage blocks 110 in the storage block group recorded by a location mapping table 120, thereby realizing the data garbage collection operation on multiple storage blocks 110 recorded by multiple location mapping tables 120.
[0041] In this embodiment, the storage device 10 includes multiple storage blocks 110 and defines multiple location mapping tables 120. Each location mapping table 120 records the location mapping relationship of a storage block group 101 among the multiple storage blocks 110, and the storage block group recorded by one of the multiple location mapping tables 120 is marked as a storage block area. Further, by obtaining the partition data of the storage block area corresponding to a location mapping table 120, wherein the partition data of each storage block area is used to characterize the effective data volume of the storage block area, data garbage collection operation is performed on multiple storage blocks using the partition data of the storage block area corresponding to a location mapping table, thereby improving the efficiency of garbage collection operation.
[0042] In some embodiments, obtaining partition data of a storage block area corresponding to at least one location mapping table 120 includes: determining a count value corresponding to a storage block area; in response to adding new write data to the storage block area, incrementing the count value corresponding to the storage block area by a first preset value; or in response to adding invalid data to the storage block area, incrementing the count value corresponding to the storage block area by a second preset value.
[0043] A count value corresponding to a storage block area is determined, wherein at least one storage block area corresponding to a location mapping table 120 has a corresponding region data value in a preset format. For example, at least one storage block area corresponding to a location mapping table 120 has a corresponding data (region_vtc) to record the number of valid data on the storage block area. Further, in response to the addition of new data to the storage block area, the count value corresponding to the storage block area is incremented by a first preset value, for example, the first preset value is 1, that is, when new data is written to the storage block area, the region_vtc count corresponding to the storage block area is incremented by 1; or in response to the addition of invalid data to the storage block area, the count value corresponding to the storage block area is incremented by a second preset value, for example, the second preset value is -1, that is, when data in the storage block area becomes invalid, the region_vtc count corresponding to the storage block area is decremented by 1.
[0044] In some embodiments, when the count value corresponding to the storage block area is a third preset value, there is no valid data in the storage block area.
[0045] For example, at least one location mapping table 120 has a corresponding data (region_vtc) in the storage block area to record the number of valid data in the storage block area. In response to the addition of new data to the storage block area, the count value of the storage block area is incremented by a first preset value, such as 1, that is, when new data is written to the storage block area, the count value of the region_vtc corresponding to the storage block area is incremented by 1; or in response to the addition of invalid data to the storage block area, the count value of the storage block area is incremented by a second preset value, such as -1, that is, when data in the storage block area becomes invalid, the count value of the region_vtc corresponding to the storage block area is decremented by 1.
[0046] Specifically, when the count value corresponding to the storage block area is a third preset value, there is no valid data in the storage block area. For example, the third preset value can be 0, meaning that when the region_vtc count corresponding to the storage block area is 0, there is no valid data in the storage block area. Figure 3 As shown, there is no valid data in the storage block area corresponding to the location mapping table P2L_2, that is, the count value of the storage block area corresponding to the location mapping table P2L_2 is 0.
[0047] In some embodiments, based on the partition data of the storage block area corresponding to at least one location mapping table, a data garbage collection operation is performed on multiple storage blocks, including: determining whether the partition data of the current storage block area meets a preset condition; in response to the partition data of the storage block area not meeting the preset condition, performing a data garbage collection operation on the storage blocks in the storage block area; in response to the partition data of the storage block area meeting the preset condition, determining whether the partition data of the next storage block area meets the preset condition, until the data garbage collection operation on multiple storage blocks is completed.
[0048] In storage device 10, at least one location mapping table in a plurality of location mapping tables 120 records a group of storage blocks as a storage block area, meaning that there are multiple storage block areas in storage device 10. Partition data of the current storage block area is obtained from these multiple storage block areas. This partition data can be used to characterize the effective data volume of the storage block area. It is determined whether the partition data of the current storage block area meets preset conditions. If the partition data does not meet the preset conditions, a data garbage collection operation is performed on the storage block 110 in that storage block area. If the partition data meets the preset conditions, it is determined whether the partition data of the next storage block area in the plurality of storage block areas meets the preset conditions, until the data garbage collection operation is completed on all storage blocks 110 in storage device 10.
[0049] In this embodiment, it is determined whether the partition data of the current storage block area meets the preset conditions; in response to the partition data of the storage block area not meeting the preset conditions, a data garbage collection operation is performed on the storage block in the storage block area, or in response to the partition data of the storage block area meeting the preset conditions, it is determined whether the partition data of the next storage block area meets the preset conditions, until multiple storage blocks have completed the data garbage collection operation. That is, if the partition data of the current storage block area meets the preset conditions, no further processing is required, and the process can jump to the next storage block area, saving processing time and improving the efficiency of data garbage collection.
[0050] In some embodiments, the preset condition is that the count value of the storage block area is a third preset value.
[0051] For example, storage device 10 contains multiple storage block areas. The partition data of the current storage block area is obtained from these multiple storage block areas. This partition data can be used to characterize the effective data volume of the storage block area. It is determined whether the partition data of the current storage block area meets a preset condition. The preset condition is that the count value of the storage block area is a third preset value, for example, 0. If the partition data of the storage block area does not meet the preset condition, i.e., the count value of the current storage block area is not 0, then a data garbage collection operation is performed on storage block 110 in that storage block area. If the partition data of the storage block area meets the preset condition, i.e., the count value of the current storage block area is 0, then no further processing of the current storage block area is required. The process directly checks whether the partition data of the next storage block area among the multiple storage block areas meets the preset condition, until the data garbage collection operation is completed for multiple storage blocks in storage device 10.
[0052] In this embodiment, it is determined whether the count value of the current storage block area is a third preset value; in response to the count value of the storage block area not being a third preset value, a data garbage collection operation is performed on the storage blocks in the storage block area; or in response to the count value of the storage block area being a third preset value, it is determined whether the count value of the next storage block area is a third preset value, until multiple storage blocks have been processed for data garbage collection. That is, if the count value of the current storage block area is a third preset value, no further processing is required, and the process can jump to the next storage block area, saving processing time and improving the efficiency of data garbage collection.
[0053] In some embodiments, performing a data garbage collection operation on the storage block 110 in the storage block area includes: reading at least one location mapping table corresponding to the storage block area for comparison to determine information of valid data; and rewriting the valid data.
[0054] If the partition data of the storage block area does not meet the preset conditions, that is, there is valid data in the storage block area, then it is necessary to perform a data garbage collection operation on the storage block 110 in the storage block area.
[0055] Taking the example that the partition data of the current storage block area does not meet the preset conditions, for example, if the count value of the current storage block area is not 0, at least one location mapping table corresponding to the current storage block area is read and compared to determine the information of valid data. That is, the logical physical location mapping table of the current storage block area and the corresponding physical logical location mapping table are read and compared to determine the location information of valid data, and then the valid data is read and rewritten into the new storage block.
[0056] In some embodiments, in response to completing a data garbage collection operation on a storage block in the storage block area, the count value of the storage block area is set to a third preset value.
[0057] For example, storage device 10 contains multiple storage block areas. The partition data of the current storage block area is obtained from these multiple storage block areas. This partition data can be used to characterize the amount of valid data in that storage block area. It is determined whether the partition data of the current storage block area meets a preset condition, which is that the count value of the storage block area is a third preset value, for example, 0. If the partition data of the storage block area does not meet the preset condition, i.e., the count value of the current storage block area is not 0, then a data garbage collection operation is performed on storage block 110 in that storage block area. Furthermore, after completing the data garbage collection operation on storage block 110 in that storage block area, the count value of that storage block area is set to the third preset value, i.e., the count value is set to 0. This allows the system to determine whether the current storage block area has completed garbage collection or has no valid data in the event of a power outage and subsequent power-on, thus enabling processing of the next storage block area and saving time.
[0058] To facilitate understanding, an example of a data management method for a storage device in this application embodiment is provided. In the storage device 10, at least one location mapping table 120 records a group of storage blocks as a storage block area, meaning that multiple storage block areas exist in the storage device 10. Figure 4 As shown, Figure 4 This is a flowchart illustrating a data management method for a storage device according to an embodiment of this application. The method involves: acquiring partition data of a first storage block region, where the partition data represents the effective data volume of the corresponding storage block region; determining whether the partition data of the storage block region meets a preset condition, such as a count value of 0 for the storage block region; if the partition data of the storage block region does not meet the preset condition, performing a data garbage collection operation on the storage blocks in that storage block region; if the partition data of the storage block region meets the preset condition, determining whether the judgment of the last storage block region among multiple storage block regions has been completed; if the judgment of the last storage block region among multiple storage block regions has not been completed, acquiring the partition data of the next storage block region among multiple storage block regions to determine whether the partition data of that storage block region meets the preset condition, until the judgment of the last storage block region among multiple storage block regions is completed, thereby performing a data garbage collection operation on the multiple storage blocks 110 in the storage device 10.
[0059] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0060] Please see Figure 5 , Figure 5This is a schematic diagram of the structure of a storage device according to an embodiment of this application. The storage device 50 includes a memory 51 and a processor 52 coupled to each other. The processor 52 is used to execute program instructions stored in the memory 51 to implement the steps of the data management method embodiment of the storage device described above. In a specific implementation scenario, the storage device 50 may include, but is not limited to, a microcomputer or a server.
[0061] Specifically, processor 52 controls itself and memory 51 to implement the steps of the data management method embodiment of the storage device described above. Processor 52 may also be called a CPU (Central Processing Unit), and may be an integrated circuit chip with signal processing capabilities. Processor 52 may also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor. Furthermore, processor 52 may be implemented using integrated circuit chips.
[0062] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a non-volatile computer-readable storage medium according to an embodiment of this application. The non-volatile computer-readable storage medium 60 is used to store a computer program 601. When the computer program 601 is executed by a processor, for example by the aforementioned... Figure 5 When the processor 52 in the embodiment is executed, it is used to implement the steps of the above-described embodiment of the data management method for storage devices.
[0063] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0064] In the several embodiments provided in this application, it should be understood that the disclosed methods and related devices can be implemented in other ways. For example, the related device implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication disconnection shown or discussed may be indirect coupling or communication disconnection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0065] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0066] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0067] Those skilled in the art will readily recognize that numerous modifications and variations can be made to the apparatus and method while maintaining the teachings of this application. Therefore, the above disclosure should be considered limited only by the scope of the appended claims.
Claims
1. A data management method of a storage device, characterized by, The storage device includes a plurality of storage blocks and is defined with a plurality of location mapping tables, wherein each location mapping table records a location mapping relationship of a storage block group in the plurality of storage blocks, a storage block group recorded by at least one of the plurality of location mapping tables is marked as a storage block area, and the method comprises: obtaining partition data of a storage block area corresponding to the at least one location mapping table, wherein the partition data of each storage block area is used to represent an effective data amount of the storage block area; performing a data garbage collection operation on the plurality of storage blocks based on the partition data of the storage block area corresponding to the at least one location mapping table.
2. The method of claim 1, wherein, Obtaining the partition data of the storage block area corresponding to the at least one location mapping table comprises: determining a count value corresponding to a storage block area; in response to newly writing data in the storage block area, the count value corresponding to the storage block area is added by a first preset value; or in response to newly writing invalid data in the storage block area, the count value corresponding to the storage block area is added by a second preset value.
3. The method of claim 2, wherein, When the count value corresponding to the storage block area is a third preset value, there is no valid data in the storage block area.
4. The method of claim 1, wherein, The method for performing a data garbage collection operation on the plurality of storage blocks based on the partition data of the storage block area corresponding to the at least one location mapping table comprises: determining whether the partition data of the current storage block area satisfies a preset condition; in response to the partition data of the storage block area not satisfying the preset condition, performing a data garbage collection operation on the storage blocks in the storage block area; in response to the partition data of the storage block area satisfying the preset condition, determining whether the partition data of the next storage block area satisfies a preset condition, until the data garbage collection operation on the plurality of storage blocks is completed.
5. The method of claim 4, wherein, The preset condition is that the count value of the storage block area is the third preset value.
6. The method of claim 4, wherein, The method for performing a data garbage collection operation on the storage blocks in the storage block area comprises: reading at least one location mapping table corresponding to the storage block area to compare and determine information of valid data; re-writing the valid data.
7. The method of claim 6, wherein, Further comprising: in response to completing the data garbage collection operation on the storage blocks in the storage block area, setting the count value of the storage block area to the third preset value.
8. The method according to any one of claims 1-7, characterized in that, The storage block group recorded by one of the plurality of location mapping tables is marked as a storage block area.
9. A storage device, comprising: The storage device comprises a memory and a processor coupled to each other, and the processor is configured to execute program instructions stored in the memory to implement the data management method of the storage device according to any one of claims 1 to 8.
10. A non-transitory computer readable storage medium having stored thereon program instructions, the program instructions comprising instructions for causing a processor to: 10 5 perform the method of any one of claims 1-9. 10 6 The program instructions are executed by the processor to implement the data management method of the storage device according to any one of claims 1 to 8.
Citation Information
Patent Citations
Scheme to improve efficiency of garbage collection in cached flash translation layer
CN111902806A
Data recovery method of storage device, terminal equipment and storage medium
CN116263641A
Implementation method and device for improving garbage collection efficiency of mapping table and computer equipment
CN116880766A