A flash memory mode conversion method, system, and apparatus
By associating resource reservations and conversion progress with transaction identifiers, the accuracy issues of resource management and power failure recovery during flash mode conversion are resolved, achieving precise resource management and data consistency assurance.
Patent Information
- Application Number
- CN202611576524.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-13
- Publication Date
- 2026-11-10
AI Technical Summary
In existing technologies, during the flash memory mode conversion process, the granularity of resource management and the accuracy of power-off recovery are difficult to meet the high reliability requirements, resulting in unused resources not being accurately reclaimed and occupied resources not being accurately identified.
By associating resource reservations and conversion progress with transaction identifiers, conversion transaction descriptors and batch resource reservation records are established to ensure precise management of resource occupation and release, and accurate recovery after power failure.
It enables precise management of resource usage and accurate recovery after power failure, improves the reliability of flash memory mode conversion, and ensures data consistency and accurate resource recovery.
Smart Images

Figure CN123067798A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of non-volatile memory control technology, and specifically to a flash memory mode conversion method, system, and apparatus. Background Technology
[0002] In non-volatile flash memory devices, to improve write performance, some physical blocks are often configured in pSLC (pseudo-single-level cell) mode to handle high-frequency host writes; to increase storage density, static or cold data is migrated to TLC (triple-level cell) mode. With changing data activity and storage space management requirements, the storage controller needs to dynamically switch physical blocks between pSLC and TLC modes to balance performance, capacity, and lifespan. This switching process involves reading valid data from the source physical block, writing to the destination physical block, updating the logical mapping, and reclaiming the source physical block; it is a critical management operation of the Flash Translation Layer (FTL).
[0003] Existing patent application CN114327269A (A data migration method and storage device for a flash conversion layer) proposes a data migration scheme based on logical unit page granularity. This scheme copies valid data page by page between the source physical block and the destination physical block, and updates the logical mapping table all at once after all data is copied, and then releases the source physical block. The aim is to reduce the impact on foreground host requests during migration by dividing the migration process into two stages: data transport and mapping switching.
[0004] However, in the process of cross-batch mode conversion, when multiple migration batches and foreground host requests are executed concurrently, the existing solution lacks a batch-based resource reservation and occupancy boundary recording mechanism bound to transactions. The correspondence between reserved resources and specific conversion batches is unclear. When the device is powered off and then powered on again, the controller cannot determine the occupancy status and release boundary of each batch of resources based on persistent records. This results in unused resources not being accurately reclaimed and occupied resources not being accurately reclaimed. As a result, the conversion process cannot meet the requirements of a high-reliability storage system in terms of resource management granularity and power-off recovery accuracy. Summary of the Invention
[0005] To address the shortcomings of existing technologies where controllers cannot determine the occupancy status and release boundaries of each batch of resources based on persistent records, resulting in unused resources not being accurately reclaimed and occupied resources not being accurately reclaimed, this invention proposes a flash memory mode conversion method, system, and device. By associating resource reservations and conversion progress with transaction identifiers, it achieves precise management of resource occupancy and accurate recovery after power failure, thereby solving the problems existing in the prior art.
[0006] A flash memory mode conversion method is applied to a storage controller having a first mode physical block set, a second mode physical block set, and a flash memory conversion layer. During the conversion of flash memory physical blocks from the first mode to the second mode, the storage controller performs the following steps: In response to the mode conversion request, the first mode physical block set is determined as the source physical block set, the second mode physical block set is determined as the destination physical block set, and the range of valid data to be processed is determined, so as to establish a conversion transaction descriptor with a transaction identifier, and to establish a batch resource reservation record associated with the transaction identifier for each conversion batch. When the transformation transaction descriptor is in an executable transaction state and the batch resource reservation record meets the resource conditions, valid data is read from the first mode physical block set, data is written to the second mode physical block set and verification is performed, and the completion bitmap is updated according to the execution result; after the completion bitmap covers the entire valid data range, the updated logical mapping is written to the mapping table of the flash conversion layer, and the mapping association information and commit flag are persistently recorded. Based on the persistence results, release the physical blocks and unused resources that have been converted in the first mode physical block set to complete the physical block conversion from the first mode to the second mode.
[0007] Furthermore, the transformation transaction descriptor includes at least a source physical block set, a destination physical block set, a transformation direction, a valid data range, a completion bitmap, and a transaction status; the transformation direction includes a transformation from a single-bit storage mode to a multi-bit storage mode; the transaction status includes a ready state, a copying state, a verification state, a commit state, and a rollback state.
[0008] Furthermore, the batch resource reservation record includes at least the destination block reservation quantity, command buffer reservation quantity, data buffer reservation quantity, background write quota, and maximum data processing quantity; the maximum data processing quantity is determined based on at least two of the following: destination block remaining quantity, command buffer remaining quantity, data buffer remaining quantity, background write quota, and foreground reserved resource quantity.
[0009] Furthermore, the resource conditions include ensuring that the remaining amount of the destination block, command buffer, data buffer, and background write quota all meet the requirements of the current conversion batch; when any resource does not meet the resource conditions, the creation of a new conversion batch is prohibited; for reserved resources with the transaction identifier but not used for data writing, they are released according to the corresponding batch resource reservation record.
[0010] Furthermore, the completed bitmap is only updated when the source data is successfully read, the destination data is successfully written, and the destination data is successfully verified.
[0011] Furthermore, after the device is powered on again, the storage controller performs committed transaction confirmation or uncommitted resource reclamation based on the transformation transaction descriptor with the same transaction identifier, the completion bitmap, the mapping association information, and the commit flag.
[0012] Furthermore, when the storage controller is powered on and restored, if the transformation transaction descriptor with the same transaction identifier is in a committed state and the mapping association information matches the commit flag, then the data in the second mode physical block set and the updated mapping are acknowledged; otherwise, the mapping before the transformation is maintained, and the uncommitted destination block occupied and reserved resources associated with the transaction identifier are reclaimed or isolated.
[0013] The present invention also includes a flash memory mode conversion system applied to a storage controller having a first mode physical block set, a second mode physical block set, and a flash memory conversion layer. During the conversion of flash memory physical blocks from the first mode to the second mode, the storage controller includes: A module is established to respond to a mode conversion request, determine the first mode physical block set as the source physical block set, the second mode physical block set as the destination physical block set, and determine the effective data range to be processed, so as to establish a conversion transaction descriptor with a transaction identifier, and establish a batch resource reservation record associated with the transaction identifier for each conversion batch. The mapping commit module is used to read valid data from the first mode physical block set, write data to the second mode physical block set and perform verification when the transformation transaction descriptor is in an executable transaction state and the batch resource reservation record meets the resource conditions, and update the completion bitmap according to the execution result; after the completion bitmap covers the entire range of valid data, write the updated logical mapping into the mapping table of the flash conversion layer, and persistently record the mapping association information and commit flag. The mode conversion module is used to release the physical blocks and unused resources that have been converted in the first mode physical block set according to the persistence result, so as to complete the physical block conversion from the first mode to the second mode.
[0014] The present invention also includes a flash memory mode conversion computer device, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the flash memory mode conversion method.
[0015] The present invention also includes a readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, are used to perform the steps of the flash memory mode conversion method.
[0016] This invention provides a flash memory mode conversion method, which has the following beneficial effects: This invention associates and binds conversion transaction descriptors with batch resource reservation records through a unified transaction identifier. It uses a completion bitmap to track data migration progress and maps the commit status using mapping association information and commit markers. This ensures that resource usage and transaction execution progress at each stage of the mode conversion can be traced back to the same transaction identifier. Specifically, the batch resource reservation record establishes clear resource usage boundaries for each conversion batch. The device can accurately reclaim unused and occupied resources based on persistent records. The completion bitmap is updated only after all read, write, and verification operations are successful, and source block release is strictly constrained to be after the mapping association information and commit markers are persisted, ensuring that source block release does not precede mapping commit and preventing data loss. Therefore, after power-on, the device can accurately confirm committed transactions or reclaim uncommitted resources based on persistent information under the same transaction identifier, overcoming the limitation of only being able to reclaim or retain all resources. This comprehensively improves the reliability of flash memory mode conversion in terms of resource management granularity, data consistency assurance, and power-off recovery accuracy. Attached Figure Description
[0017] Figure 1 This is a control structure diagram of the conversion transaction and batch resource reservation in an embodiment of the present invention; Figure 2 This is a flowchart illustrating the execution of a conversion transaction in an embodiment of the present invention; Figure 3 This is a state diagram of the transformation transaction descriptor in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0019] In existing solutions for mode conversion scenarios involving multiple batches and concurrent execution, the destination block, command buffer, data buffer, and write quota may be cross-occupied across different batches. If the persistent information only records the overall conversion status without recording the resource ownership, completion scope, and mapping commit boundaries of each batch, it becomes difficult to distinguish between committed and uncommitted data during power failure recovery. This could lead to inaccurate reclamation of destination block resources or unclear timing of source block release. Existing solutions lack a clearly disclosed mechanism for jointly persisting and determining the recovery of batch resource reservations, completion bitmaps, and mapping commit markers for the same conversion transaction.
[0020] Based on this, the present invention proposes a flash memory mode conversion method based on conversion transaction descriptors and batch resource reservation, which is applied to a storage controller having a first mode physical block set, a second mode physical block set, and a flash memory conversion layer; the first mode and the second mode refer to different programming states, storage bits per storage cell, or corresponding available page organization methods adopted by the same flash memory chip or storage array; this embodiment uses the conversion from pseudo-single-level storage cell mode pSLC to three-level storage cell mode TLC as an example for illustration; the first mode and the second mode can also be other storage modes with different reliability, capacity, or write characteristics.
[0021] The controller responds to a request to convert the source physical block from pSLC mode to TLC mode. This invention establishes a conversion transaction descriptor with a transaction identifier; for each conversion batch, a batch resource reservation record associated with the transaction identifier is established; when the transaction status and reserved resources meet the conditions, the controller performs valid data reading, destination block writing and verification, and updates the completion bitmap; after the completion bitmap covers the entire valid data range, the controller sequentially updates the logical mapping, writes mapping association information and commit flags, updates the transaction status, and releases the source block; upon power-on recovery, the transaction status is determined based on the descriptor associated with the same transaction identifier, the completion bitmap, mapping association information, and commit flags, and mapping confirmation or uncommitted resource reclamation is performed.
[0022] like Figure 1 As shown, the method specifically includes the following steps: S1. Respond to the mode conversion request and establish a conversion transaction descriptor with a transaction identifier.
[0023] After responding to the mode conversion request, the controller determines the source physical block set, the destination physical block set, and the range of valid data to be processed, and creates a transaction identifier and establishes a conversion transaction descriptor.
[0024] Preferably, the conversion transaction descriptor records at least the transaction identifier, conversion direction, current processing position, completion bitmap, transaction status, mapping association information, and commit flag, and persists it to a ready state before the destination data is written; the conversion direction includes the conversion from single-bit storage mode to multi-bit storage mode; the transaction identifier is used to associate the conversion transaction descriptor with the corresponding batch resource reservation record; the transaction status includes ready state, copy state, verification state, commit state, and rollback state; the ready state is persisted before the destination data is written.
[0025] The completion bitmap corresponds one-to-one with the valid data range of the transformation transaction. Each bit in the bitmap corresponds to a data unit to be transformed or a data range with a preset granularity. The controller only updates the bit to the completion state and persists it when the corresponding data unit has completed source data reading, destination location writing, and post-write verification. During power-down recovery, the completion bitmap is used to determine the incomplete range and the completed but not yet committed range. If the completion bitmap does not cover the entire valid data range, logical mappings should not be switched or source blocks should not be released based on it.
[0026] S2. For each conversion batch of the conversion transaction descriptor, establish a batch resource reservation record associated with the transaction identifier.
[0027] Before each conversion batch begins, the controller obtains the remaining amount of the destination block, the remaining amount of the command buffer, the remaining amount of the data buffer, the amount of reserved resources in the foreground, and the amount of write quota in the background. Based on these resources, the controller determines the maximum amount of data to be processed in this batch and establishes a batch resource reservation record that includes the transaction identifier, batch number, the amount of reservation of the destination block, the amount of reservation of the command buffer, the amount of reservation of the data buffer, and the amount of write quota in the background. The maximum amount of data to be processed is determined based on at least two of the remaining amount of the destination block, the remaining amount of the command buffer, the remaining amount of the data buffer, the amount of write quota in the background, and the amount of reserved resources in the foreground.
[0028] Preferably, when any resource does not meet the resource conditions, the creation of a new conversion batch is prohibited; for reserved resources with the transaction identifier but not used for data writing, they are released according to the corresponding batch resource reservation record.
[0029] S3. Filter valid data from the source block.
[0030] Based on the current logical mapping, the controller identifies valid data units still referenced by logical addresses within the scope determined by the transformation transaction descriptor, and adds the valid data units to the scope of this batch; invalid data units and data units that have been updated and overwritten are not written to the destination physical block.
[0031] S4. Read and temporarily store valid data.
[0032] The controller reads valid data units from the source physical block according to the scope of this batch, and uses the reserved command buffer to save the command context and the reserved data buffer to temporarily store the read data.
[0033] Data units that fail to be read are not updated in the completed bitmap; the logical mapping before the conversion is preserved.
[0034] S5. Write to the destination physical block and verify.
[0035] The controller writes the temporary data to the destination physical block and verifies the destination data after writing. If the destination data writing fails or the verification fails, the corresponding data unit is not updated and the conversion transaction remains in an uncommitted state.
[0036] S6. When the source data is successfully read, the destination data is successfully written, and the destination data is successfully verified, update the bitmap and return the batch resources.
[0037] For data units where the source data is successfully read, the destination data is successfully written, and the destination data verification is successful, the controller updates the completion bitmap in the transformation transaction descriptor. After the batch ends, the controller returns unused command buffers, data buffers, and background write quotas; subsequent batches re-reserve resources.
[0038] S7. Determine the conditions for transaction completion.
[0039] The controller checks whether the completed bitmap covers all valid data ranges defined by the transformation transaction descriptor; if it does not cover all valid data ranges, the next transformation batch is established when the resource conditions are met; if it covers all valid data ranges, the mapping commit step is initiated.
[0040] S8. Commit the mapping and release the source block.
[0041] The controller updates the logical mapping, persists the mapping association information, and the commit flag sequentially, and updates the transformation transaction descriptor to the committed state. Specifically, the controller first persists the mapping association information between the destination block and the logical address, then writes the commit flag, and finally updates the transaction descriptor to the committed state. During recovery, the data in the destination block and the new mapping are only recognized if the transaction descriptor is in a committed completed state and the commit flag, mapping association information, and their checksums are all consistent; otherwise, the mapping before the transformation is maintained, and the destination block is treated as an uncommitted resource.
[0042] The controller releases the source physical blocks and corresponding batch resources that have completed the transformation only when the commit status, commit flag, and mapping association information are valid.
[0043] S9. Perform power-on recovery determination.
[0044] After the device is powered on again, the controller reads the transformation transaction descriptor with the same transaction identifier, batch resource reservation record, completion bitmap, commit flag and mapping association information.
[0045] If the transaction descriptor is in a committed state and the mapping association information matches the commit flag, then the destination physical block and the updated logical mapping are accepted; otherwise, the logical mapping before the conversion is maintained, and uncommitted occupied and reserved resources of the destination physical block associated with the transaction identifier are reclaimed or isolated.
[0046] This invention associates effective data transformation, batch resource usage, logical mapping commit, and source block release under the same transaction identifier, resulting in the following technical effects: (1) The logical address switches between the source physical block and the destination physical block according to the transaction status: when the completion bitmap does not cover the entire range of valid data, the logical mapping remains pointing to the source physical block; when the completion bitmap covers the entire range of valid data and the commit flag is valid, the logical mapping switches to the destination physical block. Therefore, for the same logical address, during the conversion process, it only corresponds to the original data in the source physical block or the data that has been verified in the destination physical block, and does not correspond to the location of data that has not been written.
[0047] (2) Shared resources for background conversion have verifiable upper limits of occupancy: The batch resource reservation record specifies the reservation amount of physical blocks, command buffers, data buffers and background write quotas for this batch, and associates them with transaction identifiers and batch numbers. The controller executes batch processing and resource release according to the record, so that the reserved resources can be mapped to specific conversion transactions and specific batches, and the resources reserved in the foreground are not used as background conversion resources.
[0048] (3) Power-off recovery uses the conversion transaction as the processing unit: After the device is powered on again, the controller determines whether the transaction has been committed based on the conversion transaction descriptor associated with the same transaction identifier, the completion bitmap, the mapping association information, and the commit flag, and processes the destination physical block occupancy and reserved resources associated with the transaction accordingly. The recovery process does not use the task progress in memory before the power outage as a criterion.
[0049] (4) The release time of the source physical block and the commit time of the logical mapping are constrained by the same commit flag: the source physical block only enters the releasable state after the commit flag and mapping association information are valid; in the preparation state, copying state or verification state, the source physical block maintains its original data state. The source physical block enters the free block management when the destination physical block has not yet become the current mapping location.
[0050] Based on the above methods, the present invention proposes the following embodiments: Example 1: Establishing a conversion transaction descriptor After responding to the mode conversion request, the controller determines the pSLC source block set and TLC destination block set to be converted; the controller determines the valid data range still referenced by the logical address based on the mapping information and creates a transaction identifier; then it creates a conversion transaction descriptor in the PREPARE state, and persistently records the transaction identifier, source block set, destination block set, conversion direction, valid data range, current processing position and verification information; subsequent batches are executed according to the range determined by the conversion transaction descriptor associated with the transaction identifier.
[0051] like Figure 2As shown, after receiving a conversion request, the controller first establishes a conversion transaction descriptor in a ready state, determining the source and destination block ranges; subsequently, it allocates the current batch's command buffer, data buffer, and write quota. When resources are insufficient, new batches are stopped from entering while the existing mapping is retained; when resources are sufficient, valid data is filtered for the current batch, and reads, destination TLC block writes, and post-write verification are performed. When the current batch verification is complete, the corresponding completion bitmap is registered and unused resources are returned; if all valid data is not yet complete, the next batch is entered and resource reservation is performed again; if all valid data is complete, the logical mapping is updated and a commit flag is written, then the source pSLC block and batch resources are released. If any batch is interrupted or post-write verification fails, the existing mapping is maintained and uncommitted resources are reclaimed.
[0052] like Figure 3 As shown, the transformation transaction sequentially goes through the preparation, replication, verification, and commit states. The preparation state indicates that the transaction scope, source block, destination block, and resource reservation information have been persisted; the replication state indicates that data transformation is being performed batch by batch; the verification state indicates that all target data has been verified after writing; and the commit state indicates that the mapping association information and commit flags have been persisted. If a read / write failure or abnormal interruption occurs during replication, or if a power outage or commit verification failure occurs after verification but before commit, the transaction enters the rollback state, maintaining the original mapping and reclaiming uncommitted resources. Upon power-up recovery, the preparation, replication, and verification states are all treated as uncommitted transactions; only when the transaction is in the commit state and the association information verification is consistent is it allowed to enter the resource release boundary.
[0053] Example 2: Establishing Batch Resource Reservation Records Before each batch is executed, the controller reads the remaining amount of the destination block, the remaining amount of the command buffer (cmd_buf), the remaining amount of the data buffer (data_buf), the amount of reserved resources in the foreground, and the write quota in the background. Based on this, it determines the maximum amount of data to be processed in this batch and establishes a batch resource reservation record containing the transaction identifier and batch number. If any of the destination block, command buffer, data buffer, or background write quota is insufficient, a new conversion batch is not created. Unused reserved resources are released according to the resource reservation record of this batch, and the conversion transaction descriptor remains in its original state.
[0054] Example 3: Effective Data Conversion and Completion of Bitmap The controller sequentially reads source data and writes destination data for valid data units within the reserved range. Invalid data units are not included in the destination block write. Each data range is marked as complete only after successful source data reading, successful destination data writing, and successful destination data verification. If a read failure, write failure, or verification failure occurs, the data range remains in an incomplete state.
[0055] Example 4: Mapping Commit and Source Block Release Once the bitmap covers the entire valid data range, the controller will update the transaction descriptor to the VERIFIED state. The controller will then write the destination block address to the corresponding mapping location, persist the mapping association information and commit flag, and update the descriptor to the COMMITTED state. The pSLC source block that no longer contains valid data is only allowed to be released when both the COMMITTED state and the commit association information are valid. This order ensures that the source block release does not occur earlier than the destination data verification and mapping commit.
[0056] Example 5: Determination after equipment interruption After the device is powered on again, the controller reads the transformation transaction descriptor, commit flag, and mapping association information. If the descriptor is in the COMMITTED state, and the commit flag and mapping association information pass verification, the data in the TLC destination block and the updated mapping are acknowledged, and the source block is released. If the descriptor is in the PREPARE, COPYING, or VERIFIED state, or any verification fails, the mapping before the transformation is maintained, uncommitted data in the destination block is not effective on the host, and the destination block is reclaimed or isolated according to the resource status. Thus, a transformation transaction after an interruption can be processed according to the committed or uncommitted rules.
[0057] Based on the same inventive concept, this invention also proposes a flash memory mode conversion system, applied to a storage controller having a first mode physical block set, a second mode physical block set, and a flash memory conversion layer, comprising: The module is established to respond to a mode conversion request, determine the first mode physical block set as the source physical block set, the second mode physical block set as the destination physical block set, and determine the effective data range to be processed, so as to establish a conversion transaction descriptor with a transaction identifier, and establish a batch resource reservation record associated with the transaction identifier for each conversion batch.
[0058] The mapping commit module is used to read valid data from the first mode physical block set, write data to the second mode physical block set and perform verification when the transformation transaction descriptor is in an executable transaction state and the batch resource reservation record meets the resource conditions. The module updates the bitmap based on the execution result. After the bitmap covers the entire range of valid data, the updated logical mapping is written to the mapping table of the flash conversion layer, and the mapping association information and commit flag are persistently recorded.
[0059] The mode conversion module is used to release the physical blocks and unused resources that have been converted in the first mode physical block set according to the persistence result, so as to complete the physical block conversion from the first mode to the second mode.
[0060] The present invention also proposes a flash memory mode conversion computer device, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the flash memory mode conversion method.
[0061] The present invention also proposes a readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, are used to perform the steps of a flash memory mode conversion method.
[0062] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A flash memory mode conversion method, applied to a storage controller having a first mode physical block set, a second mode physical block set, and a flash memory conversion layer, characterized in that, During the transition of a flash memory physical block from the first mode to the second mode, the storage controller performs the following steps: In response to the mode conversion request, the first mode physical block set is determined as the source physical block set, the second mode physical block set is determined as the destination physical block set, and the range of valid data to be processed is determined, so as to establish a conversion transaction descriptor with a transaction identifier, and to establish a batch resource reservation record associated with the transaction identifier for each conversion batch. When the transformation transaction descriptor is in an executable transaction state and the batch resource reservation record meets the resource conditions, valid data is read from the first mode physical block set, data is written to the second mode physical block set, and verification is performed; the bitmap is updated according to the execution result. After the bitmap covers the entire valid data range, the updated logical mapping is written into the mapping table of the flash conversion layer, and the mapping association information and commit flag are persistently recorded. Based on the persistence results, release the physical blocks and unused resources that have been converted in the first mode physical block set to complete the physical block conversion from the first mode to the second mode.
2. The flash memory mode conversion method according to claim 1, characterized in that, The transformation transaction descriptor includes at least a source physical block set, a destination physical block set, a transformation direction, a valid data range, a completion bitmap, and a transaction status; the transformation direction includes a transformation from a single-bit storage mode to a multi-bit storage mode; the transaction status includes a ready state, a copy state, a verification state, a commit state, and a rollback state.
3. The flash memory mode conversion method according to claim 1, characterized in that, The batch resource reservation record includes at least the destination block reservation amount, command buffer reservation amount, data buffer reservation amount, background write quota, and maximum data processing amount; the maximum data processing amount is determined based on at least two of the following: destination block remaining amount, command buffer remaining amount, data buffer remaining amount, background write quota, and foreground reserved resource amount.
4. The flash memory mode conversion method according to claim 1, characterized in that, The resource conditions include that the remaining amount of the destination block, command buffer, data buffer, and background write quota all meet the requirements of the current conversion batch; when any resource does not meet the resource conditions, the creation of a new conversion batch is prohibited; for reserved resources with the transaction identifier that have not been used for data writing, they are released according to the corresponding batch resource reservation record.
5. The flash memory mode conversion method according to claim 1, characterized in that, The completed bitmap is updated only when the source data is successfully read, the destination data is successfully written, and the destination data is successfully verified.
6. The flash memory mode conversion method according to claim 1, characterized in that, After the device is powered on again, the storage controller performs committed transaction confirmation or uncommitted resource reclamation based on the transformation transaction descriptor with the same transaction identifier, the completion bitmap, the mapping association information, and the commit flag.
7. The flash memory mode conversion method according to claim 6, characterized in that, It also includes that when the storage controller is powered on and restored, if the transformation transaction descriptor with the same transaction identifier is in a committed state and the mapping association information matches the commit flag, then the data in the second mode physical block set and the updated mapping are accepted; otherwise, the mapping before the transformation is maintained, and the uncommitted destination block occupied and reserved resources associated with the transaction identifier are reclaimed or isolated.
8. A flash memory mode conversion system, applied to a storage controller having a first mode physical block set, a second mode physical block set, and a flash memory conversion layer, characterized in that, During the transition of a flash memory physical block from a first mode to a second mode, the storage controller includes: A module is established to respond to a mode conversion request, determine the first mode physical block set as the source physical block set, the second mode physical block set as the destination physical block set, and determine the effective data range to be processed, so as to establish a conversion transaction descriptor with a transaction identifier, and establish a batch resource reservation record associated with the transaction identifier for each conversion batch. The mapping commit module is used to read valid data from the first mode physical block set, write data to the second mode physical block set and perform verification when the transformation transaction descriptor is in an executable transaction state and the batch resource reservation record meets the resource conditions, and update the completion bitmap according to the execution result; after the completion bitmap covers the entire range of valid data, write the updated logical mapping into the mapping table of the flash conversion layer, and persistently record the mapping association information and commit flag. The mode conversion module is used to release the physical blocks and unused resources that have been converted in the first mode physical block set according to the persistence result, so as to complete the physical block conversion from the first mode to the second mode.
9. A flash memory mode conversion computer device, characterized in that, include: A memory, a processor, and a computer program stored in the memory, wherein the processor, when executing the computer program, implements the steps of the flash memory mode conversion method according to any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program, the computer program including program instructions, which, when executed by a processor, are used to perform the steps of the flash memory mode conversion method according to any one of claims 1-7.
Citation Information
Patent Citations
Data erasing mode setting method and system, electronic equipment and storage medium
CN114327269A
