CN105389266A - Data management method and apparatus - Google Patents

Data management method and apparatus Download PDF

Info

Publication number
CN105389266A
CN105389266A CN201510672620.4A CN201510672620A CN105389266A CN 105389266 A CN105389266 A CN 105389266A CN 201510672620 A CN201510672620 A CN 201510672620A CN 105389266 A CN105389266 A CN 105389266A
Authority
CN
China
Prior art keywords
page
mapping table
data
field
lpn
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.)
Granted
Application number
CN201510672620.4A
Other languages
Chinese (zh)
Other versions
CN105389266B (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.)
Shenzhen Union Memory Information System Co Ltd
Original Assignee
Lenovo Beijing 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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN201510672620.4A priority Critical patent/CN105389266B/en
Publication of CN105389266A publication Critical patent/CN105389266A/en
Application granted granted Critical
Publication of CN105389266B publication Critical patent/CN105389266B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc
    • G06F2212/1036Life time enhancement

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data management method and apparatus. The method comprises: dividing a mapping table into M independent mapping table pages, wherein M is a positive integer; allocating a unique virtual logic page number (LPN) for each mapping table page; and storing the mapping table page based on the virtual LPN. With the adoption of the technical scheme provided by the invention, the convenience is at least provided for a garbage collector (GC) to perform unified recovery and management on data pages and the mapping table pages.

Description

