Garbage collection function test method and device, readable storage medium and electronic equipment

By using interface queries and error injection, multi-level testing of solid-state drive garbage collection functions is achieved, solving the problem of inaccurate testing in existing technologies and improving testing efficiency and effectiveness.

CN119964630BActive Publication Date: 2025-11-25CHENGDU BIWIN STORAGE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510082299.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-11-25
Estimated Expiration
2045-01-20

AI Technical Summary

Technical Problem

Existing testing methods for solid-state drive (SSD) garbage collection functionality are insufficient for accurate and effective testing, especially for evaluating the internal processes of garbage collection.

Method used

By receiving test requests, querying the health status information of solid-state drives using multiple interfaces, injecting uncorrectable errors and performing garbage collection operations, and combining self-monitoring information, multi-level testing of the garbage collection function is achieved.

Benefits of technology

It improves the testing efficiency and effectiveness of the garbage collection function, ensures the accuracy and automation of the operation, and enhances the robustness of the solid-state drive.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119964630B_ABST
    Figure CN119964630B_ABST
Patent Text Reader

Abstract

The application discloses a garbage collection function test method and device, a readable storage medium and an electronic device. If the received test requirement includes a first test requirement of a garbage collection function when an uncorrectable error occurs when reading a source block, first interface is used to query first health state information according to the test requirement, test data is sequentially written to a solid state disk, the garbage collection function is closed by using second interface, an effective block is acquired by using first interface, an uncorrectable error is injected into the effective block by using third interface, the garbage collection function is started by using second interface, and garbage collection is performed on the effective block by using second interface. If the state of the effective block is checked by using first interface and has changed to non-effective, second health state information is queried by using first interface, and a first test result is determined based on the two acquired health state information, thereby improving the efficiency and effectiveness of GC function test and ensuring the robustness of the GC function of the solid state disk.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of solid state drives, in particular to a garbage collection function test method and device, readable storage medium and electronic equipment. BACKGROUND

[0002] The storage medium used by an SSD (Solid State Drive) is a flash memory (NAND Flash). Due to the characteristic that the flash memory must be erased before being written, a piece of SSD will have invalid data after being used for a period of time. GC (Garbage Collection) moves valid data and erases it to reserve available space for future data writing.

[0003] Since the GC function belongs to the FTL (Flash Translation Layer), general black box testing can only test the impact of GC on performance, and it is difficult to accurately and effectively test the internal process of GC. SUMMARY

[0004] The technical problem to be solved by the present application is to provide a garbage collection function test method and device, readable storage medium and electronic equipment, which can improve the efficiency and effectiveness of GC function testing.

[0005] To solve the above technical problems, a technical solution adopted by the present application is as follows:

[0006] A garbage collection function test method, comprising the steps of:

[0007] receiving a test requirement of a solid state drive, if the test requirement includes a first test requirement of garbage collection function when an uncorrectable error occurs in reading a source block, using a first interface to query first health state information of the solid state drive according to the first test requirement;

[0008] sequentially writing first preset size of test data to the solid state drive, and using a second interface to close the garbage collection function of the solid state drive;

[0009] using the first interface to obtain a valid block from the solid state drive, and using a third interface to inject an uncorrectable error into the valid block;

[0010] using the second interface to open the garbage collection function of the solid state drive, and using the second interface to perform garbage collection on the valid block;

[0011] If the state of the valid block has changed to be invalid by using the first interface, second health state information of the solid state disk is inquired by using the first interface, and a first test result corresponding to the first test requirement is determined based on the first health state information and the second health state information.

[0012] To solve the above technical problems, another technical solution adopted by the present application is:

[0013] A garbage collection function testing device comprises:

[0014] An inquiry module is configured to receive a test requirement of a solid state disk, and if the test requirement comprises a first test requirement of a garbage collection function when an uncorrectable error occurs during reading a source block, first health state information of the solid state disk is inquired by using a first interface according to the first test requirement.

[0015] A data writing module is configured to sequentially write test data of a first preset size to the solid state disk, and to close the garbage collection function of the solid state disk by using a second interface.

[0016] An error injection module is configured to acquire a valid block from the solid state disk by using the first interface, and to inject an uncorrectable error into the valid block by using a third interface.

[0017] A garbage collection module is configured to open the garbage collection function of the solid state disk by using the second interface, and to perform garbage collection on the valid block by using the second interface.

[0018] A test result determination module is configured to, if the state of the valid block has changed to be invalid by using the first interface, inquire second health state information of the solid state disk by using the first interface, and determine a first test result corresponding to the first test requirement based on the first health state information and the second health state information.

[0019] To solve the above technical problems, another technical solution adopted by the present application is:

[0020] A computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement each step of the garbage collection function testing method.

[0021] To solve the above technical problems, another technical solution adopted by the present application is:

[0022] An electronic device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements each step of the garbage collection function testing method when executing the computer program.

[0023] The beneficial effects of the present application are as follows: if the received test requirement includes the first test requirement of the garbage collection function when an uncorrectable error occurs when reading a source block, the first interface is used to query the first health state information of the solid state disk according to the test requirement, the solid state disk is sequentially written with test data of a first preset size, the garbage collection function of the solid state disk is closed using the second interface, an effective block is obtained from the solid state disk using the first interface, an uncorrectable error is injected into the effective block using the third interface, the garbage collection function of the solid state disk is started using the second interface, and the garbage collection function is performed on the effective block using the second interface. If the state of the effective block is checked using the first interface and has changed to non-effective, the second health state information of the solid state disk is queried using the first interface, and the first test result is determined based on the two obtained health state information. The GC (garbage collection) function test can be completed by calling multiple interfaces according to the specified test requirement, different functions are realized by using multiple interfaces, the GC function test required information can be quickly queried through the first interface and the second interface, and the GC function can be accurately started and closed, the error injection test can be effectively performed on the internal process of the GC function through the third interface, the test is more effective, the automation degree of the GC function is improved, and the accuracy of operation execution is ensured. Therefore, the efficiency and effectiveness of the GC function test are improved, and the robustness of the solid state disk GC function is ensured. BRIEF DESCRIPTION OF DRAWINGS

