WO2024109236A1 - Metadata check method and system, and computer device and non-volatile readable storage medium - Google Patents

Metadata check method and system, and computer device and non-volatile readable storage medium Download PDF

Info

Publication number
WO2024109236A1
WO2024109236A1 PCT/CN2023/115981 CN2023115981W WO2024109236A1 WO 2024109236 A1 WO2024109236 A1 WO 2024109236A1 CN 2023115981 W CN2023115981 W CN 2023115981W WO 2024109236 A1 WO2024109236 A1 WO 2024109236A1
Authority
WO
WIPO (PCT)
Prior art keywords
metadata
level
verification
check
discrete
Prior art date
Application number
PCT/CN2023/115981
Other languages
French (fr)
Chinese (zh)
Inventor
费卫宏
白建
王萌萌
Original Assignee
苏州元脑智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏州元脑智能科技有限公司 filed Critical 苏州元脑智能科技有限公司
Publication of WO2024109236A1 publication Critical patent/WO2024109236A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2284Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing by power-on test, e.g. power-on self test [POST]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing

Definitions

  • the present application relates to the field of storage technology, and in particular to a metadata verification method, system, computer device and non-volatile readable storage medium.
  • the present application proposes a metadata verification method, system, computer device and non-volatile readable storage
  • the medium checks the metadata during the operation of the hard disk, so as to detect abnormal metadata in time to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, it reduces the CPU (Central Processing Unit) occupancy rate during the verification process to avoid affecting the operation speed of the main business of the hard disk.
  • CPU Central Processing Unit
  • one aspect of an embodiment of the present application provides a metadata verification method, comprising the following steps:
  • the metadata inspection logic is triggered to inspect the metadata based on the first-level initial verification set.
  • the method further comprises:
  • a host In response to the discrete verification of the metadata failing, a host is notified of the occurrence of a metadata asynchronous event, and the metadata patrol logic is disabled.
  • the discrete verification logic includes:
  • the metadata is discretely verified based on the secondary initial verification set in each discrete verification cycle.
  • the metadata patrol logic includes:
  • the second timer is turned off.
  • the method further comprises:
  • the first timer is opened and the metadata inspection logic is exited.
  • the metadata patrol logic includes:
  • the calculated first-level checksum value is compared with the corresponding first-level initial checksum value in the initial checksum set;
  • the step of calculating the first-level check value of each block of metadata in turn according to the inspection cycle is returned to calculate the first-level check value of the next block of metadata.
  • the method further comprises:
  • the second timer is turned off and the metadata inspection logic is disabled.
  • the method further comprises:
  • the occurrence of the metadata asynchronous event is notified to the host, and the second timer is turned off and the metadata patrol logic is disabled.
  • the method further comprises:
  • the information that the current second-level check set is inconsistent with the second-level initial check set is recorded in the log, and the second timer is turned off and the metadata inspection logic is disabled.
  • the method further comprises:
  • the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
  • the metadata discrete verification logic includes:
  • the method further comprises:
  • the method further comprises:
  • the method further comprises:
  • the host In response to the failure of the discrete verification of metadata, the host is notified of the occurrence of a metadata asynchronous event, and the information that the current secondary verification set is inconsistent with the secondary initial verification set is recorded in the log, and the metadata inspection logic is disabled.
  • calculating the primary initial checksum for each block of metadata includes:
  • the first-level initial checksum of each block of metadata is calculated based on the cyclic redundancy check.
  • calculating the primary initial check set to obtain the secondary initial check set includes:
  • a cyclic redundancy check is performed on the first-level initial check set to obtain a second-level initial check set.
  • the method further comprises:
  • the first-level initial check value is recalculated based on the updated metadata, and the first-level initial check set and the second-level initial check set are updated based on the recalculated first-level initial check value.
  • Another aspect of the embodiment of the present application further provides a metadata verification system, including:
  • a first calculation module configured to divide all metadata of the hard disk into blocks in response to the hard disk being powered on, and calculate a first-level initial checksum value of each block of metadata to obtain a first-level initial checksum set;
  • a second calculation module configured to calculate the first-level initial check set to obtain a second-level initial check set
  • An opening module configured to open a first timer and set a discrete verification period
  • a discrete verification module is configured to trigger a metadata discrete verification logic according to a discrete verification period to perform a discrete verification on the metadata based on the secondary initial verification set;
  • the inspection module is configured to trigger the metadata inspection logic to inspect the metadata based on the first-level initial inspection set in response to the discrete verification of the metadata passing.
  • a computer device including: at least one processor; and a memory, wherein the memory stores a computer program executable on the processor, and the steps of the above method are implemented when the computer program is executed by the processor.
  • a non-volatile readable storage medium which stores a computer program that implements the above method steps when executed by a processor.
  • the present application has at least the following beneficial technical effects: by checking the metadata during the operation of the hard disk, abnormal metadata can be discovered in a timely manner, thereby ensuring the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, the CPU occupancy rate during the verification process is reduced to avoid affecting the operating speed of the main business of the hard disk.
  • FIG1 is a block diagram of an embodiment of a metadata verification method provided by the present application.
  • FIG2 is a schematic diagram of an embodiment of a metadata verification system provided by the present application.
  • FIG3 is a schematic diagram of the structure of a computer device according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the structure of an embodiment of a non-volatile readable storage medium provided in the present application.
  • the first aspect of the embodiment of the present application proposes an embodiment of a metadata verification method. As shown in FIG1 , it includes the following steps:
  • the entire block of metadata is processed in blocks, and each block of metadata is verified and calculated, such as CRC (Cyclic Redundancy Check) calculation, and the calculation results are saved in a global array, where the array subscript indicates the corresponding block of metadata, and the array value indicates the first-level initial verification value of the block of metadata.
  • This array is called the first-level initial verification set. Since the smaller the size of each block of metadata, the smaller the discrete time consumed during verification, the smaller the impact on the hard disk performance, but it will increase space consumption. Therefore, the size of each block of metadata is weighed according to the actual situation.
  • the first-level initial check set is calculated for check calculation, such as CRC calculation, that is, the generated global array check is calculated and saved.
  • This value is called the second-level initial check value; each time the software actively updates the metadata, it only needs to recalculate the first-level initial check set array value corresponding to the block where the current data is located, and then update the corresponding second-level initial check value.
  • a first timer is used to trigger a metadata discrete verification logic, and after the metadata discrete verification logic is triggered, the first timer is turned off; when the metadata discrete verification passes, the metadata inspection logic is triggered; when the metadata discrete verification fails, the metadata asynchronous event is notified to the host, so as to timely detect the abnormality of the metadata, and by reporting the abnormality to the host, developers and maintenance personnel can obtain metadata abnormality information in time, and can improve the troubleshooting efficiency during the operation of the hard disk.
  • the metadata discrete verification logic can be implemented in the following way: calculate the first-level verification set of the current metadata, and the second-level verification set of the first-level verification set, compare the calculated second-level verification set of the current metadata with the second-level initial verification set, and if the second-level verification set of the current metadata is consistent with the second-level initial verification, the verification passes; if the second-level verification set of the current metadata is inconsistent with the second-level initial verification, the verification fails.
  • the metadata inspection logic can be implemented in the following way: start the second timer, trigger the verification of each piece of metadata based on the second timer, that is, verify a piece of metadata in each inspection cycle. If the verification passes, continue to verify the next piece of metadata. If the verification fails, notify the host of the metadata asynchronous event.
  • the detailed process of each inspection cycle is as follows:
  • the check Calculate the first-level check value of the current metadata and compare it with the corresponding first-level initial check value in the first-level initial check set. If the first-level check value of the current metadata is consistent with the corresponding first-level initial check value in the first-level initial check set, the check passes; if the first-level check value of the current metadata is inconsistent with the corresponding first-level initial check value in the first-level initial check set, the check fails.
  • the embodiment of the present application checks metadata during the operation of the hard disk, thereby promptly discovering abnormal metadata to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, reduces the CPU occupancy rate during the verification process to avoid affecting the operation speed of the main business of the hard disk; and by promptly discovering metadata anomalies, improves the troubleshooting efficiency during the operation of the hard disk.
  • the method further comprises:
  • a host In response to the discrete verification of the metadata failing, a host is notified of the occurrence of a metadata asynchronous event, and the metadata patrol logic is disabled.
  • the discrete verification logic includes:
  • the metadata is discretely verified based on the secondary initial verification set in each discrete verification cycle.
  • the metadata patrol logic includes:
  • the second timer is turned off.
  • the method further comprises:
  • the first timer is opened and the metadata inspection logic is exited.
  • the metadata patrol logic includes:
  • the calculated first-level checksum value is compared with the corresponding first-level initial checksum value in the initial checksum set;
  • the step of calculating the first-level check value of each block of metadata in turn according to the inspection cycle is returned to calculate the first-level check value of the next block of metadata.
  • the method further comprises:
  • the second timer is turned off and the metadata inspection logic is disabled.
  • the method further comprises:
  • the occurrence of the metadata asynchronous event is notified to the host, and the second timer is turned off and the metadata patrol logic is disabled.
  • the method further comprises:
  • the information that the current second-level check set is inconsistent with the second-level initial check set is recorded in the log, and the second timer is turned off and the metadata inspection logic is disabled.
  • the method further comprises:
  • the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
  • the metadata inspection logic is implemented in the following manner:
  • step S14 when the first-level check value is consistent with the corresponding first-level initial check value in the initial check set, return to step S12 to calculate the first-level check value of the next piece of metadata;
  • the metadata is checked during the operation of the hard disk, and abnormal metadata can be discovered in time to ensure the completeness and correctness of the data; and the CPU occupancy rate during the verification process is reduced to avoid affecting the operation speed of the main business of the hard disk; and through the timely discovery of metadata anomalies, the troubleshooting efficiency during the operation of the hard disk is improved.
  • the metadata discrete verification logic includes:
  • the method further comprises:
  • the method further comprises:
  • the method further comprises:
  • the host In response to the failure of the discrete verification of metadata, the host is notified of the occurrence of a metadata asynchronous event, and the information that the current secondary verification set is inconsistent with the secondary initial verification set is recorded in the log, and the metadata inspection logic is disabled.
  • calculating the primary initial checksum for each block of metadata includes:
  • the first-level initial checksum value of each block of metadata is calculated based on the cyclic redundancy check.
  • calculating the primary initial check set to obtain the secondary initial check set includes:
  • a cyclic redundancy check is performed on the first-level initial check set to obtain a second-level initial check set.
  • the metadata discrete verification logic is implemented in the following manner:
  • the host In response to the metadata discrete verification failing, the host is notified of the occurrence of a metadata asynchronous event, and the information that the current secondary verification set is inconsistent with the secondary initial verification set is recorded in the log, and the metadata inspection logic is disabled.
  • the metadata is checked during the operation of the hard disk, and abnormal metadata can be discovered in time to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, the CPU occupancy rate during the verification process is reduced to avoid affecting the operation speed of the main business of the hard disk; and by timely discovering metadata anomalies, the troubleshooting efficiency during the operation of the hard disk is improved.
  • the method further comprises:
  • the first-level initial check value is recalculated based on the updated metadata, and the first-level initial check set and the second-level initial check set are updated based on the recalculated first-level initial check value.
  • step S115 If the verification of step S114 is passed, the metadata inspection logic is triggered by the flag bit, the data inspection is started, the second timer is started, and the process goes to step S117;
  • step S116 If the step S114 fails to pass the verification, the asynchronous event is notified to the host, the LOG is recorded, and then the inspection process is disabled;
  • the second timer triggers metadata check of each block, that is, calculates the CRC check value of a block of metadata, and compares it with the corresponding CRC value saved in the primary CRC set saved in step S110;
  • step S118 if the verification of step S117 is passed, the metadata of the next block is verified, that is, the next data unit is offset, the CPU is released, and the second timer is triggered to enter the next data unit verification;
  • step S117 If the check in step S117 fails, the asynchronous event is notified to the host, a LOG is recorded, the second timer is turned off, and then the inspection process is disabled.
  • the embodiment of the present application checks metadata during the operation of the hard disk, thereby promptly discovering abnormal metadata to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, reduces the CPU occupancy rate during the verification process to avoid affecting the operation speed of the main business of the hard disk; and by promptly discovering metadata anomalies, improves the troubleshooting efficiency during the operation of the hard disk.
  • an embodiment of the present application further provides a metadata verification system, including:
  • a first calculation module 110 wherein the first calculation module 110 is configured to divide all metadata of the hard disk into blocks in response to the hard disk being powered on, and calculate a first-level initial checksum value of each block of metadata to obtain a first-level initial checksum set;
  • a second calculation module 120 the second calculation module 120 is configured to calculate the first-level initial check set to obtain a second-level initial check set;
  • the start module 130 is configured to start a first timer and set a discrete check period
  • a discrete verification module 140 the discrete verification module 140 is configured to trigger a metadata discrete verification logic according to a discrete verification period to perform a discrete verification on the metadata based on the secondary initial verification set;
  • the inspection module 150 is configured to trigger the metadata inspection logic to inspect the metadata based on the primary initial inspection set in response to the discrete verification of the metadata passing.
  • the metadata is checked during the operation of the hard disk, so as to timely discover abnormal metadata.
  • the completeness and correctness of the data are guaranteed by using discrete verification and hierarchical verification to reduce the CPU usage during the verification process and avoid affecting the running speed of the main business of the hard disk.
  • a general purpose processor may be a microprocessor, but alternatively, the processor may be any conventional processor, controller, microcontroller, or state machine.
  • the processor may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
  • the steps of the method or algorithm described in conjunction with the disclosure here can be directly included in hardware, in a software module executed by a processor, or in a combination of the two.
  • the software module can reside in a non-volatile readable storage medium of any other form known in the art, such as a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or a non-volatile readable storage medium.
  • An exemplary non-volatile readable storage medium is coupled to a processor so that the processor can read information from the non-volatile readable storage medium or write information to the non-volatile readable storage medium.
  • the non-volatile readable storage medium can be integrated with the processor.
  • the processor and the non-volatile readable storage medium can reside in an ASIC.
  • the ASIC can reside in a user terminal.
  • the processor and the non-volatile readable storage medium can reside in a user terminal as a discrete component.
  • an embodiment of the present application further provides a computer device 30, which includes a processor 310 and a memory 320, wherein the memory 320 stores a computer program 321 that can be run on the processor, and the processor 310 executes the steps of the above method when executing the program.
  • the memory as a non-volatile, non-volatile readable storage medium, can be configured to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions/modules corresponding to the metadata verification method in the embodiment of the present application.
  • the processor executes various functional applications and data processing of the system by running the non-volatile software programs, instructions and modules stored in the memory, that is, the metadata verification method of the above method embodiment is implemented.
  • the memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the system, etc.
  • the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device.
  • the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • an embodiment of the present application further provides a non-volatile readable storage medium 40 , which stores a computer program 410 that executes the above method when executed by a processor.
  • the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile readable storage medium.
  • the program When executed, it can include the processes of the embodiments of the above-mentioned methods.
  • the non-volatile readable storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc.
  • the above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned arbitrary method embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present application relates to the technical field of storage. In particular, disclosed are a metadata check method and system, and a computer device and a non-volatile readable storage medium. The method comprises: in response to a hard disk being powered on, partitioning all metadata of the hard disk into blocks, and calculating a first-level initial check value of each block of metadata, so as to obtain a first-level initial check set; performing calculation on the first-level initial check set to obtain a second-level initial check set; starting a first timer, and setting a discrete check cycle; triggering metadata discrete-check logic according to the discrete check cycle, so as to perform a discrete check on the metadata on the basis of the second-level initial check set; and in response to the metadata passing the discrete check, triggering metadata inspection logic, so as to perform inspection on the metadata on the basis of the first-level initial check set. By means of the solution of the present application, metadata can be checked during the operation process of a hard disk, such that abnormal metadata can be found in a timely manner, thereby ensuring the completeness and correctness of data.

Description

元数据校验方法、系统、计算机设备及非易失性可读存储介质Metadata verification method, system, computer device and non-volatile readable storage medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2022年11月21日提交中国专利局,申请号为202211455849.9,申请名称为“一种元数据校验方法、系统、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application filed with the China Patent Office on November 21, 2022, with application number 202211455849.9 and application name “A Metadata Verification Method, System, Computer Device and Storage Medium”, all contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及存储技术领域,尤其涉及一种元数据校验方法、系统、计算机设备及非易失性可读存储介质。The present application relates to the field of storage technology, and in particular to a metadata verification method, system, computer device and non-volatile readable storage medium.
背景技术Background technique
在SSD(固态硬盘(Solid State Disk或Solid State Drive,简称SSD))设备运行过程中,对于需要频繁访问的关键数据,都会加载到DRAM(Dynamic Random Access Memory,动态随机存取存储器DRAM)中,需要用到的时候,直接访问内存,十分快速便捷。当前SSD设备中,读写流程中元数据的数据量比较大且在设备运行中,一直存放在内存中。随着SSD设备的长时间稳定运行,SSD设备温度持续处于较高的状态,此时从内存中读取元数据,会存在以下问题:During the operation of SSD (Solid State Disk or Solid State Drive, SSD for short), key data that needs to be accessed frequently will be loaded into DRAM (Dynamic Random Access Memory). When needed, the memory can be accessed directly, which is very fast and convenient. In current SSD devices, the amount of metadata in the read and write process is relatively large and is always stored in the memory during device operation. As the SSD device runs stably for a long time, the temperature of the SSD device continues to be high. At this time, reading metadata from the memory will cause the following problems:
在软件上,由于软件误操作,或是地址越界访问,导致内存中的元数据被篡改,但是元数据使用者感知不到,使用了错误的数据,导致SSD运行异常,此时难以确定是元数据本身生成时就是错误的,还是在运行过程中被软件误修改的,抑或是其他逻辑有问题导致的,因此没法对问题进行快速定位和解决。In terms of software, due to software misoperation or out-of-bounds address access, the metadata in the memory is tampered with, but the metadata user is unaware of it and uses the wrong data, causing the SSD to operate abnormally. At this time, it is difficult to determine whether the metadata itself is incorrect when it is generated, or is mistakenly modified by the software during operation, or is caused by other logical problems. Therefore, it is impossible to quickly locate and solve the problem.
在硬件上,SSD在高温、长时间运行、电磁干扰等恶劣环境下,内存中的数据有小概率会出现变迁。在此前提下,如果SSD感知不到数据有问题,依旧取用此数据进行用户数据读写处理,最严重的情况就会导致用户需要保存的数据丢失,无法读出。而且在SSD设备出现问题之后,开发工程师也无法确定是那个环节引起的,也没有手段来确定问题是否是元数据异常导致的业务流程问题。In terms of hardware, when SSD is in harsh environments such as high temperature, long-term operation, and electromagnetic interference, there is a small probability that the data in the memory will change. Under this premise, if the SSD cannot sense that there is a problem with the data, it will still use this data to read and write user data. In the worst case, the data that the user needs to save will be lost and cannot be read. Moreover, after the SSD device has a problem, the development engineer cannot determine which link caused it, and there is no means to determine whether the problem is a business process problem caused by metadata anomalies.
发明内容Summary of the invention
有鉴于此,本申请提出了一种元数据校验方法、系统、计算机设备及非易失性可读存储 介质,通过在硬盘运行过程中,对元数据进行检查,从而及时发现异常元数据,以此来保证数据的完备性和正确性;并且通过采用离散校验、分级校验的方式,减少校验过程中对CPU(Central Processing Unit,中央处理器)的占用率,避免影响硬盘主要业务的运行速度。In view of this, the present application proposes a metadata verification method, system, computer device and non-volatile readable storage The medium checks the metadata during the operation of the hard disk, so as to detect abnormal metadata in time to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, it reduces the CPU (Central Processing Unit) occupancy rate during the verification process to avoid affecting the operation speed of the main business of the hard disk.
基于上述目的,本申请实施例的一方面提供了一种元数据校验方法,包括如下步骤:Based on the above purpose, one aspect of an embodiment of the present application provides a metadata verification method, comprising the following steps:
响应于硬盘上电,对硬盘的所有元数据进行分块,并计算每块元数据的一级初始校验值,得到一级初始校验集;In response to the hard disk being powered on, all metadata of the hard disk are divided into blocks, and a first-level initial checksum value of each block of metadata is calculated to obtain a first-level initial checksum set;
对一级初始校验集进行计算得到二级初始校验集;Calculate the first-level initial check set to obtain the second-level initial check set;
开启第一定时器,并设置离散校验周期;Start the first timer and set the discrete verification period;
按离散校验周期触发元数据离散校验逻辑以基于二级初始校验集对元数据进行离散校验;Triggering metadata discrete verification logic according to a discrete verification period to perform discrete verification on the metadata based on the secondary initial verification set;
响应于元数据的离散校验通过,则触发元数据巡检逻辑以基于一级初始校验集对元数据进行巡检。In response to the discrete verification of the metadata passing, the metadata inspection logic is triggered to inspect the metadata based on the first-level initial verification set.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于元数据的离散校验未通过,向主机通报发生元数据异步事件,并禁用元数据巡检逻辑。In response to the discrete verification of the metadata failing, a host is notified of the occurrence of a metadata asynchronous event, and the metadata patrol logic is disabled.
在一些实施方式中,离散校验逻辑包括:In some embodiments, the discrete verification logic includes:
关闭第一定时器;Turn off the first timer;
在每个离散校验周期内基于二级初始校验集对元数据进行离散校验。The metadata is discretely verified based on the secondary initial verification set in each discrete verification cycle.
在一些实施方式中,元数据巡检逻辑包括:In some implementations, the metadata patrol logic includes:
开启第二定时器,并设置巡检周期;Start the second timer and set the inspection cycle;
按巡检周期依次计算每块元数据的一级校验值,并基于初始校验集中对应的一级初始校验值对每次计算得到的一级校验值进行校验;Calculate the first-level checksum value of each piece of metadata in turn according to the inspection cycle, and verify the first-level checksum value calculated each time based on the corresponding first-level initial checksum value in the initial checksum set;
响应于所有块的元数据校验完成,则关闭第二定时器。In response to the metadata verification of all blocks being completed, the second timer is turned off.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在关闭第二定时器后,开启第一定时器,并退出元数据巡检逻辑。After the second timer is closed, the first timer is opened and the metadata inspection logic is exited.
在一些实施方式中,元数据巡检逻辑包括:In some implementations, the metadata patrol logic includes:
开启第二定时器,并设置巡检周期;Start the second timer and set the inspection cycle;
按巡检周期与划分的块依次获取硬盘当前的元数据,并依次计算每块元数据的一级校验值; Obtain the current metadata of the hard disk in turn according to the inspection cycle and the divided blocks, and calculate the first-level check value of each block of metadata in turn;
在每计算完一块元数据的一级校验值后,将计算得到的一级校验值与初始校验集中对应的一级初始校验值进行对比;After calculating the first-level checksum value of each piece of metadata, the calculated first-level checksum value is compared with the corresponding first-level initial checksum value in the initial checksum set;
在一级校验值和初始校验集中对应的一级初始校验值一致的情况下,则返回按巡检周期依次计算每块元数据的一级校验值的步骤以计算下一块元数据的一级校验值。When the first-level check value is consistent with the corresponding first-level initial check value in the initial check set, the step of calculating the first-level check value of each block of metadata in turn according to the inspection cycle is returned to calculate the first-level check value of the next block of metadata.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则关闭第二定时器,并禁用元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the second timer is turned off and the metadata inspection logic is disabled.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则向主机通报发生元数据异步事件,并关闭第二定时器以及禁用元数据巡检逻辑。When the first-level check value is inconsistent with the first-level initial check value corresponding to the initial check set, the occurrence of the metadata asynchronous event is notified to the host, and the second timer is turned off and the metadata patrol logic is disabled.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志,并关闭第二定时器以及禁用元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the information that the current second-level check set is inconsistent with the second-level initial check set is recorded in the log, and the second timer is turned off and the metadata inspection logic is disabled.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于所有块的元数据巡检完成,则关闭第二定时器,并开启第一定时器,并退出元数据巡检逻辑。In response to the metadata inspection of all blocks being completed, the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
在一些实施方式中,元数据离散校验逻辑包括:In some implementations, the metadata discrete verification logic includes:
关闭第一定时器;Turn off the first timer;
获取硬盘运行的当前时刻的元数据的一级校验集,并对当前时刻的一级校验集进行计算得到当前时刻的二级校验集;Obtain the first-level checksum of the metadata of the hard disk at the current time, and calculate the first-level checksum at the current time to obtain the second-level checksum at the current time;
对比当前时刻的二级校验集与二级初始校验集;Compare the current secondary checksum with the secondary initial checksum;
在当前时刻的二级校验集与二级初始校验集一致的情况下,则元数据的离散校验通过。When the current secondary check set is consistent with the secondary initial check set, the discrete check of the metadata passes.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在当前时刻的二级校验集与二级初始校验集不一致的情况下,则元数据的离散校验未通过。When the current secondary check set is inconsistent with the secondary initial check set, the discrete check of the metadata fails.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于元数据的离散校验未通过,将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志。In response to the discrete verification of the metadata failing, information that the secondary verification set at the current moment is inconsistent with the secondary initial verification set is recorded in the log.
在一些实施方式中,方法还包括: In some embodiments, the method further comprises:
响应于元数据的离散校验未通过,向主机通报发生元数据异步事件,并将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志,并禁用元数据巡检逻辑。In response to the failure of the discrete verification of metadata, the host is notified of the occurrence of a metadata asynchronous event, and the information that the current secondary verification set is inconsistent with the secondary initial verification set is recorded in the log, and the metadata inspection logic is disabled.
在一些实施方式中,计算每块元数据的一级初始校验值包括:In some implementations, calculating the primary initial checksum for each block of metadata includes:
基于循环冗余校验计算每块元数据的一级初始校验值。The first-level initial checksum of each block of metadata is calculated based on the cyclic redundancy check.
在一些实施方式中,对一级初始校验集进行计算得到二级初始校验集包括:In some implementations, calculating the primary initial check set to obtain the secondary initial check set includes:
对一级初始校验集进行循环冗余校验计算得到二级初始校验集。A cyclic redundancy check is performed on the first-level initial check set to obtain a second-level initial check set.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在硬盘运行过程中,响应于有元数据发生更新,则基于更新后的元数据重新计算一级初始校验值,并基于重新计算的一级初始校验值更新一级初始校验集与二级初始校验集。During the operation of the hard disk, in response to metadata being updated, the first-level initial check value is recalculated based on the updated metadata, and the first-level initial check set and the second-level initial check set are updated based on the recalculated first-level initial check value.
本申请实施例的另一方面,还提供了一种元数据校验系统,包括:Another aspect of the embodiment of the present application further provides a metadata verification system, including:
第一计算模块,第一计算模块被配置为响应于硬盘上电,对硬盘的所有元数据进行分块,并计算每块元数据的一级初始校验值,得到一级初始校验集;A first calculation module, wherein the first calculation module is configured to divide all metadata of the hard disk into blocks in response to the hard disk being powered on, and calculate a first-level initial checksum value of each block of metadata to obtain a first-level initial checksum set;
第二计算模块,第二计算模块被配置为对一级初始校验集进行计算得到二级初始校验集;A second calculation module, the second calculation module is configured to calculate the first-level initial check set to obtain a second-level initial check set;
开启模块,开启模块被配置为开启第一定时器,并设置离散校验周期;An opening module, the opening module is configured to open a first timer and set a discrete verification period;
离散校验模块,离散校验模块被配置为按离散校验周期触发元数据离散校验逻辑以基于二级初始校验集对元数据进行离散校验;A discrete verification module, the discrete verification module is configured to trigger a metadata discrete verification logic according to a discrete verification period to perform a discrete verification on the metadata based on the secondary initial verification set;
巡检模块,巡检模块被配置为响应于元数据的离散校验通过,则触发元数据巡检逻辑以基于一级初始校验集对元数据进行巡检。The inspection module is configured to trigger the metadata inspection logic to inspect the metadata based on the first-level initial inspection set in response to the discrete verification of the metadata passing.
本申请实施例的又一方面,还提供了一种计算机设备,包括:至少一个处理器;以及存储器,存储器存储有可在处理器上运行的计算机程序,计算机程序由处理器执行时实现如上方法的步骤。According to another aspect of the embodiments of the present application, a computer device is provided, including: at least one processor; and a memory, wherein the memory stores a computer program executable on the processor, and the steps of the above method are implemented when the computer program is executed by the processor.
本申请实施例的再一方面,还提供了一种非易失性可读存储介质,非易失性可读存储介质存储有被处理器执行时实现如上方法步骤的计算机程序。According to another aspect of the embodiments of the present application, a non-volatile readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.
本申请至少具有以下有益技术效果:通过在硬盘运行过程中,对元数据进行检查,从而及时发现异常元数据,以此来保证数据的完备性和正确性;并且通过采用离散校验、分级校验的方式,减少校验过程中对CPU的占用率,避免影响硬盘主要业务的运行速度。The present application has at least the following beneficial technical effects: by checking the metadata during the operation of the hard disk, abnormal metadata can be discovered in a timely manner, thereby ensuring the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, the CPU occupancy rate during the verification process is reduced to avoid affecting the operating speed of the main business of the hard disk.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术 描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的实施例。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will describe the embodiments or the prior art. The drawings required for use in the description are briefly introduced. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying any creative work.
图1为本申请提供的元数据校验方法的一实施例的框图;FIG1 is a block diagram of an embodiment of a metadata verification method provided by the present application;
图2为本申请提供的元数据校验系统的一实施例的示意图;FIG2 is a schematic diagram of an embodiment of a metadata verification system provided by the present application;
图3为本申请提供的计算机设备的一实施例的结构示意图;FIG3 is a schematic diagram of the structure of a computer device according to an embodiment of the present application;
图4为本申请提供的非易失性可读存储介质的一实施例的结构示意图。FIG. 4 is a schematic diagram of the structure of an embodiment of a non-volatile readable storage medium provided in the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚明白,以下结合可选的实施例,并参照附图,对本申请实施例进行详细说明。In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the embodiments of the present application are described in detail below in combination with optional embodiments and with reference to the accompanying drawings.
需要说明的是,本申请实施例中所有使用“第一”和“第二”的表述均是为了区分两个相同名称非相同的实体或者非相同的参量,可见“第一”“第二”仅为了表述的方便,不应理解为对本申请实施例的限定,后续实施例对此不再一一说明。It should be noted that all expressions using "first" and "second" in the embodiments of the present application are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present application. The subsequent embodiments will not explain this one by one.
基于上述目的,本申请实施例的第一个方面,提出了一种元数据校验方法的实施例。如图1所示,其包括如下步骤:Based on the above purpose, the first aspect of the embodiment of the present application proposes an embodiment of a metadata verification method. As shown in FIG1 , it includes the following steps:
S10、响应于硬盘上电,对硬盘的所有元数据进行分块,并计算每块元数据的一级初始校验值,得到一级初始校验集;S10, in response to the hard disk being powered on, dividing all metadata of the hard disk into blocks, and calculating a first-level initial checksum value of each block of metadata to obtain a first-level initial checksum set;
S20、对一级初始校验集进行计算得到二级初始校验集;S20, calculating the first-level initial check set to obtain a second-level initial check set;
S30、开启第一定时器,并设置离散校验周期;S30, start the first timer and set a discrete verification period;
S40、按离散校验周期触发元数据离散校验逻辑以基于二级初始校验集对元数据进行离散校验;S40, triggering metadata discrete verification logic according to a discrete verification period to perform discrete verification on the metadata based on the secondary initial verification set;
S50、响应于元数据的离散校验通过,则触发元数据巡检逻辑以基于一级初始校验集对元数据进行巡检。S50 . In response to the metadata discrete verification passing, triggering metadata inspection logic to inspect the metadata based on the first-level initial verification set.
可选的,硬盘上电的初始化阶段,生成元数据时,对整块元数据进行分块处理,对每块元数据进行校验计算,例如CRC(Cyclic Redundancy Check,循环冗余校验)计算,并将计算结果保存在全局数组中,其中,数组下标表示对应第几块元数据,数组值表示该块元数据的一级初始校验值,该数组称为一级初始校验集。由于每块元数据的大小越小,在校验时离散消耗时间越小,对硬盘性能影响越小,但是带来了空间消耗会增多,因此,根据实际情况来权衡划分的每块元数据的大小。 Optionally, during the initialization phase of powering on the hard disk, when generating metadata, the entire block of metadata is processed in blocks, and each block of metadata is verified and calculated, such as CRC (Cyclic Redundancy Check) calculation, and the calculation results are saved in a global array, where the array subscript indicates the corresponding block of metadata, and the array value indicates the first-level initial verification value of the block of metadata. This array is called the first-level initial verification set. Since the smaller the size of each block of metadata, the smaller the discrete time consumed during verification, the smaller the impact on the hard disk performance, but it will increase space consumption. Therefore, the size of each block of metadata is weighed according to the actual situation.
计算完所有元数据的初始校验值之后,再计算一级初始校验集进行校验计算,例如CRC计算,即对生成的全局数组校验计算并保存,该值称为二级初始校验值;每次软件主动更新元数据时,只需要重新计算当前数据所在块对应的一级初始校验集数组值,然后再更新对应的二级初始校验值即可。After calculating the initial check value of all metadata, the first-level initial check set is calculated for check calculation, such as CRC calculation, that is, the generated global array check is calculated and saved. This value is called the second-level initial check value; each time the software actively updates the metadata, it only needs to recalculate the first-level initial check set array value corresponding to the block where the current data is located, and then update the corresponding second-level initial check value.
在硬盘运行过程中,使用第一定时器,触发元数据离散校验逻辑,并在元数据离散校验逻辑触发后,关闭第一定时器;在元数据离散校验通过的情况下,触发元数据巡检逻辑;在元数据离散校验未通过的情况下,则将元数据异步事件通报给主机,以此及时地方式元数据的异常,并通过将异常上报给主机,使得开发人员和维护人员能够及时获取到元数据异常信息,并且能够提高硬盘运行过程中的故障排除效率。During the operation of the hard disk, a first timer is used to trigger a metadata discrete verification logic, and after the metadata discrete verification logic is triggered, the first timer is turned off; when the metadata discrete verification passes, the metadata inspection logic is triggered; when the metadata discrete verification fails, the metadata asynchronous event is notified to the host, so as to timely detect the abnormality of the metadata, and by reporting the abnormality to the host, developers and maintenance personnel can obtain metadata abnormality information in time, and can improve the troubleshooting efficiency during the operation of the hard disk.
元数据离散校验逻辑可以通过以下方式实现:计算当前元数据的一级校验集,以及一级校验集的二级校验集,将计算得到的当前元数据的二级校验集与二级初始校验集进行对比,在当前元数据的二级校验集与二级初始校验一致的情况下,则校验通过,在当前元数据的二级校验集与二级初始校验不一致的情况下,则校验未通过。The metadata discrete verification logic can be implemented in the following way: calculate the first-level verification set of the current metadata, and the second-level verification set of the first-level verification set, compare the calculated second-level verification set of the current metadata with the second-level initial verification set, and if the second-level verification set of the current metadata is consistent with the second-level initial verification, the verification passes; if the second-level verification set of the current metadata is inconsistent with the second-level initial verification, the verification fails.
元数据巡检逻辑可以通过以下方式实现:开始第二定时器,基于第二定时器触发每一块元数据的校验,即每个巡检周期进行一块元数据的校验,若校验通过,则继续校验下一块元数据,若校验未通过,则将元数据异步事件通报给主机。每个巡检周期的详细过程如下:The metadata inspection logic can be implemented in the following way: start the second timer, trigger the verification of each piece of metadata based on the second timer, that is, verify a piece of metadata in each inspection cycle. If the verification passes, continue to verify the next piece of metadata. If the verification fails, notify the host of the metadata asynchronous event. The detailed process of each inspection cycle is as follows:
计算当前元数据的一级校验值,并和一级初始校验集中对应的一级初始校验值进行对比,在当前元数据的一级校验值和一级初始校验集中对应的一级初始校验值一致的情况下,则校验通过,在当前元数据的一级校验值和一级初始校验集中对应的一级初始校验值不一致的情况下,则校验未通过。Calculate the first-level check value of the current metadata and compare it with the corresponding first-level initial check value in the first-level initial check set. If the first-level check value of the current metadata is consistent with the corresponding first-level initial check value in the first-level initial check set, the check passes; if the first-level check value of the current metadata is inconsistent with the corresponding first-level initial check value in the first-level initial check set, the check fails.
本申请实施例,通过在硬盘运行过程中,对元数据进行检查,从而及时发现异常元数据,以此来保证数据的完备性和正确性;并且通过采用离散校验、分级校验的方式,减少校验过程中对CPU的占用率,避免影响硬盘主要业务的运行速度;并且通过对元数据异常的及时发现,提高硬盘运行过程中的故障排除效率。The embodiment of the present application checks metadata during the operation of the hard disk, thereby promptly discovering abnormal metadata to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, reduces the CPU occupancy rate during the verification process to avoid affecting the operation speed of the main business of the hard disk; and by promptly discovering metadata anomalies, improves the troubleshooting efficiency during the operation of the hard disk.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于元数据的离散校验未通过,向主机通报发生元数据异步事件,并禁用元数据巡检逻辑。In response to the discrete verification of the metadata failing, a host is notified of the occurrence of a metadata asynchronous event, and the metadata patrol logic is disabled.
在一些实施方式中,离散校验逻辑包括:In some embodiments, the discrete verification logic includes:
关闭第一定时器;Turn off the first timer;
在每个离散校验周期内基于二级初始校验集对元数据进行离散校验。 The metadata is discretely verified based on the secondary initial verification set in each discrete verification cycle.
在一些实施方式中,元数据巡检逻辑包括:In some implementations, the metadata patrol logic includes:
开启第二定时器,并设置巡检周期;Start the second timer and set the inspection cycle;
按巡检周期依次计算每块元数据的一级校验值,并基于初始校验集中对应的一级初始校验值对每次计算得到的一级校验值进行校验;Calculate the first-level checksum of each piece of metadata in turn according to the inspection cycle, and verify the first-level checksum calculated each time based on the corresponding first-level initial checksum in the initial checksum set;
响应于所有块的元数据校验完成,则关闭第二定时器。In response to the metadata verification of all blocks being completed, the second timer is turned off.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在关闭第二定时器后,开启第一定时器,并退出元数据巡检逻辑。After the second timer is closed, the first timer is opened and the metadata inspection logic is exited.
在一些实施方式中,元数据巡检逻辑包括:In some implementations, the metadata patrol logic includes:
开启第二定时器,并设置巡检周期;Start the second timer and set the inspection cycle;
按巡检周期与划分的块依次获取硬盘当前的元数据,并依次计算每块元数据的一级校验值;Obtain the current metadata of the hard disk in turn according to the inspection cycle and the divided blocks, and calculate the first-level check value of each block of metadata in turn;
在每计算完一块元数据的一级校验值后,将计算得到的一级校验值与初始校验集中对应的一级初始校验值进行对比;After calculating the first-level checksum value of each piece of metadata, the calculated first-level checksum value is compared with the corresponding first-level initial checksum value in the initial checksum set;
在一级校验值和初始校验集中对应的一级初始校验值一致的情况下,则返回按巡检周期依次计算每块元数据的一级校验值的步骤以计算下一块元数据的一级校验值。When the first-level check value is consistent with the corresponding first-level initial check value in the initial check set, the step of calculating the first-level check value of each block of metadata in turn according to the inspection cycle is returned to calculate the first-level check value of the next block of metadata.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则关闭第二定时器,并禁用元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the second timer is turned off and the metadata inspection logic is disabled.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则向主机通报发生元数据异步事件,并关闭第二定时器以及禁用元数据巡检逻辑。When the first-level check value is inconsistent with the first-level initial check value corresponding to the initial check set, the occurrence of the metadata asynchronous event is notified to the host, and the second timer is turned off and the metadata patrol logic is disabled.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志,并关闭第二定时器以及禁用元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the information that the current second-level check set is inconsistent with the second-level initial check set is recorded in the log, and the second timer is turned off and the metadata inspection logic is disabled.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于所有块的元数据巡检完成,则关闭第二定时器,并开启第一定时器,并退出元数据巡检逻辑。In response to the metadata inspection of all blocks being completed, the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
在一可选的实施例中,通过如下方式实现元数据巡检逻辑:In an optional embodiment, the metadata inspection logic is implemented in the following manner:
S11、开启第二定时器,并设置巡检周期,开启第二定时器的用于在每个巡检周期进行 一块元数据的校验,直到所有块的元数据校验完成;S11, start the second timer and set the inspection cycle, start the second timer for each inspection cycle The metadata of one block is verified until the metadata of all blocks is verified;
S12、按巡检周期与划分的块获取硬盘中当前需要校验的块的元数据,并计算该块元数据的一级校验值;S12, obtaining metadata of a block currently to be verified in the hard disk according to the inspection cycle and the divided blocks, and calculating a primary verification value of the metadata of the block;
S13、将计算得到的一级校验值与初始校验集中对应的一级初始校验值进行对比;S13, comparing the calculated first-level check value with the corresponding first-level initial check value in the initial check set;
S14、在一级校验值和初始校验集中对应的一级初始校验值一致的情况下,则返回步骤S12,计算下一块元数据的一级校验值;S14, when the first-level check value is consistent with the corresponding first-level initial check value in the initial check set, return to step S12 to calculate the first-level check value of the next piece of metadata;
S15、在一级校验值和初始校验集中对应的一级初始校验值不一致的情况下,则向主机通报发生元数据异步事件,并将对比不一致信息记录到日志,并关闭第二定时器。禁用元数据巡检逻辑;S15, if the primary check value is inconsistent with the corresponding primary initial check value in the initial check set, the host is notified of the occurrence of a metadata asynchronous event, the comparison inconsistency information is recorded in the log, and the second timer is turned off. Metadata inspection logic is disabled;
S16、响应于所有块的元数据巡检完成,则关闭第二定时器,并开启第一定时器,并退出元数据巡检逻辑。S16: In response to the metadata inspection of all blocks being completed, the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
通过上述方案,实现了在硬盘运行过程中对元数据的检查,能够及时发现异常元数据,以此来保证数据的完备性和正确性;并且减少校验过程中对CPU的占用率,避免影响硬盘主要业务的运行速度;并且通过对元数据异常的及时发现,提高硬盘运行过程中的故障排除效率。Through the above scheme, the metadata is checked during the operation of the hard disk, and abnormal metadata can be discovered in time to ensure the completeness and correctness of the data; and the CPU occupancy rate during the verification process is reduced to avoid affecting the operation speed of the main business of the hard disk; and through the timely discovery of metadata anomalies, the troubleshooting efficiency during the operation of the hard disk is improved.
在一些实施方式中,元数据离散校验逻辑包括:In some implementations, the metadata discrete verification logic includes:
关闭第一定时器;Turn off the first timer;
获取硬盘运行的当前时刻的元数据的一级校验集,并对当前时刻的一级校验集进行计算得到当前时刻的二级校验集;Obtain the first-level checksum of the metadata of the hard disk at the current time, and calculate the first-level checksum at the current time to obtain the second-level checksum at the current time;
对比当前时刻的二级校验集与二级初始校验集;Compare the current secondary checksum with the secondary initial checksum;
在当前时刻的二级校验集与二级初始校验集一致的情况下,则元数据的离散校验通过。When the current secondary check set is consistent with the secondary initial check set, the discrete check of the metadata passes.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在当前时刻的二级校验集与二级初始校验集不一致的情况下,则元数据的离散校验未通过。When the current secondary check set is inconsistent with the secondary initial check set, the discrete check of the metadata fails.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于元数据的离散校验未通过,将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志。In response to the discrete verification of the metadata failing, information that the secondary verification set at the current moment is inconsistent with the secondary initial verification set is recorded in the log.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
响应于元数据的离散校验未通过,向主机通报发生元数据异步事件,并将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志,并禁用元数据巡检逻辑。 In response to the failure of the discrete verification of metadata, the host is notified of the occurrence of a metadata asynchronous event, and the information that the current secondary verification set is inconsistent with the secondary initial verification set is recorded in the log, and the metadata inspection logic is disabled.
在一些实施方式中,计算每块元数据的一级初始校验值包括:In some implementations, calculating the primary initial checksum for each block of metadata includes:
基于循环冗余校验计算每块元数据的一级初始校验值。The first-level initial checksum value of each block of metadata is calculated based on the cyclic redundancy check.
在一些实施方式中,对一级初始校验集进行计算得到二级初始校验集包括:In some implementations, calculating the primary initial check set to obtain the secondary initial check set includes:
对一级初始校验集进行循环冗余校验计算得到二级初始校验集。A cyclic redundancy check is performed on the first-level initial check set to obtain a second-level initial check set.
在一可选的实施例中,通过如下方式实现元数据离散校验逻辑:In an optional embodiment, the metadata discrete verification logic is implemented in the following manner:
S21、在触发元数据离散校验逻辑后,关闭第一定时器;S21, after the metadata discrete verification logic is triggered, close the first timer;
S22、获取硬盘运行的当前时刻的元数据的一级校验集,并对当前时刻的一级校验集进行计算得到当前时刻的二级校验集;S22, obtaining a first-level checksum of metadata at the current moment of hard disk operation, and calculating the first-level checksum at the current moment to obtain a second-level checksum at the current moment;
S23、对比当前时刻的二级校验集与二级初始校验集;S23, comparing the current secondary check set with the secondary initial check set;
S24、在当前时刻的二级校验集与二级初始校验集一致的情况下,则元数据的离散校验通过;S24: If the current secondary check set is consistent with the secondary initial check set, the discrete check of the metadata passes;
S25、在当前时刻的二级校验集与二级初始校验集不一致的情况下,则元数据的离散校验未通过;S25. If the current secondary check set is inconsistent with the secondary initial check set, the discrete check of the metadata fails;
S26、响应于元数据的离散校验未通过,向主机通报发生元数据异步事件,并将当前时刻的二级校验集与二级初始校验集不一致的信息记录到日志,并禁用元数据巡检逻辑。S26. In response to the metadata discrete verification failing, the host is notified of the occurrence of a metadata asynchronous event, and the information that the current secondary verification set is inconsistent with the secondary initial verification set is recorded in the log, and the metadata inspection logic is disabled.
通过上述方案,实现了在硬盘运行过程中对元数据的检查,能够及时发现异常元数据,以此来保证数据的完备性和正确性;并且通过采用离散校验、分级校验的方式,减少校验过程中对CPU的占用率,避免影响硬盘主要业务的运行速度;并且通过对元数据异常的及时发现,提高硬盘运行过程中的故障排除效率。Through the above scheme, the metadata is checked during the operation of the hard disk, and abnormal metadata can be discovered in time to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, the CPU occupancy rate during the verification process is reduced to avoid affecting the operation speed of the main business of the hard disk; and by timely discovering metadata anomalies, the troubleshooting efficiency during the operation of the hard disk is improved.
在一些实施方式中,方法还包括:In some embodiments, the method further comprises:
在硬盘运行过程中,响应于有元数据发生更新,则基于更新后的元数据重新计算一级初始校验值,并基于重新计算的一级初始校验值更新一级初始校验集与二级初始校验集。During the operation of the hard disk, in response to metadata being updated, the first-level initial check value is recalculated based on the updated metadata, and the first-level initial check set and the second-level initial check set are updated based on the recalculated first-level initial check value.
下面通过一可选的实施例对本申请的可选的实施方式进行说明。The following describes an optional implementation of the present application through an optional embodiment.
S110、在硬盘初始化阶段,生成元数据的时候,对整块元数据进行分块处理,对每块元数据计算CRC,并保存在全局数组中,数组下标表示对应第几块数据,数组值表示该块数据的CRC,该数组称为一级CRC集,即一级初始校验集;S110, during the hard disk initialization phase, when generating metadata, the entire metadata is processed in blocks, CRC is calculated for each metadata block, and saved in a global array, the array subscript indicates the corresponding block of data, and the array value indicates the CRC of the block of data, the array is called a first-level CRC set, i.e., a first-level initial checksum set;
S111、计算完所有元数据的CRC之后,再对一级CRC集计算CRC,即对步骤S110所生成的数组计算CRC并保存,该值称为二级CRC值,即二级初始校验集;S111, after calculating the CRC of all metadata, calculate the CRC of the primary CRC set, that is, calculate the CRC of the array generated in step S110 and save it, which is called the secondary CRC value, that is, the secondary initial check set;
S112、设备运行时,使用第一定时器,触发元数据离散校验流程;S112, when the device is running, use the first timer to trigger the metadata discrete verification process;
S113、元数据离散校验流程触发后,关闭第一定时器; S113, after the metadata discrete verification process is triggered, close the first timer;
S114、先计算当前一级CRC集的CRC,即二级CRC值,和步骤S111最终计算的二级CRC值对比;S114, first calculate the CRC of the current primary CRC set, that is, the secondary CRC value, and compare it with the secondary CRC value finally calculated in step S111;
S115、步骤S114校验通过,则通过标记位,触发元数据巡检逻辑,开始数据巡检,开启第二定时器,进入步骤S117;S115: If the verification of step S114 is passed, the metadata inspection logic is triggered by the flag bit, the data inspection is started, the second timer is started, and the process goes to step S117;
S116、步骤S114校验不通过,则通报异步事件给host(主机),记录LOG(日志),随后禁用巡检流程;S116: If the step S114 fails to pass the verification, the asynchronous event is notified to the host, the LOG is recorded, and then the inspection process is disabled;
S117、第二定时器触发每一块的元数据校验,即,计算一块元数据的CRC校验值,并和步骤S110中保存的一级CRC集中保存的对应CRC值进行比较;S117, the second timer triggers metadata check of each block, that is, calculates the CRC check value of a block of metadata, and compares it with the corresponding CRC value saved in the primary CRC set saved in step S110;
S118、步骤S117校验通过,校验下一块的元数据,即偏移到下一个数据单元,释放CPU,等待第二定时器触发进入下一个数据单元检验;S118, if the verification of step S117 is passed, the metadata of the next block is verified, that is, the next data unit is offset, the CPU is released, and the second timer is triggered to enter the next data unit verification;
S119、所有数据校验完成,关闭第二定时器,打开第一定时器,退出元数据离散巡检逻辑;S119, after all data verification is completed, the second timer is turned off, the first timer is turned on, and the metadata discrete inspection logic is exited;
S120、步骤S117校验不通过,则通报异步事件给host,记录LOG,关闭第二定时器,随后禁用巡检流程。S120. If the check in step S117 fails, the asynchronous event is notified to the host, a LOG is recorded, the second timer is turned off, and then the inspection process is disabled.
本申请实施例,通过在硬盘运行过程中,对元数据进行检查,从而及时发现异常元数据,以此来保证数据的完备性和正确性;并且通过采用离散校验、分级校验的方式,减少校验过程中对CPU的占用率,避免影响硬盘主要业务的运行速度;并且通过对元数据异常的及时发现,提高硬盘运行过程中的故障排除效率。The embodiment of the present application checks metadata during the operation of the hard disk, thereby promptly discovering abnormal metadata to ensure the completeness and correctness of the data; and by adopting discrete verification and hierarchical verification methods, reduces the CPU occupancy rate during the verification process to avoid affecting the operation speed of the main business of the hard disk; and by promptly discovering metadata anomalies, improves the troubleshooting efficiency during the operation of the hard disk.
基于同一发明构思,根据本申请的另一个方面,如图2所示,本申请的实施例还提供了一种元数据校验系统,包括:Based on the same inventive concept, according to another aspect of the present application, as shown in FIG2 , an embodiment of the present application further provides a metadata verification system, including:
第一计算模块110,第一计算模块110被配置为响应于硬盘上电,对硬盘的所有元数据进行分块,并计算每块元数据的一级初始校验值,得到一级初始校验集;A first calculation module 110, wherein the first calculation module 110 is configured to divide all metadata of the hard disk into blocks in response to the hard disk being powered on, and calculate a first-level initial checksum value of each block of metadata to obtain a first-level initial checksum set;
第二计算模块120,第二计算模块120被配置为对一级初始校验集进行计算得到二级初始校验集;A second calculation module 120, the second calculation module 120 is configured to calculate the first-level initial check set to obtain a second-level initial check set;
开启模块130,开启模块130被配置为开启第一定时器,并设置离散校验周期;The start module 130 is configured to start a first timer and set a discrete check period;
离散校验模块140,离散校验模块140被配置为按离散校验周期触发元数据离散校验逻辑以基于二级初始校验集对元数据进行离散校验;A discrete verification module 140, the discrete verification module 140 is configured to trigger a metadata discrete verification logic according to a discrete verification period to perform a discrete verification on the metadata based on the secondary initial verification set;
巡检模块150,巡检模块150被配置为响应于元数据的离散校验通过,则触发元数据巡检逻辑以基于一级初始校验集对元数据进行巡检。The inspection module 150 is configured to trigger the metadata inspection logic to inspect the metadata based on the primary initial inspection set in response to the discrete verification of the metadata passing.
本申请实施例,通过在硬盘运行过程中,对元数据进行检查,从而及时发现异常元数 据,以此来保证数据的完备性和正确性;并且通过采用离散校验、分级校验的方式,减少校验过程中对CPU的占用率,避免影响硬盘主要业务的运行速度。In the embodiment of the present application, the metadata is checked during the operation of the hard disk, so as to timely discover abnormal metadata. The completeness and correctness of the data are guaranteed by using discrete verification and hierarchical verification to reduce the CPU usage during the verification process and avoid affecting the running speed of the main business of the hard disk.
结合这里的公开所描述的各种示例性逻辑块、模块和电路可以利用被设计成用于执行这里功能的下列部件来实现或执行:通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或其它可编程逻辑器件、分立门或晶体管逻辑、分立的硬件组件或者这些部件的任何组合。通用处理器可以是微处理器,但是可替换地,处理器可以是任何传统处理器、控制器、微控制器或状态机。处理器也可以被实现为计算设备的组合,例如,DSP和微处理器的组合、多个微处理器、一个或多个微处理器结合DSP和/或任何其它这种配置。The various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure herein may be implemented or executed using the following components designed to perform the functions herein: a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but alternatively, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
结合这里的公开所描述的方法或算法的步骤可以直接包含在硬件中、由处理器执行的软件模块中或这两者的组合中。软件模块可以驻留在RAM存储器、快闪存储器、ROM存储器、EPROM存储器、EEPROM存储器、寄存器、硬盘、可移动盘、CD-ROM、或本领域已知的任何其它形式的非易失性可读存储介质中。示例性的非易失性可读存储介质被耦合到处理器,使得处理器能够从该非易失性可读存储介质中读取信息或向该非易失性可读存储介质写入信息。在一个替换方案中,非易失性可读存储介质可以与处理器集成在一起。处理器和非易失性可读存储介质可以驻留在ASIC中。ASIC可以驻留在用户终端中。在一个替换方案中,处理器和非易失性可读存储介质可以作为分立组件驻留在用户终端中。The steps of the method or algorithm described in conjunction with the disclosure here can be directly included in hardware, in a software module executed by a processor, or in a combination of the two. The software module can reside in a non-volatile readable storage medium of any other form known in the art, such as a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or a non-volatile readable storage medium. An exemplary non-volatile readable storage medium is coupled to a processor so that the processor can read information from the non-volatile readable storage medium or write information to the non-volatile readable storage medium. In an alternative, the non-volatile readable storage medium can be integrated with the processor. The processor and the non-volatile readable storage medium can reside in an ASIC. The ASIC can reside in a user terminal. In an alternative, the processor and the non-volatile readable storage medium can reside in a user terminal as a discrete component.
基于同一发明构思,根据本申请的另一个方面,如图3所示,本申请的实施例还提供了一种计算机设备30,在该计算机设备30中包括处理器310以及存储器320,存储器320存储有可在处理器上运行的计算机程序321,处理器310执行程序时执行如上的方法的步骤。Based on the same inventive concept, according to another aspect of the present application, as shown in FIG3 , an embodiment of the present application further provides a computer device 30, which includes a processor 310 and a memory 320, wherein the memory 320 stores a computer program 321 that can be run on the processor, and the processor 310 executes the steps of the above method when executing the program.
其中,存储器作为一种非易失性非易失性可读存储介质,可被配置为存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中的元数据校验方法对应的程序指令/模块。处理器通过运行存储在存储器中的非易失性软件程序、指令以及模块,从而执行系统的各种功能应用以及数据处理,即实现上述方法实施例的元数据校验方法。Among them, the memory, as a non-volatile, non-volatile readable storage medium, can be configured to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions/modules corresponding to the metadata verification method in the embodiment of the present application. The processor executes various functional applications and data processing of the system by running the non-volatile software programs, instructions and modules stored in the memory, that is, the metadata verification method of the above method embodiment is implemented.
存储器可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据系统的使用所创建的数据等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器可选包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至本地模块。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。 The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the system, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
基于同一发明构思,根据本申请的另一个方面,如图4所示,本申请的实施例还提供了一种非易失性可读存储介质40,非易失性可读存储介质40存储有被处理器执行时执行如上方法的计算机程序410。Based on the same inventive concept, according to another aspect of the present application, as shown in FIG. 4 , an embodiment of the present application further provides a non-volatile readable storage medium 40 , which stores a computer program 410 that executes the above method when executed by a processor.
最后需要说明的是,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关硬件来完成,程序可存储于一非易失性可读存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,程序的非易失性可读存储介质可为磁碟、光盘、只读存储记忆体(ROM)或随机存储记忆体(RAM)等。上述计算机程序的实施例,可以达到与之对应的前述任意方法实施例相同或者相类似的效果。Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the non-volatile readable storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned arbitrary method embodiments.
本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。为了清楚地说明硬件和软件的这种可互换性,已经就各种示意性组件、方块、模块、电路和步骤的功能对其进行了一般性的描述。这种功能是被实现为软件还是被实现为硬件取决于实际应用以及施加给整个系统的设计约束。本领域技术人员可以针对每种实际应用以各种方式来实现的功能,但是这种实现决定不应被解释为导致脱离本申请实施例公开的范围。It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithmic steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or implemented as hardware depends on practical application and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for every practical application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the present application embodiment.
以上是本申请公开的示例性实施例,但是应当注意,在不背离权利要求限定的本申请实施例公开的范围的前提下,可以进行多种改变和修改。根据这里描述的公开实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。上述本申请实施例公开实施例序号仅仅为了描述,不代表实施例的优劣。此外,尽管本申请实施例公开的元素可以以个体形式描述或要求,但除非明确限制为单数,也可以理解为多个。The above are exemplary embodiments disclosed in the present application, but it should be noted that various changes and modifications may be made without departing from the scope of the present application disclosed in the claims. The functions, steps and/or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. The serial numbers of the embodiments disclosed in the above-mentioned embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. In addition, although the elements disclosed in the embodiments of the present application may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
应当理解的是,在本文中使用的,除非上下文清楚地支持例外情况,单数形式“一个”旨在也包括复数形式。还应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任意和所有可能组合。It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and/or" refers to any and all possible combinations including one or more of the associated listed items.
所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本申请实施例公开的范围(包括权利要求)被限于这些例子;在本申请实施例的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,并存在如上的本申请实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。因此,凡在本申请实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本申请实施例的保护范围之内。 A person of ordinary skill in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present application (including the claims) is limited to these examples; under the concept of the embodiments of the present application, the technical features in the above embodiments or different embodiments may also be combined, and there are many other variations of different aspects of the embodiments of the present application as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.

