Bad block table construction method and device, electronic equipment and readable storage medium

By building balanced bad block tables in storage devices, the problem of bad block tables in storage devices occupying a large amount of storage space is solved, and the overall performance of storage devices is improved.

CN120144060APending Publication Date: 2025-06-13SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510371338.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

As the storage capacity of storage devices increases, the number of bad blocks inside them increases significantly, resulting in bad block tables occupying a large amount of storage space, affecting the overall performance of storage devices.

Method used

By determining the total number of data blocks in the target memory, processing the total number of data blocks according to the preset equalization strategy, obtaining the number of rows and columns of the bad block table, and building an initial bad block table, writing the status information of the data block to the initial bad block table, forming the bad block table corresponding to the target memory.

Benefits of technology

It effectively reduces the storage space usage of bad block tables, improves the overall performance of storage devices, ensures that the number of rows and columns of bad block tables is equal or close, and achieves balanced processing of the length and width of bad block tables.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120144060A_ABST
    Figure CN120144060A_ABST
Patent Text Reader

Abstract

The invention discloses a bad block table construction method which comprises the following steps: determining a target memory, and determining the total number of data blocks of the target memory; processing the total data volume of the data blocks according to a preset equipartition strategy to obtain a bad block table row number and a bad block table column number; wherein the difference value between the row number of the bad block table and the column number of the bad block table is 0 or 1; constructing an initial bad block table according to the row number of the bad block table and the column number of the bad block table; and obtaining state information of each data block in the target memory, and writing each piece of state information into the initial bad block table to obtain a bad block table corresponding to the target memory. By applying the technical scheme provided by the invention, the storage space occupation of the bad block table can be effectively reduced, and the overall performance of the storage equipment is further improved. The invention also discloses a bad block table construction device, electronic equipment and a computer readable storage medium, which also have the above technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technologies, and in particular, to a method for constructing a bad block table, and also relates to a bad block table construction device, an electronic device, and a computer-readable storage medium. Background Art

[0002] A bad block refers to a block in a storage device (such as a NAND flash memory device) that contains one or more invalid bit positions, and its reliability cannot be guaranteed. Correspondingly, bad block information is written into the corresponding data block before shipment. After reading the storage device, a bad block table is created and saved in the normal data block of the storage device. In related technologies, the bad block table usually stores bad block information in a fixed format, such as recording the physical address of each bad block and its status information, etc. However, with the increase in the storage capacity of the storage device, the number of internal bad blocks may increase significantly, resulting in the bad block table occupying a large amount of storage space and affecting the overall performance of the storage device.

[0003] Therefore, how to effectively reduce the storage space occupied by the bad block table and further improve the overall performance of the storage device is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0004] The purpose of this application is to provide a method for constructing a bad block table, which can effectively reduce the storage space occupied by the bad block table and further improve the overall performance of the storage device; another purpose of this application is to provide a bad block table construction device, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above beneficial effects.

[0005] In a first aspect, this application provides a method for constructing a bad block table, including:

[0006] Determine a target memory and determine the total number of data blocks in the target memory;

[0007] Process the total data volume of the data blocks according to a preset equal division strategy to obtain the number of rows and the number of columns of the bad block table; wherein, the difference between the number of rows and the number of columns of the bad block table is 0 or 1;

[0008] Construct an initial bad block table according to the number of rows and the number of columns of the bad block table;

[0009] Obtain the status information of each data block in the target memory and write each status information into the initial bad block table to obtain the bad block table corresponding to the target memory.

[0010] Optionally, obtaining the status information of each data block in the target memory includes:

[0011] For each data block in the target memory, determine the spare area of the first page in the data block;

[0012] Read the first byte of the spare area to obtain a read value;

[0013] When the read value is 0xff, determine that the status information of the data block is normal;

[0014] When the read value is not 0xff, determine that the status information of the data block is abnormal.

[0015] Optionally, writing each of the status information to the initial bad block table includes:

[0016] When the status information of the data block is normal, write the flag bit 1 representing the normal status information to the initial bad block table;

[0017] When the status information of the data block is abnormal, write the flag bit 0 representing the abnormal status information to the initial bad block table.

[0018] Optionally, processing the total data volume of the data blocks according to a preset equal division strategy to obtain the number of rows and columns of the bad block table includes:

[0019] Calculate the square root of the total number of data blocks to obtain the square root value of the total number of data blocks;

[0020] Perform a ceiling operation on the square root value to obtain the smallest integer not less than the square root value;

[0021] Perform a subtraction operation on the smallest integer to obtain a target integer;

[0022] Perform a multiplication calculation on the smallest integer and the target integer to obtain a product value;

[0023] Determine whether the product value is not less than the total number of data blocks;

