Garbage collection method, device, equipment and medium suitable for FDP
By performing garbage collection in the SSD based on round-robin judgment and flow control ratio using the RUH linked list, the problems of write amplification and random write performance impact in FDP are solved, thereby improving storage space utilization and system stability.
Patent Information
- Application Number
- CN202510199669.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-02-21
AI Technical Summary
In existing technologies, write amplification and random write performance are easily affected during the garbage collection process of FDP, resulting in low storage space utilization and difficulty in garbage collection, which affects system stability.
When the number of free virtual blocks in the SSD meets the preset water level condition, the number of valid data frames is judged in turn based on the RUH linked list, and garbage collection is performed using the flow control ratio until the preset condition is met, thus optimizing the garbage collection process.
It improves the flexibility and efficiency of garbage collection, reduces unnecessary resource consumption, optimizes storage space utilization, extends the lifespan of SSDs, and maintains system stability.
Smart Images

Figure CN120123259B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of storage, and in particular to a garbage collection method and device suitable for FDP, equipment and medium. BACKGROUND
[0002] If an SSD (Solid State Drive) supports FDP (Flexible Data Placement), there will be many RUHs (Reclaim Unit Handle) in the same reclaim group. For the RUHs that are continuously isolated, it is required that the reclaim unit data of different RUHs cannot be mixed into the same reclaim unit during the garbage collection process.
[0003] In the related art, a common way is to divide the garbage collection into multiple streams, and the data of each stream is only reclaimed by the garbage collection manager of the stream; or a virtual address can be established according to the storage parameters of the SSD, and then the corresponding mapping relationship is obtained, and during garbage collection, data migration is performed according to the mapping relationship.
[0004] However, in the related art, the garbage collection is divided into multiple streams, and because many blocks are opened at the same time, the water level line is high during the reclaiming, thereby affecting the write amplification and random write performance; the garbage collection is performed according to the virtual address established according to the storage parameters of the SSD, and in the case that the address space is large or the mapping relationship changes frequently, the overhead of establishing and maintaining the mapping relationship is large, which leads to the problem of memory fragmentation, reduces the utilization rate of the storage space, increases the difficulty of garbage collection, and needs to be improved. SUMMARY
[0005] The present application provides a garbage collection method and device suitable for FDP, equipment and medium, to at least solve the technical problems in the related art that the performance of write reduction, write amplification and random write is easily affected, the overhead is large, the utilization rate of the storage space is low, the difficulty of garbage collection is large, and it is not conducive to maintaining and maintaining the stability of the system.
[0006] The application provides a garbage collection method suitable for FDP, comprising: in the case that FDP is started and the number of idle virtual blocks in an SSD disk meets a preset garbage collection water level condition, based on at least one RUH chain table in the SSD disk, whether a first source number of source virtual blocks corresponding to at least one low water level virtual block of effective data frame number in the at least one RUH chain table is greater than a preset number is determined in turn; if the first source number is greater than the preset number, based on the low water level virtual block of effective data frame number, garbage collection is initiated on at least one source virtual block in at least one RUH by using a flow control ratio until a first destination number of destination virtual blocks meets a first preset destination recovery condition, so as to obtain a first garbage collection result of the SSD disk; if the first source number is less than or equal to the preset number, a second source number of source virtual blocks in a low water level virtual block list of effective data frame number corresponding to the at least one RUH is counted based on the low water level virtual block of effective data frame number, and when the second source number is greater than a second destination number of the destination virtual blocks, garbage collection is initiated on the at least one source virtual block by using the flow control ratio until the second destination number meets a second preset destination recovery condition and / or the at least one source virtual block meets a preset source recovery condition, so as to obtain a second garbage collection result of the SSD disk.
[0007] The application also provides a garbage collection device suitable for FDP, comprising: a first judgment module, configured to, in the case that FDP is started and the number of idle virtual blocks in an SSD disk meets a preset garbage collection water level condition, based on at least one RUH chain table in the SSD disk, determine whether a first source number of source virtual blocks corresponding to at least one low water level virtual block of effective data frame number in the at least one RUH chain table is greater than a preset number in turn; a first generation module, configured to, when the first source number is greater than the preset number, based on the low water level virtual block of effective data frame number, initiate garbage collection on at least one source virtual block in at least one RUH by using a flow control ratio until a first destination number of destination virtual blocks meets a first preset destination recovery condition, so as to obtain a first garbage collection result of the SSD disk; and a second generation module, configured to, when the first source number is less than or equal to the preset number, count a second source number of source virtual blocks in a low water level virtual block list of effective data frame number corresponding to the at least one RUH based on the low water level virtual block of effective data frame number, and when the second source number is greater than a second destination number of the destination virtual blocks, initiate garbage collection on the at least one source virtual block by using the flow control ratio until the second destination number meets a second preset destination recovery condition and / or the at least one source virtual block meets a preset source recovery condition, so as to obtain a second garbage collection result of the SSD disk.
[0008] The application further provides an electronic device, comprising a memory for storing a computer program, and a processor for executing the computer program to implement the steps of any of the garbage collection methods for FDP.
[0009] The application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the steps of any of the garbage collection methods for FDP.
[0010] The application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of any of the garbage collection methods for FDP.
[0011] According to the application, when the FDP is started and the number of idle virtual blocks in the SSD disk meets a certain garbage collection water level condition, the first source number of the source virtual block corresponding to the low water level virtual block with the number of valid data frames is determined by turns based on the RUH linked list, and when the first source number is greater than a certain preset number, garbage collection is performed by using the flow control ratio until a first certain purpose recovery condition is met, and a first garbage collection result is obtained; and when the first source number is less than or equal to the certain preset number, the second source number of the source virtual block is counted, and when the second source number is greater than a second purpose number, garbage collection is performed by using the flow control ratio until a second certain purpose recovery condition is met and / or the source virtual block meets a certain source recovery condition, and a second garbage collection result is obtained. Therefore, the technical problems that the performance of write reduction, write amplification and random write is easily affected, the overhead is large, the utilization rate of the storage space is low, the difficulty of garbage collection is large, and the stability of the system is not conducive to maintaining and keeping can be solved, and the technical effects that garbage collection is started at an appropriate time by using the FDP, the space that is no longer needed is released, only the source virtual block that really needs to be recovered is operated, unnecessary resource consumption is reduced, and dynamic adjustment is made according to the number of the source virtual block and the destination virtual block, so that garbage collection is more flexible and efficient. BRIEF DESCRIPTION OF DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creating laborious work.
[0013] Figure 1 A flowchart of a garbage collection method for FDP provided by an embodiment of the application;
[0014] Figure 2 A block diagram of joining a linked list provided by an embodiment of the application;
[0015] Figure 3 A block diagram of a source virtual block and a destination virtual block is provided for an embodiment of the present application.
[0016] Figure 4 A flowchart of inserting a valid data frame number low water mark virtual block list is provided for an embodiment of the present application.
[0017] Figure 5 A flowchart of garbage collection is provided for an embodiment of the present application.
[0018] Figure 6 A block diagram of a garbage collection device for FDP is provided for an embodiment of the present application.
[0019] Reference signs:
[0020] Wherein, 10 - a garbage collection device for FDP; 100 - a first judging module, 200 - a first generating module, 300 - a second generating module. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, any other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0022] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms “first”, “second” and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0023] In order to make the skilled in the art better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0024] The embodiments of the present application provide a garbage collection method for FDP, and the method is described in detail in combination with the execution flow of the garbage collection method for FDP.
[0025] Specifically, Figure 1 A flowchart of a garbage collection method for FDP is provided according to an embodiment of the present application.
[0026] AsFigure 1 As shown, the garbage collection method applicable to the FDP includes the following steps:
[0027] In step S101, in the case that the FDP is started and the number of idle virtual blocks in the SSD disk meets the preset garbage collection water line condition, based on at least one RUH linked list in the SSD disk, it is determined in turn whether the first source number of the source virtual block corresponding to the at least one valid data frame number low water virtual block in the at least one RUH linked list is greater than the preset number.
[0028] It can be understood that in the embodiments of the present application, the FDP can be used to optimize the data placement and garbage collection efficiency of the SSD. The garbage collection of the SSD is to recycle the blocks where invalid data is located, and to erase them for reuse. Further, in the embodiments of the present application, when the number of idle virtual blocks in the SSD disk meets a certain garbage collection water line condition, garbage collection is initiated. The certain garbage collection water line condition can be set by those skilled in the art according to actual conditions, and the present application does not make specific limitations.
[0029] In addition, in the embodiments of the present application, the RUH linked list can be a structure of a certain management block, or a list of a certain maintenance block to be recycled, and the specific settings can be made by those skilled in the art according to actual conditions, and the present application does not make specific limitations. Each RUH linked list can correspond to different block states or attributes, such as blocks of different wear degrees or blocks of different priorities. The at least one RUH linked list can include one RUH linked list or multiple RUH linked lists, and the specific settings can be made by those skilled in the art according to actual conditions, and the present application does not make specific limitations.
[0030] In addition, it should be noted that the embodiments of the present application require more accurate estimation of the reserved space, so before garbage collection, the replacement of virtual block bad blocks can be performed, that is, when a certain block in a virtual block becomes a bad block, a block of the same lun and the same plane is found in the invalid virtual block to fill it. Virtual blocks that cannot be filled will be marked as invalid virtual blocks, and the number of blocks of all virtual blocks is sufficient. Because the computing power used in the embodiments of the present application is small, more accurate estimation of the reserved space is required. If there is no virtual block bad block replacement strategy, the average value can be used for estimation, but the selection accuracy will be affected.
[0031] As a possible implementation manner, the embodiment of the present application can recycle the space of the idle virtual block when the FDP is opened and there are enough idle virtual blocks in the SSD disk, and a certain garbage collection water level condition is met, so as to be reallocated to new data writing. Specifically, the embodiment of the present application can first determine the first source quantity of the source virtual block corresponding to the effective data frame quantity low water level virtual block according to the effective data frame quantity low water level virtual block in the RUH linked list in the SSD disk, and then alternately judge whether the first source quantity is greater than a certain quantity, and take different measures in different cases. The certain quantity can be set by a person skilled in the art according to the actual situation, and the present application does not make specific limitations.
[0032] For example, when the FDP is opened and the number of idle virtual blocks in the SSD disk is detected to be 20, which meets a certain garbage collection water level condition, when it is detected that there are 16 effective data frame quantity low water level virtual blocks greater than a certain quantity (such as 15, which is not limited by the present application) in the RUH linked list A, garbage collection can be triggered immediately, and the block is erased after migrating the effective data. Then, the linked list B is polled, and if there are only 3 effective data frame quantity low water level virtual blocks, it is skipped to the next linked list to ensure efficient resource utilization.
[0033] The embodiment of the present application can more effectively identify which blocks contain less effective data by monitoring the low water level virtual blocks in the RUH linked list, so as to preferentially perform garbage collection on these blocks, reduce the data migration amount in the garbage collection process, improve the overall efficiency, and release the free space in the SSD by timely garbage collection, reduce the fragmentation, and thus optimize the read-write performance, reduce the read-write errors and data loss risk caused by data fragmentation, and can more effectively utilize the storage space of the SSD.
[0034] Optionally, in an embodiment of the present application, before alternately judging whether the first source quantity of the source virtual block corresponding to the at least one effective data frame quantity low water level virtual block in the at least one RUH linked list in the SSD disk is greater than a preset quantity, it further includes: calculating the data frame sum of the used virtual block according to the number of the used virtual block in the SSD disk and the data frame quantity corresponding to the used virtual block; calculating the effective data frame sum of the used virtual block according to the amount of data written in the SSD disk; calculating the effective data frame occupancy average of the used virtual block based on the data frame sum and the effective data frame sum; obtaining the effective data frame quantity low water level virtual block based on the effective data frame occupancy average and the used virtual block; and constructing the used virtual block linked list corresponding to the used virtual block based on the effective data frame quantity low water level virtual block.
[0035] As a possible implementation, before judging whether the first source quantity of the low water level virtual block corresponding to the source virtual block is greater than the preset quantity, the embodiment of the application can first calculate the data frame total sum according to the quantity of the used virtual block and the data frame quantity corresponding to the used virtual block, then calculate the effective data frame total sum according to the written data quantity, and then calculate the effective data frame occupancy average value of the used virtual block, and obtain the low water level virtual block of the effective data frame quantity by using the effective data frame occupancy average value, and then construct the used virtual block linked list.
[0036] Among them, the total amount of data frames in one block of the embodiment of the application can be understood as including the number of effective data frames and the total amount of invalid data frames; the total amount of data frames added by multiple can be understood as the data frame total sum; the total amount of effective data frames added by multiple can be understood as the effective data frame total sum, which is not specifically limited by the application.
[0037] For example, in the embodiment of the application, since the number of all virtual blocks is fixed, the number of data frames in each virtual block is also fixed, and then the data frame total sum can be calculated according to the number of used virtual blocks and the number of data frames in each virtual block, which can be but not limited to:
[0038] Data frame total sum = number of used virtual blocks * number of data frames in each virtual block,
[0039] Further, the embodiment of the application can calculate the effective data frame total sum according to the written data quantity, so as to calculate the effective data frame occupancy average value, which can be but not limited to:
[0040] Effective data frame occupancy average value = effective data frame total sum / data frame total sum,
[0041] As can be seen from the above formula, the effective data frame occupancy of the used virtual block in the embodiment of the application is necessarily lower than the average value, and these virtual blocks lower than the average value are recorded as the low water level virtual block of the effective data frame quantity, and further, as shown in Figure 2 The embodiment of the application uses a timer to poll and check all virtual blocks of the SSD full disk, and puts all the low water level virtual blocks of the effective data frame quantity into the corresponding RUH linked list to obtain the used virtual block linked list.
[0042] Among them, the total time of one round of polling of the entire virtual block linked list by the timer should be less than the time of filling a destination virtual block. It can be understood that, in the case of continuous circulation, the time of one round is not too long, and if the destination virtual block is not filled, there is enough time to return. As long as the current RUH has enough recyclable amount in the next round, recycling can be performed, and this virtual block will not waste space, thereby optimizing the performance of the SSD and improving the overall resource utilization.
[0043] The embodiment of the present application can calculate the average of the effective data frame occupancy rate, more accurately identify which virtual blocks contain less effective data, and thus preferentially perform garbage collection on these blocks, thereby reducing unnecessary data migration, improving the efficiency and pertinence of garbage collection, optimizing the performance of the SSD, prolonging the service life of the SSD, and improving the overall resource utilization.
[0044] Optionally, in an embodiment of the present application, before determining whether the first source number of the source virtual block corresponding to the at least one effective data frame low-water-level virtual block in the at least one RUH linked list in the SSD disk is greater than the preset number by taking turns, based on the at least one virtual block and the average of the effective data frame occupancy rate in the SSD disk, an RUH linked list corresponding to the at least one virtual block is generated.
[0045] In actual execution, the embodiment of the present application can add an RUH information in the structure of the virtual block information in the SSD disk when the FDP is opened. When each virtual block is opened, the RUH in which the virtual block is located is recorded in the virtual block information, and a linked list header is established for each RUH, and then an RUH linked list corresponding to each virtual block is generated based on the average of the effective data frame occupancy rate.
[0046] The embodiment of the present application can make the data management in the SSD disk more orderly and efficient by generating the RUH linked list, and make the generated RUH linked list ensure the reasonable allocation and utilization of storage resources by the average of the effective data frame occupancy rate, thereby helping to avoid the waste of storage space, improve the overall storage efficiency of the SSD disk, reduce the data access delay, and improve the response speed of the system.
[0047] Optionally, in an embodiment of the present application, before initiating garbage collection on the at least one source virtual block by using the flow control ratio, the third source number of the source virtual block and the third destination number of the destination virtual block when garbage collection is performed are calculated based on the effective data frame low-water-level virtual block; the initial flow control ratio of the at least one RUH for garbage collection is calculated based on the third source number and the third destination number; and the initial flow control ratio is recalculated by using the actual garbage collection write proportion based on the sum of the write data of the destination virtual block and the actual effective data frame of the source virtual block, to obtain the flow control ratio.
[0048] In some embodiments, the embodiment of the present application can calculate the third source number of the source virtual block and the third destination number of the destination virtual block when garbage collection is performed before initiating garbage collection, and then calculate the initial flow control ratio, and further recalculate the initial flow control ratio to obtain the flow control ratio.
[0049] Exemplarily, in order to prevent the idle virtual blocks from being exhausted in the garbage collection process, the embodiments of the present application need to control the flow of garbage collection write and host write, ensure that the garbage collection write and the host write are performed at a certain ratio, and ensure that the host write has the maximum performance without exhausting the blocks, so as to ensure the performance of the SSD, increase the performance stability, and prolong the life of the disk.
[0050] Further, when the garbage collection is started in each RUH, the embodiments of the present application can calculate the total number of virtual blocks to be recycled (which can be understood as the third source number of source virtual blocks), that is, know the minimum number of releasable virtual blocks in this recycling process (which can be understood as the third source number-third destination number) and the maximum number of virtual blocks required to carry these data (which can be understood as the third destination number of destination virtual blocks), and then calculate an initial flow control ratio (which can be understood as the ratio of the number of garbage collection writes to the total number of writes). The calculation formula can be, but is not limited to:
[0051] The number of garbage collection writes / the total number of writes=the third destination number / the third source number,
[0052] Among them, the total number of writes of the embodiments of the present application=the number of host writes+the number of garbage collection writes.
[0053] In combination with Figure 3 As shown in the figure, when the four source virtual blocks are recycled to three destination virtual blocks, the ratio of the host write and the garbage collection should be 1:3, and then the allocation ratio of the garbage collection and the host write can be calculated. It can be understood that the embodiments of the present application can fix the amount of data written each time, and must have how much host write and how much garbage collection write. When one side reaches the limit, the other side needs to be waited for, so as to ensure that the write performance is relatively stable.
[0054] In addition, it should be noted that in the garbage collection process, the host write may also move the data in the source virtual block, so when a certain amount of data is written to each destination virtual block, the actual data frame sum of the current destination virtual block and the current source virtual block is checked. If the actual data frame sum decreases to a certain extent, the ratio of the garbage collection write can be appropriately reduced, the initial flow control ratio is recalculated, and then the flow control ratio is obtained.
[0055] Optionally, in an embodiment of the present application, the initial flow control ratio is recalculated based on the write data of the destination virtual block and the total actual valid data frame of the source virtual block and the actual garbage collection write proportion, including: judging whether the number of idle virtual blocks is located in a first condition interval in the preset garbage collection water level condition; if the number of idle virtual blocks is located in the first condition interval, recalculating the initial flow control ratio based on the write data, the total actual valid data frame and the actual garbage collection write proportion by using a first calculation condition; if the number of idle virtual blocks is not located in the first condition interval, judging whether the number of idle virtual blocks is located in a second condition interval in the preset garbage collection water level condition; if the number of idle virtual blocks is located in the second condition interval, recalculating the initial flow control ratio based on the write data, the total actual valid data frame and the actual garbage collection write proportion by using a second calculation condition; if the number of idle virtual blocks is not located in the second condition interval, judging whether the number of idle virtual blocks is located in a third condition interval in the preset garbage collection water level condition; if the number of idle virtual blocks is located in the third condition interval, recalculating the initial flow control ratio based on the write data, the total actual valid data frame and the actual garbage collection write proportion by using a third calculation condition, wherein the first condition interval, the second condition interval and the third condition interval are mutually exclusive, and the union is the preset garbage collection water level condition.
[0056] It can be understood that the embodiments of the present application can divide a certain garbage collection water level condition into a first condition interval, a second condition interval and a third condition interval, and the three condition intervals are mutually exclusive, and the specific division manner can be set by a person skilled in the art according to the actual situation, and the present application does not make specific limitation.
[0057] In some embodiments, the embodiments of the present application can recalculating the initial flow control ratio by using the first calculation condition when the number of idle virtual blocks is located in the first condition interval.
[0058] For example, in order to make the overall performance of the SSD more stable, the embodiments of the present application can set a certain garbage collection water level higher than the garbage collection steady state, so when the certain garbage collection water level condition is just met, the proportion of garbage collection write can be appropriately reduced according to the initial flow control ratio, so that the random write performance decreases more smoothly. It can be understood that the embodiments of the present application adjust the proportion of garbage collection write to 60% to 79% of the initial flow control ratio when the number of idle virtual blocks is located in the first condition interval, that is, recalculating the initial flow control ratio by using the first calculation condition. The first calculation condition can be set by a person skilled in the art according to the actual situation, and the present application does not make specific limitation.
[0059] In some embodiments, the embodiments of the present application can recalculate the initial flow control ratio by using a second calculation condition when the number of idle virtual blocks is not in the first condition interval and is in the second condition interval.
[0060] For example, the embodiments of the present application can adjust the proportion of garbage collection to 80%-99% of the initial flow control ratio, i.e., recalculate the initial flow control ratio by using the second calculation condition, when the number of idle virtual blocks is in the second condition interval. The second calculation condition can be set by those skilled in the art according to actual conditions, and the present application does not make specific limitations.
[0061] In some embodiments, the embodiments of the present application can recalculate the initial flow control ratio by using a third calculation condition when the number of idle virtual blocks is not in the first condition interval and is not in the second condition interval, and is in the third condition interval.
[0062] For example, the embodiments of the present application can recalculate the initial flow control ratio by using the third calculation condition when the number of idle virtual blocks is in the third condition interval. The third calculation condition can be set by those skilled in the art according to actual conditions, and the present application does not make specific limitations.
[0063] The embodiments of the present application can more finely control the data flow in the garbage collection process, avoid system performance degradation or data migration conflicts caused by excessive flow in the garbage collection process, and maintain a more stable running state.
[0064] In step S102, if the first source number is greater than the preset number, the garbage collection is initiated on at least one source virtual block in at least one RUH based on the effective data frame number low water virtual block and the flow control ratio until the first destination number of the destination virtual block meets the first preset destination recovery condition, to obtain the first garbage collection result of the SSD disk.
[0065] In some embodiments, when the first source number is greater than a certain number, the embodiments of the present application can initiate garbage collection on at least one source virtual block in at least one RUH according to the effective data frame number low water virtual block and the flow control ratio. This garbage collection process will continue until the first destination number of the destination virtual block meets the first certain destination recovery condition, and the first garbage collection result of the SSD disk is obtained after the garbage collection is completed. The certain number and the first certain destination recovery condition can be set by those skilled in the art according to actual conditions, and the present application does not make specific limitations.
[0066] Exemplarily, in the FDP is enabled and the number of idle virtual blocks in the SSD disk meets the preset garbage collection water level line condition, the embodiment of the application starts to take turns to judge from the 0th RUH, if the number of valid data frames in the linked list is less than the low water level virtual block by 15 (this value can be adjusted according to the number of RUs, and the application does not make specific limitations), the garbage collection is directly started to the RUH, and at most 10 target virtual blocks are recycled, the next one is switched, and the garbage collection of all RUHs is successful, and then the first garbage collection result of the SSD disk is obtained.
[0067] The embodiment of the application can release the space occupied by the low water level virtual block with the number of valid data frames by garbage collection, flexibly cope with different storage scenarios and data distribution, thereby optimizing the utilization of storage resources, and further ensuring that the SSD disk has enough free space to cope with future data writing requirements, improving data access speed, and further improving user experience.
[0068] Optionally, in an embodiment of the application, the garbage collection is initiated to the at least one source virtual block by using the flow control ratio, including: obtaining the low water level virtual block with the number of valid data frames meeting the preset condition in the at least one RUH; and based on the low water level virtual block with the number of valid data frames meeting the preset condition, the garbage collection is initiated to the at least one source virtual block by using the flow control ratio.
[0069] As a possible implementation manner, the embodiment of the application can first obtain the low water level virtual block with the number of valid data frames meeting a certain condition in the RUH, and then initiate the garbage collection to the at least one source virtual block by using the flow control ratio. The certain condition can be set by the person skilled in the art according to the actual situation, and the application does not make specific limitations.
[0070] Exemplarily, in the garbage collection process, the embodiment of the application starts to recycle from the RUH with the smallest number of valid data frames, after each source virtual block is recycled, the RUH with the smallest number of valid data frames is found to continue recycling, and the garbage collection is completed.
[0071] The embodiment of the application can more accurately locate those source virtual blocks that really need garbage collection by screening the low water level virtual block with the number of valid data frames meeting a certain condition as the recycling target, thereby reducing unnecessary recycling operations, improving the overall efficiency of garbage collection, and controlling the speed of garbage collection by controlling the flow control ratio, to ensure that the SSD disk can still maintain stable performance output during garbage collection, thereby prolonging the service life of the SSD disk and enhancing user experience.
[0072] Optionally, in one embodiment of the present application, before the second source number of the source virtual blocks in the effective data frame number low water virtual block list corresponding to the at least one RUH is counted based on the effective data frame number low water virtual block statistics, it further comprises: checking the used virtual block chain table in the at least one RUH according to a preset polling rule, and judging whether the initial effective data frame number low water virtual block list corresponding to the at least one RUH satisfies a preset condition; if the initial effective data frame number low water virtual block list does not satisfy the preset condition, updating the initial effective data frame number low water virtual block list based on the effective data frame number of the used virtual blocks in the used virtual block chain table until the initial effective data frame number low water virtual block list satisfies the preset condition, and obtaining the effective data frame number low water virtual block list based on the updated initial effective data frame number low water virtual block list; if the initial effective data frame number low water virtual block list satisfies the preset condition, obtaining the effective data frame number low water virtual block list based on the initial effective data frame number low water virtual block list.
[0073] It can be understood that the effective data frame number low water virtual block list in the embodiment of the present application can be understood as that a certain array space is applied for each RUH to record the serial number (the maximum number can be adjusted according to the total number of RUs in each RG, which is not limited in the present application) of the effective data frame number low water virtual block satisfying the maximum 10 (the list size, which can be set by the person skilled in the art according to the actual situation, and the present application does not make specific limitation) in the current RUH, and then the effective data frame number low water virtual block list satisfying certain conditions can be obtained.
[0074] It can be understood by the person skilled in the art that the embodiment of the present application can check the used virtual block chain table in the RUH according to a certain polling rule, and judge whether the initial effective data frame number low water virtual block list satisfies certain conditions.
[0075] Further, in some embodiments, when the initial effective data frame number low water virtual block list does not satisfy certain conditions, the embodiment of the present application updates the initial effective data frame number low water virtual block list based on the effective data frame number of the used virtual blocks in the used virtual block chain table until the preset condition is satisfied, and then obtains the effective data frame number low water virtual block list.
[0076] In some embodiments, when the initial effective data frame number low water virtual block list satisfies certain conditions, the embodiment of the present application obtains the effective data frame number low water virtual block list based on the initial effective data frame number low water virtual block list.
[0077] For example, the process of inserting the effective data frame number low water virtual block list in the embodiment of the present application is shown in Figure 4 The main content is as follows:
[0078] Step S401: judge whether the linked list is empty, if not, execute step S402, otherwise, execute step S413.
[0079] Step S402: select a virtual block.
[0080] Step S403: set m as the last bit of the virtual block list of the low water level of the number of valid data frames.
[0081] Step S404: judge whether the current virtual block is smaller than the value of m, if smaller, execute step S405, otherwise, execute step S406.
[0082] Step S405: judge whether m == 0, if equal, execute step S408, otherwise, execute step S407.
[0083] Step S406: judge whether (m+1) <= block list size - 1, if smaller or equal, execute step S407, otherwise, execute step S409.
[0084] Step S407: m - 1.
[0085] Step S408: m bit is updated as the current virtual block.
[0086] Step S409: select the next of the linked list.
[0087] Step S410: the virtual block after m is moved.
[0088] Step S411: judge whether m == block list size - 1, if equal, execute step S410, otherwise, execute step S409.
[0089] Step S412: judge whether the head is reached, if yes, execute step S413, otherwise, execute step S403.
[0090] Step S413: end.
[0091] In summary, the embodiment of the present application uses the used virtual block chain list of the current RUH to perform polling checking. If the list position in this RUH has not been filled, the low water mark virtual block of the valid data frame quantity is inserted into the list, and the virtual blocks are inserted and sorted according to the valid data frame quantity. If the 10 list positions have been filled, the maximum valid data frame quantity in the 10 list positions is compared. If the current virtual block is smaller than the virtual block filled in the list, the virtual block with a smaller valid data frame quantity in the comparison list is compared until the virtual block is found. The virtual block with a larger valid data frame quantity is squeezed out, and finally the several virtual blocks with the lowest low water mark virtual block of the valid data frame quantity in each RUH are selected, and then the low water mark virtual block list of the valid data frame quantity is obtained.
[0092] The embodiment of the present application periodically checks the used virtual block chain list according to a certain polling rule, ensures that the data in the initial low water mark virtual block list of the valid data frame quantity is the latest and accurate, avoids the decision-making error of garbage collection caused by outdated or incorrect data, and further optimizes the garbage collection strategy and improves the utilization rate of storage resources.
[0093] In step S103, if the first source quantity is less than or equal to the preset quantity, the second source quantity of the source virtual block in the low water mark virtual block list of the valid data frame quantity corresponding to at least one RUH is counted based on the low water mark virtual block of the valid data frame quantity, and when the second source quantity is greater than the second destination quantity of the destination virtual block, the garbage collection of at least one source virtual block is initiated by using the flow control ratio until the second destination quantity meets the second preset destination recovery condition and / or at least one source virtual block meets the preset source recovery condition, so as to obtain the second garbage collection result of the SSD disk.
[0094] In some embodiments, when the first source quantity is less than or equal to a certain quantity, the second source quantity of the source virtual block corresponding to the low water mark virtual block of the valid data frame quantity can be counted, and when the second source quantity is greater than the second destination quantity of the destination virtual block, the garbage collection of at least one source virtual block is initiated by using the flow control ratio until any one of the following conditions is met, the current RUH garbage collection is stopped, the next RUH is switched, and then the second garbage collection result of the SSD disk is obtained.
[0095] Condition 1: The second destination quantity meets the second certain destination recovery condition, wherein the second certain destination recovery condition can be set by a person skilled in the art according to the actual situation, and the present application does not make specific limitations.
[0096] It can be understood that the embodiment of the present application fills the destination virtual block, reduces the destination virtual block quantity by one, and judges whether the destination virtual block quantity is 0. When 0 is obtained, the switching is performed until the garbage collection of all RUHs is completed, and then the second garbage collection result is obtained.
[0097] Condition 2: At least one source virtual block meets a certain source recycling condition, wherein the certain source recycling condition can be set by a person skilled in the art according to actual conditions, and the present application does not make specific limitations.
[0098] It can be understood that, in the embodiment of the present application, after each current source virtual block is written, it can be re-judged whether the current RUH still has an effective data frame number low water level virtual block, and if not, it is switched.
[0099] For example, in the embodiment of the present application, when the first source number is less than 15, it is judged whether the second source number of the source virtual block is greater than the second destination number of the destination virtual block, and in the case that the second source number is greater than the second destination number, the garbage recycling of the current RUH is initiated. The judgment algorithm is as follows Figure 5 , the main content is:
[0100] Step S501: Start FDP and the number of idle virtual blocks meets a certain garbage recycling water level condition.
[0101] Step S502: The current RUH is set to 0.
[0102] Step S503: Accumulate the number of effective data frames in the list, and calculate the destination virtual block.
[0103] Step S504: Judge whether the number of destination virtual blocks is less than the number of source virtual blocks, if less, execute step S505, otherwise, execute step S510.
[0104] Step S505: Recycle the virtual block with the lowest number of effective data frames in the RUH.
[0105] Step S506: Judge whether the destination virtual block is full, if full, execute step S507, otherwise, execute step S509.
[0106] Step S507: Judge whether the idle virtual block is promoted to the garbage recycling stop water level, if reached, execute step S501, otherwise, execute step S508.
[0107] Step S508: Judge whether the destination virtual block of the current RUH is exhausted, if exhausted, execute step S510, otherwise, execute step S503.
[0108] Step S509: Judge whether there is still a virtual block in the list, if yes, execute step S505, otherwise, execute step S510.
[0109] Step S510: Switch to the next RUH.
[0110] In summary, the embodiment of the present application counts the second source quantity of the source virtual blocks in the low water level virtual block list of the current valid data frame quantity, accumulates the valid data frame quantity of the source virtual blocks, calculates the total valid data frame quantity, and then divides the total valid data frame quantity by the data frame quantity of a single virtual block to obtain the second destination quantity of the destination virtual block. If the second source quantity is greater than the second destination quantity, garbage collection can be initiated (in order to prevent waste, the garbage collection is not continued for the excess that cannot fill a destination virtual block, and the result is rounded off by using the tail-cutting method), and the calculation formula can be, but is not limited to, as follows:
[0111] Destination virtual block quantity = sum(valid data frame quantity of source virtual blocks) / data frame quantity of a single virtual block,
[0112] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, and of course, it can also be realized by hardware, but in many cases, the former is a better embodiment.
[0113] The embodiment of the present application also provides a garbage collection device suitable for FDP.
[0114] Figure 6 A block diagram of the garbage collection device suitable for FDP provided by the embodiment of the present application is shown.
[0115] As shown in the figure, the garbage collection device suitable for FDP 10 includes a first judgment module 100, a first generation module 200, and a second generation module 300. Figure 6
[0116] The first judgment module 100 is configured to, in the case that the FDP is started and the quantity of the idle virtual blocks in the SSD disk meets the preset garbage collection water level condition, determine whether the first source quantity of the source virtual blocks corresponding to the low water level virtual blocks with the quantity of the valid data frames being less than the preset quantity is greater than the preset quantity based on at least one RUH linked list in the SSD disk.
[0117] The first generation module 200 is configured to, when the first source quantity is greater than the preset quantity, initiate garbage collection on at least one source virtual block in at least one RUH based on the low water level virtual block with the quantity of the valid data frames by using the flow control ratio until the first destination quantity of the destination virtual block meets the first preset destination collection condition, so as to obtain the first garbage collection result of the SSD disk.
[0118] The second generation module 300 is configured to, when the first source quantity is less than or equal to the preset quantity, count a second source quantity of source virtual blocks in a list of low-water-level virtual blocks of valid data frame quantity based on the low-water-level virtual blocks of valid data frame quantity, and when the second source quantity is greater than a second destination quantity of destination virtual blocks, initiate garbage collection on at least one source virtual block by using a flow control ratio until the second destination quantity meets a second preset destination collection condition and / or the at least one source virtual block meets a preset source collection condition, to obtain a second garbage collection result of the SSD disk.
[0119] Optionally, in an embodiment of the present application, the method further comprises a first calculation module, a second calculation module, a third calculation module, an acquisition module and a construction module.
[0120] The first calculation module is configured to calculate a data frame sum of used virtual blocks based on a quantity of used virtual blocks in the SSD disk and a data frame quantity corresponding to the used virtual blocks before determining whether a first source quantity of source virtual blocks corresponding to at least one low-water-level virtual block of valid data frame quantity in at least one RUH chain table in the SSD disk is greater than a preset quantity by taking turns on the at least one RUH chain table.
[0121] The second calculation module is configured to calculate a valid data frame sum of used virtual blocks based on a quantity of data written in the SSD disk.
[0122] The third calculation module is configured to calculate an average value of valid data frame occupancy of used virtual blocks based on the data frame sum and the valid data frame sum.
[0123] The acquisition module is configured to acquire the low-water-level virtual blocks of valid data frame quantity based on the average value of valid data frame occupancy and the used virtual blocks.
[0124] The construction module is configured to construct a used virtual block chain table corresponding to the used virtual blocks based on the low-water-level virtual blocks of valid data frame quantity.
[0125] Optionally, in an embodiment of the present application, the method further comprises a third generation module.
[0126] The third generation module is configured to generate an RUH chain table corresponding to at least one virtual block based on the at least one virtual block in the SSD disk and the average value of valid data frame occupancy before determining whether a first source quantity of source virtual blocks corresponding to at least one low-water-level virtual block of valid data frame quantity in at least one RUH chain table in the SSD disk is greater than a preset quantity by taking turns on the at least one RUH chain table.
[0127] Optionally, in an embodiment of the present application, the method further comprises a second judgment module, an update module and a fourth generation module.
[0128] The second judging module is configured to check the used virtual block chain table in the at least one RUH according to a preset polling rule before judging whether the initial effective data frame number low water level virtual block list corresponding to the at least one RUH meets a preset condition, and judging a second source number of source virtual blocks in a source virtual block list corresponding to the at least one RUH based on the effective data frame number low water level virtual block.
[0129] The updating module is configured to update the initial effective data frame number low water level virtual block list based on the effective data frame number of the used virtual block in the used virtual block chain table when the initial effective data frame number low water level virtual block list does not meet the preset condition, until the initial effective data frame number low water level virtual block list meets the preset condition, and obtain the effective data frame number low water level virtual block list based on the updated initial effective data frame number low water level virtual block list.
[0130] The fourth generating module is configured to obtain the effective data frame number low water level virtual block list based on the initial effective data frame number low water level virtual block list when the initial effective data frame number low water level virtual block list meets the preset condition.
[0131] Optionally, in an embodiment of the present application, the method further includes a fourth calculating module, a fifth calculating module and a fifth generating module.
[0132] The fourth calculating module is configured to calculate a third source number of source virtual blocks and a third destination number of destination virtual blocks when garbage collection is performed based on the effective data frame number low water level virtual block before initiating the garbage collection on the at least one source virtual block by using the flow control ratio.
[0133] The fifth calculating module is configured to calculate an initial flow control ratio of the at least one RUH for garbage collection based on the third source number and the third destination number.
[0134] The fifth generating module is configured to recalculate the initial flow control ratio by using an actual garbage collection write proportion based on the sum of the write data of the destination virtual block and the actual effective data frame of the source virtual block, to obtain the flow control ratio.
[0135] Optionally, in an embodiment of the present application, the fifth calculating module includes a first judging unit, a first calculating unit, a second judging unit, a second calculating unit, a third judging unit and a third calculating unit.
[0136] The first judging unit is configured to judge whether the number of the idle virtual blocks is located in a first condition interval in the preset garbage collection water level line condition.
[0137] The first calculation unit is configured to recalculate the initial flow control ratio based on the write data, the actual valid data frame sum and the actual garbage collection write proportion by using a first calculation condition when the number of idle virtual blocks is in a first condition interval.
[0138] The second judgment unit is configured to judge whether the number of idle virtual blocks is in a second condition interval in the preset garbage collection water level condition when the number of idle virtual blocks is not in the first condition interval.
[0139] The second calculation unit is configured to recalculate the initial flow control ratio based on the write data, the actual valid data frame sum and the actual garbage collection write proportion by using a second calculation condition when the number of idle virtual blocks is in the second condition interval.
[0140] The third judgment unit is configured to judge whether the number of idle virtual blocks is in a third condition interval in the preset garbage collection water level condition when the number of idle virtual blocks is not in the second condition interval.
[0141] The third calculation unit is configured to recalculate the initial flow control ratio based on the write data, the actual valid data frame sum and the actual garbage collection write proportion by using a third calculation condition when the number of idle virtual blocks is in the third condition interval, wherein the first condition interval, the second condition interval and the third condition interval are mutually exclusive and collectively the preset garbage collection water level condition.
[0142] Optionally, in an embodiment of the present application, the first generation module 200 comprises an acquisition unit and a launch unit.
[0143] The acquisition unit is configured to acquire the valid data frame quantity low water level virtual block satisfying the preset condition in the at least one RUH.
[0144] The launch unit is configured to launch garbage collection on the at least one source virtual block by using the flow control ratio based on the valid data frame quantity low water level virtual block satisfying the preset condition.
[0145] The features of the embodiments of the garbage collection device suitable for FDP can be referred to the related descriptions of the embodiments of the garbage collection method suitable for FDP, which will not be repeated here.
[0146] Embodiments of the present application also provide an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned embodiments of the garbage collection method suitable for FDP.
[0147] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is arranged to execute the steps in any of the above-mentioned embodiments of the garbage collection method suitable for FDP when running.
[0148] In an example embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media capable of storing computer programs.
[0149] The embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to realize the steps in any of the above-mentioned embodiments of the garbage collection method suitable for FDP.
[0150] The embodiment of the present application further provides another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps in any of the above-mentioned embodiments of the garbage collection method suitable for FDP.
[0151] The skilled person can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0152] The above describes in detail a garbage collection method suitable for FDP provided by the present application. The principles and implementation manners of the present application are described by applying specific examples in the present document, and the above description of the examples is only used to help understand the method of the present application and its core idea. It should be noted that, for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A garbage collection method suitable for FDP, characterized by, The method comprises the following steps: In the case that flexible data placement (FDP) is enabled and the number of idle virtual blocks in a solid state disk (SSD) meets a preset garbage collection water level condition, based on at least one RUH list in the SSD, it is determined in turn whether a first source number of source virtual blocks corresponding to at least one low water level virtual block of effective data frame number is greater than a preset number, wherein the low water level virtual block of effective data frame number is a virtual block whose effective data frame occupancy is lower than an average value of effective data frame occupancy; If the first source number is greater than the preset number, based on the low water level virtual block of effective data frame number, garbage collection is initiated on at least one source virtual block in at least one RUH by using a flow control ratio until a first destination number of destination virtual blocks meets a first preset destination collection condition, so as to obtain a first garbage collection result of the SSD, wherein the destination virtual block receives the effective data frame of the source virtual block; If the first source number is less than or equal to the preset number, based on the low water level virtual block of effective data frame number, a second source number of source virtual blocks in a list of low water level virtual blocks of effective data frame number corresponding to the at least one RUH is counted, and when the second source number is greater than a second destination number of destination virtual blocks, garbage collection is initiated on the at least one source virtual block by using the flow control ratio until the at least one source virtual block meets a preset source collection condition, so as to obtain a second garbage collection result of the SSD; Wherein, before the second source number is greater than the second destination number of destination virtual blocks, it further comprises: Based on the second source number, the number of effective data frames of the source virtual block is accumulated to calculate the corresponding total number of effective data frames; The total number of effective data frames is divided by the number of data frames of a single virtual block to obtain the second destination number.
2. The method of claim 1, wherein, Before determining in turn whether a first source number of source virtual blocks corresponding to at least one low water level virtual block of effective data frame number in at least one RUH list in the SSD is greater than a preset number, it further comprises: According to the number of used virtual blocks in the SSD and the number of data frames corresponding to the used virtual blocks, the total number of data frames of the used virtual blocks is calculated; According to the amount of data written in the SSD, the total number of effective data frames of the used virtual blocks is calculated; Based on the total number of data frames and the total number of effective data frames, the average value of effective data frame occupancy of the used virtual blocks is calculated; Based on the average value of effective data frame occupancy and the used virtual blocks, the low water level virtual block of effective data frame number is obtained; Based on the low water level virtual block of effective data frame number, a used virtual block list corresponding to the used virtual blocks is constructed.
3. The method of claim 2, wherein, Before determining in turn whether a first source number of source virtual blocks corresponding to at least one low water level virtual block of effective data frame number in at least one RUH list in the SSD is greater than a preset number, it further comprises: Based on the at least one virtual block in the SSD disk and the average value of the effective data frame occupancy, a RUH chain table corresponding to the at least one virtual block is generated.
4. The method of claim 2, wherein, Before the second source quantity of the source virtual block in the at least one RUH corresponding effective data frame quantity low water level virtual block list is counted based on the effective data frame quantity low water level virtual block, the method further comprises: checking the used virtual block chain table in the at least one RUH according to a preset polling rule, and judging whether the initial effective data frame quantity low water level virtual block list corresponding to the at least one RUH meets a preset condition; if the initial effective data frame quantity low water level virtual block list does not meet the preset condition, updating the initial effective data frame quantity low water level virtual block list based on the effective data frame quantity of the used virtual block in the used virtual block chain table until the initial effective data frame quantity low water level virtual block list meets the preset condition, and obtaining the effective data frame quantity low water level virtual block list based on the updated initial effective data frame quantity low water level virtual block list; if the initial effective data frame quantity low water level virtual block list meets the preset condition, obtaining the effective data frame quantity low water level virtual block list based on the initial effective data frame quantity low water level virtual block list.
5. The method of claim 1, wherein, Before the garbage collection is initiated to the at least one source virtual block by using the flow control ratio, the method further comprises: based on the effective data frame quantity low water level virtual block, calculating a third source quantity of the source virtual block and a third destination quantity of the destination virtual block when the garbage collection is performed; based on the third source quantity and the third destination quantity, calculating an initial flow control ratio of the at least one RUH for garbage collection; based on the sum of the write data of the destination virtual block and the actual effective data frame of the source virtual block, recalculating the initial flow control ratio by using an actual garbage collection write ratio to obtain the flow control ratio.
6. The method of claim 5, wherein, The recalculating the initial flow control ratio by using the actual garbage collection write ratio based on the sum of the write data of the destination virtual block and the actual effective data frame of the source virtual block comprises: judging whether the quantity of the idle virtual block is located in a first condition interval in the preset garbage collection water level condition; if the quantity of the idle virtual block is located in the first condition interval, recalculating the initial flow control ratio by using a first calculation condition based on the write data, the sum of the actual effective data frame and the actual garbage collection write ratio; if the quantity of the idle virtual block is not located in the first condition interval, judging whether the quantity of the idle virtual block is located in a second condition interval in the preset garbage collection water level condition; if the quantity of the idle virtual block is located in the second condition interval, recalculating the initial flow control ratio by using a second calculation condition based on the write data, the sum of the actual effective data frame and the actual garbage collection write ratio; if the quantity of the idle virtual block is not located in the second condition interval, judging whether the quantity of the idle virtual block is located in a third condition interval in the preset garbage collection water level condition; If the number of the idle virtual blocks is in the third condition interval, the initial flow control ratio is recalculated based on the write data, the actual total of valid data frames, and the actual garbage collection write proportion by using a third calculation condition, wherein the first condition interval, the second condition interval, and the third condition interval are mutually exclusive, and the union is the preset garbage collection water line condition.
7. The method of claim 1, wherein, The initiating garbage collection of the at least one source virtual block by using the flow control ratio comprises: acquiring a valid data frame number low water level virtual block in the at least one RUH that meets a preset condition; initiating garbage collection of the at least one source virtual block by using the flow control ratio based on the valid data frame number low water level virtual block that meets the preset condition.
8. A garbage collection device suitable for use in FDPs, characterized by, comprise: The first judgment module is configured to, in a case where the FDP is started and the number of idle virtual blocks in the SSD disk meets a preset garbage collection water line condition, determine, based on at least one RUH chain table in the SSD disk, whether a first source number of source virtual blocks corresponding to at least one valid data frame number low water level virtual block in the at least one RUH chain table is greater than a preset number, wherein the valid data frame number low water level virtual block is a virtual block whose valid data frame occupancy rate is lower than an average value of valid data frame occupancy rates; The first generation module is configured to, in a case where the first source number is greater than the preset number, initiate garbage collection of at least one source virtual block in at least one RUH by using a flow control ratio based on the valid data frame number low water level virtual block, until a first destination number of destination virtual blocks meets a first preset destination collection condition, to obtain a first garbage collection result of the SSD disk, wherein the destination virtual block receives valid data frames of the source virtual block; The second generation module is configured to, in a case where the first source number is less than or equal to the preset number, count a second source number of source virtual blocks in a valid data frame number low water level virtual block list corresponding to the at least one RUH based on the valid data frame number low water level virtual block, and initiate garbage collection of the at least one source virtual block by using the flow control ratio in a case where the second source number is greater than a second destination number of the destination virtual blocks, until the at least one source virtual block meets a preset source collection condition, to obtain a second garbage collection result of the SSD disk. The calculation module is configured to, before the second source number is greater than the second destination number of the destination virtual blocks, accumulate the number of valid data frames of the source virtual block based on the second source number, to calculate a corresponding total number of valid data frames; The third generation module is configured to divide the total number of valid data frames by the number of data frames of a single virtual block, to obtain the second destination number. comprise:
9. An electronic device, comprising: The memory, the processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the garbage collection method for FDP according to any one of claims 1-7. The program is executed by the processor to implement the garbage collection method for FDP according to any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that,
Citation Information
Patent Citations
Memory system and method for operating the same
CN110716879A
Adjustment method for free physical block water line and storage device
CN116974481A