A data inspection method, device, equipment and storage medium
By combining the data status of each physical block on the hard drive with the results of the last inspection cycle, the inspection range and priority are dynamically adjusted, which solves the problem of the accuracy of hard drive data inspection and improves the inspection effect and data reading performance of the hard drive.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN YUNHAI XINKE MICROELECTRONICS TECH CO LTD
- Filing Date
- 2026-04-14
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies fail to effectively combine the data status of each physical block on the hard drive with the results of the previous inspection cycle during hard drive data inspection, resulting in discrepancies between the inspection results and the actual situation, which affects data reading performance.
By dynamically adjusting the current inspection scope, priority sorting, and data migration based on the data status of each physical block on the hard drive and the results of the last inspection cycle, the accuracy of the inspection is improved.
It achieves more accurate hard drive data inspection results, improving the inspection effect and data reading performance of hard drives.
Smart Images

Figure CN122173030A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of hard disk inspection technology, and in particular to a data inspection method, apparatus, device, and storage medium. Background Technology
[0002] Solid-state drives (SSDs) store data electronically in storage units (physical blocks). Software obtains data (0 or 1) by reading the voltage level. However, over time, electrons in the storage units may unexpectedly "escape," causing voltage shifts and gradually making the data inaccurate. Eventually, the escaped electrons exceed a threshold, resulting in a 0 / 1 jump and completely corrupted data. While software can recover erroneous data through error correction codes, read-retry, and soft-decode, these operations impact data read performance. Therefore, it's necessary to inspect the data on the hard drive during idle periods to ensure stable read performance. Currently, a common data inspection method combines the data status of each physical block, considering only the actual situation of the physical blocks in the current inspection cycle. From an overall perspective, this method may yield results that deviate from the actual condition of the hard drive.
[0003] Therefore, how to inspect the data in the hard drive and improve the accuracy of data inspection is a problem that needs to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a data inspection method, apparatus, device, and storage medium that can adjust the data inspection range of a physical block by combining the data status of each physical block in the hard drive and the inspection results of that physical block in the previous inspection cycle; the data inspection range of a single physical block changes dynamically in different cycles, which can obtain more accurate inspection results of physical blocks and improve the inspection effect of the hard drive. The specific solution is as follows: Firstly, this application provides a data inspection method, including: The current physical block to be inspected in the current inspection cycle is determined based on the data status of each physical block of the hard drive to be inspected. The inspection data range of the physical block to be inspected is adjusted based on the inspection results of the physical block to be inspected in the previous inspection cycle to obtain the current inspection data range corresponding to the physical block to be inspected. The data inspection operation is performed on the physical block to be inspected using the current inspection data range to obtain the data inspection result of the physical block to be inspected in the current inspection cycle, so as to complete the data inspection operation of each physical block of the hard disk to be inspected.
[0005] Optionally, the data status includes physical block usage time, number of valid pages in the physical block, and number of times the physical block data is read.
[0006] Optionally, determining the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard drive to be inspected includes: The inspection priority of several physical blocks whose physical block usage time is greater than the preset time and whose number of valid pages is greater than the preset page number threshold is determined as the first priority. The inspection priority of several physical blocks whose corresponding physical block usage time is greater than the preset time and whose effective page number is not greater than the preset page number threshold is determined as the second priority. The inspection priority of a number of physical blocks whose corresponding physical block usage time is no greater than the preset time is determined as the third priority. Based on the inspection priority of each physical block in the hard disk to be inspected, the current physical block to be inspected in the current inspection cycle is determined from each physical block.
[0007] Optionally, determining the current physical block to be inspected in the current inspection cycle from the physical blocks based on the inspection priority corresponding to each physical block in the hard disk to be inspected includes: The physical blocks are sorted in ascending order based on their inspection priority and the average number of data reads of the relevant physical blocks in the hard drive to be inspected, resulting in sorted physical blocks corresponding to each inspection priority; the average number of data reads is the ratio of the number of data reads of a physical block to the number of valid pages in the physical block. Determine the current physical block to be inspected in the current inspection cycle from the sorted physical blocks.
[0008] Optionally, determining the current physical block to be inspected in the current inspection cycle from the sorted physical blocks includes: The current physical block to be inspected in the current inspection cycle is determined sequentially from the first sorted physical blocks corresponding to the first priority. If the first sorted physical blocks have all completed data inspection operations in the current inspection cycle, then the current physical block to be inspected in the current inspection cycle is determined sequentially from the second sorted physical blocks corresponding to the second priority. If all the second sorted physical blocks have completed data inspection operations in the current inspection cycle, then the current inspection cycle will end directly.
[0009] Optionally, adjusting the inspection data range of the physical block to be inspected based on the data inspection results of the physical block to be inspected in the previous inspection cycle to obtain the current inspection data range corresponding to the physical block to be inspected includes: If the inspection data range of the physical block to be inspected in the previous inspection cycle is a preset data range, and the corresponding data inspection result indicates that the bit error rate is not greater than a preset bit error threshold, then the preset data range is determined as the current inspection data range corresponding to the physical block to be inspected. If the inspection data range of the current physical block to be inspected in the previous inspection cycle is greater than the preset data range, and the corresponding data inspection result indicates that the bit error rate is not greater than the preset bit error threshold, then the inspection data range of the current physical block to be inspected in the previous inspection cycle is reduced according to the preset range adjustment parameter, and the reduced data range is determined as the current inspection data range corresponding to the current physical block to be inspected; the reduced data range is not less than the preset data range. If the inspection data range of the current physical block to be inspected in the previous inspection cycle is not less than the preset data range, and the corresponding data inspection result indicates that the bit error rate is greater than the preset bit error threshold, then the inspection data range of the current physical block to be inspected in the previous inspection cycle is expanded according to the preset range adjustment parameter, and the expanded data range is determined as the current inspection data range corresponding to the current physical block to be inspected.
[0010] Optionally, after obtaining the data inspection result of the physical block to be inspected in the current inspection cycle, the method further includes: If the data inspection result indicates that data reading has failed, a forced migration operation is triggered on the data in the currently inspected physical block. The data in the currently inspected physical block is moved to a new physical block through the forced migration operation so that the data inspection operation can be performed on the new physical block in the next inspection cycle.
[0011] Secondly, this application provides a data inspection device, comprising: The physical block determination module is used to determine the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard drive to be inspected; The inspection data range adjustment module is used to adjust the inspection data range of the physical block to be inspected based on the data inspection results of the physical block to be inspected in the previous inspection cycle, so as to obtain the current inspection data range corresponding to the physical block to be inspected. The data inspection module is used to perform data inspection operations on the physical block to be inspected using the current inspection data range, and obtain the data inspection results of the physical block to be inspected in the current inspection cycle, so as to complete the data inspection operation on each physical block of the hard disk to be inspected.
[0012] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the data inspection method described above.
[0013] Fourthly, this application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the data inspection method described above.
[0014] Therefore, in the data inspection process, this application first determines the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard drive to be inspected; then, based on the data inspection results of the current physical block to be inspected in the previous inspection cycle, the inspection data range of the current physical block to be inspected is adjusted to obtain the current inspection data range corresponding to the current physical block to be inspected; subsequently, the current inspection data range is used to perform data inspection operations on the current physical block to be inspected to obtain the data inspection results of the current physical block to be inspected in the current inspection cycle, thereby completing the data inspection operation on each physical block of the hard drive to be inspected. In this way, this application combines the data status of each physical block in the hard drive and the inspection results of the physical block in the previous inspection cycle to adjust the data inspection range of the current physical block; the data inspection range of a single physical block changes dynamically in different cycles, which can obtain more accurate inspection results of the physical blocks and improve the inspection effect of the hard drive. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0016] Figure 1 This is a flowchart of a data inspection method disclosed in this application; Figure 2 This application discloses a flowchart for determining inspection priority. Figure 3 This application discloses a flowchart for adjusting the inspection scope; Figure 4 This is a schematic diagram of the structure of a data inspection device disclosed in this application; Figure 5 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] See Figure 1 As shown, an embodiment of the present invention discloses a data inspection method, including: Step S11: Determine the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard disk to be inspected.
[0019] In this embodiment, the hard drive to be inspected has an inspection cycle. During each inspection cycle, when inspecting each physical block on the hard drive, the data status of each physical block needs to be considered. The inspection order for each physical block can be determined based on its data status. It is understood that "cold" and "hot" data are concepts in the storage field, used to describe the stability of data. For a piece of data, if it has not been read or moved for a long time after being written, it is considered "colder" and less stable than data written later and read more frequently. Conversely, it is considered "hot" data and has better stability. The data status of physical blocks can determine whether the data is hot or cold. Data status can include, but is not limited to, physical block usage time, the number of valid pages in the physical block, and the number of times the physical block data is read. The average number of reads can be calculated from the number of reads and the amount of valid data. The lower the average number of reads, the colder the data. In other words, the fewer times the valid data on a physical block is read, the lower the probability of software error correction and the higher the probability of the data itself being corrupted; this is considered "cold" data and should be inspected first.
[0020] In one specific embodiment, determining the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard drive to be inspected may include: determining the inspection priority of several physical blocks whose corresponding physical block usage time is greater than a preset time and whose number of effective pages is greater than a preset page number threshold as a first priority; determining the inspection priority of several physical blocks whose corresponding physical block usage time is greater than the preset time and whose number of effective pages is not greater than the preset page number threshold as a second priority; determining the inspection priority of several physical blocks whose corresponding physical block usage time is not greater than the preset time as a third priority; and determining the current physical block to be inspected in the current inspection cycle from each physical block based on the inspection priority of each physical block in the hard drive to be inspected. It should be noted that, for the above three parameters characterizing the data status of physical blocks, data status characterizing different inspection priorities can be further divided; the longer the physical block usage time, the greater the probability of the physical block error, which can be divided by the preset time; and, the number of effective pages of the physical block can be further divided, which can be achieved by the preset page number threshold. Specifically, the longer a physical block has been used and the more valid pages it contains, the higher the probability of a physical block error. During the inspection cycle, these physical blocks can be assigned the highest priority and should be inspected as soon as possible. Conversely, if a physical block has a long usage time but a low number of valid pages, the probability of an error is relatively low, and these physical blocks can be assigned the second priority. Furthermore, if a physical block has a short usage time, the probability of an error is low, and these physical blocks can be assigned the third priority. Subsequently, when inspecting the physical blocks of the hard drive, the physical blocks that need to be inspected can be determined based on their respective inspection priorities. In a specific embodiment, such as... Figure 2 The inspection priority determination process shown involves updating the usage time of idle physical blocks when data is written to them. At this time, the physical blocks contain relatively little data and have a short usage time, classifying them as third priority during the inspection cycle. Correspondingly, physical blocks whose usage time exceeds a preset time and whose effective page count (data volume) is not greater than a preset page count threshold are classified as second priority, while those with more than the preset page count threshold are classified as first priority. It can be understood that a first-priority physical block, after its data volume decreases and its effective page count falls below the preset page count threshold, can change from first priority to second priority. Furthermore, corresponding inspection operations are implemented based on the inspection priorities of different physical blocks. If a data inspection is abnormal, a forced garbage collection operation can be triggered to forcibly move the data from the abnormal physical block, restoring it to its open state. After a normal physical block inspection is completed, the status of each physical block and the relevant inspection priorities can be updated for the next inspection cycle.
[0021] In another specific embodiment, determining the current physical block to be inspected in the current inspection cycle based on the inspection priority of each physical block in the hard drive to be inspected may include: sorting each physical block in ascending order based on the inspection priority and the average number of data reads of related physical blocks in the hard drive to be inspected, to obtain sorted physical blocks corresponding to each inspection priority; the average number of data reads is the ratio of the number of data reads of a physical block to the number of valid pages of a physical block; and determining the current physical block to be inspected in the current inspection cycle from the sorted physical blocks. Specifically, after dividing the inspection priority according to the data status of each physical block, a single priority may correspond to multiple physical blocks. In this case, multiple physical blocks with the same inspection priority can be sorted according to the average number of data reads of the physical blocks; related physical blocks can be sorted according to the average number of data reads of each physical block in ascending order, and then the current physical block to be inspected in the current inspection cycle can be determined according to the inspection priority and the order of related physical blocks.
[0022] In another specific embodiment, determining the current physical block to be inspected in the current inspection cycle from each of the sorted physical blocks may include: determining the current physical block to be inspected in the current inspection cycle sequentially from the first sorted physical blocks corresponding to the first priority; if the first sorted physical blocks have all completed data inspection operations in the current inspection cycle, then determining the current physical block to be inspected in the current inspection cycle sequentially from the second sorted physical blocks corresponding to the second priority; if the second sorted physical blocks have all completed data inspection operations in the current inspection cycle, then directly ending the current inspection cycle. Specifically, during the inspection process, the physical blocks of the first priority are inspected first. The first priority corresponds to the first sorted physical blocks, and the physical blocks that need to be inspected at the current moment can be determined sequentially, resulting in the physical blocks to be inspected. It can be understood that if all physical blocks corresponding to the first priority have completed their inspection operations in the current inspection cycle, then the physical blocks that need to be inspected at the current moment are determined sequentially from the second sorted physical blocks corresponding to the second priority, i.e., the physical blocks to be inspected. Correspondingly, if all physical blocks corresponding to the second priority have completed their inspection operations in the current inspection cycle, and considering that the usage time of the physical blocks corresponding to the third priority is less than the preset time and the probability of error is extremely low, then the relevant physical blocks of the third priority can be skipped, and the current inspection cycle can be ended directly. In some embodiments, it is also possible to select to inspect the physical blocks of the third priority.
[0023] Step S12: Adjust the inspection data range of the physical block to be inspected according to the inspection results of the physical block to be inspected in the previous inspection cycle to obtain the current inspection data range corresponding to the physical block to be inspected.
[0024] In this embodiment, the physical block to be inspected at the current moment of the current inspection cycle can be determined through the above steps. Then, the inspection data range for the current inspection cycle can be adjusted based on the data inspection results of the physical block to be inspected in the previous inspection cycle, thus obtaining the current inspection data range of the physical block to be inspected in the current inspection cycle. It is understood that when a physical block is inspected for the first time, the inspection operation can be performed according to the default inspection data range. However, during the inspection process of subsequent cycles, the data inspection range for the current inspection cycle can be adjusted based on the data inspection results of the physical block in the previous inspection cycle, thus obtaining the current inspection data range of the physical block specific to the current inspection cycle.
[0025] In one specific embodiment, adjusting the inspection data range of the physical block to be inspected based on the data inspection results of the physical block to be inspected in the previous inspection cycle to obtain the current inspection data range corresponding to the physical block to be inspected may include: if the inspection data range of the physical block to be inspected in the previous inspection cycle is a preset data range, and the corresponding data inspection results indicate that the bit error rate is not greater than a preset bit error threshold, then the preset data range is determined as the current inspection data range corresponding to the physical block to be inspected; if the inspection data range of the physical block to be inspected in the previous inspection cycle is greater than the preset data range, and the corresponding data inspection results indicate that the bit error rate is not greater than the preset bit error threshold... If the code threshold is not specified, the inspection data range of the current physical block to be inspected in the previous inspection cycle is reduced according to the preset range adjustment parameters, and the reduced data range is determined as the current inspection data range corresponding to the current physical block to be inspected; the reduced data range is not less than the preset data range; if the inspection data range of the current physical block to be inspected in the previous inspection cycle is not less than the preset data range, and the corresponding data inspection result indicates that the bit error rate is greater than the preset bit error threshold, the inspection data range of the current physical block to be inspected in the previous inspection cycle is expanded according to the preset range adjustment parameters, and the expanded data range is determined as the current inspection data range corresponding to the current physical block to be inspected. Specifically, if the data inspection range of a physical block in the previous inspection cycle was the default preset data range, and the data inspection result in the previous inspection cycle indicated that the bit error rate was not greater than the preset bit error threshold, the data in the physical block can be considered normal. In this inspection cycle, the preset inspection range can be used to carry out the inspection operation for that physical block. Conversely, if the data inspection range of a physical block in the previous inspection cycle was greater than the preset data range, and the corresponding data inspection result indicated that the bit error rate was not greater than the preset bit error threshold, it indicates that the data of that physical block was normal in the previous inspection. In this case, the data inspection range of that physical block in the previous inspection cycle can be reduced according to the preset range adjustment parameters, and the reduced data range can be used for the inspection operation of that physical block in this inspection cycle. It should be noted that the reduced data range is not less than the preset data range, that is, the minimum data inspection range of the physical block during inspection is the preset data range, and the maximum data inspection range can be the entire physical block. Furthermore, if the data inspection range of a physical block in the previous inspection cycle is not less than the preset data range, and the corresponding data inspection result indicates that the bit error rate is greater than the preset bit error threshold, it indicates that the data of the physical block is at high risk of error. In this case, the data inspection range of the physical block can be expanded in the current inspection cycle. The previous data inspection range of the physical block can be expanded according to the preset range adjustment parameters to obtain the current inspection data range of the physical block for this data inspection.Understandably, if the data inspection range of the physical block in the previous inspection cycle is the preset data range, and the corresponding data inspection result indicates that the bit error rate is lower than the preset bit error threshold, then the physical block can continue to be inspected in this inspection cycle according to the budgeted data range.
[0026] In specific embodiments, such as Figure 3 The data inspection range adjustment process is shown below. When inspecting data for a physical block, the inspection results can be divided into three categories: First, data read successfully, and the bit error rate is below the threshold (data is accurate, no protection is needed); second, data read successfully, and the bit error rate is above the threshold (some data is inaccurate, but can be recovered by software and the read voltage is updated); third, data read fails (data is completely invalid, indicating that the entire physical block is unreliable and data needs to be moved for protection, i.e., forced garbage collection). When inspecting a physical block, a physical block can be divided into multiple data areas, each area serving as the smallest unit for data inspection. During inspection, the default inspection range is the pre-set weak area prone to errors. If inspection result 2 occurs, the inspection range is expanded in the next inspection, that is, not only the weak area is inspected, but also the data in its adjacent areas. If result 2 still occurs in the adjacent areas, the range is expanded in the next inspection until the entire physical block is inspected. Conversely, centering on the weak area, if the inspection results for the two outermost adjacent data areas both show only result 1, the inspection range can be narrowed in the next inspection, i.e., the outermost area is removed until only the weak area (the default inspection range) remains. Additionally, if inspection result 3 appears, the inspection is immediately stopped and data migration is performed. In the next inspection, the inspection range can be set to the entire physical block, assuming that the probability of error in the entire physical block's data is extremely high.
[0027] Step S13: Perform a data inspection operation on the physical block to be inspected using the current inspection data range to obtain the data inspection result of the physical block to be inspected in the current inspection cycle, so as to complete the data inspection operation on each physical block of the hard disk to be inspected.
[0028] In this embodiment of the application, the above steps can determine the current physical block to be inspected in the current inspection cycle and the corresponding adjusted current inspection data range. Then, based on the current inspection data range, a data inspection operation is performed on the current physical block to be inspected to obtain the data inspection result of the current physical block to be inspected in the current inspection cycle. It can be understood that the data inspection result of each physical block obtained in the current inspection cycle can be used as a parameter to calculate the data inspection range of the relevant physical block when it is inspected in the next inspection cycle.
[0029] In one specific embodiment, after obtaining the data inspection result of the currently inspected physical block in the current inspection cycle, the process may further include: if the data inspection result indicates a data reading failure, triggering a forced data migration operation for the data in the currently inspected physical block, so as to move the data in the currently inspected physical block to a new physical block, so that the data inspection operation can be performed on the new physical block in the next inspection cycle. Specifically, a physical block may be damaged due to special reasons, resulting in the inability to read data. The corresponding data inspection result indicates a data reading failure, indicating that the security of the entire physical block is unreliable. In this case, it is necessary to protect the data in the physical block by forced migration and reverse migration, i.e., forced garbage collection, to restore the problematic physical block to an idle state.
[0030] Therefore, this application can determine hot and cold data by combining the data status of each physical block in the hard drive, prioritizing the inspection of cold data. Under the same performance load, higher data error correction expectations can be achieved through data inspection, improving inspection efficiency and accuracy. Furthermore, this application can expand or shrink the data inspection range of the current physical block by combining the hot and cold data in the physical block and the inspection results of the same physical block in the previous inspection cycle. The more errors in the physical block, the larger the inspection range, the more data needs to be inspected, and the more error data can be covered. Conversely, less performance waste can be reduced. That is, the data inspection range of a single physical block changes dynamically in different cycles, which can obtain more accurate inspection results of the physical block and improve the inspection effect of the hard drive.
[0031] like Figure 4 As shown in the figure, this application discloses a data inspection device, including: The physical block determination module 11 is used to determine the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard disk to be inspected. The inspection data range adjustment module 12 is used to adjust the inspection data range of the physical block to be inspected according to the data inspection results of the physical block to be inspected in the previous inspection cycle, so as to obtain the current inspection data range corresponding to the physical block to be inspected. The data inspection module 13 is used to perform data inspection operations on the physical block to be inspected using the current inspection data range, and obtain the data inspection results of the physical block to be inspected in the current inspection cycle, so as to complete the data inspection operation on each physical block of the hard disk to be inspected.
[0032] Therefore, this application combines the data status of each physical block in the hard drive with the inspection results of the physical block in the previous inspection cycle to adjust the data inspection range of the current physical block; the data inspection range of a single physical block changes dynamically in different cycles, which can obtain more accurate physical block inspection results and improve the inspection effect of the hard drive.
[0033] In one specific embodiment, the physical block determination module 11 may include: The first priority determination unit is used to determine the inspection priority of several physical blocks whose corresponding physical block usage time is greater than a preset time and whose number of valid pages is greater than a preset page number threshold as the first priority. The second priority determination unit is used to determine the inspection priority of a number of physical blocks whose corresponding physical block usage time is greater than the preset time and whose number of valid pages is not greater than the preset page number threshold as the second priority. The third priority determination unit is used to determine the inspection priority of a number of physical blocks whose corresponding physical block usage time is not greater than the preset time as the third priority. The first physical block determination submodule is used to determine the current physical block to be inspected in the current inspection cycle from each of the physical blocks based on the inspection priority corresponding to each physical block in the hard disk to be inspected.
[0034] In another specific embodiment, the first physical block determining submodule may include: The physical block sorting unit is used to sort the physical blocks in ascending order based on the inspection priority and the average number of data reads of the relevant physical blocks in the hard disk to be inspected, so as to obtain the sorted physical blocks corresponding to each inspection priority; the average number of data reads is the ratio of the number of data reads of the physical block to the number of effective pages of the physical block. The second physical block determination submodule is used to determine the current physical block to be inspected in the current inspection cycle from the sorted physical blocks.
[0035] In one specific embodiment, the second physical block determining submodule may include: The first physical block determination unit is used to determine the current physical block to be inspected in the current inspection cycle from the first sorted physical blocks corresponding to the first priority in order. The second physical block determination unit is used to determine the current physical block to be inspected in the current inspection cycle from the second sorted physical blocks corresponding to the second priority in order when the first sorted physical blocks have all completed the data inspection operation in the current inspection cycle. The inspection cycle end unit is used to directly end the current inspection cycle when the second sorted physical blocks have completed the data inspection operation in the current inspection cycle.
[0036] In one specific embodiment, the inspection data range adjustment module 12 may include: The first adjustment unit is used to determine the preset data range as the current inspection data range corresponding to the current physical block to be inspected when the inspection data range of the current physical block to be inspected in the previous inspection cycle is a preset data range, and the corresponding data inspection result characterizes the data error rate not greater than a preset error threshold. The second adjustment unit is used to reduce the inspection data range of the current physical block to be inspected in the previous inspection cycle according to a preset range adjustment parameter when the inspection data range of the current physical block to be inspected in the previous inspection cycle is greater than the preset data range, and the corresponding data inspection result characterizes the data error rate as not greater than the preset error threshold. The reduced data range is determined as the current inspection data range corresponding to the current physical block to be inspected. The reduced data range is not less than the preset data range. The third adjustment unit is used to expand the inspection data range of the current physical block to be inspected in the previous inspection cycle according to the preset range adjustment parameters when the inspection data range of the current physical block to be inspected in the previous inspection cycle is not less than the preset data range, and the corresponding data inspection result indicates that the bit error rate is greater than the preset bit error threshold, and then determines the expanded data range as the current inspection data range corresponding to the current physical block to be inspected.
[0037] In one specific embodiment, the device may further include: The data migration module is used to trigger a forced migration operation on the data in the currently inspected physical block when the data inspection result indicates that data reading has failed. The forced migration operation moves the data in the currently inspected physical block to a new physical block so that the data inspection operation can be performed on the new physical block in the next inspection cycle.
[0038] Furthermore, embodiments of this application also disclose an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0039] Figure 5This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data inspection method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0040] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0041] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0042] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the data inspection method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0043] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed data inspection method. The specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0044] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0045] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0046] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0047] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0048] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A data inspection method, characterized in that, include: The current physical block to be inspected in the current inspection cycle is determined based on the data status of each physical block of the hard drive to be inspected. The inspection data range of the physical block to be inspected is adjusted based on the inspection results of the physical block to be inspected in the previous inspection cycle to obtain the current inspection data range corresponding to the physical block to be inspected. The data inspection operation is performed on the physical block to be inspected using the current inspection data range to obtain the data inspection result of the physical block to be inspected in the current inspection cycle, so as to complete the data inspection operation of each physical block of the hard disk to be inspected.
2. The data inspection method according to claim 1, characterized in that, The data status includes physical block usage time, number of valid pages in the physical block, and number of times the physical block data is read.
3. The data inspection method according to claim 2, characterized in that, The process of determining the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard drive to be inspected includes: The inspection priority of several physical blocks whose physical block usage time is greater than the preset time and whose number of valid pages is greater than the preset page number threshold is determined as the first priority. The inspection priority of several physical blocks whose corresponding physical block usage time is greater than the preset time and whose effective page number is not greater than the preset page number threshold is determined as the second priority. The inspection priority of a number of physical blocks whose corresponding physical block usage time is no greater than the preset time is determined as the third priority. Based on the inspection priority of each physical block in the hard disk to be inspected, the current physical block to be inspected in the current inspection cycle is determined from each physical block.
4. The data inspection method according to claim 3, characterized in that, The step of determining the current physical block to be inspected in the current inspection cycle from the physical blocks in the hard disk to be inspected based on the inspection priority corresponding to each physical block includes: The physical blocks are sorted in ascending order based on their inspection priority and the average number of data reads of the relevant physical blocks in the hard drive to be inspected, resulting in sorted physical blocks corresponding to each inspection priority; the average number of data reads is the ratio of the number of data reads of a physical block to the number of valid pages in the physical block. Determine the current physical block to be inspected in the current inspection cycle from the sorted physical blocks.
5. The data inspection method according to claim 4, characterized in that, The step of determining the current physical block to be inspected in the current inspection cycle from the sorted physical blocks includes: The current physical block to be inspected in the current inspection cycle is determined sequentially from the first sorted physical blocks corresponding to the first priority. If the first sorted physical blocks have all completed data inspection operations in the current inspection cycle, then the current physical block to be inspected in the current inspection cycle is determined sequentially from the second sorted physical blocks corresponding to the second priority. If all the second sorted physical blocks have completed data inspection operations in the current inspection cycle, then the current inspection cycle will end directly.
6. The data inspection method according to any one of claims 1 to 5, characterized in that, The step of adjusting the inspection data range of the physical block to be inspected based on the data inspection results of the physical block to be inspected in the previous inspection cycle, to obtain the current inspection data range corresponding to the physical block to be inspected, includes: If the inspection data range of the physical block to be inspected in the previous inspection cycle is a preset data range, and the corresponding data inspection result indicates that the bit error rate is not greater than a preset bit error threshold, then the preset data range is determined as the current inspection data range corresponding to the physical block to be inspected. If the inspection data range of the current physical block to be inspected in the previous inspection cycle is greater than the preset data range, and the corresponding data inspection result indicates that the bit error rate is not greater than the preset bit error threshold, then the inspection data range of the current physical block to be inspected in the previous inspection cycle is reduced according to the preset range adjustment parameter, and the reduced data range is determined as the current inspection data range corresponding to the current physical block to be inspected; the reduced data range is not less than the preset data range. If the inspection data range of the current physical block to be inspected in the previous inspection cycle is not less than the preset data range, and the corresponding data inspection result indicates that the bit error rate is greater than the preset bit error threshold, then the inspection data range of the current physical block to be inspected in the previous inspection cycle is expanded according to the preset range adjustment parameter, and the expanded data range is determined as the current inspection data range corresponding to the current physical block to be inspected.
7. The data inspection method according to any one of claims 1 to 5, characterized in that, After obtaining the data inspection result of the physical block to be inspected in the current inspection cycle, the method further includes: If the data inspection result indicates that data reading has failed, a forced migration operation is triggered on the data in the currently inspected physical block. The data in the currently inspected physical block is moved to a new physical block through the forced migration operation so that the data inspection operation can be performed on the new physical block in the next inspection cycle.
8. A data inspection device, characterized in that, include: The physical block determination module is used to determine the current physical block to be inspected in the current inspection cycle based on the data status of each physical block of the hard drive to be inspected; The inspection data range adjustment module is used to adjust the inspection data range of the physical block to be inspected based on the data inspection results of the physical block to be inspected in the previous inspection cycle, so as to obtain the current inspection data range corresponding to the physical block to be inspected. The data inspection module is used to perform data inspection operations on the physical block to be inspected using the current inspection data range, and obtain the data inspection results of the physical block to be inspected in the current inspection cycle, so as to complete the data inspection operation on each physical block of the hard disk to be inspected.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the data inspection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the data inspection method as described in any one of claims 1 to 7.