[0024] If the product value is not less than the total number of data blocks, use the smallest integer and the target integer as the number of rows and columns of the bad block table respectively;

[0025] If the product value is less than the total number of data blocks, use the smallest integer as the number of rows and columns of the bad block table.

[0026] Optionally, determining the total number of data blocks in the target memory includes:

[0027] Determine the total storage capacity and data block size of the target memory;

[0028] Calculate the quotient of the total storage capacity and the data block size to obtain the total number of data blocks of the target memory.

[0029] Optionally, determining the total number of data blocks of the target memory includes:

[0030] Determine the number of communication paths in the target memory;

[0031] Determine the number of control signals of each communication path in the target memory;

[0032] Determine the number of data blocks of a unit control signal in the target memory;

[0033] Perform a product calculation on the number of communication paths, the number of control signals, and the number of data blocks to obtain the total number of data blocks of the target memory.

[0034] Optionally, after obtaining the status information of each data block in the target memory and writing each status information into the initial bad block table to obtain the bad block table corresponding to the target memory, it further includes:

[0035] Select a target data block in the target memory; the target data block is any normal data block in the target memory;

[0036] Write the bad block table into the target data block.

[0037] In a second aspect, the present application also discloses a bad block table construction device, including:

[0038] A determination module, configured to determine a target memory and determine the total number of data blocks of the target memory;

[0039] A processing module, configured to process the total data volume of the data blocks according to a preset equal division strategy to obtain the number of rows and the number of columns of the bad block table; wherein, the difference between the number of rows and the number of columns of the bad block table is 0 or 1;

[0040] A construction module, configured to construct an initial bad block table according to the number of rows and the number of columns of the bad block table;

[0041] A table writing module, configured to obtain the status information of each data block in the target memory and write each status information into the initial bad block table to obtain the bad block table corresponding to the target memory.

[0042] In a third aspect, the present application also discloses an electronic device, including:

[0043] A memory, configured to store a computer program;

[0044] A processor, configured to implement the steps of any of the above-mentioned bad block table construction methods when executing the computer program.

[0045] In a fourth aspect, the present application also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned bad block table construction methods are implemented.

[0046] In a fifth aspect, the present invention also discloses a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of any of the above-mentioned bad block table construction methods are implemented.

[0047] The present application provides a method for constructing a bad block table, including: determining a target memory and determining the total number of data blocks in the target memory; processing the total data volume of the data blocks according to a preset equal division strategy to obtain the number of rows and columns of the bad block table; wherein, the difference between the number of rows and columns of the bad block table is 0 or 1; constructing an initial bad block table according to the number of rows and columns of the bad block table; obtaining the status information of each data block in the target memory and writing each status information into the initial bad block table to obtain the bad block table corresponding to the target memory.

[0048] Applying the technical solution provided by the present application, the construction of the bad block table is realized according to the total number of data blocks in the target memory. It can be understood that the bad block table is used to record the quality of each data block in the corresponding target memory. The number of data blocks in the target memory is the number of data blocks that the bad block table needs to record. Based on this, the total number of data blocks in the target memory can be counted, and then the number of rows and columns of the bad block table can be calculated through the equal division strategy, ensuring that the difference between the number of rows and columns is 0 or 1, that is, ensuring that the number of rows and columns of the bad block table is as equal or close as possible, so as to complete the construction of the initial bad block table, and use the initial bad block table to record the quality status of each data block in the target memory to complete the construction of the bad block table corresponding to the target memory. Thus, it can be seen that the present technical solution realizes the construction of the bad block table according to the total number of data blocks in the target memory, ensures that the number of rows and columns of its corresponding bad block table is equal or close, realizes the balanced processing of the length and width of the bad block table, and thus can effectively reduce the storage space occupied by the bad block table in the target memory, and further improve the overall performance of the memory.

[0049] In one embodiment of the present application, a preset equal distribution strategy for the total number of data blocks is implemented by square root calculation, and then the minimum integer not less than the square root value of the total number of data blocks is obtained by rounding up as the number of rows or columns of the bad block table. Taking the minimum integer as the number of rows of the bad block table as an example, the target integer obtained by subtracting one from the minimum integer is first used as the number of columns of the bad block table for verification to ensure that the product of the number of rows and columns of the bad block table is not less than the total number of data blocks of the target memory, otherwise the minimum integer is directly used as the number of rows and columns of the bad block table. In other words, the technical solution, on the basis of balancing the number of rows and columns of the bad block table, also reduces the number of rows and columns of the bad block table as much as possible, ensuring that the bad block table can record the good and bad status of all data blocks in the target memory while reducing its size as much as possible, further reducing its storage space occupancy, and ensuring the overall performance of the memory.

[0050] The bad block table construction device, electronic device, computer-readable storage medium and computer program product provided in this application also have the above-mentioned technical effects, and this application will not repeat them here. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.

[0052] Figure 1 It is a schematic diagram of the bad block table structure in the prior art;

[0053] Figure 2 A flowchart of a bad block table construction method provided in this application;

[0054] Figure 3 A flowchart of a method for obtaining data block status information provided by the present application;

[0055] Figure 4 A schematic diagram of a bad block table structure provided by this application;

[0056] Figure 5 A schematic diagram of the structure of a bad block table construction device provided in this application;

[0057] Figure 6 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0058] The core of the present application is to provide a method for constructing a bad block table, which can effectively reduce the storage space occupied by the bad block table and further improve the overall performance of the storage device. Another core of the present application is to provide a bad block table construction device, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above beneficial effects.

[0059] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the following will introduce the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0060] The embodiment of the present application provides a method for constructing a bad block table.

[0061] First, please refer to Figure 1 , Figure 1 which is a schematic diagram of the bad block table structure in the prior art. The memory has two channels, Channel 0 and Channel 1. Each channel corresponds to 4 CE signals (Chip Enable, a control signal) CE0~CE4, and each CE has 8195 data blocks B 1 ~B 8195 , where B is the abbreviation of data block Block. Obviously, the number of rows and columns of this bad block table are 8195 and 8 respectively, and its row and column numbers are seriously unbalanced. Assuming that the good or bad state of each data block in the memory is represented by one bit, then this bad block table needs to occupy 8195×(2×4)÷8 = 8195 bytes (Byte, 1Byte = 8bit), and its storage space occupation cannot be underestimated.

[0062] Further, please refer to Figure 2 , Figure 2 which is a schematic flowchart of a method for constructing a bad block table provided by the present application. This method for constructing a bad block table may include the following S101 to S104.

[0063] S101: Determine the target memory and determine the total number of data blocks in the target memory.

[0064] This step aims to determine the target memory and the total number of its data blocks. First, determine the target memory, which is the memory for which a bad block table needs to be constructed. Its specific type does not affect the implementation of this technical solution and can be any type of memory for which a bad block table needs to be constructed, such as NAND flash memory, etc. Further, statistically determine the total number of data blocks in this target memory. The following provides two different implementation methods.

[0065] In one embodiment of the present application, determining the total number of data blocks in a target memory may include:

[0066] Determine the total storage capacity and data block size of the target memory;

[0067] Perform a quotient calculation on the total storage capacity and the data block size to obtain the total number of data blocks in the target memory.

[0068] The embodiment of the present application provides an implementation method for determining the total number of data blocks in a target memory. It can be understood that for any memory, the sizes of its internal data blocks are equal. Therefore, the total storage capacity and the data block size (i.e., the storage capacity of one data block) of the target memory can be determined respectively. Obviously, the quotient of the two is the total number of data blocks in the target memory.

[0069] In one embodiment of the present application, determining the total number of data blocks in a target memory may include:

[0070] Determine the number of communication paths in the target memory;

[0071] Determine the number of control signals for each communication path in the target memory;

[0072] Determine the number of data blocks per unit control signal in the target memory;

[0073] Perform a product calculation on the number of communication paths, the number of control signals, and the number of data blocks to obtain the total number of data blocks in the target memory.

[0074] The embodiment of the present application provides another implementation method for determining the total number of data blocks in a target memory. Specifically, the internal total number of data blocks can be counted by referring to the specific structure of the target memory. Different memories have different numbers of communication paths (the communication path refers to the communication path connecting to the external controller, such as the SSD controller, which is generally used to implement data transmission). Each communication path generally corresponds to the same number of CE signals (control signals), and each CE signal generally corresponds to the same number of data blocks. Therefore, for the target memory, the product of the number of communication paths, the number of CE signals per communication path, and the number of data blocks per CE signal is its total number of data blocks.

[0075] S102: Process the total data volume of the data blocks according to a preset equal division strategy to obtain the number of rows and columns of the bad block table; wherein, the difference between the number of rows and columns of the bad block table is 0 or 1.

[0076] This step aims to determine the number of rows and columns of the bad block table, which is specifically obtained by processing the total data volume of the data blocks using a preset equal division strategy. It should be noted that this preset equal division strategy aims to achieve balanced processing of the number of rows and columns of the bad block table, so as to ensure that the number of rows and columns of the bad block table is the same or close as much as possible, that is, the difference between the number of rows and columns of the bad block table is 0 or 1. It can be understood that when the number of rows and columns of the bad block table is the same or close, it essentially achieves balanced processing of the length and width of the bad block table, which can effectively reduce the size of the bad block table, that is, reduce its occupancy of storage space.

