Solid state disk space active recovery method, device and equipment and readable storage medium

By performing calculations of logical capacity and data storage statistics before the solid-state drive receives high-speed write data, it determines whether to perform space recycling, which solves the uncertainty of the solid-state drive in the normal working state, ensuring that the data is written Performance and space requirements.

CN119226183APending Publication Date: 2024-12-31MEMORIGHT (WUHAN) CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411307960.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

There are uncertainties in time and performance when performing space recovery in SSDs under normal working conditions, resulting in performance requirements that cannot ensure high-speed data writing.

Method used

When the host receives the preparation instruction before writing data at high speed through the host, it obtains the logical available capacity and data storage statistics of the solid state hard disk, calculates the actual available capacity and the capacity required to be recycled, and decides whether to perform space recycling or prompt deletion based on the recycling time and read and write bandwidth. Data, ensure that appropriate amount of space is recovered before writing data.

Benefits of technology

It realizes space and performance guarantee when the host writes data at high speed to the solid-state drive, provides a good experience in active solid-state drive space recovery, and avoids unnecessary data transfer and performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226183A_ABST
    Figure CN119226183A_ABST
Patent Text Reader

Abstract

The invention discloses a solid state disk space active recovery method, device and equipment and a readable storage medium. The solid state disk space active recovery method comprises the steps that the capacity of to-be-written data is obtained, and the logic available capacity and logic effective data capacity of a solid state disk and data storage statistics of all storage units are obtained; calculating the actual available capacity of the solid state disk according to the data storage statistics of each storage unit; according to the to-be-written data capacity and the actual available capacity, the capacity needing to be recycled is obtained through calculation; and according to the to-be-recycled capacity, the data storage statistics of each storage unit and the read-write bandwidth, calculating to obtain the to-be-recycled duration. According to the method, through a space active recovery mechanism for controlling the solid state disk based on the host, proper space recovery can be performed in advance according to the capacity of the to-be-written data when the host has the requirement of writing the data into the solid state disk at a high speed, so that the space and performance of the host during subsequent high-speed data writing into the solid state disk can be ensured.
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 disk space recovery, and in particular to a solid-state hard disk space active recovery method, device, equipment and readable storage medium. Background Art

[0002] Flash NAND (a non-volatile random access storage medium) has the characteristic that it cannot be overwritten in situ, that is, it must be erased before writing. Flash NAND is written in pages and erased in blocks (consisting of several pages). That is, a block must be erased as a whole before multiple pages inside it can be written in sequence.

[0003] Due to this characteristic of Flash NAND, when using SSDs (Solid State Drives) that use Flash NAND as storage media, as the number of data writes and modifications increases, valid data and invalid data will be mixed in the same Block. As the number of such blocks increases, useless data will occupy too much space. This space must be erased and reused only after valid data is recovered. At this time, we say that the SSD has entered a normal working state.

[0004] Any Flash NAND has a certain erase and write life. In the normal working state of SSD, in order to reduce unnecessary data movement, the existing SSD space recovery generally starts after the available space of Flash NAND is reduced to a certain extent, and stops after a certain amount of space is recovered, so as to avoid excessive space recovery affecting the life of Flash NAND. Space recovery is garbage recovery, which means that when the flash memory block in the SSD is full, new write operations will not be able to be performed, so garbage recovery is required to free up space. The garbage recovery algorithm usually adopts the "write amplification" strategy, that is, before erasing a flash memory block, the valid data of the flash memory block is copied to other flash memory blocks with free space, and then the flash memory block is erased.

[0005] Therefore, it can be seen that the time when the SSD performs space reclamation in normal working state is uncertain. In addition, if the valid data is evenly distributed in each block, the SSD needs to perform space reclamation from more blocks, which will take a long time, resulting in performance uncertainty when the SSD performs space reclamation. In summary, the time and performance uncertainty of the SSD performing space reclamation in normal working state make the SSD unable to ensure the performance requirements when writing data at high speed. Summary of the invention

[0006] The present application provides a method, device, equipment and readable storage medium for active space recovery of a solid-state hard drive, aiming to solve the technical problem that under normal working conditions, there is uncertainty in time and performance when performing space recovery on an SSD, which causes the SSD to be unable to ensure the performance requirements when writing data at high speed.

