Storage device check block determination method, electronic device, and storage medium

By determining the disk array check block in the solid-state drive and generating a check code, the data recovery problem caused by uneven distribution of bad blocks is solved, and fast check block determination and recovery of multiple damaged data are achieved.

CN118860728BActive Publication Date: 2025-10-17SHANGHAI LONGSYS DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310475049.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2025-10-17
Estimated Expiration
2043-04-27

AI Technical Summary

Technical Problem

In the prior art, uneven distribution of bad blocks in solid-state drives results in an inability to quickly determine disk array parity blocks, an inability to quickly recover data, and an inability to recover multiple damaged data in the same disk array stripe.

Method used

By determining the disk array parity block from the physical blocks in multiple logical units based on the detection results of each logical unit in the storage device, and using the storage data of non-bad blocks to generate the disk array parity code, it is ensured that all disk array parity blocks are located in the same logical unit and the storage data of bad blocks in the logical unit are not involved in the parity code generation.

Benefits of technology

The disk array check block is quickly determined, the efficiency of determining the check code is improved, and data recovery failure caused by multiple damaged data in the same disk array stripe is avoided, and multiple damaged data can be recovered.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860728B_ABST
    Figure CN118860728B_ABST
Patent Text Reader

Abstract

The application relates to the storage field and provides a storage device check block determination method, an electronic device and a storage medium. The method determines a disk array check block from physical blocks in a plurality of logical units according to detection results of each logical unit in a storage device, and determines a disk array check code of each disk array check block according to storage data of non-bad blocks in each logical unit. The method can quickly determine the disk array check block and can also realize recovery of a plurality of damaged data in the same disk array strip.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of storage, in particular to a storage device check block determination method, an electronic device and a storage medium. BACKGROUND

[0002] At present, as the use time of a solid state disk (SSD) increases, the number of bad blocks in the solid state disk will slowly increase. When the distribution of the bad blocks in the solid state disk is uneven, the disk array check blocks of multiple redundant arrays of independent disks stripe (RAID stripe) will not be in the same logical unit (LU), which will result in that the disk array check blocks cannot be quickly determined, and the data in the storage device such as the solid state disk cannot be quickly recovered.

[0003] In addition, when k data are included in the disk array stripe, and any data in the k data is damaged, at present, by using the parity check function of the disk array (such as RAID5), the k-1 non-damaged data in the disk array stripe can be used to recover any damaged data. However, when there are multiple damaged data in the same disk array stripe, the multiple damaged data cannot be recovered. SUMMARY

[0004] In view of the above, it is necessary to provide a storage device determination method applied to an electronic device or a storage medium, which can solve the technical problems that the disk array check blocks cannot be quickly determined, and the multiple damaged data in the same disk array stripe cannot be recovered.

[0005] In one aspect, the present application provides a storage device check block determination method applied to an electronic device, wherein the electronic device includes a storage device, and the storage device check block determination method includes: determining disk array check blocks from physical blocks in multiple logical units according to detection results of each logical unit in the storage device; and determining disk array check codes of each disk array check block according to storage data of non-bad blocks in each logical unit.

[0006] According to the present application, the disk array check blocks are determined from the physical blocks in the multiple logical units according to the detection results of each logical unit in the storage device, which includes: if the detection results of each logical unit in the storage device all include identification information of bad blocks, counting the number of bad blocks of each logical unit based on the identification information; and determining all physical blocks in the logical unit with the least number of bad blocks as the disk array check blocks, and the logical unit is generally retrieved in a backward manner.

[0007] According to an embodiment of the present application, the determining the RAID check block from the physical blocks in the plurality of logical units according to the detection result of each logical unit in the storage device further comprises: if the detection result of a logical unit in the storage device does not contain the identification information of the bad block, determining the logical unit without the identification information of the bad block as a target logical unit; if there are a plurality of target logical units, determining all the physical blocks in a target logical unit according to a preset manner as the RAID check block.

[0008] According to an embodiment of the present application, the determining the RAID check code of each RAID check block according to the storage data of the non-bad block in each logical unit further comprises: constructing a corresponding block sequence number of the RAID stripe according to the physical blocks with the same block sequence number in all the logical units, each RAID stripe comprising a corresponding RAID check block; for each RAID check block, if all the physical blocks in the RAID stripe corresponding to the RAID check block and the target stripe before the RAID stripe in the storage device are non-bad blocks, determining the XOR result of the storage data of all the physical blocks in the RAID stripe as the RAID check code.

[0009] According to an embodiment of the present application, the determining the RAID check code of each RAID check block according to the storage data of the non-bad block in each logical unit further comprises: for each RAID check block, if any physical block in the RAID stripe corresponding to the RAID check block and the target stripe is a bad block, determining the logical unit in which the bad block is located as a defective logical unit; obtaining target storage data in a target physical block after the bad block in the defective logical unit based on the target stripe; and determining the RAID check code according to the target storage data and the XOR result of the storage data of the non-bad block in the RAID stripe except the defective logical unit.

[0010] According to an embodiment of the present application, the obtaining the target storage data in the target physical block after the bad block in the defective logical unit based on the target stripe comprises: if there is a bad block in the target stripe, determining the statistical number of the bad block in the defective logical unit and determining the stripe sequence number of the RAID stripe corresponding to the RAID check block; calculating the participating block sequence number of the defective logical unit participating in the generation of the RAID check code according to the statistical number and the stripe sequence number; and if the participating block sequence number is less than or equal to the maximum block sequence number of the defective logical unit, obtaining the physical block corresponding to the participating block sequence number from the defective logical unit as the target physical block, and obtaining the target storage data from the target physical block.

[0011] According to an embodiment of the present application, the obtaining the target storage data in the target physical block after the bad block in the defective logical unit based on the target stripe comprises: if all the physical blocks in the target stripe are non-bad blocks, determining the block sequence number of the bad block as a target block sequence number; if the physical block corresponding to a plurality of block sequence numbers in the defective logical unit is greater than the target block sequence number, determining the physical block corresponding to the minimum block sequence number from the plurality of block sequence numbers, taking the determined physical block as the target physical block, and obtaining the target storage data from the target physical block.

[0012] According to an embodiment of the present application, after the disk array check code of each disk array check block is determined based on the storage data of the non-bad block in each logical unit, the method further comprises: when it is detected that any physical block in the storage device has data read failure, determining the generated disk array check code of the any physical block as a target disk array check code; and performing data recovery on the any physical block based on all the other physical blocks participating in the generation of the target disk array check code except the physical block with data read failure and the target disk array check code.