[0077] In an embodiment of the present application, processing the total data volume of the data blocks according to the preset equal division strategy to obtain the number of rows and columns of the bad block table may include:

[0078] Calculate the square root of the total number of data blocks to obtain the square root value of the total number of data blocks;

[0079] Perform a ceiling operation on the square root value to obtain the smallest integer not less than the square root value;

[0080] Perform a subtraction operation on the smallest integer to obtain the target integer;

[0081] Calculate the product of the smallest integer and the target integer to obtain the product value;

[0082] Determine whether the product value is not less than the total number of data blocks;

[0083] If the product value is not less than the total number of data blocks, use the smallest integer and the target integer as the number of rows and columns of the bad block table respectively;

[0084] If the product value is less than the total number of data blocks, use the smallest integer as the number of rows and columns of the bad block table.

[0085] The embodiment of the present application provides an implementation method for determining the number of rows and columns of a bad block table, that is, a preset equal distribution strategy is provided. First, the preset equal distribution strategy for the total number of data blocks is implemented by square root calculation, and then the minimum integer not less than the square root value of the total number of data blocks is obtained by rounding up as the number of rows or columns of the bad block table. Taking the minimum integer as the number of rows of the bad block table as an example, the target integer obtained by subtracting one from the minimum integer is first used as the number of columns of the bad block table for verification, ensuring that the product of the number of rows and columns of the bad block table is not less than the total number of data blocks of the target memory, otherwise the minimum integer is directly used as the number of rows and columns of the bad block table, that is, the number of rows and columns of the bad block table are both the minimum integer. Conversely, if the minimum integer is used as the number of columns of the bad block table, the target integer obtained by subtracting one from the minimum integer is first used as the number of rows of the bad block table for verification, ensuring that the product of the number of rows and columns of the bad block table is not less than the total number of data blocks of the target memory, otherwise the minimum integer is directly used as the number of rows and columns of the bad block table, that is, the number of rows and columns of the bad block table are both the minimum integer.

[0086] It can be seen that the embodiment of the present application not only balances the number of rows and columns of the bad block table, but also reduces the number of rows and columns of the bad block table as much as possible, ensuring that the bad block table can record the good and bad status of all data blocks in the target memory while reducing its size as much as possible, further reducing its storage space occupancy and ensuring the overall performance of the memory.

[0087] S103: construct an initial bad block table according to the number of bad block table rows and the number of bad block table columns.

[0088] This step aims to realize the construction of the initial bad block table based on the number of bad block table rows and the number of bad block table columns. Obviously, the number of rows of the initial bad block table is the number of bad block table rows, and the number of columns of the bad block table is the number of bad block table columns. It should be pointed out that the initial bad block table refers to the bad block table that does not write the good or bad status of the data blocks in the target memory, and is essentially an empty table. It can be imagined that by writing the good or bad status of each data block in the target memory into the initial bad block table, the bad block table corresponding to the target memory can be obtained.

[0089] S104: Acquire status information of each data block in the target memory, and write each status information into an initial bad block table to obtain a bad block table corresponding to the target memory.

[0090] This step aims to realize the construction of the bad block table corresponding to the target memory. As mentioned above, the initial bad block table is essentially an empty table. By writing the good or bad status of each data block in the target memory into the initial bad block table, the bad block table corresponding to the target memory can be obtained. Based on this, the status information of each data block in the target memory can be obtained in turn. The status information represents the good or bad status of the data block, that is, good blocks and bad blocks; then the status information of each data block can be written into the initial bad block table in turn. At this point, the construction of the bad block table of the target memory is completed.

[0091] In one embodiment of the present application, obtaining the status information of each data block in the target memory may include:

[0092] For each data block in the target memory, determine the spare area of the first page in the data block;

[0093] Read the first byte of the spare area to obtain a read value;

[0094] When the read value is 0xff, determine that the status information of the data block is normal;

[0095] When the read value is not 0xff, determine that the status information of the data block is abnormal.

[0096] An embodiment of the present application provides a method for obtaining the status information of each data block in the target memory. Taking NAND flash as an example, when it leaves the factory, all positions within the valid data blocks are erased, and the bad block information is written into the SA area (Spare Area) of the corresponding data block before shipment. This area is mainly used to store information related to data integrity. Based on this, please refer to Figure 3 , Figure 3 which is a schematic flowchart of a method for obtaining data block status information provided by the present application. For each data block in the target memory, the spare area of the first page (in NAND flash, a Page is the smallest programmable and readable data unit) can be determined first, and the first byte therein can be read. If the read value is 0xff, it indicates that the data block is a good block; if the read value is not 0xff, it indicates that the data block is a bad block. Thus, the status information of each data block in the target memory is obtained (the normal state corresponds to a good block, and the abnormal state corresponds to a bad block).

[0097] In one embodiment of the present application, writing the status information into the initial bad block table may include:

[0098] When the status information of the data block is normal, write the flag bit 1 indicating the normal status information into the initial bad block table;

[0099] When the status information of the data block is abnormal, write the flag bit 0 indicating the abnormal status information into the initial bad block table.

[0100] The embodiment of the present application provides a method for implementing writing data block status information into an initial bad block table. Specifically, for different data block statuses, different flag bits can be set respectively. Among them, the normal data block status corresponds to flag bit 1, and the abnormal data block status corresponds to flag bit 0. Thus, the writing operation of data block status information can be realized by writing the status flag bit into the initial bad block table. In addition, in the bad block table, one bit can be used to represent the status flag bit of a data block.

[0101] Furthermore, when one bit is used to represent the status flag bit of a data block in the bad block table, the row headers of the bad block table are Bit0 to Bit (number of columns of the bad block table - 1), and the column headers are Bit0 to Bit (number of rows of the bad block table - 1). Based on this, in an embodiment of the present application, the method for constructing the bad block table may further include:

[0102] Constructing a two-dimensional index of each data block status flag bit according to the row headers and column headers of the bad block table;

[0103] Determining the physical positions of each data block in the target memory;

[0104] For each data block in the target memory, establishing a mapping relationship between the two-dimensional index of the data block status flag bit and the physical position, so as to update the bad block table according to the mapping relationship.

[0105] It can be understood that by creating a mapping relationship between the physical position of the data block and the two-dimensional index of the data block status flag bit, when the data block status changes (such as the data block changes from a bad block to a good block, or the data block changes from a good block to a bad block), the data block status recorded in the bad block table can be quickly and efficiently changed (such as changing flag bit 0 to flag bit 1, or changing flag bit 1 to flag bit 0), that is, realizing a fast and efficient update of the bad block table. Obviously, the two-dimensional index of the data block status flag bit is (Bit x, Bit y), where x ranges from 0 to (number of columns of the bad block table - 1), and y ranges from 0 to (number of rows of the bad block table - 1).

[0106] It can be seen that the bad block table construction method provided by the embodiments of the present application constructs the bad block table according to the total number of data blocks in the target memory. It can be understood that the bad block table is used to record the good or bad conditions of each data block in the corresponding target memory. The number of data blocks contained in the target memory is the same as the number of data blocks that the bad block table needs to record. Based on this, the total number of data blocks in the target memory can be counted, and then the number of rows and columns of the bad block table can be calculated through an equal division strategy, ensuring that the difference between the number of rows and columns is 0 or 1, that is, ensuring that the number of rows and columns of the bad block table is as equal or close as possible, so as to complete the construction of the initial bad block table, and use the initial bad block table to record the good or bad states of each data block in the target memory, and complete the construction of the bad block table corresponding to the target memory. Thus, it can be seen that the technical solution constructs the bad block table according to the total number of data blocks in the target memory, ensures that the number of rows and columns of the corresponding bad block table is equal or close, realizes the balanced processing of the length and width of the bad block table, and thus can effectively reduce the storage space occupied by the bad block table in the target memory, and further improve the overall performance of the memory.

[0107] Based on the above embodiments:

[0108] In an embodiment of the present application, after obtaining the status information of each data block in the target memory and writing each status information into the initial bad block table to obtain the bad block table corresponding to the target memory, it may further include:

[0109] Select a target data block in the target memory; the target data block is any normal data block in the target memory;

[0110] Write the bad block table into the target data block.

[0111] It can be understood that when the memory enters the running state, its bad block table is stored in its internal storage space. Therefore, a data block (target data block) with a normal status information can be arbitrarily selected in the target memory to complete the storage of the bad block table. Further, to effectively reduce the storage space occupied by the bad block table, the bad block table can be first subjected to overall compression processing and then written into the target data block.

[0112] Based on the above embodiments, the embodiments of the present application take the NAND flash memory as an example and provide another bad block table construction method.

[0113] Taking Figure 1 the shown bad block table structure as an example, for any memory, assuming that L represents the number of Channels, C represents the number of CEs corresponding to one Channel, and B represents the number of Blocks corresponding to one CE. At this time, the bad block table is a two-dimensional table with B rows and L×C columns, as Figure 1The shown bad block table has B = 8195 rows and L×C = 2×4 columns. In the traditional method, 8 CEs in each row are fixed to represent one Byte, so it is equivalent to having as many Bytes as there are Block rows. The actual effect is still equivalent to a one-dimensional table, resulting in a relatively large occupied space.

[0114] Based on this, the implementation process of the bad block table construction method provided by the embodiments of this application is as follows:

