CN106293521A - A kind of mapping granule adaptive flash translation layer (FTL) management method - Google Patents
A kind of mapping granule adaptive flash translation layer (FTL) management method Download PDFInfo
- Publication number
- CN106293521A CN106293521A CN201610623356.XA CN201610623356A CN106293521A CN 106293521 A CN106293521 A CN 106293521A CN 201610623356 A CN201610623356 A CN 201610623356A CN 106293521 A CN106293521 A CN 106293521A
- Authority
- CN
- China
- Prior art keywords
- page
- physical
- flash
- subpage
- logical
- 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
Links
- 238000013507 mapping Methods 0.000 title claims abstract description 104
- 238000007726 management method Methods 0.000 title claims abstract description 12
- 238000013519 translation Methods 0.000 title claims description 13
- 230000003044 adaptive effect Effects 0.000 title description 4
- 239000008187 granular material Substances 0.000 title 1
- 238000003860 storage Methods 0.000 claims abstract description 20
- 238000006243 chemical reaction Methods 0.000 claims abstract description 14
- 238000000034 method Methods 0.000 claims description 44
- 230000008569 process Effects 0.000 claims description 19
- 230000005055 memory storage Effects 0.000 claims description 7
- 239000002699 waste material Substances 0.000 abstract description 5
- 230000015556 catabolic process Effects 0.000 abstract 1
- 238000006731 degradation reaction Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 7
- 230000008901 benefit Effects 0.000 description 4
- 238000007667 floating Methods 0.000 description 4
- 230000007704 transition Effects 0.000 description 4
- 238000013403 standard screening design Methods 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 101001122730 Paramecium tetraurelia Serine/threonine-protein phosphatase PP2A catalytic subunit 1 Proteins 0.000 description 2
- 230000007423 decrease Effects 0.000 description 2
- 230000005684 electric field Effects 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 230000005012 migration Effects 0.000 description 2
- 238000013508 migration Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 239000000758 substrate Substances 0.000 description 2
- 230000003321 amplification Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003199 nucleic acid amplification method Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 238000004064 recycling Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000035939 shock Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000005641 tunneling Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0238—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
- G06F12/0246—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0631—Configuration or reconfiguration of storage systems by allocating resources to storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/72—Details relating to flash memory management
- G06F2212/7201—Logical to physical mapping or translation of blocks or pages
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明公开了一种映射粒度自适应的闪存转换层管理方法,包括:从文件系统接收数据请求,并判断该数据请求的类型是读请求还是写请求,如果是写请求,则根据该写请求的逻辑页号查询闪存存储空间的页映射表,以判断该写请求对应的逻辑页是否不是第一次写,如果是则根据页映射表中该逻辑页号对应的类型判断该逻辑页的类型是部分页面还是完整页面,如果是部分页面则将该部分页面对应的子页状态表中的子页状态设置为失效,判断写请求的大小是否大于闪存页的大小,如果是则从整页空闲队列的队首取出空闲的物理页,将写请求对应的数据写入该物理页中。本发明能够减少大容量闪存页访问造成的读写性能下降和存储空间浪费。
The invention discloses a flash memory conversion layer management method with self-adaptive mapping granularity, comprising: receiving a data request from a file system, and judging whether the type of the data request is a read request or a write request, and if it is a write request, according to the write request, query the page mapping table of the flash storage space to determine whether the logical page corresponding to the write request is not written for the first time, and if so, judge the type of the logical page according to the type corresponding to the logical page number in the page mapping table Whether it is a partial page or a complete page, if it is a partial page, set the subpage status in the subpage status table corresponding to the partial page to invalid, judge whether the size of the write request is greater than the size of the flash page, if so, start from the entire page to idle The leader of the queue takes out an idle physical page, and writes the data corresponding to the write request into the physical page. The invention can reduce the degradation of reading and writing performance and the waste of storage space caused by large-capacity flash memory page access.
Description
技术领域technical field
本发明属于固态盘存储技术领域,更具体地,涉及一种映射粒度自适应的闪存转换层管理方法。The invention belongs to the technical field of solid-state disk storage, and more particularly relates to a flash memory conversion layer management method with self-adaptive mapping granularity.
背景技术Background technique
作为目前最广泛使用的外存储设备,机械硬盘的读写性能已经渐渐不能满足上层应用的需求,存储设备的性能已经成为计算机系统整体性能的瓶颈。为了提高计算机存储系统的性能,近年来,以与非型(NAND)闪存作为存储介质的固态硬盘获得了广泛的应用。固态硬盘具有高带宽、低延迟、低功耗、抗震性好、无噪音等特点,已经在消费级市场和企业级存储中部分替代机械硬盘,成为主要的存储设备之一。随着闪存制造工艺的进步,NAND型闪存芯片的存储密度越来越高,存储容量越来越大。作为闪存读写的基本单位,闪存页的容量也呈现逐渐增加的趋势。从早先的512字节,增加到4KB、8KB,现在已经出现了16KB页大小的单层单元(Single-Level Cell,简称SLC)和多层单元(Multi-Level Cell,简称MLC)NAND型闪存芯片,未来还可能增加到32KB甚至更大。As the most widely used external storage device at present, the read and write performance of mechanical hard disk has gradually failed to meet the needs of upper-level applications, and the performance of storage devices has become the bottleneck of the overall performance of the computer system. In order to improve the performance of computer storage systems, in recent years, solid-state hard disks using NAND flash memory as storage media have been widely used. Solid-state drives have the characteristics of high bandwidth, low latency, low power consumption, good shock resistance, and no noise. They have partially replaced mechanical hard drives in the consumer market and enterprise-level storage, and have become one of the main storage devices. With the progress of flash memory manufacturing technology, the storage density of NAND flash memory chips is getting higher and higher, and the storage capacity is getting larger and larger. As the basic unit for reading and writing of flash memory, the capacity of flash memory page is also gradually increasing. From the previous 512 bytes, it has increased to 4KB and 8KB, and now there are 16KB page-sized single-level cell (Single-Level Cell, referred to as SLC) and multi-level cell (Multi-Level Cell, referred to as MLC) NAND flash memory chips , and may increase to 32KB or even larger in the future.
为了提供兼容机械硬盘的访问接口,固态硬盘通常采用闪存转换层(FlashTranslation Layer,简称FTL)向上层隐藏闪存的读、写、擦除操作。通过使用闪存转换层,大部分文件系统都可以直接应用在固态硬盘上。而常见文件系统的存储单位文件系统块(File System Block,简称FSB)的大小基本固定,通常都采用4KB的存储单位。闪存页的容量已经达到文件系统块的数倍。以16KB的闪存页为例,4个4KB的文件系统块才能填满一个闪存页。如果需要更新一个闪存页中4KB的数据,需要先将整个闪存页 中16KB的数据读出,与4KB的更新数据合并后,再写入一个新的闪存页中。由表1可知,在2010年之前,主要NAND型闪存芯片的闪存页容量不超过4KB。此时,闪存页容量与文件系统块不匹配的矛盾并不凸显。随着闪存页容量的增加,大容量闪存页对读写性能的影响越来越明显,常用的闪存转换层方法并不能很好的解决这个问题。In order to provide an access interface compatible with mechanical hard disks, solid-state hard disks usually use a Flash Translation Layer (FTL for short) to hide the read, write, and erase operations of the flash memory from the upper layer. By using the flash translation layer, most file systems can be directly applied to SSDs. However, the size of the storage unit of the common file system, the file system block (File System Block, FSB for short), is basically fixed, and the storage unit of 4KB is usually used. The size of a flash page has reached several times that of a file system block. Taking a 16KB flash page as an example, four 4KB file system blocks can fill a flash page. If you need to update the 4KB data in a flash page, you need to read out the 16KB data in the entire flash page first, merge it with the 4KB update data, and then write it into a new flash page. It can be seen from Table 1 that before 2010, the flash memory page capacity of major NAND flash memory chips did not exceed 4KB. At this time, the contradiction between the flash memory page capacity and the file system block mismatch is not prominent. With the increase of flash page capacity, the impact of large-capacity flash pages on read and write performance becomes more and more obvious, and the commonly used flash translation layer method cannot solve this problem well.
表1 NAND型闪存和闪存页容量增大趋势Table 1 NAND flash memory and flash page capacity increase trend
发明内容Contents of the invention
针对现有技术的以上缺陷或改进需求,本发明提供了一种映射粒度自适应的闪存转换层管理方法(Mapping Granularity Adaptive Flash Translation Layer,简称MGA-FTL),其目的在于,利用闪存单元可以被重复写入的特性,支持以闪存子页为粒度分配存储空间和对闪存页进行重复写入,提高了大容量闪存页的空间利用率和读写性能。MGA-FTL针对不同的文件系统请求的粒度,采用完整的闪存页或闪存页部分空间进行响应,即采用页级映射和子页级映射相混合映射的管理方法。当文件系统请求大小与一个闪存页大小相同时,分配一个完整的闪存页存储请求的数据;当文件系统请求大小小于一个闪存页大小时,分配闪存页中的一个子页来存储请求的数据,该闪存页中剩余的空间可以保留用于存储其他小于闪存页大小的请求;另外,本发明通过提出一种子页合并策略。子页合并策略根据该文件系统请求访问的频率,通过限制文件系统请求可以分布在不同闪存页中的数目, 更好的减少请求的访问延迟,使系统达到更好的性能。In view of the above defects or improvement needs of the prior art, the present invention provides a mapping granularity adaptive flash translation layer management method (Mapping Granularity Adaptive Flash Translation Layer, referred to as MGA-FTL), the purpose of which is to use the flash memory unit can be The feature of repeated writing supports the allocation of storage space at the granularity of flash subpages and repeated writing of flash pages, which improves the space utilization and read/write performance of large-capacity flash pages. According to the granularity of different file system requests, MGA-FTL responds with a complete flash page or a part of a flash page, that is, uses a hybrid mapping management method of page-level mapping and sub-page level mapping. When the file system request size is the same as a flash page size, allocate a complete flash page to store the requested data; when the file system request size is smaller than a flash page size, allocate a subpage in the flash page to store the requested data, The remaining space in the flash page can be reserved for storing other requests smaller than the size of the flash page; in addition, the present invention proposes a subpage merge strategy. According to the access frequency of the file system request, the subpage merge strategy can better reduce the request access delay and achieve better system performance by limiting the number of file system requests that can be distributed in different flash pages.
为实现上述目的,按照本发明的一个方面,提供了一种映射粒度自适应的闪存转换层管理方法,包括以下步骤:In order to achieve the above object, according to one aspect of the present invention, a kind of mapping granularity adaptive flash memory conversion layer management method is provided, comprising the following steps:
(1)从文件系统接收数据请求,并判断该数据请求的类型是读请求还是写请求,如果是写请求,则进入步骤(2),如果是读请求,则进入步骤(9);(1) Receive a data request from the file system, and judge whether the type of the data request is a read request or a write request, if it is a write request, then enter step (2), if it is a read request, then enter step (9);
(2)根据该写请求的逻辑页号查询闪存存储空间的页映射表,以判断该写请求对应的逻辑页是否不是第一次写,如果是则转入步骤(3),否则转入步骤(4);(2) query the page mapping table of the flash memory storage space according to the logical page number of this write request, to judge whether the logical page corresponding to this write request is not written for the first time, if it is then proceed to step (3), otherwise proceed to step (4);
(3)根据页映射表中该逻辑页号对应的类型判断该逻辑页的类型是部分页面还是完整页面,如果是部分页面则将该部分页面对应的子页状态表中的子页状态设置为失效,然后转入步骤(4),如果是完整页面则将完整页面对应的页状态表中的页状态设置为失效,然后转入步骤(4);(3) Judge whether the type of the logical page is a partial page or a complete page according to the type corresponding to the logical page number in the page mapping table, if it is a partial page, the subpage status in the subpage status table corresponding to the partial page is set to Invalidation, then proceed to step (4), if it is a complete page, the page status in the page state table corresponding to the complete page is set to invalidation, then proceed to step (4);
(4)判断写请求的大小是否大于闪存页的大小(其通常是8kB或者16kB),如果是则转入步骤(5),否则转入步骤(6);(4) judge whether the size of write request is greater than the size of flash memory page (it is usually 8kB or 16kB), if then proceed to step (5), otherwise proceed to step (6);
(5)从整页空闲队列的队首取出空闲的物理页,将写请求对应的数据写入该物理页中,并将完整页面对应的页状态表中的页状态修改为全部有效,然后过程结束;其中整页空闲队列是系统初始化时建立的,用于分配空闲的物理页;(5) Take out the free physical page from the head of the full page free queue, write the data corresponding to the write request into the physical page, and modify the page status in the page status table corresponding to the complete page to be all valid, and then process End; the full page free queue is established when the system is initialized, and is used to allocate free physical pages;
(6)判断写请求的分配策略是独占式分配还是共享式分配,如果是独占式分配转入步骤(7),如果是共享式分配转入步骤(8)。(6) Determine whether the allocation strategy of the write request is exclusive allocation or shared allocation, if it is exclusive allocation, go to step (7), if it is shared allocation, go to step (8).
(7)根据页映射表中该逻辑页号对应子页映射表指针,找到该逻辑页号的子页映射表,将写请求对应的数据写入同一个物理页中。若页映射表中没有该逻辑页号的表项,则创建表项并在整页空闲队列的队首取出空闲的物理页进行分配。然后过程结束。(7) Find the subpage mapping table of the logical page number according to the subpage mapping table pointer corresponding to the logical page number in the page mapping table, and write the data corresponding to the write request into the same physical page. If there is no entry of the logical page number in the page mapping table, an entry is created and a free physical page is taken out from the head of the full page free queue for allocation. Then the process ends.
(8)从请求大小对应的部分页空闲的队首取出空闲的物理子页,将写 请求对应的数据写入该物理子页中,并将部分页面对应的子页状态表中的子页状态设置为有效,然后过程结束;其中部分有效队列是根据整页空闲队列的使用情况动态建立的,用于响应部分页面数据大小的写请求;(8) Take out the free physical subpage from the head of the idle part of the page corresponding to the request size, write the data corresponding to the write request into the physical subpage, and write the subpage status in the subpage status table corresponding to the part of the page Set to valid, and then the process ends; some of the valid queues are dynamically established according to the usage of the full-page free queue, and are used to respond to write requests with a partial page data size;
(9)根据该读请求的逻辑页号对应的类型判断该逻辑页的类型是部分页面还是完整页面,如果是部分页面则转入步骤(10),否则转入步骤(12)。(9) Judging whether the type of the logical page is a partial page or a complete page according to the type corresponding to the logical page number of the read request, if it is a partial page, then proceed to step (10), otherwise proceed to step (12).
(10)根据子页映射表中该读请求的逻辑页号对应的物理子页号,读出物理子页中数据,并将该逻辑页的读次数计数器加1;(10) According to the physical subpage number corresponding to the logical page number of the read request in the subpage mapping table, read the data in the physical subpage, and add 1 to the read times counter of the logical page;
(11)根据该逻辑页的读次数计数器以及该逻辑页关联的物理页数量,判断是否需要合并分散的子页,如果需要则进行合并,然后过程结束,否则过程结束。(11) According to the read times counter of the logical page and the number of physical pages associated with the logical page, it is judged whether it is necessary to merge scattered subpages, if necessary, the merge is performed, and then the process ends, otherwise the process ends.
(12)根据页映射表中该读请求的逻辑页号对应的物理页号,读出物理页中数据,然后过程结束。(12) According to the physical page number corresponding to the logical page number of the read request in the page mapping table, read the data in the physical page, and then the process ends.
优选地,步骤(2)具体为,首先查询闪存存储空间的页映射表,并判断其中是否有写请求的逻辑页号,如果有则表示逻辑页不是第一次写,否则表示是第一次写。Preferably, step (2) is specifically, first query the page mapping table of the flash memory storage space, and judge whether there is a logical page number of the write request, if there is, it means that the logical page is not written for the first time, otherwise it means that it is the first time Write.
优选地,页映射表结构包括两级索引的映射表,第一级为页映射表,表项包括逻辑闪存页号,该逻辑闪存页的映射类型和对应物理闪存页号,其中如果逻辑闪存页号对应映射类型是部分页面,则物理闪存页号表项指向一个第二级映射表,称为子页映射表,子页映射表表项包括逻辑闪存子页号,该逻辑闪存子页号对应物理闪存页号、闪存页中具体的物理闪存子页号、该逻辑页关联的物理页数量。Preferably, the page mapping table structure includes a mapping table of two-level indexes, the first level is a page mapping table, and the entry includes a logical flash page number, a mapping type of the logical flash page and a corresponding physical flash page number, wherein if the logical flash page If the mapping type corresponding to the number is a partial page, the physical flash page number entry points to a second-level mapping table, called the subpage mapping table. The subpage mapping table entry includes the logical flash memory subpage number, and the logical flash memory subpage number corresponds to The physical flash page number, the specific physical flash subpage number in the flash page, and the number of physical pages associated with the logical page.
优选地,页状态表结构包括两级闪存页状态表,第一级为页状态表,表项包括物理闪存页号、物理闪存页的类型、以及物理闪存页状态,如果物理闪存页对应类型为部分页面,则状态表项指向一个子页状态表,该子页状态表包括物理子页号、子页对应状态、以及物理页对应的逻辑页的数量。Preferably, the page state table structure includes a two-level flash page state table, the first level is a page state table, and the table items include the physical flash page number, the type of the physical flash page, and the state of the physical flash page, if the corresponding type of the physical flash page is For some pages, the state entry points to a subpage state table, and the subpage state table includes the physical subpage number, the state corresponding to the subpage, and the number of logical pages corresponding to the physical page.
优选地,空闲页队列包括一个整页空闲队列和一个部分页空闲队列,整页空闲队列将所有状态为整页空闲的闪存页组成一条队列,部分页空闲队列分为3条子队列,每条队列下反别挂载空闲空间为4KB、8K和12KB大小的闪存页,这些闪存页之间的转化规则是,如果响应请求之后该闪存页中还有可用的空间,则再将其链入相应空闲容量的队列中。Preferably, the free page queue includes a full page free queue and a partial page free queue. The full page free queue forms a queue with all flash memory pages that are free in the full page state, and the partial page free queue is divided into 3 sub-queues, each queue Next, do not mount flash pages with free space of 4KB, 8K, and 12KB. The conversion rule between these flash pages is that if there is still available space in the flash page after responding to the request, then link it into the corresponding free space. capacity queue.
总体而言,通过本发明所构思的以上技术方案与现有技术相比,能够取得下列有益效果:Generally speaking, compared with the prior art, the above technical solutions conceived by the present invention can achieve the following beneficial effects:
1、本发明基于闪存页的重复写入特性,结合具体的闪存芯片访问接口和特性参数,提出了一种以闪存子页为粒度对大容量闪存页进行重复写入的方法,减少了主机和固态硬盘之间不必要的数据传输,进而提高了闪存存储空间的利用率。1. The present invention is based on the repeated writing characteristics of flash memory pages, combined with specific flash memory chip access interfaces and characteristic parameters, and proposes a method for repeatedly writing large-capacity flash memory pages at the granularity of flash memory sub-pages, which reduces the need for hosts and Unnecessary data transfer between SSDs improves the utilization of flash storage space.
2、本发明重新定义了闪存页的状态和状态转换图。增加了一个“部分有效”的闪存页状态,用于描述部分子页包含有效数据的闪存页。并且定义该状态和闪存页原有的“空闲”、“有效”和“过期”三个状态之间的转换关系,从能够对闪存页物理状态进行更为精细的描述。2. The present invention redefines the state and state transition diagram of the flash memory page. A "partially valid" flash page status has been added to describe flash pages where some subpages contain valid data. And define the transition relationship between this state and the original three states of "idle", "valid" and "expired" of the flash memory page, so as to be able to describe the physical state of the flash memory page more finely.
3、本发明设计了针对子页级映射和页级映射进行优化的两级索引的地址映射表,在页级映射的基础上,通过动态内存分配的方式为子页映射表分配存储空间。采用子页级映射处理文件系统的小粒度读写请求,由此解决了文件系统读写单位小于闪存页容量的技术问题。3. The present invention designs a two-level index address mapping table optimized for subpage-level mapping and page-level mapping, and allocates storage space for the subpage mapping table through dynamic memory allocation on the basis of page-level mapping. Sub-page-level mapping is used to process small-grained read and write requests of the file system, thereby solving the technical problem that the read and write unit of the file system is smaller than the flash memory page capacity.
4、本发明提出了一种既充分利用大容量闪存页中的子页空间,又防止数据分布过于分散的方法,并针对该分配方案设计了子页合并和垃圾回收的方法。4. The present invention proposes a method for fully utilizing the subpage space in the large-capacity flash memory page and preventing data distribution from being too scattered, and designs a method for subpage merging and garbage collection for the allocation scheme.
附图说明Description of drawings
图1是闪存单元写入和写入禁止的示意图。FIG. 1 is a schematic diagram of flash memory cell write and write inhibit.
图2是本发明方法的数据结构示意图。Fig. 2 is a schematic diagram of the data structure of the method of the present invention.
图3示出本发明方法的两级索引映射表。Fig. 3 shows a two-level index mapping table of the method of the present invention.
图4示出本发明方法的闪存页状态转换图。FIG. 4 shows a state transition diagram of a flash memory page in the method of the present invention.
图5示出本发明方法的闪存页状态表。FIG. 5 shows a flash memory page state table of the method of the present invention.
图6示出本发明方法的可分配空闲页队列。Fig. 6 shows the allocatable free page queue of the method of the present invention.
图7示出本发明方法的独占式与共享式子页分配方式。FIG. 7 shows the exclusive and shared subpage allocation methods of the method of the present invention.
图8示出本发明方法中限制LPN关联的PPN数量的示意图。Fig. 8 shows a schematic diagram of limiting the number of PPNs associated with an LPN in the method of the present invention.
图9是本发明映射粒度自适应的闪存转换层管理方法的流程图。FIG. 9 is a flow chart of the flash translation layer management method with self-adaptive mapping granularity of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。此外,下面所描述的本发明各个实施方式中所涉及到的技术特征只要彼此之间未构成冲突就可以相互组合。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not constitute a conflict with each other.
本发明的目的在于,针对使用大容量闪存页的固态硬盘,优化闪存转换层的功能,减少大容量闪存页访问造成的读写性能下降和存储空间浪费。The purpose of the present invention is to optimize the function of the flash conversion layer for solid-state hard drives using large-capacity flash pages, and reduce the decline in read and write performance and waste of storage space caused by large-capacity flash page access.
在闪存页写操作时,同一闪存页中的所有闪存单元共享对应字线上写入电压(Programming Voltage,用符号Vp表示)。该电压使半导体衬底中的电子利用隧道效应穿过氧化层进入浮栅中。但是,如果提高衬底中导电沟道的电压,就可以减少氧化层上的电压降,从而防止电子利用隧道效应进入浮栅,如图1所示。图1(a)为处于写入状态的闪存单元,导电沟道电势低,穿过氧化层的电场强,电子容量发生隧道效应进入浮栅。图1(b)为处于写入禁止状态的闪存单元,导电沟道电势高,穿过氧化层的电场弱,电子不容易发生隧道效应进入浮栅。闪存转换层通常规定当一个闪存页被写入数据后,只有对该闪存页所在的闪存块进行擦除(擦除后为“1”状态),才能再次向该闪存页写入数据。但是,根据上述的闪存单元写入禁止特性,如果闪存页某一位为“1”,在不擦除的情况下,可以将该位修改为“0”,直到闪存页中的不存在“1”为止。即闪存页是可以被重复写入的。闪存页重复写 入时,只修改闪存页中的部分区域,不需要重新写入整个闪存页,减少了传输数据量和闪存存储空间的浪费,也相对增强了闪存的使用寿命。During the write operation of the flash memory page, all the flash memory cells in the same flash memory page share the programming voltage (Programming Voltage, denoted by the symbol Vp) on the corresponding word line. This voltage causes electrons in the semiconductor substrate to tunnel through the oxide layer into the floating gate. However, if the voltage of the conductive channel in the substrate is increased, the voltage drop across the oxide layer can be reduced, preventing electrons from tunneling into the floating gate, as shown in Figure 1. Figure 1(a) shows the flash memory cell in the writing state, the potential of the conductive channel is low, the electric field passing through the oxide layer is strong, and the electron capacity tunnels into the floating gate. Figure 1(b) shows a flash memory cell in a write-inhibited state. The potential of the conductive channel is high, and the electric field passing through the oxide layer is weak, so it is difficult for electrons to tunnel into the floating gate. The flash translation layer generally stipulates that after a flash page is written with data, only the flash block where the flash page is located is erased (it is "1" state after erasing), and data can be written to the flash page again. However, according to the above-mentioned write prohibition feature of the flash memory unit, if a certain bit of the flash page is "1", the bit can be modified to "0" without erasing until there is no "1" in the flash page. "until. That is, flash memory pages can be rewritten. When the flash page is repeatedly written, only a part of the flash page is modified, and the entire flash page does not need to be rewritten, which reduces the amount of transmitted data and the waste of flash memory storage space, and relatively increases the service life of the flash memory.
为方便描述,下表2中列出了本发明中用到的符号和它们的说明。For convenience of description, symbols used in the present invention and their descriptions are listed in Table 2 below.
表2符号说明Table 2 Symbol Description
两级索引映射表:Two-level index mapping table:
MGA-FTL是一种页级映射和子页级映射相混合的闪存转换层,通过页映射来处理普通粒度的文件系统请求,通过子页映射来服务小粒度的文件系统请求。映射表采用一级映射表为页映射表(Page Mapping Table,PMT),二级映射表为子页映射表(SubpageMapping Table,SPMT)的方式。为了减小映射表的内存开销,二级映射表采用动态内存分配,即只有当逻辑页需要进行子页粒度的写入时,才为其分配二级映射表内存。MGA-FTL is a flash translation layer that combines page-level mapping and subpage-level mapping. It handles common granularity file system requests through page mapping and serves small granularity file system requests through subpage mapping. The mapping table adopts a method in which the primary mapping table is a page mapping table (Page Mapping Table, PMT), and the secondary mapping table is a subpage mapping table (Subpage Mapping Table, SPMT). In order to reduce the memory overhead of the mapping table, the secondary mapping table uses dynamic memory allocation, that is, only when the logical page needs to be written at the sub-page granularity, the memory of the secondary mapping table is allocated to it.
图3给出了两级索引映射表的一个实例情况。其中LPN为0、2、3的逻辑页对应完整的闪存页(类型为FP)直接进行页级映射,不需要二级映射表。LPN为1、4的逻辑页对应闪存页的部分子页,需要使用二级映射表。此时,页映射表表项中的PPN字段存放的是指向二级映射表的指针。在子页映射表中,保存了该逻辑页中的各个逻辑子页映射的物理页号(PPN)和物理子页号(PSPN),除此之外,还记录了该逻辑页映射的物理页的数量(PPN Count),用于在闪存页分配和合并时进行参考。对于不存在映射关系的逻辑地址,其物理地址在图中用“N/A”表示。Figure 3 shows an example of a two-level index mapping table. The logical pages whose LPN is 0, 2, and 3 correspond to a complete flash memory page (type is FP) and directly perform page-level mapping, without the need for a secondary mapping table. Logical pages with LPN 1 and 4 correspond to some subpages of the flash memory page, and a secondary mapping table is required. At this time, the PPN field in the page mapping table entry stores a pointer to the secondary mapping table. In the subpage mapping table, the physical page number (PPN) and physical subpage number (PSPN) of each logical subpage mapping in the logical page are saved, and in addition, the physical page mapping of the logical page is also recorded The number (PPN Count) for reference during flash page allocation and merging. For the logical addresses that do not have a mapping relationship, their physical addresses are represented by "N/A" in the figure.
闪存空间状态信息转换:Flash space state information conversion:
通常在闪存转换层中,物理闪存页的状态包括空闲(Free),有效(Valid)和无效(Invalid)三种。因为MGA-FTL需要表示一个闪存页中的部分子页有效这种新状态,所以添加了一个新的闪存页状态,部分有效(Part Valid,PV),用于描述这种闪存页中以子页为单位存放数据的情形。添加此状态后,MGA-FTL共包含四个状态,即整页空闲(Full Free,FF)、整页有效(Full Valid,FV)、整页无效(Full Invalid,FI)和部分有效。图4给出了MGA-FTL中闪存空间状态信息转换关系。Usually in the flash translation layer, the state of the physical flash page includes three types: free (Free), valid (Valid) and invalid (Invalid). Because MGA-FTL needs to represent the new state that some subpages in a flash page are valid, a new flash page state, Part Valid (PV), is added, which is used to describe the subpages in this flash page The situation where the data is stored for the unit. After adding this state, MGA-FTL contains four states in total, namely full page free (Full Free, FF), full page valid (Full Valid, FV), full page invalid (Full Invalid, FI) and partially valid. Figure 4 shows the conversion relationship of flash memory space state information in MGA-FTL.
MGA-FLT针对新的闪存空间状态信息转换,增加了两级闪存页状态表。图5给出了与图3相同存储情形下的两级闪存页状态表信息。两级闪存页状态表包括闪存页状态表(Page State Table,PST)和子页状态表(Subpage State Table,SPST)。图5中,PPN为0、2、3的物理页作为完整的闪存页使用,因此状态为全部有效(FV状态);而PPN为1,4的物理页只使用了部分子页,因而引入了二级状态表。PPN为1的闪存页中,PSPN为0、1、2的子页保存了有效数据(V状态),而PSPN为1的子页空闲(F状态)。PPN为4的闪存页的子页使用情况与其类似。除了记录物理子页的状态,还记录了该物理页对应的逻辑页的数量(LPN Count)。例如,物理页PPN 1中的数据来自于LPN 1和LPN 4,因此记为2。MGA-FLT adds a two-level flash page state table for the new flash space state information conversion. FIG. 5 shows the information of the two-level flash memory page state table under the same storage situation as in FIG. 3 . The two-level flash page state table includes a flash page state table (Page State Table, PST) and a subpage state table (Subpage State Table, SPST). In Figure 5, the physical pages with PPNs of 0, 2, and 3 are used as complete flash memory pages, so the state is all valid (FV state); while the physical pages with PPNs of 1 and 4 only use part of the subpages, thus introducing Secondary state table. In the flash memory page with PPN 1, the subpages with PSPN 0, 1, and 2 store valid data (V state), while the subpage with PSPN 1 is idle (F state). The subpage usage of a flash page with a PPN of 4 is similar. In addition to recording the state of the physical subpage, the number of logical pages (LPN Count) corresponding to the physical page is also recorded. For example, the data in physical page PPN 1 comes from LPN 1 and LPN 4, so it is recorded as 2.
闪存空闲空间分配算法:Flash memory free space allocation algorithm:
在MGA-FTL中,可供分配的空闲空间包括1)处于FF状态的完整的空闲闪存页,2)处于PV状态,并包含空闲子页的闪存页。基于表2所对一个闪存页大小16KB和一个闪存子页大小4KB的假设,MGA-FTL将可分配的最大连续空间相同的闪存页组成一条队列,如图6所示,则FF状态的闪存页组成一条队列,PV状态的闪存页则分为三条不同的队列,分别用于响应4KB、8KB和12KB不同大小的子页请求。如果响应请求之后该闪存页中还有可用的空间,则再将其链入相应空闲容量的队列中。为方便描述,下文将这些闪存页队列分成成为FF队列、PV4KB队列、PV8KB队列 和PV12KB队列。In MGA-FTL, free space available for allocation includes 1) a complete free flash page in FF state, and 2) a flash page in PV state and containing free subpages. Based on the assumption in Table 2 that a flash page size is 16KB and a flash subpage size is 4KB, MGA-FTL forms a queue of flash pages with the same maximum contiguous space that can be allocated, as shown in Figure 6, then the flash page in FF state A queue is formed, and the flash pages in the PV state are divided into three different queues, which are respectively used to respond to subpage requests of different sizes of 4KB, 8KB, and 12KB. If there is still available space in the flash memory page after responding to the request, then it is linked into the queue of corresponding free capacity. For the convenience of description, these flash page queues are divided into FF queue, PV4KB queue, PV8KB queue and PV12KB queue below.
当文件系统请求小于闪存页容量时,可以为其分配一个完整的FF状态的闪存页,也可以分配一个包含足够空闲空间的PV状态的闪存页。由此引入了两种不同的空闲空间分配策略:When the file system request is smaller than the capacity of the flash page, it can be allocated a complete FF state flash page, or a PV state flash page containing enough free space. This introduces two different free space allocation strategies:
1)独占式分配方式(Exclusive Allocation,简称EA)1) Exclusive Allocation (EA for short)
即将同属于同一个逻辑页的逻辑子页分配到同一个物理页中,即该物理页被逻辑页独占,如图7(a)所示。独占式分配的优点在于减少了子页合并时的开销,但是造成了空间利用率较低。That is, the logical subpages belonging to the same logical page are allocated to the same physical page, that is, the physical page is exclusively occupied by the logical page, as shown in FIG. 7( a ). The advantage of exclusive allocation is that it reduces the overhead of subpage merging, but results in lower space utilization.
2)共享式分配方式(Shared Allocation,简称SA)2) Shared Allocation (Shared Allocation, SA for short)
即属于不同逻辑页的逻辑子页可以被分配到同一个物理页中,如图7(b)所示。共享式分配方式的优点在于子页空间利用率高,但是合并操作的开销较大。That is, logical subpages belonging to different logical pages can be allocated to the same physical page, as shown in FIG. 7( b ). The advantage of the shared allocation method is that the utilization rate of the subpage space is high, but the overhead of the merge operation is relatively large.
两种分配方式各有其优缺点,MGA-FTL引入了一个参数——分配阈值(AllocationThreshold,简称AT)决定采用哪种分配方式,AT与FF状态的闪存页的比例(即空闲页比例,Free Page Ratio,简称FPR)相关,当FPR>=AT时,系统中处于FF状态的空闲页充足,使用EA分配方式,直接分配空闲页用于响应子页请求。当FPR<AT时,不在消耗FF状态空闲页,转而使用SA分配方式,消耗PV状态的闪存页中的空闲子页。当系统中空闲页随着垃圾回收操作的进行由增加,FPR再次超过AT时,MGA-FTL重新使用EA分配方式。此外,在分配空闲空间时,还会考虑请求的空间局部性。The two allocation methods have their own advantages and disadvantages. MGA-FTL introduces a parameter—AllocationThreshold (AT for short) to determine which allocation method to use, the ratio of AT and FF flash memory pages (that is, the proportion of free pages, Free Page Ratio, referred to as FPR), when FPR>=AT, there are enough free pages in the FF state in the system, and the EA allocation method is used to directly allocate free pages for responding to subpage requests. When FPR<AT, instead of consuming free pages in the FF state, use the SA allocation method to consume free subpages in the flash page in the PV state. When the free pages in the system increase with the garbage collection operation, and the FPR exceeds AT again, MGA-FTL uses the EA allocation method again. Additionally, the spatial locality of requests is taken into account when allocating free space.
闪存空闲空间分配算法如图8所示。文件系统写请求分配物理地址时,分为分配完整的闪存页、采用独占式分配方法分配空闲子页、采用共享式分配方式分配空闲子页三种方式。其中,共享式分配又根据请求的大小,分别从闪存页空闲空间为4KB、8KB、12KB的三个队列中选取合适的闪存页。The flash memory free space allocation algorithm is shown in Figure 8. When the file system write requests to allocate physical addresses, there are three methods: allocating complete flash memory pages, allocating free subpages by exclusive allocation, and allocating free subpages by shared allocation. Among them, the shared allocation selects appropriate flash memory pages from three queues with free spaces of flash memory pages of 4KB, 8KB, and 12KB respectively according to the size of the request.
碎片空间合并算法与无效数据回收算法:Fragmented space merging algorithm and invalid data recovery algorithm:
MGA-FTL为了提高大容量闪存页的利用率,利用闪存页中未被写入的空闲区域来处理子页粒度的文件系统请求。这样做带来的问题是同一个逻辑页的数据可能分布到不同的物理页中,造成了闪存存储空间的碎片化。当对逻辑页进行读操作时,需要读取多个物理页,从而降低固态硬盘的读性能。In order to improve the utilization rate of large-capacity flash pages, MGA-FTL utilizes the unwritten free area in flash pages to handle file system requests at sub-page granularity. The problem caused by this is that the data of the same logical page may be distributed to different physical pages, resulting in the fragmentation of the flash memory storage space. When performing a read operation on a logical page, multiple physical pages need to be read, thereby reducing the read performance of the solid-state disk.
针对这个问题,MGA-FTL采用了限制一个逻辑页关联的物理页的数量(PPN Count,PC)的方法来进行优化,同时参考逻辑页的读次数(Read Count,RC),其基本思路是:一个逻辑页的读次数越多,该逻辑页相关联的物理页越少。按照前文的假定,当采用16KB的闪存页且子页容量为4KB时,同一个逻辑页可能关联的物理页数量最多为4个。MGA-FTL规定如下:1)RC==0,PC<=4;2)0<RC<=2,PC<=3;3)2<RC<=5,PC<=2;4)RC>5,PC=1。In response to this problem, MGA-FTL adopts the method of limiting the number of physical pages (PPN Count, PC) associated with a logical page for optimization, and refers to the number of reads (Read Count, RC) of the logical page. The basic idea is: The more times a logical page is read, the fewer physical pages associated with the logical page. According to the previous assumptions, when a 16KB flash memory page is used and the subpage capacity is 4KB, the number of physical pages that may be associated with the same logical page is at most 4. MGA-FTL is stipulated as follows: 1) RC==0, PC<=4; 2) 0<RC<=2, PC<=3; 3) 2<RC<=5, PC<=2; 4) RC> 5, PC=1.
当某一逻辑页没有被读过时,可以将它的子页写到多个物理页中;随着读次数的增加,关联的物理页数量减少;当该逻辑页被多次读之后,系统将只允许在一个物理页上存储该逻辑页,即使造成额外的空间浪费。如图8(a)所示,假设现有一个逻辑页LPN的四个子页LSPN 0~3分布在物理页PPN A和PPN B中。现在文件系统发出对该逻辑页的最后一个子页LSPN 3的写操作。当该LPN的都次数RC为0,则可以按照图8(b)中所示的方式,将LSPN 3写入PV4KB队列中的物理页PPN C的空闲子页中,而LSPN 2仍然保存在PPN B中,该LPN关联的物理页的数量变为3。但是,如果RC为4,PC不能大于2,即需要限制LPN关联的物理页的数量,此时可以按照图8(c)中的方式,将LSPN 2和LSPN 3写入到PV8KB队列中的物理页PPN D中,这样不会增加改LPN的PC计数,但是会造成一个子页的多余数据迁移。如果RC为10,则需要按照图8(d)中所示的,将LSPN 0~3全部拷贝到FF队列中的物理页PPN E中,此过程增加了3个子页的额外数据迁移,但是之后再对该LPN进行读操场时,只需要从PPN E中读取,减少了读操作的开销。When a logical page has not been read, its subpages can be written to multiple physical pages; as the number of reads increases, the number of associated physical pages decreases; when the logical page is read multiple times, the system will It is only allowed to store the logical page on one physical page, even if it causes extra space waste. As shown in FIG. 8( a ), it is assumed that four subpages LSPN 0 to 3 of a logical page LPN are distributed in physical pages PPN A and PPN B. The file system now issues a write operation to the last subpage LSPN 3 of this logical page. When the number RC of the LPN is 0, LSPN 3 can be written into the free subpage of the physical page PPN C in the PV4KB queue as shown in Figure 8(b), while LSPN 2 is still stored in the PPN In B, the number of physical pages associated with the LPN becomes 3. However, if the RC is 4, the PC cannot be greater than 2, that is, the number of physical pages associated with the LPN needs to be limited. At this time, LSPN 2 and LSPN 3 can be written to the physical pages in the PV8KB queue according to the method shown in Figure 8(c). In page PPN D, this will not increase the PC count of the LPN, but will cause redundant data migration of a subpage. If RC is 10, you need to copy all LSPN 0~3 to the physical page PPN E in the FF queue as shown in Figure 8(d). This process adds additional data migration of 3 subpages, but after When the LPN is read again, it only needs to be read from the PPN E, which reduces the overhead of the read operation.
系统采用参数——垃圾回收阈值(Garbage Collection Threshold,简称GCT)来决定垃圾回收操作的触发时机。当空闲的闪存空间的比例低于GCT时,触发垃圾回收操作,选取包含较多无效数据的闪存块进行回收。The system uses a parameter - Garbage Collection Threshold (GCT for short) to determine the triggering timing of the garbage collection operation. When the proportion of free flash memory space is lower than the GCT, a garbage collection operation is triggered, and a flash memory block containing more invalid data is selected for recycling.
如图9所示,本发明映射粒度自适应的闪存转换层管理方法包括以下步骤:As shown in Figure 9, the flash memory conversion layer management method of the present invention with mapping granularity self-adaptation comprises the following steps:
(1)从文件系统接收数据请求,并判断该数据请求的类型是读请求还是写请求,如果是写请求,则进入步骤(2),如果是读请求,则进入步骤(9);(1) Receive a data request from the file system, and judge whether the type of the data request is a read request or a write request, if it is a write request, then enter step (2), if it is a read request, then enter step (9);
(2)根据该写请求的逻辑页号查询闪存存储空间的页映射表,以判断该写请求对应的逻辑页是否不是第一次写,如果是则转入步骤(3),否则转入步骤(4);具体而言,首先查询闪存存储空间的页映射表,并判断其中是否有写请求的逻辑页号,如果有则表示逻辑页不是第一次写,否则表示是第一次写;(2) query the page mapping table of the flash memory storage space according to the logical page number of this write request, to judge whether the logical page corresponding to this write request is not written for the first time, if it is then proceed to step (3), otherwise proceed to step (4); Specifically, at first query the page mapping table of the flash memory storage space, and judge whether there is a logical page number of the write request, if there is, it means that the logical page is not written for the first time, otherwise it means that it is written for the first time;
如图3所示,给出了页映射表结构及列举了一个应用实例。页映射表结构包括两级索引的映射表,第一级称为页映射表,表项包括逻辑闪存页号(LPN),该逻辑闪存页的映射类型(Type)和对应物理闪存页号(PPN)。如果逻辑闪存页号对应映射类型是部分页面(PP),则物理闪存页号表项指向一个第二级映射表,称为子页映射表。子页映射表表项包括逻辑闪存子页号(LSPN),该逻辑闪存子页号对应物理闪存页号(PPN)以及闪存页中具体哪个物理闪存子页号(PSPN),除此之外,还记录了该逻辑页关联的物理页数量(PPN Count),用于在闪存页分配和合并时进行参考。实例情况如图3中所示,逻辑闪存页号为0、2、3的逻辑页对应完整页面(类型为FP)直接进行页级映射,不需要二级映射表。逻辑闪存页号为1、4的逻辑页对应闪存页的部分子页,需要使用二级映射表。此时,页映射表表项中的物理闪存页号字段存放的是指向二级映射表的指针。As shown in Figure 3, the page mapping table structure is given and an application example is listed. The page mapping table structure includes a mapping table with two levels of indexes. The first level is called the page mapping table. The entries include the logical flash page number (LPN), the mapping type (Type) of the logical flash page and the corresponding physical flash page number (PPN). ). If the mapping type corresponding to the logical flash page number is a partial page (PP), the physical flash page number entry points to a second-level mapping table, called a subpage mapping table. The subpage mapping table entry includes a logical flash subpage number (LSPN), which corresponds to a physical flash page number (PPN) and a specific physical flash subpage number (PSPN) in a flash page. In addition, The number of physical pages (PPN Count) associated with the logical page is also recorded for reference when allocating and merging flash memory pages. As shown in FIG. 3 , the logical pages with logical flash memory page numbers 0, 2, and 3 correspond to complete pages (type is FP) and directly perform page-level mapping without the need for a secondary mapping table. The logical pages with logical flash page numbers 1 and 4 correspond to some subpages of the flash page, and a secondary mapping table is required. At this time, the physical flash memory page number field in the page mapping table entry stores a pointer to the secondary mapping table.
(3)根据页映射表中该逻辑页号对应的类型判断该逻辑页的类型是部分页面(Partial page,简称PP)还是完整页面(Full page,简称FP),如果是部分页面则将该部分页面对应的子页状态表中的子页状态设置为失效,然后转入步骤(4),如果是完整页面则将完整页面对应的页状态表中的页状态设置为失效,然后转入步骤(4);(3) According to the type corresponding to the logical page number in the page mapping table, it is judged whether the type of the logical page is a partial page (Partial page, referred to as PP) or a complete page (Full page, referred to as FP). The subpage status in the subpage status table corresponding to the page is set to invalidation, and then proceeds to step (4), if it is a complete page, the page status in the corresponding page status table of the complete page is set to invalidation, and then proceeds to step ( 4);
具体而言,子页状态表是在闪存页部分使用的状态下动态生成的,用于保存闪存子页的使用状态;其具体状态转换过程如图4所示;Specifically, the subpage state table is dynamically generated under the state that the flash memory page is partially used, and is used to save the use state of the flash memory subpage; its specific state transition process is shown in Figure 4;
如图5所示,给出了页状态表结构及图3中映射实例对应的状态表信息情况。页状态表结构包括两级闪存页状态表,第一级称为页状态表,表项包括物理闪存页号(PPN),物理闪存页的类型(Type)和物理闪存页状态(State)。如果物理闪存页对应类型为部分页面(PP),则状态表项指向一个子页状态表。子页状态表包括物理子页号(PSPN)和该子页对应状态(State),此外还包括该物理页对应的逻辑页的数量(LPN Count)。对应实例情况如图5中所示,物理闪存页号为0、2、3的物理页作为完整的闪存页使用,因此状态为全部有效(FV状态);而物理闪存页号为1,4的物理页只使用了部分子页,因而引入了二级状态表。物理闪存页号为1的闪存页中,物理子页号为0、1、2的子页保存了有效数据(V状态),而物理子页号为3的子页空闲(F状态)。As shown in Figure 5, the structure of the page state table and the state table information corresponding to the mapping example in Figure 3 are given. The page state table structure includes a two-level flash page state table, the first level is called the page state table, and the entries include the physical flash page number (PPN), the type (Type) of the physical flash page and the physical flash page state (State). If the corresponding type of the physical flash memory page is a partial page (PP), the state entry points to a subpage state table. The subpage state table includes the physical subpage number (PSPN) and the state corresponding to the subpage (State), and also includes the number of logical pages (LPN Count) corresponding to the physical page. The corresponding example situation is as shown in Figure 5, the physical pages whose physical flash memory page numbers are 0, 2, and 3 are used as complete flash memory pages, so the state is all valid (FV state); and the physical flash memory page numbers are 1,4 The physical page only uses part of the subpages, thus introducing a secondary state table. In the flash memory page whose physical flash page number is 1, the subpages whose physical subpage numbers are 0, 1, and 2 store valid data (V state), while the subpage whose physical subpage number is 3 is idle (F state).
(4)判断写请求的大小是否大于闪存页的大小(其通常是8kB或者16kB),如果是则转入步骤(5),否则转入步骤(6);(4) judge whether the size of write request is greater than the size of flash memory page (it is usually 8kB or 16kB), if then proceed to step (5), otherwise proceed to step (6);
(5)从整页空闲队列的队首取出空闲的物理页,将写请求对应的数据写入该物理页中,并将完整页面对应的页状态表中的页状态修改为全部有效;其中整页空闲队列是系统初始化时建立的,用于分配空闲的物理页;然后过程结束。(5) Take out the free physical page from the head of the full page free queue, write the data corresponding to the write request into the physical page, and modify the page status in the page status table corresponding to the complete page to be all valid; The page free queue is established when the system is initialized to allocate free physical pages; then the process ends.
如图6所示,给出了闪存系统可分配空闲页队列示意图。空闲页队列包括一个整页空闲队列和一个部分页空闲队列。整页空闲队列将所有状态 为整页空闲的闪存页组成一条队列;部分页空闲队列分为3条子队列,每条队列下反别挂载空闲空间为4KB、8K和12KB大小的闪存页。它们之间的转化规则是,如果响应请求之后该闪存页中还有可用的空间,则再将其链入相应空闲容量的队列中。As shown in FIG. 6 , a schematic diagram of a free page queue that can be allocated in a flash memory system is given. The free page queue includes a full page free queue and a partial page free queue. The full-page free queue forms a queue of all flash pages whose status is full-page free; the partial-page free queue is divided into three sub-queues, and each queue mounts flash pages with free space of 4KB, 8K, and 12KB. The conversion rule among them is, if there is still available space in the flash memory page after responding to the request, then it will be linked into the queue of corresponding free capacity.
(6)判断写请求的分配策略是独占式分配(Exclusive Allocation,简称EA)还是共享式分配(Shared Allocation,简称SA),如果是独占式分配转入步骤(7),如果是共享式分配转入步骤(8)。(6) Determine whether the allocation strategy of the write request is Exclusive Allocation (EA for short) or Shared Allocation (Shared Allocation, SA for short). If it is exclusive allocation, go to step (7); if it is shared allocation, go to Enter step (8).
(7)根据页映射表中该逻辑页号对应子页映射表指针,找到该逻辑页号的子页映射表,将写请求对应的数据写入同一个物理页中。若页映射表中没有该逻辑页号的表项,则创建表项并在整页空闲队列的队首取出空闲的物理页进行分配。然后过程结束。(7) Find the subpage mapping table of the logical page number according to the subpage mapping table pointer corresponding to the logical page number in the page mapping table, and write the data corresponding to the write request into the same physical page. If there is no entry of the logical page number in the page mapping table, an entry is created and a free physical page is taken out from the head of the full page free queue for allocation. Then the process ends.
如图7所示,分配策略包括独占式分配,否则为共享式分配。独占式分配即将同属于同一个逻辑页的逻辑子页分配到同一个物理页中,该物理页被逻辑页独占。共享式分配允许不同逻辑页的逻辑子页被分配到同一个物理页中。As shown in Figure 7, the allocation strategy includes exclusive allocation, otherwise shared allocation. Exclusive allocation is to allocate logical subpages belonging to the same logical page to the same physical page, and the physical page is exclusively occupied by the logical page. Shared allocation allows logical subpages of different logical pages to be allocated to the same physical page.
闪存空闲空间分配算法描述如图(8)所示。The description of the flash memory free space allocation algorithm is shown in Figure (8).
(8)从请求大小对应的部分页空闲的队首取出空闲的物理子页,将写请求对应的数据写入该物理子页中,并将部分页面对应的子页状态表中的子页状态设置为有效;其中部分有效队列是根据整页空闲队列的使用情况动态建立的,用于响应部分页面数据大小的写请求。然后过程结束。(8) Take out the free physical subpage from the head of the idle part of the page corresponding to the request size, write the data corresponding to the write request into the physical subpage, and write the subpage status in the subpage status table corresponding to the part of the page Set to valid; some of the valid queues are dynamically established according to the usage of the full-page free queue, and are used to respond to write requests with a partial page data size. Then the process ends.
(9)根据该读请求的逻辑页号对应的类型判断该逻辑页的类型是部分页面还是完整页面,如果是部分页面则转入步骤(10),否则转入步骤(12)。(9) Judging whether the type of the logical page is a partial page or a complete page according to the type corresponding to the logical page number of the read request, if it is a partial page, then proceed to step (10), otherwise proceed to step (12).
(10)根据子页映射表中该读请求的逻辑页号对应的物理子页号,读出物理子页中数据,并将该逻辑页的读次数计数器(Read Count,简称RC)加1;(10) According to the physical subpage number corresponding to the logical page number of the read request in the subpage mapping table, read the data in the physical subpage, and add 1 to the read counter (Read Count, referred to as RC) of the logical page;
(11)根据该逻辑页的读次数计数器以及该逻辑页关联的物理页数量, 判断是否需要合并分散的子页,如果需要则进行合并,然后转入(结束);否则转入(13)。(11) According to the read times counter of the logical page and the number of physical pages associated with the logical page, judge whether to merge scattered subpages, if necessary, merge, and then transfer to (end); otherwise transfer to (13).
具体而言,合并规则规定如下:1)RC==0,PC<=4;2)0<RC<=2,PC<=3;3)2<RC<=5,PC<=2;4)RC>5,PC=1。Specifically, the merging rules are stipulated as follows: 1) RC==0, PC<=4; 2) 0<RC<=2, PC<=3; 3) 2<RC<=5, PC<=2; 4 )RC>5, PC=1.
如图(9)所示,为合并操作的一个实例示意图。图8(a)所示,假设现有一个逻辑页LPN的四个子页LSPN 0~3分布在物理页PPN A和PPN B中。图8(b)所示,文件系统发出对该逻辑页的最后一个子页LSPN 3的写操作。当该LPN的都次数RC为0,将LSPN 3写入PV4KB队列中的物理页PPN C的空闲子页中,而LSPN 2仍然保存在PPN B中,该LPN关联的物理页的数量变为3。图8(c)所示,如果RC为4,PC不能大于2,将LSPN 2和LSPN 3写入到PV8KB队列中的物理页PPN D中。图8(d)所示,如果RC为10,将LSPN 0~3全部拷贝到FF队列中的物理页PPN E中。As shown in Figure (9), it is a schematic diagram of an example of a merge operation. As shown in FIG. 8( a ), it is assumed that four subpages LSPN 0 to 3 of an existing logical page LPN are distributed in physical pages PPN A and PPN B. As shown in FIG. 8( b ), the file system issues a write operation to the last subpage LSPN 3 of the logical page. When the number RC of the LPN is 0, write LSPN 3 into the free subpage of the physical page PPN C in the PV4KB queue, while LSPN 2 is still stored in PPN B, and the number of physical pages associated with the LPN becomes 3 . As shown in Figure 8(c), if RC is 4 and PC cannot be greater than 2, write LSPN 2 and LSPN 3 into the physical page PPN D in the PV8KB queue. As shown in Figure 8(d), if RC is 10, all LSPNs 0-3 are copied to the physical page PPN E in the FF queue.
(12)根据页映射表中该读请求的逻辑页号对应的物理页号,读出物理页中数据,然后过程结束。(12) According to the physical page number corresponding to the logical page number of the read request in the page mapping table, read the data in the physical page, and then the process ends.
实验结果表明,相比于普通页映射的闪存转换层方法,MGA-FTL有效地减少了闪存页容量增大带来的数据传输时间和闪存存储空间的浪费。在所测试的真实负载中,最多可以减少53%的请求平均响应时间,30%的固态硬盘写入放大和40%的闪存块擦除操作。The experimental results show that, compared with the common page-mapped flash translation layer method, MGA-FTL effectively reduces the data transmission time and the waste of flash storage space caused by the increase of flash page capacity. In the real load tested, it can reduce the average response time of requests by up to 53%, the write amplification of SSD by 30%, and the erase operation of flash block by 40%.
本领域的技术人员容易理解,以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。Those skilled in the art can easily understand that the above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention, All should be included within the protection scope of the present invention.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610623356.XA CN106293521B (en) | 2016-08-02 | 2016-08-02 | A kind of flash translation layer (FTL) management method that mapping granule is adaptive |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610623356.XA CN106293521B (en) | 2016-08-02 | 2016-08-02 | A kind of flash translation layer (FTL) management method that mapping granule is adaptive |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106293521A true CN106293521A (en) | 2017-01-04 |
CN106293521B CN106293521B (en) | 2019-04-12 |
Family
ID=57664190
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610623356.XA Active CN106293521B (en) | 2016-08-02 | 2016-08-02 | A kind of flash translation layer (FTL) management method that mapping granule is adaptive |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106293521B (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107256196A (en) * | 2017-06-13 | 2017-10-17 | 北京中航通用科技有限公司 | The caching system and method for support zero-copy based on flash array |
CN107632942A (en) * | 2017-08-29 | 2018-01-26 | 记忆科技(深圳)有限公司 | A kind of method that solid state hard disc realizes LBA rank TRIM orders |
CN107766001A (en) * | 2017-10-18 | 2018-03-06 | 成都索贝数码科技股份有限公司 | A kind of storage quota method based on groups of users |
CN107943719A (en) * | 2017-11-28 | 2018-04-20 | 杭州电子科技大学 | A kind of flash translation layer (FTL) control method based on requests classification |
TWI633434B (en) * | 2017-07-12 | 2018-08-21 | 宏碁股份有限公司 | Method, system, and computer readable medium for managing solid state drive |
CN108647157A (en) * | 2018-03-14 | 2018-10-12 | 深圳忆联信息系统有限公司 | A kind of mapping management process and solid state disk based on phase transition storage |
CN108829346A (en) * | 2018-05-28 | 2018-11-16 | 华中科技大学 | A kind of user's write request processing method for the solid state hard disk adapting to Hash memory pages difference |
CN109189348A (en) * | 2018-10-08 | 2019-01-11 | 华中科技大学 | The reading performance optimization method of storage system based on charge trap-type 3D TLC flash memory |
CN109446117A (en) * | 2018-09-06 | 2019-03-08 | 杭州电子科技大学 | A kind of solid state hard disk page grade flash translation layer (FTL) design method |
CN110727604A (en) * | 2019-08-26 | 2020-01-24 | 华为技术有限公司 | A data processing method and device |
CN111143313A (en) * | 2019-12-25 | 2020-05-12 | 成都三零嘉微电子有限公司 | Method for improving log block read-write performance of hybrid mapping algorithm |
CN112559386A (en) * | 2020-12-22 | 2021-03-26 | 深圳忆联信息系统有限公司 | Method and device for improving SSD performance, computer equipment and storage medium |
US10990536B2 (en) | 2018-09-17 | 2021-04-27 | Samsung Electronics Co., Ltd. | Memory controller, operating method of the memory controller, and storage device including the memory controller |
CN113434083A (en) * | 2020-03-23 | 2021-09-24 | 北京忆芯科技有限公司 | Storage device read command fusion method and device |
CN114327272A (en) * | 2021-12-28 | 2022-04-12 | 深圳大普微电子科技有限公司 | Data processing method, solid state disk controller and solid state disk |
WO2023045407A1 (en) * | 2021-09-26 | 2023-03-30 | 深圳大普微电子科技有限公司 | I/o request processing method and apparatus, device and readable storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1783032A (en) * | 2004-11-12 | 2006-06-07 | 国际商业机器公司 | Method and device for providing flexible sub-column to sub-row mapping for sub-page activation |
CN1795437A (en) * | 2002-10-28 | 2006-06-28 | 桑迪士克股份有限公司 | Method and apparatus for grouping pages within a block |
US20090106486A1 (en) * | 2007-10-19 | 2009-04-23 | Inha-Industry Partnership Institute | Efficient prefetching and asynchronous writing for flash memory |
CN102467455A (en) * | 2010-10-29 | 2012-05-23 | 三星电子株式会社 | Memory system, data storage device, user device and data management method thereof |
US20120239863A1 (en) * | 2007-10-24 | 2012-09-20 | Rao G R Mohan | Nonvolatile memory systems with embedded fast read and write memories |
CN102779096A (en) * | 2012-07-11 | 2012-11-14 | 山东华芯半导体有限公司 | Page, block and face-based three-dimensional flash memory address mapping method |
-
2016
- 2016-08-02 CN CN201610623356.XA patent/CN106293521B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1795437A (en) * | 2002-10-28 | 2006-06-28 | 桑迪士克股份有限公司 | Method and apparatus for grouping pages within a block |
CN1783032A (en) * | 2004-11-12 | 2006-06-07 | 国际商业机器公司 | Method and device for providing flexible sub-column to sub-row mapping for sub-page activation |
US20090106486A1 (en) * | 2007-10-19 | 2009-04-23 | Inha-Industry Partnership Institute | Efficient prefetching and asynchronous writing for flash memory |
US20120239863A1 (en) * | 2007-10-24 | 2012-09-20 | Rao G R Mohan | Nonvolatile memory systems with embedded fast read and write memories |
CN102467455A (en) * | 2010-10-29 | 2012-05-23 | 三星电子株式会社 | Memory system, data storage device, user device and data management method thereof |
CN102779096A (en) * | 2012-07-11 | 2012-11-14 | 山东华芯半导体有限公司 | Page, block and face-based three-dimensional flash memory address mapping method |
Cited By (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107256196A (en) * | 2017-06-13 | 2017-10-17 | 北京中航通用科技有限公司 | The caching system and method for support zero-copy based on flash array |
TWI633434B (en) * | 2017-07-12 | 2018-08-21 | 宏碁股份有限公司 | Method, system, and computer readable medium for managing solid state drive |
CN107632942A (en) * | 2017-08-29 | 2018-01-26 | 记忆科技(深圳)有限公司 | A kind of method that solid state hard disc realizes LBA rank TRIM orders |
CN107766001A (en) * | 2017-10-18 | 2018-03-06 | 成都索贝数码科技股份有限公司 | A kind of storage quota method based on groups of users |
CN107766001B (en) * | 2017-10-18 | 2021-05-25 | 成都索贝数码科技股份有限公司 | A storage quota method based on user groups |
CN107943719A (en) * | 2017-11-28 | 2018-04-20 | 杭州电子科技大学 | A kind of flash translation layer (FTL) control method based on requests classification |
CN108647157A (en) * | 2018-03-14 | 2018-10-12 | 深圳忆联信息系统有限公司 | A kind of mapping management process and solid state disk based on phase transition storage |
CN108829346B (en) * | 2018-05-28 | 2020-11-17 | 华中科技大学 | User writing request processing method of solid state disk adapting to flash memory page difference |
CN108829346A (en) * | 2018-05-28 | 2018-11-16 | 华中科技大学 | A kind of user's write request processing method for the solid state hard disk adapting to Hash memory pages difference |
CN109446117A (en) * | 2018-09-06 | 2019-03-08 | 杭州电子科技大学 | A kind of solid state hard disk page grade flash translation layer (FTL) design method |
CN109446117B (en) * | 2018-09-06 | 2023-02-28 | 杭州电子科技大学 | Design method for page-level flash translation layer of solid state disk |
US10990536B2 (en) | 2018-09-17 | 2021-04-27 | Samsung Electronics Co., Ltd. | Memory controller, operating method of the memory controller, and storage device including the memory controller |
CN109189348A (en) * | 2018-10-08 | 2019-01-11 | 华中科技大学 | The reading performance optimization method of storage system based on charge trap-type 3D TLC flash memory |
CN110727604A (en) * | 2019-08-26 | 2020-01-24 | 华为技术有限公司 | A data processing method and device |
CN111143313A (en) * | 2019-12-25 | 2020-05-12 | 成都三零嘉微电子有限公司 | Method for improving log block read-write performance of hybrid mapping algorithm |
CN113434083A (en) * | 2020-03-23 | 2021-09-24 | 北京忆芯科技有限公司 | Storage device read command fusion method and device |
CN112559386A (en) * | 2020-12-22 | 2021-03-26 | 深圳忆联信息系统有限公司 | Method and device for improving SSD performance, computer equipment and storage medium |
WO2023045407A1 (en) * | 2021-09-26 | 2023-03-30 | 深圳大普微电子科技有限公司 | I/o request processing method and apparatus, device and readable storage medium |
CN114327272A (en) * | 2021-12-28 | 2022-04-12 | 深圳大普微电子科技有限公司 | Data processing method, solid state disk controller and solid state disk |
Also Published As
Publication number | Publication date |
---|---|
CN106293521B (en) | 2019-04-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106293521A (en) | A kind of mapping granule adaptive flash translation layer (FTL) management method | |
US11237765B2 (en) | Data writing method and storage device | |
TWI647702B (en) | Memory controller, memory system, and method for managing data configuration in a memory | |
US10379782B2 (en) | Host managed solid state drivecaching using dynamic write acceleration | |
TWI399644B (en) | Block management method for a non-volatile memory | |
JP5674999B2 (en) | Block management configuration of SLC / MLC hybrid memory | |
US8332578B2 (en) | Method and system to improve the performance of a multi-level cell (MLC) NAND flash memory | |
TWI630540B (en) | Data storage device and method for operating non-volatile memory | |
US8954656B2 (en) | Method and system for reducing mapping table size in a storage device | |
CN106547703A (en) | A kind of FTL optimization methods based on block group structure | |
CN109471594B (en) | M L C flash memory read-write method | |
CN102591589A (en) | Data storage device, user device and data write method | |
CN103608782A (en) | Selective data storage in LSB and MSB pages | |
CN108829346B (en) | User writing request processing method of solid state disk adapting to flash memory page difference | |
KR101403922B1 (en) | Apparatus and method for data storing according to an access degree | |
CN112506445B (en) | Partition proportion self-adaptive adjustment method for homogeneous hybrid solid state disk | |
CN115373592B (en) | Apparatus, non-transitory computer readable medium, and method for page line stuffing data | |
CN105389135A (en) | Solid-state disk internal cache management method | |
CN102999441B (en) | Fine granularity memory access method | |
TW201508484A (en) | Data writing method, hard disc module, and data writing system | |
CN115203079A (en) | Method for writing data into solid state disk | |
CN104298615B (en) | Method for equalizing swap partition loss of memory | |
CN113590505B (en) | Address mapping method, solid state disk controller and solid state disk | |
EP4307129A1 (en) | Method for writing data into solid-state hard disk | |
KR20110070656A (en) | Method and apparatus for processing data in flash memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |