Block adaptive allocation method and system based on SPI NOR Flash data storage

By embedding the block record table and deep learning algorithm in the SPI NOR Flash driver layer, combined with the prediction model and file subsystem algorithm, dynamically adjusting the read and write task allocation, it solves the problems of low block management accuracy and aging equipment in embedded systems. problem, significantly improving the performance and reliability of data storage systems.

CN118394273BActive Publication Date: 2024-10-08JIANGSU ZHUOYI INFORMATION TECH CO LTD +4
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410568358.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-08
Publication Date
2024-10-08
Estimated Expiration
2044-05-08

AI Technical Summary

Technical Problem

The existing software's flash file subsystem based on MTD cannot directly record the read and write operations on the MTD original device in the embedded system, resulting in accuracy defects. The block load distribution accuracy is low and cannot be adaptively adjusted, making it unable to effectively cope with equipment aging. question.

Method used

By intrusively modifying the SPI NOR Flash driver layer, embedding and initializing the block record table, collecting and analyzing statistical data, introducing deep learning algorithms to formulate adaptive block allocation strategies, dynamically optimizing the allocation plan combined with prediction models, and setting block life thresholds, Modify the file subsystem algorithm, conduct real-time testing and optimization at the hardware and software levels, achieve accurate recording and analysis of block usage, and dynamically adjust the allocation of read and write tasks.

Benefits of technology

Significantly improves the performance, reliability and service life of the SPI NOR Flash data storage system, solves the problems of low block management accuracy and inability to cope with equipment aging, achieves accurate recording and analysis of block usage, and extends the Flash life service life, and reduces maintenance costs through real-time optimization and automatic correction mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394273B_ABST
    Figure CN118394273B_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computer storage, and in particular to a method and system for adaptively allocating blocks based on SPI NOR Flash data storage. The method firstly modifies a driver layer, embeds and initializes a block usage record table, and realizes real-time updating and querying; secondly, analyzes the record table data, introduces a deep learning algorithm to formulate an adaptive block allocation strategy, and optimizes read and write operations; thirdly, constructs a prediction model, predicts the block usage trend and lifespan, and realizes dynamic allocation optimization; fourthly, sets a lifespan threshold, modifies a file subsystem algorithm, and integrates it with a driver layer, dynamically adjusts the allocation of read and write tasks, monitors the working status, and restricts read and write operations; finally, evaluates performance through real-time testing, optimizes the allocation strategy, sets a performance threshold, and monitors and automatically corrects abnormalities in real time; the invention significantly improves the performance, reliability, and service life of a SPI NOR Flash data storage device, and solves the problems of low block management accuracy and storage imbalance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer storage, and in particular to a block adaptive allocation method and system based on SPI NOR Flash data storage. Background Art

[0002] In embedded systems, in order to ensure the life and stability of the system, statistics are usually kept on flash reads and writes, and restrictions are placed on flash reads and writes at the operating system level, thereby extending the life of the flash chip; generally in embedded systems, the file subsystem will perform write balancing on the modules to balance the number of block reads and writes; existing software based on the MTD-based flash file subsystem (jffs2, yffs2) performs write balancing algorithms based on a self-maintained logical block list, but because these operations depend on the file subsystem, they can only record the read and write operations on the device after it is mounted through the file subsystem, and cannot record the direct read and write operations on the mtd original device, resulting in certain defects in accuracy.

[0003] For example, the patent with authorization announcement number CN111061649B discloses a method for adaptively allocating storage space of a memory, which divides all sectors of each storage chip in the memory into a data area and a mark area, and after reading the information of each storage chip one by one, maps the hardware address space of the actual data area of ​​each storage chip into a logical address space, and maps the mark area of ​​each storage chip into a mark space address table; performs an erase operation on sectors that are displayed as not erased, and updates the mark byte of the sector in the mark space for sectors that have already been erased in each storage chip; sets the starting address of the data to be written into the storage chip to the logical address of the storage chip; uses all existing data of the sector to be written together with the data to be written as the final data of the sector to be written; and the microcontroller erases the sector data or directly writes the final data into the sector based on whether the erase operation has been performed on the sector in the storage chip, so as to avoid repeated erasing of the storage chip.

[0004] The above existing technologies all have the following problems: 1) The existing software performs write balancing algorithm processing based on the MTD-based flash file subsystem (jffs2, yffs2) based on the self-maintained logical block list, but because these operations depend on the file subsystem, only the reading and writing of the device after mounting through the file subsystem can be recorded, and the direct reading and writing operations of the mtd original device cannot be recorded, and there are certain defects in accuracy; 2) For the existing block load distribution method, a single parameter is used, the corresponding block distribution accuracy is low and the error rate of data migration is high, and adaptive adjustment cannot be achieved. In order to solve the above problems, the present invention provides a block adaptive distribution method and system based on SPI NOR Flash data storage. Summary of the invention

[0005] In view of the shortcomings of the prior art, the present invention proposes a block adaptive allocation method and system based on SPI NOR Flash data storage. First, the SPI NOR Flash driver layer is intrusively modified, and the block usage record table is embedded and initialized. When receiving the upper-layer instruction, the corresponding block record table is updated, the actual erase operation is performed, and a query interface is provided for the upper layer to obtain block usage statistics. Secondly, the statistical data fed back in the record table is collected and analyzed, and a deep learning algorithm is introduced to formulate an adaptive block allocation strategy, and the optimal read and write operation allocation scheme is calculated. Then, a prediction model is constructed, and the usage trend and life change of each block are predicted using historical and real-time usage data, so as to dynamically optimize the allocation strategy. Subsequently, a block life threshold is set, the file subsystem algorithm is modified and integrated with the revised driver layer. When the file subsystem performs a write operation, the read and write task allocation is dynamically adjusted according to the block usage, the working status is monitored, and the read and write operations are limited according to the predicted life. Finally, through real-time testing of hardware and software, test data is collected to evaluate the performance, and the allocation strategy is optimized and adjusted accordingly. The performance indicator threshold is set to monitor the test process in real time. When Flash performance degradation or abnormality is detected, an alarm is triggered and fed back to the strategy and interactive interface to achieve automatic correction of abnormalities. This method effectively solves the problems of low block management accuracy and inability to cope with equipment aging in the existing technology, and significantly improves the performance, reliability and service life of the SPI NOR Flash data storage system.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] The block adaptive allocation method based on SPI NOR Flash data storage includes:

[0008] Step S1: Intrusively modify the SPI NOR Flash driver layer, embed the block usage record table and initialize it. When receiving an upper-layer instruction, update the record table of the block corresponding to the instruction and perform the actual erase operation. At the same time, query the block embedding record table through the query interface, obtain the statistical data in the corresponding block record table, and feed it back to the upper layer;

[0009] Step S2: Collect and analyze the statistical data fed back in the block record table, introduce a deep learning algorithm to formulate an adaptive block allocation strategy based on the analysis results, and use the formulated allocation strategy to calculate the optimal read and write operation allocation plan;

[0010] Step S3: construct a prediction model, and input the collected historical and real-time usage statistics of each block into the prediction model, predict the usage trend and life change data of each block, feed the predicted usage trend and life change data back to the adaptive block allocation strategy in step S2, and optimize the strategy in real time;

[0011] Step S4: Setting a block life threshold, modifying the file subsystem algorithm and integrating it with the modified driver layer. When the file subsystem performs a write operation, dynamically adjust the allocation of read and write tasks according to the acquired block usage, and monitor the block working status at the same time. Based on the monitored working status and predicted life change data, use the set block life threshold to limit the read and write operations of the block;

[0012] Step S5: Perform real-time testing on the hardware and software of the process from step S1 to step S4, collect real-time test data, and evaluate the test performance using the collected test data, and optimize and adjust the adaptive block allocation strategy according to the evaluation results;

[0013] Step S6: Set the threshold of the performance indicator, and monitor the performance indicator of the test process in step S5 in real time. When the Flash performance is detected to be degraded or abnormal, an alarm is triggered according to the threshold of the set performance indicator, and the abnormal situation is fed back to the adaptive block allocation strategy and the interactive interface to automatically correct the abnormality.

[0014] Step S2 introduces a deep learning algorithm to formulate an adaptive block allocation strategy, using a reinforcement learning algorithm. The specific steps include:

[0015] S201. Based on the statistical data fed back in the block record table, construct the input state of the reinforcement learning at the current time t in the adaptive block allocation strategy in, Indicates the percentage of used space of the i-th block at the current time t, Indicates the number of reads and writes of the i-th block at the current time t, Indicates the number of erasures of the i-th block at the current time t, represents the predicted remaining life of the i-th block at the current time t, Indicates the number of read and write requests sent to the i-th block at the current time t. Indicates the type of request sent to the i-th block at the current time t. Indicates the priority of sending a request to the i-th block at the current time t, represents the number and distribution of low-load blocks at the current time t, represents the average historical workload of the i-th block at the current time t, and the joint execution action at the current time t is in, Indicates the action of executing forced data migration at the current time t. Indicates that the action of increasing the selection priority of low-load and low-usage frequency blocks is executed at the current time t. Indicates that the read and write restrictions are executed on the blocks that have reached the lifespan threshold at the current time t. Indicates the action of increasing or decreasing the request priority at the current time t, and the combined reward function R at the current time t t , the specific combined reward function is:

[0016] in, Represents the space utilization optimization reward for all blocks, Indicates the read and write efficiency rewards for all blocks, represents all block life management rewards, r t p represents the request priority to satisfy the reward, α1, α2, α3, α4 represent the weighted coefficients of the corresponding rewards, k1, k2, k3, k4 represent the gain coefficients of the corresponding rewards; std(.) represents the standard deviation operator, β i represents the read / write efficiency coefficient determined according to the load status of the i-th block, γ i represents the remaining life reward coefficient determined according to the remaining life of block i, represents the lifespan threshold of the i-th block, Q h,t+1 , Q l,t+1 represents the status of high priority and low priority requests at the next moment in turn; f(.) represents the fitting function of the high priority and low priority request status;

[0017] S202: Build an adaptive block allocation strategy model based on the SAC reinforcement learning algorithm, and convert the constructed input state s at the current time t into t , and jointly execute action a at the current time t t and the current time t combined reward function R t Input into the constructed adaptive block allocation strategy model for training, and obtain the adaptive block allocation strategy model with training completion degree;

[0018] S203, deploying the acquired adaptive block allocation strategy model into the modified SPINO R Flash driver layer, and generating the optimal read / write operation and block allocation plan according to the request instructions issued in real time and the acquired usage data of each block.

[0019] Specifically, step S3 includes:

[0020] S301, collecting historical usage statistics of each block, current usage data of the block, and physical properties and wear data of the block from the record table, and performing cleaning and outlier removal preprocessing on the collected historical and real-time data;

[0021] S302, constructing a prediction model based on BiLSTM and a single-head attention network, inputting the preprocessed historical usage data into the constructed prediction model, and training the model using five-fold cross validation to obtain a trained prediction model;

[0022] S303, input the pre-processed block usage data at the current moment into the trained prediction model, calculate the usage trend data of each block in the next 12 hours, use the calculated usage trend data and the physical properties and wear data of the block at the current moment to calculate the remaining service life of each block, and sort the remaining service life of each block in descending order;

[0023] S304: Feedback the calculated block usage trend data for the next 12 hours and the remaining life of each block after descending order into the adaptive block allocation strategy model to dynamically adjust the block allocation strategy model.

[0024] Specifically, step S4 includes:

[0025] S401, inputting the set block life threshold and the calculated remaining life of the block into the adaptive block allocation strategy model to obtain the block read and write restriction instruction and the data forced migration instruction;

[0026] S402: When the file subsystem performs a write operation, when the remaining life and the number of erasures of the jth block exceed the corresponding set thresholds, read and write restrictions are imposed on the jth block according to the obtained block read and write restriction instructions and data forced migration instructions;

[0027] S403, collecting the remaining lifespan, historical data migration error rate, and remaining erase times of each block after sorting, and inputting the collected data into a comprehensive fuzzy algorithm to evaluate the health of each block and obtain a comprehensive health score of each block;

[0028] S404, sort the acquired health scores in descending order, and according to the sorting result, use the data forced migration instruction to forcibly transfer the erase operation and read and write data of the jth block to the kth block with the highest comprehensive health score after sorting for operation and storage.

[0029] Specifically, the specific process of step S5 includes:

[0030] S501, by combining the hardware level and the software level to build a test environment, start the test environment, simulate read and write operations according to the actual workload mode, and capture the operating index data of the Flash device and the test index data of each block in real time by modifying the SPI NOR Flash driver layer;

[0031] S502, preprocessing the obtained operation index data and test index data, and using the preprocessed index data to calculate the change of the comprehensive health score of each block, the data migration success rate, and the read-write restriction execution status, and compare the calculated block comprehensive health score change, data migration success rate, and read-write restriction execution status with the set industry benchmark threshold to obtain the effectiveness and efficiency of the adaptive block allocation strategy;

[0032] S502. Based on the obtained effectiveness and efficiency of the adaptive block allocation strategy, locate the specific performance bottleneck in the adaptive block allocation strategy at the current moment, automatically adjust the parameters of the adaptive block allocation strategy based on the performance bottleneck, and conduct a new round of real-time testing and iterative optimization on the adjusted strategy until all test results meet the industry benchmark threshold.

[0033] Specifically, the performance indicators of the test process in step S6 include read and write speed, erase and write times, delay, error rate, cache hit rate, queue depth and I / O busyness.

[0034] The block adaptive allocation system based on SPI NOR Flash data storage includes: driver layer recording and query module, adaptive block allocation module, file subsystem and partition management coordination module, system testing and optimization module and performance monitoring and alarm module;

[0035] The driver layer record and query module is used to initialize the block usage record table, record and update the usage information of each block, and enable the upper-layer software to query and return the block record table usage process data; the adaptive block allocation module is used to formulate an adaptive block allocation strategy based on the Flash usage data recorded by the driver layer, and predict the future Flash usage trend; the file subsystem and partition management collaboration module is used to dynamically adjust the write allocation strategy according to the block usage frequency, and monitor the status of each block in real time according to the block usage process data; the system test and optimization module is used to test the system in the actual environment and collect test data, and use the collected test data to optimize and adjust the adaptive block allocation strategy; the performance monitoring and alarm module is used to monitor the working performance of the Flash in real time, trigger an alarm when the Flash performance degrades or an abnormality occurs, and handle the abnormality;

[0036] Specifically, the driver layer recording and query module includes a block usage recording unit and a query interface unit; the adaptive block allocation module includes a data analysis unit, an allocation strategy formulation unit and a prediction unit; the file subsystem and partition management collaboration module includes a file subsystem modification unit and a partition management unit; the system test and optimization module includes a test data collection unit and an optimization adjustment unit; the performance monitoring and alarm module includes a performance monitoring unit and an alarm triggering unit;

[0037] The block usage record unit is used to initialize the block usage record table, record the number of times each block is used and erased, and update the record of the corresponding block at each erase or write operation; the query interface unit is used to provide an interface for the upper-level software to query the block usage record table and return the block usage data; the data analysis unit is used to read the Flash usage data recorded by the driver layer and analyze the usage frequency, erase and write times and remaining life of each block; the allocation strategy formulation unit is used to formulate an adaptive block allocation strategy based on the analysis results of the data analysis unit to achieve the optimal data read and write operation allocation; the prediction unit is used to predict the future Flash usage trend based on historical data to adjust the block allocation strategy; the file subsystem modification unit is used to modify the internal algorithm of the file subsystem and dynamically adjust the write allocation according to the block usage frequency. The system comprises a partition management unit, which is used to establish a detailed block usage record table on the Flash partition, monitor the number of erase times and usage frequency of each block in real time, and trigger write protection or restrict read and write operations when the number of erase times of a block reaches the preset life threshold, and force migration of read and write operation data to prevent data loss or performance degradation caused by excessive use of blocks; a test data collection unit, which is used to test the system in an actual environment and collect test data; an optimization and adjustment unit, which is used to analyze system performance according to test results and optimize and adjust the adaptive block allocation strategy based on the analysis results; a performance monitoring unit, which is used to monitor the performance indicators of the Flash in real time, collect and analyze performance data, and evaluate the working status of the Flash; an alarm triggering unit, which is used to trigger an alarm when the Flash performance degrades or an abnormality occurs according to a preset threshold.

[0038] Specifically, an electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements a block adaptive allocation method based on SPI NOR Flash data storage when executing the computer program.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] 1. Aiming at the deficiencies of the prior art, the present invention invasively modifies the SPI NOR Flash driver layer so that the system can directly read and write the mtd original device, thereby improving the accuracy of data acquisition, and formulates an adaptive block allocation strategy by introducing a deep learning algorithm, and dynamically optimizes the allocation strategy in combination with a prediction model, thereby realizing accurate recording and analysis of block usage; by modifying the file subsystem algorithm and dynamically adjusting the read and write task allocation according to the block usage, the service life of the Flash is effectively extended; through the above strategies, the present invention not only solves the problems of low block management accuracy and inability to cope with equipment aging in the prior art, but also significantly improves the overall performance and reliability of the Flash data storage system.

[0041] 2. The present invention continuously optimizes the adaptive block allocation strategy through real-time testing and performance evaluation to ensure that it can achieve optimal performance under various workloads; at the same time, by setting performance indicator thresholds and real-time monitoring, once the Flash performance degrades or an abnormality occurs, the system can quickly trigger an alarm and automatically correct the abnormality, thereby ensuring the stability and reliability of the storage system; the present invention not only improves data storage efficiency, but also extends the service life of the Flash and reduces maintenance costs; in addition, its real-time optimization and automatic correction mechanism make the storage system more intelligent. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is a flow chart of a method for adaptively allocating blocks based on SPI NOR Flash data storage according to Embodiment 1 of the present invention;

[0043] Figure 2 This is a diagram of the software-hardware application architecture of the test process of Example 1 of the present invention;

[0044] Figure 3 This is a module structure diagram of the block adaptive allocation system based on SPI NOR Flash data storage of the present invention. DETAILED DESCRIPTION

[0045] Example 1

[0046] See also Figure 1 , an embodiment of the present invention provides: a block adaptive allocation method based on SPI NOR Flash data storage, comprising the following steps:

[0047] Step S1: Intrusively modify the SPI NOR Flash driver layer, embed the block usage record table and initialize it. When receiving an upper-layer instruction, update the record table of the block corresponding to the instruction and perform the actual erase operation. At the same time, query the block embedding record table through the query interface to obtain the statistical data in the corresponding block record table, and feed it back to the upper layer. Furthermore, the record table embedded in each block in this embodiment records the information of each block including the number of uses, the number of erases and the access frequency. The query interface is connected to the SPI NOR Flash driver layer to enable the upper-layer software to obtain the usage data of the Flash.

[0048] Step S2: Collect and analyze the statistical data fed back in the block record table, introduce a deep learning algorithm to formulate an adaptive block allocation strategy based on the analysis results, and use the formulated allocation strategy to calculate the optimal read and write operation and block allocation plan;

[0049] Step S3: construct a prediction model, and input the collected historical and real-time usage statistics of each block into the prediction model, predict the usage trend and life change data of each block, feed the predicted usage trend and life change data back to the adaptive block allocation strategy in step S2, and optimize the strategy in real time; further, in this embodiment, the specific steps of step S3 include:

[0050] S301. Collect historical usage statistics of each block, current usage data of the block, physical properties and wear data of the block from the record table, and perform cleaning and outlier removal preprocessing on the collected historical and real-time data; including key indicators such as block read and write times, erase times, workload distribution, etc., and combine the physical properties (such as capacity, type, manufacturing batch, etc.) and wear data (such as erase times, number of bad blocks, etc.) of the block at the current moment;

[0051] S302, constructing a prediction model based on BiLSTM and a single-head attention network, inputting the preprocessed historical usage data into the constructed prediction model, and training the model using five-fold cross validation to obtain a trained prediction model;

[0052] S303, input the pre-processed block usage data at the current moment into the trained prediction model, calculate the usage trend data of each block in the next 12 hours, including the expected number of reads and writes, load changes; use the calculated usage trend data and the physical properties and wear data of the block at the current moment, use the wear model to calculate the remaining service life of each block, and sort the remaining service life of each block in descending order; wherein, the wear model is constructed by multivariate regression, machine learning algorithm (such as support vector machine, neural network) or physics-based model (such as Monte Carlo simulation); at the same time, add temperature to the constructed wear model to construct the wear rate to correct the prediction model in real time, wherein the specific formula of wear rate and temperature is:

[0053] E a

[0054] δ=k·e kbT , where k is an empirical constant that reflects the rate of wear reaction per unit time under given conditions (such as specific Flash materials, process technology, packaging method, etc.); E a is the activation energy, which refers to the minimum energy required to drive the inner block material to undergo wear reaction; k b is the Boltzmann constant, T is the actual working environment temperature of the driver chip;

[0055] S304. Feedback the calculated block usage trend data for the next 12 hours and the remaining life of each block in descending order to the adaptive block allocation strategy model, and dynamically adjust the block allocation strategy model, such as giving priority to allocating read and write tasks to blocks with longer remaining life, limiting write operations on blocks with shorter life, etc., so as to optimize resource utilization, extend equipment life and reduce the risk of data loss.

[0056] Step S4: Setting a block life threshold, modifying the file subsystem algorithm and integrating it with the modified driver layer, when the file subsystem performs a write operation, dynamically adjusting the allocation of read and write tasks according to the acquired block usage, and monitoring the block working status at the same time, and limiting the block read and write operations according to the monitored working status and predicted life change data using the set block life threshold; further, in this embodiment, the specific steps of step S4 include:

[0057] S401. According to the set block life threshold and the calculated remaining life of the block, the block read / write restriction instructions and the data forced migration instructions are input into the adaptive block allocation strategy model to avoid excessive use of blocks close to the life limit, so as to ensure data security and equipment life.

[0058] S402: When the file subsystem performs a write operation, when the remaining life and the number of erasures of the jth block exceed the corresponding set thresholds, read and write restrictions are imposed on the jth block according to the obtained block read and write restriction instructions and data forced migration instructions;

[0059] S403, collecting the remaining lifespan, historical data migration error rate, and remaining erase times of each block after sorting, and inputting the collected data into a comprehensive fuzzy algorithm to evaluate the health of each block and obtain a comprehensive health score of each block;

[0060] S404, sort the acquired health scores in descending order, and according to the sorting result, use the data forced migration instruction to forcibly transfer the erase operation and read and write data of the jth block to the kth block with the highest comprehensive health score after sorting for operation and storage.

[0061] This process effectively improves the data security, resource utilization and equipment life of the SPINOR Flash storage system through the above S401-S404 processes, realizes active protection, dynamic response and policy linkage of storage resources, and provides a strong guarantee for the long-term stable operation of the system.

[0062] Step S5: Perform real-time testing on the hardware and software of the process from step S1 to step S4, collect real-time test data, evaluate the test performance using the collected test data, and optimize and adjust the adaptive block allocation strategy according to the evaluation results; further, the specific process of step S5 in this embodiment includes:

[0063] S501, build a test environment by combining the hardware level and the software level, start the test environment, simulate read and write operations according to the actual workload mode, and capture the operating index data of the Flash device and the test index data of each block in real time by modifying the SPI NOR Flash driver layer; further, please refer to Figure 2 , the software and hardware include a file subsystem, the existing software records read and write operations at this layer; MTD original device, this embodiment records read and write operations at this layer; Flash hardware driver, this embodiment modifies the internal algorithm of the driver to enable it to have the function of directly recording and reading and writing MTD original devices, a driver interface, which is used to enable the upper-layer application to directly query the erasure and read and write times of the MTD original device, an operating system and an application system, which are used to control the entire read, write and erase process, and provide an operating space for issuing instructions; the specific workflow is as follows:

[0064] 1) After receiving the request, the operating system performs necessary permission checks, resource allocation (such as memory buffer), and other operations, and then encapsulates the request into instructions that adapt to the Flash hardware driver;

[0065] 2) The operating system sends the packaged instructions to the Flash hardware driver through the driver interface, and passes relevant parameters (such as data buffer address, read and write length, etc.);

[0066] 3) After receiving the instruction, the driver records the read and write operation information according to the internal algorithm, performs the actual read, write or erase operation, and updates the device status;

[0067] 4) Upper-layer applications (such as monitoring tools) can directly query the status information of the MTD original device such as the number of erases and reads and writes through the driver interface, and the driver returns the query results;

[0068] 5) For read operations, the Flash hardware driver writes the read data back to the memory buffer provided by the operating system, and then the operating system returns the read result to the application system.

[0069] S502, preprocessing the obtained operation index data and test index data, and using the preprocessed index data to calculate the change of the comprehensive health score of each block, the data migration success rate, and the read-write restriction execution status, and compare the calculated block comprehensive health score change, data migration success rate, and read-write restriction execution status with the set industry benchmark threshold to obtain the effectiveness and efficiency of the adaptive block allocation strategy;

[0070] S502. Based on the obtained effectiveness and efficiency of the adaptive block allocation strategy, locate the specific performance bottleneck in the adaptive block allocation strategy at the current moment, automatically adjust the parameters of the adaptive block allocation strategy based on the performance bottleneck, and conduct a new round of real-time testing and iterative optimization on the adjusted strategy until all test results meet the industry benchmark threshold.

[0071] Step S6: Set the threshold of the performance indicator, and monitor the performance indicator of the test process in step S5 in real time. When the Flash performance is monitored to be degraded or abnormal, an alarm is triggered according to the threshold of the set performance indicator, and the abnormal situation is fed back to the adaptive block allocation strategy and the interactive interface to automatically correct the abnormality. Furthermore, the performance indicators of the test process in step S6 of this embodiment include read and write speed, number of erase and write times, delay, error rate, cache hit rate, queue depth and I / O busyness.

[0072] In this embodiment, step S2 introduces a deep learning algorithm to formulate an adaptive block allocation strategy, using a reinforcement learning algorithm. The specific steps include:

[0073] S201. Based on the statistical data fed back in the block record table, construct the input state of the reinforcement learning at the current time t in the adaptive block allocation strategy in, Indicates the percentage of used space of the i-th block at the current time t, Indicates the number of reads and writes of the i-th block at the current time t, Indicates the number of erasures of the i-th block at the current time t, represents the predicted remaining life of the i-th block at the current time t, Indicates the number of read and write requests sent to the i-th block at the current time t. Indicates the type of request sent to the i-th block at the current time t. The request types include read, write and erase. The priority of sending a request to the i-th block at time t is comprehensively marked by the remaining life of the requested block and the current load, the importance of the requested storage data, and the time sensitivity of the application making the request; represents the number and distribution of low-load blocks at the current time t, It represents the average value of the historical workload of the i-th block at the current time t. The joint execution action at the current time t is in, Indicates the action of executing forced data migration at the current time t. Indicates that the action of increasing the selection priority of low-load and low-usage frequency blocks is executed at the current time t. Indicates that the read and write restrictions are executed on the blocks that have reached the lifespan threshold at the current time t. Indicates the action of increasing or decreasing the request priority at the current time t, and the combined reward function R at the current time t t , the specific combined reward function is:

[0074]