[0024] Figure 1 A step flow chart of a garbage collection function test method according to an embodiment of the present application;

[0025] Figure 2 A structure schematic diagram of a garbage collection function test device according to an embodiment of the present application;

[0026] Figure 3 A structure schematic diagram of an electronic device according to an embodiment of the present application;

[0027] Figure 4 A garbage collection function test flow chart when an uncorrectable error occurs when reading a source block in a garbage collection function test method according to an embodiment of the present application;

[0028] Figure 5 A garbage collection function test flow chart when there is not enough idle block in a garbage collection function test method according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] To explain the technical content, purposes and effects of the present application in detail, the following will be described in combination with the embodiments and the accompanying drawings.

[0030] Please refer to Figure 1 A garbage collection function test method, comprising the steps of:

[0031] receive a test requirement of the solid state disk, if the test requirement comprises a first test requirement of a garbage collection function when an uncorrectable error occurs when reading a source block, then according to the first test requirement, a first interface is used to query first health state information of the solid state disk;

[0032] sequentially write first preset size of test data to the solid state disk, and use a second interface to close the garbage collection function of the solid state disk;

[0033] use the first interface to obtain an effective block from the solid state disk, and use a third interface to inject an uncorrectable error to the effective block;

[0034] use the second interface to open the garbage collection function of the solid state disk, and use the second interface to perform garbage collection on the effective block;

[0035] if the state of the effective block is checked to be invalid by using the first interface, then second health state information of the solid state disk is queried by using the first interface, and a first test result corresponding to the first test requirement is determined based on the first health state information and the second health state information.

[0036] From the above description, the beneficial effects of the present application are that if the received test requirement comprises a first test requirement of a garbage collection function when an uncorrectable error occurs when reading a source block, then according to the test requirement, a first interface is used to query first health state information of the solid state disk, first preset size of test data is sequentially written to the solid state disk, and a second interface is used to close the garbage collection function of the solid state disk, a first interface is used to obtain an effective block from the solid state disk, and a third interface is used to inject an uncorrectable error to the effective block, a second interface is used to open the garbage collection function of the solid state disk, and the second interface is used to perform garbage collection on the effective block, if the state of the effective block is checked to be invalid by using the first interface, then second health state information of the solid state disk is queried by using the first interface, and a first test result corresponding to the first test requirement is determined based on the first health state information and the second health state information, which can complete GC (garbage collection) function test by calling multiple interfaces according to the specified test requirement, and different functions are realized by using multiple interfaces, the first interface and the second interface can quickly query the information required for GC function test and accurately open and close the GC function, the third interface can effectively test the internal process of the GC function, the test is more effective, the automation degree of the GC function is improved, and the accuracy of operation execution is ensured, thereby improving the efficiency and effectiveness of the GC function test, and ensuring the robustness of the solid state disk GC function.

[0037] Further, the first interface comprises a solid state disk health state viewing interface and a block information viewing interface;

[0038] The first health state information of the solid state disk is queried according to the first test requirement using a first interface, and the first health state information of the solid state disk is obtained.

[0039] The solid state disk health state viewing interface is called according to the first test requirement, and the first health state information of the solid state disk output by the solid state disk health state viewing interface is obtained;

[0040] The valid block is obtained from the solid state disk using the first interface, and the valid block includes:

[0041] The block information viewing interface is called by taking the ID of the block as the interface input, and the block state output by the block information viewing interface is obtained;

[0042] If the block state is valid, the block is taken as a valid block;

[0043] If the block state is invalid, the ID of a new block is obtained, and the step of calling the block information viewing interface by taking the ID of the block as the interface input is executed again;

[0044] If the state of the valid block has changed to invalid by checking the state of the valid block using the first interface, the second health state information of the solid state disk is queried using the first interface, and the second health state information of the solid state disk is obtained.

[0045] The block information viewing interface is called by taking the ID of the valid block as the interface input, and the state of the valid block output by the block information viewing interface is obtained;

[0046] If the state of the valid block has changed to invalid, the solid state disk health state viewing interface is called, and the second health state information of the solid state disk output by the solid state disk health state viewing interface is obtained.

[0047] As can be seen from the above description, the first interface includes the solid state disk health state viewing interface and the block information viewing interface, and the health state information of the solid state disk and the state of the block can be simply and quickly queried by using the two interfaces. The health state information and the state of the block can accurately reflect the performance of the current solid state disk, thereby improving the test efficiency and effectiveness of the GC function.

[0048] Further, the second interface includes a garbage collection function setting interface;

[0049] The garbage collection function of the solid state disk is closed using the second interface, and the garbage collection function setting interface is called by taking the parameter of the closed function as the interface input.

[0050] The garbage collection function setting interface is called by taking the parameter of the closed function as the interface input.

[0051] The using the second interface to start the garbage collection function of the solid state disk, and the using the second interface to perform garbage collection on the valid block include:

[0052] The parameter of the starting function is input as an interface to call the garbage collection function setting interface, and the source block specifying parameter is determined according to the valid block;

[0053] The source block specifying parameter is input as an interface to call the garbage collection function setting interface to perform garbage collection on the valid block.

[0054] As can be known from the above description, the second interface includes a garbage collection function setting interface, the garbage collection function setting interface can accurately control the starting and stopping of the GC function, and can also specify the valid block for GC, so that the GC function test is more in line with the actual use scenario, and the effectiveness of the GC function test is improved.

[0055] Further, the first interface includes a physical address viewing interface;

[0056] The third interface includes an uncorrectable error injection interface;