[0013] In another aspect, the present application further provides a storage device check block determination apparatus applied to an electronic device, wherein the electronic device comprises a storage device, and the storage device check block determination apparatus comprises: a determination unit configured to determine disk array check blocks from physical blocks in a plurality of logical units according to detection results of each logical unit in the storage device; and the determination unit is further configured to determine disk array check codes of each disk array check block according to storage data of non-bad blocks in each logical unit.

[0014] In another aspect, the present application further provides a storage medium, wherein the storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor in an electronic device to implement a storage device check block determination method.

[0015] In another aspect, the present application further provides an electronic device, wherein the electronic device comprises a storage medium storing computer readable instructions and a processor, and the processor executes the computer readable instructions stored in the storage medium to implement a storage device check block determination method.

[0016] From the above technical solutions can be seen, the embodiment of the application determines the disk array check block from multiple logical units, so that all the disk array check blocks are in the same logical unit, thereby facilitating the rapid determination of all the disk array check blocks, and thus the determination efficiency of the disk array check code can be improved. In addition, the embodiment of the application determines the disk array check code by the storage data of the non-bad blocks in each logical unit. Since the storage data of the bad blocks in the logical unit does not participate in the generation of the disk array check code, it can avoid the situation that multiple damaged data in the same disk array stripe cannot be recovered, and can realize the recovery of multiple damaged data in the same disk array stripe. BRIEF DESCRIPTION OF DRAWINGS

[0017] Figure 1 is a structural schematic diagram of an electronic device for implementing the storage device check block determination method provided by the embodiment of the application.

[0018] Figure 2 is a flowchart of the storage device check block determination method provided by the embodiment of the application.

[0019] Figure 3 is a schematic diagram of a disk array stripe provided by the embodiment of the application.

[0020] Figure 4 is a detailed flowchart of determining the disk array check code provided by the embodiment of the application.

[0021] Figure 5 is a detailed flowchart of obtaining target storage data provided by the embodiment of the application.

[0022] Figure 6 is a structural schematic diagram of a storage device provided by the embodiment of the application.

[0023] Figure 7 is a structural schematic diagram of another storage device provided by the embodiment of the application.

[0024] Figure 8 is a structural schematic diagram of another storage device provided by the embodiment of the application.

[0025] Figure 9 is a flowchart of the storage device check block determination method provided by another embodiment of the application.

[0026] Figure 10 is a functional module diagram of the storage device check block determination apparatus provided by the embodiment of the application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the application more clear, the application is described in detail below with reference to the drawings and specific embodiments.

[0028] It should be noted that "at least one" in the present application means one or more, and "multiple" means two or more than two. The "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0029] In the embodiments of the present application, the words such as "exemplary" or "for example" are used to mean an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words such as "exemplary" or "for example" are intended to present the relevant concept in a specific manner. The embodiments described below and the features in the embodiments can be combined with each other without conflict.

[0030] As shown in Figure 1 Fig. 1 is a structural schematic diagram of an electronic device for implementing the storage device check block determination method provided by the embodiments of the present application.

[0031] In the embodiments of the present application, the storage device check block determination method is applied to one or more electronic devices 1. The electronic device 1 is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored computer readable instructions. The hardware thereof includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0032] The electronic device 1 can be any electronic product capable of human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive Internet Protocol Television (IPTV), a smart wearable device, etc.

[0033] The electronic device 1 can include a network device and / or a user device. The network device includes, but is not limited to, a single network electronic device, a group of electronic devices composed of multiple network electronic devices, or a cloud composed of a large number of hosts or network electronic devices based on cloud computing.

[0034] The network in which the electronic device 1 is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), and the like.

[0035] In the embodiments of the present application, the electronic device 1 includes, but is not limited to, a storage device 12, a processor 13, and computer readable instructions stored in the storage device 12 and executable on the processor 13, such as a storage device verification block determination program.

[0036] Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation on the electronic device 1, and can include more or fewer components than the diagram, or combine certain components, or different components, for example, the electronic device 1 can also include an input / output device, a network access device, a bus, and the like.

[0037] The processor 13 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, and the like. The processor 13 is the operation core and control center of the electronic device 1, and connects various parts of the entire electronic device 1 through various interfaces and lines, and executes the operating system of the electronic device 1 and various application programs, program codes, and the like installed.

[0038] The storage device 12 can be an external storage device and / or an internal storage device of the electronic device 1. Further, the storage device 12 can be a storage device having a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.

[0039] In combination Figure 2The storage device 12 in the electronic device 1 stores computer readable instructions, and the processor 13 can execute the computer readable instructions stored in the storage device 12 to implement the method for determining the storage device check block as shown in Figure 2 .

[0040] As shown in Figure 2 , it is a flow chart of the method for determining the storage device check block provided by the embodiments of the present application. The method for determining the storage device check block is applied in an electronic device (for example, the electronic device 1 in Figure 1 ), and the electronic device runs a storage device. The order of the steps in the flow chart can be changed according to different requirements, and some steps can be omitted.

[0041] 201. Determine the disk array check block from the physical blocks in the plurality of logical units according to the detection result of each logical unit in the storage device.

[0042] In at least one embodiment of the present application, the storage device can be a solid state disk (SSD), which is a computer storage device using a non-volatile storage device chip as a data storage medium. Compared with a traditional mechanical hard disk, the solid state disk has faster read and write speed, lower energy consumption and higher durability. The basic structure of the storage device includes a page, a block, a plane and a logical unit (LU). Among them, the page is the most basic component, for example, the size of the page can be 4KB, each block usually contains multiple pages, for example, the block A includes 64 pages, each plane includes multiple blocks, and each logical unit includes multiple planes. The logical unit can represent the storage space in the electronic device, and each logical unit includes a corresponding logical unit number (LUN). Each logical unit includes multiple physical blocks. The detection result can be the identification information of the bad block included in each logical unit, for example, the logical units included in the storage device are LUN0-LUN7, and each logical unit in LUN0-LUN7 contains identification information of a bad block. The detection result can also be that there is a logical unit in the storage device that does not contain identification information of a bad block, for example, the logical units included in the storage device are LUN0-LUN7, each logical unit in LUN0-LUN6 contains identification information of a bad block, and LUN7 does not contain identification information of a bad block. The plurality of disk array check blocks are located in the same logical unit.

[0043] In at least one embodiment of the present application, the electronic device determines the disk array check block from the physical blocks in the plurality of logical units according to the detection result of each logical unit in the storage device, comprising: if the detection result of each logical unit in the storage device contains the identification information of the bad block, the electronic device counts the number of bad blocks of each logical unit based on the identification information, and determines all physical blocks in the logical unit with the least number of bad blocks as the disk array check block. Generally, the logical unit is retrieved in a backward manner.

[0044] For example, the logical units in the storage device include LUN0-LUN7, the number of bad blocks of LUN0 is 1, the number of bad blocks of LUN1 is 2, the number of bad blocks of LUN2 is 3, the number of bad blocks of LUN3 is 3, the number of bad blocks of LUN4 is 2, the number of bad blocks of LUN5 is 3, the number of bad blocks of LUN6 is 3, and the number of bad blocks of LUN7 is 2. Since the number of bad blocks of LUN0 is the least, the electronic device determines all physical blocks in LUN0 as the disk array check block.

[0045] The number of bad blocks can be quickly counted through the detection result of each logical unit, and then all physical blocks in the logical unit with the least number of bad blocks are determined as the disk array check block, which can avoid the phenomenon that the disk array check code corresponding to the disk array check block cannot be generated. At the same time, the disk array check block is set in the same logical unit, which is conducive to the quick determination of the disk array check block.

[0046] In other embodiments, if there are multiple logical units with the least number of bad blocks, the electronic device determines the multiple logical units with the least number of bad blocks as candidate logical units, and determines the logical unit sequence number of the candidate logical units in the storage device. In one embodiment, the electronic device determines all physical blocks in the candidate logical unit corresponding to the largest logical unit sequence number as the disk array check block. In another embodiment, the electronic device determines all physical blocks in any logical unit with the least number of bad blocks as the disk array check block.

[0047] For example, the logical units in the storage device include LUN0-LUN7, the number of bad blocks of LUN0 is 1, the number of bad blocks of LUN1 is 2, the number of bad blocks of LUN2 is 3, the number of bad blocks of LUN3 is 3, the number of bad blocks of LUN4 is 2, the number of bad blocks of LUN5 is 1, the number of bad blocks of LUN6 is 3, and the number of bad blocks of LUN7 is 1. Since the number of bad blocks of LUN0, LUN5 and LUN7 is the least, and the logical unit sequence number of LUN7 is the largest, the electronic device determines all physical blocks in LUN7 as the disk array check block. In another embodiment, the electronic device can determine all physical blocks in LUN0 as the disk array check block

[0048] Through the above embodiments, when there are multiple logical units corresponding to the minimum number of bad blocks, all physical blocks in the logical unit with the largest logical unit number can be determined as the disk array check block, so that the disk array check block can be quickly determined.

[0049] In at least one embodiment of the present application, the electronic device determines the disk array check block from the physical blocks in the plurality of logical units according to the detection result of each logical unit in the storage device, and further comprises: if there is logical unit in the storage device whose detection result does not contain the identification information of the bad block, the electronic device determines the logical unit whose detection result does not contain the identification information of the bad block as the target logical unit, and if there are multiple target logical units, the electronic device determines all physical blocks in one target logical unit as the disk array check block according to a preset manner.

[0050] Specifically, the electronic device determines the unit number of the target logical unit in the storage device, and determines all physical blocks in the target logical unit corresponding to the largest unit number as the disk array check block.

[0051] For example, the logical units in the storage device include LUN0-LUN7, the detection results of LUN0 and LUN7 do not contain the identification information of the bad block, the number of bad blocks of LUN1 is 2, the number of bad blocks of LUN2 is 3, the number of bad blocks of LUN3 is 3, the number of bad blocks of LUN4 is 2, the number of bad blocks of LUN5 is 1, and the number of bad blocks of LUN6 is 3. Since the detection results of LUN0 and LUN7 do not contain the identification information of the bad block, and the unit number of LUN7 is the largest, the electronic device determines all physical blocks in LUN7 as the disk array check block.

[0052] In other embodiments, if there is only one target logical unit, all physical blocks in the target logical unit are determined as the disk array check block.

[0053] In at least one embodiment of the present application, the electronic device constructs the disk array stripe of the corresponding block sequence number with the physical blocks of the same block sequence number in all logical units, and each disk array stripe includes the corresponding disk array check block. In combination with Figure 3A schematic diagram illustrating disk array stripes is shown. The logical units in the storage device include LUN0-LUN7. Each logical unit includes plane0 (hereinafter referred to as P0)-plane3 (hereinafter referred to as P3). The electronic device uses physical blocks with the same block number in LUN0-LUN7 to form disk array stripes with corresponding block numbers. For example, the disk array stripe with block number 0 (hereinafter referred to as RAID0 stripe) includes L0P0, L1P0, L2P0, L3P0, L4P0, L5P0, L6P0 and L7P0. The disk array stripe with block number 1 (hereinafter referred to as RAID1 stripe) includes L0P1, L1P1, L2P1, L3P1, L4P1, L5P1, L6P1 and L 7P1, the disk array stripe with block number 2 (hereinafter referred to as RAID2 stripe) includes L0P2, L1P2, L2P2, L3P2, L4P2, L5P2, L6P2 and L7P2, and the disk array stripe with block number 3 (hereinafter referred to as RAID3 stripe) includes L0P3, L1P3, L2P3, L3P3, L4P3, L5P3, L6P3 and L7P3. If all physical blocks in LUN7 are disk array parity blocks, the disk array parity block in the RAID0 stripe is L7P0, the disk array parity block in the RAID1 stripe is L7P1, the disk array parity block in the RAID2 stripe is L7P2, and the disk array parity block in the RAID3 stripe is L7P3.

[0054] 202 : Determine a disk array check code of each disk array check block according to the storage data of the non-bad blocks in each logical unit.

[0055] In at least one embodiment of the present application, bad blocks may be generated during the manufacturing process of the storage device. For example, bad blocks may appear when the storage device leaves the factory, or they may be added as the storage device ages. The data stored in non-bad blocks is the data stored in non-bad blocks. The disk array checksum is generated using the data stored in non-bad blocks. Therefore, bad blocks do not participate in the generation of the disk array checksum.

[0056] In at least one embodiment of the present application, the specific process of determining the disk array check code of each disk array check block can be referred to below. Figure 4 Detailed description of the process shown.

[0057] The embodiment of the present application determines the disk array check block from multiple logical units, so that all disk array check blocks are in the same logical unit, thereby facilitating the rapid determination of all disk array check blocks, thereby improving the determination efficiency of the disk array check code. In addition, the embodiment of the present application determines the disk array check code by the storage data of the non-failed block in each logical unit. Since the storage data of the failed block in the logical unit does not participate in the generation of the disk array check code, it can avoid the failure to recover the damaged data due to the presence of multiple damaged data in the same disk array stripe, and can realize the recovery of multiple damaged data in the same disk array stripe.

[0058] As shown in Figure 4 , it is a detailed flow chart for determining the disk array check code provided by the embodiment of the present application, and the disk array check code determination method is applied to an electronic device. As shown in Figure 4 , it specifically includes the following steps:

[0059] 2021, for each disk array check block, judge whether all physical blocks in the current disk array stripe corresponding to the current disk array check block are non-failed blocks, and whether all physical blocks in the target stripe before the current disk array stripe in the storage device are non-failed blocks.

[0060] In this embodiment, the target stripe is a stripe in the storage device whose stripe number is less than the current disk array stripe. Since the detection result includes the identification information of the failed block, the electronic device can determine whether the physical block is a non-failed block by judging whether the identification information of the physical block is contained in the detection result.

[0061] 2022, if all physical blocks in the current disk array stripe and the target stripe are non-failed blocks, the electronic device determines the exclusive or result of the storage data of all physical blocks in the disk array stripe as the disk array check code.

[0062] The generation of the disk array check code is combined Figure 6 , as shown in Figure 6 , the logical unit in the storage device includes LUN0 (hereinafter referred to as L0)-LUN7 (hereinafter referred to as L7), each logical unit includes plane0 (hereinafter referred to as P0)-plane3 (hereinafter referred to as P3), and all physical blocks in LUN7 are disk array check blocks Figure 6The parity check code of RAID Stripe0 (the parity block of RAID L7P0 in the RAID0 stripe, hereinafter referred to as RAID0L7P0) is: the exclusive OR result of the storage data of all physical blocks in the RAID0 stripe, for example: RAID0L7P0 = L0P0 XOR L1P0 XOR L2P0 XOR L3P0 XOR L4P0 XOR L5P0 XOR L6P0.

[0063] In this embodiment, when all physical blocks in the current disk array stripe and the target stripe are non-bad blocks, the disk array check code is determined based on the storage data of all physical blocks in the current disk array stripe. Since the storage data of the bad blocks does not participate in the generation of the disk array check code, it can avoid the inability to recover the damaged data due to the presence of multiple damaged data in the same disk array stripe.

[0064] 2023. If any physical block in the current disk array stripe and / or the target stripe is a bad block, determine that the logical unit where the bad block is located is a defective logical unit.

[0065] like Figure 6 As shown, when determining the disk array check codes of RAID1 stripes, RAID2 stripes and RAID3 stripes, since the physical block L0P1 in the RAID1 stripe is a bad block, the electronic device determines the logical unit (for example, LUN0) where the physical block L0P1 is located as a defective logical unit.

[0066] like Figure 7 As shown, the storage device includes LUN0-LUN7, each logical unit includes plane0 (hereinafter referred to as P0)-plane3 (hereinafter referred to as P3), and all physical blocks in LUN6 are disk array parity blocks ( Figure 7The bad block is marked as RAIDParity), where L5P0 in the RAID0 stripe is a bad block, L2P1, L3P1, and L4P1 in the RAID1 stripe are bad blocks, L0P2 in the RAID2 stripe is a bad block, and L1P3 in the RAID3 stripe is a bad block. When determining the disk array parity code of the RAID0 stripe, since the physical block L5P0 in the RAID0 stripe is a bad block, the electronic device determines the logical unit (for example, LUN5) where the physical block L5P0 is located as a defective logical unit. When determining the disk array parity code of the RAID1 stripe, since the physical blocks L2P1, L3P1, and L4P1 in the RAID1 stripe are bad blocks, the electronic device determines the logical units (for example, LUN2, LUN3, and LUN4) where the physical blocks L2P1, L3P1, and L4P1 are located as defective logical units. When determining the disk array parity code of a RAID 2 stripe, since physical block L0P2 in the RAID 2 stripe is a bad block, the electronic device determines the logical unit (for example, LUN0) where physical block L0P2 is located as a defective logical unit. When determining the disk array parity code of a RAID 3 stripe, since physical block L1P3 in the RAID 3 stripe is a bad block, the electronic device determines the logical unit (for example, LUN1) where physical block L1P3 is located as a defective logical unit.

[0067] like Figure 8 As shown, the storage device includes LUN0-LUN7, each logical unit includes plane0 (hereinafter referred to as P0)-plane3 (hereinafter referred to as P3), and all physical blocks in LUN7 are disk array parity blocks ( Figure 8L5P0 in the RAID0 stripe is a bad block, L2P1, L3P1, L4P1 and L6P1 in the RAID1 stripe are bad blocks, L0P2 and L2P2 in the RAID2 stripe are bad blocks, and L1P3 in the RAID3 stripe is a bad block. When determining the disk array check code of the RAID0 stripe, since the physical block L5P0 in the RAID0 stripe is a bad block, the electronic device determines the logical unit (for example, LUN5) in which the physical block L5P0 is located as a defective logical unit. When determining the disk array check code of the RAID1 stripe, since the physical blocks L2P1, L3P1, L4P1 and L6P1 in the RAID1 stripe are bad blocks, the electronic device determines the logical units (for example, LUN2, LUN3, LUN4 and LUN6) in which the physical blocks L2P1, L3P1, L4P1 and L6P1 are located as defective logical units. When determining the disk array check code of the RAID2 stripe, since the physical blocks L0P2 and L2P2 in the RAID2 stripe are bad blocks, the electronic device determines the logical units (for example, LUN0 and LUN2) in which the physical blocks L0P2 and L2P2 are located as defective logical units. When determining the disk array check code of the RAID3 stripe, since the physical block L1P3 in the RAID3 stripe is a bad block, the electronic device determines the logical unit (for example, LUN1) in which the physical block L1P3 is located as a defective logical unit.

[0068] 2024, based on the target stripe, obtaining target storage data in a target physical block located after the bad block in the defective logical unit.

[0069] In this embodiment, the target physical block is an adjacent non-bad block to the bad block in the defective logical unit, and the block sequence number of the target physical block is greater than the block sequence number of the bad block. The target storage data is data stored in the target physical block. As shown in Figure 5 Figure 5 A detailed flowchart of obtaining target storage data provided by the embodiment of the application. The electronic device obtains target storage data in a target physical block located after the bad block in the defective logical unit based on the target stripe, including the following steps:

[0070] 20241, determining whether there is a bad block in the target stripe.

[0071] In this embodiment, since the detection result includes the identification information of the bad block, the electronic device can determine whether the physical block is a non-bad block by judging whether the identification information of the physical block is contained in the detection result.

[0072] ​20242. If all physical blocks in the target stripe are non-bad blocks, the block number of the bad block is determined as the target block number. If multiple block numbers corresponding to the physical blocks in the defective logical unit are greater than the target block number, the physical block corresponding to the smallest block number is determined from the multiple block numbers, the determined physical block is used as the target physical block, and the target storage data is obtained from the target physical block.

[0073] like Figure 6 As shown, when determining the disk array check code of the RAID1 stripe, the target stripe is the RAID0 stripe, the block number of the bad block L0P1 is 1, and it is determined that the target physical block is L0P2.

[0074] like Figure 7 As shown, when determining the disk array check code of the RAID0 stripe, since the stripe number of the RAID0 stripe is the smallest and the physical block L5P0 of the RAID0 stripe is a bad block, the block number of the bad block L5P0 is 0, it is determined that the target physical block is L5P1.

[0075] like Figure 8 As shown, when determining the disk array check code of the RAID0 stripe, since the stripe number of the RAID0 stripe is the smallest and the physical block L5P0 of the RAID0 stripe is a bad block, the block number of the bad block L5P0 is 0, it is determined that the target physical block is L5P1.

[0076] 20243. If bad blocks exist in the target stripe, determine the statistical number of bad blocks in the defective logical unit and determine the stripe sequence number of the disk array stripe.

[0077] In this embodiment, the statistical number is the total number of bad blocks in the defective logical unit, and the stripe number indicates the position of the disk array stripe in the storage device.

[0078] 20244, based on the statistical quantity and the stripe sequence number, calculate the sequence number of the block participating in the disk array check code generation in the defective logical unit.

[0079] In this embodiment, the participating block sequence number is equal to the sum of the statistical number and the stripe sequence number.

[0080] 20245, compare the participating block sequence number with the maximum block sequence number of the defective logical unit.

[0081] 20246. If the participating block sequence number is less than or equal to the maximum block sequence number of the defective logical unit, obtain the physical block corresponding to the participating block sequence number from the defective logical unit as the target physical block, and obtain the target storage data from the target physical block.

[0082] like Figure 6As shown in the figure, when determining the disk array check code of the RAID2 stripe, the target stripe is the RAID0 stripe and the RAID1 stripe. Since the RAID1 stripe has the physical block L0P1 as a bad block, the statistical number of the bad block L0P1 in the defective LUN0 is 1, the stripe serial number of the RAID2 stripe is 2, and the calculation shows that the participating block serial number is 3. Since the maximum block serial number of the defective LUN0 is 3, the target physical block is L0P3.

[0083] As shown in the figure, Figure 7 As shown in the figure, when determining the disk array check code of the RAID1 stripe, since the RAID1 stripe has the physical blocks L2P1, L3P1 and L4P1 as bad blocks, the corresponding defective logical units include the defective LUN2, the defective LUN3 and the defective LUN4, the target stripe (the RAID0 stripe) has the physical block L5P0 as a bad block, the corresponding defective logical unit is the defective LUN5, and the statistical numbers of the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are 1 respectively. The stripe serial number of the RAID1 stripe is 1, and the calculation shows that the participating block serial numbers in the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are 2 respectively. Since the maximum block serial numbers of the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are 3 respectively, the target physical blocks in the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are L2P2, L3P2, L4P2 and L5P2 respectively. When determining the disk array check code of the RAID2 stripe, since the RAID2 stripe has the physical block L0P2 as a bad block, the corresponding defective logical unit includes the defective LUN0, the target stripe (the RAID0 stripe and the RAID1 stripe) has the physical blocks L5P0, L2P1, L3P1 and L4P1 as bad blocks, the corresponding defective logical units are the defective LUN5, the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5, the statistical numbers of the defective LUN0, the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are 1 respectively, the stripe serial number of the RAID2 stripe is 2, and the calculation shows that the participating block serial numbers in the defective LUN0, the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are 3 respectively. Since the maximum block serial numbers of the defective LUN0, the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are 3 respectively, the target physical blocks in the defective LUN0, the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN5 are L0P3, L2P3, L3P3, L4P3 and L5P3 respectively.

[0084] As shown in the figure, Figure 8As shown, in determining the disk array check code of the RAID1 stripe, since the RAID1 stripe has the physical blocks L2P1, L3P1, L4P1 and L6P1 as bad blocks, the corresponding defective logical units include the defective LUN2, the defective LUN3, the defective LUN4 and the defective LUN6, the target stripe (the RAID0 stripe) has the physical block L5P0 as a bad block, the corresponding defective logical unit is the defective LUN5, the statistical number of the defective LUN2 is 2, the statistical numbers of the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively 1, the stripe serial number of the RAID1 stripe is 1, after calculation, the participating block serial number of the defective LUN2 is 3, the participating block serial numbers in the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively 2, since the maximum block serial numbers of the defective LUN2, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively 3, therefore, the target physical blocks in the defective LUN2, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively L2P3, L3P2, L4P2, L5P2 and L6P2. In determining the disk array check code of the RAID2 stripe, since the RAID2 stripe has the physical blocks L0P2 and L2P2 as bad blocks, the corresponding defective logical units include the defective LUN0 and the defective LUN2, the target stripe (the RAID0 stripe and the RAID1 stripe) has the physical blocks L5P0, L2P1, L3P1, L4P1 and L6P1 as bad blocks, the corresponding defective logical units are the defective LUN5, the defective LUN2, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6, the statistical number of the defective LUN2 is 2, the statistical numbers of the defective LUN0, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively 1, the stripe serial number of the RAID2 stripe is 2, after calculation, the participating block serial number of the defective LUN2 is 4, the participating block serial numbers in the defective LUN0, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively 3, since the maximum block serial numbers of the defective LUN0, the defective LUN2, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively 3, therefore, the target physical blocks in the defective LUN0, the defective LUN3, the defective LUN4, the defective LUN5 and the defective LUN6 are respectively L0P3, L3P3, L4P3, L5P3 and L6P3.

[0085] 20247, if the participating block serial number is greater than the maximum block serial number of the defective logical unit, ignore the target storage data.

[0086] As Figure 6As shown in the figure, when determining the disk array check code of the RAID3 stripe, the target stripe is the RAID0 stripe, the RAID1 stripe and the RAID2 stripe. Since the RAID1 stripe in the target stripe has the physical block L0P1 as a bad block, the statistical number of the bad block L0P1 in the defective LUN0 is 1, the stripe serial number of the RAID3 stripe is 3, and the calculated participating block serial number is 4. Since the maximum block serial number of the defective LUN0 is 3, the target storage data is ignored when determining the disk array check code of the RAID3 stripe.

[0087] As shown in the figure, when determining the disk array check code of the RAID3 stripe, the target stripe is the RAID0 stripe, the RAID1 stripe and the RAID2 stripe. Since the RAID1 stripe in the target stripe has the physical block L0P1 as a bad block, the statistical number of the bad block L0P1 in the defective LUN0 is 1, the stripe serial number of the RAID3 stripe is 3, and the calculated participating block serial number is 4. Since the maximum block serial number of the defective LUN0 is 3, the target storage data is ignored when determining the disk array check code of the RAID3 stripe. Figure 7 As shown in the figure, when determining the disk array check code of the RAID3 stripe, the target stripe is the RAID0 stripe, the RAID1 stripe and the RAID2 stripe. Since the RAID1 stripe in the target stripe has the physical block L0P1 as a bad block, the statistical number of the bad block L0P1 in the defective LUN0 is 1, the stripe serial number of the RAID3 stripe is 3, and the calculated participating block serial number is 4. Since the maximum block serial number of the defective LUN0 is 3, the target storage data is ignored when determining the disk array check code of the RAID3 stripe.

[0088] 2025, according to the XOR result of the target storage data and the storage data of the non-bad block in the disk array stripe except the defective logical unit, the disk array check code of the disk array check block is determined.

[0089] As shown in the figure, when determining the disk array check code of the RAID3 stripe, the target stripe is the RAID0 stripe, the RAID1 stripe and the RAID2 stripe. Since the RAID1 stripe in the target stripe has the physical block L0P1 as a bad block, the statistical number of the bad block L0P1 in the defective LUN0 is 1, the stripe serial number of the RAID3 stripe is 3, and the calculated participating block serial number is 4. Since the maximum block serial number of the defective LUN0 is 3, the target storage data is ignored when determining the disk array check code of the RAID3 stripe. Figure 6In the determination of the disk array check code of the RAID1 stripe, the electronic device determines the target physical block as L0P2, and thus the disk array check code of the RAID Stripe1 (e.g., the RAID L7P1 check block in the RAID1 stripe, hereinafter referred to as RAID1 L7P1) is the XOR result of the target storage data of L0P2 and the storage data of all non-defective blocks in the RAID1 stripe except the defective logical unit, e.g., RAID1 L7P1 = L0P2 XOR L1P1 XOR L2P1 XOR L3P1 XOR L4P1 XOR L5P1 XOR L6P1. In the determination of the disk array check code of the RAID2 stripe, the electronic device determines the target physical block as L0P3, and thus the disk array check code of the RAID Stripe2 (e.g., the RAID L7P2 check block in the RAID2 stripe, hereinafter referred to as RAID2 L7P2) is the XOR result of the target storage data of L0P3 and the storage data of all non-defective blocks in the RAID2 stripe except the defective logical unit, e.g., RAID2 L7P2 = L0P3 XOR L1P2 XOR L2P2 XOR L3P2 XOR L4P2 XOR L5P3 XOR L6P2. In the determination of the disk array check code of the RAID3 stripe, since the target storage data is ignored, the disk array check code of the RAID Stripe3 (e.g., the RAID L7P3 check block in the RAID3 stripe, hereinafter referred to as RAID3 L7P3) is the XOR result of the storage data of all non-defective blocks in the RAID3 stripe except the defective LUN, e.g., RAID3 L7P3 = L1P3 XOR L2P3 XOR L3P3 XOR L4P3 XOR L5P3 XOR L6P3.

[0090] As Figure 7As shown, when determining the disk array check code of the RAID0 stripe, the electronic device determines the target physical block as L5P1, and thus the disk array check code of the RAID Stripe0 (e.g., the RAID L6P0 check block in the RAID0 stripe, hereinafter referred to as RAID0 L6P0) is the XOR result of the target storage data of the target physical block L5P1 and the storage data of all physical blocks in the RAID0 stripe except the defective logical unit (e.g., LUN5), for example: RAID0 L6P0 = L0P0 XOR L1P0 XOR L2P0 XOR L3P0 XOR L4P0 XOR L5P1 XOR L7P0. When determining the disk array check code of the RAID1 stripe, the electronic device determines the target physical blocks as L2P2, L3P2, L4P2 and L5P2, and thus the disk array check code of the RAID Stripe1 (e.g., the RAID L6P1 check block in the RAID1 stripe, hereinafter referred to as RAID1 L6P1) is the XOR result of the target storage data of the target physical blocks L2P2, L3P2, L4P2 and L5P2 and the storage data of all physical blocks in the RAID1 stripe except the defective logical units (e.g., defective LUN2, defective LUN3, defective LUN4 and defective LUN5), for example: RAID1 L6P1 = L0P1 XOR L1P1 XOR L2P2 XOR L3P2 XOR L4P2 XOR L5P2 XOR L7P1. When determining the disk array check code of the RAID2 stripe, the electronic device determines the target physical blocks as L0P3, L2P3, L3P3, L4P3 and L5P3, and thus the disk array check code of the RAID Stripe2 (e.g., the RAID L6P2 check block in the RAID2 stripe, hereinafter referred to as RAID2 L6P2) is the XOR result of the target storage data of the target physical blocks L0P3, L2P3, L3P3, L4P3 and L5P3 and the storage data of all physical blocks in the RAID2 stripe except the defective logical units (e.g., defective LUN0, defective LUN2, defective LUN3, defective LUN4 and defective LUN5), for example: RAID2 L6P2 = L0P3 XOR L1P2 XOR L2P3 XOR L3P3 XOR L4P3 XOR L5P3 XOR L7P2.In determining the disk array check code of the RAID3 stripe, the electronic device ignores the target storage data in the defective LUN5, the defective LUN2, the defective LUN3, the defective LUN4, the defective LUN5, and the defective LUN0, and thus the disk array check code of the RAID Stripe3 (for example, a RAID L6P3 check block in the RAID3 stripe, hereinafter referred to as a RAID3 L6P3) is an exclusive-OR result of the storage data of all non-defective blocks in the RAID3 stripe except the defective logical unit, for example, RAID3 L6P3=L1P3 XOR L7P3.

[0091] As Figure 8As shown, when determining the disk array check code of the RAID0 stripe, the electronic device determines that the target physical block is L5P1. Therefore, the disk array check code of RAID Stripe0 (for example, the RAID L7P0 check block in the RAID0 stripe, hereinafter referred to as RAID0L7P0) is: the XOR result of the target storage data of the target physical block L5P1 and the storage data of all physical blocks in the RAID0 stripe except the defective logical unit (for example, LUN5), for example: RAID0 L7P0 = L0P0 XOR L1P0 XOR L2P0 XOR L3P0 XOR L4P0 XOR L5P1 XOR L6P0. When determining the disk array parity code of the RAID1 stripe, the electronic device determines that the target physical blocks are L2P3, L3P2, L4P2, L5P2 and L6P2. Therefore, the disk array parity code of RAIDStripe1 (for example, the RAID L7P1 parity block in the RAID1 stripe, hereinafter referred to as RAID1 L6P1) is: the exclusive OR result of the target storage data of the target physical blocks L2P3, L3P2, L4P2, L5P2 and L6P2 and the storage data of all physical blocks in the RAID1 stripe except the defective LUN (for example, defective LUN2, defective LUN3, defective LUN4, defective LUN5 and defective LUN6), for example: RAID1 L7P1 = L0P1 XOR L1P1 XOR L2P3 XOR L3P2 XOR L4P2 XOR L5P2 XOR L6P2. When determining the disk array parity code of the RAID2 stripe, the electronic device determines that the target physical blocks are L0P3, L3P3, L4P3, L5P3 and L6P3 respectively. Therefore, the disk array parity code of RAID Stripe2 (for example, the RAID L7P2 parity block in the RAID2 stripe, hereinafter referred to as RAID2 L7P2) is: the target storage data of the target physical blocks L0P3, L3P3, L4P3, L5P3 and L6P3 and the storage data of all physical blocks in the RAID2 stripe except the defective logical units (for example, defective LUN0, defective LUN2, defective LUN3, defective LUN4, defective LUN5 and defective LUN6), for example: RAID2L7P2 = L0P3 XOR L1P2 XOR L3P3 XOR L4P3 XOR L5P3 XOR L6P3.

[0092] like Figure 9 FIG. 1 is a flowchart of a method for determining a storage device check block according to another embodiment of the present invention. The method for determining a storage device check block is applied to an electronic device (eg Figure 1In the electronic device 1) in the flowchart, the electronic device runs a storage device, and according to different requirements, the order of steps in the flowchart can be changed, and some steps can be omitted.

[0093] 901. Determine the disk array check block from the physical blocks in the plurality of logical units according to the detection result of each logical unit in the storage device.

[0094] 902. Determine the disk array check code of each disk array check block according to the storage data of the non-bad block in each logical unit.

[0095] The details of steps 901-902 can refer to the detailed description of steps 201-202 in the above Figure 2 The detailed description of steps 201-202 in the above

[0096] 903. When it is detected that any physical block in the storage device has a data read failure, determine the generated disk array check code of any physical block as the target disk array check code.

[0097] 904. Based on all other physical blocks participating in the generation of the target disk array check code except the physical block with data read failure and the target disk array check code, perform data recovery on any physical block.

[0098] In at least one embodiment of the present application, the electronic device performs data recovery on any physical block based on all other physical blocks participating in the generation of the target disk array check code except the physical block and the target disk array check code, including: the electronic device generates the recovery data of any physical block based on the XOR result of the storage data of other physical blocks and the target disk array check code.

[0099] As shown in the Figure 6 L0P2 and L1P2 have data read failures, since the target disk array check code generated by L0P2 is RAID1 L7P1, the data of any physical block L0P2 is recovered based on RAID1 L7P1 and the storage data of other physical blocks participating in the generation of RAID1 L7P1, for example: L0P2=L1P1 XOR L2P1 XOR L3P1 XOR L4P1 XOR L5P1 XOR L6P1 XOR RAID1 L7P1. Since the target disk array check code generated by L1P2 is RAID2 L7P2, the data of any physical block L1P2 is recovered based on RAID2 L7P2 and the storage data of other physical blocks participating in the generation of RAID2 L7P2, for example: L1P2=L0P3 XOR L2P2 XOR L3P2 XOR L4P2 XOR L5P2 XOR L6P2 XOR RAID2 L7P2.

[0100] As shown in Figure 7 read failure occurs in any physical block L5P2, since the target disk array check code generated by L5P2 is RAID1 L6P1, data recovery is performed on any physical block L5P2 based on the storage data in RAID1 L6P1 and other physical blocks participating in the generation of RAID1 L6P1, for example: L5P2=L0P1 XOR L1P1 XOR L2P2 XOR L3P2 XOR L4P2 XOR L7P1 XOR RAID1 L6P1.

[0101] As shown in Figure 8 read failure occurs in any physical block L6P0 and L6P2, since the target disk array check code generated by L6P0 is RAID0 L7P0, data recovery is performed on any physical block L6P0 based on the storage data in RAID0 L7P0 and other physical blocks participating in the generation of RAID0 L7P0, for example: L6P0=L0P0 XOR L1P0 XOR L2P0 XOR L3P0 XOR L4P0 XOR L5P1 XOR RAID0 L7P0. Since the target disk array check code generated by L6P2 is RAID1 L7P1, data recovery is performed on any physical block L6P2 based on the storage data in RAID1 L7P1 and other physical blocks participating in the generation of RAID1 L7P1, for example: L6P2=L0P1 XOR L1P1 XOR L2P3 XOR L3P2 XOR L4P2 XOR L5P2 XOR L7P1.

[0102] When multiple damaged data occurs in the storage device, the embodiment of the present application can realize the recovery of the multiple damaged data by combining the target disk array check code and other physical blocks participating in the generation of the target disk array check code.

[0103] As shown in Figure 10 is a functional module diagram of the storage device check block determination apparatus provided by the embodiment of the present application. The storage device check block determination apparatus 11 runs in an electronic device, the electronic device runs a storage device, and the storage device check block determination apparatus 11 includes a determination unit 110 and a recovery unit 111. The module / unit referred to by the present application refers to a series of computer readable instruction segments capable of being acquired by the processor 13 and capable of completing a fixed function, which are stored in the storage device 12.

[0104] The determining unit 110 is configured to determine a disk array check block from the physical blocks in the plurality of logical units according to the detection result of each logical unit in the storage device. The determining unit 110 is further configured to determine a disk array check code of each disk array check block according to the storage data of the non-bad blocks in each logical unit.

[0105] The determining unit 110 is further configured to determine the disk array check code generated by any physical block as a target disk array check code when detecting that the any physical block in the storage device has a data read failure. The restoring unit 111 is configured to perform data restoration on the any physical block based on all the physical blocks participating in the generation of the target disk array check code except the physical block with the data read failure and the target disk array check code.

[0106] The modules / units integrated in the electronic device 1, if implemented in the form of software function units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiments can also be implemented by computer readable instructions instructing related hardware to complete, and the computer readable instructions can be stored in a computer readable storage medium. When the computer readable instructions are executed by a processor, the steps of the above-mentioned various method embodiments can be implemented.

[0107] The computer readable instructions include computer readable instruction codes, which can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer readable medium can include any entity or device capable of carrying computer readable instruction codes, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).

[0108] The storage device 12 can be configured to store computer readable instructions and / or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer readable instructions and / or modules stored in the storage device 12, and calling data stored in the storage device 12. The storage device 12 can mainly include a storage program area and a storage data area, wherein the storage program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like; and the storage data area can store data created according to the use of the electronic device, etc. The storage device 12 can include non-volatile and volatile storage devices, for example, a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other storage devices.

[0109] For example, the computer readable instructions can be divided into one or more modules / units, and the one or more modules / units are stored in the storage device 12 and executed by the processor 13 to complete the present application. The one or more modules / units can be a series of computer readable instruction segments capable of completing a specific function, and the computer readable instruction segments are used to describe the execution process of the computer readable instructions in the electronic device 1. For example, the computer readable instructions can be divided into a determination unit 110 and a recovery unit 111.

[0110] The detailed content of the functions of the modules / units can refer to the detailed description of the above Figures 2-8 , which will not be described again here.

[0111] The embodiment of the present application determines the disk array check blocks from a plurality of logical units, so that all the disk array check blocks are in the same logical unit, thereby facilitating the rapid determination of all the disk array check blocks, and thus the determination efficiency of the disk array check code can be improved. In addition, the disk array check code is determined by the storage data of the non-bad blocks in each logical unit, and since the storage data of the bad blocks in the logical unit does not participate in the generation of the disk array check code, the recovery of the damaged data in the same disk array strip can be realized, which can avoid the failure to recover the damaged data due to the presence of multiple damaged data in the same disk array strip.

[0112] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and another division mode can be used in actual implementation.

[0113] The modules described as separate components may or may not be physically separate, and the components displayed as modules may or may not be physical units, i.e., may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.

[0114] In addition, each functional module in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software functional modules.

[0115] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, the scope of the present application is defined by the appended claims rather than the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any additional reference signs in the claims should not be considered as limiting the claims involved.

[0116] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. A plurality of units or devices can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names and not to indicate any particular order.

[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and not to limit it, although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A method for determining a storage device check block, applied to an electronic device, characterized in that: The electronic device includes a storage device, and the storage device check block determination method includes: Determining a disk array check block from physical blocks in a plurality of logical units according to a detection result of each logical unit in the storage device; Determining a disk array check code for each disk array check block based on the storage data of the non-bad blocks in each logical unit includes: forming disk array stripes with corresponding block numbers based on physical blocks with the same block number in all logical units, each disk array stripe including a corresponding disk array check block; and for each disk array check block, if all physical blocks in the disk array stripe corresponding to the disk array check block and in a target stripe preceding the disk array stripe in the storage device are non-bad blocks, determining an exclusive OR result of the storage data of all physical blocks in the disk array stripe as the disk array check code.

2. The method for determining a storage device parity block according to claim 1, wherein: The step of determining a disk array check block from physical blocks in a plurality of logical units according to a detection result of each logical unit in the storage device comprises: If the detection result of each logical unit in the storage device includes identification information of bad blocks, counting the number of bad blocks in each logical unit based on the identification information; All physical blocks in the logical unit with the least number of bad blocks are determined as the disk array check blocks, and the logical units are retrieved from back to front.

3. The storage device check block determination method according to claim 1, wherein: The method of determining a disk array check block from physical blocks in a plurality of logical units according to a detection result of each logical unit in the storage device further includes: If the detection result of the logical unit in the storage device does not include identification information of the bad block, determining the logical unit that does not include identification information of the bad block as the target logical unit; If there are multiple target logical units, all physical blocks in one target logical unit are selected according to a preset method to be determined as the disk array check blocks.

4. The method for determining a storage device parity block according to claim 1, wherein: Determining the disk array check code of each disk array check block according to the storage data of the non-bad blocks in each logical unit further includes: If any physical block in the disk array stripe corresponding to each disk array check block and the target stripe is a bad block, determining that the logical unit where the bad block is located is a defective logical unit; Based on the target stripe, acquiring target storage data in a target physical block located after the bad block in the defective logical unit; The disk array check code is determined according to an exclusive OR result of the target storage data and the storage data of non-bad blocks in the disk array stripe except the defective logical unit.

5. The method for determining a storage device parity block according to claim 4, wherein: The acquiring, based on the target stripe, target storage data in a target physical block located after the bad block in the defective logical unit comprises: If bad blocks exist in the target stripe, determining a statistical number of the bad blocks in the defective logical unit, and determining a stripe sequence number of the disk array stripe corresponding to the disk array check block; Calculating, based on the statistical quantity and the stripe sequence number, a sequence number of a block in the defective logical unit that participates in generating the disk array check code; If the participating block sequence number is less than or equal to the maximum block sequence number of the defective logical unit, a physical block corresponding to the participating block sequence number is obtained from the defective logical unit as the target physical block, and the target storage data is obtained from the target physical block.

6. The method for determining a storage device parity block according to claim 4, wherein: The acquiring, based on the target stripe, target storage data in a target physical block located after the bad block in the defective logical unit comprises: If all physical blocks in the target stripe are non-bad blocks, the block sequence number of the bad block is determined as the target block sequence number; If multiple block numbers corresponding to the physical blocks in the defective logical unit are greater than the target block number, the physical block corresponding to the smallest block number is determined from the multiple block numbers, the determined physical block is used as the target physical block, and the target storage data is obtained from the target physical block.

7. The method for determining a storage device parity block according to claim 1, wherein: After determining the disk array check code of each disk array check block based on the storage data of the non-bad blocks in each logical unit, the method further includes: When a data read failure occurs in any physical block of the storage device, determining a disk array check code generated by the physical block as a target disk array check code; Data recovery is performed on any physical block based on all physical blocks participating in generation of the target disk array check code, excluding the physical block where data reading fails, and the target disk array check code.

8. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the storage device check block determination method according to any one of claims 1 to 7.

9. An electronic device, characterized in that: The electronic device comprises: The storage medium of claim 8, storing computer-readable instructions and a processor, executing the computer-readable instructions stored in the storage medium to implement the storage device check block determination method.

Citation Information

Patent Citations

  • A solid-state storage device with asymmetric channels

    CN109783404A

  • Method and system using checksums to repair data

    US20070106925A1