CN111897748A - Mapping relation storage method, reading method, device, equipment and medium - Google Patents

Mapping relation storage method, reading method, device, equipment and medium Download PDF

Info

Publication number
CN111897748A
CN111897748A CN201910368571.3A CN201910368571A CN111897748A CN 111897748 A CN111897748 A CN 111897748A CN 201910368571 A CN201910368571 A CN 201910368571A CN 111897748 A CN111897748 A CN 111897748A
Authority
CN
China
Prior art keywords
level table
block
storage
physical address
zone
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
CN201910368571.3A
Other languages
Chinese (zh)
Other versions
CN111897748B (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.)
Shanghai Geyi Electronic Co ltd
Beijing Zhaoyi Innovation Technology Co Ltd
Original Assignee
Shanghai Geyi Electronic Co ltd
Beijing Zhaoyi Innovation Technology 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 Shanghai Geyi Electronic Co ltd, Beijing Zhaoyi Innovation Technology Co Ltd filed Critical Shanghai Geyi Electronic Co ltd
Priority to CN201910368571.3A priority Critical patent/CN111897748B/en
Publication of CN111897748A publication Critical patent/CN111897748A/en
Application granted granted Critical
Publication of CN111897748B publication Critical patent/CN111897748B/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/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a mapping relation storage method, a mapping relation reading device, mapping relation equipment and a storage medium, wherein the method comprises the following steps: storing mapping entries between logical addresses and physical addresses of a flash memory to a block level table; storing the physical address of each block level table into a zone level table; storing the physical address of the zone level table to a root level table; wherein the number of block-level tables is at least two. By adopting the technical scheme, the mapping entries between the logical addresses and the physical addresses of the flash memory can be accurately stored.

Description

Mapping relation storage method, reading method, device, equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of data storage, in particular to a mapping relation storage method and device, electronic equipment and a storage medium.
Background
The EMMC (Embedded Multi Media Card) is established by the MMC association, mainly aims at the standard specification of an Embedded memory of products such as a mobile phone or a tablet computer, and consists of an Embedded memory solution, and is provided with an MMC multimedia interface, a flash memory (such as nand flash) and an EMMC controller. More and more mobile devices employ an EMMC chip as a memory cell.
When storing user data (for example, data such as photos and videos shot by a user through a mobile phone), the user data can be stored in a nand flash storage medium from a user terminal (for example, a front end of the mobile phone) to an EMMC chip, due to the storage characteristic of the nand flash, each time the data is stored, one storage page must be written at a time, and different nands have storage pages with different sizes, for example, the storage pages can be 4KB, 8KB or 16 KB. According to the agreement of the EMMC protocol, the write-in unit of the user data is 512 bytes, so a mapping association scheme between a logical address and a physical address needs to be formulated, the mapping association scheme meets the requirement of nand and the agreement of the EMMC protocol, and accurate access/fetching of the user data is realized. One existing mapping association scheme is: if the size of the user data is not larger than the size of the storage space of one storage block, filling the whole storage block in a mode of filling invalid data, namely mapping association between the logical address and the physical address is carried out by taking the storage block as a unit; or, if the size of the user data is not larger than the size of the storage space of one storage page, the entire storage page is filled by filling invalid data, that is, mapping association between the logical address and the physical address is performed in units of the storage page. Although the mapping association scheme generates fewer mapping entries (mapping entries refer to the correspondence between logical addresses and physical addresses), the mapping association scheme is not flexible enough and generates a large amount of invalid redundant data.
In view of the above drawbacks, another mapping association scheme has appeared, specifically, mapping association between logical addresses and physical addresses is performed in units of 4KB storage space, the scheme is relatively flexible, and there are few redundant data, but there are relatively many generated mapping entries, so how to reasonably store the mapping entries under the mapping scheme to achieve efficient data access becomes a key for implementing the scheme.
Disclosure of Invention
The embodiment of the invention provides a mapping relation storage method, a mapping relation storage device, electronic equipment and a storage medium, and the mapping relation storage method and the mapping relation storage device can accurately store mapping items between logical addresses and physical addresses of a flash memory.
In a first aspect, an embodiment of the present invention provides a mapping relationship storage method, where the method includes:
storing mapping entries between logical addresses and physical addresses of a flash memory to a block level table;
storing the physical address of each block level table into a zone level table;
storing the physical address of the zone level table to a root level table;
wherein the number of block-level tables is at least two.
In a second aspect, an embodiment of the present invention provides a mapping relationship reading method, where the method includes:
reading all root level tables from a second preset storage block;
determining a latest root level table based on the timestamp of the root level table;
reading a physical address of a first latest zone level table from the latest root level table;
reading a first latest zone level table from the physical address;
reading a physical address of a latest block-level table from the first latest region-level table;
reading the latest block-level table from the physical address of the latest block-level table;
a mapping entry between a logical address and a physical address of the flash memory is read based on the latest block level table.
In a third aspect, an embodiment of the present invention provides a mapping relationship storage apparatus, where the apparatus includes:
the first storage module is used for storing mapping entries between the logical addresses and the physical addresses of the flash memories into a block-level table;
the second storage module is used for storing the physical address of each block level table to the zone level table;
the third storage module is used for storing the physical address of the zone level table to a root level table;
wherein the number of block-level tables is at least two.
In a fourth aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the mapping relation storing method according to any one of claims 1 to 5 and the mapping relation reading method according to any one of claims 6 to 7 when executing the computer program.
In a fifth aspect, an embodiment of the present invention provides a storage medium containing computer-executable instructions, which when executed by a computer processor implement the mapping relation storing method according to any one of claims 1 to 5 and the mapping relation reading method according to any one of claims 6 to 7.
According to the mapping relation storage method provided by the embodiment of the invention, mapping entries between logical addresses and physical addresses of a flash memory are stored in a block level table; storing the physical address of each block level table into a zone level table; storing the physical address of the zone level table to a root level table; the number of the block level tables is at least two, so that mapping entries between logical addresses and physical addresses of the flash memory are accurately stored.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the contents of the embodiments of the present invention and the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a mapping relationship storage method according to an embodiment of the present invention;
FIG. 2 is a block-level table and a block-level table according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another block-level table and a block-level table according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a mapping relationship reading method according to a second embodiment of the present invention;
fig. 5 is a schematic structural diagram of a mapping relationship storage device according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical problems solved, technical solutions adopted and technical effects achieved by the present invention clearer, the technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a schematic flowchart of a mapping relationship storage method according to an embodiment of the present invention. The mapping relation storage method disclosed in this embodiment is suitable for storing many mapping entries, for example, in a mapping association scheme between a logical address and a physical address with a storage space of 4KB as a unit, many mapping entries may be generated, and in this scenario, the mapping relation storage method provided in this embodiment may be used to store the mapping entries. The mapping relation storage method may be specifically executed by a mapping relation storage apparatus, where the apparatus may be implemented by software and/or hardware, and is generally integrated in a chip, such as an EMMC chip or the like. Referring specifically to fig. 1, the method comprises the steps of:
step 110, store mapping entries between logical addresses and physical addresses of the flash memory to a block level table.
The mapping entries specifically refer to mapping relationships between logical addresses and physical addresses, and each mapping entry represents a mapping relationship between a 4K logical address and a corresponding 4K physical address, taking the example that the minimum mapping unit is 4K.
The number of the block level tables is at least two, and the specific block level table may refer to at least two storage pages of the flash memory. Assuming that the size of the storage space of a page of the flash memory is 16KB, one storage block includes 256 storage pages, and the flash memory includes 2000 storage blocks in total, if the minimum mapping unit is 4K, the flash memory has 16 × 256 × 2000/4 — 2048000 mapping entries to be stored. Each mapping entry needs 4 bytes, and each storage page can store 16000/4-4000 mapping entries, that is, each block level table can store 4000 mapping entries, and a total of 512 block level tables are needed to store 2048000 mapping entries.
Step 120, storing the physical address of each block level table into the zone level table.
Specifically, the physical addresses of the storage pages corresponding to the block level tables are stored in the area level tables, and the 512 block level tables are managed by the area level tables. If the physical address of the storage page corresponding to each block level table occupies 4 bytes, the block level table requires a total storage space of 4 × 512+12 ═ 2060B, where 12 in the formula refers to the space occupied by the physical address of the block level table, and the block level table can be stored by using the storage page of the flash memory.
Step 130, storing the physical address of the zone level table to a root level table.
The physical address of the block level table specifically refers to a physical address of a storage page storing the block level table, and according to the above example, the root level table needs a storage space of 12B in total to store the physical address of the block level table, and the root level table may also be stored in one storage page of the flash memory.
Illustratively, the mapping relationship storage method further includes: respectively storing the block level table and the zone level table to first different storage pages of a first preset storage block;
and when the information stored in the block level table and the information stored in the area level table are updated, respectively storing the updated block level table and the updated area level table to a second different storage page of the first preset storage block.
Specifically, the first preset storage block may be specified according to actual requirements. The essence of storing the block-level table and the region-level table to a first different storage page of a first preset storage block respectively is: the storage page storing the block level table and the storage page storing the zone level table are different storage pages, the storage page storing the block level table and the storage page storing the zone level table are called as first different storage pages, and the first different storage pages are located in the same storage block, so that the full utilization of a flash memory space is realized, and the storage efficiency and the accuracy of the block level table and the zone level table are improved. Specifically, reference may be made to a storage diagram of a block level table and a zone level table shown in fig. 2, where a position 210 occupied by one block level table is a storage page, and it can be seen from fig. 2 that the storage page storing the block level table and the storage page storing the zone level table are different storage pages.
According to different task instructions, the same logical address can be mapped with different physical addresses, when a mapping entry between a logical address and a physical address is changed, a block level table storing the mapping entry between the logical address and the physical address is updated, that is, information stored in the block level table is updated, at this time, the updated block level table is sequentially stored to other storage pages, and the other storage pages are different from the storage pages storing the block level table before the change. When the storage page storing the block level table is changed, that is, the physical address of the block level table is changed, the information stored in the block level table storing the physical address of the block level table is also updated accordingly, and therefore, the updated block level table is sequentially stored in other storage pages, which are different from the storage page storing the block level table before updating, and the storage page storing the updated block level table are referred to as second different storage pages. Specifically, refer to another storage diagram of a block level table and a block level table shown in fig. 3, where a position 310 occupied by one block level table is a storage page, the block level table 10 is a block level table after the block level table 1 is updated, and the block level table 10 is a block level table after the block level table 1 is updated, it can be seen from fig. 3 that the storage page storing the updated block level table and the storage page storing the updated block level table are different storage pages, the storage page storing the block level table 1 before being updated and the storage page storing the block level table 10 after being updated are different storage pages, and the storage page storing the block level table 1 before being updated and the storage page storing the block level table 10 after being updated are different storage pages. And when the information stored in the block level table and the information stored in the zone level table are updated once, respectively changing the storage pages for storing the block level table and the zone level table according to the principle.
Further, in order to distinguish between the block-level tables and the zone-level tables before and after the update to specify which block-level table is the newest block-level table and which zone-level table is the newest zone-level table, a time stamp may be added to the block-level table based on the information update time stored in the block-level table, and a time stamp may be added to the zone-level table based on the information update time stored in the zone-level table.
Preferably, in order to ensure that there is enough space to store the block level table and the zone level table, the first predetermined storage block may include 20 designated blocks (storage blocks), and when most of the 20 designated blocks, for example, 15 blocks, are already occupied, a programming operation may be performed based on a certain rule to reuse the storage space without losing information of the latest block level table and zone level table.
Further, the mapping relationship storage method further includes: when an operation instruction is received, downloading a target block level table from a storage page of a first preset storage block to an RAM;
when the block-level table which needs to be updated does not exist in the RAM, the block-level table in the current RAM is stored in the first preset storage block, so that the latest block-level table information is prevented from being lost due to sudden power failure.
The operation instruction may specifically be a read operation instruction, or a write operation instruction, and the like.
In order to realize accurate storage of the root-level table, the mapping relation storage method further comprises: storing the root level table to a first storage page of a second preset storage block;
when the information stored in the root level table is updated, storing the updated root level table to a second storage page of the second preset storage block, so that the storage addresses of the root level table before and after updating are different;
a timestamp is added to each updated root level table based on the update time.
That is, when the physical address of the area level table is changed, the root level table of the physical address of the area level table is updated. The second preset storage block is a storage block different from the first preset storage block, 3 blocks can be assigned to the second preset storage block due to the fact that the storage space occupied by the root level table is small, every time information stored in the root level table is updated, the updated root level table is sequentially stored in other storage pages of the second preset storage block, when 2 blocks in the 3 blocks are used up, GC (Garbage Collection) operation can be performed on the 2 blocks used up, effective root level tables can be collected through GC operation, namely the latest root level table is reserved, invalid data are erased, the root level table which is updated and replaced is erased, the blocks which are used are recovered, and the utilization rate of the storage space is improved.
In the mapping relationship storage method provided by this embodiment, mapping entries between logical addresses and physical addresses of a flash memory are stored in a block level table; storing the physical address of each block level table into a zone level table; storing the physical address of the zone level table to a root level table; the number of the block-level tables is at least two, so that mapping entries between logical addresses and physical addresses of the flash memory are accurately stored.
Example two
Fig. 4 is a flowchart illustrating a mapping relationship reading method according to a second embodiment of the present invention. The solution of this embodiment is based on the solution of the foregoing embodiment, and is applicable to the case of reading the mapping relationship between the logical address and the physical address stored according to the mapping relationship storage method of the foregoing embodiment, and may be executed by a mapping relationship reading device, which may be implemented by software and/or hardware and is generally integrated in a chip, such as an EMMC chip or the like. Referring specifically to fig. 4, the method includes the steps of:
step 410, reading all root level tables from the second preset storage block, and determining the latest root level table based on the time stamp of the root level table.
And assuming that the original root level table is the root level table 1, and obtaining a root level table 2 and a root level table 3 through two updates, respectively, all the root level tables in the second preset storage block are the root level table 1, the root level table 2 and the root level table 3. Each update adds a timestamp to each root level table according to the update time, so that the latest root level table in all root level tables can be determined based on the timestamps of the root level tables, wherein the latest root level table refers to the root level table with the latest update time, such as two root level tables, one of which is the root level table updated yesterday, and the other is the root level table updated today, and the latest root level table is the root level table updated today.
Step 420, reading the physical address of the first latest zone level table from the latest root level table.
Step 430, read the first latest zone level table from the physical address.
Step 440, reading a physical address of a latest block level table from the first latest region level table.
Step 450, read the latest block-level table from the physical address of the latest block-level table.
Step 460 reads a mapping entry between the logical address and the physical address of the flash memory based on the latest block level table.
Usually, the physical address of the zone-level table stored in the latest root-level table is the physical address of the latest zone-level table, but there may be a case where the update is not timely, that is, the physical address of the zone-level table is updated, but the physical address information stored in the root-level table has not yet been updated, so to improve the reading accuracy, further, before performing step 430 "read the first latest zone-level table from the physical address", the mapping relation reading method further includes:
reading all the zone-level tables from the first preset storage block;
determining a second most recent zone-level table based on the timestamp of the zone-level table;
if the physical address of the first latest zone level table is consistent with the physical address of the second latest zone level table, the step 430 is continuously executed, otherwise, the root level table is updated based on the physical address of the second latest zone level table, and the step 410 of "reading all root level tables from the second preset storage block" is returned to be executed, or the latest zone level table is directly read from the physical address of the second latest zone level table.
In this embodiment, the physical address of the zone level table read from the latest root level table is compared with the physical address of the latest zone level table determined from the first preset storage block, if the two physical addresses are consistent, it is determined that the physical address stored in the root level table is updated in time, and the updated physical address is the latest physical address of the zone level table, and if the two physical addresses are not consistent, it is determined that the physical address stored in the root level table is not updated in time, and the updated physical address is not the latest physical address of the zone level table.
Further, to further improve the reading accuracy of the mapping relationship, before performing step 460 "read the latest block-level table from the physical address of the latest block-level table", the method further includes: reading all the block-level tables from the first preset memory block, and determining the latest block-level table of each block-level table based on the time stamp of each block-level table, the physical address of the latest block-level table of each block-level table read from the first preset memory block being recorded as the second physical address, the physical address of each latest block level table obtained in step 450 above is denoted as the first physical address, for each block-level table, if the first physical address of the current block-level table is consistent with the second physical address, go to step 460, if the first physical address of the current block-level table is inconsistent with the second physical address, the block-level table is updated with the second physical address of the current block-level table and the process returns to step 410 "read all root-level tables from the second predetermined memory block", or directly reading the latest block-level table from the second physical address and reading a mapping entry from the latest block-level table.
In the mapping relationship reading method provided in this embodiment, the purpose of determining whether the physical address stored in the latest root level table is the physical address of the latest block level table is achieved by comparing the physical address of the block level table determined from the latest root level table with the physical address of the latest block level table determined from the first preset storage block, and the purpose of determining whether the physical address stored in the latest block level table is the physical address of the latest block level table is achieved by comparing the physical address of the latest block level table read from the latest root level table with the physical address of the latest block level table determined from the first preset storage block, thereby improving the accuracy of reading the mapping relationship.
EXAMPLE III
Fig. 5 is a schematic structural diagram of a mapping relationship storage device according to a third embodiment of the present invention. Referring to fig. 5, the apparatus comprises: a first memory module 510, a second memory module 520, and a third memory module 530;
the first storage module 510 is configured to store mapping entries between logical addresses and physical addresses of the flash memory into a block-level table; a second storage module 520, configured to store the physical address of each block level table in the zone level table; a third storage module 530, configured to store the physical address of the zone-level table to a root-level table; wherein the number of block-level tables is at least two.
Further, the apparatus further comprises: the fourth storage module is used for storing the block level table and the zone level table to first different storage pages of a first preset storage block respectively; and when the information stored in the block level table and the information stored in the area level table are updated, respectively storing the updated block level table and the updated area level table to a second different storage page of the first preset storage block.
Further, the apparatus further comprises: and the adding module is used for adding a timestamp to the block-level table based on the information updating time stored in the block-level table and adding a timestamp to the zone-level table based on the information updating time stored in the zone-level table.
Further, the device further comprises a downloading module, configured to, when receiving the operation instruction, download the target block-level table from the storage page of the first preset storage block to the RAM;
and the fifth storage module is used for storing the block level table in the current RAM into the first preset storage block when the block level table which needs to be updated does not exist in the RAM.
Further, the apparatus further includes a sixth storage module, configured to store the root level table in a first storage page of a second preset storage block; when the information stored in the root level table is updated, storing the updated root level table to a second storage page of the second preset storage block, so that the storage addresses of the root level table before and after updating are different;
the adding module is further configured to add a timestamp to each updated root level table based on the update time.
The mapping relationship storage device provided by the embodiment stores mapping entries between logical addresses and physical addresses of a flash memory into a block-level table; storing the physical address of each block level table into a zone level table; storing the physical address of the zone level table to a root level table; the number of the block-level tables is at least two, so that mapping entries between logical addresses and physical addresses of the flash memory are accurately stored.
The mapping relation storage device provided by the embodiment of the invention can execute the mapping relation storage method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For details of the mapping relationship storage method provided in any embodiment of the present invention, reference may be made to the technical details not described in detail in the above embodiments.
Example four
Fig. 6 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. FIG. 6 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 6 is only an example and should not bring any limitation to the function and the scope of use of the embodiment of the present invention.
As shown in FIG. 6, electronic device 12 is embodied in the form of a general purpose computing device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set of program modules (e.g., first memory module 510, second memory module 520, and third memory module 530 of a map storage device) configured to perform the functions of embodiments of the invention.
A program/utility 40 having a set of program modules 42 (e.g., first memory module 510, second memory module 520, and third memory module 530 of a mapping relationship storage), may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination may include an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 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 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, to implement a mapping relationship storage method provided by an embodiment of the present invention, where the method includes:
storing mapping entries between logical addresses and physical addresses of a flash memory to a block level table;
storing the physical address of each block level table into a zone level table;
storing the physical address of the zone level table to a root level table;
wherein the number of block-level tables is at least two.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, to implement the mapping relationship storage method provided by the embodiment of the present invention.
Of course, those skilled in the art can understand that the processor may also implement the technical solutions of the mapping relationship storage method and the mapping relationship reading method provided in any embodiment of the present invention.
EXAMPLE five
The fifth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the mapping relationship storage method provided in the fifth embodiment of the present invention, where the method includes:
storing mapping entries between logical addresses and physical addresses of a flash memory to a block level table;
storing the physical address of each block level table into a zone level table;
storing the physical address of the zone level table to a root level table;
wherein the number of block-level tables is at least two.
Of course, the computer program stored on the computer-readable storage medium provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform related operations in the mapping relationship storage method and the mapping relationship reading method provided in any embodiments of the present invention.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer 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 computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer 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 computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer 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 computer 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.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, 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 user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A mapping relation storage method is characterized by comprising the following steps:
storing mapping entries between logical addresses and physical addresses of a flash memory to a block level table;
storing the physical address of each block level table into a zone level table;
storing the physical address of the zone level table to a root level table;
wherein the number of block-level tables is at least two.
2. The method of claim 1, further comprising: respectively storing the block level table and the zone level table to first different storage pages of a first preset storage block;
and when the information stored in the block level table and the information stored in the area level table are updated, respectively storing the updated block level table and the updated area level table to a second different storage page of the first preset storage block.
3. The method of claim 2, further comprising:
and adding a timestamp to the block-level table based on the information updating time stored in the block-level table, and adding a timestamp to the zone-level table based on the information updating time stored in the zone-level table.
4. The method of claim 2, further comprising: when an operation instruction is received, downloading a target block level table from a storage page of a first preset storage block to an RAM;
and when the block-level table which needs to be updated does not exist in the RAM, storing the block-level table in the current RAM into the first preset storage block.
5. The method according to any one of claims 1-4, further comprising: storing the root level table to a first storage page of a second preset storage block;
when the information stored in the root level table is updated, storing the updated root level table to a second storage page of the second preset storage block, so that the storage addresses of the root level table before and after updating are different;
a timestamp is added to each updated root level table based on the update time.
6. A mapping relation reading method is characterized by comprising the following steps:
reading all root level tables from a second preset storage block;
determining a latest root level table based on the timestamp of the root level table;
reading a physical address of a first latest zone level table from the latest root level table;
reading a first latest zone level table from the physical address;
reading a physical address of a latest block-level table from the first latest region-level table;
reading the latest block-level table from the physical address of the latest block-level table;
a mapping entry between a logical address and a physical address of the flash memory is read based on the latest block level table.
7. The method of claim 6, further comprising, prior to reading the first most recent zone level table from the physical address:
reading all the zone-level tables from the first preset storage block;
determining a second most recent zone-level table based on the timestamp of the zone-level table;
if the physical address of the first latest zone level table is consistent with the physical address of the second latest zone level table, continuing to execute the operation of reading the first latest zone level table from the physical address;
and if the physical address of the first latest zone level table is inconsistent with the physical address of the second latest zone level table, updating the root level table based on the physical address of the second latest zone level table, and returning to execute the operation of reading all the root level tables from the second preset storage block.
8. A mapping relationship storage apparatus, the apparatus comprising:
the first storage module is used for storing mapping entries between the logical addresses and the physical addresses of the flash memories into a block-level table;
the second storage module is used for storing the physical address of each block level table to the zone level table;
the third storage module is used for storing the physical address of the zone level table to a root level table;
wherein the number of block-level tables is at least two.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the mapping relation storing method according to any one of claims 1 to 5 and the mapping relation reading method according to any one of claims 6 to 7 when executing the computer program.
10. A storage medium containing computer-executable instructions which, when executed by a computer processor, implement the map storing method according to any one of claims 1-5 and the map reading method according to any one of claims 6-7.
CN201910368571.3A 2019-05-05 2019-05-05 Mapping relation storage method, reading method, device, equipment and medium Active CN111897748B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910368571.3A CN111897748B (en) 2019-05-05 2019-05-05 Mapping relation storage method, reading method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910368571.3A CN111897748B (en) 2019-05-05 2019-05-05 Mapping relation storage method, reading method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN111897748A true CN111897748A (en) 2020-11-06
CN111897748B CN111897748B (en) 2024-08-16

Family

ID=73169229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910368571.3A Active CN111897748B (en) 2019-05-05 2019-05-05 Mapping relation storage method, reading method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN111897748B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901189A (en) * 2009-05-26 2010-12-01 联发科技股份有限公司 Data updating and recovering methods for a non-volatile memory array
CN102779096A (en) * 2012-07-11 2012-11-14 山东华芯半导体有限公司 Page, block and face-based three-dimensional flash memory address mapping method
CN103026346A (en) * 2010-07-27 2013-04-03 国际商业机器公司 Logical to physical address mapping in storage systems comprising solid state memory devices
CN103150268A (en) * 2013-03-04 2013-06-12 浪潮电子信息产业股份有限公司 Block-level data capture method in CDP (Continuous Data Protection)
CN108062203A (en) * 2017-12-15 2018-05-22 北京京存技术有限公司 A kind of flash data management method, device and memory
CN109388520A (en) * 2017-08-08 2019-02-26 大心电子(英属维京群岛)股份有限公司 Data back up method, data reconstruction method and storage control

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901189A (en) * 2009-05-26 2010-12-01 联发科技股份有限公司 Data updating and recovering methods for a non-volatile memory array
CN103026346A (en) * 2010-07-27 2013-04-03 国际商业机器公司 Logical to physical address mapping in storage systems comprising solid state memory devices
CN102779096A (en) * 2012-07-11 2012-11-14 山东华芯半导体有限公司 Page, block and face-based three-dimensional flash memory address mapping method
CN103150268A (en) * 2013-03-04 2013-06-12 浪潮电子信息产业股份有限公司 Block-level data capture method in CDP (Continuous Data Protection)
CN109388520A (en) * 2017-08-08 2019-02-26 大心电子(英属维京群岛)股份有限公司 Data back up method, data reconstruction method and storage control
CN108062203A (en) * 2017-12-15 2018-05-22 北京京存技术有限公司 A kind of flash data management method, device and memory

Also Published As

Publication number Publication date
CN111897748B (en) 2024-08-16

Similar Documents

Publication Publication Date Title
US11947489B2 (en) Creating snapshots of a storage volume in a distributed storage system
CN109426619B (en) Method for accessing flash memory module, related flash memory controller and electronic device
CN110018998B (en) File management method and system, electronic equipment and storage medium
US20150058539A1 (en) Method and Apparatus for Restoring Flash Translation Layer (FTL) in Non-Volatile Storage device
CN107665095B (en) Apparatus, method and readable storage medium for memory space management
CN110187832B (en) Data operation method, device and system
EP4174677A1 (en) Data reading and writing method and device
CN111897485A (en) Data storage method and device, electronic equipment and storage medium
CN113934655B (en) Method and apparatus for solving ambiguity problem of cache memory address
CN103778067A (en) Object processing method and device of Java card and Java card
US11467766B2 (en) Information processing method, apparatus, device, and system
US9489309B2 (en) Method and system for dynamic cache partitioning using address remapping
KR20100097959A (en) User device including flash memory storing index and index accessing method thereof
US20230048813A1 (en) Method of storing data and method of reading data
CN108717395B (en) Method and device for reducing memory occupied by dynamic block mapping information
CN111897748B (en) Mapping relation storage method, reading method, device, equipment and medium
CN111897484B (en) Data storage method and device, electronic equipment and storage medium
CN111857547B (en) Method, apparatus and computer readable medium for managing data storage
CN109491620B (en) Storage data rewriting method, device, server and storage medium
KR20140042426A (en) Computing system and data management method thereof
CN111897744B (en) Data writing method and device, electronic equipment and storage medium
US8990541B2 (en) Compacting Memory utilization of sparse pages
JP2012113721A (en) Memory system
CN111897745A (en) Data storage method and device, electronic equipment and storage medium
US12008261B2 (en) Method and device for accessing memory

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
CB02 Change of applicant information

Address after: Room 101, Floor 1-5, Building 8, Yard 9, Fenghao East Road, Haidian District, Beijing 100094

Applicant after: Zhaoyi Innovation Technology Group Co.,Ltd.

Applicant after: SHANGHAI GEYI ELECTRONIC Co.,Ltd.

Address before: 100083 12 Floors, Block A, Tiangong Building, Science and Technology University, 30 College Road, Haidian District, Beijing

Applicant before: GIGADEVICE SEMICONDUCTOR(BEIJING) Inc.

Applicant before: SHANGHAI GEYI ELECTRONIC Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant