[go: up one dir, main page]

CN112486852B - Solid state disk and address mapping method thereof - Google Patents

Solid state disk and address mapping method thereof Download PDF

Info

Publication number
CN112486852B
CN112486852B CN202011387849.0A CN202011387849A CN112486852B CN 112486852 B CN112486852 B CN 112486852B CN 202011387849 A CN202011387849 A CN 202011387849A CN 112486852 B CN112486852 B CN 112486852B
Authority
CN
China
Prior art keywords
data
logical block
continuous
segment
solid state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011387849.0A
Other languages
Chinese (zh)
Other versions
CN112486852A (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.)
Hefei Datang Storage Technology Co ltd
Original Assignee
Hefei Datang Storage 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 Hefei Datang Storage Technology Co ltd filed Critical Hefei Datang Storage Technology Co ltd
Priority to CN202011387849.0A priority Critical patent/CN112486852B/en
Publication of CN112486852A publication Critical patent/CN112486852A/en
Application granted granted Critical
Publication of CN112486852B publication Critical patent/CN112486852B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0615Address space extension
    • G06F12/0623Address space extension for memory modules
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0882Page mode

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The embodiment of the application discloses a solid state disk and an address mapping method thereof, wherein the method comprises the following steps: when the solid state disk receives a segment of data sent by a host end and a logical block address corresponding to the segment of data, judging whether the logical block address corresponding to the segment of data is continuous or not; when the corresponding logical block addresses of the segment data are continuous, the continuous data in the logical block addresses are sequentially stored in a segment of continuous physical block addresses in the flash memory, and a binary tree data structure is adopted to store the first and the last logical block addresses and the corresponding physical block addresses, which are new page mapping table management methods, so as to replace the original method for managing page mapping tables by using a linear table. According to the embodiment, for the solid state disk with the cache, the input cost in the aspect of cache is reduced, and the redundant cache space can be used for improving the performance of the solid state disk; for the solid state disk without cache, the time for reading and writing the mapping table of the mapping page from the flash memory is greatly shortened, and the reading and writing performance of the solid state disk is improved.

Description

一种固态硬盘及其地址映射方法A solid state hard disk and address mapping method thereof

技术领域Technical Field

本文涉及数据处理与存储技术,尤指一种固态硬盘及其地址映射方法。The present invention relates to data processing and storage technology, and more particularly to a solid state drive and an address mapping method thereof.

背景技术Background technique

由于主机端发送的数据的地址(逻辑区块地址:LBA)与其存储在闪存(NAND)中的地址(物理块地址:PBA)并不是顺序对应的,意味着LBA x并不一定存储在闪存中的PBA x位置上,需要固态硬盘(SSD)中的固件(一段运行在固态硬盘固件芯片中的程序)将二者进行一一对应。否则主机端要读取某一逻辑区块地址对应的数据时,固件找不到该数据在闪存中的位置,造成数据丢失。Since the address of the data sent by the host (logical block address: LBA) and the address stored in the flash memory (NAND) (physical block address: PBA) are not sequentially corresponding, which means that LBA x is not necessarily stored at the PBA x position in the flash memory, the firmware in the solid-state drive (SSD) (a program running in the SSD firmware chip) is required to match the two one-to-one. Otherwise, when the host wants to read the data corresponding to a certain logical block address, the firmware cannot find the location of the data in the flash memory, resulting in data loss.

已有技术现状:当前固态硬盘普遍采用页映射的方式管理LBA到PBA的映射关系,具体情况如图1所示。Current state of the art: Currently, solid-state drives generally use page mapping to manage the mapping relationship from LBA to PBA, as shown in Figure 1.

即每当主机端写入一个页(PAGE)大小的数据时,固态硬盘的固件就会将该笔数据写入到某一物理页中,并将该数据的逻辑区块地址与物理块地址相对应。具体步骤:主机端将要写入的数据及相应的逻辑区块地址送达固态硬盘端;固件找到空闲的闪存物理块及相应的物理地址;固态硬盘中的固件将主机端发送的数据写入到物理块中;最后固件将该数据的逻辑区块地址与物理块地址相关联。在有缓存(DRAM)的固态硬盘中,固件会专门将一段连续的缓存空间用作映射表的存储,即缓存地址X存储LBA0所对应的PBA,缓存地址X+1存储LBA1所对应的PBA,缓存地址X+y存储LBAy所对应的PBA。That is, whenever the host writes a page (PAGE) of data, the firmware of the SSD will write the data to a physical page and correspond the logical block address of the data to the physical block address. Specific steps: the host sends the data to be written and the corresponding logical block address to the SSD; the firmware finds the free flash physical block and the corresponding physical address; the firmware in the SSD writes the data sent by the host to the physical block; finally, the firmware associates the logical block address of the data with the physical block address. In a SSD with cache (DRAM), the firmware will use a continuous cache space as the storage of the mapping table, that is, cache address X stores the PBA corresponding to LBA0, cache address X+1 stores the PBA corresponding to LBA1, and cache address X+y stores the PBA corresponding to LBAy.

该方案使得在有缓存的固件中,主机端读取速度更快,且持续读写时性能波动较小,但是缓存硬件成本较高;在无缓存的固件中,空盘读写的性能较高,随后主机端读写速度大幅下降,性能较低。This solution allows faster host-side read speeds and less performance fluctuations during continuous reading and writing in cached firmware, but the cache hardware cost is high. In non-cached firmware, the performance of reading and writing to an empty disk is high, and then the host-side read and write speeds drop significantly, resulting in lower performance.

目前无缓存的固态硬盘性能和有缓存的固态硬盘差距较大,其中一个重要原因在于有缓存的固态硬盘将页映射表存储在缓存中,在缓存中读取页映射表远快于从闪存中读取页映射表,因此前者性能更好;但是有缓存的固态硬盘会因为大容量的缓存而拉高了生产成本和销售价格,削弱了产品的价格竞争力。Currently, there is a large gap between the performance of SSDs without cache and SSDs with cache. One of the important reasons is that SSDs with cache store page mapping tables in cache, and reading page mapping tables in cache is much faster than reading them from flash memory, so the former has better performance; however, SSDs with cache will increase production costs and sales prices due to the large-capacity cache, weakening the price competitiveness of the product.

