Data writing method, flash memory device, and computer readable storage medium
By using machine learning models to identify file block types and optimize write order in flash memory devices, the problem of die-level access conflicts is resolved, improving the read performance and resource utilization of flash memory devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DAPUSTOR CORP
- Filing Date
- 2024-12-30
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies in flash memory devices suffer from performance degradation due to die-level access conflicts, especially when writing multiple files concurrently. They cannot effectively avoid die-level conflicts, leading to decreased read performance. Furthermore, existing fragmentation and defragmentation methods are time-consuming and resource-intensive.
A machine learning model is used to identify the data type of file blocks, and file blocks of the same type are sequentially and cyclically allocated to each raw die. By constructing a raw die location record table and managing the write cache, the writing order and position of file blocks are optimized, reducing raw die level conflicts.
It improves the read performance of flash memory devices, reduces die-level conflicts, and enhances data writing efficiency and resource utilization.
Smart Images

Figure CN120066402B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a data writing method, a flash memory device, and a computer-readable storage medium. Background Technology
[0002] Flash memory devices refer to storage devices manufactured using flash memory technology. For example, a solid-state drive (SSD) typically uses multiple NAND flash chips as its backend storage medium. Each flash chip usually contains multiple dies, and each die contains multiple storage cells for storing bits of data. A single die can only process one request at a time, while multiple dies allow the SSD to process multiple input / output requests in parallel. The higher the degree of parallel processing of data by these dies, the greater the bandwidth and throughput of the SSD. Conversely, if all the physical pages of data to be read are located on the same die, these pages can only be read one by one, not simultaneously, ultimately leading to a sharp decline in the SSD's read performance. This phenomenon is also known as die-level access conflict.
[0003] To avoid performance degradation caused by die-level access conflicts, most traditional SSD firmware uses a flash translation layer that allocates dies according to the order in which data is written. That is, dies are selected sequentially in a round-robin fashion, and the physical pages on that die are allocated to write requests, thus distributing the physical pages corresponding to consecutive logical pages of a file across different dies as much as possible. However, when writing multiple files concurrently, the flash translation layer cannot guarantee the continuous allocation of dies for the same file. Furthermore, as the file system ages, the data for a file may eventually be concentrated on only a portion of the dies, leading to die-level conflicts on those dies and consequently degrading the read performance of the flash device.
[0004] Currently, the common method to resolve disk-level conflicts is to defragment files, for example, by copying fragmented files to a new contiguous space and then deleting the fragmented areas. However, for large-capacity hard drives, this defragmentation process is time-consuming and consumes significant system resources, thus reducing the read performance of flash memory devices. Summary of the Invention
[0005] This application provides a data writing method, a flash memory device, and a computer-readable storage medium. By using a machine learning model to identify the data type of each file block, and sequentially allocating file blocks of the same type to each die, this application can reduce die-level conflicts and improve the read performance of the flash memory device.
[0006] The embodiments of this application provide the following technical solutions:
[0007] In a first aspect, embodiments of this application provide a data writing method applied to a flash memory device, the flash memory device including a flash memory chip, the flash memory chip including multiple dies, the method including:
[0008] Obtain the file block data flashed on the host, where one file block data corresponds to one file block;
[0009] Based on a machine learning model, file block data is identified to determine the data type of each file block. There are several types of data types for file blocks.
[0010] Based on the data type of each file block, determine several file blocks of the same data type;
[0011] Several file blocks of the same data type are sequentially written to several raw disks, wherein the file blocks of the same data type correspond sequentially to the raw disks.
[0012] In some embodiments, the method further includes:
[0013] The machine learning model is trained to obtain the trained machine learning model, including:
[0014] Obtain the original dataset, which includes the training dataset and the validation dataset, and the original dataset includes multiple file blocks of data;
[0015] The machine learning model is trained using a training dataset to optimize its parameters, resulting in an optimized machine learning model.
[0016] Based on the performance of the machine learning model on the validation dataset during the optimization process, the machine learning model with the best performance is selected as the final model to obtain the trained machine learning model.
[0017] In some embodiments, determining several file blocks of the same data type based on the data type of each file block includes:
[0018] Based on the data type of each file block, the file block data is grouped to obtain several file block groups, where each file block group corresponds one-to-one with a data type.
[0019] Based on the file block group, identify several file blocks of the same data type, where each file block group includes several file blocks.
[0020] In some embodiments, the method further includes:
[0021] Based on the number of file blocks in each file block group, several file block groups are sorted to obtain several sorted file block groups.
[0022] Write several file blocks of the same data type sequentially to several raw disks, including:
[0023] Write all file blocks in each file block group to several raw disks in sequence, according to the order of the file block groups.
[0024] In some embodiments, a brush batch contains multiple file block groups;
[0025] The method also includes:
[0026] Construct a raw die location record table, which is used to record the raw die location information of the last written raw die for each type of file block. Each type of file block includes file blocks of the same type from different brush batches.
[0027] Write several file blocks from each file block group sequentially to several raw disks, including:
[0028] Obtain the location information of the first raw die, wherein the location information of the first raw die is the location information of the first raw die, and the first raw die is the raw die of the last write of the same type of file block in the previous batch corresponding to the file block data type contained in the current batch;
[0029] Based on the position information of the first die, the position information of the second die is determined, wherein the position information of the second die is the die position information of the second die, and the second die is the die following the first die;
[0030] Write the first file block of each file block group in the current batch to the second die, and then write the remaining file blocks of each file block group to the die after the second die in sequence.
[0031] In some embodiments, the second die includes a plurality of physical pages, and each physical page corresponds to a sequence number;
[0032] Write the first file block of each file block group in the current brush batch to the second die, including:
[0033] Obtain the first free physical page of the second bare die, wherein the first free physical page is the free physical page with the first sequence number in the second bare die;
[0034] Write the first file block of each file block group in the current flush batch to the first free physical page.
[0035] In some embodiments, the flash memory device includes a write cache space for caching file block data flushed from the host.
[0036] The method also includes:
[0037] Determine whether the space occupied by file block data in the write cache is greater than a preset space threshold;
[0038] If so, write the entire file block in the write cache space to the raw disk;
[0039] If not, then control the write cache space to continue caching file block data flushed from the host.
[0040] In some embodiments, the method further includes:
[0041] Determine the write mode of the file block, where the write mode is either append write mode or overwrite write mode;
[0042] Determine the write mode of file blocks, including:
[0043] Obtain the flash memory mapping table, which records the mapping relationship between the logical block address and the physical page address of each file block;
[0044] Query the flash memory mapping table to determine if the logical block address corresponding to the current file block exists in the flash memory mapping table;
[0045] If so, the current file block's write mode is determined to be overwrite mode, where overwrite mode is used to write the current file block to the third raw disk, where the third raw disk is the raw disk corresponding to the logical block address of the current file block;
[0046] If not, the current file block is determined to be written in append mode, where append mode is used to write the current file block to the second bare disk, where the second bare disk is the next bare disk after the first bare disk, and the first bare disk is the bare disk to which the last file block of each file type in the current brush batch was written.
[0047] Secondly, embodiments of this application provide a flash memory device, including:
[0048] The processor and memory, the processor is used to execute executable program code in memory, and when the executable program code is executed, the processor executes instructions such as the data writing method of the first aspect.
[0049] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed, implements the data writing method as described in the first aspect.
[0050] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a data writing method applied to a flash memory device. The flash memory device includes flash memory chips, and each flash memory chip includes multiple dies. The method includes: acquiring file block data flashed by the host, wherein one file block data corresponds to one file block; identifying the file block data based on a machine learning model to determine the data type of each file block, wherein there are several data types for each file block; determining several file blocks of the same data type based on the data type of each file block; and sequentially writing the several file blocks of the same data type to several dies, wherein the file blocks of the same data type correspond sequentially to the dies. This application can identify the data type of each file block through a machine learning model and sequentially and cyclically allocate file blocks of the same type to each die, thereby reducing die-level conflicts and improving the read performance of the flash memory device. Attached Figure Description
[0051] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0052] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application;
[0053] Figure 2 This is a flowchart illustrating a data writing method provided in an embodiment of this application;
[0054] Figure 3 This is a schematic diagram of a file block classification technology based on machine learning provided in an embodiment of this application;
[0055] Figure 4 This is a schematic diagram of a process for obtaining a trained machine learning model according to an embodiment of this application;
[0056] Figure 5 yes Figure 2 A detailed flowchart of step S203 in the process;
[0057] Figure 6 This is a flowchart illustrating how to obtain a sorted group of file blocks according to an embodiment of this application;
[0058] Figure 7 This is a schematic diagram of a process for constructing a die location record table according to an embodiment of this application;
[0059] Figure 8 yes Figure 2 A detailed flowchart of step S204 in the process;
[0060] Figure 9 yes Figure 8 A detailed flowchart of step S241 in the process;
[0061] Figure 10 yes Figure 9 A detailed flowchart of step S2413 in the process;
[0062] Figure 11 This is a schematic diagram of a file block placement technology based on write cache provided in an embodiment of this application;
[0063] Figure 12 This is a flowchart illustrating a method for determining whether the space occupied by file block data in the write cache space is greater than a preset space threshold, provided in an embodiment of this application.
[0064] Figure 13 This is a flowchart illustrating a method for determining the writing mode of a file block, as provided in an embodiment of this application.
[0065] Figure 14 yes Figure 13 A detailed flowchart of step S1301 in the process;
[0066] Figure 15 This is a schematic diagram illustrating a file block placement technique based on write caching provided in an embodiment of this application for processing overwrite requests;
[0067] Figure 16 This is a schematic diagram illustrating a file block placement technique based on a mapping table for processing overwrite requests, provided in an embodiment of this application.
[0068] Figure 17 This is a schematic diagram of the structure of a flash memory device provided in an embodiment of this application.
[0069] Explanation of icon numbers:
[0070] label name label name 100 Application scenarios 10 host 20 Flash memory devices 210 processor 220 memory Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0072] Furthermore, the technical features involved in the various embodiments of this application described below can be combined with each other as long as they do not conflict with each other.
[0073] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0074] The technical solution of this application is described in detail below with reference to the accompanying drawings:
[0075] Please see Figure 1 , Figure 1 This is a schematic diagram of an application scenario provided in an embodiment of this application.
[0076] like Figure 1 As shown, application scenario 100 includes a host 10 and a flash memory device 20, wherein the host 10 is communicatively connected to the flash memory device 20.
[0077] In this embodiment, the host 10 includes an application layer, a file system layer, and an operating system layer. The application layer includes multiple applications. The host 10 is used to generate data through the applications in the application layer, for example, through user input, calculation, or file operations; write data to the file system layer by calling the file system interface; organize the data into file blocks through the file system layer and send a write request to the operating system; after the operating system receives the write request sent by the file system, it processes the write request through the I / O subsystem, wherein the write request corresponds to multiple file block data; and according to the write request, the file block data is flushed to the flash memory device 20 through the host interface (such as SATA, NVMe, etc.).
[0078] In this embodiment, the flash memory device 20 includes a flash memory chip, which includes multiple dies. The flash memory device 20 is used to acquire file block data that is flashed by the host 10, wherein one file block data corresponds to one file block; based on a machine learning model, the file block data is identified to determine the data type of each file block, wherein there are several types of data types for file blocks; based on the data type of each file block, several file blocks of the same data type are determined; and the several file blocks of the same data type are sequentially written to several dies, wherein the file blocks of the same data type correspond sequentially to the dies.
[0079] Please see Figure 2 , Figure 2 This is a flowchart illustrating a data writing method provided in an embodiment of this application.
[0080] The data writing method is applied to a flash memory device, which includes a flash memory chip and a plurality of dies.
[0081] like Figure 2 As shown, the data writing method includes:
[0082] Step S201: Obtain the file block data flashed on the host.
[0083] Specifically, the flash memory device communicates with the host and obtains file block data flashed by the host. One file block of data corresponds to one file block, which is a data storage unit in the file system, that is, the smallest allocation unit of data within the file system. The size of the file block is usually determined by the file system and can be fixed or variable. Common block sizes include, but are not limited to, 4KB, 8KB, or 16KB.
[0084] Existing file type identification tasks require processing large amounts of complex data. Current statistical identification methods suffer from poor recognition rates and a limited range of file types. For example, methods that directly determine file types based on features such as the longest common substring and subsequence, or byte frequency distribution, may fail to accurately distinguish different file types due to the influence of various factors (such as encoding, compression, and encryption). Therefore, the aforementioned existing technologies have low accuracy in file type identification.
[0085] To address the problems of the existing technical solutions, this application proposes a file block classification technology based on machine learning. This technology uses a large-scale training dataset to train a state-of-the-art machine learning model. Within a solid-state drive, the trained model can automatically predict the data type of file blocks and determine the location of the data on the flash memory based on the data type of the file blocks.
[0086] Please refer to the following: Figure 3 , Figure 3 This is a schematic diagram of a file block classification technology based on machine learning provided in an embodiment of this application.
[0087] like Figure 3As shown, this application combines the following advantages of machine learning models: First, machine learning algorithms can automatically learn and capture the main patterns of input data, improving recognition accuracy. The input data can be a combination of statistical features of the original file blocks, or the original file itself can be used as input, depending on the algorithm model. For example, the Scedan algorithm uses unigrams and bigrams as features of file block bytes and uses a support vector machine model to predict file block types. The FiFTy algorithm, on the other hand, directly uses the byte values of the original file as input and uses a CNN ensemble network to predict file block types. Second, with the increasing intelligence of solid-state drives (SSDs), some SSDs have incorporated computational modules, allowing for the loading and use of pre-trained machine learning modules to identify file blocks within the drive. For example, the FiFTy model, which can identify 75 file types, only requires 3.5MB of space, while the lightweight version only requires 1.7MB. This machine learning algorithm can be loaded into the computational module of the SSD, and this application proposes a machine learning-based file block classification module.
[0088] This machine learning model is placed on the computational module of the solid-state drive (SSD). It can be used to classify data written from the host side to the SSD side. Unclassified data blocks are predicted by the model and can be labeled with different file types, such as CSV, GIF, and ARW. The choice of machine learning model can be based on the needs of the actual task; models such as Sceadan, FiFTy, and ByteRCNN can be selected. Here, we take the FiFTy model as an example, which has a wide range of file types (75), high accuracy (77.5%), and significant influence. The FiFTy model can predict the file type of 512-byte or 4KB blocks of original file bytes. Its embedding layer can automatically learn the semantic information of the input bytes, and the CNN layer can learn the relationships and main patterns between the input and output data. Its training process includes the following three steps:
[0089] Step (1): Prepare the original dataset. The source of the data can be selected according to the file classification requirements of different task scenarios. For general models, open-source datasets that have already been labeled with file types can be selected. For specific scenarios, such as the RocksDB scenario, the target file types (such as WAL, SST files, etc.) need to be manually labeled before being input into the machine learning model for training. After obtaining the data, it is also necessary to divide the data into training set, validation set and dataset in a non-overlapping manner, with a typical ratio of 8:1:1.
[0090] Step (2): Input the input and target values of the training set data into the machine learning model for learning. Through learning, the machine learning model continuously fits the error between the predicted value calculated based on the input data and the specified target value. The fitting method generally uses the gradient descent algorithm to continuously correct the parameters of each layer in the model based on the error between the prediction result of the training set and the target result, thereby obtaining the optimized machine learning model.
[0091] Step (3): The training of the machine learning model in the optimization process is terminated by using the validation dataset to obtain the trained machine learning model. When the prediction results of the validation dataset begin to deteriorate, the training process needs to be stopped and the training is terminated. At this point, the training is complete, and the trained machine learning model is obtained. The trained model can be directly added to the computable module of the flash memory device to predict the data type of file blocks of 512 bytes or 4KB.
[0092] Please refer to the following: Figure 4 , Figure 4 This is a schematic diagram of a process for obtaining a trained machine learning model, provided in an embodiment of this application.
[0093] like Figure 4 As shown, the process of obtaining the trained machine learning model includes:
[0094] Step S401: Obtain the original dataset.
[0095] Specifically, the process involves acquiring the raw data. The source of this raw data can be chosen based on the file classification requirements of different task scenarios. For example, for a general model, an open-source dataset that has already been labeled with file types can be selected. For specific scenarios, such as the RocksDB scenario, the target file types (such as WAL, SST files, etc.) need to be manually labeled before being input into the machine learning model for training. After acquiring the raw data, it is also necessary to divide the raw data into training set, validation set, and dataset in a non-overlapping manner, typically in an 8:1:1 ratio, thus obtaining the raw dataset.
[0096] In some embodiments, the input data can be selected based on the different algorithm models. For example, the original dataset can be a combination of statistical features of the original file blocks or the original file itself. For instance, the Sceadan algorithm uses unigrams and bigrams as features of the file block bytes and uses a support vector machine model to predict the file block type. The FiFTy algorithm, on the other hand, directly uses the byte values of the original file as input and uses a CNN ensemble network to predict the file block type.
[0097] Step S402: Train the machine learning model using the training dataset to optimize the parameters of the machine learning model and obtain the optimized machine learning model.
[0098] Specifically, after obtaining the original dataset, the input and target values of the training dataset are fed into the machine learning model for learning. Learning involves the machine learning model continuously fitting the error between the predicted values calculated from the input data and the specified target values. The fitting method typically uses gradient descent to continuously adjust the parameters of each layer in the model based on the error between the prediction results from the training set and the target results, thus obtaining an optimized machine learning model.
[0099] Step S403: Based on the performance of the machine learning model on the validation dataset during the optimization process, select the machine learning model with the best performance as the final model to obtain the trained machine learning model.
[0100] Specifically, to ensure the optimized machine learning model generalizes rather than overfits during training, its performance on the validation dataset needs to be monitored. The optimized model is validated on the validation dataset to obtain the trained machine learning model. The performance of the machine learning model on the validation dataset during the optimization process includes the prediction accuracy, which is represented by the proportion of correctly predicted samples out of the total samples. The higher the accuracy, the better the machine learning model's performance. When the prediction results on the validation dataset start to deteriorate, the training process needs to be stopped. That is, based on the performance of the machine learning model on the validation dataset during the optimization process, the machine learning model with the best performance at the time of optimization is selected as the final model—that is, the machine learning model with the highest prediction accuracy. At this point, training is complete, and the trained machine learning model is obtained. The trained model can be directly added to the computable module of a flash memory device to predict the data type of file blocks of 512 bytes or 4KB.
[0101] Step S202: Based on the machine learning model, identify the file block data to determine the data type of each file block.
[0102] Specifically, based on the trained machine learning model obtained above, multiple file block data are identified, where one file block data corresponds to one file block, resulting in multiple file blocks. Then, the data type of multiple file blocks is predicted, so as to output the data type of each file block through the machine learning model. There are several types of data for file blocks, and the machine learning model includes, but is not limited to, models such as Sceadan, FiFTy, and ByteRCNN.
[0103] In this embodiment, if the trained machine learning model is a FiFTy model, the data types of file blocks predicted by the FiFTy model include, but are not limited to, CSV, EXE, GIF, and ARW data types. In specific scenarios, a more targeted machine learning model can be manually trained to perform more accurate file segmentation. For example, in the RocksDB scenario, the data types predicted by the machine learning model include, but are not limited to, SST and WAL; while in the MySQL scenario, the data types predicted by the machine learning model include, but are not limited to, ibd, binlog, and redo data types.
[0104] Step S203: Based on the data type of each file block, determine several file blocks of the same data type.
[0105] For details, please refer to [link / reference]. Figure 5 , Figure 5 yes Figure 2 A detailed flowchart of step S203 is shown.
[0106] like Figure 5 As shown, step S203: Based on the data type of each file block, determine several file blocks of the same data type, including:
[0107] Step S231: Group the file block data according to the data type of each file block to obtain several file block groups.
[0108] Specifically, the file block data is grouped according to the data type of each file block, so that file blocks of the same data type are divided into the same file block group, thus obtaining several file block groups. The file block group corresponds one-to-one with the data type. For example, if there are 5 file blocks of different data types in the file block data, then 5 file block groups can be determined.
[0109] Step S232: Based on the file block group, determine several file blocks of the same data type;
[0110] Specifically, after determining the file block group based on the data type, several file blocks in each file block group are determined based on the file block group, that is, several file blocks of the same data type are determined. Each file block group includes several file blocks.
[0111] In this application embodiment, a file block placement technology based on write cache is proposed. According to the file type identification results of the machine learning model, file blocks of the same type in the write cache of the flash memory device are written to the flash memory in a concentrated manner, which ensures that data of the same file type can make fuller use of each die.
[0112] Please refer to the following: Figure 6 , Figure 6 This is a flowchart illustrating how to obtain a sorted group of file blocks according to an embodiment of this application.
[0113] like Figure 6 The process for obtaining several sorted groups of file blocks, as shown, includes:
[0114] Step S601: Based on the number of file blocks in each file block group, sort several file block groups to obtain several sorted file block groups.
[0115] Specifically, when the write cache threshold is reached and data needs to be flushed, several file block groups are sorted based on the number of file blocks in each group. This results in several sorted file block groups, ordered from most to least number of file blocks of each file type. The write cache threshold can be set according to actual needs. Preferably, it is set to 20% of the dynamic random access memory (DRAM) size. For example, when the SSD write cache size reaches 20% of DRAM, a forced flush is performed. Then, based on the sorted file block groups, file blocks of the same type are flushed sequentially. This effectively isolates different file types of data during a single flush to a certain extent, thereby reducing die-level conflicts. Simultaneously, by placing data onto each die in a cyclical manner during flushing, the parallelism of the die can be better utilized when reading data of the same type.
[0116] In this embodiment, write cache data flushed in different batches can still cause significant die-level conflicts. Specifically, when the time intervals between multiple file blocks of the same file being written to the flash memory device on the host side differ greatly, these file blocks may exist in different write cache data batches. Consequently, these file blocks may be flushed from the write cache to the back-end flash memory in different batches. In this case, it cannot be guaranteed that the data in the next batch will be placed in the die-level order immediately following the data in the previous batch, which will cause a certain degree of die-level conflict. Therefore, it is necessary to record the die location (i.e., which die) of each type of file in the previous batch. The data in the next batch is placed according to this record. At this time, it is necessary to construct a die location record table to store the die location information of the previous batch of file blocks of each data type.
[0117] Please refer to the following: Figure 7 , Figure 7 This is a schematic diagram of a process for constructing a die location record table according to an embodiment of this application.
[0118] like Figure 7 As shown, the process of constructing the die location record table includes:
[0119] Step S701: Construct a die location record table.
[0120] Specifically, a raw die location record table is constructed. This table records the raw die location information of file blocks of each data type that are written to the raw die. Each data type file block includes file blocks from different flush batches. A flush batch is a single flush of all data in memory. These data can be categorized into multiple file block groups, thus a flush batch contains multiple file block groups. The raw die location record table also records the raw die location information of the last written raw die for each data type file block. Each data type file block includes file blocks from different flush batches of the same type from different file block groups. In subsequent steps, the raw die location information of file blocks from different flush batches can be obtained by querying the raw die location record table.
[0121] Step S204: Write several file blocks of the same data type sequentially to several raw disks.
[0122] In this context, the correspondence between file blocks of the same data type and raw dies means that several file blocks of the same data type are written to several raw dies in a sequential order.
[0123] For details, please refer to [link / reference]. Figure 8 , Figure 8 yes Figure 2 A detailed flowchart of step S204 is shown.
[0124] like Figure 8 As shown, step S204: sequentially write several file blocks of the same data type to several raw disks, including:
[0125] Step S241: Write all file blocks in each file block group to several raw disks in sequence, according to the order of the file block groups.
[0126] For details, please refer to [link / reference]. Figure 9 , Figure 9 yes Figure 8 A detailed flowchart of step S241 is shown.
[0127] like Figure 9 As shown, step S241: Following the sequential order of several file block groups, write all file blocks in each file block group to several raw disks, including:
[0128] Step S2411: Obtain the position information of the first bare die.
[0129] Specifically, first, the current batch is obtained. The last written raw disk of the same type of file block in the previous batch corresponding to the file block data type contained in the current batch is determined as the first raw disk. The location information of the first raw disk is obtained by querying the raw disk location record table. The first raw disk location information is the raw disk location information of the first raw disk. The first raw disk is the raw disk of the last file block written in each file block group of the previous batch of the current batch. The first raw disk is the raw disk of the last written file block in the previous batch corresponding to the file block data type contained in the current batch.
[0130] Step S2412: Determine the position information of the second die based on the position information of the first die.
[0131] Specifically, the first raw die location information includes the location of the last written raw die of the file block of the same type in the previous batch that corresponds to the data type of the file block contained in the current batch. This location is determined as the first raw die location. Then, based on the first raw die location information, the next location of the first raw die location can be obtained to determine the second raw die location information. The second raw die location information is the raw die location information of the second raw die, and the second raw die is the next raw die of the first raw die.
[0132] Step S2413: Write the first file block of each file block group in the current brush batch to the second die, and write the remaining file blocks of each file block group to the die after the second die in sequence.
[0133] For details, please refer to [link / reference]. Figure 10 , Figure 10 yes Figure 9 A detailed flowchart of step S2413 is shown.
[0134] like Figure 10 As shown, step S2413: Write the first file block of each file block group in the current brush batch to the second die, and write the remaining file blocks of each file block group to the die after the second die in sequence, including:
[0135] Step S4131: Obtain the first free physical page of the second die.
[0136] Specifically, each bare die includes multiple physical pages. These physical pages are sorted to determine their sequence number, and any unwritten physical pages are identified as free physical pages. The second bare die also includes multiple physical pages, with each page corresponding to a unique sequence number. The first free physical page of the second bare die is then obtained; this first free physical page is the free physical page with the earliest sequence number in the second bare die.
[0137] In this embodiment, sorting multiple physical pages on a die includes determining the sequence number of each physical page based on its address. The address of a physical page is its unique identifier on the die, similar to an address in computer memory, used to locate and access a specific physical page. During the sorting process, the address information of each physical page is first obtained; this address information is generally represented in binary, hexadecimal, or other formats. Then, based on the address information of each physical page, a sorting algorithm (such as bubble sort, quick sort, merge sort, etc.) is used to sort the physical pages. The purpose of sorting is to determine the relative position of each physical page on the die, thereby assigning each physical page a unique sequence number, which can be used for subsequent access, management, and maintenance operations.
[0138] Step S4132: Write the first file block of each file block group in the current flush batch to the first free physical page.
[0139] Specifically, when writing file blocks of the same data type in the next batch, the location information of the second bare die is determined according to the bare die location record table. Then, according to the location information of the second bare die, the first file block of each file block group in the current batch is written to the first free physical page in the second bare die. That is, for file blocks of the same data type, the data of the current file block is written to the free physical page with the earliest sequence number of the next bare die after the last one written to the bare die.
[0140] In this embodiment, this method ensures that when multiple batches of file data of the same data type are written, the data of the same data type can still be distributed sequentially across the various dies. Simultaneously, since the data of each file block is written to the first available physical page of each die's sequence number, it also ensures that there are not a large number of free physical pages between different files, thus making full use of the flash memory chip's space.
[0141] Please refer to the following: Figure 11 , Figure 11 This is a schematic diagram of a file block placement technology based on write cache provided in an embodiment of this application.
[0142] like Figure 11As shown, assuming the current flash memory contains 16 dies, referred to as die 1 to die 16, the data types of the file blocks include CSV, GIF and ARW types, where CSV type corresponds to CSV file blocks, GIF type corresponds to GIF file blocks and ARW type corresponds to ARW file blocks. During the first file block write process, if there are 23 CSV file blocks (numbered 1 to 23), 19 GIF file blocks (numbered 1 to 19), and 10 ARW file blocks (numbered 1 to 10) that need to be written to flash memory, the file block groups are first sorted according to the number of file blocks of each data type. The file blocks that are sorted first are written to flash memory first. Since the number of CSV file blocks is greater than the number of GIF file blocks, and the number of GIF file blocks is greater than the number of ARW file blocks, the CSV file blocks are written to flash memory first, then the 19 GIF file blocks are written to flash memory, and finally the 10 ARW file blocks are written to flash memory. Through the die location record table, the die where the CSV file blocks were last written is recorded as die 7, the die where the GIF file blocks were last written is recorded as die 10, and the die where the ARW file blocks were last written is recorded as die 4, thus completing the data flushing of this file block.
[0143] During the second file block write process, circles in the flash memory represent the data from the previous write, and squares represent the data from the current write. Assume there are 15 CSV file blocks to be written, numbered 24 to 38; and 3 ARW file blocks to be written, numbered 11 to 13. Since the number of CSV file blocks to be written is greater than the number of ARW file blocks, the CSV file blocks are written to the flash memory first. Using the die location record table, the die where the last CSV file block was written is found to be die 7. Therefore, the location for writing the current CSV file block number 24 is die 8. The CSV file block number 25 is written to die 9, the CSV file block number 26 is written to die 10, and so on, until the final die for writing the current CSV file block is die 6. Next, the ARW file block is written to the flash memory. By using the die location record table, it is found that the die where the last ARW file block was written is die 4. Therefore, the location where the ARW file block with the sequence number 11 is written is die 5. The ARW file block with the sequence number 12 is written to die 6, and the ARW file block with the sequence number 13 is written to die 7. Thus, the die where the last ARW file block was written is die 7.
[0144] During the third file block writing process, assuming there are 11 GIF file blocks to be written this time, with serial numbers 20 to 30; through the raw disk position record table, the last raw disk written to the previous GIF file block is raw disk 10, then the position for writing the GIF file block with serial number 20 this time is determined to be raw disk 11, and the GIF file block with serial number 20 is written to raw disk 11, the CSV file block with serial number 21 is written to raw disk 12, and so on, until the last raw disk written to the CSV file block this time is raw disk 5.
[0145] During the fourth write operation, assuming there are 17 ARW file blocks to be written, numbered 14 to 30; using the die location record table, we find that the last die block written to in the previous ARW file block was die 7. Therefore, we determine that ARW file block number 14 will be written to die 8. ARW file block number 15 will be written to die 9, ARW file block number 16 to die 10, and so on, until the last die block written to in this operation is die 8. It is important to note that... Figure 10 Each raw die consists of 8 physical pages. Each time a file block is written to the raw die, the file block needs to be written to the first free physical page of that raw die. For example, before writing the ARW file block with sequence number 29, the physical pages with sequence numbers 5 to 8 in raw die 7 are all free physical pages. At this time, it is determined that the first free physical page in the raw die is the physical page with sequence number 5, so the ARW file block with sequence number 29 is written to the physical page with sequence number 5.
[0146] In this embodiment of the application, taking the CSV file block (green) as an example, if the writing is not performed according to the rule of writing the first file block of each file block group in the current batch to the second die, then the CSV file block No. 24 should be placed in the position of the blue file block No. 11 in the flash memory (located on die 5). However, since the die record table shows that the last CSV file written was the green file No. 23 (located on die 7), this writing needs to find a free block at the position of die 8 to write to. At this time, it is ensured that the CSV file data can be placed sequentially and distributed on the die. Furthermore, if the writing is not performed according to the rule of writing the first file block of each file block group in the current flash batch to the first free physical page, there will be a free physical page between CSV (green) file block 38 and GIF (yellow) file block 20 before ARW (blue) data is written. As data is continuously written, this free physical page will cause a large number of data holes in the flash memory. However, if each die prioritizes writing to the free physical page with the earliest sequence number, this free physical page will eventually be used effectively, thus avoiding the generation of a large number of data holes in the flash memory.
[0147] Please refer to the following: Figure 12 , Figure 12 This is a flowchart illustrating a process for determining whether the space occupied by file block data in the write cache space is greater than a preset space threshold, provided in an embodiment of this application.
[0148] In this embodiment, the flash memory device includes a write cache space for caching file block data flushed by the host.
[0149] like Figure 12 As shown, the process for determining whether the space occupied by file block data in the write cache exceeds a preset space threshold includes:
[0150] Step S1201: Obtain the occupied space of file block data in the write cache space.
[0151] Specifically, each time the host flushes file block data, it retrieves the space occupied by the file block data in the current write cache space.
[0152] Step S1202: Determine whether the space occupied by file block data in the write cache space is greater than the preset space threshold.
[0153] Specifically, the flash memory device sets up a write cache in the dynamic random access memory within the disk to buffer data written to the disk by the host. Only after a preset space threshold is reached will the data in the cache be flushed to the back-end flash memory medium. That is, it is determined whether the space occupied by the file block data in the write cache space is greater than the preset space threshold. If the space occupied by the file block data in the write cache space is greater than the preset space threshold, then proceed to step S1203; if the space occupied by the file block data in the write cache space is less than or equal to the preset space threshold, then proceed to step S1204. It should be noted that the preset space threshold can be set according to actual needs. For example, the preset space threshold can be set to 20% of the write cache space. If the space occupied by the file block data in the current write cache space reaches 20% of the write cache space, then proceed to step S1203.
[0154] Step S1203: Write all file blocks in the write cache space to the raw disk.
[0155] Specifically, if the file block data in the write cache space occupies more than the preset space threshold, it means that the file block data in the current write cache space meets the condition for writing the file block to flash memory, and then all file blocks in the write cache space are written to the die.
[0156] Step S1204: Control the write cache space to continue caching file block data flushed from the host.
[0157] Specifically, if the space occupied by file block data in the write cache space is less than or equal to the preset space threshold, it means that the space occupied by file block data in the current write cache space does not meet the conditions for writing the file block to flash memory. In this case, the write cache space is controlled to continue to cache the file block data refreshed by the host and cache the file block data refreshed by the host in the write cache space.
[0158] In this application's embodiments, flushing file blocks of the same data type from the write cache in a concentrated manner is suitable for append-only write mode, but not for die-level conflicts in overwrite mode. Specifically, since flash memory cannot be updated in-situ, the data written in the overwrite operation and the data being overwritten are located in different locations in the flash memory. This disrupts the sequential placement order of the same file data on the die, greatly increasing the probability of flash memory access conflicts when this data is read. Based on this, this application proposes a method for writing file blocks to flash memory according to different write modes, wherein the write modes include overwrite mode and append-only write mode.
[0159] Please refer to the following: Figure 13 , Figure 13 This is a flowchart illustrating a method for determining the writing mode of a file block, as provided in an embodiment of this application.
[0160] like Figure 13 As shown, the process for determining the write mode of a file block includes:
[0161] Step S1301: Determine the write mode of the file block.
[0162] For details, please refer to [link / reference]. Figure 14 , Figure 14 yes Figure 13 A detailed flowchart of step S1301 is shown.
[0163] like Figure 14 As shown, step S1301: Determine the write mode of the file block, including:
[0164] Step S1311: Obtain the flash memory mapping table.
[0165] Specifically, the flash memory mapping table is obtained. This flash memory mapping table refers to the mapping table that converts logical block addresses to physical page addresses within the flash memory device. The flash memory mapping table records the physical page address information corresponding to the logical block address of the written data. In subsequent steps, the write mode of the file block can be identified and determined using this flash memory mapping table.
[0166] Step S1312: Query the flash memory mapping table to determine whether the logical block address corresponding to the current file block exists in the flash memory mapping table.
[0167] Specifically, the flash memory mapping table is queried to determine whether the logical block address corresponding to the current file block exists in the flash memory mapping table. If the logical block address corresponding to the current file block already exists in the flash memory mapping table, then proceed to step S1313; if the logical block address corresponding to the current file block does not exist in the flash memory mapping table, then proceed to step S1314.
[0168] Step S1313: Determine that the current file block's write mode is overwrite write mode.
[0169] Specifically, if the logical block address corresponding to the current file block already exists in the flash memory mapping table, then the current write mode is an overwrite mode. In overwrite mode, the current file block is written to a third die, which is the die corresponding to the logical block address of the current file block. For overwrite mode, the die corresponding to the logical block address of the current file block is identified as the third die, and the file block to be overwritten on the third die is determined based on the logical block address of the current file block. The flash memory translation layer of the flash memory device then writes the current file block onto the same die as the overwritten file block, based on the logical block address of the overwritten file block.
[0170] Step S1314: Determine that the current file block's write mode is append write mode.
[0171] Specifically, if the logical block address corresponding to the current file block does not exist in the flash memory mapping table, it means that the current write mode is the append write mode. The append write mode is used to write the current file block to the second die. The second die is the die following the first die, and the first die is the die to which the last file block of each file type in the current batch was written.
[0172] Please refer to the following: Figure 15 , Figure 15 This is a schematic diagram illustrating a file block placement technique based on write caching provided in an embodiment of this application for handling overwrite requests.
[0173] like Figure 15As shown, when the write mode of the current file block is determined without using a flash mapping table, the flash translation layer of the solid-state drive will default to append-only write mode when file blocks are overwritten to the same logical block address, allocating physical page addresses to the file blocks. Specifically, the flash mapping table cannot guarantee that the physical page addresses Y2 and Y3 allocated to the overwritten logical block addresses X2 and X3 are the same as their previous die locations. For example, suppose the logical block address corresponding to file block 65 is the same as the physical page address of file block 3, but the CSV (green) overwrite of file block 65 is not placed on die 3 corresponding to the overwritten file block 3, but is placed on die 1 according to the append-only write mode based on write cache data placement technology. This causes a backlog of valid CSV files on die 1, while the CSV data on die 3 is very sparse, ultimately leading to severe die-level conflicts when the CSV file is read.
[0174] Please refer to the following: Figure 16 , Figure 16 This is a schematic diagram illustrating a file block placement technique based on a mapping table for handling overwrite requests, provided in an embodiment of this application.
[0175] like Figure 16 As shown, assuming the current file block to be written is a CSV file block with sequence number 66, by querying the flash memory mapping table, it is determined that the logical block address corresponding to the CSV file block with sequence number 66 exists in the flash memory mapping table. If the logical block address corresponding to the current file block already exists in the flash memory mapping table, it means that the write mode corresponding to the current file block is the overwrite mode. In the overwrite mode, the current file block is written to the third die, which is the die corresponding to the logical block address of the current file block, i.e., die 6. For the overwrite mode, the flash memory translation layer of the flash memory device writes the CSV file block with sequence number 66 to the same die 6 as the overwritten file block according to the logical block address of the file block being overwritten.
[0176] For example, when using a flash memory mapping table, the physical page addresses allocated to the logical block addresses X2 and X3 for overwrite are the same as the die locations of the previous physical page addresses, meaning the data is still placed on die 2 and die 3. In flash memory, taking the 75th file block of a CSV as an example, the file block data is placed on die 3. The method for placing the overwrite data of the remaining file blocks is the same as the above method, and will not be elaborated further here.
[0177] In this embodiment, CSV file blocks are distributed very evenly across the various dies. The die containing the most CSV file blocks is die 15, with 4 CSV file blocks, while the die containing the fewest CSV file blocks contains 4 CSV file blocks, a difference of only 1. Compared to... Figure 14The scheme that does not use flash memory mapping table information to place overwrite data has a difference of 4 between the die containing the most CSV file blocks and the die containing the fewest CSV file blocks. This phenomenon will become more serious when a large amount of data is written later, which will lead to die-level conflicts.
[0178] In this application embodiment, a data writing method is provided, applied to a flash memory device. The flash memory device includes flash memory chips, and the flash memory chips include multiple dies. The method includes: acquiring file block data flashed by the host, wherein one file block data corresponds to one file block; identifying the file block data based on a machine learning model to determine the data type of each file block, wherein there are several data types of file blocks; determining several file blocks of the same data type according to the data type of each file block; and sequentially writing the several file blocks of the same data type to several dies, wherein the file blocks of the same data type correspond sequentially to the dies. By using a machine learning model to identify the data type of each file block and sequentially and cyclically allocating file blocks of the same type to each die, this application can reduce die-level conflicts and improve the read performance of the flash memory device.
[0179] Please refer to the following: Figure 17 , Figure 17 This is a schematic diagram of the structure of a flash memory device provided in an embodiment of this application.
[0180] like Figure 17 As shown, the flash memory device 20 includes one or more processors 210 and memory 220. Wherein, Figure 17 Take a processor 210 as an example.
[0181] Processor 210 and memory 220 can be connected via a bus or other means. Figure 17 Taking the example of a connection between China and Israel via a bus.
[0182] Processor 210 is configured to provide computing and control capabilities to control flash memory device 20 to perform corresponding tasks, such as controlling flash memory device 20 to perform a data writing method in any of the above method embodiments. This data writing method is applied to the flash memory device, which includes flash memory chips, each of which includes multiple dies. The method includes: acquiring file block data flashed by the host computer, wherein one file block data corresponds to one file block; identifying the file block data based on a machine learning model to determine the data type of each file block, wherein there are several data types for each file block; determining several file blocks of the same data type based on the data type of each file block; and sequentially writing the several file blocks of the same data type to several dies, wherein the file blocks of the same data type correspond sequentially to the dies.
[0183] By using a machine learning model to identify the data type of each file block and sequentially allocating file blocks of the same type to various dies, this application can reduce die-level conflicts and improve the read performance of flash memory devices.
[0184] Processor 210 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0185] Memory 220, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the data writing method in the embodiments of this application. Processor 210 can implement the data writing method in any of the above method embodiments by running the non-transitory software programs, instructions, and modules stored in memory 220. Specifically, memory 220 may include volatile memory (VM), such as random access memory (RAM); memory 220 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), solid-state drive (SSD), or other non-transitory solid-state storage devices; memory 220 may also include combinations of the above types of memory.
[0186] Memory 220 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 220 may optionally include memory remotely located relative to processor 210, and these remote memories may be connected to processor 210 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0187] One or more modules are stored in memory 220. When executed by one or more processors 210, they perform the data writing method in any of the above method embodiments, for example, the method described above. Figure 2 The steps shown.
[0188] In this embodiment, the flash memory device 20 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The flash memory device 20 may also include other components for implementing device functions, which will not be described in detail here.
[0189] This application also provides a non-volatile computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the data writing method described in the above embodiments. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0190] This application also provides a non-volatile computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the data writing method described in the above embodiments. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0191] This application also provides a computer program product comprising one or more lines of program code stored in a non-volatile computer-readable storage medium. A processor of a flash memory device reads the program code from the non-volatile computer-readable storage medium and executes the program code to complete the method steps of the data writing method provided in the above embodiments.
[0192] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a non-volatile computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0193] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, the program can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A data writing method, characterized in that, Applied to a flash memory device, the flash memory device including a flash memory chip, the flash memory chip including a plurality of dies, the method includes: Obtain the file block data flashed on the host, where one file block data corresponds to one file block; Based on a machine learning model, the file block data is identified to determine the data type of each file block, wherein there are several types of data for the file blocks; Based on the data type of each file block, determine several file blocks of the same data type; Several file blocks of the same data type are sequentially written to several bare dies, wherein the file blocks of the same data type correspond sequentially to the bare dies; The method further includes, before writing the file block to the raw disk: Determine the write mode of the file block, wherein the write mode is an append write mode or an overwrite write mode; The determination of the write mode of the file block includes: Obtain a flash memory mapping table, wherein the flash memory mapping table is used to record the mapping relationship between the logical block address and the physical page address of each file block; Query the flash memory mapping table to determine whether the logical block address corresponding to the current file block exists in the flash memory mapping table; If so, the current file block's write mode is determined to be overwrite mode, wherein the overwrite mode is used to write the current file block to the third raw disk, wherein the third raw disk is the raw disk corresponding to the logical block address of the current file block; If not, the current file block is determined to be written in append mode, wherein the append mode is used to write the current file block to the second bare disk, wherein the second bare disk is the next bare disk after the first bare disk, and the first bare disk is the bare disk to which the last file block of each file type in the current brush batch was written.
2. The method according to claim 1, characterized in that, The method further includes: Training the machine learning model to obtain a trained machine learning model includes: Obtain the original dataset, which includes a training dataset and a validation dataset, and the original dataset includes multiple file block data; The machine learning model is trained using the training dataset to optimize its parameters, resulting in an optimized machine learning model. Based on the performance of the machine learning model on the validation dataset during the optimization process, the machine learning model with the best performance at the time of optimization is selected as the final model to obtain the trained machine learning model.
3. The method according to claim 1, characterized in that, The step of determining several file blocks of the same data type based on the data type of each file block includes: Based on the data type of each file block, the file block data is grouped to obtain several file block groups, wherein each file block group corresponds one-to-one with a data type. Based on the file block group, several file blocks of the same data type are determined, wherein each file block group includes several file blocks.
4. The method according to claim 3, characterized in that, The method further includes: Based on the number of file blocks in each file block group, several file block groups are sorted to obtain several sorted file block groups. The step of sequentially writing several file blocks of the same data type into several raw disks includes: According to the sequential order of the file block groups, all file blocks in each file block group are written to the bare dies in turn.
5. The method according to claim 4, characterized in that, A single batch of downloads contains multiple groups of the aforementioned file blocks; The method further includes: Construct a raw die location record table, wherein the raw die location record table is used to record the raw die location information of the last written raw die for each type of file block, wherein each type of file block includes file blocks of the same type in different brush batches; The step of sequentially writing several file blocks from each of the file block groups to several raw disks includes: Obtain the location information of the first raw die, wherein the location information of the first raw die is the location information of the first raw die, and the first raw die is the raw die of the last write of the same type of file block in the previous batch corresponding to the file block data type contained in the current batch; Based on the first die position information, the second die position information is determined, wherein the second die position information is the die position information of the second die, and the second die is the die following the first die; Write the first file block of each file block group in the current batch to the second die, and then write the remaining file blocks of each file block group to the die after the second die in sequence.
6. The method according to claim 5, characterized in that, The second bare die includes multiple physical pages, and each physical page corresponds one-to-one with a serial number; The step of writing the first file block of each file block group in the current brush batch to the second raw die includes: Obtain the first free physical page of the second die, wherein the first free physical page is the free physical page with the first sequence number in the second die; Write the first file block of each file block group in the current flush batch to the first free physical page.
7. The method according to claim 1, characterized in that, The flash memory device includes a write cache space, which is used to cache file block data flushed by the host. The method further includes: Determine whether the space occupied by file block data in the write cache space is greater than a preset space threshold; If so, then write all file blocks of the write cache space to the raw disk; If not, then control the write cache space to continue caching file block data flushed by the host.
8. A flash memory device, characterized in that, include: A processor and a memory, the processor being configured to execute executable program code in the memory, wherein when the executable program code is executed, the processor executes instructions of the data writing method as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the data writing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Logical-to-physical mapping of data groups with data locality
US20210191850A1
Hot-Cold Chunks Soft-Prediction During Programming
US20230376227A1