CN112486854B - NAND Flash Nand Flash storage management method and device - Google Patents

NAND Flash Nand Flash storage management method and device Download PDF

Info

Publication number
CN112486854B
CN112486854B CN202011576812.2A CN202011576812A CN112486854B CN 112486854 B CN112486854 B CN 112486854B CN 202011576812 A CN202011576812 A CN 202011576812A CN 112486854 B CN112486854 B CN 112486854B
Authority
CN
China
Prior art keywords
file
mapping table
data mapping
physical page
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011576812.2A
Other languages
Chinese (zh)
Other versions
CN112486854A (en
Inventor
许晓梦
刘晓波
韩国梁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Weichai Power Co Ltd
Original Assignee
Weichai Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Weichai Power Co Ltd filed Critical Weichai Power Co Ltd
Priority to CN202011576812.2A priority Critical patent/CN112486854B/en
Publication of CN112486854A publication Critical patent/CN112486854A/en
Application granted granted Critical
Publication of CN112486854B publication Critical patent/CN112486854B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0882Page mode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1748De-duplication implemented within the file system, e.g. based on file segments
    • G06F16/1752De-duplication implemented within the file system, e.g. based on file segments based on file chunks

Abstract

The disclosure provides a NAND Flash Nand Flash storage management method and device. The method comprises the following steps: responding to the deletion operation of a user on the file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; if the undeleted file exists according to the array values of the physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file. Therefore, the data in the Nand Flash can be stored in sequence, the erasing times of the physical blocks are basically consistent, and the physical blocks with excessive erasing times cannot occur. The probability of the physical block becoming a bad block is reduced.

Description

NAND Flash Nand Flash storage management method and device
Technical Field
The invention relates to the technical field of data processing, in particular to a NAND Flash Nand Flash storage management method and device.
Background
The Nand Flash is characterized in that when all physical blocks are used, when data are written again, all data in the physical blocks must be erased firstly and then written, and the data cannot be directly rewritten in place. And the number of times each physical block is erased is limited. The number of times of erasure is usually about 10 ten thousand, and when the number of times of erasure of any physical block reaches about 10 ten thousand, the physical block is likely to become a bad block.
At present, Nand Flash can store data by randomly selecting physical pages in physical blocks, so that access of each physical block is unbalanced in the use process of the Nand Flash, the number of times of erasing and writing of some physical blocks is large, the number of times of erasing and writing of some physical blocks is small, and bad blocks are easy to generate for the physical blocks with large erasing and writing times.
Disclosure of Invention
The exemplary embodiment of the disclosure provides a Nand-type Flash Nand Flash storage management method and device, which are used for sequentially writing and erasing in Nand Flash, so that access balance of each physical block of the Nand Flash is realized, and the possibility that the physical block is changed into a bad block is reduced.
The first aspect of the present disclosure provides a Nand Flash storage management method, where the Nand Flash includes a data area and a data mapping table area, the data area is used for storing files, and the data mapping table area is used for storing data mapping tables corresponding to the files, and the method includes:
responding to the deletion operation of a user on the file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
if the undeleted file exists according to the array value of the physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file.
In this embodiment, after copying an undeleted file stored before deleting a file, saving the undeleted file from an adjacent physical page subsequent to a last physical page of the file stored in the data area to obtain an offset file, and setting an array value of a physical page list in a data mapping table corresponding to the undeleted file as a value corresponding to the deleted file. Therefore, the data in the Nand Flash can be stored according to the storage sequence, so that the erasing times of each physical block are basically consistent, and the physical block with excessive erasing times can not occur. The access balance of the physical blocks is realized, and the possibility that the physical blocks are changed into bad blocks is reduced.
In an embodiment, after the setting the array value of the physical page list in the data mapping table corresponding to the undeleted file to the value corresponding to the deleted file, the method further includes:
starting to store a data mapping table corresponding to the offset file from an adjacent physical page behind the last physical page of the data mapping table stored in the data mapping table region; and
and setting a first byte of a free area of a first target physical page in the data mapping table area to be invalid, wherein the first target physical page is a previous adjacent physical page of a physical page storing the data mapping table corresponding to the offset file.
In this embodiment, the data mapping table corresponding to the offset file is stored, and the first byte of the free area of the previous adjacent physical page of the physical page storing the data mapping table corresponding to the offset file is set to be invalid, so that the data mapping tables corresponding to the files in the data area can also be stored sequentially, thereby reducing the change of each physical block storing the data mapping table into a bad block.
In one embodiment, the data mapping table corresponding to the offset file is generated by the following method:
determining an index value and a group value corresponding to the offset file by using a physical block and a physical page for storing the offset file;
and generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the equipment group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be valid.
In this embodiment, the data mapping table corresponding to the offset file is generated through the check value of the offset file during storage, the device group number of the physical block storing the offset file, the index value, and the array value, so that the generated data mapping table is more accurate.
In one embodiment, after the setting the array value of the physical page list in the data mapping table corresponding to the undeleted file to the value corresponding to the deleted file, the method further includes:
if it is determined that no idle physical page exists in the physical block storing the data mapping table corresponding to the undeleted file and the array value of the physical page list in the data mapping table in each physical page in the physical block is the value corresponding to the deleted file, erasing the physical block and erasing the physical block storing each file corresponding to each data mapping table in the physical block in the data area.
In the embodiment, the physical block in which all the physical pages store data is erased, so that the erasing frequency of the physical block is reduced, and the possibility that the physical block is a bad block is reduced.
In one embodiment, before the responding to the user's deletion operation of the file in the data area, the method further comprises:
after the Nand Flash is electrified and initialized, aiming at any data mapping table in the data mapping table area, if the data mapping table is effective and a physical page storing the data mapping table is an effective page, performing cyclic redundancy check on a file corresponding to the data mapping table to obtain a new check value;
and if the new check value is consistent with the check value stored in the data mapping table, determining the last physical page of the file stored in the data area according to the index value of the physical page list in the data mapping table, and determining the last physical page of the data mapping table stored in the data mapping table area according to the physical page storing the data mapping table.
In the embodiment, the last physical page of the file stored in the data area and the last physical page of the data mapping table stored in the data mapping table area are determined through the data mapping table determined after the Nand Flash is powered on and initialized, so that the storage positions in the data area and the data mapping table area can be determined when the file is stored or deleted subsequently.
In one embodiment, the method further comprises:
responding to the operation of a user on the data area to create a file, and determining the file name of the created file;
traversing array values of a physical page list in each data mapping table in the data mapping table area, wherein the array values represent that when a file corresponding to the data mapping table is an undeleted file, the corresponding value is the file name of the file;
and if the fact that the array value of the physical page list in the data mapping table is not the same as the file name of the created file is determined, the created file is stored in an adjacent physical page behind the last physical page of the stored file in the data area.
In the embodiment, when a file is created, the array values of the physical page list in each data mapping table are compared with the file name of the created file, so as to determine whether the file name is duplicated, and if not, the created file can be stored in a physical page located after the last physical page in each physical page of the stored file in the data area. Files with duplicate file names are avoided.
In one embodiment, after storing the created file in an adjacent physical page of the data area after a last physical page of the stored file, the method further comprises:
storing a data mapping table corresponding to the created file into an adjacent physical page behind the last physical page of the stored data mapping table in the data mapping table area; and
and setting the first byte of a free area of a second target physical page in the data mapping table area as invalid, wherein the second target physical page is a previous adjacent physical page of a physical page storing the data mapping table corresponding to the created file.
In this embodiment, the data mapping table corresponding to the created file is stored in the physical page subsequent to the last physical page of the stored data mapping table in the data mapping table area, and the first byte of the free area of the previous adjacent physical page of the physical page storing the data mapping table corresponding to the created file is set to be invalid, so that sequential storage of physical blocks in the data mapping table area is realized, and occurrence of bad blocks is reduced.
In one embodiment, the data mapping table corresponding to the created file is generated by the following method:
determining an index value and an array value corresponding to the created file according to the physical block and the physical page for storing the created file;
and generating a data mapping table corresponding to the created file according to the check value of the created file during storage, the device group number of the physical block for storing the created file, the index value and the array value, and setting the data mapping table to be valid.
In this embodiment, the data mapping table corresponding to the created file is generated according to the check value of the created file during storage, the device group number of the physical block storing the created file, the index value, and the array value, so as to ensure the accuracy of the data mapping table.
A second aspect of the present disclosure provides a Nand Flash memory storage management apparatus, where the Nand Flash memory includes a data area and a data mapping table area, the data area is used to store files, and the data mapping table area is used to store data mapping tables corresponding to the files, and the apparatus includes:
the deleting module is used for responding to the deleting operation of a user on the file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
the offset module is used for determining that the undeleted file exists according to the array values of the physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file.
In one embodiment, the apparatus further comprises:
an offset data mapping table saving module, configured to set an array value of a physical page list in a data mapping table corresponding to the undeleted file to a value corresponding to the deleted file, and then save the data mapping table corresponding to the offset file from an adjacent physical page subsequent to a last physical page of the stored data mapping table in the data mapping table region;
a first target physical page setting module, configured to set a first byte of a free area of a first target physical page in the data mapping table area to be invalid, where the first target physical page is a previous adjacent physical page of a physical page storing a data mapping table corresponding to the offset file.
In one embodiment, the apparatus further comprises:
an offset data mapping table generation module to:
generating a data mapping table corresponding to the offset file by the following method:
determining an index value and an array value corresponding to the offset file by using a physical block and a physical page for storing the offset file;
and generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the equipment group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be valid.
In one embodiment, the apparatus further comprises:
and the erasing module is used for erasing the physical block and erasing the physical block of each file corresponding to each data mapping table in the physical block in the data area, wherein the physical block corresponds to the deleted file, and the physical block corresponds to each data mapping table in the physical block.
In one embodiment, the apparatus further comprises:
the power-on initialization module is used for responding to the deletion operation of a user on a file in the data area, performing power-on initialization on Nand Flash, and then aiming at any data mapping table in the data mapping table area, if the data mapping table is effective and a physical page storing the data mapping table is an effective page, performing cyclic redundancy check on the file corresponding to the data mapping table to obtain a new check value;
and the last physical page determining module is used for determining the last physical page of the file stored in the data area according to the index value of the physical page list in the data mapping table if the new check value is consistent with the check value stored in the data mapping table, and determining the last physical page of the data mapping table stored in the data mapping table area according to the physical page in the data mapping table.
In one embodiment, the apparatus further comprises:
the file name acquisition module is used for responding to the operation of a user on the data area to create the file and determining the file name of the created file;
the traversing module is used for traversing array values of a physical page list in each data mapping table in the data mapping table area, wherein the array values represent that when a file corresponding to the data mapping table is an undeleted file, the corresponding value is the file name of the file;
and the created file storage module is used for storing the created file in an adjacent physical page behind the last physical page of the stored file in the data area if the array value of the physical page list in the data mapping table is determined to be the same as the file name of the created file.
In one embodiment, the apparatus further comprises:
a created file data mapping table storage module, configured to store a data mapping table corresponding to the created file in an adjacent physical page subsequent to a last physical page of the stored data mapping table in the data mapping table region;
and the second target physical page setting module is used for setting the first byte of the free area of the second target physical page in the data mapping table area to be invalid, wherein the second target physical page is a previous adjacent physical page of a physical page for storing the data mapping table corresponding to the created file.
In one embodiment, the apparatus further comprises:
a created file data mapping table generating module, configured to generate a data mapping table corresponding to the created file in the following manner:
determining an index value and an array value corresponding to the created file according to the physical block and the physical page for storing the created file;
and generating a data mapping table corresponding to the created file according to the check value of the created file during storage, the device group number of the physical block for storing the created file, the index value and the array value, and setting the data mapping table to be valid.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions for execution by the at least one processor; the instructions are executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
According to a fourth aspect provided by an embodiment of the present disclosure, there is provided a computer storage medium storing a computer program for executing the method according to the first aspect.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic flow chart of a NAND Flash Nand Flash storage management method according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a NAND Flash Nand Flash data area structure according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a NAND Flash Nand Flash data mapping table area structure according to an embodiment of the present disclosure;
FIG. 4 is a second flowchart of a NAND Flash Nand Flash storage management method according to an embodiment of the present disclosure;
fig. 5 is a third schematic flow chart of a Nand Flash memory storage management method according to an embodiment of the present disclosure;
FIG. 6 is a NAND Flash Nand Flash memory storage management device according to one embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The term "and/or" in the embodiments of the present disclosure describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B, and may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The application scenario described in the embodiment of the present disclosure is for more clearly illustrating the technical solution of the embodiment of the present disclosure, and does not form a limitation on the technical solution provided in the embodiment of the present disclosure, and as a person having ordinary skill in the art knows, with the occurrence of a new application scenario, the technical solution provided in the embodiment of the present disclosure is also applicable to similar technical problems. In the description of the present disclosure, the meaning of "a plurality" is two or more, unless otherwise specified.
At present, Nand Flash can store data by randomly selecting physical pages in physical blocks, so that access of each physical block is unbalanced in the use process of the Nand Flash, the number of times of erasing and writing of some physical blocks is large, the number of times of erasing and writing of some physical blocks is small, and bad blocks are easy to generate for the physical blocks with large erasing and writing times.
Therefore, the present disclosure provides a Nand Flash memory storage management method and apparatus, by copying an undeleted file stored before deleting a file, starting to store from a physical page located after the last physical page in each physical page of the stored file in the data area to obtain an offset file, and deleting the undeleted file, it is ensured that each physical block in Nand Flash and the physical page sequence in the physical block are stored, so that the number of times of erasing each physical block is kept substantially the same, and a physical block with excessive erasing times does not occur. The access balance of the physical blocks is realized, and the possibility that the physical blocks are changed into bad blocks is reduced.
The Nand Flash is divided into two parts, one part is a data area and used for storing files, and the other part is a data mapping table area and used for storing data mapping tables corresponding to the files stored in the data area. Before the scheme is introduced, a data mapping table in the scheme is introduced:
the data mapping table includes an effective state of the data mapping table, a device group number of a physical block storing a file, a check value, and a physical page list.
(1) Valid state of data mapping table: the valid state of the data mapping table includes two states, namely valid state and idle state, namely the valid state of the data mapping table is used for indicating whether the data mapping table has a corresponding file in the data area. If the data mapping table has a corresponding file in the data area, setting the effective state of the data mapping table to be effective, and if the data mapping table has no corresponding file in the data area, setting the effective state of the data mapping table to be idle.
(2) Device group number of physical block storing file: in the method, each physical block in the Nand Flash data area is divided according to the equipment group, and the number of the physical blocks in the equipment group is configurable. The number of physical blocks included in the device group in the present disclosure is configured in principle to enable the size of the data mapping table to be stored in one physical page. The device group number is a cycle count, that is, the device group number is completely used and then counted again from the initialization 0.
(3) And (3) checking a value: when the file is stored in the data area, cyclic redundancy check is performed on the stored file to obtain a check value.
(4) Physical page list: the physical page list is defined in an array manner. The index value and the array value are included, wherein the index value is determined by storing a physical block and a physical page corresponding to the file. The array value is used for indicating whether the corresponding file is an undeleted file or not, and if the file is an undeleted file, the array value can be indicated by the file name of the corresponding file. If the file is a deleted file, it can be represented by a designated flag, such as 0.
The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. Before deleting or creating a file in the Nand Flash, firstly, electrifying and initializing the Nand Flash, and after electrifying and initializing the Nand Flash, aiming at any data mapping table in the data mapping table area, if the data mapping table is effective (determined according to the effective state of the data mapping table) and a physical page storing the data mapping table is an effective page (determined according to the first byte of a free area of the physical page), carrying out cyclic redundancy check on the file corresponding to the data mapping table to obtain a new check value; and if the new check value is consistent with the check value stored in the data mapping table, determining the last physical page of the file stored in the data area according to the index value of the physical page list in the data mapping table, and determining the last physical page of the data mapping table stored in the data mapping table area according to the physical page storing the data mapping table.
Wherein, the last physical page in the data area among the physical pages of the stored file can be determined by the following method:
firstly, acquiring a device group number, and then calculating a physical block where a last physical page of a stored file is located, wherein the physical block where the last physical page of the stored file is located can be calculated by a formula (1):
block=Devicenum*PAR_BLOCKS_NUM+list/PAGES_PER_BLOCK(1);
BLOCK represents a physical BLOCK of a storage file in the data area (calculated this time as the physical BLOCK where the last physical page of the stored file is located), Devicenum represents a device group number of the physical BLOCK of the storage file, PAR _ BLOCKS _ NUM represents the number of physical BLOCKS included in a device group corresponding to the device group number of the physical BLOCK of the storage file, list represents an index value of a physical page list in a data mapping table (calculated this time as the index value of the physical page list in the last data mapping table), and PAGES _ PER _ BLOCK represents the number of physical PAGES included in each physical BLOCK.
Then, the final physical page in all the physical pages of the stored file is calculated through a formula (2):
page=list%PAGES_PER_BLOCK(2);
the page is a physical page of the stored file in the data area (this time, the last physical page of the stored file is calculated).
It should be noted that block and page are related to an index value of a physical page list in an input data mapping table, and if the input index value is the index value of the physical page list of the data mapping table in the last physical page of the stored data mapping table, the determined block and page are a physical block where the last physical page of the stored file is located and the last physical page of the stored file, respectively. And determining the block and the page respectively as the physical block where the last physical page of the stored file is located and the last physical page of the stored file because the data mapping table determined during power-on initialization is the data mapping table in the last physical page of the stored data mapping table.
Since the last physical page in the physical pages of the stored file in the data area and the last physical page in the physical pages of the stored data mapping table in the data mapping table area cannot be directly acquired after power-on initialization, the last physical page in the physical pages of the stored file in the Nand Flash data area and the last physical page in the physical pages of the stored data mapping table in the data mapping table area need to be determined in the above manner. Therefore, after power-on, the file is deleted or added, so that the storage position in the data area and the storage position in the data mapping table area can be determined according to the last physical page in the physical pages of the stored file in the data area and the last physical page in the physical pages of the stored data mapping table in the data mapping table area.
It should be noted that, if the data mapping tables do not meet the above conditions, the situation that the stored data is lost is indicated, and the backup data mapping table needs to be read in the above manner, so as to determine the last physical page in the Nand Flash data area located in each physical page of the stored file and the last physical page in the data mapping table area located in each physical page of the stored data mapping table.
Fig. 1 is a schematic flow chart of a Nand Flash storage management method according to an embodiment of the present disclosure, which may include the following steps:
step 101: responding to the deletion operation of a user on the file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
in the embodiment of the present disclosure, the data mapping table corresponding to the file is determined by the index value of the physical page list in the data mapping table.
The index value of the physical page list in the data mapping table corresponding to the file can be determined by formula (3):
list=(block-Devicenum*PAR_BLOCKS_NUM)*PAGES_PER_BLOCK+page(3);
wherein, list represents an index value, BLOCK represents a physical BLOCK storing a file in the data area, Devicenum is a device group number of the physical BLOCK storing the file, PAR _ BLOCKS _ NUM is the number of physical BLOCKS included in a device group corresponding to the device group number of the physical BLOCK storing the file, PAGES _ PER _ BLOCK is the number of physical PAGES included in each physical BLOCK, and page is a physical page storing the file in the data area.
The index value of the physical page list in the data mapping table of the file corresponding to the deletion operation can be determined in the above manner, the position of the data mapping table can be determined through the index value, and the array value of the physical page list in the data mapping table is modified into the value corresponding to the deleted file.
Step 102: if the undeleted file exists according to the array value of the physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file.
For example, as shown in fig. 2, which is a structure diagram in a Nand Flash data area in the embodiment of the present disclosure, if a user deletes a file 4 in a physical block 1 in the data area, a set of values of a physical page list in a corresponding data mapping table is set as a value corresponding to the deleted file; if the file 2 and the file 3 of the physical block 1 are determined to be undeleted files, the file 2 and the file 3 are copied, then the file 2 is saved in a first physical page after a last physical page of the stored file in the data area, and the file 3 is saved in a second physical page after a physical page of the stored file n. The last physical page of the storage file in fig. 2 is a physical page n in the physical block n. That is, file 2 is saved to physical page n +1 in physical block n, and file 3 is saved to physical page n +2 in physical block n.
It should be noted that, if the deletion operation is the first execution operation after power-on initialization, the last physical page of the stored file is determined after power-on initialization, and if not, the last physical page of the stored file may be directly obtained.
After step 102 is executed, in an embodiment, if it is determined that there is no free physical page in the physical block storing the data mapping table corresponding to the undeleted file, and the array value of the physical page list in the data mapping table in each physical page in the physical block is the value corresponding to the deleted file, the physical block is erased, and the physical block storing each file corresponding to each data mapping table in the physical block in the data area is erased.
For example, if it is determined that all files in physical block 1 storing file 2, file 3, and file 4 are deleted files, the physical block 1 is erased, and the physical block where the corresponding data mapping table is located is erased.
In one embodiment, the data mapping table corresponding to the offset file is generated by:
determining an index value and a group value corresponding to the offset file by using a physical block and a physical page for storing the offset file; and generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the equipment group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be valid.
After the data mapping table is generated, the data mapping table corresponding to the offset file is saved from an adjacent physical page behind the last physical page of the data mapping table stored in the data mapping table region; and setting a first byte of a free area of a first target physical page in the data mapping table area to be invalid, wherein the first target physical page is a previous adjacent physical page of a physical page storing the data mapping table corresponding to the offset file.
For example according to the example described in figure 2. As shown in fig. 3, which is a structural diagram of a data mapping table area in the embodiment of the present disclosure, if a physical page 1 in a physical block 3 is a last physical page of a stored data mapping table, a physical page 2 stores a data mapping table corresponding to a file 2, and a physical page 3 stores a data mapping table corresponding to a file 3.
Therefore, after copying the undeleted file stored before deleting the file, the undeleted file is stored from the physical page positioned after the last physical page in the physical pages of the stored file in the data area to obtain the offset file, and the undeleted file is deleted, so that the files stored in the Nand Flash are ensured to realize sequential storage, the erasing times of the physical blocks are basically consistent, and the physical blocks with excessive erasing times cannot occur. The access balance is realized, and the possibility of bad blocks of the physical blocks is reduced.
As shown in fig. 4, a schematic flowchart of creating a file in the Nand Flash data area according to an embodiment of the disclosure is shown, and the effect of creating a file in the Nand Flash data area is similar to the effect of deleting a file described above, and the disclosure will not be described here. Wherein, can include the following steps:
step 401: responding to the operation of a user on creating a file in the data area, and determining the file name of the created file;
step 402: traversing array values of a physical page list in each data mapping table in the data mapping table area, wherein the array values represent that a corresponding identifier is the file name of a file when the file corresponding to the data mapping table is an undeleted file;
step 403: and if the fact that the array value of the physical page list in the data mapping table is not the same as the file name of the created file is determined, the created file is stored in a physical page located after the last physical page in all the physical pages of the stored file in the data area.
Wherein, the data mapping table corresponding to the created file is generated by the following method:
determining an index value and an array value corresponding to the created file according to the physical block and the physical page for storing the created file; and generating a data mapping table corresponding to the created file according to the check value of the created file during storage, the device group number of the physical block for storing the created file, the index value and the array value, and setting the data mapping table to be valid.
In order to ensure that the data mapping tables corresponding to the files can be stored sequentially, after step 403 is executed, in an embodiment, the data mapping table corresponding to the created file is saved to a physical page located after the last physical page in the physical pages where the data mapping tables are stored in the data mapping table area; and setting a first byte of a free area of a second target physical page in the data mapping table area to be invalid, wherein the second target physical page is a previous physical page of a physical page storing the data mapping table corresponding to the created file.
In order to further understand the technical solution of the embodiment of the present disclosure, the deleted file is taken as an example, and the detailed description with reference to fig. 5 may include the following steps:
step 501: after the Nand Flash is electrified and initialized, aiming at any data mapping table in the data mapping table area, if the data mapping table is effective and a physical page storing the data mapping table is an effective page, performing cyclic redundancy check on a file corresponding to the data mapping table to obtain a new check value;
step 502: if the new check value is consistent with the check value stored in the data mapping table, determining the last physical page of the file stored in the data area according to the index value of the physical page list in the data mapping table, and determining the last physical page of the data mapping table stored in the data mapping table area according to the physical page storing the data mapping table;
step 503: responding to the deletion operation of a user on the file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
step 504: judging whether the undeleted file exists according to the array value of the physical page list in each data mapping table corresponding to each file stored before the file; if yes, go to step 505, otherwise, end.
Step 505, copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file;
step 506: determining an index value and a group value corresponding to the offset file by using a physical block and a physical page for storing the offset file;
step 507: generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the device group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be valid;
step 508: starting to store a data mapping table corresponding to the offset file from an adjacent physical page behind the last physical page of the data mapping table stored in the data mapping table region;
step 509: and setting a first byte of a free area of a first target physical page in the data mapping table area to be invalid, wherein the first target physical page is a previous adjacent physical page of a physical page storing the data mapping table corresponding to the offset file.
Based on the same disclosure concept, the Nand Flash memory storage management method in the embodiments of the present disclosure can also be implemented by a Nand Flash memory storage management device. The effect of the Nand Flash storage management device is similar to that of the method, and is not described again here.
Fig. 6 is a schematic structural diagram of a Nand Flash storage management apparatus according to an embodiment of the present disclosure.
As shown in fig. 6, the Nand-type Flash Nand Flash memory storage management device 600 of the present disclosure may include a deletion module 610 and an offset module 620.
A deleting module 610, configured to, in response to a deleting operation performed by a user on a file in the data area, set an array value of a physical page list in a data mapping table corresponding to the file to a value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
an offset module 620, configured to determine that an undeleted file exists according to array values of a physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file.
In one embodiment, the apparatus further comprises:
an offset data mapping table saving module 630, configured to set an array value of a physical page list in a data mapping table corresponding to the undeleted file to a value corresponding to the deleted file, and then save the data mapping table corresponding to the offset file from an adjacent physical page subsequent to a last physical page of the stored data mapping table in the data mapping table region;
a first target physical page setting module 640, configured to set a first byte of a free area of a first target physical page in the data mapping table area to be invalid, where the first target physical page is a previous adjacent physical page of a physical page storing a data mapping table corresponding to the offset file.
In one embodiment, the apparatus further comprises:
an offset data mapping table generation module 650 for:
generating a data mapping table corresponding to the offset file by the following method:
determining an index value and a group value corresponding to the offset file by using a physical block and a physical page for storing the offset file;
and generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the equipment group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be valid.
In one embodiment, the apparatus further comprises:
an erasing module 660, configured to erase the physical block and erase the physical block in the data region, where the physical block corresponds to each data mapping table in the physical block, if it is determined that there is no idle physical page in the physical block that stores the data mapping table corresponding to the undeleted file, and the array value of the physical page list in the data mapping table in each physical page in the physical block is a value corresponding to the deleted file after setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as a value corresponding to the deleted file.
In one embodiment, the apparatus further comprises:
a power-on initialization module 670, configured to, in response to a user before a deletion operation of a file in the data area, perform power-on initialization on the Nand Flash, and then perform cyclic redundancy check on the file corresponding to the data mapping table to obtain a new check value, if the data mapping table is valid and a physical page storing the data mapping table is a valid page, with respect to any data mapping table in the data mapping table area;
a last physical page determining module 680, configured to determine, if the new check value is consistent with the check value stored in the data mapping table, a last physical page of the file stored in the data area according to the index value of the physical page list in the data mapping table, and determine, according to the physical page in which the data mapping table is stored, the last physical page of the data mapping table stored in the data mapping table area.
In one embodiment, the apparatus further comprises:
a file name obtaining module 690, configured to determine a file name of a created file in response to a user operation on creating a file in the data area;
a traversing module 691, configured to traverse a array value of a physical page list in each data mapping table in the data mapping table region, where a value corresponding to a file corresponding to the data mapping table when the file is an undeleted file is a file name of the file in the array value;
a create file storing module 692, configured to store the created file in an adjacent physical page subsequent to the last physical page of the stored file in the data area if it is determined that the array value of the physical page list in the non-existing data mapping table is the same as the file name of the created file.
In one embodiment, the apparatus further comprises:
a created file data mapping table storage module 693, configured to store a data mapping table corresponding to the created file in an adjacent physical page subsequent to a last physical page of a stored data mapping table in the data mapping table region;
a second target physical page setting module 694, configured to set a first byte of a free area of a second target physical page in the data mapping table area to be invalid, where the second target physical page is a previous adjacent physical page of a physical page storing a data mapping table corresponding to the created file.
In one embodiment, the apparatus further comprises:
a created file data mapping table generating module 695, configured to generate a data mapping table corresponding to the created file by:
determining an index value and an array value corresponding to the created file according to the physical block and the physical page for storing the created file;
and generating a data mapping table corresponding to the created file according to the check value of the created file during storage, the device group number of the physical block for storing the created file, the index value and the array value, and setting the data mapping table to be valid.
After introducing a Nand-type Flash Nand Flash storage management method and apparatus according to an exemplary embodiment of the present disclosure, an electronic device according to another exemplary embodiment of the present disclosure is next introduced.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible implementations, an electronic device in accordance with the present disclosure may include at least one processor, and at least one computer storage medium. The computer storage medium stores program codes, and when the program codes are executed by a processor, the program codes cause the processor to execute the steps of the Nand Flash storage management method according to various exemplary embodiments of the present disclosure described above in the specification. For example, the processor may perform steps 101-102 as shown in FIG. 1.
An electronic device 700 according to this embodiment of the disclosure is described below with reference to fig. 7. The electronic device 700 shown in fig. 7 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, the electronic device 700 is embodied in the form of a general-purpose electronic device. The components of the electronic device 700 may include, but are not limited to: the at least one processor 701, the at least one computer storage medium 702, and the bus 703 that connects the various system components (including the computer storage medium 702 and the processor 701).
Bus 703 represents one or more of any of several types of bus structures, including a computer storage media bus or computer storage media controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.
The computer storage media 702 may include readable media in the form of volatile computer storage media, such as random access computer storage media (RAM)721 and/or cache storage media 722, and may further include read-only computer storage media (ROM) 723.
Computer storage media 702 may also include a program/utility 725 having a set (at least one) of program modules 724, such program modules 724 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The electronic device 700 may also communicate with one or more external devices 704 (e.g., keyboard, pointing device, etc.), with one or more devices that enable a user to interact with the electronic device 700, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 700 to communicate with one or more other electronic devices. Such communication may occur via input/output (I/O) interfaces 705. Also, the electronic device 700 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 706. As shown, the network adapter 706 communicates with other modules for the electronic device 700 over a bus 703. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, to name a few.
In some possible embodiments, various aspects of a Nand-type Flash Nand Flash storage management method provided by the present disclosure may also be implemented in the form of a program product including program code for causing a computer device to perform the steps of the Nand-type Flash Nand Flash storage management method according to various exemplary embodiments of the present disclosure described above in this specification when the program product is run on the computer device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable diskette, a hard disk, a random access computer storage media (RAM), a read-only computer storage media (ROM), an erasable programmable read-only computer storage media (EPROM or flash memory), an optical fiber, a portable compact disc read-only computer storage media (CD-ROM), an optical computer storage media piece, a magnetic computer storage media piece, or any suitable combination of the foregoing.
The Nand Flash storage management program product of the embodiments of the present disclosure may employ a portable compact disc read-only computer storage medium (CD-ROM) and include program code, and may be run on an electronic device. However, the program product of the present disclosure is not so limited, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the consumer electronic device, partly on the consumer electronic device, as a stand-alone software package, partly on the consumer electronic device and partly on a remote electronic device, or entirely on the remote electronic device or server. In the case of remote electronic devices, the remote electronic devices may be connected to the consumer electronic device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external electronic device (e.g., through the internet using an internet service provider).
It should be noted that although several modules of the apparatus are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the modules described above may be embodied in one module, in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module described above may be further divided into embodiments by a plurality of modules.
Further, while the operations of the disclosed methods are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk computer storage media, CD-ROMs, optical computer storage media, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the present disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable computer storage medium that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable computer storage medium produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made to the present disclosure without departing from the spirit and scope of the disclosure. Thus, if such modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include such modifications and variations as well.

Claims (16)

1. A Nand Flash memory storage management method is characterized in that the Nand Flash memory Nand Flash comprises a data area and a data mapping table area, the data area is used for storing files, and the data mapping table area is used for storing data mapping tables corresponding to the files, and the method comprises the following steps:
after the Nand Flash is electrified and initialized, aiming at any data mapping table in the data mapping table area, if the data mapping table is effective and a physical page storing the data mapping table is an effective page, performing cyclic redundancy check on a file corresponding to the data mapping table to obtain a new check value;
if the new check value is consistent with the check value stored in the data mapping table, determining the last physical page of the file stored in the data area according to the index value of the physical page list in the data mapping table, and determining the last physical page of the data mapping table stored in the data mapping table area according to the physical page storing the data mapping table;
responding to the deletion operation of a user on the file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
if the undeleted file exists according to the array value of the physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file.
2. The method of claim 1, wherein after setting the array value of the physical page list in the data mapping table corresponding to the undeleted file to the value corresponding to the deleted file, the method further comprises:
storing a data mapping table corresponding to the offset file from an adjacent physical page behind a last physical page of the stored data mapping table in the data mapping table region; and
and setting a first byte of a free area of a first target physical page in the data mapping table area to be invalid, wherein the first target physical page is a previous adjacent physical page of a physical page storing the data mapping table corresponding to the offset file.
3. The method of claim 2, wherein the data mapping table corresponding to the offset file is generated by:
determining an index value and an array value corresponding to the offset file by using a physical block and a physical page for storing the offset file;
and generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the equipment group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be valid.
4. The method according to claim 1, wherein after setting the array value of the physical page list in the data mapping table corresponding to the undeleted file to the value corresponding to the deleted file, the method further comprises:
and if it is determined that no idle physical page exists in the physical block storing the data mapping table corresponding to the undeleted file and the array value of the physical page list in the data mapping table in each physical page in the physical block is the value corresponding to the deleted file, erasing the physical block and erasing the physical block storing each file corresponding to each data mapping table in the physical block in the data area.
5. The method of claim 1, further comprising:
responding to the operation of a user on the data area to create a file, and determining the file name of the created file;
traversing array values of a physical page list in each data mapping table in the data mapping table area, wherein the array values represent that when a file corresponding to the data mapping table is an undeleted file, the corresponding value is the file name of the file;
and if the fact that the array value of the physical page list in the data mapping table is not the same as the file name of the created file is determined, the created file is stored in an adjacent physical page behind the last physical page of the stored file in the data area.
6. The method of claim 5, wherein after storing the created file in an adjacent physical page of the data area that is subsequent to a last physical page of the stored file, the method further comprises:
storing a data mapping table corresponding to the created file into an adjacent physical page behind the last physical page of the stored data mapping table in the data mapping table region; and
and setting the first byte of a free area of a second target physical page in the data mapping table area as invalid, wherein the second target physical page is a previous adjacent physical page of a physical page storing the data mapping table corresponding to the created file.
7. The method of claim 6, wherein the data mapping table corresponding to the created file is generated by:
determining an index value and an array value corresponding to the created file according to the physical block and the physical page for storing the created file;
and generating a data mapping table corresponding to the created file according to the check value of the created file during storage, the device group number of the physical block for storing the created file, the index value and the array value, and setting the data mapping table to be valid.
8. A Nand Flash memory storage management device is characterized in that the Nand Flash memory comprises a data area and a data mapping table area, the data area is used for storing files, the data mapping table area is used for storing data mapping tables corresponding to the files, and the device comprises:
the power-on initialization module is used for carrying out power-on initialization on Nand Flash, aiming at any data mapping table in the data mapping table area, if the data mapping table is effective and a physical page storing the data mapping table is an effective page, carrying out cyclic redundancy check on a file corresponding to the data mapping table to obtain a new check value;
a last physical page determining module, configured to determine, if the new check value is consistent with the check value stored in the data mapping table, a last physical page of the file stored in the data area according to an index value of a physical page list in the data mapping table, and determine, according to the physical page storing the data mapping table, the last physical page of the data mapping table stored in the data mapping table area;
the deleting module is used for responding to the deleting operation of a user on the file in the data area and setting the array value of the physical page list in the data mapping table corresponding to the file as the value corresponding to the deleted file; the array value is used for indicating whether the file corresponding to the data mapping table is deleted or not;
the offset module is used for determining that the undeleted file exists according to the array values of the physical page list in each data mapping table corresponding to each file stored before the file; copying the undeleted file to obtain an offset file, storing the offset file from a physical page adjacent to the last physical page of the stored file in the data area, and setting the array value of the physical page list in the data mapping table corresponding to the undeleted file as the value corresponding to the deleted file.
9. The apparatus of claim 8, further comprising:
an offset data mapping table saving module, configured to set an array value of a physical page list in a data mapping table corresponding to the undeleted file to a value corresponding to the deleted file, and then save the data mapping table corresponding to the offset file from an adjacent physical page subsequent to a last physical page of the stored data mapping table in the data mapping table region;
and the first target physical page setting module is used for setting the first byte of the free area of the first target physical page in the data mapping table area to be invalid, wherein the first target physical page is a previous adjacent physical page of a physical page for storing the data mapping table corresponding to the offset file.
10. The apparatus of claim 9, further comprising:
an offset data mapping table generating module to:
generating a data mapping table corresponding to the offset file by the following method:
determining an index value and a group value corresponding to the offset file by using a physical block and a physical page for storing the offset file;
and generating a data mapping table corresponding to the offset file according to the check value of the offset file during storage, the equipment group number of the physical block for storing the offset file, the index value and the array value, and setting the data mapping table to be effective.
11. The apparatus of claim 8, further comprising:
and the erasing module is used for erasing the physical block and erasing the physical block of each file corresponding to each data mapping table in the physical block in the data area, wherein the physical block corresponds to the deleted file, and the physical block corresponds to each data mapping table in the physical block.
12. The apparatus of claim 8, further comprising:
the file name acquisition module is used for responding to the operation of a user on the data area to create the file and determining the file name of the created file;
the traversing module is used for traversing array values of a physical page list in each data mapping table in the data mapping table area, wherein the array values represent that when a file corresponding to the data mapping table is an undeleted file, the corresponding value is the file name of the file;
and the created file storage module is used for storing the created file in an adjacent physical page behind the last physical page of the stored file in the data area if the fact that the array value of the physical page list in the data mapping table does not exist is the same as the file name of the created file is determined.
13. The apparatus of claim 12, further comprising:
a created file data mapping table storage module, configured to store a data mapping table corresponding to the created file in an adjacent physical page subsequent to a last physical page of the stored data mapping table in the data mapping table region;
and the second target physical page setting module is used for setting the first byte of the free area of the second target physical page in the data mapping table area to be invalid, wherein the second target physical page is a previous adjacent physical page of a physical page for storing the data mapping table corresponding to the created file.
14. The apparatus of claim 13, further comprising:
a created file data mapping table generating module, configured to generate a data mapping table corresponding to the created file in the following manner:
determining an index value and an array value corresponding to the created file according to the physical block and the physical page for storing the created file;
and generating a data mapping table corresponding to the created file according to the check value of the created file during storage, the device group number of the physical block for storing the created file, the index value and the array value, and setting the data mapping table to be valid.
15. An electronic device comprising at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions for execution by the at least one processor; the instructions are executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A computer storage medium, characterized in that the computer storage medium stores a computer program for performing the method according to any one of claims 1-7.
CN202011576812.2A 2020-12-28 2020-12-28 NAND Flash Nand Flash storage management method and device Active CN112486854B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011576812.2A CN112486854B (en) 2020-12-28 2020-12-28 NAND Flash Nand Flash storage management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011576812.2A CN112486854B (en) 2020-12-28 2020-12-28 NAND Flash Nand Flash storage management method and device

Publications (2)

Publication Number Publication Date
CN112486854A CN112486854A (en) 2021-03-12
CN112486854B true CN112486854B (en) 2022-08-23

Family

ID=74914434

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011576812.2A Active CN112486854B (en) 2020-12-28 2020-12-28 NAND Flash Nand Flash storage management method and device

Country Status (1)

Country Link
CN (1) CN112486854B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2126953A1 (en) * 1993-12-03 1995-06-04 Jeffery P. Davis Dual port interface for a computer-based multifunction personal communication system
CN109697025A (en) * 2017-10-20 2019-04-30 株式会社日立制作所 The storage medium of storage device, data managing method and data administrator
CN110928806A (en) * 2018-09-20 2020-03-27 爱思开海力士有限公司 Memory system and operating method thereof

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4079506B2 (en) * 1997-08-08 2008-04-23 株式会社東芝 Method for controlling nonvolatile semiconductor memory system
CN100383763C (en) * 2004-02-27 2008-04-23 中国人民解放军国防科学技术大学 Page transport and copy method based on operation system reverse page table
CN100470506C (en) * 2007-06-08 2009-03-18 马彩艳 Flash memory management based on sector access
CN101727402B (en) * 2009-10-23 2012-07-04 深圳市江波龙电子有限公司 Read and write control method and system of data of nonvolatile storage
CN102841851B (en) * 2012-07-19 2015-09-09 深圳市江波龙电子有限公司 Flash memory management method and flash memory device
CN103996412A (en) * 2013-02-19 2014-08-20 北京同方微电子有限公司 Power-fail protection method applied to intelligent-card nonvolatile memories

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2126953A1 (en) * 1993-12-03 1995-06-04 Jeffery P. Davis Dual port interface for a computer-based multifunction personal communication system
CN109697025A (en) * 2017-10-20 2019-04-30 株式会社日立制作所 The storage medium of storage device, data managing method and data administrator
CN110928806A (en) * 2018-09-20 2020-03-27 爱思开海力士有限公司 Memory system and operating method thereof

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《SREA: A self-recovery effect aware wear-leveling strategy for the reliability extension of NAND flash memory》;Debao Wei;《Microelectronics Reliability》;20190923;第1页-第5页 *
《一种适用于NAND闪存的LDPC译码算法》;于彬;《软件导刊》;20190423(第7期);第84页-第87页 *

Also Published As

Publication number Publication date
CN112486854A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN108681565B (en) Block chain data parallel processing method, device, equipment and storage medium
US10430281B2 (en) Space efficient cascading point in time copying
CN108132890B (en) Garbage recycling method, device and equipment for memory chip and storage medium
KR102483299B1 (en) Method, apparatus, device and storage medium for processing circular instruction
CN111198868B (en) Intelligent database-dividing real-time data migration method and device
CN111240689A (en) Application program construction method, device, equipment and storage medium
US11030060B2 (en) Data validation during data recovery in a log-structured array storage system
US9542111B2 (en) Writable clone data structure
US20140281221A1 (en) Data processing
CN104375875A (en) Method for compiler optimization of applications and compiler
US20190220194A1 (en) Method, device and computer program product for expanding storage space
CN111208933A (en) Data access method, device, equipment and storage medium
JP2019215847A (en) Reducing buffer overflow
US10747514B2 (en) Reduced save and restore instructions for call-clobbered registers
CN106528322B (en) Method and apparatus for detecting non-documented corruption of data
US11436200B2 (en) Fault tolerant parallel journaling for file systems
CN113918308A (en) Interface calling method, system, readable storage medium and computer equipment
WO2021189905A1 (en) Distributed data retrieval method and apparatus, and electronic device and storage medium
CN112486854B (en) NAND Flash Nand Flash storage management method and device
CN112039975A (en) Method, device, equipment and storage medium for processing message field
CN115599437B (en) Software version processing method and device, electronic equipment and storage medium
CN113010115B (en) Data processing method in block chain node and related equipment
US10671397B2 (en) Reduced save and restore instructions for call-clobbered registers
CN108052410B (en) Method and device for preventing errors of SPI-Nand read data page
CN113656406A (en) Index page merging method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant