Method and apparatus for testing raid function, readable storage medium and electronic device
By querying and injecting errors through the RAID error correction capability test interface, the accuracy and efficiency issues of RAID function testing are resolved, enabling efficient testing of RAID functions and applicable to solid-state drives with different RAID modes.
Patent Information
- Application Number
- CN202510082269.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-01-20
AI Technical Summary
Existing RAID function testing methods are difficult to achieve accurate and efficient testing, especially in terms of how to improve the test coverage of RAID functions during firmware development.
The RAID error correction capability test interface is used to query the physical address of the target logical address on the flash memory and the location of the error correction area, inject non-parity read errors, and determine the test results based on the status of the data unit. The first interface is used to accurately query information, and the second interface is used to accurately inject errors, thereby realizing the test of RAID error correction capability.
It improves the accuracy and efficiency of RAID function testing, can shield the differences between different firmware schemes to ensure test results, and can be inherited and reused, making it suitable for different RAID modes.
Smart Images

Figure CN119964627B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of solid-state drives, and more particularly to a RAID function testing method, apparatus, readable storage medium, and electronic device. Background Technology
[0002] RAID (Redundant Array of Independent Disks) serves as the last line of defense for data error correction in SSDs (Solid State Disks or Solid State Drives) when read errors occur on NAND flash memory. This is especially crucial after read retry and LDPC (Low Density Parity Check Code) error correction have both failed. Therefore, improving the test coverage of RAID functionality during firmware development is a critical issue that needs to be addressed.
[0003] Since the business processes involved in RAID functionality are mainly within the firmware's FTL (Flash Translation Layer), conventional black-box testing methods are difficult to use for accurate and effective testing. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a RAID function testing method, apparatus, readable storage medium and electronic device that can improve the accuracy and efficiency of testing.
[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0006] A method for testing RAID functionality, comprising the following steps:
[0007] If the received test request for the solid-state drive includes a basic test request for RAID error correction capability, then test data of a first preset size is sequentially written to the solid-state drive, and a target logical address is selected from the logical address of the solid-state drive where the test data has been written.
[0008] Use the first interface in the RAID error correction capability test interface to query the physical address of the target logical address on the flash memory, as well as the location and range of the error correction region of the RAID stripe where the physical address is located;
[0009] Based on the location of the error correction area, the first interface in the RAID error correction capability test interface is used to query the first state of all data units in the error correction area, and based on the range information of the error correction area, the second interface in the RAID error correction capability test interface is used to inject a non-verification read error into at least one data unit in the error correction area.
[0010] Data is read from the solid-state drive, and the second state of all data units in the RAID error correction capability test interface is queried according to the location of the error correction area using the first interface of the error correction area test interface;
[0011] Based on the sequentially written test data, the read data, the first state, and the second state, a first test result corresponding to the basic test request is obtained.
[0012] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:
[0013] A RAID function testing device, comprising:
[0014] The data writing module is used to sequentially write test data of a first preset size to the solid-state drive if the received test request for the solid-state drive includes a basic test request for RAID error correction capability, and to select a target logical address from the logical address of the solid-state drive where the test data has been written.
[0015] The data query module is used to query the physical address of the target logical address on the flash memory and the location and range of the error correction area of the RAID stripe where the physical address is located using the first interface in the RAID error correction capability test interface.
[0016] The error injection module is used to query the first state of all data units in the error correction area using the first interface in the RAID error correction capability test interface according to the location of the error correction area, and to inject a non-verification read error into at least one data unit in the error correction area using the second interface in the RAID error correction capability test interface according to the range information of the error correction area.
[0017] The data reading module is used to read data from the solid-state drive and query the second state of all data units in the RAID error correction capability test interface according to the location of the error correction area;
[0018] The test result determination module is used to obtain a first test result corresponding to the basic test request based on the test data written in sequence, the data read, the first state, and the second state.
[0019] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:
[0020] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the various steps in the above-described RAID function testing method.
[0021] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows:
[0022] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the various steps in the RAID function testing method described above.
[0023] The beneficial effects of this invention are as follows: If the received test request includes a basic test request for RAID error correction capability, test data is sequentially written to the solid-state drive (SSD), and a target logical address is selected from the logical address of the written test data. The first interface in the RAID error correction capability test interface is used to query the physical address of the target logical address on the flash memory, as well as the error correction region location and range information of the RAID stripe where the physical address is located. Based on the error correction region location, the first interface is used to query the first state of all data units in the error correction region. Based on the error correction region range information, the second interface is used to inject a non-correctable read error (UNC) into at least one data unit in the error correction region. Data is read from the SSD, and based on the error correction region location, the first interface is used to query the second state of all data units in the error correction region. Based on the sequentially written test data, the read data, the first state, and the second state, a first test result is obtained. The RAID error correction capability test can be achieved through the RAID error correction capability test interface. Furthermore, the first interface can accurately and quickly query the information required during the RAID function test, and the second interface can accurately inject UNC (Uncorrectable Read Error). Error (non-checked read error) is more targeted than existing black-box testing methods, ensuring test results. It also utilizes RAID error correction capabilities to test the interface to distinguish the functions of different interfaces, shielding the differences between different firmware schemes. It can be inherited and reused, improving test efficiency, thereby improving the accuracy and efficiency of testing. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the steps of a RAID function testing method according to an embodiment of the present invention;
[0025] Figure 2 This is a schematic diagram of the structure of a RAID function testing device according to an embodiment of the present invention;
[0026] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0027] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0028] Please refer to Figure 1 A RAID functionality testing method, comprising the following steps:
[0029] If the received test request for the solid-state drive includes a basic test request for RAID error correction capability, then test data of a first preset size is sequentially written to the solid-state drive, and a target logical address is selected from the logical address of the solid-state drive where the test data has been written.
[0030] Use the first interface in the RAID error correction capability test interface to query the physical address of the target logical address on the flash memory, as well as the location and range of the error correction region of the RAID stripe where the physical address is located;
[0031] Based on the location of the error correction area, the first interface in the RAID error correction capability test interface is used to query the first state of all data units in the error correction area, and based on the range information of the error correction area, the second interface in the RAID error correction capability test interface is used to inject a non-verification read error into at least one data unit in the error correction area.
[0032] Data is read from the solid-state drive, and the second state of all data units in the RAID error correction capability test interface is queried according to the location of the error correction area using the first interface of the error correction area test interface;
[0033] Based on the sequentially written test data, the read data, the first state, and the second state, a first test result corresponding to the basic test request is obtained.
[0034] As can be seen from the above description, the beneficial effects of the present invention are as follows: If the received test request includes a basic test request for RAID error correction capability, test data is sequentially written to the solid-state drive, and a target logical address is selected from the logical address of the written test data. The first interface in the RAID error correction capability test interface is used to query the physical address of the target logical address on the flash memory and the error correction region location and error correction region range information of the RAID stripe where the physical address is located. Based on the error correction region location, the first interface is used to query the first state of all data units in the error correction region, and based on the error correction region range information, the second interface is used to inject a non-checked read error into at least one data unit in the error correction region. Data is read from the solid-state drive, and based on the error correction region location, the first interface is used to query the second state of all data units in the error correction region. Based on the sequentially written test data, the read data, the first state, and the second state, a first test result is obtained. The RAID error correction capability test can be realized through the RAID error correction capability test interface. Furthermore, the first interface can accurately and quickly query the information required during the RAID function test, and the second interface can accurately inject UNC (Uncorrectable Non-Checked Read Error). ReadError (non-checked read error) is more targeted than existing black-box testing methods, ensuring test results. It also utilizes RAID error correction capabilities to test the functionality of different interfaces, shielding the differences between different firmware schemes. It can be inherited and reused, improving testing efficiency and thus enhancing the accuracy and efficiency of testing.
[0035] Furthermore, it also includes:
[0036] The first and second interfaces are encapsulated to obtain the RAID error correction capability test interface.
[0037] As described above, by encapsulating the first and second interfaces, an upper-layer RAID error correction capability test interface is obtained, which can be directly called to improve testing efficiency and has good versatility, and can be compatible with a variety of different RAID modes.
[0038] Furthermore, the first interface includes a physical address query interface and a RAID stripe information query interface;
[0039] The querying of the physical address of the target logical address on the flash memory, as well as the location and range of the error correction region of the RAID stripe containing the physical address, using the first interface in the RAID error correction capability test interface includes:
[0040] The target logical address is used as the interface input to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the target logical address on the flash memory is obtained from the output of the physical address query interface.
[0041] The physical address is used as the interface input to call the RAID stripe information query interface in the RAID error correction capability test interface, and the error correction region location and error correction region range information of the RAID stripe where the physical address is located are obtained from the output of the RAID stripe information query interface.
[0042] As described above, the first interface includes a physical address query interface and a RAID stripe information query interface. By calling the physical address query interface in the RAID error correction capability test interface, the corresponding physical address can be directly obtained, saving testers calculation time. Then, by calling the RAID stripe information query interface in the RAID error correction capability test interface, the location and range of the error correction area of the RAID stripe where the physical address is located can be obtained, which can efficiently and accurately obtain the information required for RAID error correction capability testing.
[0043] Furthermore, the first interface includes a block information query interface;
[0044] The step of querying the first state of all data units in the RAID error correction capability test interface according to the location of the error correction region includes:
[0045] Determine the block identifier of all data units in the error correction region based on the location of the error correction region;
[0046] Use the block identifier as the interface input to call the block information query interface in the RAID error correction capability test interface, and obtain the block information output by the block information query interface;
[0047] The first state of all data units in the error correction region is obtained based on the block information.
[0048] As described above, the first state of all data units in the error correction region can be obtained through the block information query interface. Using the first state of all data units in the error correction region as one of the conditions for judging whether the RAID error correction capability test has passed is more convenient and reliable.
[0049] Furthermore, the first interface includes a physical address query interface;
[0050] The second interface includes a non-verified read error injection interface;
[0051] The step of injecting a non-parity read error into at least one data unit in the error correction region using the second interface in the RAID error correction capability test interface based on the error correction region range information includes:
[0052] Select any data unit from the error correction region based on the error correction region range information;
[0053] The logical address of the data unit is used as input to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the logical address on the flash memory is obtained from the output of the physical address query interface.
[0054] The physical address is used as the interface input to call the non-parity read error injection interface in the RAID error correction capability test interface to inject a non-parity read error into the data unit.
[0055] As described above, the logical address of the data unit is used as input to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the logical address output by the physical address query interface on the flash memory is obtained. The physical address is then used as input to call the non-parity read error injection interface in the RAID error correction capability test interface to inject a non-parity read error into the data unit. This tests whether the RAID can successfully correct an error when a UNC appears within the RAID error correction capability range, making the test more targeted. Furthermore, the accurate injection of UNCs is achieved through the physical address query interface and the non-parity read error injection interface, improving the accuracy and effectiveness of the test.
[0056] Further, obtaining the first test result corresponding to the basic test request based on the sequentially written test data, the read data, the first state, and the second state includes:
[0057] Determine whether the read data is consistent with the sequentially written test data. If they are inconsistent, the first test result corresponding to the basic test request is determined to be failed. If they are consistent, determine whether the second state is bad and the first state is good. If both are true, the first test result corresponding to the basic test request is determined to be passed. Otherwise, the first test result corresponding to the basic test request is determined to be failed.
[0058] As described above, if the read data is consistent with the sequentially written test data, it indicates that the RAID error correction function is normal. The RAID error correction algorithm has calculated the erroneous data and returned it to the host. If the second state is bad and the first state is good, it means that the physical address with UNC is damaged. The subsequent bad block management process of the firmware will handle this erroneous address. At this time, it can be determined that the first test result is passed and the RAID error correction capability is normal.
[0059] Furthermore, the first interface includes a physical address query interface;
[0060] The second interface includes a non-verified read error injection interface;
[0061] The step of injecting a non-parity read error into at least one data unit in the error correction region using the second interface in the RAID error correction capability test interface based on the error correction region range information includes:
[0062] Based on the error correction region range information, select any two data units from the error correction region;
[0063] The logical addresses of the two data units are respectively used as inputs to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the logical address on the flash memory is obtained from the output of the physical address query interface.
[0064] The two physical addresses are used as interface inputs to call the non-parity read error injection interface in the RAID error correction capability test interface to inject non-parity read errors into the two data units.
[0065] As described above, based on the error correction area range information, any two data units are selected from the error correction area. The logical addresses of the two data units are used as inputs to call the physical address query interface in the RAID error correction capability test interface. The physical address of the logical address output by the physical address query interface is obtained on the flash memory. The two physical addresses are used as interface inputs to call the non-parity read error injection interface in the RAID error correction capability test interface to inject non-parity read errors into the two data units. This tests whether the RAID error correction meets the design specifications when the number of UNCs appearing in the RAID stripe exceeds the RAID error correction capability range, thereby improving the comprehensiveness of RAID function testing.
[0066] Further, obtaining the first test result corresponding to the basic test request based on the sequentially written test data, the read data, the first state, and the second state includes:
[0067] Determine whether the read data is consistent with the sequentially written data. If they are consistent, the first test result corresponding to the basic test request is determined to be failed. If they are inconsistent, determine whether the second state is bad and the first state is good. If both are true, the first test result corresponding to the basic test request is determined to be passed. Otherwise, the first test result corresponding to the basic test request is determined to be failed.
[0068] As described above, when two UNCs occur, it exceeds the disk's error correction capability and should result in error correction failure. The read operation will encounter a UNC, indicating that the physical address of the error is corrupted. Therefore, when the read data is inconsistent with the sequentially written data, and the second state is bad while the first state is good, it means that the RAID error correction capability meets the design specifications, and only then is the test result considered to be passed.
[0069] Furthermore, it also includes:
[0070] If the received test request for the solid-state drive includes an advanced test request for risk block data migration and anomaly handling after successful RAID error correction, then the first interface is used to obtain the RAID configuration information of the solid-state drive and the first RAID error correction status according to the advanced test request.
[0071] Write test data of a second preset size sequentially to the solid-state drive;
[0072] Randomly select one block from the solid-state drives, and use the first interface to obtain the first physical address of the logical address on the flash memory based on the logical address of the block;
[0073] Based on the first physical address, a non-verification read error is injected into the block using the second interface;
[0074] Read the data in the solid-state drive sequentially;
[0075] Use the first interface to obtain the second RAID error correction status of the solid-state drive, and wait for the block to be garbage collected;
[0076] Use the first interface to obtain the second physical address of the logical address on the flash memory;
[0077] The second test result corresponding to the advanced test request is determined based on the first physical address, the second physical address, the first RAID error correction status, and the second RAID error correction status.
[0078] As described above, if the test request includes advanced test requests for risk block data migration and exception handling after successful RAID error correction, the first and second interfaces can be used to test whether the risk block data migration and exception handling process after successful RAID error correction is normal. The cooperation between the first and second interfaces can realize different test cases, improve test coverage, and ensure the reliability and comprehensiveness of RAID function testing.
[0079] Furthermore, the RAID error correction status includes the total number of RAID error correction attempts and the number of successful RAID error correction attempts;
[0080] The determination of the second test result corresponding to the advanced test request based on the first physical address, the second physical address, the first RAID error correction status, and the second RAID error correction status includes:
[0081] Based on the first RAID error correction situation, determine whether the total number of RAID error corrections and the number of successful RAID error corrections in the second RAID error correction situation have both increased. If not, determine that the second test result corresponding to the advanced test request is failed. If yes, determine whether the second physical address has changed based on the first physical address. If it has changed, determine that the second test result corresponding to the advanced test request is passed. If it has not changed, determine that the second test result corresponding to the advanced test request is failed.
[0082] As described above, when both the total number of RAID error corrections and the number of successful RAID error corrections increase in the second RAID error correction scenario, it indicates that RAID error correction has occurred and been successful. At the same time, if the second physical address changes, it indicates that the logical address of the error has a new mapping. At this point, it can be determined that the second test result is passed. The risk block data migration and anomaly handling process are fault-free after the current solid-state drive RAID error correction is successful, which improves the effectiveness of the test.
[0083] Please refer to Figure 2 Another embodiment of the present invention provides a RAID function testing device, comprising:
[0084] The data writing module is used to sequentially write test data of a first preset size to the solid-state drive if the received test request for the solid-state drive includes a basic test request for RAID error correction capability, and to select a target logical address from the logical address of the solid-state drive where the test data has been written.
[0085] The data query module is used to query the physical address of the target logical address on the flash memory and the location and range of the error correction area of the RAID stripe where the physical address is located using the first interface in the RAID error correction capability test interface.
[0086] The error injection module is used to query the first state of all data units in the error correction area using the first interface in the RAID error correction capability test interface according to the location of the error correction area, and to inject a non-verification read error into at least one data unit in the error correction area using the second interface in the RAID error correction capability test interface according to the range information of the error correction area.
[0087] The data reading module is used to read data from the solid-state drive and query the second state of all data units in the RAID error correction capability test interface according to the location of the error correction area;
[0088] The test result determination module is used to obtain a first test result corresponding to the basic test request based on the test data written in sequence, the data read, the first state, and the second state.
[0089] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the various steps in the above-described RAID function testing method.
[0090] Please refer to Figure 3 Another 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. When the processor executes the computer program, it implements each step in the above-described RAID function testing method.
[0091] The RAID function testing method, apparatus, readable storage medium, and electronic device described above are applicable to different types of SSDs, including SATA SSDs and NVMe SSDs. The following detailed embodiments illustrate these methods:
[0092] Please refer to Figure 1 Embodiment 1 of the present invention is as follows:
[0093] A method for testing RAID functionality, comprising the following steps:
[0094] S1. If the received test request for the solid-state drive includes a basic test request for RAID error correction capability, then sequentially write test data of a first preset size to the solid-state drive, and select a target logical address from the logical addresses of the solid-state drive where the test data has been written.
[0095] In one alternative implementation, the process further includes the following step before S1:
[0096] S0. After confirming that the SSD under test has been correctly recognized by the test host as a data disk and that the SSD has been updated to the specified test version, a full disk erase is performed on the SSD. Then, the SSD firmware configuration information query interface is called to obtain the RAID mode and RAID rate output by the SSD firmware configuration information query interface. This allows us to determine the RAID support and error correction capabilities of each area of the SSD (mainly the data block area and the table entry block area).
[0097] In one optional implementation, the test data of a first preset size being sequentially written to the solid-state drive includes:
[0098] Starting from LBA=0, test data of 5% of the disk capacity is sequentially written to the solid-state drive.
[0099] In one alternative implementation, it further includes:
[0100] If an I / O error occurs during sequential write, the first test result corresponding to the basic test request is determined to be a failure.
[0101] In one optional implementation, the first interface includes a solid-state drive firmware configuration information query interface, a physical address query interface, a RAID stripe information query interface, a block information query interface, and a RAID function operation status query interface; the second interface includes a non-parity read error injection interface. The first and second interfaces are low-level interfaces provided by the firmware.
[0102] The descriptions of each interface are as follows:
[0103] Solid State Drive Firmware Configuration Information Query Interface Description: No parameters are required to query the configuration information and firmware version information of the SSD firmware, including information such as the RAID mode and RAID rate mentioned in the implementation plan.
[0104] Physical Address Query Interface Description: Specify a logical address (LBA, Logic Block Address) to obtain the physical address of that logical address on the flash memory.
[0105] RAID Strip Information Query Interface Description: Specify a physical address (FAA / PBA) to view the information of that physical address in the RAID Strip, including the number of data units and parity units in the RAID Strip, and the position of the physical address in the RAID Strip.
[0106] Block information query interface description: Specify a Block ID (block identifier) to view detailed information about the Block, such as the block type, block status, and bad block status.
[0107] RAID Function Operation Status Query Interface Description: Enter the Block ID to view the current RAID function operation status of the disk. It is mainly used to check and output whether RAID error correction has been triggered, the total number of RAID error corrections, the number of successful RAID error corrections, the number of failed RAID error corrections, and the error correction results.
[0108] Unchecked Read Error Injection Interface Description: Specifies an FAA to inject a UNC error.
[0109] In one optional implementation, the first interface further includes a solid-state drive health status query interface.
[0110] Solid State Drive Health Status Query Interface Description: View the current health status of the SSD, mainly to obtain the SSD's operating status and error information, including firmware running new UNC count, ECC Fail count, Program Fail count, Erase Fail count, etc.
[0111] In one alternative implementation, it further includes:
[0112] The first and second interfaces are encapsulated to obtain the RAID error correction capability test interface.
[0113] S2. Use the first interface in the RAID error correction capability test interface to query the physical address of the target logical address on the flash memory, as well as the location and range of the error correction region of the RAID stripe where the physical address is located. Specifically, this includes S21-S22:
[0114] S21. Use the target logical address as the interface input to call the physical address query interface in the RAID error correction capability test interface, and obtain the physical address of the target logical address on the flash memory output by the physical address query interface.
[0115] S22. Using the physical address as the interface input, call the RAID stripe information query interface in the RAID error correction capability test interface, and obtain the error correction region location and error correction region range information of the RAID stripe where the physical address is located, as output by the RAID stripe information query interface.
[0116] S3. Based on the location of the error correction area, use the first interface in the RAID error correction capability test interface to query the first state of all data units in the error correction area, and based on the range information of the error correction area, use the second interface in the RAID error correction capability test interface to inject a non-verification read error into at least one data unit in the error correction area.
[0117] In one optional implementation, S3 specifically includes S31-S36:
[0118] S31. Determine the block identifier of all data units in the error correction region based on the location of the error correction region.
[0119] S32. Use the block identifier as the interface input to call the block information query interface in the RAID error correction capability test interface, and obtain the block information output by the block information query interface.
[0120] S33. Obtain the first state of all data units in the error correction region based on the block information.
[0121] In one alternative implementation, it further includes:
[0122] If the first state acquisition of all data units in the error correction region fails, and the first state is not all good, then the first test result corresponding to the basic test request is determined to be a failure.
[0123] S34. Select any data unit from the error correction region based on the error correction region range information.
[0124] S35. Using the logical address of the data unit as input, call the physical address query interface in the RAID error correction capability test interface, and obtain the physical address of the logical address on the flash memory output by the physical address query interface.
[0125] S36. Using the physical address as the interface input, call the non-parity read error injection interface in the RAID error correction capability test interface to inject a non-parity read error into the data unit.
[0126] In one alternative implementation, it further includes:
[0127] If injecting a non-verification read error into the data unit fails, the first test result corresponding to the basic test request is determined to be a failure.
[0128] In another alternative implementation, S3 specifically includes S31′-S33′:
[0129] S31': Select any two data units from the error correction region based on the error correction region range information.
[0130] S32': Using the logical addresses of the two data units as inputs, call the physical address query interface in the RAID error correction capability test interface, and obtain the physical address of the logical address on the flash memory output by the physical address query interface.
[0131] S33': Using the two physical addresses as interface inputs, call the non-parity read error injection interface in the RAID error correction capability test interface to inject non-parity read errors into the two data units.
[0132] In one alternative implementation, it further includes:
[0133] If injecting a non-verification read error into the two data units fails, the first test result corresponding to the basic test request is determined to be a failure.
[0134] S4. Read data from the solid-state drive, and use the first interface in the RAID error correction capability test interface to query the second state of all data units in the error correction area according to the location of the error correction area.
[0135] Specifically, data is read from the solid-state drive, and the block identifier of all data units in the error correction area is determined according to the location of the error correction area. The block identifier is used as the interface input to call the block information query interface in the RAID error correction capability test interface, and the block information output by the block information query interface is obtained. The second state of all data units in the error correction area is obtained according to the block information.
[0136] S5. Based on the sequentially written test data, the read data, the first state, and the second state, obtain the first test result corresponding to the basic test request.
[0137] In an optional implementation, if S3 specifically includes S31-S36, then S5 includes:
[0138] Determine whether the read data is consistent with the sequentially written test data. If they are inconsistent, the first test result corresponding to the basic test request is determined to be failed. If they are consistent, determine whether the second state is bad and the first state is good. If both are true, the first test result corresponding to the basic test request is determined to be passed. Otherwise, the first test result corresponding to the basic test request is determined to be failed.
[0139] This verifies that if the SSD's RAID function is normal, then when the number of UNCs appearing in the SSD's user data area within the RAID stripe is within the RAID error correction capability, the error can be corrected, the HOST read command will not report an error, and the HOST can read the correct data.
[0140] In another alternative implementation, if S3 specifically includes S31′-S33′, then S5 includes:
[0141] Determine whether the read data is consistent with the sequentially written data. If they are consistent, the first test result corresponding to the basic test request is determined to be failed. If they are inconsistent, determine whether the second state is bad and the first state is good. If both are true, the first test result corresponding to the basic test request is determined to be passed. Otherwise, the first test result corresponding to the basic test request is determined to be failed.
[0142] This verifies that if the SSD's RAID function is normal, when the number of UNCs appearing in the RAID stripe exceeds the RAID error correction capability, although RAID error correction fails and the HOST reads a Read Error, only the physical address of the error is damaged, the disk can still continue to be written to, and the newly written data can be read back correctly.
[0143] S6. If the received test request for the solid-state drive includes an advanced test request for risk block data migration and anomaly handling after successful RAID error correction, then the first interface is used to obtain the RAID configuration information of the solid-state drive and the first RAID error correction status according to the advanced test request.
[0144] In one optional implementation, the RAID error correction status includes the total number of RAID error correction attempts and the number of successful RAID error correction attempts.
[0145] Specifically, the system calls the solid-state drive firmware configuration information query interface according to the advanced test request, obtains the RAID configuration related information of the solid-state drive output by the solid-state drive firmware configuration information query interface, and calls the RAID function operation status query interface to obtain the first RAID error correction status output by the RAID function operation status query interface.
[0146] In one alternative implementation, it further includes:
[0147] If it is determined based on the RAID mode that the solid-state drive does not support RAID functionality, then the advanced tests of risk block data migration and anomaly handling after successful RAID error correction will not be performed.
[0148] S7. Write test data of a second preset size sequentially to the solid-state drive.
[0149] In one alternative implementation, the second preset size is 15G.
[0150] S8. Randomly select one block from the solid-state drives, and use the first interface to obtain the first physical address of the logical address on the flash memory according to the logical address of the block.
[0151] Specifically, a block is randomly selected from the solid-state drives, and the logical address of the block is used as the interface input to call the physical address query interface to obtain the first physical address on the flash memory of the logical address output by the physical address query interface.
[0152] S9. Inject a non-verification read error into the block using the second interface based on the first physical address.
[0153] Specifically, the first physical address is used as the interface input to call the unchecked read error injection interface to inject an unchecked read error into the block.
[0154] S10. Read the data in the solid-state drive sequentially.
[0155] In one alternative implementation, it further includes:
[0156] If an error occurs during sequential reading, the second test result corresponding to the advanced test request is determined to be a failure.
[0157] S11. Use the first interface to obtain the second RAID error correction status of the solid-state drive, and wait for the block to be garbage collected.
[0158] Specifically, the RAID function operation status query interface is called to obtain the second RAID error correction status output by the RAID function operation status query interface, and the block is waited for garbage collection.
[0159] S12. Use the first interface to obtain the second physical address of the logical address on the flash memory.
[0160] Specifically, the logical address of the block is used as the interface input to call the physical address query interface to obtain the second physical address of the logical address on the flash memory, which is output by the physical address query interface.
[0161] S13. Determine the second test result corresponding to the advanced test request based on the first physical address, the second physical address, the first RAID error correction status, and the second RAID error correction status.
[0162] Specifically, based on the first RAID error correction situation, it is determined whether the total number of RAID error corrections and the number of successful RAID error corrections in the second RAID error correction situation have both increased. If not, the second test result corresponding to the advanced test request is determined to be unsuccessful. If yes, it is determined whether the second physical address has changed based on the first physical address. If it has changed, the second test result corresponding to the advanced test request is determined to be successful. If it has not changed, the second test result corresponding to the advanced test request is determined to be unsuccessful.
[0163] In one alternative implementation, it further includes:
[0164] If the received test request for the solid-state drive includes interaction test requests for RAID function and other functional modules, then according to the interaction test requests for RAID function and other functional modules, while the test host triggers a non-verified read error, other operations are performed on the solid-state drive, such as TRIM (causing the operating system to notify the solid-state drive which data is invalid), Flush (forcing data in the cache to be written to the flash memory of the hard drive), Write, Read, firmware upgrade, issuing management commands, etc., to test whether the SSD firmware can process normally when the test host happens to have the above-mentioned business requests while UNC processing is being carried out inside the disk platter (data on physical blocks that have successfully corrected RAID errors is being moved by GC, or risky blocks are waiting to be moved in the GC queue, or data has been moved and bad block processing is underway, etc.), thus verifying the SSD firmware's ability to handle multiple concurrent tasks on the front end and back end.
[0165] By obtaining the RAID capabilities of the disk through the two types of underlying interfaces (the first interface and the second interface) provided by the SSD firmware, it is possible to adapt to different RAID design schemes while improving the reuse rate of test cases and the development efficiency of new test cases.
[0166] The format definition of the underlying interface described above varies depending on the type of SSD. For example, SATA and NVMe drives use different protocols, so the interface formats in SATA and NVMe drives are also different. The underlying interface format provided by the firmware of SATA drives is customized with reference to the ATA command protocol definition, while the underlying interface format provided by the firmware of NVMe drives is formulated with reference to the definition of the Vendor command format in the standard NVMe protocol.
[0167] Please refer to Figure 2 Embodiment two of the present invention is as follows:
[0168] A RAID function testing device, comprising:
[0169] The data writing module is used to sequentially write test data of a first preset size to the solid-state drive if the received test request for the solid-state drive includes a basic test request for RAID error correction capability, and to select a target logical address from the logical address of the solid-state drive where the test data has been written.
[0170] The data query module is used to query the physical address of the target logical address on the flash memory and the location and range of the error correction area of the RAID stripe where the physical address is located using the first interface in the RAID error correction capability test interface.
[0171] The error injection module is used to query the first state of all data units in the error correction area using the first interface in the RAID error correction capability test interface according to the location of the error correction area, and to inject a non-verification read error into at least one data unit in the error correction area using the second interface in the RAID error correction capability test interface according to the range information of the error correction area.
[0172] The data reading module is used to read data from the solid-state drive and query the second state of all data units in the RAID error correction capability test interface according to the location of the error correction area;
[0173] The test result determination module is used to obtain a first test result corresponding to the basic test request based on the test data written in sequence, the data read, the first state, and the second state.
[0174] Embodiment 3 of the present invention is as follows:
[0175] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the various steps of the RAID function testing method in Embodiment 1.
[0176] Embodiment four of the present invention is as follows:
[0177] Please refer to Figure 3 An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the RAID function testing method in Embodiment 1.
[0178] In summary, this invention provides a RAID function testing method, apparatus, readable storage medium, and electronic device. If the received test request includes a basic test request for RAID error correction capability, test data is sequentially written to the solid-state drive (SSD), and a target logical address is selected from the logical addresses of the written test data. The first interface in the RAID error correction capability test interface is used to query the physical address of the target logical address on the flash memory, as well as the error correction region location and error correction region range information of the RAID stripe where the physical address is located. Based on the error correction region location, the first interface is used to query the first state of all data units in the error correction region. Based on the error correction region range information, the second interface is used to inject a non-checked read error into at least one data unit in the error correction region. Data is read from the SSD, and based on the error correction region location, the first interface is used to query the second state of all data units in the error correction region. A first test result is obtained based on the sequentially written test data, the read data, the first state, and the second state. By constructing specific RAID error correction scenarios through test interfaces, the first interface allows for precise and rapid querying of information required during RAID function testing, while the second interface enables accurate injection of UNCs. This effectively covers various business logics of SSD firmware RAID error correction, verifying whether the business logic processing and results are consistent with the firmware design. This testing method is more targeted than existing black-box testing methods, ensuring test effectiveness. Furthermore, by encapsulating the test interface in two layers—the upper layer implements the required functions, and the lower layer adapts to the differences in opcode, command ID, and other parameters for different SSD forms (SATA / NVME) and projects—it can shield the differences between different firmware schemes at the test case level. Test cases for the aforementioned RAID business processes can be inherited and reused, improving testing efficiency. In addition, if the test request includes advanced test requests for risk block data migration and anomaly handling after successful RAID error correction, the first and second interfaces are used to test whether the risk block data migration and anomaly handling processes are normal. The cooperation of the first and second interfaces can realize different test cases, improving test coverage and ensuring the reliability and comprehensiveness of RAID function testing.
[0179] In the embodiments provided in this application, it should be understood that the disclosed methods, apparatuses, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple components or modules may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices, components, or modules may be electrical, mechanical, or other forms.
[0180] The components described as separate parts may or may not be physically separate. The components shown as components may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the components can be selected to achieve the purpose of this embodiment according to actual needs.
[0181] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each component can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0182] If the integrated module is implemented as a software functional 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. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0183] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0184] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0185] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for testing RAID functionality, characterized in that, Including the following steps: If the received test request for the solid-state drive includes a basic test request for RAID error correction capability, then test data of a first preset size is sequentially written to the solid-state drive, and a target logical address is selected from the logical address of the solid-state drive where the test data has been written. Use the first interface in the RAID error correction capability test interface to query the physical address of the target logical address on the flash memory, as well as the location and range of the error correction region of the RAID stripe where the physical address is located; Based on the location of the error correction area, the first interface in the RAID error correction capability test interface is used to query the first state of all data units in the error correction area, and based on the range information of the error correction area, the second interface in the RAID error correction capability test interface is used to inject a non-verification read error into at least one data unit in the error correction area. Data is read from the solid-state drive, and the second state of all data units in the RAID error correction capability test interface is queried according to the location of the error correction area using the first interface of the error correction area test interface; Based on the sequentially written test data, the read data, the first state, and the second state, a first test result corresponding to the basic test request is obtained; If the received test request for the solid-state drive includes an advanced test request for risk block data migration and anomaly handling after successful RAID error correction, then the first interface is used to obtain the RAID configuration information of the solid-state drive and the first RAID error correction status according to the advanced test request. Write test data of a second preset size sequentially to the solid-state drive; Randomly select one block from the solid-state drives, and use the first interface to obtain the first physical address of the logical address on the flash memory based on the logical address of the block; Based on the first physical address, a non-verification read error is injected into the block using the second interface; Read the data in the solid-state drive sequentially; Use the first interface to obtain the second RAID error correction status of the solid-state drive, and wait for the block to be garbage collected; Use the first interface to obtain the second physical address of the logical address on the flash memory; The second test result corresponding to the advanced test request is determined based on the first physical address, the second physical address, the first RAID error correction status, and the second RAID error correction status.
2. The RAID function testing method according to claim 1, characterized in that, Also includes: The first and second interfaces are encapsulated to obtain the RAID error correction capability test interface.
3. The RAID function testing method according to claim 1, characterized in that, The first interface includes a physical address query interface and a RAID stripe information query interface; The querying of the physical address of the target logical address on the flash memory, as well as the location and range of the error correction region of the RAID stripe containing the physical address, using the first interface in the RAID error correction capability test interface includes: The target logical address is used as the interface input to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the target logical address on the flash memory is obtained from the output of the physical address query interface. The physical address is used as the interface input to call the RAID stripe information query interface in the RAID error correction capability test interface, and the error correction region location and error correction region range information of the RAID stripe where the physical address is located are obtained from the output of the RAID stripe information query interface.
4. The RAID function testing method according to claim 1, characterized in that, The first interface includes a block information query interface; The step of querying the first state of all data units in the RAID error correction capability test interface according to the location of the error correction region includes: Determine the block identifier of all data units in the error correction region based on the location of the error correction region; Use the block identifier as the interface input to call the block information query interface in the RAID error correction capability test interface, and obtain the block information output by the block information query interface; The first state of all data units in the error correction region is obtained based on the block information.
5. The RAID function testing method according to claim 1, characterized in that, The first interface includes a physical address lookup interface; The second interface includes a non-verified read error injection interface; The step of injecting a non-parity read error into at least one data unit in the error correction region using the second interface in the RAID error correction capability test interface based on the error correction region range information includes: Select any data unit from the error correction region based on the error correction region range information; The logical address of the data unit is used as input to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the logical address on the flash memory is obtained from the output of the physical address query interface. The physical address is used as the interface input to call the non-parity read error injection interface in the RAID error correction capability test interface to inject a non-parity read error into the data unit.
6. A RAID function testing method according to claim 5, characterized in that, The process of obtaining the first test result corresponding to the basic test request based on the sequentially written test data, the read data, the first state, and the second state includes: Determine whether the read data is consistent with the sequentially written test data. If they are inconsistent, the first test result corresponding to the basic test request is determined to be failed. If they are consistent, determine whether the second state is bad and the first state is good. If both are true, the first test result corresponding to the basic test request is determined to be passed. Otherwise, the first test result corresponding to the basic test request is determined to be failed.
7. The RAID function testing method according to claim 1, characterized in that, The first interface includes a physical address lookup interface; The second interface includes a non-verified read error injection interface; The step of injecting a non-parity read error into at least one data unit in the error correction region using the second interface in the RAID error correction capability test interface based on the error correction region range information includes: Based on the error correction region range information, select any two data units from the error correction region; The logical addresses of the two data units are respectively used as inputs to call the physical address query interface in the RAID error correction capability test interface, and the physical address of the logical address on the flash memory is obtained from the output of the physical address query interface. The two physical addresses are used as interface inputs to call the non-parity read error injection interface in the RAID error correction capability test interface to inject non-parity read errors into the two data units.
8. A RAID function testing method according to claim 7, characterized in that, The process of obtaining the first test result corresponding to the basic test request based on the sequentially written test data, the read data, the first state, and the second state includes: Determine whether the read data is consistent with the sequentially written data. If they are consistent, the first test result corresponding to the basic test request is determined to be failed. If they are inconsistent, determine whether the second state is bad and the first state is good. If both are true, the first test result corresponding to the basic test request is determined to be passed. Otherwise, the first test result corresponding to the basic test request is determined to be failed.
9. A RAID function testing method according to claim 1, characterized in that, The RAID error correction information includes the total number of RAID error correction attempts and the number of successful RAID error corrections. The determination of the second test result corresponding to the advanced test request based on the first physical address, the second physical address, the first RAID error correction status, and the second RAID error correction status includes: Based on the first RAID error correction situation, determine whether the total number of RAID error corrections and the number of successful RAID error corrections in the second RAID error correction situation have both increased. If not, determine that the second test result corresponding to the advanced test request is failed. If yes, determine whether the second physical address has changed based on the first physical address. If it has changed, determine that the second test result corresponding to the advanced test request is passed. If it has not changed, determine that the second test result corresponding to the advanced test request is failed.
10. A RAID function testing device, characterized in that, include: The data writing module is used to sequentially write test data of a first preset size to the solid-state drive if the received test request for the solid-state drive includes a basic test request for RAID error correction capability, and to select a target logical address from the logical address of the solid-state drive where the test data has been written. The data query module is used to query the physical address of the target logical address on the flash memory and the location and range of the error correction area of the RAID stripe where the physical address is located using the first interface in the RAID error correction capability test interface. The error injection module is used to query the first state of all data units in the error correction area using the first interface in the RAID error correction capability test interface according to the location of the error correction area, and to inject a non-verification read error into at least one data unit in the error correction area using the second interface in the RAID error correction capability test interface according to the range information of the error correction area. The data reading module is used to read data from the solid-state drive and query the second state of all data units in the RAID error correction capability test interface according to the location of the error correction area; The test result determination module is used to obtain a first test result corresponding to the basic test request based on the test data written in sequence, the data read, the first state, and the second state. If the received test request for the solid-state drive includes an advanced test request for risk block data migration and anomaly handling after successful RAID error correction, then the first interface is used to obtain the RAID configuration information of the solid-state drive and the first RAID error correction status according to the advanced test request. Write test data of a second preset size sequentially to the solid-state drive; Randomly select one block from the solid-state drives, and use the first interface to obtain the first physical address of the logical address on the flash memory based on the logical address of the block; Based on the first physical address, a non-verification read error is injected into the block using the second interface; Read the data in the solid-state drive sequentially; Use the first interface to obtain the second RAID error correction status of the solid-state drive, and wait for the block to be garbage collected; Use the first interface to obtain the second physical address of the logical address on the flash memory; The second test result corresponding to the advanced test request is determined based on the first physical address, the second physical address, the first RAID error correction status, and the second RAID error correction status.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the RAID function testing method as described in any one of claims 1 to 9.
12. 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, it implements each step of the RAID function testing method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Error correction capability test method and device, readable storage medium and electronic equipment
CN113778822A
Method and apparatus for testing raid systems
US5574855A