Hard disk inspection method and electronic device

By combining partial and comprehensive inspection methods with optimization strategies for busy and idle periods, the problem of insufficient efficiency and accuracy in SSD inspection has been solved, enabling timely correction of data instability and ensuring data stability and read/write performance.

CN120375905BActive Publication Date: 2026-01-02BIWIN STORAGE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510874801.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2026-01-02
Estimated Expiration
2045-06-27

AI Technical Summary

Technical Problem

Existing solid-state drive (SSD) inspection methods are insufficient in terms of efficiency and accuracy, failing to detect and correct data instability in a timely manner, leading to a decline in data read and write performance.

Method used

A combination of partial and full inspections is adopted. Partial inspections are performed in the first preset period to update the recoverable bits, full inspections are performed in the second preset period, and full inspections are performed on the storage block with the largest recoverable bits in the third preset period. The inspection strategy is optimized according to busy and idle periods to ensure data stability.

Benefits of technology

It improves the efficiency and accuracy of hard drive inspection, promptly detects and corrects data instability, reduces the impact on read and write processes, and ensures data stability and read/write performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120375905B_ABST
    Figure CN120375905B_ABST
Patent Text Reader

Abstract

The application discloses a hard disk inspection method and electronic equipment. A first preset number of first storage blocks are locally inspected at a first preset period, and the number of correctable positions corresponding to the first storage blocks is updated. Each storage block is sequentially fully inspected at a second preset period, and a first current storage block is recorded. After the first preset number of second storage blocks with the maximum number of correctable positions are fully inspected at a third preset period, the fully inspection of each storage block is sequentially continued from the first current storage block. The application combines the advantages of local inspection and full inspection. The local inspection is efficient, and the number of correctable positions can be updated faster. The full inspection can preferentially scan the storage blocks with a high number of correctable positions with high accuracy, so that the full inspection of the storage blocks close to the critical state is preferentially judged in time, and the data is moved in time to avoid data read / write errors.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of solid state drives, in particular to a hard disk inspection method and electronic equipment. BACKGROUND

[0002] With the popularization and continuous development of the application of SSD (solid state drive), the requirements for the read-write performance and stability level of data storage are increasingly stringent. After the solid state drive writes data into the Nand Flash particles, due to the inherent physical characteristics of the Nand Flash particles, if the data is stored in the same location for a long time, the electronic escape phenomenon will occur, and when the data in the same location and area is frequently read and written, the data rollover condition will also occur; the above problems will cause the data to be in an unstable state. In addition, external factors such as temperature and humidity in the storage environment will also interfere with the data stability. Therefore, in order to ensure the data stability of the solid state drive in the daily use scene, a patrol strategy is usually added to check the stability of the stored valid data, and targeted processing such as error correction and migration is performed in a timely manner for unstable data, so as to ensure the stability of the solid state drive in long-term data storage.

[0003] In the related art, the mainstream inspection scheme is basically the same, and the full area or specific designated area of the data stored in the solid state drive is scanned in a timely manner. As for the full area scanning, it is usually time-consuming, especially for large-capacity solid state drives, there is also a situation that it cannot be scanned in time. While scanning the designated area, although the scanning is usually timely, the accuracy is insufficient, and data omission may occur in actual operation. At the same time, if the inspection scanning is too frequent, it will excessively occupy the read-write resources of the hard disk, resulting in a decrease in the read-write performance of the solid state drive. SUMMARY

[0004] The technical problem to be solved by the present application is to provide a hard disk inspection method and electronic equipment, which realizes more accurate and efficient hard disk inspection.

[0005] In order to solve the above technical problems, the technical scheme adopted by the present application is:

[0006] A hard disk inspection method, comprising:

[0007] performing local inspection on a preset number of first storage blocks in a first preset period, and updating the number of correctable bits corresponding to the first storage blocks;

[0008] performing full inspection on each storage block in a second preset period in sequence, and recording the first current storage block;

[0009] After performing the full inspection on the second storage block with the maximum number of correctable bits in the first preset number of bits with the third preset period, the full inspection on each storage block is sequentially performed starting from the first current storage block.

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

[0011] An electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements each step of the hard disk inspection method as described above when executing the computer program.

[0012] The present application has the advantages that: the local inspection and the full inspection are fused, the number of correctable bits is updated with the first preset period by using the advantage of fast local inspection speed; the full inspection is performed with the second preset period, and the first current storage block is recorded; the full inspection is performed with the third preset period on the second storage block with the maximum number of correctable bits in the first preset number of bits, and then returns to the first current storage block to continue the full inspection with the second preset period, so that the storage blocks with poor stability are preferentially confirmed by using the high accuracy of the full inspection; the local inspection is efficient and can update the number of correctable bits faster, so that the full inspection can preferentially scan the storage blocks with high number of correctable bits with high accuracy, so that the storage blocks with state close to the critical state are preferentially inspected and judged, and the data is moved in time to avoid data read / write errors. BRIEF DESCRIPTION OF DRAWINGS

[0013] Figure 1 The step flowchart of the hard disk inspection method in the embodiment of the present application;

[0014] Figure 2 The step flowchart of the full inspection in the embodiment of the present application;

[0015] Figure 3 The step flowchart of the local inspection in the busy time in the embodiment of the present application;

[0016] Figure 4 The step flowchart of the local inspection in the idle time in the embodiment of the present application;

[0017] Figure 5 The step flowchart of the data moving in the busy time in the embodiment of the present application;

[0018] Figure 6 The step flowchart of the data moving in the idle time in the embodiment of the present application;

[0019] Figure 7 The step flowchart of the inspection after power-on in the embodiment of the present application;

[0020] Figure 8 Fig. 1 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] To make the technical contents, purposes and effects of the present application clear, the following will be described in detail in combination with the embodiments and the accompanying drawings.

[0022] A hard disk inspection method, comprising:

[0023] performing local inspection on a preset number of first storage blocks with a first preset period, and updating the correctable bit number corresponding to the first storage blocks;

[0024] performing comprehensive inspection on each storage block sequentially with a second preset period, and recording a first current storage block;

[0025] after performing comprehensive inspection on the second storage blocks with the largest correctable bit number in the first preset number of bits with a third preset period, continuing to perform comprehensive inspection on each storage block sequentially from the first current storage block.

[0026] From the above description, the present application has the following beneficial effects: local inspection and comprehensive inspection are combined, the advantage of fast local inspection is used to update the correctable bit number with a first preset period; comprehensive inspection is performed with a second preset period, and a first current storage block is recorded; after comprehensive inspection is performed on the second storage blocks with the largest correctable bit number in the first preset number of bits with a third preset period, the first current storage block is returned to continue comprehensive inspection with a second preset period, so that the characteristics of high accuracy of comprehensive inspection are used to preferentially confirm the storage blocks with poor stability; the efficiency of local inspection is high, and the correctable bit number can be updated faster, so that comprehensive inspection can preferentially scan the storage blocks with high correctable bit number with high accuracy, so that the storage blocks with state close to the critical state are preferentially judged by comprehensive inspection, and data is moved in time to avoid data read / write errors.

[0027] Further, the performing local inspection on a preset number of first storage blocks with a first preset period, and updating the correctable bit number corresponding to the first storage blocks comprises:

[0028] in a busy time, randomly selecting a first storage block with a total number of half of the first preset period, and performing local inspection on the first storage block;

[0029] determining whether the correctable bit number of the first storage block is greater than a preset bit number in the scanning process of local inspection, if yes, performing scanning and updating the correctable bit number of the first storage block, otherwise, not scanning the first storage block.

[0030] From the above description, it can be seen that, since the primary task of the storage medium is to ensure the normal progress of the read-write process, whether local inspection or comprehensive inspection is performed, it should not affect the normal read-write process execution of the storage medium, so when busy, instead of performing comprehensive inspection on all storage blocks, the first preset number is set to half, and only half of the first storage blocks are randomly inspected during local inspection, further reducing the resource occupation of local inspection, and the number of correctable bits is judged during local inspection, and only the first storage blocks with a number of correctable bits greater than a preset number are scanned by local inspection, which further reduces the number of first storage blocks that need to be scanned during local inspection, and further improves the efficiency; The number of correctable bits is large, which means that the stability of the corresponding storage block is poorer, and the scanning operation of local inspection is preferentially performed to timely move data and avoid data read-write exceeding the upper limit of the number of correctable bits.

[0031] Further, the first storage blocks are randomly selected from half of the total number of storage blocks at a first preset period, and the local inspection is performed on the first storage blocks.

[0032] All storage blocks are divided into a preset number of storage areas.

[0033] Half of the first storage blocks are randomly selected from all valid storage blocks in each storage area at a first preset period, and local inspection is performed on the first storage blocks.

[0034] From the above description, the storage blocks are divided into a preset number of storage areas, and when selecting the first storage blocks, half of the valid storage blocks in each area are selected as the first storage blocks. The main purpose of performing comprehensive inspection or local inspection is to find storage blocks that need to be moved, and if the storage block has been marked as invalid, it means that there is no need to judge whether the data needs to be moved, so excluding invalid storage blocks can reduce the number of storage blocks that need to be scanned. At the same time, dividing all storage blocks into a preset number of storage areas and randomly selecting in the storage area can more evenly obtain half of the first storage blocks in the storage medium, avoiding the problem that the storage block position is too concentrated and the storage block is not randomly selected in multiple random selections.

[0035] Further, it further comprises:

[0036] When busy, every preset number of first preset periods, perform local inspection on all storage blocks, and update the number of correctable bits of each storage block.

[0037] As can be seen from the above description, in the busy time, in order to improve the efficiency and reduce the occupation of resources, the local inspection of half of the storage blocks is adopted, and the storage blocks with a number of correctable errors are skipped. As a result, the stability of the storage blocks has changed in the process of multiple local inspections, but the number of correctable errors has not been updated because the storage blocks have not been scanned in the local inspection or the full inspection, resulting in that the number of correctable errors stored in the storage blocks does not match the actual stability. Therefore, after a preset number of first preset periods, a local inspection is performed on all the storage blocks to update the number of correctable errors, so as to ensure that the number of correctable errors stored in the storage blocks is close to the actual situation.

[0038] Further, the performing local inspection on a preset number of first storage blocks in the first preset period and updating the number of correctable errors corresponding to the first storage blocks comprises:

[0039] In the idle time, local inspection is performed on all the storage blocks in the first preset period, and the number of correctable errors corresponding to all the storage blocks is updated.

[0040] As can be seen from the above description, in the idle time, it is indicated that there is no read-write task or the resource occupied by the read-write task is small. At this time, when the local inspection is performed in the first preset period, the preset number is set to be the number of all the storage blocks in the storage medium, the local inspection is performed on all the storage blocks, and the number of correctable errors corresponding to all the storage blocks is updated. The idle time resource is fully utilized, and the number of correctable errors corresponding to the storage blocks is updated in time.

[0041] Further, it further comprises:

[0042] In the idle time, the second preset period and the third preset period are shortened.

[0043] As can be seen from the above description, in the idle time, the second period and the third period corresponding to the full inspection are shortened. Therefore, the full inspection can be performed at a shorter interval in the idle time, so as to accelerate the frequency of accurate updating of the number of correctable errors and improve the accuracy of data moving judgment.

[0044] Further, it further comprises:

[0045] When the device is powered on, local inspection is performed on all the storage blocks, and the number of correctable errors of each storage block is updated;

[0046] After the third storage block with the largest number of correctable errors in the first preset number is obtained and full inspection is performed, the second current storage block of the full inspection before power-off is read;

[0047] From the second current storage block, full inspection is sequentially performed on each storage block.

[0048] From the above description, when the device is powered on, the local inspection is performed on all storage blocks, the stability of the storage block can be updated at the fastest efficiency, so that the data moving judgment can be performed in the updated stable state during the read-write process after power-on, the accuracy of data moving judgment is improved, and the accuracy of read-write data is ensured.

[0049] Further, it further comprises:

[0050] In the busy time, if the target data block that fails to read data but can be corrected appears in the local inspection or the comprehensive inspection, the current error correction voltage level is obtained;

[0051] If the current error correction voltage level is greater than or equal to the moving level, the data is read using the error correction voltage level before the current error correction voltage level, and it is determined whether all read failures and uncorrectable occur, and if so, the data moving is performed on the storage data in the target data block.

[0052] Otherwise, the data is read using the error correction voltage level after the current error correction voltage level, and if all read failures and uncorrectable occur, the data moving is performed on the storage data in the target data block.

[0053] From the above description, if the current error correction voltage level reaches the moving level in the busy time, the data moving is not directly performed, but the error correction voltage level before and after the error correction voltage level is used to read the data again, and if all read failures occur, the data moving operation is performed, so that the resources can be as much as possible emptied for read-write operation in the busy time, and the data read-write efficiency is ensured.

[0054] Further, it further comprises:

[0055] In the idle time, if the target data block that fails to read data but can be corrected appears in the local inspection or the comprehensive inspection, the current error correction voltage level is obtained;

[0056] If the current error correction voltage level is greater than or equal to the moving level, the data moving is performed on the storage data in the target data block.

[0057] From the above description, if the current error correction voltage level is greater than or equal to the moving level in the idle time, the data moving operation is immediately performed, so that the data moving operation is performed in time by using the idle resources, the storage block with poor stability continues to participate in the data read-write process is avoided, and the accuracy of read-write result is ensured.

[0058] Further, it further comprises:

[0059] If the storage block is in the data moving state, the local inspection or the comprehensive inspection is not performed on the storage block in the data moving state.

[0060] From the above description, the purpose of the local inspection or the overall inspection is to find the storage block with poor stability for moving, so if the storage block is already in the moving state, it means that the storage block does not need to be locally inspected or overall inspected, at this time, the corresponding storage block is skipped, no resources are occupied for scanning, and the scanning efficiency is improved.

[0061] Further, the local inspection of the first storage block in the preset number is performed at a first preset period.

[0062] Obtain the total page number of a single local inspection scan;

[0063] According to the characteristics of the storage particles, obtain the first storage page identifier prone to errors, and randomly generate a second storage page identifier different from the first storage page identifier, and the sum of the number of the first storage page identifier and the number of the second storage page identifier is the total page number;

[0064] According to the first storage page identifier and the second storage page identifier, the local inspection of the first storage block in the preset number is performed.

[0065] From the above description, in the process of performing local inspection, when scanning part of the pages in the storage block, according to the characteristics of the storage particles, the first storage page identifier prone to errors is obtained first, and then the second storage page identifier different from the first storage page identifier is randomly generated, in this way, the comprehensive state of the storage block is obtained by comprehensively considering the state of the storage page with poor stability in the local inspection scanning process and the state of other storage pages in the randomly sampled storage block.

[0066] Please refer to Figure 8 An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements each step of the hard disk inspection method as described above when executing the computer program.

[0067] In the moving strategy when the data is unstable, the scheme in the related art is generally relatively single, usually only according to the read data when the correction gear is in a state to determine whether to perform a moving operation, if the correction gear is in a more serious degree, then refresh is started, otherwise it is not started, the single nature of this moving judgment is easy to cause the data in the disk to be moved too frequently, resulting in too large write amplification, reducing the solid state life, or the moving opportunity is too late, which is easy to cause the data to be lost.

[0068] The hard disk inspection method and the electronic device provided by the application can be applied to a storage cutoff with an inspection function, for example, to a solid state drive (SSD, Solid State Drive) as follows by means of a specific implementation.

[0069] Embodiment one

[0070] Please refer to Figure 1 A hard disk inspection method, comprising the steps of:

[0071] S1, performing local inspection on a preset number of first storage blocks at a first preset period, and updating the number of correctable bits (err cnt) corresponding to the first storage blocks. Local inspection (fast inspection) scans a specified area in the storage medium, such as scanning a specified number and position of storage pages in a specified storage block (blk). The period is short, and a specified number and position of storage pages in a specified number of storage blocks are scanned simultaneously in each period. The number of correctable bits is the number of bits in the recorded correctable data that are in error when the data is read but can be corrected.

[0072] In an optional embodiment, S1 comprises S101-S102.

[0073] S101, randomly selecting half of the total number of first storage blocks at a first preset period when busy, and performing local inspection on the first storage blocks. Busy time can be when there is a read-write task (busy), or it can be determined whether it is busy time according to whether the resource occupancy rate exceeds the preset proportion, such as setting it as busy time when the IO port occupancy rate exceeds 50%. Determining whether there is a read-write task can maximize the impact of the inspection process on the read-write task.

[0074] S102, determining whether the number of correctable bits of the first storage block is greater than a preset number of bits during the scanning process of the local inspection. If yes, scanning and updating the number of correctable bits of the first storage block, otherwise not scanning the first storage block.

[0075] In an optional embodiment, the preset number of bits is set to the median. For example, taking 8 bits as the median when reading 16 bits of data. In this way, the status of the storage block that is more likely to be incorrect is confirmed during busy time, and scanning of the storage block with a smaller number of correctable bits and a lower error probability is skipped, reducing the impact on the read-write task.

[0076] In an optional embodiment, S101 comprises S1011-S1012.

[0077] S1011, dividing all storage blocks into a preset number of storage areas.

[0078] S1012, randomly selecting half of the first storage blocks from all valid storage blocks in each of the storage areas at a first preset period, and performing local inspection on the first storage blocks.

[0079] For example, 500 storage blocks are divided into 50 areas, each area including 10 storage blocks, and each time half of the effective storage blocks in the area are randomly selected for inspection. This ensures that the selection of storage blocks in the entire storage medium is relatively balanced, and the random selection in the local area is also a trade-off between the length of the inspection time and the comprehensiveness of the inspection.

[0080] In an optional embodiment, S1 includes S111: performing local inspection on all storage blocks at an idle time with a first preset period to update the number of correctable bits corresponding to all the storage blocks. This ensures the completeness of the scanning and improves the coverage of the storage blocks. In correspondence with the busy time, the idle time can be when there is no read-write task (idle), or it can be determined whether it is idle according to whether the resource occupancy rate is lower than a preset proportion, for example, according to the IO port occupancy rate being less than or equal to 50% to set it as idle.

[0081] In an optional embodiment, performing local inspection on a preset number of first storage blocks with a first preset period in S1 includes S121-S123.

[0082] S121, obtaining the total number of pages of a single local inspection scan. The total number of pages can be set to 5%-10% of the total number of storage pages in the storage medium, for example, 15%, to achieve the effect of random sampling and improve the accuracy of the judgment of the state of the storage blocks while reducing the number of scanned storage pages.

[0083] S122, obtaining the first storage page identifier prone to errors according to the characteristics of the storage particles, and randomly generating a second storage page identifier different from the first storage page identifier, and the sum of the number of the first storage page identifier and the number of the second storage page identifier is the total number of pages. In an optional embodiment, the number of storage pages to be scanned in each first storage block is obtained by dividing the total number of pages of a single local inspection scan by the number of first storage blocks, and the first storage page identifier and the second storage page identifier are generated in each first storage block according to the number of storage pages to be scanned.

[0084] S123, performing local inspection on a preset number of first storage blocks according to the first storage page identifier and the second storage page identifier.

[0085] For example, if the total number of pages is 128, it means that 128 memory pages need to be scanned, and if 6 memory pages are scanned at a time, it means that when each memory block is scanned half of the memory block, only 6 memory pages in each memory block are scanned, and when 128 memory pages are scanned cumulatively, it is considered that a local inspection is completed. The location of the memory page is composed of two parts, the first part is the first memory page (weak page) selected according to the characteristics of the memory medium particles (Nand particles), and the second part is the second memory page generated by a random seed, and the two parts constitute the total 128 memory page locations of each round of inspection. The number of first memory pages is set to be greater than the number of second memory pages, for example, 108 memory page locations are weak page locations, and 20 memory page locations are randomly generated memory page locations. That is, a total of 128 pages need to be scanned, and 6 pages are scanned at a time, of which 5 are weak pages and 1 is a random page. When the randomly generated memory page conflicts with the weak page, the duplicate second memory page generated randomly is discarded and randomly generated again. In this way, the weak page is generally the location where the exception is most likely to occur, and the inspection of the weak page can effectively detect the stability of the data, and the random page is to realize the balanced inspection of some locations in the disk and improve the coverage of the inspection scan. The number is dynamically adjusted according to the total number of memory pages of the memory medium particles, and generally contains about 5% to 10% of the total number of memory pages of the memory medium particles, thereby realizing the effect of sampling coverage.

[0086] S2, sequentially performing full inspection on each memory block at a second preset period, and recording a first current memory block. The full inspection (full inspection) fully scans each memory block in the storage medium, and the full scan scans the data stored in the entire storage medium according to the specified period, scans all memory pages in a certain memory block each time, but the period is longer. The full inspection sequentially traverses and scans all memory blocks in the storage medium, that is, it scans all memory pages in a memory block each time, and at the same time, it records the maximum correctable bit number of the data in the all memory pages in the current scanned memory block when the read data is fed back, and the maximum correctable bit number is recorded as the correctable bit number of the memory block in the correctable bit number parameter of the memory block.

[0087] S3, after performing the full inspection on the second storage blocks with the maximum number of correctable bits in the first preset number of positions, continue to perform the full inspection on each storage block in sequence from the first current storage block. The rapid implementation of the local inspection performs a preliminary check on the entire storage medium, but is not accurate, so the jump inspection of the full inspection on the storage blocks with a large number of correctable bits uses the full coverage of the full inspection to ensure the accuracy of the inspection. The local inspection and the full inspection are linked according to the number of correctable bits, and the advantages and disadvantages of the local inspection and the full inspection are fully complementary, so that the rapid and accurate selection of the inspection is realized.

[0088] In an optional embodiment, the third preset period is a multiple of the second preset period. In this way, after the full inspection is sequentially performed for a fixed number of second preset periods, the scanning on the second storage blocks with the maximum number of correctable bits in the first preset number of positions is performed, the state of the storage blocks with poor states found in the local inspection is confirmed by the full inspection, and the accuracy of the data migration is improved.

[0089] In an optional embodiment, S4 is further included: during the busy time, after a preset number of first preset periods, performing the local inspection on all storage blocks and updating the number of correctable bits of each storage block. For example, after 10 first preset periods, the local scanning on the entire storage medium is performed and the number of correctable bits of each storage block is updated, so as to avoid the problem that the storage blocks close to the critical state are not updated in time after being used during the busy time, resulting in too late data migration time.

[0090] In an optional embodiment, S5 is further included: during the idle time, the second preset period and the third preset period are shortened. During the idle time, the local inspection and the full inspection are associated, and during the resource idle time, the local inspection is performed on the entire storage medium, and the period of the full inspection is shortened, so that the scanning frequency of the full inspection on the second storage blocks with the maximum number of correctable bits in the first preset number of positions is also correspondingly increased, so that the storage blocks that need to be migrated can be found more timely, and the data stability is ensured.

[0091] In an optional embodiment, the second preset period and the third preset period are shortened to 1 / 3 of the initial state. For example, the capacity of the storage medium is 4T, and during the busy time, in order to maintain the performance, the full inspection may need 14 days, and during the idle time, only about 4 days are needed, because there is no host service during the idle time, and there is no consideration of the impact of the inspection on the performance, so the inspection can be accelerated to ensure the stability of the data in the disk, but attention should be paid to the fact that too frequent inspection will increase the power consumption during the idle time, so the inspection period during the idle time should be determined according to the demand, and is generally set to 1 / 3 of the original period.

[0092] In an alternative embodiment, it further comprises S6: S601-S603.

[0093] S601, when the device is powered on, locally inspecting all storage blocks, and updating the number of correctable bits of each storage block.

[0094] S602, after the third storage block with the largest number of correctable bits is obtained by performing full inspection, reading the second current storage block before power-off full inspection.

[0095] S603, sequentially performing full inspection on each storage block starting from the second current storage block.

[0096] In this way, after the storage is powered on again, the number of correctable bits is updated using the efficient characteristics of local inspection, and then accurate scanning is performed through full inspection. For example, the storage medium is left for a long time (2-3 years) after power-off. At this time, due to the phenomenon of electronic escape, there is a lot of instability in the data in the storage medium. However, there is a priority for instability, that is, which storage block is the most unstable and needs to be moved first, and which storage block is relatively stable and can still perform read-write tasks. At this time, after power-on, the local inspection of all storage blocks is performed first to efficiently confirm the approximate stability of each storage block in the storage medium. Then, the storage block with the worst stability, that is, the storage block with the largest number of correctable bits, is fully inspected as a perfect check to investigate the specific stability of the current most unstable area, and the data of the storage block with poor stability is moved in time.

