CN103605617B - The method and device that a kind of records store data changes - Google Patents
The method and device that a kind of records store data changes Download PDFInfo
- Publication number
- CN103605617B CN103605617B CN201310594802.5A CN201310594802A CN103605617B CN 103605617 B CN103605617 B CN 103605617B CN 201310594802 A CN201310594802 A CN 201310594802A CN 103605617 B CN103605617 B CN 103605617B
- Authority
- CN
- China
- Prior art keywords
- bitmap
- logical block
- logical
- block area
- area
- 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
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请公开了一种记录存储数据发生变化的方法及装置,其中,所述方法包括:确定逻辑单元号LUN中当前变化逻辑块所在的逻辑块区;查询位图集中是否已存在所述逻辑块区的对应位图;如果不存在,则在所述位图集中建立所述逻辑块区的对应位图,并在所述对应位图中记录所述当前变化逻辑块发生变化;如果存在,则直接在所述对应位图中记录所述当前变化逻辑块发生变化。通过上述方式,本申请能够减少位图占用的存储资源,降低对内存资源的浪费。
The present application discloses a method and device for recording and storing data changes, wherein the method includes: determining the logical block area where the currently changed logical block in the logical unit number LUN is located; querying whether the logical block already exists in the bitmap set The corresponding bitmap of the area; if it does not exist, then set up the corresponding bitmap of the logical block area in the bitmap set, and record the change of the current change logical block in the corresponding bitmap; if it exists, then The change of the current changed logic block is directly recorded in the corresponding bitmap. Through the above method, the present application can reduce the storage resources occupied by the bitmap and reduce the waste of memory resources.
Description
技术领域technical field
本申请涉及存储技术领域,特别是涉及一种记录存储数据发生变化的方法及装置。The present application relates to the field of storage technology, in particular to a method and device for recording changes in stored data.
背景技术Background technique
现有技术中,通常使用位图(Bitmap)技术来记录逻辑单元号(Logic UnitNumber,简称LUN)中数据是否发生变化。具体,在内存中申请一块容量固定的内存作为记录LUN中逻辑块(chunk)变化情况的位图,其中,所述位图所需的容量由LUN的最大容量和位图中的位所对应的逻辑块的大小共同决定的。例如,如图1所示,设定位图中一位对应记录一个逻辑块中的数据变化情况,LUN的最大容量为64TB,LUN中每个逻辑块的大小为64KB,则需要容量为1G bit的位图,在LUN没有任何数据发生变化是,位图所有位的数值为“0”,当LUN中逻辑块chunk0、chunk1、chunk2和chunk9中的数据发生了变化,则相应地,位图中第1、2、3及9位被置“1”。故通过确定位图中数值为1的位所在的位置,则可获知LUN中哪些逻辑块发生数据变化。In the prior art, a bitmap (Bitmap) technology is usually used to record whether data in a Logical Unit Number (Logic UnitNumber, LUN for short) changes. Specifically, apply for a fixed-capacity memory in the memory as a bitmap that records the changes of logical blocks (chunks) in the LUN, where the capacity required by the bitmap is determined by the maximum capacity of the LUN and the bits in the bitmap corresponding to The size of the logical block is jointly determined. For example, as shown in Figure 1, set one bit in the bitmap to record the data change in a logical block, the maximum capacity of the LUN is 64TB, and the size of each logical block in the LUN is 64KB, the required capacity is 1G bit When the bitmap of the LUN does not have any data changes, all bits in the bitmap are "0". When the data in the logical blocks chunk0, chunk1, chunk2, and Bits 1, 2, 3 and 9 are set to "1". Therefore, by determining the position of the bit whose value is 1 in the bitmap, it is possible to know which logical blocks in the LUN have data changes.
然而,对于目前多样化的存储技术,特别是可动态扩展的存储技术,如精简配置技术,其对LUN的容量可按需分配,且通常情况下其实际容量远小于最大容量。若仍使用现有的位图技术,则存在如下问题:位图的容量是固定的,如果要确保能够记录LUN中的所有逻辑块是否发生变化,则位图容量必须根据LUN的最大支持容量进行申请,而非LUN的实际容量,故造成对申请的内存资源的浪费。而且,在一般系统中支持多个LUN,如支持1024个LUN的情况下,根据上例,每个1TB的LUN需要申请1G bit容量的位图,则一个系统共需要1024*1G bit=1T bit的内存用作位图,显然,仅用于记录变化的位图也占用了大量的内存资源,如果规格继续增大,如此大内存需求,是存储系统难以支撑的。However, for the current diversified storage technologies, especially dynamically expandable storage technologies such as thin provisioning technology, the capacity of LUNs can be allocated on demand, and usually the actual capacity is much smaller than the maximum capacity. If the existing bitmap technology is still used, the following problems exist: the capacity of the bitmap is fixed, and if it is necessary to ensure that all logical blocks in the LUN are changed, the capacity of the bitmap must be determined according to the maximum supported capacity of the LUN. Application, rather than the actual capacity of the LUN, resulting in a waste of memory resources for the application. Moreover, a general system supports multiple LUNs. For example, in the case of supporting 1024 LUNs, according to the above example, each 1TB LUN needs to apply for a bitmap with a capacity of 1G bit, and a system needs a total of 1024*1G bit=1T bit Obviously, a bitmap that is only used to record changes also takes up a lot of memory resources. If the specification continues to increase, such a large memory requirement will be difficult for the storage system to support.
发明内容Contents of the invention
本申请主要解决的技术问题是提供一种记录存储数据发生变化的方法及装置,能够减少位图占用的存储资源,降低对内存资源的浪费。The technical problem mainly solved by this application is to provide a method and device for recording changes in stored data, which can reduce storage resources occupied by bitmaps and reduce waste of memory resources.
为解决上述技术问题,本申请第一方面提供一种记录存储数据发生变化的方法,所述方法包括以下步骤:确定逻辑单元号LUN中当前变化逻辑块所在的逻辑块区,其中,所述逻辑单元号LUN至少包括两个逻辑块区,所述逻辑块区包含多个逻辑块;查询位图集中是否已存在所述逻辑块区的对应位图,其中,所述位图集用于放置多个位图,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化,所述逻辑块区的对应位图即为记录所述逻辑块区的逻辑块发生变化的位图;如果不存在,则在所述位图集中建立所述逻辑块区的对应位图,并在所述对应位图中记录所述当前变化逻辑块发生变化;如果存在,则直接在所述对应位图中记录所述当前变化逻辑块发生变化。In order to solve the above technical problems, the first aspect of the present application provides a method for recording changes in stored data, the method includes the following steps: determining the logical block area where the currently changed logical block in the logical unit number LUN is located, wherein the logical The unit number LUN includes at least two logical block areas, and the logical block area includes a plurality of logical blocks; query whether the corresponding bitmap of the logical block area already exists in the bitmap set, wherein the bitmap set is used to place multiple bitmaps, each of which is used to record changes in the logical blocks corresponding to one of the logical block areas, and the corresponding bitmap of the logical block areas is the bit that records the changes in the logical blocks of the logical block area Figure; if it does not exist, then set up the corresponding bitmap of the logical block area in the bitmap set, and record the change in the current change logical block in the corresponding bitmap; if it exists, directly in the said corresponding bitmap The change of the current change logic block is recorded in the corresponding bitmap.
结合第一方面,本申请第一方面第一种可能的实施方式为:所述查询位图集中是否已存在所述逻辑块区的对应位图的步骤之前,所述方法还包括:将所述逻辑单元号LUN中的存储数据划分为多个逻辑块;将所述多个逻辑块划分为第一数值个逻辑块区,其中,所述第一数值至少为2;确定每个逻辑块区的对应位图信息,其中,所述逻辑块区的对应位图信息包括所述逻辑块区的对应位图的位数等于所述逻辑块区的逻辑块数,所述逻辑块区的对应位图的每个位分别对应用于记录所述逻辑块区的一个逻辑块是否发生变化,每个位可被设置为第一标记或者第二标记,所述第一标记用于表示该位所对应的逻辑块发生了变化,所述第二标记用于表示该位所对应的逻辑块没有发生变化。With reference to the first aspect, the first possible implementation manner of the first aspect of the present application is: before the step of querying whether the corresponding bitmap of the logical block area already exists in the bitmap set, the method further includes: adding the The storage data in the logical unit number LUN is divided into a plurality of logical blocks; the plurality of logical blocks are divided into a first number of logical block areas, wherein the first numerical value is at least 2; the number of each logical block area is determined Corresponding bitmap information, wherein, the corresponding bitmap information of the logical block area includes that the number of digits of the corresponding bitmap of the logical block area is equal to the number of logical blocks of the logical block area, and the corresponding bitmap of the logical block area Each bit of each corresponds to recording whether a logical block in the logical block area has changed, and each bit can be set as a first flag or a second flag, and the first flag is used to indicate that the bit corresponds to The logic block has changed, and the second flag is used to indicate that the logic block corresponding to the bit has not changed.
结合第一方面的第一种可能的实施方式,本申请第一方面第二种可能的实施方式为:所述在所述对应位图中记录所述当前变化逻辑块发生变化的步骤包括:根据所述逻辑块区的对应位图信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。With reference to the first possible implementation manner of the first aspect, the second possible implementation manner of the first aspect of the present application is: the step of recording the change of the current changed logical block in the corresponding bitmap includes: according to The corresponding bitmap information of the logical block area, find out the bit in the corresponding bitmap for recording whether the current changed logical block has changed, and set the found bit as the first mark, and record the current The change time of the change logic block.
结合第一方面的第二种可能的实施方式,本申请第一方面第三种可能的实施方式为:所述方法还包括:在接收复制命令时,获取所述复制命令中的预设时间条件;在所述位图集中搜索出所述逻辑块发生变化的时间符合所述预设时间条件的位图中的位;将搜索出的位图中的位所对应的逻辑块进行复制操作,在复制完成后将所述搜索出的位图中的位设置为所述第二标记。With reference to the second possible implementation manner of the first aspect, the third possible implementation manner of the first aspect of the present application is: the method further includes: when receiving the copy command, acquiring the preset time condition in the copy command ; Search out the bits in the bitmap whose time the logic block changes meets the preset time condition in the bitmap set; copy the logic block corresponding to the bit in the searched out bitmap, and After the copying is completed, set the bit in the searched bitmap as the second flag.
结合第一方面的第一至三任一种可能的实施方式,本申请第一方面第四种可能的实施方式为:所述方法还包括:检测所述位图集中是否存在所有位均为所述第二标记的位图,如果存在,则将所述位图从位图集中删除。In combination with any of the first to third possible implementation manners of the first aspect, the fourth possible implementation manner of the first aspect of the present application is: the method further includes: detecting whether all bits in the bitmap set are If the bitmap of the second mark exists, the bitmap is deleted from the bitmap set.
为了解决上述技术问题,本申请第二方面提供一种记录存储数据发生变化的装置,所述装置包括确定模块、查询模块、建立模块和记录模块,所述确定模块用于确定逻辑单元号LUN中当前变化逻辑块所在的逻辑块区,并将确定的逻辑块区发生给所述查询模块,其中,所述逻辑单元号LUN至少包括两个逻辑块区,所述逻辑块区包含多个逻辑块;所述查询模块用于查询位图集中是否已存在所述逻辑块区的对应位图,并将查询结果发送给建立模块和记录模块,其中,所述位图集用于放置多个位图,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化,所述逻辑块区的对应位图即为记录所述逻辑块区的逻辑块发生变化的位图;所述建立模块用于在未查询到所述逻辑块区的对应位图时,在所述位图集中建立所述逻辑块区的对应位图,并将所述对应位图发送给所述记录模块;所述记录模块用于在所述对应位图中记录所述当前变化逻辑块发生变化。In order to solve the above technical problems, the second aspect of the present application provides a device for recording changes in stored data. The device includes a determination module, a query module, an establishment module, and a recording module. The determination module is used to determine the logical unit number LUN Currently change the logical block area where the logical block is located, and send the determined logical block area to the query module, wherein the logical unit number LUN includes at least two logical block areas, and the logical block area includes multiple logical blocks ; The query module is used to query whether the corresponding bitmap of the logical block area already exists in the bitmap set, and sends the query result to the establishment module and the recording module, wherein the bitmap set is used to place multiple bitmaps , each of the bitmaps is used to record changes in the logical blocks corresponding to one of the logical block areas, and the corresponding bitmap of the logical block area is the bitmap that records the changes in the logical blocks of the logical block area; The establishment module is used to establish the corresponding bitmap of the logical block area in the bitmap set when the corresponding bitmap of the logical block area is not found, and send the corresponding bitmap to the recording module ; The recording module is used to record the change of the current change logic block in the corresponding bitmap.
结合第二方面,本申请第二方面第一种可能的实施方式为:还包括划分模块,所述划分模块用于将所述逻辑单元号LUN中的存储数据划分为多个逻辑块,将所述多个逻辑块划分为第一数值个逻辑块区,确定每个逻辑块区的对应位图信息,并将所述每个逻辑块区的对应位图信息发送给所述记录模块,其中,所述第一数值至少为2,所述逻辑块区的对应位图信息包括所述逻辑块区的对应位图的位数等于所述逻辑块区的逻辑块数,所述逻辑块区的对应位图的每个位分别对应用于记录所述逻辑块区的一个逻辑块是否发生变化,每个位可被设置为第一标记或者第二标记,所述第一标记用于表示该位所对应的逻辑块发生了变化,所述第二标记用于表示该位所对应的逻辑块没有发生变化。With reference to the second aspect, the first possible implementation manner of the second aspect of the present application is: further comprising a division module, the division module is configured to divide the storage data in the logical unit number LUN into a plurality of logical blocks, and divide the The plurality of logical blocks are divided into a first number of logical block areas, the corresponding bitmap information of each logical block area is determined, and the corresponding bitmap information of each logical block area is sent to the recording module, wherein, The first numerical value is at least 2, the corresponding bitmap information of the logical block area includes the number of bits of the corresponding bitmap of the logical block area equal to the number of logical blocks of the logical block area, and the corresponding bitmap of the logical block area Each bit of the bitmap corresponds to recording whether a logical block of the logical block area has changed, and each bit can be set as a first flag or a second flag, and the first flag is used to represent the The corresponding logic block has changed, and the second flag is used to indicate that the logic block corresponding to the bit has not changed.
结合第二方面的第一种可能的实施方式,本申请第二方面第二种可能的实施方式为:所述记录模块具体用于根据所述逻辑块区的对应位图信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,并记录所述当前变化逻辑块发生变化的时间。With reference to the first possible implementation manner of the second aspect, the second possible implementation manner of the second aspect of the present application is: the recording module is specifically configured to find out the Corresponding to the bit in the bitmap used to record whether the current changing logic block changes, and setting the found bit as the first flag, and recording the time when the current changing logic block changes.
结合第二方面的第二种可能的实施方式,本申请第二方面第三种可能的实施方式为:还包括复制模块,所述复制模块用于在接收复制命令时,获取所述复制命令中的预设时间条件,在所述位图集中搜索出所述逻辑块发生变化的时间符合所述预设时间条件的位图中的位,将搜索出的位图中的位所对应的逻辑块进行复制操作,在复制完成后将所述搜索出的位图中的位设置为所述第二标记。With reference to the second possible implementation manner of the second aspect, the third possible implementation manner of the second aspect of the present application is: further comprising a copying module, the copying module is configured to obtain the According to the preset time condition, the bits in the bitmap whose time the logical block changes meet the preset time condition are searched in the bitmap set, and the logical block corresponding to the bit in the searched bitmap is searched Perform a copy operation, and set the bit in the searched bitmap as the second mark after the copy is completed.
结合第二方面的第一至三任一种可能的实施方式,本申请第二方面第四种可能的实施方式为:还包括删除模块,所述删除模块用于检测所述位图集中是否存在所有位均为所述第二标记的位图,如果存在,则将所述位图从位图集中删除。In combination with any one of the first to third possible implementation manners of the second aspect, the fourth possible implementation manner of the second aspect of the present application is: further comprising a deletion module, the deletion module is used to detect whether there is All bits are the bitmap of the second mark, and if present, the bitmap is deleted from the bitmap set.
通过上述方案,本申请采用位图集来实现记录LUN的存储数据的变化,并在逻辑块发生变化时,才建立该逻辑块的对应位图,区别于固定采用一个位图记录LUN所有存储数据的变化情况的现有技术,本申请采用动态位图方式,使得位图总占用的存储空间与LUN发生变化的逻辑块数对应,实现了位图的按需分配,减少占用存储资源,同时,也提高了位图的利用效率,减少对位图内存资源的浪费。Through the above scheme, this application uses the bitmap set to record the changes of the storage data of the LUN, and only when the logic block changes, the corresponding bitmap of the logic block is established, which is different from the fixed use of a bitmap to record all the storage data of the LUN According to the prior art of changing situations, this application adopts a dynamic bitmap method, so that the total storage space occupied by the bitmap corresponds to the number of logical blocks that change in the LUN, realizing the on-demand allocation of bitmaps and reducing the storage resources occupied. At the same time, It also improves the utilization efficiency of the bitmap and reduces the waste of bitmap memory resources.
附图说明Description of drawings
图1是现有技术中LUN中逻辑块与位图间的对应关系图;FIG. 1 is a diagram of the corresponding relationship between logical blocks and bitmaps in a LUN in the prior art;
图2是本申请记录存储数据发生变化的方法一实施方式的流程图;Fig. 2 is a flowchart of an embodiment of a method for recording and storing data changes in the present application;
图3是本申请记录存储数据发生变化的方法另一实施方式的流程图;Fig. 3 is a flow chart of another embodiment of the method for recording and storing data changes in the present application;
图4是图3所示的记录存储数据发生变化的方法中预先设置每个逻辑块区的逻辑块信息和对应位图信息的流程图;Fig. 4 is a flow chart of pre-setting logical block information and corresponding bitmap information of each logical block area in the method for recording storage data changes shown in Fig. 3;
图5是本申请记录存储数据发生变化的装置进行异步远程复制一实施方式中位图集的结构示意图;Fig. 5 is a schematic structural diagram of a bit atlas in an implementation mode of asynchronous remote replication by a device for recording and storing data changes in the present application;
图6是本申请记录存储数据发生变化的装置进行同步远程复制一实施方式中位图集的结构示意图;Fig. 6 is a schematic structural diagram of a bit atlas in an embodiment of synchronous remote replication of a device for recording and storing data changes in the present application;
图7是本申请记录存储数据发生变化的装置一实施方式的结构示意图;FIG. 7 is a schematic structural diagram of an embodiment of a device for recording and storing data changes in the present application;
图8是本申请记录存储数据发生变化的装置另一实施方式的结构示意图;Fig. 8 is a schematic structural diagram of another embodiment of the device for recording and storing data changes in the present application;
图9是本申请记录存储数据发生变化的装置再一实施方式的结构示意图。Fig. 9 is a schematic structural diagram of another embodiment of the device for recording and storing data changes in the present application.
具体实施方式detailed description
下面结合附图和具体的实施方式进行说明。The following description will be made in conjunction with the accompanying drawings and specific implementation manners.
请参阅图2,图2是本申请记录存储数据发生变化的方法一实施方式的流程图。本实施方式中,所述方法包括以下步骤:Please refer to FIG. 2 . FIG. 2 is a flowchart of an embodiment of a method for recording and storing data changes in the present application. In this embodiment, the method includes the following steps:
步骤S201:记录存储数据发生变化的装置确定LUN中当前变化逻辑块所在的逻辑块区。Step S201: The device for recording changes in stored data determines the logical block area where the currently changed logical block is located in the LUN.
本实施方式中,LUN采用精简配置(thin)技术,所述LUN可进行动态扩展。其中,所述LUN作为存储空间,至少包括两个逻辑块区,所述逻辑块区包含多个逻辑块,每个逻辑块定义为一定容量大小的存储数据。本实施方式中,LUN中每个逻辑块均分配有不同的逻辑块号,将每个逻辑块区的逻辑块信息预先保存在本地,例如,第一逻辑块区包含逻辑块0和1,第二逻辑块区包含逻辑块2和3……如此类推。在LUN中的逻辑块发生变化时,记录存储数据发生变化的装置获取LUN中当前变化逻辑块的逻辑块号,预设的逻辑块区与逻辑块间的关系为每个逻辑块包括两个逻辑块,确定所述当前变化逻辑块所在的逻辑块区。In this implementation manner, the LUN adopts thin provisioning (thin) technology, and the LUN can be dynamically expanded. Wherein, as a storage space, the LUN includes at least two logical block areas, and the logical block area includes a plurality of logical blocks, and each logical block is defined as storing data with a certain capacity. In this embodiment, each logical block in the LUN is assigned a different logical block number, and the logical block information of each logical block area is pre-stored locally. For example, the first logical block area includes logical blocks 0 and 1, and the logical block area of the second The second logical block area contains logical blocks 2 and 3...and so on. When a logical block in the LUN changes, the device for recording and storing data changes obtains the logical block number of the currently changed logical block in the LUN. The preset relationship between the logical block area and the logical block is that each logical block includes two logical blocks. block, determining the logical block area where the currently changed logical block is located.
步骤S202:查询位图集中是否已存在所述逻辑块区的对应位图。Step S202: Query whether the corresponding bitmap of the logical block already exists in the bitmap set.
本申请中,LUN中的逻辑块上的存储数据发生变化即为LUN中的逻辑块发生变化。在LUN中的逻辑块发生变化时,记录存储数据发生变化的装置采用所述位图集记录所述LUN中逻辑块发生变化的情况。所述位图集可以不同的数据结构方式(如树结构、列表)保存在存储介质中,优化地,所述装置也可将位图集暂存在缓存中,以加速位图空间的处理,并定时将缓存中的位图集数据存放在永久存储介质,例如硬盘、flash。具体地,所述位图集用于放置多个位图,其中,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化。In this application, a change in storage data on a logical block in the LUN is a change in the logical block in the LUN. When the logical block in the LUN changes, the device for recording the change of stored data uses the bitmap set to record the change of the logical block in the LUN. The bitmap set can be stored in the storage medium in different data structures (such as tree structure, list). Optimally, the device can also temporarily store the bitmap set in the cache to speed up the processing of the bitmap space, and Regularly store the bitmap set data in the cache in permanent storage media, such as hard disk and flash. Specifically, the bitmap set is used to place a plurality of bitmaps, wherein each bitmap is used to record a change of a logical block corresponding to one of the logical block areas.
具体,所述装置本地预设有LUN中每个逻辑块区的对应位图信息。当LUN中的逻辑块发生变化时,记录存储数据发生变化的装置根据预设的对应位图信息获得当前变化逻辑块所在的逻辑块区的对应位图信息,并查询位图集中是否包括获取的对应位图信息,如果不包括,即位图集中不存在当前变化逻辑块的逻辑块区的对应位图,则执行步骤S203,如果包括,即位图集中已存在当前变化逻辑块的逻辑块区的对应位图,则执行步骤S204。其中,所述逻辑块区的对应位图即为记录所述逻辑块区的逻辑块发生变化的位图。Specifically, the device is locally preset with corresponding bitmap information of each logical block in the LUN. When the logical block in the LUN changes, the device for recording and storing data changes obtains the corresponding bitmap information of the logical block area where the currently changed logical block is located according to the preset corresponding bitmap information, and queries whether the acquired bitmap is included in the bitmap set. Corresponding bitmap information, if not included, that is, there is no corresponding bitmap of the logical block area of the current changing logical block in the bitmap set, then step S203 is performed, if included, that is, the corresponding bitmap of the logical block area of the current changing logical block already exists in the bitmap set bitmap, execute step S204. Wherein, the corresponding bitmap of the logical block area is a bitmap that records changes of logical blocks in the logical block area.
举例说明,LUN中划分为16个逻辑块区,每个逻辑块区包括8个逻辑块。记录存储数据发生变化的装置预先设置每个逻辑块区的对应位图信息为第一逻辑块区的对应位图为第一位图,第二逻辑块区的对应位图为第二位图……如此类推,且每个位图包括8个位,每个位用于记录一个逻辑块是否发生变化。对应地,第一位图对应用于记录第一逻辑块区,即第1到8个逻辑块,第二位图对应用于记录第二逻辑块区,即第9到16个逻辑块,第三位图对应用于记录第三逻辑块区,即第17到24个逻辑块……如此类推。在LUN中的第10、15个逻辑块发生变化时,所述装置确定所述当前变化的逻辑块位于第二逻辑块区,根据上述预设的逻辑块区对应位图信息,获得所述第二逻辑块区的对应位图信息为第二位图,所述装置查询当前的位图集中建立的位图的信息是否包括第二位图信息,如果包括,则位图集中已建立第二逻辑块区的对应位图,如果不包括,则位图集中未建立第二逻辑块区的对应位图。For example, a LUN is divided into 16 logical block areas, and each logical block area includes 8 logical blocks. The device for recording and storing data changes presets the corresponding bitmap information of each logical block area as the corresponding bitmap of the first logical block area as the first bitmap, and the corresponding bitmap of the second logical block area as the second bitmap... ...and so on, and each bitmap includes 8 bits, and each bit is used to record whether a logical block has changed. Correspondingly, the first bitmap is used to record the first logical block area, that is, the 1st to 8th logical blocks, and the second bitmap is used to record the second logical block area, that is, the 9th to 16th logical blocks, and the second bitmap is used to record the second logical block area, that is, the 9th to 16th logical blocks. The three-bit map is correspondingly used to record the third logical block area, that is, the 17th to 24th logical blocks...and so on. When the 10th and 15th logical blocks in the LUN change, the device determines that the currently changed logical block is located in the second logical block area, and obtains the second logical block area according to the bitmap information corresponding to the preset logical block area The corresponding bitmap information of the two logical block areas is the second bitmap, and the device inquires whether the information of the bitmap established in the current bitmap set includes the second bitmap information, and if so, the second logical bitmap has been established in the bitmap set If the corresponding bitmap of the block area is not included, the corresponding bitmap of the second logical block area is not established in the bitmap set.
步骤S203:在所述位图集中建立所述逻辑块区的对应位图,并在所述对应位图中记录所述当前变化逻辑块发生变化。Step S203: Create a corresponding bitmap of the logical block area in the bitmap set, and record the change of the currently changed logical block in the corresponding bitmap.
如果在位图集中未查询到所述当前变化逻辑块所在的逻辑块区的对应位图,则记录存储数据发生变化的装置在所述位图集中建立所述当前变化逻辑块所在的逻辑块区的对应位图,并且在所述对应位图中记录所述当前变化逻辑块发生变化,例如,将对应位图中对应当前变化逻辑块的位设置为第一标记,以标识该位对应的逻辑块发生变化,而对应位图中对应没有发生变化的逻辑块的位则设置为第二标记,以标识该位所对应的逻辑块没有发生变化。If the corresponding bitmap of the logical block area where the currently changed logical block is located is not found in the bitmap set, the device for recording and storing data changes establishes the logical block area where the currently changed logical block is located in the bitmap set The corresponding bitmap of the corresponding bitmap, and the change of the current change logic block is recorded in the corresponding bitmap, for example, the bit corresponding to the current change logic block in the corresponding bitmap is set as the first mark to identify the logic block corresponding to the bit When the block changes, the bit corresponding to the logical block that has not changed in the corresponding bitmap is set as the second flag to identify that the logical block corresponding to the bit has not changed.
步骤S204:直接在所述对应位图中记录所述当前变化逻辑块发生变化。Step S204: Directly record the change of the current changed logic block in the corresponding bitmap.
如果在位图集中查询到所述当前变化逻辑块所在的逻辑块区的对应位图,则记录存储数据发生变化的装置在所述对应位图中记录所述当前变化逻辑块发生变化,例如,将对应位图中对应当前变化逻辑块的位设置为第一标记,以标识该位对应的逻辑块发生变化,而对应位图中对应没有发生变化的逻辑块的位则设置为第二标记,以标识该位所对应的逻辑块没有发生变化。If the corresponding bitmap of the logical block area where the currently changed logical block is located is found in the bitmap set, the device for recording the change of the stored data records the change of the current changed logical block in the corresponding bitmap, for example, The bit corresponding to the current changing logical block in the corresponding bitmap is set as the first mark to identify that the logical block corresponding to the bit has changed, and the bit corresponding to the logical block that has not changed in the corresponding bitmap is set as the second mark, To identify that the logic block corresponding to this bit has not changed.
本实施方式中,采用位图集方式记录LUN中的逻辑块是否发生变化,将LUN分为多个逻辑块区,一个逻辑块区对应一个位图,且位图集中的位图产生条件为:在逻辑块发生变化时,才建立所述逻辑块所在的逻辑块区的对应位图,无需产生没有发生变化的逻辑块区的对应位图,实现了位图按需分配,减少对位图空间的浪费,同时,也减少了总位图占用的存储资源。In this embodiment, a bitmap set is used to record whether the logical blocks in the LUN have changed, and the LUN is divided into multiple logical block areas, one logical block area corresponds to a bitmap, and the bitmap generation conditions in the bitmap set are: When the logical block changes, the corresponding bitmap of the logical block area where the logical block is located is established, and there is no need to generate the corresponding bitmap of the logical block area that has not changed, realizing the allocation of bitmaps on demand and reducing the bitmap space At the same time, it also reduces the storage resources occupied by the total bitmap.
需要说明的是,本实施方式中的LUN采用精简配置技术,但在其他实施方式中,所述LUN还可采用其他可进行动态扩展的技术,或者LUN的不可进行动态扩展,其容量固定大小,其LUN的具体种类并不影响本申请方法的实施,故在此不对LUN进行具体限定。It should be noted that the LUN in this embodiment adopts the thin provisioning technology, but in other embodiments, the LUN can also adopt other technologies that can be dynamically expanded, or the LUN cannot be dynamically expanded, and its capacity is fixed. The specific type of the LUN does not affect the implementation of the method of the present application, so the LUN is not specifically limited here.
请参阅图3,图3是本申请记录存储数据发生变化的方法另一实施方式的流程图。本实施方式中,所述方法包括以下步骤:Please refer to FIG. 3 . FIG. 3 is a flow chart of another embodiment of the method for recording and storing data changes in the present application. In this embodiment, the method includes the following steps:
步骤S301:记录存储数据发生变化的装置确定LUN中当前变化逻辑块所在的逻辑块区。Step S301: The device for recording changes in stored data determines the logical block area where the currently changed logical block is located in the LUN.
具体地,请参阅图4,在采用位图集以记录逻辑块发生变化情况之前,本方法还包括预先设置每个逻辑块区的逻辑块信息和对应位图信息,具体为:Specifically, please refer to FIG. 4. Before using the bitmap set to record the change of the logical block, the method also includes presetting the logical block information and corresponding bitmap information of each logical block area, specifically:
步骤S401:将所述LUN中的存储数据划分为多个逻辑块。Step S401: Divide the storage data in the LUN into multiple logical blocks.
记录存储数据发生变化的装置将LUN中的存储数据划分为多个逻辑块,例如,LUN当前分配的容量为1GB,所述装置将LUN划分为1024个容量为1KB的逻辑块,每个逻辑块分配有不同的逻辑块号,例如,逻辑块0、逻辑块1、逻辑块2等。The device for recording changes in stored data divides the stored data in the LUN into multiple logical blocks. For example, the currently allocated capacity of the LUN is 1GB, and the device divides the LUN into 1024 logical blocks with a capacity of 1KB. Each logical block Different logical block numbers are assigned, for example, logical block 0, logical block 1, logical block 2, and so on.
步骤S402:将所述多个逻辑块划分为第一数值个逻辑块区,其中,所述第一数值至少为2。Step S402: Divide the plurality of logical blocks into a first number of logical block areas, wherein the first number is at least 2.
例如,LUN中包括有1024个逻辑块,将1024个逻辑块划分为128个逻辑块区,每个逻辑块区包括8个逻辑块,如第一逻辑块区包括逻辑块0至7、第二逻辑块区包括逻辑块8至15……如此类推。For example, a LUN includes 1024 logical blocks, and the 1024 logical blocks are divided into 128 logical block areas, and each logical block area includes 8 logical blocks. For example, the first logical block area includes logical blocks 0 to 7, and the second The logical block area includes logical blocks 8 to 15 . . . and so on.
当然,所述装置未必按顺序划分逻辑块,在其他实施方式中,根据实际情况需要,可将LUN中不是连续的逻辑块划分在一个逻辑块区,而且,每个逻辑块区的逻辑块数并不限定为全部相同,此时,在所述装置划分好逻辑块区后,需将每个逻辑块区的逻辑块信息(如逻辑块号)保存在本地,以使所述装置能够根据保存的逻辑块信息确定LUN中逻辑块所在的逻辑块区。Of course, the device does not necessarily divide the logical blocks in order. In other implementations, according to actual needs, non-contiguous logical blocks in the LUN can be divided into one logical block area, and the number of logical blocks in each logical block area It is not limited to all being the same. At this time, after the device divides the logical block area, the logical block information (such as the logical block number) of each logical block area needs to be saved locally, so that the device can save The logical block information determines the logical block area where the logical block in the LUN is located.
步骤S403:确定每个逻辑块区的对应位图信息。Step S403: Determine the corresponding bitmap information of each logical block.
所述装置为LUN中每个逻辑块区对应设置一个对应位图信息,并将每个逻辑块区的对应位图信息保存在本地,其中,所述逻辑块区的对应位图信息包括所述逻辑块区的对应位图的位数等于所述逻辑块区的逻辑块数,所述逻辑块区的对应位图的每个位分别对应用于记录所述逻辑块区的一个逻辑块是否发生变化,每个位可被设置为第一标记或者第二标记,所述第一标记用于表示该位所对应的逻辑块发生了变化,所述第二标记用于表示该位所对应的逻辑块没有发生变化。例如,所述第一标记为1,第二标记为0,当逻辑块发生变化时,则将对应该逻辑块的位置1,如果逻辑块没有发生变化,则将对应该逻辑块的位置0,通过判断该位为0还是1,则可知道该位对应的逻辑块是否发生变化。The device sets a corresponding bitmap information for each logical block area in the LUN, and saves the corresponding bitmap information of each logical block area locally, wherein the corresponding bitmap information of the logical block area includes the The number of digits of the corresponding bitmap of the logical block area is equal to the number of logical blocks of the logical block area, and each bit of the corresponding bitmap of the logical block area is respectively corresponding to whether a logical block used to record the logical block area occurs Change, each bit can be set as the first mark or the second mark, the first mark is used to indicate that the logic block corresponding to the bit has changed, and the second mark is used to indicate that the logic block corresponding to the bit The block has not changed. For example, the first mark is 1, and the second mark is 0. When the logic block changes, it will correspond to the position 1 of the logic block. If the logic block does not change, it will correspond to the position 0 of the logic block. By judging whether the bit is 0 or 1, it can be known whether the logic block corresponding to the bit has changed.
记录存储数据发生变化的装置通过上述步骤S401-S403,进行预设每个逻辑块区的逻辑块信息和对应位图信息后,所述装置在逻辑块发生变化时,则执行步骤S301-S308,以采用位图集记录发生变化的逻辑块情况。After the device for recording and storing data changes has preset the logical block information and corresponding bitmap information of each logical block area through the above steps S401-S403, the device executes steps S301-S308 when the logical block changes, A bitmap set is used to record the changed logic blocks.
本实施方式中,在LUN中的逻辑块发生变化时,记录存储数据发生变化的装置获取当前变化的逻辑块信息,并根据预设逻辑块区与逻辑块间的关系或者保存的每个逻辑块区的逻辑块信息,确定LUN中当前变化逻辑块所在的逻辑块区。例如,LUN中逻辑块顺序分配为多个逻辑块区,且每个逻辑块区均包括8个逻辑块,即第一逻辑块区包括逻辑块0-7,第二逻辑块区包括逻辑块8-16……当逻辑块20发生变化时,所述装置获取发生变化的逻辑块号为20,根据预设逻辑块区与逻辑块间的关系为每个逻辑块区均包括8个逻辑块,即可计算出发生变化的逻辑块所在的逻辑块区为第三逻辑块区。或者,在本地保存有每个逻辑块区的逻辑块信息时,所述装置可直接根据保存的信息,确定当前变化逻辑块所在的逻辑块区。In this embodiment, when the logical block in the LUN changes, the device for recording and storing data changes acquires the currently changed logical block information, and according to the relationship between the preset logical block area and the logical block or the saved logical block The logical block information of the area determines the logical block area where the currently changing logical block in the LUN is located. For example, logical blocks in a LUN are sequentially allocated into multiple logical block areas, and each logical block area includes 8 logical blocks, that is, the first logical block area includes logical blocks 0-7, and the second logical block area includes logical block 8. -16...When the logical block 20 changes, the device obtains the changed logical block number as 20, and according to the relationship between the preset logical block area and the logical block, each logical block area includes 8 logical blocks, That is, it can be calculated that the logical block area where the changed logical block is located is the third logical block area. Alternatively, when the logical block information of each logical block area is saved locally, the device may directly determine the logical block area where the currently changed logical block is located according to the stored information.
步骤S302:查询位图集中是否已存在所述逻辑块区的对应位图。Step S302: Query whether the corresponding bitmap of the logical block already exists in the bitmap set.
本实施方式中,在LUN中的逻辑块发生变化时,记录存储数据发生变化的装置采用所述位图集记录所述LUN中逻辑块发生变化的情况。所述位图集可以不同的数据结构方式(如树结构、列表)保存在存储介质中,优化地,所述装置也可将位图集暂存在缓存中,并定时将缓存中的位图集数据存放在永久存储介质,例如硬盘、flash。具体地,所述位图集用于放置多个位图,其中,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化。In this embodiment, when the logical block in the LUN changes, the device for recording the change of the stored data uses the bitmap set to record the change of the logical block in the LUN. The bitmap set can be stored in the storage medium in different data structures (such as tree structure, list). Optimally, the device can also temporarily store the bitmap set in the cache, and regularly store the bitmap set in the cache Data is stored in permanent storage media, such as hard disks and flash. Specifically, the bitmap set is used to place a plurality of bitmaps, wherein each bitmap is used to record a change of a logical block corresponding to one of the logical block areas.
具体,当LUN中的逻辑块发生变化时,记录存储数据发生变化的装置根据预设的每个逻辑块区的对应位图信息,获得当前变化逻辑块所在的逻辑块区的对应位图信息,并查询位图集中是否已存在当前变化逻辑块的逻辑块区的对应位图,如果不存在,则执行步骤S303,如果存在,则执行步骤S304。其中,所述逻辑块区的对应位图即为记录所述逻辑块区的逻辑块发生变化的位图。Specifically, when the logical block in the LUN changes, the device for recording and storing data changes obtains the corresponding bitmap information of the logical block area where the currently changed logical block is located according to the preset corresponding bitmap information of each logical block area, And inquire whether the corresponding bitmap of the logical block area of the current changed logical block exists in the bitmap set, if not, execute step S303, and if yes, execute step S304. Wherein, the corresponding bitmap of the logical block area is a bitmap that records changes of logical blocks in the logical block area.
步骤S303:在所述位图集中建立所述逻辑块区的对应位图,根据所述逻辑块区的对应位图信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。Step S303: Establish the corresponding bitmap of the logical block area in the bitmap set, and find out whether the current changed logical block in the corresponding bitmap is recorded according to the corresponding bitmap information of the logical block area change bits, and set the found bits as the first mark to record the time when the current change logic block changes.
如果在位图集中未查询到所述当前变化逻辑块所在的逻辑块区的对应位图,则所述装置在位图树中插入节点,该插入的节点携带所述当前变化逻辑块所在的逻辑块区的对应位图,以实现在所述位图集中建立所述当前变化逻辑块的对应位图。并且,所述装置根据所述逻辑块区的对应位图信息中对应位图每个位对应的逻辑块信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。If the corresponding bitmap of the logical block area where the current changed logical block is located is not found in the bitmap set, the device inserts a node in the bitmap tree, and the inserted node carries the logical block where the currently changed logical block is located. The corresponding bitmap of the block area, so as to realize the establishment of the corresponding bitmap of the current changing logical block in the bitmap set. And, the device finds out the information in the corresponding bitmap for recording whether the current changed logical block has changed according to the logical block information corresponding to each bit of the corresponding bitmap in the corresponding bitmap information of the logical block area. bit, and set the found bit as the first mark to record the time when the current change logic block changes.
另外,本实施方式中,将当前变化逻辑块发生变化的时间以列表形式记录在内存中,当然,在其他实施方式中,还可以其他方式记录当前变化逻辑块发生变化的时间,在此不作限定。In addition, in this embodiment, the time when the current change logic block changes is recorded in the memory in the form of a list. Of course, in other embodiments, the time when the current change logic block changes can also be recorded in other ways, which is not limited here .
步骤S304:根据所述逻辑块区的对应位图信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。Step S304: According to the corresponding bitmap information of the logical block area, find out the bit in the corresponding bitmap for recording whether the current changed logical block has changed, and set the found bit as the first flag, Record the time when the current change logic block changes.
如果在位图集中查询到所述当前变化逻辑块所在的逻辑块区的对应位图,则记录存储数据发生变化的装置根据所述逻辑块区的对应位图信息中对应位图每个位对应的逻辑块信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。If the corresponding bitmap of the logical block area where the current changed logical block is located is found in the bitmap set, the device for recording and storing data changes corresponds to each bit of the corresponding bitmap in the corresponding bitmap information of the logical block area. Logical block information, find out the bit used to record whether the current changing logical block changes in the corresponding bitmap, and set the found bit as the first mark, and record the change in the current changing logical block time.
步骤S305:在接收复制命令时,获取所述复制命令中的预设时间条件。Step S305: when receiving the copy command, acquire the preset time condition in the copy command.
进一步地,本申请记录存储数据发生变化的方法应用于远程复制技术(如异步远程复制、同步远程复制等)时,即如果主机上LUN的逻辑块数据发生变化,则执行上述步骤S301至S304以记录所述逻辑块发生变化,并且将主机上发生变化的逻辑块复制到从机上的LUN中。记录存储数据发生变化的装置接收到将主机发生变化的逻辑块复制到从机中的复制命令时,对所述复制命令进行解析,获得命令中包括的预设时间条件。Furthermore, when the method for recording storage data changes in this application is applied to remote replication technologies (such as asynchronous remote replication, synchronous remote replication, etc.), that is, if the logical block data of the LUN on the host changes, the above steps S301 to S304 are executed to Record the change of the logical block, and copy the changed logical block on the host to the LUN on the slave. When the device for recording changes in stored data receives a copy command for copying the changed logical blocks of the master to the slave, it analyzes the copy command to obtain the preset time conditions included in the command.
步骤S306:在所述位图集中搜索出所述逻辑块发生变化的时间符合所述预设时间条件的位图中的位。Step S306: Searching for bits in the bitmap whose change time of the logic block meets the preset time condition in the bitmap set.
记录存储数据发生变化的装置遍历记录的所述位图集中所有位图的所有位上对应记录的逻辑块发生变化的时间,并搜索出逻辑块发生变化的时间符合预设时间条件的位图中的位。The device for recording the change of stored data traverses the time when the corresponding recorded logical block changes on all bits of all the bitmaps in the recorded bitmap set, and searches out the bitmap where the time when the logical block changes meets the preset time condition bits.
步骤S307:将搜索出的位图中的位所对应的逻辑块进行复制操作,在复制完成后将所述搜索出的位图中的位设置为所述第二标记。Step S307: Perform a copy operation on the logical block corresponding to the bit in the searched bitmap, and set the bit in the searched bitmap as the second flag after the copying is completed.
记录存储数据发生变化的装置根据搜索出的位图中的位,查找出所述搜索出的位图中的位对应的LUN中的逻辑块,并将查找出的逻辑块复制到从机中,在复制完成后,将所述搜索出的位图中的位设置为所述第二标记。The device for recording the change of the stored data finds the logical block in the LUN corresponding to the bit in the searched bitmap according to the bit in the searched out bitmap, and copies the found logical block to the slave, After the copying is completed, set the bit in the searched bitmap as the second flag.
进一步地,在所述方法应用于一主多从远程分享的实施方式中,所述位图还设置有共享标识,所述共享标识用于标识共享从设备对所述位图记录的发生变化的逻辑块是否已进行共享,其中,所述共享标识为第一共享标识时,则表示所有共享从设备对所述位图记录的发生变化的逻辑块已进行共享,所述共享标识为第二共享标识时,则表示共享从设备对所述位图记录的发生变化的逻辑块未完成共享。所述记录存储数据发生变化的装置在将查找出的逻辑块复制到从机后,如果判断所述共享标识为第一共享标识,即表示所有共享从设备对所述位图记录的发生变化的逻辑块已进行共享,则将所述搜索出的位图中的位设置为所述第二标记。例如,一主五从的远程复制中,主机LUN的逻辑块发生变化并记录在对应位图上,且将所述位图的共享标识设置为5。每个从机从主机LUN中完成复制所述变化的逻辑块时,将共享标识减1,当五个从机均完成复制时,所述共享标识为0。当所述装置检测到所述共享标识为0时,则将所述搜索出的位图中的位设置为所述第二标记。本申请可以通过在位图中设置共享标识,使得位图中携带各共享从设备的共享情况,而无需对每个共享从设备配置位图集,减少了对存储资源的占用。Further, in the embodiment where the method is applied to remote sharing by one master and multiple slaves, the bitmap is also provided with a sharing identifier, and the sharing identifier is used to identify the changes made by the shared slave device to the bitmap record. Whether the logical block has been shared, wherein, when the shared identification is the first shared identification, it means that all shared slave devices have shared the changed logical block recorded in the bitmap, and the shared identification is the second shared When identified, it means that the shared slave device has not completed the sharing of the changed logical block recorded in the bitmap. After the device for recording and storing data changes copies the found logical block to the slave, if it judges that the shared identifier is the first shared identifier, it means that all shared slave devices have changed the bitmap records. If the logical block has been shared, then set the bit in the searched bitmap as the second flag. For example, in the remote replication of one master and five slaves, the logical block of the host LUN changes and is recorded in the corresponding bitmap, and the sharing identifier of the bitmap is set to 5. When each slave completes copying the changed logical block from the host LUN, the sharing identifier is decremented by 1, and when all five slaves complete copying, the sharing identifier is 0. When the device detects that the sharing identifier is 0, set the bit in the searched bitmap as the second flag. In the present application, by setting the sharing identifier in the bitmap, the bitmap carries the sharing status of each shared slave device without configuring a bitmap set for each shared slave device, thereby reducing the occupation of storage resources.
本实施方式中,在进行对发生变化的逻辑块进行复制时,以逻辑块发生变化的时间为基准,选择将某一段时间段或者某一时刻的逻辑块进行复制,提高了复制的灵活性,且在将时间条件设置为执行复制的时间之前时,可使所述装置对复制过程中发生变化的逻辑块不作复制处理,以避免复制与逻辑块发生变化同步发生时,容易出现遗漏对同步发生的部分逻辑块进行复制,或者在对某一逻辑块完成复制时,所述逻辑块再次发生变化,进而无法实现从机对应逻辑块数据的更新等情况。In this embodiment, when copying a changed logical block, based on the time when the logical block changes, a certain period of time or a certain moment of logical block is selected to be copied, which improves the flexibility of copying. And when the time condition is set to before the time to perform the copy, the device can be made not to copy the logical block that changes during the copy process, so as to avoid the synchronous occurrence of the copy and the change of the logical block, which is prone to omission and synchronous occurrence Part of the logic block is copied, or when the copy of a certain logic block is completed, the logic block changes again, and then the update of the corresponding logic block data of the slave cannot be realized.
步骤S308:检测所述位图集中是否存在所有位均为第二标记的位图,如果存在,则将所述位图从位图集中删除。Step S308: Detect whether there is a bitmap whose bits are all the second marks in the bitmap set, and if so, delete the bitmap from the bitmap set.
记录存储数据发生变化的装置定时或者在接收到检测命令时,检测位图集中是否存在所有位均为第二标识的位图,如果存在,则表示所述位图对应的逻辑块当前均无发生变化,故将所述所有位均为第二标识的位图从位图集中删除。Record the timing of the device when the stored data changes or when a detection command is received, detect whether there is a bitmap in the bitmap set that all bits are the second identifier, and if it exists, it means that the logical block corresponding to the bitmap does not currently occur change, so the bitmap whose all bits are the second identifier is deleted from the bitmap set.
举第一例进行说明,请参阅图5,本申请方法应用在异步远程复制中,其中,异步远程复制即为每隔一段时间,将主机上LUN中发生变化的存储数据复制到从机LUN中。同时,每当主机上LUN中的逻辑块数据发生变化,所述装置执行上述步骤S301至S304,以记录当前变化逻辑块发生了变化和发生变化的时间。如图5,t0、t1、t2、t3表示每个位图对应逻辑块发生变化的时间,其中t0<t1<t2<t3。在接收到复制命令时,则启动主从数据同步,其中所述复制命令包括的预设时间条件为:所需复制的逻辑块发生变化时间为t0至t2。根据上述预设时间条件可将位图集分成两个区域:同步区,包括当前需要同步的逻辑块所在逻辑块区对应位图(t0、t1、t2);未同步区,包括当前不需同步的逻辑块所在逻辑块区的对应位图(t3)。一般,LUN数据每发生变化一次,则执行同步一次,且每执行一次同步则更新一次时间点,故同步区中一般只包括一个时间点的位图。而本例中,同步区包括多个时间点的位图t0、t1、t2,则由于在之前执行同步t0、t1时间点的位图过程中,由于用户中断或者设备出现故障,导致没有同步完成,故仍遗留部分t0、t1时间点的位图。在本次同步中,所述装置将同步区中t0、t1、t2的位图对应的主机LUN中逻辑块数据复制到从机LUN上,实现主从数据的同步,其中,每同步一个逻辑块,则将该逻辑块所在逻辑块区的对应位图的对应位设置为第二标记,当所述装置检测到位图集中有位图的所有位均为第二标记时,则删除该位图。并且,在同步过程中,如果主机LUN逻辑块发生变化,则将对应位图记录在未同步区。Take the first example for illustration, please refer to Figure 5, the application method is applied in asynchronous remote replication, wherein asynchronous remote replication is to copy the storage data that changes in the LUN on the host to the LUN of the slave at regular intervals . At the same time, whenever the logical block data in the LUN on the host changes, the device executes the above steps S301 to S304 to record the change and the time when the current changed logical block occurs. As shown in Figure 5, t0, t1, t2, and t3 represent the time when each bitmap corresponds to a change in the logical block, where t0<t1<t2<t3. When a copy command is received, master-slave data synchronization is started, wherein the preset time condition included in the copy command is: the change time of the logical block to be copied is from t0 to t2. According to the above preset time conditions, the bitmap set can be divided into two areas: synchronization area, including the corresponding bitmap (t0, t1, t2) of the logical block area where the current logical block needs to be synchronized; unsynchronized area, including the current non-synchronization The corresponding bitmap (t3) of the logical block area where the logical block is located. Generally, each time the LUN data changes, the synchronization is performed once, and the time point is updated every time the synchronization is performed, so the synchronization area generally only includes a bitmap of one time point. In this example, the synchronization area includes bitmaps t0, t1, and t2 at multiple time points. During the previous synchronization of bitmaps at time points t0 and t1, the synchronization was not completed due to user interruption or device failure. , so part of the bitmaps at time points t0 and t1 are still left. In this synchronization, the device copies the logical block data in the host LUN corresponding to the bitmaps of t0, t1, and t2 in the synchronization area to the slave LUN to realize the synchronization of the master-slave data, wherein each time a logical block is synchronized , then set the corresponding bit of the corresponding bitmap of the logical block area where the logical block is located as the second mark, and when the device detects that all bits of the bitmap in the bitmap set are the second mark, the bitmap is deleted. And, during the synchronization process, if the logical block of the host LUN changes, the corresponding bitmap will be recorded in the unsynchronized area.
举第二例进行说明,请参阅图6,本申请方法应用在同步远程复制中,其中,同步远程复制即为当主机上LUN中存储数据发生变化时,立刻将主机上LUN中发生变化的存储数据复制到从机LUN中。与第一例类似,位图集分两个区:同步区(t4对应的位图)和未同步区(t5对应的位图),其中,t4对应的位图为当前变化逻辑块所在逻辑块区对应的位图,t5对应的位图为同步过程中发生变化的逻辑块所在逻辑块区的对应位图。在主机上LUN中存储数据发生变化时,所述装置执行上述步骤S301至S304,以记录当前变化逻辑块发生了变化和发生变化的时间t4,并且,所述装置执行复制命令,所述复制命令的预设时间条件即为当前发生变化的时间t4或之前,本例的位图集中满足该条件的只有t4对应的位图,故将t4放入同步区。所述装置根据复制命令将同步区中t4的位图对应的主机LUN中逻辑块数据复制到从机LUN上,实现主从数据的同步,其中,每同步一个逻辑块,则将该逻辑块所在逻辑块区的对应位图的对应位设置为第二标记,当所述装置检测到位图集中有位图的所有位均为第二标记时,则删除该位图。并且,在同步过程中,如果主机LUN逻辑块发生变化,则将对应位图(即t5对应的位图)记录在未同步区。Take the second example for illustration. Please refer to Figure 6. The method of this application is applied in synchronous remote replication. Synchronous remote replication means that when the data stored in the LUN on the host changes, the storage The data is copied to the slave LUN. Similar to the first example, the bitmap set is divided into two areas: the synchronization area (the bitmap corresponding to t4) and the unsynchronized area (the bitmap corresponding to t5), where the bitmap corresponding to t4 is the logic block where the current change logic block is located The bitmap corresponding to the area, and the bitmap corresponding to t5 is the corresponding bitmap of the logical block area where the logical block changed during the synchronization process is located. When the data stored in the LUN on the host changes, the device performs the above steps S301 to S304 to record the change and the time t4 when the current changed logical block occurs, and the device executes the copy command, the copy command The preset time condition of is the current change time t4 or before. Only the bitmap corresponding to t4 in the bitmap set in this example meets this condition, so t4 is put into the synchronization area. According to the copy command, the device copies the logical block data in the master LUN corresponding to the bitmap of t4 in the synchronization area to the slave LUN to realize the synchronization of the master-slave data. Wherein, each time a logical block is synchronized, the The corresponding bit of the corresponding bitmap in the logical block area is set as the second mark, and when the device detects that all the bits of the bitmap in the bitmap set are the second mark, the bitmap is deleted. And, during the synchronization process, if the logical block of the host LUN changes, the corresponding bitmap (that is, the bitmap corresponding to t5) will be recorded in the unsynchronized area.
需要说明的是,上述举例中,本申请记录存储数据发生变化的方法应用在远程复制中,但并不以此作为限定,本申请所述方法还可应用在其他任意需要记录存储数据发生变化的情况中。It should be noted that, in the above examples, the method for recording and storing data changes in this application is applied in remote replication, but this is not a limitation. The method described in this application can also be applied to any other situation that needs to record and store data changes. situation.
另外,本申请在记录逻辑块发生变化时,未必限定为需记录发生变化的时间,以区分不同时间段变化的逻辑块。必须申明的是,本申请方法可根据实际情况记录逻辑块的其他信息作为区分,如记录逻辑块所在存储位置等,故在此本申请对记录逻辑块发生变化的具体步骤不作任何限定。In addition, when recording changes in logical blocks in the present application, it is not necessarily limited to recording the time of changes, so as to distinguish logical blocks that change in different time periods. It must be stated that the method of this application can record other information of the logical block as a distinction according to the actual situation, such as recording the storage location of the logical block, etc. Therefore, this application does not make any restrictions on the specific steps of recording the change of the logical block.
再者,本实施方式中,所述位图集保存在记录存储数据发生变化的装置的外部,但在其他实施方式中,所述位图集也可保存在本申请所述装置中,在此不作限定。而且,本申请所述位图集还可暂时保存在缓存中。由于缓存相对于内存,具有更高的读写速度,进而提高了本申请记录存储数据是否发生变化的速度。并且,在所述缓存满足一定情况下,如缓存容量大于预设容量,发生断电的情况下,会自动将缓存中的位图集保存在内存中。Furthermore, in this embodiment, the bitmap set is stored outside the device that records and stores data changes, but in other implementations, the bitmap set can also be stored in the device described in this application, here Not limited. Moreover, the bitmap set described in this application can also be temporarily stored in the cache. Compared with the memory, the cache has a higher reading and writing speed, which further improves the speed of recording whether the stored data changes in the present application. Moreover, when the cache meets certain conditions, such as the cache capacity is greater than the preset capacity, and a power failure occurs, the bitmap set in the cache will be automatically saved in the memory.
本实施方式中,采用位图集方式记录LUN中的逻辑块是否发生变化,同时,在逻辑块发生变化时,才建立所述逻辑块所在逻辑块区的对应位图,实现了位图按需分配,提高了位图中空间的利用率,减少对位图空间的浪费,同时,也减少了位图占用的存储资源。进一步地,在位图中所有位为第二标记时,将位图删除,实现了对位图占用的存储资源的释放,更进一步地减少了位图占用的存储资源。In this embodiment, the bitmap set method is used to record whether the logical block in the LUN changes. At the same time, when the logical block changes, the corresponding bitmap of the logical block area where the logical block is located is established, realizing the bitmap on-demand Allocation improves the utilization rate of the bitmap space, reduces the waste of bitmap space, and at the same time reduces the storage resources occupied by the bitmap. Further, when all the bits in the bitmap are the second marks, the bitmap is deleted, so as to release the storage resources occupied by the bitmap and further reduce the storage resources occupied by the bitmap.
请参阅图7,图7是本申请记录存储数据发生变化的装置一实施方式的结构示意图。本实施方式中,所述记录存储数据发生变化的装置包括确定模块710、查询模块720、建立模块730和记录模块740。Please refer to FIG. 7 . FIG. 7 is a schematic structural diagram of an embodiment of a device for recording and storing data changes in the present application. In this embodiment, the device for recording changes in stored data includes a determination module 710 , a query module 720 , an establishment module 730 and a record module 740 .
确定模块710用于LUN中当前变化逻辑块所在的逻辑块区,并将确定的逻辑块区发生给所述查询模块720。The determining module 710 is used for the logical block area where the currently changed logical block in the LUN is located, and sends the determined logical block area to the query module 720 .
本实施方式中,LUN采用精简配置(thin)技术,所述LUN可进行动态扩展。其中,所述LUN作为存储空间,至少包括两个逻辑块区,所述逻辑块区包含多个逻辑块,每个逻辑块定义为一定容量大小的存储数据。本实施方式中,LUN中每个逻辑块均分配有不同的逻辑块号,将每个逻辑块区的逻辑块信息预先保存在本地,例如,第一逻辑块区包含逻辑块0和1,第二逻辑块区包含逻辑块2和3……如此类推。在LUN中的逻辑块发生变化时,确定模块710获取LUN中当前变化逻辑块的逻辑块号,根据预设的逻辑块区与逻辑块间的关系为每个逻辑块包括两个逻辑块,确定所述当前变化逻辑块所在的逻辑块区。In this implementation manner, the LUN adopts thin provisioning (thin) technology, and the LUN can be dynamically expanded. Wherein, as a storage space, the LUN includes at least two logical block areas, and the logical block area includes a plurality of logical blocks, and each logical block is defined as storing data with a certain capacity. In this embodiment, each logical block in the LUN is assigned a different logical block number, and the logical block information of each logical block area is pre-stored locally. For example, the first logical block area includes logical blocks 0 and 1, and the logical block area of the second The second logical block area contains logical blocks 2 and 3...and so on. When the logical block in the LUN changes, the determination module 710 obtains the logical block number of the currently changed logical block in the LUN, and according to the preset relationship between the logical block area and the logical block, each logical block includes two logical blocks, and determines The logical block area where the currently changed logical block is located.
查询模块720用于查询位图集中是否已存在所述逻辑块区的对应位图,并将查询结果发送给建立模块730和记录模块740。The query module 720 is used to query whether the corresponding bitmap of the logical block already exists in the bitmap set, and send the query result to the establishment module 730 and the record module 740 .
本实施方式中,在LUN中的逻辑块上的存储数据,即该逻辑块发生变化时,记录存储数据发生变化的装置采用所述位图集记录所述LUN中逻辑块发生变化的情况。所述位图集可以不同的数据结构方式(如树结构、列表)保存在存储介质中,优化地,所述装置也可将位图集暂存在缓存中,以加速位图空间的处理,并定时将缓存中的位图集数据存放在永久存储介质,例如硬盘、flash。具体地,所述位图集用于放置多个位图,其中,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化。In this embodiment, when the storage data on the logical block in the LUN, that is, the logical block changes, the device for recording the change of the stored data uses the bitmap set to record the change of the logical block in the LUN. The bitmap set can be stored in the storage medium in different data structures (such as tree structure, list). Optimally, the device can also temporarily store the bitmap set in the cache to speed up the processing of the bitmap space, and Regularly store the bitmap set data in the cache in permanent storage media, such as hard disk and flash. Specifically, the bitmap set is used to place a plurality of bitmaps, wherein each bitmap is used to record a change of a logical block corresponding to one of the logical block areas.
具体,所述装置本地预设有LUN中每个逻辑块区的对应位图信息。当LUN中的逻辑块发生变化时,查询模块720根据预设的对应位图信息获得当前变化逻辑块所在的逻辑块区的对应位图信息,并查询位图集中是否包括获取的对应位图信息,其中,所述逻辑块区的对应位图即为记录所述逻辑块区的逻辑块发生变化的位图。Specifically, the device is locally preset with corresponding bitmap information of each logical block in the LUN. When the logical block in the LUN changes, the query module 720 obtains the corresponding bitmap information of the logical block area where the currently changed logical block is located according to the preset corresponding bitmap information, and queries whether the acquired corresponding bitmap information is included in the bitmap set , wherein, the corresponding bitmap of the logical block area is a bitmap that records changes in logical blocks of the logical block area.
举例说明,LUN中划分为16个逻辑块区,每个逻辑块区包括8个逻辑块。记录存储数据发生变化的装置预先设置每个逻辑块区的对应位图信息为第一逻辑块区的对应位图为第一位图,第二逻辑块区的对应位图为第二位图……如此类推,且每个位图包括8个位,每个位用于记录一个逻辑块是否发生变化。对应地,第一位图对应用于记录第一逻辑块区,即第1到8个逻辑块,第二位图对应用于记录第二逻辑块区,即第9到16个逻辑块,第三位图对应用于记录第三逻辑块区,即第17到24个逻辑块……如此类推。在LUN中的第10、15个逻辑块发生变化时,确定模块710确定所述当前变化的逻辑块位于第二逻辑块区,根据上述预设的逻辑块区对应位图信息,获得所述第二逻辑块区的对应位图信息为第二位图,查询模块720查询当前的位图集中建立的位图的信息是否包括第二位图信息,并将查询结果发送给建立模块730和记录模块740。For example, a LUN is divided into 16 logical block areas, and each logical block area includes 8 logical blocks. The device for recording and storing data changes presets the corresponding bitmap information of each logical block area as the corresponding bitmap of the first logical block area as the first bitmap, and the corresponding bitmap of the second logical block area as the second bitmap... ...and so on, and each bitmap includes 8 bits, and each bit is used to record whether a logical block has changed. Correspondingly, the first bitmap is used to record the first logical block area, that is, the 1st to 8th logical blocks, and the second bitmap is used to record the second logical block area, that is, the 9th to 16th logical blocks, and the second bitmap is used to record the second logical block area, that is, the 9th to 16th logical blocks. The three-bit map is correspondingly used to record the third logical block area, that is, the 17th to 24th logical blocks...and so on. When the 10th and 15th logical blocks in the LUN change, the determination module 710 determines that the currently changed logical block is located in the second logical block area, and obtains the second logical block area according to the bitmap information corresponding to the preset logical block area. The corresponding bitmap information of the two logical block areas is the second bitmap, and the query module 720 queries whether the bitmap information set up in the current bitmap set includes the second bitmap information, and sends the query result to the building module 730 and the recording module 740.
建立模块730用于在未查询到所述逻辑块区的对应位图时,在所述位图集中建立所述逻辑块区的对应位图,并将所述对应位图发送给所述记录模块740。The establishment module 730 is used to establish the corresponding bitmap of the logical block in the bitmap set when the corresponding bitmap of the logical block is not found, and send the corresponding bitmap to the recording module 740.
在位图集中未查询到所述当前变化逻辑块所在的逻辑块区的对应位图时,建立模块730在所述位图集中建立所述当前变化逻辑块所在的逻辑块区的对应位图,例如,所述位图集为树结构,则再位图树中插入携带所述对应位图的节点,以建立所述对应位图。When the corresponding bitmap of the logical block area where the current changed logical block is located is not found in the bitmap set, the establishment module 730 establishes a corresponding bitmap of the logical block area where the currently changed logical block is located in the bitmap set, For example, if the set of bitmaps is a tree structure, a node carrying the corresponding bitmap is inserted into the bitmap tree to establish the corresponding bitmap.
记录模块740用于在所述对应位图中记录所述当前变化逻辑块发生变化。The recording module 740 is configured to record the change of the current changed logical block in the corresponding bitmap.
记录模块740在所述对应位图中记录所述当前变化逻辑块发生变化,例如,将对应位图中对应当前变化逻辑块的位设置为第一标记,以标识该位对应的逻辑块发生变化,而对应位图中对应没有发生变化的逻辑块的位则设置为第二标记,以标识该位所对应的逻辑块没有发生变化。The recording module 740 records the change of the current changed logical block in the corresponding bitmap, for example, setting the bit corresponding to the current changed logical block in the corresponding bitmap as a first mark to identify that the logical block corresponding to the bit has changed , and the bit corresponding to the logical block that has not changed in the corresponding bitmap is set as the second flag to identify that the logical block corresponding to the bit has not changed.
本实施方式中,采用位图集方式记录LUN中的逻辑块是否发生变化,将LUN分为多个逻辑块区,一个逻辑块区对应一个位图,且位图集中的位图产生条件为:在逻辑块发生变化时,才建立所述逻辑块所在的逻辑块区的对应位图,无需产生没有发生变化的逻辑块区的对应位图,实现了位图按需分配,减少对位图空间的浪费,同时,也减少了总位图占用的存储资源。In this embodiment, a bitmap set is used to record whether the logical blocks in the LUN have changed, and the LUN is divided into multiple logical block areas, one logical block area corresponds to a bitmap, and the bitmap generation conditions in the bitmap set are: When the logical block changes, the corresponding bitmap of the logical block area where the logical block is located is established, and there is no need to generate the corresponding bitmap of the logical block area that has not changed, realizing the allocation of bitmaps on demand and reducing the bitmap space At the same time, it also reduces the storage resources occupied by the total bitmap.
需要说明的是,本实施方式中的LUN采用精简配置技术,但在其他实施方式中,所述LUN还可采用其他可进行动态扩展的技术,或者LUN的不可进行动态扩展,其容量固定大小,其LUN的具体种类并不影响本申请方法的实施,且所述LUN可设置在本申请记录存储数据发生变化的装置内部,也可设置在外部设备中,在此不对LUN进行具体限定。It should be noted that the LUN in this embodiment adopts the thin provisioning technology, but in other embodiments, the LUN can also adopt other technologies that can be dynamically expanded, or the LUN cannot be dynamically expanded, and its capacity is fixed. The specific type of LUN does not affect the implementation of the method of this application, and the LUN can be set inside the device that records and stores data changes in this application, or can be set in an external device, and the LUN is not specifically limited here.
请参阅图8,图8是本申请记录存储数据发生变化的装置另一实施方式的结构示意图。本实施方式中,所述记录存储数据发生变化的装置810包括确定模块811、查询模块812、建立模块813、记录模块814、划分模块815、复制模块816及删除模块817。Please refer to FIG. 8 . FIG. 8 is a schematic structural diagram of another embodiment of an apparatus for recording and storing data changes in the present application. In this embodiment, the device 810 for recording and storing data changes includes a determination module 811 , a query module 812 , a creation module 813 , a record module 814 , a division module 815 , a copy module 816 and a deletion module 817 .
划分模块815用于将所述LUN中的存储数据划分为多个逻辑块,将所述多个逻辑块划分为第一数值个逻辑块区,确定每个逻辑块区的对应位图信息,并将所述每个逻辑块区的对应位图信息发送给所述记录模块,其中,所述第一数值至少为2,所述逻辑块区的对应位图信息包括所述逻辑块区的对应位图的位数等于所述逻辑块区的逻辑块数,所述逻辑块区的对应位图的每个位分别对应用于记录所述逻辑块区的一个逻辑块是否发生变化,每个位可被设置为第一标记或者第二标记,所述第一标记用于表示该位所对应的逻辑块发生了变化,所述第二标记用于表示该位所对应的逻辑块没有发生变化。The division module 815 is configured to divide the storage data in the LUN into a plurality of logical blocks, divide the plurality of logical blocks into a first number of logical block areas, determine the corresponding bitmap information of each logical block area, and Send the corresponding bitmap information of each logical block area to the recording module, wherein the first value is at least 2, and the corresponding bitmap information of the logical block area includes the corresponding bit of the logical block area The number of digits in the map is equal to the number of logical blocks in the logical block area, and each bit of the corresponding bitmap in the logical block area is respectively corresponding to whether a logical block in the logical block area has changed, and each bit can be It is set as a first flag or a second flag, the first flag is used to indicate that the logic block corresponding to the bit has changed, and the second flag is used to indicate that the logic block corresponding to the bit has not changed.
例如,LUN当前分配的容量为1GB,划分模块815将LUN划分为1024个容量为1KB的逻辑块,每个逻辑块分配有不同的逻辑块号,例如,逻辑块0、逻辑块1、逻辑块2等。划分模块815将1024个逻辑块划分为128个逻辑块区,每个逻辑块区包括8个逻辑块,如第一逻辑块区包括逻辑块0至7、第二逻辑块区包括逻辑块8至15……如此类推。划分模块815为LUN中每个逻辑块区对应设置一个对应位图信息,如第一逻辑块区的对应位图为容量为8位的第一位图,第一位图中的每一位依序对应用于记录逻辑块0-7,其他逻辑块区的对应位图信息同上理。位图中每一位可设置为第一或第二标记,所述第一标记为1,第二标记为0,当逻辑块发生变化时,则将对应该逻辑块的位置1,如果逻辑块没有发生变化,则将对应该逻辑块的位置0,通过判断该位为0还是1,则可知道该位对应的逻辑块是否发生变化。For example, the currently allocated capacity of the LUN is 1GB, and the division module 815 divides the LUN into 1024 logical blocks with a capacity of 1KB, and each logical block is allocated with a different logical block number, for example, logical block 0, logical block 1, logical block 2 etc. The division module 815 divides 1024 logical blocks into 128 logical block areas, each logical block area includes 8 logical blocks, such as the first logical block area includes logical blocks 0 to 7, and the second logical block area includes logical blocks 8 to 15...and so on. The division module 815 sets a corresponding bitmap information for each logical block area in the LUN. For example, the corresponding bitmap of the first logical block area is the first bitmap with a capacity of 8 bits, and each bit in the first bitmap is The sequence correspondence is used to record logical blocks 0-7, and the corresponding bitmap information of other logical block areas is the same as above. Each bit in the bitmap can be set as the first or second flag, the first flag is 1, the second flag is 0, when the logic block changes, the position corresponding to the logic block will be 1, if the logic block If there is no change, it will correspond to the position 0 of the logic block. By judging whether the bit is 0 or 1, it can be known whether the logic block corresponding to the bit has changed.
确定模块811用于确定LUN中当前变化逻辑块所在的逻辑块区。在LUN中的逻辑块发生变化时,确定模块811获取当前变化的逻辑块信息,并根据划分模块815所预设逻辑块区与逻辑块间的关系或者保存的每个逻辑块区的逻辑块信息,确定LUN中当前变化逻辑块所在的逻辑块区。The determining module 811 is configured to determine the logical block area where the currently changed logical block is located in the LUN. When the logical block in the LUN changes, the determination module 811 obtains the currently changed logical block information, and according to the relationship between the logical block area and the logical block preset by the dividing module 815 or the saved logical block information of each logical block area , to determine the logical block area where the currently changing logical block in the LUN is located.
查询模块812用于查询位图集820中是否存在所述逻辑块区的对应位图,并将查询结果发送给建立模块813和记录模块814。The query module 812 is used to query whether the corresponding bitmap of the logical block exists in the bitmap set 820 , and send the query result to the establishment module 813 and the recording module 814 .
所述位图集820可以不同的数据结构方式(如树结构、列表)保存在存储介质中,优化地,所述装置也可将位图集820暂存在缓存中,并定时将缓存中的位图集数据存放在永久存储介质,例如硬盘、flash。具体地,所述位图集820用于放置多个位图,其中,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化。The bitmap set 820 can be stored in the storage medium in different data structures (such as tree structure, list). Optimally, the device can also temporarily store the bitmap set 820 in the cache, and regularly store the bitmap set 820 in the cache. Atlas data is stored in permanent storage media, such as hard disk and flash. Specifically, the bitmap set 820 is used to place a plurality of bitmaps, wherein each bitmap is used to record a change of a logical block corresponding to one of the logical block areas.
具体,当LUN中的逻辑块发生变化时,查询模块812根据预设的每个逻辑块区的对应位图信息,获得当前变化逻辑块所在的逻辑块区的对应位图信息,并查询位图集820中是否已存在当前变化逻辑块的逻辑块区的对应位图。Specifically, when the logical block in the LUN changes, the query module 812 obtains the corresponding bitmap information of the logical block area where the currently changed logical block is located according to the preset corresponding bitmap information of each logical block area, and queries the bitmap Whether the corresponding bitmap of the logical block area of the current changing logical block already exists in the set 820 .
建立模块813用于未查询到所述逻辑块区的对应位图时,在所述位图集820中建立所述当前变化逻辑块的对应位图,并将所述对应位图发送给所述记录模块814。例如,所述位图集820为树结构,则再位图树中插入携带所述对应位图的节点,以建立所述对应位图。The establishment module 813 is used to establish the corresponding bitmap of the current changed logical block in the bitmap set 820 when the corresponding bitmap of the logical block area is not found, and send the corresponding bitmap to the Record module 814 . For example, the bitmap set 820 has a tree structure, and then a node carrying the corresponding bitmap is inserted into the bitmap tree to establish the corresponding bitmap.
记录模块814用于根据所述逻辑块区的对应位图信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。The recording module 814 is used to find out the bit in the corresponding bitmap for recording whether the current changed logical block has changed according to the corresponding bitmap information of the logical block area, and set the found bit as the first mark, recording the time when the current change logic block changes.
另外,本实施方式中,将当前变化逻辑块发生变化的时间以列表形式记录在本申请装置内部或外部内存中,当然,在其他实施方式中,还可以其他方式记录当前变化逻辑块发生变化的时间,在此不作限定。In addition, in this embodiment, the time when the current change logic block changes is recorded in the internal or external memory of the device of the present application in the form of a list. Of course, in other embodiments, the time when the current change logic block changes can also be recorded in other ways. Time is not limited here.
复制模块816用于在接收复制命令时,获取所述复制命令中的预设时间条件,在所述位图集820中搜索出所述逻辑块发生变化的时间符合所述预设时间条件的位图中的位;将搜索出的位图中的位所对应的逻辑块进行复制操作,在复制完成后将搜索出的位图中的位设置为所述第二标记。The copying module 816 is configured to obtain the preset time condition in the copy command when receiving the copy command, and search out the bit in the bitmap set 820 that the time when the logic block changes meets the preset time condition Bits in the map: performing a copy operation on the logical blocks corresponding to the bits in the searched out bitmap, and setting the bits in the searched out bitmap as the second mark after the copying is completed.
进一步地,本申请记录存储数据发生变化的装置还可实现远程复制(如异步远程复制、同步远程复制等),即如果主机上LUN的逻辑块数据发生变化,则通过确定模块811、查询模块812、建立模块813和记录模块814记录所述逻辑块发生变化,同时,复制模块816还将主机上发生变化的逻辑块复制到从机上的LUN中。复制模块816接收到将主机发生变化的逻辑块复制到从机中的复制命令时,对所述复制命令进行解析,获得命令中包括的预设时间条件。Furthermore, the device for recording and storing data changes in this application can also implement remote replication (such as asynchronous remote replication, synchronous remote replication, etc.), that is, if the logical block data of the LUN on the host changes, the determination module 811 and the query module 812 , the establishment module 813 and the recording module 814 record the change of the logical block, and at the same time, the replication module 816 also copies the changed logical block on the master to the LUN on the slave. When the copy module 816 receives a copy command to copy the changed logical block from the master to the slave, it parses the copy command to obtain the preset time condition included in the command.
复制模块816遍历记录的所述位图集820中所有位图的所有位上对应记录的逻辑块发生变化的时间,并搜索出逻辑块发生变化的时间符合预设时间条件的位图中的位。The copying module 816 traverses the time when the corresponding recorded logical block changes on all bits of all the bitmaps in the recorded bitmap set 820, and searches out the bits in the bitmap whose logical block changes meet the preset time condition .
复制模块816根据搜索出的位图中的位,查找出所述搜索出的位图中的位对应的主机LUN中的逻辑块,并将查找出的逻辑块复制到从机中,在复制完成后,将所述搜索出的位图中的位设置为所述第二标记。The replication module 816 finds out the logical block in the host LUN corresponding to the bit in the searched out bitmap according to the bits in the searched out bitmap, and copies the found logical block to the slave machine. Then, set the bit in the searched bitmap as the second flag.
进一步地,在本申请装置实现一主多从远程分享的实施方式中,所述位图还设置有共享标识,所述共享标识用于标识共享从设备对所述位图记录的发生变化的逻辑块是否已进行共享,其中,所述共享标识为第一共享标识时,则表示所有共享从设备对所述位图记录的发生变化的逻辑块已进行共享,所述共享标识为第二共享标识时,则表示共享从设备对所述位图记录的发生变化的逻辑块未完成共享。复制模块816在将查找出的逻辑块复制到从机后,如果判断所述共享标识为第一共享标识,即表示所述所有共享从设备对所述位图记录的发生变化的逻辑块已进行共享,则在将所述搜索出的位图中的位设置为所述第二标记。Further, in the embodiment in which the device of the present application implements one master and multiple slaves for remote sharing, the bitmap is also provided with a sharing identifier, and the sharing identifier is used to identify the logic of the change of the shared slave device to the bitmap record Whether the block has been shared, wherein, when the shared identifier is the first shared identifier, it means that all shared slave devices have shared the changed logical blocks recorded in the bitmap, and the shared identifier is the second shared identifier , it means that the shared slave device has not finished sharing the changed logical blocks recorded in the bitmap. After the copying module 816 copies the found logical block to the slave, if it judges that the shared identifier is the first shared identifier, it means that all the shared slave devices have changed the logical blocks recorded in the bitmap. shared, then setting the bit in the searched bitmap as the second flag.
本实施方式中,在进行对发生变化的逻辑块进行复制时,以逻辑块发生变化的时间为基准,选择将某一段时间段或者某一时刻的逻辑块进行复制,提高了复制的灵活性,且在将时间条件设置为执行复制的时间之前时,可使所述装置对复制过程中发生变化的逻辑块不作复制处理,以避免复制与逻辑块发生变化同步发生时,容易出现遗漏对同步发生的部分逻辑块进行复制,或者在对某一逻辑块完成复制时,所述逻辑块再次发生变化,进而无法实现从机对应逻辑块数据的更新等情况。In this embodiment, when copying a changed logical block, based on the time when the logical block changes, a certain period of time or a certain moment of logical block is selected to be copied, which improves the flexibility of copying. And when the time condition is set to before the time to perform the copy, the device can be made not to copy the logical block that changes during the copy process, so as to avoid the synchronous occurrence of the copy and the change of the logical block, which is prone to omission and synchronous occurrence Part of the logic block is copied, or when the copy of a certain logic block is completed, the logic block changes again, and then the update of the corresponding logic block data of the slave cannot be realized.
删除模块817用于检测所述位图集820中是否存在所有位均为所述第二标记的位图,如果存在,则将所述位图从位图集820中删除。The deletion module 817 is configured to detect whether there is a bitmap whose bits are all the second marks in the bitmap set 820 , and if so, delete the bitmap from the bitmap set 820 .
删除模块817定时或者在接收到检测命令时检测位图集820中的是否存在所有位均为第二标识的位图,如果存在,则表示所述位图对应的逻辑块当前均无发生变化,故将所述所有位均为第二标识的位图从位图集820中删除。The deletion module 817 detects whether there is a bitmap whose all bits are the second identification in the bitmap set 820 at regular intervals or when receiving the detection command. If it exists, it means that the logical block corresponding to the bitmap is currently unchanged. Therefore, the bitmap whose bits are all the second identifiers is deleted from the bitmap set 820 .
举第一例进行说明,请参阅图5,本申请装置能够实现异步远程复制,其中,异步远程复制即为每隔一段时间,将主机上LUN中发生变化的存储数据复制到从机LUN中。同时,每当主机上LUN中的逻辑块数据发生变化,所述装置通过确定模块811、查询模块812、建立模块813及记录模块814,记录当前变化逻辑块发生了变化和发生变化的时间。如图5,t0、t1、t2、t3表示每个位图对应逻辑块发生变化的时间,其中t0<t1<t2<t3。在接收到复制命令时,复制模块816启动主从数据同步,其中所述复制命令包括的预设时间条件为:所需复制的逻辑块发生变化时间为t0至t2。根据上述预设时间条件可将位图集820分成两个区域:同步区,包括当前需要同步的逻辑块所在逻辑块区的对应位图(t0、t1、t2);未同步区,包括当前不需同步的逻辑块所在逻辑块区的对应位图(t3)。一般,LUN数据每发生变化一次,则执行同步一次,且每执行一次同步则更新一次时间点,故同步区中一般只包括一个时间点的位图。而本例中,同步区包括多个时间点的位图t0、t1、t2,则由于在之前执行同步t0、t1时间点的位图过程中,由于用户中断或者设备出现故障,导致没有同步完成,故仍遗留部分t0、t1时间点的位图。在本次同步中,复制模块816将同步区中t0、t1、t2的位图对应的主机LUN中逻辑块数据复制到从机LUN上,实现主从数据的同步,其中,每同步一个逻辑块,复制模块816将该逻辑块所在逻辑块区的对应位图的对应位设置为第二标记。当删除模块817检测到位图集820中有位图的所有位均为第二标记时,则删除该位图。同时,在同步过程中,如果主机LUN逻辑块发生变化,则记录模块814将对应位图记录在未同步区。Let us take the first example for illustration. Please refer to FIG. 5 . The device of the present application can realize asynchronous remote replication. The asynchronous remote replication is to copy the changed storage data in the LUN on the host to the LUN of the slave at regular intervals. At the same time, whenever the logical block data in the LUN on the host changes, the device records the change and the time of the current changed logical block through the determination module 811, the query module 812, the establishment module 813 and the recording module 814. As shown in Figure 5, t0, t1, t2, and t3 represent the time when each bitmap corresponds to a change in the logical block, where t0<t1<t2<t3. When receiving the copy command, the copy module 816 starts master-slave data synchronization, wherein the preset time condition included in the copy command is: the change time of the logical block to be copied is from t0 to t2. According to the above preset time conditions, the bitmap set 820 can be divided into two areas: the synchronization area, including the corresponding bitmap (t0, t1, t2) of the logical block area where the logical block that needs to be synchronized currently is located; the unsynchronized area, including the currently unsynchronized Corresponding bitmap (t3) of the logical block area where the logical block to be synchronized is located. Generally, each time the LUN data changes, the synchronization is performed once, and the time point is updated every time the synchronization is performed, so the synchronization area generally only includes a bitmap of one time point. In this example, the synchronization area includes bitmaps t0, t1, and t2 at multiple time points. During the previous synchronization of bitmaps at time points t0 and t1, the synchronization was not completed due to user interruption or device failure. , so part of the bitmaps at time points t0 and t1 are still left. In this synchronization, the replication module 816 copies the logical block data in the host LUN corresponding to the bitmaps of t0, t1, and t2 in the synchronization area to the slave LUN to realize the synchronization of the master-slave data. , the copy module 816 sets the corresponding bit of the corresponding bitmap of the logical block area where the logical block is located as the second flag. When the deletion module 817 detects that all the bits of the bitmap in the bitmap set 820 are the second mark, the bitmap is deleted. At the same time, during the synchronization process, if the logical block of the host LUN changes, the recording module 814 records the corresponding bitmap in the unsynchronized area.
举第二例进行说明,请参阅图6,本申请装置能够实现同步远程复制,其中,同步远程复制即为当主机上LUN中存储数据发生变化时,立刻将主机上LUN中发生变化的存储数据复制到从机LUN中。与第一例类似,位图集820分两个区:同步区(t4对应的位图)和未同步区(t5对应的位图),其中,t4对应的位图为当前变化逻辑块所在逻辑块区的对应位图,t5对应的位图为同步过程中发生变化的逻辑块所在逻辑块区的对应位图。在主机上LUN中存储数据发生变化时,所述装置通过确定模块811、查询模块812、建立模块813及记录模块814,记录当前变化逻辑块发生了变化和发生变化的时间t4,并且,复制模块816执行复制命令,所述复制命令的预设时间条件即为当前发生变化的时间t4或之前,本例的位图集820中满足该条件的只有t4对应的位图,故将t4放入同步区。复制模块816根据复制命令将同步区中t4的位图对应的主机LUN中逻辑块数据复制到从机LUN上,实现主从数据的同步,其中,每同步一个逻辑块,复制模块816将该逻辑块所在逻辑块区的对应位图的对应位设置为第二标记。当删除模块817检测到位图集820中有位图的所有位均为第二标记时,则删除该位图。并且,在同步过程中,如果主机LUN逻辑块发生变化,则记录模块814将对应位图(即t5对应的位图)记录在未同步区。Take the second example for illustration, please refer to Figure 6, the device of this application can realize synchronous remote replication, wherein, synchronous remote replication means that when the data stored in the LUN on the host changes, immediately copy the stored data that has changed in the LUN on the host Copy to the slave LUN. Similar to the first example, the bitmap set 820 is divided into two areas: the synchronization area (the bitmap corresponding to t4) and the unsynchronized area (the bitmap corresponding to t5), where the bitmap corresponding to t4 is the logic block where the current change logic block is located. The corresponding bitmap of the block area, the bitmap corresponding to t5 is the corresponding bitmap of the logical block area where the logical block that changes during the synchronization process is located. When the data stored in the LUN on the host changes, the device records the change and the time t4 of the current changed logic block through the determination module 811, the query module 812, the establishment module 813 and the recording module 814, and the copy module 816 executes the copy command, the preset time condition of the copy command is the current time t4 or before the change, in the bitmap set 820 of this example, only the bitmap corresponding to t4 satisfies this condition, so t4 is put into the synchronization Area. The replication module 816 copies the logical block data in the master LUN corresponding to the bitmap of t4 in the synchronization area to the slave LUN according to the replication command, so as to realize the synchronization of the master-slave data. Wherein, each time a logical block is synchronized, the replication module 816 will The corresponding bit of the corresponding bitmap of the logical block area where the block is located is set as the second flag. When the deletion module 817 detects that all the bits of the bitmap in the bitmap set 820 are the second mark, the bitmap is deleted. Moreover, during the synchronization process, if the logical block of the host LUN changes, the recording module 814 records the corresponding bitmap (that is, the bitmap corresponding to t5) in the unsynchronized area.
需要说明的是,本申请在记录逻辑块发生变化时,未必限定为需记录发生变化的时间,以区分不同时间段变化的逻辑块。必须申明的是,本申请可根据实际情况记录逻辑块的其他信息作为区分,如记录逻辑块所在存储位置等,故在此本申请对记录逻辑块发生变化的具体方式不作任何限定。It should be noted that when recording changes in logical blocks in this application, it is not necessarily limited to recording the time at which changes occur, so as to distinguish logical blocks that have changed in different time periods. It must be stated that this application can record other information of the logical block as a distinction according to the actual situation, such as recording the storage location of the logical block, etc. Therefore, this application does not make any restrictions on the specific method of recording the change of the logical block.
另外,本实施方式中,所述位图集保存在记录存储数据发生变化的装置的外部,但在其他实施方式中,所述位图集也可保存在本申请所述装置中,在此不作限定。而且,本申请所述位图集还可暂时保存在缓存中。由于缓存相对于内存,具有更高的读写速度,进而提高了本申请记录存储数据是否发生变化的速度。并且,在所述缓存满足一定情况下,如缓存容量大于预设容量,发生断电的情况下,会自动将缓存中的位图集保存在内存中。In addition, in this embodiment, the bitmap set is stored outside the device that records and stores data changes, but in other embodiments, the bitmap set can also be stored in the device described in this application, which is not described here. limited. Moreover, the bitmap set described in this application can also be temporarily stored in the cache. Compared with the memory, the cache has a higher reading and writing speed, which further improves the speed of recording whether the stored data changes in the present application. Moreover, when the cache meets certain conditions, such as the cache capacity is greater than the preset capacity, and a power failure occurs, the bitmap set in the cache will be automatically saved in the memory.
本实施方式中,采用位图集方式记录LUN中的逻辑块是否发生变化,同时,在逻辑块发生变化时,才建立所述逻辑块所在逻辑块区的对应位图,实现了位图按需分配,提高了位图中空间的利用率,减少对位图空间的浪费,同时,也减少了位图占用的存储资源。进一步地,在位图中所有位为第二标记时,将位图删除,实现了对位图占用的存储资源的释放,更进一步地减少了位图占用的存储资源。In this embodiment, the bitmap set method is used to record whether the logical block in the LUN changes. At the same time, when the logical block changes, the corresponding bitmap of the logical block area where the logical block is located is established, realizing the bitmap on-demand Allocation improves the utilization rate of the bitmap space, reduces the waste of bitmap space, and at the same time reduces the storage resources occupied by the bitmap. Further, when all the bits in the bitmap are the second marks, the bitmap is deleted, so as to release the storage resources occupied by the bitmap and further reduce the storage resources occupied by the bitmap.
请参阅图9,图9是本申请记录存储数据发生变化的装置再一实施方式的结构示意图。本实施方式中,所述记录存储数据发生变化的装置包括处理器910及存储介质920,其中所述处理器910与存储介质920通过总线930连接。Please refer to FIG. 9 . FIG. 9 is a schematic structural diagram of another embodiment of an apparatus for recording and storing data changes in the present application. In this embodiment, the device for recording and storing data changes includes a processor 910 and a storage medium 920 , wherein the processor 910 and the storage medium 920 are connected through a bus 930 .
存储介质920用于存储处理器910执行的计算机指令以及处理器910工作时所需存储的数据。The storage medium 920 is used for storing computer instructions executed by the processor 910 and data required to be stored when the processor 910 works.
处理器910执行存储介质920存储的计算机指令,用于确定LUN中当前变化逻辑块所在的逻辑块区,查询位图集中是否已存在所述逻辑块区的对应位图,在未查询到所述逻辑块区的对应位图时,在所述位图集中建立所述当前变化逻辑块的对应位图,并在所述对应位图中记录所述当前变化逻辑块发生变化,在查询到所述逻辑块区的对应位图时,直接在所述对应位图中记录所述当前变化逻辑块发生变化。The processor 910 executes the computer instructions stored in the storage medium 920 to determine the logical block area where the currently changed logical block in the LUN is located, and checks whether the corresponding bitmap of the logical block area already exists in the bitmap set. When the corresponding bitmap of the logical block area is set, the corresponding bitmap of the current changing logical block is established in the bitmap set, and the change of the current changing logical block is recorded in the corresponding bitmap. When the corresponding bitmap of the logical block area is selected, the change of the current changed logical block is directly recorded in the corresponding bitmap.
本实施方式中,处理器910预先将所述LUN中的存储数据划分为多个逻辑块,将所述多个逻辑块划分为第一数值个逻辑块区,并确定每个逻辑块区的对应位图信息。其中,所述第一数值至少为2,所述逻辑块区的对应位图信息包括所述逻辑块区的对应位图的位数等于所述逻辑块区的逻辑块数,所述逻辑块区的对应位图的每个位分别对应用于记录所述逻辑块区的一个逻辑块是否发生变化,每个位可被设置为第一标记或者第二标记,所述第一标记用于表示该位所对应的逻辑块发生了变化,所述第二标记用于表示该位所对应的逻辑块没有发生变化。例如,所述第一标记为1,第二标记为0,当逻辑块发生变化时,则将对应该逻辑块的位置1,如果逻辑块没有发生变化,则将对应该逻辑块的位置0,通过判断该位为0还是1,则可知道该位对应的逻辑块是否发生变化。In this embodiment, the processor 910 divides the storage data in the LUN into multiple logical blocks in advance, divides the multiple logical blocks into a first number of logical block areas, and determines the corresponding bitmap information. Wherein, the first numerical value is at least 2, and the corresponding bitmap information of the logical block area includes that the number of bits of the corresponding bitmap of the logical block area is equal to the number of logical blocks of the logical block area, and the logical block area Each bit of the corresponding bitmap corresponds to recording whether a logical block in the logical block area has changed, and each bit can be set as a first flag or a second flag, and the first flag is used to indicate the The logic block corresponding to the bit has changed, and the second mark is used to indicate that the logic block corresponding to the bit has not changed. For example, the first mark is 1, and the second mark is 0. When the logic block changes, it will correspond to the position 1 of the logic block. If the logic block does not change, it will correspond to the position 0 of the logic block. By judging whether the bit is 0 or 1, it can be known whether the logic block corresponding to the bit has changed.
在LUN中的逻辑块发生变化时,处理器910确定LUN中当前变化逻辑块所在的逻辑块区,并根据确定每个逻辑块区的对应位图信息,查询位图集中是否已存在所述逻辑块区的对应位图。所述位图集保存在存储介质中,优化地,所述装置也可将位图集暂存在缓存中,以加速位图空间的处理,并定时将缓存中的位图集数据存放在永久存储介质中,其中,所述位图集用于放置多个位图,每个所述位图为所述树的节点,共同构成所述树结构。具体地,每个所述位图用于记录对应一个所述逻辑块区的逻辑块发生变化。When a logical block in the LUN changes, the processor 910 determines the logical block area where the currently changed logical block in the LUN is located, and checks whether the logical block already exists in the bitmap set according to the corresponding bitmap information of each logical block area. The corresponding bitmap of the block. The bitmap set is stored in the storage medium. Optimally, the device can temporarily store the bitmap set in the cache to speed up the processing of the bitmap space, and regularly store the bitmap set data in the cache in the permanent storage In the medium, the bitmap set is used to place multiple bitmaps, each of which is a node of the tree, and together constitute the tree structure. Specifically, each of the bitmaps is used to record changes in logical blocks corresponding to one of the logical block areas.
另外,处理器910记录对应所述当前变化逻辑块发生了变化的方式具体为:处理器910根据所述逻辑块区的对应位图信息,查找出所述对应位图中用于记录所述当前变化逻辑块是否发生变化的位,并将查找出的位设置为第一标记,记录所述当前变化逻辑块发生变化的时间。本实施方式中,处理器910将当前变化逻辑块发生变化的时间以列表形式记录在本申请装置内部或外部内存中,当然,在其他实施方式中,还可以其他方式记录当前变化逻辑块发生变化的时间,在此不作限定。In addition, the manner in which the processor 910 records that the logical block corresponding to the current change has changed is as follows: the processor 910 finds out the corresponding bitmap for recording the current block according to the corresponding bitmap information of the logical block area; Change the bit of whether the logic block changes, and set the found bit as the first mark, and record the time when the current change logic block changes. In this embodiment, the processor 910 records the time when the current changed logic block changes in a list form in the internal or external memory of the device of the present application. Of course, in other embodiments, the change of the current changed logic block can also be recorded in other ways The time is not limited here.
优化地,处理器910还用于在接收复制命令时,获取所述复制命令中的预设时间条件;在所述位图集中搜索出所述逻辑块发生变化的时间符合所述预设时间条件的位图中的位;将搜索出的位图中的位所对应的逻辑块进行复制操作,在复制完成后将搜索出的位图中的位设置为所述第二标记。Optimally, the processor 910 is also configured to acquire the preset time condition in the copy command when receiving the copy command; search out the time when the logic block changes in the bitmap set conforms to the preset time condition the bits in the bitmap; performing a copy operation on the logic blocks corresponding to the bits in the searched out bitmap, and setting the bits in the searched out bitmap as the second flag after the copying is completed.
进一步地,本申请记录存储数据发生变化的装置还可实现远程复制(如异步远程复制、同步远程复制等),即如果主机上LUN的逻辑块数据发生变化,处理器910记录所述逻辑块发生变化,同时,还将主机上发生变化的逻辑块复制到从机上的LUN中。处理器910接收到将主机发生变化的逻辑块复制到从机中的复制命令时,对所述复制命令进行解析,获得命令中包括的预设时间条件。Furthermore, the device for recording storage data changes in this application can also implement remote replication (such as asynchronous remote replication, synchronous remote replication, etc.), that is, if the logical block data of the LUN on the host changes, the processor 910 records the occurrence of the logical block. At the same time, the changed logical block on the master is copied to the LUN on the slave. When the processor 910 receives a copy command to copy the changed logic block of the master to the slave, it parses the copy command to obtain the preset time condition included in the command.
处理器910遍历记录的所述位图集中所有位图的所有位上对应记录的逻辑块发生变化的时间,并搜索出逻辑块发生变化的时间符合预设时间条件的位图中的位。The processor 910 traverses the time when the corresponding recorded logic block changes in all the bits of all the bitmaps in the recorded bitmap set, and searches for bits in the bitmap whose logic block change times meet the preset time condition.
处理器910根据搜索出的位图中的位,查找出所述搜索出的位图中的位对应的主机LUN中的逻辑块,并将查找出的逻辑块复制到从机中,在复制完成后,将所述搜索出的位图中的位设置为所述第二标记。本实施方式中,在进行对发生变化的逻辑块进行复制时,以逻辑块发生变化的时间为基准,选择将某一段时间段或者某一时刻的逻辑块进行复制,提高了复制的灵活性,且在将时间条件设置为执行复制的时间之前时,可使所述装置对复制过程中发生变化的逻辑块不作复制处理,以避免复制与逻辑块发生变化同步发生时,容易出现遗漏对同步发生的部分逻辑块进行复制,或者在对某一逻辑块完成复制时,所述逻辑块再次发生变化,进而无法实现从机对应逻辑块数据的更新等情况。The processor 910 finds out the logical block in the master LUN corresponding to the bit in the searched out bitmap according to the bits in the searched out bitmap, and copies the found logical block to the slave machine. Then, set the bit in the searched bitmap as the second flag. In this embodiment, when copying a changed logical block, based on the time when the logical block changes, a certain period of time or a certain moment of logical block is selected to be copied, which improves the flexibility of copying. And when the time condition is set to before the time to perform the copy, the device can be made not to copy the logical block that changes during the copy process, so as to avoid the synchronous occurrence of the copy and the change of the logical block, which is prone to omission and synchronous occurrence Part of the logic block is copied, or when the copy of a certain logic block is completed, the logic block changes again, and then the update of the corresponding logic block data of the slave cannot be realized.
进一步优化地,处理器910还用于检测所述位图集中是否存在所有位均为所述第二标记的位图,如果存在,则将所述位图从位图集中删除。Further optimally, the processor 910 is further configured to detect whether there is a bitmap whose bits are all the second marks in the bitmap set, and if so, delete the bitmap from the bitmap set.
处理器910定时或者在接收到检测命令时检测位图集中的是否存在所有位均为第二标识的位图,如果存在,则表示所述位图对应的逻辑块当前均无发生变化,故将所述所有位均为第二标识的位图从位图集中删除。The processor 910 detects whether there is a bitmap whose all bits are the second identifier in the bitmap set at regular intervals or when receiving the detection command. If it exists, it means that the logic block corresponding to the bitmap is currently unchanged, so the The bitmap whose all bits are the second identifier is deleted from the bitmap set.
需要说明的是,本申请在记录逻辑块发生变化时,未必限定为需记录发生变化的时间,以区分不同时间段变化的逻辑块。必须申明的是,本申请可根据实际情况记录逻辑块的其他信息作为区分,如记录逻辑块所在存储位置等,故在此本申请对记录逻辑块发生变化的具体方式不作任何限定。It should be noted that when recording changes in logical blocks in this application, it is not necessarily limited to recording the time at which changes occur, so as to distinguish logical blocks that have changed in different time periods. It must be stated that this application can record other information of the logical block as a distinction according to the actual situation, such as recording the storage location of the logical block, etc. Therefore, this application does not make any restrictions on the specific method of recording the change of the logical block.
另外,本实施方式中,所述位图集保存在记录存储数据发生变化的装置的外部,但在其他实施方式中,所述位图集也可保存在本申请所述装置的存储介质,在此不作限定。而且本申请所述位图集还可暂时保存在缓存中。由于缓存相对于内存,具有更高的读写速度,进而提高了本申请记录存储数据是否发生变化的速度。并且,在所述缓存满足一定情况下,如缓存容量大于预设容量,发生断电的情况下,会自动将缓存中的位图集保存在内存中。In addition, in this embodiment, the bitmap set is stored outside the device that records and stores data changes, but in other embodiments, the bitmap set can also be stored in the storage medium of the device described in this application. This is not limited. Moreover, the bitmap set described in this application can also be temporarily stored in the cache. Compared with the memory, the cache has a higher reading and writing speed, which further improves the speed of recording whether the stored data changes in the present application. Moreover, when the cache meets certain conditions, such as the cache capacity is greater than the preset capacity, and a power failure occurs, the bitmap set in the cache will be automatically saved in the memory.
通过上述方案,本申请采用位图集来实现记录LUN的存储数据的变化,并在逻辑块发生变化时,才建立该逻辑块的对应位图,区别于固定采用一个位图记录LUN所有存储数据的变化情况的现有技术,本申请采用动态位图方式,使得位图总占用的存储空间与LUN发生变化的逻辑块数对应,实现了位图的按需分配,减少占用存储资源,同时,也提高了位图的利用效率,减少对位图内存资源的浪费。Through the above scheme, this application uses the bitmap set to record the changes of the storage data of the LUN, and only when the logic block changes, the corresponding bitmap of the logic block is established, which is different from the fixed use of a bitmap to record all the storage data of the LUN According to the prior art of changing situations, this application adopts a dynamic bitmap method, so that the total storage space occupied by the bitmap corresponds to the number of logical blocks that change in the LUN, realizing the on-demand allocation of bitmaps and reducing the storage resources occupied. At the same time, It also improves the utilization efficiency of the bitmap and reduces the waste of bitmap memory resources.
在本申请所提供的几个实施方式中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施方式仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several implementation manners provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device implementations described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施方式方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施方式中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施方式所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储介质(ROM,Read-Only Memory)、随机存取存储介质(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only storage medium (ROM, Read-Only Memory), random access storage medium (RAM, Random Access Memory), magnetic disk or optical disk, etc., which can store program codes. medium.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310594802.5A CN103605617B (en) | 2013-11-21 | 2013-11-21 | The method and device that a kind of records store data changes |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310594802.5A CN103605617B (en) | 2013-11-21 | 2013-11-21 | The method and device that a kind of records store data changes |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103605617A CN103605617A (en) | 2014-02-26 |
| CN103605617B true CN103605617B (en) | 2017-08-18 |
Family
ID=50123846
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201310594802.5A Active CN103605617B (en) | 2013-11-21 | 2013-11-21 | The method and device that a kind of records store data changes |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103605617B (en) |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105373471B (en) * | 2014-08-29 | 2019-05-24 | 腾讯科技(深圳)有限公司 | Detection method and device for RAM leakage loophole |
| CN111352932B (en) * | 2018-12-20 | 2023-08-15 | 中国移动通信集团广东有限公司 | Method and device for improving data processing efficiency based on bitmap tree algorithm |
| CN109725855B (en) * | 2018-12-29 | 2023-09-01 | 杭州宏杉科技股份有限公司 | A method and device for jump copying |
| CN110032475A (en) * | 2019-04-15 | 2019-07-19 | 苏州浪潮智能科技有限公司 | A kind of cloning process of logical volume, device and equipment |
| CN112667525A (en) * | 2020-12-23 | 2021-04-16 | 北京浪潮数据技术有限公司 | Used space measuring method and component of persistent memory |
| CN113553005B (en) * | 2021-07-06 | 2023-12-22 | 杭州宏杉科技股份有限公司 | Data read-write method, device and equipment for simplifying LUN |
| CN113986128B (en) * | 2021-10-26 | 2024-05-28 | 杭州宏杉科技股份有限公司 | LUN data replication method and device |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102067676A (en) * | 2008-06-23 | 2011-05-18 | 高通股份有限公司 | Method and apparatus for managing system information modification in a wireless communication system |
| CN102103629A (en) * | 2010-12-14 | 2011-06-22 | 西北工业大学 | Online data migration method |
| CN102473435A (en) * | 2009-09-24 | 2012-05-23 | 松下电器产业株式会社 | Write-once information recording medium, information recording method, information recording device, information reproduction method, information reproduction device and method for manufacturing information recording medium |
| CN103064766A (en) * | 2013-01-07 | 2013-04-24 | 天津火星科技有限公司 | Fast data synchronization method in continuous data protection technology |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7139932B2 (en) * | 2002-01-03 | 2006-11-21 | Hitachi, Ltd. | Data synchronization of multiple remote storage after remote copy suspension |
| JP2009117891A (en) * | 2007-11-01 | 2009-05-28 | Toshiba Corp | Wireless communication device |
-
2013
- 2013-11-21 CN CN201310594802.5A patent/CN103605617B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102067676A (en) * | 2008-06-23 | 2011-05-18 | 高通股份有限公司 | Method and apparatus for managing system information modification in a wireless communication system |
| CN102473435A (en) * | 2009-09-24 | 2012-05-23 | 松下电器产业株式会社 | Write-once information recording medium, information recording method, information recording device, information reproduction method, information reproduction device and method for manufacturing information recording medium |
| CN102103629A (en) * | 2010-12-14 | 2011-06-22 | 西北工业大学 | Online data migration method |
| CN103064766A (en) * | 2013-01-07 | 2013-04-24 | 天津火星科技有限公司 | Fast data synchronization method in continuous data protection technology |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103605617A (en) | 2014-02-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103605617B (en) | The method and device that a kind of records store data changes | |
| EP3905054B1 (en) | File management method, distributed storage system, and management node | |
| CN106372221B (en) | Method, device and system for file synchronization | |
| US9292217B2 (en) | Logical volume space sharing | |
| CN103180852B (en) | Distributed data processing method and apparatus | |
| CN110321301B (en) | Data processing method and device | |
| WO2017167171A1 (en) | Data operation method, server, and storage system | |
| WO2019144553A1 (en) | Data storage method and apparatus, and storage medium | |
| JP2020506444A (en) | Expired backup processing method and backup server | |
| JP2017537397A (en) | Data processing method, apparatus, and system | |
| CN104461768B (en) | copy storage device and copy storage method | |
| CN105938457A (en) | Data filtering method, and device and data reading system | |
| CN107111549B (en) | File system management method and device | |
| CN102014153A (en) | Data storage system and method thereof | |
| JP6288596B2 (en) | Data processing method and apparatus | |
| WO2015078132A1 (en) | Data storage method and storage server | |
| CN103778120A (en) | Global file identification generation method, generation device and corresponding distributed file system | |
| WO2017096521A1 (en) | Method and apparatus for extending user partition | |
| CN103036949A (en) | Optimization method and system of Cassandra system in virtual environment | |
| CN105528302B (en) | A kind of method and system of the dynamic hyperdisk of logic-based volume | |
| CN106855869B (en) | Method, device and system for realizing high availability of database | |
| WO2020083106A1 (en) | Node expansion method in storage system and storage system | |
| WO2016206070A1 (en) | File updating method and storage device | |
| CN118672515A (en) | Storage system | |
| CN107908713A (en) | A kind of distributed dynamic cuckoo filtration system and its filter method based on Redis clusters |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | 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 |