Storage control method and apparatus, and device
By setting up a protection group in the storage device, identifying and updating the failed storage unit, the problem of low utilization rate of the storage device during failure is solved, and a higher utilization rate of the storage device is achieved.
Patent Information
- Application Number
- PCT/IB2024/061531
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-22
- Filing Date
- 2024-11-19
- Publication Date
- 2025-06-26
AI Technical Summary
When existing storage devices fail, after redundant storage units are exhausted, they cannot continue to be used, resulting in waste of available storage units and low utilization rate.
By setting up a protection group in the storage device, a fault storage unit is determined, and the fault unit is removed in the protection group, and the update process is performed to form a new protection group for storing other data or migrating the fault data.
It realizes flexible update of the protection group when a failure occurs, avoids overall equipment failure, improves the utilization rate of storage devices, and reduces the idleness of redundant storage units.
Smart Images

Figure IB2024061531_26062025_PF_FP_ABST
Abstract
Description
[0001] TECHNICAL FIELD The present disclosure relates to the field of data storage, and more particularly to a storage control method, apparatus, and device. Background: Storage devices can be categorized into solid-state drives (SSDs) and hard disk drives (HDDs). An SSD may include multiple storage planes, each of which may include multiple data blocks. A data block is the smallest storage unit in an SSD. An HDD may include multiple HDDs, each of which may include multiple sectors. A sector is the smallest storage unit in an HDD. In related art, multiple available storage units and multiple redundant storage units can be configured in any HDD or storage plane. These multiple redundant storage units are not accessible to users and can only be used to replace available storage units when an available storage unit fails. When the redundant storage units are exhausted, if an available storage unit fails again, the HDD or storage plane will fail. Failure of multiple HDDs or storage planes in a storage device will cause the storage device to fail and become unusable. However, in the above approach, when a storage device becomes unusable, in addition to the faulty storage unit, multiple functioning storage units remain in the storage device. However, because the entire storage device is unusable, these multiple available storage units are wasted, resulting in low storage device utilization. SUMMARY OF THE INVENTION Various aspects of the present disclosure provide a storage control method, apparatus, and device for improving storage device utilization. In a first aspect, an embodiment of the present disclosure provides a storage control method, comprising: identifying a faulty storage unit in a first protection group, the first protection group comprising multiple storage units located in at least two storage planes, or located in at least two hard disk drives (HDDs); removing the faulty storage unit from the first protection group and updating the first protection group to obtain an updated first protection group; the updated first protection group is used to store other data, or the updated first protection group further includes a migration storage unit, the migration storage unit being used to store data in the faulty storage unit. In one possible implementation, the multiple storage units are located in at least two storage planes and are multiple data blocks.In one possible embodiment, the first protection group includes N data blocks; removing the faulty storage unit from the first protection group and updating the first protection group to obtain an updated first protection group includes: recovering the data in the faulty storage unit to obtain N data blocks corresponding to the first protection group, where N is an integer greater than 1 and the N data blocks are data from the N data blocks in the first protection group; migrating the N data blocks; removing the faulty storage unit from the first protection group and clearing the data in the first protection group to obtain an updated first protection group. In one possible embodiment, migrating the N data blocks includes: determining a second protection group, the second protection group including N data blocks; and migrating the N data blocks to the N data blocks in the second protection group. In one possible embodiment, the level of the first protection group before the update is N, and the number of the faulty storage units is K. The method further includes: determining the updated first protection group to be an MK-level protection group; wherein the code at the position corresponding to the faulty storage unit in the updated first protection group is a preset value. In one possible embodiment, the multiple storage units are located in at least two HDDs, and the multiple storage units are multiple sectors. In one possible embodiment, removing the faulty storage unit from the first protection group and updating the first protection group to obtain an updated first protection group includes: recovering data in the faulty storage unit to obtain recovered data from the faulty storage unit, and removing the faulty storage unit from the first protection group; determining a target sector in the redundant sectors, migrating the recovered data to the target sector, and adding the target sector to the first protection group to obtain the updated first protection group. In one possible embodiment, determining the target sector in the redundant sectors includes: determining the sector pointed to by a current pointer in the redundant sectors; and determining the sector pointed to by the current pointer as the target sector. In one possible embodiment, after migrating the recovered data to the target sector, the process further includes: determining a logical address corresponding to the recovered data; determining a physical address corresponding to the target sector; and mapping the logical address to the physical address. In a possible implementation, the method further includes: in response to a write failure in the third protection group, determining a next available sector in the third protection group; and writing the data to be written to the next available sector.In one possible embodiment, the method further includes: after reading or writing data from the at least two HDDs, determining a first number of available sectors of the HDDs; when the first number is less than or equal to a first threshold, updating the redundant sectors of the at least two HDDs to available sectors; and when the remaining number of redundant sectors is less than or equal to a second threshold, marking the at least two HDDs as having no available capacity. In another possible embodiment, the method further includes: marking the faulty storage unit as in a faulty state. In a second aspect, an embodiment of the present disclosure provides a storage control method, comprising: determining a faulty data block in a first protection group, the first protection group comprising multiple data blocks, the multiple data blocks being located in at least two storage planes of a solid-state drive (SSD); removing the faulty data block from the first protection group, and updating the first protection group to obtain an updated first protection group, wherein the updated first protection group is used to store other data. In one possible embodiment, the first protection group includes N data blocks; the faulty data block is removed from the first protection group, and the first protection group is updated to obtain an updated first protection group, including: recovering the data in the faulty data block to obtain N blocks of data corresponding to the first protection group, where N is an integer greater than 1, and the N blocks of data are data in the N data blocks in the first protection group; migrating the N blocks of data; removing the faulty data block from the first protection group, and clearing the data in the first protection group to obtain an updated first protection group. In one possible embodiment, migrating the N blocks of data includes: determining a second protection group, where the second protection group includes N data blocks; and migrating the N blocks of data to the N data blocks in the second protection group. In a third aspect, an embodiment of the present disclosure provides a storage control method, comprising: determining a faulty sector in a first protection group, the first protection group including multiple sectors, the multiple sectors being located in at least two mechanical hard disks (HDDs); removing the faulty sector from the first protection group, and updating the first protection group to obtain an updated first protection group, the updated first protection group further including a migration sector, the migration sector being used to store data in the faulty sector.In one possible implementation, removing the faulty sector from the first protection group and updating the first protection group to obtain an updated first protection group includes: recovering data in the faulty sector to obtain recovered data in the faulty sector, and removing the faulty sector from the first protection group; determining a target sector in redundant sectors, migrating the recovered data to the target sector, and adding the target sector to the first protection group to obtain an updated first protection group. In a fourth aspect, an embodiment of the present disclosure provides a storage control device, comprising: a first determination module and a processing module, wherein the first determination module is configured to determine a faulty storage unit in a first protection group, wherein the first protection group includes multiple storage units, and the multiple storage units are located in at least two storage planes, or the multiple storage units are located in at least two mechanical hard disks (HDDs); the processing module is configured to remove the faulty storage unit in the first protection group, and update the first protection group to obtain an updated first protection group; wherein the updated first protection group is used to store other data, or the updated first protection group also includes a migration storage unit, and the migration storage unit is used to store data in the faulty storage unit. In one possible embodiment, the multiple storage units are located in at least two storage planes, and the multiple storage units are multiple data blocks. In one possible embodiment, the first protection group includes N data blocks; the processing module is specifically configured to: recover the data in the faulty storage unit to obtain N data blocks corresponding to the first protection group, where N is an integer greater than 1, and the N data blocks are data from the N data blocks in the first protection group; migrate the N data blocks; remove the faulty storage unit from the first protection group and clear the data in the first protection group to obtain an updated first protection group. In one possible embodiment, the processing module is specifically configured to: determine a second protection group, where the second protection group includes N data blocks; and migrate the N data blocks to the N data blocks in the second protection group. In one possible embodiment, the level of the first protection group before the update is N, and the number of the faulty storage units is K. The device further includes a second determination module, the second determination module being configured to determine that the updated first protection group is an MK-level protection group; wherein the code at the position corresponding to the faulty storage unit in the updated first protection group is a preset value. In a possible implementation, the multiple storage units are located in at least two HDDs, and the multiple storage units are multiple sectors.In one possible embodiment, the processing module is specifically configured to: recover the data in the failed storage unit to obtain recovered data from the failed storage unit, and remove the failed storage unit from the first protection group; determine a target sector in the redundant sectors, migrate the recovered data to the target sector, and add the target sector to the first protection group to obtain an updated first protection group. In one possible embodiment, the processing module is specifically configured to: determine the sector pointed to by the current pointer in the redundant sectors; and determine the sector pointed to by the current pointer as the target sector. In one possible embodiment, the apparatus further includes a mapping module, configured to: determine a logical address corresponding to the recovered data; determine a physical address corresponding to the target sector; and map the logical address to the physical address. In one possible embodiment, the apparatus further includes a response module and a write module, wherein the response module is configured to, in response to a write failure in the third protection group, determine the next available sector in the third protection group; and the write module is configured to write the data to be written to the next available sector. In one possible implementation, the apparatus further includes: a third determination module, an update module, and a marking module. The third determination module is configured to, after reading or writing data from the at least two HDDs, determine a first number of available sectors of the HDDs; the update module is configured to, when the first number is less than or equal to a first threshold, update the redundant sectors of the at least two HDDs to available sectors; and the marking module is configured to, when the remaining number of redundant sectors is less than or equal to a second threshold, mark the at least two HDDs as having no available capacity. In one possible implementation, the marking module is further configured to mark the faulty storage unit as faulty. In a fifth aspect, an embodiment of the present disclosure provides a storage control device, comprising: a determination module and a processing module, wherein the determination module is configured to determine a faulty data block in a first protection group, the first protection group comprising multiple data blocks, and the multiple data blocks are located in at least two storage planes in a solid-state drive (SSD); the processing module is configured to remove the faulty data block in the first protection group, and update the first protection group to obtain an updated first protection group, and the updated first protection group is used to store other data.In one possible embodiment, the first protection group includes N data blocks; the processing module is specifically configured to: recover the data in the faulty data block to obtain N blocks of data corresponding to the first protection group, where N is an integer greater than 1, and the N blocks of data are data in the N data blocks in the first protection group; migrate the N blocks of data; remove the faulty data block in the first protection group, and clear the data in the first protection group to obtain an updated first protection group. In one possible embodiment, the processing module is specifically configured to: determine a second protection group, where the second protection group includes N data blocks; and migrate the N blocks of data to the N data blocks in the second protection group. In a sixth aspect, embodiments of the present disclosure provide a storage control device, comprising: a determination module and a processing module, wherein the determination module is configured to determine a faulty sector in a first protection group, the first protection group comprising multiple sectors located in at least two mechanical hard disks (HDDs); and the processing module is configured to remove the faulty sector from the first protection group and update the first protection group to obtain an updated first protection group, the updated first protection group also comprising a migration sector for storing data in the faulty sector. In one possible implementation, the processing module is specifically configured to: recover the data in the faulty sector to obtain recovered data in the faulty sector and remove the faulty sector from the first protection group; determine a target sector from redundant sectors, migrate the recovered data to the target sector, and add the target sector to the first protection group to obtain an updated first protection group. In a seventh aspect, embodiments of the present disclosure provide an electronic device, comprising: a memory and a processor; the memory storing computer-executable instructions; and the processor executing the computer-executable instructions stored in the memory, causing the processor to perform the method described in any one of the first, second, or third aspects. In an eighth aspect, embodiments of the present disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by the processor, are used to implement the method described in any one of the first, second, or third aspects. In a ninth aspect, embodiments of the present disclosure provide a computer program product, comprising a computer program, which, when executed by the processor, implements the method described in any one of the first, second, or third aspects.Embodiments of the present disclosure provide a storage control method, apparatus, and device that can identify a faulty storage unit in a first protection group, remove the faulty storage unit from the first protection group, and then update the first protection group to obtain an updated first protection group. When a faulty storage unit occurs in a protection group, the protection group can be flexibly updated so that the updated protection group can continue to be used. This prevents the entire protection group from being rendered unusable due to a faulty storage unit, avoids wasting available storage units in the protection group, and thus improves storage device utilization. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings described herein are provided to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are provided to explain the present disclosure and are not intended to unduly limit the present disclosure. In the accompanying drawings: Figure 1 is a schematic diagram of a scenario provided by an exemplary embodiment of the present disclosure; Figure 2A is a structural schematic diagram of an SSD usage method in the related art; Figure 2B is a structural schematic diagram of an HDD usage method in the related art; Figure 3 is a flow diagram of a storage control method provided by an exemplary embodiment of the present disclosure; Figure 4A is a schematic diagram of a first protection group provided by an exemplary embodiment of the present disclosure; Figure 4B is a schematic diagram of a first protection group provided by an exemplary embodiment of the present disclosure; Figure 5 is a flow diagram of another storage control method provided by an exemplary embodiment of the present disclosure; Figure 6 is a schematic diagram of a faulty storage unit being located in a protection group provided by an exemplary embodiment of the present disclosure; Figure 7 is a process diagram of a storage control method provided by an exemplary embodiment of the present disclosure; Figure 8 is a schematic diagram of a zone division method in an HDD provided by an exemplary embodiment of the present disclosure; Figure 9 is a flow diagram of another storage control method provided by an exemplary embodiment of the present disclosure; Figure 10 is a flow diagram of a method of reading and writing data in an HDD provided by an exemplary embodiment of the present disclosure; Figure 11 is a structural schematic diagram of a storage control device provided by an exemplary embodiment of the present disclosure; Figure 12 is a structural schematic diagram of a storage control device provided by an exemplary embodiment of the present disclosure; Figure 13 is a structural schematic diagram of a storage control device provided by an exemplary embodiment of the present disclosure; FIG14 is a fourth structural diagram of a storage control device provided in an exemplary embodiment of the present disclosure; FIG15 is a fifth structural diagram of a storage control device provided in an exemplary embodiment of the present disclosure; FIG16 is a structural diagram of an electronic device provided in an exemplary embodiment of the present disclosure.DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, storage, and display) involved in this disclosure are all authorized by the user or fully authorized by all parties. The collection, use, and processing of the relevant data must comply with relevant laws, regulations, and standards, and corresponding operation portals are provided for users to choose to authorize or reject. To further clarify the objectives, technical solutions, and advantages of this disclosure, the technical solutions of this disclosure will be clearly and completely described below in conjunction with specific embodiments of this disclosure and the corresponding drawings. Obviously, the described embodiments are only some of the embodiments of this disclosure, and are not exhaustive. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure. FIG1 is a schematic diagram of a scenario provided by an exemplary embodiment of this disclosure. Referring to FIG1 , if the storage device is an SSD hard drive, the SSD hard drive may include multiple storage planes. For example, the SSD hard drive may include storage plane 1, storage plane 2, and storage plane w, where w is an integer greater than or equal to 2. Each storage plane includes multiple data blocks, that is, multiple storage cells. The storage cells in the storage device can be divided into multiple protection groups, namely protection group 1, protection group 2, protection group 3, protection group 4, and protection group 5. Protection group 1, protection group 2, and protection group 3 can include the same number of storage cells, and protection group 4 and protection group 5 can include the same number of storage cells. Assume that protection group 1, protection group 2, and protection group 3 each include 100 storage cells, and protection group 4 and protection group 5 each include 99 storage cells. If a faulty storage cell exists in protection group 1, the faulty storage cell can be identified in protection group 1, removed from protection group 1, and then updated to obtain an updated protection group 1. The updated protection group 1 can include 99 storage cells, which can be used to store 99 blocks of data. In related art, multiple available storage cells and multiple redundant storage cells can be set in any HDD or storage plane. The multiple redundant storage units are not available to users. They can be used only to replace available storage units when an available storage unit fails. When the redundant storage units are exhausted, if an available storage unit fails again, the HDD or storage plane will fail. If multiple HDDs or storage planes in a storage device fail, the storage device will fail and become unusable.However, in the above approach, when a storage device becomes unusable, in addition to the faulty storage unit, multiple functioning storage units remain in the storage device. However, since the entire storage device is unusable, these multiple available storage units are wasted, resulting in low storage device utilization. In the disclosed embodiments, protection groups can be set up in the storage device, and data can be read and written according to the protection groups. When a faulty storage unit appears in a first protection group, the faulty storage unit can be removed from the first protection group, and the first protection group can be updated to obtain an updated first protection group. Since the protection group can be flexibly updated when a faulty storage unit appears in a protection group, the updated protection group can continue to be used, preventing the entire protection group from becoming unusable due to a faulty storage unit. This avoids wasting available storage units in the protection group, thereby improving storage device utilization. Below, the use of an SSD in the related art will be described with reference to FIG2A , and the use of an HDD in the related art will be described with reference to FIG2B . FIG2A is a schematic diagram of the structure of the use of an SSD in the related art. As shown in Figure 2A, an SSD includes multiple logical unit numbers (LUNs), also known as dies. Each LUN can contain multiple storage planes. Any storage plane can contain multiple data blocks. During the SSD production process, each storage plane may contain defective data blocks, also known as faulty data blocks. After isolating these faulty data blocks, each storage plane can contain a different number of usable data blocks. The current practice is to set a uniform number, n, of usable data blocks per storage plane. The remaining data blocks on each storage plane, after excluding the uniformly specified n usable data blocks, are used as redundant data blocks, or data blocks within the redundant capacity. Redundant data blocks are not available to users during the SSD's lifecycle. Only when x faulty data blocks appear on a storage plane are they replaced with x redundant data blocks from that plane, until all redundant data blocks are exhausted. When the redundant data blocks on a storage plane are exhausted, that plane is declared failed. If multiple dies are replaced within an SSD, rendering its internal data protection ineffective, the entire SSD fails. Therefore, current usage practices are detrimental to extending SSD lifespan and increase costs. The reality is that most SSDs have a large number of redundant data blocks unused throughout their service life, wasting storage capacity and causing localized wear hotspots that degrade storage quality. Figure 2B illustrates the structural ZF schematic of HDD usage in related art.Referring to FIG. 2B , a Shingled Magnetic Recording (SMR) HDD is taken as an example. A Conventional Magnetic Recording (CMR) HDD can be considered a special case of SMR in which the entire disk is a zone and there is no track overlap.
[0002] An SMR HDD can include multiple zones, each containing multiple usable sectors. The number of zones in an SMR HDD can be calculated by dividing the nominal capacity by the zone capacity. Redundant capacity can then be evenly divided according to the physical location of the tracks, assigning redundant sectors to each zone. Redundant sectors are used to replace bad sectors that occur during use in their respective zones. Redundant capacity is only used to replace bad sectors during use, ensuring that the SMR HDD always maintains its nominal capacity. During the lifecycle of an SMR HDD, most redundant sectors remain unused, resulting in low utilization. Furthermore, SMR HDDs have physical limitations in moving the read head to the new address after sector replacement, resulting in additional read latency. Rewriting the entire zone results in a large amount of background data writes, resulting in high overhead and impacting write performance. In Figures 2A and 2B, multiple protection groups can be pre-configured in the storage device. For SSDs, a protection group can include multiple data blocks; for HDDs, a protection group can include multiple sectors. If the number of failed storage units (e.g., data blocks or sectors) in one or more protection groups exceeds the range that the protection group can recover, the entire SSD or HDD will become unusable, and the remaining capacity will also be unusable, resulting in low storage device utilization. The technical solutions presented in this disclosure are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and identical or similar content will not be repeated in different embodiments. Figure 3 is a schematic flow chart of a storage control method provided by an exemplary embodiment of the present disclosure. Referring to Figure 3, the method may include:
[0003] S301: Determine a faulty storage unit in a first protection group. The execution entity of the embodiments of the present disclosure may be an electronic device or a storage control device provided in the electronic device. The storage control device may be implemented via software or a combination of software and hardware. The storage control device may be a processor in the electronic device. For ease of understanding, the following description uses the electronic device as an example. The first protection group may include multiple storage units. The multiple storage units may be located in at least two storage planes, or in at least two HDDs. The following describes the first protection group in an SSD with reference to FIG4A , and the first protection group in an HDD hard disk group with reference to FIG4B . FIG4A is a schematic diagram of the first protection group provided in an exemplary embodiment of the present disclosure. Referring to FIG4A , if the storage device is an SSD, the multiple storage units are located in at least two storage planes of the SSD, and the multiple storage units are multiple data blocks. As shown in FIG4A , the SSD may include Z storage planes, and each storage plane may include multiple data blocks. Because unqualified data blocks, or faulty data blocks, may be generated during the production process, the number of available data blocks in each storage plane varies. Each data block may have a corresponding number in the storage plane. Optionally, data blocks with the same number may be grouped into a protection group. For example, protection group 1 may include data block 1 in storage plane 1, data block 1 in storage plane 2, and data block 1 in storage plane Z; protection group 2 may include data block 2 in storage plane 1, data block 2 in storage plane 2, and data block 2 in storage plane Z. It should be emphasized that the multiple data blocks in any protection group are located on multiple storage planes. For a protection group, each storage plane includes a portion of the data blocks in that protection group, and the number of these portions of data blocks may vary. For example, protection group 3 may include 100 data blocks, of which 60 data blocks may be located on storage plane 1 and 40 data blocks may be located on storage plane 2. In the SSD shown in FIG4A , redundant capacity in the SSD can be released all at once. Compared to FIG2A , there is no need to set up redundant capacity in each storage plane, thereby increasing the total available capacity of the SSD and improving SSD utilization. FIG4B is a second schematic diagram of a first protection group provided in an exemplary embodiment of the present disclosure. Referring to FIG4B , if the storage device is an HDD group including four HDDs, the multiple storage units are located in at least two HDDs, and the multiple storage units are multiple sectors.If the first protection group is protection group 1, protection group 1 may include 200 sectors, of which 70 sectors may be located in HDD 1, 30 sectors may be located in HDD 2, 60 sectors may be located in HDD 3, and 40 sectors may be located in HDD 4. If a faulty storage unit exists in the first protection group, the faulty storage unit may be determined in the first protection group. For example, if the first protection group includes 100 data blocks, namely, data block 1, data block 2, ..., data block 100, and if data block 2 fails, the faulty storage unit in the first protection group may be determined to be data block 2.
[0004] S302: Remove the faulty storage unit from the first protection group and update the first protection group to obtain an updated first protection group. If a faulty storage unit exists in the first protection group and cannot store data, the faulty storage unit can be removed from the first protection group and updated to obtain an updated first protection group. The updated first protection group does not include the faulty storage unit. The updated first protection group can be used to store other data, or the updated first protection group can include a migration storage unit, which can be used to store data from the faulty storage unit. If the storage device is an HDD hard disk group, the storage device may include multiple protection groups and remaining capacity. Each protection group may include multiple sectors, and the remaining capacity may also include multiple sectors. The migration storage unit may be a storage unit in the remaining capacity. For example, in an SSD, the first protection group includes 100 data blocks, namely, data block 1, data block 2, and data block 100. If data block 2 is a faulty storage unit, data block 2 can be removed from the first protection group to obtain an updated first protection group. The updated first protection group can include 99 data blocks and can be used to store other data. For example, if the first protection group in an HDD hard disk group includes 200 sectors, namely sector 1, sector 2, sector 3, ..., sector 200. If sector 3 is a faulty storage unit and the migrated storage unit is sector 201, sector 201 can be used in the first protection group to replace sector 3, obtaining an updated first protection group. The updated first protection group can include sectors 1, sector 2, sector 201, ..., and sector 200. Sector 201 can store the data in sector 3. The technical solution disclosed herein can simultaneously free up storage space and reduce costs while also reducing the amount of data to be relocated, improving the external service performance of storage devices, and enhancing service stability. This avoids storage device replacement and offline due to localized media wear, and improves the adjustability of data protection capabilities, thereby increasing storage device utilization. In this embodiment, a faulty storage unit can be identified in a first protection group, removed from the first protection group, and then updated to obtain an updated first protection group. When a faulty storage unit in a protection group occurs, the protection group can be flexibly updated to ensure continued use. This prevents the entire protection group from being rendered unusable due to a faulty storage unit, avoiding waste of available storage units in the protection group and thus improving storage device utilization.When performing storage control on an SSD, the above-mentioned storage control method may further include: determining a faulty data block in a first protection group, where the first protection group includes multiple data blocks, and the multiple data blocks are located in at least two storage planes of the solid-state drive (SSD); removing the faulty data block from the first protection group, and updating the first protection group to obtain an updated first protection group, where the updated first protection group is used to store other data. The following describes the SSD storage control process in detail with reference to FIG5 . FIG5 is a schematic flow diagram of another storage control method provided in an embodiment of the present disclosure. Referring to FIG5 , the method may include:
[0005] S501. Determine a faulty storage unit in a first protection group. The storage unit may be a data block, and the faulty storage unit is a faulty data block. The first protection group may include N data blocks. For example, the first protection group includes 100 data blocks, namely, data block 1, data block 2, ..., data block 1.
[0006] 100, if data block 2 fails, the failed storage unit can be determined in the first protection group, that is, data block 20.
[0007] S502. Recover the data in the failed storage unit to obtain N blocks of data corresponding to the first protection group.
[0008] The N blocks of data are data from the N data blocks in the first protection group, where N is an integer greater than 1. Optionally, among the N data blocks in the first protection group, N-1 data blocks can be used to store user data, and 1 data block can be used to store parity data. If k data blocks among the N-1 data blocks fail, data in the failed data blocks can be recovered based on the user data and parity data in the remaining N-1-k data blocks to obtain the data in the failed data blocks, thereby obtaining the N blocks of data corresponding to the first protection group. For example, if the first protection group includes 100 data blocks, namely data block 1, data block 2, ..., data block 100, data blocks 1 to 99 are used to store user data, and data block 100 is used to store parity data. If data block 2 fails, the data in data block 2 can be recovered based on the user data in data block 1 and data blocks 3 to 99, and the check data in data block 100, to obtain the data in data block 2, thereby obtaining 100 blocks of data corresponding to the first protection group.
[0009] S503. Migrate the N blocks of data. In an optional embodiment, the N blocks of data can be migrated as follows: determine a second protection group; and migrate the N blocks of data to the N data blocks in the second protection group. The second protection group can include N data blocks. The second protection group and the first protection group can include the same number of data blocks. Because the first protection group contains a faulty data block and cannot continue to store the N blocks of data corresponding to the first protection group, a second protection group including N data blocks can be determined in the SSD, and the N blocks of data corresponding to the first protection group can be migrated to the N data blocks in the second protection group to store the N blocks of data. For example, if the first protection group includes 100 data blocks, of which there is one faulty data block, after recovering the data in the faulty data block, 100 blocks of data corresponding to the first protection group are obtained. The first protection group cannot continue to store the 100 blocks of data, so a second protection group can be determined. The second protection group can include 100 data blocks. The 100 blocks of data corresponding to the first protection group can be migrated to the 100 data blocks in the second protection group to store the 100 blocks of data. 5504. Remove the faulty storage unit in the first protection group and clear the data in the first protection group to obtain an updated first protection group. The faulty storage unit can be removed in the first protection group and marked as a faulty state. For example, the first protection group includes 100 data blocks, namely data block 1, data block 2, ..., data block.
[0010] 100. If data block 2 fails, data block 2 can be removed from the first protection group and marked as a failure state. Then, data in the 100 data blocks in the first protection group can be cleared to obtain an updated first protection group.
[0011] S505. Determine that the updated first protection group is a level MK protection group. The level of the first protection group before the update is level N, and the number of faulty storage units is K. The code at the position corresponding to the faulty storage unit in the updated first protection group is a preset value. The preset value may be 0. For example, if the first protection group before the update includes 100 data blocks, namely data block 1, data block 2, ..., and data block 100, and the level of the first protection group is level 100, and if data block 2 fails, that is, the number of faulty storage units is 1, the first protection group can be updated to obtain a level 99 protection group after the update, including 99 data blocks. The code at the position corresponding to data block 2 is a preset value 0. The following describes the code at the position corresponding to the faulty storage unit in the SSD with reference to FIG6. FIG6 is a schematic diagram of a faulty storage unit located in a protection group according to an exemplary embodiment of the present disclosure. Referring to Figure 6, assume that a logical unit has six storage planes: Storage Plane 1, Storage Plane 2, Storage Plane 3, Storage Plane 4, Storage Plane 5, and Storage Plane 6. As shown in Figure 6, each storage plane contains a different number of failed data blocks and a different number of available data blocks. As protection groups are divided, the number of available data blocks in some protection groups gradually decreases. For example, Protection Group 1 may contain 18 available data blocks; Protection Group 2 may contain 36 available data blocks; Protection Group 3 may contain 15 available data blocks; Protection Group 4 may contain 12 available data blocks; and Protection Group 5 may contain 6 available data blocks. When only one available data block exists in a protection group, this flash memory block can be used as flexible capacity and temporarily not store user data. For protection group 3, the three data blocks in storage plane 2 are all faulty data blocks, so the codes corresponding to the three faulty data blocks can be set to the preset value 0; for protection group 4, the three data blocks in storage plane 1 and the three data blocks in storage plane 2 are all faulty data blocks, so the codes corresponding to the six faulty data blocks can be set to the preset value 0; for protection group 5, the data blocks in storage plane 1, storage plane 2, storage plane 3 and storage plane 4 are all faulty data blocks, so the codes corresponding to the 12 faulty data blocks can be set to the preset value 0, that is, all 0 data are written in the faulty data blocks.Setting the code corresponding to a faulty data block to a preset value of 0 means that when reading user data, since the faulty data block cannot be read, all zeros can be used as the data read from the faulty data block. When writing data, since the faulty data block cannot be written, all zeros can be written to the faulty data block as the data in the faulty data block. This approach has the advantage of maintaining data protection capabilities and facilitating read and write operations without having to distinguish which faulty data block to avoid when reading or writing user data. The SSD employs a virtual padding method of zero data blocks (i.e., the code corresponding to the faulty data block is set to a preset value of 0) to implement the construction and encoding of protection groups with a variable number of available data blocks. In the disclosed embodiment, a faulty storage unit can be identified in a first protection group, and the data in the faulty storage unit can be recovered to obtain N blocks of data corresponding to the first protection group. The N blocks of data can then be migrated, removing the faulty storage unit from the first protection group and clearing the data in the first protection group. The first protection group can then be updated to obtain an updated first protection group. Since an SSD can include multiple protection groups, these groups can be used to store data throughout the lifecycle of the SSD. The first and second protection groups can include the same number of data blocks. When a faulty storage unit in the first protection group occurs, data in the first protection group can be migrated to the second protection group. The first and second protection groups can serve as redundant protection groups, eliminating the need for fixed, non-user redundant storage units and reducing idle redundant storage units. Furthermore, the first protection group can be updated so that it can continue to be used after the update, avoiding waste of available storage units in the protection group and thus improving storage device utilization. The following describes the storage control method using a specific example based on the embodiment shown in FIG5 and in conjunction with FIG7. FIG7 is a schematic diagram of a storage control method provided by an exemplary embodiment of the present disclosure. FIG7 includes steps ①, ②, ③, ④, and ⑤. The first protection group can include N data blocks, each of which stores data. In step 1, if there is one faulty data block in the first protection group, data from N-1 data blocks in the first protection group can be read to obtain N-1 blocks of data. The data in the faulty data block can then be restored based on the N-1 blocks of data, thereby obtaining the N blocks of data corresponding to the first protection group. In step 2, a second protection group including N data blocks can be determined, and the N blocks of data corresponding to the first protection group can then be written to the N data blocks in the second protection group. In step 3, the data in the first protection group can be cleared.In step 4, the faulty data blocks can be removed from the first protection group and marked as faulty, resulting in an updated first protection group. The updated first protection group includes N-1 data blocks. In step 5, other data can be stored in the updated first protection group. In the disclosed embodiment, the faulty data blocks can be identified in the first protection group, and the data in the faulty data blocks can be recovered to obtain N blocks of data corresponding to the first protection group. The N blocks of data can be migrated, the faulty data blocks removed from the first protection group, and the data in the first protection group cleared. The first protection group can be updated to obtain the updated first protection group. Since an SSD can include multiple protection groups, these multiple protection groups can be used to store data throughout the lifecycle of the SSD. The first protection group and the second protection group can include the same number of data blocks. When a faulty data block exists in the first protection group, the data in the first protection group can be migrated to the second protection group. The first and second protection groups can serve as redundant protection groups for each other, eliminating the need for fixed, non-user-accessible redundant storage units and reducing idle redundant storage units. Furthermore, the first protection group can be updated so that the updated first protection group can continue to be used, avoiding waste of available storage units in the protection group and thus improving storage device utilization. Figures 5 through 7 illustrate the storage control method in an SSD. The following describes the storage control method in an HDD in conjunction with Figures 8 through 10. First, the HDD zone division method in the present disclosure will be described in conjunction with Figure 8. Figure 8 is a schematic diagram of a zone division method in an HDD provided in an exemplary embodiment of the present disclosure. As shown on the left side of Figure 8, for any HDD, all sectors in the HDD can be treated equally. Physical space is sequentially divided according to preset zone sizes, with isolation zones provided between adjacent zones. After the division is complete, the remaining capacity less than the size of a zone can be used as surplus capacity for flexible use. Compared to Figure 2B, redundant sectors do not need to be allocated to each zone. As shown on the right side of Figure 8, as HDDs are used, faulty sectors gradually appear, causing a decrease in HDD capacity. For any protection group, it can include multiple sectors across multiple HDDs. Because faulty sectors can occur within HDDs, the multiple sectors within each HDD in a protection group do not need to be located in the same location within each HDD. These sectors can be located across zones within the HDD. The sectors within a protection group do not need to be bound to zones and are not restricted by zones. They can also span isolation zones.For example, protection group 1 may include 200 sectors, of which 70 sectors may be located in HDD1, 30 sectors may be located in HDD2, 60 sectors may be located in HDD3, and 40 sectors may be located in HDD4. Of the 70 sectors in HDD1, 25 sectors may be located in zone 1 of HDD1, and 35 sectors may be located in zone 2 of HDD1; of the 30 sectors in HDD2, these 30 sectors may be located in zone 4 of HDD2; of the 60 sectors in HDD3, 20 sectors may be located in zone 2 of HDD3, and 40 sectors may be located in zone 5 of HDD3; and of the 40 sectors in HDD4, these 40 sectors may be located in zone 8 of HDD4. When performing storage control on an HDD, the above-mentioned storage control method may further include: determining a faulty sector in a first protection group, the first protection group including multiple sectors located in at least two mechanical hard disks (HDDs); removing the faulty sector from the first protection group, and updating the first protection group to obtain an updated first protection group, wherein the updated first protection group also includes a migration sector for storing data in the faulty sector. The storage control method in an HDD group will be described in detail below with reference to FIG9 . FIG9 is a schematic flow diagram of another storage control method provided in an exemplary embodiment of the present disclosure. Referring to FIG9 , the method may include:
[0012] S901. Determine a faulty storage unit in a first protection group. A storage unit may be a sector, and a faulty storage unit is a faulty sector. The first protection group may include N sectors, which may be used to store N blocks of data. For example, the first protection group includes 200 sectors, namely sector 1, sector 2, ..., and sector 100. If sector 2 fails, the faulty storage unit in the first protection group may be sector 2.
[0013] S902. Recover data in the faulty storage unit to obtain recovered data from the faulty storage unit, and remove the faulty storage unit from the first protection group. Of the N sectors in the first protection group, N-1 sectors can be used to store user data, and one sector can be used to store parity data. If one of the N-1 sectors fails, data in the faulty sector can be recovered based on the user data and parity data in the remaining N-2 sectors to obtain recovered data from the faulty sector. The faulty sector can then be removed from the first protection group and marked as faulty. For example, if the first protection group includes 200 sectors, namely sectors 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 9 If sector 2 fails, the data in sector 2 can be recovered based on the user data in sectors 1 and 3 to 199, and the parity data in sector 200, to obtain recovered data in sector 2. Sector 2 can be removed from the first protection group and marked as failed.
[0014] S903. Determine a target sector in the redundant sectors and migrate the recovered data to the target sector. In an optional embodiment, the target sector can be determined in the redundant sectors by: determining the sector pointed to by the current pointer in the redundant sectors; and determining the sector pointed to by the current pointer as the target sector. Optionally, each HDD in the HDD group may include multiple redundant sectors. The sector pointed to by the current pointer can be determined in the redundant sectors of the HDD where the faulty sector is located, and the sector pointed to by the current pointer can be determined as the target sector. For example, if the HDD group includes four HDDs, namely HDD1, HDD2, HDD3, and HDD4, and the faulty sector is sector 2 located in HDD1, the sector pointed to by the current pointer can be determined in the redundant sectors of HDD1 to be sector 201, and sector 201 can be determined as the target sector. Since the faulty sector can no longer store data, after determining the target sector, the recovered data in the faulty sector can be migrated to the target sector. For example, if the faulty sector is sector 2 and the target sector is sector 201, the recovered data in sector 2 can be migrated to sector 201 to store the recovered data.
[0015] 5904. Determine the logical address corresponding to the recovered data. The logical address (Logical Block Address, LBA) corresponding to the recovered data is the logical address corresponding to the faulty sector where the recovered data is located. For example, if the faulty sector is sector 2 and the corresponding logical address is LBA-3, then the logical address corresponding to the recovered data can be determined to be LBA-3.
[0016] S905. Determine the physical address corresponding to the target sector. Each sector has a corresponding physical address (Physics Block Address, PBA). For example, if the target sector is sector 201, the physical address corresponding to sector 201 may be PBA-201.
[0017] S906. Map the logical address to the physical address. Optionally, there is a one-to-one mapping between the logical address and the physical address. Since the recovery data in the failed sector has been migrated to the target sector, the physical address of the target sector can be mapped to the logical address of the recovery data so that the recovery data can be read from the target sector based on the logical address. For example, if the logical address corresponding to the recovery data is LBA-3, the target sector is sector 201, and the corresponding physical address is PBA-201, then the logical address LBA-3 can be mapped to the physical address PBA-201.
[0018] S907. Add the target sector to the first protection group to obtain an updated first protection group. Since the faulty sector has been removed from the first protection group and the recovered data has been stored in the target sector, other data is still in other sectors in the first protection group. Therefore, the target sector can be added to the first protection group to obtain an updated first protection group. In other words, the faulty sector can be replaced with the target sector to obtain an updated first protection group. For example, if the first protection group in an HDD hard disk group includes 200 sectors, namely sector 1, sector 2, sector 3, and sector 200, and sector 2 is a faulty sector, and the target sector is sector 201, sector 201 can be added to the first protection group to obtain an updated first protection group. The updated first protection group may include sectors 1, sector 201, sector 3, and sector 200. Sector 201 can store the recovered data from sector 2. It should be noted that the target sector is the migration storage unit. In an embodiment of the present disclosure, the electronic device can identify a faulty storage unit in the first protection group, then recover the data in the faulty storage unit to obtain the recovered data in the faulty storage unit, and then remove the faulty storage unit from the first protection group. The electronic device can identify a target sector in the redundant sectors and migrate the recovered data to the target sector. The electronic device can determine the logical address corresponding to the recovered data and the physical address corresponding to the target sector, and then map the logical and physical addresses. The electronic device can add the target sector to the first protection group to obtain an updated first protection group. Since an HDD hard disk group can include multiple protection groups, and each protection group can include multiple sectors, constructing protection groups based on sectors improves storage flexibility and utilizes redundant sectors, thereby improving storage device utilization. Figure 10 is a schematic diagram of a process for reading and writing data in an HDD according to an exemplary embodiment of the present disclosure. Referring to Figure 10, the method may include:
[0019] S1001: Obtain a first request and process the first request. The first request may be used to read data from or write data to a first sector of a third protection group. The request type of the first request may be a read request or a write request. For example, if the first sector is sector 1, the first request may be to read data 1 from sector 1 or to write data 1 to sector 1.
[0020] S1002: Determine whether the first request is successfully processed. If so, execute S1012; if not, determine the request type of the first request, that is, execute S1003.
[0021] S1003: Determine the request type of the first request. If the request type of the first request is a read request, it indicates that reading data from the first sector fails, and S1004 may be executed. If the request type of the first request is a write request, it indicates that writing data to the first sector fails, and S1010 may be executed.
[0022] S1004: Determine a third protection group in which the first sector is located. The third protection group may include N sectors, including the first sector. For example, if the first sector is sector 1, then the third protection group in which sector 1 is located may be determined to be protection group 5.
[0023] S1005: Perform recovery processing on the data in the third protection group to obtain recovered data in the first sector. Since the third protection group may include N sectors, and each sector may store data, N-1 blocks of data may be determined from the N-1 sectors in the third protection group excluding the first sector. Data in the first sector may be recovered based on the N-1 blocks of data to obtain recovered data in the first sector. For example, if the first sector is sector 1 and the third protection group includes 50 sectors, 49 blocks of data may be determined from the 49 sectors in the third protection group excluding sector 1. Data in sector 1 may be recovered based on the 49 blocks of data to obtain recovered data in sector 1, i.e., data 1.
[0024] S1006: Determine a target sector in the redundant sectors and write the recovered data to the target sector. Optionally, the current sector where the write pointer is located in the HDD where the first sector is located can be determined as the target sector. This target sector can be in the redundant sectors. After determining the target sector, the recovered data can be written to the target sector. For example, if the first sector is sector 1, and sector 1 is located in HDD 1, then the current sector where the write pointer is located in HDD 1 can be determined as the target sector. Assume that the target sector can be sector 60.
[0025] S1007: Determine whether the recovery data is successfully written into the target sector. If so, execute S1008; if not, execute S1010.
[0026] S1008: Map the physical address corresponding to the target sector and the logical address corresponding to the recovered data. Since the recovered data in the first sector has been written to the target sector, the physical address corresponding to the target sector and the logical address corresponding to the recovered data can be mapped so that the recovered data can be read from the target sector based on the logical address. For example, if the logical address corresponding to the recovered data is LBA-1, the target sector is sector 60, and the corresponding physical address is PBA-60, then the logical address LBA-1 can be mapped to the physical address PBA-60.
[0027] S1009: Mark the first sector as a failure state. Since data reading in the first sector fails, that is, the first sector has failed, the first sector may be marked as a failure state. For example, if the first sector is sector 1, sector 1 may be marked as a failure state.
[0028] S1010: Determine the next available sector. When executing step S1010, two situations may occur: Situation 1: Step S1010 is executed after step S1007. In this situation, since writing the recovery data to the target sector fails, it indicates that the target sector is unavailable. Therefore, the next available sector can be sequentially determined from the redundant sectors. The next available sector is not necessarily physically contiguous with the target sector; multiple failed sectors or isolation zones may separate the next available sector from the target sector. For example, if the target sector is sector 60, the next available sector can be sequentially determined from the redundant sectors. Assuming that sectors 61 and 62 following sector 60 are both failed sectors, the next available sector can be sequentially determined to be sector 63. Case 2: Step S10100 is executed after step S1002. In this case, since the processing of the first request fails and the first request is determined to be a write request, the first request is for writing data to the first sector in the third protection group (i.e., writing data to the first sector in the third protection group). Therefore, the first sector can be determined to be a failed sector. In response to the write failure in the third protection group, the next available sector can be determined in the third protection group. The next available sector is not necessarily physically contiguous with the first sector; it can be separated from the first sector by multiple failed sectors or isolation zones. For example, if the first sector is sector 1, the next available sector can be sequentially determined in the third protection group. Assume that the next available sector is sector 2.
[0029] S1011. Write the data to be written to the next available sector. The data to be written may be recovery data or data in the first request. For example, as in the above example, if the next available sector is sector 63, the recovery data may be written to sector 63; if the next available sector is sector 2, data 1 may be written to sector 2.
[0030] S1012: Determine whether the first request is the last request. If yes, execute S1013; if not, execute S1001.
[0031] S1013: After reading or writing data from at least two HDDs, determine a first number of available sectors in the HDDs. If the first request is the last request, then after executing the first request, i.e., after reading or writing data from at least two HDDs, the first number of available sectors in each HDD can be determined. The first number refers to the total number of available sectors in the at least two HDDs. For example, if there are two HDDs, HDD1 and HDD2, the number of available sectors in HDD1 and the number of available sectors in HDD2 can be determined, thereby determining the first number of available sectors. Assume that the first number is 10,000.
[0032] S1014: When the first number is less than or equal to a first threshold, the redundant sectors of the at least two HDDs are updated to available sectors. When the remaining number of redundant sectors is less than or equal to a second threshold, the at least two HDDs are marked as having no available capacity. The first threshold may be a preset nominal capacity. The first threshold may be represented by the number of sectors. For example, the first threshold may be 15,000. When the first number is less than the first threshold, it indicates that the number of available sectors is less than the nominal capacity. To maintain the nominal capacity, the redundant sectors of the at least two HDDs may be updated to available sectors. For example, if the first number is 10,000 and the first threshold is 15,000, 5,000 redundant sectors of the two HDDs may be updated to available sectors to maintain the number of available sectors meeting the first threshold of 15,000. The second threshold may be a preset threshold. For example, the second threshold may be 50. When the remaining number of redundant sectors is less than the second threshold, it indicates that the at least two HDDs are no longer able to store data. Therefore, the at least two HDDs may be marked as having no available capacity. For example, if the second threshold is 50 and the number of remaining redundant sectors is 50, at least two HDDs can be marked as having no available capacity because the number of remaining redundant sectors is less than or equal to the second threshold. In the disclosed embodiment, data can be read and written to at least two HDDs according to the protection group. During a data read, if the first sector in the third protection group fails, data can be recovered based on data from other sectors in the third protection group to obtain recovered data for the first sector. A target sector can then be determined and the recovered data written to the target sector. If writing to the target sector fails, the next available sector can be sequentially determined and the recovered data written to the next available sector. During a data write, if the first sector in the third protection group fails, the next available sector in the third protection group can be sequentially determined and the data to be written written to the next available sector. After reading data from or writing data to at least two HDDs, a first number of available sectors of the HDDs is determined, and when the first number is less than or equal to a first threshold, redundant sectors of the at least two HDDs are updated to available sectors, and when the remaining number of redundant sectors is less than or equal to a second threshold, the at least two HDDs are marked as having no available capacity.Because data can be read and written to at least two HDDs based on protection groups, the advantages of sequential access performance are fully utilized. Although zones are divided into fixed sizes after releasing redundant capacity, physical space constraints are eliminated in actual use. Protection groups are constructed at a granularity much smaller than zones, enhancing data reading and writing flexibility. Furthermore, faulty sectors in read and write operations are written at the current position of the write pointer, maintaining sequential operations and utilizing redundant capacity, thereby comprehensively improving HDD utilization. Figure 11 is a first structural diagram of a storage control device provided by an exemplary embodiment of the present disclosure. Referring to Figure 11 , the storage control device 10 may include: a first determination module 11 and a processing module 12. The first determination module 11 is configured to determine a faulty storage unit in a first protection group, wherein the first protection group includes multiple storage units located in at least two storage planes, or located in at least two hard disk drives (HDDs). The processing module 12 is configured to remove the faulty storage unit from the first protection group and update the first protection group to obtain an updated first protection group. The updated first protection group is configured to store other data, or the updated first protection group further includes a migration storage unit configured to store data in the faulty storage unit. The storage control device provided in the embodiments of the present disclosure can implement the technical solutions described in the above-mentioned method embodiments. The implementation principles and beneficial effects are similar and are not further described here. Figure 12 is a second structural schematic diagram of a storage control device provided in an exemplary embodiment of the present disclosure. Referring to FIG. 12 , based on the device shown in FIG. 11 , the storage control device 10 may include: a second determination module 13 and a marking module 14. In one possible embodiment, the multiple storage units are located on at least two storage planes, and the multiple storage units are multiple data blocks. In one possible embodiment, the first protection group includes N data blocks. The processing module 12 is specifically configured to: recover the data in the faulty storage unit to obtain N blocks of data corresponding to the first protection group, where N is an integer greater than 1, and the N blocks of data are the data in the N data blocks in the first protection group; migrate the N blocks of data; remove the faulty storage unit from the first protection group, and clear the data in the first protection group to obtain an updated first protection group. In one possible embodiment, the processing module 12 is specifically configured to: determine a second protection group, where the second protection group includes N data blocks; and migrate the N blocks of data to the N data blocks in the second protection group.In one possible implementation, the level of the first protection group before the update is N, and the number of faulty storage units is K. The second determination module 13 is configured to determine that the first protection group after the update is a level MK protection group; wherein the code at the position corresponding to the faulty storage unit in the updated first protection group is a preset value. In one possible implementation, the marking module 14 is configured to mark the faulty storage unit as faulty. The storage control device provided in the embodiments of the present disclosure can implement the technical solutions shown in the above-mentioned method embodiments. The implementation principles and beneficial effects are similar and will not be further described here. Figure 13 is a third structural schematic diagram of a storage control device provided in an exemplary embodiment of the present disclosure. Referring to Figure 13, based on the device shown in Figure 11, the storage control device 10 may include: a marking module 14, a mapping module 15, a response module 16, a write module 17, a third determination module 18, and an update module 19. In one possible implementation, the multiple storage units are located in at least two HDDs, and the multiple storage units are multiple sectors. In one possible embodiment, the processing module 12 is specifically configured to: recover the data in the failed storage unit to obtain the recovered data in the failed storage unit, and remove the failed storage unit from the first protection group; determine a target sector in the redundant sectors, migrate the recovered data to the target sector, and add the target sector to the first protection group to obtain an updated first protection group. In one possible embodiment, the processing module 12 is specifically configured to: determine the sector pointed to by the current pointer in the redundant sectors; and determine the sector pointed to by the current pointer as the target sector. In one possible embodiment, the mapping module 15 is configured to: determine the logical address corresponding to the recovered data; determine the physical address corresponding to the target sector; and map the logical address to the physical address. In one possible embodiment, the response module 16 is configured to, in response to a write failure in the third protection group, determine the next available sector in the third protection group; and the write module 17 is configured to write the data to be written to the next available sector.In one possible embodiment, the third determination module 18 is configured to determine a first number of available sectors of the at least two HDDs after reading or writing data from the at least two HDDs; the update module 19 is configured to update the redundant sectors of the at least two HDDs to available sectors when the first number is less than or equal to a first threshold; and the marking module 14 is configured to mark the at least two HDDs as having no available capacity when the remaining number of redundant sectors is less than or equal to a second threshold. In one possible embodiment, the marking module 14 is further configured to mark the faulty storage unit as being in a faulty state. The storage control device provided in the embodiment of the present disclosure can implement the technical solution shown in the above-mentioned method embodiment. Its implementation principles and beneficial effects are similar and will not be further described here. Figure 14 is a fourth structural schematic diagram of a storage control device provided in an exemplary embodiment of the present disclosure. Referring to Figure 14 , the storage control device 20 includes a determination module 21 and a processing module 22. The determination module 21 is configured to determine a faulty data block in a first protection group, where the first protection group includes multiple data blocks located on at least two storage planes of a solid-state drive (SSD). The processing module 22 is configured to remove the faulty data block from the first protection group and update the first protection group to obtain an updated first protection group for storing other data. The storage control device provided in the embodiments of the present disclosure can implement the technical solutions shown in the above-described method embodiments. The implementation principles and beneficial effects thereof are similar and are not further described here. In one possible embodiment, the first protection group includes N data blocks; the processing module 22 is specifically used to: recover the data in the faulty data block to obtain N blocks of data corresponding to the first protection group, where N is an integer greater than 1, and the N blocks of data are the data in the N data blocks in the first protection group; migrate the N blocks of data; remove the faulty data block in the first protection group, and clear the data in the first protection group to obtain an updated first protection group. In one possible embodiment, the processing module 22 is specifically used to: determine a second protection group, where the second protection group includes N data blocks; migrate the N blocks of data to the N data blocks in the second protection group. The storage control device provided in the embodiment of the present disclosure can execute the technical solution shown in the above-mentioned method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here. Figure 15 is a structural schematic diagram 5 of a storage control device provided in an exemplary embodiment of the present disclosure.Referring to Figure 15 , the storage control device 30 includes a determination module 31 and a processing module 32. The determination module 31 is configured to determine a faulty sector in a first protection group, wherein the first protection group includes multiple sectors located in at least two mechanical hard disks (HDDs). The processing module 32 is configured to remove the faulty sector from the first protection group and update the first protection group to obtain an updated first protection group. The updated first protection group also includes a migration sector for storing data in the faulty sector. The storage control device provided in the embodiments of the present disclosure can implement the technical solutions described in the above method embodiments. The implementation principles and beneficial effects are similar and will not be further described here. In one possible implementation, the processing module 31 is specifically configured to: recover the data in the faulty sector to obtain recovered data from the faulty sector, remove the faulty sector from the first protection group; determine a target sector from the redundant sectors, migrate the recovered data to the target sector, and add the target sector to the first protection group to obtain an updated first protection group. The storage control device provided in the embodiments of the present disclosure can implement the technical solutions shown in the above-mentioned method embodiments. Its implementation principles and beneficial effects are similar and will not be further described here. The exemplary embodiments of the present disclosure provide a schematic structural diagram of an electronic device. Referring to FIG16 , the electronic device 40 may include a processor 41 and a memory 42. For example, the processor 41 and the memory 42 are interconnected. Volatile memory, such as read-only memory (ROM) or flash RAM, is an example of computer-readable media. Computer-readable media include both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmitting media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves. It should also be noted that the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, product, or apparatus comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, product, or apparatus. Without further limitation, elements defined by the phrase "comprising a..." do not preclude the presence of other identical elements in the process, method, product, or apparatus comprising the elements. The foregoing description is merely an example of the present disclosure and is not intended to limit the present disclosure. Various modifications and variations will be apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, and the like made within the spirit and principles of the present disclosure are intended to be encompassed by the claims of the present disclosure. Industrial Applicability: A faulty storage unit can be identified in a first protection group, removed from the first protection group, and then updated to obtain an updated first protection group. When a faulty storage unit occurs in a protection group, the protection group can be flexibly updated so that the updated protection group can continue to be used. This prevents the entire protection group from being unusable due to a faulty storage unit, avoids wasting available storage units in the protection group, and thus improves the utilization of storage devices.
Claims
22 Claims 1. A storage control method, comprising: Determine a faulty storage unit in a first protection group, wherein the first protection group includes a plurality of storage units, and the plurality of storage units are located in at least two storage planes, or the plurality of storage units are located in at least two mechanical hard disks HDD; remove the faulty storage unit in the first protection group, and update the first protection group to obtain an updated first protection group; The updated first protection group is used to store other data, or the updated first protection group further includes a migration storage unit, and the migration storage unit is used to store the data in the failed storage unit.
2. The method according to claim 1, wherein: The multiple storage units are located in at least two storage planes, and the multiple storage units are multiple data blocks.
3. The method according to claim 2, wherein: The first protection group includes N data blocks; Removing the faulty storage unit from the first protection group and updating the first protection group to obtain an updated first protection group includes: recovering the data in the faulty storage unit to obtain N blocks of data corresponding to the first protection group, where N is an integer greater than 1, and the N blocks of data are data in N data blocks in the first protection group; Migrate the N blocks of data; remove the faulty storage unit in the first protection group, and clear the data in the first protection group to obtain an updated first protection group.
4. The method according to claim 3, wherein: The migration processing of the N blocks of data includes: determining a second protection group, where the second protection group includes N data blocks; and migrating the N blocks of data to the N data blocks in the second protection group.
5. The method according to any one of claims 2 to 4, wherein: The level of the first protection group before updating is level N, and the number of the fault storage units is K; the method also includes: determining that the first protection group after updating is an MK-level protection group; wherein the code at the corresponding position of the fault storage unit in the updated first protection group is a preset value.
6. The method according to claim 1, wherein: The multiple storage units are located in at least two HDDs, and the multiple storage units are multiple sectors.
7. The method according to claim 6, wherein: The faulty storage unit is removed from the first protection group, and the first protection group is updated to obtain an updated first protection group, including: recovering the data in the faulty storage unit to obtain the recovered data in the faulty storage unit, and removing the faulty storage unit from the first protection group; determining a target sector in a redundant sector, migrating the recovered data to the target sector, and adding the target sector to the first protection group to obtain an updated first protection group.
8. The method according to claim 7, wherein: Determining a target sector in a redundant sector includes: Determine the sector pointed to by the current pointer in the redundant sectors; and determine the sector pointed to by the current pointer as the target sector.
9. The method according to claim 7 or 8, wherein: After migrating the recovery data to the target sector, the method further includes: determining a logical address corresponding to the recovery data; determining a physical address corresponding to the target sector; and mapping the logical address to the physical address.
10. The method according to any one of claims 6 to 9, wherein: The method further includes: in response to a write failure in the third protection group, determining a next available sector in the third protection group; and writing the data to be written to the next available sector.
11. The method according to any one of claims 6 to 10, wherein: The method also includes: after reading or writing data from the at least two HDDs, determining a first number of available sectors of the HDD; when the first number is less than or equal to a first threshold, updating the redundant sectors of the at least two HDDs to available sectors, and when the remaining number of the redundant sectors is less than or equal to a second threshold, marking the at least two HDDs as having no available capacity.
12. The method according to any one of claims 1 to 11, wherein: The method further includes: marking the failed storage unit as a failed state.
13. A storage control method, comprising: Determine a faulty data block in a first protection group, wherein the first protection group includes a plurality of data blocks, and the plurality of data blocks are located in at least two storage planes in a solid state drive (SSD); The faulty data block is removed from the first protection group, and the first protection group is updated to obtain an updated first protection group, where the updated first protection group is used to store other data.
14. The method according to claim 13, wherein: The first protection group includes N data blocks; the faulty data block is removed from the first protection group, and the first protection group is updated to obtain an updated first protection group, including: recovering the data in the faulty data block to obtain N blocks of data corresponding to the first protection group, where N is an integer greater than 1, and the N blocks of data are the data in the N data blocks in the first protection group; migrating the N blocks of data; removing the faulty data block from the first protection group, and clearing the data in the first protection group to obtain an updated first protection group.
15. The method according to claim 14, wherein: The migration processing of the N blocks of data includes: determining a second protection group, where the second protection group includes N data blocks; and migrating the N blocks of data to the N data blocks in the second protection group.
16. A storage control method, comprising: Determining a faulty sector in a first protection group, wherein the first protection group includes a plurality of sectors, and the plurality of sectors are located in at least two mechanical hard disks HDD; The faulty sector is removed from the first protection group, and the first protection group is updated to obtain an updated first protection group, wherein the updated first protection group further includes a migration sector, and the migration sector is used to store data in the faulty sector.
17. The method according to claim 16, wherein: The faulty sector is removed from the first protection group, and the first protection group is updated to obtain an updated first protection group, including: recovering data in the faulty sector to obtain recovered data in the faulty sector, and removing the faulty sector from the first protection group; determining a target sector in a redundant sector, migrating the recovered data to the target sector, and adding the target sector to the first protection group to obtain an updated first protection group.
18. A storage control device, comprising: A first determination module and a processing module, wherein the first determination module is configured to determine a faulty storage unit in a first protection group, wherein the first protection group includes a plurality of storage units, wherein the plurality of storage units are located in at least two storage planes, or wherein the plurality of storage units are located in at least two mechanical hard disks HDD; the processing module is configured to remove the faulty storage unit in the first protection group, and update the first protection group to obtain an updated first protection group; wherein the updated first protection group is used to store other data, or wherein the updated first protection group also includes a migration storage unit, wherein the migration storage unit is used to store data in the faulty storage unit.
19. An electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the electronic device executes the method described in any one of claims 1-12, claims 13-15 or claims 16-17.
20. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 12, claims 13 to 15, or claims 16 to 17 is implemented.
21. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 12, claims 13 to 15 or claims 16 to 17 is implemented.
Citation Information
Patent Citations
Data recovery method, storage equipment and storage system
CN103534688A
A bad sector mapping method based on a mechanical hard disk
CN109582237A
Hard disk fault processing method, array controller and hard disk
CN110879761A
System for storing data and method for operating storage system
CN114003167A
Method and device for controlling solid state disk
CN114691433A