Solid state disk garbage collection method and device and related equipment

The method and device for SSDs screen and exclude restricted blocks from GC, reducing high-frequency processing and stabilizing performance by focusing on non-restricted blocks.

CN119248666APending Publication Date: 2025-01-03SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411212635.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Repetitive file modifications in a short period of time in SSDs lead to high-frequency garbage collection (GC) processing, reducing recovery efficiency and causing performance fluctuations.

Method used

A method and device that screen storage blocks for GC by identifying and excluding 'restricted' blocks, performing GC only on non-restricted blocks to reduce frequent selection and stabilize performance.

Benefits of technology

Reduces the frequency of GC processing in targeted SSD areas, thereby enhancing recovery efficiency and stabilizing SSD performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248666A_ABST
    Figure CN119248666A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of solid state disks, in particular to a solid state disk garbage collection method and device and related equipment. The method comprises the steps of determining candidate storage blocks in a plurality of to-be-recycled storage blocks in response to a received write-in request; if the candidate storage block is the limited storage block, repeatedly executing the step of determining the candidate storage block in the plurality of storage blocks to be recycled until the determined candidate storage block is not the limited storage block; wherein the limited storage block is a storage block which is limited to be subjected to garbage collection processing in a target storage area where the candidate storage block is located; performing garbage collection processing on the candidate storage blocks which are determined not to be the limited storage blocks to obtain free storage blocks used for storing the to-be-written data; according to the method and the device, the limited storage blocks are set to screen the to-be-recycled storage blocks subjected to GC processing, so that the frequency of repeatedly selecting some to-be-recycled storage blocks in the target storage area to perform GC processing can be effectively reduced, and the performance of the SSD can be effectively stabilized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of solid-state hard disks, and in particular to a solid-state hard disk garbage collection method, device, and related equipment. Background Art

[0002] In the prior art, when an SSD (Solid State Drive) receives a write request sent by a host, if the free storage blocks of the SSD at the current moment are insufficient to store the data to be written included in the write request, the SSD needs to perform GC (Garbage Collection) processing on the storage blocks to be reclaimed that store invalid data and valid data, so as to move the valid data in the storage blocks to be reclaimed to other storage blocks and erase the invalid data, and finally obtain free storage blocks that can be used to store the data to be written.

[0003] When using an SSD, a user may modify a file repeatedly through a host in a short period of time and store the modified content in a target storage area with a fixed range in the SSD. In the above situation, the storage blocks to be reclaimed in the target storage area may include a large amount of valid data. When the valid data and the valid data from other storage blocks to be reclaimed are moved to a free storage block in the target storage area for storage, it is very likely that part of the valid data will become invalid data due to the user's further modification. Then, the remaining valid data in the valid data may need to be moved to another free storage block again until all the valid data becomes invalid data due to the user's repeated modifications.

[0004] In summary, if a user repeatedly modifies a file in a short period of time and stores the modified content in a fixed-range target storage area in the SSD, it is easy to cause high-frequency GC processing in certain fixed-range target storage areas in the SSD, ultimately reducing the recovery efficiency of the GC processing and may even cause fluctuations in the performance of the SSD. Summary of the invention

[0005] In view of this, the purpose of the present application is to provide a solid-state hard disk garbage collection method, device and related equipment to solve the technical problem in the prior art that if a user repeatedly modifies a file in a short period of time and stores the modified content in a target storage area with a fixed range in the SSD, it is easy to reduce the recovery efficiency of the GC processing and may even cause the performance of the SSD to fluctuate.

[0006] In a first aspect, the present application provides a solid state drive garbage collection method, which is applied to a solid state drive, and the method comprises:

[0007] In response to receiving a write request, determining a candidate storage block from a plurality of storage blocks to be reclaimed; wherein the write request includes: data to be written;

[0008] If the candidate storage block is a restricted storage block, the step of determining the candidate storage block from the plurality of storage blocks to be reclaimed is repeated until it is determined that the obtained candidate storage block is not the restricted storage block; wherein the restricted storage block is a storage block in the target storage area where the candidate storage block is located that is restricted from garbage collection;

