Quick processing method and device for SSD flash memory block write error and SSD equipment
By flexibly forming RG Block in SSD and using cache space for data migration, the problem of limited RG Block assembly and large resource utilization in the prior art is solved, and the performance and service life of SSD is improved.
Patent Information
- Application Number
- CN202411417905.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2044-10-11
AI Technical Summary
The RG Block organization form of existing SSDs is inconsistent due to the inconsistent number of bad blocks in each Die, resulting in the actual number of RG Blocks that can be formed, which affects the service life and performance of the SSD, and the write error processing process occupies a lot of resources, affecting performance.
By selecting a good block for part or all planes of each Die in the SSD to form an RG Block, and using the preset cache space for data migration when writing errors, avoiding replacement of bad blocks and reducing garbage collection.
It improves the OP of SSD, extends the service life, reduces the garbage collection and processing process, and ensures the stability of SSD performance.
Smart Images

Figure CN119322589A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to a method and device for quickly processing a write error of an SSD flash memory block, and an SSD device. Background Art
[0002] In the prior art, during the SSD firmware processing, the RG Block is organized in units of Die, and one good block located on different planes is selected from each Die to form a group of multi-plane Blocks.
[0003] For the organization form of RG Block in the prior art, the number of actual good blocks on each Plane is inconsistent due to the inconsistent number of bad blocks in each Die. The number of RG Blocks that can actually be formed in an SSD is affected by the Plane with the least good blocks contained in all Dies. This will cause some extra blocks in all other Planes to be unable to participate in the formation of RG Block, resulting in the SSD OP being too small, which will affect the service life and performance of the SSD.
[0004] When a write error occurs in one or more blocks in a group of multi-plane blocks in one or more Dies during the data writing process of an RG Block, the data that has not been successfully stored in this group of RG Blocks will be written into another group of intact RG Blocks, and the valid data that has been successfully written in the RG Block with the write error will be GCed. After the valid data is recovered, the Block with the write error will be replaced with a good spare Block that failed to form an RG Block. If there is no good spare Block to replace, this group of RG Blocks will be downgraded. When it cannot be used after downgrading, the firmware will invalidate this group of RG Blocks, and the good blocks in this group of RG Blocks will be placed in the spare Block pool for replacing bad blocks during subsequent operation.
[0005] This method makes the organization form of RG Block too strict. Blocks that do not meet this organization form cannot be organized into RG Blocks, resulting in small OP, affecting the life and performance of SSD. In addition, the processing flow when a write error occurs is to first select a good RG Block to rewrite the data that was not successfully written, and perform GC processing on the valid data in the RG Block with a write error. GC processing is usually a background behavior. These two steps will occupy more runtime resources and affect the performance of SSD. Summary of the invention
[0006] In order to solve the above technical problem or at least partially solve the above technical problem, the present invention provides a method and apparatus for quickly processing an SSD flash memory block write error and an SSD device.
[0007] One aspect of the present invention provides a method for quickly processing a write error of an SSD flash memory block, wherein an RGBlock of the SSD is composed of selecting a good block from part of the planes or all of the planes in each Die constituting an RG Block, and the method comprises:
[0008] When performing a write operation on the first RG Block, the data to be written is cached in a cache unit of a preset first cache space according to the position layout of each block in the first RG Block, so that the position layout of the cache unit storing the data to be written in the first cache space is the same as the position layout of the blocks of the target RG Block;
[0009] When the data to be written in the first cache space is sequentially written into the first RG Page of the first RG Block, if a write error occurs, obtaining location information where the write error occurs, wherein the location information where the write error occurs includes location information of the first Block where the write error occurs and information of the first RG Page;
[0010] Determine a data migration rule for the data to be written pre-stored in the first cache space according to the location information where the write error occurs, and migrate the data to be written in the first cache space within the first cache space according to the data migration rule, and / or migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0011] The data to be written after the data in the first cache space is migrated is written into the second RGPage adjacent to the first RG Page; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, the data to be written after the data in the first cache space is migrated is written into the second RG Page adjacent to the first RG Page, and the data to be written migrated to the second cache space is written into the third RG Page adjacent to the second RG Page.
[0012] Further, the step of determining a data migration rule for the data to be written pre-stored in the first cache space according to the location information where the write error occurs includes:
[0013] Determine whether the first RG Page is the last page in the first RG Block;
[0014] If the first RG Page is not the last page in the first RG Block, the data migration rule is to migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0015] If the first RG Page is the last page in the first RG Block, obtaining the location layout of the blocks of the second RG Block to which the second RG Page belongs, and determining the data migration rule according to the location layout of the blocks of the second RG Block;
[0016] The determining of the data migration rule according to the location layout of the Block of the second RG Block includes:
[0017] Migrating the data to be written in the first cache space within the first cache space; or,
[0018] The data to be written in the first cache space is migrated within the first cache space, and the data to be written in the first cache space is migrated between the first cache space and a preset second cache space.
[0019] Furthermore, if the first RG Page is the last page in the first RG Block, the data migration rule includes:
[0020] The data to be written in the cache unit corresponding to the first Block position in the first cache space is used as redundant data of the second RG Page, and the redundant data of the second RG Page is migrated to the second cache space.
[0021] Further, the determining the data migration rule according to the block distribution of the second RG Block includes:
[0022] Obtaining a correspondence between a position of a cache unit pre-stored with data to be written in the first cache space and a position of a Block of the second RG Block;
[0023] The cache unit that corresponds to the block position in the first cache space and the second RG Block and does not store the data to be written is used as the migration-in position; the cache unit that does not correspond to the block in the first cache space and the second RG Block and stores the data to be written is used as the migration-out position;
[0024] When the number of the migration-in positions is greater than or equal to the number of the migration-out positions, the to-be-written data of the cache unit at the migration-out position in the first cache space is migrated to the cache unit at the migration-in position in the first cache space.
[0025] When the number of migration-in positions is less than the number of migration-out positions, the data to be written in each cache unit in the first cache space and at the migration-out position are preferentially migrated to each cache unit at the migration-in position in the first cache space; after the data to be written are pre-stored in each cache unit at the migration-in position in the first cache space, the data to be written that have not been migrated in the migration-out position are used as redundant data of the second RG Page, and the redundant data of the second RG Page are migrated to the second cache space.
[0026] Furthermore, the migrating the redundant data of the second RG Page to the second cache space includes:
[0027] Get the location layout of the Block of the third RG Block to which the third RG Page belongs;
[0028] The redundant data of the second RG Page is migrated to a cache unit in the second cache space that has the same location layout as that of the Block of the third RG Block.
[0029] Furthermore, after migrating the redundant data of the second RG Page to the second cache space, the method further includes:
[0030] The data to be written is continuously pre-stored in the second cache space, so that each cache unit having the same position layout as the Block of the third RG Block in the second cache space is pre-stored with the data to be written.
[0031] Furthermore, after obtaining the location information where the write error occurs, the method further includes:
[0032] Mark the first block as a bad block and remove the first RG Block;
[0033] The data in the first RG Page is marked as invalid data, and the data in each RG Page on which the write operation has been successfully completed in the first RG Block is retained.
[0034] Another aspect of the present invention further provides a fast processing device for SSD flash memory block write errors, wherein the RG Block of the SSD is composed of selecting a good block from part of the planes or all of the planes in each Die constituting the RG Block, and the device comprises:
[0035] An arrangement module, configured to cache the data to be written into a cache unit of a preset first cache space according to the position layout of each block in the first RG Block when performing a write operation on the first RG Block, so that the position layout of the cache unit storing the data to be written in the first cache space is the same as the position layout of the block of the target RG Block;
[0036] an acquisition module, configured to acquire location information of the write error if a write error occurs when the data to be written in the first cache space is sequentially written into the first RG Page of the first RG Block, wherein the location information of the write error includes location information of the first Block where the write error occurs and information of the first RG Page;
[0037] a migration module, configured to determine a data migration rule for the data to be written pre-stored in the first cache space according to the location information of the write error, and migrate the data to be written in the first cache space within the first cache space according to the data migration rule, and / or migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0038] The write operation module is further used to write the data to be written after the data in the first cache space is migrated into the second RG Page adjacent to the first RG Page; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, write the data to be written in the first cache space after the data is migrated into the second RG Page adjacent to the first RG Page, and write the data to be written migrated to the second cache space into the third RG Page adjacent to the second RG Page.
[0039] Furthermore, the migration module includes:
[0040] A determination submodule, used to determine whether the first RG Page is the last page in the first RG Block;
[0041] a migration determination submodule, configured to, if the first RG Page is not the last page in the first RG Block, migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0042] The migration determination submodule is further configured to, if the first RG Page is not the last page in the first RG Block, obtain the location layout of the Block of the second RG Block to which the second RG Page belongs, and determine the data migration rule according to the location layout of the Block of the second RG Block; wherein the determining the data migration rule according to the location layout of the Block of the second RG Block includes:
[0043] Migrating the data to be written in the first cache space within the first cache space; or,
[0044] The data to be written in the first cache space is migrated within the first cache space, and the data to be written in the first cache space is migrated between the first cache space and a preset second cache space.
[0045] Another aspect of the present invention further provides an SSD device, which includes a storage controller, the storage controller includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the program.
[0046] The present invention provides a method and apparatus for quickly processing write errors of SSD flash memory blocks, and an SSD device. The RG Block of the SSD is composed of a good block selected from part of the planes or all of the planes in each Die that constitutes the RG Block. The RG Block is more flexible in its construction, which maximizes the OP of the SSD, extends the service life of the SSD, and improves the performance of the SSD. When write error information is received, the preset first cache space and second cache space are used for data migration and reorganization, so that the first RG Block with a write error can continue to be used without replacing the bad block, thereby reducing the GC processing flow and ensuring the stability of the SSD performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0048] Figure 1 A schematic flow chart of a method for quickly processing an SSD flash memory block write error according to an embodiment of the present invention;
[0049] Figure 2 A method for quickly processing SSD flash memory block write errors in a specific embodiment of the present invention;
[0050] Figure 3 It is a schematic diagram of the structure of a device for quickly processing an SSD flash memory block write error in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] Before introducing the method for quickly processing an SSD flash memory block write error according to an embodiment of the present invention, a brief introduction to the background technology of the present invention is first given:
[0053] Die: Usually refers to an independent chip unit cut from a wafer and packaged, also known as a bare chip. It is the smallest independently working component of a NAND Flash flash particle.
[0054] Plane: In NAND flash memory chips, Plane is a form of organization of a large number of storage blocks, mainly used to improve the parallelism of data storage and management. It is part of the internal logical structure of the flash memory chip, and together with Block and Page, it constitutes the basic storage unit of the flash memory.
[0055] RG Block: A logical concept at the SSD level, the minimum parallel erase unit in SSD firmware management. A group of RG Blocks is a parallel operation unit formed by organizing part or all of the Dies in the SSD and a Block on each Plane in each Die. In fact, the Blocks in each Die can be flexibly organized, such as selecting one good block on different Planes that is less than or equal to the number of Planes in the corresponding Die.
[0056] Good blocks: refers to blocks in the SSD that can perform normal read and write operations. These blocks have maintained a good state during the manufacturing and use process, and can reliably store and read data, ensuring that users can use the SSD normally.
[0057] Bad blocks: refers to blocks in the SSD that cannot be read or written normally. These blocks may be damaged due to defects in the manufacturing process, wear and tear during use, or other factors, resulting in data being unable to be stored or read correctly.
[0058] Page: The smallest unit used to store data in NAND flash memory, which allows data to be read and written in units of Page.
[0059] GC (Garbage Collection): also known as garbage collection, refers to the process of transferring valid written data on a flash block in the SSD to other flash blocks and completely erasing the original flash block to obtain a new flash block that can be used for subsequent writing.
[0060] OP (Over-Provision): The reserved space in an SSD is usually the actual capacity of the SSD minus the user available capacity. User space is the space where users store user data, and reserved space is the capacity space that users cannot operate. The purpose of reserved space is to improve the performance of the SSD and extend the service life of the SSD.
[0061] Firmware: Firmware is the program in the chip that drives the chip to work. The firmware in the SSD is deeply developed based on the characteristics of NandFlash and the usage scenarios of the SSD. There are many algorithms in the firmware and the firmware development process is complicated. The entire firmware in the SSD can ensure the normal and stable operation of the SSD.
[0062] Buffer: Buffer is a memory area used to temporarily store data. Here it refers specifically to the data cache area in the SSD, which is mainly used to receive and temporarily store user data sent from the host to the SSD. This data will be stored in the NAND Flash later.
[0063] Write error: When the firmware in the SSD is running, the controller writes the data in the buffer to the block in the specific die of NandFlash. If there is a problem with the corresponding block, the corresponding die will report a write error to the controller, indicating that the data is not successfully stored in the block in NAND Flash. In this case, the firmware will perform special processing to ensure data integrity.
[0064] In the embodiment of the present invention, a method for quickly processing SSD flash memory block write errors is provided, in which the RG Block of the SSD is composed of a good block selected from part of the planes or all of the planes in each Die constituting the RGBlock. The formation method of the RG Block does not strictly stipulate that a Block must be selected on each Plane. Blocks may not be selected on a certain Plane or on multiple Planes to form the RG Block. In this way, the good blocks on each Plane in each Die can be fully utilized, thereby increasing OP.
[0065] The following is combined with Figure 1 and attached Figure 2 The method for quickly processing an SSD flash memory block write error proposed in an embodiment of the present invention is described in detail. The method comprises the following steps:
[0066] S1. When performing a write operation on the first RG Block, cache the data to be written into the cache unit of the preset first cache space according to the position layout of each block in the first RG Block, so that the position layout of the cache unit storing the data to be written in the first cache space is the same as the position layout of the block of the target RG Block;
[0067] like Figure 2 In the specific embodiment shown, the present invention presets Buffer0 as the first cache space and presets Buffer1 as the second cache space in the Buffer area, and pre-stores the data to be written in the first cache space and the second cache space. The arrangement of each cache unit in the first cache space and the second cache space corresponds to the arrangement of all dies and all planes in the die used for the component RG Block, and the storage capacity of each cache unit in the first cache space or the second cache space is the storage capacity of a page, so that the data to be written stored in the first cache space or the second cache space at one time can perform a write operation on all pages in a group of RG Blocks.
[0068] S2. When the data to be written in the first cache space is sequentially written into the first RG Page of the first RG Block, if a write error occurs, obtaining location information where the write error occurs, wherein the location information where the write error occurs includes location information of the first Block where the write error occurs and information of the first RG Page;
[0069] It should be noted that, after the data to be written is pre-stored in the first cache space, the data to be written in the first cache space is written into RG BlockM Page N. Here, in order to simplify the description, the Nth RGPage of RG BlockM is described as RG BlockM Page N. Afterwards, the data to be written is pre-stored in the first cache space again, and the data to be written in the first cache space is written into RG BlockM Page N+1. After all RG Pages in RG BlockM have completed the write operation, the write operation is performed on each RG Page in RG Block(M+1).
[0070] S3, determining a data migration rule for the data to be written pre-stored in the first cache space according to the location information where the write error occurs, and migrating the data to be written in the first cache space within the first cache space according to the data migration rule, and / or migrating the data to be written in the first cache space between the first cache space and a preset second cache space;
[0071] S4. Write the data to be written after the data in the first cache space is migrated into the second RG Page adjacent to the first RG Page; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, write the data to be written in the first cache space after the data is migrated into the second RG Page adjacent to the first RG Page, and write the data to be written migrated to the second cache space into the third RG Page adjacent to the second RG Page.
[0072] In an embodiment of the present invention, the second RG Page may belong to the same RG Block as the first RG Page, or may belong to a different RG Block from the first RG Page. The position correspondences are different, and the data migration rules for data migration of the data to be written pre-stored in the first cache space are different. Correspondingly, the third RG Page may belong to the same RG Block as the second RG Page, or may belong to a different RG Block from the second RG Page. The present invention uses the preset first cache space and second cache space for data migration and reorganization, so that the first RG Block with a write error can continue to perform write operations in the second RG Page without replacing the bad Block, thereby reducing the GC processing flow and ensuring the stability of SSD performance.
[0073] Specifically, in the embodiment of the present invention, determining the data migration rule for the to-be-written data pre-stored in the first cache space according to the location information where the write error occurs further includes the following steps:
[0074] S01. Determine whether the first RG Page is the last page in the first RG Block;
[0075] S02. If the first RG Page is not the last page in the first RG Block, the data migration rule is to migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0076] S03. If the first RG Page is the last page in the first RG Block, obtain the location layout of the Block of the second RG Block to which the second RG Page belongs, and determine the data migration rule according to the location layout of the Block of the second RG Block; wherein, determining the data migration rule according to the location layout of the Block of the second RG Block includes: migrating the data to be written in the first cache space within the first cache space; or migrating the data to be written in the first cache space within the first cache space, and migrating the data to be written in the first cache space between the first cache space and a preset second cache space.
[0077] Furthermore, in an embodiment of the present invention, if the first RG Page is not the last page in the first RG Block, the first Block in the second RG Page that cannot perform a write operation is the first Block in which a write error occurs. At this time, the data to be written in the cache unit corresponding to the position of the first Block in the first cache space cannot be successfully written into the second RGPage. Therefore, the data migration rule includes: using the data to be written in the cache unit corresponding to the position of the first Block in the first cache space as redundant data of the second RG Page, and migrating the redundant data of the second RG Page to the second cache space.
[0078] Furthermore, if the first RG Page is the last page in the first RG Block, the position layout of the blocks of the second RG Block may be different from that of the first RG Block, and thus a specific data migration rule needs to be determined according to the position layout of the blocks of the second RG Block.
[0079] In the embodiment of the present invention, determining the data migration rule according to the location layout of the Block of the second RG Block includes the following steps:
[0080] S031, obtaining the correspondence between the position of the cache unit in the first cache space where the data to be written is pre-stored and the position of the block in the second RG Block; taking the cache unit in the first cache space that corresponds to the block position in the second RG Block and does not store the data to be written as the migration-in position; taking the cache unit in the first cache space that does not correspond to the block in the second RG Block and stores the data to be written as the migration-out position;
[0081] It can be understood that the cache unit that corresponds to the Block position in the second RG Block and does not store data to be written can write the data to the second RG Page after caching the data to be written, so the data to be written can be cached again during the data migration process. The corresponding first cache space does not correspond to the Block position in the second RGBlock, and the cache unit that stores data to be written cannot write the data to the second RG Page, so the data to be written in such cache units needs to be migrated during the data migration process to avoid failure to write again.
[0082] S032: When the number of the migration-in positions is greater than or equal to the number of the migration-out positions, migrate the to-be-written data of the cache unit at the migration-out position in the first cache space to the cache unit at the migration-in position in the first cache space.
[0083] It can be understood that when the number of migration-in locations is greater than or equal to the number of migration-out locations, the first cache space can successfully cache all the data to be written, and each cache unit storing the data to be written will not fail to write when performing a write operation because its arrangement is different from the Block arrangement in the second RG Block.
[0084] S033. When the number of migration-in positions is less than the number of migration-out positions, the data to be written in each cache unit at the migration-out position in the first cache space is preferentially migrated to each cache unit at the migration-in position in the first cache space; after the data to be written are pre-stored in each cache unit at the migration-in position in the first cache space, the data to be written that have not been migrated in the migration-out position are used as redundant data of the second RG Page, and the redundant data of the second RG Page is migrated to the second cache space.
[0085] It can be understood that when the number of migration-in locations is less than the number of migration-out locations, the data to be written cached in the first cache space has exceeded the storage capacity of the second RG Page, and therefore part of the data needs to be migrated to the second cache space. In order to minimize the operation steps of data migration, the present invention only migrates data to locations with different block position layouts, and retains most of the data in the storage units with the same block position layout as the second RG Block, saving resource overhead for data migration.
[0086] Furthermore, since the data storage order and data storage location will change after the data is migrated, in an embodiment of the present invention, the data to be written after the data in the first cache space is migrated is written into the second RG Page adjacent to the first RG Page; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, the data in the first cache space after the data migration is written into the second RG Page adjacent to the first RG Page, and the data migrated to the second cache space is written into the third RG Page adjacent to the second RG Page, the method also includes: recording the distribution of the data to be written after the write operation is completed.
[0087] In addition, it should be noted that, in the embodiment of the present invention, migrating the redundant data of the second RG Page to the second cache space includes: acquiring the position layout of the Block of the third RG Block to which the third RG Page belongs; and migrating the redundant data of the second RG Page to a cache unit in the second cache space having the same position layout as the Block of the third RG Block.
[0088] The third RG Block can belong to the same RG Block as the second RG Block, or it can belong to a different RG Block from the second RG Block. Therefore, when caching the data to be written to the second cache space, it is necessary to determine the specific data migration location according to the location layout of the Block of the RG Block to which the third RGPage belongs.
[0089] Furthermore, the redundant data of the second RG Page is sequentially migrated to each cache unit corresponding to the Block of the third RG Block in the second cache space, and the cache unit corresponding to the Block of the third RG Block may be arbitrarily selected for storage, which is not limited in the present invention.
[0090] In addition, in order to make more full use of the storage space of the second cache space and the third RG Page, after migrating the redundant data of the second RGPage to the second cache space, the method further includes: continuing to pre-store the data to be written into the second cache space, so that each cache unit with the same position layout of the Block of the second cache space and the third RG Block is pre-stored with the data to be written.
[0091] The following is combined with Figure 2, the data migration rules of the embodiment of the present invention when the invention writes an error are described in detail. In order to facilitate the description of the present invention, the data volume of a Page is represented by a unit. In this specific embodiment, it is assumed that a die contains two planes, so the maximum data volume of an RG Page is 2(N+1)·unit. The position marked with unit* in the figure is the cache unit with pre-stored data to be written, and the blue position is the cache unit with pre-stored invalid data corresponding to the bad block position.
[0092] Furthermore, scenario 1 describes the situation when the first RG Page is not the last page in the first RG Block. When performing write operations on each RG Page in RG BlockM, the data to be written is first pre-stored in batches into buffer0, wherein the position of the cache unit pre-stored with the data to be written in buffer0 corresponds one to one to the position of the Block contained in RG BlockM.
[0093] Furthermore, when writing data to RG BlockM Page (N+1), the data in buffer0 is data2. When the firmware sends data2 to NAND Flash, the Block on Plane1 in Die2 reports a write error. The firmware receives the write error information, indicating that data2 is not successfully stored in NAND Flash. Data2 in buffer0 continues to be retained. The Block on Plane1 in Die2 reports a write error, that is, the Block becomes a bad block during runtime and data cannot be written any more. The data in unit5 in data2 cannot be directly written to RG BlockM in the original way. At this time, the data in RG BlockM Page (N+1) is first marked as invalid, and then flow1 is performed to move the data in unit5 from buffer0 to the corresponding position of Die0, Plane0 in buffer1.
[0094] Furthermore, after the data in unit 5 of data2 is migrated, the position of unit 5 in the original buffer0 is filled with dummy data (invalid data). At this time, the data in buffer0 is Figure 1 It is shown in the figure that "data2 has moved the data on the write error unit" and written the data into RG Block M Page (N+2). In addition, the data in buffer1 is directly written to RG Block M Page (N+3) according to flow2 in the figure. From then on, the entire write error handling process is completed.
[0095] It should be noted that at this time, the data to be written in Block PageN~0 on Die2 Plane1 is not subjected to GC processing, and these data can generally be read correctly. If they cannot be read correctly, the data can also be read correctly through RAID error correction.
[0096] Therefore, in the embodiment of the present invention, after obtaining the location information where the write error occurs, the method further includes: marking the first Block as a bad block and removing the first RG Block; marking the data in the first RG Page as invalid data, and retaining the data in each RG Page in the first RG Block that has been successfully written. This embodiment is applicable to other embodiments.
[0097] In the above specific embodiment, the firmware also needs to save the distribution of valid data in the RG Block, such as the data on Die1, Plane0 in RGBlockM PageN~0 is invalid, and the data on Die1, Plane0, Die2, Plane1 in RG BlockM Page (N+2) is invalid.
[0098] Scenario 2 describes the situation when the first RG Page is the last page in the first RG Block and the number of migration-in locations is less than the number of migration-out locations. In scenario 2, a write error occurs when the firmware writes data3 to RG Block M Page (N+4). Assuming that RG Block M Page (N+4) is the last page of the RG Block, in this case, it is necessary to consider switching to another valid RG Block to continue writing in the write error processing process.
[0099] Furthermore, the write error is located on Plane0 of Die(N-1) and DieN. The firmware will first mark the data in RGBlockM Page(N+4) as invalid, and then allocate RGBlock(M+1) for the subsequent data writing location. The figure shows that the location where data can be stored in RGBlock(M+1) (such as Page0) and the location where data to be written is stored in RG BlockM (such as Page(N+3)) have different layouts, which involves the "tidying up" process of data3.
[0100] Furthermore, the data sorting process is performed based on the principle of minimum number of operations. First, the location where data3 is written to RGBlockM Page (N+4) and the write error occurs is valid in RG Block (M+1) Page0, and no special processing is required for these two data locations. At this time, the data in unit0 is first moved to the location where Die1 and Plane0 were originally filled with Dummy Data, and then the data in unit3 is moved to buffer1. As shown in the figure, after the data in unit3 in buffer0 is moved, it is filled with Dummy Data. Then the data unit (2N+1) in data3 is moved to buffer1. As shown in the figure, the original location of unit (2N+1) in buffer0 is filled with Dummy Data. The final sorted data is shown in "data3 moved data exceeding the write length", and then the data is written to RG Block (M+1) Page0, and the remaining data is written from buffer1 to RG Block (M+1) Page1. At this point, the write error processing process in scenario 2 is completed, without GC and frequent bad block replacement operations, ensuring the stability of SSD performance.
[0101] Scenario 3 describes the situation when the first RGPage is the last page in the first RG Block, and the number of migration-in locations is greater than the number of migration-out locations. In Scenario 3, the RG Block that is subsequently switched can store more data locations relative to the RG Block where the write error occurs. The error handling process for this scenario will be simplified, involving only the movement of data in buffer0, where the write error is located on Plane0 of Die1. The firmware will first mark the data in RG Block (M+1) Page (N+4) as invalid, and then allocate RG Block (M+2) for subsequent data write locations. At this time, since Plane0 of Die1 of RGBlock (M+2) belongs to the block of RG Block (M+2), data migration is not required here. However, the Block on Plane1 of Die0 does not belong to RG Block (M+2). At this time, it is only necessary to migrate the data to be written on Plane1 of Die0 in the first cache space to Plane0 of Die0.
[0102] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0103] Figure 3 The structure diagram of a fast processing device for SSD flash memory block write errors according to an embodiment of the present invention is schematically shown. Figure 3 The fast processing device for SSD flash memory block write errors according to the embodiment of the present invention specifically includes an arrangement module 301, a write operation module 302 and a migration module 303, wherein:
[0104] Arrangement module 301, used for caching the data to be written into the cache unit of the preset first cache space according to the position layout of each block in the first RG Block when performing a write operation on the first RG Block, so that the position layout of the cache unit storing the data to be written in the first cache space is the same as the position layout of the block of the target RG Block;
[0105] A write operation module 302, configured to obtain location information of the write error if a write error occurs when sequentially writing the data to be written in the first cache space into the first RG Page of the first RG Block, wherein the location information of the write error includes location information of the first Block where the write error occurs and information of the first RG Page;
[0106] A migration module 303 is used to determine a data migration rule for the data to be written pre-stored in the first cache space according to the location information of the write error, and migrate the data to be written in the first cache space within the first cache space according to the data migration rule, and / or migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0107] The write operation module 302 is further used to write the data to be written after the data in the first cache space is migrated into the second RG Page adjacent to the first RG Page; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, the data to be written in the first cache space after the data is migrated is written into the second RG Page adjacent to the first RGPage, and the data to be written migrated to the second cache space is written into the third RG Page adjacent to the second RG Page.
[0108] Furthermore, the migration module includes:
[0109] A determination submodule, used to determine whether the first RG Page is the last page in the first RG Block;
[0110] a migration determination submodule, configured to, if the first RG Page is not the last page in the first RG Block, migrate the data to be written in the first cache space between the first cache space and a preset second cache space;
[0111] The migration determination submodule is further configured to obtain the position layout of the blocks of the second RG Block to which the second RG Page belongs if the first RG Page is the last page in the first RG Block, and determine the data migration rule according to the position layout of the blocks of the second RG Block.
[0112] Furthermore, the migration determination submodule is specifically used for, if the first RG Page is not the last page in the first RG Block, the data migration rule includes: using the data to be written in the cache unit corresponding to the first Block position in the first cache space as redundant data of the second RG Page, and migrating the redundant data of the second RG Page to the second cache space.
[0113] Furthermore, the migration determination submodule determines the data migration rule according to the location layout of the Block of the second RG Block, specifically including:
[0114] An acquisition submodule, used to acquire a correspondence between a position of a cache unit pre-stored with data to be written in the first cache space and a position of a Block of the second RG Block;
[0115] The migration determination submodule is used to use the cache unit that corresponds to the block position in the first cache space and the second RG Block and does not store the data to be written as the migration-in position; and use the cache unit that does not correspond to the block in the first cache space and the second RG Block and stores the data to be written as the migration-out position;
[0116] When the number of the migration-in positions is greater than or equal to the number of the migration-out positions, the to-be-written data of the cache unit at the migration-out position in the first cache space is migrated to the cache unit at the migration-in position in the first cache space.
[0117] When the number of migration-in positions is less than the number of migration-out positions, the data to be written in each cache unit at the migration-out position in the first cache space is preferentially migrated to each cache unit at the migration-in position in the first cache space; after the data to be written are pre-stored in each cache unit at the migration-in position in the first cache space, the data to be written that have not been migrated in the migration-out position are used as redundant data of the second RG Page, and the redundant data of the second RG Page is migrated to the second cache space.
[0118] Furthermore, the acquisition submodule is further used to acquire the position layout of the Block of the third RG Block to which the third RG Page belongs;
[0119] The migration submodule of the migration module 304 is further configured to migrate the redundant data of the second RG Page to a cache unit in the second cache space that has the same location layout as that of the Block of the third RG Block.
[0120] Furthermore, the device also includes a management module, which is used to mark the first Block as a bad block and remove the first RG Block after obtaining the location information of the write error; mark the data in the first RG Page as invalid data, and retain the data in each RG Page in the first RG Block that has been successfully written.
[0121] Furthermore, the device also includes a recording module, which is used to record the distribution of written data.
[0122] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0123] In addition, an embodiment of the present invention further provides an SSD device, which includes a storage controller, the storage controller includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the program. Figure 1 Alternatively, when the processor executes the computer program, the functions of each module / unit in the above-mentioned SSD flash memory block write error fast processing device embodiment are realized, for example Figure 3 The arrangement module 301, the write operation module 302 and the migration module 303 are shown.
[0124] In this embodiment, if the module / unit integrated in the SSD device is implemented in the form of 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, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.
[0125] The present embodiment provides a method, apparatus and SSD device for quickly processing write errors of SSD flash memory blocks. The RGBlock of the SSD is composed of a good block selected from part of the planes or all of the planes in each Die that constitutes the RG Block. The RGBlock is more flexible in its construction, which maximizes the OP of the SSD, extends the service life of the SSD and improves the performance of the SSD. When a write error message is received, the preset first cache space and second cache space are used for data migration and reorganization, so that the first RG Block with a write error can continue to be used without replacing the bad block, thereby reducing the GC processing flow and ensuring the stability of the SSD performance.
[0126] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0127] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0128] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, any one of the claimed embodiments may be used in any combination.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for quickly processing SSD write errors, characterized in that: The RG Block of the SSD is composed of selecting a good block from part of the planes or all of the planes in each Die constituting the RG Block, and the method includes: When performing a write operation on the first RG Block, the data to be written is cached in a cache unit of a preset first cache space according to the position layout of each block in the first RG Block, so that the position layout of the cache unit storing the data to be written in the first cache space is the same as the position layout of the blocks of the target RG Block; When the data to be written in the first cache space is sequentially written into the first RG Page of the first RG Block, if a write error occurs, obtaining location information where the write error occurs, wherein the location information where the write error occurs includes location information of the first Block where the write error occurs and location information of the first RG Page; Determine a data migration rule for the data to be written pre-stored in the first cache space according to the location information where the write error occurs, and migrate the data to be written in the first cache space within the first cache space according to the data migration rule, and / or migrate the data to be written in the first cache space between the first cache space and a preset second cache space; The data to be written after the data in the first cache space is migrated is written into the second RG Page adjacent to the first RG Page; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, the data to be written after the data in the first cache space is migrated is written into the second RG Page adjacent to the first RG Page, and the data to be written migrated to the second cache space is written into the third RG Page adjacent to the second RG Page.
2. The method according to claim 1, characterized in that: The step of determining a data migration rule for the data to be written pre-stored in the first cache space according to the location information of the write error comprises: Determine whether the first RG Page is the last page in the first RG Block; If the first RG Page is not the last page in the first RG Block, the data migration rule is to migrate the data to be written in the first cache space between the first cache space and a preset second cache space; If the first RG Page is the last page in the first RG Block, obtaining the location layout of the blocks of the second RG Block to which the second RG Page belongs, and determining the data migration rule according to the location layout of the blocks of the second RG Block; The determining of the data migration rule according to the location layout of the Block of the second RG Block includes: Migrating the data to be written in the first cache space within the first cache space; or, The data to be written in the first cache space is migrated within the first cache space, and the data to be written in the first cache space is migrated between the first cache space and a preset second cache space.
3. The method according to claim 2, characterized in that If the first RG Page is not the last page in the first RG Block, the data migration rule includes: The data to be written in the cache unit corresponding to the first Block position in the first cache space is used as redundant data of the second RG Page, and the redundant data of the second RG Page is migrated to the second cache space.
4. The method according to claim 2, characterized in that: The determining the data migration rule according to the location layout of the Block of the second RG Block includes: Obtaining a correspondence between a position of a cache unit pre-stored with data to be written in the first cache space and a position of a Block of the second RG Block; The cache unit that corresponds to the block position in the first cache space and the second RG Block and does not store the data to be written is used as the migration-in position; the cache unit that does not correspond to the block in the first cache space and the second RG Block and stores the data to be written is used as the migration-out position; When the number of migration-in positions is greater than or equal to the number of migration-out positions, migrating the to-be-written data of the cache unit at the migration-out position in the first cache space to the cache unit at the migration-in position in the first cache space; When the number of migration-in positions is less than the number of migration-out positions, the data to be written in each cache unit at the migration-out position in the first cache space is preferentially migrated to each cache unit at the migration-in position in the first cache space; after the data to be written are pre-stored in each cache unit at the migration-in position in the first cache space, the data to be written that have not been migrated in the migration-out position are used as redundant data of the second RG Page, and the redundant data of the second RG Page is migrated to the second cache space.
5. The method according to any one of claims 2 to 4, characterized in that: The migrating the redundant data of the second RG Page to the second cache space includes: Get the location layout of the Block of the third RG Block to which the third RG Page belongs; The redundant data of the second RG Page is migrated to a cache unit in the second cache space that has the same location layout as that of the Block of the third RG Block.
6. The method according to claim 5, characterized in that After migrating the redundant data of the second RG Page to the second cache space, the method further includes: The data to be written is continuously pre-stored in the second cache space, so that each cache unit having the same position layout as the Block of the third RG Block in the second cache space is pre-stored with the data to be written.
7. The method according to claim 1, characterized in that After obtaining the location information where the write error occurs, the method further includes: Mark the first block as a bad block and remove the first RG Block; The data in the first RG Page is marked as invalid data, and the data in each RG Page on which the write operation has been successfully completed in the first RG Block is retained.
8. A fast processing device for SSD flash memory block write errors, characterized in that: The RG Block of the SSD is composed of selecting a good block from part of the planes or all the planes in each Die constituting the RGBlock, and the device includes: An arrangement module, configured to cache the data to be written into a cache unit of a preset first cache space according to the position layout of each block in the first RG Block when performing a write operation on the first RG Block, so that the position layout of the cache unit storing the data to be written in the first cache space is the same as the position layout of the block of the target RG Block; an acquisition module, configured to acquire location information of the write error if a write error occurs when the data to be written in the first cache space is sequentially written into the first RGPage of the first RG Block, wherein the location information of the write error includes location information of the first Block where the write error occurs and location information of the first RG Page; a migration module, configured to determine a data migration rule for the data to be written pre-stored in the first cache space according to the location information of the write error, and migrate the data to be written in the first cache space within the first cache space according to the data migration rule, and / or migrate the data to be written in the first cache space between the first cache space and a preset second cache space; The write operation module is further used to write the data to be written after the data in the first cache space is migrated into the second RG Page adjacent to the first RGPage; if the data to be written in the first cache space is migrated between the first cache space and the preset second cache space, write the data to be written in the first cache space after the data is migrated into the second RG Page adjacent to the first RG Page, and write the data to be written migrated to the second cache space into the third RG Page adjacent to the second RG Page.
9. The device according to claim 8, characterized in that The migration module includes: A determination submodule, used to determine whether the first RG Page is the last page in the first RG Block; a migration determination submodule, configured to, if the first RG Page is not the last page in the first RG Block, migrate the data to be written in the first cache space between the first cache space and a preset second cache space; The migration determination submodule is further configured to, if the first RG Page is the last page in the first RG Block, obtain the location layout of the Block of the second RG Block to which the second RG Page belongs, and determine the data migration rule according to the location layout of the Block of the second RG Block; wherein determining the data migration rule according to the location layout of the Block of the second RG Block includes: Migrating the data to be written in the first cache space within the first cache space; or, The data to be written in the first cache space is migrated within the first cache space, and the data to be written in the first cache space is migrated between the first cache space and a preset second cache space.
10. An SSD device, characterized in that: The SSD device includes a storage controller, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Management method of memory block, write operation method of memory, and memory
CN113220508A
Bad block management method based on NAND Flash
CN113921071A
Asynchronous bad block management in NAND flash memory
US20130205072A1