Storage test unit and test method thereof, and electronic equipment

By writing and overwriting data in the storage device, and reading the data for verification after simulating a power outage, the problem of data integrity testing of the storage device under power outage is solved, and efficient and accurate data integrity assessment is achieved. .

CN118409921BActive Publication Date: 2024-09-27合肥康芯威存储技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410874319.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-27
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

It is difficult to guarantee data integrity when a storage device is powered off, which may result in the loss of operating system data or user files. Existing technologies fail to effectively test the storage chip's ability to maintain data integrity.

Method used

Provide a storage test unit and its test method. By writing the first and second types of data, simulating a power failure or hard reset during the writing of the second type of data, reading the data after re-powering, and judging the storage Whether the device can completely retain the data written before power failure, the data integrity of the storage device can be tested by overwriting the second type of data with the first type of data and performing a full readout verification.

Benefits of technology

It realizes the data integrity test of storage devices under abnormal power outage conditions, improves test accuracy and efficiency, and can eliminate test errors caused by hardware problems such as bad blocks to ensure the accuracy of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118409921B
    Figure CN118409921B
Patent Text Reader

Abstract

The present invention provides a storage test unit and a test method thereof, and an electronic device, wherein the test method of the storage test unit includes the following steps: writing first-class data to a storage device and filling the storage device; writing second-class data to the storage device, and the second-class data covers the first-class data, and the storage device is powered off or hard reset during the writing of the second-class data; and reading the storage data of the storage device after powering on again, when the second-class data written before power failure is retained in the storage data, and the retained second-class data is covered by the first-class data, when the storage data is read out and verified, the storage data is all the first-class data, then the test of the storage device passes. The present invention provides a storage test unit and a test method thereof, and an electronic device, which can test the ability of the storage device to maintain data integrity and the test accuracy is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of storage testing, and in particular to a storage testing unit and a testing method thereof, and electronic equipment. Background Art

[0002] The most basic requirement for storage devices is to ensure the correctness of stored data. In the field of storage, non-volatile memory (NVM) can ensure that the data stored in it will not be lost when it is static, but if the storage chip loses power while data is being written to the storage chip, the stored data is likely to be lost. In the event of a power outage, the data integrity of the storage device is difficult to ensure, which may cause the loss of operating system data or user file data stored in the storage device. Therefore, the ability of the storage chip to maintain data integrity is unknown. Summary of the invention

[0003] The object of the present invention is to provide a storage test unit and a test method thereof, and an electronic device, which can test the ability of a storage device to maintain data integrity and have high test accuracy.

[0004] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:

[0005] The present invention provides a testing method for a storage test unit, comprising the following steps:

[0006] Writing the first type of data into the storage device and filling up the storage device;

[0007] Writing second-category data to the storage device, with the second-category data overwriting the first-category data, and powering off or hard resetting the storage device during the process of writing the second-category data; and

[0008] After power is restored, the storage data of the storage device is read. When the second category data written before power failure is retained in the storage data and the retained second category data is overwritten with the first category data, and the storage data are all the first category data during the full disk read-out verification, the test of the storage device passes.

[0009] In one embodiment of the present invention, the step of writing the second type of data to the storage device includes:

[0010] Setting a plurality of test segments, wherein the second type of data is stored in the test segments, wherein the plurality of test segments are numbered, wherein the test segments include at least one logic block, and in the test segments, the addresses of the plurality of logic blocks are continuously distributed, wherein the number and addresses of the logic blocks of the plurality of test segments are randomly set, and the addresses of the plurality of test segments do not overlap;

[0011] The test segments are written into the storage device in sequence according to the numbering order.

[0012] In one embodiment of the present invention, in the step of writing the test segment into the storage device, the test segment is randomly written into the storage device, and the second type of data overwrites the first type of data at the write position.

[0013] In one embodiment of the present invention, the step of powering off or hard resetting the storage device includes: starting from writing the second test segment, powering off or hard resetting the storage device during the writing process of any test segment.

[0014] In one embodiment of the present invention, the step of re-reading the storage data of the storage device includes acquiring a power-off segment, where the power-off segment is the test segment being written when a power-off or hard reset occurs.