Data management method and device
Technical Field
The invention relates to the field of solid state disks, in particular to a data management method and device.
Background
The mapping table cannot be fixedly updated into one or more blocks (blocks), otherwise, one or more blocks are erased and written repeatedly, and the risk of bad blocks is increased. It is therefore desirable to have the storage of mapping tables as streamed as possible in flash memory (flash).
If the mapping table is divided into a plurality of independent pages, the pages are written into the flash as common data pages (datapages), and the recovery operation of a Wear Leveling (WL) and a Garbage Collector (GC) is carried out together with the common data pages. However, since the mapping table page (mappingtablepage) does not have a corresponding Logical Page (LPN) number, it causes a trouble in GC recycling.
Therefore, how to facilitate the GC to uniformly recycle and manage the data page and the mapping table page becomes a problem to be solved urgently.
Disclosure of Invention
In view of the above, the present invention is directed to a data management method and apparatus, which at least facilitate the GC to uniformly recover and manage the data page and the mapping table.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the invention discloses a data management method, which comprises the following steps:
dividing a mapping table into M independent mapping table pages, wherein M is a positive integer;
allocating a unique virtual LPN number for each mapping table page;
storing the mapping table page based on the virtual LPN number.
In the foregoing solution, preferably, the storing the mapping table page based on the virtual LPN number includes:
reserving an integer field of the page tail of the mapping table page;
the virtual LPN number is stored in the integer field.
In the foregoing solution, preferably, the allocating a virtual LPN number to each mapping table page includes:
acquiring a first field corresponding to a data page; the first field refers to a field reserved for a data page by a file system;
determining a second field based on the first field; wherein the second field is a field which cannot be covered by the file system;
and allocating a unique virtual LPN number to each mapping table page randomly or sequentially from the second field.
In the foregoing solution, preferably, the method further includes:
when the data is recycled, the data is processed,
obtaining an LPN number corresponding to a current page;
determining a type of a current page based on the LPN number;
when the current page is a mapping table page, judging the validity of the mapping table page by a corresponding family table, and if the mapping table page is invalid, recycling the mapping table page;
and when the current page is a data page, judging the validity of the data page corresponding to the mapping table, and if the data page is invalid, recovering the data page.
In the foregoing solution, preferably, the determining the type of the current page based on the LPN number includes:
checking the field type corresponding to the LPN number;
if the field type is a first field, judging that the type of the current page is a data page;
and if the field type is the second field, judging that the type of the current page is the mapping table page.
In the above scheme, preferably, the family table records a one-to-one correspondence relationship between a mapping table and a physical page number (VPN) with a virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
In the foregoing solution, preferably, the determining, by the family table, validity of the mapping table page includes:
acquiring a VPN number corresponding to a mapping table page;
searching a standard VPN number corresponding to the virtual LPN number in a family table according to the virtual LPN number of the mapping table page;
judging whether the VPN number is consistent with the standard VPN number, and if so, judging that the mapping table page is effective; and if not, judging that the mapping table page is invalid.
In the foregoing solution, preferably, the determining, by the mapping table, the validity of the data page includes:
acquiring a VPN number corresponding to a data page;
searching a standard VPN number corresponding to the LPN number in a mapping table according to the LPN number of the data page;
judging whether the VPN number is consistent with the standard VPN number or not; if the data pages are consistent, judging that the data pages are valid; and if the data pages are not consistent, judging that the data pages are invalid.
The invention also discloses a data management device, which comprises:
the mapping table comprises a dividing unit, a mapping table page generation unit and a mapping table generation unit, wherein the dividing unit is used for dividing the mapping table into M independent mapping table pages, and M is a positive integer;
an allocation unit, configured to allocate a virtual logical page LPN number to each mapping table page;
a storage unit, configured to store the mapping table page based on the virtual LPN number.
In the foregoing solution, preferably, the storage unit is further configured to:
the reservation module is used for reserving an integer field of the page tail of the mapping table page;
and the storage module is used for storing the virtual LPN number in the integer field.
In the foregoing solution, preferably, the allocation unit includes:
the first acquisition module is used for acquiring a first field corresponding to the data page; the first field refers to a field reserved for a data page by a file system;
a first determining module to determine a second field based on the first field; wherein the second field is a field which cannot be covered by the file system;
and the allocation module is used for allocating a unique virtual LPN number to each mapping table page randomly or sequentially from the second field.
In the foregoing solution, preferably, the apparatus further includes: a recovery unit, wherein the recovery unit comprises:
the second acquisition module is used for acquiring the LPN number corresponding to the current page;
a second determining module, configured to determine a type of the current page based on the LPN number;
the first recovery module is used for judging the validity of the mapping table page by the corresponding family table when the current page is the mapping table page, and if the mapping table page is invalid, performing recovery processing on the mapping table page;
and the second recovery module is used for judging the validity of the data page corresponding to the mapping table when the current page is the data page, and recovering the data page if the data page is invalid.
Preferably, the second determining module is further configured to: checking the field type corresponding to the LPN number; if the field type is a first field, judging that the type of the current page is a data page; and if the field type is the second field, judging that the type of the current page is the mapping table page.
In the above scheme, preferably, a one-to-one correspondence relationship between the mapping table and the physical page number VPN is recorded in the family table, with the virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
In the foregoing scheme, preferably, the first recovery module is further configured to:
acquiring a VPN number corresponding to a mapping table page;
searching a standard VPN number corresponding to the virtual LPN number in a family table according to the virtual LPN number of the mapping table page;
judging whether the VPN number is consistent with the standard VPN number, and if so, judging that the mapping table page is effective; and if not, judging that the mapping table page is invalid.
In the foregoing solution, preferably, the second recovery module is further configured to:
acquiring a VPN number corresponding to a data page;
searching a standard VPN number corresponding to the LPN number in a mapping table according to the LPN number of the data page;
judging whether the VPN number is consistent with the standard VPN number or not; if the data pages are consistent, judging that the data pages are valid; and if the data pages are not consistent, judging that the data pages are invalid.
According to the data management method and device provided by the invention, a mapping table is divided into M independent mapping table pages, wherein M is a positive integer; allocating a unique virtual LPN number for each mapping table page; storing the mapping table page based on the virtual LPN number; in this way, at least the GC is facilitated to uniformly reclaim and manage the data page and the mapping table page.
Drawings
Fig. 1 is a schematic flow chart illustrating an implementation of a data management method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating an implementation of another data management method according to an embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating an implementation of another data management method according to an embodiment of the present invention;
fig. 4(a) is a schematic diagram of a mapping table page provided by an embodiment of the present invention, fig. 4(b) is a schematic diagram of another mapping table page provided by an embodiment of the present invention, and fig. 4(c) is a schematic diagram of a current family table provided by an embodiment of the present invention;
fig. 5 is a schematic flow chart illustrating an implementation of another data management method according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a data management apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of another data management apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of another data management apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of another data management apparatus according to an embodiment of the present invention.
Detailed Description
So that the manner in which the features and aspects of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings.
Example one
Fig. 1 is a schematic diagram of an implementation flow of a data management method according to an embodiment of the present invention, and in a preferred embodiment of the present invention, as shown in fig. 1, the data management method mainly includes the following steps:
step 101: and dividing the mapping table into M independent mapping table pages, wherein M is a positive integer.
Step 102: each mapping table page is assigned a unique virtual logical page LPN number.
Preferably, the allocating a virtual LPN number to each mapping table page may include:
acquiring a first field corresponding to a data page; the first field refers to a field reserved for a data page by a file system;
determining a second field based on the first field; wherein the second field is a field which cannot be covered by the file system;
and allocating a unique virtual LPN number to each mapping table page randomly or sequentially from the second field.
For example, the second field may be a complex field. That is, the virtual LPN number may use a field (e.g., a complex number field) that is not covered by the LPN number allocated by the file system for the data page.
Step 103: storing the mapping table page based on the virtual LPN number.
Preferably, the storing the mapping table page based on the virtual LPN number may include:
reserving an integer field of the page tail of the mapping table page;
the virtual LPN number is stored in the integer field.
In the data management method of this embodiment, when storing the mapping table, the mapping table is divided into independent mapping table pages for storage, and a virtual LPN number that can be distinguished from a data page identification number (i.e., an LPN number) is allocated to each mapping table page; thus, the subsequent management of the mapping table is facilitated.
Example two
Fig. 2 is a schematic flow chart of another implementation of a data management method according to an embodiment of the present invention, and in a preferred embodiment of the present invention, as shown in fig. 2, the data management method mainly includes the following steps:
step 201: and acquiring the LPN number corresponding to the current page.
It should be noted that this embodiment is completed based on fig. 1. That is, when storing, the mapping table has been divided into independent mapping table pages, and a virtual LPN number is assigned to each mapping table page; at the same time, the file system also assigns an LPN number to each data page.
Step 202: determining a type of a current page based on the LPN number.
Preferably, the determining the type of the current page based on the LPN number may include:
checking the field type corresponding to the LPN number;
if the field type is a first field, judging that the type of the current page is a data page;
and if the field type is the second field, judging that the type of the current page is the mapping table page.
Step 203: and recycling the current page according to a preset strategy.
Preferably, the recycling processing of the current page according to a preset policy may include:
when the current page is a mapping table page, judging the validity of the mapping table page by a corresponding family table, and if the mapping table page is invalid, recycling the mapping table page;
and when the current page is a data page, judging the validity of the data page corresponding to the mapping table, and if the data page is invalid, recovering the data page.
Wherein, the family table records a one-to-one correspondence relationship between a mapping table and a physical page number VPN by taking a virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
In the data management method of this embodiment, an LPN number corresponding to a current page is obtained; determining a type of a current page based on the LPN number; recycling the current page according to a preset strategy; therefore, the data page and the mapping table page are convenient to be uniformly recycled and managed.
EXAMPLE III
Fig. 3 is a schematic flow chart of an implementation of another data management method according to an embodiment of the present invention, and in a preferred embodiment of the present invention, as shown in fig. 3, the data management method mainly includes the following steps:
step 301: and acquiring the VPN number corresponding to the mapping table page.
It should be noted that the present embodiment is a processing flow of the mapping table page given in the scenario in which fig. 2 has determined that the current page is the mapping table page.
Step 302: and searching a standard VPN number corresponding to the virtual LPN number in a family table according to the virtual LPN number of the mapping table page.
The family table records a one-to-one correspondence relationship between a mapping table and a VPN by using a virtual LPN number as an index.
Step 303: judging whether the VPN number is consistent with the standard VPN number, and if so, judging that the mapping table page is effective; and if not, judging that the mapping table page is invalid.
Fig. 4(a) shows a mapping table page schematic, where the length of the whole word in the end of the page stores the virtual LPN number 5 and the VPN storing the mapping table page is 10;
that is, the VPN-10 stores a mapping table page with virtual LPN number 5, and if the page is rewritten, there must be another VPN storing the page, for example, VPN-20, as shown in fig. 4 (b);
fig. 4(c) shows a schematic diagram of a current family table (clustertable), according to which the validity of the mapping table is judged, and it can be seen from fig. 4-c that since the family table is indexed by a virtual LPN number, the VPN corresponding to the virtual LPN is 20, and then the mapping table page stored on VPN-10 corresponding to fig. 4-a is invalid, and should be recovered.
In the data management method of this embodiment, the mapping table is already divided into independent mapping table pages during storage, and how to judge the validity of the mapping table pages corresponding to the family table is given on the basis that a virtual LPN number is allocated to each mapping table page.
Example four
Fig. 5 is a schematic flow chart of an implementation of another data management method according to an embodiment of the present invention, and in a preferred embodiment of the present invention, as shown in fig. 5, the data management method mainly includes the following steps:
step 501: and acquiring a VPN number corresponding to the data page.
It should be noted that the present embodiment is a processing flow of the data page given in the scenario in which fig. 2 already determines that the current page is the data page.
Step 502: and searching a standard VPN number corresponding to the LPN number in a mapping table according to the LPN number of the data page.
Wherein, the family table records a one-to-one corresponding relation between a mapping table and a VPN by taking a virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
Step 503: judging whether the VPN number is consistent with the standard VPN number or not; if the data pages are consistent, judging that the data pages are valid; and if the data pages are not consistent, judging that the data pages are invalid.
The difference between this embodiment and the third embodiment is that: the LPN number stored at the end of each data page is stored in the last page of each block in a centralized manner, and only the way of reading the LPN number is different, but the validity is determined by looking up the table in the same manner, which is not described herein again.
In the data management method of this embodiment, the mapping table is already divided into independent mapping table pages during storage, and how to determine the validity of the data page corresponding to the mapping table is given on the basis that a virtual LPN number is allocated to each mapping table page.
EXAMPLE five
An embodiment of the present invention provides a data management apparatus, and fig. 6 is a schematic structural diagram of a data management apparatus according to an embodiment of the present invention, and as shown in fig. 6, the data management apparatus includes:
a dividing unit 61, configured to divide the mapping table into M independent mapping table pages, where M is a positive integer;
an allocating unit 62 configured to allocate a virtual LPN number to each mapping table page;
a storage unit 63, configured to store the mapping table page based on the virtual LPN number.
Preferably, the distribution unit 62 includes:
a first obtaining module 621, configured to obtain a first field corresponding to the data page; the first field refers to a field reserved for a data page by a file system;
a first determining module 622 for determining a second field based on the first field; wherein the second field is a field which cannot be covered by the file system;
and an allocating module 623, configured to allocate a unique virtual LPN number to each mapping table page randomly or sequentially from the second field.
For example, the second field may be a complex field. That is, the virtual LPN number may be a field (e.g., a complex number field) that is not covered by the LPN number assigned to the data page by the file system
Preferably, the storage unit 63 includes:
a reserving module 631, configured to reserve an integer field of a page tail of the mapping table page;
a storing module 632, configured to store the virtual LPN number in the integer field.
It should be understood by those skilled in the art that the functions of the units in the data management device of this embodiment may be implemented by analog circuits that implement the functions described in the embodiments of the present invention, or by running software that executes the functions described in the embodiments of the present invention on an intelligent terminal.
It should be noted that the data management apparatus of this embodiment may be disposed in a terminal, and the functions of the partitioning unit 61, the allocating unit 62, the storing unit 63, and the modules included in the units according to the embodiment of the present invention may be implemented by a Central Processing Unit (CPU), a Micro Processing Unit (MPU), a Digital Signal Processing (DSP) chip, or the like of the data management apparatus or the terminal to which the data management apparatus belongs.
By adopting the data management device of the embodiment, the storage of the mapping table can flow in the flash memory as much as possible, and the subsequent management of the mapping table is convenient.
EXAMPLE six
An embodiment of the present invention provides another data management apparatus, and fig. 7 is a schematic structural diagram of a data management apparatus according to an embodiment of the present invention, and as shown in fig. 7, the data management apparatus includes:
a dividing unit 61, configured to divide the mapping table into M independent mapping table pages, where M is a positive integer;
an allocating unit 62 configured to allocate a virtual LPN number to each mapping table page;
a storage unit 63 configured to store the mapping table page based on the virtual LPN number;
a recovery unit 64, configured to obtain an LPN number corresponding to a current page when performing recovery processing on data; determining a type of a current page based on the LPN number; when the current page is a mapping table page, judging the validity of the mapping table page by a corresponding family table, and if the mapping table page is invalid, recycling the mapping table page; and when the current page is a data page, judging the validity of the data page corresponding to the mapping table, and if the data page is invalid, recovering the data page.
Wherein, the family table records a one-to-one correspondence relationship between a mapping table and a physical page number VPN by taking a virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
Wherein the recovery unit 64 includes:
a second obtaining module 641, configured to obtain an LPN number corresponding to the current page;
a second determining module 642, configured to determine a type of the current page based on the LPN number;
a first recovery module 643, configured to, when the current page is a mapping table page, determine validity of the mapping table page by using a corresponding family table, and if the mapping table page is invalid, perform recovery processing on the mapping table page;
a second recycling module 644, configured to, when the current page is a data page, determine validity of the data page according to the mapping table, and if the data page is invalid, recycle the data page.
Preferably, the second determining module 642 is further configured to: checking the field type corresponding to the LPN number; if the field type is a first field, judging that the type of the current page is a data page; and if the field type is the second field, judging that the type of the current page is the mapping table page.
It should be understood by those skilled in the art that the functions of the units in the data management device of this embodiment may be implemented by analog circuits that implement the functions described in the embodiments of the present invention, or by running software that executes the functions described in the embodiments of the present invention on an intelligent terminal.
It should be noted that the data management apparatus of this embodiment may be disposed in a terminal, and the functions of the dividing unit 61, the allocating unit 62, the storing unit 63, the recovering unit 64, and the modules included in the units according to the embodiment of the present invention may be implemented by a CPU, an MPU, a DSP chip, or the like of the data management apparatus or the terminal to which the data management apparatus belongs.
By adopting the data management device of the embodiment, the GC is at least convenient to uniformly recycle and manage the data page and the mapping table page.
EXAMPLE seven
Fig. 8 is a schematic structural diagram of another data management apparatus provided in an embodiment of the present invention, and as shown in fig. 8, the data management apparatus includes: a dividing unit 61, a distributing unit 62, a storage unit 63, and a recovery unit 64; wherein,
the dividing unit 61 is configured to divide the mapping table into M independent mapping table pages, where M is a positive integer;
the allocating unit 62 is configured to allocate a virtual LPN number to each mapping table page;
the storage unit 63 is configured to store the mapping table page based on the virtual LPN number;
the recovery unit 64 is configured to obtain an LPN number corresponding to the current page; determining a type of a current page based on the LPN number; and recycling the current page according to a preset strategy.
Preferably, the recovery unit 64 includes:
a second obtaining module 641, configured to obtain an LPN number corresponding to the current page;
a second determining module 642, configured to determine a type of the current page based on the LPN number;
a first recovery module 643, configured to, when the current page is a mapping table page, determine validity of the mapping table page by using a corresponding family table, and if the mapping table page is invalid, perform recovery processing on the mapping table page;
a second recycling module 644, configured to, when the current page is a data page, determine validity of the data page according to the mapping table, and if the data page is invalid, recycle the data page.
Preferably, the second determining module 642 is further configured to: checking the field type corresponding to the LPN number; if the field type is a first field, judging that the type of the current page is a data page; and if the field type is the second field, judging that the type of the current page is the mapping table page.
Preferably, the first recovery module 643, including:
a first obtaining submodule 6431, configured to obtain a VPN number corresponding to a mapping table page;
a first lookup sub-module 6432, configured to lookup, in a family table, a standard VPN number corresponding to the virtual LPN number according to the virtual LPN number of the mapping table page;
a first determining submodule 6433, configured to determine whether the VPN number is consistent with the standard VPN number, and if so, determine that the mapping table page is valid; and if not, judging that the mapping table page is invalid.
It should be noted that the data management apparatus of this embodiment may be disposed in a terminal, and the functions of the dividing unit 61, the allocating unit 62, the storing unit 63, the recovering unit 64, and the modules included in the units according to the embodiment of the present invention may be implemented by a CPU, an MPU, a DSP chip, or the like of the data management apparatus or the terminal to which the data management apparatus belongs.
By adopting the data management device of the embodiment, the data page and the mapping table page can be recycled and managed uniformly, and the validity of the mapping table page can be better judged corresponding to the family table.
Example eight
Fig. 9 is a schematic structural diagram of another data management apparatus provided in an embodiment of the present invention, and as shown in fig. 9, the data management apparatus includes: a dividing unit 61, a distributing unit 62, a storage unit 63, and a recovery unit 64; wherein,
the dividing unit 61 is configured to divide the mapping table into M independent mapping table pages, where M is a positive integer;
the allocating unit 62 is configured to allocate a virtual LPN number to each mapping table page;
the storage unit 63 is configured to store the mapping table page based on the virtual LPN number;
the recovery unit 64 is configured to obtain an LPN number corresponding to the current page; determining a type of a current page based on the LPN number; and recycling the current page according to a preset strategy.
Preferably, the recovery unit 64 includes:
a second obtaining module 641, configured to obtain an LPN number corresponding to the current page;
a second determining module 642, configured to determine a type of the current page based on the LPN number;
a first recovery module 643, configured to, when the current page is a mapping table page, determine validity of the mapping table page by using a corresponding family table, and if the mapping table page is invalid, perform recovery processing on the mapping table page;
a second recycling module 644, configured to, when the current page is a data page, determine validity of the data page according to the mapping table, and if the data page is invalid, recycle the data page.
Preferably, the second determining module 642 is further configured to: checking the field type corresponding to the LPN number; if the field type is a first field, judging that the type of the current page is a data page; and if the field type is the second field, judging that the type of the current page is the mapping table page.
Preferably, the second recycling module 644 includes:
a second obtaining submodule 6441, configured to obtain a VPN number corresponding to the data page;
a second lookup submodule 6442, configured to lookup, in a mapping table, a standard VPN number corresponding to the LPN number according to the LPN number of the data page;
a second judging submodule 6443, configured to judge whether the VPN number is consistent with the standard VPN number; if the data pages are consistent, judging that the data pages are valid; and if the data pages are not consistent, judging that the data pages are invalid.
It should be understood by those skilled in the art that the functions of the units in the data management device of this embodiment may be implemented by analog circuits that implement the functions described in the embodiments of the present invention, or by running software that executes the functions described in the embodiments of the present invention on an intelligent terminal.
It should be noted that the data management apparatus of this embodiment may be disposed in a terminal, and the functions of the dividing unit 61, the allocating unit 62, the storing unit 63, the recovering unit 64, and the modules included in the units according to the embodiment of the present invention may be implemented by a CPU, an MPU, a DSP chip, or the like of the data management apparatus or the terminal to which the data management apparatus belongs.
By adopting the data management device of the embodiment, the data page and the mapping table page can be recovered and managed uniformly, and the validity of the data page can be judged better according to the mapping table.
In the embodiments provided in the present invention, it should be understood that the disclosed method, apparatus and electronic device may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: a removable memory device, a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Alternatively, the integrated unit according to the embodiment of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic or optical disk, or various other media that can store program code.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (16)

1. A method of data management, the method comprising:
dividing a mapping table into M independent mapping table pages, wherein M is a positive integer;
allocating a unique virtual logical page LPN number to each mapping table page;
storing the mapping table page based on the virtual LPN number.
2. The method of claim l, wherein storing the mapping table page based on the virtual LPN number comprises:
reserving an integer field of the page tail of the mapping table page;
the virtual LPN number is stored in the integer field.
3. The method of claim l, wherein the assigning a virtual LPN number to each mapping table page comprises:
acquiring a first field corresponding to a data page; the first field refers to a field reserved for a data page by a file system;
determining a second field based on the first field; wherein the second field is a field which cannot be covered by the file system;
and allocating a unique virtual LPN number to each mapping table page randomly or sequentially from the second field.
4. The method of claim 3, further comprising:
when the data is recycled, the data is processed,
obtaining an LPN number corresponding to a current page;
determining a type of a current page based on the LPN number;
when the current page is a mapping table page, judging the validity of the mapping table page by a corresponding family table, and if the mapping table page is invalid, recycling the mapping table page;
and when the current page is a data page, judging the validity of the data page corresponding to the mapping table, and if the data page is invalid, recovering the data page.
5. The method of claim 4, wherein the determining the type of the current page based on the LPN number comprises:
checking the field type corresponding to the LPN number;
if the field type is a first field, judging that the type of the current page is a data page;
and if the field type is the second field, judging that the type of the current page is the mapping table page.
6. The method of claim 4,
the family table records a one-to-one corresponding relation between a mapping table and a physical page number VPN by taking a virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
7. The method of claim 4, wherein the determining validity of the mapping table page by the corresponding family table comprises:
acquiring a VPN number corresponding to a mapping table page;
searching a standard VPN number corresponding to the virtual LPN number in a family table according to the virtual LPN number of the mapping table page;
judging whether the VPN number is consistent with the standard VPN number, and if so, judging that the mapping table page is effective; and if not, judging that the mapping table page is invalid.
8. The method of claim 4, wherein the determining the validity of the data page by the mapping table comprises:
acquiring a VPN number corresponding to a data page;
searching a standard VPN number corresponding to the LPN number in a mapping table according to the LPN number of the data page;
judging whether the VPN number is consistent with the standard VPN number or not; if the data pages are consistent, judging that the data pages are valid; and if the data pages are not consistent, judging that the data pages are invalid.
9. A data management apparatus, characterized in that the apparatus comprises:
the mapping table comprises a dividing unit, a mapping table page generation unit and a mapping table generation unit, wherein the dividing unit is used for dividing the mapping table into M independent mapping table pages, and M is a positive integer;
an allocation unit, configured to allocate a virtual logical page LPN number to each mapping table page;
a storage unit, configured to store the mapping table page based on the virtual LPN number.
10. The apparatus of claim 9, wherein the storage unit is further configured to:
the reservation module is used for reserving an integer field of the page tail of the mapping table page;
and the storage module is used for storing the virtual LPN number in the integer field.
11. The apparatus of claim 9, wherein the allocation unit comprises:
the first acquisition module is used for acquiring a first field corresponding to the data page; the first field refers to a field reserved for a data page by a file system;
a first determining module to determine a second field based on the first field; wherein the second field is a field which cannot be covered by the file system;
and the allocation module is used for allocating a unique virtual LPN number to each mapping table page randomly or sequentially from the second field.
12. The apparatus of claim 9, further comprising a recovery unit, the recovery unit comprising:
the second acquisition module is used for acquiring the LPN number corresponding to the current page;
a second determining module, configured to determine a type of the current page based on the LPN number;
the first recovery module is used for judging the validity of the mapping table page by the corresponding family table when the current page is the mapping table page, and if the mapping table page is invalid, performing recovery processing on the mapping table page;
and the second recovery module is used for judging the validity of the data page corresponding to the mapping table when the current page is the data page, and recovering the data page if the data page is invalid.
13. The apparatus of claim 12, wherein the second determining module is further configured to: checking the field type corresponding to the LPN number; if the field type is a first field, judging that the type of the current page is a data page; and if the field type is the second field, judging that the type of the current page is the mapping table page.
14. The apparatus of claim 12,
the family table records a one-to-one corresponding relation between a mapping table and a physical page number VPN by taking a virtual LPN number as an index;
the mapping table records a one-to-one correspondence relationship between the data page and the VPN by taking the LPN number as an index.
15. The apparatus of claim 12, wherein the first recovery module is further configured to:
acquiring a VPN number corresponding to a mapping table page;
searching a standard VPN number corresponding to the virtual LPN number in a family table according to the virtual LPN number of the mapping table page;
judging whether the VPN number is consistent with the standard VPN number, and if so, judging that the mapping table page is effective; and if not, judging that the mapping table page is invalid.
16. The apparatus of claim 12, wherein the second recovery module is further configured to:
acquiring a VPN number corresponding to a data page;
searching a standard VPN number corresponding to the LPN number in a mapping table according to the LPN number of the data page;
judging whether the VPN number is consistent with the standard VPN number or not; if the data pages are consistent, judging that the data pages are valid; and if the data pages are not consistent, judging that the data pages are invalid.
CN201510672620.4A 2015-10-16 2015-10-16 A kind of data managing method and device Active CN105389266B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510672620.4A CN105389266B (en) 2015-10-16 2015-10-16 A kind of data managing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510672620.4A CN105389266B (en) 2015-10-16 2015-10-16 A kind of data managing method and device

Publications (2)

Publication Number Publication Date
CN105389266A true CN105389266A (en) 2016-03-09
CN105389266B CN105389266B (en) 2019-03-01

Family

ID=55421570

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510672620.4A Active CN105389266B (en) 2015-10-16 2015-10-16 A kind of data managing method and device

Country Status (1)

Country Link
CN (1) CN105389266B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107315648A (en) * 2017-06-29 2017-11-03 成都三零嘉微电子有限公司 A kind of method of data-moving performance during raising bad block management
CN108073522A (en) * 2016-11-10 2018-05-25 慧荣科技股份有限公司 Garbage collection method for data storage device
CN108228376A (en) * 2017-12-29 2018-06-29 北京联想核芯科技有限公司 A kind of data processing method and device of SSD hard disks
CN109542800A (en) * 2018-11-23 2019-03-29 深圳大普微电子科技有限公司 Method, solid state hard disk and the storage device of garbage disposal based on flash memory
WO2019062370A1 (en) * 2017-09-30 2019-04-04 华为技术有限公司 Method and device for garbage collection in storage system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1447243A (en) * 2002-03-25 2003-10-08 太和科技股份有限公司 Calculation method executed in quick flash memory fast and not caused abnormal power breakdown as well as its control system
CN1534509A (en) * 2003-03-27 2004-10-06 太和科技股份有限公司 Flash memory calculating method possessing quick and preventing improper operation function and its control system
CN101030167A (en) * 2007-01-17 2007-09-05 忆正存储技术(深圳)有限公司 Flash-memory zone block management
CN102945208A (en) * 2012-10-25 2013-02-27 记忆科技(深圳)有限公司 Multiuser hard disk system and implementation method thereof
US20140040577A1 (en) * 2012-08-03 2014-02-06 International Business Machines Corporation Automatic Use of Large Pages
CN104714894A (en) * 2015-03-18 2015-06-17 清华大学 Layered phase-change memory abrasion equilibrating method and system based on random mapping

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1447243A (en) * 2002-03-25 2003-10-08 太和科技股份有限公司 Calculation method executed in quick flash memory fast and not caused abnormal power breakdown as well as its control system
CN1534509A (en) * 2003-03-27 2004-10-06 太和科技股份有限公司 Flash memory calculating method possessing quick and preventing improper operation function and its control system
CN101030167A (en) * 2007-01-17 2007-09-05 忆正存储技术(深圳)有限公司 Flash-memory zone block management
US20140040577A1 (en) * 2012-08-03 2014-02-06 International Business Machines Corporation Automatic Use of Large Pages
CN102945208A (en) * 2012-10-25 2013-02-27 记忆科技(深圳)有限公司 Multiuser hard disk system and implementation method thereof
CN104714894A (en) * 2015-03-18 2015-06-17 清华大学 Layered phase-change memory abrasion equilibrating method and system based on random mapping

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108073522A (en) * 2016-11-10 2018-05-25 慧荣科技股份有限公司 Garbage collection method for data storage device
CN107315648A (en) * 2017-06-29 2017-11-03 成都三零嘉微电子有限公司 A kind of method of data-moving performance during raising bad block management
CN107315648B (en) * 2017-06-29 2020-07-03 成都三零嘉微电子有限公司 Method for improving data moving performance during bad block management
WO2019062370A1 (en) * 2017-09-30 2019-04-04 华为技术有限公司 Method and device for garbage collection in storage system
CN108228376A (en) * 2017-12-29 2018-06-29 北京联想核芯科技有限公司 A kind of data processing method and device of SSD hard disks
CN109542800A (en) * 2018-11-23 2019-03-29 深圳大普微电子科技有限公司 Method, solid state hard disk and the storage device of garbage disposal based on flash memory

Also Published As

Publication number Publication date
CN105389266B (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN105389266B (en) A kind of data managing method and device
US10152501B2 (en) Rollover strategies in a n-bit dictionary compressed column store
CN110209490B (en) Memory management method and related equipment
CN112799584B (en) Data storage method and device
CN103077126B (en) A kind of EMS memory management process and device
CN107066498B (en) Key value KV storage method and device
EP4137924A1 (en) Fragment management method and fragment management apparatus
CN105745628B (en) A kind of method for writing data into flash memory device, flash memory device and storage system
EP3352071A1 (en) Data check method and storage system
EP2919120A1 (en) Memory monitoring method and related device
CN113032156B (en) Memory allocation method and device, electronic equipment and storage medium
CN107122136B (en) Capacity obtaining method and device
CN109165175B (en) Equipment identifier generation method and device
US20130061009A1 (en) High Performance Free Buffer Allocation and Deallocation
CN111459399A (en) Data writing method, data reading method and device
CN114327917A (en) Memory management method, computing device and readable storage medium
CN115712500A (en) Memory release method, memory recovery method, memory release device, memory recovery device, computer equipment and storage medium
CN109753224B (en) Storage structure and storage structure configuration method
CN106844236A (en) The date storage method and device of terminal device
CN117762827A (en) Memory optimization method and related equipment
CN115658561A (en) Power distribution terminal memory management method and device, electronic equipment and storage medium
CN115794417A (en) Memory management method and device
CN115543859A (en) Wear leveling optimization method, device, equipment and medium for multi-partition SSD
US9990278B2 (en) Overlaid erase block mapping
CN111026890A (en) Picture data storage method, system, device and storage medium based on index table

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20170208

Address after: The 100176 branch of the Beijing economic and Technological Development Zone fourteen Street No. 99 building 33 building D No. 2226

Applicant after: Beijing legend core technology Co., Ltd.

Address before: 100085 Haidian District West Road, Beijing, No. 6

Applicant before: Lenovo (Beijing) Co., Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20190808

Address after: 518067 Dongjiaotou Workshop D24/F-02, Houhai Avenue, Shekou Street, Nanshan District, Shenzhen City, Guangdong Province

Patentee after: Shenzhen Yi Lian Information System Co., Ltd.

Address before: The 100176 branch of the Beijing economic and Technological Development Zone fourteen Street No. 99 building 33 building D No. 2226

Patentee before: Beijing legend core technology Co., Ltd.

TR01 Transfer of patent right