[0057] The using the third interface to inject uncorrectable errors into the valid block includes:

[0058] The logical address of the valid block is input as an interface to call the physical address viewing interface, and the physical address of the logical address on the flash memory output by the physical address viewing interface is obtained;

[0059] The physical address is input as an interface to call the uncorrectable error injection interface to inject uncorrectable errors into the valid block.

[0060] As can be known from the above description, the first interface also includes a physical address viewing interface, and the third interface includes an uncorrectable error injection interface. The physical address viewing interface can be used to more conveniently query the physical address of the block, and in combination with the uncorrectable error injection interface, uncorrectable errors can be injected into the specified block to verify the GC function when the GC internal process reads the source block and uncorrectable errors occur. It is more convenient, and the GC internal process is accurately and effectively tested, thereby improving the effectiveness and comprehensiveness of the GC function test.

[0061] Further, the health status information includes an uncorrectable error count;

[0062] The determining a first test result corresponding to the first test requirement based on the first health status information and the second health status information includes:

[0063] If yes, it is determined that the first test result corresponding to the first test requirement is test passed; if no, it is determined that the first test result corresponding to the first test requirement is test failed.

[0064] According to the above description, the health status information includes the uncorrectable error count, and the GC function test result in the case that the uncorrectable error occurs when the GC internally flows the source block can be determined through the uncorrectable error count obtained twice, thereby realizing the effective GC function test.

[0065] Further, it further comprises:

[0066] If the test requirement further comprises a second test requirement of the garbage collection function in the case that the free block is insufficient, the first interface is used to query the first self-monitoring, analysis and reporting technical information of the solid state disk according to the second test requirement;

[0067] The garbage collection function of the solid state disk is closed by using the second interface;

[0068] The test data of the second preset size is sequentially written to the solid state disk until the number of free blocks of the solid state disk is one more;

[0069] After the test environment is restarted, the garbage collection function of the solid state disk is started by using the second interface, and a first preset time length is waited;

[0070] The test data is randomly written to the solid state disk for a second preset time length;

[0071] The second self-monitoring, analysis and reporting technical information of the solid state disk is queried by using the first interface, and the second test result corresponding to the second test requirement is determined based on the first self-monitoring, analysis and reporting technical information and the second self-monitoring, analysis and reporting technical information.

[0072] As can be known from the above description, if the test requirement further comprises a second test requirement of the garbage collection function in the case of insufficient free blocks, the first interface is used to query the first self-monitoring, analysis and reporting technical information of the solid state disk, the second interface is used to close the garbage collection function, the solid state disk is sequentially written with test data of a second preset size until the free blocks of the solid state disk are one, after the test environment is restarted, the second interface is used to start the garbage collection function, and the solid state disk is randomly written with test data for a second preset time length, the first interface is used to query the second self-monitoring, analysis and reporting technical information, and the second test result corresponding to the second test requirement is determined based on the two times of acquired self-monitoring, analysis and reporting technical information, so that the first interface and the second interface are used to more efficiently construct the scene of insufficient free blocks, the GC function in the case of insufficient free blocks is reasonably and effectively verified, and the comprehensiveness and reliability of the GC function test are improved.

[0073] Further, the self-monitoring, analysis and reporting technical information comprises a bad block count and an uncorrectable error count;

[0074] The second test result corresponding to the second test requirement is determined based on the first self-monitoring, analysis and reporting technical information and the second self-monitoring, analysis and reporting technical information, comprising:

[0075] According to the first self-monitoring, analysis and reporting technical information and the second self-monitoring, analysis and reporting technical information, it is determined whether the bad block count and the uncorrectable error count are both increased, if yes, it is determined that the second test result corresponding to the second test requirement is test passed, and if no, it is determined that the second test result corresponding to the second test requirement is test failed.

[0076] As can be known from the above description, the self-monitoring, analysis and reporting technical information comprises a bad block count and an uncorrectable error count, and the test result of the GC function in the case of insufficient free blocks can be conveniently and quickly determined according to the bad block count and the uncorrectable error count.

[0077] Further, it further comprises:

[0078] If the test requirement further comprises a third test requirement of the garbage collection function in the case of programming failure error, the third test requirement is used to query the third health state information of the solid state disk by using the first interface;

[0079] The solid state disk is sequentially written with test data of a third preset size, and the garbage collection function of the solid state disk is closed by using the second interface;

[0080] An effective block is acquired from the solid state disk by using the first interface;

[0081] using the second interface to start a garbage collection function of the solid state disk, and using the second interface to perform garbage collection on the valid block;

[0082] using the third interface to inject a program failure error into the valid block;

[0083] If the state of the valid block is checked to have changed to invalid using the first interface, third health state information of the solid state disk is queried using the first interface, and a third test result corresponding to the third test requirement is determined based on the third health state information and the fourth health state information.

[0084] As can be known from the above description, if the test requirement further includes a third test requirement of a garbage collection function in the case of a program failure error, third health state information of the solid state disk is queried using the first interface, the solid state disk is sequentially written with test data of a third preset size, the garbage collection function of the solid state disk is closed using the second interface, a valid block is obtained from the solid state disk using the first interface, the garbage collection function of the solid state disk is started using the second interface, garbage collection is performed on the valid block using the second interface, a program failure error is injected into the valid block using the third interface, if the state of the valid block is checked to have changed to invalid using the first interface, fourth health state information of the solid state disk is queried using the first interface, and a third test result is determined based on the health state information queried twice, so as to verify the GC function in the case of a program failure error when the GC internal process reads a source block. According to the actual test requirement, different errors can be injected into the GC function internal process by using the first interface, the second interface and the third interface, the flexibility and comprehensiveness of the GC function test are improved, and the test effect is ensured.

[0085] Further, the first interface includes a physical address viewing interface;

[0086] The third interface includes a program failure error injection interface;

