Abrasion balancing method, device and equipment for sequential storage of data acquisition card
By realizing the data cyclic writing and the use of statistical page bit flags in the data acquisition card, the problem of low storage speed and inability to maximize the use of FLASH erase life in sequential storage applications is solved, and more efficient data storage and sampling rates are achieved.
Patent Information
- Application Number
- CN202311402576.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-26
- Publication Date
- 2025-04-29
AI Technical Summary
In the sequential storage application of data acquisition cards, the storage speed is low, it occupies memory and cannot maximize the use of FLASH erase life, resulting in bad blocks in the storage system during long-term operation, resulting in data loss.
By obtaining statistics page data, calculating and updating the current data storage location, determining whether the collected data has been stored and written into the statistics page bit flag, determining whether FLASH is full and erased the statistics page, and updating the storage location to realize data cyclical writing and synchronous erase life.
The erase life of the FLASH block written to the data position information is effectively synchronized with the erase life of the FLASH written to the collected data block, maximizing the erase life of the entire FLASH, improving the data storage speed, and indirectly increasing the sampling rate of the data acquisition card.
Smart Images

Figure CN119902689A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data acquisition, and in particular to a wear leveling method, device and equipment for sequential storage of a data acquisition card. Background Art
[0002] Generally, one or more storage devices are provided on the data acquisition card or acquisition board for the storage and reading of the collected data. The storage device is mainly composed of FLASH, which has the characteristics of limited erasure times and erase first and then write. Therefore, it is necessary to balance the erasure frequency of each block in FLASH to extend the service life of FLASH, which is the so-called wear leveling. The existing FLASH wear leveling, whether it is the wear leveling of eMMC itself or the wear leveling based on the internal implementation of the file system, is based on the general application as a balancing method. The disadvantage is that in applications similar to sequential storage, the storage speed is low, data needs to be moved, etc., which occupies memory and cannot maximize the use of FLASH erasure life. The physical block in FLASH has a limit on the number of erases (EC). If there is no corresponding algorithm to balance the number of erases of each block (Block) during the operation of the storage system, so that each erase is concentrated on certain specific blocks, it will accelerate the decay of the life of these frequently erased blocks, and finally become bad blocks early, which may directly lead to data loss. The increase in the number of bad blocks will also lead to a decrease in the FLASH over provision (OP) space, a decrease in the garbage collection (GC) efficiency, and ultimately a larger write amplification index (WAI), which in turn exacerbates the decay of the FLASH service life during the entire storage period.
[0003] For example, in a scenario where the acquisition card (board) collects data and stores it sequentially for a fixed time, if dynamic wear leveling is used, it is necessary to count the blocks with the smallest number of erases, and calculate the number of erases and writes, storage location and other information each time the data is stored or erased, which requires additional computing overhead and memory overhead. The statistical information also needs to be continuously updated in the FLASH so that the latest statistical information is still stored when the acquisition board loses power, and the latest erase information can continue to be counted after the next power-on. If this part of information is stored in the FLASH in the form of files or data, it will also greatly affect the life of the FLASH. If static wear leveling is used, data that has not been modified for a long time will be moved from blocks with fewer erases and writes to blocks with more erases and writes. Each move and calculation will affect the acquisition rate in a scenario of continuous acquisition and writing.
[0004] In summary, how to design a method for wear leveling of data acquisition cards that increases storage rate and reduces write statistical calculations is a problem that urgently needs to be solved. Summary of the invention
[0005] The purpose of the present invention is to provide a wear leveling method for sequential storage of a data acquisition card, so as to solve the problems of low storage speed, memory occupation and failure to maximize the erase and write life of FLASH in existing sequential storage.
[0006] In order to solve the above technical problems, the present invention provides a wear leveling method for sequential storage of a data acquisition card, comprising:
[0007] Get the statistics page data, calculate the current data storage location and update the location address;
[0008] Determine whether the collected data has been stored. If it has been stored, accumulate the storage location address and write the statistical page flag. Otherwise, offset one address and accumulate the storage location address.
[0009] Determine whether the FLASH is full. If it is full, erase the statistics page and update the storage location to the data start page.
[0010] Preferably, the step of obtaining the statistical page data includes:
[0011] Based on the stored data, determine whether the FLASH block is used for the first time. If it is used for the first time, count the entire FLASH bad blocks and location information, clear the statistics block, and initialize the storage location information. When data is stored later, update the storage location;
[0012] If it is not the first time to use, read the number and location of bad blocks and obtain the statistics page data.
[0013] Preferably, the step of judging whether the collected data has been stored, accumulating the storage location address and writing the statistical page flag if the data has been stored, and accumulating the storage location address by offsetting an address otherwise comprises:
[0014] Calculate the current data storage location based on the statistical page data, and determine whether the collected data is stored;
[0015] If the collected data has been stored, the storage location address is accumulated and the statistical page flag is written;
[0016] If the collected data has not been stored, the collected data is re-determined until the collected data has been stored.
[0017] Preferably, the determining whether the FLASH is full, if it is full, erasing the statistics page, and updating the storage location to the data start page comprises:
[0018] Determining whether the FLASH block is full based on the statistical page bit flag;
[0019] If the FLASH block is full, after updating the total number of writes, the statistics block is erased, the storage location is updated, and the information storage is completed;
[0020] If the FLASH block is not full, it is determined again whether the collected data is stored until the FLASH block is full.
[0021] Preferably, it also includes:
[0022] A FLASH block is written separately as data into the statistics block, and the bits of each page in the statistics block correspond to each flag bit in the data block and are continuously written.
[0023] Preferably, the step of writing a FLASH block as data into a statistics block comprises:
[0024] Use other blocks as data blocks for storing data in the data acquisition card, and calculate the address written in the current data block. When the data is stored next time, write the address offset in the data block and continue writing.
[0025] Preferably, one BIT of the statistics page corresponds to one data page in the data block.
[0026] The present invention also provides a wear leveling device for sequential storage of a data acquisition card, comprising:
[0027] Data acquisition module, obtains statistical page data, calculates the current data storage location and updates the location address;
[0028] The judgment module judges whether the collected data has been stored. If it has been stored, the storage location address is accumulated and the statistical page flag is written. Otherwise, the storage location address is accumulated by offsetting an address.
[0029] The storage location update module determines whether the FLASH is full. If it is full, the statistics page is erased and the storage location is updated to the data start page.
[0030] The present invention also provides a wear leveling device for sequential storage of a data acquisition card, comprising:
[0031] Memory for storing computer programs;
[0032] A processor is used to implement the steps of the above-mentioned wear leveling method for sequential storage of a data acquisition card when executing the computer program.
[0033] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the wear leveling method for sequential storage of a data acquisition card described above are implemented.
[0034] The present invention provides a wear leveling method for sequential storage of a data acquisition card. In an application scenario where collected data is continuously stored in a data acquisition card, data is written repeatedly into each block of FLASH. By means of address flag bits (BITs), the erase life of the FLASH block where data location information is written can be effectively synchronized with the erase life of the FLASH where the collected data block is written, thereby maximizing the use of the erase life of the entire FLASH, improving the speed of data storage, and indirectly improving the sampling rate of the data acquisition card. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0036] Figure 1 A flowchart of a first specific embodiment of a wear leveling method for sequential storage of a data acquisition card provided by the present invention;
[0037] Figure 2 It is a flowchart of the erase position statistics method;
[0038] Figure 3 The storage flow chart for FLASH round-robin load balancing;
[0039] Figure 4 A structural block diagram of a wear leveling device for sequential storage of a data acquisition card provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The core of the present invention is to provide a wear leveling method, device, equipment and storage medium for sequential storage of a data acquisition card, which writes the storage location according to the FLASH bit-by-bit write statistics on time, realizes the load balancing of the entire FLASH cycle, maximizes the use of the entire FLASH erase life, and improves the speed of data storage.
[0041] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0042] Please refer to Figure 1 , Figure 1 This is a flow chart of a first specific embodiment of a wear leveling method for sequential storage of a data acquisition card provided by the present invention; the specific operation steps are as follows:
[0043] Step S101: Obtain statistical page data, calculate the current data storage location and update the location address;
[0044] Before getting the statistics page data, include:
[0045] Based on the stored data, determine whether the FLASH block is used for the first time. If it is used for the first time, count the entire FLASH bad blocks and location information, clear the statistics block, and initialize the storage location information. When data is stored later, update the storage location;
[0046] If it is not the first time to use, read the number and location of bad blocks and obtain the statistics page data.
[0047] Step S102: determine whether the collected data has been stored, if so, accumulate the storage location address and write the statistical page flag, otherwise offset one address and accumulate the storage location address;
[0048] Calculate the current data storage location based on the statistical page data, and determine whether the collected data is stored;
[0049] If the collected data has been stored, the storage location address is accumulated and the statistical page flag is written;
[0050] If the collected data has not been stored, the collected data is re-determined until the collected data has been stored.
[0051] Step S103: determine whether the FLASH is full, if it is full, erase the statistics page and update the storage location to the data start page;
[0052] Determining whether the FLASH block is full based on the statistical page bit flag;
[0053] If the FLASH block is full, after updating the total number of writes, the statistics block is erased, the storage location is updated, and the information storage is completed;
[0054] If the FLASH block is not full, it is determined again whether the collected data is stored until the FLASH block is full.
[0055] like Figure 2 As shown, it also includes writing a FLASH block as data into the statistics block separately, and corresponding the bit of each page in the statistics block to each flag bit in the data block, using other blocks as data blocks for storing data in the data acquisition card, and calculating the address written in the current data block. When the data is stored next time, the address offset is written into the data block and writing continues.
[0056] One BIT of the statistics page corresponds to one data page in the data block.
[0057] This embodiment provides a wear leveling method for sequential storage of a data acquisition card. In the application of sequential storage with continuous writing of the data acquisition card, a data cyclic writing mode is innovatively proposed, and only the write position offset is counted to mark the current write position. Because each data block will be written cyclically, the number of writes increases in sequence according to the number of cycles, which reduces the overhead of calculating the number of block writes in the storage of collected data, improves the data writing speed, and implements a balanced erase strategy for cyclic storage to maximize the life of the memory. There is no additional data movement operation and the write position is stored according to the bit (BIT) mark in the page (PAGE), realizing power-off protection and repeated writing after power-on.
[0058] Based on the above embodiment, this embodiment describes the wear leveling method of sequential storage of the data acquisition card, such as Figure 3 As shown, the details are as follows:
[0059] First, a statistical block for recording data storage is allocated in the data acquisition card. Then, when data is stored in the data block (i.e., other blocks except the statistical block), it is marked in the statistical block, so that the data can be stored in sequence in the form of position offset. In addition, the bit mark in the statistical block can also be used to determine whether the FLASH is full. If it is full, it is erased (in the scenario of sequential storage, if it is full, it does not need to be erased, and writing starts from the beginning (erasing once before writing)), and then the data is stored again from the beginning to achieve cyclic writing.
[0060] Specifically, each statistical page in the statistical block corresponds to each data block, and further, the BIT in each statistical page corresponds to the data page in the corresponding data block, so that the data page of the data block to which data is currently written can be determined based on the bit in the statistical block, and the next data write will start from the next page of the data page. At the same time, the statistical page bit flag is updated after the data is written.
[0061] Wear leveling (WL) methods include static wear leveling (Static WL) and dynamic wear leveling (Dymaic WL). Dynamic wear leveling means that when a new block needs to be allocated for storage, the block with the smallest number of erases is selected first. Dynamic wear leveling is applicable to blocks without valid data (also called free blocks), while static wear leveling is used for blocks with valid data (also called non-free blocks). Static wear leveling is to move cold data (Cold Data) that has not been modified for a long time from blocks with fewer erase times to blocks with more erase times, so that blocks with fewer erase times will be reused. The identification methods of cold data are divided into frequency considerations, time considerations, and a combination of the two. According to the operation mode, it can be divided into write-time identification and read-time identification. Representative algorithms for frequency considerations include Bloom Filter, etc., and representatives for time consideration algorithms include LRU and DAC, etc. Their improved algorithms may include frequency and time considerations.
[0062] Because the service life of FLASH is mainly the erase life, this method can realize one erase and write times by bit number by recording the statistical data storage position of the write bit (BIT). That is, there are 4KByte per page and 64 pages per block, with a total of 2048K BITs. That is, after one erase, there are 2048K writes. When recording the write position, the efficiency of FLASH life is greatly improved, and the service life is equivalent to 256K times by writing once and erasing once. Further, a statistical block with the erase times of FLASH can count a total of 4096x 64x 8=2048K pages, which fully meets the sum of all data pages of the data block, that is, it is completely possible to synchronize the erase times of the data block with the erase times of the statistical block, and the largest block uses the entire life of FLASH.
[0063] A single FLASH block is written as data into the statistics block, and the other blocks are used as data blocks for storing data in the data acquisition card. The BIT bit of each page in the statistics block corresponds to each write-in flag bit in the data block, so that the address written in the current data block can be calculated, and the next time data is stored, it can be offset from the data block and continue to write.
[0064] The embodiment of the present invention provides a wear leveling method for sequential storage of a data acquisition card, which innovatively proposes a data cyclic writing mode, only counts the write position offset to mark the current write position, reduces the overhead of calculating the number of block writes required for data acquisition storage, and improves the data writing speed. A method for erasing and writing position statistics is proposed, in which a FLASH block is separately used as a data writing statistics block, and other blocks are used as data blocks for storing data in the data acquisition card, so that the erase life of the FLASH block that writes data position information is effectively synchronized with the erase life of the FLASH that writes the acquisition data block, maximizes the use of the erase life of the entire FLASH, and improves the speed of data storage, indirectly improves the sampling rate of the data acquisition card, and realizes the improvement of storage rate (reducing write statistics calculation) and the guarantee of wear leveling effectiveness under the data acquisition and sequential continuous storage of the acquisition card.
[0065] Please refer to Figure 4 , Figure 4 A structural block diagram of a wear leveling device for sequential storage of a data acquisition card provided by an embodiment of the present invention; the specific device may include:
[0066] Data acquisition module 100, acquires statistical page data, calculates the current data storage location and updates the location address;
[0067] The judgment module 200 judges whether the collected data has been stored. If it has been stored, the storage location address is accumulated and the statistical page flag is written. Otherwise, the storage location address is accumulated by offsetting one address.
[0068] The storage location update module 300 determines whether the FLASH is full. If it is full, the statistics page is erased and the storage location is updated to the data start page.
[0069] A wear leveling device for sequential storage of a data acquisition card in this embodiment is used to implement the aforementioned wear leveling method for sequential storage of a data acquisition card. Therefore, the specific implementation method of a wear leveling device for sequential storage of a data acquisition card can be seen in the embodiment part of the wear leveling method for sequential storage of a data acquisition card in the previous text. For example, the data acquisition module 100, the judgment module 200, and the storage location update module 300 are respectively used to implement steps S101, S102, and S103 in the aforementioned wear leveling method for sequential storage of a data acquisition card. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, which will not be repeated here.
[0070] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0071] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0072] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.
[0073] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0074] The above is a detailed introduction to the wear leveling method, device, equipment and storage medium for sequential storage of a data acquisition card provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0075] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0076] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0077] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
Claims
1. A wear leveling method for sequential storage of a data acquisition card, characterized in that: include: Get the statistics page data, calculate the current data storage location and update the location address; Determine whether the collected data has been stored. If it has been stored, accumulate the storage location address and write the statistical page flag. Otherwise, offset one address and accumulate the storage location address. Determine whether the FLASH is full. If it is full, erase the statistics page and update the storage location to the data start page.
2. The wear leveling method for sequential storage of a data acquisition card as claimed in claim 1, characterized in that: The step of obtaining the statistics page data includes: Based on the stored data, determine whether the FLASH block is used for the first time. If it is used for the first time, count the entire FLASH bad blocks and location information, clear the statistics block, and initialize the storage location information. When data is subsequently stored, update the storage location; If it is not the first time to use, read the number and location of bad blocks and obtain the statistics page data.
3. The wear leveling method for sequential storage of a data acquisition card as claimed in claim 1, characterized in that: The method of judging whether the collected data has been stored, if it has been stored, accumulating the storage location address, writing the statistical page flag, otherwise offsetting an address to accumulate the storage location address includes: Calculate the current data storage location based on the statistical page data, and determine whether the collected data is stored; If the collected data has been stored, the storage location address is accumulated and the statistical page flag is written; If the collected data has not been stored, the collected data is re-determined until the collected data has been stored.
4. The wear leveling method for sequential storage of a data acquisition card as claimed in claim 3, characterized in that: The step of determining whether the FLASH is full, and if so, erasing the statistics page and updating the storage location to the data start page comprises: Determining whether the FLASH block is full based on the statistical page bit flag; If the FLASH block is full, after updating the total number of writes, the statistics block is erased, the storage location is updated, and the information storage is completed; If the FLASH block is not full, it is determined again whether the collected data is stored until the FLASH block is full.
5. The wear leveling method for sequential storage of a data acquisition card as claimed in claim 4, characterized in that: Also includes: A FLASH block is written separately as data into the statistics block, and the bits of each page in the statistics block correspond to each flag bit in the data block and are continuously written.
6. The wear leveling method for sequential storage of a data acquisition card as claimed in claim 5, characterized in that: The step of writing a FLASH block as data into a statistics block comprises: Use other blocks as data blocks for storing data in the data acquisition card, and calculate the address written in the current data block. When the data is stored next time, write the address offset in the data block and continue writing.
7. The wear leveling method for sequential storage of a data acquisition card as claimed in claim 1, characterized in that: One BIT of the statistics page corresponds to one data page in the data block.
8. A wear leveling device for sequential storage of a data acquisition card, characterized in that: include: Data acquisition module, obtains statistical page data, calculates the current data storage location and updates the location address; The judgment module judges whether the collected data has been stored. If it has been stored, the storage location address is accumulated and the statistical page flag is written. Otherwise, the storage location address is accumulated by offsetting an address. The storage location update module determines whether the FLASH is full. If it is full, the statistics page is erased and the storage location is updated to the data start page.
9. A wear leveling device for sequential storage of a data acquisition card, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of a wear leveling method for sequential storage of a data acquisition card as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a wear leveling method for sequential storage of a data acquisition card as described in any one of claims 1 to 7 are implemented.