[0009] A garbage collection process is performed on the candidate storage blocks that are determined not to be the limited-use storage blocks to obtain free storage blocks for storing the data to be written.

[0010] Preferably, the method further comprises:

[0011] In response to any current storage block in the target storage area being full, the current storage block is determined as the limited storage block.

[0012] Preferably, a plurality of the target storage areas are arranged in the user space in the storage area of ​​the solid state drive, and each of the target storage areas is correspondingly arranged with a plurality of the limited-use storage blocks; after determining the candidate storage block from the plurality of storage blocks to be reclaimed, the method further comprises:

[0013] Determine whether the physical address of the candidate storage block is included in the plurality of physical addresses recorded in the restricted data table;

[0014] Wherein, the restricted-use data table is used to record the physical addresses of a plurality of the restricted-use storage blocks;

[0015] If the physical address of the candidate storage block is included in the plurality of physical addresses recorded in the restricted data table, the candidate storage block is determined to be the restricted storage block.

[0016] Preferably, the number of the physical addresses of the limited storage blocks recorded in the limited data table is m, where m is a positive integer, and the physical addresses of the m limited storage blocks are arranged in a time sequence of being added to the limited data table; determining the current storage block as the limited storage block comprises:

[0017] Among the m physical addresses of the limited-use storage blocks recorded in the limited-use data table, the physical address of the limited-use storage block that was first added to the limited-use data table is deleted;

[0018] The physical address of the current storage block is added into the restricted data table as the physical address of the restricted storage block.

[0019] Preferably, the storage area of ​​the solid state drive further includes: reserved space; and the method further includes:

[0020] The number m of physical addresses of the limited storage blocks is determined according to the number of the free storage blocks included in the reserved space.

[0021] Preferably, determining the number m of physical addresses of the limited storage blocks according to the number of the free storage blocks included in the reserved space includes:

[0022] In response to the number of the free storage blocks included in the reserved space meeting the target condition, adjusting the number m of physical addresses of the limited storage blocks;

[0023] The target condition includes at least one of the following:

[0024] The number of free storage blocks is a first value;

[0025] A ratio between the number of the free storage blocks and the number of the storage blocks included in the reserved space is a second value.

[0026] In a second aspect, the present application provides a solid state drive garbage collection device, the device comprising: a screening module and an execution module;

[0027] The screening module is used to determine a candidate storage block from a plurality of storage blocks to be reclaimed in response to receiving a write request; wherein the write request includes: data to be written;

[0028] The screening module is further configured to, if the candidate storage block is a restricted storage block, repeatedly execute the step of determining the candidate storage block from the plurality of storage blocks to be reclaimed until it is determined that the obtained candidate storage block is not the restricted storage block; wherein the restricted storage block is a storage block in the target storage area where the candidate storage block is located that is restricted from garbage collection;

[0029] The execution module is used to perform garbage collection processing on the candidate storage blocks that are determined not to be the limited-use storage blocks to obtain free storage blocks for storing the data to be written.

[0030] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store software programs, and the processor runs or executes the software programs stored in the memory so that the electronic device implements the above-mentioned solid-state hard drive garbage collection method.

[0031] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program codes executed by a processor, wherein the program codes include codes for implementing the above-mentioned solid-state hard disk garbage collection method.

[0032] In a fifth aspect, the present application provides a computer program product, including a program code, which enables a computer to execute the above-mentioned solid-state hard disk garbage collection method when the computer runs the computer program product.

[0033] Beneficial effects:

[0034] The present application provides a solid-state hard disk garbage collection method, which is applied to a solid-state hard disk, and the method comprises: in response to receiving a write request, determining a candidate storage block from a plurality of storage blocks to be recovered; if the candidate storage block is a limited-use storage block, repeatedly performing the step of determining the candidate storage block from the plurality of storage blocks to be recovered until it is determined that the obtained candidate storage block is not a limited-use storage block; wherein the limited-use storage block is a storage block in a target storage area where the candidate storage block is located that is restricted from performing garbage collection processing; performing garbage collection processing on the candidate storage block that is determined not to be a limited-use storage block to obtain a free storage block for storing data to be written;

[0035] In summary, the present application can effectively reduce the frequency of certain storage blocks to be reclaimed in the target storage area being repeatedly selected for GC processing by setting limited storage blocks to screen the storage blocks to be reclaimed for GC processing, and can also effectively stabilize the performance of the SSD. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. The following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A schematic diagram of a solid state drive garbage collection method according to an embodiment of the present application;

[0038] Figure 2 A schematic diagram of the structure of a solid state drive garbage collection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In the prior art, when the SSD receives a write request sent by the host, if the free storage blocks of the SSD at the current moment are insufficient to store the data to be written included in the write request, the SSD needs to perform GC processing on the storage blocks to be reclaimed to obtain enough free storage blocks to store the data to be written.

[0040] When a user modifies the target content in a file stored in the SSD in the host, the SSD needs to store the modified content, and the target content becomes invalid data, and the current storage block P storing the target content also becomes a storage block P to be reclaimed; wherein, since the current storage block P storing the target content usually does not only store the target content, when the target content is determined to be invalid data, the current storage block P is usually confirmed as a storage block to be reclaimed.

[0041] In actual applications, there are situations where a user repeatedly modifies a file through a host in a short period of time and stores the data corresponding to the modified content in a target storage area with a fixed range in the SSD;

[0042] For example, a user modifies a file stored in an SSD five times within five minutes. The five modified contents correspond to storage blocks P and P in the target storage area of ​​the SSD. 1 The stored data N 1 、Data N 2 、Data N 3 、Data N 4 and data N 5 ;

[0043] At the first moment, the user makes the first modification to the file on the host, that is, to the storage block P 1 The data stored in N 1 The corresponding first target content is modified to obtain the first modified content. After the first modified content is saved, the storage block P 1 The data stored in N 1 Becomes invalid data. At this time, due to the storage block P 1 There is invalid data stored in the storage block P 1 Becomes the storage block P to be recycled 1 ; Among them, the storage block to be recycled is the storage block that can be processed by GC;

[0044] In addition, the host sends a write request to the SSD, and the write request includes: the data to be written corresponding to the first modified content; if the free storage blocks of the SSD at the current moment are insufficient to store the data to be written corresponding to the first modified content, the SSD needs to perform GC processing on the storage blocks to be reclaimed to obtain enough free storage blocks to store the content obtained after the first modification; if the GC processing required at the current moment is for the storage blocks P to be reclaimed 1 To execute, when GC is completed, data N 1 Erased, waiting to be reclaimed storage block P 1 Becomes free storage block Q 1 , storage block P to be recycled 1The data N previously stored in 2 、Data N 3 、Data N 4 and data N 5 Now it has been moved to the storage block P in the target storage area. 2 middle;

[0045] At the second moment, the user makes a second modification to the file on the host, that is, to the storage block P 2 The data stored in N 2 The corresponding second target content is modified to obtain the second modified content. After the second modified content is saved, the storage block P 2 The data stored in N 2 Becomes invalid data. At this time, due to the storage block P 2 There is invalid data stored in the storage block P 2 Becomes the storage block P to be recycled 2 ;

[0046] In addition, the host sends a write request to the SSD, and the write request includes: the data to be written corresponding to the second modified content; if the free storage blocks of the SSD at the current moment are insufficient to store the data to be written corresponding to the second modified content, the SSD needs to perform GC processing on the storage blocks to be reclaimed to obtain enough free storage blocks to store the content obtained after the second modification; if the GC processing required at the current moment is for the storage blocks P to be reclaimed 2 To execute, when GC is completed, data N 2 Erased, waiting to be reclaimed storage block P 2 Becomes free storage block Q 2 , storage block P to be recycled 2 The data N previously stored in 3 、Data N 4 and data N 5 Now it has been moved to the storage block P in the target storage area. 3 middle;

[0047] The data N modified by the user at the third moment, the fourth moment, and the fifth moment respectively 3 、Data N 4 and data N 5 The process can refer to the processing performed at the first moment and the second moment, which will not be repeated here.

[0048] According to the above example, the user has modified the file 5 times. 1 、Data N 2 、Data N 3 、Data N 4 and data N 5In the five modifications, the data becomes invalid, but five GC processes are performed in the target storage area. However, according to the modification content, only one GC process is actually required, that is, until the storage block P is 1 The data in N 1 、Data N 2 、Data N 3 、Data N 4 and data N 5 All become invalid data; at this time, if the storage block P 1 Remove data N 1 、Data N 2 、Data N 3 、Data N 4 and data N 5 Also stores valid data, for storage block P 1 Perform GC processing. If the storage block P 1 Remove data N 1 、Data N 2 、Data N 3 、Data N 4 and data N 5 No other valid data is stored, for storage block P 1 An erasing process is performed, but in the prior art, five GC processes need to be performed on multiple storage blocks in the target storage area.

[0049] In summary, when a user repeatedly modifies a file in a short period of time and stores the modified content in a fixed-range target storage area within the SSD, it is easy to cause high-frequency GC processing in certain fixed-range target storage areas within the SSD, including storage blocks used to store target content, which ultimately reduces the recovery efficiency of the GC processing and may even cause fluctuations in the performance of the SSD.

[0050] In order to solve the above problems, the present application proposes a solid state drive garbage collection solution, which reduces the frequency of performing GC processing on a target storage area by screening storage blocks to be recycled selected in the GC process.

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0052] First, the present application proposes a solid state drive garbage collection method, which is applied to a solid state drive SSD, the SSD is connected to a host, such as Figure 1 As shown, Figure 1 A schematic diagram of a solid state drive garbage collection method provided in an embodiment of the present application, the method includes: S110 to S130, the details of which are as follows:

[0053] S110: In response to receiving a write request, determining a candidate storage block from a plurality of storage blocks to be reclaimed.

[0054] Specifically, when the SSD receives a write request, if the free storage blocks in the SSD are insufficient to store the data to be written, the SSD needs to start GC processing to centrally store the valid data in the storage blocks to be reclaimed and erase the invalid data to obtain free storage blocks.

[0055] The first step of GC processing is to determine the storage blocks to be reclaimed that can be processed by GC.

[0056] The write request includes: the data to be written and a logical block address (LBA), which is used to specify the logical address of the storage block in the SSD used to store the data to be written; after receiving the write request, the SSD determines a reclaimed storage block that can be used to store the data to be written from the existing multiple reclaimed storage blocks.

[0057] S120: If the candidate storage block is a restricted storage block, repeatedly executing the step of determining the candidate storage block from a plurality of storage blocks to be reclaimed until it is determined that the obtained candidate storage block is not a restricted storage block; wherein the restricted storage block is a storage block in the target storage area where the candidate storage block is located that is restricted from garbage collection.

[0058] Specifically, in the prior art, after the SSD determines the storage block to be reclaimed that can be used to store the data to be written, it can build a mapping relationship between the logical block address and the physical address of the storage block to be reclaimed, that is, update the mapping table (Logical to Physical Address Translation Table, L2P); however, in an embodiment of the present application, after determining the storage block to be reclaimed that can be used to store the data to be written, it is also necessary to screen the storage block to be reclaimed; the screening step is to determine whether the storage block to be reclaimed is a limited storage block; usually by comparing whether the physical address of the storage block to be reclaimed is the same as the physical address of the limited storage block.

[0059] The purpose of setting the limited storage blocks is to reduce the repeated selection of some storage blocks to be reclaimed in the target storage area for GC processing.

[0060] The target storage area is a storage area in the SSD that includes multiple storage blocks. The location and size of the target storage area can be determined according to actual needs, and this application does not make specific limitations on this.

[0061] In one implementation, the method further includes: step (1), the details of which are as follows:

[0062] Step (1): In response to any current storage block in the target storage area being full, the current storage block is determined as a limited storage block.

[0063] Specifically, there are multiple methods for determining limited storage blocks. In an embodiment of the present application, a current storage block that is full in the target storage area is determined as a limited storage block. It should be emphasized that "a current storage block that is full" refers to a storage block to which data is written according to a write request from the host, and does not include a storage block in the SSD used to store background task data or storage system information.

[0064] If a current storage block is full, it means that there is a lot of valid data stored in it. Therefore, if the user repeatedly modifies the file content corresponding to the data stored in the full current storage block in a short period of time and stores the data corresponding to the modified content in the target storage area with a fixed range in the SSD, it is likely to cause multiple GC processing for the target storage area. Therefore, in order to prevent the above situation from happening, the full current storage block is determined as a limited storage block. Subsequently, the valid data stored in the full current storage block gradually becomes invalid data as the user continues to modify it. After the invalid data increases to the corresponding threshold, only one GC processing is required.

[0065] In one implementation, a plurality of target storage areas are set in the user space in the storage area of ​​the solid state drive, and each target storage area is correspondingly provided with a plurality of limited-use storage blocks; after S110, the method further includes: steps (2) to (3), the details of which are as follows:

[0066] Step (2): determining whether the multiple physical addresses recorded in the restricted data table include the physical address of the candidate storage block;

[0067] The restricted-use data table is used to record the physical addresses of multiple restricted-use storage blocks.

[0068] Specifically, as shown in Table 1, Table 1 is an example table of a restricted data table provided in an embodiment of the present application; the physical addresses of the m restricted physical blocks in Table 1 are arranged in chronological order of addition to the restricted data table, the physical address of the first restricted storage block is the earliest added, and the physical address of the mth restricted storage block is the latest added; it should be emphasized that Table 1 is only an exemplary display of the restricted data table. In actual operation, the format and content of the restricted data table can be determined according to actual needs, and the present application does not make specific limitations on this.

[0069] Table 1 Example of a restricted data table

[0070]

[0071] After the physical address of the candidate storage block is determined, the physical address of the candidate storage block can be compared with the physical addresses of multiple restricted storage blocks recorded in the restricted data table. If they are the same, the candidate storage block is considered to be a restricted storage block.

[0072] In one implementation, the number of physical addresses of the restricted storage blocks recorded in the restricted data table is m, where m is a positive integer, and the physical addresses of the m restricted storage blocks are arranged in the time sequence of adding to the restricted data table; step (1) includes: step (1.1) to step (1.2), the details of which are as follows:

[0073] Step (1.1): Among the physical addresses of the m restricted storage blocks recorded in the restricted data table, the physical address of the restricted storage block that was first added to the restricted data table is deleted.

[0074] Step (1.2): Add the physical address of the current storage block as the physical address of the restricted storage block into the restricted data table.

[0075] Specifically, the number m of physical addresses of restricted storage blocks recorded in the restricted data table is relatively fixed. Each time a new physical address is added thereto, an old physical address needs to be deleted. The deleted physical address is the earliest physical address added to the restricted data table at the current moment.

[0076] Step (3): If the multiple physical addresses recorded in the restricted data table include the physical address of the candidate storage block, determine that the candidate storage block is a restricted storage block.

[0077] Specifically, if it is determined that the candidate storage block is a limited-use storage block, it means that the candidate storage block cannot be processed by GC.

[0078] In one implementation, the method further includes: step (4), the details of which are as follows:

[0079] Step (4): Determine the number m of physical addresses of the restricted storage blocks according to the number of free storage blocks included in the reserved space.

[0080] Specifically, according to the number of free storage blocks included in the reserved space in the SSD, the m corresponding to the restricted data table is adjusted; in actual operation, the number of free storage blocks may refer to the number of free storage blocks when the SSD leaves the factory, or may refer to the number of free storage blocks at a certain moment during the use of the SSD, and this application does not make any specific limitation on this.

[0081] In one implementation, step (4) includes: step (4.1), the details of which are as follows:

[0082] Step (4.1): in response to the number of free storage blocks included in the reserved space meeting the target condition, adjusting the number m of physical addresses of the restricted storage blocks;

[0083] The target condition is one of the following conditions:

[0084] The number of free storage blocks is a first value;

[0085] The ratio between the number of free memory blocks and the number of memory blocks included in the reserved space is a second value.

[0086] Specifically, step (4.1) is to further limit the process of determining m corresponding to the limited data table according to the number of free storage blocks included in the reserved space during the use of the SSD; wherein, both the triggering conditions (i.e., the target conditions) for adjusting the number m of physical addresses of the limited storage blocks are limited, and how to adjust the number m of physical addresses of the limited storage blocks is limited.

[0087] The target condition may be that the number of free storage blocks reaches a certain preset number, such as a first value, or that the ratio between the number of free storage blocks and the number of storage blocks included in the reserved space reaches a certain preset threshold, such as a second value;

[0088] When the above conditions are met, the above adjustment process for the number m of physical addresses of the limited storage blocks can be triggered; in practical applications, both the first value and the second value can be divided into multiple levels, which are used to correspond to different numbers m of physical addresses of the limited storage blocks;

[0089] For example, when the first value is 20, the number m of physical addresses of the restricted storage block is 5;

[0090] When the first value is 30, the number m of physical addresses of the restricted storage block is 8;

[0091] When the second value is 0.4, the number m of physical addresses of the restricted storage block is 7;

[0092] When the first value is 0.5, the number m of physical addresses of the restricted storage block is 8;

[0093] In actual operation, how to select the target condition and how to set the first value and the second value can be determined according to actual needs, and this application does not make specific limitations on this.

[0094] S130: performing garbage collection processing on the storage blocks to be reclaimed that are determined not to be restricted storage blocks to obtain free storage blocks for storing the data to be written.

[0095] Specifically, after determining that the storage block to be reclaimed is not a restricted storage block, garbage collection processing can be performed on the storage block to be reclaimed, and finally a storage block is obtained.

[0096] Second, the present application provides a solid state hard disk garbage collection device, such as Figure 2 As shown, Figure 2 A schematic diagram of the structure of a solid state drive garbage collection device provided in an embodiment of the present application, the device includes: a screening module 310 and an execution module 320;

[0097] A screening module 310, configured to determine a candidate storage block from a plurality of storage blocks to be reclaimed in response to receiving a write request;

[0098] The screening module 310 is further configured to, if the candidate storage block is a restricted storage block, repeatedly execute the step of determining the candidate storage block from the plurality of storage blocks to be reclaimed, until it is determined that the obtained candidate storage block is not a restricted storage block; wherein the restricted storage block is a storage block in the target storage area where the candidate storage block is located that is restricted from garbage collection;

[0099] The execution module 320 is used to perform garbage collection processing on the candidate storage blocks that are determined not to be restricted storage blocks to obtain free storage blocks for storing the data to be written.

[0100] In one implementation, the screening module 310 is further configured to determine the current storage block as a limited storage block in response to any current storage block in the target storage area being full.

[0101] In one implementation, a plurality of target storage areas are set in the user space in the storage area of ​​the solid state drive, and each target storage area is correspondingly provided with a plurality of restricted storage blocks; the screening module 310 is further used to determine whether the plurality of physical addresses recorded in the restricted data table include the physical address of the candidate storage block;

[0102] The restricted data table is used to record the physical addresses of multiple restricted storage blocks;

[0103] The screening module 310 is further configured to determine that the candidate storage block is a restricted storage block if the multiple physical addresses recorded in the restricted data table include the physical address of the candidate storage block.

[0104] In one implementation, the number of physical addresses of the restricted storage blocks recorded in the restricted data table is m, where m is a positive integer, and the physical addresses of the m restricted storage blocks are arranged in the order of time when they are added to the restricted data table; the screening module 310 is further used to delete the physical address of the restricted storage block that is added to the restricted data table earliest among the physical addresses of the m restricted storage blocks recorded in the restricted data table;

[0105] The screening module 310 is further used to add the physical address of the current storage block as the physical address of the restricted storage block into the restricted data table.

[0106] In one implementation, the storage area of ​​the solid state drive further includes: a reserved space; and the method further includes:

[0107] The screening module 310 is further configured to determine the number m of physical addresses of the restricted storage blocks according to the number of free storage blocks included in the reserved space.

[0108] In one implementation, the screening module 310 is further configured to adjust the number m of physical addresses of the restricted storage blocks in response to the number of free storage blocks included in the reserved space meeting the target condition;

[0109] The target conditions include at least one of the following:

[0110] The number of free storage blocks is a first value;

[0111] The ratio between the number of free memory blocks and the number of memory blocks included in the reserved space is a second value.

[0112] Third, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements steps S110 to S130 provided in the above embodiment when executing the computer program.

[0113] Fourthly, the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, steps S110 to S130 of the above embodiment are executed.

