Virtual block splicing method and device, target storage equipment and storage medium
By obtaining the number of damaged physical blocks in the logical unit number in the SSD, generating damaged and target virtual blocks, optimizing the virtual block patchwork method, the performance fluctuation caused by the large number of broken blocks in the virtual block is solved, and the performance and availability of storage devices are improved space.
Patent Information
- Application Number
- CN202411019119.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-26
AI Technical Summary
When existing SSDs write performance close to the concurrency performance limit, performance fluctuations occur because bad blocks in virtual blocks limit the concurrency amount, especially when there are many bad blocks in virtual blocks, performance fluctuations are obvious and fixed marshalling. The probability of broken blocks in the edge block at the bottom of the method is high, resulting in a large number of broken blocks in the virtual block, affecting the available space and performance of the SSD.
By obtaining the number of damaged physical blocks in each multi-block physical block in the logical unit number, we generate damaged virtual blocks and target virtual blocks, ensuring that the number of damaged physical blocks is close, preventing excessive performance fluctuations, and using completely damaged physical blocks and up to damaged physical blocks. The strategy of stopping virtual blocks is to stop generating virtual blocks according to preset stop conditions, and optimize the virtual block patchwork method to improve storage device performance.
It effectively prevents performance fluctuations caused by excessive number of damaged physical blocks in virtual blocks, improves the performance of the target storage device, and ensures the available space and performance stability of the SSD.
Smart Images

