Flash memory block processing method, flash memory data processing method, device and related equipment
Patent Information
- Application Number
- CN202211342513.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2042-10-31
AI Technical Summary
[0004]本发明实施例提供闪存块的处理方法,旨在解决现有技术中,闪存块的运行效率及生产良率低的问题
[0041] The beneficial effects achieved by this invention are as follows: This application constructs a residual block table, and based on the residual block table, constructs a bad block replacement table including replacement block numbers and corresponding replacement giant blocks. The replacement giant blocks in the bad block replacement table can provide more operable giant blocks, increasing the number of usable giant blocks and improving production yield. Furthermore, based on the replacement giant blocks in the bad block replacement table, virtual giant blocks are constructed in the giant block table. Information about bad blocks existing in the original good and bad block tables but which can be constructed into operable giant blocks is not stored in the bad block replacement table, but rather virtual giant blocks are constructed in the giant block table. When operating a virtual module, the target replacement giant block is obtained from the bad block replacement table according to the replacement block number. The block requiring a flash memory command is then searched based on the replacement block index in the target replacement giant block. This eliminates the need to sequentially match and search according to the giant block number in the original good and bad block tables when searching for the target replacement giant block, reducing search time and improving operating efficiency.
Smart Images

Figure CN115794663B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital storage technology, and particularly relates to methods for processing flash memory blocks, flash memory data processing methods, devices, and related equipment. Background Technology
[0002] In digital storage solutions equipped with FLASH memory, the good and bad block handling technology of the FTL (FLASH TRANSLATION LAYER) algorithm not only affects performance but is also highly correlated with production yield. When any host-side command or firmware trigger causes the FLASH FTL to operate on the FLASH, to improve the utilization of flash memory blocks, it first refers to the bad block replacement table to find operable good blocks. Traditional FTL algorithms store bad block indicators for all large blocks, guiding the FTL to consult the bad block replacement table when operating on a specific large block number. The information of the queried large block must be stored in the bad block replacement table before a matching large block number can be found and the good block information retrieved. This lookup method is time-consuming, leading to low flash memory block operating efficiency.
[0003] Secondly, based on the user data area capacity configuration ratio and product specification requirements, the operation of the FTL algorithm generally requires defining a maximum limit on the number of usable blocks. When the number of bad flash memory blocks used in an application device is too small to meet the operating conditions of the FTL algorithm, the device will be judged as a defective product during the production stage, thus reducing the production yield. Summary of the Invention
[0004] This invention provides a method for processing flash memory blocks, aiming to solve the problems of low operating efficiency and low production yield of flash memory blocks in the prior art.
[0005] This invention is implemented by providing a method for processing flash memory blocks, including the following steps:
[0006] A residual block table is constructed based on the original good and bad block table of flash memory blocks, and the residual block table includes all residual blocks;
[0007] A bad block replacement table is constructed based on the residual block table. The bad block replacement table includes replacement block numbers and replacement megablocks corresponding to the replacement block numbers. Each replacement megablock includes a replacement block index.
[0008] A giant block table is constructed based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block number of the replacement giant block, and giant blocks composed of good blocks based on the original good and bad block table.
[0009] Furthermore, the construction of the residual block table based on the original good and bad block table of flash memory blocks includes:
[0010] From the original good and bad block table of the flash memory blocks, obtain all the remaining blocks selected for each chip;
[0011] Each residual block is mapped to its corresponding chip select, and the residual block table is constructed in an orderly manner.
[0012] Furthermore, the step of constructing a bad block replacement table based on the residual block table includes:
[0013] Based on the sequential interleaving match of the residual blocks for each shard select in the residual block table, at least one replacement megablock in the bad block replacement table is constructed, and the replacement megablock includes the replacement block index corresponding to each shard select;
[0014] If at least one of the chip selects in the residual block table has exhausted its residual blocks, then it is determined whether the number of remaining residual blocks in the other chip selects is sufficient to match the chip selects whose residual blocks have been exhausted in order to form the replacement giant block;
[0015] If the conditions are met, the remaining residual blocks are interleaved and matched to the selected piece where the residual blocks are exhausted, and the remaining replacement giant blocks in the bad block replacement table are constructed.
[0016] The replacement block numbers are sequentially assigned to all the replacement giant blocks in the bad block replacement table.
[0017] Furthermore, the construction of the giant block table based on the original good and bad block table and the bad block replacement table includes:
[0018] In the original good and bad block table, an original giant block is constructed based on the good blocks with the same index in each slice selection;
[0019] The number of virtual giant blocks is determined based on the number of replacement block numbers in the bad block replacement table;
[0020] The virtual giant block number of each virtual giant block is calculated based on the maximum number of blocks in a single chip select and the replacement block numbers arranged in the bad block replacement table.
[0021] The giant block table is constructed based on the original giant block, the virtual giant block, the index of the original giant block, and the virtual giant block number.
[0022] This invention also provides a flash memory data processing method, wherein flash memory blocks of flash memory data are processed using the flash memory block processing method, including the following steps:
[0023] The massive block table is searched based on flash memory commands. The massive block to be operated on is determined to be the virtual massive block based on the massive block number of the massive block to be operated on in the massive block table and the maximum number of blocks selected by a single chip in the flash memory block.
[0024] If the block to be operated is the virtual block, then the replacement block number corresponding to the bad block replacement table is calculated based on the block number of the block to be operated and the maximum number of blocks selected by a single chip in the flash memory block;
[0025] Obtain the target replacement block corresponding to the replacement block number, locate the target block based on each replacement block index in the target replacement block, and perform flash operation on the target block using the flash data corresponding to the flash command.
[0026] Furthermore, determining whether the block to be operated on is the virtual block based on the block number of the block to be operated on in the block table and the maximum number of blocks selected by a single chip in the flash memory block includes:
[0027] Calculate whether the difference between the maximum number of blocks in a single chip select and the block number of the block to be operated on meets the difference threshold;
[0028] If the difference satisfies the difference threshold, then the block to be operated on is determined to be the virtual block;
[0029] If the difference does not meet the difference threshold, then it is determined that the block to be operated on is not the virtual block.
[0030] Embodiments of the present invention also provide a flash memory block processing apparatus, comprising:
[0031] The first construction module is used to construct a residual block table based on the original good and bad block table of flash memory blocks, wherein the residual block table includes all residual blocks;
[0032] The second construction module is used to construct a bad block replacement table based on the residual block table. The bad block replacement table includes replacement block numbers and replacement giant blocks corresponding to the replacement block numbers. Each replacement giant block includes a replacement block index.
[0033] The third construction module is used to construct a giant block table based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block number of the replacement giant block, and giant blocks composed of good blocks based on the original good and bad block table.
[0034] This invention also provides a flash memory data processing apparatus, wherein flash memory blocks of flash memory data are processed using the flash memory block processing method, including:
[0035] The query module is used to query the giant table in the flash memory block based on flash memory commands;
[0036] The judgment module is used to determine whether the block to be operated is the virtual block based on the block number of the block to be operated in the block table and the maximum number of blocks selected by a single chip in the flash memory block;
[0037] The calculation module is used to calculate the replacement block number corresponding to the bad block replacement table based on the block number of the block to be operated and the maximum number of blocks for a single chip select in the flash memory block if the block to be operated is the virtual block.
[0038] The acquisition module is used to acquire the target replacement block corresponding to the replacement block number, locate the target block based on each replacement block index in the target replacement block, and perform flash operation on the target block with the flash data corresponding to the flash command.
[0039] This invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the computer program to implement the flash memory block processing method as described in any embodiment.
[0040] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the flash memory block processing method as described in any embodiment.
[0041] The beneficial effects achieved by this invention are as follows: This application constructs a residual block table, and based on the residual block table, constructs a bad block replacement table including replacement block numbers and corresponding replacement giant blocks. The replacement giant blocks in the bad block replacement table can provide more operable giant blocks, increasing the number of usable giant blocks and improving production yield. Furthermore, based on the replacement giant blocks in the bad block replacement table, virtual giant blocks are constructed in the giant block table. Information about bad blocks existing in the original good and bad block tables but which can be constructed into operable giant blocks is not stored in the bad block replacement table, but rather virtual giant blocks are constructed in the giant block table. When operating a virtual module, the target replacement giant block is obtained from the bad block replacement table according to the replacement block number. The block requiring a flash memory command is then searched based on the replacement block index in the target replacement giant block. This eliminates the need to sequentially match and search according to the giant block number in the original good and bad block tables when searching for the target replacement giant block, reducing search time and improving operating efficiency. Attached Figure Description
[0042] Figure 1a This is a flowchart of a flash memory block processing method provided in Embodiment 1 of the present invention;
[0043] Figure 1b This is a schematic diagram of an original good and bad block table provided in this embodiment.
[0044] Figure 1c The first embodiment provided is based on Figure 1b A schematic diagram of the constructed residual block table;
[0045] Figure 1d The first embodiment provided is based on Figure 1c A schematic diagram of the constructed bad block replacement table;
[0046] Figure 2 Provided for Embodiment 2 of the present invention Figure 1a Flowchart of step S10;
[0047] Figure 3a Provided for Embodiment 3 of the present invention Figure 1a Flowchart of step S20;
[0048] Figure 3b This is a schematic diagram of another original good / bad block table provided in Embodiment 3 of the present invention;
[0049] Figure 3c The third embodiment provided is based on Figure 3b A schematic diagram of the constructed residual block table;
[0050] Figure 3d The embodiment provided is based on Figure 3b A schematic diagram of the bad block replacement table;
[0051] Figure 4 Provided for Embodiment 2 of the present invention Figure 1a Flowchart of step S30;
[0052] Figure 5 A flowchart of a flash memory data processing method provided in an embodiment of the present invention;
[0053] Figure 6 A schematic diagram of the structure of a flash memory block processing device provided in an embodiment of the present invention;
[0054] Figure 7 Provided for embodiments of the present invention Figure 6 A schematic diagram of the structure of the first building block;
[0055] Figure 8 Provided for embodiments of the present invention Figure 6 A structural diagram of the second building block in the middle;
[0056] Figure 9 Provided for embodiments of the present invention Figure 6 A structural diagram of the third building block in the middle;
[0057] Figure 10 A schematic diagram of a flash memory data processing device provided in an embodiment of the present invention;
[0058] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0060] This application constructs a residual block table, and based on this table, builds a bad block replacement table including replacement block numbers and corresponding replacement giant blocks. The replacement giant blocks in the bad block replacement table can provide more operable giant blocks, increasing the number of usable giant blocks and improving production yield. Furthermore, virtual giant blocks are constructed in the giant block table based on the replacement giant blocks in the bad block replacement table. Information about bad blocks existing in the original good / bad block table but which can be constructed into operable giant blocks is not stored in the bad block replacement table; instead, virtual giant blocks are constructed in the giant block table. When operating a virtual module, the target replacement giant block is retrieved from the bad block replacement table based on the replacement block number. The block requiring a flash command is then located based on the replacement block index in the target replacement giant block. This eliminates the need to sequentially match and search the original good / bad block table based on the giant block number when searching for the target replacement giant block, reducing search time and improving operational efficiency.
[0061] Example 1
[0062] Figure 1a A flowchart illustrating the flash memory block processing method provided in an embodiment of this application is shown, as follows: Figure 1a As shown, the method includes steps S10 to S40. The specific implementation principle of each step is as follows:
[0063] S10. Construct a residual block table based on the original good and bad block table of flash memory blocks. The residual block table includes all residual blocks.
[0064] In this embodiment, the above-described flash memory block processing method can be applied to all digital storage devices employing FLASH memory. The aforementioned original good / bad block table can refer to a table composed of blocks included in each CE in the chip select (CE) configured according to the flash memory block. Each flash memory can be configured with at least one CE, and each CE can include at least one block, and each CE can include at least one of good blocks, bad blocks, and residual blocks, where good blocks, bad blocks, and residual blocks can refer to storage cells of the flash memory block. The various CEs of a single flash memory block may contain different numbers and different bad blocks, and a good block based on each CE can constitute a giant block. (Illustratively, see reference...) Figure 1bThe diagram shown is a schematic representation of the distribution of an original good and bad block table provided in this embodiment. The flash memory block comprises four CEs (numbered CE0 to CE3), each CE containing eight blocks (B0 to B7). CE0 includes one bad block B2 (the block with gray background and white text), one residual block B5 (the block with black background and white text), and six good blocks B0, B1, B3, B4, B6, and B7 (the blocks with white background and black text). CE1 includes one bad block B5, one residual block B2, and six good blocks B0, B1, B3, B4, B6, and B7. CE2 includes two residual blocks B2 and B5, and six good blocks B0, B1, B3, B4, B6, and B7. CE3 includes two residual blocks B2 and B5, and six good blocks B0, B1, B3, B4, B6, and B7. Therefore, six giant blocks that can be used by the FTL can be naturally formed, including the first, second, third, fourth, sixth, and seventh rows, where each row constitutes a giant block. Among them, a good block can refer to a block that can directly form a giant block for the FTL algorithm to operate on directly; a bad block can refer to a block that the FTL algorithm cannot operate on; a residual block can refer to a block that the FTL algorithm cannot operate on directly, but can be combined with the residual blocks in each CE to form a giant block for the FTL algorithm to operate on.
[0065] In the initial stage of the FTL algorithm, residual blocks can be obtained based on all blocks in the original good and bad block table. Within the same CE, if a bad block exists, the residual block can replace the bad block. Finally, the aforementioned residual block table is constructed in order according to the chip select order of each CE. (Reference) Figure 1c As shown, this embodiment provides a method based on... Figure 1b The residual block table is constructed from the original good and bad block table. Among them, CE0 includes residual block B5; CE1 includes residual block B2; CE2 includes residual blocks B2 and B5; CE3 includes residual blocks B2 and B5.
[0066] S20. Construct a bad block replacement table based on the residual block table. The bad block replacement table includes the replacement block number and the replacement giant block corresponding to the replacement block number. Each replacement giant block includes the replacement block index.
[0067] The aforementioned bad block replacement table includes operable replacement megablocks constructed from each residual block in the residual block table. (Illustratively, see reference...) Figure 1c As shown, the residual blocks B5 of CE0, B2 of CE1, B2 of CE2, and B2 of CE3 in the first row can form a replacement giant block. However, in the second row, CE1 and CE0 have no usable residual blocks, and CE2 and CE3 also have no extra residual blocks available for use by CE0 and CE1. Therefore, there are no residual blocks to form a complete replacement giant block. Thus, a bad block replacement table can be constructed based on the first row of the residual block table. (Refer to...) Figure 1d As shown, Figure 1d Based on Figure 1cThe bad block replacement table is constructed.
[0068] It is possible that when multiple replacement giants can be constructed from the residual block table, all the results of constructing replacement giants are added to the bad block replacement table in an orderly manner. The bad block replacement table yields all replacement giants, including those formed by allocating the remaining residual blocks of a single CE in the flash memory block to other CEs where the residual blocks have been exhausted. For example, if the flash memory block has CE0 and CE1, CE0 includes residual blocks B0, B1, and B2, and CE1 includes residual block B4, then when constructing the bad block replacement table, the residual block B2 of CE0 is allocated to CE1, thus forming two replacement giants (B0 and B4, B1 and B2). Figure 1c As shown, the bad block replacement table includes replacement block numbers, with each replacement block number corresponding to a replacement megablock. The replacement megablock to be operated on can be indexed based on the replacement block number. At the same time, the replacement megablock includes a replacement block index, which can be used to find the specific location of each operable good block in the replacement megablock within CE.
[0069] S30. Construct a giant block table based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block numbers of the replaced giant blocks, as well as giant blocks composed of good blocks based on the original good and bad block table.
[0070] Among them, some giant blocks can be directly obtained from the original good / bad table, such as Figure 1b In the process, six naturally formed giant blocks that can be used by the FTL can be directly obtained. During FTL initialization, giant blocks are directly retrieved from the original good / bad block table. Giant blocks containing bad blocks are not added to the giant block table; therefore, there is no need to store information about giant blocks with bad blocks. Instead, virtual giant blocks are added to the giant block table. Virtual giant blocks may refer to giant blocks that do not actually store data, but can be indexed from the virtual giant block to the bad block replacement table based on the association between the virtual giant block and the replacement block number. The replacement giant block is then found in the bad block replacement table, and the specific location of the operable good block is found based on the replacement block index of the replacement giant block. The virtual giant block number can be calculated based on the replacement block number in the bad block replacement table and the maximum number of blocks per CE in the original good / bad block table. Therefore, based on the giant blocks directly obtained from the original good / bad block table and the virtual giant blocks constructed from the replacement giant blocks in the bad block replacement table, all operable giant blocks are finally obtained in the giant block table.
[0071] In this embodiment of the invention, a residual block table is constructed, and a bad block replacement table is built based on the residual block table, including replacement block numbers and corresponding replacement giant blocks. The replacement giant blocks in the bad block replacement table can provide more operable giant blocks, increasing the number of usable giant blocks and improving production yield. Furthermore, virtual giant blocks are constructed in the giant block table based on the replacement giant blocks in the bad block replacement table. Information about bad blocks that exist in the original good and bad block tables but can be constructed into operable giant blocks is not stored in the bad block replacement table, but rather virtual giant blocks are constructed in the giant block table. When operating a virtual module, the target replacement giant block is obtained from the bad block replacement table based on the replacement block number. The block requiring flash memory commands (including flash read, write, and erase commands) is searched based on the replacement block index in the target replacement giant block. This eliminates the need to sequentially match and search in the original good and bad block tables based on the giant block number when searching for the target replacement giant block, reducing search time and improving operating efficiency.
[0072] Example 2
[0073] In this embodiment, based on the above embodiment one, as follows: Figure 2 As shown, step S10 includes steps S101 to S102. The specific implementation principles of each step are as follows:
[0074] S101. Obtain all remaining blocks selected for each chip from the original good and bad block table of the flash memory blocks.
[0075] S102. Match each residual block with its corresponding chip select and construct a residual block table in an orderly manner.
[0076] Specifically, the residual blocks included in each CE can be directly read from the original good / bad block table. Based on the order of the residual blocks in each CE of the original good / bad block table, the residual blocks corresponding to each chip select are added to the residual block table. It's possible that each CE may have no residual blocks or contain at least one residual block, thus the construction of replacement giant blocks will differ. For example: if the flash memory block includes CE0 and CE1, and each CE0 and CE1 contains one residual block, then one replacement giant block is formed; or if CE0 contains three residual blocks and CE1 has no residual blocks, then the residual blocks in CE0 can be configured into CE1, ultimately forming two replacement giant blocks; or if CE0 and CE1 each contain at least two residual blocks, at least two replacement giant blocks are formed, and so on. Therefore, the number of replacement giant blocks to be constructed depends on the number of residual blocks in each CE.
[0077] In this embodiment, by obtaining the residual blocks in the original good and bad block table, and according to the order of the position of each residual block in each CE in the original good and bad block table, the residual blocks corresponding to each CE are added to the residual block table to obtain a complete residual block table. In this way, a bad block replacement table including more possible replacement giant blocks can be constructed according to the different distribution of residual blocks in each CE in the residual block table.
[0078] Example 3
[0079] In this embodiment, based on the above embodiment two, as follows: Figure 3a As shown, step S20 includes steps S201 to S204. The specific implementation principle of each step is as follows:
[0080] S201. Based on the sequential interleaving match of the residual blocks in each chip select in the residual block table, construct at least one replacement giant block in the bad block replacement table. The replacement giant block includes the replacement block index corresponding to each chip select.
[0081] Specifically, the sequential interleaving matching of residual blocks based on each CE in the residual block table can refer to the fact that the replacement giant block is not limited to the position of the same giant block (same row) in the original good and bad block table, but each residual block can only be used in one replacement giant block. (Illustrative example, see reference...) Figure 3b The diagram shown is a schematic representation of another original good / bad block table provided in an embodiment of the present invention. The flash memory includes CE0 and CE1. CE0 includes residual blocks B7 to B11, and CE1 includes residual block B6. Therefore, the following table is constructed: Figure 3c The diagram shows a residual block table. Then, by performing an interleaved matching of the residual block tables in CE0 and CE1 according to their order, it can be seen that the residual blocks that can directly form a replacement giant block are B7 of CE0 and B6 of CE1. Therefore, when bad blocks are concentrated in a single CE, even if there are many residual blocks, the number of replacement giant blocks that can be generated will be very small. Of course, if there are more residual blocks in CE1, more replacement giant blocks will be generated. Each replacement giant block includes the replacement block index corresponding to each CE, such as... Figure 3d As shown, Figure 3d The embodiment provided is based on Figure 3c A schematic diagram of the bad block replacement table. Among them, 7, 8, 10, 6, CE0-9, and CE0-10 are the replacement block indices for B7, B8, B10, B6, CE0-B9, and CE0-B10, respectively.
[0082] S202. If at least one chip select in the residual block table has exhausted its residual blocks, then determine whether the number of remaining residual blocks in the other chip selects is sufficient to match the chip select with exhausted residual blocks to form a replacement giant block.
[0083] In this process, after each CE has been interleaved and matched to form a partial replacement block, if one or more CEs have exhausted their residual blocks, it is possible to check whether there are any unmatched residual blocks in other CEs. If there are still residual blocks in other CEs, it is possible to determine whether the total number of residual blocks is greater than or equal to the total number of CEs. This determination can determine whether it is necessary to match the remaining residual blocks in the CEs to other CEs and reorganize a new replacement block.
[0084] S203. If satisfied, the remaining residual blocks are interleaved and matched to the selected piece where the residual blocks are exhausted, and the remaining replacement giant blocks in the bad block replacement table are constructed.
[0085] Specifically, if the total number of remaining residual blocks is greater than or equal to the total number of CEs, the remaining residual blocks can be allocated sequentially to CEs where residual blocks have been exhausted, thereby forming one or more new replacement giant blocks. For example, if a flash memory block includes CE0 to CE3, after forming two replacement giant blocks, the residual blocks in CE0 and CE1 are exhausted, there are 2 remaining residual blocks in CE2, and 4 remaining residual blocks in CE3, resulting in a total of 6 remaining residual blocks, which is greater than the number of CEs. This means that one more replacement giant block can still be formed. Therefore, based on the order of the residual blocks in the CEs, the residual blocks in CE2 and CE3 can be allocated to CEs where residual blocks have been exhausted to construct a new replacement giant block. (Illustrative example follows.) Figure 3d As shown, according to Figure 3c The residual block table allocates CE0-B9 and CE0-B10 to CE1, forming a total of 3 replacement giant blocks. In the bad block replacement table, the replacement giant block only stores the replacement block index of the residual block, rather than the actual data in the residual block, thus reducing the storage space occupied.
[0086] S204: The replacement block numbers are arranged in order for all replacement giant blocks in the bad block replacement table.
[0087] When forming multiple sets of replacement giant blocks, the replacement block number can be established in the bad block replacement table according to the number of replacement giant blocks. For example, if there are a total of 5 sets of replacement giant blocks, they will be numbered 0, 1, 2, 3, and 4 in sequence.
[0088] In this embodiment, a bad block replacement table is constructed by interleaving the residual blocks of each CE in the residual block table. This table includes replacement block numbers and corresponding replacement giant blocks. Adding replacement block numbers facilitates establishing associations with virtual giant blocks in the giant block table. When operating on virtual giant blocks, the corresponding replacement block number is used, making it easier for the FTL algorithm to read the replacement giant block corresponding to that number. Since searching based on the replacement block index in the replacement giant block requires flash memory commands, this improves operational efficiency. Furthermore, allocating the remaining residual blocks in a single CE to other CEs and constructing new replacement giant blocks in the bad block replacement table increases the number of usable giant blocks and improves production yield.
[0089] Example 4
[0090] In this embodiment, based on the above embodiment three, as follows: Figure 4 As shown, step S30 includes steps S301 to S304. The specific implementation principle of each step is as follows:
[0091] S301. In the original good and bad block table, construct the original giant block based on the good blocks with the same index in each slice selection.
[0092] In the original good and bad block table, each CE includes good blocks with different indexes. If all CEs include good blocks with the same index, then the good blocks with the same index can directly form an original giant block. For example, if CE0 to CE3 all include B3, and B3 is a good block and 3 is the index of the good block, then an original giant block can be formed based on the four B3s in CE0 to CE3.
[0093] S302. Determine the number of virtual giant blocks based on the number of replacement block numbers in the bad block replacement table.
[0094] The replacement block number is associated with a virtual giant block. Each replacement block number corresponds to a replacement giant block. The number of replacement block numbers in the bad block replacement table determines the number of virtual giant blocks generated in the giant block table.
[0095] S303. Calculate the virtual giant block number for each virtual giant block based on the maximum number of blocks selected in a single chip and the replacement block numbers arranged in the bad block replacement table.
[0096] Specifically, a virtual block number needs to be created for each virtual giant block. The virtual giant block number is the sum of the maximum number of blocks in a single CE and the replacement block number in the bad block replacement table. At the same time, a virtual giant block number corresponds to a replacement block number in an ordered manner. For example, if the maximum number of blocks in a single CE is 8 and the replacement block numbers in the bad block replacement table are ordered to include 0, 1, and 2, then there will be 3 virtual giant block numbers in the giant block table, namely 8 (8+0), 9 (8+1), and 10 (8+2). If there are 7 original giant blocks obtained directly from the original good and bad block table, then with the addition of 3 virtual giant blocks, there will be 10 operable giant blocks in the giant block table.
[0097] S304. Construct a giant block table based on the original giant block, the virtual giant block, the index of the original giant block, and the virtual giant block number.
[0098] Specifically, the original good blocks and virtual giant blocks constitute all the giant blocks in the giant block table. The index of each original giant block can be used as its giant block number, and combined with the virtual giant block number, all the giant block numbers in the giant block table can be formed. The original giant blocks are arranged in a corresponding order with their corresponding giant block numbers. Each original giant block includes good blocks with the same index in each CE (Cross-Entry Point). The virtual giant block number can be associated with the bad block replacement table to locate the replacement giant block to be operated on.
[0099] In this embodiment, by constructing a block table that includes virtual blocks, information about blocks that are bad but can be constructed into operable blocks in the original good and bad block table is not stored in the bad block replacement table. Instead, virtual blocks are constructed in the block table. When operating on a virtual module, the indexes of each good block in the replacement block to be operated are directly found from the bad block replacement table based on the calculated replacement block number. The location based on the index requires a flash command, eliminating the need to sequentially match and search in the original good and bad block table based on the block number when searching for the replacement block. This reduces search time and improves operating efficiency.
[0100] Example 5
[0101] This invention also provides a flash memory data processing method in its embodiments, wherein the flash memory blocks of flash memory data are processed using the flash memory block processing method described in any of the above embodiments. For example... Figure 5 The flowchart shown is a flash memory data processing method provided in an embodiment of the present invention, including the following steps:
[0102] S401. Search the block table based on flash memory commands, and determine whether the block to be operated is a virtual block based on the block number of the block to be operated in the block table and the maximum number of blocks selected by a single chip in the flash memory block.
[0103] In this embodiment, the good blocks, bad blocks, and residual blocks in the provided flash memory block have been processed by the flash memory block processing method provided in any of the above embodiments. Therefore, this flash memory block also includes the aforementioned large block table, bad block replacement table, etc. When the host issues a flash command to the flash memory block, it can search for an operable large block in the flash memory block to execute the flash command. Therefore, an operable large block can be obtained by searching the large block table in the flash memory block.
[0104] Specifically, the maximum number of blocks in a single CE can be obtained, for example, a single CE may contain 8 blocks, 12 blocks, etc. Furthermore, when searching for a giant block, the giant block number of the giant block to be operated on can be obtained. The difference between the giant block number of the giant block to be operated on and the maximum number of blocks in a single CE is calculated, and it is determined whether the difference is greater than or equal to a difference threshold. For example, if the difference threshold is 0, the giant block number of the giant block to be operated on is 9, and the maximum number of blocks in a single CE is 8, then 9-8=1, which meets the difference threshold. If the difference meets the difference threshold, the giant block to be operated on can be determined to be a virtual giant block; if the difference does not meet the difference threshold, the giant block to be operated on is not a virtual giant block, and flash commands can be directly issued to the giant block to be operated on.
[0105] S402. If the block to be operated is a virtual block, calculate the replacement block number corresponding to the bad block replacement table based on the block number of the block to be operated and the maximum number of blocks for a single chip select in the flash memory block.
[0106] S403. Obtain the target replacement block with the corresponding replacement block number, locate the target block based on each replacement block index in the target replacement block, and perform flash operation on the target block using the flash data of the corresponding flash command.
[0107] The target block can refer to a workable good block found through the bad block replacement table. Specifically, if the block to be operated on is a virtual block, the difference between the block number of the block to be operated on and the maximum number of blocks in a single CE can be used as the replacement block number to be found. The replacement block number to be found is retrieved from the bad block replacement table, and the target replacement block corresponding to that replacement block number is obtained. The specific location of the target block is located according to the index of each block in the target replacement block. Then, the flash data of the corresponding flash command is used to perform flash operations on the target block (including flash read, write, and erase commands, etc.). The flash command under the target block can be obtained from the bad block replacement table without any block number matching search. For example, if the difference is 1, the replacement block number is 1. Then, the target replacement block corresponding to replacement block number 1 is retrieved from the bad block replacement table, and the flash command under the target block is located according to the index in the target replacement block corresponding to replacement block number 1.
[0108] In this embodiment of the invention, the difference between the maximum number of blocks in a single CE and the block number of the block to be operated is used to determine whether the block to be operated is a virtual block. If it is a virtual block, the difference between the maximum number of blocks in a single CE and the block number of the block to be operated is used as the replacement block number corresponding to the block to be operated to obtain the target replacement block from the bad block replacement table. The flash memory command under the target block is located according to the index in the target replacement block corresponding to the replacement block number. It is not necessary to sequentially match and search in the original good and bad block table according to the block number when searching for the target replacement block, which can reduce the search time and improve the running efficiency.
[0109] Example 6
[0110] Corresponding to the above Figure 1a The processing method of the flash memory block shown is as follows: Figure 6 The diagram shown is a schematic diagram of a flash memory block processing apparatus provided in an embodiment of this application. The apparatus M60 includes:
[0111] The first building module M601 is used to build a residual block table based on the original good and bad block table of flash memory blocks. The residual block table includes all residual blocks.
[0112] The second construction module M602 is used to construct a bad block replacement table based on the residual block table. The bad block replacement table includes replacement block numbers and corresponding replacement giant blocks. Each replacement giant block includes a replacement block index.
[0113] The third building module M603 is used to build a giant block table based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block numbers of the replaced giant blocks, as well as giant blocks composed of good blocks based on the original good and bad block table.
[0114] Optional, see reference Figure 7 As shown, Figure 7 This is a schematic diagram of the structure of the first building module provided in an embodiment of the present invention. The first building module M601 includes:
[0115] The acquisition unit M6011 is used to acquire all the remaining blocks selected for each chip from the original good and bad block table of the flash memory block;
[0116] The first construction unit M6012 is used to map each residual block to its corresponding chip select and construct the residual block table in an orderly manner.
[0117] Optional, see reference Figure 8 As shown, Figure 8 This is a schematic diagram of the structure of the second building module provided in an embodiment of the present invention. The second building module M602 includes:
[0118] The second construction unit M6021 is used to construct at least one replacement giant block in the bad block replacement table based on the sequential interleaving match of the residual blocks of each chip select in the residual block table. The replacement giant block includes the replacement block index corresponding to each chip select.
[0119] The judgment unit M6022 is used to determine whether the number of remaining residual blocks in the remaining selections is sufficient to match the remaining selections that have exhausted their residual blocks in the residual block table, so as to form a replacement giant block.
[0120] Matching unit M6023 is used to interleave the remaining residual blocks with the selected piece where the residual blocks are exhausted, and construct the remaining replacement giant blocks in the bad block replacement table if the condition is met.
[0121] Configuration unit M6024 is used to sequentially configure replacement block numbers for all replacement giant blocks in the bad block replacement table.
[0122] Optional, see reference Figure 9 As shown, Figure 9 A schematic diagram of the structure of the third building module provided in an embodiment of the present invention. The third building module M603 includes:
[0123] The third building unit M6031 is used to build the original giant block in the original good and bad block table based on the good blocks with the same index in each slice selection;
[0124] The determination unit M6032 is used to determine the number of virtual giant blocks based on the number of replacement block numbers in the bad block replacement table;
[0125] The first calculation unit M6033 is used to calculate the virtual giant block number of each virtual giant block based on the maximum number of blocks in a single chip select and the replacement block numbers arranged in the bad block replacement table.
[0126] The fourth building unit, M6034, is used to build a giant block table based on the original giant block, the virtual giant block, the index of the original giant block, and the virtual giant block number.
[0127] The flash memory block processing apparatus provided in this embodiment of the invention can implement all the processes implemented by the flash memory block processing method in the above method embodiments, and will not be repeated here to avoid repetition. It can also achieve the same beneficial effects.
[0128] Example 7
[0129] Corresponding to the above Figure 5 The flash memory data processing method shown is as follows: Figure 10 The diagram shown is a schematic diagram of a flash memory data processing apparatus provided in an embodiment of this application. The apparatus M70 includes:
[0130] The query module M701 is used to query the massive table in the flash memory block based on flash memory commands;
[0131] The judgment module M702 is used to determine whether the block to be operated is a virtual block based on the block number of the block to be operated in the block table and the maximum number of blocks selected by a single chip in the flash memory block.
[0132] The calculation module M703 is used to calculate the replacement block number corresponding to the bad block replacement table for the virtual block based on the block number of the block to be operated and the maximum number of blocks for a single chip select in the flash memory block if the block to be operated is a virtual block.
[0133] The acquisition module M704 is used to acquire the target replacement block with the corresponding replacement block number, locate the target block based on each replacement block index in the target replacement block, and perform flash operation on the target block with the flash data of the corresponding flash command.
[0134] Optionally, the determination module M702 includes:
[0135] The calculation unit M7021 is used to calculate whether the difference between the maximum number of blocks in a single chip select and the block number of the block to be operated on meets the difference threshold.
[0136] The judgment unit M7022 is used to determine that the block to be operated is a virtual block if the difference meets the difference threshold.
[0137] The judgment unit M7022 is also used to determine that the block to be operated is not a virtual block if the difference does not meet the difference threshold.
[0138] The flash memory data processing apparatus provided in this embodiment of the invention can implement all the processes implemented by the flash memory data processing method in the above method embodiments, and will not be repeated here to avoid repetition. It can also achieve the same beneficial effects.
[0139] Example 8
[0140] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 11 As shown, the electronic device D11 of this embodiment includes: a processor D110, a memory D111, a network interface D112, and a computer program stored in the memory D111 and executable on the processor D110. The memory D111 may include flash memory processed by the processing method for flash memory blocks provided in this application. The processor D110 is used to call the computer program stored in the memory D111 and perform the following steps:
[0141] A residual block table is constructed based on the original good and bad block table of flash memory blocks, and the residual block table includes all residual blocks;
[0142] A bad block replacement table is constructed based on the residual block table. The bad block replacement table includes the replacement block number and the corresponding replacement megablock. Each replacement megablock includes the replacement block index.
[0143] A giant block table is constructed based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block numbers of the replaced giant blocks, as well as giant blocks composed of good blocks based on the original good and bad block table.
[0144] Optionally, the processor D110 performs a residual block table construction based on the original good and bad block table of flash memory blocks, including:
[0145] Retrieve all remaining blocks selected from each chip from the original good and bad block table of the flash memory blocks;
[0146] Each residual block is matched with its corresponding slice selection, and a residual block table is constructed in an orderly manner.
[0147] Optionally, the processor D110 performs the following: Constructing a bad block replacement table based on the residual block table, including:
[0148] Based on the sequential interleaving match of the residual blocks for each slice select in the residual block table, at least one replacement giant block is constructed in the bad block replacement table. The replacement giant block includes the replacement block index corresponding to each slice select.
[0149] If at least one chip select in the residual block table has exhausted its residual blocks, then determine whether the number of remaining residual blocks in the other chip selects is sufficient to match the chip select with exhausted residual blocks to form a replacement giant block;
[0150] If satisfied, the remaining residual blocks are interleaved and matched to the selected piece where the residual blocks are exhausted, and the remaining replacement giant blocks in the bad block replacement table are constructed.
[0151] The replacement block numbers are assigned sequentially to all replacement giant blocks in the bad block replacement table.
[0152] Optionally, the processor D110 executes a massive block table based on the original good and bad block table and the bad block replacement table, including:
[0153] In the original good and bad block table, construct the original giant block based on the good blocks with the same index in each slice selection;
[0154] The number of virtual giant blocks is determined based on the number of replacement block numbers in the bad block replacement table;
[0155] The virtual giant block number is calculated for each virtual giant block based on the maximum number of blocks selected in a single chip and the replacement block numbers arranged in the bad block replacement table.
[0156] The giant block table is constructed based on the original giant block, the virtual giant block, the index of the original giant block, and the virtual giant block number.
[0157] The electronic device D11 provided in this embodiment of the invention can implement the various implementation methods in the flash memory block processing method embodiment, as well as the corresponding beneficial effects. To avoid repetition, these will not be described again here.
[0158] D110-D112, however, it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. In this context, those skilled in the art will understand that the electronic device D11 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0159] The D11 electronic device can be a desktop computer, laptop, handheld computer, or cloud server, among other computing devices. The D11 electronic device allows for human-computer interaction via a keyboard, mouse, remote control, touchpad, or voice control.
[0160] In some embodiments, the processor D110 may be a Central Processing Unit (CPU). However, the processor D110 may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0161] In some embodiments, the memory D111 may be an internal storage unit of the electronic device D11, such as the memory of the electronic device D11 equipped with flash memory.
[0162] The D112 may include a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the electronic device D11 and other electronic devices.
[0163] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by the processor D110, it implements various processes of the flash memory block processing method embodiment provided in this invention and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0164] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms.
[0165] The terms "first," "second," etc., used in the specification, claims, or accompanying drawings of this application are used to distinguish different objects and not to describe a specific order. The reference to "embodiment" herein means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0166] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method of processing a flash memory block, the method comprising: Includes the following steps: A residual block table is constructed based on the original good and bad block table of flash memory blocks. The residual block table includes all residual blocks. The residual block refers to a block that the FTL algorithm cannot directly operate on, but can be combined with the residual blocks selected from each chip to form a giant block for the FTL algorithm to operate on. A bad block replacement table is constructed based on the residual block table. The bad block replacement table includes replacement block numbers and replacement megablocks corresponding to the replacement block numbers. Each replacement megablock includes a replacement block index. A giant block table is constructed based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block number of the replacement giant block, and giant blocks composed of good blocks based on the original good and bad block table. The giant blocks are composed of good blocks for each chip select. The construction of a giant block table based on the original good and bad block table and the bad block replacement table includes: In the original good and bad block table, an original giant block is constructed based on the good blocks with the same index in each slice selection; The number of virtual giant blocks is determined based on the number of replacement block numbers in the bad block replacement table; The virtual giant block number of each virtual giant block is calculated based on the maximum number of blocks in a single chip select and the replacement block numbers arranged in the bad block replacement table. The giant block table is constructed based on the original giant block, the virtual giant block, the index of the original giant block, and the virtual giant block number.
2. The method of claim 1, wherein, The construction of the residual block table based on the original good and bad block table of flash memory blocks includes: From the original good and bad block table of the flash memory blocks, obtain all the remaining blocks selected for each chip; Each residual block is matched with its corresponding chip select, and the residual block table is constructed in an orderly manner.
3. The method of claim 2, wherein, The step of constructing a bad block replacement table based on the residual block table includes: Based on the sequential interleaving match of the residual blocks for each shard select in the residual block table, at least one replacement megablock in the bad block replacement table is constructed, and the replacement megablock includes the replacement block index corresponding to each shard select; If at least one of the chip selects in the residual block table has exhausted its residual blocks, then it is determined whether the number of remaining residual blocks in the other chip selects is sufficient to match the chip selects whose residual blocks have been exhausted in order to form the replacement giant block; If the conditions are met, the remaining residual blocks are interleaved and matched to the selected piece where the residual blocks are exhausted, and the remaining replacement giant blocks in the bad block replacement table are constructed. The replacement block numbers are sequentially assigned to all the replacement giant blocks in the bad block replacement table.
4. A flash memory data processing method, characterized by, The flash memory data is processed using the flash memory data processing method as described in any one of claims 1 to 3, wherein the flash memory data processing method includes the following steps: The massive block table is searched based on flash memory commands. The massive block to be operated on is determined to be the virtual massive block based on the massive block number of the massive block to be operated on in the massive block table and the maximum number of blocks selected by a single chip in the flash memory block. If the block to be operated is the virtual block, then the replacement block number corresponding to the bad block replacement table is calculated based on the block number of the block to be operated and the maximum number of blocks selected by a single chip in the flash memory block; Obtain the target replacement block corresponding to the replacement block number, locate the target block based on each replacement block index in the target replacement block, and perform flash operation on the target block using the flash data corresponding to the flash command.
5. The method of claim 4, wherein, The step of determining whether the block to be operated on is the virtual block based on the block number of the block to be operated on in the block table and the maximum number of blocks selected by a single chip in the flash memory block includes: Calculate whether the difference between the maximum number of blocks in a single chip select and the block number of the block to be operated on meets the difference threshold; If the difference satisfies the difference threshold, then the block to be operated on is determined to be the virtual block; If the difference does not meet the difference threshold, then it is determined that the block to be operated on is not the virtual block.
6. An apparatus for processing a flash memory block, the apparatus comprising: include: The first construction module is used to construct a residual block table based on the original good and bad block table of flash memory blocks. The residual block table includes all residual blocks. The residual block refers to a block that the FTL algorithm cannot directly operate on, but can construct a giant block for the FTL algorithm to operate on by combining the residual blocks selected from each chip through interleaving matching. The second construction module is used to construct a bad block replacement table based on the residual block table. The bad block replacement table includes replacement block numbers and replacement giant blocks corresponding to the replacement block numbers. Each replacement giant block includes a replacement block index. The third construction module is used to construct a giant block table based on the original good and bad block table and the bad block replacement table. The giant block table includes virtual giant blocks associated with the replacement block number of the replacement giant block, and giant blocks composed of good blocks based on the original good and bad block table. The giant blocks are composed of good blocks for each chip select. The third building module is specifically used for: In the original good and bad block table, an original giant block is constructed based on the good blocks with the same index in each slice selection; The number of virtual giant blocks is determined based on the number of replacement block numbers in the bad block replacement table; The virtual giant block number of each virtual giant block is calculated based on the maximum number of blocks in a single chip select and the replacement block numbers arranged in the bad block replacement table. The giant block table is constructed based on the original giant block, the virtual giant block, the index of the original giant block, and the virtual giant block number.
7. A flash memory data processing apparatus, wherein a flash memory block of flash memory data is processed by the processing apparatus of the flash memory block as claimed in claim 6, characterized in that, The flash memory data processing device includes: The query module is used to query the giant table in the flash memory block based on flash memory commands; The judgment module is used to determine whether the block to be operated is the virtual block based on the block number of the block to be operated in the block table and the maximum number of blocks selected by a single chip in the flash memory block; The calculation module is used to calculate the replacement block number corresponding to the bad block replacement table based on the block number of the block to be operated and the maximum number of blocks for a single chip select in the flash memory block if the block to be operated is the virtual block. The acquisition module is used to acquire the target replacement block corresponding to the replacement block number, locate the target block based on each replacement block index in the target replacement block, and perform flash operation on the target block with the flash data corresponding to the flash command.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the method for processing flash memory blocks as described in any one of claims 1 to 3.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. When the computer program is executed by the processor, it implements the method for processing flash memory blocks as described in any one of claims 1 to 3.
Citation Information
Patent Citations
SSD bad block replacement method and device, readable storage medium and electronic equipment
CN112558863A
Method of managing a large array of non-volatile memories
US20080155183A1