WO2024046213A1 - Method and apparatus for caching blocks of redundant array of independent disks, and device and readable medium - Google Patents

Method and apparatus for caching blocks of redundant array of independent disks, and device and readable medium Download PDF

Info

Publication number
WO2024046213A1
WO2024046213A1 PCT/CN2023/114783 CN2023114783W WO2024046213A1 WO 2024046213 A1 WO2024046213 A1 WO 2024046213A1 CN 2023114783 W CN2023114783 W CN 2023114783W WO 2024046213 A1 WO2024046213 A1 WO 2024046213A1
Authority
WO
WIPO (PCT)
Prior art keywords
pointer variable
stripe
cache
memory
read
Prior art date
Application number
PCT/CN2023/114783
Other languages
French (fr)
Chinese (zh)
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 苏州元脑智能科技有限公司
Publication of WO2024046213A1 publication Critical patent/WO2024046213A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0625Power saving in storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • G06F3/0689Disk arrays, e.g. RAID, JBOD

Definitions

  • the present application relates to the field of computers, and more specifically to a method, device, equipment and non-volatile readable storage medium for independent redundant disk array block caching.
  • Storage technology is widely used in various major areas of today's society, such as banks and major universities. With the advancement of science and technology, storage technology has also made a qualitative leap. Development is no longer limited to the efficiency of storing data, data security and reliability, etc. The focus is gradually focusing on how to save memory and use less memory to complete business need.
  • RAID6 redundant array of independent disks storage technology stores user data information into the cache structure sce (sce) corresponding to the blocks in the cache stripe information sde (storage stripe cache information structure) structure. structure that stores chunked data information).
  • sce cache stripe information
  • sde storage stripe cache information structure
  • structure that stores chunked data information.
  • each sce structure is 64 bytes, then 64*16 bytes need to be allocated, as well as pointer variables pointing to these structures.
  • Each pointer variable is 8 bytes, that is, 8*16 bytes are allocated, and the memory required for a strip is (64+8)*16 bytes.
  • a RAID6 redundant array consists of a large number of stripes, so the memory requirements are also very large.
  • the purpose of the embodiments of this application is to propose a method, device, equipment and non-volatile readable storage medium for independent redundant disk array block caching.
  • disks can be effectively saved. Reduce the memory cost of the array, improve the performance of the storage system, and improve the competitiveness of the product.
  • one aspect of the embodiment of the present application provides a method for independent redundant disk array block caching, which includes the following steps:
  • the stripe number and block number where the data to be read are located is obtained based on the array address of the read IO process
  • determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
  • applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
  • calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading data based on the pointer variable includes:
  • the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory.
  • it also includes:
  • it also includes:
  • it also includes:
  • the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
  • Another aspect of the embodiment of the present application also provides a device for independent redundant disk array block caching.
  • the device includes:
  • the construction module is configured to determine the number of blocks in each stripe in the disk array and construct a strip cache information structure
  • the application module is configured to apply for memory from the fixed object pool according to the number of blocks in each stripe;
  • the first computing module is configured to perform a read IO process in response to the disk array, and obtain the strip number and block number where the data to be read is located based on the array address of the read IO process;
  • the second calculation module is configured to calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable.
  • the construction module is also configured to:
  • the application module is also configured to:
  • the second computing module is further configured to:
  • Another aspect of the embodiments of the present application also provides a computer device, which includes:
  • the memory stores computer instructions that can be run on the processor. When the instructions are executed by the processor, the steps of any of the above methods are implemented.
  • the non-volatile readable storage medium stores a computer program.
  • the computer program is executed by a processor, any one of the above methods is implemented. A step of.
  • the independent redundant disk array block cache method determines the number of blocks in each stripe in the disk array and constructs a strip cache information structure. ; Apply for memory from the fixed object pool according to the number of blocks in each stripe; Perform the read io process in response to the disk array, and obtain the stripe number and partition where the data to be read is located based on the array address of the read io process. Block number; calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read the data based on the pointer variable.
  • the technical solution can effectively save the memory cost of the disk array and improve the storage system. performance and improve product competitiveness.
  • Figure 1 is a schematic flow chart of a method for independent redundant disk array block caching according to some embodiments of the present application
  • Figure 2 is a schematic diagram of a strip cache information structure according to some embodiments of the present application.
  • Figure 3 is a schematic diagram of an independent redundant disk array block cache device according to some embodiments of the present application.
  • Figure 4 is a schematic diagram of a computer device according to some embodiments of the present application.
  • Figure 5 is a schematic diagram of a computer non-volatile readable storage medium according to some embodiments of the present application.
  • Figure 1 shows a schematic flow chart of the method.
  • the method may include the following steps:
  • S1 determines the number of blocks in each stripe in the disk array and constructs the stripe cache information structure. Determine the number x of blocks in each stripe in the disk array according to the requirements. The maximum value of x is 16 and the minimum value of x is 5. Reconstruct the strip cache information structure sde struct ⁇ sce*sceExtension[i ] ⁇ , as shown in Figure 2, where the maximum value of i in the sceExtension[i] array is 4 and the minimum value is 1. Based on the above-reconstructed strip cache information structure, you only need to allocate [(x/4) The entire +1]*8 bytes of memory are used to store pointer variables, and each stripe saves x*8-[(x+3)/4]*8 bytes of memory. For example, when creating a raid6 stripe width When it is 16, the memory saved per stripe is 16*8-4*8 bytes.
  • S2 applies for memory from the fixed object pool according to the number of blocks in each stripe. Based on the number of chunks
  • the memory applied for includes the memory corresponding to the block cache and the memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes. Then in a sceExtensions[i] array
  • the memory allocated by a pointer variable can actually store 4 sce.
  • S3 responds to the disk array and performs the read IO process, and obtains the strip number and block number where the data to be read is located based on the array address of the read IO process.
  • the strip number and block number where the data in the normal raid is located can be calculated based on the address in the read IO process. This calculation method can be calculated using any method in the existing technology. This No further details will be given.
  • S4 calculates the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reads the data based on the pointer variable.
  • the cache information of the block can be obtained through the pointer variable of sce.
  • the cache information of the block can be obtained through the pointer variable of sce.
  • the memory cost of the disk array can be effectively saved, the performance of the storage system can be improved, and the competitiveness of the product can be improved.
  • determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
  • applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
  • calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading the data based on the pointer variable includes:
  • the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory.
  • the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
  • the memory cost of the disk array can be effectively saved, the performance of the storage system can be improved, and the competitiveness of the product can be improved.
  • the method disclosed according to the embodiment of the present application can also be implemented as a computer program executed by a CPU, and the computer program can be stored in a computer-readable storage medium.
  • the computer program is executed by the CPU, the above functions defined in the method disclosed in the embodiment of the present application are performed.
  • the second aspect of the embodiment of the present application proposes a device for independent redundant disk array block caching.
  • the device 200 includes:
  • the construction module is configured to determine the number of blocks in each stripe in the disk array and construct a strip cache information structure
  • the application module is configured to apply for memory from the fixed object pool according to the number of blocks in each stripe;
  • the first computing module is configured to perform a read IO process in response to the disk array, and obtain the strip number and block number where the data to be read is located based on the array address of the read IO process;
  • the second calculation module is configured to calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable.
  • the construction module is also configured as:
  • the application module is also configured as:
  • the second computing module is further configured to:
  • the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory.
  • a judgment module is also included, and the judgment module is configured as:
  • the judgment module is also configured as:
  • the judgment module is also configured as:
  • the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
  • FIG. 4 shows a schematic diagram of an embodiment of a computer device provided by this application.
  • the embodiment of the present application includes the following devices: at least one processor 21; and a memory 22.
  • the memory 22 stores computer instructions 23 that can be run on the processor. When the instructions are executed by the processor, the following methods are implemented:
  • Memory is requested from the fixed object pool according to the number of blocks in each stripe. Based on the number of chunks
  • the memory requested includes the memory corresponding to the block cache and the memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes, so the memory allocated by a pointer variable in the sceExtensions[i] array can actually store 4 sce.
  • the stripe number and block number where the data to be read are located are obtained based on the array address of the read IO process.
  • the strip number and block number where the data in the normal raid is located can be calculated based on the address in the read IO process. This calculation method can be calculated using any method in the existing technology. This No further details will be given.
  • the cache information of the block can be obtained through the pointer variable of sce.
  • the cache information of the block can be obtained through the pointer variable of sce.
  • determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
  • applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
  • calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading the data based on the pointer variable includes:
  • the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory.
  • the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
  • FIG. 5 shows a schematic diagram of an embodiment of a computer-readable storage medium provided by this application.
  • the computer-readable storage medium 31 stores a computer program 32 that performs the following methods when executed by a processor:
  • Memory is requested from the fixed object pool according to the number of blocks in each stripe. Based on the number of chunks
  • the memory applied for includes the memory corresponding to the block cache and the memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes. Then in a sceExtensions[i] array
  • the memory allocated by a pointer variable can actually store 4 sce.
  • the stripe number and block number where the data to be read are located are obtained based on the array address of the read IO process.
  • the strip number and block number where the data in the normal raid is located can be calculated based on the address in the read IO process. This calculation method can be calculated using any method in the existing technology. This No further details will be given.
  • the cache information of the block can be obtained through the pointer variable of sce.
  • the cache information of the block can be obtained through the pointer variable of sce.
  • determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
  • applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
  • calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading the data based on the pointer variable includes:
  • the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
  • the object pointed to by the cache pointer variable is 256 bytes of memory.
  • the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
  • the method disclosed according to the embodiment of the present application can also be implemented as a computer program executed by a processor, and the computer program can be stored in a computer non-volatile readable storage medium.
  • the computer program is executed by the processor, the above functions defined in the method disclosed in the embodiment of the present application are performed.
  • the above method steps and system units can also be implemented using a controller and a computer non-volatile readable storage medium for storing a computer program that enables the controller to implement the above steps or unit functions.
  • functionality may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functionality may be stored on or transmitted over as one or more instructions or code on a computer non-volatile readable storage medium.
  • Computer non-volatile readable storage media includes computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. Storage media can be any available media that can be accessed by a general purpose or special purpose computer.
  • the computer non-volatile readable storage medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage devices, magnetic disk storage devices or other magnetic storage devices, or may be used to carry or Any other medium that stores required program code in the form of instructions or data structures and that can be accessed by a general or special purpose computer or a general or special purpose processor. Also, any connection is properly termed a computer-readable storage medium.
  • coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave are used to deliver software from a website, server, or other remote source
  • coaxial cable Cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of media.
  • disks and optical disks include compact disks (CDs), laser disks, optical disks, digital versatile disks (DVDs), floppy disks, and Blu-ray disks, where disks typically reproduce data magnetically, while optical disks reproduce data optically using lasers. . Combinations of the above should also be included within the scope of computer non-volatile readable storage media.
  • the program can be stored in a computer-readable storage medium.
  • the above-mentioned The storage medium can be a read-only memory, a magnetic disk or an optical disk, etc.