[0115] 1. Determine the total number of data blocks in the memory:

[0116] The total number of data blocks in the memory = B×L×C.

[0117] 2. Use the equal division strategy to evenly divide the total number of data blocks:

[0118] Find two positive integers X and Y with a very small difference (approaching 0, such as 0 or 1) such that B×L×C≈X×Y, and the result of X×Y is the ceiling of B×L×C. Taking the Figure 1 memory corresponding to the shown bad block table as an example, then 8195×8≈X×Y.

[0119] It can be understood that the simplest feasible method to obtain the row and column values X and Y of the equal division strategy is to take the square root of B×L×C and then take the ceiling to get the required X and Y. That is, taking the square root of 8195*8 is approximately 256.047, and taking the ceiling is 257. So, the number of rows X = 257 and the number of columns Y = 256 can be taken.

[0120] 3. Verification operation:

[0121] Verify whether X×Y = 257×256 = 65792 meets the condition. Since 8195×8 = 65560 < 65792, therefore, the number of rows X = 257 and the number of columns Y = 256 fully meet the range required by the bad block table and meet the condition. Thus, a bad block table structure as Figure 4 shown can be constructed, Figure 4 which is a schematic diagram of a bad block table structure provided by this application.

[0122] 4. Calculate the memory occupancy:

[0123] (X + Y) / 8bit = (257bit + 256bit) / 8bit = 65Byte. Obviously, compared with the traditional 8195Byte, the space is reduced to 0.793% of the original, and the optimization effect is obvious.

[0124] Obviously, the improved bad block table algorithm optimized based on the equal division strategy realizes the transformation of the traditional table and maps it into a new two-dimensional table with relatively uniform rows and columns. That is, both the rows and columns of the original bad block table are represented by bits, and their lengths are balanced. This is equivalent to using a two-dimensional index to represent the range of the original one-dimensional index. Without additional hardware investment and excessive calculations, the storage space of the bad block table is greatly reduced, and the bad block table is used to distinguish bad blocks from good blocks to achieve the purpose of efficiently managing data blocks. Through operations on the bad block table, it can ensure that the concurrent requirements of the memory data are met without operating on bad blocks, improve the read and write efficiency of the memory, and ensure the reliability of the data.

[0125] It can be seen that the bad block table construction method provided by the embodiments of the present application constructs the bad block table according to the total number of data blocks in the target memory. It can be understood that the bad block table is used to record the quality of each data block in the corresponding target memory. The number of data blocks contained in the target memory is the number of data blocks that the bad block table needs to record. Based on this, the total number of data blocks in the target memory can be counted, and then the number of rows and columns of the bad block table can be calculated through the equal division strategy, ensuring that the difference between the number of rows and columns is 0 or 1, that is, ensuring that the number of rows and columns of the bad block table is as equal or close as possible, thereby completing the construction of the initial bad block table and using the initial bad block table to record the quality status of each data block in the target memory to complete the construction of the bad block table corresponding to the target memory. Thus, it can be seen that the technical solution constructs the bad block table according to the total number of data blocks in the target memory, ensures that the number of rows and columns of its corresponding bad block table is equal or close, realizes the balanced processing of the length and width of the bad block table, and thus can effectively reduce the storage space occupied by the bad block table in the target memory and further improve the overall performance of the memory.

[0126] The embodiments of the present application provide a bad block table construction device.

[0127] Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of a bad block table construction device provided by the present application. The bad block table construction device may include:

[0128] A determination module 1, configured to determine a target memory and determine the total number of data blocks in the target memory;

[0129] A processing module 2, configured to process the total amount of data blocks according to a preset equal division strategy to obtain the number of rows of the bad block table and the number of columns of the bad block table; wherein, the difference between the number of rows of the bad block table and the number of columns of the bad block table is 0 or 1;

[0130] A construction module 3, configured to construct an initial bad block table according to the number of rows of the bad block table and the number of columns of the bad block table;

[0131] A write table module 4, configured to obtain status information of each data block in a target memory, and write each piece of status information into an initial bad block table to obtain a bad block table corresponding to the target memory.

[0132] It can be seen that the bad block table construction device provided by the embodiment of the present application constructs a bad block table according to the total number of data blocks in the target memory. It can be understood that the bad block table is used to record the good or bad conditions of each data block in the corresponding target memory. The number of data blocks contained in the target memory is the number of data blocks that the bad block table needs to record. Based on this, the total number of data blocks in the target memory can be counted, and then the number of rows and columns of the bad block table can be calculated through an equal division strategy, ensuring that the difference between the number of rows and columns is 0 or 1, that is, as much as possible to ensure that the number of rows and columns of the bad block table are equal or close, so as to complete the construction of the initial bad block table, and use the initial bad block table to record the good or bad status of each data block in the target memory, and complete the construction of the bad block table corresponding to the target memory. It can be seen from this that the technical solution constructs a bad block table according to the total number of data blocks in the target memory, ensures that the number of rows and columns of its corresponding bad block table are equal or close, realizes the balanced processing of the length and width of the bad block table, thereby effectively reducing the storage space occupied by the bad block table in the target memory, and further improving the overall performance of the memory.