[0075] Among them, r t u Represents the space utilization optimization reward for all blocks. This reward is achieved by calculating the standard deviation or coefficient of variation of the utilization of all blocks. The smaller the standard deviation, the more balanced the space utilization, and the higher the reward. t e Represents the read and write efficiency reward for all blocks, which is rewarded by the decrease in the number of read and write times of high-load blocks, or the increase in the number of read and write times of low-load blocks; Represents the lifetime management reward for all blocks, which rewards the successful restriction of read and write actions of blocks close to the lifetime threshold, while encouraging the migration of data to blocks with longer lifetime and less frequent use; r t prepresents the reward for request priority satisfaction, which is calculated by the completion ratio or average waiting time of high-priority requests and the fairness index of low-priority requests. The fairness index includes Jain's fairness index, α1, α2, α3, α4 represent the weighting coefficients of the corresponding rewards, k1, k2, k3, k4 represent the gain coefficients of the corresponding rewards; std(.) represents the standard deviation operator, β i represents the read / write efficiency coefficient determined according to the load status of the i-th block, γ i represents the remaining life reward coefficient determined according to the remaining life of block i, represents the lifespan threshold of the i-th block, Q h,t+1 , Q l,t+1 represents the high priority and low priority request states at the next moment in turn; f(.) represents the high priority and low priority request state fitting function; the specific formula of the high priority and low priority request state fitting function in this embodiment is: f(Q h,t+1 , Q l,t+1 )=w h P h (Q h,t+1 )+w l P l (Q l,t+1 );where P h (Q h,t+1 ) indicates that according to Q h,t+1 The high-priority request processing status indicators calculated include the completion ratio or average waiting time of high-priority requests, P l (Q l,t+1 ) indicates that according to Q l,t+1 Calculate the fairness metrics for low-priority requests, including Jain's fairness index; w h , w l is the weighting coefficient of the corresponding indicator, which is used to adjust the relative importance of the high-priority request processing and the fairness of low-priority requests in the reward function; the high-priority request status is evaluated by calculating the completion ratio or average waiting time of high-priority requests, and the low-priority request status is measured by fairness indicators (such as Jain's fairness index) to measure the fairness of the system when processing low-priority requests. The closer the Jain's fairness index is to 1, the more balanced the service resources obtained by all low-priority requests, that is, the system maintains fairness as much as possible when processing low-priority requests;

[0076] S202: Build an adaptive block allocation strategy model based on the SAC reinforcement learning algorithm, and convert the constructed input state s at the current time t into t , and jointly execute action a at the current time t t and the current time t combined reward function R tInput into the constructed adaptive block allocation strategy model for training to obtain the adaptive block allocation strategy model of training completion; further, the adaptive block allocation strategy model of this embodiment includes a strategy network, a target strategy network, an evaluation network 1, a target evaluation network 1, an evaluation network 2, and a target evaluation network 2; the strategy network and the target strategy network are composed of a neural network 1 with the same structure, and the neural network 1 includes a convolutional neural network 1 with a convolution kernel size of 16, a ReLU layer, a fully connected layer 2 with a kernel size of 4, and a Tanh layer; the evaluation network 1, the target evaluation network 1, the evaluation network 2, and the target evaluation network 2 are composed of a neural network 2 with the same structure, and the neural network 2 includes a convolutional neural network 1 with a convolution kernel size of 16, a ReLU layer, a convolutional neural network 2 with a convolution kernel size of 8, a ReLU layer, a fully connected layer 2 with a kernel size of 4, and a fully connected layer 3 with a kernel size of 1; the evaluation network 1 corresponds to the target evaluation network 1, and the evaluation network 2 corresponds to the target evaluation network 2;

[0077] S203, deploying the acquired adaptive block allocation strategy model into the modified SPINORFlash driver layer, generating the optimal read and write operation allocation plan according to the real-time request instructions and the acquired usage data of each block, so as to achieve load balancing and life extension of each block.

[0078] Example 2

[0079] See also Figure 3 , another embodiment provided by the present invention: a block adaptive allocation system based on SPINORFlash data storage, comprising: a driver layer recording and query module, an adaptive block allocation module, a file subsystem and partition management collaboration module, a system testing and optimization module and a performance monitoring and alarm module;

[0080] The driver layer record and query module is used to initialize the block usage record table, record and update the usage information of each block, and enable the upper-layer software to query and return the block record table usage process data; the adaptive block allocation module is used to formulate an adaptive block allocation strategy based on the Flash usage data recorded by the driver layer, and predict the future Flash usage trend; the file subsystem and partition management collaboration module is used to dynamically adjust the write allocation strategy according to the block usage frequency, and monitor the status of each block in real time according to the block usage process data; the system test and optimization module is used to test the system in the actual environment and collect test data, and use the collected test data to optimize and adjust the adaptive block allocation strategy; the performance monitoring and alarm module is used to monitor the working performance of the Flash in real time, trigger an alarm when the Flash performance degrades or an abnormality occurs, and handle the abnormality;

[0081] The driver layer record and query module includes a block usage record unit and a query interface unit; the adaptive block allocation module includes a data analysis unit, an allocation strategy formulation unit and a prediction unit; the file subsystem and partition management collaboration module includes a file subsystem modification unit and a partition management unit; the system test and optimization module includes a test data collection unit and an optimization adjustment unit; the performance monitoring and alarm module includes a performance monitoring unit and an alarm triggering unit;

[0082] The block usage record unit is used to initialize the block usage record table, record the number of times each block is used and erased, and update the record of the corresponding block at each erase or write operation; the query interface unit is used to provide an interface for the upper-level software to query the block usage record table and return the block usage data; the data analysis unit is used to read the Flash usage data recorded by the driver layer and analyze the usage frequency, erase and write times and remaining life of each block; the allocation strategy formulation unit is used to formulate an adaptive block allocation strategy based on the analysis results of the data analysis unit to achieve the optimal data read and write operation allocation; the prediction unit is used to predict the future Flash usage trend based on historical data to adjust the block allocation strategy; the file subsystem modification unit is used to modify the internal algorithm of the file subsystem and adjust the block allocation strategy based on the block usage. The frequency dynamically adjusts the write allocation strategy; the partition management unit is used to establish a detailed block usage record table on the Flash partition, monitor the number of erase times and usage frequency of each block in real time, and trigger write protection or limit read and write operations when the number of erase times of a block is close to the preset life threshold to prevent data loss or performance degradation caused by excessive use; the test data collection unit is used to test the system in an actual environment and collect test data; the optimization and adjustment unit is used to analyze the system performance according to the test results, and use the analysis results to optimize and adjust the adaptive block allocation strategy; the performance monitoring unit is used to monitor the performance indicators of the Flash in real time, collect and analyze performance data to evaluate the working status of the Flash; the alarm trigger unit is used to trigger an alarm when the Flash performance degrades or an abnormality occurs according to the preset threshold;

[0083] First, the driver layer record and query module uses the block usage record unit to initialize the block usage record table and updates the record after each Flash operation. When the upper-layer software needs to query the block usage, the query interface unit provides an interface and returns data; second, the data analysis unit of the adaptive block allocation module reads the record data returned by the query interface unit and analyzes the block usage. At the same time, the allocation strategy formulation unit is used to formulate an allocation strategy, and the prediction unit is used to predict future usage trends based on historical data and adjust the allocation strategy; fourth, the file subsystem modification unit of the file subsystem and partition management collaboration module adjusts the write allocation strategy according to the block usage frequency, while the partition management unit monitors the status of each block and triggers write protection or restriction operations when necessary; fifth, the system test and optimization module collects real-time test performance data through the test data collection unit, and uses the optimization adjustment unit to analyze the performance data to optimize the allocation strategy; sixth, the performance monitoring and alarm module uses the performance monitoring unit to monitor the performance indicators in real time. Once the performance degrades or is abnormal, the alarm trigger unit will trigger an alarm.

[0084] The system significantly improves the performance and reliability of the data storage system by integrating five modules: driver layer recording and query, adaptive block allocation, file subsystem and partition management collaboration, system testing and optimization, and performance monitoring and alarm. The system can record and query block usage in real time, formulate the best block allocation strategy based on data analysis, and predict future usage trends for dynamic adjustment. At the same time, the collaborative work of the file subsystem and partition management effectively prevents performance degradation or data loss caused by excessive use. Through system testing and optimization, the allocation strategy is continuously improved to ensure that the system is always in the best condition. Real-time monitoring and exception handling of the performance monitoring and alarm module further ensure the stable operation of the system. The system not only solves the problems of low management accuracy and inability to cope with equipment aging in traditional storage technology, but also provides a more efficient and stable solution for data storage.

[0085] Example 3

[0086] A computer-readable storage medium stores computer instructions, which, when executed, execute the steps of a block adaptive allocation method based on SPI NOR Flash data storage.

[0087] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in the field may also change, modify, replace and modify the above-mentioned embodiments without departing from the scope of protection of the purpose of the present invention and the claims, and all of these are within the protection of the present invention.

Claims

1. The block adaptive allocation method based on SPINOR Flash data storage is characterized by: include: Step S1: Intrusively modify the SPINOR Flash driver layer, embed the block usage record table and initialize it. When receiving the upper layer instruction, update the record table of the block corresponding to the instruction and perform the actual erase operation. At the same time, query the block embedding record table through the query interface, obtain the statistical data in the corresponding block record table, and feed it back to the upper layer; Step S2: Collect and analyze the statistical data fed back in the block record table, introduce a deep learning algorithm to formulate an adaptive block allocation strategy based on the analysis results, and use the formulated allocation strategy to calculate the optimal read and write operation allocation plan; Step S3: construct a prediction model, and input the collected historical and real-time usage statistics of each block into the prediction model, predict the usage trend and life change data of each block, feed the predicted usage trend and life change data back to the adaptive block allocation strategy in step S2, and optimize the strategy in real time; Step S4: Setting a block life threshold, modifying the file subsystem algorithm and integrating it with the modified driver layer. When the file subsystem performs a write operation, dynamically adjust the allocation of read and write tasks according to the acquired block usage, and monitor the block working status at the same time. Based on the monitored working status and predicted life change data, use the set block life threshold to limit the read and write operations of the block; Step S5: Perform real-time testing on the hardware and software of the process from step S1 to step S4, collect real-time test data, and evaluate the test performance using the collected test data, and optimize and adjust the adaptive block allocation strategy according to the evaluation results; Step S6: Set the threshold of the performance indicator, and monitor the performance indicator of the test process in step S5 in real time. When the Flash performance is detected to be degraded or abnormal, an alarm is triggered according to the threshold of the set performance indicator, and the abnormal situation is fed back to the adaptive block allocation strategy and the interactive interface to automatically correct the abnormality. The step S2 introduces a deep learning algorithm to formulate an adaptive block allocation strategy, using a reinforcement learning algorithm, and the specific steps include: S201. Based on the statistical data fed back in the block record table, construct the input state of the reinforcement learning at the current time t in the adaptive block allocation strategy in, Indicates the percentage of used space of the i-th block at the current time t, Indicates the number of reads and writes of the i-th block at the current time t, Indicates the number of erasures of the i-th block at the current time t, represents the predicted remaining life of the i-th block at the current time t, Indicates the number of read and write requests sent to the i-th block at the current time t. Indicates the type of request sent to the i-th block at the current time t. Indicates the priority of sending a request to the i-th block at the current time t, represents the number and distribution of low-load blocks at the current time t, It represents the average value of the historical workload of the i-th block at the current time t. The joint execution action at the current time t is Among them, a t 1 Indicates the action of executing forced data migration at the current time t. Indicates that the action of increasing the selection priority of low-load and low-usage frequency blocks is executed at the current time t. Indicates that the read and write restrictions are executed on the blocks that have reached the lifespan threshold at the current time t. Indicates the action of increasing or decreasing the request priority at the current time t, and the combined reward function R at the current time t t , the specific combined reward function is: Among them, r t u represents the space utilization optimization reward for all blocks, r t e Represents the read and write efficiency reward for all blocks, r t l represents all block life management rewards, r t p represents the request priority to satisfy the reward, α1, α2, α3, α4 represent the weighted coefficients of the corresponding rewards, k1, k2, k3, k4 represent the gain coefficients of the corresponding rewards; std(.) represents the standard deviation operator, β i represents the read / write efficiency coefficient determined according to the load status of the i-th block, γ i represents the remaining life reward coefficient determined according to the remaining life of block i, represents the lifespan threshold of the i-th block, Q h,t+1 , Q l,t+1 represents the status of high priority and low priority requests at the next moment in turn; f(.) represents the fitting function of the high priority and low priority request status; S202: Build an adaptive block allocation strategy model based on the SAC reinforcement learning algorithm, and convert the constructed input state s at the current time t into t , and jointly execute action a at the current time t t and the current time t combined reward function R t Input into the constructed adaptive block allocation strategy model for training, and obtain the adaptive block allocation strategy model with training completion degree; S203, deploying the acquired adaptive block allocation strategy model into the modified SPINO R Flash driver layer, and generating the optimal read / write operation and block allocation plan according to the request instructions issued in real time and the acquired usage data of each block.

2. The block adaptive allocation method based on SPINO R Flash data storage as claimed in claim 1, characterized in that: The specific steps of step S3 include: S301, collecting historical usage statistics of each block, current usage data of the block, and physical properties and wear data of the block from the record table, and performing cleaning and outlier removal preprocessing on the collected historical and real-time data; S302, constructing a prediction model based on BiLSTM and a single-head attention network, inputting the preprocessed historical usage data into the constructed prediction model, and training the model using five-fold cross validation to obtain a trained prediction model; S303, input the pre-processed block usage data at the current moment into the trained prediction model, calculate the usage trend data of each block in the next 12 hours, use the calculated usage trend data and the physical properties and wear data of the block at the current moment to calculate the remaining service life of each block, and sort the remaining service life of each block in descending order; S304: Feedback the calculated block usage trend data for the next 12 hours and the remaining life of each block after descending order into the adaptive block allocation strategy model to dynamically adjust the block allocation strategy model.

3. The block adaptive allocation method based on SPINO R Flash data storage as claimed in claim 2, characterized in that: The specific steps of step S4 include: S401, inputting the set block life threshold and the calculated remaining life of the block into the adaptive block allocation strategy model to obtain the block read and write restriction instruction and the data forced migration instruction; S402: When the file subsystem performs a write operation, when the remaining life and the number of erasures of the jth block exceed the corresponding set thresholds, read and write restrictions are imposed on the jth block according to the obtained block read and write restriction instructions and data forced migration instructions; S403, collecting the remaining lifespan, historical data migration error rate, and remaining erase times of each block after sorting, and inputting the collected data into a comprehensive fuzzy algorithm to evaluate the health of each block and obtain a comprehensive health score of each block; S404, sort the acquired health scores in descending order, and according to the sorting result, use the data forced migration instruction to forcibly transfer the erase operation and read and write data of the jth block to the kth block with the highest comprehensive health score after sorting for operation and storage.

4. The block adaptive allocation method based on SPI NOR Flash data storage as claimed in claim 3, characterized in that, The specific process of step S5 includes: S501, by combining the hardware level and the software level to build a test environment, start the test environment, simulate read and write operations according to the actual workload mode, and capture the operating index data of the Flash device and the test index data of each block in real time by modifying the SPI NOR Flash driver layer; S502, preprocessing the obtained operation index data and test index data, and using the preprocessed index data to calculate the change of the comprehensive health score of each block, the data migration success rate, and the read-write restriction execution status, and compare the calculated block comprehensive health score change, data migration success rate, and read-write restriction execution status with the set industry benchmark threshold to obtain the effectiveness and efficiency of the adaptive block allocation strategy; S502. Based on the obtained effectiveness and efficiency of the adaptive block allocation strategy, locate the specific performance bottleneck in the adaptive block allocation strategy at the current moment, automatically adjust the parameters of the adaptive block allocation strategy based on the performance bottleneck, and conduct a new round of real-time testing and iterative optimization on the adjusted strategy until all test results meet the industry benchmark threshold.

5. The block adaptive allocation method based on SPI NOR Flash data storage as claimed in claim 4, characterized in that, The performance indicators of the test process in step S6 include read and write speed, erase and write times, delay, error rate, cache hit rate, queue depth and I / O busyness.

6. A block adaptive allocation system based on SPI NOR Flash data storage, which is implemented based on the block adaptive allocation system method based on SPI NOR Flash data storage according to any one of claims 1 to 5, characterized in that: include: Driver layer recording and query module, adaptive block allocation module, file subsystem and partition management collaboration module, system testing and optimization module, and performance monitoring and alarm module; The driver layer recording and query module is used to initialize the block usage record table, record and update the usage information of each block, and enable the upper-layer software to query and return the block record table usage process data; the adaptive block allocation module is used to formulate an adaptive block allocation strategy based on the Flash usage data recorded by the driver layer, and predict the future Flash usage trend; the file subsystem and partition management collaboration module is used to dynamically adjust the write allocation strategy according to the block usage frequency, and monitor the status of each block in real time according to the block usage process data; The system testing and optimization module is used to implement system testing and test data collection in an actual environment, and optimize and adjust the adaptive block allocation strategy using the collected test data; The performance monitoring and alarm module is used to monitor the working performance of the Flash in real time, trigger an alarm when the Flash performance degrades or an abnormality occurs, and handle the abnormality.

7. The block adaptive allocation system based on SPINOR Flash data storage as claimed in claim 6, characterized in that: The driver layer record and query module includes a block usage record unit and a query interface unit; the adaptive block allocation module includes a data analysis unit, an allocation strategy formulation unit and a prediction unit; the file subsystem and partition management collaboration module includes a file subsystem modification unit and a partition management unit; the system test and optimization module includes a test data collection unit and an optimization adjustment unit; the performance monitoring and alarm module includes a performance monitoring unit and an alarm triggering unit; The block usage record unit is used to initialize the block usage record table, record the number of times each block is used and the number of times it is erased, and update the record of the corresponding block during each erase or write operation; The query interface unit is used to provide an interface for the upper-layer software to query the block usage record table and return the block usage data; the data analysis unit is used to read the Flash usage data recorded by the driver layer and analyze the usage frequency, number of erases and writes, and remaining life of each block; the allocation strategy formulation unit is used to formulate an adaptive block allocation strategy based on the analysis results of the data analysis unit to achieve the optimal data read and write operation allocation; the prediction unit is used to predict the usage frequency and space share of each block based on historical data to adjust the block allocation strategy; The file subsystem modification unit is used to modify the internal algorithm of the file subsystem and dynamically adjust the write allocation strategy according to the block usage frequency; The partition management unit is used to establish a detailed block usage record table on the Flash partition, monitor the number of erasures and usage frequency of each block in real time, and trigger write protection or restrict read and write operations when the number of erasures of a block reaches a preset life threshold, and forcibly migrate the read and write operation data to prevent data loss or performance degradation caused by excessive use of blocks; The test data collection unit is used to test the system in an actual environment and collect test data; The optimization and adjustment unit is used to analyze system performance according to the test results, and optimize and adjust the adaptive block allocation strategy using the analysis results; The performance monitoring unit is used to monitor the performance indicators of the Flash in real time, collect and analyze performance data, and evaluate the working status of the Flash; The alarm triggering unit is used to trigger an alarm when the Flash performance degrades or an abnormality occurs according to a preset threshold.

8. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed, the block adaptive allocation method based on SPINOR Flash data storage as described in any one of claims 1 to 5 is executed.