[0007] In a first aspect, an embodiment of the present application provides a method for actively reclaiming space on a solid-state hard disk, the method comprising:

[0008] When the host receives a preparation instruction before writing data to the SSD at high speed, it obtains the capacity of the data to be written, the logical available capacity of the SSD, the logical effective data capacity and the data storage statistics of each storage unit;

[0009] If the logical available capacity is greater than or equal to the capacity of the data to be written, the actual available capacity of the solid-state drive is calculated based on the data storage statistics of each storage unit;

[0010] If the actual available capacity is less than the capacity of the data to be written, the capacity to be reclaimed is calculated based on the capacity of the data to be written and the actual available capacity;

[0011] The required recycling time is calculated based on the required recycling capacity, data storage statistics of each storage unit, and read / write bandwidth;

[0012] If the required recycling time is less than or equal to the preset time, an instruction to execute space recycling is sent to the solid-state drive. If the required recycling time is greater than the preset time, a prompt to delete the data is output.

[0013] Optionally, after obtaining the logical available capacity, logical effective data capacity and data storage statistics of each storage unit of the solid state drive, the method further includes:

[0014] If the logical available capacity is smaller than the capacity of the data to be written, a prompt to delete the data is output.

[0015] Optionally, calculating the actual available capacity of the solid state drive according to the data storage statistics of each storage unit includes:

[0016] According to the data storage statistics of each storage unit, the actual effective data capacity of the solid state drive is calculated;

[0017] If the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, the solid-state drive is notified to execute the TRIM command to re-obtain the data storage statistics of each storage unit, and the actual available capacity of the solid-state drive is calculated based on the re-obtained data storage statistics of each storage unit.

[0018] Optionally, calculating the actual available capacity of the solid state drive according to the data storage statistics of each storage unit further includes:

[0019] The storage units containing all invalid data are searched from each storage unit, and the total capacity of the storage units containing all invalid data is calculated to obtain the actual available capacity of the solid state drive.

[0020] Optionally, the required recovery time is calculated based on the required recovery capacity, data storage statistics of each storage unit, and read / write bandwidth, and includes:

[0021] Sort each storage unit according to the effective data capacity from small to large to obtain a sorted sequence;

[0022] Traverse each storage unit in the sorted sequence in positive order, and calculate the recycling time of the storage unit according to the effective data capacity and read / write bandwidth in the storage unit;

[0023] When the sum of invalid data capacities in the traversed storage units reaches the capacity that needs to be reclaimed, the traversal is stopped, and the sum of the reclaim durations of the traversed storage units is counted, and the sum of the reclaim durations of the storage units is taken as the required reclaim duration.

[0024] Optionally, the required recovery time is calculated based on the required recovery capacity, data storage statistics of each storage unit, and read / write bandwidth, and further includes:

[0025] During the traversal process, the serial numbers of the traversed storage units that need to be recycled are recorded;

[0026] If the required reclamation time is less than or equal to the preset time, sending an instruction to the solid state drive to execute space reclamation includes:

[0027] If the required recycling time is less than or equal to the preset time, the numbers of the traversed storage units that need to be recycled and the instructions for executing space recycling are sent to the solid-state drive, so that the solid-state drive can execute space recycling according to the numbers of the traversed storage units that need to be recycled.

[0028] In a second aspect, an embodiment of the present application provides a solid state hard disk space active recovery device, the solid state hard disk space active recovery device comprising:

[0029] An acquisition module, used for acquiring the capacity of data to be written, the logical available capacity, the logical effective data capacity and the data storage statistics of each storage unit of the solid state drive when the host receives a preparation instruction before writing data to the solid state drive at high speed;

[0030] A first calculation module, configured to calculate the actual available capacity of the solid-state hard disk according to the data storage statistics of each storage unit if the logical available capacity is greater than or equal to the capacity of the data to be written;

[0031] A second calculation module is used to calculate the capacity to be reclaimed according to the capacity of the data to be written and the actual available capacity if the actual available capacity is less than the capacity of the data to be written;

[0032] The third calculation module is used to calculate the required recovery time according to the recovery capacity, data storage statistics and read / write bandwidth of each storage unit;

[0033] The decision-making execution module is used to send an instruction to execute space recovery to the solid-state drive if the required recovery time is less than or equal to the preset time, and output a prompt to delete the data if the required recovery time is greater than the preset time.

[0034] Optionally, the first computing module is used to:

[0035] According to the data storage statistics of each storage unit, the actual effective data capacity of the solid state drive is calculated;

[0036] If the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, the solid-state drive is notified to execute the TRIM command to re-obtain the data storage statistics of each storage unit, and the actual available capacity of the solid-state drive is calculated based on the re-obtained data storage statistics of each storage unit.

[0037] In a third aspect, an embodiment of the present application provides a solid-state hard drive space active recovery device, wherein the solid-state hard drive space active recovery device includes a processor, a memory, and a solid-state hard drive space active recovery program stored in the memory and executable by the processor, wherein when the solid-state hard drive space active recovery program is executed by the processor, the steps of the solid-state hard drive space active recovery method as described above are implemented.

[0038] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a solid-state hard drive space active recovery program is stored. When the solid-state hard drive space active recovery program is executed by a processor, the steps of the solid-state hard drive space active recovery method as described above are implemented.

[0039] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:

[0040] In an embodiment of the present application, when the host receives a preparation instruction before writing data to the solid-state hard disk at high speed, the capacity of the data to be written is obtained, and the logical available capacity, the logical effective data capacity and the data storage statistics of each storage unit of the solid-state hard disk are obtained; if the logical available capacity is greater than or equal to the capacity of the data to be written, the actual available capacity of the solid-state hard disk is calculated according to the data storage statistics of each storage unit; if the actual available capacity is less than the capacity of the data to be written, the capacity to be reclaimed is calculated according to the capacity of the data to be written and the actual available capacity; the required reclaim time is calculated according to the required reclaimed capacity, the data storage statistics of each storage unit and the read-write bandwidth; if the required reclaim time is less than or equal to the preset time, an instruction to execute space reclaim is sent to the solid-state hard disk; if the required reclaim time is greater than the preset time, a prompt to delete the data is output. The embodiment of the present application, through an active space recovery mechanism based on host control of the solid-state hard disk, can reclaim an appropriate amount of space in advance according to the capacity of the data to be written when the host has a need to write data to the solid-state hard disk at high speed, thereby ensuring the space and performance of the host when writing data to the solid-state hard disk at high speed subsequently. By outputting the capacity to be recovered and the required recovery time, and providing the execution of space recovery instructions and the active deletion of data options, the user is provided with a good experience of active solid-state hard disk space recovery. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a flow chart of an embodiment of a method for actively reclaiming space on a solid state drive of the present application;

[0042] Figure 2 For this application Figure 1 Detailed flow chart of step S20;

[0043] Figure 3 For this application Figure 1 A detailed flow chart of step S40;

[0044] Figure 4 This is a functional module diagram of an embodiment of a device for actively reclaiming space from a solid state hard disk of the present application;

[0045] Figure 5 This is a schematic diagram of the hardware structure of the solid-state hard disk space active recovery device involved in the embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 this application.

[0047] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0048] In a first aspect, an embodiment of the present application provides a method for actively reclaiming space on a solid state drive.

[0049] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of a method for actively reclaiming space on a solid state drive of the present application. Figure 1 As shown, the active SSD space recovery method includes:

[0050] Step S10, when the host receives a preparation instruction before writing data to the SSD at high speed, it obtains the capacity of data to be written, the logical available capacity of the SSD, the logical effective data capacity and the data storage statistics of each storage unit.

[0051] In this embodiment, the host is the execution subject, and the host sends instructions to the solid-state hard disk for execution control. When the host receives a preparation instruction before writing data to the solid-state hard disk at high speed, it means that the host will have a need to write data to the solid-state hard disk at high speed next. In order to meet the space and performance requirements of the subsequent host to write data to the solid-state hard disk at high speed, the solid-state hard disk is actively prepared for space recovery. If the space of the solid-state hard disk is insufficient for writing, the space of the solid-state hard disk is recovered in advance to avoid insufficient space when the subsequent host writes data to the solid-state hard disk at high speed, and to avoid the solid-state hard disk executing space recovery when the host writes data at high speed, thereby reducing the data writing performance. First, the capacity of the data to be written that needs to be written at high speed is obtained, as well as the logical available capacity of the solid-state hard disk, the logical effective data capacity and the data storage statistics of each storage unit are obtained. Among them, capacity refers to the size of the data volume, and the capacity is measured in commonly seen units such as KB (kilobytes), MB (megabytes), GB (gigabytes) and TB (terabytes). The sum of the logical available capacity and the logical effective data capacity is the total capacity of the solid-state drive, that is, the available capacity, used capacity and total capacity of the solid-state drive that we usually display when we check the space storage status of the solid-state drive. In this embodiment, the storage unit is a space storage management unit of the solid-state drive. The solid-state drive includes multiple storage units, each storage unit includes multiple Block blocks, and the data storage statistics of each storage unit include how much capacity is occupied by valid data in the storage unit and how much capacity is occupied by invalid data.