[0015] In one embodiment of the present invention, the judgment condition for passing the test of the storage device includes: the second type of data is stored in the test segment written before the power-off segment, and the first type of data is stored in the test segment written after the power-off segment.

[0016] In one embodiment of the present invention, the judgment condition for passing the test of the storage device includes: in the power-off segment, allowing the first type of data to be stored in some logic blocks, wherein the logic blocks storing the first type of data are located at the end of the power-off segment.

[0017] In an embodiment of the present invention, the testing method includes preparing a plurality of the testing segments before writing the second type of data.

[0018] The present invention provides a storage test unit, comprising:

[0019] A test segment preparation module, used for preparing a plurality of test segments and recording the addresses and the number of data blocks of the test segments, wherein the addresses of the plurality of test segments do not overlap;

[0020] A first data writing module, used for writing first type of data into the storage device and filling up the storage device;

[0021] a second data writing module, which writes second-category data to the storage device according to the address of the test segment, wherein the second-category data covers the first-category data;

[0022] a power-off execution module, configured to power off or hard reset the storage device during the process of writing the second type of data; and

[0023] The verification and recovery module is used to read the storage data of the storage device after power is restored. When the second-category data written before power failure is retained in the storage data, and the retained second-category data is overwritten with the first-category data, when the storage data is fully read out for verification, the test of the storage device passes, and it is determined that the test of the storage device passes.

[0024] The present invention provides an electronic device, comprising a storage device, a processor, and a computer program stored in a storage medium and executable on the processor, wherein the processor implements a test method for a storage test unit as described in any one of the above items when executing the computer program.

[0025] As described above, the present invention provides a storage test unit and a test method thereof, and an electronic device, which can test whether the storage device still has a good ability to maintain data integrity in the case of abnormal power failure. And according to the technical solution provided by the present invention, it has the ability to enable the storage device to complete self-test, has high test efficiency, can also eliminate test errors caused by hardware problems such as bad blocks, and has high test accuracy.

[0026] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0028] Figure 1 It is a schematic diagram of the structure of a storage test unit in one embodiment of the present invention.

[0029] Figure 2 Schematic diagram of the functional structure of a controller in one embodiment of the present invention.

[0030] Figure 3 FIG. 1 is a schematic diagram of the functional structure of a processor in an embodiment of the present invention.

[0031] Figure 4 FIG. 4 is a flow chart of a method for testing a storage device according to an embodiment of the present invention.

[0032] Figure 5 Schematic diagram of writing the test segment and the first type of data in one embodiment of the present invention.

[0033] Figure 6 FIG. 1 is a power-off timing diagram during writing in a test segment according to an embodiment of the present invention.

[0034] Figure 7 The present invention is a block diagram of the structural principle of an electronic device in one embodiment of the present invention.

[0035] Figure 8 The present invention is a block diagram of the structural principle of a computer-readable storage medium in one embodiment of the present invention.

[0036] In the figure: 100, storage device; 110, controller; 111, power-off warning module; 112, data management module; 120, controller cache; 130, flash memory chip; 200, power management module; 300, storage test unit; 310, storage host; 320, power controller; 330, input and output interface; 400, processor; 411, test segment preparation module; 412, first data writing module; 413, second data writing module; 414, power-off execution module; 415, verification and recovery module; 500, computer instruction; 501, computer-readable storage medium; RST, reset port; DataChunk, test segment. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The test object of the storage test unit provided by the present invention is a storage device, and specifically a non-volatile storage device. The storage test unit of the present invention can be used to test the ability of the non-volatile storage device to maintain data integrity. In the present invention, the non-volatile storage device is a flash memory or a storage device including a flash memory, such as a SM flash card, a CF card, a Multi Media Card (MMC), a Secure Digital Card (SD card), a memory stick, and a micro hard disk, etc. Please refer to Figure 1As shown, the object to be tested is a storage device 100. In the present invention, the storage device 100 includes a controller 110 and a flash memory chip 130. The controller 110 includes a controller cache 120. The controller 110 is electrically connected to the storage test unit 300 to receive control commands and host data. The controller cache 120 is electrically connected to the controller 110 and the flash memory chip 130. When writing data to the storage device 100, the data is first written to the controller cache 120, and then transferred from the controller cache 120 to the flash memory chip 130. In this embodiment, the storage device 100 is electrically connected to the power management module 200, and the power management module 200 supplies power to the storage device 100. In the present invention, when power failure occurs, the storage data in the flash memory chip 130 will not be lost, but the data in the controller cache 120 will be lost.

[0039] See also Figure 1 As shown, in one embodiment of the present invention, the storage test unit 300 includes a storage host 310, a power controller 320 and an input / output interface 330. The storage host 310 is electrically connected to the controller 110 to send a clock signal, a control instruction and host data to the controller 110. The host data is not limited to user data or process file data, etc. The controller 110 can also feed back data of the control result to the storage host 310. The power controller 320 is electrically connected to the power management module 200 to control the power-off time and power-on time of the power management module 200. The power controller 320 is electrically connected to the power management module 200 through an integrated circuit bus (Inter-Integrated Circuit, I2C). In this embodiment, the input / output interface 330 is a general-purpose input / output bus (General-purpose input / output, GPIO). The input / output interface 330 is electrically connected to the reset terminal RST of the storage device 100, so as to input a reset control signal to the storage device 100 to control the reset process of the storage device 100. In an embodiment of the present invention, Table 1 shows a logical schematic diagram of the storage device 100. The logical block is the smallest read / write unit of the storage device 100, and in this embodiment, the logical block can be read / written sequentially or randomly.

[0040] See also Figure 2As shown, in one embodiment of the present invention, when writing data to the storage device 100, the data is first written into the controller cache 120, and then transferred to the flash memory chip 130. It should be noted that when writing data to the storage device 100, the address used is the logical address of the logical block. After being sorted by the controller 110 and its firmware, the address of the data when finally written to the flash memory chip 130 uses the physical address of the logical block. While writing data, an address mapping relationship is established between the logical address and the physical address of the written data, so that when the written data is retrieved, the physical address of the written data can be found according to the address mapping relationship. Among them, the address mapping relationship of the written data can be stored in the controller cache 120 in the form of a linked list, thereby forming an address mapping table for the written data. When power failure occurs, the address mapping table stored in the controller cache 120 will also be lost, resulting in the data corresponding to the lost part of the address mapping table becoming invalid data. It should be noted that valid data is data that can be found through the address mapping table.

[0041] See also Figure 2 As shown, in one embodiment of the present invention, the controller 110 includes a power-off warning module 111 and a data management module 112. The power-off warning module 111 is electrically connected to the storage host 310 and receives the power-off prompt instruction of the storage host 310. When the planned power-off action is about to occur, the storage host 310 sends a power-off prompt instruction to the controller 110 before the power-off time. The interval between the time of sending the power-off prompt instruction and the power-off time is the data backup time. When the power-off warning module 111 receives the power-off prompt instruction, the data management module 112 transfers the data in the controller cache 120 to the flash memory chip 130. It should be noted that, within the data backup time, transferring the data of the controller cache 120 at this time is the first priority work of the storage device 100, and the data transfer is completed at the fastest transmission speed of the device to avoid data loss. In this embodiment, after power failure and power on again, the data of the flash memory chip 130 is re-read to check whether the data is lost. When the data is lost, the data can be restored. The present invention does not limit the operation of data recovery on the storage device 100. In the present invention, when the power failure is unplanned, it is an abnormal power failure. In the abnormal power failure, the storage host 310 will not issue a power failure prompt command, or even if a power failure prompt command is issued, the data backup time is too short, all or part of the data in the controller cache 120 is lost, and part of the data in the flash memory chip 130 becomes invalid data. The lost data in the controller cache 120 includes the address mapping table and user data.

[0042] See also Figure 1 and Figure 3As shown, in one embodiment of the present invention, the storage host 310 includes a processor 400. The processor 400 includes a test segment preparation module 411, a first data writing module 412, a second data writing module 413, a power-off execution module 414 and a verification recovery module 415. The first data writing module 412 and the second data writing module 413 are used to write data to the storage device 100. The test segment preparation module 411 is used to select a logic block from the storage device 100 to form a plurality of test segments. The address selection of the plurality of test segments is random, and the addresses of the plurality of test segments do not overlap with each other. In this embodiment, the test segment includes a plurality of logic blocks. In the same test segment, the addresses of the plurality of logic blocks are continuously distributed. The first data writing module 412 writes the first type of data to the storage device 100 until the storage device 100 is filled. If the second type of data is stored in the address to be written, when the first data writing module 412 writes the data, the first type of data is used to overwrite the original second type of data. The second data writing module 413 writes the second type of data to the test segment of the storage device 100, and the second type of data overwrites the original first type of data. In this embodiment, the first type of data is preset data, and the tester can determine the content of the first type of data. The second type of data is randomly generated data and is different from the first type of data. For the convenience of explaining the scheme of this embodiment, in the subsequent embodiments, the first type of data is, for example, 0xA5, and the second type of data is, for example, 0x5A. The power-off execution module 414 is electrically connected to the power controller 320 and the input-output interface 330. Among them, the power-off execution module 414 sends a power-off instruction or a power-on instruction to the power controller 320 to adjust the power supply of the storage device 100 through the power controller 320 and the power management module 200. Among them, the power-off execution module 414 can also output a hard reset signal to the input-output interface 330. The input-output interface 330 is electrically connected to the reset port RST of the storage device 100. For example, the hard reset signal is a low level signal, and the power-off execution module 414 outputs a low level signal to the reset port RST, thereby resetting the storage device 100 to achieve the effect of simulating abnormal power failure. In another embodiment of the present invention, the processor 400 can also be set in the controller 110, so that the storage device 100 has a self-test capability.

[0043] See also Figure 1 and Figure 3As shown, in one embodiment of the present invention, after power is turned on again, the verification and recovery module 415 reads the data of the flash memory chip 130 and the controller cache 120, and compares and determines whether the data types stored in the power-off test segment, the test segment written before the power-off, and the test segment not written before the power-off are in accordance with expectations. Specifically, the test segment written before the power-off should store the second type of data, and the test segment not written before the power-off should store the first type of data. The power-off test segment may contain part of the first type of data and part of the second type of data. After the test segment written before the power-off, the power-off test segment, and the test segment not written before the power-off are all restored to the first type of data, the verification and recovery module 415 checks whether the storage device 100 is entirely the first type of data.

[0044] See also Figure 1 , Figure 3 and Figure 4 As shown, the present invention provides a test method for a storage test unit, including steps S10 to S50.

[0045] Step S10: write the first type of data into the storage device and fill up the storage device.

[0046] Step S20: setting a test segment, wherein the test segment stores the second type of data, and randomly writing the test segment into the storage device.

[0047] Step S30: When writing the test segment, the storage device is powered off or hard reset.

[0048] Step S40: read the data in the test section to detect whether the second type of data written before power failure is completely preserved.

[0049] Step S50: The storage device is restored by overwriting the second type of data with the first type of data. If all the data in the storage device is the first type of data, the test passes.

[0050] See also Figure 1 , Figure 3-Figure 5 As shown, in one embodiment of the present invention, in step S10, the first data writing module 412 writes the first type of data to the storage device 100 until the first type of data is written to the entire storage device 100. Figure 5 As shown, the first type of data is, for example, 0xA5. In step S20, a plurality of test segments DataChunk are first generated. The test segments DataChunk store the second type of data. It should be noted that the second type of data is different from the first type of data. Figure 5 As shown, the second type of data is, for example, 0x5A. In step S20, multiple test segments DataChunk have their own numbers to distinguish different test segments DataChunk. Figure 5As shown, this embodiment provides, for example, 5 test segments DataChunk, which are respectively test segment DataChunk_1, test segment DataChunk_2, test segment DataChunk_3, test segment DataChunk_4 and test segment DataChunk_5. It should be noted that the test segment DataChunk is a package of continuous logical blocks. In this embodiment, in step S20, when the test segment DataChunk is written to the storage device 100, the data content of the test segment DataChunk is first written to the controller cache 120. Then it is transferred to the flash memory chip 130.

[0051] In step S20, the prepared test segment is, for example, as shown in the following table. Table 1 shows the address distribution, size, and storage data type of the test segment before and after power failure, as well as a schematic diagram of the distribution of logic blocks in the storage device 100. It should be noted that the test segment refers to an address selected from the storage device for writing as the second type of data. In the storage device, addresses other than the test segment do not participate in the test steps of the present invention. For example, logic block_0, logic block_1, and logic block_5, etc., shown in the following table. It should also be noted that although addresses other than the test segment do not participate in the test steps of the present invention, different storage devices have different execution methods for instructions, and the storage device may have errors itself. Therefore, it is not ruled out that during the test process, addresses other than the test segment also participate in the test steps of the present invention, thereby causing data errors. The test method provided by the present invention can eliminate such errors and more comprehensively test the retention of data integrity of the storage device. As shown in the following table, the test segment includes one or more logic blocks. The following table only shows 5 test segments, and the test segments are not limited to 5. In the preparation stage, continuous logic blocks are randomly selected from the storage device 100 as test segments. The selected logical block address is the address of the test segment. For example, the address of test segment_2 is the address of logical block_2 to logical block_4. In the test segment, the addresses of multiple logical blocks are distributed continuously. In the present invention, a test segment can have only one logical block. The addresses of multiple test segments are randomly distributed in the storage device, and the addresses between multiple test segments do not overlap. In this embodiment, when preparing the test segment, logical blocks are randomly selected to form multiple test segments. And the test segments are numbered, wherein the number of the test segment is independent of the order of the test segment addresses. It should be noted that the addresses of multiple test segments are randomly selected, and the selected logical blocks are recorded and written into the test segment. Figure 5 As shown in the table below, the logical block address of the test segment written to the storage device 100 is random, and the process of writing the test segment is written in the order of the test segment numbers, that is, test segment_1, test segment_2, test segment_3, test segment_4 and test segment_5 are written in sequence. After the test segment is prepared, the address of the test segment is recorded.

[0052] Table 1 is as follows.

[0053]

[0054] See also Figure 1 , Figure 3-Figure 6 As shown, in one embodiment of the present invention, in step S20, the test segment DataChunk is written to the storage device 100 according to the numbering sequence of the test segments. In other embodiments of the present invention, data may be written to the test segments not in the numbering sequence. In step S30, starting from the second test segment DataChunk_2, a power-off indication or a reset indication may occur during the writing process of any test segment DataChunk. Figure 6 As shown, in this embodiment, after writing the test segments DataChunk_1 and DataChunk_2, and when writing the test segment DataChunk_3, the power-off execution module 414 sends a power-off instruction to the power controller 320, and the power controller 320 controls the power management module 200, thereby powering off the storage device 100. In another embodiment of the present invention, the power-off execution module 414 inputs a hard reset signal to the reset port RST through the input / output interface 330, thereby resetting the storage device 100 and clearing the storage data in the controller cache 120. Figure 6 As shown, the power source VCC / VCCQ is the power supply of the storage device 100. It should be noted that the present invention does not limit the test segment number that is being written when the power failure occurs.

[0055] See also Figure 1 , Figure 3-Figure 6 As shown, in one embodiment of the present invention, in step S40, after power is turned off, power is turned on again. The interval time between power off and power on again is not limited in the present invention. Specifically, the interval time between power off and power on again is greater than the general recovery time of the storage device 100. It should be noted that the data recovery time of the storage device 100 has an average value according to different types and parameters of the storage device 100. The general recovery time referred to in this embodiment is the average data recovery time of the storage device 100. In step S40, after power is turned on again, the data of multiple test segments DataChunk are read in sequence. In this embodiment, under the control of the power management module 200, the power supply VCC / VCCQ is turned off, and the time node of the power supply VCC / VCCQ being turned off is the power-off time node. At the power-off time node, the test segment being written cannot be completely saved and is difficult to be restored. Although the test segment before the power-off time node cannot be saved, if the storage device 100 has the ability to recover data from abnormal power off, this part of the data can be restored. At the power-off time node, the test segment of the storage device 100 has not yet been written, and the present invention does not limit this.

[0056] See also Figure 1 , Figure 3-Figure 6 As shown, in one embodiment of the present invention, in step S40, the test segment that is writing data at the power-off time node is used as the power-off segment, for example, the test segment DataChunk_3 is used as the power-off segment. The verification recovery module 415 reads the test segment that has data written before the power-off segment, the power-off segment, and the test segment that is scheduled to write data after the power-off segment. It should be noted that the before and after proposed in this embodiment are based on the time sequence of data writing and have nothing to do with the address sequence of the test segments. Figure 5 In this embodiment, in step S40, if the test segment to which data is written before the power failure segment stores the second type of data, and the test segment to which data is written after the power failure segment stores the first type of data, the storage device 100 passes the data recovery capability test.

[0057] As shown in the above table, the power-off segment is test segment_3. After power is restored, the second type of data is stored in test segment_1 and test segment_2, and the first type of data is stored in test segment_4 and test segment_5. In the power-off segment, the first type of data may be stored in some logic blocks, and the second type of data may be stored in some logic blocks, as shown in test segment_3 in the above table. The logic blocks storing the first type of data are located at the end of the power-off segment. It should be noted that the end of the power-off segment refers to one or more logic blocks at the end of the address sequence in the power-off segment. In the power-off segment, all logic blocks may store the first type of data or the second type of data. It should be noted that the storage data types in the same logic block are the same.

[0058] See also Figure 1 , Figure 3-Figure 6 As shown, in one embodiment of the present invention, in step S50, the verification recovery module 415 writes the first type of data to the storage device 100 until the first type of data covers the test segment and the first type of data fills up the storage device 100. In step S50, the storage data in the storage device 100 is then read out to determine that the first type of data fills up the storage device 100, while ensuring that the storage device 100 can achieve power-off data protection, and the storage device 100 will not have other storage problems due to the power-off data protection capability, thereby ensuring the comprehensiveness and accuracy of the test results.

[0059] See also Figure 1 and Figure 7As shown, the present invention also proposes an electronic device, the electronic device includes a processor 400 and a storage device 100, the storage device 100 stores program instructions, and the processor 400 runs the program instructions to implement the above-mentioned storage device test method. The processor 400 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The storage device 100 is a mNAND product, including but not limited to eMMC, UFS, SSD, etc. It can be one or more independent circuit hardware, such as an application-specific integrated circuit (ASIC), or a module or system product composed of independent circuit hardware. It should be noted that the computer program in the above-mentioned storage test unit 300 can be implemented in the form of a software function unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. It should be noted that the storage test method provided by the present invention can also be burned into the storage device 100 in the form of firmware to form a complete electronic device. The processor 400 can be set in the storage test unit 300 or in the controller 110. In another embodiment of the present invention, the test firmware of the storage test method is burned into the storage device 100, and the storage test unit 300 is only used to send the power-off instruction, hard reset instruction and power-on instruction required for the test to control the test process. In other embodiments of the present invention, the controller 110 can actively generate the power-off instruction, hard reset instruction and power-on instruction required for the test, and the first type of data storage is directly mapped to the flash memory chip 130 by the controller firmware through a mapping table. In other embodiments of the present invention, the storage device 100 can perform self-test. The test result may be stored in a predetermined location of the flash memory chip 130 and exported after the test is completed.

[0060] See also Figure 4 and Figure 8As shown, the present invention also proposes a computer-readable storage medium 501, which stores computer instructions 500, and the computer instructions 500 are used to enable a computer to execute the above-mentioned storage device test method. The computer-readable storage medium 501 can be an electronic medium, a magnetic medium, an optical medium, an electromagnetic medium, an infrared medium or a semiconductor system or a propagation medium. The computer-readable storage medium 501 can also include a semiconductor or solid-state memory, a magnetic tape, a removable computer disk, a random access memory (RAM), a read-only memory (ROM), a hard disk and an optical disk. The optical disk can include a compact disk-read only memory (CD-ROM), a compact disk-read / write (CD-RW) and a DVD.

[0061] The present invention provides a storage test unit and a test method thereof, and an electronic device, wherein the test method of the storage test unit comprises the following steps: writing a first type of data to a storage device and filling up a flash memory chip of the storage device. Writing a second type of data to the storage device, and powering off or hard resetting the storage device during the process of writing the second type of data. And reading the storage data of the storage device after powering on again, when the second type of data written before the power failure is retained in the storage data, the test of the storage device passes. Through the above scheme, the present invention can test whether the storage device still has a good ability to maintain data integrity under abnormal power failure, and the present invention can accurately and efficiently test the data retention capacity of different storage devices under abnormal power failure through the retention of the second type of data. And according to the technical scheme provided by the present invention, the storage test unit can be integrated into the storage device, so that the storage device has the ability to complete self-test, the test efficiency is high, and the test errors caused by hardware problems such as bad blocks can be eliminated, and the test accuracy is high.

[0062] The embodiments of the present invention disclosed above are only used to help illustrate the present invention. The embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A test method for a storage test unit, characterized in that: The following steps are involved: Writing first-category data into a storage device and filling up the storage device, wherein the first-category data is preset data; Writing second-category data to the storage device, with the second-category data overwriting the first-category data, and powering off or hard resetting the storage device during the process of writing the second-category data, wherein the second-category data is randomly generated data and is different from the first-category data; as well as After power is turned on again, the storage data of the storage device is read. If the second type of data written before power failure is retained in the storage data, and the first type of data is used to overwrite the retained second type of data, and the storage data are all the first type of data during the full disk read-out verification, then the test of the storage device passes; The step of writing the second type of data to the storage device includes: Setting a plurality of test segments, wherein the second type of data is stored in the test segments, wherein the plurality of test segments are numbered, wherein the test segments include at least one logic block, and in the test segments, the addresses of the plurality of logic blocks are continuously distributed, wherein the number and addresses of the logic blocks of the plurality of test segments are randomly set, and the addresses of the plurality of test segments do not overlap; and Writing the test segments into the storage device in sequence according to the numbering order; Wherein, the step of re-reading the storage data of the storage device includes obtaining a power-off segment, wherein the power-off segment is the test segment being written when a power-off or hard reset occurs; The judgment condition for whether the test of the storage device passes includes: the second type of data is stored in the test segment written before the power-off segment, and the first type of data is stored in the test segment written after the power-off segment.

2. The test method of the storage test unit according to claim 1, characterized in that: In the step of writing the test segment into the storage device, the test segment is randomly written into the storage device, and the second type of data covers the first type of data at the write position.

3. The test method of the storage test unit according to claim 1, characterized in that: The step of powering off or hard resetting the storage device includes: starting from writing the second test segment, powering off or hard resetting the storage device during the writing process of any test segment.

4. The test method of the storage test unit according to claim 1, characterized in that: The judgment condition for whether the test of the storage device passes includes: in the power-off segment, allowing the first type of data to be stored in some logic blocks, wherein the logic blocks storing the first type of data are located at the end of the power-off segment.

5. The test method of the storage test unit according to claim 1, characterized in that: The testing method includes preparing a plurality of the testing segments before writing the second type of data.

6. A storage test unit, characterized in that: include: A test segment preparation module, used for preparing a plurality of test segments and recording the addresses and the number of data blocks of the test segments, wherein the addresses of the plurality of test segments do not overlap; A first data writing module, used for writing first-category data into a storage device and filling up the storage device, wherein the first-category data is preset data; a second data writing module, which writes second-category data to the storage device according to the address of the test segment, wherein the second-category data covers the first-category data, wherein the second-category data is randomly generated data and is different from the first-category data, wherein the step of writing the second-category data to the storage device comprises: setting a plurality of test segments, wherein the second-category data is stored in the test segments, wherein the plurality of the test segments are numbered, wherein the test segments include at least one logic block, and in the test segments, the addresses of the plurality of the logic blocks are continuously distributed, wherein the number and addresses of the logic blocks of the plurality of the test segments are randomly set, and the addresses of the plurality of the test segments do not overlap, and writing the test segments to the storage device in sequence according to the numbering order; a power-off execution module, configured to power off or hard reset the storage device during the process of writing the second type of data; and a verification and recovery module, used for reading the storage data of the storage device after power is turned on again, and when the second type of data written before power failure is retained in the storage data, after the first type of data is used to overwrite the retained second type of data, when the storage data is fully read out for verification, the storage data is all the first type of data, and the test of the storage device is determined to be passed; Wherein, the step of re-reading the storage data of the storage device includes obtaining a power-off segment, wherein the power-off segment is the test segment being written when a power-off or hard reset occurs; The judgment condition for whether the test of the storage device passes includes: the second type of data is stored in the test segment written before the power-off segment, and the first type of data is stored in the test segment written after the power-off segment.

7. An electronic device, characterized in that: The invention comprises a storage device, a processor and a computer program stored in a storage medium and executable on the processor, wherein the processor implements the test method of the storage test unit as claimed in any one of claims 1 to 5 when executing the computer program.