Data backup method, device, electronic device and storage medium

By identifying write operations in the logical volume and using bitmaps to determine unbacked data blocks, and prioritizing backup, the problem that the backup process affects business operations in the prior art is solved, and more efficient data backup and business continuity are achieved.

CN119739565APending Publication Date: 2025-04-01MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411916218.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The existing data backup method will affect business operations during the backup process, resulting in data blocks being unable to write new data in time, resulting in business interruption.

Method used

By identifying write operations in logical volumes, unbacked data blocks are determined using bitmaps and prioritized backups to reduce the impact on business operations.

Benefits of technology

Reduce business interruption time, improve backup efficiency, and ensure timely backup of data blocks and business continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739565A_ABST
    Figure CN119739565A_ABST
Patent Text Reader

Abstract

The present application discloses a data backup method, device, electronic device and storage medium. The method comprises: when a first write operation to a first data block in a logical volume is identified, a second data block that is not backed up in the first data block is determined according to the value of a bit corresponding to the first data block in a first bitmap corresponding to the first data block in the logical volume, wherein the bits in the first bitmap correspond to the data blocks one-to-one; and the second data block is backed up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data backup, and in particular to a data backup method, device, electronic device and storage medium. Background Art

[0002] A logical volume (LV) is a virtual logical disk divided from a volume group formed by physical disk partitions. It can also be called a disk partition. Multiple data blocks are stored in a logical volume.

[0003] Data backup can prevent data loss due to system failures and other reasons, and backing up data is an essential operation. In the process of data backup, the prior art directly traverses the bitmap to back up the data. It takes a certain amount of time to traverse the bitmap to back up the data. During this process, the business may continue to write data to certain data blocks in the logical volume. However, affected by the backup process, some data blocks may not be written with new data based on the business requirements during the backup process, causing a long interruption of the business, thereby affecting the business. Summary of the invention

[0004] The embodiments of the present application provide a data backup method, device, electronic device and storage medium, which can reduce the impact on business operations and shorten the time of business interruption by giving priority to backing up the second data block that has not been backed up but is about to be written with new data.

[0005] In a first aspect, an embodiment of the present application provides a data backup method, the method comprising:

[0006] In a case where a first write operation to a first data block in the logical volume is identified, determining a second data block that is not backed up in the first data block based on a value of a bit corresponding to the first bitmap of the first data block in the logical volume, the bits in the first bitmap corresponding to the data blocks in a one-to-one correspondence;

[0007] Back up the second data block.

[0008] In a second aspect, an embodiment of the present application provides a computing device, the computing device comprising: a backup process and a kernel module;

[0009] The kernel module is used to, when recognizing a first write operation to a first data block in the logical volume, determine a second data block that is not backed up in the first data block according to a value of a bit corresponding to the first bitmap of the first data block in the logical volume, wherein the bits in the first bitmap correspond to the data blocks one-to-one;

[0010] The backup process is used to back up the second data block.

[0011] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the processor being connected to the memory, the memory being used to store a computer program, and the processor being used to execute the computer program stored in the memory, so that the electronic device executes a method as in the first aspect, the second aspect or the third aspect.

[0012] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program enables a computer to execute a method as described in the first aspect, the second aspect, or the third aspect.

[0013] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and a computer operable to cause the computer to execute a method such as the first aspect, the second aspect, or the third aspect.

[0014] Implementing the embodiments of the present application has the following beneficial effects:

[0015] It can be seen that in an embodiment of the present application, when the first write operation to the first data block in the logical volume is identified, the second data block that is not backed up in the first data block is determined based on the value of the bit corresponding to the first data block in the first bitmap corresponding to the logical volume, and the bits in the first bitmap correspond one-to-one to the data blocks. The bits in the first bitmap correspond one-to-one to the data blocks, and the value of each bit in the first bitmap corresponds one-to-one to the state of the data block corresponding to each bit, that is, the value of each bit in the first bitmap is used to indicate whether the data block corresponding to each bit in the logical volume has been modified compared to the last backup. By recording the location of the data blocks that have been modified between the last backup and the current backup through the first bitmap, it is possible to obtain which data blocks have changed between the two backups without a full comparison, thereby improving the backup efficiency.

[0016] Further, in the case of identifying the first write operation to the first data block in the logical volume, based on the value of the bit corresponding to the first data block in the first bitmap corresponding to the logical volume, the second data block that has not been backed up in the first data block is determined. It should be noted that the value of the bit corresponding to the first bitmap of the second data block that has not been backed up is the first preset value, indicating that the second data block has not been backed up but is about to be written with new data. Therefore, in this case, in order to reduce the impact on the first write operation, the backup priority of the second data block should be increased. That is, the second data block is backed up, and the first write operation is performed after the second data block is backed up first. During the backup process, the backup process gives priority to backing up the second data block that has not been backed up but is about to be written with new data. It can prevent the situation that the second data block has not been backed up and is modified, thereby causing data omission; it can also prevent the situation that the second data block cannot be backed up for a long time because the bit corresponding to the second data block in the first bitmap has not been traversed for a long time, and the first write operation cannot be performed. That is, during the backup process, giving priority to backing up the second data block that has not been backed up but is about to be written with new data can not only ensure the accuracy of the backup data, but also reduce the impact on the business write operation and shorten the business interruption time. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A flowchart of a data backup method provided in an embodiment of the present application;

[0019] Figure 2 A schematic diagram of a mapping relationship between a data block and a bitmap provided in an embodiment of the present application;

[0020] Figure 3 A schematic diagram of a shared memory provided in an embodiment of the present application;

[0021] Figure 4 A schematic diagram of a backup system provided in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of a backup scenario provided in an embodiment of the present application;

[0023] Figure 6 A flowchart of another data backup method provided in an embodiment of the present application;

[0024] Figure 7 A schematic diagram of a process for obtaining a first bitmap provided in an embodiment of the present application;

[0025] Figure 8 A schematic diagram of a flow chart of a read or write operation of a data block provided in an embodiment of the present application;

[0026] Fig. 9 A schematic diagram of a metadata volume persistence process provided in an embodiment of the present application;

[0027] Fig.10 A flowchart of another data backup method provided in an embodiment of the present application;

[0028] Fig.11 A flowchart of a backup method for backing up high-priority data blocks in a backup process provided by an embodiment of the present application;

[0029] Fig.12 A flowchart of another data backup method provided in an embodiment of the present application;

[0030] Fig.13 A schematic diagram of an external storage format provided in an embodiment of the present application;

[0031] Fig.14 A block diagram of the functional units of a computing device provided in an embodiment of the present application;

[0032] Fig.15 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0034] The terms "first", "second", "third" and "fourth" etc. in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0035] Reference to "embodiments" herein means that a particular feature, result, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0036] In order to facilitate understanding of the technical solution of the present application, the relevant technical terms involved in the present application are first explained.

[0037] Kernel module: A module in an operating system. It runs in system state and is used to extend basic kernel functions and allows dynamic loading or unloading during system operation.

[0038] LVM: short for Logical Volume Manager, is a mechanism for managing disk partitions in Linux. It combines several physical disk partitions (physical volumes) into a storage pool or volume group for unified management. LVM can divide logical volumes of different sizes from the volume group to create new logical devices each time.

[0039] A logical volume (LV) is a virtual logical disk divided from a volume group formed by a combination of physical disk partitions. It can also be called a disk partition.

[0040] Chunk: A data block is the basic unit of data storage. Each data block can contain three parts: block tag, data block size, and data.

[0041] Bitmap: A bitmap is a data structure used to store a large amount of Boolean data (i.e., each data has only two states: 0 or 1). It uses each bit to represent a state, thereby saving memory space and improving operating efficiency. In a computer, the smallest storage unit is a byte, and a bitmap uses bits to store and operate data. It should be noted that the bitmap in this application refers to a dirty chunk bitmap. Each value in the bitmap is used to indicate the state of the data block corresponding to each bit in the logical volume, that is, to identify which data chunks have been modified between the last backup and the current backup. In this application, a first preset value is used to identify that a data block has been modified between the last backup and the current backup, and a second preset value is used to identify that a data block has not been modified between the last backup and the current backup.

[0042] Copy-on-Write (COW): COW is a memory management strategy. Its core idea is that if multiple callers request the same resource (such as memory or data storage on disk) at the same time, multiple callers will obtain the same pointer to the same resource together. Until a caller tries to modify the content of the resource, the system will actually copy a dedicated copy to the caller, while the original resource seen by other callers remains unchanged. This process is transparent to other callers.

[0043] Eventfd: It is a system call of Linux, which is used to create a file descriptor for event notification. The eventfd() function will create an eventfd object. The user-space application can use this eventfd to implement the waiting or notification mechanism of events, and it can also be used by the kernel space to notify new events to the user-space application.

[0044] First, let's introduce the existing backup methods. The existing data backup methods mainly include full backup and incremental backup. In the process of full backup, all data files will be copied. Each full backup will contain data that has not changed since the last backup, which leads to data duplication and requires more storage resources and longer backup time, reducing backup efficiency and increasing backup costs.

[0045] Secondly, the existing incremental backup method uses the specific value of the bit in the bitmap to mark the write operation of the data. When backup is required, the data corresponding to the bit of the specific value is backed up. However, when there is a business need to perform a write operation on the data block, and the data block has not been backed up, the write operation may not be performed normally. For example, if the value of the bit with indexes 2, 4, 5, 6, 7, 11 and 14 in the bitmap is the first preset value, it means that the data blocks corresponding to these bits have been modified and need to be backed up. When backing up to the data block corresponding to the bitmap index 2, if the write operation of the data block corresponding to the bitmap index 14 is obtained, since the data block corresponding to the bitmap index 14 has not been backed up, therefore, in order to ensure the accuracy of the data record, it is necessary to wait for the bitmap to traverse the bit with index 2 to index 14 in turn, and then the data block corresponding to the bitmap index 14 can be backed up, and then the write operation of the data block corresponding to the bitmap index 14 can be written normally. It can be seen that this incremental backup method will affect the write operation of the business and cause a long interruption of the business.

[0046] Therefore, there is an urgent need for a data backup method that can both improve backup efficiency and reduce the impact on business.

