Method and apparatus for managing nand flash memory
By using a Nand Flash storage management method in RAM, the first page of the block containing the data to be modified is read out and written to a new block, thus solving the problem of insufficient RAM space and enabling efficient data modification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEICHAI POWER CO LTD
- Filing Date
- 2022-12-30
- Publication Date
- 2026-07-21
AI Technical Summary
Existing Nand Flash storage management methods lack sufficient RAM space to temporarily store the data of the entire block, making data modification operations difficult.
By reading the first page of the Block containing the data to be modified into a preset RAM for processing, and then writing the processed data into the page of a new Block, while reading out the data that does not need to be modified and writing it into a new Block, the data storage linked list is regenerated, thus saving RAM space.
Without violating the NAND Flash hardware read/write operation mechanism, RAM space is saved and data modification is achieved efficiently.
Smart Images

Figure CN115933990B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method and apparatus for managing NAND flash memory. Background Technology
[0002] Flash memory, also known as flash storage, is a type of non-volatile memory chip. Data is not lost after power is turned off, and it can store large amounts of data. Nand Flash is a type of Flash memory used for storing large amounts of data.
[0003] In the storage space of Nand Flash memory, the order of each block is determined by an index table. That is, the storage space of Nand Flash is divided into several blocks with determinable locations by the index table. Each block is further divided into several smallest physical storage pages. When erasing data, the data is erased in blocks as the smallest unit; when writing data, the data is written in the smallest physical storage page as the smallest unit.
[0004] Existing technology manages data storage in NAND Flash by storing data contiguously in units of the smallest physical storage page (Page). After data is stored in the previous storage page, the next physical storage page is set as the next storage location through a linked list. Data in the NAND Flash can be stored sequentially, keeping the number of erases and writes of each physical block basically consistent and preventing physical blocks from having too many erase and write cycles. When all the smallest physical storage pages (Pages) are full and all blocks are full, the program erases the block with the earliest data written and then rewrites the data to the erased block.
[0005] However, the existing NAND Flash memory storage management method requires that when a user needs to modify a specific piece of data in the smallest physical storage page, according to the NAND Flash operation requirements, all the data in the entire block must be read into RAM, the corresponding data modified, the block erased, and the data rewritten sequentially into the current block before the data modification can be truly completed. In practical application scenarios, there is not enough RAM space to temporarily store the data of the entire block to achieve data modification.
[0006] Therefore, there is an urgent need to propose a NAND flash memory storage management method to solve the technical problem that existing NAND flash memory storage management methods do not have enough RAM space to temporarily store the data of the entire block in order to enable data modification. Summary of the Invention
[0007] This application provides a NAND flash memory storage management method and apparatus to at least solve the technical problem in related technologies where NAND flash memory storage management methods do not have enough RAM space to temporarily store the data of the entire block in order to modify the data.
[0008] According to one aspect of the embodiments of this application, a NAND flash memory storage management method is provided. The NAND flash memory includes a data management module and a mapping management module. The data management module is used to store files, and the mapping management module is used to store data storage linked lists corresponding to each file. The method includes: responding to a user's data modification instruction to the data management module, reading the first page of a first block containing the data to be modified into a preset RAM; processing the data to be modified in the preset RAM; writing the processed data to be modified into the storage location of a page of a preset second block based on the storage location of the first page; traversing the other pages of the first block excluding the first page, sequentially reading the data that does not need to be modified from the other pages into the preset RAM, and writing the data that does not need to be modified into the page of the preset second block based on the storage location of the other pages; and, based on the mapping management module, replacing the ID number of the second block with the ID number of the first block, and regenerating a new data storage linked list.
[0009] Optionally, the method further includes: erasing the contents of the first block and using the erased first block as the second block for the next data change.
[0010] Optionally, the method further includes: in response to a user's data writing instruction to the data management module, continuously storing the data to be written into a preset RAM; when the preset RAM space meets a preset size, writing the data to be written into a free page of the NandFlash.
[0011] Optionally, in response to a user's data writing instruction to the data management module, before continuously storing the data to be written into a preset RAM, the method includes: determining whether the storage space of the Nand Flash is full; if the storage space of the Nand Flash is full, obtaining clearable data and clearing the clearable data.
[0012] Optionally, the method further includes: in response to a user's data writing instruction to the data management module, controlling the mapping management module to determine the next free Page or Block; determining whether the Block is a bad block; and when the Block is a bad block, using the third Block in the bad block management module as the target Block for data writing.
[0013] Optionally, the method further includes: in response to a user's data reading instruction to the data management module, obtaining the data to be read from the Page of the Block based on the data storage list; and reading the data to be read into RAM via SPI.
[0014] Optionally, the method further includes: in response to a user's data erasure command to the data management module, obtaining the fourth block containing the data to be erased based on the data storage linked list; and erasing the data in the fourth block.
[0015] According to another aspect of this application, a NAND flash memory storage management device is provided, the NAND flash memory storage management device comprising: a data management module for storing files; a mapping management module for storing data storage linked lists corresponding to each file; a data reading module for reading the first page of the first block containing the data to be modified into a preset RAM in response to a user's data modification instruction to the data management module; a data processing module for processing the data to be modified in the preset RAM; a data storage module for writing the processed data to be modified into the storage location of a page of a preset second block based on the storage location of the first page; a data writing module for traversing the other pages of the first block excluding the first page, sequentially reading the data that does not need to be modified from the other pages into the preset RAM, and writing the data that does not need to be changed into the page of the preset second block based on the storage location of the other pages; and a linked list storage module for replacing the ID number of the second block with the ID number of the first block based on the mapping management module, and regenerating a new data storage linked list.
[0016] According to another aspect of this application, a computer device is provided, the computer device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the NAND Flash memory management method as described in any of the preceding claims.
[0017] According to another aspect of this application, a computer-readable storage medium is provided, wherein a computer program is stored therein, wherein the computer program is configured to execute, at runtime, the NAND Flash memory management method as described in one of the preceding claims.
[0018] In this application embodiment, a NAND flash memory is provided. A Flash storage management method, wherein the NandFlash includes a data management module and a mapping management module, the data management module is used to store files, and the mapping management module is used to store data storage linked lists corresponding to each file. The method includes: responding to a user's data modification instruction to the data management module, reading the first page of the first block containing the data to be modified into a preset RAM; processing the data to be modified in the preset RAM; writing the processed data to be modified into the storage location of a page of a preset second block based on the storage location of the first page; traversing the other pages of the first block except the first page, sequentially reading the data that does not need to be modified from the other pages into the preset RAM, and writing the data that does not need to be modified into the page of the preset second block based on the storage location of the other pages; replacing the ID number of the second block with the ID number of the first block based on the mapping management module, and regenerating a new data storage linked list; reading the first page of the first block containing the data to be modified into the preset RAM, and sequentially reading the data that does not need to be modified from the other pages into the preset RAM, without needing to read all the data in the entire block, greatly saving RAM space. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of the hardware environment for an optional NAND flash memory storage management method according to an embodiment of the present invention;
[0022] Figure 2 This is a schematic diagram of an optional NAND flash memory storage management method according to an embodiment of this application;
[0023] Figure 3 This is a schematic diagram of an optional NAND flash memory storage management device according to an embodiment of this application;
[0024] Figure 4 This is a structural block diagram of an optional computer device according to an embodiment of this application. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] According to one aspect of the embodiments of this application, a NAND flash memory storage management method is provided. The NAND flash memory includes a data management module and a mapping management module. The data management module is used to store files, and the mapping management module is used to store a data storage linked list corresponding to each file. It should be understood that, in this application, the data storage linked list is the position of the Page in the Block corresponding to each file at the time of storage. The method includes: responding to a user's data modification instruction to the data management module, reading the first Page of the first Block containing the data to be modified into a preset RAM; processing the data to be modified in the preset RAM; writing the processed data to be modified into the storage position of a Page in a preset second Block based on the storage position of the first Page; traversing the other Pages of the first Block except for the first Page, sequentially reading the data that does not need to be modified from the other Pages into the preset RAM, and writing the data that does not need to be modified into the Pages of the preset second Block based on the storage position of the other Pages; and, based on the mapping management module, replacing the ID number of the second Block with the ID number of the first Block, and regenerating a new data storage linked list.
[0028] In this embodiment, the above-described NAND Flash memory management method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal 102 via a network and can provide services to the terminal or clients installed on the terminal. It can set up a database on the server or independently of the server to provide data storage services to server 104, and can also be used to handle cloud services. The aforementioned network includes, but is not limited to, wide area networks (WANs), metropolitan area networks (MANs), or local area networks (LANs). Terminal 102 is not limited to PCs, mobile phones, tablets, etc. The NAND flash memory storage management method of this application embodiment can be executed by server 104, terminal 102, or jointly by server 104 and terminal 102. The NAND flash memory storage management method of this application embodiment can also be executed by a client installed on terminal 102.
[0029] Taking the NAND flash memory storage management method in this embodiment executed by terminal 102 and / or server 104 as an example, Figure 2 This is a schematic diagram of an optional NAND flash memory storage management method according to an embodiment of this application, as shown below. Figure 2 As shown, the process of this method may include the following steps:
[0030] S202. In response to the user's data modification instruction to the data management module, the first page of the first block containing the data to be modified is read into the preset RAM;
[0031] When a user needs to modify a piece of data in a Page, according to the operation requirements of Nand Flash, all the data in the entire Block must be read into RAM, the corresponding data must be modified, the Block must be erased, and the data must be rewritten into the current Block in sequence before the data modification can be truly completed. In actual application scenarios, there is not enough RAM space to temporarily store the data of the entire Block to realize the data modification. To solve the above problems, in this application, in response to the user's data modification instruction to the data management module, the first Page of the first Block containing the data to be modified is read into the preset RAM.
[0032] In this embodiment, the user's data modification instruction to the data management module can be a user-initiated data modification instruction to the data management module, or it can be a data modification instruction to the data management module automatically triggered by the program. When the data modification instruction is triggered, the first page of the first block containing the data to be modified is read into the preset RAM.
[0033] It should be understood that, compared to memory management methods that read all data in a block into RAM, the memory management method of this application, when modifying data to be modified, only reads the first page of the first block containing the data to be modified into the preset RAM. This significantly saves RAM space without violating the hardware read / write operation mechanism of NAND Flash.
[0034] S204. Process the data to be modified in the preset RAM;
[0035] In this embodiment, processing the data to be modified can be an operation to modify the data according to the user's data modification instruction to the data management module; it should be understood that processing the data to be modified can be data processing that includes, but is not limited to, modifying the data type, data value, etc., and no specific limitation is made here.
[0036] S206. The processed data to be modified is written to the storage location of the preset second block's page based on the storage location of the first page;
[0037] Wherein, the preset second block is any pre-determined idle block; specifically, as an exemplary embodiment, after determining the data storage status of the block through the mapping management module, any idle block can be selected as the second block.
[0038] S208. Traverse the pages of the first block except for the first page, read the data that does not need to be modified from the other pages into the preset RAM in turn, and write the data that does not need to be modified into the preset page of the second block according to the storage location of the other pages;
[0039] The above scheme sequentially reads the unmodified data from other pages into a preset RAM, and writes the unmodified data into the corresponding pages of a preset second block based on the storage location of the other pages. That is, after reading the data from each page, the unmodified data is written into the corresponding pages of the preset second block once. Compared with the technical solution of reading all the data in the entire block into RAM and then modifying the corresponding data, this scheme does not need to read all the data in the entire block without violating the hardware read / write operation mechanism of Nand Flash, thus greatly saving RAM space.
[0040] S210. Based on the mapping management module, replace the ID number of the second block with the ID number of the first block, and regenerate a new data storage linked list.
[0041] The above scheme, in response to the user's data modification command to the data management module, reads the first page of the first block containing the data to be modified into a preset RAM; processes the data to be modified in the preset RAM; writes the processed data to be modified into the storage location of a preset second block's page based on the storage location of the first page; traverses all pages of the first block except the first page, sequentially reads the data that does not need to be modified from the other pages into the preset RAM, and writes the data that does not need to be modified into the preset second block's page based on the storage location of the other pages; based on the mapping management module, replaces the ID number of the second block with the ID number of the first block, and regenerates a new data storage linked list; reads the first page of the first block containing the data to be modified into the preset RAM, and sequentially reads the data that does not need to be modified from the other pages into the preset RAM, without needing to read all the data in the entire block, greatly saving RAM space.
[0042] As an exemplary embodiment, the method further includes: erasing the contents of the first block and using the erased first block as the second block for the next data change.
[0043] To simplify the process of determining the preset second block, in this embodiment, after modifying the data to be modified, the content of the first block containing the data to be modified is erased, and the erased first block is used as the second block for the next data change. This simplifies the control process by eliminating the need to determine the data storage status of the block through the mapping management module and then selecting any available block as the second block.
[0044] As an exemplary embodiment, the method further includes: in response to a user's data writing instruction to the data management module, continuously storing the data to be written into a preset RAM; and when the preset RAM space meets a preset size, writing the data to be written into a free page of the Nand Flash.
[0045] In actual production and application scenarios, Nand Flash is used to store large amounts of data for extended periods. However, the size of each data entry often doesn't guarantee that it's exactly the size of a page in the Nand Flash. Furthermore, Nand Flash cannot repeatedly write data to different addresses within the same page, as this would cause a data bit in the page to flip, resulting in data errors. Therefore, in this embodiment, the data to be written is continuously stored in a preset RAM. When the preset RAM space meets a preset size, the data to be written is written to a free page in the Nand Flash. The preset size can be the size of one page in the Nand Flash, or it can be the size of N pages in the Nand Flash (N = 1, 2, 3...). This approach allows for more flexible storage of data of different lengths, avoids wasting storage space, and improves the utilization rate of the Nand Flash.
[0046] As an exemplary embodiment, in response to a user's data writing instruction to the data management module, before continuously storing the data to be written into a preset RAM, the method includes: determining whether the storage space of the Nand Flash is full; if the storage space of the Nand Flash is full, obtaining clearable data and clearing the clearable data.
[0047] In this embodiment, the mapping management module records the storage location of the data, the storage status of each block and page, and the order in which data is stored on each page during normal data storage. The mapping management module is used to manage the current usage of the Nand Flash and to manage the status of each page, ensuring that each page is under monitoring and managing the storage of data. Therefore, the mapping management module can be used to determine whether the Nand Flash storage space is full and to determine the data that can be cleared from the Nand Flash storage space.
[0048] As an exemplary embodiment, the method further includes: in response to a user's data writing instruction to the data management module, controlling the mapping management module to determine the next free Page or Block; determining whether the Page or Block is a bad block; and when the Block is a bad block, using the third Block in the bad block management module as the target Block for data writing.
[0049] As an exemplary embodiment, the mapping management module can determine whether a free storage location is a bad block. Specifically, the mapping management module tags bad blocks in the Nand Flash. When data is stored in a storage area that is considered a bad block, the bad block management module will skip it and use the third block in the bad block management module as the target block for writing data. The bad block management module can pre-traverse the ID numbers of free blocks to find a block that is not a bad block and use that block as the third block.
[0050] As an exemplary embodiment, the method further includes: in response to a user's data reading instruction to the data management module, obtaining the data to be read from the Page of the Block based on the data storage list; and reading the data to be read into RAM via SPI.
[0051] In addition to obtaining specific information about the stored data, data reading also requires calling the data reading interface to retrieve data from a Page when data needs to be modified. In this application, the data to be read is read into RAM via SPI. The data to be read can be data from a Page, and data modification is implemented in the RAM space.
[0052] As an exemplary embodiment, the method further includes: in response to a user's data erasure command to the data management module, obtaining the fourth block containing the data to be erased based on the data storage linked list; and erasing the data in the fourth block.
[0053] The hardware operation mechanism of NAND Flash erases data in blocks; therefore, in this application, the fourth block containing the data to be erased is obtained based on the data storage linked list; and the fourth block is erased.
[0054] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0055] According to another aspect of the embodiments of this application, a NAND flash memory management device for implementing the above-described NAND flash memory management method is also provided.
[0056] Figure 3 This is a schematic diagram of a NAND flash memory storage management device according to an embodiment of this application, as shown below. Figure 3 As shown, the device may include:
[0057] Data management module 302 is used to store files;
[0058] The mapping management module 304 is used to store the data storage linked list corresponding to each file;
[0059] The data reading module 306 is used to read the first page of the first block containing the data to be modified into a preset RAM in response to the user's data modification command to the data management module;
[0060] The data processing module 308 is used to process the data to be modified in a preset RAM;
[0061] The data storage module 310 is used to write the processed data to be modified into the storage location of the page of the preset second block based on the storage location of the first page.
[0062] The data writing module 312 is used to traverse the other pages of the first block except for the first page, read the data that does not need to be modified from the other pages into the preset RAM in turn, and write the data that does not need to be changed into the preset page of the second block according to the storage location of the other pages.
[0063] The linked list storage module 314 is used to replace the ID number of the second block with the ID number of the first block based on the mapping management module, and regenerate a new data storage linked list.
[0064] It should be noted that the data reading module 306 in this embodiment can be used to perform the above step S202, the data processing module 308 in this embodiment can be used to perform the above step S204, the data storage module 310 in this embodiment can be used to perform the above step S206, the data writing module 312 in this embodiment can be used to perform the above step S208, and the linked list storage module 314 in this embodiment can be used to perform the above step S210.
[0065] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented through software or hardware, and the hardware environment includes the network environment.
[0066] According to another aspect of the embodiments of this application, a computer device for implementing the above-described NAND flash memory storage management method is also provided. Figure 4 This is a structural block diagram of an optional computer device according to an embodiment of this application, such as... Figure 4 As shown, it includes a processor 402, a communication interface 404, a memory 406, and a communication bus 408. The processor 402, communication interface 404, and memory 406 communicate with each other via the communication bus 408.
[0067] Memory 406 is used to store computer programs;
[0068] When processor 402 executes a computer program stored in memory 406, it performs the following steps:
[0069] In response to the user's data modification command to the data management module, the first page of the first block containing the data to be modified is read into the preset RAM;
[0070] The data to be modified is processed in the preset RAM;
[0071] The processed data to be modified is written to the storage location of the preset second block's page, based on the storage location of the first page.
[0072] Traverse all pages of the first block except the first page, read the data that does not need to be modified from the other pages into the preset RAM, and write the data that does not need to be modified into the preset second block based on the storage location of the other pages;
[0073] Based on the mapping management module, the ID number of the second block is replaced with the ID number of the first block, and a new data storage linked list is regenerated.
[0074] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0075] The communication interface is used for communication between the aforementioned computer equipment and other devices.
[0076] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0077] As an example, such as Figure 4 As shown, the memory 406 may include, but is not limited to, the data management module 302, mapping management module 304, data read module 306, data processing module 308, data storage module 310, data write module 312, and linked list storage module 314 in the NAND flash memory storage management device. It may also include, but is not limited to, other module units in the NAND flash memory storage management device, which will not be described in detail in this example.
[0078] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0079] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.
[0080] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. The device implementing the above-described NAND flash memory storage management method can be a terminal device, such as a smartphone (e.g., Android phone, iOS phone), tablet computer, PDA, mobile internet device (MID), PAD, etc. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, the terminal device may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.
[0081] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.
[0082] According to another aspect of the embodiments of this application, a storage medium is also provided. Optionally, in this embodiment, the storage medium can be used to execute program code for a NAND flash memory storage management method.
[0083] Optionally, in this embodiment, the storage medium may be located on at least one of the network devices in the network shown in the above embodiment.
[0084] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
[0085] In response to the user's data modification command to the data management module, the first page of the first block containing the data to be modified is read into the preset RAM;
[0086] The data to be modified is processed in the preset RAM;
[0087] The processed data to be modified is written to the storage location of the preset second block's page, based on the storage location of the first page.
[0088] Traverse all pages of the first block except the first page, read the data that does not need to be modified from the other pages into the preset RAM, and write the data that does not need to be modified into the preset second block based on the storage location of the other pages;
[0089] Based on the mapping management module, the ID number of the second block is replaced with the ID number of the first block, and a new data storage linked list is regenerated.
[0090] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.
[0091] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.
[0092] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0093] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0094] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.
[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the solution provided in this embodiment, depending on actual needs.
[0097] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0098] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0099] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A NAND flash memory storage management method, characterized in that, The Nand Flash includes a data management module and a mapping management module. The data management module is used to store files, and the mapping management module is used to store a data storage linked list corresponding to each file. The method includes: In response to the user's data modification command to the data management module, the first page of the first block containing the data to be modified is read into the preset RAM; The data to be modified is processed in the preset RAM; The processed data to be modified is written to the storage location of the preset second block's page, based on the storage location of the first page. Traverse all pages of the first block except the first page, read the data that does not need to be modified from the other pages into the preset RAM, and write the data that does not need to be modified into the preset second block based on the storage location of the other pages; Based on the mapping management module, the ID number of the second block is replaced with the ID number of the first block, and a new data storage linked list is regenerated; The method further includes: In response to the user's data write command to the data management module, the data to be written is continuously stored in the preset RAM; When the preset RAM space meets the preset size, the data to be written is written into the free page of the Nand Flash. In response to a user's data write command to the data management module, the process before continuously storing the data to be written into the preset RAM includes: Determine if the NAND Flash storage space is full; If the Nand Flash storage space is full, obtain the data that can be cleared and clear it. When a user issues a data write command to the data management module, the mapping management module is controlled to determine the next free Page or Block. Determine if the block is a bad block; When the block is bad, the third block in the bad block management module is used as the target block for writing data.
2. The NAND Flash memory management method as described in claim 1, characterized in that, The method further includes: Erase the contents of the first block and use the erased first block as the second block for the next data change.
3. The NAND flash memory storage management method as described in claim 1, characterized in that, The method further includes: In response to the user's data reading command to the data management module, the data to be read is obtained from the Page of the Block based on the data storage list; The data to be read is read into RAM via SPI.
4. The NAND Flash memory management method as described in claim 1, characterized in that, The method further includes: In response to the user's data erasure command to the data management module, the fourth block of the data to be erased is obtained based on the data storage linked list; The data in the fourth block is erased.
5. A NAND flash memory storage management device, characterized in that, The device is capable of executing the NAND Flash memory management method according to any one of claims 1-4, and the NAND Flash memory management device includes: The data management module is used to store files; The mapping management module is used to store the data storage linked list corresponding to each file; The data reading module is used to respond to the user's data modification command to the data management module by reading the first page of the first block containing the data to be modified into the preset RAM; A data processing module is used to process the data to be modified in a preset RAM; The data storage module is used to write the processed data to be modified into the storage location of the page of the preset second block based on the storage location of the first page. The data writing module is used to traverse the other pages of the first block except for the first page, read the data that does not need to be modified from the other pages into the preset RAM in turn, and write the data that does not need to be modified into the preset page of the second block according to the storage location of the other pages. The linked list storage module is used to replace the ID number of the second block with the ID number of the first block based on the mapping management module, and regenerate a new data storage linked list.
6. A computer device, characterized in that, The computer device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the NAND Flash memory management method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the NAND flash memory storage management method according to any one of claims 1 to 4 when it runs.