Method and device for implementing ssd bad block scattering, computer device and medium
By redistributing bad blocks in the SSD to evenly distribute the number of bad blocks on the RAID Line, the problem of SSD performance fluctuation is solved and the operation stability of the SSD is improved.
Patent Information
- Application Number
- CN202211680335.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-26
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-12-26
AI Technical Summary
Existing SSD products have too many bad blocks concentrated on RAID Line, resulting in performance fluctuations. Existing technologies have failed to effectively solve this problem.
By obtaining the bad block distribution on the RAIDLine and reallocating the bad blocks to other RAIDLines, the number of bad blocks on each RAIDLine is kept consistent, and the reallocation is performed by calculating the offset value.
This improves the stability of SSD business operations and avoids performance fluctuations caused by excessive concentration of bad blocks.
Smart Images

Figure CN115826871B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, in particular to an SSD bad block scattering implementation method and device, computer equipment and medium. BACKGROUND
[0002] Due to the relationship of the storage medium, the SSD product has the inherent defect that the bit position will be reversed. In addition to using error correction code (ECC) technology to ensure data integrity, the SSD product generally also uses redundant array of independent disks (RAID) technology to correct ECC uncorrectable errors. The RAID technology divides the storage space of the SSD into multiple RAID lines for management. When there are too many bad blocks on the RAID line, the number of concurrent Die processing is reduced, and the read-write performance of the SSD will decrease. The existing SSD product does not consider the performance fluctuation problem caused by the excessive concentration of bad blocks on part of the RAID line. SUMMARY
[0003] The purpose of the present application is to overcome the shortcomings of the prior art, provide an SSD bad block scattering implementation method and device, computer equipment and medium, and achieve the distribution of bad blocks on the RAID line as evenly as possible to improve the stability of the operation of the SSD business.
[0004] To achieve the above purpose, the present application adopts the following technical scheme:
[0005] In a first aspect, an SSD bad block scattering implementation method is provided. The storage space of the SSD includes multiple RAID lines, and multiple bad blocks are distributed on at least part of the RAID lines. The method comprises:
[0006] Obtaining the distribution of all bad blocks on the RAID line;
[0007] According to the distribution, at least part of the bad blocks in all bad blocks are redistributed from the original RAID line to other RAID lines, so that the number of bad blocks of each RAID line with bad blocks remains consistent.
[0008] Further technical solutions are as follows: according to the distribution, at least part of the bad blocks in all bad blocks are redistributed from the original RAID line to other RAID lines, so that the number of bad blocks of each RAID line with bad blocks remains consistent, comprising:
[0009] Calculating the offset value of each bad block on the RAID line;
[0010] According to the offset value, each bad block is updated from the original position to the new position.
[0011] A further technical solution is: calculating the offset value of each bad block on the RAIDLine includes:
[0012] Create a bad block table with physical Die as the index;
[0013] Add a subscript to the physical block where the bad block in each Die is located;
[0014] Count the physical blocks with the most bad blocks in the bad block table;
[0015] Calculate the difference between the subscripts of the physical block with the largest number of bad blocks in the bad block table and the bad blocks in the physical die to obtain the distance set;
[0016] Compare the distance set with the set of physical Die optional values;
[0017] Determine whether there is a value in the set of physical Die optional values that does not belong to the distance set;
[0018] If it exists, the largest value among the values that do not belong to the distance set is selected as the offset value.
[0019] A further technical solution is: after determining whether there is a value that does not belong to the distance set in the set of physical Die optional values, the method further includes:
[0020] If it does not exist, the value with the lowest frequency in the distance set is selected as the offset value.
[0021] In a second aspect, an SSD bad block scattering implementation device is provided, wherein the storage space of the SSD includes multiple RAID lines, and multiple bad blocks are distributed on at least some of the RAID lines, and the device includes an acquisition unit and a reallocation unit;
[0022] The acquisition unit is used to obtain the distribution of all bad blocks on the RAIDLine;
[0023] The reallocation unit is configured to reallocate at least part of all bad blocks from the original RAIDLine to other RAIDLines according to the distribution condition, so as to keep the number of bad blocks in each RAIDLine with bad blocks consistent.
[0024] Its further technical solution is: the reallocation unit includes a calculation module and an update module;
[0025] The calculation module is used to calculate the offset value of each bad block on the RAIDLine;
[0026] The updating module is used to update each bad block from its original position to a new position according to the offset value.
[0027] Its further technical solution is: the calculation module includes a creation submodule, an addition submodule, a statistics submodule, a calculation submodule, a comparison submodule, a judgment submodule and a first selection submodule;
[0028] The creation submodule is used to create a bad block table with physical Die as the index;
[0029] The adding submodule is used to add a subscript to the physical block where the bad block in each Die is located;
[0030] The statistical submodule is used to count the physical blocks with the largest number of bad blocks in the bad block table;
[0031] The calculation submodule is used to calculate the subscript difference between the physical block with the largest number of bad blocks in the bad block table and the bad blocks in the physical Di e to obtain a distance set;
[0032] The comparison submodule is used to compare the distance set with the set of physical Die optional values;
[0033] The judgment submodule is used to judge whether there is a value that does not belong to the distance set in the set of physical Die optional values;
[0034] The first selection submodule is configured to select the largest value from the values not in the distance set as the offset value, if any.
[0035] Its further technical solution is: the calculation module also includes a second selection submodule;
[0036] The second selection submodule is configured to select the value with the lowest frequency from the distance set as the offset value if the value does not exist.
[0037] In a third aspect, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned SSD bad block scattering method when executing the computer program.
[0038] In a fourth aspect, a computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the SSD bad block scattering implementation method as described above.
[0039] Compared with the prior art, the present invention has the following advantages: the present invention obtains the distribution of all bad blocks on the RAID Line; and reallocates at least some of the bad blocks from the original RAID Line to other RAID Lines according to the distribution, so that the number of bad blocks on each RAID Line with bad blocks is consistent, thereby avoiding the performance fluctuation problem caused by excessive concentration of bad blocks on the SSD and improving the stability of SSD business operation.
[0040] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 A flowchart of a method for implementing SSD bad block scattering provided by a specific embodiment of the present invention;
[0043] Figure 2 A schematic block diagram of an apparatus for implementing SSD bad block scattering according to a specific embodiment of the present invention;
[0044] Figure 3 A schematic block diagram of a computer device provided in accordance with a specific embodiment of the present invention;
[0045] Figure 4 A schematic diagram of the bad block distribution and scattering effect provided by a specific embodiment of the present invention is provided. DETAILED DESCRIPTION
[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0047] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0048] It should also be understood that the terms used in the present specification are only for the purpose of describing particular embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0049] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0050] An embodiment of the present invention provides a method for implementing SSD bad block scattering, wherein the storage space of the SSD includes multiple RAID Lines, and multiple bad blocks are distributed on at least part of the RAID Lines, such as Figure 1 As shown, the method includes the following steps: S10-S20.
[0051] S10. Obtain the distribution of all bad blocks on the RAIDLine.
[0052] like Figure 4 As shown, Figure 4There are 31 RAID Lines, each consisting of Block 1 from Die 0 to Die 15. Before bad block redistribution, there are 20 bad blocks in the 31 RAID Lines. RAID Line 31 has 6 bad blocks: Block 30 from Die 0, Block 30 from Die 1, Block 30 from Die 2, Block 30 from Die 3, Block 30 from Die 4, and Block 30 from Die 5. RAID Line 30 has 5 bad blocks: Block 29 from Die 0, Block 29 from Die 1, Block 29 from Die 2, Block 29 from Die 3, and Block 29 from Die 4. There are four bad blocks on RAIDLine29: Block 28 of Die0, Block 28 of Die1, Block 28 of Die2, and Block 28 of Die3. There are three bad blocks on RAIDLine28: Block 27 of Die0, Block 27 of Die1, and Block 27 of Die2. There are two bad blocks on RAIDLine27: Block 26 of Die0 and Block 26 of Die1.
[0053] S20: reallocate at least part of all the bad blocks from the original RAIDLine to other RAIDLines according to the distribution, so that the number of bad blocks in each RAIDLine where the bad blocks are distributed remains consistent.
[0054] Because before the bad blocks are redistributed, there are multiple blocks on a RAIDLine, such as Figure 4 As shown in the figure, there are 6 bad blocks on RAID Line 31 and 2 bad blocks on RAID Line 27. Therefore, in this case, when the RAID Line is switched, the number of dies that can be processed concurrently may vary greatly, causing significant fluctuations in the SSD's read and write performance. Therefore, to solve the problem of significant fluctuations in SSD read and write performance, it is necessary to reallocate the locations of at least some of the bad blocks. It should be noted that the slider on Die 0 Block 1 does not need to be reallocated.
[0055] In one embodiment, step S20 specifically includes the following steps: S201 - S202 .
[0056] S201: Calculate the offset value of each bad block on the RAIDLine.
[0057] In one embodiment, step S201 specifically includes the following steps: S2011-S2018.
[0058] S2011. Create a bad block table with physical Die as the index.
[0059] S2012. Add a subscript to the physical block where the bad block in each Die is located.
[0060] S2013. Count the physical blocks with the largest number of bad blocks in the bad block table.
[0061] S2014. Calculate the difference between the subscripts of the physical block with the largest number of bad blocks in the bad block table and the bad blocks in the physical die to obtain a distance set.
[0062] S2015. Compare the distance set with the set of physical Die optional values.
[0063] S2016: Determine whether there is a value in the set of physical Die optional values that does not belong to the distance set.
[0064] S2017. If it exists, select the largest value from the values that do not belong to the distance set as the offset value.
[0065] S2018. If it does not exist, select the value with the lowest frequency from the distance set as the offset value.
[0066] For S2011-S2018, specifically, i is the index of Die, Die0 does not need to be offset, so the value of i ranges from 1 to the total number of Dies - 1; shift_all is a set of optional values for physical Die, ranging from 0 to the total number of Blocks - 1; RAID_Line_bad_block_num[block_num] represents the number of bad blocks on each RAIDLine; max_bad_block_location_list is a list of BLOCK numbers with the largest number of bad blocks; Distance is a set of distances at which bad blocks will fall on the same RAID_LINE after being offset by the corresponding distance.
[0067] The offset value is calculated as follows:
[0068] According to the bad block table, a bad block table with physical Die as the index is obtained. The bad block table is traversed. Each time a Die is traversed, the logical bad block position of Diei-1 is added to RAID_Line_bad_block_num, that is, the physical Block of Die i-1 is added with the subscript of shift[i-1] + 1.
[0069] like Figure 4As shown, when i=1, DieShift is shift0=0, and the value of RAID_Line_bad_block_num[26 / 27 / 28 / 29 / 30] is updated from 0 to 1; when i=2, DieShift is shift1=26, and the logical position of the Die1 bad block is Block21 / 22 / 23 / 24 / 25, so the values of RAID_Line_bad_block_num[21 / 22 / 23 / 24 / 25 / 26 / 27 / 28 / 29 / 30] after the update are all 1.
[0070] Count the block number with the largest number of bad blocks in the RAID_Line_bad_block_num bad block table and record it as max_bad_block_location_list.
[0071] like Figure 4 As shown, when i=1, max_bad_block_location_list is {26,27,28,29,30}, and when i=2, max_bad_block_location_list is {21,22,23,24,25,,26,27,28,29,30}.
[0072] Calculate the difference between the subscripts of the physical bad blocks in max_bad_block_location_list and Diei, and record this as the distance set Distance. This distance set means that if Diei is offset by a value in Distance to generate a logical block, then a bad block on Diei must fall within the same RAID Line as the current bad block, causing the number of bad blocks in this RAID Line to increase. Therefore, it is necessary to compare the distance set Distance with the set of optional physical Die values, shifti.
[0073] like Figure 4As shown, when i=1, the physical bad blocks are 26, 27, 28, 29, 30, and the distances are calculated in sequence as {0, 1, 2, 3, 4}, {30, 0, 1, 2, 3}, {29, 30, 0, 1, 2}, {28, 29, 30, 0, 1}, {27, 28, 29, 30, 0}, and finally Di The stance is {0,1,2,3,4,27,28,29,30}. When i=2, the physical bad blocks are 27,28,29,30, and the distance is {25,26,27,28,29,30,0,1,2,3},{24,25,26,27,28,29,30,0,1,2},{23,24,25,26,27,28,29,30,0,1},{22,23,24,25,26,27,28,29,30,0}. The final distance is {0,1,2,3,22,23,24,25,26,27,28,29,30}.
[0074] If the set of physical Die optional values shifti does not contain a value in the distance set Distance, the largest value shifti is selected from the values that do not belong to the distance set as the offset value of Diei, such as Figure 4 As shown, when i = 1, the maximum value 26 not in Distance is selected as shift1; when i = 2, the maximum value 21 not in Distance is selected as shift2. If there is a value in the distance set Distance in the set shifti of physical Die optional values, the value with the lowest frequency in the distance set Distance is selected as the offset value Diei.
[0075] S202: Update each bad block from its original position to a new position according to the offset value.
[0076] Since the offset value is calculated, the corresponding bad block can be updated according to the calculated offset value, such as Figure 4 As shown, update as follows:
[0077] The bad block of Block26 of Die1 is updated to Block21 of Die1, the bad block of Block27 of Die1 is updated to Block22 of Die1, the bad block of Block28 of Die1 is updated to Block23 of Die1, the bad block of Block29 of Die1 is updated to Block24 of Die1, and the bad block of Block30 of Die1 is updated to Block25 of Die1.
[0078] The bad block of Block 27 of Die 2 is updated to Block 17 of Die 2, the bad block of Block 28 of Die 2 is updated to Block 18 of Die 2, the bad block of Block 29 of Die 2 is updated to Block 19 of Die 2, and the bad block of Block 30 of Die 2 is updated to Block 20 of Die 2.
[0079] The bad block of Block 28 of Die 3 is updated to Block 14 of Die 3 , the bad block of Block 29 of Die 3 is updated to Block 15 of Die 3 , and the bad block of Block 30 of Die 3 is updated to Block 16 of Die 3 .
[0080] The bad block of Block 29 of Die 4 is updated to Block 12 of Die 4, and the bad block of Block 30 of Die 4 is updated to Block 13 of Die 4.
[0081] The bad block in Block 30 of Die5 is updated to Block 11 of Die5.
[0082] After the above update, each of RAIDLine12-RAIDLine31 has only one bad block, ensuring that the number of bad blocks in each RAIDLine with bad blocks remains consistent. This avoids performance fluctuations caused by excessive concentration of bad blocks on the SSD and improves the stability of SSD service operations.
[0083] Figure 2 A schematic block diagram of an SSD bad block scattering implementation apparatus provided in an embodiment of the present invention; corresponding to the above-mentioned SSD bad block scattering implementation method, an embodiment of the present invention further provides an SSD bad block scattering implementation apparatus 100.
[0084] like Figure 2 As shown, an SSD bad block scattering device 100 includes a plurality of RAID Lines, wherein the storage space of the SSD includes multiple RAID Lines, and multiple bad blocks are distributed on at least some of the RAID Lines. The device includes an acquisition unit 110 and a reallocation unit 120. The acquisition unit 110 is configured to acquire the distribution of all bad blocks on the RAID Lines. The reallocation unit 120 is configured to reallocate at least some of the bad blocks from the original RAID Line to other RAID Lines based on the distribution, so that the number of bad blocks on each RAID Line with bad blocks remains consistent.
[0085] In one embodiment, the reallocation unit 120 includes a calculation module and an update module. The calculation module is used to calculate the offset value of each bad block on the RAIDLine. The update module is used to update each bad block from its original position to a new position according to the offset value.
[0086] In an embodiment, the calculating module comprises a creating submodule, an adding submodule, a counting submodule, a calculating submodule, a comparing submodule, a judging submodule and a first selecting submodule. The creating submodule is configured to create a bad block table indexed by physical dies. The adding submodule is configured to add an index for each physical block in which a bad block in each die is located.
[0087] The counting submodule is configured to count a physical block with the largest number of bad blocks in the bad block table. The calculating submodule is configured to calculate a difference between the physical block with the largest number of bad blocks and the index of the bad block in the physical die to obtain a distance set. The comparing submodule is configured to compare the distance set with a set of selectable values of the physical die. The judging submodule is configured to judge whether there is a value not in the distance set in the set of selectable values of the physical die. The first selecting submodule is configured to select a maximum value not in the distance set as an offset value if there is.
[0088] In an embodiment, the calculating module further comprises a second selecting submodule. The second selecting submodule is configured to select a value with the lowest frequency in the distance set as the offset value if there is not.
[0089] The above SSD bad block scattering implementation device can be implemented in the form of a computer program, which can run on a computer device as shown in Figure 3 .
[0090] Please refer to Figure 3 , Figure 3 is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 700 can be a server, wherein the server can be a stand-alone server or a server cluster composed of multiple servers.
[0091] As shown in Figure 3 , the computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above SSD bad block scattering implementation method when executing the computer program.
[0092] The computer device 700 can be a terminal or a server. The computer device 700 comprises a processor 720, a memory and a network interface 750 connected through a system bus 710, wherein the memory can comprise a non-volatile storage medium 730 and an internal memory 740.
[0093] The non-volatile storage medium 730 can store an operating system 731 and a computer program 732. The computer program 732, when executed, can cause the processor 720 to execute any one of the SSD bad block scattering implementation methods.
[0094] The processor 720 is used to provide computing and control capabilities and support the operation of the entire computer device 700.
[0095] The internal memory 740 provides an environment for the operation of the computer program 732 in the non-volatile storage medium 730. When the computer program 732 is executed by the processor 720, the processor 720 can execute any method for implementing SSD bad block scattering.
[0096] The network interface 750 is used for network communication, such as sending assigned tasks, etc. It will be understood by those skilled in the art that Figure 3 The structure shown in the figure is only a block diagram of a portion of the structure related to the solution of the present application and does not constitute a limitation on the computer device 700 to which the solution of the present application is applied. The specific computer device 700 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement. The processor 720 is used to execute the program code stored in the memory to implement the following steps:
[0097] A method for implementing SSD bad block scattering, wherein the storage space of the SSD includes multiple RAID lines, and multiple bad blocks are distributed on at least some of the RAID lines, the method comprising:
[0098] Get the distribution of all bad blocks on the RAIDLine;
[0099] At least part of all the bad blocks are reallocated from the original RAIDLine to other RAIDLines according to the distribution situation, so that the number of bad blocks in each RAIDLine where the bad blocks are distributed is kept consistent.
[0100] In one embodiment, the method of reallocating at least part of all bad blocks from the original RAIDLine to other RAIDLines based on the distribution of the bad blocks so that the number of bad blocks in each RAIDLine where the bad blocks are distributed remains consistent includes:
[0101] Calculate the offset value of each bad block on the RAIDLine;
[0102] Update each bad block from its original location to its new location according to the offset value.
[0103] In one embodiment, the step of calculating the offset value of each bad block on a RAIDLine includes:
[0104] Create a bad block table with physical Die as the index;
[0105] Add a subscript to the physical block where the bad block in each Die is located;
[0106] counting the number of bad blocks in the bad block table to obtain a distance set;
[0107] calculating the difference between the number of bad blocks in the bad block table and the index of the bad block in the physical Die to obtain the distance set;
[0108] comparing the distance set with a set of selectable values of the physical Die;
[0109] determining whether there is a value in the set of selectable values of the physical Die that is not in the distance set;
[0110] if there is, selecting the maximum value from the values that are not in the distance set as the offset value.
[0111] In an embodiment, after the determination of whether there is a value in the set of selectable values of the physical Die that is not in the distance set, the method further comprises:
[0112] if there is not, selecting the value with the lowest frequency from the distance set as the offset value. It should be understood that, in the embodiments of the present application, the processor 720 can be a central processing unit (CPU), and the processor 720 can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0113] Those skilled in the art can understand that, Figure 3 The structure of the computer device 700 shown in the above embodiments does not constitute a limitation on the computer device 700, and the computer device 700 can include more or fewer components than those shown in the figure, or combine some components, or arrange different components.
[0114] In another embodiment of the present application, a computer readable storage medium is provided. The computer readable storage medium can be a non-volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program is executed by a processor to implement the SSD bad block scattering method disclosed in the embodiments of the present application.
[0115] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0116] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, or units with the same function may be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0117] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.
[0118] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0119] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the present application, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0120] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. The method for breaking up bad blocks in SSD is characterized by: The storage space of the SSD includes multiple RAID lines, and the multiple bad blocks are distributed on at least some of the RAID lines. The method includes: Get the distribution of all bad blocks on the RAID Line; Redistribute at least some of the bad blocks from the original RAID line to other RAID lines based on the distribution of the bad blocks, so that the number of bad blocks on each RAID line with the bad blocks remains consistent; The method of reallocating at least part of all the bad blocks from the original RAID Line to other RAID Lines according to the distribution situation so that the number of bad blocks in each RAID Line where the bad blocks are distributed is consistent includes: Calculate the offset value of each bad block on the RAID Line; Update each bad block from its original location to its new location according to the offset value; Calculating the offset value of each bad block on the RAID Line includes: Create a bad block table with physical Die as the index; Add a subscript to the physical block where the bad block in each Die is located; Count the physical blocks with the most bad blocks in the bad block table; Calculate the difference between the subscripts of the physical block with the largest number of bad blocks in the bad block table and the bad blocks in the physical die to obtain the distance set; Compare the distance set with the set of physical Die optional values; Determine whether there is a value in the set of physical Die optional values that does not belong to the distance set; If it exists, the largest value among the values that do not belong to the distance set is selected as the offset value; After determining whether there is a value that does not belong to the distance set in the set of physical Die optional values, the method further includes: If it does not exist, the value with the lowest frequency in the distance set is selected as the offset value.
2. The device for breaking up bad blocks of SSD is characterized by: The storage space of the SSD includes a plurality of RAID lines, the plurality of bad blocks are distributed on at least some of the RAID lines, and the device includes an acquisition unit and a reallocation unit; The acquisition unit is used to obtain the distribution of all bad blocks on the RAID Line; The reallocation unit is configured to reallocate at least part of all bad blocks from the original RAID Line to other RAID Lines according to the distribution situation, so as to keep the number of bad blocks in each RAID Line where the bad blocks are distributed consistent; The reallocation unit includes a calculation module and an update module; The calculation module is used to calculate the offset value of each bad block on the RAID Line; The updating module is used to update each bad block from its original position to a new position according to the offset value; The calculation module includes a creation submodule, an addition submodule, a statistics submodule, a calculation submodule, a comparison submodule, a judgment submodule and a first selection submodule; The creation submodule is used to create a bad block table with physical Die as the index; The adding submodule is used to add a subscript to the physical block where the bad block in each Die is located; The statistical submodule is used to count the physical blocks with the largest number of bad blocks in the bad block table; The calculation submodule is used to calculate the difference between the subscripts of the physical block with the largest number of bad blocks in the bad block table and the bad blocks in the physical die to obtain a distance set; The comparison submodule is used to compare the distance set with the set of physical Die optional values; The judgment submodule is used to judge whether there is a value that does not belong to the distance set in the set of physical Die optional values; The first selection submodule is configured to select the largest value from the values not in the distance set as the offset value, if any; The calculation module also includes a second selection submodule; The second selection submodule is configured to select the value with the lowest frequency from the distance set as the offset value if the value does not exist.
3. A computer device, characterized in that: The system comprises a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for scattering bad blocks of an SSD as claimed in claim 1 is implemented.
4. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the SSD bad block scattering implementation method according to claim 1.
Citation Information
Patent Citations
Bad block management method and system for storage equipment, and computer readable storage medium
CN113986120A