[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN108845957B - A permutation and write-back adaptive buffer management method - Google Patents

A permutation and write-back adaptive buffer management method Download PDF

Info

Publication number
CN108845957B
CN108845957B CN201810276887.5A CN201810276887A CN108845957B CN 108845957 B CN108845957 B CN 108845957B CN 201810276887 A CN201810276887 A CN 201810276887A CN 108845957 B CN108845957 B CN 108845957B
Authority
CN
China
Prior art keywords
write
buffer
block
list
read
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
CN201810276887.5A
Other languages
Chinese (zh)
Other versions
CN108845957A (en
Inventor
姚英彪
周杰
颜明博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Wanzhida Technology Co ltd
Original Assignee
Hangzhou Dianzi University
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 Hangzhou Dianzi University filed Critical Hangzhou Dianzi University
Priority to CN201810276887.5A priority Critical patent/CN108845957B/en
Publication of CN108845957A publication Critical patent/CN108845957A/en
Application granted granted Critical
Publication of CN108845957B publication Critical patent/CN108845957B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7205Cleaning, compaction, garbage collection, erase control

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

本发明提供一种置换和回写自适应的缓冲区管理方法,将缓冲区划分为缓存块记录表、写缓冲区和读缓冲区;其中,缓存块记录表用于记录同属一个逻辑数据块的数据页在缓冲区的位置信息,写缓冲区用于缓存响应写请求而被修改过的数据页,读缓冲区用于缓存仅响应读请求而未被修改的数据页。本发明在加载和剔除数据页时采用页级的管理方式,通过周期自适应调整读缓冲区阈值,能够感知负载读写特的变化,使得该管理方法在多种负载条件下都能得到较高的缓存命中率。同时,采用脏页自适应聚簇回写,能够感知FTL层垃圾回收的压力,自适应地调整回写策略,能够有效地减少因为FTL垃圾回收引发的额外块擦除次数,提升了固态硬盘的总体性能和使用寿命。

Figure 201810276887

The invention provides an adaptive buffer management method for replacement and write-back, which divides the buffer into a buffer block record table, a write buffer zone and a read buffer zone; wherein, the buffer block record table is used to record data belonging to the same logical data block. The location information of the data page in the buffer. The write buffer is used to cache the data pages that have been modified in response to the write request, and the read buffer is used to cache the data pages that have not been modified in response to the read request. The present invention adopts a page-level management method when loading and removing data pages, and adjusts the read buffer threshold value adaptively through a period, so that the change of the read and write characteristics of the load can be sensed, so that the management method can achieve higher performance under various load conditions. cache hit rate. At the same time, the use of dirty page adaptive cluster write-back can sense the pressure of FTL layer garbage collection and adaptively adjust the write-back strategy, which can effectively reduce the number of extra block erasures caused by FTL garbage collection and improve the performance of solid-state drives. Overall performance and longevity.

Figure 201810276887

Description

一种置换和回写自适应的缓冲区管理方法A permutation and write-back adaptive buffer management method

技术领域technical field

本发明属于基于闪存固态盘的固件优化方法设计技术领域,公开了一种置换和回写自适应的缓冲区管理方法。The invention belongs to the technical field of firmware optimization method design based on flash solid state disks, and discloses a buffer management method for replacement and write-back adaptive.

背景技术Background technique

东芝公司在1989年提出了一种新型的非易失性存储介质——NAND闪存(flashmemory),该存储介质因为其高性能,低功耗,抗震性好的优点被广泛应用于嵌入式设备,便携式电脑和企业级存储系统。本文提到的闪存即为NAND闪存。Toshiba proposed a new type of non-volatile storage medium - NAND flash memory in 1989, which is widely used in embedded devices because of its high performance, low power consumption and good shock resistance. Laptops and enterprise storage systems. The flash memory mentioned in this article is NAND flash memory.

缓冲区是存储系统组成中不可或缺的一部分,通过将频繁访问的数据保存在小容量的高速缓存中,可以有效改善存储系统的I/O性能。几十年来,研究人员针对以机械硬盘为主存储介质的存储系统提出了很多经典有效的缓冲区方法,例如FIFO(先进先出方法),LRU(最久未使用方法),LFU(最少使用置换方法),和LRFU(最近及最不频繁使用置换方法)等等。但是,固态硬盘的底层存储介质为闪存,闪存具有明显与传统磁介质不一样的特点,因而传统面向机械硬盘的缓存区管理算法在固态盘缓存区设计中难以适用。The buffer is an integral part of the storage system. By storing frequently accessed data in a small-capacity cache, the I/O performance of the storage system can be effectively improved. For decades, researchers have proposed many classical and effective buffer methods for storage systems with mechanical hard disks as the main storage medium, such as FIFO (first-in first-out method), LRU (longest unused method), LFU (least used replacement method) ), and LRFU (Recent and Least Frequently Used Permutation Method), etc. However, the underlying storage medium of solid-state drives is flash memory, which has distinct characteristics different from traditional magnetic media. Therefore, traditional cache management algorithms for mechanical hard disks are difficult to apply in the design of solid-state disk cache areas.

固态硬盘底层的NAND闪存有如下局限:1)闪存只提供读、写和擦除3种操作,且这三种操作性能不对称,读最快,写次之,擦除最慢;2)闪存是按页(page)、块(block)、平面(plane)的结构进行组织;页是读/写的最小单位,一般为2/4/8KB;块是擦除的最小单位,一个块一般包含64/128个页;3)闪存擦除后只能写一次,即所谓的erase-before-write,这造成闪存不支持原地更新;4)闪存每个存储单元的编程/擦除(P/E)次数有限,超过该P/E次数后,闪存存储数据不再可靠。The underlying NAND flash memory of solid-state drives has the following limitations: 1) Flash memory only provides three operations: read, write, and erase, and the performance of these three operations is asymmetric, with the fastest read, followed by write, and the slowest erase; 2) Flash memory It is organized according to the structure of page, block and plane; page is the smallest unit of read/write, generally 2/4/8KB; block is the smallest unit of erasure, and a block generally contains 64/128 pages; 3) The flash memory can only be written once after erasing, the so-called erase-before-write, which causes the flash memory to not support in-place updates; 4) Program/erase (P/ E) The number of times is limited. After the P/E times are exceeded, the data stored in the flash memory is no longer reliable.

针对闪存的读写不对称性,研究人员提出了一系列面向闪存的缓冲区方法,根据操作粒度可以区分为页级缓冲区方法和块级缓冲区方法。Aiming at the read-write asymmetry of flash memory, researchers have proposed a series of flash-oriented buffer methods, which can be divided into page-level buffer methods and block-level buffer methods according to the operation granularity.

页级缓冲区方法:大部分的改进方法都以LRU为基础,其中经典有效的方法有CFLRU(干净页优先最近最少置换)方法,CCF-LRU(冷干净页优先最近最少置换)方法,AD-LRU(自适应双队列最小冷区置换)方法。但这些方法都只考虑了缓冲区中置换页的状态,而忽视了当前访问负载的特性,导致各类方法只适用于特定的负载才能获得较优的性能。相对于页级缓冲区方法以单一页进行回写操作,块级缓冲区方法在回写操作时,以块为组织单位进行回写,能够有效重构访问模式,将随机的写请求转变为连续的写请求,从而能够有效地减少底层FTL的垃圾回收开销。Page-level buffer method: Most of the improved methods are based on LRU. The classic and effective methods include CFLRU (clean page first least recently replaced) method, CCF-LRU (cold clean page first least recently replaced) method, AD- LRU (Adaptive Double Queue Least Cold Region Replacement) method. However, these methods only consider the status of the replacement page in the buffer, while ignoring the characteristics of the current access load, resulting in various methods only applicable to specific loads to obtain better performance. Compared with the page-level buffer method, which uses a single page for the write-back operation, the block-level buffer method uses the block as the organizational unit to perform the write-back operation during the write-back operation, which can effectively reconstruct the access mode and convert random write requests into continuous write requests. The write request can effectively reduce the garbage collection overhead of the underlying FTL.

块级缓冲区方法:以BPLRU(块填充最近最少置换)方法和FAB(最大块优先置换)方法为基础,衍生了PUD-LRU(Predicted average Update Distance aware LRU)方法,CLC(Cold and Largest Cluster)方法。但这些块级缓冲区方法,都只缓存写请求,在以读请求为主的负载环境下,其性能表现不佳。此外,这些块级缓存区方法在脏页回写时,对同一回写块中数据页的冷热不加以区分,导致部分热数据页过早被回写,同时回写时无法感知底层闪存转化层(Flash Translation Layer,FTL)垃圾回收的压力,采用单一的回写策略,导致FTL层额外的垃圾回收开销。Block-level buffer method: Based on the BPLRU (block filling least recently replaced) method and the FAB (largest block first replacement) method, the PUD-LRU (Predicted average Update Distance aware LRU) method is derived, and the CLC (Cold and Largest Cluster) method is derived. method. However, these block-level buffer methods only cache write requests, and their performance is poor in a load environment dominated by read requests. In addition, these block-level cache methods do not distinguish between hot and cold data pages in the same write-back block when dirty pages are written back, resulting in some hot data pages being written back prematurely, and the underlying flash conversion cannot be sensed during write-back. Layer (Flash Translation Layer, FTL) garbage collection pressure, using a single write-back strategy, resulting in additional garbage collection overhead of the FTL layer.

发明内容SUMMARY OF THE INVENTION

针对上述现有技术中存在的不足,本发明公布一种置换和回写自适应的缓冲区管理方法,不仅能根据负载读写特性动态调整置换策略提高缓冲区读写命中率,而且能够在聚簇回写时保留热数据页和根据闪存转换层(FTL)垃圾回收压力调整回写策略减少底层闪存块的擦除次数。Aiming at the above-mentioned deficiencies in the prior art, the present invention discloses an adaptive buffer management method for replacement and write-back, which can not only dynamically adjust the replacement strategy according to the load reading and writing characteristics to improve the buffer read and write hit rate, but also can improve the buffer read and write hit rate during aggregation. Retains hot data pages during cluster write-back and adjusts the write-back strategy according to Flash Translation Layer (FTL) garbage collection pressure to reduce the number of erasures of underlying flash blocks.

为实现本发明的目的,本发明采用以下技术方案:For realizing the purpose of the present invention, the present invention adopts the following technical solutions:

一种置换和回写自适应的缓冲区管理方法,所述缓冲区划分为缓存块记录表、写缓冲区和读缓冲区;所述缓存块记录表用于记录同属一个逻辑数据块的数据页在缓冲区的位置信息,所述写缓冲区用于缓存响应写请求而被修改过的数据页,所述读缓冲区用于缓存仅响应读请求而未被修改的数据页;An adaptive buffer management method for replacement and write-back, wherein the buffer is divided into a cache block record table, a write buffer and a read buffer; the cache block record table is used to record data pages belonging to the same logical data block The location information of the buffer, the write buffer is used to cache the data pages that have been modified in response to the write request, and the read buffer is used to cache the unmodified data pages that only respond to the read request;

所述管理方法包括以下步骤:The management method includes the following steps:

S1,当访问请求到来,查询缓存块记录表是否包含请求对应的缓存块信息,若存在,执行S2,否则,执行S4;S1, when the access request arrives, check whether the cache block record table contains the cache block information corresponding to the request, if so, execute S2, otherwise, execute S4;

S2,查询缓存块记录表中是否存在指向请求数据页的位置指针,若存在,则执行S3,否则,执行S5;S2, query whether there is a location pointer pointing to the requested data page in the cache block record table, if so, execute S3, otherwise, execute S5;

S3,将命中数据页迁移到相应缓冲区的MRU位置,更新对应缓存块记录表中的位置指针列表;之后执行S8;S3, migrate the hit data page to the MRU position of the corresponding buffer, and update the position pointer list in the corresponding cache block record table; then execute S8;

S4,向缓存块记录表中添加对应的记录块信息,同时初始化该记录块的所有信息,之后执行S5;S4, add the corresponding record block information to the cache block record table, initialize all the information of the record block at the same time, and then execute S5;

S5,判定当前缓冲区是否满;若满,执行S6,否则,执行S7;S5, determine whether the current buffer is full; if it is full, execute S6, otherwise, execute S7;

S6,比较读缓冲区与目标阈值Tau的大小;若大于,则选择读缓冲区的LRU位置的数据页剔除,否则,选择写缓冲区的LRU位置的数据页作为剔除项并执行自适应聚簇回写;更新剔除数据页对应的记录块信息,之后执行S7;S6, compare the size of the read buffer with the target threshold Tau; if it is greater than the size of the read buffer, select the data page at the LRU position of the read buffer to be culled, otherwise, select the data page at the LRU position of the write buffer as the culling item and perform adaptive clustering Write back; update the record block information corresponding to the excluded data page, and then execute S7;

S7,将缺失的请求数据页加载入对应的缓冲区,同时将指向该数据页的位置添加至对应的缓存块记录表的位置指针列表中,并更新对应的记录块信息;之后执行S8;S7, load the missing request data page into the corresponding buffer zone, add the position pointing to the data page to the position pointer list of the corresponding cache block record table, and update the corresponding record block information; then execute S8;

S8,启动置换策略阈值调整机制,对阈值Tau进行调整;最后,结束本次请求的处理。S8, start the replacement policy threshold adjustment mechanism to adjust the threshold Tau; finally, end the processing of this request.

进一步地,所述读缓冲区和写缓冲区采用LRU管理队列,当缓冲区命中请求和加载新数据页时,将命中请求和加载新数据页迁移到队列的MRU位置。Further, the read buffer and the write buffer use LRU to manage the queue, and when the buffer hits the request and loads the new data page, the hit request and the new data page loaded are migrated to the MRU position of the queue.

进一步地,所述缓存块记录表中,一个记录块的信息包含:缓存块编号BlkNum、缓冲区中同属该记录块的数据页个数BlkSize、同属该记录块的干净页位置指针列表C-list-index、同属该记录块的脏页位置指针列表D-list-index。Further, in the described cache block record table, the information of a record block includes: the cache block number BlkNum, the number BlkSize of the data pages that belong to the record block in the buffer, and the clean page position pointer list C-list that belongs to the record block. -index, the list of dirty page location pointers D-list-index that belong to the same record block.

进一步地,所述步骤S3中,更新对应缓存块记录表中的位置指针列表具体为:Further, in the step S3, updating the position pointer list in the corresponding cache block record table is specifically:

从C-list-index或D-list-index列表中剔除指向该迁移数据页的旧位置指针,之后判断迁入位置,若迁入读缓冲区,则将位置指针存入对应的缓存块中C-list-index;否则,将数据页的位置指针存入记录块中的D-list-index。Remove the old position pointer pointing to the migrated data page from the C-list-index or D-list-index list, and then determine the migration position. If the read buffer is moved into the read buffer, the position pointer is stored in the corresponding cache block C -list-index; otherwise, store the location pointer of the data page in D-list-index in the record block.

进一步地,所述步骤S6中,所述更新剔除数据页对应的记录块信息,具体为:Further, in the step S6, the updating and eliminating the record block information corresponding to the data page is specifically:

从C-list-index或D-list-index列表中找到指向该剔除数据页的旧位置指针并剔除,并更新对应的记录块的BlkSize=BlkSize-1。Find the old position pointer pointing to the culled data page from the C-list-index or D-list-index list and cull it, and update BlkSize=BlkSize-1 of the corresponding record block.

进一步地,所述步骤S7中,所述将指向该数据页的位置添加至对应的缓存块记录表的位置指针列表中,并更新对应的记录块信息,具体为:Further, in the step S7, the position pointing to the data page is added to the position pointer list of the corresponding cache block record table, and the corresponding record block information is updated, specifically:

判断请求类型,若为读请求,则将新添加数据页的位置指针存入对应的缓存记录块中C-list-index;否则,将数据页的位置指针存入记录块中的D-list-index,之后更新对应的记录块的BlkSize=BlkSize+1。Determine the request type. If it is a read request, store the location pointer of the newly added data page into the C-list-index in the corresponding cache record block; otherwise, store the location pointer of the data page into the D-list-index in the record block. index, and then update the BlkSize=BlkSize+1 of the corresponding record block.

进一步地,所述步骤S6中,所述自适应聚簇回写的流程为:Further, in the step S6, the process of the adaptive cluster write-back is:

S61,选择写缓冲区LRU位置的数据页作为剔除对象,并查询该数据页对应的缓存记录块中D-list-index信息,之后执行S62;S61, select the data page at the LRU position of the write buffer as the culling object, and query the D-list-index information in the cache record block corresponding to the data page, and then execute S62;

S62,依次读取D-list-index的位置指针指向的数据页,并根据位于缓存队列前半部分为热数据的原则,对所述D-list-index的位置指针指向的数据页进行判断,并将判别为热的数据页加入保留集合Ф,之后执行S63;S62, sequentially read the data pages pointed to by the position pointer of the D-list-index, and according to the principle that the first half of the cache queue is hot data, determine the data pages pointed to by the position pointer of the D-list-index, and Add the data pages judged to be hot to the reserved set Ф, and then execute S63;

S63,计算当前写入放大系数

Figure BDA0001613820660000031
S63, calculate the current write amplification factor
Figure BDA0001613820660000031

根据当前写入放大系数W计算当前回写阈值

Figure BDA0001613820660000032
Calculate the current writeback threshold according to the current write amplification factor W
Figure BDA0001613820660000032

其中,Bw为固定周期内缓存区回写次数的统计值;Fw为固定周期内闪存写操作次数统计值;BlkMaxSize为所述逻辑数据块大小,t为常系数;Among them, Bw is the statistical value of the number of write-backs in the cache area in a fixed period; Fw is the statistical value of the number of flash write operations in a fixed period; BlkMaxSize is the size of the logical data block, and t is a constant coefficient;

之后执行S64;Then execute S64;

S64,计算填补页数E=BlkMaxSize-N,N为当前记录块在写缓冲区中的数据页个数,之后比较比较E和Th的大小;若E≤Th,则执行S65;否则,执行S66;S64, calculate the number of filling pages E=BlkMaxSize-N, where N is the number of data pages of the current record block in the write buffer, then compare and compare the sizes of E and Th; if E≤Th, execute S65; otherwise, execute S66 ;

S65,启用页填充,从底层闪存中读取E个填补页和回写的脏页组成整个数据块回写入底层闪存;之后执行S67;S65, enable page filling, read E filling pages from the underlying flash memory and write-back dirty pages to form an entire data block and write back to the underlying flash memory; then execute S67;

S66,不启用页填充,将D-list-index中的脏页全部回写入底层闪存,执行S67;S66, do not enable page filling, write all the dirty pages in the D-list-index back into the underlying flash memory, and execute S67;

S67,将集合Ф中的数据页全部移入到读缓冲区,同时删除原数据块的缓存块记录表中的D-list-index的位置信息,同时将转移后的新位置指针存入C-list-index;最后结束本次聚簇回写操作。S67: Move all the data pages in the set Ф into the read buffer, delete the location information of the D-list-index in the cache block record table of the original data block, and store the transferred new location pointer in the C-list at the same time -index; finally end the cluster write-back operation.

进一步地,所述步骤S8中,所述启动置换策略阈值调整机制,对阈值Tau进行调整,具体调整流程为:Further, in the step S8, the threshold adjustment mechanism of the replacement strategy is activated to adjust the threshold Tau, and the specific adjustment process is as follows:

S81,判断当前请求是否为命中,若是,则执行S82,否则,执行S83;S81, determine whether the current request is a hit, if so, execute S82, otherwise, execute S83;

S82,判断请求类型和命中区域,若读缓冲区读命中,则CRH加1;若读缓冲区写命中,则CWH加1;若写缓冲区读命中,则DRH加1;若写缓冲区写命中,则CRH加1;最后执行S83;S82, judge the request type and the hit area, if the read buffer hits the read, then CRH increases by 1; if the read buffer hits the write, then the CWH increases by 1; if the write buffer hits the read, the DRH increases by 1; if the write buffer writes If it hits, then CRH is incremented by 1; finally, S83 is executed;

S83,更新当前的TCount,即TCount=TCount+1,同时更新统计值Bw和统计值Fw,之后执行S84;S83, update the current TCount, that is, TCount=TCount+1, and update the statistical value Bw and the statistical value Fw at the same time, and then execute S84;

S84,判断TCount是否达到阈值更新周期CycleTime,若是,则执行S85,否则,结束阈值Tau的本次更新操作;S84, determine whether TCount reaches the threshold update cycle CycleTime, if so, execute S85, otherwise, end the current update operation of the threshold Tau;

其中,CRH为读缓冲区的读命中统计变量,CWH为读缓冲区的写命中统计变量;DRH为写缓冲区的读命中统计变量,DWH为写缓冲区的写命中统计变量;TCount为当前请求操作计数;CycleTime为阈值更新周期;Among them, CRH is the read hit statistics variable of the read buffer, CWH is the write hit statistics variable of the read buffer; DRH is the read hit statistics variable of the write buffer, DWH is the write hit statistics variable of the write buffer; TCount is the current request Operation count; CycleTime is the threshold update period;

S85,计算目标写缓冲区单位增益DR,目标读缓冲区单位增益CR:S85, calculate the unity gain DR of the target write buffer and the unity gain CR of the target read buffer:

Figure BDA0001613820660000041
Figure BDA0001613820660000041

其中BufSize为读写总缓冲区的大小,Tau’为更新前的阈值,Where BufSize is the size of the total buffer for reading and writing, Tau' is the threshold before updating,

Cr,Cw为归一计算得到读写时延代价系数:Cr and Cw are the normalized calculation to obtain the read and write delay cost coefficient:

Figure BDA0001613820660000042
Figure BDA0001613820660000042

其中,ReadDelay和WriteDelay分别为周期内读延迟和写延迟;之后执行S86。Among them, ReadDelay and WriteDelay are the read delay and write delay in the cycle respectively; then execute S86.

S86,更新阈值Tau:S86, update the threshold Tau:

Figure BDA0001613820660000043
Figure BDA0001613820660000043

同时更新周期缓冲区回写次数统计值Bw=0,周期闪存写操作次数统计值Fw=0,周期计数值TCount=1,最后结束阈值Tau的本次更新操作。At the same time, the periodical buffer write-back count Bw=0, the period flash write-back count Fw=0, and the period count TCount=1 are updated, and the current update operation of the threshold Tau is finally ended.

本发明与现有技术相比,有益效果是:Compared with the prior art, the present invention has the following beneficial effects:

本发明提出的置换和回写自适应的缓冲区管理方法,在加载和剔除数据页时采用页级的管理方式,并通过周期自适应调整读缓冲区阈值,能够感知负载读写特的变化,使得该管理方法在多种负载条件下都能得到较高的缓存命中率。其次,本发明中提出的管理方法在脏页聚簇回写时,能够感知FTL层垃圾回收的压力,自适应地调整回写策略,能够有效的减少因为FTL垃圾回收引发的额外块擦除次数,提升固态硬盘的总体性能和使用寿命。The replacement and write-back adaptive buffer management method proposed by the present invention adopts a page-level management method when loading and culling data pages, and adjusts the read buffer threshold value adaptively through cycles, so as to be able to sense the change of load read and write characteristics, Therefore, the management method can obtain a higher cache hit rate under various load conditions. Secondly, the management method proposed in the present invention can sense the pressure of garbage collection at the FTL layer when the dirty page is clustered and write back, adjust the write-back strategy adaptively, and can effectively reduce the number of extra block erasures caused by FTL garbage collection. , to improve the overall performance and service life of the SSD.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术的技术方案,下面将对实施例或现有技术描述所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the For some embodiments of the invention, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1:本发明的缓存块记录表示意图。Fig. 1 is a schematic diagram of the cache block record table of the present invention.

图2:本发明的读写缓冲区队列结构示意图。Figure 2: Schematic diagram of the structure of the read-write buffer queue of the present invention.

图3:本发明的自适应聚簇回写流程图。Figure 3: The adaptive cluster write-back flow chart of the present invention.

图4:本发明的周期阈值调整流程图。Figure 4: The flow chart of the period threshold adjustment of the present invention.

图5:本发明的请求处理总流程图。Figure 5: General flow chart of request processing of the present invention.

图6:本发明的实例处理过程图。Figure 6: An example process diagram of the present invention.

具体实施方式Detailed ways

为了使本领域技术人员更好地理解本发明的技术方案,下面将结合附图以及具体的实施方式,对本发明进行详细地介绍说明。In order to make those skilled in the art better understand the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

为了对发明进一步详细说明,首先需要给出本发明相关概念的定义:In order to further describe the invention in detail, it is first necessary to provide the definitions of the related concepts of the present invention:

缓存数据页:缓存的基本读写单位,与闪存的物理页大小一致。Cache data page: The basic read and write unit of the cache, which is consistent with the physical page size of the flash memory.

缓存数据块:由数据请求页地址对物理块大小进行除法运算,得到商一致的数据页组成的集合,该数据块的最大包含页数和底层物理块的包含物理页数一致。Cache data block: The physical block size is divided by the data request page address to obtain a set of data pages with consistent quotients. The maximum number of pages contained in the data block is consistent with the number of physical pages contained in the underlying physical block.

逻辑页地址:主机I/O请求P按照其文件系统的标识的逻辑地址编号(LogicalPage Number,LPN)。Logical page address: the logical address number (Logical Page Number, LPN) of the host I/O request P according to the identification of its file system.

逻辑块号:也是缓存数据块的编号(Block Number,BlkNum),指定请求P的BlkNum为其LPN除以数据块最大页数得到的商。Logical block number: It is also the number of the cache data block (Block Number, BlkNum). The BlkNum of the specified request P is the quotient obtained by dividing the LPN by the maximum number of pages of the data block.

本发明提出的一种置换和回写自适应的缓冲区管理方法,将缓存划分为三个部分:缓存块记录表,写缓冲区(Write Buffer)和读缓冲区(Read Buffer)。The invention proposes a replacement and write-back adaptive buffer management method, which divides the cache into three parts: a cache block record table, a write buffer (Write Buffer) and a read buffer (Read Buffer).

缓存块记录表用来记录同属于一个数据块的不同数据页在缓冲区的位置和状态。缓存块记录表通过记录不同数据页的位置指针,加速了请求数据页的查询,更新,回写的操作。The cache block record table is used to record the position and status of different data pages belonging to the same data block in the buffer. By recording the location pointers of different data pages, the cache block record table speeds up the query, update, and write-back operations of requesting data pages.

如图1所示,缓存块记录表中,记录块的信息具体包括:当前的缓存块编号BlkNum,当前缓冲区中同属该记录块的数据页个数BlkSize,同属该记录块的干净页位置指针列表C-list-index,同属该记录块的脏页位置指针列表D-list-index。所述的缓存块的大小和实际底层的物理块大小一致,即包含的数据页个数相同,其大小值为BlkMaxSize。对应数据页的逻辑页地址(Logical Page Number,LPN)除BlkMaxSize,所得结果记为其所属的缓存块的编号,相应的余数为其缓存块的偏移量。As shown in Figure 1, in the cache block record table, the information of the record block specifically includes: the current cache block number BlkNum, the number of data pages BlkSize that belong to the same record block in the current buffer, and the clean page position pointer that belongs to the same record block. List C-list-index, which also belongs to the dirty page location pointer list D-list-index of the record block. The size of the cache block is consistent with the size of the actual underlying physical block, that is, the number of data pages contained is the same, and its size is BlkMaxSize. The logical page address (LPN) of the corresponding data page is divided by BlkMaxSize, and the result obtained is recorded as the number of the cache block to which it belongs, and the corresponding remainder is the offset of the cache block.

写缓冲区用于缓存响应写请求后发生修改后的数据页(脏页),该缓冲区的数据页依据LRU原则形成队列进行管理;同时该缓冲区内的数据页又分冷热,前半部分的数据页为热页,后半部的数据页为冷页。The write buffer is used to cache the modified data pages (dirty pages) after responding to the write request. The data pages in the buffer are managed by forming a queue according to the LRU principle; at the same time, the data pages in the buffer are divided into hot and cold. The data pages are hot pages, and the data pages in the second half are cold pages.

读缓冲区用于缓存仅响应读请求未发生修改的数据页(干净页),该缓冲区的数据页同样采用LRU队列管理。该缓冲区中的数据页响应写请求后将被迁入写缓冲区,同样写缓冲区的热数据页发生回写也会被迁入读缓冲区中。The read buffer is used to cache only unmodified data pages (clean pages) in response to read requests, and the data pages of this buffer are also managed by LRU queues. The data pages in the buffer will be moved into the write buffer after responding to the write request, and the hot data pages in the write buffer will also be moved into the read buffer when the write-back occurs.

如图2所示,读写缓冲区的队列结构中,两种缓冲区的队列大小会因为在置换过程中动态选择置换对象而发生变化。As shown in Figure 2, in the queue structure of the read and write buffers, the queue sizes of the two buffers will change due to the dynamic selection of the replacement object during the replacement process.

对读写缓冲区的命中情况,底层读写延迟,缓冲区回写次数,底层数据页更新写次数进行周期的统计。Periodic statistics are performed on the hits of the read and write buffers, the underlying read and write delays, the number of buffer writebacks, and the number of updates and writes of the underlying data pages.

将固定观察周期内的写缓冲区的读命中统计变量记为DRH,写缓冲区的写命中统计变量记为DWH;读缓冲区的读命中统计变量记为CRH,读缓冲区的写命中统计变量记为CWH;该周期内缓存区回写次数记为Bw,该周期内闪存写操作次数记为Fw;该周期内写延迟记为WriteDelay,读延迟记为ReadDelay。The read hit statistical variable of the write buffer in the fixed observation period is recorded as DRH, and the write hit statistical variable of the write buffer is recorded as DWH; the read hit statistical variable of the read buffer is recorded as CRH, and the write hit statistical variable of the read buffer is recorded as DRH. It is recorded as CWH; the number of cache write-backs in this cycle is recorded as Bw, the number of flash write operations in this cycle is recorded as Fw; the write delay in this cycle is recorded as WriteDelay, and the read delay is recorded as ReadDelay.

在选择写缓冲区的数据页作为置换对象并回写入闪存时,将触发自适应聚簇回写机制。The adaptive cluster writeback mechanism is triggered when the data page of the write buffer is selected as the replacement object and written back to flash.

如图3所示,自适应聚簇回写机制中,由置换数据页确定回写缓存块,借助该缓存块记录中的D-list-index的记录信息确定回写的脏页集合同时识别保留热脏页。在聚簇回写过程中,根据当前的写入放大系数动态选择是否采用页填充。其操作流程如下:As shown in Figure 3, in the adaptive cluster write-back mechanism, the write-back cache block is determined by the replacement data page, and the set of write-back dirty pages is determined with the help of the record information of the D-list-index in the cache block record, and the reserved pages are identified and reserved. Hot dirty pages. In the cluster write-back process, whether to use page filling is dynamically selected according to the current write amplification factor. Its operation process is as follows:

S61,选择写缓冲区LRU位置的数据页V作为剔除对象,并查询该数据页对应的缓存记录块中D-list-index信息,之后执行S62。S61, select the data page V at the LRU position of the write buffer as the object to be eliminated, and query the D-list-index information in the cache record block corresponding to the data page, and then execute S62.

S62,依次读取D-list-index的位置指针指向的数据页,并根据位于缓存队列前半部分为热数据的原则,对这些数据页进行判断,并将判别为热的数据页加入保留集合Ф,之后执行S63。S62: Read the data pages pointed to by the location pointer of D-list-index in turn, and judge these data pages according to the principle that the first half of the cache queue is hot data, and add the data pages judged to be hot to the reserved set Ф , and then execute S63.

S63,计算当前回写阈值

Figure BDA0001613820660000061
其中,
Figure BDA0001613820660000062
之后执行S64。S63, calculate the current write-back threshold
Figure BDA0001613820660000061
in,
Figure BDA0001613820660000062
After that, S64 is executed.

S64,计算填补页数E=BlkMaxSize-N,N为当前记录块在写缓冲区中的数据页个数,之后比较比较E和Th的大小;若E≤Th,则执行S65;否则,执行S66。S64, calculate the number of filling pages E=BlkMaxSize-N, where N is the number of data pages of the current record block in the write buffer, then compare and compare the sizes of E and Th; if E≤Th, execute S65; otherwise, execute S66 .

S65,启用页填充,从底层闪存中读取E个填补页和回写的脏页组成整个数据块回写入底层闪存,之后执行S67。S65, enable page filling, read E filling pages from the underlying flash memory and write back dirty pages to form an entire data block and write back to the underlying flash memory, and then execute S67.

S66,不启用页填充,将D-list-index中的脏页全部回写入底层闪存,执行S67。S66, do not enable page filling, write back all the dirty pages in the D-list-index to the underlying flash memory, and execute S67.

S67,将集合Ф中的数据页全部移入到读缓冲区,同时删除原数据块的缓存块记录表中的D-list-index的位置信息,同时将转移后的新位置指针存入C-list-index,最后结束本次聚簇回写操作。S67: Move all the data pages in the set Ф into the read buffer, delete the location information of the D-list-index in the cache block record table of the original data block, and store the transferred new location pointer in the C-list at the same time -index, and finally end the cluster write-back operation.

本发明提出的管理方法中,在置换数据页时,通过比较阈值Tau(当前目标读缓冲区大小)和当前读缓冲区大小,选择置换缓冲对象。其阈值Tau会综合当前读写缓冲区的命中情况和底层的读写延迟,进行周期性的调整,阈值调整机制如图4所示,流程如下:In the management method proposed by the present invention, when replacing a data page, the replacement buffer object is selected by comparing the threshold value Tau (current target read buffer size) with the current read buffer size. The threshold Tau will be adjusted periodically based on the hits of the current read and write buffers and the underlying read and write delays. The threshold adjustment mechanism is shown in Figure 4. The process is as follows:

S81,判断当前请求是否为命中,若是,则执行S82,否则,执行S83;S81, determine whether the current request is a hit, if so, execute S82, otherwise, execute S83;

S82,判断请求类型和命中区域,若读缓冲区读命中,则CRH加1;若读缓冲区写命中,则CWH加1;若写缓冲区读命中,则DRH加1;若写缓冲区写命中,则CRH加1;最后执行S83;S82, judge the request type and the hit area, if the read buffer hits the read, then CRH increases by 1; if the read buffer hits the write, then the CWH increases by 1; if the write buffer hits the read, the DRH increases by 1; if the write buffer writes If it hits, then CRH is incremented by 1; finally, S83 is executed;

S83,更新当前的TCount,即TCount=TCount+1,同时更新统计值Bw和统计值Fw,之后执行S84;S83, update the current TCount, that is, TCount=TCount+1, update the statistical value Bw and the statistical value Fw at the same time, and then execute S84;

S84,判断TCount是否达到阈值更新周期CycleTime,若是,则执行S85,否则,结束本次阈值更新操作;S84, determine whether TCount reaches the threshold update cycle CycleTime, if so, execute S85, otherwise, end this threshold update operation;

其中,CRH为读缓冲区的读命中统计变量,CWH为读缓冲区的写命中统计变量;DRH为写缓冲区的读命中统计变量,DWH为写缓冲区的写命中统计变量;TCount为当前请求操作计数;CycleTime为阈值更新周期;Among them, CRH is the read hit statistics variable of the read buffer, CWH is the write hit statistics variable of the read buffer; DRH is the read hit statistics variable of the write buffer, DWH is the write hit statistics variable of the write buffer; TCount is the current request Operation count; CycleTime is the threshold update period;

S85,计算目标写缓冲区单位增益DR,目标读缓冲区单位增益CR:S85, calculate the unity gain DR of the target write buffer and the unity gain CR of the target read buffer:

Figure BDA0001613820660000071
Figure BDA0001613820660000071

其中BufSize为读写总缓冲区的大小,Tau’为更新前的阈值,Where BufSize is the size of the total buffer for reading and writing, Tau' is the threshold before updating,

Cr,Cw为归一计算得到读写时延代价系数:Cr and Cw are the normalized calculation to obtain the read and write delay cost coefficient:

Figure BDA0001613820660000072
Figure BDA0001613820660000072

其中,ReadDelay和WriteDelay分别为周期内读延迟和写延迟;之后执行S86。Among them, ReadDelay and WriteDelay are the read delay and write delay in the cycle respectively; then execute S86.

S86,更新阈值Tau:S86, update the threshold Tau:

Figure BDA0001613820660000073
Figure BDA0001613820660000073

同时更新周期缓冲区回写次数统计值Bw=0,周期闪存写操作次数统计值Fw=0,周期计数值TCount=1,最后结束阈值Tau的本次更新操作。At the same time, the periodical buffer write-back count Bw=0, the period flash write-back count Fw=0, and the period count TCount=1 are updated, and the current update operation of the threshold Tau is finally ended.

如图5所示,本发明的请求处理总流程,包含如下步骤:As shown in Figure 5, the general flow of request processing of the present invention includes the following steps:

S1,当一个请求P到达时,根据请求P的LPN号换算找到对应的缓存块编号pBlkNum,查询缓存块记录表中是否存在该缓存块编号,若存在,则执行S2,否则,执行S4;S1, when a request P arrives, find the corresponding cache block number pBlkNum according to the LPN number conversion of the request P, query whether the cache block number exists in the cache block record table, if so, execute S2, otherwise, execute S4;

S2,遍历该缓存块记录表项中的位置指针,查询请求P是否存在缓冲区中,若是,则执行S3,否则,执行S5;S2, traverse the location pointer in the cache block record entry, query whether the request P exists in the buffer, if so, execute S3, otherwise, execute S5;

S3,判读请求数据页所在缓冲区位置,将命中的数据页移动至对应缓冲区的MRU位置,同时更新对应缓存块记录表项中的位置指针列表,将旧的指向该数据页的指针剔除,将指向该数据页位置的新指针存入;之后执行S8;S3, interpret the buffer position where the requested data page is located, move the hit data page to the MRU position of the corresponding buffer, update the position pointer list in the corresponding cache block record entry, and remove the old pointer to the data page, Store a new pointer to the location of the data page; then execute S8;

S4,向缓存块记录表中添加编号pBlkNum缓存块表项信息,初始化该表项的BlkNum=pBlkNum,BlkSize=0,D-list-index和C-list-index为空,之后执行S5;S4, add the number pBlkNum cache block entry information to the cache block record table, initialize BlkNum=pBlkNum, BlkSize=0 of the entry, D-list-index and C-list-index are empty, then execute S5;

S5,判断当前缓冲区是否满,若满,则执行S6,否则执行S7;S5, judge whether the current buffer is full, if it is full, execute S6, otherwise execute S7;

S6,比较当前的读缓冲区大小和阈值Tau的大小,若大于,则选择读缓冲区的LRU位置的数据页进行剔除;否则,选择写缓冲区的LRU位置的数据页作为置换缓冲区,并执行自适应聚簇回写机制;从C-list-index或D-list-index列表中找到指向该剔除数据页的旧位置指针并剔除,并更新对应的记录块的BlkSize=BlkSize-1;之后,执行S7;S6, compare the size of the current read buffer with the size of the threshold Tau, if it is greater than the size of the read buffer, select the data page at the LRU position of the read buffer to be eliminated; otherwise, select the data page at the LRU position of the write buffer as the replacement buffer, and Execute the adaptive cluster write-back mechanism; find the old position pointer pointing to the culled data page from the C-list-index or D-list-index list and cull it, and update the corresponding record block's BlkSize=BlkSize-1; then , execute S7;

S7,将缺失的请求数据页从闪存读入缓冲区,同时判读其请求类型;若为读请求,则将数据页加载到读缓冲区中,同时将指向该数据页的位置的指针存入缓存块记录的C-list-index中;否则将数据页加载到写缓冲区,同时将位置指针存入对应缓存块记录的D-list-index中;之后更新缓存记录表中的BlkSize=BlkSize+1,之后,执行S8;S7, read the missing requested data page from the flash memory into the buffer, and at the same time interpret its request type; if it is a read request, load the data page into the read buffer, and store the pointer to the location of the data page into the cache at the same time In the C-list-index of the block record; otherwise, load the data page into the write buffer, and store the location pointer in the D-list-index of the corresponding cache block record; then update the cache record table BlkSize=BlkSize+1 , after that, execute S8;

S8,启动周期阈值Tau,对阈值Tau进行周期调整,最后,结束本次请求的处理。S8 , start the period threshold Tau, perform period adjustment on the threshold value Tau, and finally, end the processing of this request.

所述步骤S3中,更新对应缓存块记录表中的位置指针列表具体为:In the step S3, updating the position pointer list in the corresponding cache block record table is specifically:

S31,判读请求数据页所在缓冲区位置,若为写缓冲区,则执行S32;若为读缓冲区,则执行S33;S31, interpret the buffer position where the requested data page is located, if it is a write buffer, execute S32; if it is a read buffer, execute S33;

S32,将命中的数据页移动至写缓冲区的MRU位置,同时更新对应缓存块记录表项中的D-list-index,将旧的指向该数据页的指针剔除,将指向该数据页位置的新指针存入D-list-index;之后执行S8;S32, move the hit data page to the MRU position of the write buffer, update the D-list-index in the corresponding cache block record entry at the same time, remove the old pointer pointing to the data page, and replace the pointer pointing to the data page position The new pointer is stored in D-list-index; then execute S8;

S33,将命中的数据页移至读缓冲区的MRU位置,同时更新相应的C-list-index,将旧的指向该数据页的指针剔除,将新的位置指针存入C-list-index;之后执行S8。S33, move the hit data page to the MRU position of the read buffer, update the corresponding C-list-index at the same time, remove the old pointer to the data page, and store the new position pointer into the C-list-index; Then execute S8.

为了对本发明的管理方法的处理流程进行进一步说明,结合具体的一组实际请求处理实例进行说明,该实例处理过程如图6所示。In order to further illustrate the processing flow of the management method of the present invention, the description will be given in conjunction with a specific set of actual request processing examples, and the processing process of the example is shown in FIG. 6 .

在本实例中,数据块大小为4个数据页,缓冲区的大小为10个数据页,读写延迟时延比固定为W/R=4/1,写入放大系数恒定为W=1.5,阈值更新周期为10,当前的周期计数值TCount=1,阈值Tau初始值为5.In this example, the size of the data block is 4 data pages, the size of the buffer is 10 data pages, the read and write delay delay ratio is fixed at W/R=4/1, and the write amplification factor is constant at W=1.5, The threshold update cycle is 10, the current cycle count value TCount=1, and the initial value of the threshold Tau is 5.

在本实例中,请求序列如图6中所示,由请求的逻辑地址和请求类型构成,例如(R,20),表示一个访问数据页LPN为20的读请求。In this example, the request sequence is shown in FIG. 6 and consists of the logical address of the request and the request type, for example (R, 20), which represents a read request to access the data page with LPN of 20.

在本实例中,针对第一个请求(R,20)的处理流程:In this example, the processing flow for the first request (R, 20):

C1,根据LPN换算得到缓存块号pBlkNum=20/4=5,查询缓存块记录表中是否存在该缓存块号的记录信息。C1, the cache block number pBlkNum=20/4=5 is obtained by conversion according to the LPN, and the cache block record table is queried whether the record information of the cache block number exists.

C2,不存在该缓存块的信息,加载pBlkNum=5的记录表项到缓存块记录表中,同时更新表项的块编号BlkNum=5,BlkSize=0,C-list-index和D-list-index为空。C2, there is no information about the cache block, load the record entry with pBlkNum=5 into the cache block record table, and update the block number BlkNum=5, BlkSize=0, C-list-index and D-list- index is empty.

C3,加载请求页入缓冲区,发现缓冲区满,比对读缓冲区大小RL(4)和当前阈值Tau(5),选择写缓冲区LRU位置LPN=13作为置换对象。C3, load the request page into the buffer, find that the buffer is full, compare the read buffer size RL(4) with the current threshold Tau(5), and select the write buffer LRU position LPN=13 as the replacement object.

C4,置换页(LPN=13)属于缓存块VBlkNum=13/4=3,属于该缓存块的脏页LPN=14为热需要进行保留,当前的回写阈值

Figure BDA0001613820660000081
取整为2,填补页为2,选择整块回写,且读缓冲区包含其余数据页,不需要额外的读取操作,直接整块回写即可。C4, the replacement page (LPN=13) belongs to the cache block VBlkNum=13/4=3, the dirty page LPN=14 belonging to the cache block is reserved for hot needs, the current write-back threshold
Figure BDA0001613820660000081
The rounding is 2, the padding page is 2, and the whole block is written back, and the read buffer contains the rest of the data pages. No additional read operations are required, and the whole block can be written back directly.

C5,将VBlkNum=3缓存块中的D-list-index置空,将LPN=14的数据页移入读缓冲区队列的尾部,并将指向该数据页的位置指针存入C-list-index中C5, empty the D-list-index in the VBlkNum=3 cache block, move the data page of LPN=14 into the tail of the read buffer queue, and store the location pointer to the data page in the C-list-index

C6,将请求载入缓冲区,判断该请求为读类型,将LPN=20的数据页载入到读缓冲区的MRU位置,并将该位置指针存入到pBlkNum=20/4=5的C-list-index,同时更新其BlkSize=1C6, load the request into the buffer, determine that the request is a read type, load the data page with LPN=20 into the MRU position of the read buffer, and store the position pointer into C with pBlkNum=20/4=5 -list-index, while updating its BlkSize=1

C7,启动周期阈值Tau更新,因为未命中请求,故周期计数值TCount累加变为2,判断TCount小于更新周期CycleTime,所以直接结束更新调整,结束本次请求的操作。C7, start the update of the cycle threshold Tau, because the request is not hit, the cycle count value TCount is accumulated to 2, and it is judged that TCount is less than the update cycle CycleTime, so the update adjustment is directly ended, and the operation of this request is ended.

在本实例中,针对第二个请求(W,1)的处理流程:In this example, the processing flow for the second request (W, 1):

C8,根据LPN换算得到缓存块号pBlkNum=1/4=0,查询缓存块记录表中是否存在该缓存块号的记录信息。C8, obtain the cache block number pBlkNum=1/4=0 according to the LPN conversion, and query whether there is record information of the cache block number in the cache block record table.

C9,遍历该缓存块C-list-index发现存在LPN=1的数据页位于读缓冲区中C9, traverse the cache block C-list-index and find that the data page with LPN=1 is located in the read buffer

C10,判断请求的类型为写请求,则将该数据页从读缓冲区移入到写缓冲区的MRU位置,同时清除C-list-index的位置指针,将有关该数据页新的位置指针存入该缓存块记录表的D-list-index中C10, judging that the type of the request is a write request, move the data page from the read buffer to the MRU position of the write buffer, clear the position pointer of C-list-index, and store the new position pointer of the data page into In the D-list-index of the cache block record table

C11,启动周期阈值Tau更新,因为是读缓冲区写命中,故统计值CWH累加,之后周期计数值TCount累加变为3,又未达到更新周期结束调整,结束本次请求的操作。C11, start the cycle threshold Tau update, because it is a read buffer write hit, so the statistic value CWH is accumulated, and then the cycle count value TCount is accumulated to 3, and the end of the update cycle adjustment has not been reached, and the operation of this request is ended.

以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims (8)

1. A replacement and write-back self-adaptive buffer management method,
the buffer area is divided into a buffer block record table, a write buffer area and a read buffer area;
the cache block record table is used for recording the position information of data pages belonging to the same logical data block in a buffer area, the write buffer area is used for caching the data pages which are modified in response to a write request, and the read buffer area is used for caching the data pages which are only in response to a read request and are not modified; it is characterized in that the preparation method is characterized in that,
the management method comprises the following steps:
s1, when the access request comes, inquiring whether the cache block record table contains the cache block information corresponding to the request, if yes, executing S2, otherwise, executing S4;
s2, inquiring whether a position pointer pointing to the requested data page exists in the cache block record table, if so, executing S3, otherwise, executing S5;
s3, migrating the hit data page to the MRU position of the corresponding buffer area, wherein the MRU refers to the nearest access end; updating a position pointer list in a corresponding cache block record table; then executing S8;
s4, adding corresponding record block information to the buffer block record table, initializing all information of the record block, and then executing S5;
s5, judging whether the current buffer area is full; if yes, executing S6, otherwise, executing S7;
s6, comparing the size of the read buffer with a target threshold Tau; if so, selecting the data page at the LRU position of the read buffer area to be removed, otherwise, selecting the data page at the LRU position of the write buffer area as a removal item and executing self-adaptive cluster write-back; updating record block information corresponding to the removed data page, and then executing S7;
s7, loading the missing request data page into the corresponding buffer area, adding the position pointer pointing to the data page into the position pointer list of the corresponding cache block record table, and updating the corresponding record block information; then executing S8;
s8, starting a replacement strategy threshold value adjusting mechanism to adjust the threshold value Tau; and finally, ending the processing of the request.
2. The method of permute and write back adaptive buffer management according to claim 1,
and the read buffer area and the write buffer area adopt LRU management queues, and when the buffer area hits requests and loads new data pages, the hit requests and the loaded new data pages are migrated to the MRU position of the queues.
3. The method of permute and write back adaptive buffer management according to claim 1,
in the cache block record table, the information of one record block includes: the number BlkNum of the cache block, the number BlkSize of data pages belonging to the same record block in the buffer area, a clean page position pointer list C-list-index belonging to the same record block and a dirty page position pointer list D-list-index belonging to the same record block.
4. The method of permute and write back adaptive buffer management according to claim 3,
in step S3, the step of updating the location pointer list in the corresponding cache block record table specifically includes:
removing an old position pointer pointing to the migration data page from the C-list-index or D-list-index list, then judging a migration position, and if the migration position is migrated into the read buffer area, storing the position pointer into the corresponding C-list-index in the cache block; otherwise, the position pointer of the data page is stored into the D-list-index in the record block.
5. The method of permute and write back adaptive buffer management according to claim 3,
in step S6, the updating and removing the recording block information corresponding to the data page specifically includes:
and finding an old position pointer pointing to the removed data page from the C-list-index or D-list-index list, removing the old position pointer, and updating the BlkSize of the corresponding recording block to be BlkSize-1.
6. The method of permute and write back adaptive buffer management according to claim 3,
in step S7, the adding the position pointing to the data page to the position pointer list of the corresponding cache block record table, and updating the corresponding record block information specifically includes:
judging the type of the request, and if the request is a read request, storing the position pointer of the newly added data page into the corresponding cache record block C-list-index; otherwise, the position pointer of the data page is stored in the D-list-index of the recording block, and then the BlkSize of the corresponding recording block is updated to be BlkSize + 1.
7. The method of permute and write back adaptive buffer management according to claim 1,
in step S6, the adaptive clustering write-back process includes:
s61, selecting the data page at the position of the write buffer LRU as a removal object, inquiring the D-list-index information in the cache record block corresponding to the data page, and then executing S62;
s62, sequentially reading data pages pointed by the position pointers of the D-list-index, judging the data pages pointed by the position pointers of the D-list-index according to the principle that the data pages positioned at the front half part of the cache queue are hot data, adding the data pages judged to be hot into the reserved set phi, and then executing S63;
s63, calculating the current write amplification factor
Figure FDA0002588007460000021
Calculating the current write back threshold according to the current write amplification factor W
Figure FDA0002588007460000022
Wherein Bw is a statistical value of write-back times of the cache region in a fixed period; fw is a flash memory write operation frequency counting value in a fixed period; BlkMaxSize is the logical data block size, t is a constant coefficient; then executing S64;
s64, calculating the filling page number E ═ BlkMaxSize-N, wherein N is the number of data pages of the current recording block in the writing buffer area, and then comparing the sizes of E and Th; if E is less than or equal to Th, executing S65; otherwise, go to S66;
s65, starting page filling, reading E filling pages from the bottom layer flash memory and writing back dirty pages to form a whole data block and writing back the whole data block into the bottom layer flash memory; then executing S67;
s66, not starting page filling, completely writing back the dirty pages in the D-list-index into the bottom layer flash memory, and executing S67;
s67, all data pages in the aggregate phi are moved to a read buffer area, the position information of the D-list-index in a cache block record table of an original data block is deleted, and a new position pointer after transfer is stored in the C-list-index; and finally ending the cluster write-back operation.
8. The method for replacement and write-back adaptive buffer management according to claim 7,
in step S8, the starting of the replacement policy threshold adjustment mechanism adjusts the threshold Tau, and the specific adjustment process is as follows:
s81, judging whether the current request is hit, if yes, executing S82, otherwise, executing S83;
s82, judging the request type and the hit area, if the read buffer area hits, adding 1 to CRH; if the read buffer write hits, then CWH adds 1; if the write buffer area is read hit, DRH adds 1; if the write buffer zone is hit, adding 1 to CRH; finally, executing S83;
s83, updating the current TCount, that is, TCount +1, and updating the statistical value Bw and the statistical value Fw, and then executing S84;
s84, judging whether TCount reaches the threshold updating cycle cycleTime, if so, executing S85, otherwise, ending the updating operation of the threshold Tau;
wherein, CRH is the read hit statistical variable of the read buffer, CWH is the write hit statistical variable of the read buffer; DRH is a read hit statistical variable of a write buffer area, and DWH is a write hit statistical variable of the write buffer area; TCount is the current request operation count; the CycleTime is a threshold updating period;
s85, calculating a target write buffer unity gain DR, a target read buffer unity gain CR:
Figure FDA0002588007460000031
wherein BufSize is the size of the total read-write buffer, Tau' is the threshold before updating,
cr and Cw are normalized to obtain a read-write delay cost coefficient:
Figure FDA0002588007460000032
wherein, ReadDelay and WriteDelay are read delay and write delay in a period respectively; then executing S86;
s86, update threshold Tau:
Figure FDA0002588007460000033
and simultaneously updating the write-back frequency statistic Bw of the period buffer area to be 0, the period flash memory write operation frequency statistic Fw to be 0, the period count value TCount to be 1, and finally ending the updating operation of the threshold Tau.
CN201810276887.5A 2018-03-30 2018-03-30 A permutation and write-back adaptive buffer management method Active CN108845957B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810276887.5A CN108845957B (en) 2018-03-30 2018-03-30 A permutation and write-back adaptive buffer management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810276887.5A CN108845957B (en) 2018-03-30 2018-03-30 A permutation and write-back adaptive buffer management method

Publications (2)

Publication Number Publication Date
CN108845957A CN108845957A (en) 2018-11-20
CN108845957B true CN108845957B (en) 2020-10-09

Family

ID=64211896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810276887.5A Active CN108845957B (en) 2018-03-30 2018-03-30 A permutation and write-back adaptive buffer management method

Country Status (1)

Country Link
CN (1) CN108845957B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857680B (en) * 2018-11-21 2020-09-11 杭州电子科技大学 LRU flash memory cache management method based on dynamic page weight
CN109783019B (en) * 2018-12-28 2022-08-19 上海威固信息技术股份有限公司 Intelligent data storage management method and device
CN110888600B (en) * 2019-11-13 2021-02-12 西安交通大学 Buffer area management method for NAND flash memory
CN113722245B (en) * 2021-08-04 2023-12-12 广州市百果园信息技术有限公司 Buffer self-adaptive adjustment method, device, equipment and storage medium
CN116821174B (en) * 2023-07-17 2024-07-19 深圳计算科学研究院 Data query method and device based on logic data block
CN117453145B (en) * 2023-12-06 2024-11-12 成都虚谷伟业科技有限公司 Buffer management method and system
CN118377440B (en) * 2024-06-25 2024-12-06 山东云海国创云计算装备产业创新中心有限公司 Buffer management method, device, solid state hard disk and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528454A (en) * 2016-11-04 2017-03-22 中国人民解放军国防科学技术大学 Memory system cache mechanism based on flash memory
CN107589908A (en) * 2017-08-17 2018-01-16 暨南大学 The merging method that non-alignment updates the data in a kind of caching system based on solid-state disk
CN107590084A (en) * 2017-08-22 2018-01-16 浙江万里学院 A kind of page level buffering area improved method based on classification policy

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004029668A2 (en) * 2002-09-26 2004-04-08 Lg Electronics Inc. Optical disc, method and apparatus for managing a defective area on an optical disc of write once type
US6891690B2 (en) * 2002-11-20 2005-05-10 International Business Machines Corporation On-drive integrated sector format raid error correction code system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528454A (en) * 2016-11-04 2017-03-22 中国人民解放军国防科学技术大学 Memory system cache mechanism based on flash memory
CN107589908A (en) * 2017-08-17 2018-01-16 暨南大学 The merging method that non-alignment updates the data in a kind of caching system based on solid-state disk
CN107590084A (en) * 2017-08-22 2018-01-16 浙江万里学院 A kind of page level buffering area improved method based on classification policy

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Optimizing pipeline for a RISC processor with multimedia extension ISA;XIAO Zhi-bin,etc.;《Journal of Zhejiang University SCIENCE A》;20061231;第7卷(第2期);全文 *
缓冲区管理层对固态盘的有效性研究;杜晨杰,李君,姚英彪;《浙江万里学院学报》;20170331;第30卷(第2期);第72-76页 *

Also Published As

Publication number Publication date
CN108845957A (en) 2018-11-20

Similar Documents

Publication Publication Date Title
CN108845957B (en) A permutation and write-back adaptive buffer management method
US11579773B2 (en) Memory system and method of controlling memory system
US10552317B2 (en) Cache allocation in a computerized system
CN107193646B (en) An efficient dynamic paging method based on hybrid main memory architecture
US9146688B2 (en) Advanced groomer for storage array
KR101894625B1 (en) Priority-based garbage collection for data storage systems
CN102012867B (en) Data storage system
CN104834607B (en) A kind of hit rate for improving distributed caching and the method for reducing solid state hard disc abrasion
CN108762664B (en) Solid state disk page-level cache region management method
US10740251B2 (en) Hybrid drive translation layer
CN104166634A (en) Management method of mapping table caches in solid-state disk system
CN109446117B (en) Design method for page-level flash translation layer of solid state disk
CN110413537B (en) A flash memory conversion layer and conversion method for hybrid solid-state drives
US20090094391A1 (en) Storage device including write buffer and method for controlling the same
CN107423229B (en) Buffer area improvement method for page-level FTL
CN111580754B (en) A Write-Friendly Flash SSD Cache Management Method
CN110888600A (en) A buffer management method for NAND flash memory
CN111984188A (en) Hybrid memory data management method, device and storage medium
CN111352593B (en) Solid state disk data writing method for distinguishing fast writing from normal writing
CN102779017B (en) The control method of data buffer area in a kind of solid-state disk
CN108664217A (en) A kind of caching method and system reducing the shake of solid-state disc storaging system write performance
CN115048056B (en) Solid state disk buffer area management method based on page replacement cost
US20140359228A1 (en) Cache allocation in a computerized system
CN110221774A (en) A method of the solid state hard disk garbage reclamation with abrasion equilibrium consciousness
CN109857680B (en) LRU flash memory cache management method based on dynamic page weight

Legal Events

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

Effective date of registration: 20240708

Address after: 518000 1002, Building A, Zhiyun Industrial Park, No. 13, Huaxing Road, Henglang Community, Longhua District, Shenzhen, Guangdong Province

Patentee after: Shenzhen Wanzhida Technology Co.,Ltd.

Country or region after: China

Address before: 310018 no.1158, No.2 street, Baiyang street, Hangzhou Economic and Technological Development Zone, Zhejiang Province

Patentee before: HANGZHOU DIANZI University

Country or region before: China

TR01 Transfer of patent right