Storage management method, memory, electronic device, and storage medium
By setting a flag storage area in the Flash memory and using status flags to determine the target data block, the problem of unstable storage cells during the erasure process is solved, improving the operating efficiency and reliability of the memory and extending its service life.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG CHINT ELECTRIC CO LTD
- Filing Date
- 2025-05-13
- Publication Date
- 2026-07-21
AI Technical Summary
During the erasure process, flash memory may experience instability in storage cells due to unforeseen circumstances, potentially leading to data conflicts and loss, which can affect the reliability and lifespan of the memory.
A flag storage area is set in each data block. The target data block to be operated on is determined by the status flag, and the corresponding operation is performed according to the status of the target data in the data storage area, including updating the status flag and locating the index value of the data block.
It improves the operational efficiency and reliability of the memory, reduces the risk of data loss, extends the lifespan of the memory, and ensures the integrity and accuracy of the data.
Smart Images

Figure CN120540588B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a storage management method, a memory, an electronic device, and a storage medium. Background Technology
[0002] Flash memory, as a non-volatile storage medium, is widely used in various electronic devices. Before writing new data to Flash memory, the storage cells must first be erased. However, during the erasure process, if a sudden event occurs, such as a power outage or restart, the erasure operation may not be completed, leaving the storage cells in an unstable state and leading to uncertainty when writing data. Summary of the Invention
[0003] This application provides a storage management method, a memory, an electronic device, and a storage medium to solve the above-mentioned problems.
[0004] To achieve the above objectives, according to a first aspect of this application, a storage management method is provided, applied to a memory, wherein the storage space of the memory is used to store various log information, each log information corresponding to multiple data blocks, each data block including a data storage area for storing at least one piece of data and a flag storage area for storing status flags; the status flag of each data block is used to indicate the data write status of the data block and the erase status of the next data block of the data block, the method comprising:
[0005] In response to an operation command to the memory, the target data block to be operated is determined from the data blocks according to the status flag of each data block;
[0006] The state of the target data block is determined based on the last target data written to the data storage area in the target data block.
[0007] Based on the state of the target data block, perform an update operation on the state flag of the target data block or respond to the operation command to operate on the data storage area of the target data block.
[0008] Optionally, the status flag includes a first status flag indicating the erase status of the next data block of the data block and a second status flag indicating the data write status of the data block;
[0009] The step of determining the target data block to be operated on from the data blocks based on the status flag of each data block includes:
[0010] The first data block whose first status flag is not a preset flag and whose second status flag is a preset flag is used as the target data block; and / or
[0011] In the absence of a first data block, a target data block is determined based on a second data block; wherein, the second data block refers to a data block in which both the first status flag and the second status flag are preset flags, and neither the first status flag nor the second status flag is a preset flag in the next data block of the second data block.
[0012] Optionally, determining the state of the target data block based on the last target data written within the data storage area of the target data block includes:
[0013] If the target data is not the first or last data item, it is determined that the status flag of the target data block is not abnormal.
[0014] If the target data is the first data or the last data, the state of the target data block is determined based on the state flag.
[0015] Optionally, the step of performing an update operation on the status flag of the target data block or responding to the operation instruction based on the status of the target data block, and operating on the data storage area of the target data block, includes:
[0016] If the target data block is in a state without any abnormalities, in response to the operation instruction, read and write operations are performed on the data storage area of the target data block based on the last target data written in the data storage area;
[0017] If the target data block is in an abnormal state, perform an update operation on the state flag of the target data block, including:
[0018] If the target data of the target data block is the last data, then the next data block is erased, and after the erasure operation is completed, the first status flag bit is written into the flag storage area of the target data block.
[0019] If the target data of the target data block is the first data item, then a second status flag bit is written into the flag storage area of the target data block.
[0020] Optionally, the flag storage area further includes a third status flag bit, which indicates the storage progress of the data block being written; the method further includes:
[0021] Based on the target data, determine the target storage progress of the target data block;
[0022] When the target storage progress reaches different preset progress thresholds, the third status flag bit of the target data block flag storage area is updated.
[0023] Optionally, the method further includes:
[0024] Based on the third status flag bit of the target data block, the target index range of the target data block is determined;
[0025] Based on the target index range, the target index value is obtained through a preset search method to determine the target data corresponding to the target index value.
[0026] Optionally, in response to the operation instruction, operations are performed on the data storage area of the target data block, including:
[0027] Get write operation command;
[0028] A first index value is determined based on the target data. A write operation is performed on the storage address corresponding to the first index value based on the data to be written in the write operation instruction, and the status flag of the target data block is updated.
[0029] Optionally, in response to the operation instruction, operations are performed on the data storage area of the target data block, including:
[0030] Based on the second index value in the read operation instruction, read the stored data from the storage address corresponding to the second index value;
[0031] When the preset index value in the stored data is the same as the second index value, the data bits in the stored data are verified, and based on the verification result, the stored data corresponding to the next index value of the second index value is read.
[0032] Optionally, the method further includes:
[0033] When the verification result is a failure, the preset index value in the stored data is set to a preset flag value, which is used to indicate that the data bits in the stored data are erroneous data.
[0034] Optionally, the memory is a Flash memory, which is used to store high-frequency log information with a small amount of data.
[0035] According to a second aspect of this application, embodiments of this application also provide a memory, wherein the storage space of the memory is used to store various log information, and one log information corresponds to multiple data blocks, each data block including a data storage area for storing at least one piece of data and a flag storage area for storing status flags.
[0036] According to a third aspect of this application, embodiments of this application also provide an electronic device, comprising:
[0037] A memory on which computer programs are stored;
[0038] A processor is configured to execute the computer program in the memory to implement the steps of any of the methods provided in the embodiments of this application.
[0039] According to a fourth aspect of this application, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the methods provided in embodiments of this application.
[0040] Some embodiments of this specification include at least the following beneficial effects: By setting a flag storage area in each data block to store a status flag, and determining the target data block to be operated on based on the status flag, the technical problem of traditional memory being unable to quickly and accurately locate the target data block during data operations, resulting in low operational efficiency, is overcome. Furthermore, this method allows for rapid and accurate determination of the target data block, improving memory operational efficiency and reducing wasted time and resources due to inaccurate positioning. Simultaneously, determining the status of the target data block based on the last written target data in its data storage area, and performing corresponding operations accordingly, enables timely detection and handling of anomalies, preventing data loss or corruption, further improving the reliability and stability of the memory, and ensuring data integrity and accuracy.
[0041] Other features and advantages of this application will be described in detail in the following detailed description section. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] To gain a more complete understanding of this application and its beneficial effects, the following description will be provided in conjunction with the accompanying drawings, wherein the same reference numerals in the following description denote the same parts.
[0044] Figure 1 These are schematic diagrams of the memory structure shown in some embodiments of this specification;
[0045] Figure 2 This is an exemplary flowchart of a storage management method according to some embodiments of this specification;
[0046] Figure 3 This is an exemplary schematic diagram illustrating the determination of a target index value according to some embodiments of this specification;
[0047] Figure 4This is an exemplary schematic diagram of an update status flag according to some embodiments of this specification;
[0048] Figure 5 This is an exemplary schematic diagram illustrating the execution of write operation instructions according to some embodiments of this specification;
[0049] Figure 6 This is an exemplary schematic diagram illustrating the execution of read operation instructions according to some embodiments of this specification;
[0050] Figure 7 This is a schematic diagram of the structure of an electronic device according to some embodiments of this specification. Detailed Implementation
[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.
[0052] To facilitate understanding of the implementation schemes provided in this application, the relevant application background of the storage management method provided in this application will be explained first.
[0053] Currently, Flash memory, as a widely used non-volatile storage medium, has advantages such as data retention when power is off, fast write / erase speed, and small size, and is widely used in various electronic devices.
[0054] Because Flash memory can only change "1" to "0" during a write operation, but not "0" to "1", the memory cell must be erased before new data is written, setting all data bits to "1" so that new data can be written correctly subsequently. The erase operation increases data storage time, as only erased memory cells can be used to store new data.
[0055] However, erasing operations on Flash memory also carry certain risks. During the erasure process, if an unexpected event occurs, such as a power outage or restart, the erasure operation may not be completed, leaving the memory cell in an unstable state. In this situation, subsequent data writing may be unpredictable. For example, partially erased data may conflict with newly written data, leading to data errors or loss. Furthermore, frequent erasure operations can impact the lifespan of Flash memory, as each erase operation causes some damage to the physical structure of the memory cell. As the number of erases increases, the reliability of the memory cell gradually decreases, potentially leading to memory failure.
[0056] In view of this, some embodiments of this specification provide a storage management method that uses a flag storage area to store status flags in each data block and determines the target data block to be operated on based on the status flags. This method can improve the reliability and stability of the erase operation while ensuring the accuracy of data storage, reduce the impact of sudden events on data writing, and thus improve the overall performance and lifespan of the Flash memory.
[0057] Figure 1 This is a schematic diagram of the memory structure according to some embodiments of this specification.
[0058] like Figure 1 As shown, the memory's storage space is used to store various log information. Each log information corresponds to multiple data blocks. Each data block includes a data storage area for storing at least one piece of data and a flag storage area for storing status flags. The status flags of each data block are used to indicate the data write status of the data block and the erase status of the next data block.
[0059] Data blocks are used to store data in memory. Memory is erased in units of data blocks.
[0060] In some embodiments, a data block contains multiple sectors. For example, a data block may contain 16 minimum sectors, and a minimum sector may contain multiple pages, each page containing multiple bytes.
[0061] In some embodiments, the memory's storage space can store various log information, each log information corresponding to X data blocks, where a single data block can store a data storage area and a flag storage area for Y data entries. In some embodiments, the number of data blocks X ≥ 2; the larger the number of data blocks X, the longer the storage life of the storage area. In some embodiments, X is at least 2, which facilitates data backtracking, such as rolling back versions of embedded system software code, log backtracking, etc.
[0062] A data storage area is the portion of a data block used to store the actual data. Each data storage area can store one or more data records.
[0063] In some embodiments, the size of the data storage area can be determined according to the memory design and application scenario. The data storage area can be used for write and read operations. The contents of the data storage area are cleared after an erase operation, and the value of all storage cells is reset to "1".
[0064] The flag storage area is the portion of a data block used to store status flags. Status flags record the status information of the data block or data storage area, such as data validity, erase status, and error flags. The flag storage area enables the memory to manage and maintain the status of data blocks more efficiently.
[0065] In some embodiments, the flag storage area may contain a small number of storage units for storing status information. For example, the flag storage area may be one or more bytes for storing status flags. For example: a validity flag to indicate whether the data is valid; an erase flag to indicate whether the data block has been erased; an error flag to indicate whether an error has occurred in the data block, etc.
[0066] In some embodiments, the contents of the flag storage area are cleared after an erase operation, and the status information of the flag storage area can be updated before writing data.
[0067] In some embodiments, the flag storage area includes multiple flag bits, and the size of the flag bits is not limited. In some embodiments, flag 1 is used to indicate that the erasure of the next data block is complete. After the last piece of data in the current data block is written, the erasure of the next adjacent data block begins. After erasure is complete, flag 1 is written to the flag storage area of the current data block. Flag 2 indicates that data has been written to the current data block. After the first piece of data in the current data block is written, flag 2 is written to the flag storage area of the current data block. Flag 3 is used to dynamically indicate the storage progress of the current data block, such as 10%, 20%, etc. Flag 3 can narrow the search range and quickly locate the position of the specific data strip in the data block when retrieving the index value. The larger the flag 3 is, the faster the search.
[0068] In some embodiments, the flag storage area can be freely supplemented with other flags for adaptation. For example, if the data stored in the memory is software data to be upgraded, a flag representing the software version number can be added. After reserving storage space for the flag storage area, the remaining storage space can be used for equally spaced storage based on the size of a single data item. For example, N minimum erase units can be used to store a data storage area plus a flag storage area for a maximum of Y data items. However, in actual use, (Y-1) data items are sufficient to meet the design requirements, resulting in a waste of storage space. In some embodiments, the data storage area is increased to Y data items, so that the occupied space is N minimum erase units, thereby maximizing the utilization of the occupied N minimum erase units and improving storage space utilization and storage lifespan (where N≥1, Y≥1, and N and Y are both integers).
[0069] It should be noted that the above description of the memory and its components is for ease of description and distinction only. The order of references 1, 2, and 3 is not limited and is merely for descriptive convenience; it should not be construed as limiting this specification to the examples given. It is understood that those skilled in the art, after understanding the principles of this memory, may arbitrarily combine the various parts or construct subsystems connected to other modules without departing from these principles. Such modifications are all within the scope of this specification.
[0070] Figure 2 This is an exemplary flowchart illustrating a storage management method according to some embodiments of this specification. In some embodiments, process 200 may be executed on a processor-based basis. Figure 2 As shown, process 200 includes the following steps.
[0071] Step 210: In response to the operation instructions for the memory, determine the target data block to be operated on from the data blocks according to the status flag of each data block.
[0072] Operation instructions are commands used to instruct memory to perform specific operations. For example, specific operations may include reading, writing, erasing, updating, etc.
[0073] In some embodiments, operation instructions typically include: operation type, target address, and data content. The operation type refers to the specific type of operation to be performed, such as read, write, or erase. The target address refers to the target storage location of the operation, such as the data block number or address. For a write operation, the data content refers to the data information to be written.
[0074] Status flags refer to the status information stored in the flag storage area of each data block, used to record the current status of the data block.
[0075] The target data block refers to the data block that needs to be operated on, determined from memory.
[0076] In some embodiments, the target data block to be operated on can be determined from the data blocks in various ways based on the status flags of each data block. For example, based on the operation type of the operation instruction being write, an erased and error-free data block can be selected as the target data block according to the status flags.
[0077] In some embodiments, the status flags include a first status flag indicating the erase status of the next data block of the data block and a second status flag indicating the data write status of the data block;
[0078] Based on the status flags of each data block, determine the target data block to be operated on, including:
[0079] The first data block whose first status flag is not a preset flag and whose second status flag is a preset flag is used as the target data block; and / or
[0080] In the absence of a first data block, a target data block is determined based on a second data block; wherein, the second data block refers to a data block in which both the first and second status flag bits are preset flags, and neither the first nor the second status flag bits of the next data block of the second data block are preset flags.
[0081] The first data block refers to the data block that is not yet full. The second data block refers to the data block preceding the new data block to be written.
[0082] First status flag (e.g.) Figure 1 The flag 1 shown can be a value of 0 or 1. 1 indicates that the erase status of the next data block of this data block is not erased, and 0 indicates that the erase status of the next data block of this data block is erased.
[0083] Second status flag (e.g.) Figure 1 The flag 2 shown can be a value of 0 or 1. 1 indicates that the data block is in a state of no data being written, and 0 indicates that the data block is in a state of having data being written.
[0084] In some embodiments, the status flags of each data block can be read, the first status flag bit and the second status flag bit can be checked, and it can be determined whether the data block has been written to based on each status flag. For example, if multiple status flag bits of a data block are not preset flags (such as 0), it means that the data block has not been written to. For example, if the first status flag bits and the second status flag bits of multiple data blocks are not preset flags, the memory is a blank memory, and the first data block of the memory is taken as the target data block.
[0085] In some embodiments, if the first status flag bit and the second status flag bit of each data block are both 1, it is determined that no data has been written to each data block, and the first data block is taken as the target data block.
[0086] In some embodiments, if the first status flag of a data block is 1 and the second status flag is 0, it is determined that there is a first data block that is not fully written, and the first data block is taken as the target data block.
[0087] It should be noted that the first state flag being 1 and the second state flag being 0 can have the following possible scenarios:
[0088] The data block has been written with data, but not up to the last data record; or
[0089] The data block has been written to the last data record, but due to an abnormal situation such as a power outage, the next data block has not yet been erased.
[0090] The last piece of data refers to the last data unit that is expected to be written in the data block.
[0091] In some embodiments, if the first status flag bit of a data block is 1 and the second status flag bit is 0, it indicates that the status flags of the current multiple data blocks are in one of the following situations: the first status flag bit is 1 and the second status flag bit is 1; or the first status flag bit is 0 and the second status flag bit is 0.
[0092] In some embodiments, a second data block can be determined based on the status flags of multiple data blocks. The second data block satisfies the following conditions: the first status flag bit is 0 and the second status flag bit is 0, and the first status flag bit and the second status flag bit of the next data block of the second data block are 1 and 1 respectively.
[0093] It should be noted that there are at least two data blocks, namely data block 1 and data block 2. When the last piece of data is written to data block 1 and data block 2 is erased, the first status flag of data block 1 is 0 and the second status flag is 0. At this time, the following situations may occur:
[0094] If no new data needs to be recorded, and an abnormal situation such as power outage or restart occurs at this time, the status flag of data block 2 will not have a valid flag, that is, the first status flag bit of data block 2 is 1 and the second status flag bit is 1.
[0095] For data block 2, if a power outage or restart occurs between the operation of writing the first data and the operation of writing the second status flag, the status flag of data block 2 will not have a valid flag, that is, the first status flag of data block 2 will be 1 and the second status flag will be 1.
[0096] In some embodiments, a target data block can be determined based on a second data block. For example, if the first data entry of the next data block of the second data block contains written data, then the next data block of the second data block is taken as the target data block; if the first data entry of the next data block of the second data block does not contain written data, then the second data block is taken as the target data block.
[0097] In some embodiments of this specification, the status of data blocks can be managed more accurately by using explicit status flags, reducing the risk of errors and data loss; by prioritizing the selection of the first data block (a data block that has been erased but is not yet full of data), unnecessary erasure operations can be avoided, thereby reducing memory wear and extending its lifespan; in the absence of a first data block, by selecting a second data block, blocks that have been written to but whose next block is free can be utilized, thereby managing storage space more flexibly.
[0098] Step 220: Determine the state of the target data block based on the last target data written to the data storage area in the target data block.
[0099] The last written target data refers to the data written in the target data block's data storage area during the last write operation. Target data can be log information or other forms of data.
[0100] The status of the target data block can refer to the status flag of the data block during the writing process. For example, the status of the target data block can indicate that the status flag of the target data block has not been updated in time due to some reason (such as power failure, system failure, etc.).
[0101] In some embodiments, the status flags of the target data block (such as a first status flag bit and a second status flag bit) can be combined to determine whether an abnormality occurs during the writing process of the target data block, so as to determine the status of the target data block.
[0102] In some embodiments, determining the state of a target data block based on the last target data written to its data storage area includes:
[0103] If the target data is not the first or last data item, determine that the status flag of the target data block does not have any anomalies;
[0104] If the target data is the first or last data item, the status of the target data block is determined based on the status flag.
[0105] In some embodiments, if the target data is not the first and last data, it indicates that the status flag of the target data block is not abnormal.
[0106] In some embodiments, if the target data is the first or last data, it means that after the write operation of the target data block or the operation of erasing the next data block, the status flag may not be updated in time. The update status of the target data block's status flag can be determined based on the target data and the specific value of the status flag.
[0107] In some embodiments, if the target data is the last piece of data in the target data block and the target data block does not have a first status flag bit written (e.g., the first status flag bit is 1), it is determined that the status flag of the target data block is abnormal.
[0108] In some embodiments, if the target data is the first data in the target data block and the target data block does not have a second status flag bit written (for example, the second status flag bit is 1), it is determined that the status flag of the target data block is abnormal.
[0109] In some embodiments of this specification, the status of the target data block is determined by checking the target data and the status flag of the target data block. This helps to prevent unexpected power outages, restarts, or other emergencies from interrupting the operation of the Flash memory, avoids impacting subsequent data storage, and improves data reliability.
[0110] Step 230: Based on the state of the target data block, perform an update operation or a response operation command on the state flag of the target data block, and perform data storage operations on the target data block.
[0111] In some embodiments, if the target data block is not abnormal, operations such as writing data, reading data, and erasing data can be performed on the data storage area of the target data block.
[0112] In some embodiments, if the target data block is found to be abnormal, the status flags are updated to reflect the actual status of the data block. For example, the first status flag bit, the second status flag bit, etc., are updated.
[0113] In some embodiments, based on the state of the target data block, an update operation or a response operation instruction is performed on the state flag of the target data block, and operations are performed on the data storage area of the target data block, including:
[0114] If the target data block is in a state without any abnormalities, respond to the operation command and perform read and write operations on the data storage area of the target data block based on the last target data written in the data storage area;
[0115] If the target data block is in an abnormal state, perform an update operation on the target data block's state flags, including:
[0116] If the target data of the target data block is the last data, then the next data block is erased, and after the erasure operation is completed, the first status flag is written to the flag storage area of the target data block.
[0117] If the target data of the target data block is the first data item, then write the second status flag bit into the flag storage area of the target data block.
[0118] In some embodiments, if the target data is the last data in the target data block and the target data block does not have a first status flag bit to write (e.g., the first status flag bit is 1), the next adjacent data block is erased, and after the erasure operation is completed, the first status flag bit is written into the target data block (e.g., the first status flag bit is 0).
[0119] In some embodiments, if the target data is the first data in the target data block and the target data block does not have a second status flag bit to write (e.g., the second status flag bit is 1), then the second status flag bit is written into the target data block (e.g., the second status flag bit is 0).
[0120] In some embodiments of this specification, by detecting and processing status flags, the consistency between the data storage status and the status flags can be ensured, avoiding subsequent data storage anomalies; by responding promptly to anomalies in status flags, the impact of system failures on data storage can be reduced, improving the overall stability of the system; by updating status flags and executing operation instructions, memory resources can be managed more efficiently, extending the lifespan of the memory.
[0121] In some embodiments, the flag storage area further includes a third status flag bit, which indicates the storage progress of writing data to the data block, and the method further includes:
[0122] Based on the target data, determine the target storage schedule for the target data blocks;
[0123] When the target storage progress reaches different preset progress thresholds, update the third status flag bit of the target data block flag storage area.
[0124] Target storage progress refers to the percentage of data already written to a data block out of the total amount of data to be written. Target storage progress can be used to measure the degree of completion of write operations, and can be a percentage value (such as 20%, 50%, 100%, etc.) or the number of data entries already stored.
[0125] Different preset progress thresholds refer to multiple pre-set progress thresholds. When the target storage progress of the target data block reaches different preset progress thresholds, the third status flag (e.g., ...) is updated. Figure 1 The flag shown in symbol 3) reflects the current write status.
[0126] In some embodiments, preset progress thresholds can be set in various ways. For example, multiple preset progress thresholds can be determined based on the maximum number of data entries that the data storage area can store and the number of bits in the third status flag.
[0127] For example, the third status flag has N bits, and the data storage area can store a maximum of Y data entries. Different preset progress thresholds can be set by dividing the total capacity of the data storage area (Y data entries) into N equal parts, with each part corresponding to a preset progress threshold. For example, if N = 3 (the third status flag has 3 bits) and Y = 100 data entries, the following preset progress thresholds can be set:
[0128] Preset progress threshold 1: When the target storage progress reaches 1 / 3*Y = 33 data entries, update or write the first bit of the third status flag.
[0129] Preset progress threshold 2: When the target storage progress reaches 2 / 3*Y = 66 data entries, update or write the second bit of the third status flag.
[0130] Preset progress threshold 3: When the target storage progress reaches Y = 100 data entries, update or write the third bit of the third status flag.
[0131] For example, the third status flag has N bits, and the data storage area can store a maximum of Y data entries. Each preset progress threshold can be customized according to actual application needs through a custom progress threshold. For example:
[0132] Preset progress threshold 1: When the target storage progress reaches 20% * Y data entries, update the first bit of the third status flag.
[0133] Preset progress threshold 2: When the target storage progress reaches 50% * Y data entries, update the second bit of the third status flag.
[0134] Preset progress threshold 3: When the target storage progress reaches 80% * Y data entries, update the third bit of the third status flag.
[0135] In some embodiments of this specification, by updating the third status flag in real time, the target storage progress of the data block can be quickly determined, which helps to quickly determine the index value of the target data block.
[0136] In some embodiments, the method further includes:
[0137] Based on the third status flag of the target data block, determine the target index range of the target data block;
[0138] Based on the target index range, the target index value is obtained through a preset search method to determine the target data corresponding to the target index value.
[0139] The target index range refers to an index range within a data block determined by the third status flag.
[0140] The target index value refers to the specific index value determined by a preset search method within the target index range. The target index value can be used to locate a specific data record within a data block.
[0141] In some embodiments, the target index range represents the search range of the target index value. For example, when the third status flag is 110, N = 3 (the third status flag has 3 bits), Y = 100 data entries, and the target index range is [33, 66], it means that the maximum value of the target index value does not exceed 66.
[0142] In some embodiments of this specification, the target index range and target index value are determined by the third status flag, which can quickly locate specific data in the data block, reduce unnecessary data searches, and improve the efficiency of data location.
[0143] In some embodiments, the index value in a single data entry can be adjusted according to the maximum value required by the design, and the index value can occupy a single byte or multiple bytes. In some embodiments, an index value of 0 represents erroneous data, and a default value (e.g., 0xFFFF) represents that the data at the storage address corresponding to this index value is empty.
[0144] In some embodiments, the index value can be saved to other storage media such as EEPROM. When the storage space needs to be operated, the index value can be read directly from other storage media, saving the index lookup operation. In addition, the operation of writing the index value to other storage media needs to be added during the write operation.
[0145] In some embodiments, when the data storage area is increased to Y records, the maximum value of the index is Y; the check code algorithm can be CRC8, CRC16, CRC32, etc., which can be set according to actual needs; this specification prefers the check code to be two bytes, which is an addition check algorithm that accumulates single bytes from the index value to the check code and then modulo 65536.
[0146] Figure 3 This is an exemplary schematic diagram illustrating the determination of a target index value according to some embodiments of this specification.
[0147] In some embodiments, such as Figure 3 As shown, the target index value of the target data to be operated on can be determined from the data block based on the status flag of each data block.
[0148] In some embodiments, if the first and second status flag bits of each status flag are both 1, the index value is reset, such as setting the target index value to the default initial value (e.g., 1).
[0149] In some embodiments, if there exists a data block with a first status flag of 1 and a second status flag of 0, it is determined that there is an incomplete first data block. This data block is then used as the target data block. A preset search method can be used to perform an index search on the target data block to find the last piece of data written to the target data block. The index value corresponding to this piece of data is the target index value. For example, a sequential search algorithm or a binary search algorithm can be used. This application prefers the binary search algorithm, with a maximum search count of log₂N, where N is twice the maximum value of the corresponding target index interval. To reduce program complexity, a value of 2 is recommended for N. 3 ~2 9 That is, the maximum number of searches is 3 to 9.
[0150] In some embodiments, the target index value can be determined based on the second data block. For example, if the first data item of the next data block of the second data block contains written data, then the next data block of the second data block is the target data block, and the target index value is the index value corresponding to the first data item of the target data block; if the first data item of the next data block of the second data block does not contain written data, then the second data block is the target data block, and the target index value is the index value corresponding to the first and last data item of the target data block.
[0151] Figure 4 This is an exemplary schematic diagram of an update status flag according to some embodiments of this specification.
[0152] In some embodiments, such as Figure 4 As shown, after determining the target index value, the memory can be checked for data, and the status flag of the target data block can be updated based on the results of the data check.
[0153] In some embodiments, it can be determined whether the target index value of the target data block points to the last data. If so, it can be determined whether the target data block has a first status flag bit for writing. If the first status flag bit for writing does not exist, the next data block is erased, and after erasing the next data block, the first status flag bit is written into the target data block.
[0154] In some embodiments, it can be determined whether the target index value of the target data block points to the first data: if so, it can be determined whether the target data block has a second status flag bit for writing; if the target data block does not have a second status flag bit for writing, the second status flag bit is written into the target data block.
[0155] In some embodiments, when the target index value of the target data block does not point to the first and last data, it can be determined whether the condition for writing the third status flag has been met. For example, if the target storage progress reaches different preset progress thresholds, the third status flag of the flag storage area of the target data block can be updated.
[0156] In some embodiments of this specification, the status of a data block is determined by a status flag and by checking the last written data of the target data block. This allows for the timely detection of potential power outages, restarts, and other issues, and timely updates to the status flag, improving processing efficiency and contributing to extending the lifespan of Flash data storage and enhancing data reliability. Operations are performed only on the target data blocks that require attention, without scanning the entire storage space. Multiple status flags allow for customization of the quantity and length requirements for each type of log information in the memory, while using the same interface in the same way for flexible management.
[0157] In some embodiments, in response to an operation instruction, operations are performed on the data storage area of the target data block, including:
[0158] Get write operation command;
[0159] The first index value is determined based on the target data. The write operation is performed on the storage address corresponding to the first index value based on the data to be written in the write operation instruction, and the status flag of the target data block is updated.
[0160] A write operation instruction is a command used to instruct memory to perform a write operation. It may contain the following information. Write operation instructions can be issued by the system or the user.
[0161] In some embodiments, the write operation instruction may include the data to be written, the length of the data to be written, etc.
[0162] The first index value refers to the specific index value determined based on the target data within the target data block. The first index value is used to locate a specific storage location within the target data block. The first index value can be the first index value, the last index value, an intermediate index value, or other specific index value within the target data block.
[0163] The storage address corresponding to the first index value refers to the physical or logical address within the target data block. The storage address corresponding to the first index value is either the actual storage location of the write operation or the storage location where the data to be written is written.
[0164] Figure 5 This is an exemplary schematic diagram illustrating the execution of write operation instructions according to some embodiments of this specification.
[0165] For example, such as Figure 5 As shown, increment the target index value by 1 to obtain the first index value (e.g., Figure 5The system calculates the checksum based on the data to be written and writes the data to be written and the checksum to the storage address corresponding to the first index value. It then checks if the target data block corresponding to the first index value is full. If so, it erases the next adjacent data block and writes the first status flag to the target data block corresponding to the first index value. Next, it checks if the first index value is the index value of the first data entry in the current data block. If so, it writes the second status flag to the target data block corresponding to the first index value. If the first index value does not point to the first or last data entry, it checks if the conditions for writing the third status flag are met, such as if the storage progress of the current data block reaches different preset progress thresholds, and updates the third status flag of the data block corresponding to the first index value.
[0166] The target data block is the data block that needs to be written to, and it can be determined based on the actual situation.
[0167] In some embodiments of this specification, by determining the first index value and the storage address corresponding to the first index value, the target location can be quickly located, reducing unnecessary data scanning; by updating the status flag, the status of the data block can be ensured to be consistent with the actual write operation.
[0168] In some embodiments, in response to an operation instruction, operations are performed on the data storage area of the target data block, including:
[0169] Based on the second index value in the read operation instruction, read the stored data from the storage address corresponding to the second index value;
[0170] When the preset index value in the stored data is the same as the second index value, the data bits in the stored data are verified, and based on the verification result, the stored data corresponding to the next index value of the second index value is read.
[0171] A read operation instruction is a command used to instruct the memory to perform a read operation. Read operation instructions can be issued by the system or the user.
[0172] In some embodiments, a read operation instruction may include a second index value corresponding to one or more data to be read.
[0173] The second index value is the index value specified in the read operation instruction, used to locate a specific storage location within the target data block. The second index value is used to identify a specific data entry or segment within the data block.
[0174] Stored data refers to the data content read from a specified storage address of the target data block. Stored data can be a data record, a data segment, or other form of data unit.
[0175] A preset index value is an index value that is pre-defined in stored data to mark a specific location within a data block. Preset index values can be used for data validation and integrity checks. For example, a preset index value can be a specific index value.
[0176] The verification result refers to the result of verifying the data bits in the stored data. For example, verification can be performed using methods such as checksum or CRC check. The verification result can be either "verification successful" or "verification failed." A successful verification means the stored data is complete and consistent. A failed verification means the stored data is incomplete or inconsistent.
[0177] In some embodiments, the method further includes:
[0178] When the verification result fails, the preset index value in the stored data is set to the preset flag value. The preset flag value is used to indicate that the data bit in the stored data is erroneous.
[0179] A preset flag value is a pre-set value used to mark a data bit as erroneous in the stored data. The preset flag value can be a fixed, predefined value. When the verification result fails, the preset index value in the stored data is set to the preset flag value to mark that data bit as erroneous.
[0180] Figure 6 This is an exemplary schematic diagram illustrating the execution of read operation instructions according to some embodiments of this specification.
[0181] For example, such as Figure 6 As shown, the validity of the requested data can be determined based on the read operation command. For example, the validity can be determined based on the second index value in the requested data and the quantity of the requested data. If it is valid, the target storage address is calculated based on the second index value and the requested data, and the stored data at the target storage address is read out. If all the preset index values in the stored data are '1', i.e., the default value, then the stored data is determined to be empty, and the stored data is popped out.
[0182] In some embodiments, if the preset index values in the stored data are not all '1', it is determined whether the preset index values in the stored data are normal, that is, whether they correspond to the target storage address: if yes, data verification is performed; if the preset check code in the stored data and the calculated check code are equal, it indicates that the data is normal and the stored data is popped; if the preset check code in the stored data and the calculated check code are not equal, data anomaly handling is performed, for example, the preset index values of the stored data are all written as 0 for marking, and it is determined whether all the requested data has been read: if not, the target storage address of the next data is determined.
[0183] In some embodiments, after the data is displayed, it is determined whether all the requested data has been read; if not, the target storage address of the next data is determined.
[0184] In some embodiments of this specification, the reliability of the data is ensured by using index values and check codes; abnormal data processing helps to skip problematic data in the future, improving the user experience; and the identification of problematic and erroneous data by using index values improves the efficiency of subsequent readings.
[0185] In some embodiments, the memory is a Flash memory, which is used to store high-frequency log information with a small amount of data.
[0186] For example, the memory can be used to store high-frequency log information with a data volume less than a preset data volume threshold. The preset data volume threshold is a set upper limit used to restrict the amount of log information stored each time. The preset data volume threshold can be adjusted according to the memory's capacity and performance to ensure that the memory is not overloaded due to excessively large amounts of data written at once.
[0187] High-frequency log information refers to log information that is frequently generated during system operation.
[0188] For example, in an embedded system, for a small amount of high-frequency log information, it is necessary to record the sunrise times (hours, minutes, seconds) for 1000 days. In memory, 2 bytes are used for the index value, 2 bytes for the checksum, and each data entry is 3 bytes, for a total of 7 bytes per data entry. The first, second, and third status flags together occupy 2 bytes, for a total of 2 bytes in the flag storage area. A minimum erase sector is 4096 bytes. The starting address is 0. For the existing 88 data entries, in the first data block, entries 87 and 88 are shown in Table 1 below:
[0189] Table 1
[0190]
[0191] In some embodiments, the number of data entries is increased to 1170, and two minimum erase sectors constitute one data block. At least two data blocks are required for log retrieval. The flag storage area of the current data block is shown in Table 2 below. According to the size occupied by the third status flag bit, the third status flag bit is written every 1 / 15 (i.e., 78 entries). That is, bit 0 is set to 0 after the 78th data entry is written, and bit 1 is set to 0 after the 156th data entry is written. The correspondence between the index value of the Nth entry and the storage address is: (index value – 1) * 7 + storage start address of the current data block = storage address of the Nth data entry.
[0192] Table 2
[0193]
[0194] In some embodiments, the specific operations for obtaining and checking index values include:
[0195] S01. Check the existence flag of the first data block. If the first status flag does not exist, perform an index query on the first data block.
[0196] S02. Combining the data in the third status flag, it can be seen that the target index value is between 1 / 15 and 3 / 15, that is, between 78 and 234. The target index value is obtained through the preset search method, including:
[0197] The index value of the 156th data entry is 0xFFFF, so it is determined to be between 78 and 156.
[0198] The index value of the 117th data entry is 0xFFFF, so it is determined to be between 78 and 117.
[0199] The index value of the 97th data entry is 0xFFFF, so the value is determined to be between 78 and 97.
[0200] The index value of the 87th data entry is 87, so the value is determined to be between 87 and 97.
[0201] The index value of the 92nd data entry is 0xFFFF, so the value is determined to be between 87 and 92.
[0202] The index value of the 89th data entry is 0xFFFF, so it is determined to be between 87 and 89.
[0203] The index value of the 88th data entry is 88, and the last data entry is the 88th data entry, meaning its index value is 88.
[0204] It should be noted that when writing the 156th data entry, the second bit of the third status flag should be written, i.e., bit1 should be 0. However, due to power outages or other abnormalities, the second bit, bit1, may not have been successfully written (i.e., bit1 remains 1). To avoid misjudging or missing the status of the 156th data entry, it is necessary to add a check on the index value of the 156th data entry. Considering that the 156th data entry corresponds to the preset progress threshold of 1170*2 / 15, which is between 1 / 15 and 3 / 15, when using the binary search method, the target index range of the target index value is set to the index value range between 1170*1 / 15 and 1170*3 / 15. We can first check whether the index value of the 156th data entry is the default value or zero. If the index value of the 156th data entry is 0xFFFF, it means that no data has been written to the storage address corresponding to that index value. The target index range is between 78 and 156, thus effectively avoiding misjudgment or missed judgment.
[0205] Understandably, when determining the target index range using the data in the third status flag, it's necessary to ensure the range covers all possible cases while avoiding missed detections due to abnormal situations. For example, when using binary search, if the third status flag has N bits, the data storage area can store a maximum of Y data entries, and the first X flag bits have been written, the target index range can be [X*Y / N to 2X*Y / N]. In this case, it's necessary to first determine the index value of the last data entry in the target index range. If the index value is valid, the target index value is 2X*Y / N; if the index value is the default value, then binary search can be used to determine the target index value between [X*Y / N, 2X*Y / N]. Alternatively, the target index range can also be [X*Y / N to 3X*Y / N], in which case binary search can be used directly to determine the target index value.
[0206] It should be noted that the third status flag is written every 1 / 15 (i.e., 78 data entries). That is, bit 0 is set to 0 after the 78th data entry is written, bit 1 is set to 0 after the 156th data entry is written, and so on. Therefore, the 14-bit status flag needs to be divided into 15 intervals to represent the status of the corresponding storage interval. At this point, an extra data bit (e.g., bit 15) can be used to indicate the overflow of the third status flag. Specifically, when bit 15 is 1, it indicates that the first 14 status flag bits have not overflowed; when bit 15 is 0, it indicates that the first 14 status flag bits have overflowed, and the 1170th data entry has been written.
[0207] In some embodiments, the read operation is performed as follows: (e.g., to query the latest sunrise time information).
[0208] S11, the second index value is 88, requesting 1 piece of data, the request is valid. Read the 88th piece of data.
[0209] S12. Inspection revealed that the preset index value of the 88th data item was normal;
[0210] S13. Verify the 88th data item and calculate the check code 0+88+7+59+256=410. 410 is not equal to the preset check code 0xFFFF, which means the 88th data item is unreliable.
[0211] S14. Set the preset index value of the 88th data to 0 to make reading more efficient. It is not necessary to calculate the check code to know that the data is unreliable.
[0212] S15. Calculate the target storage address of the 87th data item and read the data item.
[0213] S16. Inspection revealed that the preset index value of data entry 87 was normal;
[0214] S17. Verify the 87th data item by calculating the check code 0+87+7+59+59=212. 212 equals the preset check code 212 (0x00D4), indicating that the 87th data item is reliable. Display the data item.
[0215] In some embodiments, the write operation is performed as follows: (e.g., sunrise time on a new day is 8:01:50).
[0216] S21. The target index value is 88. To save a new data record, the index value is incremented by 1 to obtain the first index value 89. The changed first index value is within the range.
[0217] S22. The check code is calculated to be 0+89+8+1+50=148;
[0218] S23. Write the data to the storage address corresponding to the 89th data entry. Since the 89th data entry is not the first or last data entry of the current data block, or the 89th data entry is not an integer multiple of 78, there is no need to update the third status flag.
[0219] In some embodiments, for a large number of low-frequency applications, embedded systems require online system upgrades, and the Flash memory needs to store the code data to be upgraded. The minimum capacity of most MCUs is only tens of kB. Large amounts of data are split into multiple data segments (e.g., 100B, 200B, etc.) for storage. In this case, one data block represents one complete data piece of information, and the data from one complete data block is assembled when needed. When software version backtracking is required, at least three data blocks are needed. The read and write operations are described in the relevant sections above.
[0220] It should be noted that the above description of the process is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art can make various modifications and changes to the process under the guidance of this specification. However, these modifications and changes remain within the scope of this specification.
[0221] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0222] Figure 7 This is a schematic diagram of the structure of an electronic device according to some embodiments of this specification.
[0223] This application also provides an electronic device 700, which may include components such as a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a power supply 703, and an input unit 704. Those skilled in the art will understand that... Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0224] The processor 701 is the storage management center, connecting various parts of the electronic device via various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 702, and by calling data stored in the memory 702, thereby providing overall monitoring of the electronic device. It is understood that the processor 701 communicates with the controller via signal transmission. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into the processor 701.
[0225] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0226] In some embodiments of this application, the storage management device can be implemented as a computer program, which can be implemented in, for example... Figure 7 The device operates on the electronic device shown. The memory of the electronic device can store various program modules that make up the memory management device. The computer program comprised of these program modules causes the processor to execute the steps of the memory management methods in the various embodiments of this application described in this specification.
[0227] The electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external electronic devices via a network connection. When the computer program is executed by the processor, it implements a memory management method.
[0228] The electronic device also includes a power supply 703 that supplies power to the various components. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 703 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0229] The electronic device may also include an input unit 704, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0230] Specifically, in this embodiment, the processor 701 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 702 according to computer instructions, and the processor 701 runs the applications stored in the memory 702 to realize various functions, such as the storage management methods of the various embodiments of this application described in this specification.
[0231] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0232] In practice, each of the above units or structures can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units or structures, please refer to the previous method embodiments, which will not be repeated here.
[0233] It should be noted that, Figure 7 This is merely one implementation of the electronic device 700 provided in this application embodiment. In actual applications, the electronic device 700 may include more or fewer components, which is not limited here.
[0234] It should be understood that the various solutions in the embodiments of this application can be used in a reasonable combination, and the explanations or descriptions of the various terms appearing in the embodiments can be referenced or explained to each other in the various embodiments, without limitation.
[0235] Based on the above embodiments and the same concept, this application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method provided in the above embodiments.
[0236] Based on the above embodiments and the same concept, this application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to execute the method provided in the above embodiments.
[0237] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0238] The embodiments, implementation methods, and related technical features of this application can be combined and substituted for each other without conflict.
[0239] The above are merely preferred embodiments of this application and are not intended to limit this application in any way. Although the descriptions of each embodiment in this application have different focuses, and the parts not described in detail in a certain embodiment can be referred to the relevant embodiments of other embodiments, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of this application without departing from the content of the technical solution of this application shall still fall within the scope of the technical solution of this application.
Claims
1. A storage management method, characterized in that, Applied to a memory, the memory's storage space is used to store various log information, with one log information corresponding to multiple data blocks. Each data block includes a data storage area for storing at least one piece of data and a flag storage area for storing status flags. The status flags of each data block are used to indicate the data write status of the data block and the erase status of the next data block. The method includes: In response to an operation command to the memory, the target data block to be operated is determined from the data blocks according to the status flag of each data block; The state of the target data block is determined based on the last target data written to the data storage area in the target data block. Based on the state of the target data block, perform an update operation on the state flag of the target data block or respond to the operation command to operate on the data storage area of the target data block; The status flags include a first status flag indicating the erase status of the next data block of the data block and a second status flag indicating the data write status of the data block. The step of determining the target data block to be operated on from the data blocks based on the status flag of each data block includes: The first data block whose first status flag is not a preset flag and whose second status flag is a preset flag is taken as the target data block; In the absence of a first data block, a target data block is determined based on a second data block; wherein, the second data block refers to a data block in which both the first status flag and the second status flag are preset flags, and neither the first status flag nor the second status flag is a preset flag in the next data block of the second data block; Wherein, the first status flag is a preset flag used to indicate that the erasure status of the next data block of the data block is erased; the second status flag is a preset flag used to indicate that the data writing status of the data block is written. Determining the state of the target data block based on the last target data written within the data storage area of the target data block includes: If the target data is not the first or last data item, it is determined that the status flag of the target data block is not abnormal. If the target data is the first data or the last data, the state of the target data block is determined based on the state flag.
2. The method according to claim 1, characterized in that, The step of performing an update operation on the status flag of the target data block or responding to the operation instruction based on the status of the target data block, and operating on the data storage area of the target data block, includes: If the target data block is in a state without any abnormalities, in response to the operation instruction, read and write operations are performed on the data storage area of the target data block based on the last target data written in the data storage area; If the target data block is in an abnormal state, perform an update operation on the state flag of the target data block, including: If the target data of the target data block is the last data, then the next data block is erased, and after the erasure operation is completed, the first status flag bit is written into the flag storage area of the target data block. If the target data of the target data block is the first data item, then a second status flag bit is written into the flag storage area of the target data block.
3. The method according to claim 1, characterized in that, The flag storage area further includes a third status flag bit, which indicates the storage progress of writing data to the data block, and the method further includes: Based on the target data, determine the target storage progress of the target data block; When the target storage progress reaches different preset progress thresholds, the third status flag bit of the target data block flag storage area is updated.
4. The method according to claim 3, characterized in that, The method further includes: Based on the third status flag bit of the target data block, the target index range of the target data block is determined; Based on the target index range, the target index value is obtained through a preset search method to determine the target data corresponding to the target index value.
5. The method according to claim 1, characterized in that, In response to the operation command, operations are performed on the data storage area of the target data block, including: Get write operation command; A first index value is determined based on the target data. A write operation is performed on the storage address corresponding to the first index value based on the data to be written in the write operation instruction, and the status flag of the target data block is updated.
6. The method according to claim 1, characterized in that, In response to the operation command, operations are performed on the data storage area of the target data block, including: Based on the second index value in the read operation instruction, read the stored data from the storage address corresponding to the second index value; When the preset index value in the stored data is the same as the second index value, the data bits in the stored data are verified, and based on the verification result, the stored data corresponding to the next index value of the second index value is read.
7. The method according to claim 6, characterized in that, The method further includes: When the verification result is a failure, the preset index value in the stored data is set to a preset flag value, which is used to indicate that the data bits in the stored data are erroneous data.
8. The method according to any one of claims 1 to 7, characterized in that, The memory is a Flash memory, which is used to store high-frequency log information with a small amount of data.
9. A memory, characterized in that, For implementing the storage management method according to any one of claims 1 to 8, the storage space of the memory is used to store various log information, one log information corresponds to multiple data blocks, and each data block includes a data storage area for storing at least one piece of data and a flag storage area for storing status flags.
10. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.