WO2017201699A1 - 一种基于Ondemand算法的STL映射表管理方法 - Google Patents

一种基于Ondemand算法的STL映射表管理方法 Download PDF

Info

Publication number
WO2017201699A1
WO2017201699A1 PCT/CN2016/083393 CN2016083393W WO2017201699A1 WO 2017201699 A1 WO2017201699 A1 WO 2017201699A1 CN 2016083393 W CN2016083393 W CN 2016083393W WO 2017201699 A1 WO2017201699 A1 WO 2017201699A1
Authority
WO
WIPO (PCT)
Prior art keywords
mapping
entry
data
mapping table
cache
Prior art date
Application number
PCT/CN2016/083393
Other languages
English (en)
French (fr)
Inventor
王毅
张明旭
杨烜
董丽莎
毛睿
李荣华
廖好
Original Assignee
深圳大学
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 深圳大学 filed Critical 深圳大学
Priority to PCT/CN2016/083393 priority Critical patent/WO2017201699A1/zh
Publication of WO2017201699A1 publication Critical patent/WO2017201699A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Definitions

  • the invention belongs to the field of computers, and more particularly to an STL based on Ondemand algorithm (shingled Magnetic record translation layer (laying type magnetic storage translation layer) mapping table management method.
  • STL based on Ondemand algorithm shingled Magnetic record translation layer (laying type magnetic storage translation layer) mapping table management method.
  • SMR Silicon Magnetic
  • mapping table directly imports the mapping table into the memory, resulting in low space and time performance.
  • the specific limitations are as follows: (1) The memory and the disk exchange data are slow, and the mapping table is directly imported from the disk into the memory, or Memory data is written to disk for a long delay. (2) On the one hand, the memory capacity is small relative to the mapping table for maintaining and managing disk space; on the other hand, data access on the disk has spatial locality and temporal locality. Importing the mapping table into memory at one time seriously affects the memory space utilization and the overall performance of the computer.
  • the present invention provides an STL mapping table management method based on the Ondemand algorithm, which aims to improve the system to disk by reducing the memory usage of the mapping table and improving the overall access performance of the mapping table.
  • the access performance of the data is aimed at solving the problem of directly importing the mapping table into the memory in the prior art, which seriously affects the memory space utilization and the overall performance of the computer.
  • the invention provides an STL mapping table management method based on the Ondemand algorithm.
  • the LBA query LWT_stack is obtained. If a corresponding mapping entry exists in the cache table, the corresponding PBA is obtained and the query is obtained. After the BMT table obtains the actual physical block number, the data can be read directly; if the corresponding mapping entry is not found in the cache, all mapping entries of the sector in which the mapping entry is located are cached by looking up the mapping table in the disk.
  • the process of searching the mapping table in the disk is specifically: calculating a stripe number band_num stored in the LBA->PBA mapping item, searching for a corresponding mapping item in a corresponding stripe of the storage mapping table, and The unit pushes the mapping entry of one sector size in the disk into the top of the stack in the form of an LPT_stack table node.
  • the method further includes the following steps: before the mapping table entry read from the disk is pushed to the top of the stack, if the cache is cached If the mapping table in the table does not have enough space to accommodate the new mapping table entry, the mapping table entry in the LPT_stack table is removed.
  • LRU least recently Used, least recently used algorithm
  • the method further includes: writing the mapping entry back to the disk: calculating the strip number on the disk corresponding to the node of the LPT_stack table Band_num, find the corresponding strip according to the strip number, and determine whether the strip has space. If there is space, directly store a sector size mapping table stored on the node into the disk; otherwise, the strip With the erase operation, the mapping table stored by the node in the cache is written back to the stripe.
  • strip erasing step is further included after the writing operation is completed:
  • step (3) repeating step (2) until the first sector of the strip is scanned;
  • the process of modifying the corresponding mapping entry is specifically: checking whether the LPT_stack table in the cache has a corresponding entry, and if so, modifying the mapping entry; otherwise, directly adding a new mapping entry to the corresponding node.
  • the process of performing the erasing operation on the data strip is specifically: reading a mapping entry of a logical address to a physical address corresponding to the data strip into the memory, and then reading the data strip according to the mapping entry
  • the valid data block is erased into the cache; after reading the valid data, the data is started from the first sector of the original data strip, the original data strip is sequentially written, and the corresponding mapping entry is modified; Then modify the tail field of the corresponding entry in the BMT table.
  • the present invention introduces a mapping table buffer layer to cache recently accessed mapping entries, thereby improving the search speed of common mapping tables and reducing the exchange time between memory and disk data.
  • the memory usage of the mapping table is reduced, thereby improving the overall performance of the system.
  • the stripe number of the corresponding mapping entry and the logical data strip number of the stored data are directly calculated, and then according to the mapping in the BMT table. Find the actual data strip number, and manage the mapping table and data more flexibly through the management of two mapping tables.
  • the stripe utilization of the mapping table and data is less than 100%.
  • the basic unit of data exchange between the disk and the mapping table cache is sector. On the one hand, it conforms to the disk read and write characteristics. On the other hand, according to the local characteristics, in the next access, the system accesses the sector where the last accessed mapping entry is located. The mapping table entry is more likely to speed up the access speed of the mapping table.
  • FIG. 1 is a schematic diagram of a mapping entry of a logical block number to a physical block number in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of each node in an LPT_stack in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a BMT entry in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a read operation implementation in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 5 is a flowchart of implementing a disk search LBA->PBA mapping entry in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 6 is a flowchart of implementing an inbound and outbound LBA->PBA mapping entry in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 7 is a flowchart of implementing a mapping entry in an LPT_stack table to a disk in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 8 is a flowchart of a write operation implementation in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention
  • FIG. 9 is a flowchart of implementing a modification mapping entry in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention.
  • FIG. 10 is a flowchart of implementing an erasure recovery data in an STL mapping table management method based on an Ondemand algorithm according to an embodiment of the present invention.
  • the invention mainly adopts the following two aspects to improve the management of the mapping table: (1) modifying the physical structure, on the one hand reducing the occupation of the memory space by the disk mapping table, on the other hand, improving the correspondence to the high frequency access data The access speed of the mapping entry. (2) Modify the logical storage structure of the mapping table to facilitate the reading and writing operations of the mapping entries and accelerate the access of the mapping table.
  • the invention changes the physical layer structure of the storage based on the ondemand algorithm, adds a mapping table buffer layer between the memory and the disk, and stores the most frequently accessed mapping table in the cache, and uses the LRU algorithm to be recently used. The least frequently mapped table entry is written back to disk.
  • the present invention manages the mapping table in the cache and the disk respectively, and the two storage media exchange data of the mapping entries in units of "sectors". Specifically: (1) The mapping table in the cache is organized in a logical form of "stack", and each node stores several mapping entries of one sector size. The most recently accessed mapping entry is at the top of the stack, and the bottom of the stack is the least recently accessed mapping entry node. (2) The disk updates the mapping entry in the log-structure mode. That is, when the mapping entry is updated, it is only necessary to continuously add the tail of the corresponding stripe without modifying the location of the original storage mapping entry. (3) The BMT table is used to map the logical space and the physical space of the stored data, and the short field is used to manage the free block.
  • the main purpose of the present invention is to reduce the memory usage of the mapping table, improve the overall access performance of the mapping table, and thereby improve the access performance of the system to the disk data.
  • the invention mainly improves the physical level of the storage device in the prior art, the logical storage structure of the mapping table, and the corresponding operation mode.
  • the present invention modifies the physical storage structure. Specifically, for the storage device, the present invention adds a small-capacity, non-volatile memory that can be quickly accessed between the SMR disk and the memory to store the block mapping table.
  • the cache is used as the intermediate buffer storage, and the stored block mapping table provides a mapping relationship between the logical block and the physical block for the upper layer operating system; on the other hand, the modification of the block mapping table is recorded.
  • the present invention also modifies the storage structure of the mapping table on the disk.
  • mapping table of the logical block address to the physical block address is LPT_band (logical physical Mapping table), each entry in the table stores two numbers - a logical block number and a physical block number, thereby recording the mapping relationship. As shown in Figure 1. The storage and operation of this table will be described below:
  • the present invention stipulates that the utilization rate of each band is 50%, that is, each strip space. Only 50% of the space is used to store valid mapping entries, and the remaining 50% is used to store the updated entries.
  • mapping table In order to speed up access to the mapping table, the mapping table will be stored on a fixed strip. Set the following parameters:
  • the size of each sector is Sector_size
  • the size of each logical block to physical block mapping entry is Item_size
  • the logical block address is LBA (logical block address);
  • the physical block address is PBA (physical block address);
  • the stripe number band_num storing an LBA to PBA entry can be calculated:
  • mapping items are written into the stripe according to the log-structure manner, that is, sequentially written backward;
  • mapping from LBA to PBA needs to be read, the last mapping item on the corresponding stripe is read forward until the end of the same LBA entry is encountered for the first time.
  • mapping table of the logical block address to the physical block address is LPT_stack.
  • the table is stored in the cache in the form of a linked list, and the information stored by the nodes on the linked list is as shown in FIG. 2, wherein the size of the "array of storage table entries" is the same as the size of one sector on the disk, and is used as a cache and a disk.
  • the basic unit of data exchange the mapping entry is written to the disk, or the mapping entry is read from the disk; the “strip number” is the logical strip position of the sector, and is calculated according to (Formula 1), where The logical stripe number is the same as the physical stripe number; the "modification flag” indicates whether the mapping entry in the node is modified. If it is 0, it means that it is not modified. If it is 1, it means modification.
  • the "previous node pointer" and “next node pointer” point to the two nodes before and after the current node.
  • mapping table stored in the cache needs to be written to the disk, if the modification flag is 1, it indicates that the mapping entry stored by the node changes, then write back to the disk; otherwise, directly discard the current node storage. The mapping entry is not written to disk.
  • mapping table of logical strips to physical strips BMT (band mapping Table). Each entry in the table is shown in Figure 3.
  • PBN indicates a physical strip number of the stored data, which corresponds to the strip number of the corresponding PBA of an LBA.
  • Tail indicates the block number of the last valid physical block on the PBN strip. Since the table takes up less space, the table is resident in the cache.
  • the present invention performs corresponding improvements on the following operations of the mapping table.
  • Figure 4 shows the overall flow of the read operation.
  • the system first queries the cache table LPT_stack through the LBA. If there is a corresponding mapping entry in the cache table, the corresponding PBA is obtained, and the BMT table is checked to obtain the actual physical block number, and the data can be directly read; if no corresponding correspondence is found in the cache
  • the mapping entry needs to find the mapping table in the disk and put all the mapping entries of the sector in which the mapping entry is located into the cache, as shown in FIG. 5 and FIG. 6.
  • Figure 5 shows the process of searching for a mapping entry from a disk.
  • the system first calculates the stripe number band_num stored in the LBA->PBA mapping entry, and then searches for the corresponding mapping item in the corresponding stripe of the storage mapping table, and maps the size of one sector in the disk in units of sectors.
  • the entry is pushed into the top of the stack in the form of an LPT_stack table node.
  • Figure 6 shows the process of saving the mapping entries in the disk to the cache and writing the mapping entries in the cache back to the disk.
  • LPT_stack table LRU (Leat here) Recently The algorithm is used to move the bottom node of the stack out to the disk. If the node "modification flag" is "1", it indicates that the mapping entry stored in the node has been modified, and then writes to the disk; otherwise, the mapping entry stored by the node is not Modify it and move it out directly.
  • the stripe is scanned forward, and the scanned mapping entry is stored in the erasure cache for temporary storage.
  • step (2) Repeat step (2) until the first sector of the strip is scanned.
  • the system first calculates the LBN where the LBA is located, searches the BMT table with the LBN as an index, and obtains the PBN. If there is no PBN, directly allocate the data strip; otherwise, check whether the corresponding data strip has space to write the data block, if any, write directly; otherwise, erase the data strip and release the invalid data block. , the data is written into the corresponding stripe. After the data is written, modify the corresponding mapping table entry.
  • the process of modifying the mapping entry is performed.
  • the system only checks whether the LPT_stack table in the cache has a corresponding entry, and if so, modifies the mapping entry; otherwise, directly adds a new mapping entry to the corresponding node.
  • the flow of the stripe data recovery operation is erased.
  • the system first reads the mapping entry of the corresponding logical address to the physical address into the memory, and then reads the valid data block of the data strip into the erasure buffer according to the mapping entry. After reading the valid data, the data is started from the first sector of the original data strip, the original data strip is sequentially written, and the corresponding mapping entry is modified. Finally, modify the tail field of the corresponding entry in the BMT table.
  • the present invention introduces a mapping table buffer layer to cache recently accessed mapping entries, thereby improving the search speed of common mapping tables and reducing memory.
  • the exchange time with the disk data reduces the memory usage of the mapping table, thereby improving the overall performance of the system.
  • mapping tables make the management of mapping tables and data more flexible.
  • the stripe utilization ratio for storing the mapping table and the data is less than 100%, which can effectively prevent the disk from being frequently erased due to frequent modification of the disk data, thereby reducing access to the disk data. Response time.
  • the basic unit of data exchange between the disk and the mapping table cache is sector. On the one hand, it conforms to the disk read and write characteristics. On the other hand, according to the local characteristics, the system accesses the last accessed mapping entry in the next access. The mapping table entry of the sector is more likely, which speeds up the access speed of the mapping table.
  • the present invention is mainly applied to an SMR disk that adopts a mapping table management mechanism.
  • the SMR disk has a large capacity, and the basic unit of storage is small, and a large space storage mapping table is required; at the same time, the memory capacity is small, and the storage mapping table takes up a large amount. Memory space.
  • the technology is used in SMR disk storage media such as storage clusters, data servers, and personal computers.

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

一种基于Ondemand算法的STL映射表管理方法,当需要进行读操作时,通过LBA查询缓存表LPT_stack,若缓存表中存在相应的映射表项,则获取相应的PBA,并通过查询BMT表获得实际物理块号后直接读取数据即可;若缓存中未找到对应的映射项,则需要通过查找磁盘中映射表将与该映射表项所在扇区的所有映射表项放入缓存中;当需要进行写操作时,先计算LBA所在的LBN,以LBN为索引查找BMT表后获得PBN;若没有PBN,则直接分配数据条带;否则,查看对应数据条带是否有空间写入数据块,若有,则直接写入;否则,对该数据条带进行擦除操作,释放无效数据块,并将数据写入对应条带中;当写入数据后,修改相应的映射表项。

Description

一种基于Ondemand算法的STL映射表管理方法 技术领域
本发明属于计算机领域,更具体地,涉及一种基于Ondemand算法的STL(shingled magnetic record translation layer 叠瓦式磁质存储翻译层)映射表管理方法。
背景技术
对于采用盘块映射表技术,来管理逻辑与物理空间映射关系的SMR(Shingled Magnetic Recording)磁盘,在每次操作系统向磁盘申请读写操作时,需要查询映射表,将逻辑盘块号映射成物理盘块号。
现有技术直接将映射表导入内存中,导致空间、时间性能较低,具体局限性有如下两个方面:(1)内存与磁盘交换数据较慢,将映射表直接从磁盘导入内存,或将内存数据写入磁盘,延迟时间较长。(2)一方面相对于维护管理磁盘空间的映射表,内存容量较小;另一方面,磁盘上数据访问具有空间局部性和时间局部性。一次性将映射表导入内存,严重影响内存空间利用率和计算机的整体性能。
技术问题
针对现有技术的缺陷,本发明提供了一种基于Ondemand算法的STL映射表管理方法,其目的在于通过降低映射表对内存的占用率,提高对映射表的整体访问性能,来提高系统对磁盘数据的访问性能,旨在解决现有技术中一次性将映射表导入内存,严重影响内存空间利用率和计算机的整体性能的问题。
技术解决方案
本发明提供了一种基于Ondemand算法的STL映射表管理方法,当需要进行读操作时,通过LBA查询缓存表LPT_stack,若缓存表中存在相应的映射表项,则获取相应的PBA,并通过查询BMT表获得实际物理块号后直接读取数据即可;若缓存中未找到对应的映射项,则需要通过查找磁盘中映射表将与该映射表项所在扇区的所有映射表项放入缓存中;当需要进行写操作时,先计算LBA所在的LBN,以LBN为索引查找BMT表后获得PBN;若没有PBN,则直接分配数据条带;否则,查看对应数据条带是否有空间写入数据块,若有,则直接写入;否则,对该数据条带进行擦除操作,释放无效数据块,并将数据写入对应条带中;当写入数据后,修改相应的映射表项。
更进一步地,所述查找磁盘中映射表的过程具体为:计算LBA->PBA映射项存放的条带号band_num,在存储映射表的对应条带中查找相应的映射项,并以扇区为单位将磁盘中的一个扇区大小的映射表项以LPT_stack表节点的形式压入栈顶中。
更进一步地,在所述将与该映射表项所在扇区的所有映射表项放入缓存步骤之前还包括如下步骤:在将从磁盘中读取的映射表项压入栈顶之前,若缓存中的映射表没有足够空间容纳新的映射表项,则将LPT_stack表中的映射表项移出。
更进一步地,采用LRU(least recently used,最近最少使用算法)算法;该算法通过“栈”形式对数据进行组织,在“栈”中,栈顶元素为最近使用的元素,栈底元素为当前最久未被使用的元素。因此,本算法将栈底元素从内存移动到磁盘中,若节点“修改标志”为“1”,则写入磁盘;否则,直接移出节点。
更进一步地,在所述将与该映射表项所在扇区的所有映射表项放入缓存步骤之后还包括将映射表项写回磁盘步骤:计算LPT_stack表的节点对应的磁盘上的条带号band_num,根据条带号找到相应条带,并判断该条带是否有空间,若有空间,则直接将节点上存储的一个扇区大小的映射表项存入磁盘中;否则,先对该条带进行擦除操作,将缓存中节点存储的映射表项写回该条带。
更进一步地,在完成写操作之后还包括条带擦除步骤:
(1)从条带上最后一个存储映射表项的扇区开始,向前扫描条带,扫描到的映射表项存入擦除缓存中进行暂存;
(2)对于每个扫描到的映射表项的LBA,若该LBA在擦除缓存中已存在,则该表项不存入擦除缓存中;否则存入擦除缓存中;
(3)重复步骤(2),直到扫描完该条带的第一个扇区;
(4)从该条带第一个扇区开始,将暂存在擦除缓存中的表项写回磁盘条带中。
更进一步地,所述修改相应的映射表项的过程具体为:查看缓存中的LPT_stack表是否有对应表项,若有,则修改映射表项;否则,直接添加新的映射表项到对应的节点。
更进一步地,所述对该数据条带进行擦除操作的过程具体为:将该数据条带对应的逻辑地址到物理地址的映射表项读入内存,然后根据映射表项读取数据条带的有效数据块到擦除缓存中;当读完有效数据后,再将数据从原数据条带的第一个扇区开始,顺次写入原数据条带,并修改相应的映射表项;再修改BMT表相应表项的tail字段。
有益效果
本发明根据数据访问的局部性特点,通过引入了映射表缓冲层,将最近经常访问的映射表项缓存,一方面提高了对常用映射表的查找速度,减少内存与磁盘数据的交换时间,另一方面,减小了映射表对内存的占用,从而提高系统的整体性能。另外,在映射表逻辑存储及其操作方面,根据逻辑块号LBA,直接计算得出存储其对应的映射表项的条带号和存储数据的逻辑数据条带号,再根据BMT表中的映射找到实际数据条带号,通过两个映射表的管理,使对映射表和数据的管理更加灵活。同时,存放映射表和数据的条带利用率均未达到100%,这样做可以有效防止因为对磁盘数据频繁修改,而导致磁盘做频繁擦除操作,减少了访问磁盘数据的响应时间。磁盘与映射表缓存之间的数据交换基本单位为扇区,一方面符合磁盘读写特性,另一方面,根据局部性特点,在下一次访问中,系统访问上次被访问映射表项所在扇区的映射表项可能性较大,加速了映射表访问速度。
附图说明
图1是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中逻辑块号到物理块号的映射项的示意图;
图2是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中的LPT_stack中每个节点的结构示意图;
图3是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中BMT表项的示意图;
图4是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中读操作实现流程图;
图5是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中磁盘查找LBA->PBA映射项实现流程图;
图6是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中换入、换出LBA->PBA映射项实现流程图;
图7是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中将LPT_stack表中的映射表项写入磁盘实现流程图;
图8是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中写操作实现流程图;
图9是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中修改映射表项实现流程图;
图10是本发明实施例提供的基于Ondemand算法的STL映射表管理方法中擦除回收数据实现流程图。
本发明的实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明主要采用了以下两个方面对映射表的管理进行了改进:(1)对物理结构进行修改,一方面减少磁盘映射表对内存空间的占用,另一方面,提高对高频访问数据对应映射表项的访问速度。(2)修改映射表逻辑存储结构,方便映射表项读写操作,加速映射表访问。
本发明在原技术的基础上,基于ondemand算法改变了存储的物理层结构,在内存和磁盘之间加入映射表缓冲层,将最近经常访问的映射表存入缓存中,采用LRU算法,将最近使用频度最小的映射表项写回至磁盘中。
另外,在映射表的逻辑存储结构及其操作上,本发明分别对缓存和磁盘中的映射表进行管理,两种存储介质以“扇区”为单位进行映射表项的数据交换。具体地:(1)缓存中的映射表以“栈”的逻辑形式组织,每个节点存储一个扇区大小的若干映射表项。最近访问的映射表项位于栈顶,栈底为最近最少访问的映射表项节点。(2)磁盘以log-structure方式对映射表项进行更新,即当映射表项更新时,只需在对应的条带尾部不断添加即可,而无需在原存储映射表项位置进行修改。(3)使用BMT表对存储数据的逻辑空间和物理空间进行映射,同时使用tail字段对空闲块进行管理。
本发明主要目的在于降低映射表对内存的占用率,提高对映射表的整体访问性能,从而提高系统对磁盘数据的访问性能。
本发明在原有技术的基础上,主要将原有技术中存储设备的物理层次、映射表的逻辑存储结构以及对应的操作方式两个方面分别进行改进。以下将详细介绍这两个方面及其相关内容。
本发明修改物理存储结构,具体地,针对存储设备,本发明在SMR磁盘与内存之间增加小容量、可进行快速访问的非易失性存储器,来存储块映射表。其中高速缓存作为中间缓冲存储,其存储的块映射表一方面为上层操作系统提供逻辑块与物理块的映射关系;另一方面,记录对块映射表的修改情况。
本发明还修改磁盘上映射表的存储结构。
为了对SMR磁盘上的物理空间进行管理,设置以下逻辑结构,并对相应操作进行说明:
1、在磁盘中,逻辑块地址到物理块地址的映射表为LPT_band(logical physical mapping table),该表中每个表项存储两个数——逻辑块号和物理块号,从而记录映射关系。如图1所示。以下将描述对该表的存储方式和操作:
(1)由于映射表需要进行频繁修改,为了减少对存储映射表的条带的擦除操作频度,本发明规定每个条带(band)的利用率为50%,即每个条带空间中,只使用50%的空间存储有效的映射表项,剩余50%的空间用来存储更新后的表项。
(2)为了加速对映射表的访问,映射表将存储在固定条带上。设如下参数:
每个条带中有Amount_Track_per_Band条轨迹;
每条轨迹上有Amount_Sector_per_Track个扇区;
每个扇区的大小为Sector_size;
每个逻辑块到物理块映射项所占大小为Item_size;
逻辑块地址为LBA(logical block address);
物理块地址为PBA(physical block address);
根据(式一),可算出存储某个LBA到PBA表项的条带号band_num:
band_num=LBA/(Amount_Sector_per_Track*
Amount_Track_per_Band*0.5*(Sector_size/Item_Size) (式一)
确定LBA对应的记录其映射项的条带后,进行如下操作:
A、若写入的是LBA到PBA的映射,则按照log-structure方式将映射项写入该条带中,即顺序向后写入;
B、若需要读取LBA到PBA的映射,则从对应条带上最后一个映射项向前读取,直到第一次遇到相同的LBA项结束。
2、在缓存中,逻辑块地址到物理块地址的映射表为LPT_stack。该表逻辑存储结构以及相应操作具体描述如下:
(1)该表以链表形式存储于缓存中,链表上节点存储的信息如图2所示,其中,“存储表项的数组”大小与磁盘上一个扇区大小相同,其作为缓存与磁盘的数据交换的基本单位,映射表项写入磁盘,或从磁盘中读取映射表项;“条带号”为该扇区所在的逻辑条带位置,按照(式一)计算得出,其中,逻辑条带号与物理条带号相同;“修改标志”表示该节点中的映射表项是否被修改,为0,则表示未修改,为1,则表示修改。“上一个节点指针”、“下一个节点指针”分别指向当前节点的前后两个节点。
(2)当缓存中节点存储的映射表项需要写入磁盘中时,若“修改标志”为1,表示该节点存储的映射表项发生改变,则写回磁盘;否则,直接废弃当前节点存储的映射表项,不写入磁盘。
3、记录逻辑条带到物理条带的映射表:BMT(band mapping table)。该表的每个表项如图3所示,PBN表示存储数据某个物理条带号,其对应某个LBA相应的PBA所在的条带号。tail表示在该PBN号条带上,最后一个有效的物理块的块号。由于该表占用空间较小,故该表常驻缓存中。
LBN=LBA/Logical_Sector_per_band (式二)
Logical_Sector_per_Band=Amount_Sector_per_Track
*Amount_Track_per_Band*3/4 (式三)
当获得某个(LBA,PBA)映射关系时,首先按照(式二)和(式三)算出LBA对应LBN(logical band number数据逻辑条带号),其中,为了防止存储数据的条带频繁擦除,规定其存储的有效数据占实际条带总容量的3/4;以LBN为索引,查找BMT表,找到对应PBN(physical band number数据物理条带号),再根据PBA和PBN两个值,得到所要访问的实际PBA,即实际的物理块号。
在原技术的基础上,本发明在对映射表的如下操作上进行相应改进。
1、读操作。
如图4为读操作的总流程。系统首先通过LBA查询缓存表LPT_stack,若缓存表中存在相应的映射表项,则获取相应的PBA,并查BMT表,获得实际物理块号,直接读取数据即可;若缓存中未找到对应的映射项,则需要查找磁盘中映射表,并将与该映射表项所在扇区的所有映射表项放入缓存中,如图5和图6。
如图5为从磁盘中搜索映射表项的过程。系统首先计算出LBA->PBA映射项存放的条带号band_num,然后到存储映射表的对应条带中查找相应的映射项,并以扇区为单位,将磁盘中的一个扇区大小的映射表项以LPT_stack表节点的形式压入栈顶中。
如图6为将磁盘中的映射表项存入缓存,将缓存中的映射表项写回磁盘的过程。在将新的、从磁盘中读取的映射表项压入栈顶之前,需要检查缓存中的映射表是否有足够空间容纳新的映射表项。若没有空间,需要将LPT_stack表中的映射表项移出。此处采用LRU(Leat Recently Used)算法,将栈底节点移出至磁盘中,若节点“修改标志”为“1”,表示该节点存储的映射表项已经修改,则写入磁盘;否则,该节点存储的映射表项未修改,直接移出节点即可。
条带擦除的具体操作为:
(1)从条带上最后一个存储映射表项的扇区开始,向前扫描条带,扫描到的映射表项存入擦除缓存中进行暂存。
(2)对于每个扫描到的映射表项的LBA,若该LBA在擦除缓存中已存在,则该表项不存入擦除缓存中;否则存入擦除缓存中。
(3)重复步骤(2),直到扫描完该条带的第一个扇区。
(4)从该条带第一个扇区开始,将暂存在擦除缓存中的表项写回磁盘条带中。
2、写操作
如图8,为写操作的总流程。系统首先计算LBA所在的LBN,以LBN为索引查找BMT表,获得PBN。若没有PBN,则直接分配数据条带;否则,查看对应数据条带是否有空间写入数据块,若有,则直接写入;否则,对该数据条带进行擦除操作,释放无效数据块,将数据写入对应条带中。写入数据后,修改相应的映射表项。
如图9,为修改映射表项流程。系统仅查看缓存中的LPT_stack表是否有对应表项,若有,则修改映射表项;否则,直接添加新的映射表项到对应的节点。
如图10,为擦除回收数据条带操作的流程。系统首先将该数据条带对应的逻辑地址到物理地址的映射表项读入内存,然后根据映射表项读取数据条带的有效数据块到擦除缓存中。当读完有效数据后,再将数据从原数据条带的第一个扇区开始,顺次写入原数据条带,并修改相应的映射表项。最后修改BMT表相应表项的tail字段。
技术效果:
1、在物理存储层方面,根据数据访问的局部性特点,本发明由于引入了映射表缓冲层,将最近经常访问的映射表项缓存,一方面提高了对常用映射表的查找速度,减少内存与磁盘数据的交换时间,另一方面,减小了映射表对内存的占用,从而提高系统的整体性能。
2、在映射表逻辑存储及其操作方面,本发明有以下优点:
(1)根据逻辑块号LBA,直接计算得出存储其对应的映射表项的条带号和存储数据的逻辑数据条带号,再根据BMT表中的映射找到实际数据条带号,通过两个映射表的管理,使对映射表和数据的管理更加灵活。
(2)本发明中,存放映射表和数据的条带利用率均未达到100%,这样做可以有效防止因为对磁盘数据频繁修改,而导致磁盘做频繁擦除操作,减少了访问磁盘数据的响应时间。
(3)磁盘与映射表缓存之间的数据交换基本单位为扇区,一方面符合磁盘读写特性,另一方面,根据局部性特点,在下一次访问中,系统访问上次被访问映射表项所在扇区的映射表项可能性较大,加速了映射表访问速度。
本发明主要应用在采用映射表管理机制的SMR磁盘上,SMR磁盘容量较大,且存储的基本单位较小,需要较多空间存储映射表;同时,内存容量较小,存储映射表将占用大量内存空间。该技术使用范围有:存储集群,数据服务器,个人电脑等方面的SMR磁盘存储介质。
本领域的技术人员容易理解,以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (10)

  1. 一种基于Ondemand算法的STL映射表管理方法,其特征在于,当需要进行读操作时,通过LBA查询缓存表LPT_stack,若缓存表中存在相应的映射表项,则获取相应的PBA,并通过查询BMT表获得实际物理块号后直接读取数据即可;若缓存中未找到对应的映射项,则需要通过查找磁盘中映射表将与该映射表项所在扇区的所有映射表项放入缓存中;
    当需要进行写操作时,先计算LBA所在的LBN,以LBN为索引查找BMT表后获得PBN;若没有PBN,则直接分配数据条带;否则,查看对应数据条带是否有空间写入数据块,若有,则直接写入;否则,对该数据条带进行擦除操作,释放无效数据块,并将数据写入对应条带中;当写入数据后,修改相应的映射表项。
  2. 如权利要求1所述的STL映射表管理方法,其特征在于,所述查找磁盘中映射表的过程具体为:
    计算LBA->PBA映射项存放的条带号band_num,在存储映射表的对应条带中查找相应的映射项,并以扇区为单位将磁盘中的一个扇区大小的映射表项以LPT_stack表节点的形式压入栈顶中。
  3. 如权利要求2所述的STL映射表管理方法,其特征在于,在所述将与该映射表项所在扇区的所有映射表项放入缓存步骤之前还包括如下步骤:在将从磁盘中读取的映射表项压入栈顶之前,若缓存中的映射表没有足够空间容纳新的映射表项,则将LPT_stack表中的映射表项移出。
  4. 如权利要求3所述的STL映射表管理方法,其特征在于,采用LRU算法将栈底节点移出至磁盘中,若节点“修改标志”为“1”,则写入磁盘;否则,直接移出节点。
  5. 如权利要求3所述的STL映射表管理方法,其特征在于,在所述将与该映射表项所在扇区的所有映射表项放入缓存步骤之后还包括将映射表项写回磁盘步骤:计算LPT_stack表的节点对应的磁盘上的条带号band_num,根据条带号找到相应条带,并判断该条带是否有空间,若有空间,则直接将节点上存储的一个扇区大小的映射表项存入磁盘中;否则,先对该条带进行擦除操作,将缓存中节点存储的映射表项写回该条带。
  6. 如权利要求1-5任一项所述的STL映射表管理方法,其特征在于,在完成写操作之后还包括条带擦除步骤:
    (1)从条带上最后一个存储映射表项的扇区开始,向前扫描条带,扫描到的映射表项存入擦除缓存中进行暂存;
    (2)对于每个扫描到的映射表项的LBA,若该LBA在擦除缓存中已存在,则该表项不存入擦除缓存中;否则存入擦除缓存中;
    (3)重复步骤(2),直到扫描完该条带的第一个扇区;
    (4)从该条带第一个扇区开始,将暂存在擦除缓存中的表项写回磁盘条带中。
  7. 如权利要求1所述的STL映射表管理方法,其特征在于,所述修改相应的映射表项的过程具体为:查看缓存中的LPT_stack表是否有对应表项,若有,则修改映射表项;否则,直接添加新的映射表项到对应的节点。
  8. 如权利要求1所述的STL映射表管理方法,其特征在于,所述对该数据条带进行擦除操作的过程具体为:将该数据条带对应的逻辑地址到物理地址的映射表项读入内存,然后根据映射表项读取数据条带的有效数据块到擦除缓存中;当读完有效数据后,再将数据从原数据条带的第一个扇区开始,顺次写入原数据条带,并修改相应的映射表项;再修改BMT表相应表项的tail字段。
  9. 如权利要求1所述的STL映射表管理方法,其特征在于,每个条带只使用50%的空间存储有效的映射表项,剩余50%的空间用来存储更新后的表项。
  10. 如权利要求9所述的STL映射表管理方法,其特征在于,每个条带存储的有效数据占实际条带总容量的3/4。
PCT/CN2016/083393 2016-05-26 2016-05-26 一种基于Ondemand算法的STL映射表管理方法 WO2017201699A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/083393 WO2017201699A1 (zh) 2016-05-26 2016-05-26 一种基于Ondemand算法的STL映射表管理方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/083393 WO2017201699A1 (zh) 2016-05-26 2016-05-26 一种基于Ondemand算法的STL映射表管理方法

Publications (1)

Publication Number Publication Date
WO2017201699A1 true WO2017201699A1 (zh) 2017-11-30

Family

ID=60412034

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/083393 WO2017201699A1 (zh) 2016-05-26 2016-05-26 一种基于Ondemand算法的STL映射表管理方法

Country Status (1)

Country Link
WO (1) WO2017201699A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102203747A (zh) * 2008-11-13 2011-09-28 国际商业机器公司 支持脉动移动操作的存储阵列瓦片
CN102999428A (zh) * 2012-11-01 2013-03-27 华中科技大学 一种瓦记录磁盘的四级编址方法
US9324367B1 (en) * 2015-05-05 2016-04-26 Futurewei Technologies, Inc. SMR-aware append-only file system
CN105975215A (zh) * 2016-05-25 2016-09-28 深圳大学 一种基于Ondemand算法的STL映射表管理方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102203747A (zh) * 2008-11-13 2011-09-28 国际商业机器公司 支持脉动移动操作的存储阵列瓦片
CN102999428A (zh) * 2012-11-01 2013-03-27 华中科技大学 一种瓦记录磁盘的四级编址方法
US9324367B1 (en) * 2015-05-05 2016-04-26 Futurewei Technologies, Inc. SMR-aware append-only file system
CN105975215A (zh) * 2016-05-25 2016-09-28 深圳大学 一种基于Ondemand算法的STL映射表管理方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZENG , RUI: "Design and Implementation on Data Management for Shingled Recording Disks", CHINA MASTER'S THESES FULL-TEXT DATABASE (ELECTRONIC TECHNOLOGY & INFORMATION SCIENCE, 15 July 2013 (2013-07-15), ISSN: 1674-0246 *

Similar Documents

Publication Publication Date Title
US11579773B2 (en) Memory system and method of controlling memory system
US10430084B2 (en) Multi-tiered memory with different metadata levels
CN106708427B (zh) 一种适用于键值对数据的存储方法
WO2014201865A1 (zh) 一种nand闪存设备及其随机写入方法
JP5907739B2 (ja) 不揮発性記憶装置
US8171219B2 (en) Method and system to perform caching based on file-level heuristics
US20150178010A1 (en) Memory management based on usage specifications
WO2013024952A1 (ko) 메모리 컨트롤러 및 이의 데이터 관리방법
WO2013071882A1 (zh) 用于机群文件系统的元数据存储系统和管理方法
WO2019062747A1 (zh) 数据访问方法以及计算机系统
TW201510722A (zh) 以頁面為基礎管理快閃儲存裝置
CN105095113B (zh) 一种缓存管理方法和系统
WO2013123855A1 (zh) 存储器的读写控制方法及对应的存储器和服务器
CN109240944B (zh) 一种基于可变长缓存行的数据读写方法
CN105975215B (zh) 一种基于Ondemand算法的叠瓦式磁质存储翻译层映射表管理方法
US20140223072A1 (en) Tiered Caching Using Single Level Cell and Multi-Level Cell Flash Technology
CN110018971A (zh) 缓存替换技术
US20070174550A1 (en) Data area managing method in information recording medium and information processor employing data area managing method
TWI417720B (zh) 快閃記憶體管理方法與計算機系統
Chen et al. A unified framework for designing high performance in-memory and hybrid memory file systems
CN111443874B (zh) 基于内容感知的固态盘内存缓存管理方法、设备及固态盘
WO2023227004A1 (zh) 内存访问热度统计方法、相关装置及设备
WO2017201699A1 (zh) 一种基于Ondemand算法的STL映射表管理方法
WO2014139204A1 (zh) 一种闪存存储设备中数据管理的方法及装置
CN114741028A (zh) 一种基于ocssd的持久键值存储方法、设备及系统

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16902689

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 29.03.2019)

122 Ep: pct application non-entry in european phase

Ref document number: 16902689

Country of ref document: EP

Kind code of ref document: A1