[0087] The using of the third interface to inject a program failure error into the valid block includes:

[0088] The logical address of the valid block is taken as an interface input to call the physical address viewing interface, and the physical address of the logical address on the flash memory output by the physical address viewing interface is obtained;

[0089] The physical address is taken as an interface input to call the program failure error injection interface, so as to inject a program failure error into the valid block.

[0090] As can be known from the above description, the program failure error injection into the valid block by using the physical address viewing interface and the program failure error injection interface is more efficient and accurate.

[0091] Further, the health status information comprises a program failure count;

[0092] The determining of the third test result corresponding to the third test requirement based on the third health status information and the fourth health status information comprises:

[0093] determining whether the program failure count is increased according to the third health status information and the fourth health status information, if yes, determining that the third test result corresponding to the third test requirement is test pass, if no, determining that the third test result corresponding to the third test requirement is test fail.

[0094] As can be seen from the above description, the program failure count can accurately reflect the GC performance, and the third test result is determined according to the comparison of the program failure counts in the health status information obtained by using the first interface twice, thereby improving the accuracy of the GC function test.

[0095] Please refer to Figure 2 Another embodiment of the present application provides a garbage collection function test device, comprising:

[0096] a query module, configured to receive a test requirement of a solid state disk, if the test requirement comprises a first test requirement of a garbage collection function when an uncorrectable error occurs in reading a source block, query first health status information of the solid state disk according to the first test requirement by using a first interface;

[0097] a data writing module, configured to sequentially write test data of a first preset size to the solid state disk, and close the garbage collection function of the solid state disk by using a second interface;

[0098] an error injection module, configured to acquire a valid block from the solid state disk by using the first interface, and inject an uncorrectable error into the valid block by using a third interface;

[0099] a garbage collection module, configured to open the garbage collection function of the solid state disk by using the second interface, and perform garbage collection on the valid block by using the second interface;

[0100] a test result determination module, configured to if the state of the valid block has changed to invalid by checking the state of the valid block by using the first interface, query second health status information of the solid state disk by using the first interface, and determine a first test result corresponding to the first test requirement based on the first health status information and the second health status information.

[0101] Another embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize each step of the garbage collection function test method.

[0102] Referring to Figure 3 Another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of the above-mentioned garbage collection function test method when executing the computer program.

[0103] The above-mentioned garbage collection function test method, device, readable storage medium and electronic device can be applied to the test scene of the GC function, which will be described below through a specific embodiment.

[0104] Referring to Figure 1 , Figure 4 and Figure 5 , the first embodiment of the present application is:

[0105] A garbage collection function test method, including the steps of:

[0106] S1, receiving a test requirement of a solid state disk, if the test requirement includes a first test requirement of a garbage collection function when an uncorrectable error occurs when reading a source block, then according to the first test requirement, using a first interface to query first health state information of the solid state disk, as shown in Figure 4 .

[0107] Among them, the first interface includes a solid state disk health state viewing interface, a block information viewing interface and a physical address viewing interface. The health state information includes uncorrectable error (UNC) count and program fail (Program Fail) count.

[0108] Solid state disk health state viewing interface: view the current health state information of the SSD, which is different from the standard protocol SMART-LOG. The health state information shows more running state and error information of some functional modules inside the disk. This interface does not need to input parameters, and after calling the interface, it outputs UNC count, ECC (Error Correction Code) count, Program Fail count, Erase Fail (Erase Fail) count, Bad Block (Bad Block) count, Total / AVG / MAX / MIN Erase (Total / AVG / MAX / MIN Erase) count, Free Block Count (Free Block Count), Remain Life based on PE / spare (Remain Life based on PE / spare) and the like;

[0109] Block information viewing interface: used for specifying a Block ID to view the detailed information of the Block, the interface needs to input the Block ID, and after calling the interface, the Block EC (Block Erase Count), Block RC (Block Read Count), Block RDB THR (Block Read Disturb Threshold), Block AERNA Type (Block Usage Type), Block Type (Block Type), Block State (Block State), Bad Block Status (Bad Block Status) and the like are outputted;

[0110] Physical address viewing interface: used for specifying an LBA (Logical Address) to obtain the physical address (FAA / PBA) of the LBA on the NAND, the interface needs to input the LBA, and after calling the interface, the FAA is outputted, including the block, page, die, plane and au.

[0111] The first health state information of the solid state disk is queried according to the first test requirement using a first interface.

[0112] According to the first test requirement, the solid state disk health state viewing interface is called, and the first health state information of the solid state disk outputted by the solid state disk health state viewing interface is obtained.

[0113] In an optional embodiment, S1 is further preceded by pre-test preparation.

[0114] The solid state disk is updated to a specified test version, and it is determined that the solid state disk has been normally recognized by the HOST as a data disk.

[0115] S2, sequentially writing first preset size of test data to the solid state disk, and using a second interface to close the garbage collection function of the solid state disk, as shown in Figure 4 Specifically, S2.1-S2.2 are included.

[0116] The second interface includes a garbage collection function setting interface.

[0117] Garbage collection function setting interface: used for setting the parameters of the disk GC process, the interface needs to input the specified GC type, whether to start the function, and the specified GC source block.

[0118] S2.1, sequentially writing first preset size of test data to the solid state disk.

[0119] In an optional embodiment, 5% of the capacity of the solid state disk is sequentially written with test data.

[0120] In an alternative embodiment, a plurality of test data of a SUPER BLOCK SIZE is sequentially written to the solid state disk.

[0121] In an alternative embodiment, the method further comprises:

[0122] If the sequential writing fails, a first test result corresponding to the first test requirement is determined as test failure.

[0123] S2.2, the parameter of the closing function is input as an interface to call the garbage collection function setting interface.

[0124] If the parameter of the closing function is 0, 0 is input as the value of the interface to call the garbage collection function setting interface.