[0047] See also Figure 1 , Figure 1A flow chart of a data backup method provided in an embodiment of the present application is provided. The method is applied to a computing device. In the implementation of the present application, the computing device may include a server, a host, a user device, etc., and the present application does not specifically limit this. The present application mainly uses the computing device as a server as an example for explanation. The method includes but is not limited to steps 101-102:

[0048] 101: When a first write operation to a first data block in a logical volume is identified, a second data block that is not backed up in the first data block is determined based on the value of a corresponding bit of the first data block in a first bitmap corresponding to the logical volume, wherein the bits in the first bitmap correspond one-to-one to the data blocks.

[0049] The value of each bit in the first bitmap is used to indicate the status of the data block corresponding to each bit in the logical volume.

[0050] It should be noted that the present application first describes the logical volume and the data block. A logical volume can store multiple data blocks. For example, if the capacity of the logical volume is 1MB and the capacity of a third data block is 4096B, then a logical volume can store 256 data blocks. Figure 2 As shown, the logical volume can store 256 data blocks, and the 256 data blocks can be numbered in sequence as 0, 1, 2, ..., 255. The number of each data block is used as the block mark of the data block, that is, it can be marked as data block 0, data block 1, data block 2, data block 3, data block 4, ..., data block 254, data block 255.

[0051] For example, when backing up a logical volume, a memory block is allocated for the logical volume to create a bitmap corresponding to the logical volume, which is used to record the location of the data blocks modified between the last backup and the current backup. It is not necessary to compare all the data blocks to find out which data blocks have changed between the two backups.

[0052] Specifically, create the first bitmap corresponding to the logical volume. Continuing with the above example, since the number of data blocks is 256, a bitmap of 32B can be created. A bitmap of 32B (bytes) has 256 bits, and the value of each bit (0 or 1) can be used to represent the state of the data block corresponding to each bit in the logical volume. Figure 2 As shown, the first bitmap has 256 bits (such as Figure 20, 1, 2, 3, 4, 5, 6, 7, ..., 253, 254, 255 in the first bitmap), each bit corresponds to each data block. The value of each bit in the first bitmap is used to indicate the state of the data block corresponding to each bit in the logical volume (such as 0 or 1 in the first bitmap). It should be noted that in this application, 0 represents the non-modified state and 1 represents the modified state. That is, if data block 0 and data block 3 are modified, the value of the bit with index 0 corresponding to data block 0 in the first bitmap is modified to 1, and the value of the bit with index 3 corresponding to data block 3 in the first bitmap is modified to 1 to record that data block 0 and data block 3 have been modified.

[0053] In one embodiment of the present application, a conventional backup method in the present application is first described as an example. That is, the first bitmap corresponding to the logical volume is obtained, the first bitmap is traversed, and the data blocks in the logical volume are backed up. After reading the first bitmap, a data backup method of the present application is started, which can be referred to as a method for traversing the bitmap to perform data block backup. Specifically, it includes: traversing the first bitmap to back up the data blocks in the logical volume. That is, traversing the first bitmap, backing up the data blocks corresponding to the bits in the first bitmap whose values ​​are the first preset values ​​in the logical volume. Wherein, the value of each bit in the first bitmap is used to indicate the state of the data blocks corresponding to each bit in the logical volume. Specifically, the backup process traverses the value of each bit in the first bitmap, and when the value traversed to the bit is the first preset value (it should be noted that the first preset value in the present application is 1), the index corresponding to the bit is obtained, based on the corresponding relationship between the bits in the first bitmap and the data blocks in the logical volume, the data blocks corresponding to the index are read from the logical volume, and the data blocks are backed up, that is, added to the output queue. Then, the value of the bit is changed to the second preset value (it should be noted that the second preset value in the present application is 0). Until the traversal of the first bitmap is completed. It should be noted that when traversing, after traversing to a plurality of bits whose values ​​are the first preset values, the indexes corresponding to the plurality of bits can be obtained, and then based on the correspondence between the plurality of bits in the first bitmap and the data blocks in the logical volume, the plurality of data blocks corresponding to the indexes corresponding to the plurality of bits can be read from the logical volume, and the plurality of data blocks can be backed up, i.e., added to the output queue. This application does not make specific limitations on this.

[0054] In one embodiment of the present application, when a first write operation to a first data block in the logical volume is identified, a second data block that is not backed up in the first data block is determined based on the value of a bit corresponding to the first data block in the first bitmap corresponding to the logical volume. In order to avoid the impact of the backup process on the business read and write operations, the logical volume can still perform read and write operations during the data backup process. Therefore, if a first write operation to a first data block in the logical volume is identified, the first data block will be judged and processed to avoid missing data. It should be noted that there is no limit on the number of the first data blocks.

[0055] Specifically, based on the value of the bit corresponding to the first bitmap corresponding to the first data block of the logical volume, the second data block that is not backed up in the first data block is determined. There is no limit on the number of the second data blocks. The value of the bit corresponding to the first bitmap of the second data block is the first preset value. If the second data block exists in the first data block, it means that there is a business need to perform a write operation on the second data block, but the second data block has not been backed up yet. If the second data block is directly written at this time, it may cause the write operation to fail to proceed normally. Therefore, the second data block needs to be backed up first, and it is determined that the second data block is a high-priority backup data, and a special backup method is required for the second data block. For example, if the values ​​of the bits indexed as 2, 4, 5, 6, 7, 11 and 14 in the bitmap are the first preset value, that is, 1, it means that the data blocks corresponding to these bits have been modified and need to be backed up. When backing up to the data block corresponding to the bitmap index 2, if a write operation is obtained for the data block corresponding to the bitmap index 14 (the data block corresponding to the bitmap index 14 can be regarded as the first data block at this time), since the data block corresponding to the bitmap index 14 has not been backed up, in order to ensure the accuracy of the data backup and avoid the impact on the business write operation, the data block corresponding to the bitmap index 14 should be backed up in time, that is, to improve the accuracy of the data backup and avoid the impact on the business write operation. Instead of waiting for the bitmap to traverse from the bit with index 2 to the bit with index 14 in sequence as in the prior art, the data block corresponding to the bitmap index 14 should be backed up. Then, the write operation is performed on the data block corresponding to the bitmap index 14.

[0056] 102: Back up the second data block.

[0057] Exemplarily, backing up the second data block includes: obtaining an index corresponding to the second data block, reading the second data block in the logical volume based on the index of the second data block, and then adding the second data block to an output queue. The output queue is a buffer for storing data to be processed. When backing up a data block, the backed-up data block will be placed in this queue for subsequent processing and transmission. Specifically, the output queue can be stored in a hard disk, or distributed storage can be performed, etc., to achieve persistent backup of data, which is not limited in this application.

[0058] Optionally, before backing up the second data block, the second data block may be written into the shared memory; the second data block may be read from the shared memory, and then the second data block may be added into the output queue.

[0059] It can be seen that in the embodiment of the present application, before backing up the second data block, the second data block is written to the shared memory; and the second data block is read from the shared memory. Because the speed of device accessing memory is faster than the speed of accessing logical volume, therefore, first writing the second data block to the shared memory; and then reading the second data block from the shared memory can speed up the efficiency of backing up the second data block, so that the first write operation can be executed quickly.

[0060] It should be noted that after the second data block is backed up, the storage location corresponding to the second data block in the shared memory will be released, allowing other write operations to modify the storage location.

[0061] It should be noted that in the present application, the method for backing up the second data block recorded in steps 101-102 is another data backup method in the present application, which can be referred to as a backup method for backing up data blocks with high priority first. When performing the backup method for backing up data blocks with high priority first, the method for backing up data blocks by traversing the bitmap can be suspended. The two backup methods can also be performed in parallel, and the present application does not make specific restrictions on this.

[0062] It can be seen that in an embodiment of the present application, when the first write operation to the first data block in the logical volume is identified, the second data block that is not backed up in the first data block is determined based on the value of the bit corresponding to the first bitmap corresponding to the first data block in the logical volume, and the bits in the first bitmap correspond one-to-one to the data blocks. The bits in the first bitmap correspond one-to-one to the data blocks, and the value of each bit in the first bitmap corresponds one-to-one to the state of the data block corresponding to each bit, that is, the value of each bit in the first bitmap is used to indicate whether the data block corresponding to each bit in the logical volume has been modified compared to the last backup. By recording the location of the data blocks that have been modified between the last backup and the current backup through the first bitmap, it is possible to obtain which data blocks have changed between the two backups without a full comparison, thereby improving the backup efficiency.

[0063] Further, in the case of identifying the first write operation to the first data block in the logical volume, based on the value of the bit corresponding to the first data block in the first bitmap corresponding to the logical volume, the second data block that has not been backed up in the first data block is determined. It should be noted that the value of the bit corresponding to the first bitmap of the second data block that has not been backed up is the first preset value, indicating that the second data block has not been backed up but is about to be written with new data. Therefore, in this case, in order to reduce the impact on the first write operation, the backup priority of the second data block should be increased. That is, the second data block is backed up, and the first write operation is performed after the second data block is backed up first. During the backup process, the backup process gives priority to backing up the second data block that has not been backed up but is about to be written with new data. It can prevent the situation that the second data block has not been backed up and is modified, thereby causing data omission; it can also prevent the situation that the second data block cannot be backed up for a long time because the bit corresponding to the second data block in the first bitmap has not been traversed for a long time, and the first write operation cannot be performed. That is, the backup process gives priority to backing up the second data block that has not been backed up but is about to be written with new data during the backup process, which can ensure the accuracy of the backup data and reduce the impact on the business write operation and shorten the business interruption time.

[0064] In one embodiment of the present application, after completing step 102, the following steps are also included but not limited to:

[0065] 201: Determine the bit in the first bitmap corresponding to the second data block.

[0066] Specifically, based on the correspondence between the data blocks in the logical volume and the bits in the first bitmap, the bits in the first bitmap corresponding to the second data blocks are determined.

[0067] 202: Adjust the value of the bit corresponding to the second data block in the first bitmap to obtain a second bitmap.