Claims (20)

  1. 一种元数据校验方法,其特征在于,包括:A metadata verification method, characterized by comprising:
    响应于硬盘上电,对所述硬盘的所有元数据进行分块,并计算每块元数据的一级初始校验值,得到一级初始校验集;In response to the hard disk being powered on, all metadata of the hard disk are divided into blocks, and a first-level initial check value of each block of metadata is calculated to obtain a first-level initial check set;
    对所述一级初始校验集进行计算得到二级初始校验集;Calculating the first-level initial check set to obtain a second-level initial check set;
    开启第一定时器,并设置离散校验周期;Start the first timer and set the discrete verification period;
    按所述离散校验周期触发元数据离散校验逻辑以基于所述二级初始校验集对所述元数据进行离散校验;Triggering metadata discrete verification logic according to the discrete verification period to perform discrete verification on the metadata based on the secondary initial verification set;
    响应于所述元数据的离散校验通过,则触发元数据巡检逻辑以基于所述一级初始校验集对所述元数据进行巡检。In response to the discrete verification of the metadata passing, the metadata inspection logic is triggered to inspect the metadata based on the first-level initial verification set.
  2. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    响应于所述元数据的离散校验未通过,向主机通报发生元数据异步事件,并禁用所述元数据巡检逻辑。In response to the discrete verification of the metadata failing, a host is notified of the occurrence of a metadata asynchronous event, and the metadata patrol logic is disabled.
  3. 根据权利要求1所述的方法,其特征在于,所述离散校验逻辑包括:The method according to claim 1, wherein the discrete check logic comprises:
    关闭所述第一定时器;Turning off the first timer;
    在每个所述离散校验周期内基于所述二级初始校验集对所述元数据进行离散校验。The metadata is discretely verified based on the secondary initial verification set in each discrete verification period.
  4. 根据权利要求1所述的方法,其特征在于,所述元数据巡检逻辑包括:The method according to claim 1, wherein the metadata inspection logic comprises:
    开启第二定时器,并设置巡检周期;Start the second timer and set the inspection cycle;
    按所述巡检周期依次计算每块元数据的一级校验值,并基于所述初始校验集中对应的一级初始校验值对每次计算得到的一级校验值进行校验;Calculating the first-level check value of each block of metadata in sequence according to the inspection cycle, and verifying the first-level check value obtained each time based on the first-level initial check value corresponding to the initial check set;
    响应于所有块的元数据校验完成,则关闭所述第二定时器。In response to the metadata verification of all blocks being completed, the second timer is turned off.
  5. 根据权利要求4所述的方法,其特征在于,还包括:The method according to claim 4, further comprising:
    在关闭所述第二定时器后,开启所述第一定时器,并退出所述元数据巡检逻辑。After the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
  6. 根据权利要求1所述的方法,其特征在于,所述元数据巡检逻辑包括:The method according to claim 1, wherein the metadata inspection logic comprises:
    开启第二定时器,并设置巡检周期;Start the second timer and set the inspection cycle;
    按所述巡检周期与划分的块依次获取所述硬盘当前的元数据,并依次计算每块元数据的一级校验值;Obtaining the current metadata of the hard disk in sequence according to the inspection cycle and the divided blocks, and calculating the primary check value of each block of metadata in sequence;
    在每计算完一块元数据的一级校验值后,将计算得到的一级校验值与所述初始校验集中对应的一级初始校验值进行对比; After calculating each level one check value of a piece of metadata, the calculated level one check value is compared with the corresponding level one initial check value in the initial check set;
    在所述一级校验值和所述初始校验集中对应的一级初始校验值一致的情况下,则返回按巡检周期依次计算每块元数据的一级校验值的步骤以计算下一块元数据的一级校验值。When the first-level check value is consistent with the corresponding first-level initial check value in the initial check set, the step of calculating the first-level check value of each block of metadata in turn according to the inspection cycle is returned to calculate the first-level check value of the next block of metadata.
  7. 根据权利要求6所述的方法,其特征在于,还包括:The method according to claim 6, further comprising:
    在所述一级校验值和所述初始校验集中对应的一级初始校验值不一致的情况下,则关闭所述第二定时器,并禁用所述元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the second timer is turned off and the metadata inspection logic is disabled.
  8. 根据权利要求6所述的方法,其特征在于,还包括:The method according to claim 6, further comprising:
    在所述一级校验值和所述初始校验集中对应的一级初始校验值不一致的情况下,则向主机通报发生元数据异步事件,并关闭所述第二定时器以及禁用所述元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the occurrence of a metadata asynchronous event is notified to the host, and the second timer is turned off and the metadata patrol logic is disabled.
  9. 根据权利要求6所述的方法,其特征在于,还包括:The method according to claim 6, further comprising:
    在所述一级校验值和所述初始校验集中对应的一级初始校验值不一致的情况下,则将当前时刻的二级校验集与所述二级初始校验集不一致的信息记录到日志,并关闭所述第二定时器以及禁用所述元数据巡检逻辑。When the first-level check value is inconsistent with the corresponding first-level initial check value in the initial check set, the information that the second-level check set at the current moment is inconsistent with the second-level initial check set is recorded in the log, and the second timer is turned off and the metadata inspection logic is disabled.
  10. 根据权利要求6所述的方法,其特征在于,还包括:The method according to claim 6, further comprising:
    响应于所有块的元数据巡检完成,则关闭所述第二定时器,并开启所述第一定时器,并退出所述元数据巡检逻辑。In response to the metadata inspection of all blocks being completed, the second timer is turned off, the first timer is turned on, and the metadata inspection logic is exited.
  11. 根据权利要求1所述的方法,其特征在于,所述元数据离散校验逻辑包括:The method according to claim 1, wherein the metadata discrete verification logic comprises:
    关闭所述第一定时器;Turning off the first timer;
    获取所述硬盘运行的当前时刻的元数据的一级校验集,并对当前时刻的一级校验集进行计算得到当前时刻的二级校验集;Obtaining a first-level checksum of metadata at the current moment of operation of the hard disk, and calculating the first-level checksum at the current moment to obtain a second-level checksum at the current moment;
    对比所述当前时刻的二级校验集与所述二级初始校验集;Comparing the current level 2 check set with the level 2 initial check set;
    在所述当前时刻的二级校验集与所述二级初始校验集一致的情况下,则所述元数据的离散校验通过。When the secondary check set at the current moment is consistent with the secondary initial check set, the discrete check of the metadata passes.
  12. 根据权利要求11所述的方法,其特征在于,还包括:The method according to claim 11, further comprising:
    在所述当前时刻的二级校验集与所述二级初始校验集不一致的情况下,则所述元数据的离散校验未通过。When the secondary verification set at the current moment is inconsistent with the secondary initial verification set, the discrete verification of the metadata fails.
  13. 根据权利要求11所述的方法,其特征在于,还包括:The method according to claim 11, further comprising:
    响应于所述元数据的离散校验未通过,将所述当前时刻的二级校验集与所述二级初始校验集不一致的信息记录到日志。In response to the discrete verification of the metadata failing, information that the secondary verification set at the current moment is inconsistent with the secondary initial verification set is recorded in a log.
  14. 根据权利要求11所述的方法,其特征在于,还包括: The method according to claim 11, further comprising:
    响应于所述元数据的离散校验未通过,向主机通报发生元数据异步事件,并将所述当前时刻的二级校验集与所述二级初始校验集不一致的信息记录到日志,并禁用所述元数据巡检逻辑。In response to the discrete verification of the metadata failing, the host is notified of the occurrence of a metadata asynchronous event, the information that the secondary verification set at the current moment is inconsistent with the secondary initial verification set is recorded in a log, and the metadata inspection logic is disabled.
  15. 根据权利要求1所述的方法,其特征在于,计算每块元数据的一级初始校验值包括:The method according to claim 1, wherein calculating the primary initial checksum value of each block of metadata comprises:
    基于循环冗余校验计算每块元数据的一级初始校验值。The first-level initial checksum of each block of metadata is calculated based on the cyclic redundancy check.
  16. 根据权利要求1所述的方法,其特征在于,对所述一级初始校验集进行计算得到二级初始校验集包括:The method according to claim 1, characterized in that calculating the first-level initial check set to obtain the second-level initial check set comprises:
    对所述一级初始校验集进行循环冗余校验计算得到二级初始校验集。A cyclic redundancy check calculation is performed on the first-level initial check set to obtain a second-level initial check set.
  17. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    在所述硬盘运行过程中,响应于有元数据发生更新,则基于更新后的元数据重新计算一级初始校验值,并基于重新计算的一级初始校验值更新所述一级初始校验集与所述二级初始校验集。During the operation of the hard disk, in response to metadata being updated, the first-level initial check value is recalculated based on the updated metadata, and the first-level initial check set and the second-level initial check set are updated based on the recalculated first-level initial check value.
  18. 一种元数据校验系统,其特征在于,包括:A metadata verification system, characterized by comprising:
    第一计算模块,所述第一计算模块被配置为响应于硬盘上电,对所述硬盘的所有元数据进行分块,并计算每块元数据的一级初始校验值,得到一级初始校验集;a first calculation module, wherein the first calculation module is configured to, in response to the hard disk being powered on, divide all metadata of the hard disk into blocks, and calculate a first-level initial checksum value of each block of metadata to obtain a first-level initial checksum set;
    第二计算模块,所述第二计算模块被配置为对所述一级初始校验集进行计算得到二级初始校验集;A second calculation module, the second calculation module is configured to calculate the first-level initial check set to obtain a second-level initial check set;
    开启模块,所述开启模块被配置为开启第一定时器,并设置离散校验周期;An activation module, wherein the activation module is configured to activate a first timer and set a discrete verification period;
    离散校验模块,所述离散校验模块被配置为按所述离散校验周期触发元数据离散校验逻辑以基于所述二级初始校验集对所述元数据进行离散校验;a discrete verification module, the discrete verification module being configured to trigger metadata discrete verification logic according to the discrete verification period to perform discrete verification on the metadata based on the secondary initial verification set;
    巡检模块,所述巡检模块被配置为响应于所述元数据的离散校验通过,则触发元数据巡检逻辑以基于所述一级初始校验集对所述元数据进行巡检。A patrol module is configured to trigger metadata patrol logic to patrol the metadata based on the first-level initial check set in response to the metadata passing discrete check.
  19. 一种计算机设备,包括:A computer device comprising:
    至少一个处理器;以及at least one processor; and
    存储器,所述存储器存储有可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时执行如权利要求1至17任意一项所述的方法的步骤。A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 17 when executing the program.
  20. 一种非易失性可读存储介质,所述非易失性可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时执行如权利要求1至17任意一项所述的方法的步骤。 A non-volatile readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the steps of the method according to any one of claims 1 to 17.
PCT/CN2023/115981 2022-11-21 2023-08-30 Metadata check method and system, and computer device and non-volatile readable storage medium WO2024109236A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211455849.9 2022-11-21
CN202211455849.9A CN115509800B (en) 2022-11-21 2022-11-21 Metadata verification method, system, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2024109236A1 true WO2024109236A1 (en) 2024-05-30

Family

ID=84513665

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/115981 WO2024109236A1 (en) 2022-11-21 2023-08-30 Metadata check method and system, and computer device and non-volatile readable storage medium

Country Status (2)

Country Link
CN (1) CN115509800B (en)
WO (1) WO2024109236A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115509800B (en) * 2022-11-21 2023-03-31 苏州浪潮智能科技有限公司 Metadata verification method, system, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946379A (en) * 2012-10-16 2013-02-27 无锡江南计算技术研究所 Multi-layer digest file generation method and file correctness verification method for massively parallel system
CN109753788A (en) * 2017-11-03 2019-05-14 厦门雅迅网络股份有限公司 Integrity checking method and computer readable storage medium when kernel is run
US20190278525A1 (en) * 2015-12-24 2019-09-12 Intel Corporation Techniques for data storage protection and integrity checking
US20200125276A1 (en) * 2018-10-22 2020-04-23 EMC IP Holding Company LLC Storage system with data integrity verification performed in conjunction with internal data movement
CN115145943A (en) * 2022-09-06 2022-10-04 北京麦聪软件有限公司 Multi-data-source metadata rapid comparison method, system, device and storage medium
CN115268780A (en) * 2022-07-25 2022-11-01 北京计算机技术及应用研究所 Dynamically refreshed missile-borne computer anti-single event upset software reinforcement method
CN115509800A (en) * 2022-11-21 2022-12-23 苏州浪潮智能科技有限公司 Metadata verification method, system, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851539A (en) * 2019-10-25 2020-02-28 东软集团股份有限公司 Metadata verification method and device, readable storage medium and electronic equipment
CN111782623A (en) * 2020-05-21 2020-10-16 北京交通大学 File checking and repairing method in HDFS storage platform

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102946379A (en) * 2012-10-16 2013-02-27 无锡江南计算技术研究所 Multi-layer digest file generation method and file correctness verification method for massively parallel system
US20190278525A1 (en) * 2015-12-24 2019-09-12 Intel Corporation Techniques for data storage protection and integrity checking
CN109753788A (en) * 2017-11-03 2019-05-14 厦门雅迅网络股份有限公司 Integrity checking method and computer readable storage medium when kernel is run
US20200125276A1 (en) * 2018-10-22 2020-04-23 EMC IP Holding Company LLC Storage system with data integrity verification performed in conjunction with internal data movement
CN115268780A (en) * 2022-07-25 2022-11-01 北京计算机技术及应用研究所 Dynamically refreshed missile-borne computer anti-single event upset software reinforcement method
CN115145943A (en) * 2022-09-06 2022-10-04 北京麦聪软件有限公司 Multi-data-source metadata rapid comparison method, system, device and storage medium
CN115509800A (en) * 2022-11-21 2022-12-23 苏州浪潮智能科技有限公司 Metadata verification method, system, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115509800B (en) 2023-03-31
CN115509800A (en) 2022-12-23

