A garbage collection test method, device, equipment and medium
Patent Information
- Application Number
- CN202311743586.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-15
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2043-12-15
AI Technical Summary
[0005]本发明的目的是提供一种垃圾回收测试方法、装置、设备及介质,以解决在固态硬盘使用初期无法对垃圾回收流程进行验证的问题
[0053] The garbage collection testing method provided by this invention obtains the trigger thresholds of events that trigger garbage collection in a solid-state drive (SSD). These trigger thresholds include at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold. Each trigger threshold is modified to obtain a new trigger threshold, where the new threshold is lower than the corresponding trigger threshold. Preset read and write operations are performed on the SSD using a disk input/output performance testing tool. Logs corresponding to these preset read and write operations are obtained from the SSD, and the triggering status of events corresponding to the trigger thresholds and the corresponding garbage collection events are verified based on the logs. The beneficial effect of this invention is that by actively modifying the trigger thresholds of multiple events that can trigger garbage collection, the SSD can be forced to enter various garbage collection scenarios in advance. This allows for subjective verification of the completeness of the garbage collection code and the reliability of the garbage collection process based on the log content generated by the SSD. This enables early detection and resolution of problems in the early stages of SSD product development, improving product performance.
Smart Images

Figure CN117724917B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of solid-state drive technology, and in particular to a waste recycling testing method, apparatus, equipment, and medium. Background Technology
[0002] Solid State Disk (SSD) garbage collection is an important automated process that is mainly used to manage the idle space or space with deleted data in the SSD, thereby improving the performance of the SSD and extending the life of the device.
[0003] Generally, solid-state drives (SSDs) trigger garbage collection in several ways during use: data retention, read disturbance, write errors, and wear leveling. However, in the early stages of SSD use, due to the small amount of data stored, there are usually not many garbage collection triggers, so these various garbage collection trigger scenarios cannot be effectively verified. This ultimately leads to the inability to verify the robustness of the garbage collection process in the early stages of SSD use, and by the time problems are discovered in the later stages of SSD use, it is often too late.
[0004] Given the above issues, how to solve the problem of not being able to verify the garbage collection process in the early stages of solid-state drive use is an urgent problem for technicians in this field. Summary of the Invention
[0005] The purpose of this invention is to provide a waste recycling testing method, apparatus, equipment, and medium to solve the problem that the waste recycling process cannot be verified in the early stages of solid-state drive use.
[0006] To address the aforementioned technical problems, this invention provides a waste recycling testing method, comprising:
[0007] Obtain the trigger threshold for events used to trigger garbage collection in the solid-state drive; wherein, the trigger threshold includes at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold;
[0008] Modify each of the aforementioned trigger thresholds to obtain a corresponding new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold.
[0009] The solid-state drive was subjected to preset read and write operations using a disk input / output performance testing tool.
[0010] Obtain the logs of the solid-state drive corresponding to the preset read / write operation, and verify the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection status based on the logs.
[0011] On one hand, the preset read / write operations performed on the solid-state drive using a disk input / output performance testing tool include:
[0012] When the data retention threshold is modified to obtain a new data retention threshold, the solid-state drive is subjected to random write operations for a continuous preset time using the disk input / output performance testing tool;
[0013] When the readable threshold is modified to obtain a new readable threshold, the disk input / output performance testing tool is used to continuously read the space of the solid-state drive of the first preset size.
[0014] When the write data status value is modified to obtain a new write data status value, the second preset size of data is written to the solid-state drive through the disk input / output performance testing tool.
[0015] When the wear leveling threshold is modified to obtain a new wear leveling threshold, continuous write operations are performed on the solid-state drive using the disk input / output performance testing tool.
[0016] On the other hand, verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection triggering status based on the logs includes:
[0017] When the trigger threshold is the data retention threshold, the triggering status of the data retention event and the corresponding garbage collection triggering status are verified according to the log.
[0018] When the trigger threshold is the readable threshold, the triggering status of the reading interference event and the corresponding garbage collection triggering status are verified according to the log.
[0019] When the trigger threshold is the write data status value, the triggering status of the data write error event and the corresponding garbage collection are verified according to the log.
[0020] When the trigger threshold is the wear leveling threshold, the triggering status of the wear leveling event and the corresponding garbage collection event are verified according to the log.
[0021] On the other hand, modifying each of the trigger thresholds to obtain the corresponding new trigger thresholds includes:
[0022] When the trigger threshold is the data retention threshold, the data retention threshold is modified to a first preset time value through the first serial port command, so that the disk input / output performance testing tool can perform a continuous random write operation on the solid-state drive for a second preset time value.
[0023] Wherein, the ratio of the first preset time value to the initial data retention threshold is not greater than one hundredth, and the second preset time value is not less than twice the first preset time value;
[0024] When the trigger threshold is the readable threshold, the readable threshold is modified to the first preset number of times through the second serial port command, so as to continuously read the space of the first preset size of the solid-state drive through the disk input / output performance testing tool;
[0025] Wherein, the ratio of the first preset number of times to the initial readable threshold is no greater than one ten-thousandth, and the first preset size is no greater than 1 megabyte;
[0026] When the trigger threshold is the write data status value, the write data status value is modified to 1 through the third serial port command so that the second preset size of data can be written to the solid-state drive through the disk input / output performance testing tool;
[0027] The second preset size is not less than 20 gigabytes;
[0028] When the trigger threshold is the wear leveling threshold, the wear leveling threshold is modified to the second preset number of times via the fourth serial port command, so as to enable continuous write operation of the solid-state drive through the disk input / output performance testing tool.
[0029] The second preset number of times is no greater than 2.
[0030] On the other hand, the step of verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection triggering status based on the logs includes:
[0031] Based on the log, determine whether the event corresponding to the trigger threshold has been triggered;
[0032] If the event is not triggered, the corresponding trigger threshold is modified again, and the process proceeds to the step of performing preset read and write operations on the solid-state drive using a disk input / output performance testing tool; wherein the trigger threshold modified again is less than the trigger threshold modified for the first time.
[0033] If the event is triggered, determine whether garbage collection has been triggered based on the log.
[0034] If garbage collection is triggered, it confirms that the garbage collection function of the solid-state drive is normal.
[0035] If garbage collection is not triggered, it is confirmed that the garbage collection function of the solid-state drive is abnormal, and a prompt message indicating that the garbage collection function of the solid-state drive is abnormal is output.
[0036] On the other hand, after verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection triggering status based on the logs, the method further includes:
[0037] Restore the new trigger threshold to the original trigger threshold;
[0038] The test process erases the data written to the solid-state drive.
[0039] The usage time of the solid-state drive is reset to zero, and the solid-state drive is powered off.
[0040] On the other hand, after verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection status based on the logs, it also includes...
[0041] A target trigger threshold is generated based on the triggering of the event and the corresponding garbage collection triggering.
[0042] Modify the new trigger threshold to the target trigger threshold;
[0043] Wherein, the target trigger threshold is less than the original trigger threshold and greater than the new trigger threshold.
[0044] To address the aforementioned technical problems, the present invention also provides a waste recycling testing device, comprising:
[0045] The acquisition module is used to acquire the trigger threshold of the event used to trigger garbage collection in the solid-state drive; wherein, the trigger threshold includes at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold;
[0046] A modifier is used to modify each of the trigger thresholds to obtain a new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold.
[0047] The read / write module is used to perform preset read / write operations on the solid-state drive using a disk input / output performance testing tool;
[0048] The verification module is used to obtain the logs of the solid-state drive corresponding to the preset read and write operations, and to verify the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection based on the logs.
[0049] To address the aforementioned technical problems, the present invention also provides a waste recycling testing device, comprising:
[0050] Memory, used to store computer programs;
[0051] A processor is used to implement the steps of the garbage collection test method described above when executing the computer program.
[0052] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned garbage collection test method.
[0053] The garbage collection testing method provided by this invention obtains the trigger thresholds of events that trigger garbage collection in a solid-state drive (SSD). These trigger thresholds include at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold. Each trigger threshold is modified to obtain a new trigger threshold, where the new threshold is lower than the corresponding trigger threshold. Preset read and write operations are performed on the SSD using a disk input / output performance testing tool. Logs corresponding to these preset read and write operations are obtained from the SSD, and the triggering status of events corresponding to the trigger thresholds and the corresponding garbage collection events are verified based on the logs. The beneficial effect of this invention is that by actively modifying the trigger thresholds of multiple events that can trigger garbage collection, the SSD can be forced to enter various garbage collection scenarios in advance. This allows for subjective verification of the completeness of the garbage collection code and the reliability of the garbage collection process based on the log content generated by the SSD. This enables early detection and resolution of problems in the early stages of SSD product development, improving product performance.
[0054] In addition, the present invention also provides a waste recycling testing device, equipment and medium, with the same effect as above. Attached Figure Description
[0055] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 A flowchart of a waste recycling testing method provided in an embodiment of the present invention;
[0057] Figure 2 This is a schematic diagram of a waste recycling testing device provided in an embodiment of the present invention;
[0058] Figure 3 This is a schematic diagram of a waste recycling testing device provided in an embodiment of the present invention. Detailed Implementation
[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0060] The core of this invention is to provide a waste recycling testing method, apparatus, equipment, and medium to solve the problem that the waste recycling process cannot be verified in the early stages of solid-state drive use.
[0061] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] Solid-state drive (SSD) garbage collection is an important automated process that is mainly used to manage the unused space or space with deleted data on SSDs, thereby improving SSD performance and extending device life.
[0063] During garbage collection, the system first identifies deleted or invalid data on the solid-state drive (SSD), i.e., idle data blocks. These data blocks typically become invalid due to user deletion or update operations. Garbage collection marks these data blocks as reclaimable and erases them in subsequent steps.
[0064] In addition, once invalid data is identified, garbage collection also performs a data compaction operation. Specifically, useful data is copied from one block to another to make room for new data. This helps reduce write amplification and improve write performance. After compaction is complete, garbage collection performs a block erasure operation, marking the cleared data blocks as free for subsequent write operations.
[0065] Generally, solid-state drives (SSDs) trigger garbage collection in several ways during use: data retention, read interference, write errors, and wear leveling. However, garbage collection is usually not triggered in the early stages of SSD use, making it impossible to verify the garbage collection process. In view of this problem, this invention provides a garbage collection testing method to address the issue of not being able to verify the garbage collection process in the early stages of SSD use.
[0066] Figure 1 This is a flowchart illustrating a waste recycling testing method provided in an embodiment of the present invention. Figure 1 As shown, the method includes:
[0067] S10: Get the trigger threshold for events used to trigger garbage collection in the solid-state drive.
[0068] Among them, the trigger thresholds include at least the data retention threshold, the readable threshold, the write data status value, and the wear leveling threshold.
[0069] Specifically, the first step is to develop test code for garbage collection testing, which implements the entire garbage collection testing process. Since data retention events, read interference events, data write error events, and wear leveling events all trigger garbage collection, the test code needs to obtain the trigger thresholds for these events and adjust these thresholds to trigger the events, thereby initiating garbage collection earlier. The following explains the scenarios where several events trigger garbage collection:
[0070] When a data retention event is triggered, data cleanup can be performed, thereby forcibly garbage collecting invalid data blocks. Typically, the data retention threshold is 81 days at 40 degrees Celsius; when 81 days are reached, data cleanup is performed on the data in the solid-state drive.
[0071] Read interference events can cause electrons to enter the floating gate of the flash memory in a solid-state drive (SSD). This extra electron entry shifts the transistor threshold voltage to the right, leading to data loss. To overcome read interference events, garbage collection needs to be triggered. Specifically, this involves recording the number of reads for each block on each SSD. Before this number reaches a readable threshold (typically tens of thousands of times), all data on the block is read out, erased, and then written back, or the data is moved to another location.
[0072] A data write error occurs when the backend code returns a status after writing data to the flash memory. If the data is written successfully, the status value is 0; if the write fails, the status value is 1, confirming a data write error. When a status value of 1 is received, the written data is considered garbage data and will be forcibly reclaimed.
[0073] Wear leveling refers to the limitation on the number of erase / write cycles for each block in a solid-state drive's flash memory. The flash memory transition layer ensures that the number of erase / write cycles (Program / Erase, PE) for each block remains within a certain range, thereby extending the overall lifespan of the solid-state drive. For example, the wear leveling threshold is 320 (the difference between the maximum and minimum PE values of a block). Wear leveling is activated when the PE difference exceeds this threshold.
[0074] S11: Modify each trigger threshold to obtain the corresponding new trigger threshold.
[0075] Among them, the new trigger threshold is less than the corresponding trigger threshold.
[0076] Furthermore, each trigger threshold is modified to obtain a new trigger threshold. That is, the data retention threshold, readable threshold, write data status value, and wear leveling threshold are modified separately to obtain the corresponding new modified data retention threshold, new readable threshold, new write data status value, and new wear leveling threshold.
[0077] It should be noted that the new trigger thresholds are all lower than the corresponding trigger thresholds, in order to trigger garbage collection earlier. In this embodiment, the size of the new trigger thresholds is not limited; it depends on the specific implementation.
[0078] S12: Perform preset read and write operations on the solid-state drive using a disk input / output performance testing tool.
[0079] S13: Obtain the logs of the solid-state drive corresponding to the preset read / write operation, and verify the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection status based on the logs.
[0080] Furthermore, preset read and write operations are performed on the solid-state drive using the Flexible I / O Tester (FIO) tool to trigger garbage collection. The specific content of the preset read and write operations is not limited in this embodiment and depends on the specific implementation.
[0081] Finally, the logs of the solid-state drive corresponding to the preset read / write operations are obtained, and the triggering status of events corresponding to the trigger thresholds and the corresponding garbage collection are verified based on the logs, thereby realizing the early verification of the garbage collection function. In this embodiment, there are no restrictions on the specific circumstances of verifying the triggering status of events corresponding to the trigger thresholds and the corresponding garbage collection based on the logs; it depends on the specific implementation.
[0082] In this embodiment, the trigger thresholds for events that trigger garbage collection in the solid-state drive (SSD) are obtained. These trigger thresholds include at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold. Each trigger threshold is modified to obtain a new trigger threshold, where the new threshold is less than the corresponding trigger threshold. Pre-defined read / write operations are performed on the SSD using a disk input / output performance testing tool. Logs corresponding to these pre-defined read / write operations are obtained from the SSD, and the triggering status of the events corresponding to the trigger thresholds and the corresponding garbage collection events are verified based on the logs. Therefore, by actively modifying the trigger thresholds of various events that can trigger garbage collection, the SSD can be forced to enter various garbage collection scenarios in advance. This allows for subjective verification of the completeness of the garbage collection code and the reliability of the garbage collection process based on the log content generated by the SSD. Problems can be identified and resolved early in the early stages of SSD product development, improving product performance.
[0083] Based on the above embodiments, in some embodiments, performing preset read and write operations on the solid-state drive using a disk input / output performance testing tool includes:
[0084] S120: When the data retention threshold is modified to obtain a new data retention threshold, random write operations are performed on the solid-state drive for a continuous preset time using a disk input / output performance testing tool.
[0085] S121: When the readable threshold is modified to obtain a new readable threshold, a continuous read operation is performed on the first preset size of the solid-state drive using a disk input / output performance testing tool.
[0086] S122: When a new write data status value is obtained by modifying the write data status value, write data of a second preset size to the solid-state drive through the disk input / output performance test tool.
[0087] S123: When a new wear leveling threshold is obtained by modifying the wear leveling threshold, perform continuous write operations on the solid-state drive using a disk input / output performance testing tool.
[0088] Specifically, in order to trigger different events and thus garbage collection under different events, when performing preset read and write operations on the solid-state drive using disk input / output performance testing tools, different read and write methods need to be adopted according to the specific events, as follows:
[0089] When a new data retention threshold is obtained by modifying the data retention threshold, garbage collection under the data retention event is triggered. Specifically, this involves performing random write operations on the SSD for a preset duration using a disk I / O performance testing tool. When a new readable threshold is obtained by modifying the readable threshold, garbage collection under the read / write interference event is triggered. Specifically, this involves performing continuous read operations on a first preset size of space on the SSD using a disk I / O performance testing tool. When a new write data status value is obtained by modifying the write data status value, garbage collection under the data write error event is triggered. Specifically, this involves writing a second preset size of data to the SSD using a disk I / O performance testing tool. When a new wear leveling threshold is obtained by modifying the wear leveling threshold, garbage collection under the wear leveling event is triggered. Specifically, this involves performing continuous write operations on the SSD using a disk I / O performance testing tool. It should be noted that this embodiment does not limit the specific process of the random write operation, nor the first and second preset sizes; these are determined based on the specific implementation.
[0090] Based on the above embodiments, in some embodiments, the triggering status of events corresponding to the log verification trigger threshold and the corresponding garbage collection triggering status include:
[0091] S130: When the trigger threshold is the data retention threshold, verify the triggering status of the data retention event and the corresponding garbage collection status based on the logs.
[0092] S131: When the trigger threshold is the readable threshold, verify the triggering status of the interference event and the corresponding garbage collection status based on the log.
[0093] S132: When the trigger threshold is the write data status value, verify the triggering status of the data write error event and the corresponding garbage collection status based on the log.
[0094] S133: When the trigger threshold is the wear leveling threshold, verify the triggering status of the wear leveling event and the corresponding garbage collection status based on the logs.
[0095] In practice, since different modifications to the trigger thresholds can trigger different events, and thus trigger garbage collection under different events, the triggering of events and the corresponding garbage collection are related to the specific modified trigger thresholds, as follows:
[0096] When the trigger threshold is the data retention threshold, verify the triggering of data retention events and the corresponding garbage collection events based on the logs. When the trigger threshold is the readable threshold, verify the triggering of read interference events and the corresponding garbage collection events based on the logs. When the trigger threshold is the write data status value, verify the triggering of data write error events and the corresponding garbage collection events based on the logs. When the trigger threshold is the wear leveling threshold, verify the triggering of wear leveling events and the corresponding garbage collection events based on the logs.
[0097] The following describes the specific modifications to different trigger thresholds in conjunction with the above embodiments:
[0098] (1) Modify the data retention threshold;
[0099] When the trigger threshold is the data retention threshold, the data retention threshold is modified to the first preset time value through the first serial port command; wherein the ratio of the first preset time value to the initial data retention threshold is no greater than one hundredth.
[0100] In practice, the data retention threshold is typically 81 days at 40 degrees Celsius. To trigger garbage collection under the data retention event earlier, the data retention threshold is modified to a first preset time value via a first serial port command. It's important to note that the ratio of the first preset time value to the initial data retention threshold should not exceed one-hundredth. This embodiment does not impose a limit on the first preset time value; it depends on the specific implementation. For example, the first preset time value can be set to 0.5 hours.
[0101] Furthermore, to trigger garbage collection under the data retention event, random write operations are performed on the solid-state drive (SSD) for a continuous period of a second preset time using a disk I / O performance testing tool. It is important to note that the second preset time value is no less than twice the first preset time value, thereby ensuring sufficient random writes to the SSD and guaranteeing the triggering of both the data retention event and garbage collection. In this embodiment, the second preset time value is not limited and depends on the specific implementation. For example, a second preset time value of 4 hours can be set.
[0102] (2) Modify the readable threshold;
[0103] When the trigger threshold is the readable threshold, the readable threshold is modified to the first preset number of times via the second serial port command. The ratio of the first preset number of times to the initial readable threshold is no greater than one ten-thousandth.
[0104] In practice, the readable threshold for read / write interference events typically reaches tens of thousands of times. To trigger garbage collection under read / write interference events in advance, the readable threshold is modified to a first preset number of times via a second serial port command. It should be noted that the ratio of the first preset number of times to the initial readable threshold is no greater than one ten-thousandth. This embodiment does not impose a limit on the first preset number of times; it depends on the specific implementation. For example, the first preset number of times can be set to 10 times.
[0105] Furthermore, to trigger garbage collection due to read / write interference events, a disk I / O performance testing tool is used to continuously read a space of a first preset size on the solid-state drive. It is important to note that the first preset size is no larger than 1 megabyte, ensuring sufficient continuous reading of the solid-state drive and guaranteeing the triggering of both read / write interference events and garbage collection. In this embodiment, the first preset size is not limited and depends on the specific implementation. For example, the first preset size can be set to 1 megabyte.
[0106] (3) Modify the write data status value;
[0107] When the trigger threshold is the write data status value, the write data status value is modified to 1 via the third serial port command.
[0108] In practice, when data is written successfully, the write status value is 0; when data is written unsuccessfully, the write status value is 1. To trigger garbage collection in advance in the event of a data write error, the write status value is modified to 1 via a third serial port command.
[0109] Furthermore, to trigger garbage collection under a data write error event, a second preset size of data is written to the solid-state drive (SSD) using a disk I / O performance testing tool. It is important to note that the second preset size is no less than 20 gigabytes to ensure sufficient data writing to the SSD and guarantee the triggering of both the data write error event and garbage collection. This embodiment does not impose a limit on the second preset size; it depends on the specific implementation. For example, the second preset size can be set to 20 megabytes.
[0110] (4) Modify the wear leveling threshold;
[0111] When the trigger threshold is the wear leveling threshold, the wear leveling threshold is modified to the second preset number of times via the fourth serial port command; wherein the second preset number of times is not greater than 2.
[0112] In practice, the wear leveling threshold is typically 320. To trigger garbage collection under the wear leveling event earlier, the wear leveling threshold is modified to a second preset number of times via a fourth serial port command. It should be noted that the second preset number of times is no greater than 2. This embodiment does not impose a limit on the second preset number of times; it depends on the specific implementation. For example, the second preset number of times can be set to 2.
[0113] Correspondingly, continuous write operations are performed on the solid-state drive using disk I / O performance testing tools to ensure the triggering of wear leveling events and garbage collection. This embodiment does not impose restrictions on the write location or the size of the written data during continuous write operations; these are determined based on the specific implementation.
[0114] In this way, read and write operations under different events are realized.
[0115] Based on the above embodiments, in some embodiments, the triggering status of events corresponding to the log verification trigger threshold and the corresponding garbage collection triggering status include:
[0116] S135: Determine whether the event corresponding to the trigger threshold has been triggered based on the log; if not, proceed to step S136; if yes, proceed to step S137.
[0117] S136: Modify the corresponding trigger threshold again and proceed to step S12.
[0118] The trigger threshold for the second modification is lower than the trigger threshold for the first modification.
[0119] S137: Determine whether garbage collection has been triggered based on the log; if yes, proceed to step S138; if no, proceed to step S139.
[0120] S138: Confirm that the solid-state drive's garbage collection function is working properly.
[0121] S139: Confirm that the solid-state drive's garbage collection function is abnormal, and output a prompt message indicating that the solid-state drive's garbage collection function is abnormal.
[0122] Specifically, to determine the triggering of events and the corresponding garbage collection, the system checks the logs to see if the event corresponding to the trigger threshold has been triggered. If the event is not triggered, it is assumed that the corresponding trigger threshold is not low enough, and the trigger threshold is adjusted again, with the adjusted threshold being lower than the initial threshold. Then, the system performs preset read and write operations on the SSD using a disk I / O performance testing tool to re-trigger garbage collection.
[0123] If an event is triggered, the system checks the logs to determine if garbage collection has been triggered. If garbage collection is triggered, the system confirms that the SSD's garbage collection function is working properly; if garbage collection is not triggered, the system confirms that the SSD's garbage collection function is malfunctioning, and outputs a message indicating this malfunction. This process effectively determines the event and the triggering status of garbage collection.
[0124] Based on the above embodiments, in some embodiments, after verifying the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection triggering status according to the log, the method further includes:
[0125] S14: Restore the new trigger threshold to the trigger threshold before modification.
[0126] S15: Clear the data written to the solid-state drive during the test process.
[0127] S16: Reset the SSD's usage time to zero and power off the SSD.
[0128] In practice, after verifying the garbage collection function of the SSD, to restore its normal operation, the trigger threshold modified during the testing process needs to be reverted. Specifically, the new trigger threshold should be restored to its original value. For example, if the wear leveling threshold was 320 before testing, and was modified to 2 during testing, it needs to be restored to 320 after the test.
[0129] Furthermore, the data on the solid-state drive (SSD) during the testing process is cleared, the usage time of the SSD is reset to zero, and the SSD is powered off, thereby restoring the SSD to its initial state for subsequent factory use.
[0130] Based on the above embodiments, in some embodiments, after verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection triggering status according to the log, it further includes...
[0131] S17: Generate the target trigger threshold based on the event triggering conditions and the corresponding garbage collection triggering conditions.
[0132] S18: Modify the new trigger threshold to the target trigger threshold.
[0133] Among them, the target trigger threshold is less than the original trigger threshold but greater than the new trigger threshold after modification.
[0134] In practice, after verifying the garbage collection function of the SSD, to restore its normal operation, the trigger thresholds modified during the testing process can be appropriately adjusted. Specifically, a target trigger threshold is generated based on the event triggering conditions and the corresponding garbage collection triggering conditions. The new trigger threshold is then modified to match the target trigger threshold.
[0135] It's important to note that the target trigger threshold is lower than the original trigger threshold but higher than the new trigger threshold. For example, the data retention threshold was 81 days before the test, then changed to 0.5 hours during the test. After the test, it can be changed back to 70 days. This allows for appropriate adjustment of the data retention threshold, improving the sensitivity of garbage collection triggering and enhancing the user experience.
[0136] In the above embodiments, the waste recycling testing method has been described in detail. This invention also provides embodiments corresponding to the waste recycling testing apparatus. It should be noted that this invention describes the apparatus embodiments from two perspectives: one based on functional modules, and the other based on hardware structure.
[0137] Figure 2 This is a schematic diagram of a waste recycling testing device provided in an embodiment of the present invention. Figure 2 As shown, the device includes:
[0138] The acquisition module 10 is used to acquire the trigger threshold of the event used to trigger garbage collection in the solid-state drive; wherein the trigger threshold includes at least the data retention threshold, the readable threshold, the write data status value and the wear leveling threshold.
[0139] Modify module 11 to modify each trigger threshold to obtain a new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold.
[0140] The read / write module 12 is used to perform preset read / write operations on the solid-state drive using a disk input / output performance testing tool.
[0141] The verification module 13 is used to obtain the logs of the solid-state drive corresponding to the preset read and write operations, and to verify the triggering status of the events corresponding to the trigger thresholds and the corresponding garbage collection based on the logs.
[0142] In some embodiments, the read / write module 12 includes:
[0143] The random write operation submodule is used to perform random write operations on the solid-state drive for a preset time using a disk input / output performance testing tool when the data retention threshold is modified to obtain a new data retention threshold.
[0144] The continuous read operation submodule is used to perform continuous read operations on the first preset size of space of the solid-state drive through a disk input / output performance testing tool when the readable threshold is modified to obtain a new readable threshold.
[0145] The write operation submodule is used to write a second preset size of data to the solid-state drive through a disk input / output performance testing tool when a new write data status value is obtained after modifying the write data status value.
[0146] The continuous write operation submodule is used to perform continuous write operations on the solid-state drive using disk input / output performance testing tools when the wear leveling threshold is modified to obtain a new wear leveling threshold.
[0147] In some embodiments, the verification module 13 includes:
[0148] The first verification submodule is used to verify the triggering status of the data retention event and the corresponding garbage collection event based on the logs when the trigger threshold is the data retention threshold.
[0149] The second verification submodule is used to verify the triggering status of interference events and the corresponding garbage collection status based on the logs when the trigger threshold is the readable threshold.
[0150] The third verification submodule is used to verify the triggering status of data write error events and the corresponding garbage collection status based on the logs when the trigger threshold is the write data status value.
[0151] The fourth verification submodule is used to verify the triggering status of the wear leveling event and the corresponding garbage collection event based on the logs when the trigger threshold is the wear leveling threshold.
[0152] In some embodiments, modifying module 11 includes:
[0153] The first modification submodule is used to modify the data retention threshold to a first preset time value through a first serial port command when the trigger threshold is the data retention threshold, so as to enable the disk input / output performance test tool to perform a continuous random write operation on the solid-state drive for a second preset time value.
[0154] The ratio of the first preset time value to the initial data retention threshold is no greater than one-hundredth, and the second preset time value is no less than twice the first preset time value.
[0155] The second modification submodule is used to modify the readable threshold to the first preset number of times through the second serial port command when the trigger threshold is the readable threshold, so as to continuously read the space of the first preset size of the solid-state drive through the disk input / output performance test tool.
[0156] The ratio of the first preset number of reads to the initial readable threshold is no greater than one ten-thousandth, and the first preset size is no greater than 1 megabyte.
[0157] The third modification submodule is used to modify the write data status value to 1 via the third serial port command when the trigger threshold is the write data status value, so that the second preset size of data can be written to the solid-state drive through the disk input / output performance test tool.
[0158] The second preset size is no less than 20 gigabytes.
[0159] The fourth modification submodule is used to modify the wear leveling threshold to the second preset number of times via the fourth serial port command when the trigger threshold is the wear leveling threshold, so as to enable continuous write operations on the solid-state drive through the disk input / output performance testing tool.
[0160] The second preset number of times is no greater than 2.
[0161] In some embodiments, the verification module 13 includes:
[0162] The event triggering judgment module is used to determine whether an event corresponding to a trigger threshold has been triggered based on logs. If the event has not been triggered, the threshold modification submodule is triggered; if the event has been triggered, the garbage collection triggering judgment module is triggered.
[0163] The threshold modification submodule is used to modify the corresponding trigger threshold again, and then proceed to the step of performing preset read and write operations on the solid-state drive through a disk input / output performance testing tool; wherein, the trigger threshold modified again is less than the trigger threshold modified for the first time.
[0164] The garbage collection trigger judgment module is used to determine whether garbage collection has been triggered based on the logs; if garbage collection is triggered, the first confirmation submodule is triggered; if garbage collection is not triggered, the second confirmation submodule is triggered.
[0165] The first confirmation submodule is used to confirm that the garbage collection function of the solid-state drive is working properly.
[0166] The second confirmation submodule is used to confirm that the garbage collection function of the solid-state drive is abnormal and output a prompt message indicating that the garbage collection function of the solid-state drive is abnormal.
[0167] In some embodiments, it also includes:
[0168] The trigger threshold recovery submodule is used to restore the new trigger threshold to the trigger threshold before it was modified.
[0169] The clear submodule is used to clear the data written to the solid-state drive during the testing process.
[0170] The zero-out electronic module is used to reset the usage time of the solid-state drive (SSD) and power off the SSD.
[0171] In some embodiments, it also includes
[0172] The target trigger threshold generation submodule is used to generate target trigger thresholds based on the triggering conditions of events and the corresponding garbage collection.
[0173] The target trigger threshold modification submodule is used to modify the new trigger threshold to the target trigger threshold;
[0174] Among them, the target trigger threshold is less than the original trigger threshold, but greater than the new trigger threshold after modification.
[0175] In this embodiment, the garbage collection testing device includes an acquisition module, a modification module, a read / write module, and a verification module. The garbage collection testing device can implement all the steps of the above-described garbage collection testing method during operation. It acquires the trigger thresholds of events used to trigger garbage collection in the solid-state drive (SSD); wherein the trigger thresholds include at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold; modifies each trigger threshold to obtain a corresponding new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold; performs preset read / write operations on the SSD using a disk input / output performance testing tool; acquires the logs of the SSD corresponding to the preset read / write operations, and verifies the triggering status of the events corresponding to the trigger thresholds and the corresponding garbage collection based on the logs. Therefore, by actively modifying the trigger thresholds of multiple events that can trigger garbage collection, the solution forces the SSD to enter various garbage collection scenarios in advance. This allows for subjective verification of the completeness of the garbage collection code and the reliability of the garbage collection process based on the log content generated by the SSD, enabling early detection and resolution of problems in the early stages of SSD product development, thereby improving product performance.
[0176] Figure 3 This is a schematic diagram of a waste recycling testing device provided in an embodiment of the present invention. Figure 3 As shown, the waste recycling testing equipment includes:
[0177] Memory 20 is used to store computer programs.
[0178] The processor 21 is used to execute computer programs to implement the steps of the garbage collection test method mentioned in the above embodiments.
[0179] The waste recycling testing equipment provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0180] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.
[0181] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the garbage collection testing method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the garbage collection testing method.
[0182] In some embodiments, the waste recycling testing equipment may also include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0183] Those skilled in the art will understand that Figure 3The structure shown does not constitute a limitation on waste recycling testing equipment and may include more or fewer components than illustrated.
[0184] In this embodiment, the garbage collection testing device includes a memory and a processor. The memory stores a computer program. The processor executes the computer program to implement the steps of the garbage collection testing method mentioned in the above embodiment. The method involves obtaining trigger thresholds for events that trigger garbage collection in the solid-state drive (SSD); wherein the trigger thresholds include at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold; modifying each trigger threshold to obtain a corresponding new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold; performing preset read / write operations on the SSD using a disk input / output performance testing tool; obtaining the SSD logs corresponding to the preset read / write operations; and verifying the triggering status of events corresponding to the trigger thresholds and the corresponding garbage collection based on the logs. Therefore, by actively modifying the trigger thresholds of multiple events that can trigger garbage collection, the solution forces the SSD to enter various garbage collection scenarios in advance. This allows for subjective verification of the completeness of the garbage collection code and the reliability of the garbage collection process based on the log content generated by the SSD, enabling early detection and resolution of problems in the early stages of SSD product development, thereby improving product performance.
[0185] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the steps described in the above method embodiments.
[0186] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0187] In this embodiment, a computer program is stored on a computer-readable storage medium. When the computer program is executed by a processor, it implements the steps described in the above method embodiment. The process involves obtaining trigger thresholds for events that trigger garbage collection in the solid-state drive (SSD); wherein the trigger thresholds include at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold; modifying each trigger threshold to obtain a corresponding new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold; performing preset read / write operations on the SSD using a disk input / output performance testing tool; obtaining the SSD logs corresponding to the preset read / write operations; and verifying the triggering status of events corresponding to the trigger thresholds and the corresponding garbage collection based on the logs. Therefore, by actively modifying the trigger thresholds of multiple events that can trigger garbage collection, the solution enables the SSD to forcibly and prematurely enter various garbage collection scenarios. This allows for subjective verification of the completeness of the garbage collection code and the reliability of the garbage collection process based on the log content generated by the SSD, enabling early detection and resolution of problems in the early stages of SSD product development, thereby improving product performance.
[0188] The foregoing has provided a detailed description of a waste recycling testing method, apparatus, equipment, and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
[0189] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A waste recycling testing method, characterized in that, include: Obtain the trigger threshold for events used to trigger garbage collection in the solid-state drive; wherein, the trigger threshold includes at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold; Modify each of the aforementioned trigger thresholds to obtain a corresponding new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold. The solid-state drive was subjected to preset read and write operations using a disk input / output performance testing tool. Obtain the logs of the solid-state drive corresponding to the preset read / write operation, and verify the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection status based on the logs.
2. The waste recycling testing method according to claim 1, characterized in that, The step of performing preset read / write operations on the solid-state drive using a disk input / output performance testing tool includes: When the data retention threshold is modified to obtain a new data retention threshold, the solid-state drive is subjected to random write operations for a continuous preset time using the disk input / output performance testing tool. When the readable threshold is modified to obtain a new readable threshold, the disk input / output performance testing tool is used to continuously read the space of the solid-state drive of a first preset size. When the write data status value is modified to obtain a new write data status value, the second preset size of data is written to the solid-state drive through the disk input / output performance testing tool. When the wear leveling threshold is modified to obtain a new wear leveling threshold, continuous write operations are performed on the solid-state drive using the disk input / output performance testing tool.
3. The waste recycling testing method according to claim 1, characterized in that, The step of verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection triggering status based on the logs includes: When the trigger threshold is the data retention threshold, the triggering status of the data retention event and the corresponding garbage collection triggering status are verified according to the log. When the trigger threshold is the readable threshold, the triggering status of the reading interference event and the corresponding garbage collection triggering status are verified according to the log. When the trigger threshold is the write data status value, the triggering status of the data write error event and the corresponding garbage collection are verified according to the log. When the trigger threshold is the wear leveling threshold, the triggering status of the wear leveling event and the corresponding garbage collection event are verified according to the log.
4. The waste recycling testing method according to claim 2, characterized in that, Modifying each of the trigger thresholds to obtain the corresponding new trigger thresholds includes: When the trigger threshold is the data retention threshold, the data retention threshold is modified to a first preset time value through the first serial port command, so that the disk input / output performance testing tool can perform a continuous random write operation on the solid-state drive for a second preset time value. Wherein, the ratio of the first preset time value to the initial data retention threshold is not greater than one hundredth, and the second preset time value is not less than twice the first preset time value; When the trigger threshold is the readable threshold, the readable threshold is modified to the first preset number of times through the second serial port command, so as to continuously read the space of the first preset size of the solid-state drive through the disk input / output performance testing tool; Wherein, the ratio of the first preset number of times to the initial readable threshold is no greater than one ten-thousandth, and the first preset size is no greater than 1 megabyte; When the trigger threshold is the write data status value, the write data status value is modified to 1 through the third serial port command so that the second preset size of data can be written to the solid-state drive through the disk input / output performance testing tool; The second preset size is not less than 20 gigabytes; When the trigger threshold is the wear leveling threshold, the wear leveling threshold is modified to the second preset number of times via the fourth serial port command, so as to enable continuous write operation of the solid-state drive through the disk input / output performance testing tool. The second preset number of times is no greater than 2.
5. The waste recycling testing method according to claim 3, characterized in that, The step of verifying the triggering status of the event corresponding to the triggering threshold and the corresponding garbage collection triggering status based on the logs includes: Based on the log, determine whether the event corresponding to the trigger threshold has been triggered; If the event is not triggered, the corresponding trigger threshold is modified again, and the process proceeds to the step of performing preset read and write operations on the solid-state drive using a disk input / output performance testing tool; wherein the trigger threshold modified again is less than the trigger threshold modified for the first time. If the event is triggered, determine whether garbage collection has been triggered based on the log. If garbage collection is triggered, it confirms that the garbage collection function of the solid-state drive is normal. If garbage collection is not triggered, it is confirmed that the garbage collection function of the solid-state drive is abnormal, and a prompt message indicating that the garbage collection function of the solid-state drive is abnormal is output.
6. The waste recycling testing method according to any one of claims 1 to 5, characterized in that, After verifying the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection status based on the logs, the method further includes: Restore the new trigger threshold to the original trigger threshold; The test process erases the data written to the solid-state drive. The usage time of the solid-state drive is reset to zero, and the solid-state drive is powered off.
7. The waste recycling testing method according to claim 6, characterized in that, After verifying the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection status based on the logs, the process further includes... A target trigger threshold is generated based on the triggering of the event and the corresponding garbage collection triggering. Modify the new trigger threshold to the target trigger threshold; Wherein, the target trigger threshold is less than the original trigger threshold and greater than the new trigger threshold.
8. A waste recycling testing device, characterized in that, include: The acquisition module is used to acquire the trigger threshold of the event used to trigger garbage collection in the solid-state drive; wherein, the trigger threshold includes at least a data retention threshold, a readable threshold, a write data status value, and a wear leveling threshold; A modifier is used to modify each of the trigger thresholds to obtain a new trigger threshold; wherein the new trigger threshold is less than the corresponding trigger threshold. The read / write module is used to perform preset read / write operations on the solid-state drive using a disk input / output performance testing tool; The verification module is used to obtain the logs of the solid-state drive corresponding to the preset read and write operations, and to verify the triggering status of the event corresponding to the trigger threshold and the corresponding garbage collection based on the logs.
9. A waste recycling testing device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the waste recycling test method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the waste recycling test method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Garbage collection method and system of solid state disk
CN103412826A
Solid state disk garbage collection arbitration method and device and storage medium
CN109408410A