[0052] Step S20: If the logical available capacity is greater than or equal to the capacity of the data to be written, the actual available capacity of the solid state drive is calculated based on the data storage statistics of each storage unit.

[0053] In this embodiment, according to common sense, the data to be written can only be completely written when the logical available capacity is greater than or equal to the capacity of the data to be written, otherwise a prompt to delete the data can be output, and the relevant operations are returned to step S10 after the user actively deletes some data. As mentioned above, the data storage statistics of each storage unit include the capacity occupied by valid data and the capacity occupied by invalid data in the storage unit. Therefore, based on the data storage statistics of each storage unit, the actual available capacity of the solid-state drive can be calculated. It should be noted that the actual available capacity and the logical available capacity of the solid-state drive are not always consistent. After the operating system executes data deletion on the solid-state drive, the deleted data area is not always marked as an invalid data area in time, and it is usually marked as an invalid data area only after space recovery is performed.

[0054] Step S30: If the actual available capacity is smaller than the capacity of the data to be written, the capacity to be reclaimed is calculated based on the capacity of the data to be written and the actual available capacity.

[0055] In this embodiment, if the actual available capacity is less than the capacity of the data to be written, it means that the actual available capacity is not enough to completely write the data to be written, and it is necessary to perform space recovery on the solid state drive. Therefore, according to the capacity of the data to be written and the actual available capacity, the capacity of the data to be written minus the actual available capacity can be used to calculate the required recovery capacity. It should be noted that the calculated capacity is the minimum required recovery capacity that can completely write the data to be written. The required recovery capacity can be set to a larger value according to specific needs. It should also be noted that if the actual available capacity is greater than or equal to the capacity of the data to be written, it means that the actual available capacity is sufficient to completely write the data to be written, and it is not necessary to perform space recovery on the solid state drive. Among them, space recovery is garbage recovery. The primary task of space recovery is to identify invalid data blocks, that is, data that is no longer used or has been overwritten. Space recovery can be simply understood as a disk defragmentation mechanism in a solid state drive. Its specific work is to migrate the valid data in the blocks mixed with valid data and invalid data to other blocks with free space, and completely erase the blocks after the migration is completed, thereby forming a blank block to facilitate the writing of new data.

[0056] Step S40, calculating the required recovery time according to the required recovery capacity, data storage statistics of each storage unit and the read / write bandwidth.

[0057] In this embodiment, the read-write bandwidth refers to the amount of data that can be read, written and transmitted per unit time inside the solid-state hard disk, representing the data read-write transmission speed of the solid-state hard disk. For example, for a storage unit in which valid data exists, the effective data capacity that needs to be migrated is divided by the read-write bandwidth, and the duration of migrating the valid data in the storage unit, that is, the recovery duration of the storage unit, can be calculated. Each storage unit can be traversed, and when the capacity to be recovered meets the demand, the traversal is stopped, and the recovery duration of the traversed storage units is accumulated to calculate the required recovery duration for space recovery of the solid-state hard disk.

[0058] Step S50: If the required recycling time is less than or equal to the preset time, an instruction to execute space recycling is sent to the solid state drive; if the required recycling time is greater than the preset time, a prompt to delete the data is output.

[0059] In this embodiment, if the time required for recycling is less than or equal to the preset time, it means that the time required for recycling is short. After sending the instruction to execute space recycling to the solid-state hard disk, the solid-state hard disk can quickly execute and complete the space recycling, which will have a better user experience. On the contrary, if the time required for recycling is greater than the preset time, it means that the time required for recycling is long. If space recycling is executed, the user will have to wait for a long time, and the user experience will be poor. At this time, a prompt to delete data is output, and the user will actively delete some data before returning to the relevant operations performed in step S10.