[0097] In an alternative embodiment, it further comprises S7: S701-S703.

[0098] S701, when busy, if the target data block fails to read data but can be corrected during local inspection or full inspection, obtain the current error correction voltage level.

[0099] S702, if the current error correction voltage level is greater than or equal to the moving level, use the error correction voltage level before the current error correction voltage level to read data, and determine whether all read failures and uncorrectable, if so, execute S704, otherwise execute S703.

[0100] S703, use the error correction voltage level after the current error correction voltage level to read data, if all read failures and uncorrectable, execute S704, otherwise do not perform data moving operation.

[0101] S704, performing data migration on the stored data in the target data block. As can be, the target data block is marked with a data migration state first, and waits for the data migration operation to be performed. Each storage block has its own state record, when it is confirmed that the storage block needs to be migrated, the state of the storage block is changed from valid (indicating that the storage block stores valid data) to refresh (data migration state), and then the subsequent process responsible for data migration can perform data migration processing according to the state of the storage block. The process of data migration is a prior art, which will not be described here.

[0102] In an optional implementation, before the current error correction voltage level is used in S702, the data is read by using a second preset number of error correction voltage levels, it is judged whether all read failures and non-recoverable, if all failures are executed S704, otherwise S703 is executed. If there is still a voltage level that can successfully correct error before the current error correction voltage level, it means that the current storage block has data error, but it is still within the correctable range, and the used error correction voltage is also not close to the critical value, and the data migration operation of the storage block can be suspended in busy time.

[0103] In an optional implementation, after the current error correction voltage level is used in S703, the data is read by using a third preset number of error correction voltage levels, it is judged whether there is more than a fourth preset number of readable successful error correction voltage levels, if yes, no data migration operation is performed, otherwise S704 is executed. Here, read success means that the correct data can be directly read or there is error data but can be corrected. The fourth preset number is less than the third preset number. In this way, in the case that all error correction voltage levels before the current error correction voltage level read failure, if there is more than a fourth preset number of readable successful error correction voltage levels in the third preset number of error correction voltage levels after the current error correction voltage level, it also means that the current error correction voltage level has not reached the critical value, and the data migration operation of the storage block can be suspended. If less than the fourth preset number, it means that the error correction voltage level of the current storage block has almost failed, and needs to be migrated. After the current error correction voltage level reaches the migration level, the error correction voltage levels before and after it are also obtained to further judge whether they can be read successfully, so as to reduce the data migration operation in busy time and prioritize the read-write task.

[0104] In an optional implementation, it further includes S8: S801 to S802.

[0105] S801, in idle time, if the target data block with read failure but recoverable appears in the local inspection or the overall inspection, the current error correction voltage level is obtained.

[0106] S802, if the current error correction voltage level is greater than or equal to the migration level, performing data migration on the stored data in the target data block.

[0107] In this way, the single position determination mechanism is reserved in idle time, the influence of the data migration on the read and write is reduced, and the stability of the data in the disk is improved.

[0108] In an optional implementation, the method further includes S9: if the storage block is in the data migration state, performing no local inspection or full inspection on the storage block in the data migration state.

[0109] Embodiment Two

[0110] The hard disk inspection method described above is applied in a specific scenario. Please refer to Figure 2 In busy time, S1 in Embodiment One includes S121 to S128.

[0111] S121, the local inspection is waiting for execution.

[0112] S122, it is judged whether the waiting time is greater than or equal to a first preset period. If yes, S123 is executed, otherwise, S121 is returned.

[0113] S123, the local inspection queries the number of correctable positions of the current storage block.

[0114] S124, it is judged whether the number of correctable positions is greater than the median. If yes, S125 is executed, otherwise, S127 is executed.

[0115] S125, the local inspection scans the specified storage page in the current storage block.

[0116] S126, the number of correctable positions corresponding to the current storage block is updated.

[0117] S127, the next storage block of the current storage block is sequentially taken as the current storage block after the current storage block, and S128 is executed. For example, the next storage block is obtained according to the increment of the identifier corresponding to the storage block.

[0118] S128, it is judged whether the number of scanned storage blocks is greater than half of the total number of storage blocks in the storage medium. If yes, S121 is returned, otherwise, S123 is returned.

[0119] Please refer to Figure 3 S2 includes S201 to S205; and S3 includes S301 to S303.

[0120] S201, the full inspection is waiting for execution.

[0121] S202, it is judged whether the waiting time is greater than or equal to a second preset period. If yes, S203 is executed, otherwise, S201 is returned.

[0122] S203, the full inspection sequentially scans the storage blocks, and scans all the storage pages in the scanned storage blocks.

[0123] S204, updating the number of correctable bits of the scanned storage block according to the scanning result, and recording the first current storage block.