Landscapes

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

Abstract

Provided in the present application are a method and apparatus for caching blocks of a redundant array of independent disks, and a device and a readable storage medium. The method comprises: determining the number of blocks in each stripe in a disk array, and constructing stripe cache information structural bodies; applying for an internal memory from a fixed object pool according to the number of blocks in each stripe; in response to the disk array performing a read io process, according to an array address of the read io process, calculating a stripe serial number and a block serial number, where data to be read is located; and calculating a pointer variable of a stripe cache information structural body that corresponds to the block serial number in a cache structure corresponding to the stripe serial number, and reading the data on the basis of the pointer variable. By using the solution of the present application, the internal memory cost of disk arrays can be effectively saved on, the performance of storage systems is improved, and the competitiveness of products is improved.

Description

独立冗余磁盘阵列分块缓存方法、装置、设备及可读介质Independent redundant disk array block caching method, device, equipment and readable medium
本申请要求于2022年09月01日提交中国专利局,申请号为202211059821.3,申请名称为“独立冗余磁盘阵列分块缓存方法、装置、设备及可读介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires priority to be submitted to the China Patent Office on September 1, 2022, with the application number 202211059821.3, and the application name is "Independent redundant disk array block caching method, device, equipment and readable medium", The entire contents of which are incorporated herein by reference.
技术领域Technical field
本申请涉及计算机领域,并且更具体地涉及一种独立冗余磁盘阵列分块缓存的方法、装置、设备及非易失性可读存储介质。The present application relates to the field of computers, and more specifically to a method, device, equipment and non-volatile readable storage medium for independent redundant disk array block caching.
背景技术Background technique
存储技术广泛应用于当今社会的各大领域,如银行以及各大高校等。随着科技的进步,存储的技术也有了质的飞跃,发展不再局限于存储数据的高效性,数据安全性以及可靠性等,焦点逐渐集中于如何节约内存,用更少的内存去完成业务需求。Storage technology is widely used in various major areas of today's society, such as banks and major universities. With the advancement of science and technology, storage technology has also made a qualitative leap. Development is no longer limited to the efficiency of storing data, data security and reliability, etc. The focus is gradually focusing on how to save memory and use less memory to complete business need.
RAID6(独立的磁盘组成的具有冗余性的阵列)存储技术,将用户的数据信息存储到缓存条带信息sde(存储条带缓存信息结构体)结构体内的分块对应的缓存结构体sce(存储分块数据信息的结构体)中。Raid6初始化过程中,会根据规格创建的盘数确定一个条带内分块的个数,然后预留以及分配对应分块所需要的缓存sce结构体的内存,以及指向这些内存的指针变量。例如:其中条带内分块个数上限为16,那么当创建16块盘的RAID6时,每个sce结构体64字节,那么需要分配64*16字节,以及指向这些结构体的指针变量:每个指针变量8字节,即分配8*16字节,一个条带所需要的内存为(64+8)*16字节。RAID6冗余阵列由大量的条带组成,那么内存的需求也是非常大的。RAID6 (redundant array of independent disks) storage technology stores user data information into the cache structure sce (sce) corresponding to the blocks in the cache stripe information sde (storage stripe cache information structure) structure. structure that stores chunked data information). During the initialization process of Raid6, the number of blocks in a stripe is determined based on the number of disks created according to the specifications, and then the memory of the cache sce structure required for the corresponding blocks is reserved and allocated, as well as pointer variables pointing to these memories. For example: the upper limit of the number of blocks in a stripe is 16, then when creating a RAID6 with 16 disks, each sce structure is 64 bytes, then 64*16 bytes need to be allocated, as well as pointer variables pointing to these structures. : Each pointer variable is 8 bytes, that is, 8*16 bytes are allocated, and the memory required for a strip is (64+8)*16 bytes. A RAID6 redundant array consists of a large number of stripes, so the memory requirements are also very large.
发明内容Contents of the invention
有鉴于此,本申请实施例的目的在于提出一种独立冗余磁盘阵列分块缓存的方法、装置、设备及非易失性可读存储介质,通过使用本申请的技术方案,能够有效节约磁盘阵列的内存成本,提升存储系统的性能,提高产品的竞争力。In view of this, the purpose of the embodiments of this application is to propose a method, device, equipment and non-volatile readable storage medium for independent redundant disk array block caching. By using the technical solution of this application, disks can be effectively saved. Reduce the memory cost of the array, improve the performance of the storage system, and improve the competitiveness of the product.
基于上述目的,本申请的实施例的一个方面提供了一种独立冗余磁盘阵列分块缓存的方法,包括以下步骤:Based on the above purpose, one aspect of the embodiment of the present application provides a method for independent redundant disk array block caching, which includes the following steps:
确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体;Determine the number of blocks in each stripe in the disk array, and construct the stripe cache information structure;
根据每个条带内的分块的个数从固定对象池中申请内存;Apply memory from the fixed object pool according to the number of blocks in each stripe;
响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号;In response to the disk array performing the read IO process, the stripe number and block number where the data to be read are located is obtained based on the array address of the read IO process;
计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。Calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable.
根据本申请的一些实施例,确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体包括:According to some embodiments of the present application, determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。 Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
根据本申请的一些实施例,根据每个条带内的分块的个数从固定对象池中申请内存包括:According to some embodiments of the present application, applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
根据本申请的一些实施例,计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据包括:According to some embodiments of the present application, calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading data based on the pointer variable includes:
根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
根据本申请的一些实施例,申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存。According to some embodiments of the present application, the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
根据本申请的一些实施例,缓存指针变量指向的对象为256字节的内存。According to some embodiments of the present application, the object pointed to by the cache pointer variable is 256 bytes of memory.
根据本申请的一些实施例,还包括:According to some embodiments of the present application, it also includes:
判断基于指针变量读取数据是否缓存命中。Determine whether the data read based on the pointer variable is a cache hit.
根据本申请的一些实施例,还包括:According to some embodiments of the present application, it also includes:
响应于缓存命中,从指针变量对应的分块中读取数据。In response to a cache hit, data is read from the block corresponding to the pointer variable.
根据本申请的一些实施例,还包括:According to some embodiments of the present application, it also includes:
响应于缓存未命中,从盘上读取数据,并将读取的结果存入指针变量对应的结构中。In response to a cache miss, the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
本申请的实施例的另一个方面,还提供了一种独立冗余磁盘阵列分块缓存的装置,装置包括:Another aspect of the embodiment of the present application also provides a device for independent redundant disk array block caching. The device includes:
构造模块,构造模块配置为确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体;The construction module is configured to determine the number of blocks in each stripe in the disk array and construct a strip cache information structure;
申请模块,申请模块配置为根据每个条带内的分块的个数从固定对象池中申请内存;The application module is configured to apply for memory from the fixed object pool according to the number of blocks in each stripe;
第一计算模块,第一计算模块配置为响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号;The first computing module is configured to perform a read IO process in response to the disk array, and obtain the strip number and block number where the data to be read is located based on the array address of the read IO process;
第二计算模块,第二计算模块配置为计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。The second calculation module is configured to calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable.
根据本申请的一些实施例,构造模块还配置为:According to some embodiments of the present application, the construction module is also configured to:
确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
根据本申请的一些实施例,申请模块还配置为:According to some embodiments of the present application, the application module is also configured to:
根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
根据本申请的一些实施例,第二计算模块还配置为: According to some embodiments of the present application, the second computing module is further configured to:
根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
本申请的实施例的另一个方面,还提供了一种计算机设备,该计算机设备包括:Another aspect of the embodiments of the present application also provides a computer device, which includes:
至少一个处理器;以及at least one processor; and
存储器,存储器存储有可在处理器上运行的计算机指令,指令由处理器执行时实现上述任意一项方法的步骤。The memory stores computer instructions that can be run on the processor. When the instructions are executed by the processor, the steps of any of the above methods are implemented.
本申请的实施例的另一个方面,还提供了一种非易失性可读存储介质,非易失性可读存储介质存储有计算机程序,计算机程序被处理器执行时实现上述任意一项方法的步骤。Another aspect of the embodiment of the present application also provides a non-volatile readable storage medium. The non-volatile readable storage medium stores a computer program. When the computer program is executed by a processor, any one of the above methods is implemented. A step of.
本申请具有以下有益技术效果:本申请实施例提供的独立冗余磁盘阵列分块缓存的方法,通过确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体;根据每个条带内的分块的个数从固定对象池中申请内存;响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号;计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据的技术方案,能够有效节约磁盘阵列的内存成本,提升存储系统的性能,提高产品的竞争力。The present application has the following beneficial technical effects: The independent redundant disk array block cache method provided by the embodiment of the present application determines the number of blocks in each stripe in the disk array and constructs a strip cache information structure. ; Apply for memory from the fixed object pool according to the number of blocks in each stripe; Perform the read io process in response to the disk array, and obtain the stripe number and partition where the data to be read is located based on the array address of the read io process. Block number; calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read the data based on the pointer variable. The technical solution can effectively save the memory cost of the disk array and improve the storage system. performance and improve product competitiveness.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present application or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts.
图1为根据本申请一些实施例的独立冗余磁盘阵列分块缓存的方法的示意性流程图;Figure 1 is a schematic flow chart of a method for independent redundant disk array block caching according to some embodiments of the present application;
图2为根据本申请一些实施例的条带缓存信息结构体的示意图;Figure 2 is a schematic diagram of a strip cache information structure according to some embodiments of the present application;
图3为根据本申请一些实施例的独立冗余磁盘阵列分块缓存的装置的示意图;Figure 3 is a schematic diagram of an independent redundant disk array block cache device according to some embodiments of the present application;
图4为根据本申请一些实施例的计算机设备的示意图;Figure 4 is a schematic diagram of a computer device according to some embodiments of the present application;
图5为根据本申请一些实施例的计算机非易失性可读存储介质的示意图。Figure 5 is a schematic diagram of a computer non-volatile readable storage medium according to some embodiments of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本申请实施例进一步详细说明。In order to make the purpose, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to specific embodiments and the accompanying drawings.
基于上述目的,本申请的实施例的第一个方面,提出了一种独立冗余磁盘阵列分块缓存的方法的一些实施例。图1示出的是该方法的示意性流程图。Based on the above purpose, the first aspect of the embodiments of this application proposes some embodiments of a method for independent redundant disk array block caching. Figure 1 shows a schematic flow chart of the method.
如图1中所示,该方法可以包括以下步骤: As shown in Figure 1, the method may include the following steps:
S1确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体。根据需求确定磁盘阵列中每个条带内的分块的个数x,x的最大值为16,x的最小值为5,并重新构造条带缓存信息结构体sde struct{sce*sceExtension[i]},如图2所示,其中sceExtension[i]数组中i的最大值为4,最小值为1,基于上述重新构造的条带缓存信息结构体,只需要分配[(x/4)取整+1]*8个字节的内存去存指针变量,每个条带节省了x*8-[(x+3)/4]*8个字节的内存,例如当创建raid6条带宽度为16时,每个条带节约的内存为16*8-4*8个字节。S1 determines the number of blocks in each stripe in the disk array and constructs the stripe cache information structure. Determine the number x of blocks in each stripe in the disk array according to the requirements. The maximum value of x is 16 and the minimum value of x is 5. Reconstruct the strip cache information structure sde struct{sce*sceExtension[i ]}, as shown in Figure 2, where the maximum value of i in the sceExtension[i] array is 4 and the minimum value is 1. Based on the above-reconstructed strip cache information structure, you only need to allocate [(x/4) The entire +1]*8 bytes of memory are used to store pointer variables, and each stripe saves x*8-[(x+3)/4]*8 bytes of memory. For example, when creating a raid6 stripe width When it is 16, the memory saved per stripe is 16*8-4*8 bytes.
S2根据每个条带内的分块的个数从固定对象池中申请内存。基于分块个数x和上述重新构造的条带缓存信息结构体,可以根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存,其中申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存,其中缓存指针变量指向的对象为256字节的内存,每个sce大小为64字节,那么一个sceExtensions[i]数组中的一个指针变量分配的内存里面实际可以存储4个sce。S2 applies for memory from the fixed object pool according to the number of blocks in each stripe. Based on the number of chunks The memory applied for includes the memory corresponding to the block cache and the memory corresponding to the cache pointer variable. The object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes. Then in a sceExtensions[i] array The memory allocated by a pointer variable can actually store 4 sce.
S3响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号。在磁盘阵列进行读io流程时,可以根据读io流程中的地址计算出在正常raid中的数据所在的条带编号和分块编号,该计算方法可以使用现有技术中任意的方法计算,此处不再赘述。S3 responds to the disk array and performs the read IO process, and obtains the strip number and block number where the data to be read is located based on the array address of the read IO process. When the disk array performs the read IO process, the strip number and block number where the data in the normal raid is located can be calculated based on the address in the read IO process. This calculation method can be calculated using any method in the existing technology. This No further details will be given.
S4计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。计算出在正常raid中的数据所在的条带编号和分块编号后,需要计算出数据在重新构造的条带缓存信息结构体中的指针变量,可以根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号,然后根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号,最后根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,其中stripnum为第二个公式计算后的值。获得分块对应的缓存结构的指针变量后,那么分块的缓存的信息就可通过sce的指针变量获取,在读取数据时需要判断基于指针变量读取数据是否缓存命中,如果缓存命中,则从指针变量对应的分块中读取数据,如果缓存未命中,则从盘上读取数据,并将读取的结果存入指针变量对应的结构中。S4 calculates the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reads the data based on the pointer variable. After calculating the strip number and block number where the data in the normal raid is located, you need to calculate the pointer variable of the data in the reconstructed strip cache information structure, which can be calculated according to the formula Sce**psce=sceExtension+stripnum/ 4 Calculate the pointer variable of sceExtension[i], where *psce is the pointer variable of sceExtension[i], sceExtension is the address of the first element in the array sceExtension[i] of the strip cache information structure, stripnum is the block number, and then Calculate the block number in the strip cache information structure according to the formula stripnum&=3, stripnum is the block number, and finally calculate the block number in the cache structure corresponding to the stripe number according to the formula pointer variable=*psce+stripnum The pointer variable of the corresponding strip cache information structure, where stripnum is the value calculated by the second formula. After obtaining the pointer variable of the cache structure corresponding to the block, the cache information of the block can be obtained through the pointer variable of sce. When reading the data, it is necessary to determine whether the data read based on the pointer variable is a cache hit. If the cache is hit, then Read data from the block corresponding to the pointer variable. If the cache misses, read the data from the disk and store the read result in the structure corresponding to the pointer variable.
通过使用本申请的方案,能够有效节约磁盘阵列的内存成本,提升存储系统的性能,提高产品的竞争力。By using the solution of this application, the memory cost of the disk array can be effectively saved, the performance of the storage system can be improved, and the competitiveness of the product can be improved.
在本申请的一个优选实施例中,确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体包括:In a preferred embodiment of the present application, determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4,其中i的最佳取值为4,缓存指针变量指向的对象为256字节的内存,每个sce大小为64字节,那么一个sceExtensions[i]数组中的一个指针变量分配的内存里面实际可以存储4个sce。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4, where the optimal value of i is 4, and the object pointed to by the cache pointer variable is 256 bytes of memory, each The size of sce is 64 bytes, so the memory allocated by a pointer variable in a sceExtensions[i] array can actually store 4 sce.
在本申请的一个优选实施例中,根据每个条带内的分块的个数从固定对象池中申请内存包括: In a preferred embodiment of this application, applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
在本申请的一个优选实施例中,计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据包括:In a preferred embodiment of the present application, calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading the data based on the pointer variable includes:
根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
在本申请的一个优选实施例中,申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存。In a preferred embodiment of this application, the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
在本申请的一个优选实施例中,缓存指针变量指向的对象为256字节的内存。In a preferred embodiment of this application, the object pointed to by the cache pointer variable is 256 bytes of memory.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
判断基于指针变量读取数据是否缓存命中。Determine whether the data read based on the pointer variable is a cache hit.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
响应于缓存命中,从指针变量对应的分块中读取数据。In response to a cache hit, data is read from the block corresponding to the pointer variable.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
响应于缓存未命中,从盘上读取数据,并将读取的结果存入指针变量对应的结构中。In response to a cache miss, the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
通过使用本申请的方案,能够有效节约磁盘阵列的内存成本,提升存储系统的性能,提高产品的竞争力。By using the solution of this application, the memory cost of the disk array can be effectively saved, the performance of the storage system can be improved, and the competitiveness of the product can be improved.
需要说明的是,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关硬件来完成,上述的程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中存储介质可为磁碟、光盘、只读存储器(Read-Only Memory,ROM)或随机存取存储器(Random Access Memory,RAM)等。上述计算机程序的实施例,可以达到与之对应的前述任意方法实施例相同或者相类似的效果。It should be noted that those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through computer programs. The above programs can be stored in computer-readable storage media. When the program is executed, it may include the processes of the above method embodiments. The storage media can be magnetic disks, optical disks, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM), etc. The foregoing computer program embodiments can achieve the same or similar effects as any of the corresponding foregoing method embodiments.
此外,根据本申请实施例公开的方法还可以被实现为由CPU执行的计算机程序,该计算机程序可以存储在计算机可读存储介质中。在该计算机程序被CPU执行时,执行本申请实施例公开的方法中限定的上述功能。In addition, the method disclosed according to the embodiment of the present application can also be implemented as a computer program executed by a CPU, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the CPU, the above functions defined in the method disclosed in the embodiment of the present application are performed.
基于上述目的,本申请的实施例的第二个方面,提出了一种独立冗余磁盘阵列分块缓存的装置,如图3所示,装置200包括:Based on the above purpose, the second aspect of the embodiment of the present application proposes a device for independent redundant disk array block caching. As shown in Figure 3, the device 200 includes:
构造模块,构造模块配置为确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体;The construction module is configured to determine the number of blocks in each stripe in the disk array and construct a strip cache information structure;
申请模块,申请模块配置为根据每个条带内的分块的个数从固定对象池中申请内存;The application module is configured to apply for memory from the fixed object pool according to the number of blocks in each stripe;
第一计算模块,第一计算模块配置为响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号; The first computing module is configured to perform a read IO process in response to the disk array, and obtain the strip number and block number where the data to be read is located based on the array address of the read IO process;
第二计算模块,第二计算模块配置为计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。The second calculation module is configured to calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable.
在本申请的一个优选实施例中,构造模块还配置为:In a preferred embodiment of this application, the construction module is also configured as:
确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
在本申请的一个优选实施例中,申请模块还配置为:In a preferred embodiment of this application, the application module is also configured as:
根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
在本申请的一个优选实施例中,第二计算模块还配置为:In a preferred embodiment of the present application, the second computing module is further configured to:
根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
在本申请的一个优选实施例中,申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存。In a preferred embodiment of this application, the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
在本申请的一个优选实施例中,缓存指针变量指向的对象为256字节的内存。In a preferred embodiment of this application, the object pointed to by the cache pointer variable is 256 bytes of memory.
在本申请的一个优选实施例中,还包括判断模块,判断模块配置为:In a preferred embodiment of the present application, a judgment module is also included, and the judgment module is configured as:
判断基于指针变量读取数据是否缓存命中。Determine whether the data read based on the pointer variable is a cache hit.
在本申请的一个优选实施例中,判断模块还配置为:In a preferred embodiment of this application, the judgment module is also configured as:
响应于缓存命中,从指针变量对应的分块中读取数据。In response to a cache hit, data is read from the block corresponding to the pointer variable.
在本申请的一个优选实施例中,判断模块还配置为:In a preferred embodiment of this application, the judgment module is also configured as:
响应于缓存未命中,从盘上读取数据,并将读取的结果存入指针变量对应的结构中。In response to a cache miss, the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
基于上述目的,本申请实施例的第三个方面,提出了一种计算机设备。图4示出的是本申请提供的计算机设备的实施例的示意图。如图4所示,本申请实施例包括如下装置:至少一个处理器21;以及存储器22,存储器22存储有可在处理器上运行的计算机指令23,指令由处理器执行时实现以下方法:Based on the above purpose, a third aspect of the embodiment of the present application provides a computer device. FIG. 4 shows a schematic diagram of an embodiment of a computer device provided by this application. As shown in Figure 4, the embodiment of the present application includes the following devices: at least one processor 21; and a memory 22. The memory 22 stores computer instructions 23 that can be run on the processor. When the instructions are executed by the processor, the following methods are implemented:
确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体。根据需求确定磁盘阵列中每个条带内的分块的个数x,x的最大值为16,x的最小值为5,并重新构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中sceExtension[i]数组中i的最大值为4,最小值为1,基于上述重新构造的条带缓存信息结构体,只需要分配[(x/4)取整+1]*8个字节的内存去存指针变量,每个条带节省了x*8-[(x+3)/4]*8个字节的内存,例如当创建raid6条带宽度为16时,每个条带节约的内存为16*8-4*8个字节。Determine the number of blocks in each stripe in the disk array, and construct the stripe cache information structure. Determine the number x of blocks in each stripe in the disk array according to the requirements. The maximum value of x is 16 and the minimum value of x is 5. Reconstruct the strip cache information structure sde struct{sce*sceExtension[i ]}, where the maximum value of i in the sceExtension[i] array is 4 and the minimum value is 1. Based on the above-reconstructed strip cache information structure, only [(x/4) rounding + 1]*8 needs to be allocated Bytes of memory are used to store pointer variables, and each stripe saves x*8-[(x+3)/4]*8 bytes of memory. For example, when creating a raid6 strip with a width of 16, each stripe saves x*8-[(x+3)/4]*8 bytes of memory. The memory saved by striping is 16*8-4*8 bytes.
根据每个条带内的分块的个数从固定对象池中申请内存。基于分块个数x和上述重新构造的条带缓存信息结构体,可以根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存,其中申请的内存包括分块缓存对应的内存和缓存指针变量对应的内 存,其中缓存指针变量指向的对象为256字节的内存,每个sce大小为64字节,那么一个sceExtensions[i]数组中的一个指针变量分配的内存里面实际可以存储4个sce。Memory is requested from the fixed object pool according to the number of blocks in each stripe. Based on the number of chunks The memory requested includes the memory corresponding to the block cache and the memory corresponding to the cache pointer variable. Storage, the object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes, so the memory allocated by a pointer variable in the sceExtensions[i] array can actually store 4 sce.
响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号。在磁盘阵列进行读io流程时,可以根据读io流程中的地址计算出在正常raid中的数据所在的条带编号和分块编号,该计算方法可以使用现有技术中任意的方法计算,此处不再赘述。In response to the disk array performing a read IO process, the stripe number and block number where the data to be read are located are obtained based on the array address of the read IO process. When the disk array performs the read IO process, the strip number and block number where the data in the normal raid is located can be calculated based on the address in the read IO process. This calculation method can be calculated using any method in the existing technology. This No further details will be given.
计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。计算出在正常raid中的数据所在的条带编号和分块编号后,需要计算出数据在重新构造的条带缓存信息结构体中的指针变量,可以根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号,然后根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号,最后根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,其中stripnum为第二个公式计算后的值。获得分块对应的缓存结构的指针变量后,那么分块的缓存的信息就可通过sce的指针变量获取,在读取数据时需要判断基于指针变量读取数据是否缓存命中,如果缓存命中,则从指针变量对应的分块中读取数据,如果缓存未命中,则从盘上读取数据,并将读取的结果存入指针变量对应的结构中。Calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable. After calculating the strip number and block number where the data in the normal raid is located, you need to calculate the pointer variable of the data in the reconstructed strip cache information structure, which can be calculated according to the formula Sce**psce=sceExtension+stripnum/ 4 Calculate the pointer variable of sceExtension[i], where *psce is the pointer variable of sceExtension[i], sceExtension is the address of the first element in the array sceExtension[i] of the strip cache information structure, stripnum is the block number, and then Calculate the block number in the strip cache information structure according to the formula stripnum&=3, stripnum is the block number, and finally calculate the block number in the cache structure corresponding to the stripe number according to the formula pointer variable=*psce+stripnum The pointer variable of the corresponding strip cache information structure, where stripnum is the value calculated by the second formula. After obtaining the pointer variable of the cache structure corresponding to the block, the cache information of the block can be obtained through the pointer variable of sce. When reading the data, it is necessary to determine whether the data read based on the pointer variable is a cache hit. If the cache is hit, then Read data from the block corresponding to the pointer variable. If the cache misses, read the data from the disk and store the read result in the structure corresponding to the pointer variable.
在本申请的一个优选实施例中,确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体包括:In a preferred embodiment of the present application, determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
在本申请的一个优选实施例中,根据每个条带内的分块的个数从固定对象池中申请内存包括:In a preferred embodiment of this application, applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
在本申请的一个优选实施例中,计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据包括:In a preferred embodiment of the present application, calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading the data based on the pointer variable includes:
根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
在本申请的一个优选实施例中,申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存。In a preferred embodiment of this application, the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
在本申请的一个优选实施例中,缓存指针变量指向的对象为256字节的内存。In a preferred embodiment of this application, the object pointed to by the cache pointer variable is 256 bytes of memory.
在本申请的一个优选实施例中,还包括: In a preferred embodiment of the present application, it also includes:
判断基于指针变量读取数据是否缓存命中。Determine whether the data read based on the pointer variable is a cache hit.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
响应于缓存命中,从指针变量对应的分块中读取数据。In response to a cache hit, data is read from the block corresponding to the pointer variable.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
响应于缓存未命中,从盘上读取数据,并将读取的结果存入指针变量对应的结构中。In response to a cache miss, the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
基于上述目的,本申请实施例的第四个方面,提出了一种计算机可读存储介质。图5示出的是本申请提供的计算机可读存储介质的实施例的示意图。如图5所示,计算机可读存储介质31存储有被处理器执行时执行如下方法的计算机程序32:Based on the above purpose, a fourth aspect of the embodiments of the present application provides a computer-readable storage medium. FIG. 5 shows a schematic diagram of an embodiment of a computer-readable storage medium provided by this application. As shown in Figure 5, the computer-readable storage medium 31 stores a computer program 32 that performs the following methods when executed by a processor:
确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体。根据需求确定磁盘阵列中每个条带内的分块的个数x,x的最大值为16,x的最小值为5,并重新构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中sceExtension[i]数组中i的最大值为4,最小值为1,基于上述重新构造的条带缓存信息结构体,只需要分配[(x/4)取整+1]*8个字节的内存去存指针变量,每个条带节省了x*8-[(x+3)/4]*8个字节的内存,例如当创建raid6条带宽度为16时,每个条带节约的内存为16*8-4*8个字节。Determine the number of blocks in each stripe in the disk array, and construct the stripe cache information structure. Determine the number x of blocks in each stripe in the disk array according to the requirements. The maximum value of x is 16 and the minimum value of x is 5. Reconstruct the strip cache information structure sde struct{sce*sceExtension[i ]}, where the maximum value of i in the sceExtension[i] array is 4 and the minimum value is 1. Based on the above-reconstructed strip cache information structure, only [(x/4) rounding + 1]*8 needs to be allocated Bytes of memory are used to store pointer variables, and each stripe saves x*8-[(x+3)/4]*8 bytes of memory. For example, when creating a raid6 strip with a width of 16, each stripe saves x*8-[(x+3)/4]*8 bytes of memory. The memory saved by striping is 16*8-4*8 bytes.
根据每个条带内的分块的个数从固定对象池中申请内存。基于分块个数x和上述重新构造的条带缓存信息结构体,可以根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存,其中申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存,其中缓存指针变量指向的对象为256字节的内存,每个sce大小为64字节,那么一个sceExtensions[i]数组中的一个指针变量分配的内存里面实际可以存储4个sce。Memory is requested from the fixed object pool according to the number of blocks in each stripe. Based on the number of chunks The memory applied for includes the memory corresponding to the block cache and the memory corresponding to the cache pointer variable. The object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes. Then in a sceExtensions[i] array The memory allocated by a pointer variable can actually store 4 sce.
响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号。在磁盘阵列进行读io流程时,可以根据读io流程中的地址计算出在正常raid中的数据所在的条带编号和分块编号,该计算方法可以使用现有技术中任意的方法计算,此处不再赘述。In response to the disk array performing a read IO process, the stripe number and block number where the data to be read are located are obtained based on the array address of the read IO process. When the disk array performs the read IO process, the strip number and block number where the data in the normal raid is located can be calculated based on the address in the read IO process. This calculation method can be calculated using any method in the existing technology. This No further details will be given.
计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。计算出在正常raid中的数据所在的条带编号和分块编号后,需要计算出数据在重新构造的条带缓存信息结构体中的指针变量,可以根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号,然后根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号,最后根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,其中stripnum为第二个公式计算后的值。获得分块对应的缓存结构的指针变量后,那么分块的缓存的信息就可通过sce的指针变量获取,在读取数据时需要判断基于指针变量读取数据是否缓存命中,如果缓存命中,则从指针变量对应的分块中读取数据,如果缓存未命中,则从盘上读取数据,并将读取的结果存入指针变量对应的结构中。Calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable. After calculating the strip number and block number where the data in the normal raid is located, you need to calculate the pointer variable of the data in the reconstructed strip cache information structure, which can be calculated according to the formula Sce**psce=sceExtension+stripnum/ 4 Calculate the pointer variable of sceExtension[i], where *psce is the pointer variable of sceExtension[i], sceExtension is the address of the first element in the array sceExtension[i] of the strip cache information structure, stripnum is the block number, and then Calculate the block number in the strip cache information structure according to the formula stripnum&=3, stripnum is the block number, and finally calculate the block number in the cache structure corresponding to the stripe number according to the formula pointer variable=*psce+stripnum The pointer variable of the corresponding strip cache information structure, where stripnum is the value calculated by the second formula. After obtaining the pointer variable of the cache structure corresponding to the block, the cache information of the block can be obtained through the pointer variable of sce. When reading the data, it is necessary to determine whether the data read based on the pointer variable is a cache hit. If the cache is hit, then Read data from the block corresponding to the pointer variable. If the cache misses, read the data from the disk and store the read result in the structure corresponding to the pointer variable.
在本申请的一个优选实施例中,确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体包括:In a preferred embodiment of the present application, determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16; Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
在本申请的一个优选实施例中,根据每个条带内的分块的个数从固定对象池中申请内存包括:In a preferred embodiment of this application, applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
在本申请的一个优选实施例中,计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据包括:In a preferred embodiment of the present application, calculating the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and reading the data based on the pointer variable includes:
根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
在本申请的一个优选实施例中,申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存。In a preferred embodiment of the present application, the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
在本申请的一个优选实施例中,缓存指针变量指向的对象为256字节的内存。In a preferred embodiment of this application, the object pointed to by the cache pointer variable is 256 bytes of memory.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
判断基于指针变量读取数据是否缓存命中。Determine whether the data read based on the pointer variable is a cache hit.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
响应于缓存命中,从指针变量对应的分块中读取数据。In response to a cache hit, data is read from the block corresponding to the pointer variable.
在本申请的一个优选实施例中,还包括:In a preferred embodiment of the present application, it also includes:
响应于缓存未命中,从盘上读取数据,并将读取的结果存入指针变量对应的结构中。In response to a cache miss, the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
此外,根据本申请实施例公开的方法还可以被实现为由处理器执行的计算机程序,该计算机程序可以存储在计算机非易失性可读存储介质中。在该计算机程序被处理器执行时,执行本申请实施例公开的方法中限定的上述功能。In addition, the method disclosed according to the embodiment of the present application can also be implemented as a computer program executed by a processor, and the computer program can be stored in a computer non-volatile readable storage medium. When the computer program is executed by the processor, the above functions defined in the method disclosed in the embodiment of the present application are performed.
此外,上述方法步骤以及系统单元也可以利用控制器以及用于存储使得控制器实现上述步骤或单元功能的计算机程序的计算机非易失性可读存储介质实现。In addition, the above method steps and system units can also be implemented using a controller and a computer non-volatile readable storage medium for storing a computer program that enables the controller to implement the above steps or unit functions.
本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。为了清楚地说明硬件和软件的这种可互换性,已经就各种示意性组件、方块、模块、电路和步骤的功能对其进行了一般性的描述。这种功能是被实现为软件还是被实现为硬件取决于具体应用以及施加给整个系统的设计约束。本领域技术人员可以针对每种具体应用以各种方式来实现的功能,但是这种实现决定不应被解释为导致脱离本申请实施例公开的范围。Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits and steps have been described generally in terms of their functionality. Whether this functionality is implemented as software or hardware depends on the specific application and the design constraints imposed on the overall system. Those skilled in the art can implement the functions in various ways for each specific application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments disclosed in the present application.
在一个或多个示例性设计中,功能可以在硬件、软件、固件或其任意组合中实现。如果在软件中实现,则可以将功能作为一个或多个指令或代码存储在计算机非易失性可读存储介质上或通过计算机非易失性可读存储介质来传送。计算机非易失性可读存储介质包括计算机存储介质和通信介质,该通信介质包括有助于将计算机程序从一个位置传送到另一个位置的任何介质。存储介质可以是能够被通用或专用计算机访问的任何可用介质。作为 例子而非限制性的,该计算机非易失性可读存储介质可以包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储设备、磁盘存储设备或其它磁性存储设备,或者是可以用于携带或存储形式为指令或数据结构的所需程序代码并且能够被通用或专用计算机或者通用或专用处理器访问的任何其它介质。此外,任何连接都可以适当地称为计算机非易失性可读存储介质。例如,如果使用同轴线缆、光纤线缆、双绞线、数字用户线路(DSL)或诸如红外线、无线电和微波的无线技术来从网站、服务器或其它远程源发送软件,则上述同轴线缆、光纤线缆、双绞线、DSL或诸如红外线、无线电和微波的无线技术均包括在介质的定义。如这里所使用的,磁盘和光盘包括压缩盘(CD)、激光盘、光盘、数字多功能盘(DVD)、软盘、蓝光盘,其中磁盘通常磁性地再现数据,而光盘利用激光光学地再现数据。上述内容的组合也应当包括在计算机非易失性可读存储介质的范围内。In one or more example designs, functionality may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functionality may be stored on or transmitted over as one or more instructions or code on a computer non-volatile readable storage medium. Computer non-volatile readable storage media includes computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. Storage media can be any available media that can be accessed by a general purpose or special purpose computer. as By way of example and not limitation, the computer non-volatile readable storage medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage devices, magnetic disk storage devices or other magnetic storage devices, or may be used to carry or Any other medium that stores required program code in the form of instructions or data structures and that can be accessed by a general or special purpose computer or a general or special purpose processor. Also, any connection is properly termed a computer-readable storage medium. For example, if coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave are used to deliver software from a website, server, or other remote source, the coaxial cable Cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of media. As used herein, disks and optical disks include compact disks (CDs), laser disks, optical disks, digital versatile disks (DVDs), floppy disks, and Blu-ray disks, where disks typically reproduce data magnetically, while optical disks reproduce data optically using lasers. . Combinations of the above should also be included within the scope of computer non-volatile readable storage media.
以上是本申请公开的示例性实施例,但是应当注意,在不背离权利要求限定的本申请实施例公开的范围的前提下,可以进行多种改变和修改。根据这里描述的公开实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。此外,尽管本申请实施例公开的元素可以以个体形式描述或要求,但除非明确限制为单数,也可以理解为多个。The above are exemplary embodiments disclosed in the present application, but it should be noted that various changes and modifications can be made without departing from the scope of the embodiments disclosed in the present application as defined in the claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present application may be described or claimed in individual form, they may also be understood as plural unless explicitly limited to the singular.
应当理解的是,在本文中使用的,除非上下文清楚地支持例外情况,单数形式“一个”旨在也包括复数形式。还应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任意和所有可能组合。It will be understood that, as used herein, the singular form "a" and "an" are intended to include the plural form as well, unless the context clearly supports an exception. It will also be understood that as used herein, "and/or" is meant to include any and all possible combinations of one or more of the associated listed items.
上述本申请实施例公开实施例序号仅仅为了描述,不代表实施例的优劣。The embodiment numbers disclosed in the above embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage medium can be a read-only memory, a magnetic disk or an optical disk, etc.
所属领域的普通技术人员应当理解:以上任何实施例的讨论仅为示例性的,并非旨在暗示本申请实施例公开的范围(包括权利要求)被限于这些例子;在本申请实施例的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,并存在如上的本申请实施例的不同方面的许多其它变化,为了简明它们没有在细节中提供。因此,凡在本申请实施例的精神和原则之内,所做的任何省略、修改、等同替换、改进等,均应包含在本申请实施例的保护范围之内。 Those of ordinary skill in the art should understand that the above discussion of any embodiments is only illustrative, and is not intended to imply that the scope of the disclosure of the embodiments of the present application (including the claims) is limited to these examples; under the ideas of the embodiments of the present application , the above embodiments or technical features in different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present application, which are not provided in details for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.

Claims (20)

  1. 一种独立冗余磁盘阵列分块缓存的方法,其特征在于,包括以下步骤:A method for independent redundant disk array block caching, which is characterized by including the following steps:
    确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体;Determine the number of blocks in each stripe in the disk array, and construct the stripe cache information structure;
    根据每个条带内的分块的个数从固定对象池中申请内存;Apply memory from the fixed object pool according to the number of blocks in each stripe;
    响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号;In response to the disk array performing the read IO process, the stripe number and block number where the data to be read are located is obtained based on the array address of the read IO process;
    计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。Calculate the pointer variable of the stripe cache information structure corresponding to the block number in the cache structure corresponding to the stripe number, and read data based on the pointer variable.
  2. 根据权利要求1所述的方法,其特征在于,确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体包括:The method according to claim 1, characterized in that determining the number of blocks in each stripe in the disk array and constructing the stripe cache information structure includes:
    确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
    构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
  3. 根据权利要求2所述的方法,其特征在于,还包括:The method according to claim 2, further comprising:
    分配[(x/4)取整+1]*8个字节的内存用于存指针变量。Allocate [(x/4) rounded + 1]*8 bytes of memory to store pointer variables.
  4. 根据权利要求2或3所述的方法,其特征在于,还包括:The method according to claim 2 or 3, further comprising:
    若所创建的条带宽度为x时,则根据x*8-[(x+3)/4]*8的方式,计算条带节省的字节数。If the width of the created stripe is x, calculate the number of bytes saved by the stripe according to the method x*8-[(x+3)/4]*8.
  5. 根据权利要求2或3所述的方法,其特征在于,根据每个条带内的分块的个数从固定对象池中申请内存包括:The method according to claim 2 or 3, characterized in that applying for memory from the fixed object pool according to the number of blocks in each stripe includes:
    根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
  6. 根据权利要求5所述的方法,其特征在于,还包括:The method according to claim 5, further comprising:
    若所述缓存指针变量指向的对象为256字节的内存,且每个sce大小为64个字节,则一个sceExtensions[i]数组中的一个指针变量分配的内存用于存储4个sce。If the object pointed to by the cache pointer variable is 256 bytes of memory, and the size of each sce is 64 bytes, then the memory allocated by a pointer variable in a sceExtensions[i] array is used to store 4 sce.
  7. 根据权利要求2所述的方法,其特征在于,计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据包括:The method according to claim 2, characterized in that calculating the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number, and reading the data based on the pointer variable includes:
    根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
    根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
    根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
  8. 根据权利要求7所述的方法,其特征在于,所述公式指针变量=*psce+stripnum中的stripnum为所述公式stripnum&=3计算后的值。The method according to claim 7, characterized in that stripnum in the formula pointer variable =*psce+stripnum is the calculated value of the formula stripnum&=3.
  9. 根据权利要求7或8所述的方法,其特征在于,还包括:The method according to claim 7 or 8, further comprising:
    若获得分块对应的缓存结构的指针变量,则通过sce的指针变量获取分块的缓存的信息。If the pointer variable of the cache structure corresponding to the block is obtained, the cache information of the block is obtained through the pointer variable of sce.
  10. 根据权利要求5所述的方法,其特征在于,申请的内存包括分块缓存对应的内存和缓存指针变量对应的内存。 The method according to claim 5, characterized in that the applied memory includes memory corresponding to the block cache and memory corresponding to the cache pointer variable.
  11. 根据权利要求10所述的方法,其特征在于,缓存指针变量指向的对象为256字节的内存。The method according to claim 10, characterized in that the object pointed to by the cache pointer variable is a 256-byte memory.
  12. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    判断基于指针变量读取数据是否缓存命中。Determine whether the data read based on the pointer variable is a cache hit.
  13. 根据权利要求12所述的方法,其特征在于,还包括:The method of claim 12, further comprising:
    响应于缓存命中,从指针变量对应的分块中读取数据。In response to a cache hit, data is read from the block corresponding to the pointer variable.
  14. 根据权利要求12所述的方法,其特征在于,还包括:The method of claim 12, further comprising:
    响应于缓存未命中,从盘上读取数据,并将读取的结果存入指针变量对应的结构中。In response to a cache miss, the data is read from the disk and the read result is stored in the structure corresponding to the pointer variable.
  15. 一种独立冗余磁盘阵列分块缓存的装置,其特征在于,所述装置包括:An independent redundant disk array block caching device, characterized in that the device includes:
    构造模块,所述构造模块配置为确定磁盘阵列中每个条带内的分块的个数,并构造条带缓存信息结构体;A construction module configured to determine the number of blocks in each stripe in the disk array and construct a stripe cache information structure;
    申请模块,所述申请模块配置为根据每个条带内的分块的个数从固定对象池中申请内存;An application module configured to apply for memory from the fixed object pool according to the number of blocks in each stripe;
    第一计算模块,所述第一计算模块配置为响应于磁盘阵列进行读io流程,根据读io流程的阵列地址求出要读的数据所在的条带编号和分块编号;A first computing module, the first computing module is configured to perform a read IO process in response to the disk array, and obtain the strip number and block number where the data to be read is located based on the array address of the read IO process;
    第二计算模块,所述第二计算模块配置为计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量,并基于指针变量读取数据。The second calculation module is configured to calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number, and read data based on the pointer variable.
  16. 根据权利要求15所述的装置,其特征在于,所述构造模块还配置为:The device according to claim 15, characterized in that the construction module is further configured to:
    确定磁盘阵列中每个条带内的分块的个数x,其中5≤x≤16;Determine the number x of blocks in each stripe in the disk array, where 5≤x≤16;
    构造条带缓存信息结构体sde struct{sce*sceExtension[i]},其中1≤i≤4。Construct the strip cache information structure sde struct{sce*sceExtension[i]}, where 1≤i≤4.
  17. 根据权利要求16所述的装置,其特征在于,所述申请模块还配置为:The device according to claim 16, characterized in that the application module is further configured to:
    根据公式[(x+3)/4]取整*(8+256)计算申请内存的大小并申请对应大小的内存。Calculate the size of the requested memory according to the formula [(x+3)/4] rounded * (8+256) and apply for memory of the corresponding size.
  18. 根据权利要求16所述的装置,其特征在于,所述第二计算模块还配置为:The device according to claim 16, wherein the second computing module is further configured to:
    根据公式Sce**psce=sceExtension+stripnum/4计算sceExtension[i]的指针变量,其中*psce为sceExtension[i]的指针变量,sceExtension为条带缓存信息结构体的数组sceExtension[i]中首个元素的地址,stripnum为分块编号;Calculate the pointer variable of sceExtension[i] according to the formula Sce**psce=sceExtension+stripnum/4, where *psce is the pointer variable of sceExtension[i], and sceExtension is the first one in the array sceExtension[i] of the strip cache information structure. The address of the element, stripnum is the block number;
    根据公式stripnum&=3计算分块编号在条带缓存信息结构体中的分块编号,stripnum为分块编号;Calculate the block number in the strip cache information structure according to the formula stripnum&=3, where stripnum is the block number;
    根据公式指针变量=*psce+stripnum计算条带编号对应的缓存结构中分块编号对应的条带缓存信息结构体的指针变量。Calculate the pointer variable of the strip cache information structure corresponding to the block number in the cache structure corresponding to the strip number according to the formula pointer variable=*psce+stripnum.
  19. 一种计算机设备,其特征在于,包括:A computer device, characterized in that it includes:
    至少一个处理器;以及at least one processor; and
    存储器,所述存储器存储有可在所述处理器上运行的计算机指令,所述指令由所述处理器执行时实现权利要求1-14任意一项所述方法的步骤。A memory that stores computer instructions executable on the processor, and when executed by the processor, the instructions implement the steps of the method of any one of claims 1-14.
  20. 一种非易失性可读存储介质,所述非易失性可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-14任意一项所述方法的步骤。 A non-volatile readable storage medium, the non-volatile readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the computer program implements any one of claims 1-14 Method steps.