[0125] In an alternative embodiment, the method further comprises:

[0126] If the operation of closing the garbage collection function of the solid state disk using the second interface fails, a first test result corresponding to the first test requirement is determined as test failure.

[0127] S3, an effective block is obtained from the solid state disk using the first interface, and an uncorrectable error (UNC) is injected into the effective block using a third interface, specifically comprising S3.1-S3.5:

[0128] The third interface comprises an uncorrectable error injection interface and a program fail error injection interface.

[0129] Uncorrectable error injection interface: used for specifying a FAA to inject a UNC error, which requires inputting a FAA;

[0130] Program fail error injection interface: used for specifying a FAA to inject a program fail, which requires inputting a FAA.

[0131] S3.1, the ID of the block is input as an interface to call the block information viewing interface, and the block state output by the block information viewing interface is obtained.

[0132] The ID of the block is input as an interface to call the block information viewing interface, and the block state output by the block information viewing interface is obtained.

[0133] S3.2, if the block state is valid, the block is taken as an effective block.

[0134] For example, if the value of Block State is 2, the block is taken as an effective block.

[0135] S3.3, if the block state is not valid, obtaining an ID of a new block, and returning to perform S3.1.

[0136] For example, if the value of Block State is not 2, obtaining an ID of a new block, and returning to perform S3.1.

[0137] S3.4, calling the physical address viewing interface with the logical address of the valid block as the value of the interface input LBA, and obtaining the physical address of the logical address on the flash memory output by the physical address viewing interface.

[0138] Calling the physical address viewing interface with the LBA of the valid block as the value of the interface input LBA, and obtaining the FAA including the block, page, die, plane and au information output by the physical address viewing interface.

[0139] S3.5, calling the uncorrectable error injection interface with the physical address as the interface input, to inject uncorrectable errors into the valid block.

[0140] Calling the uncorrectable error injection interface with the FAA including the block, page, die, plane and au information as the interface input, to inject UNC Error into the valid block.

[0141] In an optional embodiment, further comprising:

[0142] If the operation of injecting uncorrectable errors into the valid block using the third interface fails, determining that the first test result corresponding to the first test requirement is test failure.

[0143] S4, starting the garbage collection function of the solid state disk using the second interface, and performing garbage collection on the valid block using the second interface, specifically comprising S4.1-S4.2:

[0144] S4.1, calling the garbage collection function setting interface with the parameter of starting the function as the interface input, and determining the source block specified parameter according to the valid block.

[0145] Assuming that the parameter of starting the function is 1, calling the garbage collection function setting interface with 1 as the value of the interface input whether to start the function, and determining the source block specified parameter according to the valid block.

[0146] In an optional embodiment, further comprising:

[0147] If the operation of starting the garbage collection function of the solid state disk using the second interface fails, determining that the first test result corresponding to the first test requirement is test failure.

[0148] S4.2, calling the garbage collection function setting interface with the source block designation parameter as an interface input to perform garbage collection on the valid block.

[0149] Calling the garbage collection function setting interface with the source block designation parameter as an interface input to perform GC on the valid block.

[0150] S5, if the state of the valid block has changed to invalid by checking using the first interface, querying the second health state information of the solid state disk using the first interface, and determining the first test result corresponding to the first test requirement based on the first health state information and the second health state information, as shown in Figure 4 , specifically including S5.1-S5.3.

[0151] S5.1, calling the block information viewing interface with the ID of the valid block as an interface input, and obtaining the state of the valid block output by the block information viewing interface.

[0152] For example, calling the block information viewing interface with the ID of the valid block as an interface input, and obtaining Block State output by the block information viewing interface.

[0153] S5.2, if the state of the valid block has changed to invalid, calling the solid state disk health state viewing interface, and obtaining the second health state information of the solid state disk output by the solid state disk health state viewing interface.

[0154] For example, if the value of Block State is not 2, it means that the source block has been moved by GC, the solid state disk health state viewing interface is called, and the second health state information of the solid state disk output by the solid state disk health state viewing interface is obtained.

[0155] S5.3, determining whether the uncorrectable error count has increased according to the first health state information and the second health state information, if yes, determining that the first test result corresponding to the first test requirement is test passed, if no, determining that the first test result corresponding to the first test requirement is test failed.

[0156] S6, if the test requirement further includes a second test requirement of the garbage collection function under the condition of insufficient free blocks, querying the first self-monitoring, analysis and reporting technology information of the solid state disk according to the second test requirement using the first interface, as shown in Figure 5 .

[0157] The SMART information includes a bad block count and an uncorrectable error count.

[0158] For example, the first SMART information of the solid state disk is queried by using a solid state disk health status viewing interface according to the second test requirement.

[0159] S7, the garbage collection function of the solid state disk is closed by using the second interface, such as Figure 5 as shown.

[0160] Specifically, the parameter of the closed function is used as an interface input to call the garbage collection function setting interface.

[0161] For example, if the parameter of the closed function is 0, 0 is used as an interface input to call the garbage collection function setting interface.

[0162] In an optional embodiment, the method further comprises:

[0163] If the operation of closing the garbage collection function of the solid state disk by using the second interface fails, it is determined that the second test result corresponding to the second test requirement is a test failure.

[0164] S8, the solid state disk is sequentially written with test data of a second preset size in a loop until the number of free blocks of the solid state disk is one less, such as Figure 5 as shown.

[0165] In an optional embodiment, the solid state disk is sequentially written with test data of 1 Block Size in a loop until the number of free blocks of the solid state disk is one less.

[0166] For example, the solid state disk is sequentially written with test data of 1 Block Size in a loop, and the Free Block Count is queried by calling the solid state disk health status viewing interface until the Free Block Count is 1, and the writing is stopped.

[0167] S9, after restarting the test environment, the garbage collection function of the solid state disk is started by using the second interface, and a first preset time length is waited.

[0168] In an optional embodiment, the restarting of the test environment comprises:

[0169] The operating system is restarted, or the solid state disk is powered off and powered on alone.

[0170] In an alternative embodiment, after restarting the test environment, the parameter of starting the function is input as an interface to call the garbage collection function setting interface, and wait for 2 minutes, as shown in Figure 5

[0171] For example, if the parameter of starting the function is 1, 1 is input as an interface to call the garbage collection function setting interface, and wait for 2 minutes.

[0172] In an alternative embodiment, it further comprises:

[0173] If the solid state disk is not normally recognized by the HOST after restarting the test environment, it is determined that the second test result corresponding to the second test requirement is test failure.

[0174] In an alternative embodiment, it further comprises:

[0175] If the operation of starting the garbage collection function of the solid state disk using the second interface fails, it is determined that the second test result corresponding to the second test requirement is test failure.

[0176] S10, using test data to randomly write the solid state disk for a second preset time length.

[0177] In an alternative embodiment, the solid state disk is randomly written with test data for 1 minute.

[0178] In an alternative embodiment, it further comprises:

[0179] If the random writing appears abnormal, it is determined that the second test result corresponding to the second test requirement is test failure.

[0180] S11, using the first interface to query the second self-monitoring, analysis and reporting technical information of the solid state disk, and determining the second test result corresponding to the second test requirement based on the first self-monitoring, analysis and reporting technical information and the second self-monitoring, analysis and reporting technical information, specifically comprising S11.1-S11.2:

[0181] S11.1, using the first interface to query the second self-monitoring, analysis and reporting technical information of the solid state disk.

[0182] For example, using the solid state disk health state viewing interface to query the second SMART information of the solid state disk.

[0183] ​S11.2, judging whether the bad block count and the uncorrectable error count are both not increased according to the first self-monitoring, analyzing and reporting technical information and the second self-monitoring, analyzing and reporting technical information, if yes, determining that the second test result corresponding to the second test requirement is test pass, if not, determining that the second test result corresponding to the second test requirement is test fail.

[0184] S12, if the test requirement further comprises a third test requirement of garbage collection function under program failure error condition, querying third health state information of the solid state disk according to the third test requirement using a first interface.

[0185] Specifically, if the test requirement further comprises a third test requirement of garbage collection function under program failure error condition, querying third health state information of the solid state disk according to the third test requirement using the solid state disk health state viewing interface.

[0186] S13, sequentially writing test data of a third preset size to the solid state disk, and closing the garbage collection function of the solid state disk using a second interface.

[0187] Wherein, the third preset size can be set according to actual conditions.

[0188] Specifically, sequentially writing test data of a third preset size to the solid state disk, and closing the garbage collection function of the solid state disk using the garbage collection function setting interface.

[0189] S14, acquiring an effective block from the solid state disk using the first interface.

[0190] Specifically, acquiring an effective block from the solid state disk using the block information viewing interface.

[0191] S15, starting the garbage collection function of the solid state disk using the second interface, and performing garbage collection on the effective block using the second interface.

[0192] Specifically, starting the garbage collection function of the solid state disk using the garbage collection function setting interface, and performing garbage collection on the effective block using the garbage collection function setting interface.

[0193] S16, injecting a program failure error to the effective block using the third interface, specifically comprising S16.1-S16.2:

[0194] S16.1, calling the physical address viewing interface with the logical address of the effective block as the interface input, and acquiring the physical address of the logical address on the flash memory output by the physical address viewing interface.

[0195] S16.2, calling the program fail error injection interface as an interface input with the physical address to inject a program fail error to the valid block.

[0196] Specifically, the FAA including block, page, die, plane and au information is called as an interface input to the program fail error injection interface to inject a program fail to the valid block.

[0197] S18, if the state of the valid block has changed to invalid by checking using the first interface, querying fourth health state information of the solid state disk using the first interface, and determining a third test result corresponding to the third test requirement based on the third health state information and the fourth health state information, specifically including S18.1-S18.2:

[0198] S18.1, if the state of the valid block has changed to invalid by checking using the first interface, querying fourth health state information of the solid state disk using the first interface.

[0199] Specifically, if the state of the valid block has changed to invalid by checking using the block information viewing interface, querying fourth health state information of the solid state disk using the solid state disk health state viewing interface.

[0200] S18.2, judging whether the program fail count is increased according to the third health state information and the fourth health state information, if yes, determining that a third test result corresponding to the third test requirement is test passed, if no, determining that the third test result corresponding to the third test requirement is test failed.

[0201] Please refer to Figure 2 Embodiment two of the present application is:

[0202] A garbage collection function test device, comprising:

[0203] The query module is configured to receive a test requirement of the solid state disk, and if the test requirement includes a first test requirement of a garbage collection function when an uncorrectable error occurs in reading a source block, query first health state information of the solid state disk using a first interface according to the first test requirement.

[0204] The data writing module is configured to sequentially write test data of a first preset size to the solid state disk, and close a garbage collection function of the solid state disk using a second interface.

[0205] The error injection module is configured to acquire a valid block from the solid state disk using the first interface, and inject an uncorrectable error to the valid block using a third interface.

[0206] a garbage collection module configured to start a garbage collection function of the solid state disk using the second interface and perform garbage collection on the valid block using the second interface;

[0207] a test result determination module configured to, if the state of the valid block is changed to invalid by checking using the first interface, query second health status information of the solid state disk using the first interface, and determine a first test result corresponding to the first test requirement based on the first health status information and the second health status information.

[0208] Embodiment Three

[0209] A computer readable storage medium having a computer program stored thereon, the computer program being executable by a processor to implement each step of the garbage collection function test method of Embodiment One.

[0210] Embodiment Four

[0211] Please refer to Figure 3 An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing each step of the garbage collection function test method of Embodiment One when executing the computer program.

[0212] In summary, the application provides a garbage collection function test method, device, readable storage medium and electronic equipment. If the received test requirement includes a first test requirement of garbage collection function when uncorrectable error occurs when reading a source block, the first interface is used to query the first health state information of the solid state disk according to the test requirement, the solid state disk is sequentially written with test data of a first preset size, the garbage collection function of the solid state disk is closed by using the second interface, an effective block is obtained from the solid state disk by using the first interface, uncorrectable error is injected into the effective block by using the third interface, the garbage collection function of the solid state disk is started by using the second interface, and the garbage collection function is performed on the effective block by using the second interface. If the state of the effective block is checked by using the first interface and has become invalid, the second health state information of the solid state disk is queried by using the first interface, and the first test result is determined based on the two obtained health state information. The GC function test can be completed by calling various interfaces according to the specified test requirement, different functions are realized by using various interfaces, the GC function test required information can be quickly queried by using the first interface and the second interface, and the GC function can be accurately started and stopped, the error injection test can be effectively performed on the internal process of the GC function by using the third interface, the test is more effective, the automation degree of the GC function is improved, and the accuracy of operation execution is ensured, so that the efficiency and effectiveness of the GC function test are improved, and the robustness of the solid state disk GC function is ensured. In addition, if the test requirement also includes a second test requirement of garbage collection function in the case of insufficient free blocks of the solid state disk, the first interface and the second interface are used to more efficiently construct the scene of insufficient free blocks, and the GC function in the case of insufficient free blocks is reasonably and effectively verified, so that the comprehensiveness and reliability of the GC function test are improved. If the test requirement also includes a third test requirement of garbage collection function in the case of programming failure error, different errors can be injected into the internal process of the GC function by using the first interface, the second interface and the third interface according to the actual test requirement, so that the flexibility and comprehensiveness of the GC function test are improved, and the test effect is ensured.

[0213] In the above embodiments provided in the application, it should be understood that the disclosed method, device, computer readable storage medium and electronic equipment can be implemented in other manners. For example, the above-described device embodiment is only schematic, and for example, the division of the modules is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of components or modules can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed components can be indirect coupling or communication connection through some interfaces, devices or components or modules, and can be electrical, mechanical or in other forms.

[0214] The components described as separate components may or may not be physically separate, and the components shown as components may or may not be physical modules, i.e., they may be located in one place or distributed on multiple network modules. Some or all of the components can be selected as needed to achieve the purpose of the embodiment.

[0215] In addition, the functional modules in each embodiment of the application can be integrated into one processing module, or each component can be physically present separately, or two or more modules can be integrated into one module. The integrated module can be realized in the form of hardware or in the form of a software functional module.

[0216] The integrated module, if realized in the form of a software functional module and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

[0217] It should be noted that for the foregoing method embodiments, in order to facilitate description, they are all described as a combination of a series of actions, but those skilled in the art should know that the application is not limited by the order of the described actions, because according to the application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the application.

[0218] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0219] The above is only an embodiment of the application, and does not limit the patent scope of the application, and any equivalent transformation or direct or indirect application in related technical fields based on the content of the specification and drawings is also included in the patent protection scope of the application.

Claims

1. A garbage collection function test method characterized by comprising: The method comprises the steps of: receiving a test requirement of a solid state disk, if the test requirement comprises a first test requirement of a garbage collection function when an uncorrectable error occurs in reading a source block, querying first health status information of the solid state disk according to the first test requirement using a first interface; sequentially writing first preset size of test data to the solid state disk, and closing the garbage collection function of the solid state disk using a second interface; acquiring a valid block from the solid state disk using the first interface, and injecting an uncorrectable error into the valid block using a third interface; opening the garbage collection function of the solid state disk using the second interface, and performing garbage collection on the valid block using the second interface; if a state of the valid block is checked to have changed to invalid using the first interface, querying second health status information of the solid state disk using the first interface, and determining a first test result corresponding to the first test requirement based on the first health status information and the second health status information; the first interface comprises a solid state disk health status viewing interface and a block information viewing interface; the step of querying the first health status information of the solid state disk according to the first test requirement using the first interface comprises: calling the solid state disk health status viewing interface according to the first test requirement, and acquiring the first health status information of the solid state disk output by the solid state disk health status viewing interface; the step of acquiring a valid block from the solid state disk using the first interface comprises: calling the block information viewing interface by taking an ID of a block as an interface input, and acquiring a block state output by the block information viewing interface; if the block state is valid, taking the block as the valid block; if the block state is invalid, acquiring an ID of a new block, and returning to the step of calling the block information viewing interface by taking the ID of the block as the interface input; the step of querying the second health status information of the solid state disk using the first interface if the state of the valid block is checked to have changed to invalid using the first interface comprises: calling the block information viewing interface by taking the ID of the valid block as the interface input, and acquiring the state of the valid block output by the block information viewing interface; if the state of the valid block has changed to invalid, calling the solid state disk health status viewing interface, and acquiring the second health status information of the solid state disk output by the solid state disk health status viewing interface.

2. The method of claim 1, wherein, the second interface comprises a garbage collection function setting interface; the step of closing the garbage collection function of the solid state disk using the second interface comprises: calling the garbage collection function setting interface by taking a parameter of a closed function as an interface input; the step of opening the garbage collection function of the solid state disk using the second interface, and performing garbage collection on the valid block using the second interface comprises: calling the garbage collection function setting interface by taking a parameter of an opened function as an interface input, and determining a source block specifying parameter according to the valid block; calling the garbage collection function setting interface by taking the source block specifying parameter as the interface input, so as to perform garbage collection on the valid block.