因此,按照现有的闪存组织结构,页映射表大小约为固态硬盘可使用空间的1/1024。由于页映射表需要占用一定的空间,在有缓存的固态硬盘中会占用大部分的缓存空间,造成缓存成本增高;其次,在无缓存的固态硬盘中,主机端每次读取或写入某一逻辑区块地址的数据时,固件都要从闪存中读取或写入页映射表,这样会降低主机端数据的读写速度。Therefore, according to the existing flash memory organization structure, the page mapping table size is about 1/1024 of the available space of the SSD. Since the page mapping table needs to occupy a certain amount of space, it will occupy most of the cache space in a cached SSD, resulting in an increase in cache cost; secondly, in a non-cached SSD, every time the host reads or writes data at a certain logical block address, the firmware must read or write the page mapping table from the flash memory, which will reduce the host data read and write speed.

发明内容Summary of the invention

本申请实施例提供了一种固态硬盘及其地址映射方法,对于有缓存的固态硬盘,能够减少生产商在缓存方面的投入成本,也可以将多余的缓存空间用于提高固态硬盘性能或可靠性;对于无缓存的固态硬盘,能够大大减少从闪存中读写映射关系的数据量,进而提高固态硬盘的读写性能。The embodiment of the present application provides a solid-state drive and an address mapping method thereof. For a solid-state drive with a cache, the manufacturer's investment cost in the cache can be reduced, and the excess cache space can be used to improve the performance or reliability of the solid-state drive; for a solid-state drive without a cache, the amount of data in the mapping relationship read and written from the flash memory can be greatly reduced, thereby improving the read and write performance of the solid-state drive.

本申请实施例提供了一种固态硬盘的地址映射方法,所述方法可以包括:An embodiment of the present application provides an address mapping method for a solid state drive, and the method may include:

当固态硬盘接收到主机端发送的一段数据及该段数据相应的逻辑区块地址时,判断该段数据相应的逻辑区块地址是否连续;When the solid state drive receives a segment of data and a logical block address corresponding to the segment of data sent by the host, it determines whether the logical block address corresponding to the segment of data is continuous;

当该段数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中;When the logical block addresses corresponding to the segment of data are continuous, the continuous data in the logical block addresses are stored in sequence in a continuous physical block address in the flash memory;

采用二叉树数据结构保存该段数据相应的首尾两个逻辑区块地址和对应的物理区块地址。A binary tree data structure is used to store the first and last logical block addresses and the corresponding physical block address of the data segment.

在本申请的示例性实施例中,当所述固态硬盘具有缓存时,所述方法还可以包括:In an exemplary embodiment of the present application, when the solid state drive has a cache, the method may further include:

在所述固态硬盘接收到该段数据及该段数据相应的逻辑区块地址后,将该段数据及该段数据相应的逻辑区块地址存储于所述缓存中,并且将缓存中待写入闪存中的数据根据所述数据的逻辑区块地址进行排序,当所述缓存中存储的数据积累到预设的数据阈值时,判断所述缓存中排序好的数据相应的逻辑区块地址是否连续;After the solid state drive receives the segment of data and the logical block address corresponding to the segment of data, the segment of data and the logical block address corresponding to the segment of data are stored in the cache, and the data in the cache to be written into the flash memory are sorted according to the logical block address of the data, and when the data stored in the cache accumulates to a preset data threshold, it is determined whether the logical block addresses corresponding to the sorted data in the cache are continuous;

当所述缓存中的数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中;When the logical block addresses corresponding to the data in the cache are continuous, the continuous data in the logical block addresses are stored in sequence in a continuous physical block address in the flash memory;

当所述缓存中的数据相应的逻辑区块地址不连续时,将所述逻辑区块地址中不连续的数据存储到闪存中连续的或不连续的物理块地址中。When the logical block addresses corresponding to the data in the cache are discontinuous, the discontinuous data in the logical block addresses are stored in continuous or discontinuous physical block addresses in the flash memory.

在本申请的示例性实施例中,当所述固态硬盘具有缓存时,所述方法还可以包括:建立连续的逻辑区块地址的首尾地址与连续的物理块地址的首尾地址之间的映射关系,并将所述映射关系存储在二叉树数据结构中。In an exemplary embodiment of the present application, when the solid state drive has a cache, the method may further include: establishing a mapping relationship between the first and last addresses of consecutive logical block addresses and the first and last addresses of consecutive physical block addresses, and storing the mapping relationship in a binary tree data structure.

在本申请的示例性实施例中,所述将所述映射关系存储在二叉树数据结构中可以包括:In an exemplary embodiment of the present application, storing the mapping relationship in a binary tree data structure may include:

从所述二叉树数据结构中找到所述逻辑区块地址,检测所述逻辑区块地址以前是否写入过数据,当所述逻辑区块地址以前未写入过数据,则在所述二叉树数据结构中新插入所述映射关系;当所述逻辑区块地址以前写入过数据,则在所述二叉树数据结构中采用所述映射关系更新以前的映射关系,并通知预设的垃圾回收模块对以前的映射关系进行垃圾回收。The logical block address is found from the binary tree data structure, and it is detected whether data has been written to the logical block address before. When data has not been written to the logical block address before, the mapping relationship is newly inserted into the binary tree data structure; when data has been written to the logical block address before, the mapping relationship is used to update the previous mapping relationship in the binary tree data structure, and a preset garbage collection module is notified to perform garbage collection on the previous mapping relationship.

在本申请的示例性实施例中,所述方法还可以包括:In an exemplary embodiment of the present application, the method may further include:

当所述二叉树数据结构中新增和修改的映射关系积累到设定阈值时,将所述二叉树数据结构中新增和修改的映射关系保存到闪存中。When the newly added and modified mapping relationships in the binary tree data structure accumulate to a set threshold, the newly added and modified mapping relationships in the binary tree data structure are saved in a flash memory.

在本申请的示例性实施例中,所述方法还可以包括:In an exemplary embodiment of the present application, the method may further include:

在将待存储的数据存入闪存之前,将所述待存储的数据划分成多个部分;将所述多个部分通过多个通道并行存储到闪存中。Before storing the data to be stored in the flash memory, the data to be stored is divided into a plurality of parts; and the plurality of parts are stored in the flash memory in parallel through a plurality of channels.

在本申请的示例性实施例中,当所述固态硬盘不具有缓存时,所述方法还可以包括:In an exemplary embodiment of the present application, when the solid state drive does not have a cache, the method may further include:

当该段数据相应的逻辑区块地址连续时,直接将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中。When the logical block addresses corresponding to the segment of data are continuous, the continuous data in the logical block addresses are directly stored in sequence in a segment of continuous physical block addresses in the flash memory.

在本申请的示例性实施例中,所述方法还可以包括:In an exemplary embodiment of the present application, the method may further include:

根据该段数据相应的逻辑区块地址从闪存中加载相应的页映射表,并更新所述页映射表中该段数据相应的逻辑区块地址对应的映射关系,将修改后的页映射表存储到闪存中;Loading a corresponding page mapping table from the flash memory according to the logical block address corresponding to the segment of data, updating the mapping relationship corresponding to the logical block address corresponding to the segment of data in the page mapping table, and storing the modified page mapping table in the flash memory;