PCT/CN2023/114783 2022-09-01 2023-08-24 Method and apparatus for caching blocks of redundant array of independent disks, and device and readable medium WO2024046213A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211059821.3 2022-09-01
CN202211059821.3A CN115129265B (en) 2022-09-01 2022-09-01 Partitioned caching method, device, equipment and readable medium for redundant array of independent disks

Publications (1)

Publication Number Publication Date
WO2024046213A1 true WO2024046213A1 (en) 2024-03-07

Family

ID=83386891

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/114783 WO2024046213A1 (en) 2022-09-01 2023-08-24 Method and apparatus for caching blocks of redundant array of independent disks, and device and readable medium

Country Status (2)

Country Link
CN (1) CN115129265B (en)
WO (1) WO2024046213A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115129265B (en) * 2022-09-01 2023-01-24 苏州浪潮智能科技有限公司 Partitioned caching method, device, equipment and readable medium for redundant array of independent disks
CN115373609A (en) * 2022-10-25 2022-11-22 浪潮电子信息产业股份有限公司 Task processing method and related equipment
CN115543216B (en) * 2022-11-29 2023-03-21 苏州浪潮智能科技有限公司 Disk array distribution architecture, block calculation method, system, device and medium
CN115543696B (en) * 2022-11-30 2023-03-17 苏州浪潮智能科技有限公司 Disk array reconstruction task acceleration method, system, storage medium and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060179219A1 (en) * 2005-02-09 2006-08-10 Fujitsu Limited Configuration definition setup method for disk array apparatus, and disk array apparatus
CN103049222A (en) * 2012-12-28 2013-04-17 中国船舶重工集团公司第七0九研究所 RAID5 (redundant array of independent disk 5) write IO optimization processing method
CN114064979A (en) * 2021-11-02 2022-02-18 郑州云海信息技术有限公司 Method for accelerating acquisition of storage data of RAID (redundant array of independent disks), computer and storage medium
CN115129265A (en) * 2022-09-01 2022-09-30 苏州浪潮智能科技有限公司 Partitioned caching method, device, equipment and readable medium for redundant array of independent disks

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111007987A (en) * 2019-11-08 2020-04-14 苏州浪潮智能科技有限公司 Memory management method, system, terminal and storage medium for raid io
CN112148218B (en) * 2020-09-11 2023-12-22 北京浪潮数据技术有限公司 Method, device, equipment and storage medium for storing check data of disk array

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060179219A1 (en) * 2005-02-09 2006-08-10 Fujitsu Limited Configuration definition setup method for disk array apparatus, and disk array apparatus
CN103049222A (en) * 2012-12-28 2013-04-17 中国船舶重工集团公司第七0九研究所 RAID5 (redundant array of independent disk 5) write IO optimization processing method
CN114064979A (en) * 2021-11-02 2022-02-18 郑州云海信息技术有限公司 Method for accelerating acquisition of storage data of RAID (redundant array of independent disks), computer and storage medium
CN115129265A (en) * 2022-09-01 2022-09-30 苏州浪潮智能科技有限公司 Partitioned caching method, device, equipment and readable medium for redundant array of independent disks