3. The method of claim 1, wherein, The first interface comprises a physical address viewing interface; The third interface comprises an uncorrectable error injection interface; The injection of uncorrectable errors into the valid block using the third interface comprises: calling the physical address viewing interface with the logical address of the valid block as an interface input, and obtaining the physical address of the logical address on the flash memory output by the physical address viewing interface; calling the uncorrectable error injection interface with the physical address as an interface input to inject uncorrectable errors into the valid block.

4. The method of claim 1, wherein, The health status information comprises an uncorrectable error count; The first test requirement comprises determining a first test result corresponding to the first test requirement based on the first health status information and the second health status information, and the determination comprises: determining whether the uncorrectable error count increases according to the first health status information and the second health status information, and if so, determining that the first test result corresponding to the first test requirement is test passed, and if not, determining that the first test result corresponding to the first test requirement is test failed.

5. The method of claim 1, wherein, Further comprising: if the test requirement further comprises a second test requirement of a garbage collection function under an insufficient free block condition, querying first self-monitoring, analysis and reporting technology information of the solid state disk using the first interface according to the second test requirement; turning off the garbage collection function of the solid state disk using the second interface; cyclically writing test data of a second preset size to the solid state disk in sequence until the number of free blocks of the solid state disk is one less; after restarting the test environment, turning on the garbage collection function of the solid state disk using the second interface, and waiting for a first preset time; randomly writing test data to the solid state disk for a second preset time; querying second self-monitoring, analysis and reporting technology information of the solid state disk using the first interface, and determining a second test result corresponding to the second test requirement based on the first self-monitoring, analysis and reporting technology information and the second self-monitoring, analysis and reporting technology information.

6. The method of claim 5, wherein, The self-monitoring, analysis and reporting technology information comprises a bad block count and an uncorrectable error count; The determination of the second test result corresponding to the second test requirement based on the first self-monitoring, analysis and reporting technology information and the second self-monitoring, analysis and reporting technology information comprises: determining whether the bad block count and the uncorrectable error count are both not increased according to the first self-monitoring, analysis and reporting technology information and the second self-monitoring, analysis and reporting technology information, and if so, determining that the second test result corresponding to the second test requirement is test passed, and if not, determining that the second test result corresponding to the second test requirement is test failed.

7. The method of claim 1 or 5, wherein, Further comprising: if the test requirement further comprises a third test requirement of a garbage collection function under a program-occurring failure error condition, querying third health status information of the solid state disk using the first interface according to the third test requirement; writing test data of a third preset size to the solid state disk in sequence, and turning off the garbage collection function of the solid state disk using the second interface; acquiring an effective block from the solid state disk using the first interface; starting a garbage collection function of the solid state disk using the second interface, and performing garbage collection on the effective block using the second interface; injecting a program failure error into the effective block using the third interface; if a state of the effective block is checked to have changed to be invalid using the first interface, querying fourth health state information of the solid state disk using the first interface, and determining a third test result corresponding to the third test requirement based on the third health state information and the fourth health state information.

8. The method of claim 7, wherein, the first interface comprises a physical address viewing interface; the third interface comprises a program failure error injection interface; the injecting of the program failure error into the effective block using the third interface comprises: calling the physical address viewing interface with a logical address of the effective block as an interface input, and acquiring a physical address of the logical address on a flash memory output by the physical address viewing interface; calling the program failure error injection interface with the physical address as an interface input to inject the program failure error into the effective block.

9. The method of claim 7, wherein, the health state information comprises a program failure count; the determining of the third test result corresponding to the third test requirement based on the third health state information and the fourth health state information comprises: determining whether the program failure count is increased according to the third health state information and the fourth health state information, if yes, determining that a third test result corresponding to the third test requirement is test passed, and if no, determining that the third test result corresponding to the third test requirement is test failed.

10. A garbage collection function test apparatus characterized by comprising: comprise: a querying module, configured to receive a test requirement of a solid state disk, and if the test requirement comprises a first test requirement of a garbage collection function when an uncorrectable error occurs in reading a source block, query first health state information of the solid state disk according to the first test requirement using a first interface; a data writing module, configured to sequentially write test data of a first preset size to the solid state disk, and close a garbage collection function of the solid state disk using a second interface; an error injection module, configured to acquire an effective block from the solid state disk using the first interface, and inject an uncorrectable error into the effective block using a third interface; a garbage collection module, configured to start a garbage collection function of the solid state disk using the second interface, and perform garbage collection on the effective block using the second interface; a test result determination module, configured to if a state of the effective block is checked to have changed to be invalid using the first interface, query second health state information of the solid state disk using the first interface, and determine a first test result corresponding to the first test requirement based on the first health state information and the second health state information; the first interface comprises a solid state disk health state viewing interface and a block information viewing interface; the querying of the first health state information of the solid state disk according to the first test requirement using the first interface comprises: According to the first test requirement, the solid state disk health state checking interface is called, and the first health state information of the solid state disk output by the solid state disk health state checking interface is acquired; The step of acquiring an effective block using the first interface includes: The block information checking interface is called by inputting the ID of the block as the interface, and the block state output by the block information checking interface is acquired; If the block state is effective, the block is regarded as an effective block; If the block state is not effective, the ID of a new block is acquired, and the step of calling the block information checking interface by inputting the ID of the block as the interface is executed again; If the state of the effective block has changed to not effective by checking the state of the effective block using the first interface, the second health state information of the solid state disk is queried using the first interface, including: The block information checking interface is called by inputting the ID of the effective block as the interface, and the state of the effective block output by the block information checking interface is acquired; If the state of the effective block has changed to not effective, the solid state disk health state checking interface is called, and the second health state information of the solid state disk output by the solid state disk health state checking interface is acquired.

11. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize each step in the garbage collection function test method according to any one of claims 1 to 9.

12. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to realize each step in the garbage collection function test method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Error correction capability test method and device, readable storage medium and electronic equipment

    CN113778822A

  • Data writing method and device of solid state disk, electronic equipment and storage medium

    CN118466849A