Figure CN118963659A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of storage devices, and in particular to a virtual block assembly method, device, target storage device and storage medium. Background Art
[0002] In the prior art, SSDs organize multiple physical blocks into virtual blocks in a fixed manner according to concurrency, and unify read and write management, which can ensure that the concurrency reaches the performance limit of the transmission bus and flash memory.
[0003] When the sequential write performance of the SSD approaches the concurrent performance limit, the bad blocks in the virtual block will limit the concurrency of the virtual block, which will lead to performance fluctuations. In particular, when there are many bad blocks in a virtual block, the performance fluctuation will be more obvious. In addition, the edge blocks of some flash memory have a high probability of being bad blocks. Under the existing fixed grouping method, there will be a large number of bad blocks in some virtual blocks. If these virtual blocks are abandoned, the available space of the SSD will be affected; if they are used, it will cause performance fluctuations.
[0004] Therefore, how to keep the number of bad blocks in the virtual block close and prevent excessive fluctuations has become an urgent problem to be solved. Summary of the invention
[0005] In view of this, the present invention provides a virtual block splicing method, apparatus, target storage device and storage medium to solve the problem of virtual block splicing.
[0006] In a first aspect, the present invention provides a virtual block splicing method, comprising:
[0007] For each logical unit number in the target storage device, obtaining a first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number; each of the multiple physical blocks includes multiple physical blocks;
[0008] According to each first quantity, searching for a first plurality of physical blocks from each logical unit number, and generating a damaged virtual block based on each first plurality of physical blocks;
[0009] Based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, target physical blocks are determined from the remaining multiple physical blocks corresponding to each logical unit number in turn to generate multiple target virtual blocks; the remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks; the difference between the numbers of damaged physical blocks included in each target virtual block is within a preset range.
[0010] The virtual block patchwork method provided by the embodiment of the present application obtains the first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number for each logical unit number in the target storage device, so that the damaged virtual block and the target virtual block can be generated according to the first number of damaged physical blocks in each of the multiple physical blocks. According to each first number, the first multiple physical blocks are searched from each logical unit number, and the damaged virtual block is generated based on each first multiple physical block, which can ensure that the number of damaged physical blocks included in the generated damaged virtual block is large. Then, based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, the target physical block is determined from the remaining multiple physical blocks corresponding to each logical unit number in turn, and multiple target virtual blocks are generated. The difference between the number of damaged physical blocks included in each target virtual block is within a preset range, so that the number of damaged physical blocks in the generated target virtual block can be guaranteed to be close, and then the fluctuation can be prevented from being too large, avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0011] In an optional implementation, the first plurality of physical blocks include all damaged physical blocks, searching the first plurality of physical blocks from each logical unit number according to each first quantity, and generating damaged virtual blocks based on each first plurality of physical blocks, including:
[0012] According to each first number, a plurality of physical blocks in which all physical blocks are damaged are determined as all damaged physical blocks;
[0013] Count the number of all damaged physical blocks included in each logical unit number;
[0014] Determine the minimum value of all the numbers of damaged physical blocks included in each logical unit number as a first value;
[0015] A completely damaged physical block is selected from each logical unit number in turn to generate a damaged virtual block, and this cycle is repeated to generate a damaged virtual block of the first value.
[0016] The virtual block piecing together method provided in the embodiment of the present application determines multiple physical blocks that are all damaged as all damaged physical blocks according to each first number, thereby ensuring the accuracy of the determined all damaged physical blocks. The number of all damaged physical blocks included in each logical unit number is counted; the minimum value among the number of all damaged physical blocks included in each logical unit number is determined as the first value, thereby ensuring the accuracy of the determined first value. One all damaged physical block is selected from each logical unit number in turn to generate a damaged virtual block, and the cycle is repeated to generate damaged virtual blocks of the first value, thereby ensuring that the number of damaged physical blocks included in the generated damaged virtual block is large, and further ensuring that the number of damaged physical blocks included in the generated target virtual block is small, thereby preventing excessive fluctuations and avoiding the large number of damaged physical blocks included in the target virtual block, which affects the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0017] In an optional implementation, the first plurality of physical blocks further include the most damaged physical blocks, where the most damaged physical blocks are the plurality of physical blocks including the largest number of damaged physical blocks except all damaged physical blocks in each logical unit number; the method further includes:
[0018] Detecting whether a preset stop condition for stopping generating damaged virtual blocks is met according to the remaining multiple physical blocks corresponding to each damaged virtual block and / or each logical unit number;
[0019] If the preset stop condition is not satisfied, determining the most damaged physical blocks from each logical unit number according to each first quantity;
[0020] Based on the most damaged physical blocks, damaged virtual blocks are generated.
[0021] The virtual block piecing together method provided by the embodiment of the present application detects whether the preset stop condition for stopping the generation of damaged virtual blocks is met according to the remaining multiple physical blocks corresponding to each damaged virtual block and / or each logical unit number, thereby ensuring the accuracy of the obtained detection result. If the preset stop condition is not met, the most damaged physical blocks are determined from each logical unit number according to each first quantity, thereby ensuring the accuracy of the most damaged physical blocks determined from each logical unit number. Based on each most damaged physical block, a damaged virtual block is generated, thereby ensuring that the number of damaged physical blocks included in the generated damaged virtual block is large, thereby ensuring that the number of damaged physical blocks included in the generated target virtual block is small, thereby preventing excessive fluctuations and avoiding the large number of damaged physical blocks included in the target virtual block, which affects the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0022] In an optional implementation, the preset stop condition includes:
[0023] The first good block rate corresponding to the damaged virtual block is greater than or equal to the overall bad block rate corresponding to the target storage device; wherein the first good block rate is used to represent the ratio of normal physical blocks in the damaged virtual block to all physical blocks in the damaged virtual block; the overall bad block rate is used to represent the ratio of damaged physical blocks in the target storage device to all physical blocks in the target storage device;
[0024] and / or,
[0025] The first bad block rate corresponding to each of the multiple physical blocks in each logical unit number is less than the overall bad block rate; the first bad block rate is used to represent the ratio of the damaged physical blocks in each of the multiple physical blocks to all the physical blocks in the multiple physical blocks;
[0026] and / or,
[0027] The second bad block rate corresponding to the damaged virtual block is less than or equal to a preset threshold; the second bad block rate is used to represent the ratio of damaged physical blocks in each damaged virtual block to all physical blocks in the damaged virtual block;
[0028] and / or,
[0029] There are no bad physical blocks within at least one logical unit number.
[0030] The virtual block piecing method provided by the embodiment of the present application has a preset stop condition including: a first good block rate corresponding to the damaged virtual block is greater than or equal to an overall bad block rate corresponding to the target storage device; wherein the first good block rate is used to characterize the ratio of normal physical blocks in the damaged virtual block to all physical blocks in the damaged virtual block; the overall bad block rate is used to characterize the ratio of damaged physical blocks in the target storage device to all physical blocks in the target storage device; and / or, a first bad block rate corresponding to each multi-block physical block in each logical unit number is less than the overall bad block rate; the first bad block rate is used to characterize the ratio of damaged physical blocks in each multi-block physical block to all physical blocks in the multi-block physical block; and / or, a second bad block rate corresponding to the damaged virtual block is less than or equal to a preset threshold; the second bad block rate is used to characterize the ratio of damaged physical blocks in each damaged virtual block to all physical blocks in the damaged virtual block; and / or, there is at least one logical unit number in which no damaged physical blocks exist, so that it can be detected according to the preset stop condition whether the generation of the damaged virtual block is satisfied, thereby ensuring that the number of damaged physical blocks in the generated damaged virtual block is large and the number of normal physical blocks is small, thereby avoiding the small amount of available space in the target storage device.
[0031] In an optional implementation, based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, determining the target physical blocks from the remaining multiple physical blocks corresponding to each logical unit number in sequence, and generating multiple target virtual blocks, includes:
[0032] acquiring a third number of physical blocks included in the target virtual block;
[0033] Determine, based on the third number and each of the remaining plurality of physical blocks, that the damaged physical blocks included in the target virtual block are a fourth number;
[0034] According to the second number corresponding to each of the remaining physical blocks and the fourth number corresponding to the target virtual block, the target physical block is determined in sequence from the remaining physical blocks corresponding to each of the logical unit numbers to generate multiple target virtual blocks.
[0035] The virtual block piecing together method provided in the embodiment of the present application obtains the third number of physical blocks included in the target virtual block; based on the third number and each of the remaining multiple physical blocks, the damaged physical blocks included in the target virtual block are determined to be the fourth number, thereby ensuring the accuracy of the determined fourth number. Based on the second number corresponding to each of the remaining multiple physical blocks and the fourth number corresponding to the target virtual block, the target physical block is determined from the remaining multiple physical blocks corresponding to each logical unit number in turn, and multiple target virtual blocks are generated, thereby ensuring that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0036] In an optional implementation, determining that the damaged physical blocks included in the target virtual block are a fourth number according to the third number and each of the remaining multiple physical blocks includes:
[0037] Calculate the total number of damaged physical blocks corresponding to the remaining multiple physical blocks according to the second number corresponding to each of the remaining multiple physical blocks;
[0038] The remaining bad block rate is generated by dividing the total number of damaged physical blocks corresponding to the remaining multiple physical blocks by the total number of physical blocks corresponding to the remaining multiple physical blocks;
[0039] generating a second value by multiplying the remaining bad block rate by a third number of physical blocks included in the target virtual block;
[0040] The second value is rounded up, and the number of damaged physical blocks included in the target virtual block is determined to be a fourth number.
[0041] The virtual block piecing together method provided by the embodiment of the present application calculates the total number of damaged physical blocks corresponding to the remaining multiple physical blocks according to the second number corresponding to each of the remaining multiple physical blocks; divides the total number of damaged physical blocks corresponding to the remaining multiple physical blocks by the total number of physical blocks corresponding to the remaining multiple physical blocks to generate the remaining bad block rate, thereby ensuring the accuracy of the generated remaining bad block rate. The remaining bad block rate is multiplied by the third number of physical blocks included in the target virtual block to generate a second value, thereby ensuring the accuracy of the generated second value. The second value is rounded up to determine that the damaged physical blocks included in the target virtual block are the fourth number, thereby ensuring the accuracy of the fourth number of damaged physical blocks included in the determined target virtual block.
[0042] In an optional implementation, according to the second number corresponding to each of the remaining multiple physical blocks and the fourth number corresponding to the target virtual block, the target physical block is determined from the remaining multiple physical blocks corresponding to each of the logical unit numbers in sequence to generate multiple target virtual blocks, including:
[0043] According to the second quantities corresponding to the remaining multiple physical blocks, the remaining multiple physical blocks with the largest second quantity are determined as the first target physical block, and the logical unit number corresponding to the first target physical block is determined as the target logical unit number;
[0044] comparing a second quantity corresponding to the first target physical block with a fourth quantity corresponding to the target virtual block;
[0045] If the second number is equal to the fourth number, selecting a plurality of remaining physical blocks excluding the damaged physical block from the first other logical unit numbers except the target logical unit number as the second target physical block;
[0046] generating a target virtual block according to the first target physical block and the second target physical block;
[0047] If the second quantity is less than the fourth quantity, calculating a first difference between the fourth quantity and the second quantity;
[0048] Determine a third target physical block from the first other logical unit numbers except the target logical unit number, and determine the logical unit number corresponding to the third target physical block as the first logical unit number; wherein the number of damaged physical blocks included in the third target physical block is the first difference value;
[0049] Selecting a plurality of remaining physical blocks excluding the damaged physical block from the second other logical unit numbers except the target logical unit number and the first logical unit number as the second target physical block;
[0050] A target virtual block is generated according to the first target physical block, the second target physical block, and the third target physical block.
[0051] The virtual block piecing method provided by the embodiment of the present application determines the remaining multiple physical blocks with the largest second number as the first target physical block according to the second number corresponding to each remaining multiple physical block, thereby ensuring the accuracy of the determined first target physical block, and determining the logical unit number corresponding to the first target physical block as the target logical unit number. The second number corresponding to the first target physical block is compared with the fourth number corresponding to the target virtual block; if the second number is equal to the fourth number, the remaining multiple physical blocks that do not include damaged physical blocks are selected from the first other logical unit numbers except the target logical unit number as the second target physical block, thereby ensuring the accuracy of the determined second target physical block. According to the first target physical and the second target physical blocks, the target virtual block is generated, thereby ensuring that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device. If the second number is less than the fourth number, then calculate the first difference between the fourth number and the second number; determine a third target physical block from the first other logical unit numbers except the target logical unit number, and determine the logical unit number corresponding to the third target physical block as the first logical unit number; wherein the number of damaged physical blocks included in the third target physical block is the first difference, and select the remaining multiple physical blocks that do not include damaged physical blocks from the second other logical unit numbers except the target logical unit number and the first logical unit number as the second target physical block; generate a target virtual block based on the first target physical, the second target physical block and the third target physical block. It is ensured that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0052] In an optional embodiment, the method further includes:
[0053] Each time a target virtual block is generated, the remaining bad block rate is updated to obtain an updated new remaining bad block rate;
[0054] generating a third value by multiplying the new remaining bad block rate by a third number of physical blocks included in the target virtual block;
[0055] rounding up the third value to determine a fifth quantity, and updating the fourth quantity using the fifth quantity;
[0056] Based on the fifth number, a target virtual block is generated.
[0057] The virtual block patchwork method provided by the embodiment of the present application is to update the remaining bad block rate each time a target virtual block is generated to obtain a new remaining bad block rate after update; the third value is generated by multiplying the new remaining bad block rate by the third number of physical blocks included in the target virtual block; the third value is rounded up to determine the fifth number, and the fourth number is updated by the fifth number; the target virtual block is generated according to the fifth number. It is ensured that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0058] In an optional implementation, after generating a plurality of target virtual blocks, the method further includes:
[0059] Determine a first physical address and a first virtual address corresponding to each physical block in the target virtual block; the first virtual address is an address of the physical block in the target virtual block;
[0060] Generate a first table according to the first physical address to the first virtual address corresponding to each physical block, and store the first table corresponding to the target virtual block;
[0061] Generate a second table according to the first virtual address to the first physical address corresponding to each physical block, and store the second table corresponding to the target virtual block;
[0062] According to the first table and the second table, corresponding operations are performed on the target virtual block.
[0063] The virtual block piecing together method provided by the embodiment of the present application determines the first physical address and the first virtual address corresponding to each physical block in the target virtual block; the first virtual address is the address of the physical block in the target virtual block; a first table is generated according to the first physical address to the first virtual address corresponding to each physical block, and the first table is stored in correspondence with the target virtual block; a second table is generated according to the first virtual address to the first physical address corresponding to each physical block, and the second table is stored in correspondence with the target virtual block; according to the first table and the second table, corresponding operations are performed on the target virtual block, thereby improving the consistency of reading and writing the target virtual block and improving the performance of the target storage device.
[0064] In a second aspect, the present invention provides a virtual block assembly device, the device comprising:
[0065] An acquisition module, configured to acquire, for each logical unit number in the target storage device, a first number of damaged physical blocks in each of the plurality of physical blocks in the logical unit number;
[0066] A first generating module is used to search for a first plurality of physical blocks from each logical unit number according to each first quantity, and generate a damaged virtual block based on each first plurality of physical blocks;
[0067] The second generation module is used to determine the target physical blocks from the remaining multiple physical blocks corresponding to each logical unit number in turn based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, and generate multiple target virtual blocks; the remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks; the difference between the numbers of damaged physical blocks included in each target virtual block is within a preset range.
[0068] The virtual block assembly device provided by the embodiment of the present application obtains the first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number for each logical unit number in the target storage device, so that the damaged virtual block and the target virtual block can be generated according to the first number of damaged physical blocks in each of the multiple physical blocks. According to each first number, the first multiple physical blocks are searched from each logical unit number, and the damaged virtual block is generated based on each first multiple physical block, which can ensure that the number of damaged physical blocks included in the generated damaged virtual block is large. Then, based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, the target physical block is determined from the remaining multiple physical blocks corresponding to each logical unit number in turn, and multiple target virtual blocks are generated. The difference between the number of damaged physical blocks included in each target virtual block is within a preset range, so that the number of damaged physical blocks in the generated target virtual block can be guaranteed to be close, and then the fluctuation can be prevented from being too large, avoiding affecting the performance of the target storage device. Therefore, the above device can improve the performance of the target storage device.
[0069] In a third aspect, the present invention provides a target storage device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the virtual block splicing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0070] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the virtual block assembly method of the first aspect or any corresponding embodiment thereof.
[0071] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the virtual block assembly method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0073] Figure 1 is a flow chart of a virtual block assembly method according to an embodiment of the present invention;
[0074] Figure 2 is a flow chart of another virtual block assembly method according to an embodiment of the present invention;
[0075] Figure 3 is a flowchart of another virtual block splicing method according to an embodiment of the present invention;
[0076] Figure 4 is a schematic diagram of a virtual block splicing method according to an embodiment of the present invention;
[0077] Figure 5 is a flowchart of another virtual block assembly method according to an embodiment of the present invention;
[0078] Figure 6 is a schematic diagram of the relationship between the first table and the second table according to an embodiment of the present invention;
[0079] Figure 7 is a structural block diagram of a virtual block assembly device according to an embodiment of the present invention;
[0080] Figure 8 It is a schematic diagram of the hardware structure of the target storage device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0082] It should be noted that the execution subject of the virtual block assembly method provided in the embodiment of the present application can be a virtual block assembly device, and the virtual block assembly device can be implemented as part or all of the target storage device through software, hardware, or a combination of software and hardware. Among them, the target storage device can be installed in the target storage device, or it can be installed in a server. Among them, the server in the embodiment of the present application can be a single server, or it can be a server cluster composed of multiple servers, and the terminal in the embodiment of the present application can be a smart phone, a personal computer, a tablet computer, a wearable device, and other intelligent hardware devices such as an intelligent robot. In the following method embodiments, the execution subject is taken as an example of the target storage device for explanation.
[0083] According to an embodiment of the present invention, a virtual block assembly method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0084] In this embodiment, a virtual block assembly method is provided, which can be used for the above-mentioned target storage device. Figure 1 is a flow chart of a virtual block splicing method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0085] Step S101: for each logical unit number in the target storage device, obtain a first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number.
[0086] Each of the multi-block physical blocks includes multiple physical blocks.
[0087] Specifically, the target storage device can detect the status of each physical block included in each of the multiple physical blocks in the logical unit number through its built-in hardware and software functions. When a problem is detected in a physical block, the target storage device will record the relevant error information. The error information may include the address of the physical block, the error type, and other relevant details. Then, the target storage device can determine the first number of damaged physical blocks in each of the multiple physical blocks in each of the logical unit numbers by reading the error records.
[0088] Step S102: searching for a first plurality of physical blocks from each logical unit number according to each first quantity, and generating a damaged virtual block based on each first plurality of physical blocks.
[0089] Specifically, the target storage device can search for a plurality of physical blocks with the largest first number from each logical unit number as the first plurality of physical blocks according to each first number. Then, the target storage device generates a damaged virtual block based on each first plurality of physical blocks.
[0090] This step will be described in detail below.
[0091] Step S103, based on the second number of damaged physical blocks included in the remaining physical blocks corresponding to each logical unit number, determine the target physical blocks from the remaining physical blocks corresponding to each logical unit number in turn, and generate multiple target virtual blocks.
[0092] The remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks; and the difference between the numbers of damaged physical blocks included in each target virtual block is within a preset range.
[0093] Specifically, after generating the loss virtual block, the target storage device may count the second number of damaged physical blocks in the remaining multiple physical blocks except the first multiple physical blocks in each logical unit number. The target storage device determines the target physical blocks from the remaining multiple physical blocks corresponding to each logical unit number in turn according to the preset conditions based on the second number of damaged physical blocks in the remaining multiple physical blocks corresponding to each logical unit number, and generates multiple target virtual blocks.
[0094] The preset condition may be that the number of damaged physical blocks included in the target virtual block does not exceed a preset damaged physical block threshold. The preset damaged physical block threshold may be input to the target storage device by a user, or may be sent to the target storage device by other devices, or may be set by the target storage device according to the second number of damaged physical blocks in the remaining multiple physical blocks corresponding to each logical unit number. The embodiment of the present application does not specifically limit the way in which the target storage device obtains the preset damaged physical block threshold.
[0095] The virtual block patchwork method provided by the embodiment of the present application obtains the first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number for each logical unit number in the target storage device, so that the damaged virtual block and the target virtual block can be generated according to the first number of damaged physical blocks in each of the multiple physical blocks. According to each first number, the first multiple physical blocks are searched from each logical unit number, and the damaged virtual block is generated based on each first multiple physical block, which can ensure that the number of damaged physical blocks included in the generated damaged virtual block is large. Then, based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, the target physical block is determined from the remaining multiple physical blocks corresponding to each logical unit number in turn, and multiple target virtual blocks are generated. The difference between the number of damaged physical blocks included in each target virtual block is within a preset range, so that the number of damaged physical blocks in the generated target virtual block can be guaranteed to be close, and then the fluctuation can be prevented from being too large, avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0096] In this embodiment, a virtual block assembly method is provided, which can be used for the above-mentioned target storage device. Figure 2 is a flow chart of a virtual block splicing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0097] Step S201: for each logical unit number in the target storage device, obtain a first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number.
[0098] Each of the multi-block physical blocks includes multiple physical blocks.
[0099] For details about this step, please refer to the above description of step S101, which will not be elaborated here.
[0100] Step S202: searching for a first plurality of physical blocks from each logical unit number according to each first quantity, and generating a damaged virtual block based on each first plurality of physical blocks.
[0101] Specifically, the first plurality of physical blocks include all damaged physical blocks, and the above step S202 includes:
[0102] Step S2021: According to each first number, a plurality of physical blocks in which all physical blocks are damaged are determined as all damaged physical blocks.
[0103] Specifically, the target storage device can determine, based on the first number of damaged physical blocks in each multi-block physical block in the logical unit number, a plurality of physical blocks whose first number is equal to the number of physical blocks included in the plurality of physical blocks as all damaged physical blocks, that is, a plurality of physical blocks whose physical blocks are all damaged are determined as all damaged physical blocks.
[0104] Step S2022, counting the number of all damaged physical blocks included in each logical unit number.
[0105] Specifically, the target storage device may count the number of all damaged physical blocks included in each logical unit number.
[0106] Step S2023: determine the minimum value of the number of all damaged physical blocks included in each logical unit number as the first value.
[0107] Specifically, the target storage device compares the numbers of all damaged physical blocks included in each logical unit number, and then determines the minimum value among the numbers of all damaged physical blocks included in each logical unit number as the first value.
[0108] Step S2024, select one completely damaged physical block from each logical unit number in turn to generate a damaged virtual block, and repeat this cycle to generate a damaged virtual block of the first value.
[0109] Specifically, the target storage device selects one completely damaged physical block from each logical unit number in turn to generate a damaged virtual block. In this way, the target storage device generates a value of damaged virtual blocks.
[0110] In an optional implementation manner of the present application, the first plurality of physical blocks further include the most damaged physical blocks, and the most damaged physical blocks are the plurality of physical blocks including the largest number of damaged physical blocks determined in each logical unit number except for all damaged physical blocks; the above implementation manner may further include the following steps:
[0111] Step S2025: Detect whether a preset stop condition for stopping generating damaged virtual blocks is met according to the remaining multiple physical blocks corresponding to each damaged virtual block and / or each logical unit number.
[0112] In an optional implementation manner of the present application, the preset stop condition includes:
[0113] The first good block rate corresponding to the damaged virtual block is greater than or equal to the overall bad block rate corresponding to the target storage device; wherein the first good block rate is used to represent the ratio of normal physical blocks in the damaged virtual block to all physical blocks in the damaged virtual block; the overall bad block rate is used to represent the ratio of damaged physical blocks in the target storage device to all physical blocks in the target storage device;
[0114] and / or,
[0115] The first bad block rate corresponding to each of the multiple physical blocks in each logical unit number is less than the overall bad block rate; the first bad block rate is used to represent the ratio of the damaged physical blocks in each of the multiple physical blocks to all the physical blocks in the multiple physical blocks;
[0116] and / or,
[0117] The second bad block rate corresponding to the damaged virtual block is less than or equal to a preset threshold; the second bad block rate is used to represent the ratio of damaged physical blocks in each damaged virtual block to all physical blocks in the damaged virtual block;
[0118] and / or,
[0119] There are no bad physical blocks within at least one logical unit number.
[0120] Specifically, the target storage device can detect whether the first good block rate corresponding to the damaged virtual block is greater than or equal to the overall bad block rate corresponding to the target storage device, and / or whether the first bad block rate corresponding to each multiple physical block in each logical unit number is less than the overall bad block rate, and / or whether the second bad block rate corresponding to the damaged virtual block is less than or equal to a preset threshold, and / or whether there is no damaged physical block in at least one logical unit number.
[0121] If the first good block rate corresponding to the damaged virtual block is greater than or equal to the overall bad block rate corresponding to the target storage device; and / or, the first bad block rate corresponding to each of the multiple physical blocks in each logical unit number is less than the overall bad block rate; and / or, the second bad block rate corresponding to the damaged virtual block is less than or equal to a preset threshold; and / or, there is at least one logical unit number in which no damaged physical block exists, then it is determined that the preset stop condition for stopping the generation of damaged virtual blocks is met, and the target storage device stops generating damaged virtual blocks.
[0122] Step S2026: If the preset stop condition is not met, the most damaged physical blocks are determined from each logical unit number according to each first quantity.
[0123] Specifically, if the preset stop condition is not satisfied, the target storage device determines the most damaged physical blocks from each logical unit number according to each first quantity.
[0124] Step S2027: Generate a damaged virtual block based on the most damaged physical blocks.
[0125] Specifically, the target storage device generates a damaged virtual block based on each of the most damaged physical blocks.
[0126] After generating the loss virtual block, the target storage device may continue to detect whether the preset stop condition for stopping generating the damaged virtual block is currently satisfied; if the preset stop condition is not satisfied, the damaged virtual block is generated again from the plurality of physical blocks currently including the largest number of damaged physical blocks determined in each logical unit number. If the preset stop condition is satisfied, the generation of the damaged virtual block is stopped.
[0127] Step S203, based on the second number of damaged physical blocks included in the remaining physical blocks corresponding to each logical unit number, determine the target physical blocks from the remaining physical blocks corresponding to each logical unit number in turn, and generate multiple target virtual blocks.
[0128] The remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks; and the difference between the numbers of damaged physical blocks included in each target virtual block is within a preset range.
[0129] For details about this step, please refer to the above description of step S103, which will not be elaborated here.
[0130] The virtual block piecing together method provided in the embodiment of the present application determines multiple physical blocks that are all damaged as all damaged physical blocks according to each first number, thereby ensuring the accuracy of the determined all damaged physical blocks. The number of all damaged physical blocks included in each logical unit number is counted; the minimum value among the number of all damaged physical blocks included in each logical unit number is determined as the first value, thereby ensuring the accuracy of the determined first value. One all damaged physical block is selected from each logical unit number in turn to generate a damaged virtual block, and the cycle is repeated to generate damaged virtual blocks of the first value, thereby ensuring that the number of damaged physical blocks included in the generated damaged virtual block is large, and further ensuring that the number of damaged physical blocks included in the generated target virtual block is small, thereby preventing excessive fluctuations and avoiding the large number of damaged physical blocks included in the target virtual block, which affects the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0131] The first plurality of physical blocks also includes the most damaged physical blocks. According to the remaining plurality of physical blocks corresponding to each damaged virtual block and / or each logical unit number, it is detected whether the preset stop condition for stopping the generation of damaged virtual blocks is met, thereby ensuring the accuracy of the obtained detection result. If the preset stop condition is not met, the most damaged physical blocks are determined from each logical unit number according to each first number, thereby ensuring the accuracy of the most damaged physical blocks determined from each logical unit number. Based on each most damaged physical block, a damaged virtual block is generated, thereby ensuring that the number of damaged physical blocks included in the generated damaged virtual block is large, thereby ensuring that the number of damaged physical blocks included in the generated target virtual block is small, thereby preventing excessive fluctuations, thereby avoiding the large number of damaged physical blocks included in the target virtual block, and affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0132] Among them, the preset stop condition includes: the first good block rate corresponding to the damaged virtual block is greater than or equal to the overall bad block rate corresponding to the target storage device; wherein the first good block rate is used to characterize the ratio of normal physical blocks in the damaged virtual block to all physical blocks in the damaged virtual block; the overall bad block rate is used to characterize the ratio of damaged physical blocks in the target storage device to all physical blocks in the target storage device; and / or, the first bad block rate corresponding to each multi-block physical block in each logical unit number is less than the overall bad block rate; the first bad block rate is used to characterize the ratio of damaged physical blocks in each multi-block physical block to all physical blocks in the multi-block physical block; and / or, the second bad block rate corresponding to the damaged virtual block is less than or equal to the preset threshold; the second bad block rate is used to characterize the ratio of damaged physical blocks in each damaged virtual block to all physical blocks in the damaged virtual block; and / or, there is at least one logical unit number in which no damaged physical blocks exist, so that it can be detected according to the preset stop condition whether the generation of the damaged virtual block is satisfied, thereby ensuring that the number of damaged physical blocks in the generated damaged virtual block is large and the number of normal physical blocks is small, thereby avoiding the small amount of available space in the target storage device.
[0133] In this embodiment, a virtual block assembly method is provided, which can be used for the above-mentioned target storage device. Figure 3 is a flow chart of a virtual block splicing method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0134] Step S301: for each logical unit number in the target storage device, obtain a first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number.
[0135] Each of the multi-block physical blocks includes multiple physical blocks.
[0136] For details about this step, please refer to the above description of step S201, which will not be elaborated here.
[0137] Step S302: searching for a first plurality of physical blocks from each logical unit number according to each first quantity, and generating a damaged virtual block based on each first plurality of physical blocks.
[0138] For details about this step, please refer to the above description of step S202, which will not be elaborated here.
[0139] Step S303, based on the second number of damaged physical blocks included in the remaining physical blocks corresponding to each logical unit number, determine the target physical blocks from the remaining physical blocks corresponding to each logical unit number in turn, and generate multiple target virtual blocks.
[0140] The remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks; and the difference between the numbers of damaged physical blocks included in each target virtual block is within a preset range.
[0141] Specifically, the above step S303 may include the following steps:
[0142] Step S3031: Obtain a third number of physical blocks included in the target virtual block.
[0143] Specifically, the target storage device may calculate the third number of physical blocks included in the target virtual block by multiplying the number of logical units included in the target storage device by the number of physical blocks included in the multiple physical blocks in the logical unit.
[0144] Step S3032: Determine, according to the third number and each of the remaining multiple physical blocks, that the number of damaged physical blocks included in the target virtual block is a fourth number.
[0145] Specifically, the above step S3032 may include the following steps:
[0146] Step a1: Calculate the total number of damaged physical blocks corresponding to the remaining physical blocks according to the second number corresponding to each of the remaining physical blocks.
[0147] Specifically, the target storage device may add up the second number of damaged physical blocks included in each of the remaining multiple physical blocks to obtain the total number of damaged physical blocks corresponding to the remaining multiple physical blocks.
[0148] Step a2: generating a remaining bad block rate by dividing the total number of damaged physical blocks corresponding to the remaining multiple physical blocks by the total number of physical blocks corresponding to the remaining multiple physical blocks.
[0149] Specifically, the target storage device generates the remaining bad block rate by dividing the total number of damaged physical blocks corresponding to the remaining multiple physical blocks by the total number of physical blocks corresponding to the remaining multiple physical blocks.
[0150] Step a3: Generate a second value by multiplying the remaining bad block rate by the third number of physical blocks included in the target virtual block.
[0151] Specifically, the target storage device generates the second value by multiplying the remaining bad block rate by the third number of physical blocks included in the target virtual block.
[0152] Step a4, rounding up the second value to determine that the number of damaged physical blocks included in the target virtual block is a fourth number.
[0153] Specifically, the target storage device rounds up the second value, and determines the rounded value as the fourth number of damaged physical blocks included in the target virtual block.
[0154] Step S3033, according to the second number corresponding to each of the remaining physical blocks and the fourth number corresponding to the target virtual block, determine the target physical block from the remaining physical blocks corresponding to each logical unit number in turn, and generate multiple target virtual blocks.
[0155] Specifically, the above step S3033 may include the following steps:
[0156] Step b1, according to the second quantity corresponding to each of the remaining multiple physical blocks, determine the remaining multiple physical blocks with the largest second quantity as the first target physical block, and determine the logical unit number corresponding to the first target physical block as the target logical unit number.
[0157] Specifically, the target storage device may determine the remaining multiple physical blocks with the largest second quantity as the first target physical block according to the second quantity corresponding to each remaining multiple physical block, and determine the logical unit number corresponding to the first target physical block as the target logical unit number.
[0158] Step b2: Compare the second number corresponding to the first target physical block with the fourth number corresponding to the target virtual block.
[0159] Specifically, the target storage device may compare the second number corresponding to the first target physical block with the fourth number corresponding to the target virtual block.
[0160] Step b3: if the second number is equal to the fourth number, select the remaining multiple physical blocks excluding the damaged physical block from the first other logical unit numbers except the target logical unit number as the second target physical block.
[0161] Specifically, if the second number is equal to the fourth number, the target storage device selects a second target physical block from each of the first other logical unit numbers except the target logical unit number, wherein the second target physical block is the remaining multiple physical blocks excluding the damaged physical block.
[0162] Step b4: Generate a target virtual block according to the first target physical block and the second target physical block.
[0163] Specifically, the target storage device splices the first target physical block and each second target physical block to generate a target virtual block.
[0164] Exemplarily, if the fourth quantity corresponding to the target virtual block is 3, the target storage device determines the remaining multiple physical blocks with the largest second quantity as the first target physical block according to the second quantities corresponding to each of the remaining multiple physical blocks.
[0165] If the number of damaged physical blocks included in the first target physical block is 3, the target storage device selects a second target physical block whose damaged physical block is 0 from the first other logical unit numbers except the target logical unit number. The first target physical block and each second target physical block are spliced to generate a target virtual block, so that the number of damaged physical blocks included in the target virtual block is 3.
[0166] Step b5: If the second number is smaller than the fourth number, calculate a first difference between the fourth number and the second number.
[0167] Specifically, if the second number is smaller than the fourth number, the target storage device calculates the first difference by subtracting the second number from the fourth number.
[0168] Step b6, determining a third target physical block from the first other logical unit numbers except the target logical unit number, and determining the logical unit number corresponding to the third target physical block as the first logical unit number.
[0169] The number of damaged physical blocks included in the third target physical block is the first difference.
[0170] Specifically, the target storage device may determine a third target physical block from the first other logical unit numbers except the target logical unit number, and determine the logical unit number corresponding to the third target physical block as the first logical unit number.
[0171] Step b7, selecting a plurality of remaining physical blocks excluding the damaged physical block from the second other logical unit numbers except the target logical unit number and the first logical unit number as the second target physical block.
[0172] Specifically, the target storage device may select a plurality of remaining physical blocks excluding the damaged physical block from each second other logical unit number except the target logical unit number and the first logical unit number as the second target physical block.
[0173] Step b8, generating a target virtual block according to the first target physical block, the second target physical block and the third target physical block.
[0174] Specifically, the target storage device splices the first target physical block, each second target physical block, and the third target physical block to generate a target virtual block.
[0175] Step b9, each time a target virtual block is generated, the remaining bad block rate is updated to obtain an updated new remaining bad block rate.
[0176] Specifically, each time a target virtual block is generated, the target storage device may update the remaining bad block rate to obtain an updated new remaining bad block rate.
[0177] Step b10: Generate a third value by multiplying the new remaining bad block rate by the third number of physical blocks included in the target virtual block.
[0178] Specifically, the target storage device may generate a third value by multiplying the new remaining bad block rate by the third number of physical blocks included in the target virtual block.
[0179] Step b11, rounding up the third value to determine a fifth number, and using the fifth number to update the fourth number.
[0180] Specifically, the target storage device may round up the third value to determine the fifth number, and update the fourth number using the fifth number.
[0181] Step b12: Generate a target virtual block according to the fifth number.
[0182] Specifically, the target storage device may determine the target physical block from the remaining physical blocks corresponding to each logical unit number in turn according to the second number corresponding to each remaining physical block and the fifth number corresponding to the target virtual block, and generate multiple target virtual blocks.
[0183] This process can refer to the introduction of step S3033 above, which will not be repeated here.
[0184] For example, Figure 4 As shown, Figure 4 For example, "lun0 bad0" in "lun0 bad0" indicates that the number of damaged physical blocks in logical unit number 0 is 0. Figure 4 It can be known that in logical unit number 0, the number of damaged physical blocks included in the multiple physical blocks is 0, which are block A, block B, block D and block J. Similarly, in logical unit number 0, the number of damaged physical blocks included in the multiple physical blocks is 1, which are block E and block I; in logical unit number 0, the number of damaged physical blocks included in the multiple physical blocks is 2, which are block C and block F; in logical unit number 0, the number of damaged physical blocks included in the multiple physical blocks is 3, which is block G; in logical unit number 0, the number of damaged physical blocks included in the multiple physical blocks is 4, which is block H. Similarly, the number of damaged physical blocks included in each multiple physical block in other logical unit numbers can be determined.
[0185] The target storage device selects a plurality of physical blocks including 4 damaged physical blocks from each logical unit number, and splices them into a damaged virtual block. Then, according to the number of damaged physical blocks included in the target virtual block, a target physical block is determined from the remaining plurality of physical blocks corresponding to each logical unit, and splices them into a target virtual block based on each target physical block.
[0186] The virtual block piecing together method provided by the embodiment of the present application obtains the third number of physical blocks included in the target virtual block; calculates the total number of damaged physical blocks corresponding to the remaining multiple physical blocks according to the second number corresponding to each of the remaining multiple physical blocks; generates the remaining bad block rate by dividing the total number of damaged physical blocks corresponding to the remaining multiple physical blocks by the total number of physical blocks corresponding to the remaining multiple physical blocks, thereby ensuring the accuracy of the generated remaining bad block rate. The second numerical value is generated by multiplying the remaining bad block rate by the third number of physical blocks included in the target virtual block, thereby ensuring the accuracy of the generated second numerical value. The second numerical value is rounded up to determine that the damaged physical blocks included in the target virtual block are the fourth number, thereby ensuring the accuracy of the fourth number of damaged physical blocks included in the determined target virtual block.
[0187] According to the second number corresponding to each of the remaining multiple physical blocks, the remaining multiple physical blocks with the largest second number are determined as the first target physical block, ensuring the accuracy of the determined first target physical block, and the logical unit number corresponding to the first target physical block is determined as the target logical unit number. The second number corresponding to the first target physical block is compared with the fourth number corresponding to the target virtual block; if the second number is equal to the fourth number, the remaining multiple physical blocks that do not include damaged physical blocks are selected from the first other logical unit numbers except the target logical unit number as the second target physical block, ensuring the accuracy of the determined second target physical block. According to the first target physical and the second target physical blocks, the target virtual block is generated, ensuring that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device. If the second number is less than the fourth number, then calculate the first difference between the fourth number and the second number; determine a third target physical block from the first other logical unit numbers except the target logical unit number, and determine the logical unit number corresponding to the third target physical block as the first logical unit number; wherein the number of damaged physical blocks included in the third target physical block is the first difference, and select the remaining multiple physical blocks that do not include damaged physical blocks from the second other logical unit numbers except the target logical unit number and the first logical unit number as the second target physical block; generate a target virtual block based on the first target physical, the second target physical block and the third target physical block. It is ensured that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0188] Each time a target virtual block is generated, the remaining bad block rate is updated to obtain a new remaining bad block rate after update; the new remaining bad block rate is multiplied by the third number of physical blocks included in the target virtual block to generate a third value; the third value is rounded up to determine a fifth number, and the fifth number is used to update the fourth number; the target virtual block is generated according to the fifth number. It is ensured that the number of damaged physical blocks included in the generated target virtual block is small, and the number of damaged physical blocks in the generated target virtual block is close, thereby preventing excessive fluctuations and avoiding affecting the performance of the target storage device. Therefore, the above method can improve the performance of the target storage device.
[0189] In this embodiment, a virtual block assembly method is provided, which can be used for the above-mentioned target storage device. Figure 5 is a flow chart of a virtual block splicing method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0190] Step S401: for each logical unit number in the target storage device, obtain a first number of damaged physical blocks in each of the multiple physical blocks in the logical unit number.
[0191] Each of the multi-block physical blocks includes multiple physical blocks.
[0192] For details about this step, please refer to the above description of step S301, which will not be elaborated here.
[0193] Step S402: searching for a first plurality of physical blocks from each logical unit number according to each first quantity, and generating a damaged virtual block based on each first plurality of physical blocks.
[0194] For details about this step, please refer to the above description of step S302, which will not be repeated here.
[0195] Step S403, based on the second number of damaged physical blocks included in the remaining physical blocks corresponding to each logical unit number, determine the target physical blocks from the remaining physical blocks corresponding to each logical unit number in turn, and generate multiple target virtual blocks.
[0196] The remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks; and the difference between the numbers of damaged physical blocks included in each target virtual block is within a preset range.
[0197] For details about this step, please refer to the above description of step S303, which will not be elaborated here.
[0198] Step S404: determine the first physical address and the first virtual address corresponding to each physical block in the target virtual block.
[0199] The first virtual address is the address of the physical block in the target virtual block.
[0200] Specifically, the target storage device may determine a first physical address and a first virtual address corresponding to each physical block in the target virtual block.
[0201] Step S405 , generating a first table according to the first physical address to the first virtual address corresponding to each physical block, and storing the first table corresponding to the target virtual block.
[0202] Specifically, the target storage device may generate a first physical address to a first virtual address (Physical-to-Virtual, p2v) corresponding to each physical block, and generate a first table according to the p2v corresponding to each physical block, and store the first table in correspondence with the target virtual block.
[0203] Step S406 , generating a second table according to the first virtual address to the first physical address corresponding to each physical block, and storing the second table in correspondence with the target virtual block.
[0204] Specifically, the target storage device may generate a first virtual address to a first physical address (Virtual-to-Physical, v2p) corresponding to each physical block, and generate a second table according to the v2p corresponding to each physical block, and store the second table in correspondence with the target virtual block.
[0205] Step S407: performing corresponding operations on the target virtual block according to the first table and the second table.
[0206] In an optional implementation, when reading data from a target storage device, if the l2p (Logical-to-Physical) table records physical block information, the first table needs to be queried during the reading process. The corresponding target virtual block can be determined through the first table, and then the number of reads of the target virtual block is updated. In this way, the frequency of each target virtual block being read can be tracked to facilitate subsequent data analysis or optimization operations, for example, which target virtual blocks should be cached to improve access efficiency based on the number of reads.
[0207] When writing data from the target storage device, confirm the target virtual block when cleaning vdfb and vdfc during the writing process: When performing a write operation and cleaning vdfb and vdfc, it is also necessary to refer to the first table to confirm the corresponding target virtual block. This is to ensure that when performing these operations, the relevant target virtual blocks can be accurately found and processed to ensure data consistency and correctness.
[0208] In another optional implementation, if the information recorded in the l2p table is the virtual block information in the target virtual block.
[0209] When the l2p table records the virtual block information in the target virtual block, when reading data, in order to determine the actual location of the data, it is necessary to query the second table. The virtual block can be mapped to the actual physical storage location through the second table, so that the data can be read correctly.
[0210] In the process of writing and modifying the l2p table, if the table records the virtual block information in the target virtual block, the operation will be relatively direct and no additional special operations are required. This is because the virtual block information in the target virtual block directly contains the necessary information related to the data operation, making the writing and modifying process more efficient.
[0211] Considering the above two situations, there are certain advantages to using the virtual block information of the target virtual block recorded in the l2p table. When reading, although it is necessary to query the second table to confirm the position, there is no additional operation in the process of writing and modifying the table, which improves the efficiency of data processing as a whole. In contrast, if the l2p table records the physical block information, it is necessary to query the first table additionally in some operations of reading and writing, which increases the complexity of the operation and possible overhead. Therefore, based on these reasons, the l2p table chooses to use the virtual block information in the target virtual block.
[0212] For example, Figure 6 As shown, after generating the target virtual block, the target storage device can save the target virtual block. Then, after the power-on module is powered on, the first table, i.e., the p2v table, and the second table, i.e., the v2p table, are restored. When performing data recovery and data reading, writing, and erasing, the target storage device reads the first table and the second table respectively, and performs processing based on the first table and the second table.
[0213] The virtual block piecing together method provided by the embodiment of the present application determines the first physical address and the first virtual address corresponding to each physical block in the target virtual block; the first virtual address is the address of the physical block in the target virtual block; a first table is generated according to the first physical address to the first virtual address corresponding to each physical block, and the first table is stored in correspondence with the target virtual block; a second table is generated according to the first virtual address to the first physical address corresponding to each physical block, and the second table is stored in correspondence with the target virtual block; according to the first table and the second table, corresponding operations are performed on the target virtual block, thereby improving the consistency of reading and writing the target virtual block and improving the performance of the target storage device.
[0214] In this embodiment, a virtual block assembly device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0215] This embodiment provides a virtual block assembly device, such as Figure 7 As shown, including:
[0216] An acquisition module 501 is used to acquire, for each logical unit number in a target storage device, a first number of damaged physical blocks in each of the plurality of physical blocks in the logical unit number;
[0217] A first generating module 502 is used to search for a first plurality of physical blocks from each logical unit number according to each first quantity, and generate a damaged virtual block based on each first plurality of physical blocks;
[0218] The second generation module 503 is used to determine the target physical blocks from the remaining multiple physical blocks corresponding to each logical unit number in turn based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, and generate multiple target virtual blocks; the remaining multiple physical blocks are other multiple physical blocks in each logical unit number except the first multiple physical blocks.
[0219] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0220] The virtual block assembly device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0221] The embodiment of the present invention also provides a computer device target storage device having the above Figure 7 The virtual block assembly device shown.
[0222] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a target storage device provided by an optional embodiment of the present invention, such as Figure 8As shown, the target storage device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component utilizes different buses to communicate with each other, and can be installed on a common mainboard or installed in other ways as required. The processor can process the instructions executed in the target storage device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple target storage devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.
[0223] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0224] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0225] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the target storage device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the target storage device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0226] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0227] The target storage device further includes a communication interface 30, which is used for the target storage device to communicate with other devices or a communication network.
[0228] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0229] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0230] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A virtual block assembly method, characterized in that: The method comprises: For each logical unit number in the target storage device, obtaining a first number of damaged physical blocks in each of the plurality of physical blocks in the logical unit number; each of the plurality of physical blocks includes a plurality of physical blocks; searching first multiple physical blocks from each of the logical unit numbers according to each of the first quantities, and generating a damaged virtual block based on each of the first multiple physical blocks; Based on the second number of damaged physical blocks included in the remaining multiple physical blocks corresponding to each of the logical unit numbers, target physical blocks are determined in turn from the remaining multiple physical blocks corresponding to each of the logical unit numbers to generate multiple target virtual blocks; the remaining multiple physical blocks are multiple physical blocks other than the first multiple physical blocks in each of the logical unit numbers; the difference between the numbers of damaged physical blocks included in each of the target virtual blocks is within a preset range.
2. The method according to claim 1, characterized in that The first plurality of physical blocks include all damaged physical blocks, searching the first plurality of physical blocks from the logical unit numbers according to the first quantities, and generating damaged virtual blocks based on the first plurality of physical blocks, comprises: According to each of the first numbers, determining the plurality of physical blocks in which all physical blocks are damaged as the all-damaged physical blocks; Counting the number of all damaged physical blocks included in each of the logical unit numbers; Determine the minimum value of the number of all damaged physical blocks included in each of the logical unit numbers as a first value; One of the damaged physical blocks is selected from each of the logical unit numbers in turn to generate a damaged virtual block, and this cycle is repeated to generate the damaged virtual block of the first value.
3. The method according to claim 2, characterized in that The first plurality of physical blocks also include the most damaged physical blocks, and the most damaged physical blocks are the plurality of physical blocks including the largest number of damaged physical blocks determined in each of the logical unit numbers except for all the damaged physical blocks; the method further includes: Detecting, according to each of the damaged virtual blocks and / or the remaining multiple physical blocks corresponding to each of the logical unit numbers, whether a preset stop condition for stopping generating the damaged virtual block is met; If the preset stop condition is not satisfied, determining the most damaged physical blocks from the logical unit numbers according to the first quantities; The damaged virtual block is generated based on each of the most damaged physical blocks.
4. The method according to claim 3, characterized in that The preset stop conditions include: The first good block rate corresponding to the damaged virtual block is greater than or equal to the overall bad block rate corresponding to the target storage device; wherein the first good block rate is used to represent the ratio of normal physical blocks in the damaged virtual block to all physical blocks in the damaged virtual block; the overall bad block rate is used to represent the ratio of damaged physical blocks in the target storage device to all physical blocks in the target storage device; and / or, The first bad block rate corresponding to each of the plurality of physical blocks in each of the logical unit numbers is less than the overall bad block rate; the first bad block rate is used to represent the ratio of damaged physical blocks in each of the plurality of physical blocks to all physical blocks in the plurality of physical blocks; and / or, The second bad block rate corresponding to the damaged virtual block is less than or equal to a preset threshold; the second bad block rate is used to represent the ratio of damaged physical blocks in each of the damaged virtual blocks to all physical blocks in the damaged virtual block; and / or, There is at least one logical unit number in which the damaged physical block does not exist.
5. The method according to claim 1, characterized in that The method of determining the target physical blocks from the remaining multiple physical blocks corresponding to each logical unit number in sequence based on the second number of the damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, and generating multiple target virtual blocks, comprises: Acquire a third number of physical blocks included in the target virtual block; Determine, according to the third number and each of the remaining plurality of physical blocks, that the damaged physical blocks included in the target virtual block are a fourth number; According to the second number corresponding to each of the remaining physical blocks and the fourth number corresponding to the target virtual block, the target physical block is determined in turn from the remaining physical blocks corresponding to each of the logical unit numbers to generate a plurality of the target virtual blocks.
6. The method according to claim 5, characterized in that The step of determining, according to the third number and each of the remaining plurality of physical blocks, that the damaged physical blocks included in the target virtual block are a fourth number includes: Calculate the total number of damaged physical blocks corresponding to the remaining physical blocks according to the second number corresponding to each of the remaining physical blocks; Generate a remaining bad block rate by dividing the total number of damaged physical blocks corresponding to the remaining multiple physical blocks by the total number of physical blocks corresponding to the remaining multiple physical blocks; generating a second value by multiplying the remaining bad block rate by a third number of physical blocks included in the target virtual block; The second value is rounded up to an integer, and the number of damaged physical blocks included in the target virtual block is determined to be a fourth number.
7. The method according to claim 5, characterized in that The step of determining the target physical block from the remaining physical blocks corresponding to the logical unit numbers in sequence according to the second number corresponding to each of the remaining physical blocks and the fourth number corresponding to the target virtual block, and generating the plurality of target virtual blocks comprises: According to the second number corresponding to each of the remaining multiple physical blocks, the remaining multiple physical blocks with the largest second number are determined as first target physical blocks, and the logical unit number corresponding to the first target physical block is determined as the target logical unit number; comparing the second number corresponding to the first target physical block with a fourth number corresponding to the target virtual block; If the second number is equal to the fourth number, selecting the remaining multiple physical blocks excluding the damaged physical block from the first other logical unit number except the target logical unit number as the second target physical block; generating the target virtual block according to the first target physical block and the second target physical block; If the second number is less than the fourth number, calculating a first difference between the fourth number and the second number; Determine a third target physical block from the first other logical unit numbers except the target logical unit number, and determine the logical unit number corresponding to the third target physical block as the first logical unit number; wherein the number of the damaged physical blocks included in the third target physical block is the first difference; Selecting the remaining multiple physical blocks excluding the damaged physical block from the second other logical unit numbers except the target logical unit number and the first logical unit number as the second target physical block; The target virtual block is generated according to the first target physical block, the second target physical block and the third target physical block.
8. The method according to claim 7, characterized in that The method further comprises: Each time the target virtual block is generated, the remaining bad block rate is updated to obtain an updated new remaining bad block rate; generating a third value by multiplying the new remaining bad block rate by a third number of physical blocks included in the target virtual block; rounding up the third value to determine a fifth number, and updating the fourth number using the fifth number; The target virtual block is generated according to the fifth number.
9. The method according to claim 1, characterized in that After generating the plurality of target virtual blocks, the method further comprises: Determine a first physical address and a first virtual address corresponding to each physical block in the target virtual block; the first virtual address is an address of the physical block in the target virtual block; Generate a first table according to the first physical address to the first virtual address corresponding to each physical block, and store the first table corresponding to the target virtual block; Generate a second table according to the first virtual address to the first physical address corresponding to each physical block, and store the second table in correspondence with the target virtual block; According to the first table and the second table, a corresponding operation is performed on the target virtual block.
10. A virtual block assembly device, characterized in that: The device comprises: An acquisition module, configured to acquire, for each logical unit number in a target storage device, a first number of damaged physical blocks in each of the plurality of physical blocks in the logical unit number; A first generating module, configured to search for a first plurality of physical blocks from each of the logical unit numbers according to each of the first quantities, and generate a damaged virtual block based on each of the first plurality of physical blocks; A second generation module is used to determine the target physical blocks from the remaining multiple physical blocks corresponding to each logical unit number based on the second number of the damaged physical blocks included in the remaining multiple physical blocks corresponding to each logical unit number, and generate multiple target virtual blocks; the remaining multiple physical blocks are the other multiple physical blocks in each logical unit number except the first multiple physical blocks.
11. A target storage device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the virtual block splicing method according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the virtual block splicing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device of virtual-block abandoning of solid-state disk
CN107506148A
IO request processing method, system and device and computer readable storage medium
CN111399767A
Solid state disk physical block management method and system
CN112445429A
Flash memory block processing method and device, flash memory data processing method and device and related equipment
CN115794663A
Solid state disk management method and device
CN116610595A