当主机端读取数据时,根据所述数据段对应的逻辑区块地址加载对应的页映射表,查询所述页映射表中相应的映射关系获得对应的物理块地址的范围,并根据所述物理块地址的范围从闪存中读取相应数据返回给主机端。When the host reads data, it loads the corresponding page mapping table according to the logical block address corresponding to the data segment, queries the corresponding mapping relationship in the page mapping table to obtain the corresponding physical block address range, and reads the corresponding data from the flash memory according to the physical block address range and returns it to the host.

在本申请的示例性实施例中,在将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中之前,所述方法还可以包括:In an exemplary embodiment of the present application, before sequentially storing the continuous data in the logical block address into a continuous physical block address in the flash memory, the method may further include:

从所述闪存中寻找该段连续的物理区块地址,并返回该段连续的物理区块地址的首尾地址;Searching for the segment of continuous physical block addresses from the flash memory, and returning the first and last addresses of the segment of continuous physical block addresses;

当该段连续的物理区块地址含有坏块时,在读写时自动跳过所述坏块。When the segment of continuous physical block addresses contains a bad block, the bad block is automatically skipped during reading and writing.

本申请实施例还提供了一种固态硬盘,可以包括闪存和固件芯片,所述固件芯片中存储有指令,当所述指令被所述固件芯片执行时,实现上述任意一项所述的固态硬盘的地址映射方法。An embodiment of the present application also provides a solid state drive, which may include a flash memory and a firmware chip, wherein instructions are stored in the firmware chip, and when the instructions are executed by the firmware chip, any of the above-mentioned address mapping methods for the solid state drive is implemented.

与相关技术相比,本申请实施例可以包括:当固态硬盘接收到主机端发送的一段数据及该段数据相应的逻辑区块地址时,判断该段数据相应的逻辑区块地址是否连续;当该段数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中;采用二叉树数据结构保存该段数据相应的首尾两个逻辑区块地址和对应的物理区块地址。通过该实施例方案,对于有缓存的固态硬盘,减少了生产商在缓存方面的投入成本,也可以将多余的缓存空间用于提高固态硬盘性能或可靠性;对于无缓存的固态硬盘,大大减少了从闪存中读写映射关系的数据量,进而提高了固态硬盘的读写性能。Compared with the related art, the embodiment of the present application may include: when the solid-state hard disk receives a segment of data sent by the host end and the logical block address corresponding to the segment of data, it is determined whether the logical block address corresponding to the segment of data is continuous; when the logical block address corresponding to the segment of data is continuous, the continuous data in the logical block address is stored in sequence in a segment of continuous physical block addresses in the flash memory; a binary tree data structure is used to save the first and last logical block addresses and the corresponding physical block addresses corresponding to the segment of data. Through this embodiment, for solid-state hard disks with cache, the manufacturer's investment cost in cache is reduced, and the excess cache space can also be used to improve the performance or reliability of the solid-state hard disk; for solid-state hard disks without cache, the amount of data in the read and write mapping relationship from the flash memory is greatly reduced, thereby improving the read and write performance of the solid-state hard disk.

本申请的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的其他优点可通过在说明书以及附图中所描述的方案来实现和获得。Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by implementing the present application. Other advantages of the present application can be realized and obtained by the schemes described in the description and the drawings.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

附图用来提供对本申请技术方案的理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.

图1为本申请实施例的固态硬盘的地址映射方法流程图;FIG1 is a flow chart of an address mapping method for a solid state drive according to an embodiment of the present application;

图2为本申请实施例的采用二叉树数据结构管理页映射表的示意图;FIG2 is a schematic diagram of a page mapping table managed using a binary tree data structure according to an embodiment of the present application;

图3为本申请实施例的固态硬盘组成框图。FIG. 3 is a block diagram of the solid-state hard disk according to an embodiment of the present application.

具体实施方式Detailed ways

本申请描述了多个实施例,但是该描述是示例性的,而不是限制性的,并且对于本领域的普通技术人员来说显而易见的是,在本申请所描述的实施例包含的范围内可以有更多的实施例和实现方案。尽管在附图中示出了许多可能的特征组合,并在具体实施方式中进行了讨论,但是所公开的特征的许多其它组合方式也是可能的。除非特意加以限制的情况以外,任何实施例的任何特征或元件可以与任何其它实施例中的任何其他特征或元件结合使用,或可以替代任何其它实施例中的任何其他特征或元件。The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.

本申请包括并设想了与本领域普通技术人员已知的特征和元件的组合。本申请已经公开的实施例、特征和元件也可以与任何常规特征或元件组合,以形成由权利要求限定的独特的发明方案。任何实施例的任何特征或元件也可以与来自其它发明方案的特征或元件组合,以形成另一个由权利要求限定的独特的发明方案。因此,应当理解,在本申请中示出和/或讨论的任何特征可以单独地或以任何适当的组合来实现。因此,除了根据所附权利要求及其等同替换所做的限制以外,实施例不受其它限制。此外,可以在所附权利要求的保护范围内进行各种修改和改变。The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique invention scheme defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other invention schemes to form another unique invention scheme defined by the claims. Therefore, it should be understood that any feature shown and/or discussed in the present application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the attached claims and their equivalents, the embodiments are not subject to other restrictions. In addition, various modifications and changes may be made within the scope of protection of the attached claims.

此外,在描述具有代表性的实施例时,说明书可能已经将方法和/或过程呈现为特定的步骤序列。然而,在该方法或过程不依赖于本文所述步骤的特定顺序的程度上,该方法或过程不应限于所述的特定顺序的步骤。如本领域普通技术人员将理解的,其它的步骤顺序也是可能的。因此,说明书中阐述的步骤的特定顺序不应被解释为对权利要求的限制。此外,针对该方法和/或过程的权利要求不应限于按照所写顺序执行它们的步骤,本领域技术人员可以容易地理解,这些顺序可以变化,并且仍然保持在本申请实施例的精神和范围内。In addition, when describing representative embodiments, the specification may have presented the method and/or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and/or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.

本申请实施例提供了一种固态硬盘的地址映射方法,如图1所示,所述方法可以包括步骤S101-S103:The embodiment of the present application provides an address mapping method for a solid state drive. As shown in FIG1 , the method may include steps S101-S103:

S101、当固态硬盘接收到主机端发送的一段数据及该段数据相应的逻辑区块地址时,判断该段数据相应的逻辑区块地址是否连续;S101, when the solid state drive receives a segment of data and a logical block address corresponding to the segment of data sent by the host, determining whether the logical block address corresponding to the segment of data is continuous;

S102、当该段数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中;S102, when the logical block addresses corresponding to the segment of data are continuous, sequentially storing the continuous data in the logical block addresses into a continuous physical block address in the flash memory;

S103、采用二叉树数据结构保存该段数据相应的首尾两个逻辑区块地址和对应的物理区块地址。S103. Use a binary tree data structure to store the first and last logical block addresses and the corresponding physical block address of the data segment.

在本申请的示例性实施例中,当固件接收到主机端要存储的数据及相应的逻辑区块地址时,会将该笔数据按顺序存储在闪存(NAND)中,即用一段数据对应的首尾LBA(逻辑区块地址)和PBA(物理块地址,或称物理区块地址)建立页映射表,有别于现有的用线性表建立页映射表的方法。由于页映射表占用一定的存储空间,在有缓存的固态硬盘中会占用大量缓存空间,用首尾LBA和PBA建立映射表的方法可有效降低映射表在缓存中占用的存储空间,可以降低厂家在缓存方面的成本;在无缓存的固态硬盘中,本发明可以有效减少要读写的映射表数量,从而减少固件(一段运行在固态硬盘固件芯片中的程序)从闪存读写映射表的时间,进而提高了无缓存固态硬盘的主机端读写速度。In an exemplary embodiment of the present application, when the firmware receives the data to be stored on the host side and the corresponding logical block address, the data will be stored in the flash memory (NAND) in sequence, that is, the first and last LBA (logical block address) and PBA (physical block address, or physical block address) corresponding to a segment of data are used to establish a page mapping table, which is different from the existing method of establishing a page mapping table using a linear table. Since the page mapping table occupies a certain storage space, it will occupy a large amount of cache space in a cached solid-state hard disk. The method of establishing a mapping table using the first and last LBA and PBA can effectively reduce the storage space occupied by the mapping table in the cache, and can reduce the manufacturer's cost in terms of cache; in a non-cached solid-state hard disk, the present invention can effectively reduce the number of mapping tables to be read and written, thereby reducing the time for the firmware (a program running in the solid-state hard disk firmware chip) to read and write the mapping table from the flash memory, thereby improving the host-side read and write speed of the non-cached solid-state hard disk.

在本申请的示例性实施例中,当所述固态硬盘具有缓存时,所述方法还可以包括:In an exemplary embodiment of the present application, when the solid state drive has a cache, the method may further include:

在所述固态硬盘接收到该段数据及该段数据相应的逻辑区块地址后,将该段数据及该段数据相应的逻辑区块地址存储于所述缓存中,并且将缓存中待写入闪存中的数据根据所述数据的逻辑区块地址进行排序,当所述缓存中存储的数据积累到预设的数据阈值时,判断所述缓存中排序好的数据相应的逻辑区块地址是否连续;After the solid state drive receives the segment of data and the logical block address corresponding to the segment of data, the segment of data and the logical block address corresponding to the segment of data are stored in the cache, and the data in the cache to be written into the flash memory are sorted according to the logical block address of the data, and when the data stored in the cache accumulates to a preset data threshold, it is determined whether the logical block addresses corresponding to the sorted data in the cache are continuous;

当所述缓存中的数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中;When the logical block addresses corresponding to the data in the cache are continuous, the continuous data in the logical block addresses are stored in sequence in a continuous physical block address in the flash memory;

当所述缓存中的数据相应的逻辑区块地址不连续时,将所述逻辑区块地址中不连续的数据存储到闪存中连续的或不连续的物理块地址中。When the logical block addresses corresponding to the data in the cache are discontinuous, the discontinuous data in the logical block addresses are stored in continuous or discontinuous physical block addresses in the flash memory.

在本申请的示例性实施例中,当主机端发送一段数据及相应的逻辑区块地址至固态硬盘时,固件首先将该笔数据及相应的LBA存储于缓存中,当缓存中存储的数据积累到某一数据阈值(可根据具体情况设置)时,判断这些数据的LBA是否连续,如果是连续的,则将LBA连续的数据按顺序存储到闪存中一段连续的物理空间中(即PBA为连续的),将LBA不是连续的数据存储在不同的闪存物理块中。In an exemplary embodiment of the present application, when the host sends a piece of data and the corresponding logical block address to the solid-state drive, the firmware first stores the data and the corresponding LBA in the cache. When the data stored in the cache accumulates to a certain data threshold (which can be set according to the specific situation), it determines whether the LBA of these data is continuous. If it is continuous, the data with continuous LBA is stored in sequence in a continuous physical space in the flash memory (that is, the PBA is continuous), and the data with non-continuous LBA is stored in different flash memory physical blocks.

在本申请的示例性实施例中,在将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中之前,所述方法还可以包括:In an exemplary embodiment of the present application, before sequentially storing the continuous data in the logical block address into a continuous physical block address in the flash memory, the method may further include:

从所述闪存中寻找该段连续的物理区块地址,并返回该段连续的物理区块地址的首尾地址;Searching for the segment of continuous physical block addresses from the flash memory, and returning the first and last addresses of the segment of continuous physical block addresses;

当该段连续的物理区块地址含有坏块时,在读写时自动跳过所述坏块。When the segment of continuous physical block addresses contains a bad block, the bad block is automatically skipped during reading and writing.

在本申请的示例性实施例中,当缓存中的数据积累到某一阈值时,固件在闪存中寻找一段连续的物理区块地址,并返回这段连续的物理区块地址的首尾两个地址,如果这段连续的物理区块地址含有坏块或坏页,则固件在读写时自动跳过。In an exemplary embodiment of the present application, when the data in the cache accumulates to a certain threshold, the firmware searches for a segment of continuous physical block addresses in the flash memory and returns the first and last two addresses of this segment of continuous physical block addresses. If this segment of continuous physical block addresses contains bad blocks or bad pages, the firmware automatically skips it when reading and writing.

在本申请的示例性实施例中,所述方法还可以包括:In an exemplary embodiment of the present application, the method may further include:

在将待存储的数据存入闪存之前,将所述待存储的数据划分成多个部分;将所述多个部分通过多个通道并行存储到闪存中。Before storing the data to be stored in the flash memory, the data to be stored is divided into a plurality of parts; and the plurality of parts are stored in the flash memory in parallel through a plurality of channels.

在本申请的示例性实施例中,为了加快读写速率,固件可以启用多通道存储,即将一段数据划分为多个部分,不同部分的数据同时通过多个通道发送给闪存,此时PBA的组织方式可采取通道0的块0的页0作为PBA0,通道1的块0的页0作为PBA1的方式来管理。In an exemplary embodiment of the present application, in order to speed up the read and write rates, the firmware can enable multi-channel storage, that is, divide a segment of data into multiple parts, and send different parts of data to the flash memory through multiple channels at the same time. At this time, the organization of PBA can be managed in the manner of page 0 of block 0 of channel 0 as PBA0, and page 0 of block 0 of channel 1 as PBA1.

在本申请的示例性实施例中,当所述固态硬盘具有缓存时,所述方法还可以包括:建立连续的逻辑区块地址的首尾地址与连续的物理块地址的首尾地址之间的映射关系,并将所述映射关系存储在二叉树数据结构中。In an exemplary embodiment of the present application, when the solid state drive has a cache, the method may further include: establishing a mapping relationship between the first and last addresses of consecutive logical block addresses and the first and last addresses of consecutive physical block addresses, and storing the mapping relationship in a binary tree data structure.

在本申请的示例性实施例中,对于页映射表的管理,现在流行的方案是采用线性表的方式管理页映射表,即,将某一段连续的缓存用作存储页映射表,需要查找LBAx所对应的PBA时,直接访问页映射表在缓存中的基地址和LBA的偏移量即可,如页映射表的LBA0存储于缓存a处,一个PBA占用i个字节,那么LBAx所对应的PBA存储在(a+x*i)处。但是本申请实施例方案产生的页映射关系并不适用于此种管理方法,本申请实施例方案采用二叉树的管理方案,即,将映射关系LBAx-PBAy存储在二叉树数据结构中以方便管理,如图2所示。In the exemplary embodiment of the present application, for the management of the page mapping table, the current popular solution is to manage the page mapping table in the form of a linear table, that is, a certain continuous cache is used as a storage page mapping table. When the PBA corresponding to LBAx needs to be found, the base address of the page mapping table in the cache and the offset of the LBA can be directly accessed. For example, LBA0 of the page mapping table is stored in cache a, and a PBA occupies i bytes, then the PBA corresponding to LBAx is stored at (a+x*i). However, the page mapping relationship generated by the embodiment of the present application is not suitable for this management method. The embodiment of the present application adopts a binary tree management solution, that is, the mapping relationship LBAx-PBAy is stored in a binary tree data structure for easy management, as shown in Figure 2.

在本申请的示例性实施例中,核心创新点即为用二叉树数据结构管理和存储与以往不同的、新的页映射表,使得本申请实施例在页映射表的管理和存储上具有高效、可应用于实践的特性。In the exemplary embodiment of the present application, the core innovation is to use a binary tree data structure to manage and store a new page mapping table that is different from the previous ones, so that the embodiment of the present application has the characteristics of high efficiency and practical applicability in the management and storage of page mapping tables.

在本申请的示例性实施例中,所述将所述映射关系存储在二叉树数据结构中可以包括:In an exemplary embodiment of the present application, storing the mapping relationship in a binary tree data structure may include:

从所述二叉树数据结构中找到所述逻辑区块地址,检测所述逻辑区块地址以前是否写入过数据,当所述逻辑区块地址以前未写入过数据,则在所述二叉树数据结构中新插入所述映射关系;当所述逻辑区块地址以前写入过数据,则在所述二叉树数据结构中采用所述映射关系更新以前的映射关系,并通知预设的垃圾回收模块对以前的映射关系进行垃圾回收。The logical block address is found from the binary tree data structure, and it is detected whether data has been written to the logical block address before. When data has not been written to the logical block address before, the mapping relationship is newly inserted into the binary tree data structure; when data has been written to the logical block address before, the mapping relationship is used to update the previous mapping relationship in the binary tree data structure, and a preset garbage collection module is notified to perform garbage collection on the previous mapping relationship.

在本申请的示例性实施例中,当数据已经存储到闪存中时,固件已经获得该笔数据的LBA及对应的PBA,即LBAx-LBA(x+y)对应着PBAk-PBA(k+y)。固件可以根据LBA查找二叉树,如果该段LBA以前未写入过数据,则在二叉树中新插入该笔映射关系;如果该段LBA以前写入过数据,则用新的映射关系替换旧的的映射关系,并将旧的映射关系反馈给垃圾回收模块进行垃圾回收。In an exemplary embodiment of the present application, when data has been stored in the flash memory, the firmware has obtained the LBA and corresponding PBA of the data, that is, LBAx-LBA(x+y) corresponds to PBAk-PBA(k+y). The firmware can search the binary tree according to the LBA. If the segment of LBA has not been written with data before, the mapping relationship is newly inserted into the binary tree; if the segment of LBA has been written with data before, the old mapping relationship is replaced with the new mapping relationship, and the old mapping relationship is fed back to the garbage collection module for garbage collection.

在本申请的示例性实施例中,所述方法还可以包括:In an exemplary embodiment of the present application, the method may further include:

当所述二叉树数据结构中新增和修改的映射关系积累到设定阈值时,将所述二叉树数据结构中新增和修改的映射关系保存到闪存中。When the newly added and modified mapping relationships in the binary tree data structure accumulate to a set threshold, the newly added and modified mapping relationships in the binary tree data structure are saved in a flash memory.

在本申请的示例性实施例中,由于固态硬盘在某些情况下需保证用户数据在异常掉电时不丢失,需要经常将最新的页映射表保存到闪存中,避免页映射表丢失或错误导致用户数据丢失。因此,当新的映射关系积累到某一阈值(可人为设置)时,可以将新的映射关系保存到闪存中,以防异常掉电造成用户数据丢失。In an exemplary embodiment of the present application, since the solid-state drive needs to ensure that user data is not lost in the event of an abnormal power failure in some cases, it is necessary to frequently save the latest page mapping table to the flash memory to prevent the loss of user data due to the loss or error of the page mapping table. Therefore, when the new mapping relationship accumulates to a certain threshold (which can be set manually), the new mapping relationship can be saved to the flash memory to prevent the loss of user data due to abnormal power failure.

在本申请的示例性实施例中,当所述固态硬盘不具有缓存时,如果主机端需要读取某一数据时,固件则先从二叉树页映射表查询该笔数据LBA所对应的PBA,然后根据PBA范围从闪存对应区域读取数据送至主机端。In an exemplary embodiment of the present application, when the solid-state drive does not have a cache, if the host side needs to read certain data, the firmware first queries the PBA corresponding to the LBA of the data from the binary tree page mapping table, and then reads the data from the corresponding area of the flash memory according to the PBA range and sends it to the host side.

在本申请的示例性实施例中,当所述固态硬盘不具有缓存时,所述方法还可以包括:In an exemplary embodiment of the present application, when the solid state drive does not have a cache, the method may further include:

当该段数据相应的逻辑区块地址连续时,直接将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中。When the logical block addresses corresponding to the segment of data are continuous, the continuous data in the logical block addresses are directly stored in sequence in a segment of continuous physical block addresses in the flash memory.

在本申请的示例性实施例中,所述方法还可以包括:In an exemplary embodiment of the present application, the method may further include:

根据该段数据相应的逻辑区块地址从闪存中加载相应的页映射表,并更新所述页映射表中该段数据相应的逻辑区块地址对应的映射关系,将修改后的页映射表存储到闪存中。The corresponding page mapping table is loaded from the flash memory according to the logical block address corresponding to the segment data, and the mapping relationship corresponding to the logical block address corresponding to the segment data in the page mapping table is updated, and the modified page mapping table is stored in the flash memory.

在本申请的示例性实施例中,当主机端读取数据时,根据所述数据段对应的逻辑区块地址加载对应的页映射表,查询所述页映射表中相应的映射关系获得对应的物理块地址的范围,并根据所述物理块地址的范围从闪存中读取相应数据返回给主机端。In an exemplary embodiment of the present application, when the host side reads data, the corresponding page mapping table is loaded according to the logical block address corresponding to the data segment, the corresponding mapping relationship in the page mapping table is queried to obtain the corresponding physical block address range, and the corresponding data is read from the flash memory according to the physical block address range and returned to the host side.

在本申请的示例性实施例中,当固态硬盘未带缓存时:当主机端发送一段数据及相应的逻辑区块地址至固态硬盘时,固件会将该笔数据直接存储到闪存中;并且固件会根据该笔数据的LBA从闪存中加载相应的页映射表,然后更新该段LBA的映射关系,最后将修改后的映射表存储到闪存中。如果是从固态硬盘中读取数据,固件则首先根据该数据对应的LBA加载对应的页映射表,查询相应的映射关系获得PBA范围,然后根据PBA范围从闪存中读取相应数据返回给主机端。In an exemplary embodiment of the present application, when the SSD does not have a cache: when the host sends a piece of data and the corresponding logical block address to the SSD, the firmware will store the data directly in the flash memory; and the firmware will load the corresponding page mapping table from the flash memory according to the LBA of the data, then update the mapping relationship of the LBA segment, and finally store the modified mapping table in the flash memory. If the data is read from the SSD, the firmware first loads the corresponding page mapping table according to the LBA corresponding to the data, queries the corresponding mapping relationship to obtain the PBA range, and then reads the corresponding data from the flash memory according to the PBA range and returns it to the host.

在本申请的示例性实施例中,下面通过两个具体实施例说明本申请实施例的方案。In the exemplary embodiments of the present application, the scheme of the embodiments of the present application is explained below through two specific embodiments.

在本申请的示例性实施例中,例如,当前的社交软件服务器上通常会存储用户发布的大量图片,而一张图片的大小经过压缩后往往有数十KB(千比特)的大小,部分图片可能达到数MB(兆比特)大小。如果采用现有的运用线性表管理映射关系的固态硬盘,假如每4KB大小的数据会产生一个映射关系,则一张28KB大小的图片会产生7个映射关系,即存储7个PBA;如果采用本申请实施例的方法,则只需存储两个LBA(数据对应的首尾LBA)和两个PBA(数据存储时对应的首尾PBA),一般LBA和PBA大小相等,比常规方法节约了不小的空间。如果是4MB的图片大小,则采用线性表管理映射关系的固态硬盘会存储4096/4即1024个PBA,而采用本申请实施例的固态硬盘还是只需存储两个LBA和两个PBA,映射表的大小会大幅减小。In an exemplary embodiment of the present application, for example, a large number of pictures posted by users are usually stored on the current social software server, and the size of a picture is often tens of KB (kilobits) after compression, and some pictures may reach several MB (megabits). If the existing solid-state hard disk using a linear table to manage the mapping relationship is used, if a mapping relationship is generated for every 4KB of data, a 28KB picture will generate 7 mapping relationships, that is, 7 PBAs are stored; if the method of the embodiment of the present application is used, only two LBAs (the first and last LBAs corresponding to the data) and two PBAs (the first and last PBAs corresponding to the data when the data is stored) need to be stored, and generally the LBA and PBA are equal in size, which saves a lot of space compared to the conventional method. If the picture size is 4MB, the solid-state hard disk using a linear table to manage the mapping relationship will store 4096/4, that is, 1024 PBAs, while the solid-state hard disk using the embodiment of the present application still only needs to store two LBAs and two PBAs, and the size of the mapping table will be greatly reduced.

在本申请的示例性实施例中,又例如,假设一个LBA大小为a字节,一个PBA为b字节,固态硬盘每存储4096个字节的数据产生一个映射关系,如果固态硬盘要存储c字节的数据,那么现有的采用线性表管理映射关系的固态硬盘一般会花费(c/4096)*b个字节存储该笔数据产生的映射关系;如果采用本申请实施例的新型映射关系建立方法,则只需2(a+b)个字节存储该数据产生的映射关系。另外,在有缓存的固态硬盘中,现有的固态硬盘会将绝大部分的缓存空间用于存储映射关系,映射关系的减少一方面可以减少生产商在缓存方面的投入成本,也可以将多余的缓存空间用于提高固态硬盘性能或可靠性;在无缓存的固态硬盘中,本申请实施例方案可以大大减少从闪存中读写映射关系的数据量,进而提高固态硬盘的读写性能。In the exemplary embodiment of the present application, for example, assuming that the size of an LBA is a byte, and the size of a PBA is b bytes, the solid-state drive generates a mapping relationship for each 4096 bytes of data stored. If the solid-state drive is to store c bytes of data, then the existing solid-state drive that uses a linear table to manage the mapping relationship generally spends (c/4096)*b bytes to store the mapping relationship generated by the data; if the new mapping relationship establishment method of the embodiment of the present application is adopted, only 2 (a+b) bytes are needed to store the mapping relationship generated by the data. In addition, in a cached solid-state drive, the existing solid-state drive will use most of the cache space to store the mapping relationship. The reduction of the mapping relationship can reduce the manufacturer's investment cost in the cache on the one hand, and the excess cache space can also be used to improve the performance or reliability of the solid-state drive; in a non-cached solid-state drive, the embodiment of the present application can greatly reduce the amount of data read and written from the flash memory to the mapping relationship, thereby improving the read and write performance of the solid-state drive.

本申请实施例还提供了一种固态硬盘1,如图3所示,可以包括闪存11和固件芯片12,所述固件芯片中存储有指令,当所述指令被所述固件芯片执行时,实现上述任意一项所述的固态硬盘的地址映射方法。The embodiment of the present application also provides a solid state drive 1, as shown in FIG3 , which may include a flash memory 11 and a firmware chip 12, wherein instructions are stored in the firmware chip, and when the instructions are executed by the firmware chip, the address mapping method of the solid state drive described in any one of the above items is implemented.

