Method, device, computer storage medium and terminal for realizing data storage processing
By determining the last written data storage page when Nand flash memory is powered off as the reference page, the affected storage page is processed, and the data instability caused by abnormal powered off in Nand Flash storage is solved, and the reliability of data storage is improved. stability.
Patent Information
- Application Number
- CN202011328864.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-24
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2040-11-24
AI Technical Summary
An abnormal power failure in Nand Flash storage causes unstable data storage, and error checking and correction failures are prone to occur during write operations, affecting the reliability of data storage.
When the Nand flash memory is powered back on after abnormal power failure, determine the last data storage page written in the block written at the abnormal power failure time as the reference page, determine the storage page affected by abnormal power failure, and migrate it into data Or write pre-set invalid data to reduce the impact of power failure on data storage.
Through this method, the impact of abnormal power failure on data storage is reduced, the stability of Nand flash memory and the reliability of data storage is improved, data loss is avoided, and user experience is improved.
Smart Images

Figure CN112433959B_ABST
Abstract
Description
Technical Field
[0001] This article relates to, but is not limited to, data storage technology, and in particular to a method, apparatus, computer storage medium, and terminal for implementing data storage processing. Background Technology
[0002] NAND flash memory is based on floating gate technology. A floating gate exists between the gate (control gate) and the drain. NAND flash memory can perform erase and program charging operations. Data is stored in NAND flash memory in the form of charge. The gate and the motherboard are insulated with an oxide film, so the charge can be retained for a long time and data can still be stored when there is no power.
[0003] If a block in NAND Flash experiences a power outage during a write operation, the block becomes extremely unstable. Data written to pages before the power outage and data written to subsequent pages are prone to Error Checking and Correction (ECC) failures during reading, resulting in data loss. While related technologies perform retry reads when an ECC failure occurs, ECC failures can still occur, impacting users' ability to store data using NAND Flash. To avoid the impact of power outages on data storage, some technicians stop write operations to blocks during a power outage. While this prevents data loss from subsequent pages, it also affects the utilization of storage resources.
[0004] How to reduce the impact of abnormal power outages on data storage has become a problem that needs to be solved. Summary of the Invention
[0005] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.
[0006] This invention provides a method, apparatus, computer storage medium, and terminal for data storage processing, which can reduce the impact of abnormal power outages on data storage.
[0007] This invention provides a method for implementing data storage processing, including:
[0008] When a NAND flash memory experiences an abnormal power failure and is powered on again, determine the storage page of the block where data was last written at the time of the abnormal power failure.
[0009] The storage page where the last written data was determined is used as the base page to determine the storage page affected by the abnormal power failure;
[0010] Perform data storage processing on the identified storage pages affected by abnormal power outages.
[0011] In one exemplary instance, before determining the storage page of the last written data in the block where data was written at the time of power failure, the method further includes:
[0012] Based on the running log information of the application loading the Nand flash memory, determine the block where the data was written at the moment of the abnormal power failure.
[0013] In one exemplary instance, determining the storage pages affected by the abnormal power outage includes:
[0014] The reference page and the first preset value page preceding the reference page are identified as the first storage page affected by the abnormal power outage and containing written data; and / or,
[0015] The second preset value page storage page following the reference page is determined as the second storage page affected by the abnormal power outage and without any data written to it.
[0016] In one exemplary instance, the first storage page includes:
[0017] All memory pages in the bit line where the reference page is located.
[0018] In one exemplary instance, the data storage processing of the identified power-loss-affected storage pages includes:
[0019] When the storage page affected by the abnormal power outage includes the first storage page, the data in the first storage page is migrated to the storage page that is not affected by the power outage.
[0020] When the storage page affected by the abnormal power outage includes the second storage page, pre-set invalid data is written into the second storage page.
[0021] In one exemplary instance, when the storage pages affected by the abnormal power outage include the first storage page and the second storage page, the data storage processing on the determined storage pages affected by the power outage includes:
[0022] In a pre-defined cache area, the data in the first storage page is cached;
[0023] Write pre-defined invalid data into the second storage page;
[0024] After writing the invalid data to the second storage page, the data in the cached first storage page is written.
[0025] On the other hand, embodiments of the present invention also provide a computer storage medium storing a computer program, which, when executed by a processor, implements the above-described method for data storage processing.
[0026] Furthermore, embodiments of the present invention also provide a terminal, comprising: a memory and a processor, wherein the memory stores a computer program; wherein,
[0027] The processor is configured to execute computer programs in memory;
[0028] When the computer program is executed by the processor, it implements the data storage processing method as described above.
[0029] Furthermore, embodiments of the present invention also provide an apparatus for implementing data storage processing, comprising: a first determining unit, a second determining unit, and a processing unit; wherein,
[0030] The first determining unit is set as follows: when the Nand flash memory is powered on again after an abnormal power failure, determine the storage page of the last data written in the block where the data was written at the time of the abnormal power failure.
[0031] The second determining unit is configured to: use the last written data storage page as the reference page to determine the storage page affected by the abnormal power failure;
[0032] The processing unit is configured to perform data storage processing on the identified storage pages affected by abnormal power loss.
[0033] In one exemplary instance, the second determining unit is configured as follows:
[0034] The reference page and the first preset value page preceding the reference page are identified as the first storage page affected by the abnormal power outage and containing written data; and / or,
[0035] The second preset value page storage page following the reference page is determined as the second storage page affected by the abnormal power outage and without any data written to it.
[0036] In this embodiment of the invention, the last page of data written in the block where data was written at the moment of abnormal power failure of the Nand flash memory is used as the reference page. After determining the storage page affected by the abnormal power failure, data storage processing is performed on the storage page affected by the abnormal power failure, thereby reducing the impact of abnormal power failure on data storage.
[0037] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the description, claims, and drawings. Attached Figure Description
[0038] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of the present invention and do not constitute a limitation on the technical solutions of the present invention.
[0039] Figure 1 This is a flowchart illustrating the data storage processing method according to an embodiment of the present invention;
[0040] Figure 2 This is a structural block diagram of an apparatus for implementing data storage processing according to an embodiment of the present invention. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.
[0042] The steps illustrated in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in a different order than that presented here.
[0043] Figure 1 This is a flowchart illustrating the data storage processing method implemented in an embodiment of the present invention, such as... Figure 1 As shown, it includes:
[0044] Step 101: When the NAND flash memory is powered on again after an abnormal power failure, determine the storage page where the last data was written in the block where the data was written at the time of the abnormal power failure.
[0045] In one exemplary instance, the embodiment of the present invention further includes, before step 101: determining the block in which data was written at the time of the abnormal power failure based on the running log information of the application loading the Nand flash memory.
[0046] In one exemplary instance, whether the Nand flash memory experienced an abnormal power failure can be determined by loading the running log information of the application running on the Nand flash memory.
[0047] It should be noted that obtaining operation log information, determining abnormal power failures based on the operation log information, and identifying the data blocks written at the time of the abnormal power failure from the operation log information can be implemented by referring to relevant technologies, and will not be elaborated here. After determining the data blocks written at the time of the abnormal power failure, the parameters for restoring the data in the blocks upon power-up can be used to determine the storage page for the last written data.
[0048] Step 102: Using the last page of data written to the determined storage page as the base page, determine the storage pages affected by the abnormal power outage;
[0049] In one exemplary instance, embodiments of the present invention determine storage pages affected by an abnormal power outage, including:
[0050] The reference page and the first preset value page preceding the reference page are identified as the first storage page affected by the abnormal power outage and containing written data; and / or,
[0051] The second preset value page after the base page is identified as the second storage page affected by the abnormal power outage that has not been written to.
[0052] In this embodiment of the invention, the storage page affected by abnormal power loss may include the first storage page, the second storage page, or both the first and second storage pages.
[0053] In one exemplary instance, the first storage page in this embodiment of the invention includes:
[0054] All memory pages in the bit line where the base page resides.
[0055] In one exemplary instance, the second preset value of the embodiment of the present invention can be a number greater than 36 but less than 208, determined by experiments; for example, around 100.
[0056] Step 103: Perform data storage processing on the identified storage pages affected by the abnormal power outage.
[0057] In one exemplary instance, data storage processing is performed on identified storage pages affected by a power outage, including:
[0058] When the storage page affected by the abnormal power outage includes the first storage page, the data in the first storage page is migrated to the storage page that is not affected by the power outage.
[0059] When the storage page affected by the abnormal power outage includes the second storage page, pre-defined invalid data is written into the second storage page.
[0060] In one exemplary instance, invalid data may include: invalid data identified by a preset identifier, such as data identified as invalid by metadata.
[0061] In one exemplary instance, when the storage pages affected by an abnormal power outage include a first storage page and a second storage page, data storage processing is performed on the determined storage pages affected by the power outage, including:
[0062] In a pre-defined cache area, cache the data in the first storage page;
[0063] Write pre-defined invalid data into the second storage page;
[0064] After writing invalid data to the second storage page, write the data to the cached first storage page.
[0065] In one exemplary instance, the cache region of this invention may include a pre-defined storage region located in static random access memory (SRAM) or dynamic random access memory (DRAM).
[0066] Since data cannot be written to a block of Nand flash memory if the first storage page has already been written to, further data writing is not allowed. To use subsequent storage pages for data writing, the second storage page cannot be idle. To avoid the impact of abnormal power outages on data writing and to maximize the utilization of Nand flash memory storage resources, this embodiment of the invention writes invalid data into the second storage page, embedding the data from the first storage page after the second storage page. This reduces the impact of abnormal power outages on data storage.
[0067] In this embodiment of the invention, the last page of data written in the block where data was written at the moment of abnormal power failure of the Nand flash memory is used as the reference page. After determining the storage page affected by the abnormal power failure, data storage processing is performed on the storage page affected by the abnormal power failure, thereby reducing the impact of abnormal power failure on data storage.
[0068] This invention also provides a computer storage medium storing a computer program, which, when executed by a processor, implements the above-described method for data storage processing.
[0069] This invention also provides a terminal, comprising: a memory and a processor, wherein the memory stores a computer program; wherein,
[0070] The processor is configured to execute computer programs in memory;
[0071] When a computer program is executed by a processor, it implements the data storage and processing methods described above.
[0072] Figure 2 This is a structural block diagram of a device for implementing data storage processing according to an embodiment of the present invention, as shown below. Figure 2 As shown, it includes: a first determining unit, a second determining unit, and a processing unit; wherein,
[0073] The first determining unit is set as follows: when the Nand Flash is powered on again after an abnormal power failure, determine the storage page of the last data written in the block where the data was written at the time of the abnormal power failure.
[0074] The second determining unit is configured to: use the last written data storage page as the reference page to determine the storage page affected by the abnormal power failure;
[0075] The processing unit is configured to perform data storage processing on the identified storage pages affected by abnormal power loss.
[0076] In this embodiment of the invention, the last page of data written in the block where data was written at the moment of abnormal power failure of the Nand flash memory is used as the reference page. After determining the storage page affected by the abnormal power failure, data storage processing is performed on the storage page affected by the abnormal power failure, thereby reducing the impact of abnormal power failure on data storage.
[0077] In one exemplary instance, the first determining unit of this embodiment of the invention is further configured as follows:
[0078] Based on the runtime log information of the application loading the Nand Flash, determine the block where data was written at the moment of the abnormal power failure.
[0079] In one exemplary instance, the second determining unit of this embodiment of the invention is configured as follows:
[0080] The reference page and the first preset value page preceding the reference page are identified as the first storage page affected by the abnormal power outage and containing written data; and / or,
[0081] The second preset value page after the base page is identified as the second storage page affected by the abnormal power outage that has not been written to.
[0082] In one exemplary instance, the first storage page of this embodiment of the invention includes:
[0083] All memory pages in the bit line where the base page resides.
[0084] In one exemplary instance, the processing unit of this embodiment of the invention is configured as follows:
[0085] When the storage page affected by the abnormal power outage includes the first storage page, the data in the first storage page is migrated to the storage page that is not affected by the power outage.
[0086] When the storage page affected by the abnormal power outage includes the second storage page, pre-defined invalid data is written into the second storage page.
[0087] In one exemplary instance, the processing unit of this embodiment of the invention is configured as follows:
[0088] In a pre-defined cache area, cache the data in the first storage page;
[0089] Write pre-defined invalid data into the second storage page;
[0090] After writing invalid data to the second storage page, write the data to the cached first storage page.
[0091] The following application examples briefly illustrate the embodiments of the present invention. These application examples are only used to illustrate the present invention and are not intended to limit the scope of protection of the present invention.
[0092] Application Examples
[0093] This application example incorporates the data storage processing of the embodiments of the present invention into the abnormal power failure process. The processing performed after an abnormal power failure includes:
[0094] Step 1: When an abnormal power failure occurs during the writing of data to the Nand Flash, the block that is currently writing data is defined as Block N by loading the application's runtime log information of the Nand Flash.
[0095] Referring to relevant technologies, after an abnormal power failure of the Nand Flash, data writing will continue to be processed according to the characteristics of the Nand Flash.
[0096] Step 2: When restoring data upon power-on, determine the largest storage page in Block N where data was written, i.e., the last storage page where data was written.
[0097] Step 3: Use the last page of data to be written as the base page, read the data of all pages in the wordline where the base page is located, and write them into the pre-defined cache area;
[0098] In one exemplary instance, the cache area pre-defined in this embodiment of the invention may include: a storage area in a pre-defined static random access memory (SRAM) and dynamic random access memory (DRAM);
[0099] Step 4: Write invalid data into the second preset value page storage page after the base page.
[0100] Step 5: Write the data cached in the cache area to the storage page following the storage page where invalid data was written.
[0101] This application example stores written data affected by abnormal power outages in areas unaffected by power outages; it then writes invalid data to areas affected by abnormal power outages where no data has been written. This avoids storing valid data in storage pages affected by abnormal power outages, reducing the impact of abnormal power outages on data storage. After writing data from the cache area to storage pages following those containing invalid data, subsequent storage pages are also unaffected by abnormal power outages and can continue to be written. This invention is applicable to abnormal power outages caused by factors such as ambient temperature, wear and tear, and endurance, preventing data loss due to block instability caused by abnormal power outages, thus improving the stability of NAND flash memory operation. This enhances the user experience when using NAND flash memory for data storage.
[0102] "Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is commonly understood in the art..." As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
Claims
1. A method for implementing data storage processing, comprising: When the NAND flash memory is powered on again after abnormal power failure, the storage page where the last data is written in the block where the data is written at the time of abnormal power failure is determined; Using the storage page to which data was last written as a reference page, determining the storage page affected by the abnormal power failure; Performing data storage processing on the determined storage pages affected by the abnormal power failure; Wherein, the determining of the storage page affected by the abnormal power failure includes: determining a reference page and a first preset value page storage page before the reference page as the first storage page affected by the abnormal power failure to which data has been written; determining a second preset value page storage page after the reference page as the second storage page affected by the abnormal power failure to which data has not been written; the first storage page includes: all storage pages in the bit line where the reference page is located; the performing of data storage processing on the determined storage page affected by the power failure includes: when the storage page affected by the abnormal power failure includes the first storage page, migrating the data in the first storage page to the storage page not affected by the power failure; when the storage page affected by the abnormal power failure includes the second storage page, writing preset invalid data in the second storage page; when the storage page affected by the abnormal power failure includes the first storage page and the second storage page, the performing of data storage processing on the determined storage page affected by the power failure includes: caching the data in the first storage page in a preset cache area; writing preset invalid data in the second storage page; after writing the invalid data to the second storage page, writing the data in the cached first storage page.
2. The method according to claim 1, characterized in that Before determining the storage page where the last data is written in the block where the data is written at the time of power failure, the method further includes: The block to which the data is written at the time of the abnormal power failure is determined according to the operation log information of the application loaded with the Nand flash memory.
3. A computer storage medium, wherein a computer program is stored in the computer storage medium, and when the computer program is executed by a processor, the method for realizing data storage processing according to any one of claims 1 to 2 is implemented.
4. A terminal, comprising: A memory and a processor, wherein the memory stores a computer program; wherein, The processor is configured to execute the computer program in the memory; When the computer program is executed by the processor, the method for implementing data storage processing according to any one of claims 1 to 2 is implemented.
5. A device for implementing data storage processing, comprising: A first determining unit, a second determining unit and a processing unit; wherein, The first determining unit is configured to: when the Nand flash memory is powered on again after abnormal power failure, determine the storage page where the data is last written in the block where the data is written at the time of abnormal power failure; The second determination unit is configured to: determine the storage page affected by the abnormal power failure by taking the storage page to which the data was last written as the reference page, wherein the determination of the storage page affected by the abnormal power failure includes: determining the reference page and the first preset value page storage page before the reference page as the first storage page affected by the abnormal power failure to which data has been written; determining the second preset value page storage page after the reference page as the second storage page affected by the abnormal power failure to which data has not been written; the first storage page includes: all storage pages in the bit line where the reference page is located; The processing unit is configured to: perform data storage processing on the determined storage page affected by the abnormal power failure; Among them; the data storage processing of the determined storage page affected by the power outage includes: when the storage page affected by the abnormal power outage includes the first storage page, migrating the data in the first storage page to the storage page not affected by the power outage; when the storage page affected by the abnormal power outage includes the second storage page, writing pre-set invalid data in the second storage page; when the storage page affected by the abnormal power outage includes the first storage page and the second storage page, the data storage processing of the determined storage page affected by the power outage includes: caching the data in the first storage page in a pre-set cache area; writing pre-set invalid data in the second storage page; after writing the invalid data to the second storage page, writing the data in the cached first storage page.
