WO2016095761A1 - Cache processing method and apparatus - Google Patents

Cache processing method and apparatus Download PDF

Info

Publication number
WO2016095761A1
WO2016095761A1 PCT/CN2015/097176 CN2015097176W WO2016095761A1 WO 2016095761 A1 WO2016095761 A1 WO 2016095761A1 CN 2015097176 W CN2015097176 W CN 2015097176W WO 2016095761 A1 WO2016095761 A1 WO 2016095761A1
Authority
WO
WIPO (PCT)
Prior art keywords
data block
large data
storage space
cache image
count value
Prior art date
Application number
PCT/CN2015/097176
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 WO2016095761A1 publication Critical patent/WO2016095761A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control

Definitions

  • the embodiments of the present invention relate to a storage technology, and in particular, to a cache processing method and apparatus.
  • the desktop cloud separates the personal computer desktop environment from the physical machine through the cloud computing mode, and becomes a service that can provide desktops externally.
  • FIG. 1 is a schematic diagram of an application scenario of a desktop cloud in the prior art.
  • the application scenario includes a parent image 1 , a cache image 2 , a sub mirror 3 , and a virtual machine 4 .
  • the cache image 2 link is cloned in the parent image 1 and the sub mirror 3 link is cloned in the cache image 2 .
  • FIG. 1 shows that as shown in FIG.
  • the write IO directly writes the data block into the sub-image 3; the read IO first reads the data block into the sub-image, if the data block If it exists in the submirror, it is read in the submirror; if the data block does not exist in the submirror, it is read in the cache image; if the data block does not exist in the cache image, it is read in the parent image. The read data block is written to the cache image so that the data block can be read from the cache image the next time the same data block is read.
  • the parent image, the cache image, and the sub-mirror are in the virtual hard disk format (VHD).
  • VHD virtual hard disk format
  • the maximum size of the VHD file does not exceed the size of the local storage file system, and the VHD cannot perform the data block replacement function.
  • the data blocks read from the parent image can only be written to the cache image in the same way. If the local storage file system space where the cache image resides is used up, the new data block cannot be written to the cache. In the image, some data in the cache image may not be read later or rarely, so the proportion of useful data blocks in the cache image is reduced, resulting in wasted cache space.
  • the embodiment of the invention provides a method and a device for processing a cache, which replaces the second largest data block that is aged with a new first large data block, and then writes the small data block that needs to be written into the cache image, thereby effectively improving The utilization of storage space.
  • a first aspect of the embodiments of the present invention provides a method for processing a cache, including:
  • the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replacing the first large data block with the second largest data block in the cache image, And writing the small data block to a storage space corresponding to the first large data block in the cache image.
  • the method further includes:
  • the method further includes:
  • the identifier of the first large data block and the corresponding access count value are written into the management linked list.
  • the method further includes:
  • the replacing the first large data block with the second largest data block in the cache image, and The small data block is written into the storage space corresponding to the first large data block in the cache image, and specifically includes:
  • the starting offset position of the first large data block is the starting offset position of the second large data block;
  • the first large data block is added to the cache image, and the small data block is written
  • the storage space corresponding to the first large data block in the cache image includes:
  • a fifth possible implementation manner of the first aspect if the first large data block is in a cache image, the management is performed according to the access count value. Updating a location of the identifier of the first large data block and the access count value in a linked list, and writing the small data block to a storage space corresponding to the first large data block in the cache image.
  • a second aspect of the embodiments of the present invention provides a cache processing apparatus, including:
  • a reading module configured to receive a read input and output IO request, and read a small data block from the parent image according to the read IO request;
  • the checking module is configured to: if the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupied ratio of the storage space is greater than or equal to a preset ratio Threshold value
  • a processing module if the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replacing the first large data block with the first one of the cache image Two large data blocks, and writing the small data block to the first big data in the cache image The storage space corresponding to the block.
  • the reading module is further configured to increase an access count value of the first large data block that includes the small data block by one;
  • the processing module is further configured to write the identifier of the first large data block and the corresponding access count value into the management linked list.
  • the processing module is further configured to: if the storage space of the cache image is not full or the proportion of the storage space is occupied If the threshold is smaller than the preset ratio, the first large data block is added to the cache image, and the small data block is written into a storage space corresponding to the first large data block in the cache image.
  • the processing module includes:
  • a second large data block obtaining unit configured to sequentially search from the header position of the management linked list according to an access count value of the first large data block, acquire the second large data block, and use the second
  • the identification and access count value of the big data block is removed from the management linked list, and the identifier and the access count value of the first large data block are written before the identifier of the third large data block in the management linked list;
  • the second large data block is the first data block in the management linked list, and the access count value is less than or equal to the access count value of the first large data block; the third large data block is deleted.
  • the access data is greater than or equal to the first data block of the access count value of the first large data block;
  • a location marking unit configured to invalidate a location identifier corresponding to the second large data block in the BAT, and store a starting offset location of the first large data block to a location corresponding to the first large data block in the BAT;
  • the starting offset position of the first large data block is a starting offset position of the second large data block;
  • a small data block writing unit configured to write the small data block into a storage space corresponding to a starting offset position of the first large data block in the cache image.
  • the processing module includes:
  • An identifier writing unit configured to write an identifier of the first large data block and an access count value into the management linked list according to an access count value of the first large data block;
  • a free block obtaining unit configured to find a free block in the cache image, and write the small data block into the free block; wherein the free block is a storage corresponding to the first large data block Empty between;
  • a location writing unit configured to write a starting offset position of the free block to a location corresponding to the free block in the BAT.
  • the processing module includes:
  • an update unit configured to: when the first large data block is in the cache image, update the location of the identifier of the first large data block and the access count in the management link table according to the access count value And storing the small data block into a storage space corresponding to the first large data block in the cache image.
  • the processing method of the cache receives a read input and output IO request, and reads a small data block from the parent image according to the read IO request, and if the first large data block including the small data block is not in the cache image, Check whether the storage space of the cache mirror is full or the proportion of storage space is greater than or equal to the preset ratio threshold. If the storage space of the cache mirror is full or the storage ratio is greater than or equal to the preset ratio threshold, it will be the first.
  • the big data block replaces the second largest data block in the cache image, and writes the small data block into the storage space corresponding to the first largest data block in the cache image.
  • the new data block can no longer be written into the cache image.
  • the storage space in the cache image is full.
  • the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replace the second largest data block in the cache image with the first large data block, and write the small data block into the storage corresponding to the second largest data block in the cache image.
  • Space that is, replace the aging second largest data block with the new first large data block, and then write the small data block that needs to be written into the cache image, which effectively improves the utilization of the storage space.
  • FIG. 1 is a schematic diagram of an application scenario of a desktop cloud in the prior art
  • FIG. 2 is a flowchart of a method for processing a cache according to Embodiment 1 of the present invention
  • FIG. 3 is a flowchart of a method for processing a cache according to Embodiment 2 of the present invention.
  • FIG. 4 is a schematic diagram of a management chain table before the identification of the first big data block moves
  • FIG. 5 is a schematic diagram of a management chain table after the identification of the first large data block is moved
  • Figure 6 is a schematic diagram of bit chart management
  • FIG. 7 is a flowchart of a method for processing a cache according to Embodiment 3 of the present invention.
  • FIG. 8 is a schematic diagram of a management link table before the first large data block enters the cache image in the third embodiment
  • FIG. 9 is a schematic diagram of a management chain table after the first large data block enters the cache image in the third embodiment
  • FIG. 10 is a flowchart of a method for processing a cache according to Embodiment 4 of the present invention.
  • FIG. 11 is a schematic diagram of a management chain table before the first large data block enters the cache image in the fourth embodiment
  • FIG. 12 is a schematic diagram of a management chain table after the first large data block enters the cache image in the fourth embodiment
  • FIG. 13 is a schematic structural diagram of a cache processing apparatus according to Embodiment 5 of the present invention.
  • FIG. 14 is a schematic structural diagram of a cache processing apparatus according to Embodiment 6 of the present invention.
  • FIG. 15 is a schematic structural diagram of a cache processing apparatus according to Embodiment 7 of the present invention.
  • FIG. 16 is a schematic structural diagram of a cache processing apparatus according to Embodiment 8 of the present invention.
  • FIG. 2 is a flowchart of a method for processing a cache according to Embodiment 1 of the present invention.
  • the executor may be a central processing unit (CPU), a server, a physical host, a terminal device, etc., and is not limited thereto.
  • the method includes the following steps:
  • Step 101 Receive an Input and Output (IO) request, and read a small data block from the parent image according to the read IO request.
  • IO Input and Output
  • the small data block needs to be read from the parent image according to the read IO request.
  • the read IO request may include an identifier of the small data block, for example, a number of the small data block or a starting offset address of the small data block storage.
  • a large data block can be divided into multiple small data blocks. For example, 512B can be used as a small data block and 2MB as a large data block.
  • a 2MB data block can also be used as a small data block, and a 20 GB data block can be used as a big data block.
  • the block can be set according to actual conditions, and is not limited in the present invention.
  • Step 102 If the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold.
  • the first large data block including the small data block is not in the cache image, and it is indicated that any small data block in the first large data block is stored in the storage space of the cache image, if the first big data At least one small data block in the block is stored in the storage space of the cache image, and the first large data block is in the cache image.
  • the storage space of the cache image can be a local high-speed storage device.
  • the storage speed and the input and output per second (IOPS) are much larger than those of the ordinary hard disk. It can be either a memory or a solid state disk.
  • a storage device that can perform high-speed interoperability, such as Solid State Disk (SSD), can select a suitable storage device for caching from the perspective of cost, performance, and life cycle.
  • SSD Solid State Disk
  • Step 103 If the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold, replace the first large data block with the second largest data block in the cache image, and write the small data block.
  • the storage space of the cached image is full, that is, the storage space cannot be stored in an additional manner, or if the storage ratio of the cached image is greater than or equal to a preset ratio threshold, for example,
  • a preset ratio threshold for example, When the occupation ratio of the storage space exceeds 80%, the first large data block is replaced with the second largest data block in the cache image, and the small data block is written into the storage space corresponding to the first large data block in the cache image.
  • the second largest data block is a large data block in the cache image that is accessed relatively small times, or a large data block that has not been accessed within a preset time period, or may be accessed less than or equal to the number of times.
  • a preset cache replacement policy may be used to replace the second largest data block in the cache image with the first large data block.
  • the cache replacement policy may be a Least Recently Used (LRU) policy, or a Least Frequently Used (LFU) policy, or other policies, and those skilled in the art may
  • LRU Least Recently Used
  • LFU Least Frequently Used
  • an appropriate cache replacement strategy is selected, which is not limited in this invention.
  • an aging time with a relatively small number of times of being accessed is found in the cache image.
  • the aging large data block is used as the second largest data block, and the storage space of the second largest data block in the cache image is reserved to the first large data block, and the small data in the first large data block is used.
  • the small data block is written to the storage space corresponding to the original second largest data block in the cache image.
  • the processing method of the cache receives a read input and output IO request, and reads a small data block from the parent image according to the read IO request, and if the first large data block including the small data block is not in the cache image, Check whether the storage space of the cache mirror is full or the proportion of storage space is greater than or equal to the preset ratio threshold. If the storage space of the cache mirror is full or the storage ratio is greater than or equal to the preset ratio threshold, it will be the first.
  • the big data block replaces the second largest data block in the cache image, and writes the small data block into the storage space corresponding to the first largest data block in the cache image.
  • the new data block can no longer be written into the cache image.
  • the storage space in the cache image is full.
  • the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replace the second largest data block in the cache image with the first large data block, and write the small data block into the storage corresponding to the second largest data block in the cache image.
  • Space that is, replace the aging second largest data block with the new first large data block, and then write the small data block that needs to be written into the cache image, which effectively improves the utilization of the storage space.
  • FIG. 3 is a flowchart of a method for processing a cache according to Embodiment 2 of the present invention. As shown in FIG. 3, the method includes the following steps:
  • Step 201 Receive a read input and output IO request, and read a small data block from the parent image according to the read IO request.
  • Step 202 Add an access count value of the first large data block including the small data block by one.
  • the access count value is used to record the number of times the first large data block is accessed, when there is a small data block in the first large data block, regardless of whether the first large data block is in the cache image, Add 1 to the access count value of the first large data block.
  • Step 203 Determine whether the first large data block that includes the small data block is in the cache image. If yes, that is, the first large data block that includes the small data block is in the cache image, step 208 is performed; if not, the small data is included. If the first large data block of the block is not in the cache image, step 204 is performed.
  • Step 204 Write the identifier of the first large data block and the corresponding access count value into the management linked list.
  • the management linked list is used to manage large data blocks in the cache image and store big data.
  • the identifier of the block and the access count value of the big data block, and the management chain table may specifically be an LFU linked list.
  • the head node points to the most recent big block with the smallest access count
  • the tail point points to the oldest block with the largest access count.
  • the first data block is in the cache image, that is, the small data block in the first large data block is stored in the storage space of the cache image, if there is no management list.
  • the identifier of the first large data block is not in the cache image, that is, no small data block in the first large data block is stored in the storage space of the cache image.
  • the identifier of the first large data block and the corresponding access count value are written into the management linked list, indicating that the first largest The data block is in the cache image.
  • the access count value of all large data blocks is set to 0, and these large data blocks are managed by the management linked list. If there are small data blocks in the large data block into the cache image, that is, the small data blocks included in the first large data block.
  • the first big block identifier and the access count value are added to the management list.
  • Step 205 Check whether the storage space of the cached image is full or the proportion of the storage space is greater than or equal to a preset ratio threshold. If yes, the storage space of the cached image is full or the occupied proportion of the storage space is greater than or equal to a preset ratio threshold. Then, step 206 is performed; if no, that is, the storage space of the cache image is not full or the occupation ratio of the storage space is less than the preset ratio threshold, step 207 is performed.
  • Step 206 Replace the first large data block with the second largest data block in the cache image, and write the small data block into the storage space corresponding to the first large data block in the cache image.
  • Step 207 Add the first large data block to the cache image, and write the small data block into the storage space corresponding to the first large data block in the cache image. End.
  • the first large data block can be added to the cache image by using two methods, one is preemption in advance, and the other is dynamic allocation.
  • the preemption method is to occupy the cache space in advance when the first large data block is cached and added to the cache, regardless of whether the small data block in the first large data block can be accessed and stored in the storage space of the cache image.
  • the space required for the first largest data block in the middle (such as 2MB); the dynamic allocation method allocates only the space required for small data blocks in the storage space (such as several 512B) when the first large data block is added to the cache image. This way you can make more useful small data blocks into the cache image.
  • Step 208 Update, according to the access count value, a location and an access count value of the identifier of the first large data block in the management linked list, and write the small data block into the storage space corresponding to the first large data block in the cache image. between.
  • the management link list when the first large data block is in the cache image, that is, the management link list has the identifier and the access count value of the first large data block, according to the access count value, in the management linked list, from the first big data.
  • the location of the identified identity of the block begins, the first large data block whose access count value is less than or equal to the access count value of the first large data block is found, and the identifier of the first large data block and the access count value are written to the first large Before the data block.
  • FIG. 4 is a schematic diagram of a management chain table before the identification of the first large data block moves
  • FIG. 5 is a schematic diagram of the management chain table after the identification of the first large data block moves.
  • BLOCK1 big data block 1
  • BLOCK6 big data block 6
  • BLOCK8 big data block 8
  • BLOCK8 In the management list, BLOCK8 is still in front of BLOCK6, then BLOCK8 needs to be moved in the management list. .
  • BLOCK8 At the current position of BLOCK8, look backwards to find the first data block whose access count value is greater than or equal to 3, in this case BLOCK1, as shown in Figure 5, move BLOCK8 to BLOCK1 in the management list.
  • a small data block in a large data block may also be managed by using a bitmap, for example, a 2 MB data block is used as a large data block, and a 512B data block is used as a small data block,
  • the 2MB big data block can be further divided into 4096 512B small data blocks.
  • These 512B data blocks can be managed by using a bit chart. Each 512B in the bit chart is managed with 1 bit.
  • 6 is a schematic diagram of bit chart management. As shown in FIG. 6, the bitmap shows the management diagram of two 2MB data blocks. If the corresponding bit value is 0, it means that the corresponding 512B is not in the storage space of the cache image.
  • the corresponding bit value is 1, it means that the corresponding 512B is in the storage space of the cache image. It should be noted that FIG. 6 only shows eight 512B data blocks, and all 512B data blocks in one 2MB data block are not used. The actual operation is subject to actual conditions.
  • the corresponding position in the bitmap is 0.
  • the position corresponding to the small data block in the bit chart is updated to 1.
  • the processing method of the cache receives the read input and output IO request, and reads the small data block from the parent image according to the read IO request, and adds the access count value of the first large data block to 1, if the first The big data block is in the cache image, and according to the access count value, the location and the access count value of the identifier of the first large data block are updated in the management linked list, and the small data block is written into the first large data block in the cache image.
  • the storage space if the first large data block is not in the cache image, write the identifier of the first large data block and the corresponding access count value into the management chain table, and check whether the storage space of the cache image is full or the storage space is occupied.
  • the ratio is greater than or equal to the preset ratio threshold. If the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, the first large data block is replaced with the second largest data block in the cache image. And the small data block is written into the storage space corresponding to the first large data block in the cache image. If the storage space of the cache image is not full or the storage space occupancy ratio is less than the preset ratio threshold, if not, the storage space of the cache image is not The occupancy ratio of full or storage space is less than the preset ratio threshold. Compared with the prior art, when the storage space of the cache image is used up, the new data block can no longer be written into the cache image.
  • not only the new first large data block can be implemented. Replace the aging second largest data block, and then write the small data block that needs to be written into the cache image, which effectively improves the utilization of the storage space.
  • the management chain table is used to manage the large data blocks in the cache image according to the big data. The access count value of the block can quickly and easily find the aging data block, and improve the efficiency of the replacement, join and data block identification of the big data block in the linked list.
  • FIG. 7 is a flowchart of a method for processing a cache according to Embodiment 3 of the present invention.
  • the step of “replace the first large data block with the second largest data block in the cache image and write the small data block into the storage space corresponding to the first large data block in the cache image” The implementation includes the following steps:
  • Step 301 According to the access count value of the first big data block, search from the header position of the management linked list, obtain the second largest data block, and remove the identifier and the access count value of the second large data block from the management linked list. And write the identity and access count value of the first large data block before the identity of the third big data block in the management linked list.
  • the second largest data block is the first data block in the management linked list, and the access count value is less than or equal to the access count value of the first large data block; the third largest data block is the identifier of the second largest data block deleted. In the subsequent management list, the access count value is greater than or equal to the first data block of the access count value of the first large data block.
  • the management linked list according to the access count value of the first large data block, starting from the position of the header, the data block whose first access count value is less than or equal to the access count value of the second data is found.
  • the data block is used as the second largest data block, and the identifier and the access count value of the second largest data block are removed from the management linked list, indicating that the second large data block does not exist in the cache image, and the first big data is The identity of the block and the access count value are written into the management list, indicating that the first large block of data exists in the cache image.
  • FIG. 8 is a schematic diagram of a management link table before the first large data block enters the cache image in the third embodiment
  • FIG. 9 is a schematic diagram of the management link table after the first large data block enters the cache image in the third embodiment.
  • the management list includes data block 3 (BLOCK3), data block 6 (BLOCK6), data block 1 (BLOCK1), and data block 8 (BLOCK8).
  • the access count value of BLOCK3 is 5, and the access of BLOCK6 is as shown in FIG.
  • the count value is 7, the access count value of BLOCK1 is 7, and the access count value of BLOCK8 is 8.
  • the first large data block is BLOCK5 and the access count value is 5.
  • BLOCK5 When BLOCK5 is accessed again, its access count value is increased to 1 and the access count value of BLOCK5 is already greater than BLOCK3. That is, BLOCK3 is the data block whose first access count value is less than BLOCK5, then BLOCK3 is the second largest. Data block, and in the management linked list, BLOCK5 is not in the linked list, that is, the first large data block is not in the cache image, then it needs to be replaced in the management linked list, as shown in Figure 9, BLOCK3 is removed from the linked list, and BLOCK5 joins the management list.
  • BLOCK6 that is, BLOCK6 is the fourth data block, then add BLOCK5 to the management list. Before BLOCK6.
  • the access count value of the identifier of more data blocks may be included in the management linked list, and is not limited to FIG. 8 and FIG. 9 .
  • Step 302 Disable the location tag corresponding to the second large data block in the BAT, and store the starting offset location of the first large data block to a location corresponding to the first large data block in the BAT.
  • the starting offset position of the first large data block is the starting offset position of the second large data block.
  • 2 MB data blocks are used as big data blocks
  • 512B data blocks are used as small data blocks
  • BAT is used to manage these 2 MB blocks
  • BAT stores the start of each 2 MB data block in the storage space. Offset position. For example, for a VHD virtual hard disk file with a capacity of 20 GB, the number of BAT entries is 10,240. If the 5th 2MB data block is stored at the location where the VHD virtual hard disk file offset address is 100M, the fifth in the BAT. The value at the table entry is 100M. If an item in the BAT is 0XFFFFFFFF, it means that the data block does not exist in the cache image.
  • Table 1 is the BAT before the first large data block is added to the cache image in the third embodiment.
  • Table 2 is the BAT after the first large data block is added to the cache image in the third embodiment.
  • the BAT stores the starting position offset addresses of the three data blocks, which are 6M+1.5K, 4M+1K, and 2M+512, respectively, and 0M indicates the storage space corresponding to the BAT. Relative starting offset position, not the actual starting point in the storage space Offset position.
  • the starting offset position of the second large data block is 6M+1.5K
  • the third entry in the BAT is marked as 0XFFFFFFFF, indicating that the third data is not in the cache image, and then The initial offset position is written into the fifth entry of the BAT written by 6M+1.5K.
  • the fifth entry in the BAT corresponds to the starting offset position of the first large data block. It is indicated that the first large data block exists in the cache image, and the storage space of the first large data block is the storage space of the original second largest data block.
  • Step 303 Write the small data block into the storage space corresponding to the starting offset position of the first large data block in the cache image.
  • each small data block has a corresponding position in the first large data block, and the first large data block occupies the storage space of the original second largest data block, if the small size needs to be written If the data block has a data block storage at a position corresponding to the original second largest data block, the data block in the original corresponding position is directly replaced by the small data block; if the small data block to be written is in the original second largest data block If there is no data block storage in the corresponding location, the small data block needs to be allocated a storage space in the corresponding storage location to store the small data block in the allocated storage space.
  • the third item in the entry corresponds to the second largest data block, and is marked as 0XFFFFFF, indicating that the second large data block is invalid, and may be This location stores the new data block, but in fact the small data block that was originally accessed in the second largest data block is still stored in the storage space of the cache image.
  • the data block 1 is the original second largest data block
  • the BAT entry corresponding to the second largest data block is marked as 0XFFFFFFFFFF
  • the third 512B small data block is still stored in the storage space.
  • the small data block of the first data block is written into the cache image
  • the small data block of the first data block is stored in the data block
  • the position of the third 512B data block of the bit chart directly replaces the third 512B data block of the original second largest data block with the small data block of the first data block; if the small data block of the first data block
  • the storage location is the location of the second 512B data block in the bitmap, but the location is 0, that is, there is no storage space at the location, and the storage space needs to be allocated in the location of the second 512B data block, and the small data is allocated.
  • the block is stored in and the value of the second position in the corresponding bit chart is set to 1.
  • the processing method of the cache searches in order from the header position of the management linked list according to the access count value of the first large data block, acquires the second largest data block, and counts the identifier and access of the second largest data block.
  • the value is removed from the management linked list, and the identifier of the first large data block and the access count value are written before the identifier of the third large data block in the management linked list, and the location mark corresponding to the second largest data block is invalidated in the BAT.
  • FIG. 10 is a flowchart of a method for processing a cache according to Embodiment 4 of the present invention.
  • the specific implementation manner of the step of adding the first large data block to the cache image and writing the small data block to the storage space corresponding to the first large data block in the cache image includes the following steps:
  • Step 401 Write the identifier of the first large data block and the access count value into the management linked list according to the access count value of the first large data block.
  • the access count value of the first large data block starts from the head node of the management linked list, finds the first large data block whose access count value is greater than or equal to the access count value of the first large data block, and the first large data block The identity and access count value are written before the first big data block.
  • FIG. 11 is a schematic diagram of a management link table before the first large data block enters the cache image in the fourth embodiment
  • FIG. 12 is a schematic diagram of the management link table after the first large data block enters the cache image in the fourth embodiment.
  • the cache image has two large data blocks, namely, data block 1 (BLOCK1) and data block 6 (BLOCK6), the access count value of BLOCK1 is 1, and the access count value of BLOCK6 is 3.
  • the access count value of the first large data block (BLOCK8) outside the cache image is changed from 1 to 2.
  • BLOCK8 is added to the management list, starting from the head node, the first access count value is greater than or equal to BLOCK8.
  • the data block of the access count value here BLOCK6, adds the BLOCK8 identification and access count value to the BLOCK6 in the management list.
  • Step 402 Find a free block in the cache image and write the small data block to the free block.
  • the free block is a storage space corresponding to the first large data block.
  • a free block is searched in the storage space of the cache image, and the free block is used as a storage space corresponding to the first large data block, and the small data block is written into the free block.
  • Step 403 Write a starting offset position of the free block to a position corresponding to the free block in the BAT.
  • the initial offset position of the free block is written to the entry position corresponding to the free block in the BAT, so that the storage space of the first large data block is found according to the initial offset position during the next access.
  • Table 3 is the BAT before the first large data block is added to the cache image in the fourth embodiment.
  • Table 4 is the BAT after the first large data block is added to the cache image in the fourth embodiment.
  • the starting offset position of BLOCK1 is 0M
  • the starting offset position of BLOCK6 is 2M+512.
  • the found offset position of the free block is 4M+1K
  • 4M+1K is written to the entry position corresponding to BLOCK8 in the BAT.
  • the processing method of the cache provided in this embodiment, when the first large data block including the small data block is not in the cache image, and the storage space of the cache image is not full or the occupation ratio of the storage space is less than a preset ratio threshold, according to the first
  • the access count value of a large data block, the identifier of the first large data block and the access count value are written into the management linked list, and a free block is found in the cache image, and the small data block is written into the free block, and the idle block is idle.
  • the starting offset position of the block is written to the position corresponding to the free block in the BAT, and the management chain table and the BAT are used to manage the data block in the cache image, so that the first large data block can be quickly and conveniently added to the cache image, and the read small
  • the data block is stored in the storage space of the cache image, which not only improves the utilization of the storage space, but also accesses the cache image directly when the next time the small data block is accessed, thereby reducing the pressure on the remote storage where the parent image is located.
  • FIG. 13 is a schematic structural diagram of a cache processing apparatus according to Embodiment 5 of the present invention.
  • the apparatus includes a reading module 11, an inspection module 12, and a processing module 13.
  • the reading module 11 is configured to receive the read input and output IO request and read the small data block from the parent image according to the read IO request.
  • the checking module 12 is configured to check whether the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold if the first large data block that includes the small data block is not in the cache image.
  • the processing module 13 is configured to replace the first large data block with the second largest data block in the cache image, and replace the small data block, if the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold. Writes the storage space corresponding to the first large data block in the cache image.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 14 is a schematic structural diagram of a cache processing apparatus according to Embodiment 6 of the present invention.
  • the processing module includes an updating unit 21, configured to update the first large data block in the management linked list according to the access count value if the first large data block is in the cache image. The location of the identifier and the access count value, and write the small data block to the cache corresponding to the first largest data block in the cache image. Storage space.
  • the reading module 11 is further configured to increment the access count value of the first large data block containing the small data block by one.
  • the processing module 13 is further configured to write the identifier of the first large data block and the corresponding access count value into the management linked list.
  • the processing module 13 is further configured to add the first large data block to the cache image and write the small data block into the cache image if the storage space of the cache image is not full or the occupation ratio of the storage space is less than a preset ratio threshold.
  • the storage space corresponding to the data block is not full or the occupation ratio of the storage space is less than a preset ratio threshold.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 15 is a schematic structural diagram of a cache processing apparatus according to Embodiment 7 of the present invention.
  • the processing module 13 includes a second large data block acquiring unit 22, a position marking unit 23, and a small data block writing unit 24.
  • the second large data block obtaining unit 22 is configured to search, according to the access count value of the first large data block, from the header position of the management linked list, obtain the second large data block, and identify the second large data block.
  • the access count value is removed from the management linked list, and the identifier of the first large data block and the access count value are written before the identifier of the third large data block in the management linked list; wherein the second largest data block is in the management linked list The first data block whose access count value is less than or equal to the access count value of the first large data block; the third largest data block is the management link list after the identifier of the second largest data block is deleted, and the access count value is greater than or equal to The first data block of the access count value of the first large data block.
  • the location marking unit 23 is configured to invalidate the location tag corresponding to the second large data block in the BAT, and store the starting offset location of the first large data block to a location corresponding to the first large data block in the BAT;
  • the starting offset position of the first large data block is the starting offset position of the second largest data block.
  • the small data block writing unit 24 is configured to write the small data block into the storage space corresponding to the start offset position of the first large data block in the cache image.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 7.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 16 is a schematic structural diagram of a cache processing apparatus according to Embodiment 8 of the present invention.
  • the processing module 13 includes an identification writing unit 25, a free block acquiring unit 26, and a position writing unit 27.
  • the identifier writing unit 25 is configured to write the identifier of the first big data block and the access count value into the management linked list according to the access count value of the first large data block.
  • the free block obtaining unit 26 is configured to find a free block in the cache image and write the small data block into the free block; wherein the free block is the storage space corresponding to the first large data block.
  • the position writing unit 27 is for writing the start offset position of the free block to the position corresponding to the free block in the BAT.
  • the device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 10, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Image Input (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A cache processing method and apparatus, the method comprising: receiving an input-output-IO-read-request, according to the IO-read-request, reading small data block from a parent mirror (S101); if a first large data block containing the small data block is not in a cache mirror, checking whether storage space of the cache mirror has no space or an occupancy ratio of the storage space is greater than or equal to a preset ratio threshold (S102); if so, replacing a second large data block of the cache mirror with the first large data block, and writing the small data block into the storage space corresponding to the first large data block in the cache mirror (S103), replacing the dated second large data block with a new first large data block, and writing the small data block needed to be written into the cache mirror to effectively increase utilization rate of the storage space.

Description

缓存的处理方法和装置Cache processing method and device 技术领域Technical field
本发明实施例涉及存储技术,尤其涉及一种缓存的处理方法和装置。The embodiments of the present invention relate to a storage technology, and in particular, to a cache processing method and apparatus.
背景技术Background technique
桌面云是将个人计算机桌面环境通过云计算模式从物理机分离出来,成为一种可以对外提供桌面的服务。The desktop cloud separates the personal computer desktop environment from the physical machine through the cloud computing mode, and becomes a service that can provide desktops externally.
图1为现有技术中一种桌面云的应用场景示意图。如图1所示,该应用场景包括父镜像1、缓存镜像2、子镜像3和虚拟机4,其中,缓存镜像2链接克隆于父镜像1,子镜像3链接克隆于缓存镜像2。在该场景下,如图1所示,针对虚拟机4中的读写IO,写IO直接将数据块写入到子镜像3中;读IO先到子镜像中读取数据块,如果数据块存在于子镜像中,则在子镜像中读取;如果数据块不存在于子镜像中,再到缓存镜像中读取;如果数据块不存在于缓存镜像中,则到父镜像中读取,并将读取到的数据块写入到缓存镜像中,以便下一次读取相同数据块时可以从缓存镜像中读取该数据块。FIG. 1 is a schematic diagram of an application scenario of a desktop cloud in the prior art. As shown in FIG. 1 , the application scenario includes a parent image 1 , a cache image 2 , a sub mirror 3 , and a virtual machine 4 . The cache image 2 link is cloned in the parent image 1 and the sub mirror 3 link is cloned in the cache image 2 . In this scenario, as shown in FIG. 1, for the read/write IO in the virtual machine 4, the write IO directly writes the data block into the sub-image 3; the read IO first reads the data block into the sub-image, if the data block If it exists in the submirror, it is read in the submirror; if the data block does not exist in the submirror, it is read in the cache image; if the data block does not exist in the cache image, it is read in the parent image. The read data block is written to the cache image so that the data block can be read from the cache image the next time the same data block is read.
但是,父镜像、缓存镜像、子镜像都采用虚拟硬盘文件格式(Virtual Hard Diskformat,简称VHD),VHD文件的最大容量不超过本地存储文件系统的大小,并且,VHD无法进行数据块的替换功能,例如,从父镜像中读取到的数据块只能通过追加的方式依次写入缓存镜像中,当缓存镜像所在的本地存储文件系统空间用完后,就无法再将新的数据块写入缓存镜像中,而缓存镜像中部分数据可能后续不会或很少再被读取,因此,导致缓存镜像中的有用数据块比例变少,从而导致缓存空间的浪费。However, the parent image, the cache image, and the sub-mirror are in the virtual hard disk format (VHD). The maximum size of the VHD file does not exceed the size of the local storage file system, and the VHD cannot perform the data block replacement function. For example, the data blocks read from the parent image can only be written to the cache image in the same way. If the local storage file system space where the cache image resides is used up, the new data block cannot be written to the cache. In the image, some data in the cache image may not be read later or rarely, so the proportion of useful data blocks in the cache image is reduced, resulting in wasted cache space.
发明内容Summary of the invention
本发明实施例提供一种缓存的处理方法和装置,用新的第一大数据块替换老化的第二大数据块,然后将需要写入的小数据块写入缓存镜像中,有效提高 了存储空间的利用率。The embodiment of the invention provides a method and a device for processing a cache, which replaces the second largest data block that is aged with a new first large data block, and then writes the small data block that needs to be written into the cache image, thereby effectively improving The utilization of storage space.
本发明实施例第一方面提供一种缓存的处理方法,包括:A first aspect of the embodiments of the present invention provides a method for processing a cache, including:
接收读输入输出IO请求,并根据所述读IO请求,从父镜像中读取小数据块;Receiving a read input and output IO request, and reading a small data block from the parent image according to the read IO request;
若包含所述小数据块的第一大数据块不在缓存镜像中,则检查所述缓存镜像的存储空间是否已满或者所述存储空间的占用比例是否大于或者等于预设比例阈值;If the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupation ratio of the storage space is greater than or equal to a preset ratio threshold;
若所述缓存镜像的存储空间已满或者所述存储空间的占用比例大于或者等于所述预设比例阈值,则将所述第一大数据块替换所述缓存镜像中的第二大数据块,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。If the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replacing the first large data block with the second largest data block in the cache image, And writing the small data block to a storage space corresponding to the first large data block in the cache image.
在第一方面的第一种可能实现方式中,所述从父镜像中读取小数据块之后,所述方法还包括:In a first possible implementation manner of the first aspect, after the reading the small data block from the parent image, the method further includes:
将包含所述小数据块的第一大数据块的访问计数值加1;Adding an access count value of the first large data block containing the small data block by one;
则在所述若包含所述小数据块的第一大数据块不在缓存镜像中,则检查所述缓存镜像的存储空间是否已满或者所述存储空间的占用比例是否大于或者等于预设比例阈值之前,所述方法还包括:If the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupied ratio of the storage space is greater than or equal to a preset ratio threshold. Previously, the method further includes:
将所述第一大数据块的标识和对应的访问计数值写入管理链表。The identifier of the first large data block and the corresponding access count value are written into the management linked list.
结合第一方面的第一种可能实现方式,在第一方面的第二种可能实现方式中,还包括:In conjunction with the first possible implementation of the first aspect, in a second possible implementation manner of the first aspect, the method further includes:
若所述缓存镜像的存储空间未满或者所述存储空间的占用比例小于所述预设比例阈值,则将所述第一大数据块加入所述缓存镜像,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。Adding the first large data block to the cache image and writing the small data block if the storage space of the cache image is not full or the occupation ratio of the storage space is less than the preset ratio threshold. The storage space corresponding to the first large data block in the cache image.
结合第一方面的第一种可能实现方式,在第一方面的第三种可能实现方式中,所述将所述第一大数据块替换所述缓存镜像中的第二大数据块,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间,具体包括:In conjunction with the first possible implementation of the first aspect, in a third possible implementation of the first aspect, the replacing the first large data block with the second largest data block in the cache image, and The small data block is written into the storage space corresponding to the first large data block in the cache image, and specifically includes:
根据所述第一大数据块的访问计数值,从所述管理链表的表头位置开始依次查找,获取所述第二大数据块,将所述第二大数据块的标识和访问计数值从所述管理链表中移除,并将所述第一大数据块的标识和访问计数值写入所述管理链表中第三个大数据块的标识之前;其中,所述第二大数据块为在所述管理 链表中,访问计数值小于或者等于第一大数据块的访问计数值的第一个数据块;所述第三大数据块为删除了所述第二大数据块的标识后的管理链表中,访问计数值大于或者等于所述第一大数据块的访问计数值的第一个数据块;Determining, according to the access count value of the first large data block, starting from the header position of the management linked list, acquiring the second large data block, and determining the identifier and the access count value of the second large data block from Removing the management linked list, and writing the identifier of the first large data block and the access count value to the identifier of the third large data block in the management linked list; wherein the second large data block is In the management In the linked list, the access data is less than or equal to the first data block of the access count value of the first large data block; and the third large data block is in the management linked list after the identifier of the second large data block is deleted. Accessing a first data block whose count value is greater than or equal to an access count value of the first large data block;
在块分配表BAT中将第二大数据块对应的位置标记失效,并将所述第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置;其中,所述第一大数据块的起始偏移位置为所述第二大数据块的起始偏移位置;Deactivating a location flag corresponding to the second largest data block in the block allocation table BAT, and storing a starting offset position of the first large data block to a location corresponding to the first large data block in the BAT; The starting offset position of the first large data block is the starting offset position of the second large data block;
将所述小数据块写入所述缓存镜像中所述第一大数据块的起始偏移位置对应的存储空间。Writing the small data block into a storage space corresponding to a starting offset position of the first large data block in the cache image.
结合第一方面的第二种可能实现方式,在第一方面的第四种可能实现方式中,所述将所述第一大数据块加入所述缓存镜像,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间,具体包括:In conjunction with the second possible implementation of the first aspect, in a fourth possible implementation of the first aspect, the first large data block is added to the cache image, and the small data block is written The storage space corresponding to the first large data block in the cache image includes:
根据所述第一大数据块的访问计数值,将所述第一大数据块的标识和访问计数值写入所述管理链表中;And writing an identifier of the first large data block and an access count value into the management linked list according to an access count value of the first large data block;
在所述缓存镜像中查找到一个空闲块,并将所述小数据块写入所述空闲块;其中,所述空闲块为所述第一大数据块对应的存储空间;Finding a free block in the cache image, and writing the small data block to the free block; wherein the free block is a storage space corresponding to the first large data block;
将所述空闲块的起始偏移位置写入BAT中所述空闲块对应的位置。Writing a starting offset position of the free block to a location corresponding to the free block in the BAT.
结合第一方面的第一种可能实现方式,在第一方面的第五种可能实现方式中,若所述第一大数据块在缓存镜像中,则根据所述访问计数值,在所述管理链表中更新所述第一大数据块的标识所在的位置和所述访问计数值,并将所述小数据块写入所述缓存镜像中第一大数据块对应的存储空间。In conjunction with the first possible implementation of the first aspect, in a fifth possible implementation manner of the first aspect, if the first large data block is in a cache image, the management is performed according to the access count value. Updating a location of the identifier of the first large data block and the access count value in a linked list, and writing the small data block to a storage space corresponding to the first large data block in the cache image.
本发明实施例第二方面提供一种缓存的处理装置,包括:A second aspect of the embodiments of the present invention provides a cache processing apparatus, including:
读取模块,用于接收读输入输出IO请求,并根据所述读IO请求,从父镜像中读取小数据块;a reading module, configured to receive a read input and output IO request, and read a small data block from the parent image according to the read IO request;
检查模块,用于若包含所述小数据块的第一大数据块不在缓存镜像中,则检查所述缓存镜像的存储空间是否已满或者所述存储空间的占用比例是否大于或者等于预设比例阈值;The checking module is configured to: if the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupied ratio of the storage space is greater than or equal to a preset ratio Threshold value
处理模块,用于若所述缓存镜像的存储空间已满或者所述存储空间的占用比例大于或者等于所述预设比例阈值,则将所述第一大数据块替换所述缓存镜像中的第二大数据块,并将所述小数据块写入所述缓存镜像中所述第一大数据 块对应的存储空间。a processing module, if the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replacing the first large data block with the first one of the cache image Two large data blocks, and writing the small data block to the first big data in the cache image The storage space corresponding to the block.
在第二方面的第一种可能实现方式中,所述读取模块还用于将包含所述小数据块的第一大数据块的访问计数值加1;In a first possible implementation manner of the second aspect, the reading module is further configured to increase an access count value of the first large data block that includes the small data block by one;
所述处理模块还用于将所述第一大数据块的标识和对应的访问计数值写入管理链表。The processing module is further configured to write the identifier of the first large data block and the corresponding access count value into the management linked list.
结合第二方面的第一种可能实现方式,在第二方面的第二中可能实现方式中,所述处理模块还用于若所述缓存镜像的存储空间未满或者所述存储空间的占用比例小于所述预设比例阈值,则将所述第一大数据块加入所述缓存镜像,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。With reference to the first possible implementation of the second aspect, in a second possible implementation manner of the second aspect, the processing module is further configured to: if the storage space of the cache image is not full or the proportion of the storage space is occupied If the threshold is smaller than the preset ratio, the first large data block is added to the cache image, and the small data block is written into a storage space corresponding to the first large data block in the cache image.
结合第二方面的第一种可能实现方式,在第二方面的第三种可能实现方式中,所述处理模块包括:With reference to the first possible implementation of the second aspect, in a third possible implementation manner of the second aspect, the processing module includes:
第二大数据块获取单元,用于根据所述第一大数据块的访问计数值,从所述管理链表的表头位置开始依次查找,获取所述第二大数据块,将所述第二大数据块的标识和访问计数值从所述管理链表中移除,并将所述第一大数据块的标识和访问计数值写入所述管理链表中第三个大数据块的标识之前;其中,所述第二大数据块为在所述管理链表中,访问计数值小于或者等于第一大数据块的访问计数值的第一个数据块;所述第三大数据块为删除了所述第二大数据块的标识后的管理链表中,访问计数值大于或者等于所述第一大数据块的访问计数值的第一个数据块;a second large data block obtaining unit, configured to sequentially search from the header position of the management linked list according to an access count value of the first large data block, acquire the second large data block, and use the second The identification and access count value of the big data block is removed from the management linked list, and the identifier and the access count value of the first large data block are written before the identifier of the third large data block in the management linked list; The second large data block is the first data block in the management linked list, and the access count value is less than or equal to the access count value of the first large data block; the third large data block is deleted. In the management chain table after the identification of the second largest data block, the access data is greater than or equal to the first data block of the access count value of the first large data block;
位置标记单元,用于在BAT中将第二大数据块对应的位置标记失效,并将所述第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置;其中,所述第一大数据块的起始偏移位置为所述第二大数据块的起始偏移位置;a location marking unit, configured to invalidate a location identifier corresponding to the second large data block in the BAT, and store a starting offset location of the first large data block to a location corresponding to the first large data block in the BAT; The starting offset position of the first large data block is a starting offset position of the second large data block;
小数据块写入单元,用于将所述小数据块写入所述缓存镜像中所述第一大数据块的起始偏移位置对应的存储空间。And a small data block writing unit, configured to write the small data block into a storage space corresponding to a starting offset position of the first large data block in the cache image.
结合第二方面的第二种可能实现方式,在第二方面的第四种可能实现方式中,所述处理模块包括:With reference to the second possible implementation of the second aspect, in a fourth possible implementation manner of the second aspect, the processing module includes:
标识写入单元,用于根据所述第一大数据块的访问计数值,将所述第一大数据块的标识和访问计数值写入所述管理链表中;An identifier writing unit, configured to write an identifier of the first large data block and an access count value into the management linked list according to an access count value of the first large data block;
空闲块获取单元,用于在所述缓存镜像中查找到一个空闲块,并将所述小数据块写入所述空闲块;其中,所述空闲块为所述第一大数据块对应的存储空 间;a free block obtaining unit, configured to find a free block in the cache image, and write the small data block into the free block; wherein the free block is a storage corresponding to the first large data block Empty between;
位置写入单元,用于将所述空闲块的起始偏移位置写入BAT中所述空闲块对应的位置。And a location writing unit, configured to write a starting offset position of the free block to a location corresponding to the free block in the BAT.
结合第二方面的第一种可能实现方式,在第二方面的第五种可能实现方式中,所述处理模块包括:With reference to the first possible implementation of the second aspect, in a fifth possible implementation manner of the second aspect, the processing module includes:
更新单元,用于若所述第一大数据块在缓存镜像中,则根据所述访问计数值,在所述管理链表中更新所述第一大数据块的标识所在的位置和所述访问计数值,并将所述小数据块写入所述缓存镜像中第一大数据块对应的存储空间。And an update unit, configured to: when the first large data block is in the cache image, update the location of the identifier of the first large data block and the access count in the management link table according to the access count value And storing the small data block into a storage space corresponding to the first large data block in the cache image.
本实施例提供的缓存的处理方法,接收读输入输出IO请求,并根据读IO请求,从父镜像中读取小数据块,若包含小数据块的第一大数据块不在缓存镜像中,则检查缓存镜像的存储空间是否已满或者存储空间的占用比例是否大于或者等于预设比例阈值,若缓存镜像的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值,则将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。相较于现有技术中当缓存镜像的存储空间用完后,就无法再将新的数据块写入缓存镜像的现象而言,本实施例中,当检查到缓存镜像中的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值时,用第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第二大数据块对应的存储空间,即用新的第一大数据块替换老化的第二大数据块,然后将需要写入的小数据块写入缓存镜像中,有效提高了存储空间的利用率。The processing method of the cache provided in this embodiment receives a read input and output IO request, and reads a small data block from the parent image according to the read IO request, and if the first large data block including the small data block is not in the cache image, Check whether the storage space of the cache mirror is full or the proportion of storage space is greater than or equal to the preset ratio threshold. If the storage space of the cache mirror is full or the storage ratio is greater than or equal to the preset ratio threshold, it will be the first. The big data block replaces the second largest data block in the cache image, and writes the small data block into the storage space corresponding to the first largest data block in the cache image. Compared with the prior art, when the storage space of the cache image is used up, the new data block can no longer be written into the cache image. In this embodiment, when the storage space in the cache image is full. Or, when the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replace the second largest data block in the cache image with the first large data block, and write the small data block into the storage corresponding to the second largest data block in the cache image. Space, that is, replace the aging second largest data block with the new first large data block, and then write the small data block that needs to be written into the cache image, which effectively improves the utilization of the storage space.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any inventive labor.
图1为现有技术中一种桌面云的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a desktop cloud in the prior art;
图2为本发明实施例一提供的缓存的处理方法流程图;2 is a flowchart of a method for processing a cache according to Embodiment 1 of the present invention;
图3为本发明实施例二提供的缓存的处理方法流程图; 3 is a flowchart of a method for processing a cache according to Embodiment 2 of the present invention;
图4为第一大数据块的标识移动前的管理链表示意图;4 is a schematic diagram of a management chain table before the identification of the first big data block moves;
图5为第一大数据块的标识移动后的管理链表示意图;5 is a schematic diagram of a management chain table after the identification of the first large data block is moved;
图6为位图表管理示意图;Figure 6 is a schematic diagram of bit chart management;
图7为本发明实施例三提供的缓存的处理方法流程图;FIG. 7 is a flowchart of a method for processing a cache according to Embodiment 3 of the present invention;
图8为实施例三中第一大数据块进入缓存镜像前的管理链表示意图;8 is a schematic diagram of a management link table before the first large data block enters the cache image in the third embodiment;
图9为实施例三中第一大数据块进入缓存镜像后的管理链表示意图;9 is a schematic diagram of a management chain table after the first large data block enters the cache image in the third embodiment;
图10为本发明实施例四提供的缓存的处理方法流程图;10 is a flowchart of a method for processing a cache according to Embodiment 4 of the present invention;
图11为实施例四中第一大数据块进入缓存镜像前的管理链表示意图;11 is a schematic diagram of a management chain table before the first large data block enters the cache image in the fourth embodiment;
图12为实施例四中第一大数据块进入缓存镜像后的管理链表示意图;12 is a schematic diagram of a management chain table after the first large data block enters the cache image in the fourth embodiment;
图13为本发明实施例五提供的缓存的处理装置的结构示意图;FIG. 13 is a schematic structural diagram of a cache processing apparatus according to Embodiment 5 of the present invention; FIG.
图14为本发明实施例六提供的缓存的处理装置的结构示意图;14 is a schematic structural diagram of a cache processing apparatus according to Embodiment 6 of the present invention;
图15为本发明实施例七提供的缓存的处理装置的结构示意图;15 is a schematic structural diagram of a cache processing apparatus according to Embodiment 7 of the present invention;
图16为本发明实施例八提供的缓存的处理装置的结构示意图。FIG. 16 is a schematic structural diagram of a cache processing apparatus according to Embodiment 8 of the present invention.
具体实施方式detailed description
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. It is a partial embodiment of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
图2为本发明实施例一提供的缓存的处理方法流程图。在本实施例中,执行主体可以为中央处理器(Central Processing Unit,简称CPU)、服务器、物理主机、终端设备等,本发明中并不以此为限。如图1所示,该方法包括以下步骤:FIG. 2 is a flowchart of a method for processing a cache according to Embodiment 1 of the present invention. In this embodiment, the executor may be a central processing unit (CPU), a server, a physical host, a terminal device, etc., and is not limited thereto. As shown in Figure 1, the method includes the following steps:
步骤101、接收读输入输出(Input and Output,简称IO)请求,并根据读IO请求,从父镜像中读取小数据块。Step 101: Receive an Input and Output (IO) request, and read a small data block from the parent image according to the read IO request.
在本实施例中,当接收到读IO请求,且根据读IO在子镜像和缓存镜像中都未命中时,即根据读IO在子镜像和缓存镜像中都没有读取到小数据块,则需要根据该读IO请求,从父镜像中读取小数据块。其中,读IO请求中可以包括小数据块的标识,例如,小数据块的编号或者小数据块存储的起始偏移地址等。 一个大数据块可分为多个小数据块,例如,可以将512B作为小数据块,2MB作为大数据块;也可以将2MB的数据块作为小数据块,将20GB的数据块作为一个大数据块,可根据实际情况来设定,本发明中不做限制。In this embodiment, when a read IO request is received, and none of the sub-mirrors and the cache image are missed according to the read IO, that is, no small data blocks are read in the sub-mirror and the cache image according to the read IO, The small data block needs to be read from the parent image according to the read IO request. The read IO request may include an identifier of the small data block, for example, a number of the small data block or a starting offset address of the small data block storage. A large data block can be divided into multiple small data blocks. For example, 512B can be used as a small data block and 2MB as a large data block. A 2MB data block can also be used as a small data block, and a 20 GB data block can be used as a big data block. The block can be set according to actual conditions, and is not limited in the present invention.
步骤102、若包含小数据块的第一大数据块不在缓存镜像中,则检查缓存镜像的存储空间是否已满或者存储空间的占用比例是否大于或者等于预设比例阈值。Step 102: If the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold.
在本实施例中,包含小数据块的第一大数据块不在缓存镜像中,则说明该第一大数据块中没有任何小数据块存储在缓存镜像的存储空间中,若该第一大数据块中有至少一个小数据块存储在缓存镜像的存储空间中,则该第一大数据块在该缓存镜像中。缓存镜像的存储空间可采用本地的高速存储设备,如存储速度和每秒输入输出量(Input and Output Per Second,简称IOPS)远大于普通硬盘的存储设备,可以是内存,也可以是固态硬盘(Solid State Disk,简称SSD)等可以进行高速交互操作的存储设备,可以从成本、性能及生命周期的角度考虑选择适合的存储设备来做缓存。In this embodiment, the first large data block including the small data block is not in the cache image, and it is indicated that any small data block in the first large data block is stored in the storage space of the cache image, if the first big data At least one small data block in the block is stored in the storage space of the cache image, and the first large data block is in the cache image. The storage space of the cache image can be a local high-speed storage device. For example, the storage speed and the input and output per second (IOPS) are much larger than those of the ordinary hard disk. It can be either a memory or a solid state disk. A storage device that can perform high-speed interoperability, such as Solid State Disk (SSD), can select a suitable storage device for caching from the perspective of cost, performance, and life cycle.
步骤103、若缓存镜像的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值,则将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。Step 103: If the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold, replace the first large data block with the second largest data block in the cache image, and write the small data block. The storage space corresponding to the first largest data block in the cache image.
在本实施例中,若缓存镜像的存储空间已满,即存储空间中不能再以追加的方式存储任何方式,或者,若缓存镜像的存储空间的占用比例大于或者等于预设比例阈值,例如,存储空间的占用比例超过80%时,将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。第二大数据块为缓存镜像中,被访问的次数相对较小的大数据块,或者是在预设时间段内没有被访问的大数据块,或者也可以是被访问的次数小于或者等于第一大数据块被访问的次数的大数据块。In this embodiment, if the storage space of the cached image is full, that is, the storage space cannot be stored in an additional manner, or if the storage ratio of the cached image is greater than or equal to a preset ratio threshold, for example, When the occupation ratio of the storage space exceeds 80%, the first large data block is replaced with the second largest data block in the cache image, and the small data block is written into the storage space corresponding to the first large data block in the cache image. The second largest data block is a large data block in the cache image that is accessed relatively small times, or a large data block that has not been accessed within a preset time period, or may be accessed less than or equal to the number of times. A large block of data that is accessed by a large block of data.
可选地,在本实施例中,可以采用预先设定的缓存替换策略,用第一大数据块替换缓存镜像中的第二大数据块。例如,缓存替换策略可以为最近最少使用(Least Recently Used,简称LRU)策略,也可以为最近最不常用(Least Frequently Used,简称LFU)策略,或者是其它的策略,本领域技术人员可以根据文件特性和使用场景角度考虑,选择适当的缓存替换策略,本发明中并不以此为限。 Optionally, in this embodiment, a preset cache replacement policy may be used to replace the second largest data block in the cache image with the first large data block. For example, the cache replacement policy may be a Least Recently Used (LRU) policy, or a Least Frequently Used (LFU) policy, or other policies, and those skilled in the art may In terms of characteristics and usage scenarios, an appropriate cache replacement strategy is selected, which is not limited in this invention.
需要说明的是,本实施例中,并不是用第一大数据块中的数据替换缓存镜像中的第二大数据块,而是在缓存镜像中找到一个被访问的次数相对较少的老化的大数据块后,将该老化的大数据块作为第二大数据块,将缓存镜像中第二大数据块的存储空间预留给第一大数据块,当第一大数据块中的小数据块被读取后,将该小数据块写入到缓存镜像中原来的第二大数据块对应的存储空间上。It should be noted that, in this embodiment, instead of replacing the second largest data block in the cache image with the data in the first large data block, an aging time with a relatively small number of times of being accessed is found in the cache image. After the large data block, the aging large data block is used as the second largest data block, and the storage space of the second largest data block in the cache image is reserved to the first large data block, and the small data in the first large data block is used. After the block is read, the small data block is written to the storage space corresponding to the original second largest data block in the cache image.
本实施例提供的缓存的处理方法,接收读输入输出IO请求,并根据读IO请求,从父镜像中读取小数据块,若包含小数据块的第一大数据块不在缓存镜像中,则检查缓存镜像的存储空间是否已满或者存储空间的占用比例是否大于或者等于预设比例阈值,若缓存镜像的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值,则将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。相较于现有技术中当缓存镜像的存储空间用完后,就无法再将新的数据块写入缓存镜像的现象而言,本实施例中,当检查到缓存镜像中的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值时,用第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第二大数据块对应的存储空间,即用新的第一大数据块替换老化的第二大数据块,然后将需要写入的小数据块写入缓存镜像中,有效提高了存储空间的利用率。The processing method of the cache provided in this embodiment receives a read input and output IO request, and reads a small data block from the parent image according to the read IO request, and if the first large data block including the small data block is not in the cache image, Check whether the storage space of the cache mirror is full or the proportion of storage space is greater than or equal to the preset ratio threshold. If the storage space of the cache mirror is full or the storage ratio is greater than or equal to the preset ratio threshold, it will be the first. The big data block replaces the second largest data block in the cache image, and writes the small data block into the storage space corresponding to the first largest data block in the cache image. Compared with the prior art, when the storage space of the cache image is used up, the new data block can no longer be written into the cache image. In this embodiment, when the storage space in the cache image is full. Or, when the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replace the second largest data block in the cache image with the first large data block, and write the small data block into the storage corresponding to the second largest data block in the cache image. Space, that is, replace the aging second largest data block with the new first large data block, and then write the small data block that needs to be written into the cache image, which effectively improves the utilization of the storage space.
图3为本发明实施例二提供的缓存的处理方法流程图。如图3所示,该方法包括以下步骤:FIG. 3 is a flowchart of a method for processing a cache according to Embodiment 2 of the present invention. As shown in FIG. 3, the method includes the following steps:
步骤201、接收读输入输出IO请求,并根据读IO请求,从父镜像中读取小数据块。Step 201: Receive a read input and output IO request, and read a small data block from the parent image according to the read IO request.
步骤202、将包含小数据块的第一大数据块的访问计数值加1。Step 202: Add an access count value of the first large data block including the small data block by one.
在本实施例中,访问计数值用于记录第一大数据块被访问的次数,当第一大数据块中有小数据块被访问时,无论第一大数据块是否在缓存镜像中,都将第一大数据块的访问计数值加1。In this embodiment, the access count value is used to record the number of times the first large data block is accessed, when there is a small data block in the first large data block, regardless of whether the first large data block is in the cache image, Add 1 to the access count value of the first large data block.
步骤203、判断包含小数据块的第一大数据块是否在缓存镜像中,若是,即包含小数据块的第一大数据块在缓存镜像中,则执行步骤208;若否,即包含小数据块的第一大数据块不在缓存镜像中,则执行步骤204。Step 203: Determine whether the first large data block that includes the small data block is in the cache image. If yes, that is, the first large data block that includes the small data block is in the cache image, step 208 is performed; if not, the small data is included. If the first large data block of the block is not in the cache image, step 204 is performed.
步骤204、将第一大数据块的标识和对应的访问计数值写入管理链表。Step 204: Write the identifier of the first large data block and the corresponding access count value into the management linked list.
在本实施例中,管理链表用于管理缓存镜像中的大数据块,存储了大数据 块的标识和大数据块的访问计数值,该管理链表具体可以为LFU链表。在管理链表中,头结点(head)指向最新加入而且访问计数最小的大数据块,尾结点(tail)指向最早加入而且访问计数最大的大数据块。若管理链表中存在第一大数据块的标识,则该第一数据块在缓存镜像中,即该第一大数据块中有小数据块存储在缓存镜像的存储空间中,若管理链表中没有第一大数据块的标识,则该第一数据块不在缓存镜像中,即该第一大数据块中没有小数据块存储在缓存镜像的存储空间中。In this embodiment, the management linked list is used to manage large data blocks in the cache image and store big data. The identifier of the block and the access count value of the big data block, and the management chain table may specifically be an LFU linked list. In the management list, the head node points to the most recent big block with the smallest access count, and the tail point points to the oldest block with the largest access count. If the identifier of the first large data block exists in the management linked list, the first data block is in the cache image, that is, the small data block in the first large data block is stored in the storage space of the cache image, if there is no management list The identifier of the first large data block is not in the cache image, that is, no small data block in the first large data block is stored in the storage space of the cache image.
当第一大数据块中的小数据块被访问,且该第一大数据块不在缓存镜像中,将第一大数据块的标识和对应的访问计数值写入管理链表,表示该第一大数据块在缓存镜像中。初始状态时,将所有大数据块的访问计数值置0,并用管理链表来管理这些大数据块,如果大数据块中有小数据块进入缓存镜像,即第一大数据块包含的小数据块被读取后需要存储到缓存镜像的存储空间时,则将第一大数据块标识和访问计数值加入管理链表中。When the small data block in the first large data block is accessed, and the first large data block is not in the cache image, the identifier of the first large data block and the corresponding access count value are written into the management linked list, indicating that the first largest The data block is in the cache image. In the initial state, the access count value of all large data blocks is set to 0, and these large data blocks are managed by the management linked list. If there are small data blocks in the large data block into the cache image, that is, the small data blocks included in the first large data block. When it needs to be stored in the storage space of the cache image after being read, the first big block identifier and the access count value are added to the management list.
步骤205、检查缓存镜像的存储空间是否已满或者存储空间的占用比例是否大于或者等于预设比例阈值,若是,即缓存镜像的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值,则执行步骤206;若否,即缓存镜像的存储空间未满或者存储空间的占用比例小于预设比例阈值,则执行步骤207。Step 205: Check whether the storage space of the cached image is full or the proportion of the storage space is greater than or equal to a preset ratio threshold. If yes, the storage space of the cached image is full or the occupied proportion of the storage space is greater than or equal to a preset ratio threshold. Then, step 206 is performed; if no, that is, the storage space of the cache image is not full or the occupation ratio of the storage space is less than the preset ratio threshold, step 207 is performed.
步骤206、将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。Step 206: Replace the first large data block with the second largest data block in the cache image, and write the small data block into the storage space corresponding to the first large data block in the cache image.
步骤207、将第一大数据块加入缓存镜像,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。结束。Step 207: Add the first large data block to the cache image, and write the small data block into the storage space corresponding to the first large data block in the cache image. End.
在本实施例中,将第一大数据块加入缓存镜像可采用两种方法,一种是提前预占,一种是动态分配。提前预占方法是在缓存第一大数据块加入缓存时,不论第一大数据块中的小数据块是否都能有机会被访问而存储到缓存镜像的存储空间中,就提前占用了缓存空间中第一大数据块整体所需的空间(如2MB);动态分配方法在第一大数据块加入缓存镜像时,只分配存储空间中小数据块所需的空间(如若干个512B),这种方式可以使更多有用的小数据块进入缓存镜像中。In this embodiment, the first large data block can be added to the cache image by using two methods, one is preemption in advance, and the other is dynamic allocation. The preemption method is to occupy the cache space in advance when the first large data block is cached and added to the cache, regardless of whether the small data block in the first large data block can be accessed and stored in the storage space of the cache image. The space required for the first largest data block in the middle (such as 2MB); the dynamic allocation method allocates only the space required for small data blocks in the storage space (such as several 512B) when the first large data block is added to the cache image. This way you can make more useful small data blocks into the cache image.
步骤208、根据访问计数值,在管理链表中更新第一大数据块的标识所在的位置和访问计数值,并将小数据块写入缓存镜像中第一大数据块对应的存储空 间。Step 208: Update, according to the access count value, a location and an access count value of the identifier of the first large data block in the management linked list, and write the small data block into the storage space corresponding to the first large data block in the cache image. between.
在本实施例中,当第一大数据块在缓存镜像中时,即管理链表中有第一大数据块的标识和访问计数值,根据访问计数值,在管理链表中,从第一大数据块的标识的位置开始,找到访问计数值小于或者等于第一大数据块的访问计数值的第一个大数据块,将第一大数据块的标识和访问计数值写入该第一个大数据块之前。In this embodiment, when the first large data block is in the cache image, that is, the management link list has the identifier and the access count value of the first large data block, according to the access count value, in the management linked list, from the first big data. The location of the identified identity of the block begins, the first large data block whose access count value is less than or equal to the access count value of the first large data block is found, and the identifier of the first large data block and the access count value are written to the first large Before the data block.
图4为第一大数据块的标识移动前的管理链表示意图,图5为第一大数据块的标识移动后的管理链表示意图。如图4和图5所示,缓存镜像中有3个大数据块:大数据块1(BLOCK1),大数据块6(BLOCK6),大数据块8(BLOCK8),它们的访问计数值分别是BLOCK1的访问计数值为3,BLOCK6的访问计数值为2,BLOCK8的访问计数值为2。当BLOCK8再次被访问时,其访问计数值加1变为3,此时BLOCK8的访问计数值已经大于BLOCK6,而在管理链表中,BLOCK8还在BLOCK6前,则需要在管理链表中将BLOCK8进行移动。在BLOCK8当前位置处,往后查找,找到第一个访问计数值大于或者等于3的数据块,此例中为BLOCK1,如图5所示,把BLOCK8移动到管理链表中BLOCK1前。4 is a schematic diagram of a management chain table before the identification of the first large data block moves, and FIG. 5 is a schematic diagram of the management chain table after the identification of the first large data block moves. As shown in Figure 4 and Figure 5, there are three big data blocks in the cache image: big data block 1 (BLOCK1), big data block 6 (BLOCK6), and big data block 8 (BLOCK8). Their access count values are respectively The access count value of BLOCK1 is 3, the access count value of BLOCK6 is 2, and the access count value of BLOCK8 is 2. When BLOCK8 is accessed again, its access count value is incremented to 3, and the access count value of BLOCK8 is already greater than BLOCK6. In the management list, BLOCK8 is still in front of BLOCK6, then BLOCK8 needs to be moved in the management list. . At the current position of BLOCK8, look backwards to find the first data block whose access count value is greater than or equal to 3, in this case BLOCK1, as shown in Figure 5, move BLOCK8 to BLOCK1 in the management list.
可选地,本实施例中,还可使用位图表管理大数据块中的小数据块,例如,将2MB的数据块作为大数据块,将512B的数据块作为小数据块,则在每一个2MB大数据块内部又可以分为4096个512B小数据块,可以使用位图表来管理这些512B数据块,位图表中每一个512B使用1个位来管理。图6为位图表管理示意图,如图6所示,该位图表中示出了两个2MB的数据块的管理示意图,如果对应位值为0,则代表对应的512B不在缓存镜像的存储空间中;反之,如果对应位值为1,则代表对应的512B在缓存镜像的存储空间中。需要说明的是,图6仅示出了8个512B数据块,并未将一个2MB数据块内的所有的512B数据块,具体操作中以实际情况为准。Optionally, in this embodiment, a small data block in a large data block may also be managed by using a bitmap, for example, a 2 MB data block is used as a large data block, and a 512B data block is used as a small data block, The 2MB big data block can be further divided into 4096 512B small data blocks. These 512B data blocks can be managed by using a bit chart. Each 512B in the bit chart is managed with 1 bit. 6 is a schematic diagram of bit chart management. As shown in FIG. 6, the bitmap shows the management diagram of two 2MB data blocks. If the corresponding bit value is 0, it means that the corresponding 512B is not in the storage space of the cache image. Conversely, if the corresponding bit value is 1, it means that the corresponding 512B is in the storage space of the cache image. It should be noted that FIG. 6 only shows eight 512B data blocks, and all 512B data blocks in one 2MB data block are not used. The actual operation is subject to actual conditions.
在本实施例中,小数据块未写入缓存镜像的存储空间之前,位图表中的对应位置为0,当小数据块写入缓存镜像中第一大数据块对应的存储空间后,需要将位图表中小数据块对应的位置更新为1。In this embodiment, before the small data block is written into the storage space of the cache image, the corresponding position in the bitmap is 0. After the small data block is written into the storage space corresponding to the first large data block in the cache image, The position corresponding to the small data block in the bit chart is updated to 1.
本实施例提供的缓存的处理方法,接收读输入输出IO请求,并根据读IO请求,从父镜像中读取小数据块,并将第一大数据块的访问计数值加1,若第一 大数据块在缓存镜像中,则根据访问计数值,在管理链表中更新第一大数据块的标识所在的位置和访问计数值,并将小数据块写入缓存镜像中第一大数据块对应的存储空间,若第一大数据块不在缓存镜像中,则将第一大数据块的标识和对应的访问计数值写入管理链表,并检查缓存镜像的存储空间是否已满或者存储空间的占用比例是否大于或者等于预设比例阈值,若缓存镜像的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值,则将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间,若缓存镜像的存储空间未满或者存储空间的占用比例小于预设比例阈值,若否,即缓存镜像的存储空间未满或者存储空间的占用比例小于预设比例阈值。相较于现有技术中当缓存镜像的存储空间用完后,就无法再将新的数据块写入缓存镜像的现象而言,本实施例中,不仅可以实现用新的第一大数据块替换老化的第二大数据块,然后将需要写入的小数据块写入缓存镜像中,有效提高了存储空间的利用率,而且,使用管理链表管理缓存镜像中的大数据块,根据大数据块的访问计数值可以方便快速的找到老化的数据块,提高了大数据块的替换、加入和数据块标识在链表中移动的效率。The processing method of the cache provided in this embodiment receives the read input and output IO request, and reads the small data block from the parent image according to the read IO request, and adds the access count value of the first large data block to 1, if the first The big data block is in the cache image, and according to the access count value, the location and the access count value of the identifier of the first large data block are updated in the management linked list, and the small data block is written into the first large data block in the cache image. The storage space, if the first large data block is not in the cache image, write the identifier of the first large data block and the corresponding access count value into the management chain table, and check whether the storage space of the cache image is full or the storage space is occupied. Whether the ratio is greater than or equal to the preset ratio threshold. If the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, the first large data block is replaced with the second largest data block in the cache image. And the small data block is written into the storage space corresponding to the first large data block in the cache image. If the storage space of the cache image is not full or the storage space occupancy ratio is less than the preset ratio threshold, if not, the storage space of the cache image is not The occupancy ratio of full or storage space is less than the preset ratio threshold. Compared with the prior art, when the storage space of the cache image is used up, the new data block can no longer be written into the cache image. In this embodiment, not only the new first large data block can be implemented. Replace the aging second largest data block, and then write the small data block that needs to be written into the cache image, which effectively improves the utilization of the storage space. Moreover, the management chain table is used to manage the large data blocks in the cache image according to the big data. The access count value of the block can quickly and easily find the aging data block, and improve the efficiency of the replacement, join and data block identification of the big data block in the linked list.
图7为本发明实施例三提供的缓存的处理方法流程图。在上述实施例二的基础上,步骤“将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间”的具体实现方式包括以下步骤:FIG. 7 is a flowchart of a method for processing a cache according to Embodiment 3 of the present invention. On the basis of the foregoing embodiment 2, the step of “replace the first large data block with the second largest data block in the cache image and write the small data block into the storage space corresponding to the first large data block in the cache image” The implementation includes the following steps:
步骤301、根据第一大数据块的访问计数值,从管理链表的表头位置开始依次查找,获取第二大数据块,将第二大数据块的标识和访问计数值从管理链表中移除,并将第一大数据块的标识和访问计数值写入管理链表中第三个大数据块的标识之前。Step 301: According to the access count value of the first big data block, search from the header position of the management linked list, obtain the second largest data block, and remove the identifier and the access count value of the second large data block from the management linked list. And write the identity and access count value of the first large data block before the identity of the third big data block in the management linked list.
其中,第二大数据块为在管理链表中,访问计数值小于或者等于第一大数据块的访问计数值的第一个数据块;第三大数据块为删除了第二大数据块的标识后的管理链表中,访问计数值大于或者等于第一大数据块的访问计数值的第一个数据块。The second largest data block is the first data block in the management linked list, and the access count value is less than or equal to the access count value of the first large data block; the third largest data block is the identifier of the second largest data block deleted. In the subsequent management list, the access count value is greater than or equal to the first data block of the access count value of the first large data block.
在本实施例中,在管理链表中,根据第一大数据块的访问计数值,从表头的位置开始,查找到第一个访问计数值小于或者等于第二数据的访问计数值的数据块,将该数据块作为第二大数据块,将第二大数据块的标识和访问计数值从管理链表中移除,表示该第二大数据块不存在于缓存镜像中,将第一大数据 块的标识和访问计数值写入管理链表中,表示第一大数据块存在于缓存镜像中。In this embodiment, in the management linked list, according to the access count value of the first large data block, starting from the position of the header, the data block whose first access count value is less than or equal to the access count value of the second data is found. The data block is used as the second largest data block, and the identifier and the access count value of the second largest data block are removed from the management linked list, indicating that the second large data block does not exist in the cache image, and the first big data is The identity of the block and the access count value are written into the management list, indicating that the first large block of data exists in the cache image.
图8为实施例三中第一大数据块进入缓存镜像前的管理链表示意图,图9为实施例三中第一大数据块进入缓存镜像后的管理链表示意图。如图8所示,该管理链表中包括数据块3(BLOCK3)、数据块6(BLOCK6)、数据块1(BLOCK1)和数据块8(BLOCK8),BLOCK3的访问计数值为5,BLOCK6的访问计数值为7,BLOCK1的访问计数值为7,BLOCK8的访问计数值为8;在缓存镜像外其它的数据块中,即第一大数据块为BLOCK5,访问计数值为5。当BLOCK5再次被访问时,其访问计数值加1变为6,此时BLOCK5的访问计数值已经大于BLOCK3,即BLOCK3为第一个访问计数值小于BLOCK5的数据块,则将BLOCK3作为第二大数据块,而在管理链表中,BLOCK5不在链表中,即第一大数据块不在缓存镜像中,则需要在管理链表中进行替换,如图9所示,将BLOCK3从链表中移除,并将BLOCK5加入管理链表。在将BLOCK5加入管理链表时,从头往后查找,找到第一个访问计数值大于或者等于6的数据块,此例中为BLOCK6,即BLOCK6为第四数据块,则把BLOCK5加入到管理链表中BLOCK6前。FIG. 8 is a schematic diagram of a management link table before the first large data block enters the cache image in the third embodiment, and FIG. 9 is a schematic diagram of the management link table after the first large data block enters the cache image in the third embodiment. As shown in FIG. 8, the management list includes data block 3 (BLOCK3), data block 6 (BLOCK6), data block 1 (BLOCK1), and data block 8 (BLOCK8). The access count value of BLOCK3 is 5, and the access of BLOCK6 is as shown in FIG. The count value is 7, the access count value of BLOCK1 is 7, and the access count value of BLOCK8 is 8. In the other data blocks except the cache image, the first large data block is BLOCK5 and the access count value is 5. When BLOCK5 is accessed again, its access count value is increased to 1 and the access count value of BLOCK5 is already greater than BLOCK3. That is, BLOCK3 is the data block whose first access count value is less than BLOCK5, then BLOCK3 is the second largest. Data block, and in the management linked list, BLOCK5 is not in the linked list, that is, the first large data block is not in the cache image, then it needs to be replaced in the management linked list, as shown in Figure 9, BLOCK3 is removed from the linked list, and BLOCK5 joins the management list. When adding BLOCK5 to the management linked list, look up from the beginning to find the first data block with the access count value greater than or equal to 6. In this case, BLOCK6, that is, BLOCK6 is the fourth data block, then add BLOCK5 to the management list. Before BLOCK6.
需要说明的是,本实施例中,管理链表中可以包括更多的数据块的标识的访问计数值,并不以图8和图9为限。It should be noted that, in this embodiment, the access count value of the identifier of more data blocks may be included in the management linked list, and is not limited to FIG. 8 and FIG. 9 .
步骤302、在BAT中将第二大数据块对应的位置标记失效,并将第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置。Step 302: Disable the location tag corresponding to the second large data block in the BAT, and store the starting offset location of the first large data block to a location corresponding to the first large data block in the BAT.
其中,第一大数据块的起始偏移位置为第二大数据块的起始偏移位置。The starting offset position of the first large data block is the starting offset position of the second large data block.
在本实施例中,将2MB的数据块作为大数据块,将512B的数据块作为小数据块,使用BAT来管理这些2MB块,BAT中存储了每一个2MB数据块在存储空间中的起始偏移位置。例如,对于一个容量为20GB的VHD虚拟硬盘文件,其BAT项数量为10240个,如果第5个2MB数据块存储在VHD虚拟硬盘文件偏移地址为100M的位置处,则在BAT中第5个表项处的值就是100M,若BAT中的某一项为0XFFFFFFFF,则表示该数据块不存在于缓存镜像中。In this embodiment, 2 MB data blocks are used as big data blocks, 512B data blocks are used as small data blocks, and BAT is used to manage these 2 MB blocks, and BAT stores the start of each 2 MB data block in the storage space. Offset position. For example, for a VHD virtual hard disk file with a capacity of 20 GB, the number of BAT entries is 10,240. If the 5th 2MB data block is stored at the location where the VHD virtual hard disk file offset address is 100M, the fifth in the BAT. The value at the table entry is 100M. If an item in the BAT is 0XFFFFFFFF, it means that the data block does not exist in the cache image.
表1为实施例三中第一大数据块加入缓存镜像前的BAT,表2为实施例三中第一大数据块加入缓存镜像后的BAT。如表1所示,该BAT中存储了三个数据块的起始位置偏移地址,分别为6M+1.5K,4M+1K,2M+512,0M表示的为该BAT对应的存储空间中的相对起始偏移位置,并不是存储空间中实际的起始 偏移位置。在本实施例中,第二大数据块的起始偏移位置为6M+1.5K,则将BAT中第三个表项中标记为0XFFFFFFFF,则说明该第三数据不在缓存镜像中,再将起始偏移位置写入6M+1.5K写入BAT的第五个表项中,如表2所示,BAT中第五个表项对应的为第一大数据块的起始偏移位置,则说明该第一大数据块存在于缓存镜像中,并且,该第一大数据块的存储空间为原来的第二大数据块的存数空间。Table 1 is the BAT before the first large data block is added to the cache image in the third embodiment. Table 2 is the BAT after the first large data block is added to the cache image in the third embodiment. As shown in Table 1, the BAT stores the starting position offset addresses of the three data blocks, which are 6M+1.5K, 4M+1K, and 2M+512, respectively, and 0M indicates the storage space corresponding to the BAT. Relative starting offset position, not the actual starting point in the storage space Offset position. In this embodiment, the starting offset position of the second large data block is 6M+1.5K, and the third entry in the BAT is marked as 0XFFFFFFFF, indicating that the third data is not in the cache image, and then The initial offset position is written into the fifth entry of the BAT written by 6M+1.5K. As shown in Table 2, the fifth entry in the BAT corresponds to the starting offset position of the first large data block. It is indicated that the first large data block exists in the cache image, and the storage space of the first large data block is the storage space of the original second largest data block.
表1Table 1
OMOM
OXFFFFFFFFOXFFFFFFFF
6M+1.5K6M+1.5K
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
4M+1K4M+1K
OXFFFFFFFFOXFFFFFFFF
2M+5122M+512
表2Table 2
OMOM
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
6M+1.5K6M+1.5K
4M+1K4M+1K
OXFFFFFFFFOXFFFFFFFF
2M+5122M+512
步骤303、将小数据块写入缓存镜像中第一大数据块的起始偏移位置对应的存储空间。Step 303: Write the small data block into the storage space corresponding to the starting offset position of the first large data block in the cache image.
在本实施例中,每一个小数据块在第一大数据块中均有对应的位置,而该第一大数据块占用了原来的第二大数据块的存储空间,若需要写入的小数据块在原来的第二大数据块对应的位置有数据块存储,则直接用该小数据块替换原来对应位置上的数据块;若需要写入的小数据块在原来的第二大数据块对应的位置没有数据块存储,则需要给该小数据块在对应的存储位置分配存储空间,以将该小数据块存储到分配的存储空间中。 In this embodiment, each small data block has a corresponding position in the first large data block, and the first large data block occupies the storage space of the original second largest data block, if the small size needs to be written If the data block has a data block storage at a position corresponding to the original second largest data block, the data block in the original corresponding position is directly replaced by the small data block; if the small data block to be written is in the original second largest data block If there is no data block storage in the corresponding location, the small data block needs to be allocated a storage space in the corresponding storage location to store the small data block in the allocated storage space.
需要说明的是,在本实施例中,如表1和表2所示,表项中的第三项对应为第二大数据块,标记为0XFFFFFFFF,说明该第二大数据块无效,可以在该位置存储新的数据块,但实际上原来第二大数据块中被访问的小数据块仍然存储在缓存镜像的存储空间中。例如,在图6中,若数据块1为原来的第二大数据块,在第二大数据块被第一大数据块替换之后,虽然第二大数据块对应的BAT项中标记为0XFFFFFFFF,但其中第三个512B的小数据块仍然存储在存储空间中,当第一数据块的小数据块写入缓存镜像中时,若该第一数据块的小数据块的存储位置为数据块为位图表第三个512B的数据块的位置,则用该第一数据块的小数据块直接替换原来第二大数据块的第三个512B的数据块;若该第一数据块的小数据块存储位置为位图表中第二个512B的数据块的位置,但是该位置为0,即该位置没有存储空间,则需要在该第二个512B的数据块的位置分配存储空间,将该小数据块存储进去,并在对应的位图表中第二位置的值置为1。It should be noted that, in this embodiment, as shown in Table 1 and Table 2, the third item in the entry corresponds to the second largest data block, and is marked as 0XFFFFFFFF, indicating that the second large data block is invalid, and may be This location stores the new data block, but in fact the small data block that was originally accessed in the second largest data block is still stored in the storage space of the cache image. For example, in FIG. 6, if the data block 1 is the original second largest data block, after the second large data block is replaced by the first large data block, although the BAT entry corresponding to the second largest data block is marked as 0XFFFFFFFF, However, the third 512B small data block is still stored in the storage space. When the small data block of the first data block is written into the cache image, if the small data block of the first data block is stored in the data block, The position of the third 512B data block of the bit chart directly replaces the third 512B data block of the original second largest data block with the small data block of the first data block; if the small data block of the first data block The storage location is the location of the second 512B data block in the bitmap, but the location is 0, that is, there is no storage space at the location, and the storage space needs to be allocated in the location of the second 512B data block, and the small data is allocated. The block is stored in and the value of the second position in the corresponding bit chart is set to 1.
本实施例提供的缓存的处理方法,根据第一大数据块的访问计数值,从管理链表的表头位置开始依次查找,获取第二大数据块,将第二大数据块的标识和访问计数值从管理链表中移除,并将第一大数据块的标识和访问计数值写入管理链表中第三个大数据块的标识之前,在BAT中将第二大数据块对应的位置标记失效,并将第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置,将小数据块写入缓存镜像中第一大数据块的起始偏移位置对应的存储空间,使用管理链表和BAT来管理缓存镜像中的数据块,能快速方便的找到缓存镜像中老化的大数据块,并用新的大数据块替换老换的大数据块,将读取的小数据块存入缓存镜像中存储空间,不仅提高了存储空间的利用率,也可以在下一次访问该小数据块时,直接到缓存镜像中访问,减轻了对父镜像所在的远程存储的压力。The processing method of the cache provided in this embodiment searches in order from the header position of the management linked list according to the access count value of the first large data block, acquires the second largest data block, and counts the identifier and access of the second largest data block. The value is removed from the management linked list, and the identifier of the first large data block and the access count value are written before the identifier of the third large data block in the management linked list, and the location mark corresponding to the second largest data block is invalidated in the BAT. And storing a starting offset position of the first large data block to a position corresponding to the first large data block in the BAT, and writing the small data block to a corresponding offset position of the first large data block in the cache image Storage space, using the management linked list and BAT to manage the data blocks in the cache image, can quickly and easily find the aging large data blocks in the cache image, and replace the old large data blocks with new big data blocks, which will read small The data block is stored in the storage space of the cache image, which not only improves the utilization of the storage space, but also accesses the cache image directly when the next time the small data block is accessed, thereby alleviating the parent image. The pressure stored remotely.
图10为本发明实施例四提供的缓存的处理方法流程图。在上述实施例二的基础上,步骤“将第一大数据块加入缓存镜像,并将小数据块写入缓存镜像中第一大数据块对应的存储空间”的具体实现方式包括如下步骤:FIG. 10 is a flowchart of a method for processing a cache according to Embodiment 4 of the present invention. On the basis of the foregoing embodiment 2, the specific implementation manner of the step of adding the first large data block to the cache image and writing the small data block to the storage space corresponding to the first large data block in the cache image includes the following steps:
步骤401、根据第一大数据块的访问计数值,将第一大数据块的标识和访问计数值写入管理链表中。Step 401: Write the identifier of the first large data block and the access count value into the management linked list according to the access count value of the first large data block.
在本实施例中,当包括小数据块的第一大数据块不在缓存镜像中,并且,缓存镜像的存储空间未满或者存储空间的占用比例小于预设比例阈值时,根据 第一大数据块的访问计数值,从管理链表的头结点开始,找到访问计数值大于或者等于第一大数据块的访问计数值的第一个大数据块,并将第一大数据块的标识和访问计数值写入该第一个大数据块之前。In this embodiment, when the first large data block including the small data block is not in the cache image, and the storage space of the cache image is not full or the occupation ratio of the storage space is less than a preset ratio threshold, according to The access count value of the first large data block starts from the head node of the management linked list, finds the first large data block whose access count value is greater than or equal to the access count value of the first large data block, and the first large data block The identity and access count value are written before the first big data block.
图11为实施例四中第一大数据块进入缓存镜像前的管理链表示意图,图12为实施例四中第一大数据块进入缓存镜像后的管理链表示意图。如图11所示,该缓存镜像中有两个大数据块,分别为数据块1(BLOCK1)和数据块6(BLOCK6),BLOCK1的访问计数值为1,BLOCK6的访问计数值为3。如图12所示,缓存镜像外的第一大数据块(BLOCK8)的访问计数值由1变为2,BLOCK8加入管理链表时,从头结点开始,找到第一个访问计数值大于或者等于BLOCK8的访问计数值的数据块,此处为BLOCK6,则将BLOCK8的标识和访问计数值加入管理链表中BLOCK6之前。11 is a schematic diagram of a management link table before the first large data block enters the cache image in the fourth embodiment, and FIG. 12 is a schematic diagram of the management link table after the first large data block enters the cache image in the fourth embodiment. As shown in FIG. 11, the cache image has two large data blocks, namely, data block 1 (BLOCK1) and data block 6 (BLOCK6), the access count value of BLOCK1 is 1, and the access count value of BLOCK6 is 3. As shown in FIG. 12, the access count value of the first large data block (BLOCK8) outside the cache image is changed from 1 to 2. When BLOCK8 is added to the management list, starting from the head node, the first access count value is greater than or equal to BLOCK8. The data block of the access count value, here BLOCK6, adds the BLOCK8 identification and access count value to the BLOCK6 in the management list.
步骤402、在缓存镜像中查找到一个空闲块,并将小数据块写入空闲块。Step 402: Find a free block in the cache image and write the small data block to the free block.
其中,空闲块为第一大数据块对应的存储空间。The free block is a storage space corresponding to the first large data block.
在本实施例中,在缓存镜像的存储空间中查找一个空闲块,将该空闲块作为第一大数据块对应的存储空间,并将小数据块写入空闲块。In this embodiment, a free block is searched in the storage space of the cache image, and the free block is used as a storage space corresponding to the first large data block, and the small data block is written into the free block.
步骤403、将空闲块的起始偏移位置写入BAT中空闲块对应的位置。Step 403: Write a starting offset position of the free block to a position corresponding to the free block in the BAT.
在本实施例中,将空闲块的起始偏移位置写入BAT中空闲块对应的表项位置处,以便于下次访问时根据起始偏移位置查找到第一大数据块的存储空间。In this embodiment, the initial offset position of the free block is written to the entry position corresponding to the free block in the BAT, so that the storage space of the first large data block is found according to the initial offset position during the next access. .
表3为实施例四中第一大数据块加入缓存镜像前的BAT,表4为实施例四中第一大数据块加入缓存镜像后的BAT。如表3所示,BLOCK1的起始偏移位置为0M,BLOCK6的起始偏移位置为2M+512。如表4所示,当BLOCK8加入缓存镜像时,查找到的空闲块的起始偏移位置为4M+1K,则将4M+1K写入BAT中BLOCK8对应的表项位置。Table 3 is the BAT before the first large data block is added to the cache image in the fourth embodiment. Table 4 is the BAT after the first large data block is added to the cache image in the fourth embodiment. As shown in Table 3, the starting offset position of BLOCK1 is 0M, and the starting offset position of BLOCK6 is 2M+512. As shown in Table 4, when BLOCK8 is added to the cache image, the found offset position of the free block is 4M+1K, and 4M+1K is written to the entry position corresponding to BLOCK8 in the BAT.
表3table 3
OMOM
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
2M+5122M+512
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
表4Table 4
OMOM
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
OXFFFFFFFFOXFFFFFFFF
2M+5122M+512
OXFFFFFFFFOXFFFFFFFF
4M+1K4M+1K
本实施例提供的缓存的处理方法,当包括小数据块的第一大数据块不在缓存镜像中,并且,缓存镜像的存储空间未满或者存储空间的占用比例小于预设比例阈值时,根据第一大数据块的访问计数值,将第一大数据块的标识和访问计数值写入管理链表中,并在缓存镜像中查找到一个空闲块,并将小数据块写入空闲块,将空闲块的起始偏移位置写入BAT中空闲块对应的位置,使用管理链表和BAT来管理缓存镜像中的数据块,能快速方便将第一大数据块加入缓存镜像中,将读取的小数据块存入缓存镜像中存储空间,不仅提高了存储空间的利用率,也可以在下一次访问该小数据块时,直接到缓存镜像中访问,减轻了对父镜像所在的远程存储的压力。The processing method of the cache provided in this embodiment, when the first large data block including the small data block is not in the cache image, and the storage space of the cache image is not full or the occupation ratio of the storage space is less than a preset ratio threshold, according to the first The access count value of a large data block, the identifier of the first large data block and the access count value are written into the management linked list, and a free block is found in the cache image, and the small data block is written into the free block, and the idle block is idle. The starting offset position of the block is written to the position corresponding to the free block in the BAT, and the management chain table and the BAT are used to manage the data block in the cache image, so that the first large data block can be quickly and conveniently added to the cache image, and the read small The data block is stored in the storage space of the cache image, which not only improves the utilization of the storage space, but also accesses the cache image directly when the next time the small data block is accessed, thereby reducing the pressure on the remote storage where the parent image is located.
图13为本发明实施例五提供的缓存的处理装置的结构示意图。如图13所示,该装置包括读取模块11、检查模块12和处理模块13。读取模块11用于接收读输入输出IO请求,并根据读IO请求,从父镜像中读取小数据块。检查模块12用于若包含小数据块的第一大数据块不在缓存镜像中,则检查缓存镜像的存储空间是否已满或者存储空间的占用比例是否大于或者等于预设比例阈值。处理模块13用于若缓存镜像的存储空间已满或者存储空间的占用比例大于或者等于预设比例阈值,则将第一大数据块替换缓存镜像中的第二大数据块,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。FIG. 13 is a schematic structural diagram of a cache processing apparatus according to Embodiment 5 of the present invention. As shown in FIG. 13, the apparatus includes a reading module 11, an inspection module 12, and a processing module 13. The reading module 11 is configured to receive the read input and output IO request and read the small data block from the parent image according to the read IO request. The checking module 12 is configured to check whether the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold if the first large data block that includes the small data block is not in the cache image. The processing module 13 is configured to replace the first large data block with the second largest data block in the cache image, and replace the small data block, if the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to a preset ratio threshold. Writes the storage space corresponding to the first large data block in the cache image.
本实施例的装置,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
图14为本发明实施例六提供的缓存的处理装置的结构示意图。在上述实施例五的基础上,如图14所示,处理模块包括更新单元21用于若第一大数据块在缓存镜像中,则根据访问计数值,在管理链表中更新第一大数据块的标识所在的位置和访问计数值,并将小数据块写入缓存镜像中第一大数据块对应的存 储空间。读取模块11还用于将包含小数据块的第一大数据块的访问计数值加1。处理模块13还用于将第一大数据块的标识和对应的访问计数值写入管理链表。处理模块13还用于若缓存镜像的存储空间未满或者存储空间的占用比例小于预设比例阈值,则将第一大数据块加入缓存镜像,并将小数据块写入缓存镜像中第一大数据块对应的存储空间。FIG. 14 is a schematic structural diagram of a cache processing apparatus according to Embodiment 6 of the present invention. On the basis of the foregoing embodiment 5, as shown in FIG. 14, the processing module includes an updating unit 21, configured to update the first large data block in the management linked list according to the access count value if the first large data block is in the cache image. The location of the identifier and the access count value, and write the small data block to the cache corresponding to the first largest data block in the cache image. Storage space. The reading module 11 is further configured to increment the access count value of the first large data block containing the small data block by one. The processing module 13 is further configured to write the identifier of the first large data block and the corresponding access count value into the management linked list. The processing module 13 is further configured to add the first large data block to the cache image and write the small data block into the cache image if the storage space of the cache image is not full or the occupation ratio of the storage space is less than a preset ratio threshold. The storage space corresponding to the data block.
本实施例的装置,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
图15为本发明实施例七提供的缓存的处理装置的结构示意图。在上述实施例六的基础上,如图15所示,处理模块13包括第二大数据块获取单元22、位置标记单元23和小数据块写入单元24。其中,第二大数据块获取单元22用于根据第一大数据块的访问计数值,从管理链表的表头位置开始依次查找,获取第二大数据块,将第二大数据块的标识和访问计数值从管理链表中移除,并将第一大数据块的标识和访问计数值写入管理链表中第三个大数据块的标识之前;其中,第二大数据块为在管理链表中,访问计数值小于或者等于第一大数据块的访问计数值的第一个数据块;第三大数据块为删除了第二大数据块的标识后的管理链表中,访问计数值大于或者等于第一大数据块的访问计数值的第一个数据块。位置标记单元23用于在BAT中将第二大数据块对应的位置标记失效,并将第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置;其中,第一大数据块的起始偏移位置为第二大数据块的起始偏移位置。小数据块写入单元24用于将小数据块写入缓存镜像中第一大数据块的起始偏移位置对应的存储空间。FIG. 15 is a schematic structural diagram of a cache processing apparatus according to Embodiment 7 of the present invention. On the basis of the above-described sixth embodiment, as shown in FIG. 15, the processing module 13 includes a second large data block acquiring unit 22, a position marking unit 23, and a small data block writing unit 24. The second large data block obtaining unit 22 is configured to search, according to the access count value of the first large data block, from the header position of the management linked list, obtain the second large data block, and identify the second large data block. The access count value is removed from the management linked list, and the identifier of the first large data block and the access count value are written before the identifier of the third large data block in the management linked list; wherein the second largest data block is in the management linked list The first data block whose access count value is less than or equal to the access count value of the first large data block; the third largest data block is the management link list after the identifier of the second largest data block is deleted, and the access count value is greater than or equal to The first data block of the access count value of the first large data block. The location marking unit 23 is configured to invalidate the location tag corresponding to the second large data block in the BAT, and store the starting offset location of the first large data block to a location corresponding to the first large data block in the BAT; The starting offset position of the first large data block is the starting offset position of the second largest data block. The small data block writing unit 24 is configured to write the small data block into the storage space corresponding to the start offset position of the first large data block in the cache image.
本实施例的装置,可以用于执行图7所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 7. The implementation principle and technical effects are similar, and details are not described herein again.
图16为本发明实施例八提供的缓存的处理装置的结构示意图。在上述实施例六的基础上,如图16所示,处理模块13包括标识写入单元25、空闲块获取单元26和位置写入单元27。其中,标识写入单元25用于根据第一大数据块的访问计数值,将第一大数据块的标识和访问计数值写入管理链表中。空闲块获取单元26用于在缓存镜像中查找到一个空闲块,并将小数据块写入空闲块;其中,空闲块为第一大数据块对应的存储空间。位置写入单元27用于将空闲块的起始偏移位置写入BAT中空闲块对应的位置。 FIG. 16 is a schematic structural diagram of a cache processing apparatus according to Embodiment 8 of the present invention. On the basis of the above-described sixth embodiment, as shown in FIG. 16, the processing module 13 includes an identification writing unit 25, a free block acquiring unit 26, and a position writing unit 27. The identifier writing unit 25 is configured to write the identifier of the first big data block and the access count value into the management linked list according to the access count value of the first large data block. The free block obtaining unit 26 is configured to find a free block in the cache image and write the small data block into the free block; wherein the free block is the storage space corresponding to the first large data block. The position writing unit 27 is for writing the start offset position of the free block to the position corresponding to the free block in the BAT.
本实施例的装置,可以用于执行图10所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device in this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 10, and the implementation principle and technical effects are similar, and details are not described herein again.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。One of ordinary skill in the art will appreciate that all or part of the steps to implement the various method embodiments described above may be accomplished by hardware associated with the program instructions. The aforementioned program can be stored in a computer readable storage medium. The program, when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。 Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.

Claims (12)

  1. 一种缓存的处理方法,其特征在于,包括:A method for processing a cache, comprising:
    接收读输入输出IO请求,并根据所述读IO请求,从父镜像中读取小数据块;Receiving a read input and output IO request, and reading a small data block from the parent image according to the read IO request;
    若包含所述小数据块的第一大数据块不在缓存镜像中,则检查所述缓存镜像的存储空间是否已满或者所述存储空间的占用比例是否大于或者等于预设比例阈值;If the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupation ratio of the storage space is greater than or equal to a preset ratio threshold;
    若所述缓存镜像的存储空间已满或者所述存储空间的占用比例大于或者等于所述预设比例阈值,则将所述第一大数据块替换所述缓存镜像中的第二大数据块,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。If the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replacing the first large data block with the second largest data block in the cache image, And writing the small data block to a storage space corresponding to the first large data block in the cache image.
  2. 根据权利要求1所述的方法,其特征在于,所述从父镜像中读取小数据块之后,所述方法还包括:The method according to claim 1, wherein after the reading the small data block from the parent image, the method further comprises:
    将包含所述小数据块的第一大数据块的访问计数值加1;Adding an access count value of the first large data block containing the small data block by one;
    则在所述若包含所述小数据块的第一大数据块不在缓存镜像中,则检查所述缓存镜像的存储空间是否已满或者所述存储空间的占用比例是否大于或者等于预设比例阈值之前,所述方法还包括:If the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupied ratio of the storage space is greater than or equal to a preset ratio threshold. Previously, the method further includes:
    将所述第一大数据块的标识和对应的访问计数值写入管理链表。The identifier of the first large data block and the corresponding access count value are written into the management linked list.
  3. 根据权利要求1或2所述的方法,其特征在于,还包括:The method according to claim 1 or 2, further comprising:
    若所述缓存镜像的存储空间未满或者所述存储空间的占用比例小于所述预设比例阈值,则将所述第一大数据块加入所述缓存镜像,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。Adding the first large data block to the cache image and writing the small data block if the storage space of the cache image is not full or the occupation ratio of the storage space is less than the preset ratio threshold. The storage space corresponding to the first large data block in the cache image.
  4. 根据权利要求2所述的方法,其特征在于,所述将所述第一大数据块替换所述缓存镜像中的第二大数据块,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间,具体包括:The method according to claim 2, wherein said replacing said first large data block with a second largest data block in said cache image and writing said small data block into said cache image The storage space corresponding to the first large data block specifically includes:
    根据所述第一大数据块的访问计数值,从所述管理链表的表头位置开始依次查找,获取所述第二大数据块,将所述第二大数据块的标识和访问计数值从所述管理链表中移除,并将所述第一大数据块的标识和访问计数值写入所述管理链表中第三个大数据块的标识之前;其中,所述第二大数据块为在所述管理链表中,访问计数值小于或者等于第一大数据块的访问计数值的第一个数据块; 所述第三大数据块为删除了所述第二大数据块的标识后的管理链表中,访问计数值大于或者等于所述第一大数据块的访问计数值的第一个数据块;Determining, according to the access count value of the first large data block, starting from the header position of the management linked list, acquiring the second large data block, and determining the identifier and the access count value of the second large data block from Removing the management linked list, and writing the identifier of the first large data block and the access count value to the identifier of the third large data block in the management linked list; wherein the second large data block is In the management linked list, the access data is less than or equal to the first data block of the access count value of the first large data block; The third large data block is a first data block in the management link table after the identifier of the second large data block is deleted, and the access count value is greater than or equal to the access count value of the first large data block;
    在块分配表BAT中将第二大数据块对应的位置标记失效,并将所述第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置;其中,所述第一大数据块的起始偏移位置为所述第二大数据块的起始偏移位置;Deactivating a location flag corresponding to the second largest data block in the block allocation table BAT, and storing a starting offset position of the first large data block to a location corresponding to the first large data block in the BAT; The starting offset position of the first large data block is the starting offset position of the second large data block;
    将所述小数据块写入所述缓存镜像中所述第一大数据块的起始偏移位置对应的存储空间。Writing the small data block into a storage space corresponding to a starting offset position of the first large data block in the cache image.
  5. 根据权利要求3所述的方法,其特征在于,所述将所述第一大数据块加入所述缓存镜像,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间,具体包括:The method according to claim 3, wherein said adding said first large data block to said cache image and writing said small data block to said first large data block in said cache image Corresponding storage space, including:
    根据所述第一大数据块的访问计数值,将所述第一大数据块的标识和访问计数值写入所述管理链表中;And writing an identifier of the first large data block and an access count value into the management linked list according to an access count value of the first large data block;
    在所述缓存镜像中查找到一个空闲块,并将所述小数据块写入所述空闲块;其中,所述空闲块为所述第一大数据块对应的存储空间;Finding a free block in the cache image, and writing the small data block to the free block; wherein the free block is a storage space corresponding to the first large data block;
    将所述空闲块的起始偏移位置写入BAT中所述空闲块对应的位置。Writing a starting offset position of the free block to a location corresponding to the free block in the BAT.
  6. 根据权利要求2所述的方法,其特征在于,若所述第一大数据块在缓存镜像中,则根据所述访问计数值,在所述管理链表中更新所述第一大数据块的标识所在的位置和所述访问计数值,并将所述小数据块写入所述缓存镜像中第一大数据块对应的存储空间。The method according to claim 2, wherein if the first large data block is in a cache image, updating the identifier of the first large data block in the management linked list according to the access count value a location and the access count value, and writing the small data block to a storage space corresponding to the first large data block in the cache image.
  7. 一种缓存的处理装置,其特征在于,包括:A cache processing device, comprising:
    读取模块,用于接收读输入输出IO请求,并根据所述读IO请求,从父镜像中读取小数据块;a reading module, configured to receive a read input and output IO request, and read a small data block from the parent image according to the read IO request;
    检查模块,用于若包含所述小数据块的第一大数据块不在缓存镜像中,则检查所述缓存镜像的存储空间是否已满或者所述存储空间的占用比例是否大于或者等于预设比例阈值;The checking module is configured to: if the first large data block that includes the small data block is not in the cache image, check whether the storage space of the cache image is full or whether the occupied ratio of the storage space is greater than or equal to a preset ratio Threshold value
    处理模块,用于若所述缓存镜像的存储空间已满或者所述存储空间的占用比例大于或者等于所述预设比例阈值,则将所述第一大数据块替换所述缓存镜像中的第二大数据块,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。a processing module, if the storage space of the cache image is full or the occupation ratio of the storage space is greater than or equal to the preset ratio threshold, replacing the first large data block with the first one of the cache image And storing the small data block into a storage space corresponding to the first large data block in the cache image.
  8. 根据权利要求7所述的装置,其特征在于,所述读取模块还用于将包含 所述小数据块的第一大数据块的访问计数值加1;The apparatus of claim 7 wherein said reading module is further for The access count value of the first large data block of the small data block is increased by one;
    所述处理模块还用于将所述第一大数据块的标识和对应的访问计数值写入管理链表。The processing module is further configured to write the identifier of the first large data block and the corresponding access count value into the management linked list.
  9. 根据权利要求7或8所述的装置,其特征在于,所述处理模块还用于若所述缓存镜像的存储空间未满或者所述存储空间的占用比例小于所述预设比例阈值,则将所述第一大数据块加入所述缓存镜像,并将所述小数据块写入所述缓存镜像中所述第一大数据块对应的存储空间。The device according to claim 7 or 8, wherein the processing module is further configured to: if the storage space of the cache image is not full or the occupation ratio of the storage space is less than the preset ratio threshold, The first large data block is added to the cache image, and the small data block is written into a storage space corresponding to the first large data block in the cache image.
  10. 根权利要求8所述的装置,其特征在于,所述处理模块包括:The device of claim 8 wherein the processing module comprises:
    第二大数据块获取单元,用于根据所述第一大数据块的访问计数值,从所述管理链表的表头位置开始依次查找,获取所述第二大数据块,将所述第二大数据块的标识和访问计数值从所述管理链表中移除,并将所述第一大数据块的标识和访问计数值写入所述管理链表中第三个大数据块的标识之前;其中,所述第二大数据块为在所述管理链表中,访问计数值小于或者等于第一大数据块的访问计数值的第一个数据块;所述第三大数据块为删除了所述第二大数据块的标识后的管理链表中,访问计数值大于或者等于所述第一大数据块的访问计数值的第一个数据块;a second large data block obtaining unit, configured to sequentially search from the header position of the management linked list according to an access count value of the first large data block, acquire the second large data block, and use the second The identification and access count value of the big data block is removed from the management linked list, and the identifier and the access count value of the first large data block are written before the identifier of the third large data block in the management linked list; The second large data block is the first data block in the management linked list, and the access count value is less than or equal to the access count value of the first large data block; the third large data block is deleted. In the management chain table after the identification of the second largest data block, the access data is greater than or equal to the first data block of the access count value of the first large data block;
    位置标记单元,用于在BAT中将第二大数据块对应的位置标记失效,并将所述第一大数据块的起始偏移位置存储到BAT中的第一大数据块对应的位置;其中,所述第一大数据块的起始偏移位置为所述第二大数据块的起始偏移位置;a location marking unit, configured to invalidate a location identifier corresponding to the second large data block in the BAT, and store a starting offset location of the first large data block to a location corresponding to the first large data block in the BAT; The starting offset position of the first large data block is a starting offset position of the second large data block;
    小数据块写入单元,用于将所述小数据块写入所述缓存镜像中所述第一大数据块的起始偏移位置对应的存储空间。And a small data block writing unit, configured to write the small data block into a storage space corresponding to a starting offset position of the first large data block in the cache image.
  11. 根据权利要求9所述的装置,其特征在于,所述处理模块包括:The device according to claim 9, wherein the processing module comprises:
    标识写入单元,用于根据所述第一大数据块的访问计数值,将所述第一大数据块的标识和访问计数值写入所述管理链表中;An identifier writing unit, configured to write an identifier of the first large data block and an access count value into the management linked list according to an access count value of the first large data block;
    空闲块获取单元,用于在所述缓存镜像中查找到一个空闲块,并将所述小数据块写入所述空闲块;其中,所述空闲块为所述第一大数据块对应的存储空间;a free block obtaining unit, configured to find a free block in the cache image, and write the small data block into the free block; wherein the free block is a storage corresponding to the first large data block space;
    位置写入单元,用于将所述空闲块的起始偏移位置写入BAT中所述空闲块对应的位置。And a location writing unit, configured to write a starting offset position of the free block to a location corresponding to the free block in the BAT.
  12. 根据权利要求8所述的方法,其特征在于,所述处理模块还包括: The method according to claim 8, wherein the processing module further comprises:
    更新单元,用于若所述第一大数据块在缓存镜像中,则根据所述访问计数值,在所述管理链表中更新所述第一大数据块的标识所在的位置和所述访问计数值,并将所述小数据块写入所述缓存镜像中第一大数据块对应的存储空间。 And an update unit, configured to: when the first large data block is in the cache image, update the location of the identifier of the first large data block and the access count in the management link table according to the access count value And storing the small data block into a storage space corresponding to the first large data block in the cache image.
PCT/CN2015/097176 2014-12-16 2015-12-11 Cache processing method and apparatus WO2016095761A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410784834.6 2014-12-16
CN201410784834.6A CN104503703B (en) 2014-12-16 2014-12-16 The treating method and apparatus of caching

Publications (1)

Publication Number Publication Date
WO2016095761A1 true WO2016095761A1 (en) 2016-06-23

Family

ID=52945104

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/097176 WO2016095761A1 (en) 2014-12-16 2015-12-11 Cache processing method and apparatus

Country Status (2)

Country Link
CN (1) CN104503703B (en)
WO (1) WO2016095761A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113655955A (en) * 2021-07-16 2021-11-16 深圳大普微电子科技有限公司 Cache management method, solid state disk controller and solid state disk

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104503703B (en) * 2014-12-16 2018-06-05 华为技术有限公司 The treating method and apparatus of caching
CN105227665B (en) * 2015-07-20 2018-11-30 中国科学院计算技术研究所 A kind of caching replacement method for cache node
CN106383666B (en) * 2016-09-07 2020-05-01 东信和平科技股份有限公司 Data storage method and device
WO2018166072A1 (en) * 2017-03-13 2018-09-20 华为技术有限公司 Method and device for data processing
CN109542348B (en) * 2018-11-19 2022-05-10 郑州云海信息技术有限公司 Data brushing method and device
CN111324415A (en) * 2019-10-28 2020-06-23 烽火通信科技股份有限公司 Virtual machine mirror image cache creating method and system and computer readable medium
CN111831655B (en) * 2020-06-24 2024-04-09 北京字节跳动网络技术有限公司 Data processing method, device, medium and electronic equipment
CN114371810B (en) * 2020-10-15 2023-10-27 中国移动通信集团设计院有限公司 Data storage method and device of HDFS

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6418510B1 (en) * 2000-09-14 2002-07-09 International Business Machines Corporation Cooperative cache and rotational positioning optimization (RPO) scheme for a direct access storage device (DASD)
CN102999444A (en) * 2012-11-13 2013-03-27 华为技术有限公司 Method and device for replacing data in caching module
CN103136121A (en) * 2013-03-25 2013-06-05 中国人民解放军国防科学技术大学 Cache management method for solid-state disc
CN103218248A (en) * 2013-03-25 2013-07-24 华为技术有限公司 Virtual machine mirror image updating method, server and desktop cloud system
CN104503703A (en) * 2014-12-16 2015-04-08 华为技术有限公司 Cache processing method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7058784B2 (en) * 2003-07-04 2006-06-06 Solid State System Co., Ltd. Method for managing access operation on nonvolatile memory and block structure thereof
CN103049397B (en) * 2012-12-20 2015-09-16 中国科学院上海微系统与信息技术研究所 A kind of solid state hard disc inner buffer management method based on phase transition storage and system
CN103885728B (en) * 2014-04-04 2016-08-17 华中科技大学 A kind of disk buffering system based on solid-state disk

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6418510B1 (en) * 2000-09-14 2002-07-09 International Business Machines Corporation Cooperative cache and rotational positioning optimization (RPO) scheme for a direct access storage device (DASD)
CN102999444A (en) * 2012-11-13 2013-03-27 华为技术有限公司 Method and device for replacing data in caching module
CN103136121A (en) * 2013-03-25 2013-06-05 中国人民解放军国防科学技术大学 Cache management method for solid-state disc
CN103218248A (en) * 2013-03-25 2013-07-24 华为技术有限公司 Virtual machine mirror image updating method, server and desktop cloud system
CN104503703A (en) * 2014-12-16 2015-04-08 华为技术有限公司 Cache processing method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113655955A (en) * 2021-07-16 2021-11-16 深圳大普微电子科技有限公司 Cache management method, solid state disk controller and solid state disk
CN113655955B (en) * 2021-07-16 2023-05-16 深圳大普微电子科技有限公司 Cache management method, solid state disk controller and solid state disk

Also Published As

Publication number Publication date
CN104503703B (en) 2018-06-05
CN104503703A (en) 2015-04-08

Similar Documents

Publication Publication Date Title
WO2016095761A1 (en) Cache processing method and apparatus
US10241919B2 (en) Data caching method and computer system
US10101930B2 (en) System and method for supporting atomic writes in a flash translation layer
KR101620773B1 (en) Data migration for composite non-volatile storage device
CN105740164B (en) Multi-core processor supporting cache consistency, reading and writing method, device and equipment
EP2735978B1 (en) Storage system and management method used for metadata of cluster file system
US8838936B1 (en) System and method for efficient flash translation layer
JP6613375B2 (en) Profiling cache replacement
US10409502B2 (en) Method and apparatus for writing metadata into cache
US20150113230A1 (en) Directory storage method and query method, and node controller
US9501419B2 (en) Apparatus, systems, and methods for providing a memory efficient cache
US20160041907A1 (en) Systems and methods to manage tiered cache data storage
CN110555001B (en) Data processing method, device, terminal and medium
WO2017113213A1 (en) Method and device for processing access request, and computer system
WO2015180493A1 (en) Method, apparatus, and system for processing data storage
WO2023160358A1 (en) Memory scanning method and apparatus
WO2020063355A1 (en) Method and device for buffering data blocks, computer device, and computer-readable storage medium
CN109002400B (en) Content-aware computer cache management system and method
WO2016206070A1 (en) File updating method and storage device
US10102116B2 (en) Multi-level page data structure
US11038797B2 (en) Forwarding table entry access
CN111443874A (en) Solid-state disk memory cache management method and device based on content awareness and solid-state disk
CN104252423A (en) Consistency processing method and device based on multi-core processor
WO2016131175A1 (en) Method and device for accessing data visitor directory in multi-core system
US10162525B2 (en) Translating access requests for a multi-level page data structure

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: 15869268

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15869268

Country of ref document: EP

Kind code of ref document: A1