本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules/units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

Claims (7)

1.一种固态硬盘的地址映射方法,其特征在于,所述固态硬盘具有缓存,所述方法包括:1. A method for address mapping of a solid state drive, wherein the solid state drive has a cache, and the method comprises: 当固态硬盘接收到主机端发送的一段数据及该段数据相应的逻辑区块地址时,判断该段数据相应的逻辑区块地址是否连续,包括:将该段数据及该段数据相应的逻辑区块地址存储于所述缓存中,并且将缓存中待写入闪存中的数据根据所述数据的逻辑区块地址进行排序,当所述缓存中存储的数据积累到预设的数据阈值时,判断所述缓存中排序好的数据相应的逻辑区块地址是否连续;When the solid state drive receives a segment of data and a logical block address corresponding to the segment of data sent by the host, determining whether the logical block address corresponding to the segment of data is continuous, including: storing the segment of data and the logical block address corresponding to the segment of data in the cache, and sorting the data in the cache to be written into the flash memory according to the logical block address of the data, and when the data stored in the cache accumulates to a preset data threshold, determining whether the logical block addresses corresponding to the sorted data in the cache are continuous; 当该段数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中,包括:当所述缓存中的数据相应的逻辑区块地址连续时,将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中;或者,当所述缓存中的数据相应的逻辑区块地址不连续时,将所述逻辑区块地址中不连续的数据存储到闪存中连续的或不连续的物理块地址中;When the logical block addresses corresponding to the segment of data are continuous, the continuous data in the logical block addresses are sequentially stored in a continuous segment of physical block addresses in the flash memory, including: when the logical block addresses corresponding to the data in the cache are continuous, the continuous data in the logical block addresses are sequentially stored in a continuous segment of physical block addresses in the flash memory; or when the logical block addresses corresponding to the data in the cache are discontinuous, the discontinuous data in the logical block addresses are stored in continuous or discontinuous physical block addresses in the flash memory; 采用二叉树数据结构保存该段数据相应的首尾两个逻辑区块地址和对应的物理区块地址。A binary tree data structure is used to store the first and last logical block addresses and the corresponding physical block address of the data segment. 2.根据权利要求1所述的固态硬盘的地址映射方法,其特征在于,所述方法还包括:建立连续的逻辑区块地址的首尾地址与连续的物理块地址的首尾地址之间的映射关系,并将所述映射关系存储在二叉树数据结构中。2. The address mapping method of a solid state drive according to claim 1, characterized in that the method further comprises: establishing a mapping relationship between the first and last addresses of continuous logical block addresses and the first and last addresses of continuous physical block addresses, and storing the mapping relationship in a binary tree data structure. 3.根据权利要求2所述的固态硬盘的地址映射方法,其特征在于,所述将所述映射关系存储在二叉树数据结构中包括:3. The address mapping method of a solid state drive according to claim 2, wherein storing the mapping relationship in a binary tree data structure comprises: 从所述二叉树数据结构中找到所述逻辑区块地址,检测所述逻辑区块地址以前是否写入过数据,当所述逻辑区块地址以前未写入过数据,则在所述二叉树数据结构中新插入所述映射关系;当所述逻辑区块地址以前写入过数据,则在所述二叉树数据结构中采用所述映射关系更新以前的映射关系,并通知预设的垃圾回收模块对以前的映射关系进行垃圾回收。The logical block address is found from the binary tree data structure, and it is detected whether data has been written to the logical block address before. When data has not been written to the logical block address before, the mapping relationship is newly inserted into the binary tree data structure; when data has been written to the logical block address before, the mapping relationship is used to update the previous mapping relationship in the binary tree data structure, and a preset garbage collection module is notified to perform garbage collection on the previous mapping relationship. 4.根据权利要求2或3所述的固态硬盘的地址映射方法,其特征在于,所述方法还包括:4. The address mapping method of a solid state drive according to claim 2 or 3, characterized in that the method further comprises: 当所述二叉树数据结构中新增和修改的映射关系积累到设定阈值时,将所述二叉树数据结构中新增和修改的映射关系保存到闪存中。When the newly added and modified mapping relationships in the binary tree data structure accumulate to a set threshold, the newly added and modified mapping relationships in the binary tree data structure are saved in a flash memory. 5.根据权利要求1所述的固态硬盘的地址映射方法,其特征在于,所述方法还包括:5. The address mapping method of a solid state drive according to claim 1, characterized in that the method further comprises: 在将待存储的数据存入闪存之前,将所述待存储的数据划分成多个部分;将所述多个部分通过多个通道并行存储到闪存中。Before storing the data to be stored in the flash memory, the data to be stored is divided into a plurality of parts; and the plurality of parts are stored in the flash memory in parallel through a plurality of channels. 6.根据权利要求1所述的固态硬盘的地址映射方法,其特征在于,在将所述逻辑区块地址中连续的数据按顺序存储到闪存中一段连续的物理块地址中之前,所述方法还包括:6. The address mapping method of a solid state drive according to claim 1, characterized in that before sequentially storing the continuous data in the logical block address into a continuous physical block address in the flash memory, the method further comprises: 从所述闪存中寻找该段连续的物理区块地址,并返回该段连续的物理区块地址的首尾地址;Searching for the segment of continuous physical block addresses from the flash memory, and returning the first and last addresses of the segment of continuous physical block addresses; 当该段连续的物理区块地址含有坏块时,在读写时自动跳过所述坏块。When the segment of continuous physical block addresses contains a bad block, the bad block is automatically skipped during reading and writing. 7.一种固态硬盘,包括闪存和固件芯片,所述固件芯片中存储有指令,其特征在于,当所述指令被所述固件芯片执行时,实现如权利要求1-6任意一项所述的固态硬盘的地址映射方法。7. A solid state drive, comprising a flash memory and a firmware chip, wherein the firmware chip stores instructions, wherein when the instructions are executed by the firmware chip, the address mapping method for the solid state drive according to any one of claims 1 to 6 is implemented.
CN202011387849.0A 2020-12-01 2020-12-01 Solid state disk and address mapping method thereof Active CN112486852B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011387849.0A CN112486852B (en) 2020-12-01 2020-12-01 Solid state disk and address mapping method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011387849.0A CN112486852B (en) 2020-12-01 2020-12-01 Solid state disk and address mapping method thereof

Publications (2)

Publication Number Publication Date
CN112486852A CN112486852A (en) 2021-03-12
CN112486852B true CN112486852B (en) 2024-05-14

Family

ID=74938841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011387849.0A Active CN112486852B (en) 2020-12-01 2020-12-01 Solid state disk and address mapping method thereof

Country Status (1)

Country Link
CN (1) CN112486852B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113326001B (en) * 2021-05-20 2023-08-01 锐掣(杭州)科技有限公司 Data processing method, device, apparatus, system, medium, and program
US20220392562A1 (en) * 2021-06-08 2022-12-08 Macronix International Co., Ltd. Automatically skip bad block in continuous read or sequential cache read operation
CN113555057A (en) * 2021-07-26 2021-10-26 成都储迅科技有限责任公司 Implementation method for expanding solid state disk mapping table unit
CN113704140B (en) * 2021-08-27 2024-11-26 锐掣(杭州)科技有限公司 A method and device for mapping solid state hard disk address
CN113625973B (en) * 2021-08-30 2024-01-16 得一微电子股份有限公司 Data writing method, device, electronic equipment and computer readable storage medium
CN114036079B (en) * 2021-09-07 2023-02-17 联芸科技(杭州)股份有限公司 Mapping table compression method and system, memory controller, solid state disk and data reading method
CN114417069A (en) * 2022-01-21 2022-04-29 杭州联吉技术有限公司 Page data interaction method and device and electronic equipment
CN115033175A (en) * 2022-05-27 2022-09-09 阿里巴巴(中国)有限公司 Data reading method and device, storage medium and processor
CN115629720B (en) * 2022-12-20 2023-07-28 鹏钛存储技术(南京)有限公司 Asymmetric striping method on storage device based on flash memory as medium
CN115933995B (en) * 2023-01-09 2023-05-09 苏州浪潮智能科技有限公司 Data writing method, device, electronic equipment and readable medium in solid-state hard disk
CN115756341B (en) * 2023-01-09 2023-04-07 苏州浪潮智能科技有限公司 Garbage recycling method and device for solid state disk, electronic equipment and storage medium
CN116340198B (en) * 2023-05-26 2023-08-04 苏州浪潮智能科技有限公司 Data writing method of solid-state hard disk, its device and solid-state hard disk

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996464A (en) * 2006-01-04 2007-07-11 日立环球储存科技荷兰有限公司 Address assigning method, disk drive and data writing method
CN101552032A (en) * 2008-12-12 2009-10-07 深圳市晶凯电子技术有限公司 Method and device for constructing a high-speed solid state memory disc by using higher-capacity DRAM to join in flash memory medium management
CN107066393A (en) * 2017-01-12 2017-08-18 安徽大学 The method for improving map information density in address mapping table
CN108121670A (en) * 2017-08-07 2018-06-05 鸿秦(北京)科技有限公司 A kind of mapping method for reducing solid state disk metadata backwash frequency
CN108255420A (en) * 2017-12-22 2018-07-06 深圳忆联信息系统有限公司 A kind of solid state disk buffer memory management method and solid state disk

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7610438B2 (en) * 2000-01-06 2009-10-27 Super Talent Electronics, Inc. Flash-memory card for caching a hard disk drive with data-area toggling of pointers stored in a RAM lookup table

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996464A (en) * 2006-01-04 2007-07-11 日立环球储存科技荷兰有限公司 Address assigning method, disk drive and data writing method
CN101552032A (en) * 2008-12-12 2009-10-07 深圳市晶凯电子技术有限公司 Method and device for constructing a high-speed solid state memory disc by using higher-capacity DRAM to join in flash memory medium management
CN107066393A (en) * 2017-01-12 2017-08-18 安徽大学 The method for improving map information density in address mapping table
CN108121670A (en) * 2017-08-07 2018-06-05 鸿秦(北京)科技有限公司 A kind of mapping method for reducing solid state disk metadata backwash frequency
CN108255420A (en) * 2017-12-22 2018-07-06 深圳忆联信息系统有限公司 A kind of solid state disk buffer memory management method and solid state disk

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
缓存—主存地址映射方式解析;朱贵宪;魏胜利;《电脑知识与技术》;第14卷(第第9期);第292-294页 *

Also Published As

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

Similar Documents

Publication Publication Date Title
CN112486852B (en) Solid state disk and address mapping method thereof
US10275361B2 (en) Managing multiple namespaces in a non-volatile memory (NVM)
CN110678836B (en) Persistent memory for key value storage
US20200225882A1 (en) System and method for compaction-less key-value store for improving storage capacity, write amplification, and i/o performance
CN101241472B (en) mapping management method and system
US20100174860A1 (en) Non-volatile memory, page dynamic allocation apparatus and page mapping apparatus therefor, and page dynamic allocation method and page mapping method therefor
US20100082537A1 (en) File system for storage device which uses different cluster sizes
CN108628542B (en) A file merging method and controller
CN106708427A (en) Storage method suitable for key value pair data
US20110099350A1 (en) Block boundary resolution for mismatched logical and physical block sizes
CN110147203B (en) File management method and device, electronic equipment and storage medium
CN102662856A (en) Solid state disk and access method
EP4187363B1 (en) Storage controller, storage control method, solid state disk and storage system
US8296270B2 (en) Adaptive logging apparatus and method
US11372774B2 (en) Method and system for a solid state drive with on-chip memory integration
CN100426259C (en) Virtual access method of storage document data
CN108628762B (en) A solid-state storage device and method for processing IO commands
KR101077901B1 (en) Apparatus and method for managing flash memory using log block unit mapping technique
CN112486861B (en) Solid state disk mapping table data query method and device, computer equipment and storage medium
EP2381354A2 (en) Data recording device
US11263132B2 (en) Method and system for facilitating log-structure data organization
US11099985B2 (en) Storage controller, storage array device, data depositing method, and storage medium
KR102032878B1 (en) Method for correcting error of flash storage controller
US11934264B2 (en) ECC parity biasing for Key-Value data storage devices
US11188511B2 (en) Offloading file-indexing to memory card firmware

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: 230088 floor 7, block C, building J2, phase II, innovation industrial park, high tech Zone, Hefei, Anhui Province

Applicant after: HEFEI DATANG STORAGE TECHNOLOGY Co.,Ltd.

Address before: 100094 No. 6 Yongjia North Road, Beijing, Haidian District

Applicant before: HEFEI DATANG STORAGE TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A solid-state drive and its address mapping method

Granted publication date: 20240514

Pledgee: Hefei Xingtai Technology Micro-loan Co.,Ltd.

Pledgor: HEFEI DATANG STORAGE TECHNOLOGY Co.,Ltd.

Registration number: Y2025980012933

PE01 Entry into force of the registration of the contract for pledge of patent right