Data storage method, data storage device and electronic device
By distinguishing the importance of data and using different verification protection methods for storage, the problem of waste of storage space caused by separate storage areas is solved and efficient utilization of storage space is achieved.
Patent Information
- Application Number
- CN202210702235.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-06-21
AI Technical Summary
In the prior art, setting up a separate storage area using a single storage unit results in insufficient available capacity and inability to effectively utilize the storage space, especially wasting space when storing important data.
By distinguishing the importance of data, different verification protection methods are used to store important data. Important data is stored in the first verification protection method with high stability, while non-important data is stored in the second verification protection method with dynamic adjustment of storage space.
It realizes that while ensuring the stability of important data, it makes full use of storage space and avoids waste of storage space.
Smart Images

Figure CN114911424B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data storage, and specifically relates to a data storage method, a data storage device, an electronic device, a readable storage medium, and a chip. Background Art
[0002] With the development of storage technology, there are different types of storage cells, such as single cell (SLC) and multi-cell (MLC). Different types of storage cells have their own advantages and disadvantages. In general, with the continuous development of technology, the number of stacked layers gradually increases, and the number of bytes that can be stored in a unit storage cell increases, which has the advantage of lower cost. However, it also brings about the problem of reduced memory data retention ability and more fragile storage data stability. Especially when storing some more important data, the defects are more obvious. In the existing technology, it is usually necessary to divide an independent storage area separately and use a single storage unit for storage. However, in actual operation, the above method will lead to a significant reduction in available capacity, and when data does not need to be stored as a priority, it will cause this part to be unable to store ordinary data, wasting storage space. Summary of the Invention
[0003] The purpose of the embodiments of the present application is to provide a data storage method, a data storage device and an electronic device, which can solve the problem of using a single storage unit to establish a separate storage area, resulting in insufficient available capacity and unusable storage space resulting in waste.
[0004] In a first aspect, an embodiment of the present application provides a data storage method, which includes: receiving data information to be stored; judging whether the data information requires important storage, and generating a first judgment result; when the first judgment result is yes, storing the data information in a first verification protection mode, otherwise storing the data information in a second verification protection mode; wherein the storage space used to store verification data in the first verification protection mode is larger than the storage space used to store verification data in the second verification protection mode.
[0005] In second aspect, an embodiment of the present application provides a data storage device, including: a receiving module for receiving data information to be stored; a judgment module for judging whether the data information requires important storage and generating a first judgment result; a storage module for storing the data information in a first verification protection mode when the first judgment result is yes, otherwise storing the data information in a second verification protection mode; wherein the storage space used to store verification data in the first verification protection mode is larger than the storage space used to store verification data in the second verification protection mode.
[0006] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method of the first aspect.
[0007] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0008] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.
[0009] In an embodiment of the present application, by distinguishing the data information that needs to be stored, data of different importance can be stored in different verification protection modes, and more important data can be stored in a first verification protection mode with high stability. When this part of the data does not need to be protected, it can be stored in a common second verification protection mode, freeing up the associated space, so that the storage space can be fully utilized. Specifically, when storing data, it is necessary to first receive the data information that needs to be stored locally, and judge the data information to determine whether it needs to be stored as important. If necessary, it will be protected in a first verification protection mode with higher data protection capabilities and a larger storage space required for verification data, with stability as the first premise. Regardless of whether it is determined that the data information does not need to be stored as important at the beginning, or after storing it in the first verification protection mode, it is considered that the data is not important, the first verification protection mode can be converted to the second verification protection mode, and the second verification protection mode with a smaller storage space for identification code verification data can be used for storage, so that more data can be stored. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic diagram showing a flow chart of a data storage method according to an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram showing a flow chart of a data storage method according to an embodiment of the present application is shown;
[0012] Figure 3 A schematic diagram showing a flow chart of a data storage method according to an embodiment of the present application is shown;
[0013] Figure 4 A schematic diagram showing a flow chart of a data storage method according to an embodiment of the present application is shown;
[0014] Figure 5A schematic diagram showing a flow chart of a data storage method according to an embodiment of the present application is shown;
[0015] Figure 6 A schematic structural diagram of a data storage device according to an embodiment of the present application is shown;
[0016] Figure 7 A schematic structural diagram of an electronic device according to an embodiment of the present application is shown;
[0017] Figure 8 A schematic structural diagram of an electronic device according to an embodiment of the present application is shown;
[0018] Figure 9 A schematic diagram showing a flow chart of a data storage method according to an embodiment of the present application is shown;
[0019] Figure 10 A schematic diagram of a storage block structure when storing data in a second verification protection mode is shown;
[0020] Figure 11 A schematic diagram of a storage block structure when data is stored in a first verification protection mode is shown.
[0021] in, Figure 7 and Figure 8 The corresponding relationship between the reference numerals and component names is as follows:
[0022] 100: electronic device; 101: radio frequency unit; 102: network module; 103: audio output unit; 104: input unit; 1041: graphics processor; 1042: microphone; 105: sensor; 106: display unit; 1061: display panel; 107: user input unit; 1071: touch panel; 1072: other input devices; 108: interface unit; 1109: memory; 1110: processor. DETAILED DESCRIPTION
[0023] The following will be combined with the accompanying drawings in the embodiments of this application to clearly describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0024] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0025] The following is combined with Figures 1 to 11 , the data storage method and device, electronic device, readable storage medium and chip provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0026] This embodiment provides a data storage method, such as Figure 1 Shown, including:
[0027] Step S102: receiving data information to be stored;
[0028] Step S104: determining whether the data information requires important storage, and generating a first determination result;
[0029] Step S106: When the first judgment result is yes, the data information is stored in the first verification protection mode; otherwise, the data information is stored in the second verification protection mode.
[0030] The message notification method provided in this embodiment mainly distinguishes the data information that needs to be stored, and can store data of different importance in different verification protection methods. The more important data can be stored in a first verification protection method with high stability. When this part of the data does not need to be protected, it can be stored in an ordinary second verification protection method, thereby releasing the associated space and making full use of the storage space.
[0031] Specifically, when storing data, the data to be stored must first be received locally and the data must be judged to determine whether it requires critical storage. If so, it will be protected using the first verification protection method, which has higher data protection capabilities and a larger storage space for identification code verification data, with stability as the primary prerequisite. Regardless of whether the data is initially determined not to require critical storage, or if the data is deemed unimportant after being stored using the first verification protection method, the first verification protection method can be switched to the second verification protection method, which uses a smaller storage space for identification code verification data, allowing for more data to be stored.
[0032] Those skilled in the art can understand that the first verification protection mode and the second verification protection mode include single-layer storage (i.e., SLC, Single-Level Cell), multi-layer storage (i.e., MLC, Multi-Level Cell), three-layer storage (i.e., TLC, Trinary-Level Cell) and four-layer storage (i.e., QLC, Quad-Level Cell), etc.
[0033] Among them, the stability of storage using SLC is higher than that using TLC / QLC.
[0034] In a specific embodiment, the first check protection mode is to store in SLC mode, and the second check protection mode is to store in TLC mode. Based on the difference in storage principles between SLC and TLC, after converting SLC to TLC, the usable capacity can be tripled.
[0035] The solution mentioned in this application can dynamically adjust the verification capability of the memory. There is no need to set up special space to store important data. Only a small amount of space is needed to improve the stability of data storage and the ECC verification capability.
[0036] It should be added that, in this solution, the minimum operation unit for data storage is a block (ie, Block), and the relevant storage capacity can be dynamically adjusted to improve the utilization rate of storage space.
[0037] Furthermore, if Figure 2 As shown, before receiving the data information to be stored, it also includes: step S101: adding identification code information to the original data to generate the data information to be stored; judging whether the data information needs to be stored, including: step S1042: reading the identification code information in the data information; step S1044: when the identification code information is consistent with the set comparison identification information, the data information is stored in the first verification protection mode, otherwise the data information is stored in the second verification protection mode.
[0038] By adding corresponding identification code information to the original data before receiving the data information to be stored, it is convenient for subsequent screening of the data information. That is, the identification code information added to the more important data is different from the identification code information added to the ordinary data. It can even be that only the important data needs to add the identification code, while the ordinary data only has the original data, thereby achieving distinction.
[0039] In other words, in one embodiment, if the original data is more important, identification code information will be added to it when writing, and then the data information will be regenerated. If the original data is not important, the identification code information will not be added to it when writing.
[0040] In another embodiment, if the original data is more important, an identification code information will be added to it when writing, and then the data information will be regenerated. If the original data is not important, another identification code information will be added to it when writing, and then the data information will be regenerated.
[0041] It can be understood that the latter embodiment occupies more space because a storage space for identification code information is added for each type of data.
[0042] On the basis of writing specific identification code information into the data information in advance, when making an important judgment on the data information, that is, when judging whether the data information needs to be stored as important, the identification code information pre-written in the data information will be read. If it is determined that the read identification code information is consistent with the comparison identification information, it can be considered that the data information currently associated with the identification code information needs to be stored as important and is stored in the first verification protection mode. Otherwise, it does not need to be stored as important, that is, it is stored in the second verification protection mode.
[0043] It can be understood that the identification code information is written into the data information in advance, and the information is mainly compared with the pre-set control identification information during judgment. Only after the comparison is successful will it be considered necessary to store the information.
[0044] In addition, during this process, it also has the function of detecting whether there is a jump, that is, when writing, a unique ECC identification code (that is, identification code information) will be generated. When reading, the data and the ECC signature will be sent to the paper main controller together, and a new ECC identification code will be generated. By comparing the two identification codes, if they are the same, it is determined that the data is correct. If they are different, it means that there is a jump in the data, and the corresponding algorithm needs to be used to correct the jump data, so as to ensure that the original data is not interfered with after the identification code information is written.
[0045] Furthermore, before the step of storing the data information in the first verification protection mode, it also includes: determining the average number of erase and write times of the memory storing the data information; determining the corresponding verification protection mode according to the average number of erase and write times; wherein the verification protection mode includes the first verification protection mode.
[0046] When storing more important data using the first verification protection mode, different verification protection modes can be determined based on the average number of erase and write cycles of the memory. Specifically, based on the wear and tear of the memory over its lifespan, multiple verification protection modes with varying data protection capabilities are pre-set, including the first verification protection mode. By taking the memory lifespan into account, a dynamic verification standard can be implemented. Specifically, when the average number of erase and write cycles is low, a verification protection mode with relatively weaker data protection capabilities can be selected for data storage, while when the average number of erase and write cycles is high, a verification protection mode with stronger data protection capabilities can be selected for data storage.
[0047] It should be added that no matter which verification protection method is selected, its data protection capability is greater than that of the second verification protection method.
[0048] It should be noted that the data storage method provided in the embodiments of the present application can be executed by a data storage device or a control module in the data storage device for executing the data storage method. In the embodiments of the present application, the data storage device provided in the embodiments of the present application is described by taking the data storage device executing the data storage method as an example.
[0049] Furthermore, if Figure 3 As shown, combined Figure 11 A storage device for storing data information includes multiple storage pages, each storage page includes an associated main data storage space and a verification data storage space, the data capacity of the main data storage space is greater than the data capacity of the verification data storage space, and the data information is stored in a first verification protection mode, including: step S1062: generating first verification data based on the original data; step S1064: storing the original data and at least part of the first verification data in the main data storage space.
[0050] The storage device itself has multiple storage pages for storing data, each of which includes a check data storage space and an interconnected main data storage space. The main data storage space has a larger data capacity. When storing data information in the first check protection mode, the first check data is mainly generated based on the original data, and then the original data and part of the first check data are directly stored in the main data storage space. It can be understood that when storing with a higher stability standard, the capacity of the first check data is larger and cannot be stored in the check data storage space. Therefore, by storing it together with the original data in the main data storage space, data storage with higher storage stability can be achieved.
[0051] More specifically, the data capacity of the verification data storage space is 64B, and the data capacity of the main data storage space is 2KB.
[0052] Furthermore, generating first verification data based on the original data includes: encrypting the original data multiple times to obtain the first verification data.
[0053] The first verification data is formed by encrypting the original data at least twice, generally twice encrypted. After one encryption, an encrypted verification code is formed, and after another two encryptions, an encrypted verification code with a larger capacity is formed, that is, the first verification data is formed.
[0054] Generally, the size of the first verification data formed after multiple encryptions is 128B, which exceeds the 64B of the verification data storage space. 16 first verification data can be stored together in a 2KB main data storage space.
[0055] Furthermore, storing the original data and at least part of the first verification data in the main data storage space specifically includes: storing the first verification data in the main data storage space of multiple storage pages, and no data is stored in the verification data storage space of the multiple storage pages.
[0056] It should be noted that the first verification data generated based on the original data will be stored in multiple storage pages when stored, and only stored in the main data storage space of the storage page. The verification data storage space cannot store any data due to its small capacity.
[0057] Furthermore, if Figure 4 As shown, combined Figure 10 The storage device for storing data information includes multiple storage pages, each storage page includes a main data storage space and a verification data storage space, the data capacity of the main data storage space is greater than the data capacity of the verification data storage space, and the data information is stored in a second verification protection mode, including: step S1066: generating second verification data based on the original data; step S1068: storing the original data in the main data storage space, and storing the second verification data in the verification data storage space.
[0058] The storage device itself has multiple storage pages for storing data, and each storage page includes a check data storage space and an interconnected main data storage space. The main data storage space has a larger data capacity. When storing data information in the second check protection mode, the second check data is mainly generated based on the original data, and then the original data is stored in the main data storage space, and the second check data is stored in the check data storage space. It can be understood that when storing with a lower stability standard, the capacity of the second check data is smaller and sufficient to be stored in the check data storage space. Therefore, by storing it in the check data storage space and storing the original data in the main data storage space, data storage with lower storage stability but less space can be achieved.
[0059] More specifically, the data capacity of the verification data storage space is 64B, and the data capacity of the main data storage space is 2KB.
[0060] Furthermore, generating the second verification data according to the original data specifically includes: encrypting the original data once to obtain the second verification data.
[0061] The second verification data is formed by encrypting the original data once. The second verification data formed after the encryption once has a smaller capacity.
[0062] Generally, the size of the first verification data formed after a single encryption is 64B, and can be directly stored in the verification data storage space.
[0063] Furthermore, it also includes: data information stored in a first verification protection method is stored in a first storage area, and data information stored in a second verification protection method is stored in a second storage area; second verification data is generated based on the original data stored in the first storage area, the original data is stored in the main data storage space in the first storage area, and the second verification data is stored in the verification data storage space in the first storage area, so that the first storage area is converted into the second storage area.
[0064] When storing data normally, the storage device is mainly divided into two storage areas, namely the first storage area and the second storage area. The first storage area is used to store more important data information, that is, data information stored in the first verification protection method, and the second storage area is used to store relatively unimportant data information, that is, data information stored in the second verification protection method. When the data information originally considered to be more important changes and the user believes that it is not important at the moment and hopes to have more storage space, the first storage area will be converted to the second storage area. Specifically, the original data originally stored in the first storage is first encrypted once to generate the second verification data, and then the original data and the second verification data are respectively stored in the main data storage space and the associated verification data storage space of the first storage area, so that there is data in the verification data storage space of part of the first storage area. At this time, the part of the first storage area is converted to the second storage area.
[0065] It can be understood that if you want to convert the second storage area into the first storage area, you can do the reverse operation, that is, generate first verification data based on the original data stored in the second storage area, and then store both the original data and the first verification data in the main data storage space in the second storage area, and no data is stored in the verification data storage space, thereby converting the second storage area into the first storage area.
[0066] In addition, when performing data storage, especially when the capacity of the stored data information is greater than the data capacity of a single storage page, it also includes: when the byte size of the first verification data is greater than the capacity size of the verification data storage space, determining the main data storage space of the first number of storage pages stored in the storage device; and storing the set of the first verification data with the first number in the main data storage space of a storage page.
[0067] For some data information that has been determined to be important and stored in the first verification protection mode as previously described, if it is subsequently determined that the data does not require key protection, that is, if no key protection instruction has been received, the data information will be deleted from the original storage location, thereby saving storage space. In addition, since the data is not important but still wanted to be retained by the user, it will be transferred to other locations for storage, that is, exported to other storage blocks.
[0068] In this solution, the main focus is on the classified storage of first verification data when storing large-capacity data. Specifically, the byte size of the first verification data is larger than the verification data storage space and occupies more space, so it needs to be stored in the main data storage space. However, although the byte size of the first verification data is larger, it cannot be completely filled compared to the main data storage space. In order to improve the utilization rate of space, multiple first verification data can be stored together in the main data storage space. The specific number can be determined according to the byte size of the first verification data and the capacity of the main data storage space. For example, if the byte size of the first verification data is 128B and the main data storage space is 2KB, 16 first verification data can be stored in one main data storage space.
[0069] When the byte size of the second verification data is not greater than the capacity of the verification data storage space associated with the main data storage space in the memory, the second verification data is correspondingly stored in the verification data storage space associated with the original data.
[0070] For the classified storage of the second verification data when storing small-capacity data, the second verification data can be stored in the verification data storage space and does not occupy the main data storage space.
[0071] It mainly utilizes the main data storage space and check data storage space in the memory, among which the check data storage space has fewer bytes and is invisible to the user. For example, the nominal 2KB page storage structure is usually 2KB of main data storage space (i.e. Main area) + 64B of check data storage space (i.e. Spare area).
[0072] Typically, a page has a capacity of 2KB, and a block has 64 pages. When writing a page, the original data is stored in the Main area. During the writing process, a unique ECC code is created as parity information and stored in the spare area, thereby generating a new ECC code (i.e., the first parity data or the second parity data).
[0073] An embodiment of the present application also provides a data storage device, including a first storage area and a second storage area, wherein data information stored in a first verification protection mode is stored in the first storage area, and data information stored in a second verification protection mode is stored in the second storage area; wherein the storage space used to store verification data in the first verification protection mode is larger than the storage space used to store verification data in the second verification protection mode.
[0074] Furthermore, the first storage area and the second storage area can be converted into each other.
[0075] Furthermore, second verification data is generated based on the original data stored in the first storage area, the original data is stored in the main data storage space in the first storage area, and the second verification data is stored in the verification data storage space in the first storage area, so that the first storage area is converted into the second storage area.
[0076] Furthermore, the first storage area includes multiple storage pages, each storage page includes associated main data storage space and verification data storage space, and the data capacity of the main data storage space is greater than the data capacity of the verification data storage space; the data information stored in the first verification protection mode includes original data and first verification data generated based on the original data, and the original data and the first verification data are both stored in the main data storage space of the first storage area.
[0077] Furthermore, the first verification data is obtained by encrypting the original data multiple times.
[0078] Furthermore, the first verification data is stored in the main data storage space of the plurality of storage pages, and the verification data storage space of the plurality of storage pages does not store data.
[0079] Furthermore, the second storage area includes a plurality of storage pages, each storage page includes an associated main data storage space and a verification data storage space, the data capacity of the main data storage space is greater than the data capacity of the verification data storage space; the data information stored in the second verification protection mode includes original data and second verification data generated based on the original data, the original data is stored in the main data storage space, and the second verification data is stored in the verification data storage space. Figure 5 As shown, an embodiment of the present application provides a data storage device 900. The data storage device includes a receiving module 901, a judging module 902 and a storage module 903.
[0080] Among them, the receiving module 901 is used to receive data information to be stored; the judging module 902 is used to judge whether the data information needs to be stored and generate a first judgment result; the storage module 903 is used to store the data information in a first verification protection mode when the first judgment result is yes, otherwise the data information is stored in a second verification protection mode.
[0081] The data protection capability of the first verification protection mode is greater than that of the second verification protection mode, and the identification code verification data storage space of the first verification protection mode is greater than that of the second verification protection mode.
[0082] Furthermore, if Figure 6 As shown, it also includes: a writing module 904, which is used to add identification code information to the original data before receiving the data information to be stored to generate the data information to be stored.
[0083] Furthermore, the judgment module 902 is used to read the identification code information in the data information; if the identification code information matches the set comparison identification information, the data information needs to be stored, otherwise it does not need to be stored.
[0084] Furthermore, the data storage device includes multiple storage pages, each storage page includes an associated main data storage space and a verification data storage space, and the data capacity of the main data storage space is greater than the data capacity of the verification data storage space; the storage module 903 is also used to generate first verification data based on the original data, and store the original data and at least part of the first verification data in the main data storage space; or the storage module is used to generate second verification data based on the original data, store the original data in the main data storage space, and store the second verification data in the verification data storage space.
[0085] Furthermore, the judgment module 902 is further configured to judge whether the data information has received a key protection instruction, generate a second judgment result, and when the second judgment result is negative, delete the data information and export it to other storage blocks.
[0086] Furthermore, the storage module 903 is specifically configured to determine an average erasure and write count of the memory storing data information, and determine a corresponding verification protection mode according to the average erasure and write count.
[0087] Furthermore, the storage module 903 is configured to generate first verification data based on the original data; and store both the original data and at least a portion of the first verification data in the main data storage space.
[0088] Furthermore, the storage module 903 is used to encrypt the original data multiple times to obtain first verification data.
[0089] Furthermore, the storage module 903 is configured to store the first verification data in the main data storage space of the plurality of storage pages, and the verification data storage space of the plurality of storage pages does not store data.
[0090] Furthermore, the storage module 903 is configured to generate second verification data based on the original data; store the original data in the main data storage space, and store the second verification data in the verification data storage space.
[0091] Furthermore, the storage module 903 is used to perform a single encryption on the original data to obtain second verification data.
[0092] Furthermore, the storage module 903 is used to store data information stored in a first verification protection mode in a first storage area, and store data information stored in a second verification protection mode in a second storage area; generate second verification data based on the original data stored in the first storage area, store the original data in the main data storage space in the first storage area, and store the second verification data in the verification data storage space in the first storage area, so that the first storage area is converted into the second storage area.
[0093] The data storage device in the embodiments of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an ATM, or an kiosks, etc., which are not specifically limited in the embodiments of the present application.
[0094] The data storage device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0095] The data storage device provided in the embodiment of the present application can realize Figures 1 to 4 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0096] Alternatively, as Figure 7As shown, an embodiment of the present application also provides an electronic device 100, including a processor 1110, a memory 1109, and a program or instruction stored in the memory 1109 and executable on the processor 1110. When the program or instruction is executed by the processor 1110, the various processes of the embodiment of the above-mentioned data storage method are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0097] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0098] Figure 8 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
[0099] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101 , a network module 102 , an audio output unit 103 , an input unit 104 , a sensor 105 , a display unit 106 , a user input unit 107 , an interface unit 108 , a memory 1109 , and a processor 1110 .
[0100] Those skilled in the art will understand that the electronic device 100 may also include a power source (such as a battery) to power each component, and the power source may be logically connected to the processor 1110 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system. Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be repeated here.
[0101] The input unit 104 is used to receive data information to be stored.
[0102] Processor 1110 is used to determine whether the data information needs to be stored importantly and generate a first judgment result; when the first judgment result is yes, the data information is stored in a first verification protection mode, otherwise the data information is stored in a second verification protection mode.
[0103] By distinguishing the data information that needs to be stored, data of different importance can be stored in different verification protection methods. The more important data can be stored in the first verification protection method with high stability. When this part of the data does not require key protection, it can be stored in the ordinary second verification protection method, freeing up the associated space and making full use of the storage space.
[0104] Optionally, the processor 1110 is further configured to implement the following steps: before receiving the data information to be stored, adding identification code information to the original data to generate the data information to be stored.
[0105] Read the identification code information in the data information; if the identification code information matches the set comparison identification information, the data information needs to be stored, otherwise it does not need to be stored.
[0106] Determine whether the data information has received the key protection instruction and generate a second judgment result; when the second judgment result is no, delete the data information and store it in a second verification protection mode.
[0107] The processor 1110 is further configured to determine whether the data information has received a key protection instruction after storing the data information in the first verification protection mode, and generate a second determination result; when the second determination result is negative, delete the data information and export it to other storage blocks.
[0108] Furthermore, the processor 1110 is further configured to determine an average erase / write count of the memory storing data information; and determine a corresponding verification protection mode according to the average erase / write count.
[0109] The processor 1110 is further configured to generate first verification data based on the original data; and store the original data and at least a portion of the first verification data in the main data storage space.
[0110] The original data is encrypted multiple times to obtain first verification data.
[0111] The first verification data is stored in the main data storage space of the plurality of storage pages, and the verification data storage space of the plurality of storage pages does not store data.
[0112] The processor 1110 is further configured to generate second verification data based on the original data; store the original data in the main data storage space, and store the second verification data in the verification data storage space.
[0113] The original data is encrypted once to obtain the second verification data.
[0114] Processor 1110 is also used to store data information stored in a first verification protection mode in a first storage area, and store data information stored in a second verification protection mode in a second storage area; generate second verification data based on the original data stored in the first storage area, store the original data in the main data storage space in the first storage area, and store the second verification data in the verification data storage space in the first storage area, so that the first storage area is converted into the second storage area.
[0115] It should be understood that in an embodiment of the present application, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and an operating stick, which will not be repeated here. The memory 1109 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1110 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understood that the modem processor may not be integrated into the processor 1110.
[0116] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned data storage method embodiment is implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0117] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0118] An embodiment of the present application further provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data storage method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0119] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0120] This application also provides a specific data storage method, such as Figure 9As shown, it includes: step S202: writing data; step S204: judging whether key protection is required; if so, executing step S206: storing data in ECC1; step S208: judging whether key protection is not required; if so, executing step S210: exporting data and erasing the original storage block to release storage space; if not, continuing to execute step S206; when the judgment in step S204 is no, executing step S212: storing data in ECC2.
[0121] Among them, in step S202, the relevant attributes of the data to be written can be set in advance, such as setting account / password / important system data and other information, adding an attribute of important data, and the system automatically identifies and determines whether important protection is required when writing data.
[0122] Step S204 determines whether key protection is required based on the previously set attributes. A manually selected data option is added, allowing users to manually select whether key protection is required for data other than those set by the system when saving. If the user selects key protection, step 3 is automatically executed; otherwise, step 6 is executed.
[0123] Step S206: ECC1 is an enhanced type of verification protection, which has a greater data protection capability than general storage data and requires a larger storage space for identification code verification data.
[0124] In step S208, the user can manually select whether to cancel the key protection of certain data to release the space occupied by the enhanced ECC storage.
[0125] In step S210, when the data does not need to be protected, the data is stored in other blocks with ordinary ECC2 checksum. At this time, the original stored data is erased to release storage space.
[0126] In step S212, the data is stored in other blocks again using the common ECC2 checksum, and the required storage space is reduced.
[0127] In a specific embodiment, the Page structure of the NAND memory when it leaves the factory is divided into the Main area (i.e., the main data storage space) and the Spare area (i.e., the verification data storage space). The Spare area is invisible to the user and is not within the nominal capacity range. For example, the Page storage structure of a nominal 2KB size is usually 2KB (Main area) + 64B (Spare area). When writing data, the original data will be saved in the Main area, and the ECC check code of the data will be saved in the Spare area.
[0128] For example, a page has a capacity of 2KB and a block has 64 pages:
[0129] The ECC2 verification method is as follows:
[0130] When writing a 2KB page, the data passes through the ECC engine, which creates a unique ECC checksum. This generated ECC checksum is stored in the corresponding spare area. When the data needs to be read, the data and the ECC signature are sent to the main controller, which also generates a new ECC checksum. The main controller compares the two ECC checksums. If they match, the data is correct. If not, it indicates a data jump, and the jump is corrected using the corresponding algorithm.
[0131] ECC1 has a greater data protection capability than ECC2. The ECC check algorithms of the two can be the same or different, but the storage space required for the ECC1 check code will be greater than that of ECC2.
[0132] Since the ECC check code also needs to be protected, the final ECC identification code is the result of secondary generation.
[0133] The distribution of data protected by ECC2 in a block is as follows: Figure 10 shown.
[0134] It is understandable that the spare area corresponding to each NAND page is fixed after leaving the factory. For example, a 2KB page usually corresponds to 64B of spare space. Therefore, the maximum ECC check code stored in each spare area can only reach 64B.
[0135] Implementation of Enhanced ECC1 mode: When data is written at a high ECC1 standard, a larger parity check code is generated, which in turn exceeds the capacity of the spare area. In this case, some pages in each block can be used as the main area to store high ECC parity check codes. For example, if the required ECC parity check code capacity per page increases from 64B to 128B, the main area of the page can be used to store ECC1 parity check codes.
[0136] The data protected by ECC1 in enhanced mode is distributed in a block as follows: Figure 11 shown.
[0137] Based on this calculation, assuming a block has 64 pages, each page requires 2×64B (128B) of ECC after increasing the ECC capability. The main area of a page (2KB) can store the ECC check code generated by 2048B / 128B = 16 pages of data.
[0138] Therefore, in a block, 4 pages of main space can be used to store the ECC check code of the entire block data, and the remaining 60 pages are used to store the original data.
[0139] At this time, the overall used capacity is only reduced by 4 / 64=1 / 16, and the available download space is still 15 / 16 of the original. In the original plan, the capacity will be reduced to 1 / 3 after being designated as the enhanced area, thus greatly increasing the available space.
[0140] The above operations use Block as the minimum operation unit.
[0141] Furthermore, multiple models can be set based on the degree of memory wear and tear over its lifespan, dynamically adopting different enhanced ECC standards. For example, when the average number of memory erases and writes is low, data is stored using a checksum with lower data protection capabilities, requiring a smaller storage space for the corresponding checksum. When the average number of erases and writes is high, data is stored using a checksum with higher data protection capabilities, requiring a larger storage space for the corresponding checksum.
[0142] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0144] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A data storage method, characterized in that: include: Receiving data information to be stored; Determining whether the data information requires important storage, and generating a first determination result; When the first judgment result is yes, the data information is stored in a first verification protection mode; otherwise, the data information is stored in a second verification protection mode; Wherein, the storage space used for storing verification data in the first verification protection mode is larger than the storage space used for storing verification data in the second verification protection mode; The storage device for storing the data information includes a plurality of storage pages, each of the storage pages includes an associated main data storage space and a check data storage space, the data capacity of the main data storage space is greater than the data capacity of the check data storage space, and the storing of the data information in the first check protection mode includes: generating first verification data according to the original data; The original data and at least a portion of the first verification data are stored in the main data storage space.
2. The data storage method according to claim 1, wherein: Before receiving the data information to be stored, the method further includes: Add identification code information to the original data to generate data information to be stored; The determining whether the data information requires important storage includes: Reading the identification code information in the data information; When the identification code information matches the set comparison identification information, the data information needs to be stored as important; otherwise, it does not need to be stored as important.
3. The data storage method according to claim 1, wherein: After storing the data information in the first verification protection mode, the method further includes: Determining whether the data information has received a key protection instruction, and generating a second determination result; When the second judgment result is no, the data information is deleted and stored in the second verification protection mode.
4. The data storage method according to claim 1, wherein: Before the step of storing the data information in the first verification protection mode, the method further includes: Determine the average number of times the memory storing the data information is erased and written; Determine a corresponding verification protection mode according to the average number of erase and write times; Among them, the verification protection mode includes the first verification protection mode.
5. The data storage method according to claim 2, wherein: Generating first verification data according to the original data includes: The original data is encrypted multiple times to obtain the first verification data.
6. The data storage method according to claim 2, wherein: Storing the original data and at least part of the first verification data in the main data storage space specifically includes: The first verification data is stored in the main data storage space of the plurality of storage pages, and the verification data storage space of the plurality of storage pages does not store data.
7. The data storage method according to claim 2, wherein: The storage device for storing the data information includes a plurality of storage pages, each of the storage pages includes a main data storage space and a check data storage space, the data capacity of the main data storage space is greater than the data capacity of the check data storage space, and the storing of the data information in the second check protection mode includes: generating second verification data according to the original data; The original data is stored in the main data storage space, and the second verification data is stored in the verification data storage space.
8. The data storage method according to claim 7, characterized in that: Generating the second verification data according to the original data specifically includes: The original data is encrypted once to obtain the second verification data.
9. The data storage method according to claim 1, wherein: Also includes: The data information stored in the first verification protection mode is stored in the first storage area, and the data information stored in the second verification protection mode is stored in the second storage area; Second verification data is generated based on the original data stored in the first storage area, the original data is stored in the main data storage space in the first storage area, and the second verification data is stored in the verification data storage space in the first storage area, so that the first storage area is converted into the second storage area.
10. A data storage device, characterized in that: It includes a first storage area and a second storage area, wherein data information stored in a first verification protection mode is stored in the first storage area, and data information stored in a second verification protection mode is stored in the second storage area; Wherein, the storage space used for storing verification data in the first verification protection mode is larger than the storage space used for storing verification data in the second verification protection mode; The first storage area includes a plurality of storage pages, each of the storage pages includes an associated main data storage space and a check data storage space, and the data capacity of the main data storage space is greater than the data capacity of the check data storage space; The data information stored in the first verification protection mode includes original data and first verification data generated according to the original data, and the original data and the first verification data are both stored in the main data storage space of the first storage area.
11. The data storage device according to claim 10, wherein: The first storage area and the second storage area are convertible to each other.
12. The data storage device according to claim 10, wherein: Second verification data is generated based on the original data stored in the first storage area, the original data is stored in the main data storage space in the first storage area, and the second verification data is stored in the verification data storage space in the first storage area, so that the first storage area is converted into the second storage area.
13. The data storage device according to claim 10, wherein: The first verification data is obtained by encrypting the original data multiple times.
14. The data storage device according to claim 10, wherein: The first verification data is stored in the main data storage space of the plurality of storage pages, and the verification data storage space of the plurality of storage pages does not store data.
15. The data storage device according to claim 10, wherein: The second storage area includes a plurality of storage pages, each of the storage pages includes an associated main data storage space and a check data storage space, and the data capacity of the main data storage space is greater than the data capacity of the check data storage space; The data information stored in the second verification protection mode includes original data and second verification data generated according to the original data, the original data is stored in the main data storage space, and the second verification data is stored in the verification data storage space.
16. A data storage device, characterized in that include: A receiving module, used for receiving data information to be stored; A judgment module, configured to judge whether the data information requires important storage and generate a first judgment result; a storage module, configured to store the data information in a first verification protection mode when the first judgment result is yes, and otherwise store the data information in a second verification protection mode; Wherein, the storage space used for storing verification data in the first verification protection mode is larger than the storage space used for storing verification data in the second verification protection mode; The data storage device includes a plurality of storage pages, each of the storage pages includes an associated main data storage space and a check data storage space, and the data capacity of the main data storage space is greater than the data capacity of the check data storage space; The storage module is further configured to generate first verification data based on the original data, and store the original data and at least a portion of the first verification data in the main data storage space.
17. The data storage device according to claim 16, wherein: The storage module is further configured to generate second verification data based on the original data, store the original data in the main data storage space, and store the second verification data in the verification data storage space.
18. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the data storage method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for dynamically realizing ECC check codes of solid state drives
CN105280239A
Encoding method, decoding method, encoding device, decoding device and encoding and decoding processor for error checking and correcting
CN106874139A