Wear leveling function test method and device, readable storage medium and electronic equipment
By querying and setting the interface to judge and simulating the wear balance function of the solid-state drive, the problem of inefficient testing in the existing technology is solved, and comprehensive testing of dynamic and static balance is achieved, which improves the efficiency and reliability of the test.
Patent Information
- Application Number
- CN202510081008.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is inefficient when testing the wear equalization function of solid-state drives, and the testing methods are mostly black box tests, so it is impossible to fully evaluate the testing efficiency of dynamic equalization and static equalization.
Through the query interface, determine whether the solid-state drive supports dynamic balance and static balance, and conduct corresponding tests based on the test request. Use the setting interface to modify the number of erases of the memory block, simulate the unbalanced state to trigger the wear equalization mechanism, and then conduct dynamic equalization and static equalization tests.
It improves the efficiency and comprehensiveness of wear equalization function testing, can better be compatible with the balance characteristics of different disks, meets test plans in different situations, and ensures the reliability of wear equalization function.
Smart Images

Figure CN119512846A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of solid state hard disks, and in particular to a wear leveling function testing method, device, readable storage medium and electronic equipment. Background Art
[0002] Currently, wear leveling strategies are divided into two types: static leveling and dynamic leveling. In dynamic leveling, when writing data, the SSD (Solid State Disk or Solid State Drive) will give priority to new flash blocks with fewer cumulative erase times; in static leveling, the SSD will monitor and automatically allocate and migrate data, and it will let the old flash blocks take on read-based storage tasks, while letting the newer flash blocks take on more write tasks.
[0003] Due to the abundance of current disks, a disk has both dynamic balancing and static balancing. Existing testing methods may only target a certain balancing strategy. In addition, traditional black box testing methods take a long time to write and read data when the drive capacity is TB (terabyte), resulting in low testing efficiency. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a wear leveling function test method, device, readable storage medium and electronic device, which can effectively improve the efficiency and comprehensiveness of the wear leveling function test.
[0005] In order to solve the above technical problems, a technical solution adopted by the present invention is: A wear leveling function testing method comprises the following steps: Receiving a wear leveling function test request of a solid state drive, wherein the wear leveling function test request includes a dynamic leveling test request and a static leveling test request; If the query interface is used to query that the solid-state hard disk supports dynamic balancing, write first test data to the solid-state hard disk according to the dynamic balancing test request, and use the query interface to query the number of erase times of the current open block; Using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, the second preset value being smaller than the first preset value; Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks; Obtaining an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and returning to execute the step of using the query interface to query the number of erasures of the current open block until the number of executions reaches a preset number, and obtaining a final dynamic balance test result based on a plurality of the initial dynamic balance test results; If the query interface is used to query that the solid-state hard disk supports static balancing, a static balancing test is performed on the solid-state hard disk using a setting interface and a query interface according to the static balancing test request to obtain a static balancing test result.
[0006] In order to solve the above technical problems, another technical solution adopted by the present invention is: A wear leveling function testing device, comprising: A test request receiving module, used to receive a wear leveling function test request of the solid state drive, wherein the wear leveling function test request includes a dynamic leveling test request and a static leveling test request; A dynamic balancing test module, configured to write first test data to the solid-state hard disk according to the dynamic balancing test request if the query interface is used to query that the solid-state hard disk supports dynamic balancing, and query the number of erase times of a currently open block using the query interface; Using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, the second preset value being smaller than the first preset value; Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks; Obtaining an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and returning to execute the step of using the query interface to query the number of erasures of the current open block until the number of executions reaches a preset number, and obtaining a final dynamic balance test result based on a plurality of the initial dynamic balance test results; The static balancing test module is used to perform a static balancing test on the solid-state hard disk using a setting interface and a query interface according to the static balancing test request if the query interface is used to query that the solid-state hard disk supports static balancing to obtain a static balancing test result.
[0007] In order to solve the above technical problems, another technical solution adopted by the present invention is: A computer-readable storage medium stores a computer program, which implements each step of the wear leveling function test method when executed by a processor.
[0008] In order to solve the above technical problems, another technical solution adopted by the present invention is: An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned wear leveling function test method is implemented.
[0009] The beneficial effects of the present invention are: there is no need to know in advance which balancing strategy needs to be tested, but whether the SSD supports dynamic balancing and static balancing can be directly judged through the underlying query interface, and the corresponding wear leveling function test is performed according to the query result, which can better be compatible with different disk tests. When the SSD supports both dynamic balancing and static balancing, the dynamic balancing test and the static balancing test can be performed on the SSD respectively, which improves the comprehensiveness of the test. When testing the dynamic balancing and static balancing process, the query interface can be used to quickly obtain the erase count information of the storage block, intuitively understand the SSD drive letter balancing table, and use the setting interface to accurately and conveniently modify the erase count of the storage block. The number of erases can quickly simulate the imbalanced state and construct an imbalanced scenario to trigger dynamic balancing or static balancing, which improves the test efficiency and is more compatible with the balancing characteristics of different disks. It meets the test plans in different situations and effectively verifies the dynamic balancing capability and static balancing capability. In the dynamic balancing test, if the dynamic balancing function is normal, the number of erases of the current open block should be within the minimum number of erases of the invalid block. Therefore, based on the number of erases of the current open block and the minimum number of erases of the invalid block, the dynamic balancing test result can be directly and effectively obtained, thereby effectively improving the efficiency and comprehensiveness of the wear leveling function test and ensuring the reliability of the wear leveling function. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A flowchart of a wear leveling function testing method according to an embodiment of the present invention; Figure 2 A schematic diagram of the structure of a wear leveling function testing device according to an embodiment of the present invention; Figure 3 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention; Figure 4 This is a test flow chart of the wear leveling function test method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0011] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0012] Please refer to Figure 1 , a wear leveling function testing method, comprising the steps of: Receiving a wear leveling function test request of a solid state drive, wherein the wear leveling function test request includes a dynamic leveling test request and a static leveling test request; If the query interface is used to query that the solid-state hard disk supports dynamic balancing, write first test data to the solid-state hard disk according to the dynamic balancing test request, and use the query interface to query the number of erase times of the current open block; Using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, the second preset value being smaller than the first preset value; Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks; Obtaining an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and returning to execute the step of using the query interface to query the number of erasures of the current open block until the number of executions reaches a preset number, and obtaining a final dynamic balance test result based on a plurality of the initial dynamic balance test results; If the query interface is used to query that the solid-state hard disk supports static balancing, a static balancing test is performed on the solid-state hard disk using a setting interface and a query interface according to the static balancing test request to obtain a static balancing test result.
[0013] From the above description, it can be seen that the beneficial effects of the present invention are: there is no need to know in advance which balancing strategy needs to be tested, but to directly determine whether the SSD supports dynamic balancing and static balancing through the underlying query interface, and perform corresponding wear leveling function tests according to the query results, which can be better compatible with different disk tests. When the SSD supports dynamic balancing and static balancing at the same time, the dynamic balancing test and the static balancing test can be performed on the SSD respectively, which improves the comprehensiveness of the test. When testing the dynamic balancing and static balancing process, the query interface can be used to quickly obtain the erase count information of the storage block, intuitively understand the SSD drive letter balancing table, and use the setting interface to accurately and conveniently modify the storage The number of erase times of storage blocks can quickly simulate the imbalanced state and construct an imbalanced scenario to trigger dynamic balancing or static balancing, which improves the test efficiency and is more compatible with the balancing characteristics of different disks. It meets the test plans of different situations and effectively verifies the dynamic balancing capability and static balancing capability. In the dynamic balancing test, if the dynamic balancing function is normal, the number of erase times of the current open block should be within the minimum number of erase times of the invalid block. Therefore, based on the number of erase times of the current open block and the minimum number of erase times of the invalid block, the dynamic balancing test result can be directly and effectively obtained, thereby effectively improving the efficiency and comprehensiveness of the wear leveling function test and ensuring the reliability of the wear leveling function.
[0014] Further, performing a static balancing test on the solid state drive using a setting interface and a query interface according to the static balancing test request to obtain a static balancing test result includes: Writing second test data to the solid-state hard disk according to the static balancing test request, and setting the number of erasures of all blocks to a third preset value using a setting interface; Using the setting interface to set the number of erasures of the valid block with the minimum timestamp to a fourth preset value according to the received first garbage collection completion information, setting the number of erasures of the next block to be erased after writing the data to a fifth preset value, and continuing to write the second test data to the solid-state drive; Erasing the next block to be erased after the write data to trigger static balancing, and querying the valid block with the minimum timestamp using the query interface according to the received second garbage collection completion information; A static equalization test result is determined based on the valid block with the minimum timestamp.
[0015] From the above description, it can be seen that the setting interface is used to set the number of erase times of the block to quickly simulate the scenario sufficient to trigger static balancing, so that the static balancing test is more in line with actual usage. The query interface is used to query the valid block with the minimum timestamp. Since static balancing is used to ensure that all storage units in the solid-state drive are evenly worn, when the static balancing function is normal, the valid block with the minimum timestamp should change after the static balancing is triggered. Therefore, the static balancing test result can be effectively determined by the valid block based on the minimum timestamp, thereby improving the rationality, reliability and efficiency of the static balancing test.
[0016] Further, the query interface includes an information query interface of an open block; The using the query interface to query the number of erasures of the current open block includes: The information query interface of the open block is called to obtain the erasure count of the current open block output by the information query interface of the open block.
[0017] As can be seen from the above description, calling the open block information query interface can directly obtain the erasure count of the current open block and quickly understand the erasure status of the storage block.
[0018] Further, the setting interface includes an erasure count setting interface; The step of using the setting interface to set the erasure times of all invalid blocks to a first preset value, and using the setting interface to set the erasure times of a preset number of invalid blocks to a second preset value includes: Get the identifiers of all invalid blocks; Using the identifiers of all the invalid blocks and the first preset value as interface input to call the erasure count setting interface; Get the identifiers of a preset number of invalid blocks; The identifiers of the preset number of invalid blocks and the second preset value are used as interface inputs to call the erasure count setting interface.
[0019] From the above description, it can be seen that by calling the erase count setting interface with the block identifier and the preset value as the interface input, the erase count of the corresponding storage block can be modified, thereby quickly and accurately constructing an unbalanced scenario. By first setting the erase count of all invalid blocks to the first preset value, the wear conditions of all invalid blocks can be kept consistent. Then, by setting the erase count of some invalid blocks to the second preset value, the wear conditions of some invalid blocks can be made inconsistent with those of other invalid blocks, which is more in line with actual usage scenarios, so as to improve the effectiveness and rationality of the wear leveling function test.
[0020] Further, the query interface includes a block information query interface; The using the query interface to query the minimum number of erasure times of invalid blocks includes: Get the identifiers of all invalid blocks; Using the identifiers of all the invalid blocks as interface input to call the block information query interface, and obtaining the erasure counts of all the invalid blocks output by the block information query interface; A minimum value of the number of erasures of the invalid blocks is determined from the number of erasures of all the invalid blocks.
[0021] From the above description, it can be seen that, due to the normal dynamic balancing function, as data is written, the minimum number of erase times of invalid blocks will also change. By using the identifiers of all invalid blocks as interface input to call the block information query interface, the erase times of all invalid blocks can be obtained, and then the minimum number of erase times of invalid blocks can be determined from the erase times of all invalid blocks. This is more intuitive and convenient, and improves test efficiency.
[0022] Further, the initial dynamic balance test result obtained based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block includes: It is determined whether the erasure count of the current open block is less than or equal to the minimum erasure count of the invalid block plus one. If so, the initial dynamic balance test result is determined to be passed; if not, the initial dynamic balance test result is determined to be failed.
[0023] From the above description, it can be seen that if the erase count of the current open block is less than or equal to the minimum erase count of the invalid block plus one, it means that the block with the minimum PE (erase) is automatically selected when dynamically balancing data writing. At this time, the initial dynamic balancing test result is determined to be passed, and an effective dynamic balancing test is achieved.
[0024] Further, the query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; After writing the second test data to the solid state drive according to the static balancing test request, the method includes: Calling the solid state drive firmware configuration information query interface to obtain the static balancing threshold output by the solid state drive firmware configuration information query interface; Calling the solid state hard disk health status query interface to obtain the initial average PE output by the solid state hard disk health status query interface; The step of using the setting interface to set the number of erasures of the valid block with the minimum timestamp to a fourth preset value according to the received first garbage collection completion information, and setting the number of erasures of the next block to be erased after writing data to a fifth preset value comprises: Calling the valid block query interface of the minimum timestamp according to the received first garbage collection completion information, and obtaining the identifier of the valid block of the minimum timestamp output by the valid block query interface of the minimum timestamp; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a fourth preset value according to the initial average PE, and use the identifier of the valid block with the minimum timestamp and the fourth preset value as interface input to call the erasure count setting interface; A fifth preset value is determined according to the initial average PE and the static balancing threshold, and the identifier of the next block to be erased after writing the data and the fifth preset value are used as interface inputs to call the erasure count setting interface.
[0025] From the above description, it can be seen that according to the received first garbage collection completion information, the valid block query interface of the minimum timestamp is called to obtain the identifier of the valid block with the minimum timestamp output by it, and the next block query interface to be erased after writing data is called to obtain the identifier of the next block to be erased after writing data output by it, and the fourth preset value is determined according to the initial average PE queried by the solid-state hard disk health status query interface, and the identifier of the valid block with the minimum timestamp and the fourth preset value are used as interface inputs to call the erasure count setting interface, and the fifth preset value is determined according to the initial average PE and the static balancing threshold, and the identifier of the next block to be erased after writing data and the fifth preset value are used as interface inputs to call the erasure count setting interface, which quickly and accurately simulates the unbalanced scenario that triggers static balancing, can check the effectiveness of static balancing when GC (garbage collection) data is moved in the user block with the minimum timestamp on the flash memory, and improves the test efficiency and effectiveness.
[0026] Further, the determining of the static equalization test result based on the valid block with the minimum timestamp includes: Based on the identifier of the valid block with the minimum timestamp queried according to the first garbage collection completion information received, determine whether the identifier of the valid block with the minimum timestamp queried according to the second garbage collection completion information received has changed, and determine whether the status of the valid block with the minimum timestamp queried according to the first garbage collection completion information received has changed. If both are true, determine that the static balancing test result is passed; otherwise, determine that the static balancing test result is failed.
[0027] From the above description, it can be seen that based on the identifier of the valid block with the minimum timestamp queried last time, it is judged whether the identifier of the valid block with the minimum timestamp queried last time has changed, and it is judged whether the state of the valid block with the minimum timestamp queried last time has changed. If both are true, it means that the static balancing capability is normal, which can ensure that the write operations of all storage units are evenly distributed and reallocate static data that has not changed for a long time, so as to determine that the static balancing test result is passed, and a reliable static balancing test is achieved.
[0028] Furthermore, the wear leveling function test request also includes a test request for static balancing when interacting with other scenarios; The query interface includes a solid state drive firmware configuration information query interface, a valid block query interface with a minimum timestamp, a block information query interface, and a next block to be erased after writing data. The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state drive supports static balancing, write third test data to the solid-state drive according to the test request for static balancing when interacting with other scenarios, and call the solid-state drive firmware configuration information query interface to obtain the initial average PE and static balancing threshold output by the solid-state drive firmware configuration information query interface; Using the identifiers of all blocks and the third preset value as interface input to call the erasure count setting interface; Calling the valid block query interface of the minimum timestamp according to the received third garbage collection completion information, obtaining the identifier of the valid block of the first minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface with the identifier of the valid block of the first minimum timestamp as an interface input, and obtaining the first state of the valid block of the first minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a sixth preset value according to the initial average PE, and use the identifier of the valid block of the first minimum timestamp and the sixth preset value as interface input to call the erasure count setting interface; Determine a seventh preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the seventh preset value as interface input to call the erasure count setting interface; Continue writing the second test data to the solid state drive; Erasing the next block to be erased after the written data to trigger static balancing and simultaneously performing a hard reset operation on the solid state drive; Calling the valid block query interface of the minimum timestamp according to the received second garbage collection completion information and inspection completion information, and obtaining the identifier of the valid block of the second minimum timestamp output by the valid block query interface of the minimum timestamp; The block information query interface is called by taking the identifier of the valid block with the first minimum timestamp as an interface input, and a second state of the valid block with the first minimum timestamp output by the block information query interface is obtained; Whether the identifier of the valid block of the first minimum timestamp has changed is determined according to the identifier of the valid block of the second minimum timestamp, and whether the second state of the valid block of the first minimum timestamp has changed to invalid is determined according to the first state of the valid block of the first minimum timestamp. If both are true, it is determined that the test result of static balance when interacting with other scenarios is passed; otherwise, it is determined that the test result of static balance when interacting with other scenarios is failed.
[0029] From the above description, we can know that in addition to basic dynamic balancing tests and static balancing tests on SSDs, when static balancing is triggered through different query interfaces and setting interface tests, a hard reset operation is performed and the balancing is still completed normally. This implements the test of the interaction between balancing and different modules, and can verify whether static balancing is effective from different dimensions, thereby improving the comprehensiveness and reliability of the test.
[0030] Further, the wear leveling function test request also includes a test request for a write exception occurring when statically leveling a target block; The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, a block information query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state hard disk supports static balancing, fourth test data is written to the solid-state hard disk according to the test request of the write exception occurring during the static balancing target block, and the solid-state hard disk health status query interface is called to obtain the first write exception count output by the solid-state hard disk health status query interface; Calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface using the identifiers of all blocks and the eighth preset value as interface input; calling the valid block query interface of the minimum timestamp according to the received fourth garbage collection completion information, obtaining the identifier of the valid block of the third minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface by taking the identifier of the valid block of the third minimum timestamp as an interface input, and obtaining the first state of the valid block of the third minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a ninth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the ninth preset value as interface inputs to call the erasure count setting interface; Determine a tenth preset value according to the initial average PE, and use the identifier of the valid block of the third minimum timestamp and the tenth preset value as interface input to call the erasure count setting interface; Using the physical address of the next block to be erased after the data is written as an interface input to call the write exception injection interface; Continue writing the fourth test data to the solid state drive; Erasing the next block to be erased after the write data to trigger static balancing; calling the valid block query interface of the minimum timestamp according to the received fifth garbage collection completion information, and obtaining the identifier of the valid block of the fourth minimum timestamp output by the valid block query interface of the minimum timestamp; The block information query interface is called by taking the identifier of the valid block with the third minimum timestamp as an interface input, and a second state of the valid block with the third minimum timestamp output by the block information query interface is acquired; Calling the solid state hard disk health status query interface to obtain the second write exception count output by the solid state hard disk health status query interface; According to the identifier of the valid block of the third minimum timestamp, determine whether the identifier of the valid block of the fourth minimum timestamp has changed, and according to the first state of the valid block of the third minimum timestamp, determine whether the second state of the valid block of the third minimum timestamp has changed to invalid. If not, it is determined that the test result of the write exception occurring in the static balancing target block is failed. If both are yes, it is determined whether the second write exception count is greater than the first write exception count. If it is greater, it is determined that the test result of the write exception occurring in the static balancing target block is passed. If not, it is determined that the test result of the write exception occurring in the static balancing target block is failed.
[0031] From the above description, it can be seen that in addition to using the query interface and the setting interface, the write exception injection interface is also used to simulate the balancing situation under the write exception condition, realizing the test of write exception occurring when the target block is statically balanced, and improving the comprehensiveness of the test.
[0032] Further, the wear leveling function test request also includes a test request for a read exception that occurs when statically leveling a source block; The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, a block information query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state hard disk supports static balancing, fifth test data is written to the solid-state hard disk according to the test request of the read exception occurring during the static balancing source block, and the solid-state hard disk health status query interface is called to obtain the first read exception count output by the solid-state hard disk health status query interface; Calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface using the identifiers of all blocks and the eleventh preset value as interface input; calling the valid block query interface of the minimum timestamp according to the received sixth garbage collection completion information, obtaining the identifier of the valid block of the fifth minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface by taking the identifier of the valid block of the fifth minimum timestamp as an interface input, and obtaining the status of the valid block of the fifth minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a twelfth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the twelfth preset value as interface input to call the erasure count setting interface; Determine a thirteenth preset value according to the initial average PE, and use the identifier of the valid block of the fifth minimum timestamp and the thirteenth preset value as interface input to call the erasure count setting interface; Using the physical address of the next block to be erased after the data is written as an interface input to call the read exception injection interface; Continue writing the fifth test data to the solid state drive; Erasing the next block to be erased after the write data to trigger static balancing; Calling the solid state hard disk health status query interface according to the received seventh garbage collection completion information to obtain a second read exception count output by the solid state hard disk health status query interface; Determine whether the second read exception count is greater than the first read exception count. If so, determine that the test result of the read exception occurring during static balancing of the source block is passed; if not, determine that the test result of the read exception occurring during static balancing of the source block is failed.
[0033] As can be seen from the above description, a scenario in which a read exception occurs in a balancing source block is simulated for the solid-state drive through a read exception injection interface, thereby testing the reliability when a read exception occurs in the balancing source block.
[0034] Further, the wear leveling function test request also includes a test request for an erasure exception occurring when a static leveling erase target block is erased; The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, a block information query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state hard disk supports static balancing, then according to the test request of the erasure exception occurring when the static balancing erases the target block, the sixth test data is written to the solid-state hard disk, and the solid-state hard disk health status query interface is called to obtain the first erasure exception count output by the solid-state hard disk health status query interface; Calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface using the identifiers of all blocks and the fourteenth preset value as interface input; calling the valid block query interface of the minimum timestamp according to the received eighth garbage collection completion information, obtaining the identifier of the valid block of the sixth minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface by taking the identifier of the valid block of the sixth minimum timestamp as an interface input, and obtaining the status of the valid block of the sixth minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a fifteenth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the fifteenth preset value as interface inputs to call the erasure count setting interface; Determine a sixteenth preset value according to the initial average PE, and use the identifier of the valid block of the sixth minimum timestamp and the sixteenth preset value as interface input to call the erasure count setting interface; Using the physical address of the next block to be erased after the data is written as an interface input to call the erase exception injection interface; Continue writing the sixth test data to the solid state drive; Erasing the next block to be erased after the write data to trigger static balancing; Calling the solid state hard disk health status query interface according to the received ninth garbage collection completion information to obtain a second erasure exception count output by the solid state hard disk health status query interface; Determine whether the second erase exception count is greater than the first erase exception count. If so, determine that the test result of the erase exception occurring when the target block is statically and evenly erased is passed; if not, determine that the test result of the erase exception occurring when the target block is statically and evenly erased is failed.
[0035] From the above description, it can be seen that the erase exception injection interface combined with the setting interface and the query interface can simply and accurately implement the test of erase exceptions occurring when the target block is erased evenly, which can effectively and comprehensively test the reliability and robustness of the wear leveling function.
[0036] Please refer to Figure 2 Another embodiment of the present invention provides a wear leveling function testing device, comprising: A test request receiving module, used to receive a wear leveling function test request of the solid state drive, wherein the wear leveling function test request includes a dynamic leveling test request and a static leveling test request; A dynamic balancing test module, configured to write first test data to the solid-state hard disk according to the dynamic balancing test request if the query interface is used to query that the solid-state hard disk supports dynamic balancing, and query the number of erase times of a currently open block using the query interface; Using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, the second preset value being smaller than the first preset value; Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks; Obtaining an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and returning to execute the step of using the query interface to query the number of erasures of the current open block until the number of executions reaches a preset number, and obtaining a final dynamic balance test result based on a plurality of the initial dynamic balance test results; The static balancing test module is used to perform a static balancing test on the solid-state hard disk using a setting interface and a query interface according to the static balancing test request if the query interface is used to query that the solid-state hard disk supports static balancing to obtain a static balancing test result.
[0037] Another embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, each step in the above-mentioned wear leveling function test method is implemented.
[0038] Please refer to Figure 3Another embodiment of the present invention 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 wear leveling function test method when executing the computer program.
[0039] The wear leveling function test method, device, readable storage medium and electronic device of the present invention can be applied to different types of SSDs, such as SATA SSD, NVMe SSD, PCIe SSD, etc., and are described below through specific implementation methods: Please refer to Figure 1 and Figure 4 , Embodiment 1 of the present invention is: A wear leveling function testing method comprises the following steps: S1. Receive a wear leveling function test request for a solid state drive, wherein the wear leveling function test request includes a dynamic balancing test request, a static balancing test request, a static balancing test request when interacting with other scenarios, a write exception test request when static balancing a target block, a read exception test request when static balancing a source block, and an erase exception test request when static balancing an erasing target block.
[0040] In an optional embodiment, the query interface, setting interface and error injection interface are all firmware interfaces; the query interface includes an open block information query interface, a block information query interface, a solid-state drive firmware configuration information query interface, a valid block query interface with a minimum timestamp, a next block to be erased after writing data query interface, a solid-state drive health status query interface and a garbage collection status query interface; the setting interface includes an erase count setting interface, and the injection interface includes a write exception injection interface, a read exception injection interface and an erase exception injection interface.
[0041] The open block information query interface is described as follows: No parameters need to be entered. According to the result returned by the interface, the FAA (physical address) and other information of the current open block (open block, including the open block of DATA BLOCK and TBL BLOCK, that is, the block being written by the user area and table area storage block) of the disk are obtained. FAA includes five information: block, page, die, plane, and au.
[0042] The block information query interface is described as: specify a Block ID to query a series of information about the Block, such as block type, block state, read cnt, erase cnt, read disturb thr, etc.
[0043] The SSD firmware configuration information query interface is described as follows: No parameters need to be entered, and the configuration information of the SSD firmware can be queried, including dynamic balancing and static balancing support, project ID, particle type, particle model, disk type, number of DIEs (logical units), number of blocks, number of TLC pages, number of SLC pages, Page size, static balancing threshold, etc.
[0044] The interface description of querying the valid block with the minimum timestamp is as follows: querying the identifier of the valid block with the minimum SN (timestamp, i.e., the modification time of the data area) of the SSD without inputting parameters.
[0045] The interface description of the next block to be erased after writing data is as follows: No parameters need to be entered, and the information of the next block to be erased after writing data is queried, including the blocks to be erased in the data area, table area, and system area.
[0046] The SSD health status query interface is described as follows: No parameters need to be entered to view the current health status information of the SSD, including UNC (read exception) count, ECC (error correction code) count, Program Fail (write exception) count, Erase Fail (erase exception) count, Average PE in SSD (initial average PE), etc.
[0047] The garbage collection status query interface is described as follows: No parameters need to be entered. Check the status of the current GC task of the disk. The command returns 0 or 1. 0 means that GC is not started, and 1 means that GC is in progress.
[0048] The erasure count setting interface is described as: inputting a block ID and an erasure count to specify a block and set its erasure count.
[0049] The write exception injection interface is described as: input the FAA address, which is used to specify a certain FAA address to inject program fail. After injecting program fail, an error occurs when writing this FAA address.
[0050] The read exception injection interface is described as: input the FAA address to specify a certain FAA address to inject unc error. After the unc error is injected, an error occurs when reading this FAA address.
[0051] The erase exception injection interface is described as follows: input the FAA address to specify a certain FAA address to inject erase fail. After injecting erase fail, an error occurs when erasing this FAA address.
[0052] In an optional implementation manner, before S1, the step further includes: S0. Power on the solid state drive as a data disk, and the solid state drive has been normally recognized by the operating system.
[0053] S2. If the query interface is used to query that the solid-state hard disk supports dynamic balancing, write the first test data to the solid-state hard disk according to the dynamic balancing test request, and use the query interface to query the number of erase times of the current open block, such as Figure 4 As shown, specifically including S2.1-S2.2: S2.1. If it is found through the query interface that the solid state drive supports dynamic balancing, write first test data to the solid state drive according to the dynamic balancing test request.
[0054] Specifically, if the solid-state hard drive firmware configuration information query interface is called, and the solid-state hard drive supports dynamic balancing according to the dynamic balancing and static balancing support status output by the interface, then the first test data of a first preset size is written to the solid-state hard drive according to the dynamic balancing test request, otherwise, the dynamic balancing test is not performed.
[0055] In an optional implementation, the first preset size is 2G.
[0056] S2.2. Call the open block information query interface to obtain the erasure count of the current open block output by the open block information query interface.
[0057] In an optional implementation, it also includes: If the query of the erase count of the current open block fails, the initial dynamic balance test result is determined to be failed.
[0058] S3, using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, wherein the second preset value is less than the first preset value, specifically including S3.1-S3.4: S3.1. Get the identifiers of all invalid blocks.
[0059] S3.2. Using the identifiers of all invalid blocks and the first preset value as interface input, the erasure count setting interface is called.
[0060] In an optional implementation, the first preset value is 20.
[0061] S3.3. Obtain identifiers of a preset number of invalid blocks.
[0062] In an optional implementation, the preset number is 2.
[0063] S3.4. Using the identifiers of the preset number of invalid blocks and the second preset value as interface inputs to call the erasure count setting interface.
[0064] In an optional implementation, the second preset value is 10.
[0065] First, the erase count of all invalid blocks is set to 20 to make the wear conditions of all invalid blocks consistent, and then the erase count of some invalid blocks is set to 10 to more effectively simulate the scenario of uneven wear.
[0066] In an optional implementation, it also includes: If the erasure count setting of the invalid block fails, the initial dynamic equalization test result is determined to be failed.
[0067] S4. Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks, specifically including S4.1-S4.4: S4.1. Randomly write the first test data to the solid state drive.
[0068] Specifically, the first test data of a second preset size is randomly written to the solid state drive 4K.
[0069] The second preset size must at least reach a block size. In an optional implementation, the second preset size is 10% of the disk capacity.
[0070] In an optional implementation, it also includes: If an IO error occurs during random writing, the initial dynamic balancing test result is determined to be a failure.
[0071] S4.2. Get the identifiers of all invalid blocks.
[0072] S4.3. Using the identifiers of all the invalid blocks as interface input to call the block information query interface, and obtaining the erasure counts of all the invalid blocks output by the block information query interface.
[0073] S4.4. Determine a minimum value of the number of erasures of invalid blocks from the number of erasures of all invalid blocks.
[0074] S5. Obtain an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and return to execute steps S2.2-S5 until the number of executions reaches a preset number of times, and obtain a final dynamic balance test result based on multiple initial dynamic balance test results, specifically including S5.1-S5.2: S5.1. Determine whether the number of erasures of the current open block is less than or equal to the minimum number of erasures of the invalid block plus one. If so, determine that the initial dynamic balance test result is passed; if not, determine that the initial dynamic balance test result is failed.
[0075] S5.2. Return to execute steps S2.2-S5.1 until the number of executions reaches a preset number, and obtain a final dynamic balancing test result based on the multiple initial dynamic balancing test results.
[0076] In an optional implementation, the preset number of times is 5. Specifically, return to execute steps S2.2-S5.1 until the number of executions reaches 5 times, and obtain the final dynamic balance test result according to all the initial dynamic balance test results, that is, determine whether all the initial dynamic balance test results are passed, if so, determine that the final dynamic balance test result is passed, if not, determine that the final dynamic balance test result is failed.
[0077] The above dynamic balancing test method tests the dynamic balancing of the table entry area, that is, verifies whether the dynamic balancing can automatically select the block with the minimum PE (erase / write) when writing data.
[0078] S6. If the query interface is used to query that the solid-state hard disk supports static balancing, then according to the static balancing test request, the setting interface and the query interface are used to perform a static balancing test on the solid-state hard disk to obtain a static balancing test result, such as Figure 4 As shown, specifically including S6.1-S6.4: S6.1. If the query interface is used to query that the solid-state hard disk supports static balancing, write second test data to the solid-state hard disk according to the static balancing test request, and use the setting interface to set the number of erase times of all blocks to a third preset value, specifically including S6.1.1-S6.1.4: S6.1.1. If the query interface is used to query that the solid-state hard disk supports static balancing, write second test data to the solid-state hard disk according to the static balancing test request.
[0079] Specifically, if the solid-state drive firmware configuration information query interface is called, and it is found that the solid-state drive supports static balancing according to the dynamic balancing and static balancing support status output by the interface, then the second test data of the third preset size is written to the solid-state drive FIO according to the static balancing test request, otherwise, the static balancing test is not performed.
[0080] In an optional implementation, the third preset size is 30% of the disk capacity.
[0081] In an optional implementation, it also includes: If the query of whether the solid state drive supports static balancing fails, the static balancing test result is determined to be failed.
[0082] S6.1.2. Call the solid state drive firmware configuration information query interface to obtain the static balancing threshold output by the solid state drive firmware configuration information query interface.
[0083] S6.1.3. Call the solid state drive health status query interface to obtain the initial average PE output by the solid state drive health status query interface.
[0084] In an optional implementation, it also includes: If the initial average PE and static balancing threshold query fails, the static balancing test result is determined to be failed.
[0085] S6.1.4. Use the setting interface to set the number of erase times of all blocks to a third preset value.
[0086] Specifically, the identifiers of all blocks are obtained, and the identifiers of all blocks and the third preset value are used as interface input to call the erasure count setting interface. In an optional implementation, the third preset value is 1000, thereby triggering garbage collection.
[0087] S6.2, according to the received first garbage collection completion information, using the setting interface to set the number of erasures of the valid block with the minimum timestamp to a fourth preset value, setting the number of erasures of the next block to be erased after writing the data to a fifth preset value, and continuing to write the second test data to the solid-state drive, specifically including S6.2.1-S6.2.5: S6.2.1. Call the valid block query interface of the minimum timestamp according to the received first garbage collection completion information, and obtain the identifier of the valid block of the minimum timestamp output by the valid block query interface of the minimum timestamp.
[0088] S6.2.2. Call the next block to be erased after writing the data query interface to obtain the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface.
[0089] For example, the next block to be erased after writing data query interface is called to obtain the identifier of the next block A to be erased after writing data output by the next block to be erased after writing data query interface.
[0090] S6.2.3. Determine a fourth preset value according to the initial average PE, and use the identifier of the valid block with the minimum timestamp and the fourth preset value as interface input to call the erasure count setting interface.
[0091] In an optional implementation, determining the fourth preset value according to the initial average PE includes: The initial average PE is subtracted by 3 to obtain a fourth preset value.
[0092] S6.2.4. Determine a fifth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the fifth preset value as interface inputs to call the erase count setting interface.
[0093] In an optional implementation, determining the fifth preset value according to the initial average PE and the static equalization threshold includes: The fifth preset value is obtained by adding the initial average PE and the static equalization threshold and then adding 10.
[0094] In an optional implementation, it also includes: If the erasure count setting of the valid block with the minimum timestamp and the next block to be erased after writing data fails, the static balancing test result is determined to be failed.
[0095] S6.2.5. Continue writing the second test data to the solid state drive.
[0096] S6.3. Erasing the next block to be erased after the write data to trigger static balancing, and using a query interface to query a valid block with a minimum timestamp according to the received second garbage collection completion information.
[0097] Specifically, the next block to be erased after the write data is erased to trigger static balancing, and the valid block query interface of the minimum timestamp is called according to the received second garbage collection completion information to obtain the identifier of the valid block with the minimum timestamp output by the valid block query interface of the minimum timestamp.
[0098] S6.4. Determine a static equalization test result based on the valid block with the minimum timestamp.
[0099] Specifically, based on the identifier of the valid block with the minimum timestamp queried according to the received first garbage collection completion information, it is determined whether the identifier of the valid block with the minimum timestamp queried according to the received second garbage collection completion information has changed, and it is determined whether the state of the valid block with the minimum timestamp queried according to the received first garbage collection completion information has changed. If both are true, it is determined that the static balance test result is passed, otherwise it is determined that the static balance test result is failed. Wherein, the determination of whether the state of the valid block with the minimum timestamp queried according to the received first garbage collection completion information has changed includes: determining whether the state of the valid block with the minimum timestamp queried according to the received first garbage collection completion information has changed to invalid.
[0100] The above static balance test method tests the static balance of the data area, that is, checks whether the static balance is normal when the user block with the smallest timestamp on the flash memory undergoes GC data migration.
[0101] S7. If the query interface is used to query that the solid-state drive supports static balancing, the third test data is written to the solid-state drive according to the test request for static balancing when interacting with other scenarios, and the solid-state drive firmware configuration information query interface is called to obtain the initial average PE and static balancing threshold output by the solid-state drive firmware configuration information query interface.
[0102] Specifically, if the solid-state drive firmware configuration information query interface is called to obtain the dynamic balancing and static balancing support status output by the solid-state drive firmware configuration information query interface to determine that the solid-state drive supports static balancing, then according to the test request for static balancing when interacting with other scenarios, the third test data of the fourth preset size is written to the solid-state drive FIO, and the solid-state drive firmware configuration information query interface is called to obtain the initial average PE and static balancing threshold output by the solid-state drive firmware configuration information query interface; otherwise, the static balancing test when interacting with other scenarios is not performed.
[0103] In an optional implementation, the fourth preset size is 30% of the disk capacity.
[0104] S8. Using the identifiers of all blocks and the third preset value as interface input, the erasure count setting interface is called.
[0105] In an optional implementation, the identifiers of all blocks and 1000 are used as interface input to call the erasure count setting interface.
[0106] In an optional implementation, it also includes: If the erase count setting of all blocks fails, the test result of static balancing when interacting with other scenarios is determined to be failed.
[0107] S9. Call the valid block query interface of the minimum timestamp according to the received third garbage collection completion information, obtain the identifier of the valid block of the first minimum timestamp output by the valid block query interface of the minimum timestamp, and use the identifier of the valid block of the first minimum timestamp as interface input to call the block information query interface, and obtain the first state of the valid block of the first minimum timestamp output by the block information query interface.
[0108] S10: calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface.
[0109] S11. Determine a sixth preset value according to the initial average PE, and use the identifier of the valid block of the first minimum timestamp and the sixth preset value as interface input to call the erasure count setting interface.
[0110] In an optional implementation, determining the sixth preset value according to the initial average PE includes: The initial average PE is subtracted by 3 to obtain a sixth preset value.
[0111] S12: Determine a seventh preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the seventh preset value as interface inputs to call the erasure count setting interface.
[0112] In an optional implementation, determining the seventh preset value according to the initial average PE and the static equalization threshold includes: The seventh preset value is obtained by adding the initial average PE and the static equalization threshold and then adding 10.
[0113] In an optional implementation, it also includes: If the erasure count setting of the valid block with the first minimum timestamp and the next block to be erased after writing data fails, it is determined that the test result of static balancing when interacting with other scenarios is failed.
[0114] S13. Continue writing the second test data to the solid state drive.
[0115] In an optional implementation, it also includes: If an IO error occurs when writing data, the test result of static balancing when interacting with other scenarios is determined to be failed.
[0116] S14, erasing the next block to be erased after the written data to trigger static balancing, and performing a hard reset operation on the solid state drive.
[0117] S15. Call the valid block query interface of the minimum timestamp according to the received second garbage collection completion information and the inspection completion information, and obtain the identifier of the valid block of the second minimum timestamp output by the valid block query interface of the minimum timestamp.
[0118] S16: Call the block information query interface by taking the identifier of the valid block with the first minimum timestamp as an interface input, and obtain the second state of the valid block with the first minimum timestamp output by the block information query interface.
[0119] S17. Determine whether the identifier of the valid block of the second minimum timestamp has changed according to the identifier of the valid block of the first minimum timestamp, and determine whether the second state of the valid block of the first minimum timestamp has changed to invalid according to the first state of the valid block of the first minimum timestamp. If both are true, determine that the test result of static balance when interacting with other scenarios is passed; otherwise, determine that the test result of static balance when interacting with other scenarios is failed.
[0120] S18. If the query interface is used to query that the solid-state hard disk supports static balancing, the fourth test data is written to the solid-state hard disk according to the test request of the write exception occurring when the static balancing target block is used, and the solid-state hard disk health status query interface is called to obtain the first write exception count output by the solid-state hard disk health status query interface.
[0121] The fourth test data is test data of 30% of the disk capacity.
[0122] S19, calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface with the identifiers of all blocks and the eighth preset value as interface input. The eighth preset value is set according to actual conditions.
[0123] S20. Call the valid block query interface of the minimum timestamp according to the received fourth garbage collection completion information, obtain the identifier of the valid block of the third minimum timestamp output by the valid block query interface of the minimum timestamp, and use the identifier of the valid block of the third minimum timestamp as interface input to call the block information query interface, and obtain the first state of the valid block of the third minimum timestamp output by the block information query interface.
[0124] S21. Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface.
[0125] S22: Determine a ninth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the ninth preset value as interface inputs to call the erasure count setting interface.
[0126] In an optional implementation, determining the ninth preset value according to the initial average PE and the static equalization threshold includes: The initial average PE and the static equalization threshold are added together and then added with 10 to obtain a ninth preset value.
[0127] S23: Determine a tenth preset value according to the initial average PE, and use the identifier of the valid block with the third minimum timestamp and the tenth preset value as interface input to call the erasure count setting interface.
[0128] In an optional implementation, determining the tenth preset value according to the initial average PE includes: The initial average PE is subtracted by 3 to obtain the tenth preset value.
[0129] S24, using the physical address of the next block to be erased after the data is written as an interface input to call a write exception injection interface.
[0130] S25. Continue writing the fourth test data to the solid state drive.
[0131] S26, erasing the next block to be erased after the written data, to trigger static balancing.
[0132] S27: Call the valid block query interface of the minimum timestamp according to the received fifth garbage collection completion information, and obtain the identifier of the valid block of the fourth minimum timestamp output by the valid block query interface of the minimum timestamp.
[0133] S28: Call the block information query interface by taking the identifier of the valid block with the third minimum timestamp as an interface input, and obtain the second state of the valid block with the third minimum timestamp output by the block information query interface.
[0134] S29: Call the solid state drive health status query interface to obtain the second write exception count output by the solid state drive health status query interface.
[0135] S30. Determine whether the identifier of the valid block of the fourth minimum timestamp has changed according to the identifier of the valid block of the third minimum timestamp, and determine whether the second state of the valid block of the third minimum timestamp has changed to invalid according to the first state of the valid block of the third minimum timestamp. If not, determine that the test result of the write exception occurring in the static balancing target block is failed. If both are yes, determine whether the second write exception count is greater than the first write exception count. If greater, determine that the test result of the write exception occurring in the static balancing target block is passed. If not, determine that the test result of the write exception occurring in the static balancing target block is failed.
[0136] S31. If the query interface is used to query that the solid-state drive supports static balancing, write fifth test data to the solid-state drive according to the test request of the read exception when the static balancing source block is used, and call the solid-state drive health status query interface to obtain the first read exception count output by the solid-state drive health status query interface. The fifth test data is test data of 30% of the disk capacity.
[0137] S32, calling the solid state drive firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the solid state drive firmware configuration information query interface, and calling the erase count setting interface using the identifiers of all blocks and the eleventh preset value as interface input.
[0138] S33. Call the valid block query interface of the minimum timestamp according to the received sixth garbage collection completion information, obtain the identifier of the valid block of the fifth minimum timestamp output by the valid block query interface of the minimum timestamp, and use the identifier of the valid block of the fifth minimum timestamp as interface input to call the block information query interface, and obtain the status of the valid block of the fifth minimum timestamp output by the block information query interface.
[0139] S34: calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface.
[0140] S35, determining a twelfth preset value according to the initial average PE and the static balancing threshold, and using the identifier of the next block to be erased after writing the data and the twelfth preset value as interface input to call the erasure count setting interface.
[0141] In an optional implementation, the determining the twelfth preset value according to the initial average PE and the static equalization threshold comprises: The initial average PE and the static equalization threshold are added and then added with 10 to obtain a twelfth preset value.
[0142] S36. Determine a thirteenth preset value according to the initial average PE, and use the identifier of the valid block of the fifth minimum timestamp and the thirteenth preset value as interface input to call the erasure count setting interface.
[0143] In an optional implementation, determining a thirteenth preset value according to the initial average PE includes: The initial average PE is subtracted by 3 to obtain the thirteenth preset value.
[0144] S37, using the physical address of the next block to be erased after the data is written as an interface input to call a read exception injection interface.
[0145] S38. Continue writing the fifth test data to the solid state drive.
[0146] S39, erasing the next block to be erased after the write data to trigger static balancing.
[0147] S40. Call the solid state drive health status query interface according to the received seventh garbage collection completion information to obtain a second read exception count output by the solid state drive health status query interface.
[0148] S41. Determine whether the second read exception count is greater than the first read exception count. If so, determine that the test result of the read exception occurring during static balancing of the source block is passed. If not, determine that the test result of the read exception occurring during static balancing of the source block is failed.
[0149] S42. If the query interface is used to query that the solid-state hard disk supports static balancing, the sixth test data is written to the solid-state hard disk according to the test request of the erasure exception occurring when the static balancing erases the target block, and the solid-state hard disk health status query interface is called to obtain the first erase exception count output by the solid-state hard disk health status query interface.
[0150] The sixth test data is test data of 30% of the disk capacity.
[0151] S43, calling the solid state drive firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the solid state drive firmware configuration information query interface, and calling the erase count setting interface using the identifiers of all blocks and the fourteenth preset value as interface input.
[0152] The fourteenth preset value may be set according to actual conditions.
[0153] S44. Call the valid block query interface of the minimum timestamp according to the received eighth garbage collection completion information, obtain the identifier of the valid block of the sixth minimum timestamp output by the valid block query interface of the minimum timestamp, and use the identifier of the valid block of the sixth minimum timestamp as interface input to call the block information query interface, and obtain the status of the valid block of the sixth minimum timestamp output by the block information query interface.
[0154] S45. Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface.
[0155] S46. Determine a fifteenth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the fifteenth preset value as interface inputs to call the erasure count setting interface.
[0156] In an optional implementation, determining the fifteenth preset value according to the initial average PE and the static equalization threshold includes: The fifteenth preset value is obtained by adding the initial average PE and the static equalization threshold and then adding 10.
[0157] S47: Determine a sixteenth preset value according to the initial average PE, and use the identifier of the valid block of the sixth minimum timestamp and the sixteenth preset value as interface input to call the erasure count setting interface.
[0158] In an optional implementation, determining the sixteenth preset value according to the initial average PE includes: The initial average PE is subtracted by 3 to obtain the sixteenth preset value.
[0159] S48, using the physical address of the next block to be erased after the data is written as an interface input to call an erase exception injection interface.
[0160] S49. Continue writing the sixth test data to the solid state drive.
[0161] S50: Erasing the next block to be erased after erasing the written data to trigger static balancing.
[0162] S51. Call the solid state hard disk health status query interface according to the received ninth garbage collection completion information to obtain a second erasure exception count output by the solid state hard disk health status query interface.
[0163] S52. Determine whether the second erase exception count is greater than the first erase exception count. If so, determine that the test result of the erase exception occurring when the target block is statically and evenly erased is passed. If not, determine that the test result of the erase exception occurring when the target block is statically and evenly erased is failed.
[0164] Through the underlying interface, it is determined whether the user area and system area storage blocks support dynamic balancing and static balancing. It is no longer necessary to know in advance which balancing strategy to test, which can be more compatible with different disk tests. When testing dynamic balancing, first modify the erase count of all storage blocks to a certain value to construct the current balanced state, and then randomly select a small number of storage blocks, modify their erase count to a smaller value of the average PE, and the specific value can be determined according to the actual situation, and then continue to write N storage blocks of data to determine whether the erase count of the storage block currently being written is within the minimum erase count range, so as to achieve dynamic balancing test. When testing static balancing, under the premise of modifying the erase count of all storage blocks to achieve the balanced state, construct the minimum timestamp data storage block erase count and the current erased storage block erase count to reach the triggering static balancing threshold condition, continue to write N storage blocks of data, and determine whether the storage block with the minimum timestamp has changed, so as to achieve static balancing test, and at the same time verify whether the static balancing effect is effective from different dimensions, including the interaction between static balancing and different modules, and simulate the balancing situation under abnormal conditions through the error injection interface.
[0165] The above-mentioned testing method of the present invention can better be compatible with the balancing characteristics of different disks and meet the testing schemes of different situations. The query interface provided can intuitively understand the SSD drive letter balancing table, provide a setting interface to modify the number of storage block erase times, quickly simulate the unbalanced state, provide an error injection interface to inject different errors, test the wear leveling reliability and robustness, thereby verifying whether the automatic balancing effect is achieved, and improving the test efficiency and comprehensiveness.
[0166] In summary, the present invention provides a wear leveling function test method, device, readable storage medium and electronic device. It is not necessary to know in advance which balancing strategy needs to be tested. Instead, it is directly determined whether the SSD supports dynamic balancing and static balancing through the underlying query interface, and the corresponding wear leveling function test is performed according to the query result. It can be better compatible with different disk tests. When the SSD supports dynamic balancing and static balancing at the same time, the dynamic balancing test and the static balancing test can be performed on the SSD respectively, which improves the comprehensiveness of the test. In the process of testing dynamic balancing and static balancing, the query interface can be used to quickly obtain the erase count information of the storage block, and the SSD drive letter balancing table can be intuitively understood. The setting interface can be used to accurately and conveniently modify the erase count of the storage block, and the imbalance state can be quickly simulated to construct It creates an unbalanced scenario to trigger dynamic balancing or static balancing, improves test efficiency, and is more compatible with the balancing characteristics of different disks, meets test plans in different situations, and effectively verifies dynamic balancing capabilities and static balancing capabilities. In the dynamic balancing test, if the dynamic balancing function is normal, the erasure times of the current open block should be within the minimum erasure times of the invalid block. Therefore, based on the erasure times of the current open block and the minimum erasure times of the invalid block, the dynamic balancing test results can be directly and effectively obtained, thereby effectively improving the efficiency and comprehensiveness of the wear leveling function test and ensuring the reliability of the wear leveling function. In addition, in addition to basic dynamic balancing and static balancing tests on SSDs, different query interfaces and setting interfaces can be used to test when static balancing is triggered, and a hard reset operation is performed, and the balancing is still completed normally, realizing the test of the interaction between balancing and different modules, and being able to verify whether static balancing is effective from different dimensions, thereby improving the comprehensiveness and reliability of the test.
[0167] In the above embodiments provided in the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or components or modules, which can be electrical, mechanical or other forms.
[0168] The components described as separate components may or may not be physically separated, and the components shown as components may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0169] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each component may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0170] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present 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. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0171] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0172] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0173] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A wear leveling function testing method, characterized in that: Includes steps: Receiving a wear leveling function test request of a solid state drive, wherein the wear leveling function test request includes a dynamic leveling test request and a static leveling test request; If the query interface is used to query that the solid-state hard disk supports dynamic balancing, write first test data to the solid-state hard disk according to the dynamic balancing test request, and use the query interface to query the number of erase times of the current open block; Using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, the second preset value being smaller than the first preset value; Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks; Obtaining an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and returning to execute the step of using the query interface to query the number of erasures of the current open block until the number of executions reaches a preset number, and obtaining a final dynamic balance test result based on a plurality of the initial dynamic balance test results; If the query interface is used to query that the solid-state hard disk supports static balancing, a static balancing test is performed on the solid-state hard disk using a setting interface and a query interface according to the static balancing test request to obtain a static balancing test result.
2. A wear leveling function testing method according to claim 1, characterized in that: The step of performing a static balancing test on the solid state drive using a setting interface and a query interface according to the static balancing test request to obtain a static balancing test result includes: Writing second test data to the solid-state hard disk according to the static balancing test request, and setting the number of erasures of all blocks to a third preset value using a setting interface; Using the setting interface to set the number of erasures of the valid block with the minimum timestamp to a fourth preset value according to the received first garbage collection completion information, setting the number of erasures of the next block to be erased after writing the data to a fifth preset value, and continuing to write the second test data to the solid-state drive; Erasing the next block to be erased after the write data to trigger static balancing, and querying the valid block with the minimum timestamp using the query interface according to the received second garbage collection completion information; A static equalization test result is determined based on the valid block with the minimum timestamp.
3. A wear leveling function testing method according to claim 1, characterized in that: The query interface includes an information query interface for an open block; The using the query interface to query the number of erasures of the current open block includes: The information query interface of the open block is called to obtain the erasure count of the current open block output by the information query interface of the open block.
4. A wear leveling function testing method according to claim 1, characterized in that: The setting interface includes an erasure count setting interface; The step of using the setting interface to set the erasure times of all invalid blocks to a first preset value, and using the setting interface to set the erasure times of a preset number of invalid blocks to a second preset value includes: Get the identifiers of all invalid blocks; Using the identifiers of all the invalid blocks and the first preset value as interface input to call the erasure count setting interface; Get the identifiers of a preset number of invalid blocks; The identifiers of the preset number of invalid blocks and the second preset value are used as interface inputs to call the erasure count setting interface.
5. A wear leveling function testing method according to claim 1, characterized in that: The query interface includes a block information query interface; The using the query interface to query the minimum number of erasure times of invalid blocks includes: Get the identifiers of all invalid blocks; Using the identifiers of all the invalid blocks as interface input to call the block information query interface, and obtaining the erasure counts of all the invalid blocks output by the block information query interface; A minimum value of the number of erasures of the invalid blocks is determined from the number of erasures of all the invalid blocks.
6. A wear leveling function testing method according to claim 1, characterized in that: The initial dynamic balance test result obtained based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block includes: It is determined whether the erasure count of the current open block is less than or equal to the minimum erasure count of the invalid block plus one. If so, the initial dynamic balance test result is determined to be passed; if not, the initial dynamic balance test result is determined to be failed.
7. A wear leveling function testing method according to claim 2, characterized in that: The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, and a next block to be erased after writing data. The setting interface includes an erasure count setting interface; After writing the second test data to the solid state drive according to the static balancing test request, the method includes: Calling the solid state drive firmware configuration information query interface to obtain the static balancing threshold output by the solid state drive firmware configuration information query interface; Calling the solid state hard disk health status query interface to obtain the initial average PE output by the solid state hard disk health status query interface; The step of using the setting interface to set the number of erasures of the valid block with the minimum timestamp to a fourth preset value according to the received first garbage collection completion information, and setting the number of erasures of the next block to be erased after writing data to a fifth preset value comprises: Calling the valid block query interface of the minimum timestamp according to the received first garbage collection completion information, and obtaining the identifier of the valid block of the minimum timestamp output by the valid block query interface of the minimum timestamp; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a fourth preset value according to the initial average PE, and use the identifier of the valid block with the minimum timestamp and the fourth preset value as interface input to call the erasure count setting interface; A fifth preset value is determined according to the initial average PE and the static balancing threshold, and the identifier of the next block to be erased after writing the data and the fifth preset value are used as interface inputs to call the erasure count setting interface.
8. A wear leveling function testing method according to claim 7, characterized in that: Determining the static equalization test result based on the valid block with the minimum timestamp includes: Based on the identifier of the valid block with the minimum timestamp queried according to the first garbage collection completion information received, determine whether the identifier of the valid block with the minimum timestamp queried according to the second garbage collection completion information received has changed, and determine whether the status of the valid block with the minimum timestamp queried according to the first garbage collection completion information received has changed. If both are true, determine that the static balancing test result is passed; otherwise, determine that the static balancing test result is failed.
9. A wear leveling function testing method according to claim 1, characterized in that: The wear leveling function test request also includes a test request for static balancing when interacting with other scenarios; The query interface includes a solid state drive firmware configuration information query interface, a valid block query interface with a minimum timestamp, a block information query interface, and a next block to be erased after writing data. The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state drive supports static balancing, write third test data to the solid-state drive according to the test request for static balancing when interacting with other scenarios, and call the solid-state drive firmware configuration information query interface to obtain the initial average PE and static balancing threshold output by the solid-state drive firmware configuration information query interface; Using the identifiers of all blocks and the third preset value as interface input to call the erasure count setting interface; Calling the valid block query interface of the minimum timestamp according to the received third garbage collection completion information, obtaining the identifier of the valid block of the first minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface with the identifier of the valid block of the first minimum timestamp as an interface input, and obtaining the first state of the valid block of the first minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a sixth preset value according to the initial average PE, and use the identifier of the valid block of the first minimum timestamp and the sixth preset value as interface input to call the erasure count setting interface; Determine a seventh preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the seventh preset value as interface input to call the erasure count setting interface; Continue writing the second test data to the solid state drive; Erasing the next block to be erased after the written data to trigger static balancing and simultaneously performing a hard reset operation on the solid state drive; Calling the valid block query interface of the minimum timestamp according to the received second garbage collection completion information and inspection completion information, and obtaining the identifier of the valid block of the second minimum timestamp output by the valid block query interface of the minimum timestamp; The block information query interface is called by taking the identifier of the valid block with the first minimum timestamp as an interface input, and a second state of the valid block with the first minimum timestamp output by the block information query interface is obtained; Whether the identifier of the valid block of the first minimum timestamp has changed is determined according to the identifier of the valid block of the second minimum timestamp, and whether the second state of the valid block of the first minimum timestamp has changed to invalid is determined according to the first state of the valid block of the first minimum timestamp. If both are true, it is determined that the test result of static balance when interacting with other scenarios is passed; otherwise, it is determined that the test result of static balance when interacting with other scenarios is failed.
10. A wear leveling function testing method according to claim 1, characterized in that: The wear leveling function test request also includes a test request for a write exception that occurs when a target block is statically leveled; The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, a block information query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state hard disk supports static balancing, fourth test data is written to the solid-state hard disk according to the test request of the write exception occurring during the static balancing target block, and the solid-state hard disk health status query interface is called to obtain the first write exception count output by the solid-state hard disk health status query interface; Calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface using the identifiers of all blocks and the eighth preset value as interface input; calling the valid block query interface of the minimum timestamp according to the received fourth garbage collection completion information, obtaining the identifier of the valid block of the third minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface by taking the identifier of the valid block of the third minimum timestamp as an interface input, and obtaining the first state of the valid block of the third minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a ninth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the ninth preset value as interface inputs to call the erasure count setting interface; Determine a tenth preset value according to the initial average PE, and use the identifier of the valid block of the third minimum timestamp and the tenth preset value as interface input to call the erasure count setting interface; Using the physical address of the next block to be erased after the data is written as an interface input to call the write exception injection interface; Continue writing the fourth test data to the solid state drive; Erasing the next block to be erased after the write data to trigger static balancing; calling the valid block query interface of the minimum timestamp according to the received fifth garbage collection completion information, and obtaining the identifier of the valid block of the fourth minimum timestamp output by the valid block query interface of the minimum timestamp; The block information query interface is called by taking the identifier of the valid block with the third minimum timestamp as an interface input, and a second state of the valid block with the third minimum timestamp output by the block information query interface is acquired; Calling the solid state hard disk health status query interface to obtain the second write exception count output by the solid state hard disk health status query interface; According to the identifier of the valid block of the third minimum timestamp, determine whether the identifier of the valid block of the fourth minimum timestamp has changed, and according to the first state of the valid block of the third minimum timestamp, determine whether the second state of the valid block of the third minimum timestamp has changed to invalid. If not, it is determined that the test result of the write exception occurring in the static balancing target block is failed. If both are yes, it is determined whether the second write exception count is greater than the first write exception count. If it is greater, it is determined that the test result of the write exception occurring in the static balancing target block is passed. If not, it is determined that the test result of the write exception occurring in the static balancing target block is failed.
11. A wear leveling function testing method according to claim 1, characterized in that: The wear leveling function test request also includes a test request for a read exception that occurs when statically balancing a source block; The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, a block information query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state hard disk supports static balancing, fifth test data is written to the solid-state hard disk according to the test request of the read exception occurring during the static balancing source block, and the solid-state hard disk health status query interface is called to obtain the first read exception count output by the solid-state hard disk health status query interface; Calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface using the identifiers of all blocks and the eleventh preset value as interface input; calling the valid block query interface of the minimum timestamp according to the received sixth garbage collection completion information, obtaining the identifier of the valid block of the fifth minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface by taking the identifier of the valid block of the fifth minimum timestamp as an interface input, and obtaining the status of the valid block of the fifth minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a twelfth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the twelfth preset value as interface input to call the erasure count setting interface; Determine a thirteenth preset value according to the initial average PE, and use the identifier of the valid block of the fifth minimum timestamp and the thirteenth preset value as interface input to call the erasure count setting interface; Using the physical address of the next block to be erased after the data is written as an interface input to call the read exception injection interface; Continue writing the fifth test data to the solid state drive; Erasing the next block to be erased after the write data to trigger static balancing; Calling the solid state hard disk health status query interface according to the received seventh garbage collection completion information to obtain a second read exception count output by the solid state hard disk health status query interface; Determine whether the second read exception count is greater than the first read exception count. If so, determine that the test result of the read exception occurring during static balancing of the source block is passed; if not, determine that the test result of the read exception occurring during static balancing of the source block is failed.
12. A wear leveling function testing method according to claim 1, characterized in that: The wear leveling function test request also includes a test request for an erasure exception that occurs when a static leveling erase target block is erased; The query interface includes a SSD health status query interface, a SSD firmware configuration information query interface, a minimum timestamp valid block query interface, a block information query interface, and a next block to be erased after writing data query interface; The setting interface includes an erasure count setting interface; Also includes: If the query interface is used to query that the solid-state hard disk supports static balancing, then according to the test request of the erasure exception occurring when the static balancing erases the target block, the sixth test data is written to the solid-state hard disk, and the solid-state hard disk health status query interface is called to obtain the first erasure exception count output by the solid-state hard disk health status query interface; Calling the SSD firmware configuration information query interface, obtaining the initial average PE and static balance threshold output by the SSD firmware configuration information query interface, and calling the erasure count setting interface using the identifiers of all blocks and the fourteenth preset value as interface input; calling the valid block query interface of the minimum timestamp according to the received eighth garbage collection completion information, obtaining the identifier of the valid block of the sixth minimum timestamp output by the valid block query interface of the minimum timestamp, and calling the block information query interface by taking the identifier of the valid block of the sixth minimum timestamp as an interface input, and obtaining the status of the valid block of the sixth minimum timestamp output by the block information query interface; Calling the next block to be erased after writing the data query interface, and obtaining the identifier of the next block to be erased after writing the data output by the next block to be erased after writing the data query interface; Determine a fifteenth preset value according to the initial average PE and the static balancing threshold, and use the identifier of the next block to be erased after writing the data and the fifteenth preset value as interface inputs to call the erasure count setting interface; Determine a sixteenth preset value according to the initial average PE, and use the identifier of the valid block of the sixth minimum timestamp and the sixteenth preset value as interface input to call the erasure count setting interface; Using the physical address of the next block to be erased after the data is written as an interface input to call the erase exception injection interface; Continue writing the sixth test data to the solid state drive; Erasing the next block to be erased after the write data to trigger static balancing; Calling the solid state hard disk health status query interface according to the received ninth garbage collection completion information to obtain a second erasure exception count output by the solid state hard disk health status query interface; Determine whether the second erase exception count is greater than the first erase exception count. If so, determine that the test result of the erase exception occurring when the target block is statically and evenly erased is passed; if not, determine that the test result of the erase exception occurring when the target block is statically and evenly erased is failed.
13. A wear leveling function testing device, characterized in that: include: A test request receiving module, used to receive a wear leveling function test request of the solid state drive, wherein the wear leveling function test request includes a dynamic leveling test request and a static leveling test request; A dynamic balancing test module, configured to write first test data to the solid-state hard disk according to the dynamic balancing test request if the query interface is used to query that the solid-state hard disk supports dynamic balancing, and query the number of erase times of a currently open block using the query interface; Using a setting interface to set the erasure count of all invalid blocks to a first preset value, and using the setting interface to set the erasure count of a preset number of invalid blocks to a second preset value, the second preset value being smaller than the first preset value; Randomly write the first test data into the solid state drive, and use the query interface to query the minimum number of erasure times of invalid blocks; Obtaining an initial dynamic balance test result based on the minimum value of the number of erasures of the current open block and the number of erasures of the invalid block, and returning to execute the step of using the query interface to query the number of erasures of the current open block until the number of executions reaches a preset number, and obtaining a final dynamic balance test result based on a plurality of the initial dynamic balance test results; The static balancing test module is used to perform a static balancing test on the solid-state hard disk using a setting interface and a query interface according to the static balancing test request if the query interface is used to query that the solid-state hard disk supports static balancing to obtain a static balancing test result.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step in a wear leveling function testing method as claimed in any one of claims 1 to 12 is implemented.
15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step in the wear leveling function testing method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Solid hard disk and equilibrium method of the same
CN101441599A
Static wear leveling method, system and equipment and storage medium
CN114415962A
Automatic testing method and system for solid state disk aging test
CN118398069A
Apparatus including memory system controllers and related methods
WO2012166522A2
Cited By
Test method and device of storage controller, electronic equipment and storage medium
CN120472974A
PCIe SSD automatic balancing method
CN120508465A