[0124] S301, judging whether a third preset period is reached, if yes, executing S302, otherwise executing S205.

[0125] S302, performing overall inspection on the second storage block with the first preset number of bits and the largest number of correctable bits.

[0126] S303, returning to the first current storage block to continue the overall inspection. For example, the inspection is continued by increasing the identification corresponding to the first current storage block by 1.

[0127] S205, continuing the overall inspection in sequence with the first current storage block. For example, the inspection is continued by increasing the identification corresponding to the first current storage block by 1.

[0128] Please refer to Figure 4 In the idle time, the second preset period and the third preset period are shortened, and S1 includes S131 to S136.

[0129] S131, waiting for execution of local inspection.

[0130] S132, judging whether the waiting time is greater than or equal to the first preset period, if yes, executing S133, otherwise returning to execute S131.

[0131] S133, locally inspecting the specified storage page of the current storage block.

[0132] S134, updating the number of correctable bits of the current storage block.

[0133] S135, sequentially updating the next storage block of the current storage block as the current storage block.

[0134] S136, judging whether the storage block is the last storage block in the storage medium, if yes, returning to execute S131; otherwise, returning to execute S133. The judgment of whether the storage block is the last storage block in the storage medium can be made according to whether the identification of the storage block is greater than or equal to the maximum storage block identification in the storage medium.

[0135] Please refer to Figure 5 In the busy time, the process S7 of data moving includes S711 to S718.

[0136] S711, if the data read from the storage block has errors but can be corrected, executing S712.

[0137] S712, determine whether the current error correction voltage level is greater than or equal to the shift level, if yes, execute S713, otherwise execute S717.

[0138] S713, re-read the data in the storage block using three error correction voltage levels before the current error correction voltage level.

[0139] S714, determine whether there is an error correction voltage level that can successfully read the data, i.e., the data is read with errors but can be successfully corrected, if yes, execute S717, otherwise execute S715.

[0140] S715, re-read the data in the storage block using three error correction voltage levels after the current error correction voltage level.

[0141] S716, determine whether there is more than one error correction voltage level that can successfully read the data, if yes, execute S717, otherwise execute S718.

[0142] S717, do not shift the data of the storage block.

[0143] S718, shift the data of the storage block.

[0144] Please refer to Figure 6 In idle time, the data shifting process S8 includes S811-S814.

[0145] S811, if the data read from the storage block has errors but can be corrected, execute S812.

[0146] S812, determine whether the current error correction voltage level is greater than or equal to the shift level, if yes, it means that the data of the storage block needs to be shifted, execute S813, otherwise it means that the data of the storage block does not need to be shifted, execute S814.

[0147] S813, shift the data of the storage block.

[0148] S814, do not shift the data of the storage block.

[0149] Please refer to Figure 7 The post-power-on inspection process S6 includes S611-S617.

[0150] S611, determine whether the device has a power-on operation, if yes, execute S612.

[0151] S612, perform local inspection on the specified storage pages in all storage blocks in the storage medium.

[0152] S613, update the number of correctable bits of all storage blocks through local inspection.

[0153] S614, start full patrol.

[0154] S615, full patrol the first pre-set storage blocks with the largest number of correctable errors, i.e. read all the storage pages in the storage blocks for scanning. The first three storage blocks can be selected for full patrol.

[0155] S616, full patrol reads the scanning information of the full patrol before power-off from sys. Sys refers to the stored system information, which needs to have the features of power-off retention and timing refresh, so the storage medium will flush the sys information to the designated area for system information saving when running and powering off. This area can be a specified area of NOR FLASH or Nand, which will be read after power-on for data recovery. Full patrol can obtain the scanning information of the patrol before power-off by reading the system information saved after power-off.

[0156] S617, full patrol continues scanning from the position of the scanned storage block recorded in the scanning information before power-off.

[0157] Embodiment three

[0158] An electronic device 400, comprising a memory 402, a processor 404, and a computer program stored in the memory 402 and executable on the processor 404, wherein the processor 404 implements each step of a hard disk patrol method as described above when executing the computer program.

[0159] The beneficial effects of the electronic device in this embodiment are the same as those of the above-mentioned hard disk patrol method, which will not be repeated here.

[0160] In summary, the hard disk inspection method and electronic device provided by the application associate local inspection with overall inspection, use the correctable bit number updated by local inspection as a reference for scanning priority in the overall inspection scanning process, and set different cooperation strategies for local inspection and overall inspection according to busy time and idle time, reduce the influence on the read-write process in the 0 storage medium on the basis of timely data migration and ensuring the accuracy of data in the storage block, and ensure that the read-write process can be normally executed in priority. After the current error correction voltage level reaches the migration level, different migration strategies are also set according to busy time and idle time, if it is idle time, data migration is performed immediately to ensure that data can be stored in a storage block with high stability, if it is busy time, the error correction voltage level before and after the current error correction voltage level is read to determine whether the correct data can be read, if yes, it means that error correction can be realized according to the current error correction voltage level, and data migration is not performed to leave resources for the ongoing read-write operation; the storage block in the critical state is migrated again in busy time, resources are left for the read-write operation of the busy system while avoiding reading incorrect data, and the different strategies of busy time and idle time make the judgment of whether to perform data migration more reasonable. In this way, accurate inspection and migration object determination are realized, the efficiency of the inspection process and the data migration process is improved, the combination of the inspection strategy and the data migration strategy improves the data stability of the storage medium and reduces the influence on the read-write performance of the storage medium.