Also Published As

Publication number Publication date
CN115129265B (en) 2023-01-24
CN115129265A (en) 2022-09-30

Similar Documents

Publication Publication Date Title
WO2024046213A1 (en) Method and apparatus for caching blocks of redundant array of independent disks, and device and readable medium
US9569118B2 (en) Promoting consistent response times in a data storage system having multiple data retrieval mechanisms
US8533397B2 (en) Improving performance in a cache mechanism by way of destaging data in partial strides
CN102937882B (en) To effective access with the memory device using bitmap
US9632702B2 (en) Efficient initialization of a thinly provisioned storage array
WO2017148242A1 (en) Method for accessing shingled magnetic recording (smr) hard disk, and server
JP2013156977A (en) Elastic cache of redundant cache data
WO2019226297A1 (en) Edit transactions for blockchains
CN104142892B (en) A kind of data read-write method, apparatus and system
US20150067281A1 (en) Reservation of storage space for a thin provisioned volume
CN110502188A (en) A kind of date storage method and device based on data base read-write performance
CN115617742A (en) Data caching method, system, equipment and storage medium
WO2024098698A1 (en) Redundant array of independent disks initialization method and apparatus, device, and readable storage medium
WO2016116930A1 (en) Reusable memory devices with wom codes
US9940034B2 (en) Reducing read access latency by straddling pages across non-volatile memory channels
US8402199B2 (en) Memory management system and method thereof
CN109240943A (en) Address mapping relation feedback method, device, equipment and readable storage medium storing program for executing
WO2012024054A2 (en) Systems and methods for efficient sequential logging on caching-enabled storage devices
CN103827837A (en) Method, device and system for accessing solid state disk space
WO2023020136A1 (en) Data storage method and apparatus in storage system
US9563363B2 (en) Flexible storage block for a solid state drive (SSD)-based file system
CN114253478B (en) Method and device for calculating RAID check disk position
US11379326B2 (en) Data access method, apparatus and computer program product
CN107562654A (en) I/O command processing method and device
CN104731672A (en) Data storage method and device

Legal Events

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

Ref document number: 23859246

Country of ref document: EP

Kind code of ref document: A1