CN114564148A - Method, device, equipment and storage medium for writing data to source volume in snapshot process - Google Patents
Method, device, equipment and storage medium for writing data to source volume in snapshot process Download PDFInfo
- Publication number
- CN114564148A CN114564148A CN202210140622.9A CN202210140622A CN114564148A CN 114564148 A CN114564148 A CN 114564148A CN 202210140622 A CN202210140622 A CN 202210140622A CN 114564148 A CN114564148 A CN 114564148A
- Authority
- CN
- China
- Prior art keywords
- source volume
- volume
- data
- target
- write
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 63
- 230000008569 process Effects 0.000 title claims abstract description 17
- 238000004590 computer program Methods 0.000 claims description 30
- 238000005516 engineering process Methods 0.000 abstract description 6
- 238000010586 diagram Methods 0.000 description 11
- 230000036316 preload Effects 0.000 description 5
- 230000001360 synchronised effect Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000000903 blocking effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0631—Configuration or reconfiguration of storage systems by allocating resources to storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0674—Disk device
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请涉及一种快照过程中向源卷写数据的方法、装置、设备和存储介质。所述方法包括:接收对目标源卷的目标时刻创建快照卷的指令;将所述目标源卷重定向至新的源卷;为所述新的源卷的各数据块分配新的写地址;在接收到所述新的源卷的写数据指令时,根据所述新的写地址将所述目标源卷的写数据指令中的待写入数据写入所述新的源卷中的目标数据块。本申请通过将目标源卷重定向至新的源卷,为所述新的源卷的各数据块分配新的写地址,在对目标源卷进行写数据操作时,可以将数据写入新的写地址中,实现一次写即可完成对目标源数据的写数据操作,相比于传统技术中对源卷数据第一次改变时需要一次读两次写操作而言,提升了写性能。
The present application relates to a method, apparatus, device and storage medium for writing data to a source volume during a snapshot process. The method includes: receiving an instruction to create a snapshot volume at the target moment of the target source volume; redirecting the target source volume to a new source volume; allocating a new write address to each data block of the new source volume; When receiving the data write command of the new source volume, write the data to be written in the data write command of the target source volume to the target data in the new source volume according to the new write address piece. In the present application, by redirecting the target source volume to a new source volume, a new write address is allocated to each data block of the new source volume, and when a data write operation is performed on the target source volume, data can be written into the new source volume. In the write address, the write operation to the target source data can be completed with one write, which improves the write performance compared to the traditional technology that requires one read and two write operations when the source volume data is changed for the first time.
Description
技术领域technical field
本申请涉及数据存储技术领域,特别是涉及一种快照过程中向源卷写数据的方法、装置、设备和存储介质。The present application relates to the technical field of data storage, and in particular, to a method, apparatus, device and storage medium for writing data to a source volume during a snapshot process.
背景技术Background technique
快照是关于指定数据集合的一个完全可用拷贝,该拷贝包括相应数据在某个时间点(拷贝开始的时间点)的映像。快照可以是其所表示的数据的一个副本,也可以是数据的一个复制品。目前存储快照技术大体可分为两类,全量快照和增量快照。全量快照主要实现技术是镜像分离,创建快照速度慢,快照占用空间与源卷大小相同,快照创建完成后与源卷无依赖关系。增量快照实现技术主要有COW(写时拷贝)和ROW(写时重定向)。相对全量快照,增量快照创建速度快,占用空间小,只有源卷数据发生改变时,才会真正占用空间。COW快照卷依赖源卷数据,源卷数据第一次改变时需要一次读两次写操作,影响源数据卷的写性能。A snapshot is a fully available copy of a specified set of data that includes an image of the corresponding data at a point in time (the point in time when the copy started). A snapshot can be a copy of the data it represents, or a replica of the data. Currently, storage snapshot technologies can be roughly divided into two categories: full snapshots and incremental snapshots. The main implementation technology of full snapshots is mirror separation, the creation of snapshots is slow, the snapshot space is the same as the size of the source volume, and there is no dependency on the source volume after the snapshot is created. Incremental snapshot implementation technologies mainly include COW (copy-on-write) and ROW (redirect-on-write). Compared with full snapshots, incremental snapshots are faster to create and take up less space. Only when the source volume data changes, will it actually take up space. The COW snapshot volume depends on the source volume data. When the source volume data is changed for the first time, one read and two write operations are required, which affects the write performance of the source data volume.
发明内容SUMMARY OF THE INVENTION
基于此,有必要针对上述技术问题,提供一种快照过程中向源卷写数据的方法、装置、设备和存储介质。Based on this, it is necessary to provide a method, apparatus, device and storage medium for writing data to the source volume during the snapshot process, aiming at the above technical problems.
一种快照过程中向源卷写数据的方法,方法包括:A method for writing data to a source volume during a snapshot, the method comprising:
接收对目标源卷的目标时刻创建快照卷的指令;Receive an instruction to create a snapshot volume at the target moment of the target source volume;
将目标源卷重定向至新的源卷;redirect the target source volume to the new source volume;
为新的源卷的各数据块分配新的写地址;Allocate new write addresses for each data block of the new source volume;
在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。When receiving the data write command of the new source volume, write the data to be written in the data write command of the target source volume into the target data block in the new source volume according to the new write address.
在其中一个实施例中,上述的方法还包括:In one embodiment, the above-mentioned method further includes:
在目标缓存中预加载新的源卷在目标时刻各数据块的读地址以及写地址,新的源卷在目标时刻各数据块的读地址为目标源卷在目标时刻各数据块的读地址,新的源卷各数据块的写地址为新的写地址;Preload the read address and write address of each data block of the new source volume at the target time in the target cache, and the read address of each data block of the new source volume at the target time is the read address of each data block of the target source volume at the target time, The write address of each data block of the new source volume is the new write address;
接收新的源卷的读数据指令,从目标缓存中新的源卷的读地址中读取对应的数据。Receive the read data instruction of the new source volume, and read the corresponding data from the read address of the new source volume in the target cache.
在其中一个实施例中,上述的方法还包括:In one embodiment, the above-mentioned method further includes:
当待写入数据写入目标数据块之后,在目标缓存中将新的源卷的目标数据块的读地址异步更新为新的写地址。After the data to be written is written into the target data block, the read address of the target data block of the new source volume is asynchronously updated to the new write address in the target cache.
在其中一个实施例中,上述的方法包括:In one embodiment, the above-mentioned method includes:
将快照卷重定向至目标源卷;redirect the snapshot volume to the target source volume;
接收快照卷的读数据指令;Receive the read data command of the snapshot volume;
根据快照卷的读数据指令从目标源卷的读地址中读取目标时刻对应的数据;Read the data corresponding to the target moment from the read address of the target source volume according to the read data command of the snapshot volume;
接收快照卷的写数据指令;Receive the write data command of the snapshot volume;
将快照卷的写数据指令中的待写入数据写入目标源卷的写地址中。Write the data to be written in the data write command of the snapshot volume to the write address of the target source volume.
在其中一个实施例中,上述的方法还包括:In one embodiment, the above-mentioned method further includes:
当接收到对目标源卷创建多个时刻对应的快照卷的指令时,为目标源卷创建多个时刻对应的快照卷;When receiving an instruction to create snapshot volumes corresponding to multiple times for the target source volume, create snapshot volumes corresponding to multiple times for the target source volume;
根据目标源卷为各快照卷分配对应的标识信息、读地址以及写地址;Assign corresponding identification information, read address and write address to each snapshot volume according to the target source volume;
当接收到对各快照卷中任意一个快照卷的读数据指令时,根据对各快照卷中任意一个快照卷的读数据指令中的目标标识从对应的快照卷的对应的读地址中读取对应的数据;When receiving a data read command for any snapshot volume among the snapshot volumes, read the corresponding read address from the corresponding read address of the snapshot volume according to the target identifier in the read data command for any snapshot volume among the snapshot volumes The data;
当接收到对各快照卷中任意一个快照卷的写数据指令时,根据对各快照卷中任意一个快照卷的写数据指令中的目标标识向对应快照卷的对应写地址写入对应的数据。When receiving a data write command to any one of the snapshot volumes, write the corresponding data to the corresponding write address of the corresponding snapshot volume according to the target identifier in the data write command to any one of the snapshot volumes.
在其中一个实施例中,上述的方法还包括:In one embodiment, the above-mentioned method further includes:
将目标数据块更新后的读地址异步更新至新的源卷。Asynchronously update the updated read address of the target data block to the new source volume.
在其中一个实施例中,上述的将目标源卷重定向至新的源卷,包括:In one embodiment, the above-mentioned redirecting the target source volume to the new source volume includes:
将目标源卷的卷名修改为新的源卷的卷名,以将目标源卷重定向至新的源卷。Modify the volume name of the target source volume to the volume name of the new source volume to redirect the target source volume to the new source volume.
一种快照过程中向源卷写数据的装置,装置包括:A device for writing data to a source volume during a snapshot process, the device comprising:
接收模块,用于接收对目标源卷的目标时刻创建快照卷的指令;a receiving module, used for receiving an instruction to create a snapshot volume at the target moment of the target source volume;
重定向模块,用于将目标源卷重定向至新的源卷;The redirection module is used to redirect the target source volume to the new source volume;
分配模块,用于为新的源卷的各数据块分配新的写地址;an allocation module for allocating a new write address for each data block of the new source volume;
写入模块,用于在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。The writing module is used to write the data to be written in the data writing instruction of the target source volume into the target data block in the new source volume according to the new writing address when receiving the writing data instruction of the new source volume.
一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:A computer device, comprising a memory, a processor and a computer program stored in the memory and running on the processor, the processor implements the following steps when executing the computer program:
接收对目标源卷的目标时刻创建快照卷的指令;Receive an instruction to create a snapshot volume at the target moment of the target source volume;
将目标源卷重定向至新的源卷;redirect the target source volume to the new source volume;
为新的源卷的各数据块分配新的写地址;Allocate new write addresses for each data block of the new source volume;
在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。When receiving the data write command of the new source volume, write the data to be written in the data write command of the target source volume into the target data block in the new source volume according to the new write address.
一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
接收对目标源卷的目标时刻创建快照卷的指令;Receive an instruction to create a snapshot volume at the target moment of the target source volume;
将目标源卷重定向至新的源卷;redirect the target source volume to the new source volume;
为新的源卷的各数据块分配新的写地址;Allocate new write addresses for each data block of the new source volume;
在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。When receiving the data write command of the new source volume, write the data to be written in the data write command of the target source volume into the target data block in the new source volume according to the new write address.
上述快照过程中向源卷写数据的方法、装置、设备和存储介质,通过接收对目标源卷的目标时刻创建快照卷的指令;将目标源卷重定向至新的源卷;为新的源卷的各数据块分配新的写地址;在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。本申请通过将目标源卷重定向至新的源卷,为新的源卷的各数据块分配新的写地址,在对目标源卷进行写数据操作时,可以将数据写入新的写地址中,实现一次写即可完成对目标源数据的写数据操作,相比于传统技术中的COW方式下对源卷数据第一次改变时需要一次读两次写操作而言,提升了写性能。The method, device, device and storage medium for writing data to the source volume in the above snapshot process, by receiving an instruction to create a snapshot volume at the target moment of the target source volume; redirecting the target source volume to a new source volume; Each data block of the volume is assigned a new write address; when receiving the write data command of the new source volume, the data to be written in the write data command of the target source volume is written to the new source volume according to the new write address. target data block. In the present application, by redirecting the target source volume to the new source volume, a new write address is allocated to each data block of the new source volume, and the data can be written to the new write address when the data write operation is performed on the target source volume Compared with the COW method in the traditional technology, which requires one read and two write operations when the source volume data is changed for the first time, the write performance is improved. .
附图说明Description of drawings
图1为一个实施例中快照过程中向源卷写数据的方法的应用环境图;1 is an application environment diagram of a method for writing data to a source volume in a snapshot process in one embodiment;
图2为一个实施例中快照过程中向源卷写数据的方法的流程示意图;2 is a schematic flowchart of a method for writing data to a source volume in a snapshot process in one embodiment;
图3为一个实施例中T时刻目标源卷V的状态图;3 is a state diagram of a target source volume V at time T in one embodiment;
图4为另一个实施例中对目标源卷创建快照卷S1之后快照卷S1以及目标源卷的状态图;4 is a state diagram of the snapshot volume S1 and the target source volume after the snapshot volume S1 is created to the target source volume in another embodiment;
图5为另一个实施例中对目标源卷创建快照卷S1之后快照卷S1以及目标源卷的状态图;5 is a state diagram of the snapshot volume S1 and the target source volume after the snapshot volume S1 is created to the target source volume in another embodiment;
图6为一个实施例中对快照卷读写数据的流程示意图;6 is a schematic flowchart of reading and writing data to a snapshot volume in one embodiment;
图7为一个实施例中创建多个快照卷的流程示意图;7 is a schematic flowchart of creating a plurality of snapshot volumes in one embodiment;
图8为一个实施例中快照过程中向源卷写数据的装置的结构框图。FIG. 8 is a structural block diagram of an apparatus for writing data to a source volume during a snapshot process in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
本申请提供的快照过程中向源卷写数据的方法,可以应用于计算机设备,该计算机设备可以是终端,其内部结构图可以如图1所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种快照过程中向源卷写数据的方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。其中,终端可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备The method for writing data to a source volume during a snapshot process provided by the present application can be applied to a computer device. The computer device can be a terminal, and its internal structure diagram can be as shown in FIG. 1 . The computer equipment includes a processor, memory, a network interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The nonvolatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program, when executed by the processor, implements a method of writing data to a source volume during a snapshot. The display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the computer equipment , or an external keyboard, trackpad, or mouse. Among them, the terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices
在一个实施例中,如图2所示,提供了一种快照过程中向源卷写数据的方法,以该方法应用于图1中的终端为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 2 , a method for writing data to a source volume in a snapshot process is provided, and the method is applied to the terminal in FIG. 1 as an example to illustrate, including the following steps:
S11、接收对目标源卷的目标时刻创建快照卷的指令。S11. Receive an instruction to create a snapshot volume at the target moment of the target source volume.
本申请中,上述的目标源卷为待做快照的卷。上述的快照卷为目标源卷在某一时刻一个完全可用的拷贝。该拷贝包括目标源卷在某个时间点(拷贝开始的时间点)的映像。快照卷可以是其所表示的数据的一个副本,也可以是数据的一个复制品。In this application, the above-mentioned target source volume is the volume to be snapshotted. The above snapshot volume is a fully available copy of the target source volume at a certain time. The copy includes an image of the target source volume at a point in time (the point in time when the copy started). A snapshot volume can be a copy of the data it represents, or a replica of the data.
上述的创建目标源卷的快照卷的指令可以为用户操作存储设备而触发的指令。该指令用于对目标源卷创建对应的快照卷。The above-mentioned instruction for creating the snapshot volume of the target source volume may be an instruction triggered by the user operating the storage device. This command is used to create a corresponding snapshot volume for the target source volume.
S12、将目标源卷重定向至新的源卷。S12. Redirect the target source volume to a new source volume.
本申请中,上述的重定向是指重新指向,具体通过修改目标源卷的卷元数据,改变目标源卷的卷名,后续再根据名称查找卷时,会找到新的源卷。该卷元数据是保存卷描述信息的数据。如卷名、大小以及卷的数据寻址地址等。In this application, the above-mentioned redirection refers to redirection, specifically by modifying the volume metadata of the target source volume, changing the volume name of the target source volume, and subsequently finding a new source volume when searching for a volume based on the name. The volume metadata is data that stores volume description information. Such as volume name, size and data addressing address of the volume.
S13、为新的源卷的各数据块分配新的写地址。S13. Allocate a new write address to each data block of the new source volume.
本申请中,在创建快照卷之后,需要对目标源卷进行重定向,得到新的源卷,进一步为新的源卷分配读地址以及写地址。在为新的源卷分配读地址时将目标源卷的读地址分配至该新的源卷,在为新的源卷分配写地址时,获取新的写地址分配至该新的源卷。其中,该新的写地址可以为连续的地址。例如,假设新的源卷包括4个数据块,则可以获取新的写地址为5、6、7以及8。In the present application, after the snapshot volume is created, the target source volume needs to be redirected to obtain a new source volume, and a read address and a write address are further allocated to the new source volume. When assigning a read address to a new source volume, assign the read address of the target source volume to the new source volume, and when assigning a write address to the new source volume, obtain a new write address and assign it to the new source volume. Wherein, the new write address may be a continuous address. For example, assuming that the new source volume includes 4 data blocks, the new write addresses can be obtained as 5, 6, 7, and 8.
S14、在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。S14. When receiving the data write command of the new source volume, write the data to be written in the data write command of the target source volume into the target data block in the new source volume according to the new write address.
本申请中,上述的写数据指令用于指示向目标源卷写入数据。该写数据指令中具体可以携带待写入数据以及目标源卷的标识信息。该目标源卷的标识信息可以为目标源卷的卷名。本申请中,由于目标源卷被重定向至新的源卷,因此,向目标源卷写数据时,应该写入新的源卷对应的写地址中。In this application, the above-mentioned write data instruction is used to instruct to write data to the target source volume. The data write instruction may specifically carry the data to be written and the identification information of the target source volume. The identification information of the target source volume may be the volume name of the target source volume. In this application, since the target source volume is redirected to the new source volume, when writing data to the target source volume, it should be written to the write address corresponding to the new source volume.
具体的,本申请中,目标源卷以及新的源卷均包含对应的多个数据块,各数据块均存在对应的读地址以及写地址。上述的写数据指令中可以具体包括对应的写地址,该写地址即为上述的新的写地址中的任意一个,在将待写入数据写入目标源卷时,根据该写地址将待写入数据写入对应的目标数据块中。Specifically, in this application, both the target source volume and the new source volume include a plurality of corresponding data blocks, and each data block has a corresponding read address and a write address. The above-mentioned write data instruction may specifically include a corresponding write address, and the write address is any one of the above-mentioned new write addresses. When writing the data to be written into the target source volume, the write address will be The input data is written into the corresponding target data block.
在其中一个实施例中,上述的方法还可以包括:In one embodiment, the above-mentioned method may further include:
在目标缓存中预加载新的源卷在目标时刻各数据块的读地址以及写地址,新的源卷在目标时刻各数据块的读地址为目标源卷在目标时刻各数据块的读地址,新的源卷各数据块的写地址为新的写地址;Preload the read address and write address of each data block of the new source volume at the target time in the target cache, and the read address of each data block of the new source volume at the target time is the read address of each data block of the target source volume at the target time, The write address of each data block of the new source volume is the new write address;
接收新的源卷的读数据指令,从目标缓存中新的源卷的读地址中读取对应的数据。Receive the read data instruction of the new source volume, and read the corresponding data from the read address of the new source volume in the target cache.
本申请中,在对目标源卷进行卷读写之前需要在目标缓存中对目标源卷的卷元数据进行预加载,由于创建快照卷之后,目标源卷被重定向至新的源卷,因此,需要对新的源卷的卷元数据进行预加载至目标缓存,以后后续进行新的源卷的卷读写时从目标缓存中获取卷元数据中的读地址以及写地址进行卷读写。其中,该新的源卷的卷元数据可以包括新的源卷的卷名、卷的大小、卷的数据的读地址以及写地址等。In this application, the volume metadata of the target source volume needs to be preloaded in the target cache before the volume read/write to the target source volume. Since the target source volume is redirected to the new source volume after the snapshot volume is created, so , the volume metadata of the new source volume needs to be preloaded into the target cache, and the read and write addresses in the volume metadata are obtained from the target cache when the volume of the new source volume is subsequently read and written for volume read and write. The volume metadata of the new source volume may include the volume name of the new source volume, the size of the volume, the read address and the write address of the data of the volume, and the like.
具体的,本申请中,上述的新的源卷的读地址被分配为目标源卷的读地址,该新的源卷的写地址被分配为新的写地址。在进行新的源卷的读地址以及写地址的预加载时,将目标源卷的读地址以及上述的新的写地址加载至目标缓存中。Specifically, in this application, the read address of the above-mentioned new source volume is assigned as the read address of the target source volume, and the write address of the new source volume is assigned as a new write address. When the read address and the write address of the new source volume are preloaded, the read address of the target source volume and the above-mentioned new write address are loaded into the target cache.
进一步地,在接收到目标源卷的读数据指令时,由于目标源卷已被重定向,所以对目标源卷进行数据读取时,则可以从新的源卷的读地址进行读取。具体的,上述的目标源卷的读数据指令可以携带待读取的读地址,终端从目标缓存中新的源卷的读地址中获取该待读取的读地址中存储的数据。Further, when a data read instruction from the target source volume is received, since the target source volume has been redirected, when data is read from the target source volume, it can be read from the read address of the new source volume. Specifically, the above-mentioned read data instruction of the target source volume may carry the read address to be read, and the terminal obtains the data stored in the read address to be read from the read address of the new source volume in the target cache.
在其中一个实施例中,上述的方法还可以包括:In one embodiment, the above-mentioned method may further include:
当待写入数据写入目标数据块之后,在目标缓存中将新的源卷的目标数据块的读地址异步更新为新的写地址。After the data to be written is written into the target data block, the read address of the target data block of the new source volume is asynchronously updated to the new write address in the target cache.
本申请中,在目标时刻,在目标缓存中所存储的新的源卷的读地址为原目标源卷的读地址,而写地址被分配为新的写地址。在目标时刻之后,若新的源卷有数据更新,即有新的数据写入,则会写到新的地址对应的数据块中,此时,需要将缓存中所存储的该新的源卷的读地址进行更新,更新为新的写地址,后续再从新的源卷读取数据时,则直接从新的地址读取无需再从快照卷读取。后续从新的源卷读取数据时,已更新后的读地址可以直接根据缓存中已更新的读地址(即新的写地址)读取,还未更新的读地址,依然需要从目标源卷的读地址中读取目标时刻的数据。In the present application, at the target time, the read address of the new source volume stored in the target cache is the read address of the original target source volume, and the write address is allocated as a new write address. After the target time, if the new source volume has data update, that is, new data is written, it will be written to the data block corresponding to the new address. At this time, the new source volume stored in the cache needs to be The read address is updated to the new write address, and when data is read from the new source volume later, it is not necessary to read from the snapshot volume directly from the new address. When reading data from the new source volume later, the updated read address can be read directly according to the updated read address (ie, the new write address) in the cache. The read address that has not been updated still needs to be read from the target source volume. Read the data at the target time in the read address.
本申请中采用异步更新的方式,好处在于并行不阻塞,即数据写入后直接返回,后台通过新的线程执行更新写地址,如果不采用异步更新的方式的话,数据写入后需要等待更新写地址后才返回,这样耗时较长。In this application, the asynchronous update method is adopted, which has the advantage of non-blocking in parallel, that is, it returns directly after data is written, and the background updates the write address through a new thread. If the asynchronous update method is not used, the data needs to wait for the update write It only returns after the address, which takes a long time.
请参考图3,图3为一种实施例中,T时刻目标源卷V的状态图。如图3所示,T时刻目标源卷V的状态图中包括写地址31、读地址32、目标源卷33(即目标源卷V)以及目标源卷V中的各数据块34。其中,T时刻目标源卷V的读地址包括1、2、3以及4,写地址包括1、2、3以及4。在地址1、2、3以及4分别存储了A、B、C以及D,此时目标源卷V的卷元数据中的读写地址对应都为1、2、3以及4。此时对目标源卷V创建快照卷S1。Please refer to FIG. 3 , which is a state diagram of the target source volume V at time T in an embodiment. As shown in FIG. 3 , the state diagram of the target source volume V at time T includes a
一种实施例中,在对目标源卷创建快照卷S1之后,快照卷S1以及目标源卷的状态图如图4所示(此时目标源卷为新的源卷V1)。如图4所示,在对目标源卷创建快照卷S1之后,快照卷S1以及目标源卷的状态图中包括快照卷43以及新的源卷47,其中,快照卷43为上述的快照卷S1,新的源卷47为上述的V1。在快照卷S1中包括写地址41、读地址42以及各数据块44。其中,写地址41包括1、2、3以及4,读地址42也包括1、2、3以及4。新的源卷47中包括写地址45以及读地址46,其中,写地址45被分配为新的地址5、6、7以及8。读地址46包括1、2、3以及4。从图4中可知,对新的源卷的读还是从快照卷S1的地址1、2、3以及4中读取数据。本申请中,创建快照卷S1时,目标源卷V重定向到新的源卷V1,新的源卷V1的读地址为原来目标源卷V的读地址1、2、3以及4,新的源卷V1的写地址更新为新的写地址5、6、7以及8。快照卷S1指向原来的目标源卷V,快照卷的读写地址都为原来的目标源卷的读写地址1、2、3以及4。In one embodiment, after the snapshot volume S1 is created for the target source volume, the state diagram of the snapshot volume S1 and the target source volume is shown in FIG. 4 (the target source volume is the new source volume V1 at this time). As shown in FIG. 4, after the snapshot volume S1 is created for the target source volume, the state diagram of the snapshot volume S1 and the target source volume includes a
进一步地,创建快照卷S1后,对目标源卷V的读即变成对新的源卷V1的读,会根据读地址1、2、3以及4从快照卷S1中读取;对目标源卷V的写即变成对新的源卷V1的写,会根据新的写地址直接写到新的地址5、6、7以及8,同时在目标缓存中更新对应数据块的读地址。Further, after the snapshot volume S1 is created, the reading of the target source volume V becomes the reading of the new source volume V1, which will be read from the snapshot volume S1 according to the read addresses 1, 2, 3 and 4; The writing of volume V becomes the writing to the new source volume V1, which will directly write to the
具体的,假设对新的源卷V1的第1个数据块写入A1时,快照卷S1和新的源卷状态如图5所示。如图5所示,对新的源卷V1的第1个数据块写入A1时,快照卷S1和新的源卷状态图中包括快照卷53以及新的源卷57,其中,快照卷53相当于快照卷S1,新的源卷47相当于新的源卷V1。在快照卷S1中包括写地址51、读地址52以及各数据块54。其中,写地址51包括1、2、3以及4,读地址52也包括1、2、3以及4。新的源卷V1中包括写地址55、读地址56以及各数据块58,其中,写地址55被分配为新的地址5、6、7以及8。读地址56包括5、2、3以及4,其中,读地址5是更新后的地址。从图4中可知,新的源卷中对于未更新的读地址2、3以及4需要读取数据时,还是从快照卷S1的地址2、3以及4中读取数据。Specifically, it is assumed that when A1 is written to the first data block of the new source volume V1, the status of the snapshot volume S1 and the new source volume is shown in FIG. 5 . As shown in Figure 5, when A1 is written to the first data block of the new source volume V1, the snapshot volume S1 and the new source volume state diagram include the
本申请中,新的源卷根据写地址5将数据A1写入第1个数据块,同时在缓存中更新第1个数据块的读地址为5。进一步,通过异步方式将更新后的写地址5同步到对应数据块读地址中。In this application, the new source volume writes the data A1 into the first data block according to the
此过程可保证对源卷的写只涉及一次数据的写和一次缓存中卷元数据读地址的更新,减少源卷写性能损耗。同时,随着源卷数据的不断更新写入,源卷的数据也不会出现ROW快照实现方式中源卷数据写时导致的离散情况,进而不会出现读性能降低的问题。即对于新的源卷而言,新数据每次写入都会更新新的源卷的对应数据块的读地址,之后再从新的源卷读数据,就从新的源卷自身读取了,就不需要去快照卷读取了,所以逐渐都从新的源卷本身读取数据,就逐渐不存在一部分数据从新的源卷读取,一部分数据从快照卷读取的离散情况了。This process ensures that writing to the source volume involves only one data write and one update of the read address of the volume metadata in the cache, reducing the write performance loss of the source volume. At the same time, as the data of the source volume is continuously updated and written, the data of the source volume will not have the discrete situation caused when the data of the source volume is written in the ROW snapshot implementation, and thus the problem of reduced read performance will not occur. That is to say, for the new source volume, each time new data is written, the read address of the corresponding data block of the new source volume will be updated, and then the data will be read from the new source volume, and the data will be read from the new source volume itself. It is necessary to read from the snapshot volume, so data is gradually read from the new source volume itself, and there is gradually no discrete situation in which part of the data is read from the new source volume and part of the data is read from the snapshot volume.
在其中一个实施例中,如图6所示,上述的方法还可以包括:In one embodiment, as shown in FIG. 6 , the above method may further include:
S61、将快照卷重定向至目标源卷;S61. Redirect the snapshot volume to the target source volume;
S62、接收快照卷的读数据指令;S62. Receive a data read command from the snapshot volume;
S63、根据快照卷的读数据指令从目标源卷的读地址中读取目标时刻对应的数据;S63, read the data corresponding to the target moment from the read address of the target source volume according to the read data instruction of the snapshot volume;
S64、接收快照卷的写数据指令;S64. Receive a data write instruction of the snapshot volume;
S65、将快照卷的写数据指令中的待写入数据写入目标源卷的写地址中。S65: Write the data to be written in the data write instruction of the snapshot volume into the write address of the target source volume.
本申请中,在创建快照卷时,将快照卷重定向至目标源卷,具体的,通过将快照卷的卷名设定为目标源卷的卷名,这样候选再根据卷名查找快照卷时,会找到目标源卷。进一步地,将快照卷的读地址分配为目标源卷的读地址,将快照卷的写地址分配为目标源卷的写地址。In the present application, when a snapshot volume is created, the snapshot volume is redirected to the target source volume. Specifically, the volume name of the snapshot volume is set as the volume name of the target source volume, so that when the candidate searches for the snapshot volume according to the volume name , the target source volume will be found. Further, the read address of the snapshot volume is assigned as the read address of the target source volume, and the write address of the snapshot volume is assigned as the write address of the target source volume.
当接收到对快照卷的读数据指令以及写地址指令时,会根据目标源卷的读地址读取数据以及根据目标源卷的写地址写入数据。When receiving a data read command and a write address command to the snapshot volume, data will be read according to the read address of the target source volume and data will be written according to the write address of the target source volume.
本申请中,从整个卷的角度进行重定向,以卷为重定向的单元,相比于传统的技术中的以数据块为单元进行写时复制或写时重定向,减少了写次数,提高了写性能。In this application, redirection is performed from the perspective of the entire volume, and the volume is used as the redirection unit. Compared with the traditional technology of performing copy-on-write or write-once redirection with a data block as a unit, the number of writes is reduced and the number of writes is improved. write performance.
在其中一个实施例中,如图7所示,上述的方法还可以包括:In one embodiment, as shown in FIG. 7 , the above method may further include:
S71、当接收到对目标源卷创建多个时刻对应的快照卷的指令时,为目标源卷创建多个时刻对应的快照卷;S71, when receiving the instruction to create snapshot volumes corresponding to multiple moments to the target source volume, create snapshot volumes corresponding to multiple moments for the target source volume;
S72、根据目标源卷为各快照卷分配对应的标识信息、读地址以及写地址;S72, allocate corresponding identification information, read address and write address to each snapshot volume according to the target source volume;
S73、当接收到对各快照卷中任意一个快照卷的读数据指令时,根据对各快照卷中任意一个快照卷的读数据指令中的目标标识从对应的快照卷的对应的读地址中读取对应的数据;S73, when receiving a data read instruction to any one of the snapshot volumes, read from the corresponding read address of the corresponding snapshot volume according to the target identifier in the read data instruction to any one of the snapshot volumes Get the corresponding data;
S74、当接收到对各快照卷中任意一个快照卷的写数据指令时,根据对各快照卷中任意一个快照卷的写数据指令中的目标标识向对应快照卷的对应写地址写入对应的数据。S74. When receiving a data write instruction to any snapshot volume in each snapshot volume, write the corresponding write address to the corresponding write address of the corresponding snapshot volume according to the target identifier in the data write instruction to any snapshot volume in each snapshot volume. data.
本申请中,当需要对目标源卷创建多个时刻对应的快照卷时,为各快照卷分配标识信息,具体的,本申请在创建多个快照卷时,记录各快照卷的创建时刻、各快照卷的标识信息以及各快照卷的读地址以及写地址。当接收到任意一个快照卷的读数据指令时,提取该任意一个快照卷的读数据指令中的快照卷的标识信息或者对应的创建时刻,根据该任意一个快照卷的读数据指令中的快照卷的标识信息或者对应的创建时刻找到对应的快照卷,进一步根据需要读取数据的读地址,从找到的快照卷中读取对应的数据。In this application, when snapshot volumes corresponding to multiple times need to be created for the target source volume, identification information is allocated to each snapshot volume. The identification information of the snapshot volume and the read address and write address of each snapshot volume. When receiving a data read command of any snapshot volume, extract the identification information of the snapshot volume or the corresponding creation time in the read data command of any snapshot volume, according to the snapshot volume in the read data command of any snapshot volume Find the corresponding snapshot volume according to the identification information or the corresponding creation time, further read the read address of the data as needed, and read the corresponding data from the found snapshot volume.
当接收到任意一个快照卷的写数据指令时,提取该任意一个快照卷的写数据指令中的快照卷的标识信息或者对应的创建时刻,根据该任意一个快照卷的写数据指令中的快照卷的标识信息或者对应的创建时刻找到对应的快照卷,进一步根据需要写入数据的写地址,从找到的快照卷中写入对应的数据。When receiving a data write command for any snapshot volume, extract the identification information of the snapshot volume or the corresponding creation time in the data write command for any snapshot volume, and extract the snapshot volume in the data write command for any snapshot volume according to the snapshot volume. Find the corresponding snapshot volume according to the identification information or the corresponding creation time, and further write the write address of the data according to the need, and write the corresponding data from the found snapshot volume.
本申请支持创建多个快照卷的情况,当创建多个快照卷时,同样可以找到不同时刻对应的快照卷中的数据,提升方案的灵活性以及适用范围。This application supports the creation of multiple snapshot volumes. When multiple snapshot volumes are created, data in the snapshot volumes corresponding to different moments can also be found, which improves the flexibility and application scope of the solution.
在其中一个实施例中,上述的方法还可以包括:In one embodiment, the above-mentioned method may further include:
将目标数据块更新后的读地址异步更新至新的源卷。Asynchronously update the updated read address of the target data block to the new source volume.
本申请中,上述的目标源卷以及新的源卷可以理解为电脑的磁盘,目标源卷以及新的源卷的读写可以理解为磁盘的读写。本申请中,将目标数据块的读地址在目标缓存中异步更新为新的写地址之后,将更新后的读地址也通过异步方式更新至目标源卷重定向之后的磁盘,也即上述的新的源卷,以便后续从重定向后的磁盘中读取数据。In this application, the above-mentioned target source volume and new source volume can be understood as the disk of the computer, and the read and write of the target source volume and the new source volume can be understood as the read and write of the disk. In the present application, after asynchronously updating the read address of the target data block to a new write address in the target cache, the updated read address is also asynchronously updated to the disk after the target source volume is redirected, that is, the above-mentioned new source volume for subsequent reads from the redirected disk.
在其中一个实施例中,上述的将目标源卷重定向至新的源卷,可以包括:In one embodiment, the above-mentioned redirecting the target source volume to the new source volume may include:
将目标源卷的卷名修改为新的源卷的卷名,以将目标源卷重定向至新的源卷。Modify the volume name of the target source volume to the volume name of the new source volume to redirect the target source volume to the new source volume.
本申请中,创建快照卷时,将目标源卷重定向到新卷生成新的源卷,将快照卷指向原来的目标源卷,同时卷读写时对卷元数据进行更新以及加载等处理。源卷读写时加载源卷元数据(包含读地址和写地址,数据写入时直接写到新的写地址,同时更新数据读地址为新的写地址,提高数据写性能。快照卷指向目标源卷,快照卷的读地址和写地址都为目标源卷的读地址和写地址。In this application, when creating a snapshot volume, the target source volume is redirected to a new volume to generate a new source volume, the snapshot volume is pointed to the original target source volume, and the volume metadata is updated and loaded when the volume is read and written. When the source volume is read and written, the source volume metadata (including the read address and write address is loaded. When the data is written, it is directly written to the new write address, and the data read address is updated to the new write address to improve the data write performance. The snapshot volume points to the target The read and write addresses of the source volume and the snapshot volume are the read and write addresses of the target source volume.
具体地,本申请中的重定向即重新指向,通过修改卷元数据改变卷名,后续再根据卷名查找卷时,会找到新的源卷,原来的目标源卷由于也被重定向修改了卷名,变成了快照卷,以书类比卷举例,可以理解为重定向只是更改了书的名称(即卷名),而书的内容(卷的内容)没有改变。Specifically, the redirection in this application refers to redirection. The volume name is changed by modifying the volume metadata. When the volume is searched according to the volume name, a new source volume will be found, and the original target source volume has also been redirected and modified. The volume name has become a snapshot volume. Taking the book analogy as an example, it can be understood that the redirection only changes the name of the book (ie, the volume name), but the content of the book (the content of the volume) does not change.
本申请通过该实施方式,可以以整个卷为粒度进行重定向,与传统的以数据块为粒度进行重定向的方式不同,而本申请这种在整个卷的角度进行重定向的方式使得后续对卷的写性能有所提升。Through this embodiment, the present application can redirect the entire volume as the granularity, which is different from the traditional redirection method by the data block as the granularity. Volume write performance has improved.
在一个实施例中,如图8所示,提供了一种快照过程中向源卷写数据的装置,包括:接收模块11、重定向模块12、分配模块13和写入模块14,其中:In one embodiment, as shown in FIG. 8 , an apparatus for writing data to a source volume during a snapshot process is provided, including: a receiving
接收模块11,用于接收对目标源卷的目标时刻创建快照卷的指令;A receiving
重定向模块12,用于将目标源卷重定向至新的源卷;A
分配模块13,用于为新的源卷的各数据块分配新的写地址;an
写入模块14,用于在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。The
在其中一个实施例中,上述的装置还包括第一读取模块(图未示),该第一读取模块可以在目标缓存中预加载新的源卷在目标时刻各数据块的读地址以及写地址,新的源卷在目标时刻各数据块的读地址为目标源卷在目标时刻各数据块的读地址,新的源卷各数据块的写地址为新的写地址,接收新的源卷的读数据指令,从目标缓存中新的源卷的读地址中读取对应的数据。In one of the embodiments, the above-mentioned apparatus further includes a first reading module (not shown in the figure), and the first reading module can preload in the target cache the read addresses of each data block of the new source volume at the target moment and Write address, the read address of each data block of the new source volume at the target time is the read address of each data block of the target source volume at the target time, the write address of each data block of the new source volume is the new write address, receive a new source The read data command of the volume reads the corresponding data from the read address of the new source volume in the target cache.
在其中一个实施例中,上述的装置还包括第一更新模块(图未示),该第一更新模块可以当待写入数据写入目标数据块之后,在目标缓存中将新的源卷的目标数据块的读地址异步更新为新的写地址。In one embodiment, the above-mentioned apparatus further includes a first update module (not shown in the figure), and the first update module can update the new source volume in the target cache after the data to be written is written into the target data block. The read address of the target data block is asynchronously updated to the new write address.
在其中一个实施例中,上述的装置还包括第二读取模块(图未示),该第二读取模块可以将快照卷重定向至目标源卷,接收快照卷的读数据指令,根据快照卷的读数据指令从目标源卷的读地址中读取目标时刻对应的数据,接收快照卷的写数据指令,将快照卷的写数据指令中的待写入数据写入目标源卷的写地址中。In one embodiment, the above-mentioned apparatus further includes a second reading module (not shown in the figure), the second reading module can redirect the snapshot volume to the target source volume, receive a data read instruction of the snapshot volume, and according to the snapshot The read data command of the volume reads the data corresponding to the target time from the read address of the target source volume, receives the write data command of the snapshot volume, and writes the data to be written in the write data command of the snapshot volume to the write address of the target source volume middle.
在其中一个实施例中,上述的装置还包括创建模块(图未示),该创建模块可以当接收到对目标源卷创建多个时刻对应的快照卷的指令时,为目标源卷创建多个时刻对应的快照卷,根据目标源卷为各快照卷分配对应的标识信息、读地址以及写地址,当接收到对各快照卷中任意一个快照卷的读数据指令时,根据对各快照卷中任意一个快照卷的读数据指令中的目标标识从对应的快照卷的对应的读地址中读取对应的数据,当接收到对各快照卷中任意一个快照卷的写数据指令时,根据对各快照卷中任意一个快照卷的写数据指令中的目标标识向对应快照卷的对应写地址写入对应的数据。In one embodiment, the above-mentioned apparatus further includes a creation module (not shown in the figure), and the creation module can create multiple snapshot volumes for the target source volume when receiving an instruction to create snapshot volumes corresponding to multiple times for the target source volume For the snapshot volume corresponding to the time, assign the corresponding identification information, read address and write address to each snapshot volume according to the target source volume. The target identifier in the read data instruction of any snapshot volume reads the corresponding data from the corresponding read address of the corresponding snapshot volume. The target identifier in the data write instruction of any snapshot volume in the snapshot volume writes corresponding data to the corresponding write address of the corresponding snapshot volume.
在其中一个实施例中,上述的装置还包括第二更新模块(图未示),该第二更新模块可以将目标数据块更新后的读地址异步更新至新的源卷。In one embodiment, the above-mentioned apparatus further includes a second update module (not shown in the figure), the second update module can asynchronously update the updated read address of the target data block to the new source volume.
在其中一个实施例中,上述的重定向模块12可以将目标源卷的卷名修改为新的源卷的卷名,以将目标源卷重定向至新的源卷。In one embodiment, the
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:接收对目标源卷的目标时刻创建快照卷的指令;将目标源卷重定向至新的源卷;为新的源卷的各数据块分配新的写地址;In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the computer program to implement the following steps: receiving a response to a target source volume The instruction to create a snapshot volume at the target moment; redirect the target source volume to the new source volume; assign a new write address to each data block of the new source volume;
在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。When receiving the data write command of the new source volume, write the data to be written in the data write command of the target source volume into the target data block in the new source volume according to the new write address.
在一个实施例中,处理器执行计算机程序时具体还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
在目标缓存中预加载新的源卷在目标时刻各数据块的读地址以及写地址,新的源卷在目标时刻各数据块的读地址为目标源卷在目标时刻各数据块的读地址,新的源卷各数据块的写地址为新的写地址;Preload the read address and write address of each data block of the new source volume at the target time in the target cache, and the read address of each data block of the new source volume at the target time is the read address of each data block of the target source volume at the target time, The write address of each data block of the new source volume is the new write address;
接收新的源卷的读数据指令,从目标缓存中新的源卷的读地址中读取对应的数据。Receive the read data instruction of the new source volume, and read the corresponding data from the read address of the new source volume in the target cache.
在一个实施例中,处理器执行计算机程序时具体还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
当待写入数据写入目标数据块之后,在目标缓存中将新的源卷的目标数据块的读地址异步更新为新的写地址。After the data to be written is written into the target data block, the read address of the target data block of the new source volume is asynchronously updated to the new write address in the target cache.
在一个实施例中,处理器执行计算机程序时具体还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
将快照卷重定向至目标源卷;redirect the snapshot volume to the target source volume;
接收快照卷的读数据指令;Receive the read data command of the snapshot volume;
根据快照卷的读数据指令从目标源卷的读地址中读取目标时刻对应的数据;Read the data corresponding to the target moment from the read address of the target source volume according to the read data command of the snapshot volume;
接收快照卷的写数据指令;Receive the write data command of the snapshot volume;
将快照卷的写数据指令中的待写入数据写入目标源卷的写地址中。Write the data to be written in the data write command of the snapshot volume to the write address of the target source volume.
在一个实施例中,处理器执行计算机程序时具体还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
当接收到对目标源卷创建多个时刻对应的快照卷的指令时,为目标源卷创建多个时刻对应的快照卷;When receiving an instruction to create snapshot volumes corresponding to multiple times for the target source volume, create snapshot volumes corresponding to multiple times for the target source volume;
根据目标源卷为各快照卷分配对应的标识信息、读地址以及写地址;Assign corresponding identification information, read address and write address to each snapshot volume according to the target source volume;
当接收到对各快照卷中任意一个快照卷的读数据指令时,根据对各快照卷中任意一个快照卷的读数据指令中的目标标识从对应的快照卷的对应的读地址中读取对应的数据;When receiving a data read command for any snapshot volume among the snapshot volumes, read the corresponding read address from the corresponding read address of the snapshot volume according to the target identifier in the read data command for any snapshot volume among the snapshot volumes The data;
当接收到对各快照卷中任意一个快照卷的写数据指令时,根据对各快照卷中任意一个快照卷的写数据指令中的目标标识向对应快照卷的对应写地址写入对应的数据。When receiving a data write command to any one of the snapshot volumes, write the corresponding data to the corresponding write address of the corresponding snapshot volume according to the target identifier in the data write command to any one of the snapshot volumes.
在一个实施例中,处理器执行计算机程序时具体还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
将目标数据块更新后的读地址异步更新至新的源卷。Asynchronously update the updated read address of the target data block to the new source volume.
在一个实施例中,处理器执行计算机程序实现上述的将目标源卷重定向至新的源卷步骤时,具体实现以下步骤:In one embodiment, when the processor executes the computer program to implement the above-mentioned steps of redirecting the target source volume to the new source volume, the following steps are specifically implemented:
将目标源卷的卷名修改为新的源卷的卷名,以将目标源卷重定向至新的源卷。Modify the volume name of the target source volume to the volume name of the new source volume to redirect the target source volume to the new source volume.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:接收对目标源卷的目标时刻创建快照卷的指令;将目标源卷重定向至新的源卷;为新的源卷的各数据块分配新的写地址;在接收到新的源卷的写数据指令时,根据新的写地址将目标源卷的写数据指令中的待写入数据写入新的源卷中的目标数据块。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: receiving an instruction to create a snapshot volume at a target moment of a target source volume; The source volume is redirected to the new source volume; a new write address is allocated to each data block of the new source volume; when the write data command of the new source volume is received, the write data of the target source volume is written according to the new write address. The data to be written in the instruction is written to the target data block in the new source volume.
在一个实施例中,计算机程序被处理器执行时具体还实现以下步骤:In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
在目标缓存中预加载新的源卷在目标时刻各数据块的读地址以及写地址,新的源卷在目标时刻各数据块的读地址为目标源卷在目标时刻各数据块的读地址,新的源卷各数据块的写地址为新的写地址;Preload the read address and write address of each data block of the new source volume at the target time in the target cache, and the read address of each data block of the new source volume at the target time is the read address of each data block of the target source volume at the target time, The write address of each data block of the new source volume is the new write address;
接收新的源卷的读数据指令,从目标缓存中新的源卷的读地址中读取对应的数据。Receive the read data instruction of the new source volume, and read the corresponding data from the read address of the new source volume in the target cache.
在一个实施例中,计算机程序被处理器执行时具体还实现以下步骤:In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
当待写入数据写入目标数据块之后,在目标缓存中将新的源卷的目标数据块的读地址异步更新为新的写地址。After the data to be written is written into the target data block, the read address of the target data block of the new source volume is asynchronously updated to the new write address in the target cache.
在一个实施例中,计算机程序被处理器执行时具体还实现以下步骤:In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
将快照卷重定向至目标源卷;redirect the snapshot volume to the target source volume;
接收快照卷的读数据指令;Receive the read data command of the snapshot volume;
根据快照卷的读数据指令从目标源卷的读地址中读取目标时刻对应的数据;Read the data corresponding to the target moment from the read address of the target source volume according to the read data command of the snapshot volume;
接收快照卷的写数据指令;Receive the write data command of the snapshot volume;
将快照卷的写数据指令中的待写入数据写入目标源卷的写地址中。Write the data to be written in the data write command of the snapshot volume to the write address of the target source volume.
在一个实施例中,计算机程序被处理器执行时具体还实现以下步骤:In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
当接收到对目标源卷创建多个时刻对应的快照卷的指令时,为目标源卷创建多个时刻对应的快照卷;When receiving an instruction to create snapshot volumes corresponding to multiple times for the target source volume, create snapshot volumes corresponding to multiple times for the target source volume;
根据目标源卷为各快照卷分配对应的标识信息、读地址以及写地址;Assign corresponding identification information, read address and write address to each snapshot volume according to the target source volume;
当接收到对各快照卷中任意一个快照卷的读数据指令时,根据对各快照卷中任意一个快照卷的读数据指令中的目标标识从对应的快照卷的对应的读地址中读取对应的数据;When receiving a data read command for any snapshot volume among the snapshot volumes, read the corresponding read address from the corresponding read address of the snapshot volume according to the target identifier in the read data command for any snapshot volume among the snapshot volumes The data;
当接收到对各快照卷中任意一个快照卷的写数据指令时,根据对各快照卷中任意一个快照卷的写数据指令中的目标标识向对应快照卷的对应写地址写入对应的数据。When receiving a data write command to any one of the snapshot volumes, write the corresponding data to the corresponding write address of the corresponding snapshot volume according to the target identifier in the data write command to any one of the snapshot volumes.
在一个实施例中,计算机程序被处理器执行时具体还实现以下步骤:In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
将目标数据块更新后的读地址异步更新至新的源卷。Asynchronously update the updated read address of the target data block to the new source volume.
在一个实施例中,计算机程序被处理器执行实现上述的将目标源卷重定向至新的源卷步骤时,具体实现以下步骤:In one embodiment, when the computer program is executed by the processor to implement the above-mentioned steps of redirecting the target source volume to the new source volume, the following steps are specifically implemented:
将目标源卷的卷名修改为新的源卷的卷名,以将目标源卷重定向至新的源卷。Modify the volume name of the target source volume to the volume name of the new source volume to redirect the target source volume to the new source volume.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those skilled in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium , when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above examples only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the invention patent. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210140622.9A CN114564148A (en) | 2022-02-16 | 2022-02-16 | Method, device, equipment and storage medium for writing data to source volume in snapshot process |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210140622.9A CN114564148A (en) | 2022-02-16 | 2022-02-16 | Method, device, equipment and storage medium for writing data to source volume in snapshot process |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114564148A true CN114564148A (en) | 2022-05-31 |
Family
ID=81714143
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210140622.9A Withdrawn CN114564148A (en) | 2022-02-16 | 2022-02-16 | Method, device, equipment and storage medium for writing data to source volume in snapshot process |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114564148A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118672516A (en) * | 2024-08-21 | 2024-09-20 | 苏州元脑智能科技有限公司 | Data storage method, device, storage medium and computer program product |
-
2022
- 2022-02-16 CN CN202210140622.9A patent/CN114564148A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118672516A (en) * | 2024-08-21 | 2024-09-20 | 苏州元脑智能科技有限公司 | Data storage method, device, storage medium and computer program product |
CN118672516B (en) * | 2024-08-21 | 2024-11-12 | 苏州元脑智能科技有限公司 | Data storage method, device, storage medium and computer program product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7650458B2 (en) | Flash memory driver | |
JP6629407B2 (en) | Method and system for accessing updated files and software products | |
CN110377599B (en) | Key value storage device and operation method thereof | |
CN108733306B (en) | A file merging method and device | |
CN106557427B (en) | Memory management method and device for shared memory database | |
US11023374B2 (en) | Apparatus and method and computer program product for controlling data access | |
CN111158858B (en) | Cloning method and device of virtual machine and computer readable storage medium | |
CN111782656B (en) | Data reading and writing method and device | |
WO2021082720A1 (en) | Data processing method and apparatus | |
US20250077122A1 (en) | File system improvements for zoned storage device operations | |
WO2023071043A1 (en) | File aggregation compatibility method and apparatus, computer device and storage medium | |
JP2022517481A (en) | Methods, systems and programs for migrating data from large extent pools to small extent pools | |
CN110312986B (en) | Opportunistic use of streams for storing data on solid state devices | |
CN114564148A (en) | Method, device, equipment and storage medium for writing data to source volume in snapshot process | |
CN118069071B (en) | Resource access control method, device, computer equipment and storage medium | |
WO2024245175A1 (en) | Memory reclamation method and apparatus, electronic device, and storage medium | |
KR102554418B1 (en) | Memory controller and storage device including the same | |
CN112988610B (en) | Memory recycling processing method, device, computer equipment and storage medium | |
CN112632080B (en) | Data storage method, device and equipment based on block chain | |
CN114896335A (en) | Data dump method and system for database | |
JP6089855B2 (en) | Virtualization system, virtual server, file writing method, and file writing program | |
CN111158609B (en) | Data storage method and device, computer equipment and storage medium | |
CN111625265A (en) | Method and device for reducing DRAM space consumption in firmware upgrade | |
US20250021475A1 (en) | Methods of operating memory system and memory systems | |
TWI852615B (en) | Method for performing garbage collection management of memory device with aid of dedicated information control, memory controller, memory device and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20220531 |
|
WW01 | Invention patent application withdrawn after publication |