[0133] In an embodiment of the present application, the above-mentioned write table module 4 may specifically be configured to, for each data block in the target memory, determine the spare area of the first page in the data block; read the first byte of the spare area to obtain a read value; when the read value is 0xff, determine that the status information of the data block is normal; when the read value is not 0xff, determine that the status information of the data block is abnormal.

[0134] In an embodiment of the present application, the above-mentioned write table module 4 may specifically be configured to, when the status information of the data block is normal, write the flag bit 1 representing the normal status information into the initial bad block table; when the status information of the data block is abnormal, write the flag bit 0 representing the abnormal status information into the initial bad block table.

[0135] In an embodiment of the present application, the above-mentioned processing module 2 may specifically be configured to perform a square root calculation on the total number of data blocks to obtain a square root value of the total number of data blocks; perform a ceiling operation on the square root value to obtain the smallest integer not less than the square root value; perform a subtraction operation on the smallest integer to obtain a target integer; perform a multiplication calculation on the smallest integer and the target integer to obtain a product value; determine whether the product value is not less than the total number of data blocks; if the product value is not less than the total number of data blocks, use the smallest integer and the target integer as the number of rows and columns of the bad block table respectively; if the product value is less than the total number of data blocks, use the smallest integer as the number of rows and columns of the bad block table.

[0136] In one embodiment of the present application, the determining module 1 may specifically be configured to determine the total storage capacity and the data block size of the target memory; perform a quotient calculation on the total storage capacity and the data block size to obtain the total number of data blocks of the target memory.

[0137] In one embodiment of the present application, the determining module 1 may specifically be configured to determine the number of communication paths in the target memory; determine the number of control signals of each communication path in the target memory; determine the number of data blocks per unit control signal in the target memory; perform a product calculation on the number of communication paths, the number of control signals, and the number of data blocks to obtain the total number of data blocks of the target memory.

[0138] In one embodiment of the present application, the bad block table building device may further include a saving module, configured to, after obtaining the status information of each data block in the target memory and writing each status information into the initial bad block table to obtain the bad block table corresponding to the target memory, select a target data block in the target memory; the target data block is any normal data block in the target memory; and write the bad block table into the target data block.

[0139] For the introduction of the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate herein.

[0140] The embodiments of the present application provide an electronic device.

[0141] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an electronic device provided by the present application. The electronic device may include:

[0142] A memory 11 for storing computer programs;

[0143] A processor 10, configured to implement the steps of any of the above bad block table building methods when executing the computer program.

[0144] As Figure 6 shown, which is a schematic diagram of the composition structure of the electronic device. The electronic device may include: a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, the memory 11, and the communication interface 12 all complete communication with each other through the communication bus 13.

[0145] In the embodiments of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic devices, etc.

[0146] The processor 10 can call the program stored in the memory 11. Specifically, the processor 10 can execute the operations in the embodiments of the bad block table construction method.

[0147] The memory 11 is used to store one or more programs. The program may include program code, and the program code includes computer operation instructions. In the embodiments of the present application, the memory 11 stores at least a program for implementing the following functions:

[0148] Determine the target memory and determine the total number of data blocks in the target memory;

[0149] Process the total data volume of the data blocks according to a preset equal division strategy to obtain the number of rows and columns of the bad block table; wherein, the difference between the number of rows and columns of the bad block table is 0 or 1;

[0150] Construct an initial bad block table according to the number of rows and columns of the bad block table;

[0151] Obtain the status information of each data block in the target memory and write each status information into the initial bad block table to obtain the bad block table corresponding to the target memory.

[0152] In a possible implementation manner, the memory 11 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function, etc.; the data storage area may store the data created during use.

[0153] In addition, the memory 11 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage devices.

[0154] The communication interface 12 may be an interface of a communication module for connecting to other devices or systems.

[0155] Of course, it should be noted that Figure 6 the structure shown does not limit the electronic device in the embodiments of the present application. In actual applications, the electronic device may include more or fewer components than Figure 6 shown, or combine some components.

[0156] The embodiments of the present application provide a computer-readable storage medium.

[0157] The computer program stored on the computer-readable storage medium provided by the embodiments of the present application can implement the steps of any of the above-mentioned bad block table construction methods when executed by a processor.

[0158] Among them, the computer-readable storage medium can be any available medium that a computer can store, or a data storage device such as a server or a data center that integrates one or more available media. For example, it can be various media that can store computer program code, such as magnetic media (such as floppy disks, hard disks, magnetic tapes, etc.), optical media (such as DVDs), or semiconductor media (such as solid-state drives).

[0159] For the introduction of the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate herein.

[0160] The embodiments of the present application provide a computer program product.

[0161] The computer program product provided in the embodiments of the present application includes computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of any of the above bad block table construction methods can be implemented.

[0162] Specifically, in the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.

[0163] Among them, the computer program product can include one or more computer programs / instructions. When the computer program / instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application can be generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center to another website, a computer, a server, or a data center by wire (such as coaxial cable, optical fiber, digital subscriber line, etc.) or wirelessly (such as infrared, wireless, microwave, etc.).

[0164] For the introduction of the computer program product provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate herein.

[0165] The various embodiments in the specification are described in a progressive manner. The key points of each embodiment are the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0166] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered as exceeding the scope of this application.

[0167] The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0168] The technical solutions provided in this application have been introduced in detail above. Specific examples are used herein to illustrate the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A method for constructing a bad block table, characterized in that: include: Determine a target storage, and determine the total number of data blocks in the target storage; The total amount of data in the data block is processed according to a preset equal distribution strategy to obtain the number of bad block table rows and the number of bad block table columns; wherein the difference between the number of bad block table rows and the number of bad block table columns is 0 or 1; Constructing an initial bad block table according to the number of bad block table rows and the number of bad block table columns; The status information of each data block in the target memory is obtained, and each of the status information is written into the initial bad block table to obtain a bad block table corresponding to the target memory.

2. The bad block table construction method according to claim 1, characterized in that: Acquiring status information of each data block in the target storage, including: For each data block in the target memory, determining a spare area of ​​a first page in the data block; Read the first byte of the spare area to obtain a read value; When the read value is 0xff, determining that the status information of the data block is normal; When the read value is not 0xff, it is determined that the status information of the data block is abnormal.

3. The bad block table construction method according to claim 2, characterized in that: Writing each state information into the initial bad block table includes: When the state information of the data block is normal, a flag bit 1 indicating normal state information is written into the initial bad block table; When the state information of the data block is abnormal, a flag bit 0 indicating the abnormal state information is written into the initial bad block table.

4. The bad block table construction method according to claim 1, characterized in that: The total amount of data in the data block is processed according to the preset equal distribution strategy to obtain the number of rows and columns in the bad block table, including: Performing square root calculation on the total number of data blocks to obtain a square root value of the total number of data blocks; Rounding up the square root value to obtain a minimum integer that is not less than the square root value; Subtract one from the minimum integer to obtain a target integer; Calculating the product of the minimum integer and the target integer to obtain a product value; Determining whether the product value is not less than the total number of data blocks; If the product value is not less than the total number of data blocks, the minimum integer and the target integer are used as the number of rows and columns of the bad block table respectively; If the product value is less than the total number of data blocks, the minimum integer is used as the number of rows and columns in the bad block table.

5. The bad block table construction method according to claim 1, characterized in that: Determining the total number of data blocks in the target memory includes: Determining the total storage capacity and data block size of the target storage; The total storage capacity and the data block size are calculated as a quotient to obtain the total number of data blocks in the target storage.

6. The bad block table construction method according to claim 1, characterized in that: Determining the total number of data blocks in the target memory includes: determining a number of communication paths in the target memory; determining the number of control signals for each communication path in the target memory; Determine the number of data blocks of the unit control signal in the target memory; The number of communication paths, the number of control signals, and the number of data blocks are multiplied to obtain the total number of data blocks in the target memory.

7. The bad block table construction method according to claim 1, characterized in that: After acquiring the status information of each data block in the target memory and writing each of the status information into the initial bad block table to obtain the bad block table corresponding to the target memory, the method further includes: Selecting a target data block in the target memory; the target data block is any normal data block in the target memory; The bad block table is written into the target data block.

8. A bad block table construction device, characterized in that: include: A determination module, used to determine a target storage and determine the total number of data blocks in the target storage; A processing module, used for processing the total amount of data in the data block according to a preset equal distribution strategy to obtain the number of bad block table rows and the number of bad block table columns; wherein the difference between the number of bad block table rows and the number of bad block table columns is 0 or 1; A construction module, used for constructing an initial bad block table according to the number of rows in the bad block table and the number of columns in the bad block table; The table writing module is used to obtain the status information of each data block in the target memory, and write each of the status information into the initial bad block table to obtain the bad block table corresponding to the target memory.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the bad block table construction method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the bad block table construction method according to any one of claims 1 to 7 are implemented.