Similar Documents

Publication Publication Date Title
US11687391B2 (en) Serializing machine check exceptions for predictive failure analysis
US8281229B2 (en) Firmware verification using system memory error check logic
WO2024109236A1 (en) Metadata check method and system, and computer device and non-volatile readable storage medium
US9891917B2 (en) System and method to increase lockstep core availability
US20190004929A1 (en) Software condition evaluation apparatus and methods
US11061690B2 (en) Method for updating a boot loader of a multiprocessor device
WO2020239060A1 (en) Error recovery method and apparatus
CN105528308A (en) Power failure processing method and device and electronic apparatus
WO2012119410A1 (en) Method and device for detecting data reliability
WO2022148300A1 (en) Bios problem positioning method and apparatus, and computer readable storage medium
Norris et al. IoTRepair: Systematically addressing device faults in commodity IoT
TW201837708A (en) Boot data validity
US20060206764A1 (en) Memory reliability detection system and method
Norris et al. IoTRepair: Flexible fault handling in diverse IoT deployments
US10824493B2 (en) Disambiguation of error logging during system reset
CN115705261A (en) Memory fault repairing method, CPU, OS, BIOS and server
WO2020066552A1 (en) Bmc and method for determining bmc firmware
CN111488250A (en) High-density multi-node server testing method, system, terminal and storage medium
CN115482875A (en) Memory secure interface configuration
JP2018195329A (en) Information processing apparatus
US20210311833A1 (en) Targeted repair of hardware components in a computing device
CN114003416A (en) Dynamic memory error processing method, system, terminal and storage medium
US8355317B1 (en) Transaction-based coordination of data object modification for primary and backup control circuitry
JP2011076262A (en) Computer system and method therefor
US20240070284A1 (en) Secure boot procedure

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23893329

Country of ref document: EP

Kind code of ref document: A1