[0060] In this embodiment, the host is the execution subject, and the host sends instructions to the solid-state drive for execution control. When the host receives the preparation instruction before writing data to the solid-state drive at high speed, it means that the host has the need to write data to the solid-state drive at high speed next. In order to meet the space and performance requirements of the subsequent host to write data to the solid-state drive at high speed, the solid-state drive is actively prepared for space recovery. If the space of the solid-state drive is not enough for writing, the solid-state drive is reclaimed in advance to avoid insufficient space when the subsequent host writes data to the solid-state drive at high speed, and to avoid the solid-state drive executing space recovery when the host writes data at high speed, thereby reducing the performance of data writing. According to the actual available capacity of the solid-state drive, it is judged whether space recovery is required, and the required recovery capacity and required recovery time are further calculated. By outputting the required recovery capacity and required recovery time, and providing execution space recovery instructions and active data deletion options, a good solid-state drive space active recovery experience is provided for users. Based on the space active recovery mechanism of the host controlling the solid-state drive, when the host has the need to write data to the solid-state drive at high speed, an appropriate amount of space recovery can be performed in advance according to the capacity of the data to be written, which can ensure the space and performance of the host when writing data to the solid-state drive at high speed in the future.

[0061] Furthermore, in one embodiment, after step S10, the method further includes:

[0062] If the logical available capacity is smaller than the capacity of the data to be written, a prompt to delete the data is output.

[0063] In this embodiment, if the logical available capacity is smaller than the capacity of the data to be written, it means that the available capacity of the solid state drive cannot completely write the data to be written, and a prompt to delete the data is output. After the user actively deletes some data, the process returns to step S10 for related operations.

[0064] Further, in one embodiment, referring to Figure 2 , Figure 2 For this application Figure 1 The detailed flow chart of step S20 is as follows: Figure 2 As shown, step S20 includes:

[0065] Step S201, calculating the actual effective data capacity of the solid state drive according to the data storage statistics of each storage unit;

[0066] Step S202, if the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, notify the solid state drive to execute the TRIM instruction, re-acquire the data storage statistics of each storage unit, and calculate the actual available capacity of the solid state drive based on the re-acquired data storage statistics of each storage unit.

[0067] In this embodiment, as mentioned above, the data storage statistics of each storage unit include the capacity occupied by valid data and the capacity occupied by invalid data in the storage unit. Therefore, according to the data storage statistics of each storage unit, the actual effective data capacity of the solid-state hard disk can be calculated. If the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, it means that there is a TRIM instruction that has not been executed in the system, and the solid-state hard disk is notified to execute the TRIM instruction immediately. Among them, TRIM means trimming, pruning, and cutting. The TRIM instruction enables the operating system to notify the solid-state hard disk which data blocks are no longer considered for use and can be internally erased. After the solid-state hard disk executes the TRIM instruction, the storage area notified by the operating system that is no longer considered for use is marked as invalid data, so that the data storage statistics of each storage unit of the solid-state hard disk may change, and the corresponding actual available capacity may increase. Therefore, the data storage statistics of each storage unit are re-acquired to calculate the actual available capacity of the solid-state hard disk.

[0068] Furthermore, in one embodiment, step S20 further includes:

[0069] The storage units containing all invalid data are searched from each storage unit, and the total capacity of the storage units containing all invalid data is calculated to obtain the actual available capacity of the solid state drive.

[0070] In this embodiment, storage units whose interiors contain all invalid data are searched from among the storage units, and the total capacity of the storage units whose interiors contain all invalid data is calculated, so as to obtain the actual available capacity of the solid state drive.

[0071] Further, in one embodiment, referring to Figure 3 , Figure 3 For this application Figure 1 The detailed flow chart of step S40 is as follows: Figure 3 As shown, step S40 includes:

[0072] Step S401, sorting each storage unit according to the effective data capacity from small to large to obtain a sorting sequence;

[0073] Step S402, traversing each storage unit in the sorting sequence in positive order, and calculating the recycling time of the storage unit according to the effective data capacity and the read / write bandwidth in the storage unit;

[0074] Step S403, when the sum of invalid data capacity in each traversed storage unit reaches the capacity that needs to be reclaimed, stop traversing, count the sum of the reclaiming time of each traversed storage unit, and take the sum of the reclaiming time of each storage unit as the required reclaiming time.

[0075] In this embodiment, the read / write bandwidth refers to the amount of data that can be read / written and transmitted per unit time inside the solid-state hard disk, representing the data read / write transmission speed of the solid-state hard disk. As mentioned above, the data storage statistics of each storage unit include the capacity occupied by valid data and the capacity occupied by invalid data in the storage unit. Each storage unit is sorted from small to large according to the effective data capacity, and each storage unit is traversed in positive order. In the process of traversing a certain storage unit, taking a certain storage unit in which valid data exists as an example, the effective data capacity that needs to be migrated is divided by the read / write bandwidth, and the time for migrating the valid data in the storage unit, that is, the recovery time of the storage unit, can be calculated. When the capacity that needs to be recovered meets the demand, the traversal is stopped, and the recovery time of the traversed storage units is accumulated, that is, the required recovery time is calculated.

[0076] Furthermore, in one embodiment, step S40 further includes:

[0077] During the traversal process, the serial numbers of the traversed storage units that need to be recycled are recorded;

[0078] If the required reclamation time is less than or equal to the preset time, sending an instruction to the solid state drive to execute space reclamation includes:

[0079] If the required recycling time is less than or equal to the preset time, the numbers of the traversed storage units that need to be recycled and the instructions for executing space recycling are sent to the solid-state drive, so that the solid-state drive can execute space recycling according to the numbers of the traversed storage units that need to be recycled.

[0080] In this embodiment, during the traversal process, the numbers of the traversed storage units that need to be reclaimed are recorded, that is, a record is made of the storage units that need to perform space reclamation, and the numbers of the traversed storage units that need to be reclaimed and instructions for performing space reclamation are sent to the solid-state drive, so that the solid-state drive does not need to consider which storage units to perform space reclamation in the future, and can directly perform space reclamation on the corresponding storage units according to the recorded storage unit numbers, thereby improving the efficiency of the solid-state drive in performing space reclamation.

[0081] In a second aspect, an embodiment of the present application also provides a solid state hard disk space active recovery device.

[0082] In one embodiment, referring to Figure 4 , Figure 4 This is a functional module diagram of an embodiment of the active recovery device for solid state hard disk space of the present application. Figure 4 As shown, the solid state hard disk space active recovery device includes:

[0083] The acquisition module 10 is used to acquire the capacity of data to be written, the logical available capacity of the solid state drive, the logical effective data capacity and the data storage statistics of each storage unit when the host receives a preparation instruction before writing data to the solid state drive at high speed;

[0084] A first calculation module 20 is used to calculate the actual available capacity of the solid state drive according to the data storage statistics of each storage unit if the logical available capacity is greater than or equal to the capacity of the data to be written;

[0085] The second calculation module 30 is used to calculate the capacity to be reclaimed according to the capacity of the data to be written and the actual available capacity if the actual available capacity is less than the capacity of the data to be written;

[0086] The third calculation module 40 is used to calculate the required recovery time according to the recovery capacity, data storage statistics and read / write bandwidth of each storage unit;

[0087] The decision execution module 50 is used to send an instruction to execute space recovery to the solid state drive if the required recovery time is less than or equal to the preset time, and output a prompt to delete the data if the required recovery time is greater than the preset time.

[0088] Furthermore, in one embodiment, the apparatus for actively reclaiming space from a solid state hard disk further includes a deletion module, which is used to:

[0089] If the logical available capacity is smaller than the capacity of the data to be written, a prompt to delete the data is output.

[0090] Furthermore, in one embodiment, the first calculation module 20 is used to:

[0091] According to the data storage statistics of each storage unit, the actual effective data capacity of the solid state drive is calculated;

[0092] If the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, the solid-state drive is notified to execute the TRIM command to re-obtain the data storage statistics of each storage unit, and the actual available capacity of the solid-state drive is calculated based on the re-obtained data storage statistics of each storage unit.

[0093] Furthermore, in one embodiment, the first calculation module 20 is further configured to:

[0094] The storage units containing all invalid data are searched from each storage unit, and the total capacity of the storage units containing all invalid data is calculated to obtain the actual available capacity of the solid state drive.

[0095] Furthermore, in one embodiment, the third calculation module 40 is used to:

[0096] Sort each storage unit according to the effective data capacity from small to large to obtain a sorted sequence;

[0097] Traverse each storage unit in the sorted sequence in positive order, and calculate the recycling time of the storage unit according to the effective data capacity and read / write bandwidth in the storage unit;

[0098] When the sum of invalid data capacities in the traversed storage units reaches the capacity that needs to be reclaimed, the traversal is stopped, and the sum of the reclaim durations of the traversed storage units is counted, and the sum of the reclaim durations of the storage units is taken as the required reclaim duration.

[0099] Furthermore, in one embodiment, the third calculation module 40 is further configured to:

[0100] During the traversal process, the serial numbers of the traversed storage units that need to be recycled are recorded;

[0101] The decision execution module 50 is further used for:

[0102] If the required recycling time is less than or equal to the preset time, the numbers of the traversed storage units that need to be recycled and the instructions for executing space recycling are sent to the solid-state drive, so that the solid-state drive can execute space recycling according to the numbers of the traversed storage units that need to be recycled.

[0103] Among them, the functional implementation of each module in the above-mentioned solid-state hard disk space active recovery device corresponds to the various steps in the above-mentioned solid-state hard disk space active recovery method embodiment, and its functions and implementation processes will not be repeated here one by one.

[0104] In a third aspect, an embodiment of the present application provides a solid state hard drive space active recovery device.

[0105] Reference Figure 5 , Figure 5 The hardware structure diagram of the solid state drive space active recovery device involved in the embodiment of the present application is shown in FIG. In the embodiment of the present application, the solid state drive space active recovery device may include a processor, a memory, a communication interface, and a communication bus.

[0106] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.

[0107] The communication interface includes input / output (I / O) interface, physical interface and logical interface, etc., which are used to realize the interconnection of devices inside the SSD space active recovery device, and the interface used to realize the interconnection between the SSD space active recovery device and other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.

[0108] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0109] The processor may be a general-purpose processor, and the general-purpose processor may call the SSD space active recovery program stored in the memory, and execute the SSD space active recovery method provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). Among them, the method executed when the SSD space active recovery program is called can refer to the various embodiments of the SSD space active recovery method of the present application, which will not be repeated here.

[0110] Those skilled in the art will understand that Figure 5 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0111] In a fourth aspect, an embodiment of the present application also provides a readable storage medium.

[0112] The readable storage medium of the present application stores a solid state hard disk space active recovery program, wherein when the solid state hard disk space active recovery program is executed by the processor, the steps of the solid state hard disk space active recovery method as described above are implemented.

[0113] Among them, the method implemented when the solid-state hard disk space active recovery program is executed can refer to the various embodiments of the solid-state hard disk space active recovery method of the present application, and will not be repeated here.

[0114] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0115] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.

[0116] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.

[0117] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0118] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.

[0119] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.

[0120] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for actively reclaiming solid state hard disk space, characterized in that: The method for actively reclaiming solid state hard disk space comprises: When the host receives a preparation instruction before writing data to the SSD at high speed, it obtains the capacity of the data to be written, the logical available capacity of the SSD, the logical effective data capacity and the data storage statistics of each storage unit; If the logical available capacity is greater than or equal to the capacity of the data to be written, the actual available capacity of the solid-state drive is calculated based on the data storage statistics of each storage unit; If the actual available capacity is less than the capacity of the data to be written, the capacity to be reclaimed is calculated based on the capacity of the data to be written and the actual available capacity; The required recycling time is calculated based on the required recycling capacity, data storage statistics of each storage unit, and read / write bandwidth; If the required recycling time is less than or equal to the preset time, an instruction to execute space recycling is sent to the solid-state drive. If the required recycling time is greater than the preset time, a prompt to delete the data is output.

2. The method for actively reclaiming solid state hard disk space as claimed in claim 1, characterized in that: After obtaining the logical available capacity, logical effective data capacity and data storage statistics of each storage unit of the solid state drive, the method further includes: If the logical available capacity is smaller than the capacity of the data to be written, a prompt to delete the data is output.

3. The method for actively reclaiming solid state hard disk space as claimed in claim 1, characterized in that: The actual available capacity of the solid state drive is calculated based on the data storage statistics of each storage unit, including: According to the data storage statistics of each storage unit, the actual effective data capacity of the solid state drive is calculated; If the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, the solid-state drive is notified to execute the TRIM command to re-obtain the data storage statistics of each storage unit, and the actual available capacity of the solid-state drive is calculated based on the re-obtained data storage statistics of each storage unit.

4. The method for actively reclaiming solid state hard disk space as claimed in claim 1, characterized in that: The calculating the actual available capacity of the solid state drive according to the data storage statistics of each storage unit also includes: The storage units containing all invalid data are searched from each storage unit, and the total capacity of the storage units containing all invalid data is calculated to obtain the actual available capacity of the solid state drive.

5. The method for actively reclaiming solid state hard disk space as claimed in claim 1, characterized in that: The required recovery time is calculated based on the required recovery capacity, data storage statistics of each storage unit and read / write bandwidth, including: Sort each storage unit according to the effective data capacity from small to large to obtain a sorted sequence; Traverse each storage unit in the sorted sequence in positive order, and calculate the recycling time of the storage unit according to the effective data capacity and read / write bandwidth in the storage unit; When the sum of invalid data capacities in the traversed storage units reaches the capacity that needs to be reclaimed, the traversal is stopped, and the sum of the reclaim durations of the traversed storage units is counted, and the sum of the reclaim durations of the storage units is taken as the required reclaim duration.

6. The method for actively reclaiming solid state hard disk space as claimed in claim 5, characterized in that: The required recovery capacity, data storage statistics of each storage unit and read / write bandwidth are stored according to the need, and the required recovery time is calculated to include: During the traversal process, the serial numbers of the traversed storage units that need to be recycled are recorded; If the required reclamation time is less than or equal to the preset time, sending an instruction to the solid state drive to execute space reclamation includes: If the required recycling time is less than or equal to the preset time, the numbers of the traversed storage units that need to be recycled and the instructions for executing space recycling are sent to the solid-state drive, so that the solid-state drive can execute space recycling according to the numbers of the traversed storage units that need to be recycled.

7. A solid state hard disk space active recovery device, characterized in that: The solid state hard disk space active recovery device comprises: An acquisition module, used for acquiring the capacity of data to be written, the logical available capacity, the logical effective data capacity and the data storage statistics of each storage unit of the solid state drive when the host receives a preparation instruction before writing data to the solid state drive at high speed; A first calculation module, configured to calculate the actual available capacity of the solid-state hard disk according to the data storage statistics of each storage unit if the logical available capacity is greater than or equal to the capacity of the data to be written; A second calculation module is used to calculate the capacity to be reclaimed according to the capacity of the data to be written and the actual available capacity if the actual available capacity is less than the capacity of the data to be written; The third calculation module is used to calculate the required recovery time according to the recovery capacity, data storage statistics and read / write bandwidth of each storage unit; The decision-making execution module is used to send an instruction to execute space recovery to the solid-state drive if the required recovery time is less than or equal to the preset time, and output a prompt to delete the data if the required recovery time is greater than the preset time.

8. The active recovery device for solid state hard disk space as claimed in claim 7, characterized in that: The first computing module is used for: According to the data storage statistics of each storage unit, the actual effective data capacity of the solid state drive is calculated; If the difference between the actual effective data capacity and the logical effective data capacity is greater than the preset difference, the solid-state drive is notified to execute the TRIM command to re-obtain the data storage statistics of each storage unit, and the actual available capacity of the solid-state drive is calculated based on the re-obtained data storage statistics of each storage unit.

9. A solid state hard disk space active recovery device, characterized in that: The solid-state hard drive space active recovery device includes a processor, a memory, and a solid-state hard drive space active recovery program stored in the memory and executable by the processor, wherein when the solid-state hard drive space active recovery program is executed by the processor, the steps of the solid-state hard drive space active recovery method as described in any one of claims 1 to 6 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a solid state hard disk space active recovery program, wherein when the solid state hard disk space active recovery program is executed by the processor, the steps of the solid state hard disk space active recovery method as described in any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Data writing method for solving overwrite speed drop of file system

    CN119960693A

  • Space-borne solid state disk garbage collection method and device, storage medium and equipment

    CN121455839A

  • Spaceborne solid state disk garbage collection method, device, storage medium and equipment

    CN121455839B