Raid inspection method and inspection apparatus, and electronic device
By using the valid area bitmap in the RAID array to inspect only valid data, the problem of traditional RAID array inspection methods affecting data security is solved, and disk stability and data security are improved.
Patent Information
- Application Number
- PCT/CN2024/079973
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-08
- Filing Date
- 2024-03-04
- Publication Date
- 2024-09-12
AI Technical Summary
The traditional RAID array inspection method will affect data security. By fully reading all hard disk areas, bandwidth usage will increase and hard disk usage will increase, thereby increasing the probability of disk damage and affecting data security.
The effective area bitmap is used to inspect only the physical addresses containing valid data. By establishing and updating the effective area bitmap, effective data is inspected only during the inspection period, which reduces the frequency of hard disk usage and improves disk stability.
It effectively improves the data security of RAID disk arrays, reduces the additional loss of hard disks caused by inspections, reduces the risk of data loss, and optimizes storage system performance.
Smart Images

Figure CN2024079973_12092024_PF_FP_ABST
Abstract
Description
RAID array inspection method, inspection device and electronic equipment
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 8, 2023, with application number 2023102182272, and application name “RAID Array Inspection Method, Inspection Device and Electronic Device”, all contents of which are incorporated by reference into this application. Technical Field
[0003] Embodiments of the present application relate to the field of storage system data security, and in particular, to a RAID array inspection method, an inspection device, a storage system, a non-volatile readable storage medium, and an electronic device. Background Art
[0004] RAID (Redundant Array of Independent Disks) consists of a large number of storage units (hard disks). In a storage system, multiple disks are grouped into an array and used as a single disk. Data is stored in stripes on different disks. When accessing data, the related disks in the array work together, significantly reducing data access time while achieving better space utilization.
[0005] While meeting performance, capacity, and other requirements, it is also necessary to ensure that RAID disk arrays can meet the most basic requirement, namely, data security. Because a large number of disks are required to form a disk array, over time, disks may become silent or experience sector damage due to weakened magnetism and media damage, thus affecting data security. Besides data loss caused by inconsistent stripe data during normal use, the data reconstruction process during fault-tolerant processing also relies on stripe data consistency; otherwise, incorrect data may be restored, seriously impacting data security. To ensure data security, storage systems require regular RAID inspections to isolate and repair bad sectors in a timely manner. This means that user-written data must be regularly checked to prevent unpredictable data loss. Once a problem occurs, users are reminded to perform data recovery or take other effective measures within an acceptable period, thereby avoiding unnecessary data loss and improving data security.
[0006] To ensure storage service performance, RAID designs inspections as the lowest-priority background task, performing inspections only when no other tasks are running. Inspections are a cyclical queue processing process that contains all stripes in the array. Inspections are performed on all disks at a predetermined rate within a preset period. The inspection process has several key elements: the inspection cycle, inspection scope, inspection run time, inspection scheduling method, and inspection speed. Traditional inspection methods cyclically read all areas of all hard drives in the array, periodically sending and reading hard drive stripe data and performing XOR checksum calculations for verification. This inspection method has several drawbacks: it robs bandwidth from front-end services, impacting storage system performance to a certain extent. Furthermore, traditional full-disk inspections maximize hard drive utilization, which inadvertently increases the probability of hard drive damage. Therefore, traditional inspection methods can compromise data security in storage systems.
[0007] Therefore, there is an urgent need for an inspection method that can improve the data security in the RAID disk array.
[0008] Summary of the Invention
[0009] Embodiments of the present application provide a RAID array inspection method, inspection device, storage system, non-volatile readable storage medium, and electronic device to at least alleviate the problem in related arts that RAID array inspection methods may affect data security.
[0010] According to one embodiment of the present application, a RAID array inspection method is provided, comprising: establishing a valid area bitmap, wherein the content of the valid area bitmap includes the physical addresses and status codes of all stripes in the RAID, the status code indicating whether the data in the physical address is valid or invalid, and RAID representing a disk array; in the event of data writing or data deletion in the RAID, updating the valid area bitmap and establishing a first inspection bitmap, wherein the content of the first inspection bitmap includes the physical addresses corresponding to the data with a valid status code in the updated valid area bitmap; obtaining an inspection cycle and establishing a first inspection task, wherein within the inspection cycle, at least the first inspection task is executed according to the first inspection bitmap, wherein the first inspection task is a task for inspecting the RAID, and the inspection cycle is the time between the start of the first inspection task and the start of the next inspection task.
[0011] In an exemplary embodiment, establishing a valid area bitmap includes: after a RAID array is created and no data is stored in the RAID, constructing an initial queue based on the physical addresses of all stripes in the RAID array to obtain a valid area bitmap, wherein the contents of the initial queue include the physical addresses and status codes of all stripes in the RAID, and the status codes are all invalid and indicate that no valid data exists at the physical addresses of all stripes in the RAID.
[0012] In an exemplary embodiment, updating the valid area bitmap includes: when data is written in the RAID and the status code corresponding to the physical address of the data written in the RAID is invalid, updating the status code corresponding to the physical address of the data written in the RAID from invalid to valid.
[0013] In an exemplary embodiment, updating the valid area bitmap includes: when all data corresponding to a physical address in the RAID is deleted, updating the status code corresponding to the deleted physical address from valid to invalid, wherein the deleted physical address is the physical address of the data deleted in the RAID.
[0014] In an exemplary embodiment, when data is written into the RAID and the status code corresponding to the physical address of the data written into the RAID is valid, the status code corresponding to the physical address of the data written into the RAID is not updated.
[0015] In an exemplary embodiment, when all data corresponding to a physical address in the RAID are not completely deleted, the status code corresponding to the physical address of the data deleted from the RAID is not updated.
[0016] In an exemplary embodiment, after updating the valid area bitmap, it also includes: determining whether there is a second patrol task currently, wherein the second patrol task represents a patrol task performed on the RAID array before the first patrol task starts; if there is a second patrol task currently, storing the physical address and status code of the data written to the RAID to the target queue, detecting whether the deleted physical address is located in the target queue, and if it is located in the target queue, deleting the deleted physical address in the target queue, wherein the target queue is formed after the last data writing or data deletion of the RAID and is used to store the physical address and status code of the data written to the RAID, and the deleted physical address is the physical address of the data deleted in the RAID.
[0017] In an exemplary embodiment, after storing the physical address and status code of the data written to the RAID in the target queue, the process further includes: after the second patrol task completes patrolling the RAID array according to the second patrol bitmap, patrolling the physical addresses in the target queue, wherein the second patrol bitmap includes the physical addresses required to be patrolled in the second patrol task.
[0018] In an exemplary embodiment, determining whether a second patrol task currently exists includes: detecting whether a second patrol bitmap currently exists in the storage system; determining whether a second patrol task currently exists if the second patrol bitmap exists; and determining whether a second patrol task currently does not exist if the second patrol bitmap does not exist, wherein the storage system is configured to store data and perform patrol tasks, and the second patrol bitmap includes a physical address required to be patrolled in the second patrol task.
[0019] In an exemplary embodiment, establishing the first patrol bitmap includes: copying the physical addresses corresponding to data with a valid status code in the updated valid area bitmap to obtain the first patrol bitmap.
[0020] In an exemplary embodiment, performing the first patrol task at least according to the first patrol bitmap includes: calculating the ratio of the number of physical addresses in the first patrol bitmap to the patrol cycle to obtain a preset patrol speed; performing the first patrol task according to the first patrol bitmap and the preset patrol speed.
[0021] In an exemplary embodiment, after executing the first patrol task according to the first patrol bitmap and the preset patrol speed, it also includes: after the first patrol task is completed according to the first patrol bitmap, patrolling the physical address in the target queue generated during the execution of the first patrol task, wherein the target queue is formed after the last data writing or data deletion of the RAID and is used to store the physical address and status code of the data written to the RAID.
[0022] In an exemplary embodiment, executing a first patrol task includes: performing an XOR calculation on multiple target data in a physical address included in a first patrol bitmap to obtain an XOR result, and comparing the XOR result with an initial XOR result to determine whether the XOR result is the same, wherein the initial XOR result is an XOR result obtained by performing an XOR calculation on the multiple target data before storing the multiple target data in a RAID array; if the XOR result is the same as the initial XOR result, determining that the multiple target data are correct; if the XOR result is different from the initial XOR result, determining that there is an error in the multiple target data.
[0023] In an exemplary embodiment, after executing the first inspection task at least according to the first inspection bitmap, it also includes: detecting whether there are other tasks in the storage system, ending the inspection if there are other tasks, and performing the next inspection task if there are no other tasks, wherein the storage system is configured to store data and execute inspection tasks, and the other tasks represent tasks other than the inspection tasks in the storage system.
[0024] In an exemplary embodiment, when the status code is 1, it indicates that the corresponding physical address contains valid data, and when the status code is 0, it indicates that the corresponding physical address does not contain valid data.
[0025] In an exemplary embodiment, the method further includes: when the deleted physical address is located in the second patrol bitmap, not deleting the deleted physical address in the second patrol bitmap being executed.
[0026] According to another embodiment of the present application, a RAID array inspection device is also provided, including: a first establishment module, configured to establish a valid area bitmap, wherein the content of the valid area bitmap includes the physical addresses and status codes of all stripes in the RAID, the status code indicates whether the data in the physical address is valid or invalid, and RAID represents a disk array; a second establishment module, configured to update the valid area bitmap and establish a first inspection bitmap when data is written or deleted in the RAID, wherein the content of the first inspection bitmap includes the physical addresses corresponding to the data with a valid status code in the updated valid area bitmap; an execution module, configured to obtain a inspection cycle and establish a first inspection task, and within the inspection cycle, at least execute the first inspection task according to the first inspection bitmap, wherein the first inspection task is a task for inspecting the RAID, and the inspection cycle is the time between the start of the first inspection task and the start of the next inspection task.
[0027] According to another embodiment of the present application, a storage system is also provided, including a RAID module, a storage upper-layer module, a storage lower-layer module and a hard disk. The storage system interacts with the host for business and is configured to execute the steps in any of the above method embodiments.
[0028] According to another embodiment of the present application, a non-volatile readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when running.
[0029] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0030] Through the embodiments of the present application, first, a valid area bitmap is established based on the physical addresses and status codes of the data in the RAID disk array. In the event of data writing or data deletion, the valid area bitmap is updated, and a first patrol bitmap is established based on the physical addresses corresponding to the data with valid status codes in the valid area bitmap. The RAID disk array is then patrolled at least according to the first patrol bitmap. Compared to the prior art method of patrolling data at all physical addresses in the RAID array, the embodiments of the present application establish the first patrol bitmap based on the physical addresses with valid status codes in the valid area bitmap, that is, only patrolling data corresponding to physical addresses containing valid data. This reduces the frequency of use of the RAID disk array, improves the stability of the disk, and thus improves the security of the data. Therefore, it can alleviate the problem that the existing RAID array patrol method affects data security, thereby achieving the purpose of reducing the impact on data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] FIG1 is a hardware structure block diagram of a mobile terminal for a RAID array inspection method according to an embodiment of the present application;
[0032] FIG2 is a flow chart of a RAID array inspection method according to an embodiment of the present application;
[0033] FIG3 is a schematic diagram of a storage system architecture in which a RAID array inspection method according to an embodiment of the present application is applied;
[0034] FIG4 is a flow chart of an optional RAID array inspection method according to an embodiment of the present application;
[0035] FIG5 is a flowchart of another optional RAID array inspection method according to an embodiment of the present application;
[0036] FIG6 is a structural block diagram of a RAID array inspection device according to an embodiment of the present application.
[0037] The above drawings include the following reference numerals: 102, processor; 104, memory; 106, transmission device; 108, input / output device. DETAILED DESCRIPTION
[0038] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0039] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0040] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking the operation on a mobile terminal as an example, FIG1 is a hardware structure block diagram of a mobile terminal of a RAID array inspection method in an embodiment of the present application. As shown in FIG1 , the mobile terminal may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 configured to store data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 configured to have a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is for illustration only and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .
[0041] The memory 104 is configured to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the RAID array inspection method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 includes a memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal 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.
[0042] The transmission device 106 is configured to receive or transmit data via a network. Examples of such a network include a wireless network provided by the mobile terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 can be a radio frequency (RF) module configured to communicate with the Internet wirelessly.
[0043] In the prior art, after the RAID array is created, in the absence of other background tasks (such as reconstruction), the array creates a metadata management queue based on all stripes, where the metadata management queue contains the physical addresses on the disks corresponding to all stripes; the inspection task starts executing tasks based on the physical addresses in the queue, and each scheduling is encapsulated into multiple read IOs (Input Output) according to the granularity of blocks and sent to the hard disk, reading the data on all blocks corresponding to the stripe, and then calculating the consistency of the read data using XOR, that is, checking whether Data (data) (XOR) Data (XOR) ... Data = Parity (check bit). If the data is normal, the next inspection task is carried out; otherwise, an alarm is reported to prompt that there is a problem in this area; when other background tasks occur during the inspection process, the inspection task is temporarily suspended, and when it can be continued, it continues the inspection backward according to the previous progress. After completing one round of inspection tasks, the next round of inspection is carried out directly. As mentioned in the background, existing RAID array inspection methods have the following problems: A full-disk inspection maximizes hard drive utilization, which in turn increases the probability of hard drive damage. Hard drive damage can result in data loss, leading to data security issues. Therefore, embodiments of the present application provide a RAID array inspection method, apparatus, non-volatile readable storage medium, and electronic device to at least alleviate the problem of data security issues associated with RAID array inspection methods in related technologies.
[0044] In this embodiment, a RAID array inspection method running on the above-mentioned mobile terminal is provided. FIG2 is a flow chart of a RAID array inspection method according to an embodiment of the present application. As shown in FIG2 , the flow chart includes the following steps:
[0045] Step S202: Create a valid region bitmap, wherein the valid region bitmap includes the physical addresses and status codes of all stripes in the RAID, wherein the status codes indicate whether the data at the physical addresses is valid or invalid, and the RAID represents a disk array.
[0046] Optionally, RAID (Redundant Arrays of Independent Disks, RAID for short) is divided into hard RAID (based on hardware RAID card, integrating a certain specific RAID algorithm) and soft RAID (software implementation of RAID), and the embodiment of the present application is applied to soft RAID. During the use of RAID, the occupation and release of files determines that the array will occupy all hard disk space only in extreme scenarios. Therefore, there is no need to check all the space every time an inspection is carried out. Only the space with valid data needs to be inspected. Therefore, the embodiment of the present application establishes a valid area bitmap, that is, the physical address in the disk array and the status code indicating whether the above physical address contains valid data are stored in the valid area bitmap. When the status code is 1, it indicates that the corresponding physical address contains valid data. When the status code is 0, it indicates that the corresponding physical address does not contain valid data. That is, in the subsequent inspection process, only the physical address with a status code of 1 needs to be inspected.
[0047] Step S204: When data is written or deleted in the RAID, the valid area bitmap is updated and a first patrol bitmap is created, wherein the first patrol bitmap includes the physical addresses corresponding to the data with the valid status code in the updated valid area bitmap;
[0048] Optionally, in actual application, data may be written to or deleted from the RAID array at any time. Therefore, the above-mentioned valid area bitmap needs to be updated before the inspection to prevent the omission of physical addresses that need to be inspected or the repeated inspection of the physical addresses of deleted data, thereby improving the timeliness of the inspection. A first inspection bitmap is established based on the updated valid area bitmap. The first inspection bitmap only includes the physical addresses corresponding to the data with a valid status code in the updated valid area bitmap, so that the subsequent inspection process is inspected according to the first inspection bitmap. By changing the scope of the inspection, the embodiment of the present application greatly reduces the additional loss to the RAID disk array.
[0049] Step S206, obtain the inspection cycle, establish the first inspection task, and within the above inspection cycle, execute the above first inspection task at least according to the above first inspection bitmap, wherein the above first inspection task is a task of inspecting the above RAID, and the above inspection cycle is the time between the start of the above first inspection task and the start of the next inspection task.
[0050] Optionally, the inspection cycle can be set based on actual application scenarios. For example, if the inspection cycle is five minutes, data inspection of the RAID array is performed at least every five minutes according to the first inspection bitmap. By optimizing the inspection method, the continuous performance impact caused by the inspection is optimized, and the local performance of the storage system is improved. The above inspection cycle can be set based on actual application scenarios, that is, the embodiment of the present application does not limit the value of the above inspection cycle.
[0051] Through the above steps, first, a valid area bitmap is established based on the physical addresses and status codes of the data in the RAID disk array. In the case of data writing or data deletion, the valid area bitmap is updated, and a first patrol bitmap is established based on the physical addresses corresponding to the data with valid status codes in the valid area bitmap, and the RAID disk array is patrolled at least according to the first patrol bitmap. Compared with the method of patrolling data at all physical addresses in the RAID array in the prior art, the embodiment of the present application establishes a first patrol bitmap based on the physical addresses with valid status codes in the valid area bitmap, that is, only patrolling data corresponding to the physical addresses containing valid data, thereby reducing the frequency of use of the RAID disk array, reducing the probability of disk damage, improving the stability of the disk, and thus improving data security, alleviating the problem that the RAID array patrol method in the prior art may affect data security, reducing the problem of data loss due to disk damage, and improving data security.
[0052] The execution entity of the above steps may be a server, a terminal, etc., but is not limited thereto.
[0053] In some embodiments of the present application, establishing a valid area bitmap includes: after the RAID array is created and no data is stored in the RAID, constructing an initial queue based on the physical addresses of all stripes in the RAID array to obtain a valid area bitmap, wherein the contents of the initial queue include the physical addresses and status codes of all stripes in the RAID, and the status codes are all invalid and indicate that no valid data exists at the physical addresses of all stripes in the RAID. Through this method, when no data is stored in the RAID, an initial queue is first constructed that includes the physical addresses of all stripes in the RAID array. Since no data is stored in the RAID array, the status codes of the physical addresses in the initial queue are all invalid. The valid area bitmap is obtained from the initial queue. In this way, when a subsequent inspection task is performed, the status codes of all physical addresses in the RAID can be updated to distinguish whether the physical addresses contain valid data.
[0054] Optionally, after the RAID array is created but no data has been stored, the RAID array is in an initial state. At this time, no valid data exists in the physical addresses of all stripes in the RAID array, and the status codes are all invalid, i.e., the status codes of all physical addresses are 0. An initial queue is constructed based on all physical addresses and corresponding status codes to obtain a valid area bitmap. It should be noted that the valid area bitmap is in an initial state at this time, i.e., the valid area bitmap has not yet been used to perform inspection tasks. During the subsequent execution of inspection tasks, the valid area bitmap will update the status codes corresponding to the physical addresses according to the inspection cycle to indicate whether data has been written or deleted. The method for updating the valid area bitmap will be described below.
[0055] In some embodiments of the present application, updating the valid area bitmap includes: when data is written to the RAID array and the status code corresponding to the physical address of the data written to the RAID array is invalid, updating the status code corresponding to the physical address of the data written to the RAID array from invalid to valid. By updating the status code corresponding to the invalid physical address to valid, the valid area bitmap can be updated in a timely manner.
[0056] Optionally, data is written and deleted from the RAID at any time, and the valid area bitmap needs to change in real time as data is written and deleted. When data is written, the physical address indicating an invalid status code becomes valid, and the status code corresponding to the physical address of the deleted data is updated from 0 to 1.
[0057] In some embodiments of the present application, if all data corresponding to a physical address in the RAID array is deleted, the status code corresponding to the deleted physical address is updated from valid to invalid, where the deleted physical address is the physical address of the data deleted from the RAID array. By updating the status code corresponding to a valid physical address to invalid, this method can also ensure that the valid area bitmap can be updated in a timely manner.
[0058] Alternatively, as mentioned above, data is written and deleted from RAID at any time, and the valid area bitmap needs to change in real time as data is written and deleted. When data is deleted, the physical address that indicated a valid status code becomes invalid, and the status code corresponding to the physical address of the deleted data is updated from 1 to 0.
[0059] In some embodiments of the present application, if data is written to the RAID array and the status code corresponding to the physical address of the data written to the RAID array is valid, the status code corresponding to the physical address of the data written to the RAID array is not updated. This method does not update the status code of the physical address where data already exists, thus avoiding repeated operations on previously valid status codes, simplifying the operation steps, and improving the flexibility of the method.
[0060] Optionally, in actual application, there may be a physical address where the data is written to a valid status code, that is, the physical address already has valid data, that is, the status code corresponding to the physical address in the valid area bitmap is valid. At this time, the writing of data does not change the status of the valid data in the physical address, that is, there is no physical address whose status changes from valid to invalid or from invalid to valid, so there is no need to update the above-mentioned valid area bitmap.
[0061] In some embodiments of the present application, if all data corresponding to a physical address in the RAID array has not been completely deleted, the status code corresponding to the physical address of the data deleted from the RAID array is not updated. This method also prevents the status code from being updated even if all data at the physical address has not been completely deleted, thereby avoiding deletion of valid physical addresses that still have valid data and thus preventing omission of physical addresses.
[0062] Optionally, in actual application, there may be a situation where only part of the data in a physical address is deleted but not completely deleted. At this time, the valid status of the physical address in the valid area bitmap has not changed. Therefore, in this case, there is no need to update the valid area bitmap.
[0063] In some embodiments of the present application, after updating the valid area bitmap, the method further includes: determining whether a second inspection task currently exists, wherein the second inspection task represents an inspection task executed on the RAID array before the first inspection task begins; if the second inspection task currently exists, storing the physical address and status code of the data written to the RAID array in a target queue, detecting whether the deleted physical address is located in the target queue, and deleting the deleted physical address in the target queue if it is located in the target queue, wherein the target queue is formed after the last data writing or data deletion in the RAID array and is used to store the physical address and status code of the data written to the RAID array, and the deleted physical address is the physical address of the data deleted from the RAID array. Through the above steps, if the second inspection task exists, the physical address and status code of the stored data are stored in the target queue, so that the data stored or deleted during the execution of the second inspection task can be timely identified and updated.
[0064] Optionally, when it is detected that there is a second patrol task, that is, there is currently a second patrol task being performed, if there is data being written to the disk array, the physical address corresponding to the written data is stored in the target queue. After the second patrol task is completed, the physical address saved in the target queue is patrolled. In actual application, there will also be data written to the physical address that already contains valid data. At this time, it can be first determined whether the physical address to which the data is written already exists in the patrol bitmap corresponding to the second patrol task (that is, the second patrol bitmap below). When it exists in the patrol bitmap corresponding to the second patrol task, there is no need to store the physical address to which the data is written to the target queue. Therefore, the above steps can be adjusted according to the actual application scenario. If data is being deleted from the disk array, it is necessary to determine the location of the deleted physical address, that is, to determine whether the deleted physical address is in the target queue or in the inspection bitmap corresponding to the second inspection task. If it is in the target queue, the deleted physical address will be deleted from the target queue. If it is in the inspection bitmap corresponding to the second inspection task, since the second inspection task is being inspected according to the inspection bitmap corresponding to the second inspection task, the deleted physical address in the inspection bitmap corresponding to the second inspection task being executed will not be deleted.
[0065] It should be noted that when there is no second inspection task and data is written or deleted, it is only necessary to update the status code corresponding to the physical address of the data written or deleted in the above valid area bitmap according to the steps in the previous embodiment.
[0066] In some embodiments of the present application, after storing the physical address and status code of the data written to the RAID array in the target queue, the method further includes: after the second inspection task completes the inspection of the RAID array according to the second inspection bitmap, inspecting the physical addresses in the target queue, wherein the second inspection bitmap includes the physical addresses to be inspected in the second inspection task. Through these steps, data written or deleted at any time can be updated and inspected in a timely manner.
[0067] Optionally, since the second inspection task is the inspection task currently being executed, the target queue formed when the second inspection task is being executed needs to perform data inspection on the physical address in the target queue after the second inspection task is completed according to the second inspection bitmap. Only after the inspection of the target queue is completed is the second inspection task completed. It should be noted that the second inspection bitmap is inspected in the second inspection task. After the second inspection bitmap is inspected, the second inspection task continues to inspect the physical address in the target queue. Only after the inspection of the physical address in the target queue is completed, the second inspection task is completed. Therefore, during the execution of each inspection task, the inspection steps are the same, that is, it is necessary to first inspect the inspection bitmap corresponding to each inspection task, and then inspect the physical address in the target queue. Only then is the entire inspection task considered completed. That is, in the first inspection task, inspection is first performed according to the first inspection bitmap, and then inspection is performed according to the target queue. In some embodiments of the present application, determining whether a second inspection task currently exists includes: detecting whether a second inspection bitmap currently exists in the storage system; determining that a second inspection task currently exists if the second inspection bitmap exists; and determining that a second inspection task currently does not exist if the second inspection bitmap does not exist, wherein the storage system is configured to store data and perform inspection tasks, and the second inspection bitmap includes the physical address required to be inspected in the second inspection task.
[0068] Optionally, in actual applications, the storage system will automatically identify whether any task is running. The determination of whether any inspection task is running is made by detecting whether there is a inspection bitmap. That is, when the second inspection task is being executed, it can be identified that there is a second inspection bitmap in the storage system, thereby determining the existence of a second inspection task.
[0069] In some embodiments of the present application, establishing a first patrol bitmap includes copying the physical addresses corresponding to the data with a valid status code in the updated valid region bitmap to obtain the first patrol bitmap. Through these steps, only the physical addresses with valid data status codes are patrolled. This achieves the purpose of patrolling the RAID array while reducing unnecessary disk usage and improving data security.
[0070] Optionally, since the embodiment of the present application only performs data inspection on physical addresses containing valid data, the physical addresses corresponding to the data with valid status codes in the valid area bitmap are copied to generate a first inspection bitmap, and the RAID array is subsequently inspected according to the first inspection bitmap. During the inspection according to the first inspection bitmap, the first inspection bitmap is kept unchanged.
[0071] In some embodiments of the present application, performing the first patrol task according to at least the first patrol bitmap includes: calculating the ratio of the number of physical addresses in the first patrol bitmap to the patrol period to obtain a preset patrol speed; and performing the first patrol task according to the first patrol bitmap and the preset patrol speed. By calculating the preset patrol speed based on the ratio of the number of physical addresses containing valid data, i.e., the number of physical addresses in the first patrol bitmap, to the patrol period, the patrol speed can be adapted to the first patrol bitmap.
[0072] Optionally, since the prior art performs inspections according to all physical addresses in the RAID array, the inspection speed is the ratio of the number of all physical addresses in the array to the inspection cycle, that is, after setting the inspection cycle, the ratio of the total number of physical addresses to the inspection cycle is calculated to obtain the number of physical addresses that need to be inspected per unit time. If other tasks (for example, reconstruction tasks) interrupt the inspection task in the middle, the speed of the inspection task remains unchanged and the inspection is still performed according to the inspection speed. Therefore, the above-mentioned inspection speed calculation method is no longer applicable to the inspection method based on the valid area bitmap and the first inspection bitmap in the embodiment of the present application. The preset inspection speed in the embodiment of the present application is the ratio of the number of physical addresses in the first inspection bitmap to the inspection cycle, that is, the number of physical addresses that need to be inspected per unit time is calculated according to the total number of physical addresses in the first inspection bitmap / inspection cycle (s). For example, the preset inspection speed is 40 per second and the inspection cycle is 5 minutes. It is calculated that 40*5*60=12,000 physical addresses need to be inspected in 5 minutes. Based on the actual system bandwidth, 12,000 physical addresses are allocated to 5 minutes. After the inspection is completed, the inspection stops until the next 5-minute timer re-triggers the inspection of the next 12,000 physical addresses.
[0073] In some embodiments of the present application, after executing the first inspection task at least according to the first inspection bitmap, the method further includes: detecting whether there are other tasks in the storage system, terminating the inspection if there are other tasks, and proceeding to the next inspection task if there are no other tasks, wherein the storage system is configured to store data and execute the inspection tasks, and the other tasks represent tasks in the storage system other than the inspection task. Through the above steps, after the first inspection task is completed, if the presence of other tasks is detected, the other tasks are executed first, thereby avoiding the impact of the inspection on the operation of other tasks.
[0074] Optionally, after the first inspection task is completed, the storage system is checked to see whether there are other tasks, such as reconstruction tasks. If there are other tasks, the other tasks are executed first. If there are no other tasks, the next inspection task is executed again according to the steps of the embodiment of the present application.
[0075] In some embodiments of the present application, after executing the first patrol task according to the first patrol bitmap and the preset patrol speed, the method further includes: after the first patrol task is completed according to the first patrol bitmap, patrolling the physical addresses in the target queue generated during the execution of the first patrol task, wherein the target queue is formed after the last data writing or data deletion of the RAID and is used to store the physical addresses and status codes of the data written to the RAID. Through the above steps, if data is written or deleted during the execution of the first patrol task, the physical addresses in the target queue continue to be patrolled after the first patrol task is completed, thereby ensuring that physical addresses with valid data are not missed.
[0076] Optionally, within each inspection cycle, it is necessary to first inspect according to the inspection bitmap as described above, and then inspect the target queue within the inspection cycle. Therefore, within the first inspection cycle, when the first inspection task is inspecting according to the first inspection bitmap, if there is data writing, the physical address of the written data is stored in the target queue, and if there is data deletion, it is determined whether the physical address of the deleted data exists in the target queue. If it exists, the physical address is deleted. If it does not exist, neither the target queue nor the valid area bitmap is deleted. After the first inspection task is inspected according to the first inspection bitmap, the physical address in the target queue is inspected again to ensure that the physical address with valid data is not missed.
[0077] In some embodiments of the present application, executing the above-mentioned first inspection task includes: performing an XOR calculation on multiple target data in the physical address contained in the above-mentioned first inspection bitmap to obtain an XOR result, and comparing the above-mentioned XOR result with the initial XOR result to see whether they are the same, wherein the above-mentioned initial XOR result is the XOR result obtained by performing an XOR calculation on the multiple target data before storing the multiple target data in the above-mentioned RAID array; if the above-mentioned XOR result is the same as the above-mentioned initial XOR result, it is determined that the multiple target data are correct; if the above-mentioned XOR result is different from the above-mentioned initial XOR result, it is determined that the multiple target data have errors. Through the above steps, it is determined whether the data in the inspected physical address has errors by the XOR method, which can conveniently and effectively locate the physical address where the erroneous data exists.
[0078] Optionally, after the RAID array is generated, before the target data is stored in the RAID array, multiple target data are XORed. For example, if the target data are D1, D2, and D3, the XOR calculation is performed before being stored in the RAID array to obtain an XOR result, i.e., an initial XOR result. The initial XOR result is stored in a check block, and then the target data D1, D2, and D3 are stored in the same physical address, which contains the check block. When performing an inspection task, the target data D1, D2, and D3 at the physical address are read, and the XOR calculation is performed again to obtain a new XOR result. The initial XOR result in the check block is compared with the new XOR result. If the initial XOR result in the check block is the same as the new XOR result, it indicates that there is no error in the target data D1, D2, and D3. If the initial XOR result in the check block is different from the new XOR result, it indicates that there is an error in at least one of the target data D1, D2, and D3, thereby locating the physical address of the erroneous data for timely isolation and repair.
[0079] FIG3 is a schematic diagram of a storage system architecture for a RAID array inspection method according to an embodiment of the present application. As shown in FIG3 , service interaction io (input and output) is performed between the host and the storage system. The storage system is divided into an upper storage module, a Raid (RAID) module, and a lower storage module and a hard disk. Service interaction io (input and output) is performed between the upper storage module and the Raid (RAID) module, and service interaction io (input and output) is performed between the Raid (RAID) module and the lower storage module and the hard disk. The Raid (RAID) inspection task performs inspection reading io (input and output) on the lower storage module and the hard disk, and the inspection task performs inspection io (input and output) on the Raid (RAID). The storage system is configured to execute the above-mentioned RAID array inspection method.
[0080] In order to enable those skilled in the art to more clearly understand the technical solutions of the embodiments of the present application, the implementation process of the RAID array inspection method of the embodiments of the present application will be described in detail below in combination with optional embodiments.
[0081] This embodiment relates to an optional RAID array inspection method, as shown in FIG4 and FIG5 , including the following steps:
[0082] Step S1: Create a valid area bitmap, the content of which includes the physical addresses and status codes of all stripes in the RAID;
[0083] Step S2: If there is host data writing, determine whether there is a patrol task (second patrol task). If there is a second patrol task, update the valid area bitmap and the most recently written queue (target queue), that is, update the status code corresponding to the physical address corresponding to the written data in the valid area bitmap from invalid (0) to valid (1), and store the physical address corresponding to the written data in the target queue. If there is no second patrol task, update the valid area bitmap, that is, update the status code corresponding to the physical address corresponding to the written data in the valid area bitmap from invalid (0) to valid (1).
[0084] Step S3: In the case of data deletion, determine whether there is a patrol task (second patrol task). In the case of no second patrol task, update the valid area bitmap, that is, update the status code corresponding to the physical address corresponding to the deleted data in the valid area bitmap from valid (0) to invalid (0). In the case of the second patrol task, detect whether the deleted area (deleted physical address) is in the most recently written queue (target queue). In the case that the deleted physical address is in the target queue, update the valid area bitmap, delete the relevant record (deleted physical address) in the most recently written queue (target queue). In the case that the deleted physical address is not in the target queue, directly update the valid area bitmap.
[0085] Step S4: Prepare a patrol bitmap (first patrol bitmap) through the valid area bitmap, calculate the number of patrol strips (physical addresses) per unit time (i.e., the preset patrol speed) according to the bitmap data volume (the number of physical addresses in the first patrol bitmap) and the patrol cycle, start the patrol, and after the patrol bitmap (first patrol bitmap) is inspected, the timer triggers the traversal of the most recently written queue (target queue), the queue traversal and patrol are completed, and the patrol stops;
[0086] Step S5: Check whether there are other tasks (rest of tasks). If there are other tasks (rest of tasks), the inspection ends and other tasks (rest of tasks) are started. If there are no other tasks (rest of tasks), the inspection bitmap (first inspection bitmap) is reset and the next inspection task begins.
[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a non-volatile readable storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the above-mentioned methods of each embodiment of the present application.
[0088] This embodiment also provides a RAID array inspection device, which is configured to implement the above-mentioned embodiments and optional implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0089] FIG6 is a block diagram of a RAID array inspection device according to an embodiment of the present application. As shown in FIG6 , the device includes:
[0090] A first establishing module 22 is configured to establish a valid region bitmap, wherein the valid region bitmap includes physical addresses and status codes of all stripes in the RAID, wherein the status codes indicate whether data at the physical addresses is valid or invalid, and the RAID represents a disk array;
[0091] Optionally, RAID (Redundant Arrays of Independent Disks, RAID for short) is divided into hard RAID (based on hardware RAID card, integrating a certain specific RAID algorithm) and soft RAID (software implementation of RAID), and the embodiment of the present application is applied to soft RAID. During the use of RAID, the occupation and release of files determines that the array will occupy all hard disk space only in extreme scenarios. Therefore, there is no need to check all the space every time an inspection is carried out. Only the space with valid data needs to be inspected. Therefore, the embodiment of the present application establishes a valid area bitmap, that is, the physical address in the disk array and the status code indicating whether the above physical address contains valid data are stored in the valid area bitmap. When the status code is 1, it indicates that the corresponding physical address contains valid data. When the status code is 0, it indicates that the corresponding physical address does not contain valid data. That is, in the subsequent inspection process, only the physical address with a status code of 1 needs to be inspected.
[0092] The second establishing module 24 is configured to update the valid area bitmap and establish a first patrol bitmap when data is written or deleted in the RAID, wherein the content of the first patrol bitmap includes the physical addresses corresponding to the data with the valid status code in the updated valid area bitmap;
[0093] Optionally, in actual application, data may be written to or deleted from the RAID array at any time. Therefore, the above-mentioned valid area bitmap needs to be updated before the inspection to prevent the omission of physical addresses that need to be inspected or the repeated inspection of the physical addresses of deleted data, thereby improving the timeliness of the inspection. A first inspection bitmap is established based on the updated valid area bitmap. The first inspection bitmap only includes the physical addresses corresponding to the data with a valid status code in the updated valid area bitmap, so that the subsequent inspection process is inspected according to the first inspection bitmap. By changing the scope of the inspection, the embodiment of the present application greatly reduces the additional loss to the RAID disk array.
[0094] The execution module 26 is configured to obtain a patrol cycle, establish a first patrol task, and execute the first patrol task at least according to the first patrol bitmap during the patrol cycle, wherein the first patrol task is a task for patrolling the RAID, and the patrol cycle is the time between the start of the first patrol task and the start of the next patrol task.
[0095] Optionally, the inspection cycle can be set based on actual application scenarios. For example, if the inspection cycle is five minutes, data inspection of the RAID array is performed at least every five minutes according to the first inspection bitmap. By optimizing the inspection method, the continuous performance impact caused by the inspection is optimized, and the local performance of the storage system is improved. The above inspection cycle can be set based on actual application scenarios, that is, the embodiment of the present application does not limit the value of the above inspection cycle.
[0096] Through the above-mentioned device, a valid area bitmap is established based on the physical addresses and status codes of the data in the RAID disk array. In the event of data writing or data deletion, the valid area bitmap is updated, a first patrol bitmap is established based on the physical addresses corresponding to the data with valid status codes in the valid area bitmap, and the RAID disk array is patrolled at least according to the first patrol bitmap. Compared with the device in the prior art that patrols the data at all physical addresses in the RAID array, the embodiment of the present application establishes the first patrol bitmap based on the physical addresses with valid status codes in the valid area bitmap, that is, only patrols the data corresponding to the physical addresses containing valid data. This reduces the frequency of use of the RAID disk array, reduces the probability of disk damage, improves the stability of the disk, and thus improves data security. It alleviates the problem that the existing RAID array patrol device affects data security, reduces the problem of data loss due to disk damage, and improves data security.
[0097] In some embodiments of the present application, the first establishment module includes a construction submodule, which is configured to, after the RAID array is created and before data is stored in the RAID, construct an initial queue based on the physical addresses of all stripes in the RAID array to obtain a valid area bitmap, wherein the content of the initial queue includes the physical addresses and status codes of all stripes in the RAID, and the status codes are all invalid and indicate that no valid data exists at the physical addresses of all stripes in the RAID. Through this method, when data is not stored in the RAID, an initial queue containing the physical addresses of all stripes in the RAID array is first constructed, and since no data is stored in the RAID array, the status codes of the physical addresses in the initial queue are all invalid, and a valid area bitmap is obtained from the initial queue. In this way, when a subsequent inspection task is performed, the status codes of all physical addresses in the RAID can be updated to distinguish whether the physical addresses contain valid data.
[0098] Optionally, after the RAID array is created but no data has been stored, the RAID array is in an initial state. At this time, no valid data exists in the physical addresses of all stripes in the RAID array, and the status codes are all invalid, i.e., the status codes of all physical addresses are 0. An initial queue is constructed based on all physical addresses and corresponding status codes to obtain a valid area bitmap. It should be noted that the valid area bitmap is in an initial state at this time, i.e., the valid area bitmap has not yet been used to perform inspection tasks. During the subsequent execution of inspection tasks, the valid area bitmap will update the status codes corresponding to the physical addresses according to the inspection cycle to indicate whether data has been written or deleted. The method for updating the valid area bitmap will be described below.
[0099] In some embodiments of the present application, the second establishment module includes: a first update submodule and a second update submodule, wherein the first update submodule is configured to update the status code corresponding to the physical address of the data written into the RAID from invalid to valid when data is written into the RAID and the status code corresponding to the physical address of the data written into the RAID is invalid; and the second update submodule is configured to update the status code corresponding to the deleted physical address from valid to invalid when all data corresponding to a physical address in the RAID is deleted, wherein the deleted physical address is the physical address of the data deleted from the RAID. Through the above-mentioned device, the data status corresponding to the physical address of the stored data or the physical address of the deleted data can be updated in a timely manner to avoid omissions and repeated inspections.
[0100] Optionally, data writing and data deletion in RAID occur at any time, and the valid area bitmap needs to change in real time as data is written and deleted. When data is written, the physical address indicating an invalid status code becomes valid, and the status code corresponding to the physical address where the data was written is updated from 0 to 1. When data is deleted, the physical address indicating a valid status code becomes invalid, and the status code corresponding to the physical address where the data was deleted is updated from 1 to 0.
[0101] In some embodiments of the present application, the apparatus further includes a first execution submodule configured to not update the status code corresponding to the physical address of the data written into the RAID if data is written into the RAID and the status code corresponding to the physical address of the data written into the RAID is valid. This method prevents the status code of the physical address where data already exists from being updated, thus avoiding repeated operations on previously valid status codes, simplifying the operational steps, and improving the flexibility of the method.
[0102] Optionally, in actual application, there may be a physical address where the data is written to a valid status code, that is, the physical address already has valid data, that is, the status code corresponding to the physical address in the valid area bitmap is valid. At this time, the writing of data does not change the status of the valid data in the physical address, that is, there is no physical address whose status changes from valid to invalid or from invalid to valid, so there is no need to update the above-mentioned valid area bitmap.
[0103] In some embodiments of the present application, the apparatus further includes a second execution submodule configured to not update a status code corresponding to a physical address of data deleted from the RAID if all data corresponding to a physical address in the RAID has not been completely deleted. This method prevents the status code from being updated even if all data at the physical address has not been completely deleted, thereby avoiding deletion of valid physical addresses that still contain valid data and thus preventing omission of physical addresses.
[0104] Optionally, in actual application, there may be a situation where only part of the data in a physical address is deleted but not completely deleted. At this time, the valid status of the physical address in the valid area bitmap has not changed. Therefore, in this case, there is no need to update the valid area bitmap.
[0105] In some embodiments of the present application, the apparatus further includes a determination module and a deletion module, wherein the determination module is configured to determine whether a second inspection task is currently in existence, wherein the second inspection task is a inspection task performed on the RAID array before the first inspection task is started; and the deletion module is configured to, if the second inspection task is currently in existence, store the physical address and status code of the data written to the RAID array into a target queue, detect whether the deleted physical address is located in the target queue, and if it is located in the target queue, delete the deleted physical address from the target queue, wherein the target queue is formed after the last data writing or data deletion in the RAID array and is used to store the physical address and status code of the data written to the RAID array, and the deleted physical address is the physical address of the data deleted from the RAID array. By means of the apparatus, if the second inspection task is in existence, the physical address and status code of the stored data are stored into the target queue, thereby enabling timely identification and updating of data stored or deleted during the execution of the second inspection task.
[0106] Optionally, when it is detected that there is a second patrol task, that is, there is currently a second patrol task being performed, if there is data being written to the disk array, the physical address corresponding to the written data is stored in the target queue. After the second patrol task is completed, the physical address saved in the target queue is patrolled. In actual application, there will also be data written to the physical address that already contains valid data. At this time, it is possible to first determine whether the physical address to which the data is written already exists in the patrol bitmap corresponding to the second patrol task (that is, the second patrol bitmap below). When it exists in the patrol bitmap corresponding to the second patrol task, there is no need to store the physical address to which the data is written in the target queue. Therefore, the above-mentioned device can be adjusted according to the actual application scenario. If data is being deleted from the disk array, it is necessary to determine the location of the deleted physical address, that is, to determine whether the deleted physical address is in the target queue or in the inspection bitmap corresponding to the second inspection task. If it is in the target queue, the deleted physical address will be deleted from the target queue. If it is in the inspection bitmap corresponding to the second inspection task, since the second inspection task is being inspected according to the inspection bitmap corresponding to the second inspection task, the physical address deleted in the inspection bitmap corresponding to the second inspection task being executed will not be deleted.
[0107] It should be noted that when there is no second inspection task and data is written or deleted, it is only necessary to update the status code corresponding to the physical address of the data written or deleted in the above valid area bitmap according to the device in the previous embodiment.
[0108] In some embodiments of the present application, the apparatus further comprises a patrol module configured to patrol the physical addresses in the target queue after the second patrol task completes patrolling the RAID array according to a second patrol bitmap, wherein the second patrol bitmap includes the physical addresses to be patrolled in the second patrol task. This apparatus enables timely updating and patrolling of data that has been written or deleted at any time.
[0109] Optionally, since the second inspection task is the inspection task currently being executed, the target queue formed when the second inspection task is being executed needs to perform data inspection on the physical address in the target queue after the second inspection task is completed according to the second inspection bitmap. Only after the inspection of the target queue is completed, it is indicated that the second inspection task is completed.
[0110] In some embodiments of the present application, the judgment module includes a determination submodule configured to detect whether a second patrol bitmap exists in the storage system, and to determine the presence of a second patrol task if the second patrol bitmap exists, and to determine the absence of the second patrol task if the second patrol bitmap does not exist. The storage system is configured to store data and perform the RAID array patrol, and the second patrol bitmap includes physical addresses to be patrolled in the second patrol task. This device facilitates determining whether the second patrol task exists.
[0111] Optionally, in actual applications, the storage system will automatically identify whether any task is running. The determination of whether any inspection task is running is made by detecting whether there is a inspection bitmap. That is, when the second inspection task is being executed, it can be identified that there is a second inspection bitmap in the storage system, thereby determining the existence of a second inspection task.
[0112] In some embodiments of the present application, the second establishment module includes a copy submodule configured to copy the physical addresses corresponding to the data with the valid status code in the updated valid region bitmap to obtain a first inspection bitmap. This device only inspects the physical addresses of the data with the valid status code, thereby achieving the purpose of inspecting the RAID array while reducing unnecessary disk usage and improving data security.
[0113] Optionally, since the embodiment of the present application only performs data inspection on physical addresses containing valid data, the physical addresses corresponding to the data with valid status codes in the valid area bitmap are copied to generate a first inspection bitmap, and the RAID array is subsequently inspected according to the first inspection bitmap. During the inspection according to the first inspection bitmap, the first inspection bitmap is kept unchanged.
[0114] In some embodiments of the present application, the execution module includes: a calculation submodule and an execution submodule, wherein the calculation submodule is configured to calculate the ratio of the number of physical addresses in the first patrol bitmap to the patrol period to obtain a preset patrol speed; and the execution submodule is configured to execute the first patrol task according to the first patrol bitmap and the preset patrol speed. Through the above-mentioned device, the preset patrol speed is calculated based on the ratio of the number of physical addresses containing valid data, i.e., the number of physical addresses in the first patrol bitmap, to the patrol period, so that the patrol speed can be adapted to the first patrol bitmap.
[0115] Optionally, since the prior art performs inspections based on all physical addresses in the RAID array, the inspection speed is the ratio of the number of all physical addresses in the array to the inspection cycle. That is, after setting the inspection cycle, the ratio of the total number of physical addresses to the inspection cycle is calculated to obtain the number of physical addresses that need to be inspected per unit time. If the inspection task is interrupted by other tasks (e.g., reconstruction tasks), the speed of the inspection task remains unchanged and the inspection is still performed at the inspection speed. Therefore, the above-mentioned inspection speed calculation device is no longer applicable to the inspection method based on the valid area bitmap and the first inspection bitmap in the embodiment of the present application. The preset inspection speed in the embodiment of the present application is the ratio of the number of physical addresses in the first inspection bitmap to the inspection cycle, that is, the number of physical addresses that need to be inspected per unit time is calculated according to the total number of physical addresses in the first inspection bitmap / inspection cycle (s). For example, the preset inspection speed is 40 per second and the inspection cycle is 5 minutes. It is calculated that 40*5*60=12,000 physical addresses need to be inspected in 5 minutes. Based on the actual system bandwidth, 12,000 physical addresses are allocated to 5 minutes. After the inspection is completed, the inspection stops until the next 5-minute timer re-triggers the inspection of the next 12,000 physical addresses.
[0116] In some embodiments of the present application, the apparatus further comprises: a detection module configured to detect whether the storage system has any remaining tasks, and to terminate the inspection if any remaining tasks exist, and to proceed to the next inspection task if no remaining tasks exist, wherein the storage system is configured to store data and execute the inspection tasks, and the remaining tasks represent tasks in the storage system other than the inspection task. With the apparatus, after the first inspection task is completed, if the remaining tasks are detected, the remaining tasks are executed first, thereby preventing the inspection from affecting the operation of the remaining tasks.
[0117] Optionally, after the first inspection task is completed, the storage system is checked to see whether there are other tasks, such as reconstruction tasks. If there are other tasks, the other tasks are executed first. If there are no other tasks, the next inspection task is executed again according to the device of the embodiment of the present application.
[0118] In some embodiments of the present application, the execution module further includes a patrol submodule configured to patrol the physical addresses in the target queue generated during the execution of the first patrol task after the first patrol task is completed according to the first patrol bitmap, wherein the target queue is formed after the last data write or data deletion of the RAID and is used to store the physical addresses and status codes of the data written to the RAID. Through the above steps, if data is written or deleted during the execution of the first patrol task, the physical addresses in the target queue continue to be patrolled after the first patrol task is completed, thereby ensuring that physical addresses with valid data are not missed.
[0119] Optionally, within each inspection cycle, it is necessary to first inspect according to the inspection bitmap as described above, and then inspect the target queue within the inspection cycle. Therefore, within the first inspection cycle, when the first inspection task is inspecting according to the first inspection bitmap, if there is data writing, the physical address of the written data is stored in the target queue, and if there is data deletion, it is determined whether the physical address of the deleted data exists in the target queue. If it exists, the physical address is deleted. If it does not exist, neither the target queue nor the valid area bitmap is deleted. After the first inspection task is inspected according to the first inspection bitmap, the physical address in the target queue is inspected again to ensure that the physical address with valid data is not missed.
[0120] In some embodiments of the present application, the execution submodule further includes a comparison submodule and a determination submodule, wherein the comparison submodule is configured to perform an XOR calculation on multiple target data in the physical address contained in the above-mentioned first inspection bitmap to obtain an XOR result, and compare the above-mentioned XOR result with the initial XOR result to see whether they are the same, wherein the above-mentioned initial XOR result is the XOR result obtained by performing an XOR calculation on the multiple target data before storing the multiple target data in the above-mentioned RAID array; the determination submodule is configured to determine that the multiple target data are correct when the above-mentioned XOR result is the same as the above-mentioned initial XOR result, and determine that the multiple target data are erroneous when the above-mentioned XOR result is different from the above-mentioned initial XOR result. Through the above steps, it is determined whether the data in the inspected physical address is erroneous by the XOR method, so that the physical address with erroneous data can be conveniently and effectively located.
[0121] Optionally, after the RAID array is generated, before the target data is stored in the RAID array, multiple target data are XORed. For example, if the target data are D1, D2, and D3, the XOR calculation is performed before being stored in the RAID array to obtain an XOR result, i.e., an initial XOR result. The initial XOR result is stored in a check block, and then the target data D1, D2, and D3 are stored in the same physical address, which contains the check block. When performing an inspection task, the target data D1, D2, and D3 at the physical address are read, and the XOR calculation is performed again to obtain a new XOR result. The initial XOR result in the check block is compared with the new XOR result. If the initial XOR result in the check block is the same as the new XOR result, it indicates that there is no error in the target data D1, D2, and D3. If the initial XOR result in the check block is different from the new XOR result, it indicates that there is an error in at least one of the target data D1, D2, and D3, thereby locating the physical address of the erroneous data for timely isolation and repair.
[0122] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0123] An embodiment of the present application further provides a non-volatile readable storage medium, in which a computer program is stored. The computer program is configured to execute the apparatus in any one of the above method embodiments when running.
[0124] In an exemplary embodiment, the non-volatile readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk, and other media that can store computer programs.
[0125] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the apparatus in any one of the above method embodiments.
[0126] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0127] For optional examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementations, and this embodiment will not be described in detail here.
[0128] Obviously, those skilled in the art should understand that the various modules or devices of the above-mentioned embodiments of the present application can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented using program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the devices shown or described can be executed in a different order than herein, or they can be made into individual integrated circuit modules, or multiple modules or devices therein can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0129] The above are merely optional embodiments of the present application and are not intended to limit the embodiments of the present application. For those skilled in the art, the embodiments of the present application may be modified and varied in various ways. Any modifications, equivalent replacements, improvements, etc. made within the principles of the embodiments of the present application shall be included in the scope of protection of the embodiments of the present application.
Claims
1. A RAID array inspection method, characterized in that: include: Establishing a valid region bitmap, wherein the content of the valid region bitmap includes the physical addresses and status codes of all stripes in a redundant array of independent disks RAID, wherein the status code indicates whether the data in the physical address is valid or invalid, and the RAID indicates a disk array; In the case where data is written or deleted in the RAID, the valid area bitmap is updated, and a first patrol bitmap is established, wherein the content of the first patrol bitmap includes the physical address corresponding to the data with the valid status code in the updated valid area bitmap; Obtain a patrol cycle and establish a first patrol task. During the patrol cycle, at least perform the first patrol task according to the first patrol bitmap, wherein the first patrol task is a task for patrolling the RAID, and the patrol cycle is the time between the start of the first patrol task and the start of the next patrol task.
2. The inspection method according to claim 1, characterized in that: Create a valid area bitmap, including: After the RAID array is created and no data is stored in the RAID, an initial queue is constructed according to the physical addresses of all stripes in the RAID array to obtain a valid area bitmap, wherein the content of the initial queue includes the physical addresses and status codes of all stripes in the RAID, and the status codes are all invalid and indicate that no valid data exists at the physical addresses of all stripes in the RAID.
3. The inspection method according to claim 1, characterized in that: Updating the valid area bitmap includes: When data is written into the RAID and the status code corresponding to the physical address of the data written into the RAID is invalid, the status code corresponding to the physical address of the data written into the RAID is updated from invalid to valid.
4. The inspection method according to claim 1, characterized in that: Updating the valid area bitmap includes: In the case where all data corresponding to a physical address in the RAID is deleted, the status code corresponding to the deleted physical address is updated from valid to invalid, wherein the deleted physical address is the physical address of the data deleted in the RAID.
5. The inspection method according to claim 1, characterized in that: The method further comprises: When data is written into the RAID and the status code corresponding to the physical address of the data written into the RAID is valid, the status code corresponding to the physical address of the data written into the RAID is not updated.
6. The inspection method according to claim 1, characterized in that: The method further comprises: In the case that all data corresponding to a physical address in the RAID are not completely deleted, the status code corresponding to the physical address of the data deleted from the RAID is not updated.
7. The inspection method according to claim 1, characterized in that: After updating the valid area bitmap, the method further includes: Determine whether there is a second inspection task currently, wherein the second inspection task represents an inspection task performed on the RAID array before the first inspection task starts; When the second inspection task currently exists, the physical address and status code of the data written into the RAID are stored in the target queue, and it is detected whether the deleted physical address is located in the target queue. If it is located in the target queue, the deleted physical address in the target queue is deleted, wherein the target queue is formed after the last data writing or data deletion in the RAID and is used to store the physical address and status code of the data written into the RAID, and the deleted physical address is the physical address of the data deleted in the RAID.
8. The inspection method according to claim 7, characterized in that: After storing the physical address and status code of the data written into the RAID into the target queue, the method further includes: After the second inspection task completes the inspection of the RAID array according to the second inspection bitmap, the physical addresses in the target queue are inspected, wherein the second inspection bitmap includes the physical addresses required to be inspected in the second inspection task.
9. The inspection method according to claim 7, characterized in that: Determine whether there is a second inspection task currently, including: Detect whether a second patrol bitmap currently exists in the storage system, and determine whether a second patrol task currently exists if the second patrol bitmap exists; if the second patrol bitmap does not exist, determine whether the second patrol task currently does not exist, wherein the storage system is configured to store data and perform patrol tasks, and the second patrol bitmap includes a physical address required to be patrolled in the second patrol task.
10. The inspection method according to any one of claims 1 to 9, characterized in that: Establish the first inspection bitmap, including: The physical addresses corresponding to the data with valid status codes in the updated valid area bitmap are copied to obtain a first inspection bitmap.
11. The inspection method according to any one of claims 1 to 9, characterized in that: Performing the first inspection task at least according to the first inspection bitmap includes: Calculating the ratio of the number of the physical addresses in the first inspection bitmap to the inspection period to obtain a preset inspection speed; The first inspection task is performed according to the first inspection bitmap and the preset inspection speed.
12. The inspection method according to claim 11, characterized in that: After performing the first inspection task according to the first inspection bitmap and the preset inspection speed, the method further includes: After the first inspection task is completed according to the first inspection bitmap, the physical address in the target queue generated during the execution of the first inspection task is inspected, wherein the target queue is formed after the last data writing or data deletion of the RAID and is used to store the physical address and status code of the data written to the RAID.
13. The inspection method according to any one of claims 1 to 9, characterized in that: Executing the first inspection task includes: Performing XOR calculation on multiple target data in the physical address included in the first patrol bitmap to obtain an XOR result, and comparing the XOR result with an initial XOR result to see whether they are the same, wherein the initial XOR result is an XOR result obtained by performing XOR calculation on the multiple target data before storing the multiple target data in the RAID array; When the XOR result is the same as the initial XOR result, it is determined that the plurality of target data are correct; and when the XOR result is different from the initial XOR result, it is determined that errors exist in the plurality of target data.
14. The inspection method according to any one of claims 1 to 9, characterized in that: After performing the first inspection task at least according to the first inspection bitmap, the method further includes: Detect whether there are other tasks in the storage system, end the inspection if there are other tasks, and proceed to the next inspection task if there are no other tasks, wherein the storage system is configured to store data and execute the inspection tasks, and the other tasks represent tasks in the storage system other than the inspection task.
15. The inspection method according to claim 1, characterized in that: When the status code is 1, it indicates that the corresponding physical address contains valid data. When the status code is 0, it indicates that the corresponding physical address does not contain valid data.
16. The inspection method according to claim 7, characterized in that: The method further comprises: In the case that the deleted physical address is located in the second patrol bitmap, the deleted physical address in the second patrol bitmap being executed is not deleted.
17. A RAID array inspection device, characterized in that: include: A first establishing module is configured to establish a valid region bitmap, wherein the content of the valid region bitmap includes physical addresses and status codes of all stripes in the RAID, the status code indicates whether the data in the physical address is valid or invalid, and the RAID indicates a disk array; The second establishing module is configured to update the valid area bit when data is written or deleted in the RAID. Figure, and establish a first inspection bitmap, wherein the content of the first inspection bitmap includes the physical address corresponding to the data with the status code being valid in the updated valid area bitmap; An execution module is configured to obtain a patrol cycle and establish a first patrol task. During the patrol cycle, the first patrol task is executed at least according to the first patrol bitmap, wherein the first patrol task is a task for patrolling the RAID, and the patrol cycle is the time between the start of the first patrol task and the start of the next patrol task.
18. A storage system comprising a RAID module, an upper storage module, a lower storage module and a hard disk, characterized in that: The storage system performs business interaction with the host, and the storage system is configured to: establish a valid area bitmap; When data is written or deleted in the RAID, the valid area bitmap is updated, a first inspection task is constructed, and a first inspection bitmap is established according to physical addresses corresponding to data with valid status codes in the updated valid area bitmap; During the inspection cycle, the first inspection task is performed at least according to the first inspection bitmap, wherein the content of the valid area bitmap includes the physical addresses and status codes of all strips in the RAID, the status code indicates whether the data in the physical address is valid or invalid, the RAID represents a disk array, the first inspection task is a task of inspecting the RAID, and the inspection cycle is the time between the start of the first inspection task and the start of the next inspection task.
19. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, wherein the computer program implements the steps of the inspection method described in any one of claims 1 to 16 when executed by a processor.
20. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the inspection method described in any one of claims 1 to 16 are implemented.
Citation Information
Patent Citations
Method for restoring redundancy for RAID (Redundant Array of Independent Disks) disk array
CN105549908A
RAID Storage System, Storage Controller And RAID Array Patrol Method
CN107680622A
Method and system for accelerating disk array reconstruction
CN110187830A
Memory inspection method and device and medium
CN113821369A
RAID array inspection method, inspection device and electronic equipment
CN115878052A