[0114] Fifth, the computer program product provided in the present application includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method in the previous method embodiment. The specific implementation can refer to steps S110 to S130 of the method embodiment, which will not be repeated here.

[0115] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0116] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0117] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0118] It should be noted that if the function is implemented in the form of a software function module 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 the present application can essentially be embodied in the form of a software product, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0119] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0120] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A solid state hard disk garbage collection method, characterized in that: Applied to a solid state drive, the method comprises: In response to receiving a write request, determining a candidate storage block from a plurality of storage blocks to be reclaimed; wherein the write request includes: data to be written; If the candidate storage block is a restricted storage block, the step of determining the candidate storage block from the plurality of storage blocks to be reclaimed is repeated until it is determined that the obtained candidate storage block is not the restricted storage block; wherein the restricted storage block is a storage block in the target storage area where the candidate storage block is located that is restricted from garbage collection; A garbage collection process is performed on the candidate storage blocks that are determined not to be the limited-use storage blocks to obtain free storage blocks for storing the data to be written.

2. The method according to claim 1, characterized in that The method further comprises: In response to any current storage block in the target storage area being fully written, the current storage block is determined as the limited storage block.

3. The method according to claim 2, characterized in that A plurality of the target storage areas are arranged in the user space of the storage area of ​​the solid state drive, and each of the target storage areas is correspondingly arranged with a plurality of the limited-use storage blocks; after determining the candidate storage block from the plurality of storage blocks to be reclaimed, the method further comprises: Determine whether the physical address of the candidate storage block is included in the plurality of physical addresses recorded in the restricted data table; Wherein, the restricted-use data table is used to record the physical addresses of a plurality of the restricted-use storage blocks; If the physical address of the candidate storage block is included in the plurality of physical addresses recorded in the restricted-use data table, the candidate storage block is determined to be the restricted-use storage block.

4. The method according to claim 3, characterized in that The number of the physical addresses of the limited storage blocks recorded in the limited data table is m, where m is a positive integer, and the physical addresses of the m limited storage blocks are arranged in a time sequence of being added to the limited data table; determining the current storage block as the limited storage block comprises: Among the physical addresses of the m limited-use storage blocks recorded in the limited-use data table, the physical address of the limited-use storage block that was first added to the limited-use data table is deleted; The physical address of the current storage block is added into the restricted data table as the physical address of the restricted storage block.

5. The method according to claim 4, characterized in that The storage area of ​​the solid state drive further includes: a reserved space; and the method further includes: The number m of physical addresses of the limited storage blocks is determined according to the number of the free storage blocks included in the reserved space.

6. The method according to claim 5, characterized in that The determining, according to the number of the free storage blocks included in the reserved space, the number m of physical addresses of the limited storage blocks comprises: In response to the number of the free storage blocks included in the reserved space meeting the target condition, adjusting the number m of physical addresses of the limited storage blocks; The target condition includes at least one of the following: The number of free storage blocks is a first value; A ratio between the number of the free storage blocks and the number of the storage blocks included in the reserved space is a second value.

7. A solid state hard disk garbage collection device, characterized in that: The device comprises: a screening module and an execution module; The screening module is used to determine a candidate storage block from a plurality of storage blocks to be reclaimed in response to receiving a write request; wherein the write request includes: data to be written; The screening module is further configured to, if the candidate storage block is a restricted storage block, repeatedly execute the step of determining the candidate storage block from the plurality of storage blocks to be reclaimed until it is determined that the obtained candidate storage block is not the restricted storage block; wherein the restricted storage block is a storage block in the target storage area where the candidate storage block is located that is restricted from garbage collection; The execution module is used to perform garbage collection processing on the candidate storage blocks that are determined not to be the limited-use storage blocks to obtain free storage blocks for storing the data to be written.

8. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store software programs, and the processor runs or executes the software programs stored in the memory so that the electronic device implements the solid state drive garbage collection method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes executed by a processor, and the program codes include code for implementing the solid-state hard disk garbage collection method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises program codes, and when a computer runs the computer program product, the computer executes the solid state hard disk garbage collection method as claimed in any one of claims 1 to 6.