[0068] It should be noted that after the backup of the second data block is completed, in order to avoid duplicate backup, the value of the bit corresponding to the second data block in the first bitmap is modified to a second preset value, that is, to 0, to obtain a second bitmap. The second preset value indicates that the second data block has been successfully backed up, and subsequent backups are performed based on the second bitmap.

[0069] 203: traverse the second bitmap to back up the third data block in the logical volume that has not been backed up.

[0070] It should be noted that before executing step 203, it is also necessary to determine whether the traversal operation on the second bitmap is completed, that is, whether the value of each bit in the second bitmap is 0. If so, it means that the operation of backing up the data blocks in the logical volume has been completed.

[0071] If not, the second bitmap is traversed to back up the third data block in the logical volume that has not been backed up, that is, the second bitmap is traversed to back up the third data block in the logical volume corresponding to the bit in the second bitmap whose value is the first preset value.

[0072] Specifically, the value of each bit in the second bitmap is traversed, and when the traversed bit value is a first preset value (it should be noted that the first preset value in the present application is 1), the index corresponding to the bit is obtained, and based on the correspondence between the bits in the second bitmap and the data blocks in the logical volume, the data block corresponding to the index is read from the logical volume, and the data block is backed up, that is, added to the output queue.

[0073] It can be seen that in the embodiment of the present application, after the backup of the second data block is completed, the value of the bit corresponding to the second data block in the first bitmap is modified to the second preset value, that is, to 0, to obtain the second bitmap. The second preset value indicates that each first data block has been successfully backed up, and subsequent backups are performed based on the second bitmap, which can avoid duplicate backups and improve backup efficiency.

[0074] Optionally, traversing the second bitmap to back up the third data block that has not been backed up in the logical volume includes: obtaining a first quantity of the second data blocks; determining a first cache usage rate of the shared memory based on the first quantity, the cache capacity of the shared memory, and the capacity of the third data blocks; and traversing the second bitmap based on the first cache usage rate to back up the third data block that has not been backed up in the logical volume.

[0075] Specifically, the first number of second data blocks can be counted based on the number of times the second data block is read. Then, based on the cache capacity of the shared memory and the capacity of the third data block, the total number of third data blocks that can be cached by the cache capacity is determined, that is, the ratio of the cache capacity to the capacity of the third data block can be used as the total number. It should be noted that the cache capacity of the shared memory is the cache capacity of the shared memory after removing the second bitmap and the circular queue. Based on the first number and the total number, the first cache usage rate is determined, that is, the ratio of the first number to the total number can be used as the first cache usage rate.

[0076] Further, based on the cache capacity of the shared memory and the capacity of the third data block, the total number of data blocks that can be cached by the cache capacity is determined, and based on the first number and the total number, the first cache usage rate is determined. The first cache usage rate can be determined by formula (1):

[0077] First cache usage rate = first quantity / (cache capacity / data block size) Formula (1)

[0078] It should be noted that in the embodiment of the present application, the first cache usage rate represents the cache usage rate of the second data block for the shared memory. That is, the cache usage rate of the high-priority data block for the shared memory. Since the process of traversing the second bitmap for backup involves the read operation of the logical volume. The process of copying the high-priority data block on write also involves the read operation of the logical volume. The read operation resources that the logical volume can carry at the same time are limited. Therefore, the read operation of the logical volume in the process of traversing the second bitmap for backup and the read operation of the logical volume in the process of copying the high-priority data block on write are in a competitive relationship. In order to avoid the read operation of the logical volume involved in the process of traversing the second bitmap for backup, the influence of the read operation of the logical volume also involved in the process of copying the high-priority data block on write, that is, in order to quickly copy the high-priority data block on write, and quickly read the second data block from the logical volume to the shared memory, it is necessary to limit the read operation of the logical volume involved in the process of traversing the second bitmap for backup.

[0079] Specifically, the utilization rate of the first cache of the shared memory by the current high-priority data block (i.e., the second data block) can be used to predict the utilization rate of the cache of the shared memory by the future high-priority data block. That is, if the utilization rate of the first cache of the shared memory by the second data block that has not been backed up last time but is about to be written with new data is high, it means that the current write operation business is relatively busy, and it can be inferred that the write operation will most likely be more frequent within the preset time in the future. Therefore, in order to ensure that the high-priority data block can be quickly copied on write within the preset time in the future, it is necessary to limit the read operation of the logical volume involved in the process of traversing the second bitmap for backup.

[0080] Exemplarily, based on the first cache usage rate, traversing the second bitmap to back up the third data block that is not backed up in the logical volume includes:

[0081] Optionally, if the first cache usage rate is less than a first threshold, based on the first cache usage rate, the second cache usage rate and the concurrency, determine the second number of third data blocks to be backed up by traversing the second bitmap, and the second cache usage rate corresponds to the second data block. That is, the second cache usage rate is the cache space reserved for the second data block next time. Traverse the value of each bit in the second bitmap, and back up the second number of third data blocks from the logical volume. If in the process of backing up the second number of third data blocks, a second write operation to a fourth data block in the logical volume is identified, and there are unbacked-up second data blocks in the fourth data block, back up the second data block until the backup of the logical volume is completed. If in the process of backing up the second number of third data blocks, a second write operation to the fourth data block in the logical volume is not identified, or, if a second write operation to the fourth data block in the logical volume is identified, and there are unbacked-up second data blocks in the fourth data block, back up the second number of third data blocks from the logical volume again until the backup of the logical volume is completed.

[0082] Specifically, if the first cache usage rate is less than the first threshold, it means that the second data block that has not been backed up last time but is about to be written with new data has a low first cache usage rate for the shared memory, indicating that the current write operation business is less busy. Therefore, the read operation of the logical volume involved in the process of traversing the second bitmap for backup can be carried out normally, but in this process, it may still be necessary to perform a write-time copy on the data block that has not been backed up yet but is about to be written with new data, and perform a read operation on the logical volume. In order to ensure that the read operation can be carried out normally, it is necessary to limit the read operation of the logical volume in the process of traversing the second bitmap for backup to prevent the occupation of the read operation resources that the logical volume can carry at the same time.

[0083] Based on the first cache usage rate, the second cache usage rate and the concurrency, the second number of the third data blocks traversing the second bitmap for backup is determined. Specifically, based on the second cache usage rate, the third cache usage rate that the third data blocks traversing the second bitmap for backup occupy the largest is determined. For example, if the cache space reserved for the second data block next time is a, the third cache usage rate that the third data blocks traversing the second bitmap for backup occupy the largest is 1-a.

[0084] Based on the third cache usage rate and the first cache usage rate, a fourth cache usage rate is determined. The difference between the third cache usage rate and the first cache usage rate can be used as the fourth cache usage rate. For example, if the first cache usage rate is b, the fourth cache usage rate is 1-ab.

[0085] Furthermore, based on the fourth cache usage rate and concurrency, the second number is determined, that is, the product of the fourth cache usage rate and concurrency is taken as the second number. The concurrency can be understood as the maximum number of data blocks that the server can read simultaneously at the same time, that is, the set maximum concurrent processing capacity, wherein the preset concurrency can be adjusted based on the busyness of the server business. Based on the fourth cache usage rate and concurrency, the second number is determined, that is, the second number of data blocks that the server can process simultaneously in one cycle when only the fourth cache usage rate is used.

[0086] Furthermore, based on the second cache usage rate, determine the third cache usage rate that is occupied by the third data block traversed through the second bitmap for backup; determine the fourth cache usage rate based on the third cache usage rate and the first cache usage rate; determine the second number based on the fourth cache utilization rate and concurrency, and determine the second number. The second number can be determined by formula (2):

[0087] Second quantity = (1-second cache usage rate-first cache usage rate)*preset concurrency formula (2)

[0088] It can be seen that in the embodiment of the present application, based on the second cache usage rate, the third cache usage rate that the third data block traversing the second bitmap for backup occupies the largest is determined; based on the third cache usage rate and the first cache usage rate, the fourth cache usage rate is determined; based on the fourth cache usage rate and the concurrency, the second quantity is determined. Only the fourth cache usage rate is used to traverse the second bitmap to back up the data blocks, and the second cache usage rate is reserved for the operation of copying on write for the data blocks that have not been backed up yet but are about to be written with new data. It can ensure that the copy-on-write operation is performed on the data blocks that have not been backed up yet but are about to be written with new data, so that the read operation on the logical volume can be performed efficiently and quickly. It ensures that the high-priority data blocks that have not been backed up yet but are about to be written with new data can be quickly backed up, thereby reducing the impact on the write operation of the business, so that the operation of writing new data can be performed quickly.

[0089] Exemplarily, the value of each bit in the second bitmap is traversed, and the second number of third data blocks are backed up from the logical volume. That is, the method of executing the backup process by traversing the bitmap to back up the data blocks. Specifically, the value of each bit in the second bitmap is traversed, and the data blocks corresponding to the value of the first preset value are backed up until the number of backed-up data blocks reaches the second number. It should be noted that after traversing the second number of bits in the second bitmap whose values ​​are the first preset value, the second number of data blocks can be backed up at one time based on the corresponding relationship.

[0090] Furthermore, if during the process of backing up the second number of third data blocks, a second write operation on a fourth data block in the logical volume is identified, and the fourth data block contains the second data block that has not been backed up, the second data block is backed up until the backup of the logical volume is completed. That is, during the process of backing up the second number of third data blocks, the second write operation needs to modify the second data block that has been modified but not backed up. Therefore, in order to avoid delaying the second write operation, the second data block needs to be backed up. Specifically, the method for backing up the second data block is to cyclically execute the method for backing up the second data block recorded in step 102, and then execute the method recorded in steps 201-203 until the backup of the logical volume is completed.

[0091] Furthermore, if during the process of backing up the second number of third data blocks, the second write operation to the fourth data block in the logical volume is not identified, or if the second write operation to the fourth data block in the logical volume is identified and there is no second data block that has not been backed up in the fourth data block, the second number of third data blocks are backed up again from the logical volume until the backup of the logical volume is completed. Specifically, the method of backing up the second number of third data blocks from the logical volume has been described in the above embodiment, and this application will not repeat it here.