[0161] In the above-described embodiments provided by the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the modules is only a logical function division. In actual implementation, another division mode can be used, for example, a plurality of components or modules can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be indirect coupling or communication connection through some interfaces, devices or components or modules, and can be electrical, mechanical or other forms.

[0162] The components described as separate components can or can not be physically separate, and the components displayed as components can or can not be physical modules, that is, can be located in one place or can be distributed on a plurality of network modules. Part or all of the components can be selected according to actual needs to achieve the purpose of the embodiment scheme.

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

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

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

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

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

Claims

1. A method for hard disk inspection, characterized in that, The method comprises the following steps: performing local inspection on a preset number of first storage blocks with a first preset period, and updating the number of correctable positions of the first storage blocks; performing full inspection on each storage block sequentially with a second preset period, and recording a first current storage block in the current full inspection round; after the full inspection jumps to the second storage block with the first preset number of the largest number of correctable positions and performs full inspection, returning to the first current storage block, and then continuing to perform full inspection on each storage block sequentially from the first current storage block with the second preset period; if the storage block is in a data moving state, the local inspection or the full inspection is not performed on the storage block in the data moving state.

2. The method of claim 1, wherein, The method of performing local inspection on a preset number of first storage blocks with a first preset period, and updating the number of correctable positions of the first storage blocks comprises the following steps: in a busy state, randomly selecting half of the total number of first storage blocks with a first preset period, and performing local inspection on the first storage blocks; in the scanning process of the local inspection, judging whether the number of correctable positions of the first storage blocks is greater than a preset number, if yes, performing scanning and updating the number of correctable positions of the first storage blocks, otherwise, not performing scanning on the first storage blocks.

3. The method of claim 2, wherein, The method of randomly selecting half of the total number of first storage blocks with a first preset period, and performing local inspection on the first storage blocks comprises the following steps: dividing all the storage blocks into a preset number of storage areas; in each storage area, randomly selecting half of the first storage blocks from all the effective storage blocks with a first preset period, and performing local inspection on the first storage blocks.

4. The method of claim 2, wherein, The method further comprises the following steps: in a busy state, after a preset number of first preset periods, performing local inspection on all the storage blocks, and updating the number of correctable positions of each storage block.

5. The method of claim 1, wherein, The method of performing local inspection on a preset number of first storage blocks with a first preset period, and updating the number of correctable positions of the first storage blocks comprises the following steps: in an idle state, performing local inspection on all the storage blocks with a first preset period, and updating the number of correctable positions of all the storage blocks.

6. The method of claim 1, wherein, The method further comprises the following steps: in an idle state, shortening the second preset period and the third preset period.

7. The method of claim 1, wherein, The method further comprises the following steps: when the device is powered on, performing local inspection on all the storage blocks, and updating the number of correctable positions of each storage block; after performing full inspection on the third storage block with the second preset number of the largest number of correctable positions, reading the second current storage block in the full inspection before power-off; performing full inspection on each storage block sequentially from the second current storage block.

8. The method of claim 1, wherein, The method further comprises the following steps: in a busy state, if a target data block with read data failure but correctable position appears in the local inspection or the full inspection, acquiring a current error correction voltage level; if the current error correction voltage level is greater than or equal to a moving level, reading data using an error correction voltage level before the current error correction voltage level, judging whether all the read data is failed and uncorrectable, if yes, performing data moving on the storage data in the target data block; otherwise, reading data using an error correction voltage level after the current error correction voltage level, if all the read data is failed and uncorrectable, performing data moving on the storage data in the target data block.

9. The method of claim 1, wherein, The method further comprises the following steps: In the idle time, if a target data block with a read failure but a recoverable error occurs in the local inspection or the full inspection, a current error correction voltage level is obtained; If the current error correction voltage level is greater than or equal to a moving level, data moving is performed on the stored data in the target data block.

10. The method of claim 1, wherein, The local inspection on the first storage blocks in the first preset number includes: The total number of pages in a single local inspection scan is obtained; The first storage page identifiers prone to errors are obtained according to the characteristics of the storage particles, and the second storage page identifiers different from the first storage page identifiers are randomly generated, and the sum of the number of the first storage page identifiers and the number of the second storage page identifiers is the total number of pages; The local inspection on the first storage blocks in the first preset number is performed according to the first storage page identifiers and the second storage page identifiers.

11. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements each step in the hard disk inspection method according to any one of claims 1-10 when executing the computer program.

Citation Information

Patent Citations

  • Method for scanning disk array

    CN103729276A

  • Solid state disk data inspection method and device

    CN114356238A