[go: up one dir, main page]

CN113986128B - LUN data replication method and device - Google Patents

LUN data replication method and device Download PDF

Info

Publication number
CN113986128B
CN113986128B CN202111250149.1A CN202111250149A CN113986128B CN 113986128 B CN113986128 B CN 113986128B CN 202111250149 A CN202111250149 A CN 202111250149A CN 113986128 B CN113986128 B CN 113986128B
Authority
CN
China
Prior art keywords
data
buffer
data record
lun
written
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111250149.1A
Other languages
Chinese (zh)
Other versions
CN113986128A (en
Inventor
上官应兰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Macrosan Technologies Co Ltd
Original Assignee
Macrosan Technologies Co Ltd
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 Macrosan Technologies Co Ltd filed Critical Macrosan Technologies Co Ltd
Priority to CN202111250149.1A priority Critical patent/CN113986128B/en
Publication of CN113986128A publication Critical patent/CN113986128A/en
Application granted granted Critical
Publication of CN113986128B publication Critical patent/CN113986128B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage 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 application provides a LUN data copying method and device, which are applied to storage equipment. The storage device comprises a source LUN corresponding to a buffer zone, wherein the buffer zone is used for storing data records of data to be copied in the source LUN and partial data to be copied, and the data records comprise corresponding logical address segments of the data to be copied in the source LUN and storage positions of the data to be copied in the buffer zone. For each data record in the buffer zone, if the storage position included in the data record is empty, indicating that the data record corresponds to the data to be copied and is located in the source LUN, copying the corresponding data from the source LUN to the target LUN; if the data record includes a storage location that is not empty, indicating that the data record corresponds to the data to be copied in the buffer, copying the corresponding data from the buffer to the target LUN. The application can effectively reduce the data loss under abnormal conditions and effectively improve the utilization rate of the buffer area.

Description

LUN数据复制方法及装置LUN data replication method and device

技术领域Technical Field

本申请涉及存储技术领域,尤其涉及一种LUN数据复制方法及装置。The present application relates to the field of storage technology, and in particular to a LUN data replication method and device.

背景技术Background technique

存储设备普遍具有数据保护特性,其中,数据复制作为一种可实现数据保护的技术,已广泛应用于存储设备。Storage devices generally have data protection features, among which data replication, as a technology that can achieve data protection, has been widely used in storage devices.

目前,针对存储设备中逻辑单元号(英文:Logical Unit Number,缩写:LUN)的数据复制,主要采用周期性复制方式,即,每隔预设复制周期(比如,1小时)将源LUN中新写入数据复制到目标LUN中。这里,将存储设备中待复制的LUN称为源LUN;将用于备份(复制)该源LUN中数据的LUN称为目标LUN。At present, for data replication of logical unit numbers (English: Logical Unit Number, abbreviated: LUN) in storage devices, a periodic replication method is mainly used, that is, the newly written data in the source LUN is copied to the target LUN every preset replication period (for example, 1 hour). Here, the LUN to be copied in the storage device is called the source LUN; the LUN used to back up (copy) the data in the source LUN is called the target LUN.

如果在使用过程中源LUN故障,则此时目标LUN仅保存有上一次复制开始时刻源LUN中的数据,导致自上一次复制之后新写入源LUN的数据丢失。且复制周期越长,丢失的数据越多。If the source LUN fails during use, the target LUN will only store the data in the source LUN at the start of the last replication, resulting in the loss of data newly written to the source LUN since the last replication. The longer the replication cycle, the more data will be lost.

发明内容Summary of the invention

有鉴于此,本申请提出一种LUN数据复制方法及装置,用以尽量减少数据丢失。In view of this, the present application proposes a LUN data replication method and device to minimize data loss.

为实现上述申请目的,本申请提供了如下技术方案:In order to achieve the above application purpose, this application provides the following technical solutions:

第一方面,本申请提供一种LUN数据复制方法,应用于存储设备,所述存储设备包括待复制的源LUN,所述源LUN对应有缓冲区,所述缓冲区用于存储所述源LUN中待复制数据的数据记录以及部分待复制数据,所述数据记录包括待复制数据在所述源LUN中对应逻辑地址段以及该待复制数据在所述缓冲区中的存储位置,所述源LUN还对应有用于复制该源LUN对应数据的目标LUN,所述方法包括:In a first aspect, the present application provides a LUN data replication method, which is applied to a storage device, wherein the storage device includes a source LUN to be replicated, the source LUN corresponds to a buffer zone, the buffer zone is used to store data records of the data to be replicated in the source LUN and part of the data to be replicated, the data records include a logical address segment corresponding to the data to be replicated in the source LUN and a storage position of the data to be replicated in the buffer zone, the source LUN also corresponds to a target LUN for replicating the data corresponding to the source LUN, and the method includes:

按照数据记录写入顺序,依次遍历所述缓冲区中各数据记录,针对每一个数据记录执行如下复制操作:According to the order in which the data records are written, the data records in the buffer are traversed in sequence, and the following copy operation is performed for each data record:

如果该数据记录包括的存储位置为空,获取该数据记录包括的逻辑地址段,将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN;If the storage location included in the data record is empty, obtaining the logical address segment included in the data record, and copying the data corresponding to the logical address segment in the source LUN to the target LUN;

如果该数据记录包括的存储位置不为空,将所述缓冲区中该存储位置对应数据复制到所述目标LUN。If the storage location included in the data record is not empty, the data corresponding to the storage location in the buffer is copied to the target LUN.

可选的,所述将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN之后,所述方法还包括:Optionally, after copying the data corresponding to the logical address segment in the source LUN to the target LUN, the method further includes:

删除该数据记录;Delete the data record;

所述将所述缓冲区中该存储位置对应数据复制到所述目标LUN之后,所述方法还包括:After copying the data corresponding to the storage location in the buffer to the target LUN, the method further includes:

删除所述缓冲区中该存储位置对应数据;Deleting the data corresponding to the storage position in the buffer;

删除该数据记录。Delete the data record.

可选的,所述遍历所述缓冲区中各数据记录之前,所述方法还包括:Optionally, before traversing each data record in the buffer, the method further includes:

接收针对所述源LUN的写命令,该写命令包括待写入地址段以及待写入数据;Receiving a write command for the source LUN, the write command including an address segment to be written and data to be written;

遍历所述缓冲区中已有数据记录,针对每一个数据记录执行如下维护操作:Traverse the existing data records in the buffer and perform the following maintenance operations for each data record:

如果该数据记录包括的存储位置不为空,结束对该数据记录的维护;If the storage location included in the data record is not empty, end the maintenance of the data record;

如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段不存在交集,结束对该数据记录的维护;If the storage location included in the data record is empty, and the logical address segment included in the data record does not have an intersection with the address segment to be written, the maintenance of the data record is terminated;

如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段存在交集,从所述源LUN中读出该逻辑地址段对应数据写入所述缓冲区,并更新该数据记录包括的存储位置为该逻辑地址段对应数据在所述缓冲区中的存储位置;If the storage location included in the data record is empty, and the logical address segment included in the data record has an intersection with the address segment to be written, read the data corresponding to the logical address segment from the source LUN and write it into the buffer, and update the storage location included in the data record to the storage location of the data corresponding to the logical address segment in the buffer;

在完成对已有数据记录的维护后,将所述待写入数据写入所述源LUN中所述待写入地址段;After completing the maintenance of the existing data records, writing the data to be written into the address segment to be written in the source LUN;

在所述缓冲区中增加新的数据记录,所述新的数据记录包括的逻辑地址段为所述待写入地址段,所述新的数据记录包括的存储位置为空。A new data record is added to the buffer, wherein the logical address segment included in the new data record is the address segment to be written, and the storage location included in the new data record is empty.

可选的,所述源LUN按照预设逻辑块大小划分为多个逻辑块,所述源LUN还对应有差异位图,所述差异位图包括与各逻辑块分别对应的差异位,所述差异位的值用于标识该差异位对应逻辑块是否写入待复制数据,所述方法还包括:Optionally, the source LUN is divided into a plurality of logical blocks according to a preset logical block size, the source LUN further corresponds to a difference bitmap, the difference bitmap includes a difference bit corresponding to each logical block, and the value of the difference bit is used to identify whether the logical block corresponding to the difference bit is written with the data to be copied, and the method further includes:

如果所述缓冲区被写满,停止依据所述缓冲区中数据记录复制数据,并停止维护所述缓冲区中数据记录;If the buffer is full, stop copying data according to the data records in the buffer, and stop maintaining the data records in the buffer;

如果接收到针对所述源LUN的写命令,确定该写命令涉及到的至少一个待写入逻辑块,并向各待写入逻辑块中写入该写命令携带的待写入数据;If a write command for the source LUN is received, determining at least one to-be-written logical block involved in the write command, and writing the to-be-written data carried by the write command into each to-be-written logical block;

更新所述差异位图中各待写入逻辑块对应的差异位的值为目标值,所述目标值用于标识逻辑块中已写入待复制数据;Updating the difference bit value corresponding to each to-be-written logical block in the difference bitmap to a target value, where the target value is used to identify the to-be-copied data that has been written into the logical block;

遍历所述缓冲区中各数据记录,针对每一个数据记录执行如下更新操作:Traverse each data record in the buffer and perform the following update operation for each data record:

确定该数据记录包括的逻辑地址段所涉及的至少一个目标逻辑块;Determine at least one target logical block involved in the logical address segment included in the data record;

更新所述差异位图中各目标逻辑块对应的差异位的值为所述目标值;Update the value of the difference bit corresponding to each target logic block in the difference bitmap to the target value;

如果该数据记录包括的存储位置不为空,删除所述缓冲区中该存储位置对应数据;If the storage location included in the data record is not empty, deleting the data corresponding to the storage location in the buffer;

删除该数据记录;Delete the data record;

在完成针对所有数据记录的更新操作后,停止更新所述差异位图,并生成所述源LUN的复制视图,所述复制视图包括所述源LUN中当前时刻的数据;After completing the update operation for all data records, stop updating the difference bitmap, and generate a replication view of the source LUN, where the replication view includes the data at the current moment in the source LUN;

针对所述差异位图中值为目标值的每一个目标差异位,将所述复制视图中该目标差异位对应逻辑块中的数据复制到所述目标LUN。For each target difference bit in the difference bitmap whose value is a target value, data in a logical block corresponding to the target difference bit in the replication view is replicated to the target LUN.

可选的,所述方法还包括:Optionally, the method further includes:

在完成针对所有数据记录的更新操作后,重新启动对所述缓冲区中数据记录的维护;After completing the update operation for all data records, restarting the maintenance of the data records in the buffer;

在完成基于所述差异位图的数据复制后,重新启动基于所述缓冲区中数据记录的数据复制。After completing the data replication based on the difference bitmap, restarting the data replication based on the data records in the buffer.

第二方面,本申请提供一种LUN数据复制装置,应用于存储设备,所述存储设备包括待复制的源LUN,所述源LUN对应有缓冲区,所述缓冲区用于存储所述源LUN中待复制数据的数据记录以及部分待复制数据,所述数据记录包括待复制数据在所述源LUN中对应逻辑地址段以及该待复制数据在所述缓冲区中的存储位置,所述源LUN还对应有用于复制该源LUN对应数据的目标LUN,所述装置包括:In a second aspect, the present application provides a LUN data replication device, which is applied to a storage device, wherein the storage device includes a source LUN to be replicated, the source LUN corresponds to a buffer zone, the buffer zone is used to store data records of the data to be replicated in the source LUN and part of the data to be replicated, the data records include a logical address segment corresponding to the data to be replicated in the source LUN and a storage position of the data to be replicated in the buffer zone, the source LUN also corresponds to a target LUN for replicating the data corresponding to the source LUN, and the device includes:

遍历单元,用于按照数据记录写入顺序,依次遍历所述缓冲区中各数据记录;A traversal unit, used to traverse each data record in the buffer in sequence according to the order in which the data records are written;

复制单元,用于针对每一个数据记录,如果该数据记录包括的存储位置为空,获取该数据记录包括的逻辑地址段,将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN;如果该数据记录包括的存储位置不为空,将所述缓冲区中该存储位置对应数据复制到所述目标LUN。The replication unit is used for obtaining the logical address segment included in each data record if the storage location included in the data record is empty, and copying the data corresponding to the logical address segment in the source LUN to the target LUN; if the storage location included in the data record is not empty, copying the data corresponding to the storage location in the buffer to the target LUN.

可选的,所述复制单元将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN之后,所述装置还包括:Optionally, after the copying unit copies the data corresponding to the logical address segment in the source LUN to the target LUN, the device further includes:

删除单元,用于删除该数据记录;A deletion unit, used to delete the data record;

所述复制单元将所述缓冲区中该存储位置对应数据复制到所述目标LUN之后,所述装置还包括:After the copying unit copies the data corresponding to the storage location in the buffer to the target LUN, the device further includes:

删除单元,用于删除所述缓冲区中该存储位置对应数据;删除该数据记录。The deleting unit is used to delete the data corresponding to the storage position in the buffer; and delete the data record.

可选的,所述遍历单元遍历所述缓冲区中各数据记录之前,所述装置还包括:Optionally, before the traversal unit traverses each data record in the buffer, the device further includes:

接收单元,用于接收针对所述源LUN的写命令,该写命令包括待写入地址段以及待写入数据;A receiving unit, configured to receive a write command for the source LUN, the write command including an address segment to be written and data to be written;

所述遍历单元,用于遍历所述缓冲区中已有数据记录;The traversal unit is used to traverse the existing data records in the buffer;

维护单元,用于针对每一个数据记录,如果该数据记录包括的存储位置不为空,结束对该数据记录的维护;如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段不存在交集,结束对该数据记录的维护;如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段存在交集,从所述源LUN中读出该逻辑地址段对应数据写入所述缓冲区,并更新该数据记录包括的存储位置为该逻辑地址段对应数据在所述缓冲区中的存储位置;A maintenance unit is used for, for each data record, if the storage location included in the data record is not empty, terminating the maintenance of the data record; if the storage location included in the data record is empty, and the logical address segment included in the data record does not have an intersection with the address segment to be written, terminating the maintenance of the data record; if the storage location included in the data record is empty, and the logical address segment included in the data record does have an intersection with the address segment to be written, reading the data corresponding to the logical address segment from the source LUN and writing it into the buffer, and updating the storage location included in the data record to be the storage location of the data corresponding to the logical address segment in the buffer;

写入单元,用于在完成对已有数据记录的维护后,将所述待写入数据写入所述源LUN中所述待写入地址段;A writing unit, configured to write the data to be written into the address segment to be written in the source LUN after completing the maintenance of the existing data record;

所述维护单元,还用于在所述缓冲区中增加新的数据记录,所述新的数据记录包括的逻辑地址段为所述待写入地址段,所述新的数据记录包括的存储位置为空。The maintenance unit is further used to add a new data record in the buffer, wherein the logical address segment included in the new data record is the address segment to be written, and the storage location included in the new data record is empty.

可选的,所述源LUN按照预设逻辑块大小划分为多个逻辑块,所述源LUN还对应有差异位图,所述差异位图包括与各逻辑块分别对应的差异位,所述差异位的值用于标识该差异位对应逻辑块是否写入待复制数据,所述装置还包括:Optionally, the source LUN is divided into a plurality of logical blocks according to a preset logical block size, the source LUN further corresponds to a difference bitmap, the difference bitmap includes a difference bit corresponding to each logical block, and the value of the difference bit is used to identify whether the logical block corresponding to the difference bit is written with the data to be copied, and the device further includes:

停止单元,用于如果所述缓冲区被写满,停止依据所述缓冲区中数据记录复制数据,并停止维护所述缓冲区中数据记录;A stopping unit, configured to stop copying data according to the data records in the buffer and stop maintaining the data records in the buffer if the buffer is full;

确定单元,用于如果接收到针对所述源LUN的写命令,确定该写命令涉及到的至少一个待写入逻辑块,并向各待写入逻辑块中写入该写命令携带的待写入数据;a determination unit, configured to, if receiving a write command for the source LUN, determine at least one to-be-written logical block involved in the write command, and write the to-be-written data carried by the write command into each to-be-written logical block;

更新单元,用于更新所述差异位图中各待写入逻辑块对应的差异位的值为目标值,所述目标值用于标识逻辑块中已写入待复制数据;An updating unit, used for updating the difference bit value corresponding to each to-be-written logical block in the difference bitmap to a target value, wherein the target value is used for identifying the to-be-copied data that has been written into the logical block;

所述遍历单元,用于遍历所述缓冲区中各数据记录;The traversal unit is used to traverse each data record in the buffer;

所述确定单元,还用于针对每一个数据记录,确定该数据记录包括的逻辑地址段所涉及的至少一个目标逻辑块;The determining unit is further configured to determine, for each data record, at least one target logical block involved in a logical address segment included in the data record;

所述更新单元,还用于更新所述差异位图中各目标逻辑块对应的差异位的值为所述目标值;The updating unit is further used to update the value of the difference bit corresponding to each target logic block in the difference bitmap to the target value;

删除单元,用于如果该数据记录包括的存储位置不为空,删除所述缓冲区中该存储位置对应数据;删除该数据记录;A deleting unit, configured to delete the data corresponding to the storage location in the buffer if the storage location included in the data record is not empty; and delete the data record;

生成单元,用于在完成针对所有数据记录的更新操作后,停止更新所述差异位图,并生成所述源LUN的复制视图,所述复制视图包括所述源LUN中当前时刻的数据;A generating unit, configured to stop updating the difference bitmap after completing the update operation for all data records, and generate a replication view of the source LUN, wherein the replication view includes the data at the current moment in the source LUN;

所述复制单元,还用于针对所述差异位图中值为目标值的每一个目标差异位,将所述复制视图中该目标差异位对应逻辑块中的数据复制到所述目标LUN。The replication unit is further configured to replicate, for each target difference bit in the difference bitmap whose value is a target value, data in a logical block corresponding to the target difference bit in the replication view to the target LUN.

可选的,所述装置还包括:Optionally, the device further comprises:

重启单元,用于在完成针对所有数据记录的更新操作后,重新启动对所述缓冲区中数据记录的维护;A restart unit, used to restart the maintenance of the data records in the buffer after completing the update operation on all data records;

所述重启单元,还用于在完成基于所述差异位图的数据复制后,重新启动基于所述缓冲区中数据记录的数据复制。The restart unit is further configured to restart the data replication based on the data records in the buffer after completing the data replication based on the difference bitmap.

由以上描述可以看出,本申请实施例中,存储设备维护有源LUN对应的缓冲区,缓冲区中存储有待复制数据的数据记录以及部分待复制数据。针对缓冲区中的每一个数据记录,如果该数据记录包括的存储位置为空,说明该数据记录对应待复制数据位于源LUN中,则根据该数据记录包括的逻辑地址段从源LUN中复制对应数据到目标LUN;如果该数据记录包括的存储位置不为空,说明该数据记录对应待复制数据位于缓冲区中,则根据该数据记录包括的存储位置从缓冲区中复制对应数据到目标LUN。可以看出,本申请实施例通过不断遍历缓冲区中的数据记录,将各数据记录对应待复制数据按照数据写入顺序复制到目标LUN中,可使目标LUN及时存储源LUN中尽量多的数据,这样既使源LUN故障,已复制到目标LUN的数据是可用的,不会丢失太多数据;此外,由于缓冲区仅保存部分(尽量少的)待复制数据,因此,其空间利用率较高,可存储更多的数据记录,进一步降低数据丢失风险。It can be seen from the above description that in the embodiment of the present application, the storage device maintains a buffer corresponding to the active LUN, and the buffer stores data records of the data to be copied and part of the data to be copied. For each data record in the buffer, if the storage location included in the data record is empty, it means that the data to be copied corresponding to the data record is located in the source LUN, and the corresponding data is copied from the source LUN to the target LUN according to the logical address segment included in the data record; if the storage location included in the data record is not empty, it means that the data to be copied corresponding to the data record is located in the buffer, and the corresponding data is copied from the buffer to the target LUN according to the storage location included in the data record. It can be seen that the embodiment of the present application continuously traverses the data records in the buffer, and copies the data to be copied corresponding to each data record to the target LUN in the order of data writing, so that the target LUN can store as much data as possible in the source LUN in time, so that even if the source LUN fails, the data copied to the target LUN is available, and not too much data will be lost; in addition, since the buffer only stores part (as little as possible) of the data to be copied, its space utilization is high, and more data records can be stored, further reducing the risk of data loss.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

图1是本申请实施例示出的一种LUN数据复制方法流程图;FIG1 is a flow chart of a LUN data replication method shown in an embodiment of the present application;

图2是本申请实施例示出的一种数据记录维护流程;FIG2 is a data record maintenance process shown in an embodiment of the present application;

图3是本申请实施例示出的另一种数据复制流程;FIG3 is another data replication process shown in an embodiment of the present application;

图4是本申请实施例示出的一种LUN数据复制装置的结构示意图。FIG. 4 is a schematic diagram of the structure of a LUN data replication device according to an embodiment of the present application.

具体实施方式Detailed ways

这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

在本申请实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请实施例。在本申请实施例中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and/or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.

应当理解,尽管在本申请实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请实施例范围的情况下,协商信息也可以被称为第二信息,类似地,第二信息也可以被称为协商信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the embodiments of the present application, the negotiation information may also be referred to as the second information, and similarly, the second information may also be referred to as the negotiation information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to determination".

为了使本申请实施例的目的、技术方案和优点更加清楚,下面结合附图和具体实施例对本申请实施例执行详细描述:In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the embodiments of the present application are described in detail below in conjunction with the accompanying drawings and specific embodiments:

参见图1,为本申请实施例示出的一种LUN数据复制方法的流程图。该流程应用于存储设备。Referring to Fig. 1, it is a flow chart of a LUN data replication method shown in an embodiment of the present application. The flow chart is applied to a storage device.

该存储设备包括待复制的源LUN以及该源LUN对应的缓冲区。该缓冲区用于存储源LUN中待复制数据的数据记录以及部分待复制数据,其中,数据记录包括待复制数据在源LUN中对应的逻辑地址段以及该待复制数据在缓冲区中的存储位置。这里,逻辑地址段为待复制数据在源LUN中的存储位置。The storage device includes a source LUN to be copied and a buffer corresponding to the source LUN. The buffer is used to store data records of the data to be copied in the source LUN and part of the data to be copied, wherein the data record includes a logical address segment corresponding to the data to be copied in the source LUN and a storage location of the data to be copied in the buffer. Here, the logical address segment is the storage location of the data to be copied in the source LUN.

此外,源LUN还对应有用于复制该源LUN中数据的目标LUN。该目标LUN可以位于源LUN所在存储设备,也可以位于除源LUN所在存储设备之外的其它存储设备中,以提高数据可用性。In addition, the source LUN also corresponds to a target LUN for copying the data in the source LUN. The target LUN can be located in the storage device where the source LUN is located, or in other storage devices except the storage device where the source LUN is located, so as to improve data availability.

如图1所示,该流程可包括以下步骤:As shown in Figure 1, the process may include the following steps:

步骤101,按照数据记录写入顺序,依次遍历缓冲区中各数据记录。Step 101, traverse the data records in the buffer in sequence according to the order in which the data records are written.

这里,需要说明的是,每一个数据记录对应一次针对源LUN的写操作,因此,数据记录写入顺序即数据写入顺序。Here, it should be noted that each data record corresponds to a write operation on the source LUN, so the writing order of the data records is the data writing order.

本步骤按照数据写入顺序依次遍历各数据记录,以保证数据时序。This step traverses each data record in sequence according to the order in which the data is written to ensure data timing.

针对每一个数据记录执行如下复制操作:For each data record, perform the following copy operations:

步骤102,如果该数据记录包括的存储位置为空,获取该数据记录包括的逻辑地址段,将源LUN中该逻辑地址段对应数据复制到目标LUN。Step 102: If the storage location included in the data record is empty, obtain the logical address segment included in the data record, and copy the data corresponding to the logical address segment in the source LUN to the target LUN.

这里,数据记录包括的存储位置为空,说明该数据记录对应的待复制数据不在缓冲区中,而位于源LUN中,此时,可获取该数据记录包括的逻辑地址段,该逻辑地址段为待复制数据在源LUN中的存储位置,从源LUN中该逻辑地址段获取相应数据复制到目标LUN中。Here, the storage location included in the data record is empty, indicating that the data to be copied corresponding to the data record is not in the buffer but is located in the source LUN. At this time, the logical address segment included in the data record can be obtained. The logical address segment is the storage location of the data to be copied in the source LUN. The corresponding data is obtained from the logical address segment in the source LUN and copied to the target LUN.

步骤103,如果该数据记录包括的存储位置不为空,将缓冲区中该存储位置对应数据复制到目标LUN。Step 103: If the storage location included in the data record is not empty, copy the data corresponding to the storage location in the buffer to the target LUN.

这里,数据记录包括的存储位置不为空,说明该数据记录对应的待复制数据位于缓冲区中,则直接根据该数据记录包括的存储位置,从缓冲区中该存储位置处获取相应数据复制到目标LUN。Here, if the storage location included in the data record is not empty, it means that the data to be copied corresponding to the data record is located in the buffer. Then, directly according to the storage location included in the data record, the corresponding data is obtained from the storage location in the buffer and copied to the target LUN.

至此,完成图1所示流程。At this point, the process shown in Figure 1 is completed.

通过图1所示流程可以看出,本申请实施例通过不断遍历缓冲区中的数据记录,将各数据记录对应待复制数据按照数据写入顺序复制到目标LUN中,使目标LUN可及时存储源LUN中尽量多的数据,这样既使源LUN故障,已复制到目标LUN的数据是可用的,不会丢失太多数据;此外,由于缓冲区仅保存部分(尽量少的)待复制数据,因此,其空间利用率较高,可存储更多的数据记录,这些数据记录对应数据均会复制到目标LUN中,因此,可进一步降低数据丢失风险。It can be seen from the process shown in Figure 1 that the embodiment of the present application continuously traverses the data records in the buffer and copies the data to be copied corresponding to each data record to the target LUN in the order in which the data is written, so that the target LUN can store as much data as possible in the source LUN in time. In this way, even if the source LUN fails, the data copied to the target LUN is available and not too much data will be lost. In addition, since the buffer only stores part (as little as possible) of the data to be copied, its space utilization rate is higher and more data records can be stored. The data corresponding to these data records will all be copied to the target LUN, thereby further reducing the risk of data loss.

这里,还需要说明的是,在通过步骤102完成针对当前数据记录的数据复制后,可删除该数据记录,以释放缓冲区的空间。同理,在通过步骤103完成针对当前数据记录的数据复制后,可删除缓冲区中该数据记录对应数据,并删除该数据记录。Here, it should be noted that after completing the data copying for the current data record through step 102, the data record can be deleted to release the space in the buffer. Similarly, after completing the data copying for the current data record through step 103, the data corresponding to the data record in the buffer can be deleted, and the data record can be deleted.

下面对存储设备维护缓冲区中各数据记录的过程进行描述。参见图2,为本申请实施例示出的一种数据记录维护流程。The following describes the process of maintaining each data record in the storage device buffer. Referring to FIG2 , a data record maintenance process is shown in an embodiment of the present application.

如图2所示,该流程可包括以下步骤:As shown in FIG2 , the process may include the following steps:

步骤201,接收针对源LUN的写命令。Step 201: Receive a write command for a source LUN.

该写命令包括待写入源LUN中的数据(以下称为待写入数据)以及该待写入数据在源LUN中的写入位置(以下称为待写入地址段)。The write command includes data to be written into the source LUN (hereinafter referred to as data to be written) and a writing position of the data to be written into the source LUN (hereinafter referred to as address segment to be written).

步骤202,遍历缓冲区中已有数据记录。Step 202, traverse the existing data records in the buffer.

针对每一个已有数据记录执行步骤203至步骤205的维护操作:Perform maintenance operations from step 203 to step 205 for each existing data record:

步骤203,如果该数据记录包括的存储位置不为空,结束对该数据记录的维护。Step 203: If the storage location included in the data record is not empty, the maintenance of the data record is terminated.

如果数据记录包括的存储位置不为空,说明该数据记录对应的待复制数据因与源LUN中后写入数据存在地址冲突已被写入缓冲区中,即,保证先前写入源LUN但尚未被复制的数据不被覆盖。本申请实施例针对该存储位置不为空的数据记录不再基于写命令进行更新。If the storage location included in the data record is not empty, it means that the data to be copied corresponding to the data record has been written into the buffer due to an address conflict with the later written data in the source LUN, that is, it is ensured that the data previously written to the source LUN but not yet copied is not overwritten. The embodiment of the present application is no longer updated based on the write command for the data record whose storage location is not empty.

步骤204,如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与待写入地址段不存在交集,结束对该数据记录的维护。Step 204: If the storage location included in the data record is empty, and the logical address segment included in the data record does not intersect with the address segment to be written, the maintenance of the data record is terminated.

如果数据记录包括的存储位置为空,说明该数据记录对应待复制数据位于源LUN中。如果该待复制数据在源LUN中对应逻辑地址段与写命令包括的待写入地址段不存在交集,说明当前写命令不会对源LUN中该逻辑地址段对应数据造成覆盖。换言之,当前写命令不涉及对源LUN中该逻辑地址段的操作,因此,可结束针对当前数据记录的处理,遍历下一数据记录。If the storage location included in the data record is empty, it means that the data to be copied corresponding to the data record is located in the source LUN. If the logical address segment corresponding to the data to be copied in the source LUN does not have an intersection with the address segment to be written included in the write command, it means that the current write command will not overwrite the data corresponding to the logical address segment in the source LUN. In other words, the current write command does not involve the operation of the logical address segment in the source LUN, so the processing of the current data record can be ended and the next data record can be traversed.

步骤205,如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与待写入地址段存在交集,从源LUN中读出该逻辑地址段对应数据写入缓冲区,并更新该数据记录包括的存储位置为该逻辑地址段对应数据在缓冲区中的存储位置。Step 205, if the storage location included in the data record is empty, and the logical address segment included in the data record has an intersection with the address segment to be written, read the data corresponding to the logical address segment from the source LUN and write it into the buffer, and update the storage location included in the data record to the storage location of the data corresponding to the logical address segment in the buffer.

如果该数据记录包括的存储位置为空,说明该数据记录对应待复制数据位于源LUN中。如果该待复制数据在源LUN中对应逻辑地址段与写命令包括的待写入地址段存在交集,说明当前写命令会造成源LUN中该逻辑地址段对应数据被覆盖。为了避免源LUN中尚未复制的数据被覆盖,本申请实施例将源LUN中该逻辑地址段对应数据写入缓冲区,并更新当前数据记录包括的存储位置为该逻辑地址段对应数据被写入缓冲区中的位置。If the storage location included in the data record is empty, it means that the data to be copied corresponding to the data record is located in the source LUN. If the logical address segment corresponding to the data to be copied in the source LUN intersects with the address segment to be written included in the write command, it means that the current write command will cause the data corresponding to the logical address segment in the source LUN to be overwritten. In order to avoid overwriting of data that has not yet been copied in the source LUN, the embodiment of the present application writes the data corresponding to the logical address segment in the source LUN into the buffer, and updates the storage location included in the current data record to the location where the data corresponding to the logical address segment is written into the buffer.

步骤206,在完成对已有数据记录的维护后,将待写入数据写入源LUN中待写入地址段。Step 206, after completing the maintenance of the existing data records, write the data to be written into the address segment to be written in the source LUN.

即,完成对源LUN的写操作。That is, the write operation to the source LUN is completed.

步骤207,在缓冲区中增加新的数据记录,该新的数据记录包括的逻辑地址段为待写入地址段,该新的数据记录包括的存储位置为空。Step 207, adding a new data record in the buffer, wherein the logical address segment included in the new data record is the address segment to be written, and the storage location included in the new data record is empty.

即,增加当前写命令对应的数据记录,该数据记录对应数据位于源LUN中。That is, a data record corresponding to the current write command is added, and the data corresponding to the data record is located in the source LUN.

至此,完成图2所示流程。At this point, the process shown in Figure 2 is completed.

通过图2所示流程可以看出,本申请实施例中,针对每一个写命令分别生成对应数据记录。当新的写命令会导致源LUN中已有尚未复制数据被覆盖时,将该已有尚未复制数据拷贝到缓冲区中,然后,再将写命令对应数据写入源LUN中。简言之,本申请中,源LUN始终保存最新数据,而已有尚未复制数据保存在缓冲区中,从而保证后续数据复制的时序性。It can be seen from the process shown in FIG. 2 that in the embodiment of the present application, a corresponding data record is generated for each write command. When a new write command causes the existing uncopied data in the source LUN to be overwritten, the existing uncopied data is copied to the buffer, and then the data corresponding to the write command is written to the source LUN. In short, in the present application, the source LUN always stores the latest data, and the existing uncopied data is stored in the buffer, thereby ensuring the timing of subsequent data replication.

虽然本申请在缓冲区中仅保存部分待复制数据,但缓冲区仍然存在被写满的可能性。当缓冲区被写满时,说明当前向源LUN中写入数据的速度明显高于向目标LUN中复制数据的速度,此时,可执行图3所示流程。Although the present application only stores part of the data to be copied in the buffer, the buffer may still be full. When the buffer is full, it means that the current speed of writing data to the source LUN is significantly higher than the speed of copying data to the target LUN. At this time, the process shown in Figure 3 can be executed.

参见图3,为本申请实施例示出的另一种数据复制处理流程。Referring to FIG. 3 , another data replication process flow is shown in an embodiment of the present application.

如图3所示,该流程可包括以下步骤:As shown in FIG3 , the process may include the following steps:

步骤301,如果缓冲区被写满,停止依据缓冲区中数据记录复制数据,并停止维护缓冲区中数据记录。Step 301: If the buffer is full, stop copying data according to the data records in the buffer, and stop maintaining the data records in the buffer.

即,停止图1、图2所示流程。That is, the process shown in FIG. 1 and FIG. 2 is stopped.

步骤302,如果接收到针对源LUN的写命令,确定该写命令涉及到的至少一个待写入逻辑块,并向各待写入逻辑块中写入该写命令携带的数据。Step 302: If a write command for a source LUN is received, determine at least one to-be-written logical block involved in the write command, and write the data carried by the write command into each to-be-written logical block.

这里,源LUN可按照预设逻辑块大小(比如,8KB)划分为多个逻辑块,比如,[0,8KB]、[8KB,16KB]、[16KB,24KB],以此类推。Here, the source LUN may be divided into a plurality of logical blocks according to a preset logical block size (eg, 8 KB), such as [0, 8 KB], [8 KB, 16 KB], [16 KB, 24 KB], and so on.

当接收到写命令时,获取该写命令包括的待写入地址范围,然后,根据该待写入地址范围,确定该待写入地址范围涉及到的逻辑块,即,待写入数据的各逻辑块(以下称为待写入逻辑块)。比如,待写入地址范围为[10KB,20KB],则根据该待写入地址范围确定各待写入逻辑块为[8KB,16KB]和[16KB,24KB]。When a write command is received, the address range to be written included in the write command is obtained, and then, based on the address range to be written, the logical blocks involved in the address range to be written are determined, that is, the logical blocks of data to be written (hereinafter referred to as logical blocks to be written). For example, if the address range to be written is [10KB, 20KB], then the logical blocks to be written are determined to be [8KB, 16KB] and [16KB, 24KB] based on the address range to be written.

将写命令携带的待写入数据,按照对应的待写入地址范围,写入各待写入逻辑块。The data to be written carried by the write command is written into each logical block to be written according to the corresponding address range to be written.

步骤303,更新差异位图中各待写入逻辑块对应的差异位的值为目标值。Step 303: Update the value of the difference bit corresponding to each to-be-written logical block in the difference bitmap to the target value.

这里,需要说明的是,差异位图包括与源LUN中各逻辑块一一对应的差异位。每一个差异位的值用于标识该差异位对应逻辑块是否已写入待复制数据。Here, it should be noted that the difference bitmap includes difference bits corresponding to each logic block in the source LUN. The value of each difference bit is used to identify whether the logic block corresponding to the difference bit has been written with the data to be copied.

当存储设备通过步骤302向源LUN中写入新数据后,需要更新差异位图中与各待写入逻辑块分别对应的差异位,将差异位的值更新为目标值。这里,目标值用于标识逻辑块中已写入待复制数据,比如,目标值为“1”。反之,当差异位的值为“0”时,表示逻辑块中未写入待复制数据,即,逻辑块中没有写入新数据。After the storage device writes new data to the source LUN through step 302, it is necessary to update the difference bits corresponding to each logical block to be written in the difference bitmap, and update the value of the difference bit to the target value. Here, the target value is used to identify that the data to be copied has been written in the logical block, for example, the target value is "1". On the contrary, when the value of the difference bit is "0", it means that the data to be copied has not been written in the logical block, that is, no new data has been written in the logical block.

步骤304,遍历缓冲区中各数据记录。Step 304, traverse each data record in the buffer.

本申请实施例中,除了根据写命令维护差异位图,还需要根据缓冲区中各数据记录更新差异位图中相应差异位的值。In the embodiment of the present application, in addition to maintaining the difference bitmap according to the write command, it is also necessary to update the value of the corresponding difference bit in the difference bitmap according to each data record in the buffer.

具体的,针对每一个数据记录执行步骤305至步骤308。Specifically, step 305 to step 308 are executed for each data record.

步骤305,确定该数据记录包括的逻辑地址段所涉及的至少一个目标逻辑块。Step 305: Determine at least one target logical block involved in the logical address segment included in the data record.

比如,数据记录包括的逻辑地址段为[5KB,15KB],则该逻辑地址段涉及到的逻辑块(以下称为目标逻辑块)包括[0,8KB]和[8KB,16KB]。For example, if the logical address segment included in the data record is [5KB, 15KB], then the logical blocks involved in the logical address segment (hereinafter referred to as target logical blocks) include [0, 8KB] and [8KB, 16KB].

步骤306,更新差异位图中各目标逻辑块对应的差异位的值为目标值。Step 306: Update the value of the difference bit corresponding to each target logic block in the difference bitmap to the target value.

由于数据记录对应逻辑地址段中的数据尚未复制到目标LUN中,即,该逻辑地址段对应的各目标逻辑块中存在未复制到目标LUN的数据,因此,本步骤将差异位图中与各目标逻辑块对应的差异位的值更新为目标值,以标识各目标逻辑块中存在待复制数据。Since the data in the logical address segment corresponding to the data record has not yet been copied to the target LUN, that is, there is data that has not been copied to the target LUN in each target logical block corresponding to the logical address segment, therefore, this step updates the value of the difference bit corresponding to each target logical block in the difference bitmap to the target value to identify that there is data to be copied in each target logical block.

步骤307,如果该数据记录包括的存储位置不为空,删除缓冲区中该存储位置对应数据。Step 307: If the storage location included in the data record is not empty, delete the data corresponding to the storage location in the buffer.

在根据当前数据记录更新差异位图后,如果该数据记录包括的存储位置不为空,说明缓冲区中还保存有该数据记录对应数据,则可删除该数据。这是因为,源LUN中已保存有最新数据,当复制速度明显低于新数据写入速度时,可不必继续按照数据时序复制。After updating the difference bitmap according to the current data record, if the storage location included in the data record is not empty, it means that the buffer still contains the corresponding data of the data record, and the data can be deleted. This is because the source LUN already contains the latest data, and when the copy speed is significantly lower than the new data writing speed, it is not necessary to continue copying according to the data sequence.

步骤308,删除该数据记录。Step 308: Delete the data record.

至此,完成基于缓冲区中一条数据记录的更新操作。At this point, the update operation based on a data record in the buffer is completed.

步骤309,在完成针对缓冲区中所有数据记录的更新操作后,停止更新差异位图,并生成源LUN的复制视图,该复制视图包括源LUN中当前时刻的数据。Step 309: After completing the update operation for all data records in the buffer, stop updating the difference bitmap, and generate a copy view of the source LUN, the copy view including the data in the source LUN at the current moment.

把缓冲区中所有数据记录更新到差异位图后,差异位图可以用于新一次复制,不再需要记录新的差异。同时,需要生成源LUN上复制视图,复制视图可以是个快照,通过复制视图可以得到源LUN当前时刻的数据。After all data records in the buffer are updated to the difference bitmap, the difference bitmap can be used for a new replication, and no new differences need to be recorded. At the same time, a replication view on the source LUN needs to be generated. The replication view can be a snapshot, and the data of the source LUN at the current moment can be obtained through the replication view.

步骤310,针对差异位图中值为目标值的每一个目标差异位,将复制视图中该目标差异位对应逻辑块中的数据复制到目标LUN。Step 310: For each target difference bit in the difference bitmap whose value is the target value, copy the data in the logical block corresponding to the target difference bit in the replication view to the target LUN.

这里,将值为目标值的差异位称为目标差异位。可理解的是,之所以称为目标差异位,只是为便于区分而进行的命名,并非用于限定。Here, the difference bit whose value is the target value is called the target difference bit. It is understandable that the target difference bit is named only for the convenience of distinction and is not used for limitation.

目标差异位对应逻辑块中的数据为待复制数据,因此,本步骤将复制视图中各目标差异位对应逻辑块中的数据复制到目标LUN中,以加快使目标LUN中的数据与源LUN中数据一致,更准确地说,是使目标LUN中的数据与开始复制时刻源LUN中的数据(复制视图的数据)保持一致。The data in the logical blocks corresponding to the target difference bits are the data to be copied. Therefore, this step copies the data in the logical blocks corresponding to each target difference bit in the replication view to the target LUN to speed up the consistency of the data in the target LUN with the data in the source LUN. More precisely, it makes the data in the target LUN consistent with the data in the source LUN (the data in the replication view) when the replication starts.

至此,完成图3所示流程。At this point, the process shown in Figure 3 is completed.

通过图3所示流程可以看出,本申请实施例中,当缓冲区被写满后,根据新接收到的写命令以及缓冲区中已有数据记录更新差异位图,以标识源LUN中需要复制的逻辑块。针对每一个需要复制的逻辑块,将源LUN中该逻辑块在开始复制时刻对应的数据从复制视图复制到目标LUN中,以使目标LUN中数据与源LUN中数据保持同一个时间平面,确保目标LUN中数据可用。It can be seen from the process shown in FIG3 that in the embodiment of the present application, when the buffer is full, the difference bitmap is updated according to the newly received write command and the existing data records in the buffer to identify the logical blocks in the source LUN that need to be copied. For each logical block that needs to be copied, the data corresponding to the logical block in the source LUN at the time of starting the copy is copied from the copy view to the target LUN, so that the data in the target LUN and the data in the source LUN are kept in the same time plane, ensuring that the data in the target LUN is available.

此外,需要补充说明的是,在完成针对缓冲区中所有数据记录的更新操作后,缓冲区的空间全部被释放,此时,可重新启动对缓冲区中数据记录的维护,即,执行图2所示流程,继续根据写命令生成对应数据记录并写入缓冲区。In addition, it should be noted that after completing the update operation for all data records in the buffer, all the space in the buffer is released. At this time, the maintenance of the data records in the buffer can be restarted, that is, executing the process shown in Figure 2, and continuing to generate corresponding data records according to the write command and write them into the buffer.

在完成基于差异位图的数据复制(步骤310)后,可重新启动基于缓冲区中数据记录的数据复制,即,执行图1所示流程,以恢复按照数据时序复制数据。After completing the data replication based on the difference bitmap (step 310), the data replication based on the data records in the buffer may be restarted, that is, the process shown in FIG. 1 is executed to resume data replication according to the data sequence.

可以看出,本申请实施例中,在缓冲区未被写满时,通过不断遍历缓冲区中的数据记录实现连续复制数据,以使目标LUN及时同步源LUN中数据,缩小目标LUN中数据与源LUN中数据的差距,这样当源LUN故障时可减少数据丢失;而在缓冲区被写满时,通过将缓冲区中所有数据记录转换为差异位图形式,使存储设备根据该差异位图以及复制视图直接同步源LUN中变化的数据到目标LUN中,以使目标LUN中数据与源LUN中数据保持同一个时间平面,确保目标LUN中数据可用。It can be seen that in the embodiment of the present application, when the buffer is not full, continuous data replication is achieved by continuously traversing the data records in the buffer, so that the target LUN can synchronize the data in the source LUN in time, and narrow the gap between the data in the target LUN and the data in the source LUN, so that data loss can be reduced when the source LUN fails; and when the buffer is full, by converting all data records in the buffer into a differential bitmap format, the storage device directly synchronizes the changed data in the source LUN to the target LUN according to the differential bitmap and the replication view, so that the data in the target LUN and the data in the source LUN remain on the same time plane, ensuring that the data in the target LUN is available.

以上对本申请实施例提供的方法进行了描述,下面对本申请实施例提供的装置进行描述:The method provided in the embodiment of the present application is described above. The device provided in the embodiment of the present application is described below:

参见图4,为本申请实施例提供的装置的结构示意图,应用于存储设备。所述存储设备包括待复制的源LUN,所述源LUN对应有缓冲区,所述缓冲区用于存储所述源LUN中待复制数据的数据记录以及部分待复制数据,所述数据记录包括待复制数据在所述源LUN中对应逻辑地址段以及该待复制数据在所述缓冲区中的存储位置,所述源LUN还对应有用于复制该源LUN对应数据的目标LUN,所述装置包括:Referring to FIG4 , a schematic diagram of the structure of the apparatus provided in an embodiment of the present application is applied to a storage device. The storage device includes a source LUN to be copied, the source LUN corresponds to a buffer zone, the buffer zone is used to store data records of the data to be copied in the source LUN and part of the data to be copied, the data records include the logical address segment corresponding to the data to be copied in the source LUN and the storage location of the data to be copied in the buffer zone, the source LUN also corresponds to a target LUN for copying the data corresponding to the source LUN, and the apparatus includes:

遍历单元401,用于按照数据记录写入顺序,依次遍历所述缓冲区中各数据记录;A traversal unit 401 is used to traverse the data records in the buffer in sequence according to the order in which the data records are written;

复制单元402,用于针对每一个数据记录,如果该数据记录包括的存储位置为空,获取该数据记录包括的逻辑地址段,将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN;如果该数据记录包括的存储位置不为空,将所述缓冲区中该存储位置对应数据复制到所述目标LUN。The copying unit 402 is used to obtain the logical address segment included in each data record if the storage location included in the data record is empty, and copy the data corresponding to the logical address segment in the source LUN to the target LUN; if the storage location included in the data record is not empty, copy the data corresponding to the storage location in the buffer to the target LUN.

作为一个实施例,所述复制单元402将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN之后,所述装置还包括:As an embodiment, after the copying unit 402 copies the data corresponding to the logical address segment in the source LUN to the target LUN, the device further includes:

删除单元,用于删除该数据记录;A deletion unit, used to delete the data record;

所述复制单元402将所述缓冲区中该存储位置对应数据复制到所述目标LUN之后,所述装置还包括:After the copy unit 402 copies the data corresponding to the storage location in the buffer to the target LUN, the device further includes:

删除单元,用于删除所述缓冲区中该存储位置对应数据;删除该数据记录。The deleting unit is used to delete the data corresponding to the storage position in the buffer; and delete the data record.

作为一个实施例,所述遍历单元401遍历所述缓冲区中各数据记录之前,所述装置还包括:As an embodiment, before the traversal unit 401 traverses each data record in the buffer, the device further includes:

接收单元,用于接收针对所述源LUN的写命令,该写命令包括待写入地址段以及待写入数据;A receiving unit, configured to receive a write command for the source LUN, the write command including an address segment to be written and data to be written;

所述遍历单元401,用于遍历所述缓冲区中已有数据记录;The traversal unit 401 is used to traverse the existing data records in the buffer;

维护单元,用于针对每一个数据记录,如果该数据记录包括的存储位置不为空,结束对该数据记录的维护;如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段不存在交集,结束对该数据记录的维护;如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段存在交集,从所述源LUN中读出该逻辑地址段对应数据写入所述缓冲区,并更新该数据记录包括的存储位置为该逻辑地址段对应数据在所述缓冲区中的存储位置;A maintenance unit is used for, for each data record, if the storage location included in the data record is not empty, terminating the maintenance of the data record; if the storage location included in the data record is empty, and the logical address segment included in the data record does not have an intersection with the address segment to be written, terminating the maintenance of the data record; if the storage location included in the data record is empty, and the logical address segment included in the data record does have an intersection with the address segment to be written, reading the data corresponding to the logical address segment from the source LUN and writing it into the buffer, and updating the storage location included in the data record to be the storage location of the data corresponding to the logical address segment in the buffer;

写入单元,用于在完成对已有数据记录的维护后,将所述待写入数据写入所述源LUN中所述待写入地址段;A writing unit, configured to write the data to be written into the address segment to be written in the source LUN after completing the maintenance of the existing data record;

所述维护单元,还用于在所述缓冲区中增加新的数据记录,所述新的数据记录包括的逻辑地址段为所述待写入地址段,所述新的数据记录包括的存储位置为空。The maintenance unit is further used to add a new data record in the buffer, wherein the logical address segment included in the new data record is the address segment to be written, and the storage location included in the new data record is empty.

作为一个实施例,所述源LUN按照预设逻辑块大小划分为多个逻辑块,所述源LUN还对应有差异位图,所述差异位图包括与各逻辑块分别对应的差异位,所述差异位的值用于标识该差异位对应逻辑块是否写入待复制数据,所述装置还包括:As an embodiment, the source LUN is divided into a plurality of logical blocks according to a preset logical block size, the source LUN further corresponds to a difference bitmap, the difference bitmap includes a difference bit corresponding to each logical block, and the value of the difference bit is used to identify whether the logical block corresponding to the difference bit is written with the data to be copied, and the device further includes:

停止单元,用于如果所述缓冲区被写满,停止依据所述缓冲区中数据记录复制数据,并停止维护所述缓冲区中数据记录;A stopping unit, configured to stop copying data according to the data records in the buffer and stop maintaining the data records in the buffer if the buffer is full;

确定单元,用于如果接收到针对所述源LUN的写命令,确定该写命令涉及到的至少一个待写入逻辑块,并向各待写入逻辑块中写入该写命令携带的待写入数据;a determination unit, configured to, if receiving a write command for the source LUN, determine at least one to-be-written logical block involved in the write command, and write the to-be-written data carried by the write command into each to-be-written logical block;

更新单元,用于更新所述差异位图中各待写入逻辑块对应的差异位的值为目标值,所述目标值用于标识逻辑块中已写入待复制数据;An updating unit, used for updating the difference bit value corresponding to each to-be-written logical block in the difference bitmap to a target value, wherein the target value is used for identifying the to-be-copied data that has been written into the logical block;

所述遍历单元401,用于遍历所述缓冲区中各数据记录;The traversal unit 401 is used to traverse each data record in the buffer;

所述确定单元,还用于针对每一个数据记录,确定该数据记录包括的逻辑地址段所涉及的至少一个目标逻辑块;The determining unit is further configured to determine, for each data record, at least one target logical block involved in a logical address segment included in the data record;

所述更新单元,还用于更新所述差异位图中各目标逻辑块对应的差异位的值为所述目标值;The updating unit is further used to update the value of the difference bit corresponding to each target logic block in the difference bitmap to the target value;

删除单元,用于如果该数据记录包括的存储位置不为空,删除所述缓冲区中该存储位置对应数据;删除该数据记录;A deleting unit, configured to delete the data corresponding to the storage location in the buffer if the storage location included in the data record is not empty; and delete the data record;

生成单元,用于在完成针对所有数据记录的更新操作后,停止更新所述差异位图,并生成所述源LUN的复制视图,所述复制视图包括所述源LUN中当前时刻的数据;A generating unit, configured to stop updating the difference bitmap after completing the update operation for all data records, and generate a replication view of the source LUN, wherein the replication view includes the data at the current moment in the source LUN;

所述复制单元402,还用于针对所述差异位图中值为目标值的每一个目标差异位,将所述复制视图中该目标差异位对应逻辑块中的数据复制到所述目标LUN。The replication unit 402 is further configured to replicate, for each target difference bit in the difference bitmap whose value is a target value, data in a logical block corresponding to the target difference bit in the replication view to the target LUN.

作为一个实施例,所述装置还包括:As an embodiment, the device further includes:

重启单元,用于在完成针对所有数据记录的更新操作后,重新启动对所述缓冲区中数据记录的维护;A restart unit, used to restart the maintenance of the data records in the buffer after completing the update operation on all data records;

所述重启单元,还用于在完成基于所述差异位图的数据复制后,重新启动基于所述缓冲区中数据记录的数据复制。The restart unit is further configured to restart the data replication based on the data records in the buffer after completing the data replication based on the difference bitmap.

至此,完成图4所示装置的描述。At this point, the description of the device shown in FIG. 4 is completed.

由以上描述可以看出,本申请实施例中,存储设备维护有源LUN对应的缓冲区,缓冲区中存储有待复制数据的数据记录以及部分待复制数据。针对缓冲区中的每一个数据记录,如果该数据记录包括的存储位置为空,说明该数据记录对应待复制数据位于源LUN中,则根据该数据记录包括的逻辑地址段从源LUN中复制对应数据到目标LUN;如果该数据记录包括的存储位置不为空,说明该数据记录对应待复制数据位于缓冲区中,则根据该数据记录包括的存储位置从缓冲区中复制对应数据到目标LUN。可以看出,本申请实施例通过不断遍历缓冲区中的数据记录,将各数据记录对应待复制数据按照数据写入顺序复制到目标LUN中,可使目标LUN及时存储源LUN中尽量多的数据,这样既使源LUN故障,已复制到目标LUN的数据是可用的,不会丢失太多数据;此外,由于缓冲区仅保存部分(尽量少的)待复制数据,因此,其空间利用率较高,可存储更多的数据记录,进一步降低数据丢失风险。It can be seen from the above description that in the embodiment of the present application, the storage device maintains a buffer corresponding to the active LUN, and the buffer stores data records of the data to be copied and part of the data to be copied. For each data record in the buffer, if the storage location included in the data record is empty, it means that the data to be copied corresponding to the data record is located in the source LUN, and the corresponding data is copied from the source LUN to the target LUN according to the logical address segment included in the data record; if the storage location included in the data record is not empty, it means that the data to be copied corresponding to the data record is located in the buffer, and the corresponding data is copied from the buffer to the target LUN according to the storage location included in the data record. It can be seen that the embodiment of the present application continuously traverses the data records in the buffer, and copies the data to be copied corresponding to each data record to the target LUN in the order of data writing, so that the target LUN can store as much data as possible in the source LUN in time, so that even if the source LUN fails, the data copied to the target LUN is available, and not too much data will be lost; in addition, since the buffer only stores part (as little as possible) of the data to be copied, its space utilization is high, and more data records can be stored, further reducing the risk of data loss.

以上所述仅为本申请实施例的较佳实施例而已,并不用以限制本申请,凡在本申请实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above description is only a preferred embodiment of the embodiments of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.

Claims (8)

1.一种LUN数据复制方法,其特征在于,应用于存储设备,所述存储设备包括待复制的源LUN,所述源LUN对应有缓冲区,所述缓冲区用于存储所述源LUN中待复制数据的数据记录以及部分待复制数据,所述数据记录包括待复制数据在所述源LUN中对应逻辑地址段以及该待复制数据在所述缓冲区中的存储位置,所述源LUN还对应有用于复制该源LUN对应数据的目标LUN,所述方法包括:1. A LUN data replication method, characterized in that it is applied to a storage device, the storage device includes a source LUN to be replicated, the source LUN corresponds to a buffer zone, the buffer zone is used to store data records of the data to be replicated in the source LUN and part of the data to be replicated, the data records include a logical address segment corresponding to the data to be replicated in the source LUN and a storage location of the data to be replicated in the buffer zone, the source LUN also corresponds to a target LUN for replicating the data corresponding to the source LUN, the method comprises: 接收针对所述源LUN的写命令,该写命令包括待写入地址段以及待写入数据;Receiving a write command for the source LUN, the write command including an address segment to be written and data to be written; 遍历所述缓冲区中已有数据记录,针对每一个数据记录执行如下维护操作:Traverse the existing data records in the buffer and perform the following maintenance operations for each data record: 如果该数据记录包括的存储位置不为空,结束对该数据记录的维护;If the storage location included in the data record is not empty, end the maintenance of the data record; 如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段不存在交集,结束对该数据记录的维护;If the storage location included in the data record is empty, and the logical address segment included in the data record does not have an intersection with the address segment to be written, the maintenance of the data record is terminated; 如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段存在交集,从所述源LUN中读出该逻辑地址段对应数据写入所述缓冲区,并更新该数据记录包括的存储位置为该逻辑地址段对应数据在所述缓冲区中的存储位置;If the storage location included in the data record is empty, and the logical address segment included in the data record has an intersection with the address segment to be written, read the data corresponding to the logical address segment from the source LUN and write it into the buffer, and update the storage location included in the data record to the storage location of the data corresponding to the logical address segment in the buffer; 在完成对已有数据记录的维护后,将所述待写入数据写入所述源LUN中所述待写入地址段;After completing the maintenance of the existing data records, writing the data to be written into the address segment to be written in the source LUN; 在所述缓冲区中增加新的数据记录,所述新的数据记录包括的逻辑地址段为所述待写入地址段,所述新的数据记录包括的存储位置为空;Adding a new data record in the buffer, wherein the logical address segment included in the new data record is the address segment to be written, and the storage location included in the new data record is empty; 按照数据记录写入顺序,依次遍历所述缓冲区中各数据记录,针对每一个数据记录执行如下复制操作:According to the order in which the data records are written, the data records in the buffer are traversed in sequence, and the following copy operation is performed for each data record: 如果该数据记录包括的存储位置为空,获取该数据记录包括的逻辑地址段,将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN;If the storage location included in the data record is empty, obtaining the logical address segment included in the data record, and copying the data corresponding to the logical address segment in the source LUN to the target LUN; 如果该数据记录包括的存储位置不为空,将所述缓冲区中该存储位置对应数据复制到所述目标LUN。If the storage location included in the data record is not empty, the data corresponding to the storage location in the buffer is copied to the target LUN. 2.如权利要求1所述的方法,其特征在于,所述将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN之后,所述方法还包括:2. The method according to claim 1, characterized in that after copying the data corresponding to the logical address segment in the source LUN to the target LUN, the method further comprises: 删除该数据记录;Delete the data record; 所述将所述缓冲区中该存储位置对应数据复制到所述目标LUN之后,所述方法还包括:After copying the data corresponding to the storage location in the buffer to the target LUN, the method further includes: 删除所述缓冲区中该存储位置对应数据;Deleting the data corresponding to the storage position in the buffer; 删除该数据记录。Delete the data record. 3.如权利要求1所述的方法,其特征在于,所述源LUN按照预设逻辑块大小划分为多个逻辑块,所述源LUN还对应有差异位图,所述差异位图包括与各逻辑块分别对应的差异位,所述差异位的值用于标识该差异位对应逻辑块是否写入待复制数据,所述方法还包括:3. The method according to claim 1, wherein the source LUN is divided into a plurality of logical blocks according to a preset logical block size, the source LUN further corresponds to a difference bitmap, the difference bitmap includes a difference bit corresponding to each logical block, and the value of the difference bit is used to identify whether the logical block corresponding to the difference bit is written with the data to be copied, and the method further comprises: 如果所述缓冲区被写满,停止依据所述缓冲区中数据记录复制数据,并停止维护所述缓冲区中数据记录;If the buffer is full, stop copying data according to the data records in the buffer, and stop maintaining the data records in the buffer; 如果接收到针对所述源LUN的写命令,确定该写命令涉及到的至少一个待写入逻辑块,并向各待写入逻辑块中写入该写命令携带的待写入数据;If a write command for the source LUN is received, determining at least one to-be-written logical block involved in the write command, and writing the to-be-written data carried by the write command into each to-be-written logical block; 更新所述差异位图中各待写入逻辑块对应的差异位的值为目标值,所述目标值用于标识逻辑块中已写入待复制数据;Updating the difference bit value corresponding to each to-be-written logical block in the difference bitmap to a target value, where the target value is used to identify the to-be-copied data that has been written into the logical block; 遍历所述缓冲区中各数据记录,针对每一个数据记录执行如下更新操作:Traverse each data record in the buffer and perform the following update operation for each data record: 确定该数据记录包括的逻辑地址段所涉及的至少一个目标逻辑块;Determine at least one target logical block involved in the logical address segment included in the data record; 更新所述差异位图中各目标逻辑块对应的差异位的值为所述目标值;Update the value of the difference bit corresponding to each target logic block in the difference bitmap to the target value; 如果该数据记录包括的存储位置不为空,删除所述缓冲区中该存储位置对应数据;If the storage location included in the data record is not empty, deleting the data corresponding to the storage location in the buffer; 删除该数据记录;Delete the data record; 在完成针对所有数据记录的更新操作后,停止更新所述差异位图,并生成所述源LUN的复制视图,所述复制视图包括所述源LUN中当前时刻的数据;After completing the update operation for all data records, stop updating the difference bitmap, and generate a replication view of the source LUN, where the replication view includes the data at the current moment in the source LUN; 针对所述差异位图中值为目标值的每一个目标差异位,将所述复制视图中该目标差异位对应逻辑块中的数据复制到所述目标LUN。For each target difference bit in the difference bitmap whose value is a target value, data in a logical block corresponding to the target difference bit in the replication view is replicated to the target LUN. 4.如权利要求3所述的方法,其特征在于,所述方法还包括:4. The method according to claim 3, characterized in that the method further comprises: 在完成针对所有数据记录的更新操作后,重新启动对所述缓冲区中数据记录的维护;After completing the update operation for all data records, restarting the maintenance of the data records in the buffer; 在完成基于所述差异位图的数据复制后,重新启动基于所述缓冲区中数据记录的数据复制。After completing the data replication based on the difference bitmap, restarting the data replication based on the data records in the buffer. 5.一种LUN数据复制装置,其特征在于,应用于存储设备,所述存储设备包括待复制的源LUN,所述源LUN对应有缓冲区,所述缓冲区用于存储所述源LUN中待复制数据的数据记录以及部分待复制数据,所述数据记录包括待复制数据在所述源LUN中对应逻辑地址段以及该待复制数据在所述缓冲区中的存储位置,所述源LUN还对应有用于复制该源LUN对应数据的目标LUN,所述装置包括:5. A LUN data replication device, characterized in that it is applied to a storage device, the storage device includes a source LUN to be replicated, the source LUN corresponds to a buffer zone, the buffer zone is used to store data records of the data to be replicated in the source LUN and part of the data to be replicated, the data records include a logical address segment corresponding to the data to be replicated in the source LUN and a storage location of the data to be replicated in the buffer zone, the source LUN also corresponds to a target LUN for replicating the data corresponding to the source LUN, the device includes: 接收单元,用于接收针对所述源LUN的写命令,该写命令包括待写入地址段以及待写入数据;A receiving unit, configured to receive a write command for the source LUN, the write command including an address segment to be written and data to be written; 遍历单元,用于遍历所述缓冲区中已有数据记录;A traversal unit, used for traversing existing data records in the buffer; 维护单元,用于针对每一个数据记录,如果该数据记录包括的存储位置不为空,结束对该数据记录的维护;如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段不存在交集,结束对该数据记录的维护;如果该数据记录包括的存储位置为空,且该数据记录包括的逻辑地址段与所述待写入地址段存在交集,从所述源LUN中读出该逻辑地址段对应数据写入所述缓冲区,并更新该数据记录包括的存储位置为该逻辑地址段对应数据在所述缓冲区中的存储位置;A maintenance unit is used for, for each data record, if the storage location included in the data record is not empty, terminating the maintenance of the data record; if the storage location included in the data record is empty, and the logical address segment included in the data record does not have an intersection with the address segment to be written, terminating the maintenance of the data record; if the storage location included in the data record is empty, and the logical address segment included in the data record does have an intersection with the address segment to be written, reading the data corresponding to the logical address segment from the source LUN and writing it into the buffer, and updating the storage location included in the data record to be the storage location of the data corresponding to the logical address segment in the buffer; 写入单元,用于在完成对已有数据记录的维护后,将所述待写入数据写入所述源LUN中所述待写入地址段;A writing unit, configured to write the data to be written into the address segment to be written in the source LUN after completing the maintenance of the existing data record; 所述维护单元,还用于在所述缓冲区中增加新的数据记录,所述新的数据记录包括的逻辑地址段为所述待写入地址段,所述新的数据记录包括的存储位置为空;The maintenance unit is further used to add a new data record in the buffer, the logical address segment included in the new data record is the address segment to be written, and the storage location included in the new data record is empty; 所述遍历单元,还用于按照数据记录写入顺序,依次遍历所述缓冲区中各数据记录;The traversal unit is further used to traverse the data records in the buffer in sequence according to the order in which the data records are written; 复制单元,用于针对每一个数据记录,如果该数据记录包括的存储位置为空,获取该数据记录包括的逻辑地址段,将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN;如果该数据记录包括的存储位置不为空,将所述缓冲区中该存储位置对应数据复制到所述目标LUN。The replication unit is used for obtaining the logical address segment included in each data record if the storage location included in the data record is empty, and copying the data corresponding to the logical address segment in the source LUN to the target LUN; if the storage location included in the data record is not empty, copying the data corresponding to the storage location in the buffer to the target LUN. 6.如权利要求5所述的装置,其特征在于,所述复制单元将所述源LUN中该逻辑地址段对应数据复制到所述目标LUN之后,所述装置还包括:6. The device according to claim 5, characterized in that after the copying unit copies the data corresponding to the logical address segment in the source LUN to the target LUN, the device further comprises: 删除单元,用于删除该数据记录;A deletion unit, used to delete the data record; 所述复制单元将所述缓冲区中该存储位置对应数据复制到所述目标LUN之后,所述装置还包括:After the copy unit copies the data corresponding to the storage location in the buffer to the target LUN, the device further includes: 删除单元,用于删除所述缓冲区中该存储位置对应数据;删除该数据记录。The deleting unit is used to delete the data corresponding to the storage position in the buffer; and delete the data record. 7.如权利要求5所述的装置,其特征在于,所述源LUN按照预设逻辑块大小划分为多个逻辑块,所述源LUN还对应有差异位图,所述差异位图包括与各逻辑块分别对应的差异位,所述差异位的值用于标识该差异位对应逻辑块是否写入待复制数据,所述装置还包括:7. The device according to claim 5, wherein the source LUN is divided into a plurality of logical blocks according to a preset logical block size, the source LUN further corresponds to a difference bitmap, the difference bitmap includes a difference bit corresponding to each logical block, the value of the difference bit is used to identify whether the logical block corresponding to the difference bit is written with the data to be copied, and the device further comprises: 停止单元,用于如果所述缓冲区被写满,停止依据所述缓冲区中数据记录复制数据,并停止维护所述缓冲区中数据记录;A stopping unit, configured to stop copying data according to the data records in the buffer and stop maintaining the data records in the buffer if the buffer is full; 确定单元,用于如果接收到针对所述源LUN的写命令,确定该写命令涉及到的至少一个待写入逻辑块,并向各待写入逻辑块中写入该写命令携带的待写入数据;a determination unit, configured to, if receiving a write command for the source LUN, determine at least one to-be-written logical block involved in the write command, and write the to-be-written data carried by the write command into each to-be-written logical block; 更新单元,用于更新所述差异位图中各待写入逻辑块对应的差异位的值为目标值,所述目标值用于标识逻辑块中已写入待复制数据;An updating unit, used for updating the difference bit value corresponding to each to-be-written logical block in the difference bitmap to a target value, wherein the target value is used for identifying the to-be-copied data that has been written into the logical block; 所述遍历单元,用于遍历所述缓冲区中各数据记录;The traversal unit is used to traverse each data record in the buffer; 所述确定单元,还用于针对每一个数据记录,确定该数据记录包括的逻辑地址段所涉及的至少一个目标逻辑块;The determining unit is further configured to determine, for each data record, at least one target logical block involved in a logical address segment included in the data record; 所述更新单元,还用于更新所述差异位图中各目标逻辑块对应的差异位的值为所述目标值;The updating unit is further used to update the value of the difference bit corresponding to each target logic block in the difference bitmap to the target value; 删除单元,用于如果该数据记录包括的存储位置不为空,删除所述缓冲区中该存储位置对应数据;删除该数据记录;A deleting unit, configured to delete the data corresponding to the storage location in the buffer if the storage location included in the data record is not empty; and delete the data record; 生成单元,用于在完成针对所有数据记录的更新操作后,停止更新所述差异位图,并生成所述源LUN的复制视图,所述复制视图包括所述源LUN中当前时刻的数据;A generating unit, configured to stop updating the difference bitmap after completing the update operation for all data records, and generate a replication view of the source LUN, wherein the replication view includes the data at the current moment in the source LUN; 所述复制单元,还用于针对所述差异位图中值为目标值的每一个目标差异位,将所述复制视图中该目标差异位对应逻辑块中的数据复制到所述目标LUN。The replication unit is further configured to replicate, for each target difference bit in the difference bitmap whose value is a target value, data in a logical block corresponding to the target difference bit in the replication view to the target LUN. 8.如权利要求7所述的装置,其特征在于,所述装置还包括:8. The device according to claim 7, characterized in that the device further comprises: 重启单元,用于在完成针对所有数据记录的更新操作后,重新启动对所述缓冲区中数据记录的维护;A restart unit, used to restart the maintenance of the data records in the buffer after completing the update operation on all data records; 所述重启单元,还用于在完成基于所述差异位图的数据复制后,重新启动基于所述缓冲区中数据记录的数据复制。The restart unit is further configured to restart the data replication based on the data records in the buffer after completing the data replication based on the difference bitmap.
CN202111250149.1A 2021-10-26 2021-10-26 LUN data replication method and device Active CN113986128B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111250149.1A CN113986128B (en) 2021-10-26 2021-10-26 LUN data replication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111250149.1A CN113986128B (en) 2021-10-26 2021-10-26 LUN data replication method and device

Publications (2)

Publication Number Publication Date
CN113986128A CN113986128A (en) 2022-01-28
CN113986128B true CN113986128B (en) 2024-05-28

Family

ID=79741866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111250149.1A Active CN113986128B (en) 2021-10-26 2021-10-26 LUN data replication method and device

Country Status (1)

Country Link
CN (1) CN113986128B (en)

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1375767A (en) * 2001-07-03 2002-10-23 智权第一公司 Apparatus and method for providing branch instruction and relative target instruction to buffering zone
CN102023812A (en) * 2009-09-23 2011-04-20 成都市华为赛门铁克科技有限公司 RAID (redundant array of inexpensive disk) level transformation method and transformation device
CN102306115A (en) * 2011-05-20 2012-01-04 成都市华为赛门铁克科技有限公司 Asynchronous remote copying method, system and equipment
CN102422277A (en) * 2009-05-12 2012-04-18 微软公司 Converting luns into files or files into luns in real time
CN102782654A (en) * 2009-12-30 2012-11-14 桑迪士克科技股份有限公司 Method and controller for performing a copy-back operation
US8364920B1 (en) * 2009-04-06 2013-01-29 Network Appliance, Inc. System and method for transferring and backing up luns and lun clones on primary and secondary servers
CN102929748A (en) * 2012-11-08 2013-02-13 华为技术有限公司 Method and device for data backup
US8380674B1 (en) * 2008-01-09 2013-02-19 Netapp, Inc. System and method for migrating lun data between data containers
CN103502926A (en) * 2011-04-29 2014-01-08 美国网域存储技术有限公司 Extent-based storage architecture
CN103605617A (en) * 2013-11-21 2014-02-26 华为技术有限公司 Method and device for recording changes in stored data
CN103885717A (en) * 2012-12-19 2014-06-25 杭州宏杉科技有限公司 A data replication method and device
WO2015085530A1 (en) * 2013-12-12 2015-06-18 华为技术有限公司 Data replication method and storage system
CN105843709A (en) * 2016-04-08 2016-08-10 杭州宏杉科技有限公司 Difference data scanning method and device
WO2017054539A1 (en) * 2015-09-28 2017-04-06 华为技术有限公司 Data snapshot method and storage device
CN106775481A (en) * 2016-12-23 2017-05-31 华为技术有限公司 Method for reading data and equipment
CN107038092A (en) * 2017-04-17 2017-08-11 杭州宏杉科技股份有限公司 A kind of data copy method and device
CN110286856A (en) * 2019-06-17 2019-09-27 杭州宏杉科技股份有限公司 Roll up cloning process, device, electronic equipment and machine readable storage medium
CN110603524A (en) * 2017-02-05 2019-12-20 华睿泰科技有限责任公司 Method and system for dependency analysis of orchestrated workloads
CN111273854A (en) * 2018-12-04 2020-06-12 株式会社日立制作所 Multi-node storage system and queue control method of multi-node storage system
CN111722807A (en) * 2020-06-20 2020-09-29 苏州浪潮智能科技有限公司 Solid state hard disk garbage collection method, device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6350090B2 (en) * 2014-08-06 2018-07-04 富士通株式会社 Storage control device, copy control program, and copy control method

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1375767A (en) * 2001-07-03 2002-10-23 智权第一公司 Apparatus and method for providing branch instruction and relative target instruction to buffering zone
US8380674B1 (en) * 2008-01-09 2013-02-19 Netapp, Inc. System and method for migrating lun data between data containers
US8364920B1 (en) * 2009-04-06 2013-01-29 Network Appliance, Inc. System and method for transferring and backing up luns and lun clones on primary and secondary servers
CN102422277A (en) * 2009-05-12 2012-04-18 微软公司 Converting luns into files or files into luns in real time
CN102023812A (en) * 2009-09-23 2011-04-20 成都市华为赛门铁克科技有限公司 RAID (redundant array of inexpensive disk) level transformation method and transformation device
CN102782654A (en) * 2009-12-30 2012-11-14 桑迪士克科技股份有限公司 Method and controller for performing a copy-back operation
CN103502926A (en) * 2011-04-29 2014-01-08 美国网域存储技术有限公司 Extent-based storage architecture
CN102306115A (en) * 2011-05-20 2012-01-04 成都市华为赛门铁克科技有限公司 Asynchronous remote copying method, system and equipment
CN102929748A (en) * 2012-11-08 2013-02-13 华为技术有限公司 Method and device for data backup
CN103885717A (en) * 2012-12-19 2014-06-25 杭州宏杉科技有限公司 A data replication method and device
CN103605617A (en) * 2013-11-21 2014-02-26 华为技术有限公司 Method and device for recording changes in stored data
WO2015085530A1 (en) * 2013-12-12 2015-06-18 华为技术有限公司 Data replication method and storage system
WO2017054539A1 (en) * 2015-09-28 2017-04-06 华为技术有限公司 Data snapshot method and storage device
CN105843709A (en) * 2016-04-08 2016-08-10 杭州宏杉科技有限公司 Difference data scanning method and device
CN106775481A (en) * 2016-12-23 2017-05-31 华为技术有限公司 Method for reading data and equipment
CN110603524A (en) * 2017-02-05 2019-12-20 华睿泰科技有限责任公司 Method and system for dependency analysis of orchestrated workloads
CN107038092A (en) * 2017-04-17 2017-08-11 杭州宏杉科技股份有限公司 A kind of data copy method and device
CN111273854A (en) * 2018-12-04 2020-06-12 株式会社日立制作所 Multi-node storage system and queue control method of multi-node storage system
CN110286856A (en) * 2019-06-17 2019-09-27 杭州宏杉科技股份有限公司 Roll up cloning process, device, electronic equipment and machine readable storage medium
CN111722807A (en) * 2020-06-20 2020-09-29 苏州浪潮智能科技有限公司 Solid state hard disk garbage collection method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113986128A (en) 2022-01-28

Similar Documents

Publication Publication Date Title
US11301379B2 (en) Access request processing method and apparatus, and computer device
US8977826B1 (en) Extent commands in replication
US11030092B2 (en) Access request processing method and apparatus, and computer system
US7707373B2 (en) Storage system and backup method
CN103765373B (en) Date storage method, data storage device and memory device
US10884926B2 (en) Method and system for distributed storage using client-side global persistent cache
JP2004258944A (en) Storage device and its management method
CN111736767B (en) Method and equipment for writing cache of distributed object storage system
US20160034358A1 (en) Storage apparatus and method for controlling cache of storage apparatus
CN111158858A (en) Cloning method and device of virtual machine and computer readable storage medium
CN117170582A (en) Method, device, equipment and storage medium for implementing redirection-on-write snapshot
JP2016181142A (en) Backup control apparatus, backup control method, and program
CN113986128B (en) LUN data replication method and device
JP4394467B2 (en) Storage system, server apparatus, and preceding copy data generation method
CN105068760A (en) Data storage method, data storage apparatus and storage device
CN107357536B (en) Data modification and writing method and system for distributed storage system
CN117828132A (en) Database real-time log hybrid storage method and system
CN115421983A (en) Data backup method and device based on mainframe
CN115033425A (en) A method to improve the success rate of data backup
CN114780489A (en) Method and device for realizing distributed block storage bottom layer GC
CN114880277B (en) Block device snapshot method, system and storage medium
CN119645733B (en) KVM data storage processing method and system and continuous data point recovery method thereof
CN104615505B (en) A kind of method of remote copy record data change
CN120277108A (en) Database processing method, storage medium and device
CN114442941A (en) Data migration method, system, storage medium and equipment

Legal Events

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