[0092] It can be seen that in the embodiment of the present application, when the first cache usage rate is less than the first threshold value, that is, when the current write operation business is relatively unbusy, part of the resources can be allocated to the process of backing up by traversing the bitmap. That is, based on the first cache usage rate, the second cache usage rate and the concurrency, the second number of third data blocks to be backed up by traversing the second bitmap is determined, the value of each bit in the second bitmap is traversed, and the second number of third data blocks are backed up from the logical volume. Without affecting the backup efficiency, the copy-on-write operation that has not yet been backed up but is about to be written with new data can be carried out normally. Ensure that high-priority data blocks that have not yet been backed up but are about to be written with new data can be quickly backed up, thereby reducing the impact on the business's write operations, so that the operation of writing new data can be performed quickly.

[0093] Furthermore, until the number of backed-up data blocks reaches the second number, the second bitmap will be modified to obtain a new second bitmap. It is determined whether the traversal operation of the new second bitmap is completed, that is, whether the value of each bit in the new second bitmap is 0. If so, it indicates that the operation of backing up the data blocks in the logical volume has been completed. If not, continue to traverse the value of each bit in the new second bitmap, and back up the second number of third data blocks from the logical volume; traverse the value of each bit in the new second bitmap, and back up the data blocks corresponding to the value of the first preset value, until the traversal of the new second bitmap is completed.

[0094] Optionally, if the first cache usage rate is greater than or equal to a first threshold, the second bitmap is traversed based on the first cache usage rate to back up the third data block in the logical volume that has not been backed up, including: pausing the backup of the third data block in the logical volume; within a preset duration of pausing the backup of the third data block in the logical volume, when a second write operation to a fourth data block in the logical volume is identified and the fourth data block contains the second data block that has not been backed up, backing up the second data block until the backup of the logical volume is completed.

[0095] Within the preset time length of pausing the backup of the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified and there is no second data block that has not been backed up in the fourth data block, traverse the value of each bit in the second bitmap to back up the third data block in the logical volume; in the process of traversing the value of each bit in the second bitmap to back up the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is identified and there is the second data block that has not been backed up in the fourth data block, back up the second data block until the backup of the logical volume is completed.

[0096] Specifically, if the first cache usage rate is greater than or equal to the first threshold, it means that the second data block that has not been backed up last time but is about to be written with new data has a higher first cache usage rate for the shared memory, indicating that the current write operation business is relatively busy. Therefore, it is necessary to suspend the operation of backing up the third data block in the logical volume, that is, to suspend the method of backing up by traversing the second bitmap. Prevent the read operation of the logical volume during the backup process by traversing the second bitmap from competing with the read operation of the logical volume during the copy-on-write process of the second data block that has not been backed up but is about to be written with new data, and reduce the impact of the read operation on the logical volume during the copy-on-write process. Therefore, the backup of the third data block in the logical volume is suspended first.

[0097] Furthermore, within the preset time period of suspending the backup of the third data block in the logical volume, when the second write operation to the fourth data block in the logical volume is identified, and the second data block that has not been backed up exists in the fourth data block, it indicates that the current write operation is relatively busy, and the second write operation is for the second data block that has not been backed up but is about to be modified. Therefore, the second data block is a high-priority data block and needs to be backed up. Specifically, the method for backing up the second data block is to cyclically execute the method for backing up the second data block recorded in step 102, and then execute the method recorded in steps 201-203 until the backup of the logical volume is completed.

[0098] It can be seen that in the embodiment of the present application, if the first cache usage rate is greater than or equal to the first threshold value, it means that the second data block that has not been backed up last time but is about to be written with new data has a higher first cache usage rate for the shared memory, indicating that the current write operation business is relatively busy. Therefore, it is necessary to suspend the operation of backing up the third data block in the logical volume, that is, to suspend the backup process by traversing the second bitmap to perform backup. Prevent the backup process from competing with the logical volume read operation during the backup process by traversing the second bitmap, and the logical volume read operation during the write-time copy process of the data block that has not been backed up but is about to be written with new data, thereby reducing the impact of the read operation on the logical volume during the write-time copy process. Therefore, the backup of the third data block in the logical volume is first suspended to ensure that if a high-priority data block that has not been backed up but is about to be written with new data is currently needed, it can be quickly backed up, thereby reducing the impact on the business write operation, so that the operation of writing new data can be quickly executed.

[0099] Furthermore, during the preset time period of suspending the backup of the third data block in the logical volume, when the second write operation to the fourth data block in the logical volume is identified, and the second data block that has not been backed up exists in the fourth data block, it indicates that the second data block has not been backed up but is about to be written with new data. Therefore, in this case, in order to reduce the impact on the second write operation, the backup priority of the second data block should be increased, and the second data block should be backed up first before the second write operation. This can prevent the situation where the second data block has not been backed up and is modified, resulting in data omission; it can also prevent the situation where the second data block cannot be backed up for a long time because the bit corresponding to the second data block in the second bitmap has not been traversed for a long time, resulting in the second data block being delayed and the second write operation cannot be executed.

[0100] Optionally, within the preset time length of suspending the backup of the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified, and there is no second data block that is not backed up in the fourth data block, the value of each bit in the second bitmap is traversed to back up the third data block in the logical volume. Within the preset time length of suspending the backup of the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified, and there is no second data block that is not backed up in the fourth data block, it can be predicted that the busyness of the current write operation business is relatively low. Since the preset time length has been separated, the first cache usage rate of the shared memory is no longer referenceable. Therefore, in order to avoid the impact on the backup efficiency, the second bitmap can be traversed to back up the data blocks in the logical volume. Specifically, the method of traversing the second bitmap to back up the data blocks in the logical volume is similar to the method of traversing the first bitmap to back up the data blocks in the logical volume recorded in step 101, and is not repeated herein.

[0101] In the process of traversing the value of each bit in the second bitmap and backing up the third data block in the logical volume, when a second write operation to a fourth data block in the logical volume is identified and the fourth data block contains the second data block that has not been backed up, the second data block is backed up until the backup of the logical volume is completed. Specifically, the method for backing up the second data block is to cyclically execute the method for backing up the second data block recorded in step 102, and then execute the method recorded in steps 201-203 until the backup of the logical volume is completed.

[0102] It can be seen that in the embodiment of the present application, if the first cache usage rate is greater than or equal to the first threshold, the backup of the third data block in the logical volume will not be suspended all the time. Instead, a preset duration will be set. If within the preset duration, the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified, and there is no second data block that is not backed up in the fourth data block, the second bitmap will be traversed to back up the third data block in the logical volume. Within the preset duration of suspending the backup of the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified, and there is no second data block that is not backed up in the fourth data block, it can be predicted that the current write operation business is relatively low in busyness. Since the preset duration has been separated, the first cache usage rate of the shared memory is no longer of reference value. Therefore, there is no need to suspend the backup of the third data block in the logical volume all the time, but the second bitmap is continuously traversed to back up the third data block in the logical volume, thereby improving the backup efficiency of the data blocks in the logical volume.

[0103] In one embodiment of the present application, the computing device includes a backup process, a kernel module, and a shared memory, and the method further includes:

[0104] The kernel module writes the second data block into the shared memory. The kernel module sends a notification to the backup process; in response to the notification, the backup process reads the second data block from the shared memory and backs up the second data block.

[0105] Exemplarily, the kernel module writes the second data block into the shared memory. Specifically, after determining that the second data block is high-priority backup data, the second data block is read into the shared memory so that the backup process can also read the second data block.

[0106] Exemplarily, the kernel module sends a notification to the backup process. The kernel module sends a notification to the backup process. It should be noted that the notification is used to instruct the backup process to read data from the shared memory. Specifically, the message communication between the kernel module and the backup process is implemented through the eventfd mechanism, that is, the kernel module sends a notification to the backup process through the eventfd mechanism. The content of the notification can be 1, and this 1 can be regarded as a flag or signal, indicating that there is data in the shared memory ready to be read, or a certain operation has been completed, and the next step of processing can be carried out, and the backup process can read data from the shared memory.

[0107] Exemplarily, the backup process reads the second data block from the shared memory in response to the notification and backs up the second data block. In the process of traversing the first bitmap and backing up the data blocks in the logical volume, a notification is obtained from the kernel module of the computing device.

[0108] Specifically, the backup process responds to the notification and reads the shared memory. Figure 3 As shown in the figure, a circular queue is created in the shared memory, and the data in the shared memory is efficiently managed through the circular queue. First, the header information of the circular queue is read. Among them, there are two fields in the header information, head and tail. Head represents the head of the data, and tail represents the tail of the data. Head and tail point to the index where the data is stored in the queue. After the backup process reads the header information, it can read the corresponding data in the shared memory based on the index (such as Figure 3 e1, e2, e3, ..., en in ). Specifically, Figure 3 As shown, if the data corresponding to the index is determined to be e1, e2, and e3 based on head=3 and tail=1, the backup process reads e1, e2, and e3. For example, chunk_offset and data_offset are stored in e1, where chunk_offset indicates the location of the data block in the logical volume (e.g. Figure 3 c1, c2, ..., cn) in the shared memory, for example, it can be 14; data_offset represents the position of the data block in the shared memory, for example, it can be c1. It should be noted that the data block can be any one of the second data blocks. In addition, the first bitmap and the second data block are also stored in the shared memory. Then, the backup process can read the first data block and the position of the first data block in the logical volume based on the information read from e1. Based on this reading method, all the first data blocks stored in the shared memory are read.

[0109] Furthermore, the backup process backs up the second data block. The specific backup method is similar to the backup method recorded in step 102, and this application will not repeat it here.

[0110] It should be noted that in one embodiment of the present application, the data backup method is applied to a computing device, the computing device includes a backup process, a kernel module and a shared memory, and the backup method can be implemented in an interactive manner. Figure 4 , Figure 4 A schematic diagram of a backup system provided in an embodiment of the present application. The backup system includes a backup process 401 of a computing device, a kernel module 402 of a computing device, a shared memory 403 of a computing device, and a logical volume 404 (including Figure 4407), volume group 405, output queue 406, and memory 407. It should be noted that the logical volume is a virtual division of the volume group 405 formed by the combination of physical disk partitions, such as Figure 4 As shown, the volume group 405 can be divided into multiple logical volumes, such as Figure 4 The present application does not limit the number of divided logical volumes, nor the size of each logical volume, and the size of each divided logical volume may be the same or different. The embodiment of the present application takes the backup of logical volume 1 as an example for explanation. The backup process 401 runs in the user space, and the kernel module 402 runs in the kernel space. During the process of backing up the data of logical volume 1 in the logical volume 404 by the kernel module 402, a shared memory 403 is created in the memory 407 to realize the communication between the backup process 401 and the kernel module 402 through the shared memory 403.

[0111] The backup process 401 of the computing device reads a first bitmap from the shared memory 403 of the computing device, wherein the value of each bit in the first bitmap is used to indicate the state of the data block corresponding to each bit in the logical volume 1; the kernel module 402 identifies the first write operation to the first data block in the logical volume; the kernel module 402 responds to the first write operation, reads the first bitmap corresponding to the logical volume 1, and determines the second data block that is not backed up in the first data block based on the value of the bit corresponding to the first data block in the first bitmap corresponding to the logical volume; writes the second data block in the first data block to the shared memory 403, wherein the value of the bit corresponding to the second data block in the first bitmap is a first preset value; and sends a notification to the backup process 401. The backup process 401 of the computing device obtains a notification from the kernel module 402 of the computing device, wherein the notification is used to instruct the backup process 401 to read data from the shared memory 403; the backup process 401 of the computing device responds to the notification, reads the second data block from the shared memory 403; and backs up the second data block. Specifically, as Figure 4 As shown, the second data block can be added to the output queue 406, which is a buffer for storing data to be processed. When the backup process backs up the data block, the data block will be placed in this queue for subsequent processing and transmission. Specifically, the output queue 406 can be stored in a hard disk or distributedly stored, etc., which is not limited in this application.

[0112] It should be noted that the data blocks in the present application can be stored in a storage device, which can be a memory, a hard disk, a logical volume, etc. The present application does not limit this. In the present application, the storage device is a logical volume as an example for explanation, that is, the data blocks in the present application are stored in a logical volume.

[0113] In one embodiment of the present application, the computing device includes a backup process, a kernel module, and a shared memory. In the present application, the computing device is taken as an example of a server to illustrate a specific scenario of performing backup through the backup process, the kernel module, and the shared memory. Figure 5 As shown, Figure 5 A schematic diagram of a backup scenario provided in an embodiment of the present application.

[0114] Optionally, the present application backs up the data blocks in the logical volume through the incremental backup tool in the server. The incremental backup tool includes a kernel module (dm-backup) and a backup process (backup-tool). Specifically, the kernel module can be understood as a process running in kernel space (kernel-space), and the backup process can be understood as a process running in user space (user-space), or a program running in user space (user-space). The backup process includes first creating a kernel module for each logical volume, such as logical volume 0 (lvol0) and logical volume 1 (lvol1) as shown in the figure, and logical volume 0 and logical volume 1 each correspond to a different kernel module. Then each kernel module applies for a piece of memory in the kernel space to store the bitmap of the corresponding logical volume, and uses each bit in the bitmap to mark the status of the data block corresponding to the bit in the logical volume. As Figure 5 As shown, for logical volume 0 and logical volume 1, logical volume 0 corresponds to the third bitmap (dirychunk bitmap_3), and logical volume 1 corresponds to the first bitmap (diry chunk bitmap_1). The first bitmap and the third bitmap are stored in the metadata volume in a certain data format to prevent the bitmap from being lost after restarting. It should be noted that the third bitmap is stored in metadata volume 0 (lvol0-meta), and the first bitmap is stored in metadata volume 1 (lvol1-meta). It should be noted that the data in the metadata volume consists of super block and on-disk dirty chunk bitmap (change bitmap on disk). The header of the metadata volume is the super block, which is a part of the data at the beginning of the hard disk partition. It contains the basic information of the metadata volume. The on-disk dirty chunk bitmap (change bitmap on disk) records the data blocks that have been modified but not yet backed up compared to the last backup.

[0115] Furthermore, the present application takes the backup of logical volume 1 as an example to illustrate the backup method of the logical volume. When the backup of logical volume 1 begins, the kernel module will also create a shared memory to realize the communication between the kernel module and the backup process through the shared memory. The shared memory may include two parts, one part is the pending chunk bitmap and the COW memory buffer. Specifically, the first bitmap corresponding to logical volume 1 is copied to the pending chunk bitmap in the shared memory, so that the backup process can read the first bitmap in the shared memory and modify the first bitmap. Specifically, it includes copying the first bitmap from the metadata volume to the shared memory, and then clearing the first bitmap in the metadata volume to obtain a fourth bitmap, wherein the value of each bit in the fourth bitmap is zero. If there is a read and write operation on the data block in logical volume 1 during the backup of logical volume 1, the value of the bit in the fourth bitmap is modified based on the specific situation to record the modification operation on the data block. Such as Figure 5 As shown, when starting to back up logical volume 1, the kernel module creates a shared memory for logical volume 1, and the backup process runs in the user space. Communication between the backup process and the kernel module is achieved through shared memory.

[0116] Logical volume 1 can be regarded as a virtual logical volume added on top of the original logical volume 1 (lovll-orig). When the application (Application, APP) has a read / write operation (R / W) for the data blocks in logical volume 1, such as Figure 5 Some judgment and processing are first performed in logical volume 1, but the read and write operations for the data blocks in logical volume 1 must be actually read from the original logical volume, or actually written in the original logical volume 1. Therefore, after judging the read or write operation of the data blocks in logical volume 1 and modifying the fourth bitmap, the read and write operation has been recorded through the fourth bitmap, so it is necessary to modify the pointer of the read or write operation to the original logical volume 1, so that the read and write operation is actually read from the original logical volume, or actually written in the original logical volume.

[0117] Furthermore, there are two backup methods in the present application. One is a method in which the backup process performs data block backup by traversing the bitmap, that is, the backup process traverses the value of each bit in the first bitmap, and when the traversed bit value is the first preset value, obtains the index corresponding to the bit, based on the correspondence between the bit in the first bitmap and the data block in the logical volume 1, such as Figure 5 As shown, the data block corresponding to the index is read from logical volume 1, and the data block is backed up, that is, added to the output queue (output file / stream).

[0118] Furthermore, another data backup method in the present application is a backup method in which the backup process preferentially backs up high-priority data blocks. Figure 5 As shown, the kernel module needs to copy the second data block in logical volume 1 and write it to the shared memory through copy-on-write (COW), and then send a notification to the backup process. This notification can be regarded as a push process. It should be noted that the detailed backup method of backing up high-priority data blocks by the backup process is not described in detail in this application, and will be explained in detail below.

[0119] Similarly, logical volume 0 can also be regarded as a virtual logical volume added on top of the original logical volume 0 (lovl0-orig). When there is a read / write operation (R / W) for the data blocks in logical volume 0, such as Figure 5 First, some judgment and processing are performed in logical volume 0. However, the read and write operations for the data blocks in logical volume 0 must be read from the original logical volume 0 or written to the original logical volume 0. Therefore, after judging the read or write operation of the data blocks in logical volume 0 and modifying the third bitmap, the read and write operations have been recorded through the third bitmap. Therefore, it is necessary to modify the pointer of the read or write operation to the original logical volume 0, so that the read and write operations are actually read from the original logical volume 0 or actually written to the original logical volume 0.

[0120] Finally, metadata volume 0, metadata volume 1, original logical volume 0, and original logical volume 1 are combined to form a volume group (Volume Group) for unified management.

[0121] See also Figure 6 , Figure 6 A flow chart of another data backup method provided in an embodiment of the present application, the method is applied to a computing device, wherein the computing device includes a kernel module, a backup process, and a shared memory, and the present application mainly uses the interaction between modules in the computing device as an example to illustrate the backup method. The present application uses the backup of logical volume 1 as an example to illustrate, and the logical volume in the embodiment of the present application refers to logical volume 1. The method includes but is not limited to the steps of:

[0122] 301: The backup process reads the first bitmap from the shared memory.

[0123] The value of each bit in the first bitmap is used to indicate the status of the data block corresponding to each bit in the logical volume.

[0124] 302: The kernel module obtains a first write operation for a first data block.

[0125] Specifically, the value of the bit corresponding to the second data block in the first bitmap is obtained, and based on the value of the bit corresponding to the first data block in the first bitmap corresponding to the logical volume, it is determined whether there is an unbacked up second data block in the first data block. If not, the write operation is directly performed and the fourth bitmap is modified.

[0126] If yes, proceed to step 303. The value of the bit corresponding to the first bitmap in the second data block is a first preset value.

[0127] 303: In response to the first write operation, the kernel module reads the first bitmap corresponding to the logical volume.

[0128] The value of each bit in the first bitmap is used to indicate the status of the data block corresponding to each bit in the logical volume.

[0129] 304: The kernel module writes the second data block in the first data block into the shared memory.

[0130] The value of the bit of the second data block corresponding to the first bitmap is a first preset value.

[0131] Specifically, after determining that the second data block is high-priority backup data, the second data block is read into the shared memory, so that the backup process can also read the second data block.

[0132] 305: The kernel module sends a notification to the backup process.

[0133] The kernel module sends a notification to the backup process, so that the backup process responds to the notification, reads the second data block from the shared memory, and backs up the second data block.

[0134] It should be noted that the notification is used to instruct the backup process to read data from the shared memory. Specifically, the message communication between the kernel module and the backup process is realized through the eventfd mechanism, that is, the kernel module sends a notification to the backup process through the eventfd mechanism. The content of the notification can be 1, which can be regarded as a flag or signal, indicating that there is data in the shared memory ready to be read, or a certain operation has been completed and the next step of processing can be carried out, and the backup process can read data from the shared memory.

[0135] 306: The backup process obtains a notification from the kernel module of the computing device while traversing the first bitmap and backing up the data blocks in the logical volume.

[0136] The backup process obtains a notification from the kernel module of the computing device during the process of traversing the first bitmap and backing up the data blocks in the logical volume, that is, during the process of traversing the first bitmap and backing up the data blocks corresponding to the bits in the first bitmap whose values ​​are the first preset values ​​in the logical volume, that is, during the process of executing the method of backing up data blocks by traversing the bitmap, and the notification is used to instruct the backup process to read data from the shared memory.

[0137] 307: In response to the notification, the backup process reads a second data block from the shared memory.

[0138] Specifically, the backup process responds to the notification and reads the shared memory. It should be noted that the method for the backup process to respond to the notification and read the second data block from the shared memory has been described in the above embodiment, and this application will not repeat it again.

[0139] 308: The backup process backs up the second data block.

[0140] Exemplarily, the backup process backs up the second data block and adds each first data block to an output queue, which is a buffer for storing data to be processed. When the backup process backs up a data block, the data block is placed in this queue for subsequent processing and transmission. Specifically, the output queue can be stored in a hard disk or distributedly stored, etc., which is not limited in this application.

[0141] It should be noted that after the second data block is backed up, the storage location corresponding to the second data block in the shared memory will be released, allowing other write operations to modify the storage location.

[0142] It should be noted that in the present application, the backup method recorded in steps 306-308 is a backup method in which the backup process in the present application preferentially backs up data blocks with high priority. When the backup process preferentially backs up data blocks with high priority, the backup process can be paused to perform a method of backing up data blocks by traversing the bitmap. The two backup methods can also be performed in parallel, and the present application does not specifically limit this.

[0143] It can be seen that in the embodiment of the present application, if the kernel module of the computing device obtains the first write operation for the first data block during the backup process traversing the first bitmap and backing up the data blocks in the logical volume, the kernel module will respond to the first write operation, read the first bitmap corresponding to the logical volume, to determine the backup status of the first data block corresponding to the first write operation, and determine the second data block whose value of the bit corresponding to the first bitmap in the first data block is the first preset value. The value of the bit corresponding to the first bitmap of the second data block is the first preset value, indicating that the second data block has not been backed up but is about to be written with new data. Therefore, in this case, in order to reduce the impact on the first write operation, the backup priority of the second data block should be increased, and the second data block should be backed up first before the first write operation. That is, the kernel module first writes the second data block to the shared memory so that the backup process can also read the second data block. Then the kernel module sends a notification to the backup process, and the backup process obtains a notification for indicating that the backup process reads data from the shared memory; the backup process responds to the notification, reads the second data block from the shared memory; and backs up the second data block. The backup process gives priority to backing up the second data block that has not been backed up but is about to be written with new data during the backup process. This can prevent the situation where the second data block has not been backed up and is modified, resulting in data omissions; it can also prevent the situation where the second data block cannot be backed up for a long time because the bit corresponding to the second data block in the first bitmap has not been traversed for a long time, resulting in the first write operation being unable to be executed. That is, the backup process gives priority to backing up the second data block that has not been backed up but is about to be written with new data during the backup process, which can ensure the accuracy of the backup data and reduce the impact on the business write operation.

[0144] In one embodiment of the present application, before backing up the logical volume, the kernel module also includes a process of obtaining the first bitmap from the metadata volume. Specifically, when backing up through the kernel module, the first bitmap corresponding to the logical volume needs to be copied to the shared memory first, such as Figure 7 As shown, Figure 7 A schematic diagram of a process for obtaining a first bitmap provided in an embodiment of the present application specifically includes but is not limited to the following steps:

[0145] 501: Read the metadata volume into the memory requested by the kernel module.

[0146] Exemplarily, the metadata volume is a storage device used to store the bitmap corresponding to the logical volume, and reading the metadata volume into the memory requested by the kernel module means reading the metadata volume stored on the storage device (such as a hard disk or a network storage device, etc.) into the memory of the server. This improves the access speed because the read and write speed of the memory is much faster than that of storage devices such as disks. When the metadata volume is loaded into the memory, the system can access the information faster, thereby improving the efficiency of file operations.

[0147] 502: Determine whether the device status is clean.

[0148] 503: If yes, obtain the first bitmap from the metadata volume and store the first bitmap in the shared memory requested by the kernel module.

[0149] Specifically, the method includes copying the first bitmap from the metadata volume to the shared memory, and then clearing the first bitmap in the metadata volume to obtain a fourth bitmap, wherein the value of each bit in the fourth bitmap is 0. If there is a read and write operation for a data block in the logical volume during the process of backing up the logical volume, the value of the bit in the fourth bitmap is modified based on the specific situation.

[0150] 504: Mark the device status as dirty and persist it.

[0151] If the device status is clean, the device here refers to the metadata volume. If the metadata volume device status is clean, it means that the metadata volume is in a normal and available state. Mark the device status as dirty and persist it, marking the device to be used.

[0152] 505: If not, set the value of each bit in the first bitmap to 1, and then execute step 504.

[0153] If the device status is not clean, it means that the server may have restarted unexpectedly or there is some degree of abnormality or failure, and the first bitmap was not stored in the metadata volume in time. Therefore, in order to avoid missing the data that needs to be backed up, the value of each bit in the bitmap is marked as 1, indicating that a full backup is required at this time.

[0154] Furthermore, the value of each bit in the bitmap is set to 1, and then the device state is marked as dirty and persisted, marking the device to be used.

[0155] like Figure 8 As shown, Figure 8 A flowchart of a read or write operation of a data block provided in an embodiment of the present application specifically includes but is not limited to the following steps:

[0156] When the backup process executes a backup method of backing up high-priority data blocks first, the backup process can be paused to perform a method of backing up data blocks by traversing the bitmap.

[0157] 601: Obtain a first read operation or a first write operation on a data block in a logical volume.

[0158] It should be noted that during the data backup process, the server can still perform read or write operations on data blocks based on business needs.

[0159] 602: Determine whether it is the first write operation.

[0160] 603: If it is the first write operation, determine whether the data blocks in the logical volume are being backed up.

[0161] If it is not the first write operation, directly execute step 606 .

[0162] 604: If data blocks in the logical volume are being backed up, a backup method is executed in which the backup process preferentially backs up data blocks with high priority.

[0163] It should be noted that the backup method of the backup process preferentially backing up high-priority data blocks is similar to the backup method of the backup process preferentially backing up high-priority data blocks described in steps 301-308, and this application will not repeat them here.

[0164] If the data blocks in the logical volume are not being backed up, directly execute step 605 .

[0165] 605: Mark the value corresponding to the data block corresponding to the first write operation in the fourth bitmap as 1.

[0166] 606: Modify the pointer of the read operation or write operation to the original logical volume.

[0167] It should be noted that the logical volume can be regarded as a virtual logical volume added on top of the original logical volume. When there is a read or write operation for a data block in the logical volume, some judgment and processing are performed in the logical volume. However, the read or write operation for the data block in the logical volume must be actually read from the original logical volume, or must be actually written in the original logical volume. Therefore, after judging the read or write operation of the data block in the logical volume and modifying the fourth bitmap, the read or write operation has been recorded through the fourth bitmap. Therefore, it is necessary to modify the pointer of the read or write operation to the original logical volume so that the read or write operation is actually read from the original logical volume, or actually written in the original logical volume.

[0168] Specifically, after the logical volume is backed up, the bitmap in the metadata volume will be persisted. Fig. 9 As shown, Fig. 9A schematic diagram of a metadata volume persistence process provided in an embodiment of the present application specifically includes the following steps:

[0169] 701: Persistent bitmap.

[0170] The bitmap is saved to a non-volatile memory (such as a hard disk, flash memory, etc.) to ensure that the information can still be retained and restored after the server is restarted or powered off.

[0171] 702: Mark the device status as clean and persist it.

[0172] Set the state of the metadata volume to a clean or unmodified state. This means that the kernel module has successfully completed its task with the metadata volume and all changes have been backed up. This "clean" state is also saved to non-volatile storage. In this way, even if the server fails or restarts, when the metadata volume is loaded again, it can know that it was in a clean state before.

[0173] It can be seen that in the embodiment of the present application, the bitmap is persisted, and the device state is marked as clean and persisted, which can ensure that the device state and change information can still be accurately restored and used after the system is restarted or powered off.

[0174] In one embodiment of the present application, see Fig.10 , Fig.10 A flowchart of another data backup method provided in an embodiment of the present application is provided. The present application is described by taking the backup of data blocks in a logical volume as an example.

[0175] 801: Start backup.

[0176] It should be noted that the backup can be initiated manually, or the server can automatically perform periodic backup, etc. This application does not limit this.

[0177] 802: Suspend the application's read / write operations on the logical volume.

[0178] It should be noted that in order to maintain data consistency and avoid partial write operations being missed, the application's read / write operations on the logical volume need to be suspended after starting the backup.

[0179] 803: Back up and clear the first bitmap.

[0180] Exemplarily, the first bitmap is copied from the metadata volume, and then the first bitmap in the metadata volume is cleared to obtain a fourth bitmap, wherein the value of each bit in the fourth bitmap is 0. If there is a read and write operation for a data block in the logical volume during the process of backing up the logical volume, the value of the bit in the fourth bitmap is modified based on the specific situation.

[0181] It can be seen that in the embodiment of the present application, because the backup process of the logical volume is not completed in seconds, it takes a relatively long time. In addition, in order to avoid a significant impact on the read and write operations of the business, the read and write operations of the application on the logical volume cannot be suspended during the backup. Therefore, in order to record the write operations of the application on the logical volume received during the backup process, it is necessary to back up and clear the first bitmap to obtain the fourth bitmap. The write operations of the application on the logical volume received during the backup process are recorded in the fourth bitmap so that when data is written, it can be accurately recorded to avoid missing data and improve the accuracy of the backup.

[0182] 804: Allocate shared memory and copy the first bitmap to the bitmap area in the shared memory.

[0183] Exemplarily, the kernel module allocates shared memory and copies the first bitmap to a bitmap area in the shared memory.

[0184] 805: Resume the application's read / write operations on the logical volume.

[0185] Since the data size of the first bitmap is very small, backing up and clearing the first bitmap and copying it to the bitmap area of ​​the shared memory can be completed in a very short time. After completion, the application's read / write operations on the logical volume can be restored immediately, with little impact on the business's read / write operations.

[0186] 806: Execute a backup method in which a backup process preferentially backs up high-priority data blocks.

[0187] It should be noted that after the first write operation for the first data block in the logical volume being backed up is obtained, the backup method of backing up the data blocks with high priority is executed in the backup process. It should be noted that the backup method of backing up the data blocks with high priority by the backup process is similar to the backup method of backing up the data blocks with high priority by the backup process described in steps 301-308, and this application will not repeat them here.

[0188] 807: Waiting for the backup of data blocks in the logical volume to be completed.

[0189] That is, wait for the first bitmap to be traversed.

[0190] 808: Suspend the application's read / write operations on the logical volume.

[0191] It should be noted that after the first bitmap is traversed and the data blocks in the logical volume are backed up, in order to maintain data consistency and avoid some write operations being missed, it is necessary to suspend the application's read / write operations on the logical volume.

[0192] 809: Determine whether the backup is successful.

[0193] Specifically, it can be determined whether the value of each bit in the bitmap stored in the shared memory is the second preset value, that is, whether it is 0. The bitmap stored in the shared memory is a bitmap after the first bitmap has been modified multiple times.

[0194] 810: If yes, stop executing the backup process and prioritize backing up high-priority data blocks.

[0195] If the value of each bit in the bitmap stored in the shared memory is 0, it indicates that the incremental data in the logical volume has been successfully backed up.

[0196] 811 : If not, merge the bitmap in the shared memory and the fourth bitmap, and then continue to execute 810 .

[0197] If the values ​​of some bits in the bitmap stored in the shared memory are not 0, it means that some incremental data in the logical volume has not been successfully backed up in this backup data. The bitmap in the shared memory is merged with the fourth bitmap so that it can be backed up during the next backup of the logical volume. The bitmap in the shared memory and the fourth bitmap are merged by taking the union of each bit of the bitmap in the shared memory and the corresponding bit in the fourth bitmap. It should be noted that common backup failures are backup failures caused by external storage devices, such as insufficient storage space, and manual active stopping of the backup process for this backup.

[0198] 812: Resume the application's read / write operations on the logical volume.

[0199] Since determining whether the backup is successful only requires traversing the bitmap in the shared memory, and the data size of the bitmap is very small, the determination of whether the backup is successful can be completed quickly. After completion, the application's read / write operations on the logical volume are immediately restored, which has little impact on the business's read / write operations.

[0200] It should be noted that after the backup is completed, the fourth bitmap continues to be used to record the write operations of the data blocks in the logical volume until the next backup starts.

[0201] In one embodiment of the present application, see Fig.11 , Fig.11 A flowchart of a backup method for preferentially backing up high-priority data blocks in a backup process provided in an embodiment of the present application.

[0202] 901: The kernel module obtains a first write operation on a first data block in a logical volume.

[0203] Exemplarily, a write operation of a business on a first data block in a logical volume is obtained from an application program, and the first write operation is first processed and judged by a kernel module.

[0204] It should be noted that all operations performed by kernel modules are performed in kernel space.

[0205] 902: The kernel module determines whether the second data block exists in the first data block.

[0206] The value corresponding to the second data block in the first bitmap in the second data block is a first preset value.

[0207] 903: If yes, the kernel module applies for a cache capacity in the shared memory.

[0208] If the application is successful, execute 904. If the application fails, sleep for a few milliseconds and then execute step 902.

[0209] If not, go directly to 911.

[0210] 904: The kernel module reads the second data block into the cache capacity.

[0211] It should be noted that the kernel module writes the second data block in the first data block into the cache capacity in the shared memory, and stores the second data block in a section of the cache capacity in the shared memory, so that the backup process can also read the second data block.

[0212] 905: The kernel module sends a first notification to the backup process.

[0213] It should be noted that the first notification is used to instruct the backup process to read data from the shared memory. Specifically, the message communication between the kernel module and the backup process is realized through the eventfd mechanism, that is, the kernel module sends a notification to the backup process through the eventfd mechanism. The content of the notification can be 1, which can be regarded as a flag or signal, indicating that there is data in the shared memory ready to be read, or a certain operation has been completed and the next step of processing can be performed, and the backup process can read data from the shared memory.

[0214] 906: In response to the first notification, the backup process reads a second data block from the shared memory.

[0215] Specifically, the method for the backup process to read the second data block from the shared memory in response to the notification is similar to the method for reading the second data block from the shared memory in response to the notification recorded in step 306, and is not described in detail in this application.

[0216] 907: The backup process backs up the second data block.

[0217] Exemplarily, the backup process adds each first data block to an output queue, which is a buffer for storing data to be processed. When the backup process backs up a data block, the data block is placed in this queue for subsequent processing and transmission. Specifically, the output queue can be stored in a hard disk or distributedly stored, etc., which is not limited in this application.

[0218] 908: The backup process determines the bit in the first bitmap corresponding to the second data block; and modifies the value of the bit in the first bitmap corresponding to the second data block to a second preset value.

[0219] It should be noted that after the backup process completes the backup of the second data block, in order to avoid duplicate backup, the bit corresponding to the second data block in the first bitmap of the shared memory is determined; the value of the bit corresponding to the second data block in the first bitmap is modified to a second preset value, that is, to 0, to obtain a second bitmap to indicate that each first data block has been successfully backed up. Subsequent backups are performed based on the second bitmap.

[0220] 909: The backup process sends a second notification to the kernel module.

[0221] It should be noted that, similarly, the backup process can also send a second notification to the kernel module through the eventf mechanism, indicating that the reading of the data of the memory block is completed.

[0222] 910: The kernel module receives the second notification.

[0223] It should be noted that after the kernel module receives the data indicating that the backup process has finished reading the cache capacity in the shared memory, the kernel module releases the cache capacity in the shared memory to wait for the next writing of the data block.

[0224] 911: Traverse the bitmap to back up the data blocks in the logical volume.

[0225] It should be noted that if the kernel module determines that the second data block does not exist in the first data block, step 911 is to traverse the first bitmap to back up the data blocks in the logical volume. If the kernel module receives the third notification, step 911 is to traverse the second bitmap to back up the data blocks in the logical volume.

[0226] The specific implementation method involved in step 911 has been explained in the above content and will not be repeated here in this application.

[0227] Specifically, before performing step 906, a backup process message thread is created in the user space and waits to read a notification sent by the kernel module.

[0228] Furthermore, after performing step 909, the backup process will determine whether the backup is completed. If so, the message thread ends; if not, the message thread waits to read the notification sent by the kernel module.

[0229] In one embodiment of the present application, a method for backing up data blocks by traversing a bitmap during a backup process and a method for backing up data blocks with high priority during a backup process are described in combination. Fig.12 , Fig.12 A flowchart of another data backup method provided in an embodiment of the present application is provided. The method is applied to a backup process and includes but is not limited to the following steps:

[0230] 1001: Notify the kernel module to start backup.

[0231] It should be noted that the backup process can be started manually or the server can automatically and periodically start the backup process, etc. This application does not limit this. After starting the backup process, the kernel module is notified to start the backup.

[0232] 1002: Map the backup process into shared memory.

[0233] Mapping files or devices to memory through memory mapping (mmap) takes advantage of the characteristics of virtual memory. In the Linux system, each process has its own virtual memory space, and the virtual memory spaces of different processes can be mapped to the same physical memory pages. The mmap function can map a file or device to these shared physical memory pages, thereby realizing data sharing between multiple processes.

[0234] 1003: Create a message thread.

[0235] 1004: Waiting to read the first notification sent by the kernel module.

[0236] 1005: traverse the value of each bit in the first bitmap, and when the traversed bit value is the first preset value, obtain the index corresponding to the bit, and read the data block corresponding to the index from the logical volume based on the correspondence between the bits in the first bitmap and the data blocks in the logical volume.

[0237] 1006: Back up the data block and add it to the output queue.

[0238] It should be noted that in this application, the backed-up data blocks are first added to the output queue to temporarily store the data to be processed or transmitted. Then the data in the output queue is stored in the external storage. The storage format can be rbd diff format, such as Fig.13 As shown, the format is divided into four parts: header, metadata entry, data entry and trailer.

[0239] The header is a string "backup diff v1\n", indicating the backup storage format version; in the metadata entry, each entry has a tag to distinguish the entry type. Different tags record the backup name (namelength) and the size of the backup volume (image size); in the data entry, the tag distinguishes between all zeros and non-all zeros, records the position (offset) and length (length) of the chunk in the original logical volume, and stores the actual data (date); the tail is a string "end", indicating the end of data storage.

[0240] 1007: Change the value of this bit to the second preset value.

[0241] 1008: Determine whether the traversal of the first bitmap is complete.

[0242] 1009: If yes, notify the message thread or kernel module that the backup is completed.

[0243] If not, execute step 1005.

[0244] It should be noted that if the notification sent by the kernel module is read in step 1004 during the process of waiting to read the notification sent by the kernel module, the following operations are performed:

[0245] 1010: In response to the first notification, read a second data block from the shared memory and back up the second data block.

[0246] 1011: Determine the bit in the first bitmap corresponding to the second data block; and modify the value of the bit in the first bitmap corresponding to the second data block to a second preset value.

[0247] 1012: The backup process sends a second notification to the kernel module.

[0248] 1013: Determine whether the backup is completed.

[0249] 1014: If yes, the message thread ends.

[0250] If not, continue to execute step 1004 to wait for the notification sent by the read kernel module.

[0251] It should be noted that the specific implementation methods involved in steps 1001-1014 have been recorded in the above description. In order to avoid redundancy, this application does not make specific descriptions here. It should be noted that steps 1005-1009 correspond to the method in which the backup process backs up data blocks by traversing the bitmap, and steps 1010-1014 correspond to the backup method in which the backup process preferentially backs up high-priority data blocks. These two backup methods can be carried out in parallel, or the backup method in which steps 1010-1014 correspond to the backup process preferentially backing up high-priority data blocks takes precedence over the method in which the backup process backs up data blocks by traversing the bitmap corresponding to steps 1005-1009. This application does not make specific limitations on this.

[0252] See also Fig.14 , Fig.14 A block diagram of the functional units of a computing device provided in an embodiment of the present application. The computing device 1100 includes: a backup process 1101 and a kernel module 1102. It should be noted that the kernel module 1102 in this embodiment and the kernel module 402 in the above embodiment can be the same kernel module or different kernel modules, and the backup process 1101 in this embodiment and the backup process 401 in the above embodiment can be the same backup process or different backup processes, which is not specifically limited in this application;

[0253] The backup process 1101 is used to, when a first write operation to a first data block in the logical volume is identified, determine a second data block that is not backed up in the first data block based on a value of a bit corresponding to the first data block in a first bitmap corresponding to the logical volume, wherein the bits in the first bitmap correspond to the data blocks one-to-one;

[0254] The backup process 1101 is used to back up the second data block.

[0255] In one embodiment of the present application, it also includes:

[0256] The kernel module is also used to send a notification to the backup process;

[0257] The backup process is further configured to respond to the notification, read the second data block from the shared memory, and back up the second data block.

[0258] In one implementation of the present application, the backup process 1101 is further specifically used for:

[0259] Determining a bit in the first bitmap corresponding to the second data block;

[0260] Adjust the value of the bit corresponding to the second data block in the first bitmap to obtain a second bitmap;

[0261] The second bitmap is traversed to back up the third data block in the logical volume that has not been backed up.

[0262] In one embodiment of the present application, in traversing the second bitmap to back up the third data block that is not backed up in the logical volume, the backup process 1101 is specifically used to:

[0263] Obtaining a first quantity of the second data blocks;

[0264] Determine a first cache usage rate of the shared memory based on the first number, the cache capacity of the shared memory, and the capacity of the third data block;

[0265] Based on the first cache usage rate, the second bitmap is traversed to back up the third data block in the logical volume that has not been backed up.

[0266] In one embodiment of the present application, if the first cache usage rate is less than a first threshold, in terms of traversing the second bitmap based on the first cache usage rate to back up the third data block that is not backed up in the logical volume, the backup process 1101 is specifically used to:

[0267] Determine a second number of third data blocks to be backed up by traversing the second bitmap based on the first cache usage rate, the second cache usage rate, and the concurrency, the second cache usage rate corresponding to the second data block;

[0268] Traversing the value of each bit in the second bitmap, and backing up a second number of third data blocks from the logical volume;

[0269] If, during the process of backing up the second number of third data blocks, a second write operation to a fourth data block in the logical volume is identified, and the fourth data block contains the second data block that has not been backed up, backing up the second data block until the backup of the logical volume is completed;

[0270] If during the process of backing up the second quantity of third data blocks, the second write operation to the fourth data block in the logical volume is not recognized, or, if the second write operation to the fourth data block in the logical volume is recognized and there is no unbacked up second data block in the fourth data block, the second quantity of third data blocks is backed up from the logical volume again until the backup of the logical volume is completed.

[0271] In one embodiment of the present application, if the first cache usage rate is greater than or equal to a first threshold, in terms of traversing the second bitmap based on the first cache usage rate and backing up the third data block that is not backed up in the logical volume, the backup process 1101 is specifically used to:

[0272] suspending backing up the third data block in the logical volume;

[0273] Within the preset time period of suspending the backup of the third data block in the logical volume, when a second write operation to a fourth data block in the logical volume is identified and there is the second data block that has not been backed up in the fourth data block, backing up the second data block until the backup of the logical volume is completed;

[0274] Within the preset time length of suspending the backup of the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified and there is no second data block that has not been backed up in the fourth data block, traverse the value of each bit in the second bitmap to back up the third data block in the logical volume;

[0275] In the process of traversing the value of each bit in the second bitmap and backing up the third data block in the logical volume, when a second write operation to a fourth data block in the logical volume is identified and there is an unbacked up second data block in the fourth data block, the second data block is backed up until the backup of the logical volume is completed.

[0276] In one embodiment of the present application, in determining the second number of backable data blocks based on the first cache usage rate, the backup process 1101 is specifically configured to:

[0277] Based on the second cache usage rate, determine that the third data block traversed through the second bitmap for backup occupies the largest third cache usage rate;

[0278] Determining a fourth cache usage rate based on the third cache usage rate and the first cache usage rate;

[0279] The second number is determined based on the fourth cache usage and concurrency.

[0280] In one embodiment of the present application, in determining the first cache usage rate of the shared memory based on the first number, the cache capacity of the shared memory, and the capacity of the third data block, the backup process 1101 is specifically used to:

[0281] Based on the cache capacity and the size of the data block, determining the total number of data blocks that can be cached by the cache capacity;

[0282] The first cache usage rate is determined based on the first number and the total number.

[0283] See also Fig.15 , Fig.15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.15 As shown, the electronic device 1200 includes a transceiver 1201, a processor 1202, and a memory 1203. They are connected via a bus 1204. The memory 1203 is used to store computer programs and data, and can transmit the data stored in the memory 1203 to the processor 1202.

[0284] The processor 1202 is used to read the computer program in the memory 1203 and perform the following operations:

[0285] The control transceiver 1201 determines, when identifying a first write operation to a first data block in the logical volume, a second data block that is not backed up in the first data block according to a value of a bit corresponding to the first bitmap of the first data block in the logical volume, wherein the bits in the first bitmap correspond to the data blocks one-to-one;

[0286] Back up the second data block.

[0287] It should be noted that the specific steps executed by the processor 1202 can refer to the specific execution method of the computing device 1100 in the above embodiment, and this application will not go into details here.

[0288] It should be understood that the electronic devices in this application may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, laptops, mobile Internet devices MID (Mobile Internet Devices, referred to as: MID) or wearable devices, etc. The above electronic devices are only examples, not exhaustive, and include but are not limited to the above electronic devices. In practical applications, the above electronic devices may also include: smart vehicle terminals, computer equipment, etc.

[0289] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement part or all of the steps of any data backup method recorded in the above method embodiments.

[0290] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any data backup method recorded in the above method embodiments.

[0291] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action splicing, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by this application.

[0292] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0293] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0294] 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 distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0295] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.

[0296] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0297] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.

[0298] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data backup method, characterized in that: The method comprises: In a case where a first write operation to a first data block in the logical volume is identified, determining a second data block that is not backed up in the first data block based on a value of a bit corresponding to the first bitmap of the first data block corresponding to the logical volume, the bits in the first bitmap corresponding to the data blocks in a one-to-one correspondence; Back up the second data block.

2. The method according to claim 1, characterized in that: Before backing up the second data block, the method further includes: Writing the second data block into the shared memory; The second data block is read from the shared memory.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Determining a bit in the first bitmap corresponding to the second data block; Adjust the value of the bit corresponding to the second data block in the first bitmap to obtain a second bitmap; The second bitmap is traversed to back up the third data block in the logical volume that has not been backed up.

4. The method according to claim 3, characterized in that The traversing the second bitmap to back up the third data block that is not backed up in the logical volume includes: Obtaining a first quantity of the second data blocks; Determine a first cache usage rate of the shared memory based on the first number, a cache capacity of the shared memory, and a capacity of the third data block; Based on the first cache usage rate, the second bitmap is traversed to back up the third data block in the logical volume that has not been backed up.

5. The method according to claim 4, characterized in that If the first cache usage rate is less than a first threshold, traversing the second bitmap based on the first cache usage rate to back up the third data block that is not backed up in the logical volume includes: Determine a second number of third data blocks to be backed up by traversing the second bitmap based on the first cache usage rate, the second cache usage rate, and the concurrency, the second cache usage rate corresponding to the second data block; Traversing the value of each bit in the second bitmap, and backing up a second number of third data blocks from the logical volume; If, during the process of backing up the second number of third data blocks, a second write operation to a fourth data block in the logical volume is identified, and the fourth data block contains the second data block that has not been backed up, backing up the second data block until the backup of the logical volume is completed; If during the process of backing up the second quantity of third data blocks, the second write operation to the fourth data block in the logical volume is not recognized, or, if the second write operation to the fourth data block in the logical volume is recognized and there is no unbacked up second data block in the fourth data block, the second quantity of third data blocks is backed up from the logical volume again until the backup of the logical volume is completed.

6. The method according to claim 4, characterized in that If the first cache usage rate is greater than or equal to a first threshold, traversing the second bitmap based on the first cache usage rate to back up the third data block that is not backed up in the logical volume includes: suspending backing up the third data block in the logical volume; Within the preset time period of suspending the backup of the third data block in the logical volume, when a second write operation to a fourth data block in the logical volume is identified and there is the second data block that has not been backed up in the fourth data block, backing up the second data block until the backup of the logical volume is completed; Within the preset time length of suspending the backup of the third data block in the logical volume, if the second write operation to the fourth data block in the logical volume is not identified, or, if the second write operation to the fourth data block in the logical volume is identified and there is no second data block that has not been backed up in the fourth data block, traverse the value of each bit in the second bitmap to back up the third data block in the logical volume; In the process of traversing the value of each bit in the second bitmap and backing up the third data block in the logical volume, when a second write operation to a fourth data block in the logical volume is identified and there is an unbacked up second data block in the fourth data block, the second data block is backed up until the backup of the logical volume is completed.

7. The method according to claim 5, characterized in that The determining, based on the first cache usage rate, the second cache usage rate, and the concurrency, a second number of third data blocks to be backed up by traversing the second bitmap includes: Based on the second cache usage rate, determine that the third data block traversed through the second bitmap for backup occupies the largest third cache usage rate; Determining a fourth cache usage rate based on the third cache usage rate and the first cache usage rate; The second number is determined based on the fourth cache usage and concurrency.

8. The method according to any one of claims 4 to 7, characterized in that: The determining, based on the first quantity, the cache capacity of the shared memory, and the capacity of the third data block, a first cache usage rate of the shared memory includes: Based on the cache capacity and the capacity of the third data block, determining a total number of data blocks that can be cached by the cache capacity; The first cache usage rate is determined based on the first number and the total number.

9. A computing device, characterized in that The computing device includes: a backup process and a kernel module; The kernel module is configured to, upon identifying a first write operation to a first data block in a logical volume, determine a second data block that is not backed up in the first data block based on a value of a bit corresponding to the first data block in a first bitmap corresponding to the logical volume, the bits in the first bitmap corresponding to the data blocks one-to-one; The backup process is used to back up the second data block.

10. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 8.