CN117193662A - IO processing method, system, terminal and storage medium of snapshot volume - Google Patents

IO processing method, system, terminal and storage medium of snapshot volume Download PDF

Info

Publication number
CN117193662A
CN117193662A CN202311263946.2A CN202311263946A CN117193662A CN 117193662 A CN117193662 A CN 117193662A CN 202311263946 A CN202311263946 A CN 202311263946A CN 117193662 A CN117193662 A CN 117193662A
Authority
CN
China
Prior art keywords
lock
request
volume
data
snapshot
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311263946.2A
Other languages
Chinese (zh)
Inventor
毕家伟
马杨
蒋米传
张刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311263946.2A priority Critical patent/CN117193662A/en
Publication of CN117193662A publication Critical patent/CN117193662A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of disk arrays, and particularly provides an IO processing method, system, terminal and storage medium of a snapshot volume, which comprise the following steps: dividing target data of the IO request into target particles; during snapshot processing based on the IO request, the target granule is set to a data lock state. According to the method and the device, the target data of the IO request are divided into the target particles, then the target particles are set to be in the data locking state during the snapshot processing, and the IO flow of the snapshot processing is carried out after the target particles are locked, so that the problems of inconsistent data and IO errors of the snapshot source volume and the snapshot target volume can be effectively prevented.

Description

IO processing method, system, terminal and storage medium of snapshot volume
Technical Field
The invention belongs to the technical field of disk arrays, and particularly relates to an IO processing method, system, terminal and storage medium of a snapshot volume.
Background
The backup of data is an essential function for a storage system, and the snapshot is an important means for realizing the backup of data, wherein the snapshot has a management granularity for the data, which is called a data block gran, and when a source volume of the snapshot is written, even if the written size is possibly smaller than one gran, the snapshot module copies the data of the whole gran to a target volume. Each grain corresponds to each bit in the bitmap, and reading the specified bit of the bitmap can determine whether the data has been copy-on-write copy.
Users often create multiple snapshot target volumes for a snapshot source volume (multi-target snapshots) or re-create snapshot target volumes for snapshot target volumes (cascading snapshots), which introduces a chained management policy for snapshot volumes.
The target volume of each snapshot is immediately readable and writable after being generated, and if the volumes on the whole snapshot chain are not uniformly managed by IO, scenes such as inconsistent data of the target volumes of the snapshots, IO failure and the like can occur, so that the target volumes of the snapshots generated by users can not be normally used.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides an IO processing method, system, terminal and storage medium of a snapshot volume, so as to solve the technical problems.
In a first aspect, the present invention provides a method for processing an IO of a snapshot volume, including:
dividing target data of the IO request into target particles;
during snapshot processing based on the IO request, the target granule is set to a data lock state.
In an alternative embodiment, partitioning target data of an IO request into target particles includes:
generating a target particle number based on the volume capacity and the particle capacity of the IO request;
and splitting the target data of the IO request into a plurality of target particles with corresponding numbers based on the number of the target particles.
In an alternative embodiment, setting the target granule to a data lock state during snapshot processing based on the IO request includes:
judging whether the target particle of the IO request needs snapshot processing or not:
if yes, applying for a data lock for the target particle;
if not, the IO request is directly executed.
In an alternative embodiment, determining whether the target particle of the IO request requires snapshot processing includes:
if the IO request is a read data request, inquiring an upstream volume of a target volume of the IO request, and if the upstream volume exists and the bitmap of the upstream volume is not 1, judging that the IO request needs to execute snapshot processing; if the upstream volume does not exist or the bitmap of the upstream volume is not 1, judging that the IO request does not need to execute snapshot processing;
if the IO request is a data writing request, judging whether the IO request needs snapshot processing or not based on the position of the volume where the target data is located.
In an optional embodiment, if the IO request is a write data request, determining whether the IO request needs snapshot processing based on a location of a volume where target data is located includes:
if the upstream of the volume for writing the data request has no volume or the bitmap of the upstream volume is 1, the downstream has a volume and the bitmap of the downstream volume is 0, judging that the data request needs snapshot processing;
if the volume upstream of the volume for writing the data request exists and the upstream volume bitmap is 0, and the downstream volume is not or is provided with the volume but the downstream volume bitmap is 1, judging that the data writing request needs snapshot processing;
if a volume exists upstream of the volume for the write data request and the upstream volume bitmap is 0, a volume exists downstream and the downstream volume bitmap is 0, then it is determined that snapshot processing is required for the write data request.
In an alternative embodiment, setting the target granule to a data lock state during snapshot processing based on the IO request includes:
in each snapshot volume linked list, maintaining a lock linked list for data particles, wherein the maintenance method of the lock linked list comprises the steps of adding information of a data lock into a linked list table tail, wherein the chain table head is an IO request for obtaining the lock currently, the information of the data lock comprises a lock type, the lock type comprises a shared lock and a mutual exclusion lock, the identification of the shared lock is 0, and the identification of the mutual exclusion lock is 1;
if the IO request is a read data request, applying for a shared lock for the target particle, if the lock chain table has no information of the lock or only information of the shared lock, successfully setting the shared lock for the target particle, and maintaining a shared lock identifier and corresponding IO request information in the lock chain table; if the lock chain table has the identification of the mutual exclusion lock, the locking fails and a failure prompt is returned;
if the IO request is a data writing request, applying for a mutual exclusion lock for the target particle, if the information of the lock is not available on the inner surface of the chain table, locking successfully, and adding a mutual exclusion lock identification and corresponding IO request information in the chain table; if the information of the lock is in the lock linked list, the lock is failed to be acquired, and the mutual exclusion lock is released after the information of the lock is not in the lock linked list;
after snapshot processing is completed, releasing the data lock, traversing a lock chain table if the data lock is a mutual exclusion lock, and setting a mutual exclusion mark to be 0 if the lock chain table has no mutual exclusion lock; after releasing the data lock, judging whether a new chain list head exists in the lock chain list, if so, checking a mutual exclusion mark, and if the lock chain list only has the mark of the shared lock, informing the IO request of each lock in the lock chain list to carry out asynchronous snapshot processing; if the mutual exclusion lock identification exists in the lock linked list, the IO request to which the linked list head of the mutual exclusion lock belongs is notified to carry out asynchronous snapshot processing.
In an alternative embodiment, a method of snapshot processing includes:
if the IO request is a read data request, if the current volume does not contain data to be read, a volume for redirecting the read needs to be specified;
if the IO request is a data writing request, if the copy-on-write operation is not executed, the copy-on-write operation is executed first.
In a second aspect, the present invention provides an IO processing system for a snapshot volume, including:
the request splitting module is used for dividing target data of the IO request into target particles;
and the data locking module is used for setting the target particles to be in a data locking state during the snapshot processing based on the IO request.
In an alternative embodiment, the request splitting module includes:
a number calculation unit for generating a target particle number based on the volume capacity and the particle capacity of the IO request;
and the data splitting unit is used for splitting the target data of the IO request into a plurality of target particles with corresponding quantity based on the target particle quantity.
In an alternative embodiment, the data locking module includes:
the demand judging submodule is used for judging whether the target particles of the IO request need snapshot processing or not;
the application locking sub-module is used for applying for a data lock for the target particle if the target particle of the IO request needs snapshot processing;
and the request execution sub-module is used for directly executing the IO request if the target particle of the IO request does not need snapshot processing.
In an alternative embodiment, the demand judging sub-module includes:
a request processing unit, configured to query an upstream volume of a target volume of the IO request if the IO request is a read data request, and determine that the IO request needs to perform snapshot processing if the upstream volume exists and a bitmap of the upstream volume is not 1; if the upstream volume does not exist or the bitmap of the upstream volume is not 1, judging that the IO request does not need to execute snapshot processing;
and the write request processing unit is used for judging whether the IO request needs snapshot processing or not based on the position of the volume where the target data is located if the IO request is a data writing request.
In an alternative embodiment, the write request processing unit includes:
a first processing subunit, configured to determine that the snapshot processing is required for the write data request if there is no volume upstream of the volume for the write data request, or if the bitmap of the upstream volume is 1, and the bitmap of the downstream volume is 0;
a second processing subunit, configured to determine that the write data request needs snapshot processing if there is a volume upstream of the volume of the write data request and the upstream volume bitmap is 0, and there is no volume downstream or there is a volume but the downstream volume bitmap is 1;
and the third processing subunit is configured to determine that the snapshot processing is needed for the write data request if there is a volume upstream of the volume for the write data request and the upstream volume bitmap is 0, and if there is a volume downstream of the volume for the write data request and the downstream volume bitmap is 0.
In an alternative embodiment, the data locking module includes:
the chain table maintenance unit is used for maintaining a lock chain table for data particles in each snapshot volume chain table, the maintenance method of the lock chain table comprises the steps of adding information of a data lock into the tail of the chain table, the head of the chain table is an IO request for obtaining the lock currently, the information of the data lock comprises a lock type, the lock type comprises a sharing lock and a mutual exclusion lock, the identification of the sharing lock is 0, and the identification of the mutual exclusion lock is 1;
the first locking unit is used for applying for the shared lock for the target particle if the IO request is a read data request, successfully setting the shared lock for the target particle if the lock chain table has no information of the lock or only information of the shared lock, and maintaining a shared lock identifier and corresponding IO request information in the lock chain table; if the lock chain table has the identification of the mutual exclusion lock, the locking fails and a failure prompt is returned;
the second locking unit is used for applying exclusive locks for target particles if the IO request is a data writing request, and if the information of the locks does not exist on the inner surface of the chain, the locking is successful, and a exclusive lock identifier and corresponding IO request information are added in the chain table; if the information of the lock is in the lock linked list, the lock is failed to be acquired, and the mutual exclusion lock is released after the information of the lock is not in the lock linked list;
the release execution unit is used for releasing the data lock after snapshot processing is completed, traversing the chain table if the data lock is a mutual exclusion lock, and setting a mutual exclusion mark to be 0 if the mutual exclusion lock is not in the chain table; after releasing the data lock, judging whether a new chain list head exists in the lock chain list, if so, checking a mutual exclusion mark, and if the lock chain list only has the mark of the shared lock, informing the IO request of each lock in the lock chain list to carry out asynchronous snapshot processing; if the mutual exclusion lock identification exists in the lock linked list, the IO request to which the linked list head of the mutual exclusion lock belongs is notified to carry out asynchronous snapshot processing.
In an alternative embodiment, a method of snapshot processing includes:
if the IO request is a read data request, if the current volume does not contain data to be read, a volume for redirecting the read needs to be specified;
if the IO request is a data writing request, if the copy-on-write operation is not executed, the copy-on-write operation is executed first.
In a third aspect, a terminal is provided, including:
a processor, a memory, wherein,
the memory is used for storing a computer program,
the processor is configured to call and run the computer program from the memory, so that the terminal performs the method of the terminal as described above.
In a fourth aspect, there is provided a computer storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of the above aspects.
The IO processing method, the system, the terminal and the storage medium for the snapshot volume have the advantages that the target data of the IO request are divided into the target particles, then the target particles are set to be in a data locking state during the snapshot processing, and the target particles are locked first and then the IO flow of the snapshot processing is carried out, so that the problems of inconsistent data and IO errors of the snapshot source volume and the snapshot target volume can be effectively prevented.
According to the method, the target data of the IO request are divided into the target particles, and then the data of the particle level is locked, so that the influence of the data locking on the whole data reading and writing is reduced, and the data reading and writing efficiency of the disk array is improved.
The invention maintains the lock linked list in the snapshot volume linked list, thereby realizing the information sharing of the locked data particles, avoiding the problems of repeated locking and disorder of lock management and improving the management quality of the data lock.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic flow chart of a method of one embodiment of the invention.
Figure 2 is a schematic diagram of chain management of a method of one embodiment of the invention.
Fig. 3 is another schematic flow chart of a method of one embodiment of the invention.
FIG. 4 is a schematic flow chart diagram of request splitting for a method of one embodiment of the invention.
Fig. 5 is a schematic block diagram of a system of one embodiment of the present invention.
Fig. 6 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
The IO processing method of the snapshot volume provided by the embodiment of the invention is executed by the computer equipment, and correspondingly, the IO processing system of the snapshot volume is operated in the computer equipment.
FIG. 1 is a schematic flow chart of a method of one embodiment of the invention. The execution body of fig. 1 may be an IO processing system of a snapshot volume. The order of the steps in the flow chart may be changed and some may be omitted according to different needs.
As shown in fig. 1, the method includes:
step 110, dividing target data of the IO request into target particles;
step 120, setting the target granule to a data lock state during snapshot processing based on the IO request.
The chain management principle of snapshot volumes can be referred to in fig. 2, as follows:
at time T0, src is the snapshot source volume, contains four grains (grain 1 through grain 4), and is initially AAAA.
At time T1, snapshot Tgt1 is created with bitmap1 and initialization bitmap 0000, indicating which data blocks performed COW (0 is no copy, 1 is copied). After creating the snapshot, snapshot source volume graph4 writes B, copies src old data a to Tgt0 according to the COW principle, and the bitmap becomes 0001.
At time T2, a snapshot Tgt2 is created, and the bitmap is bitmap2. According to the chain management principle of snapshot volumes, a linked list of src- > tgt 2- > tgt1 is logically formed. We define an upstream volume with src tgt2 and bitmap2 as tgt 2; tgt1 is a downstream volume of tgt2, and bitmap1 is a downstream bitmap of tgt 2. C is written into the snapshot source volume graph3, the src old data A and the src old data A are copied to Tgt0 according to the COW principle, and the bitmap is changed to 0010.
In order to facilitate understanding of the present invention, the principle of the method for processing the IO of the snapshot volume according to the present invention is used to further describe the method for processing the IO of the snapshot volume according to the present invention in combination with the process of processing the IO of the snapshot volume in the embodiment.
Specifically, referring to fig. 3, the method for processing the IO of the snapshot volume includes:
s1, dividing target data of the IO request into target particles.
Generating a target particle number based on the volume capacity and the particle capacity of the IO request; and splitting the target data of the IO request into a plurality of target particles with corresponding numbers based on the number of the target particles.
As shown in fig. 4, the IOs are first split into individual grams, and one IO may span the grams, and for ease of management, the IOs that span the grams are split into individual grams. For example, in FIG. 3, a 1024kB volume, with a grain size of 256kB, the entire volume is divided into 4 grains, and if a read IO is addressed to 0-700kB, it is necessary to split the read IO into 3, the first 0-255kB, the second 256-511kB, and the third 512-700kB.
S2, setting the target particles to be in a data locking state during the snapshot processing based on the IO request.
For the split IO, judging that the gain corresponding to the IO needs not to be processed by the snapshot module. Judging whether the target particle of the IO request needs snapshot processing or not: if yes, applying for a data lock for the target particle; if not, the IO request is directly executed.
For a read IO request, because only one scene of the read IO request needs snapshot processing is that the volume of the read IO request is a snapshot target volume, the target volume does not have data to be read currently, and an upstream volume needs to be specified for redirection reading. It is only necessary to determine whether there is a volume upstream of the read IO request, if there is a volume and the upstream bitmap is not 1, snapshot processing (redirection read) is required; if there is no volume (not a snapshot target volume) or there is a volume but the bitmap is 1 (data has been copied to the target volume), no snapshot processing is required.
For write IO requests, the scenarios that require snapshot processing fall into three categories:
first, the volume of the write IO request has target data, and the volume downstream does not have target data. Where data of a volume (snapshot source volume) of the write IO request needs to be copied to the target volume. The corresponding judging method comprises the following steps: if there is no volume upstream of the volume that writes the data request, or the bitmap of the upstream volume is 1, and there is a volume downstream and the bitmap of the downstream volume is 0, then it is determined that snapshot processing is required for the write data request.
Second, the write IO requested volume does not have target data, and the downstream volume does have target data, or the downstream volume does not. The write IO request in this case requires modification of the upstream bitmap first. The corresponding judging method comprises the following steps: if there is a volume upstream of the volume of the write data request and the upstream volume bitmap is 0, there is no volume downstream or there is a volume but the downstream volume bitmap is 1, then it is determined that the write data request requires snapshot processing.
Third, the volumes of the write IO request do not have target data, and the volumes downstream do not have target data. In which case the target data would need to be copied to the downstream volume first. The corresponding judging method comprises the following steps: if a volume exists upstream of the volume for the write data request and the upstream volume bitmap is 0, a volume exists downstream and the downstream volume bitmap is 0, then it is determined that snapshot processing is required for the write data request.
Judging, if snapshot processing is needed, entering a next lock requesting process; if snapshot processing is not required, then the locking process is not required.
The method for requesting the lock comprises the following steps: in each snapshot volume linked list, maintaining a lock linked list for data particles, wherein the maintenance method of the lock linked list comprises the steps of adding information of a data lock into a linked list table tail, wherein the chain table head is an IO request for obtaining the lock currently, the information of the data lock comprises a lock type, the lock type comprises a shared lock and a mutual exclusion lock, the identification of the shared lock is 0, and the identification of the mutual exclusion lock is 1; if the IO request is a read data request, applying for a shared lock for the target particle, if the lock chain table has no information of the lock or only information of the shared lock, successfully setting the shared lock for the target particle, and maintaining a shared lock identifier and corresponding IO request information in the lock chain table; if the lock chain table has the identification of the mutual exclusion lock, the locking fails and a failure prompt is returned; if the IO request is a data writing request, applying for a mutual exclusion lock for the target particle, if the information of the lock is not available on the inner surface of the chain table, locking successfully, and adding a mutual exclusion lock identification and corresponding IO request information in the chain table; if the information of the lock is in the lock chain table, the lock is failed to be acquired, and the mutual exclusion lock is released after waiting for the information of the lock in the lock chain table.
Specifically, a lock linked list is maintained for each grain of each snapshot volume linked list, and if snapshot processing is required, the corresponding grain needs to be locked, that is, the lock is added to the tail of the linked list, and the head of the linked list is the IO of the lock currently obtained. The read IO corresponds to a shared lock, the write IO corresponds to a mutual exclusion lock, a mutual exclusion mark is arranged on each chain table, the mark is 1 to indicate that the mutual exclusion lock exists in the chain table, and when the mutual exclusion lock is added into the chain table, if the mutual exclusion mark is 0, the mutual exclusion mark is set to be 1. When locking is applied, for locking a shared lock (read IO), if no lock or only a shared lock (mutex zone bit 0) exists in the linked list, the locking is successful; if the linked list has the mutual exclusion lock, the locking fails. For exclusive locking (write IO), if the linked list has no lock, the locking is successful; if there is a lock in the linked list (whether a shared lock or a mutex lock), the acquisition of the lock fails and it is necessary to wait for the lock to be acquired. That is, for the same grain, only read IO and read IO can be processed in parallel, and the read IO and write IO, and the write IO and write IO are processed in series.
The next step after the lock is obtained is to perform snapshot processing. For read IO, if the current volume does not contain data to be read, a volume for redirecting the read needs to be specified; for write IO, if the COW flow is not performed, the COW needs to be performed first to copy the data. If the IO request is a read data request, if the current volume does not contain data to be read, a volume for redirecting the read needs to be specified; if the IO request is a data writing request, if the copy-on-write operation is not executed, the copy-on-write operation is executed first.
After the snapshot process is completed, the lock is released, i.e., removed from the chaining table. The method for releasing the lock comprises the following steps: if the data lock is a mutual exclusion lock, traversing a chain table, and if the mutual exclusion lock is not in the chain table, setting a mutual exclusion mark to be 0; after releasing the data lock, judging whether a new chain list head exists in the lock chain list, if so, checking a mutual exclusion mark, and if the lock chain list only has the mark of the shared lock, informing the IO request of each lock in the lock chain list to carry out asynchronous snapshot processing; if the mutual exclusion lock identification exists in the lock linked list, the IO request to which the linked list head of the mutual exclusion lock belongs is notified to carry out asynchronous snapshot processing.
For example, if the exclusive lock is removed, the linked list is traversed, and if the exclusive lock is not in the linked list, the exclusive flag is set to 0. After the locks are removed, the linked list judges whether a new linked list head exists, if so, a mutual exclusion mark is checked, and if the lock linked list is a shared lock (the mutual exclusion mark is 0), each lock in the linked list is notified to carry out asynchronous snapshot processing; if the lock chain table has a mutual exclusion lock (the mutual exclusion mark is 1), only the IO to which the chain table head belongs is notified to carry out asynchronous snapshot processing.
In some embodiments, the IO processing system of the snapshot volume may include a plurality of functional modules comprised of computer program segments. The computer program of each program segment in the IO processing system of the snapshot volume may be stored in a memory of a computer device and executed by at least one processor to perform (see FIG. 1 for details) the functions of IO processing of the snapshot volume.
In this embodiment, the IO processing system of the snapshot volume may be divided into a plurality of functional modules according to the functions performed by the IO processing system, as shown in fig. 5. The functional modules of system 500 may include: request splitting module 510, data locking module 520. The module referred to in the present invention refers to a series of computer program segments capable of being executed by at least one processor and of performing a fixed function, stored in a memory. In the present embodiment, the functions of the respective modules will be described in detail in the following embodiments.
The request splitting module is used for dividing target data of the IO request into target particles;
and the data locking module is used for setting the target particles to be in a data locking state during the snapshot processing based on the IO request.
Optionally, as an embodiment of the present invention, the request splitting module includes:
a number calculation unit for generating a target particle number based on the volume capacity and the particle capacity of the IO request;
and the data splitting unit is used for splitting the target data of the IO request into a plurality of target particles with corresponding quantity based on the target particle quantity.
Optionally, as an embodiment of the present invention, the data locking module includes:
the demand judging submodule is used for judging whether the target particles of the IO request need snapshot processing or not;
the application locking sub-module is used for applying for a data lock for the target particle if the target particle of the IO request needs snapshot processing;
and the request execution sub-module is used for directly executing the IO request if the target particle of the IO request does not need snapshot processing.
Optionally, as an embodiment of the present invention, the requirement determining submodule includes:
a request processing unit, configured to query an upstream volume of a target volume of the IO request if the IO request is a read data request, and determine that the IO request needs to perform snapshot processing if the upstream volume exists and a bitmap of the upstream volume is not 1; if the upstream volume does not exist or the bitmap of the upstream volume is not 1, judging that the IO request does not need to execute snapshot processing;
and the write request processing unit is used for judging whether the IO request needs snapshot processing or not based on the position of the volume where the target data is located if the IO request is a data writing request.
Optionally, as an embodiment of the present invention, the write request processing unit includes:
a first processing subunit, configured to determine that the snapshot processing is required for the write data request if there is no volume upstream of the volume for the write data request, or if the bitmap of the upstream volume is 1, and the bitmap of the downstream volume is 0;
a second processing subunit, configured to determine that the write data request needs snapshot processing if there is a volume upstream of the volume of the write data request and the upstream volume bitmap is 0, and there is no volume downstream or there is a volume but the downstream volume bitmap is 1;
and the third processing subunit is configured to determine that the snapshot processing is needed for the write data request if there is a volume upstream of the volume for the write data request and the upstream volume bitmap is 0, and if there is a volume downstream of the volume for the write data request and the downstream volume bitmap is 0.
Optionally, as an embodiment of the present invention, the data locking module includes:
the chain table maintenance unit is used for maintaining a lock chain table for data particles in each snapshot volume chain table, the maintenance method of the lock chain table comprises the steps of adding information of a data lock into the tail of the chain table, the head of the chain table is an IO request for obtaining the lock currently, the information of the data lock comprises a lock type, the lock type comprises a sharing lock and a mutual exclusion lock, the identification of the sharing lock is 0, and the identification of the mutual exclusion lock is 1;
the first locking unit is used for applying for the shared lock for the target particle if the IO request is a read data request, successfully setting the shared lock for the target particle if the lock chain table has no information of the lock or only information of the shared lock, and maintaining a shared lock identifier and corresponding IO request information in the lock chain table; if the lock chain table has the identification of the mutual exclusion lock, the locking fails and a failure prompt is returned;
the second locking unit is used for applying exclusive locks for target particles if the IO request is a data writing request, and if the information of the locks does not exist on the inner surface of the chain, the locking is successful, and a exclusive lock identifier and corresponding IO request information are added in the chain table; if the information of the lock is in the lock linked list, the lock is failed to be acquired, and the mutual exclusion lock is released after the information of the lock is not in the lock linked list;
the release execution unit is used for releasing the data lock after snapshot processing is completed, traversing the chain table if the data lock is a mutual exclusion lock, and setting a mutual exclusion mark to be 0 if the mutual exclusion lock is not in the chain table; after releasing the data lock, judging whether a new chain list head exists in the lock chain list, if so, checking a mutual exclusion mark, and if the lock chain list only has the mark of the shared lock, informing the IO request of each lock in the lock chain list to carry out asynchronous snapshot processing; if the mutual exclusion lock identification exists in the lock linked list, the IO request to which the linked list head of the mutual exclusion lock belongs is notified to carry out asynchronous snapshot processing.
Optionally, as an embodiment of the present invention, the method for snapshot processing includes:
if the IO request is a read data request, if the current volume does not contain data to be read, a volume for redirecting the read needs to be specified;
if the IO request is a data writing request, if the copy-on-write operation is not executed, the copy-on-write operation is executed first.
Fig. 6 is a schematic structural diagram of a terminal 600 according to an embodiment of the present invention, where the terminal 600 may be used to execute the IO processing method of the snapshot volume according to the embodiment of the present invention.
The terminal 600 may include: processor 610, memory 620, and communication unit 630. The components may communicate via one or more buses, and it will be appreciated by those skilled in the art that the configuration of the server as shown in the drawings is not limiting of the invention, as it may be a bus-like structure, a star-like structure, or include more or fewer components than shown, or may be a combination of certain components or a different arrangement of components.
The memory 620 may be used to store instructions for execution by the processor 610, and the memory 620 may be implemented by any type of volatile or non-volatile memory terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. The execution of the instructions in memory 620, when executed by processor 610, enables terminal 600 to perform some or all of the steps in the method embodiments described below.
The processor 610 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by running or executing software programs and/or modules stored in the memory 620, and invoking data stored in the memory. The processor may be comprised of an integrated circuit (Integrated Circuit, simply referred to as an IC), for example, a single packaged IC, or may be comprised of a plurality of packaged ICs connected to the same function or different functions. For example, the processor 610 may include only a central processing unit (Central Processing Unit, simply CPU). In the embodiment of the invention, the CPU can be a single operation core or can comprise multiple operation cores.
A communication unit 630, configured to establish a communication channel, so that the storage terminal can communicate with other terminals. Receiving user data sent by other terminals or sending the user data to other terminals.
The present invention also provides a computer storage medium in which a program may be stored, which program may include some or all of the steps in the embodiments provided by the present invention when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
Therefore, the method and the device can effectively prevent the problems of inconsistent data and IO errors of the snapshot source volume and the snapshot target volume by dividing the target data of the IO request into the target particles and setting the target particles into the data locking state during the snapshot processing, and the IO flow of the snapshot processing is performed after the target particles are locked.
It will be apparent to those skilled in the art that the techniques of embodiments of the present invention may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solution in the embodiments of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium such as a U-disc, a mobile hard disc, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or an optical disk, etc. various media capable of storing program codes, including several instructions for causing a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the method described in the embodiments of the present invention.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the terminal embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description in the method embodiment for relevant points.
In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods may be implemented in other ways. For example, the system embodiments described above are merely illustrative, e.g., the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with respect to each other may be through some interface, indirect coupling or communication connection of systems or modules, electrical, mechanical, or other form.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
Although the present invention has been described in detail by way of preferred embodiments with reference to the accompanying drawings, the present invention is not limited thereto. Various equivalent modifications and substitutions may be made in the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and it is intended that all such modifications and substitutions be within the scope of the present invention/be within the scope of the present invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An IO processing method for a snapshot volume, comprising:
dividing target data of the IO request into target particles;
during snapshot processing based on the IO request, the target granule is set to a data lock state.
2. The method of claim 1, wherein partitioning target data of the IO request into target particles comprises:
generating a target particle number based on the volume capacity and the particle capacity of the IO request;
and splitting the target data of the IO request into a plurality of target particles with corresponding numbers based on the number of the target particles.
3. The method of claim 1, wherein setting the target granule to the data lock state during snapshot processing based on the IO request comprises:
judging whether the target particle of the IO request needs snapshot processing or not:
if yes, applying for a data lock for the target particle;
if not, the IO request is directly executed.
4. The method of claim 3, wherein determining whether the target particle of the IO request requires snapshot processing comprises:
if the IO request is a read data request, inquiring an upstream volume of a target volume of the IO request, and if the upstream volume exists and the bitmap of the upstream volume is not 1, judging that the IO request needs to execute snapshot processing; if the upstream volume does not exist or the bitmap of the upstream volume is not 1, judging that the IO request does not need to execute snapshot processing;
if the IO request is a data writing request, judging whether the IO request needs snapshot processing or not based on the position of the volume where the target data is located.
5. The method of claim 4, wherein if the IO request is a write data request, determining whether the IO request requires snapshot processing based on a location of a volume in which target data is located comprises:
if the upstream of the volume for writing the data request has no volume or the bitmap of the upstream volume is 1, the downstream has a volume and the bitmap of the downstream volume is 0, judging that the data request needs snapshot processing;
if the volume upstream of the volume for writing the data request exists and the upstream volume bitmap is 0, and the downstream volume is not or is provided with the volume but the downstream volume bitmap is 1, judging that the data writing request needs snapshot processing;
if a volume exists upstream of the volume for the write data request and the upstream volume bitmap is 0, a volume exists downstream and the downstream volume bitmap is 0, then it is determined that snapshot processing is required for the write data request.
6. A method according to claim 1 or 3, wherein setting the target particle to a data lock state during snapshot processing based on the IO request comprises:
in each snapshot volume linked list, maintaining a lock linked list for data particles, wherein the maintenance method of the lock linked list comprises the steps of adding information of a data lock into a linked list table tail, wherein the chain table head is an IO request for obtaining the lock currently, the information of the data lock comprises a lock type, the lock type comprises a shared lock and a mutual exclusion lock, the identification of the shared lock is 0, and the identification of the mutual exclusion lock is 1;
if the IO request is a read data request, applying for a shared lock for the target particle, if the lock chain table has no information of the lock or only information of the shared lock, successfully setting the shared lock for the target particle, and maintaining a shared lock identifier and corresponding IO request information in the lock chain table; if the lock chain table has the identification of the mutual exclusion lock, the locking fails and a failure prompt is returned;
if the IO request is a data writing request, applying for a mutual exclusion lock for the target particle, if the information of the lock is not available on the inner surface of the chain table, locking successfully, and adding a mutual exclusion lock identification and corresponding IO request information in the chain table; if the information of the lock is in the lock linked list, the lock is failed to be acquired, and the mutual exclusion lock is released after the information of the lock is not in the lock linked list;
after snapshot processing is completed, releasing the data lock, traversing a lock chain table if the data lock is a mutual exclusion lock, and setting a mutual exclusion mark to be 0 if the lock chain table has no mutual exclusion lock; after releasing the data lock, judging whether a new chain list head exists in the lock chain list, if so, checking a mutual exclusion mark, and if the lock chain list only has the mark of the shared lock, informing the IO request of each lock in the lock chain list to carry out asynchronous snapshot processing; if the mutual exclusion lock identification exists in the lock linked list, the IO request to which the linked list head of the mutual exclusion lock belongs is notified to carry out asynchronous snapshot processing.
7. The method of claim 1, wherein the method of snapshot processing comprises:
if the IO request is a read data request, if the current volume does not contain data to be read, a volume for redirecting the read needs to be specified;
if the IO request is a data writing request, if the copy-on-write operation is not executed, the copy-on-write operation is executed first.
8. An IO processing system for a snapshot volume, comprising:
the request splitting module is used for dividing target data of the IO request into target particles;
and the data locking module is used for setting the target particles to be in a data locking state during the snapshot processing based on the IO request.
9. A terminal, comprising:
the memory is used for storing IO processing programs of the snapshot volumes;
a processor, configured to implement the steps of the method for IO processing a snapshot volume according to any one of claims 1 to 7 when executing the IO processing program of the snapshot volume.
10. A computer readable storage medium storing a computer program, wherein the readable storage medium stores thereon an IO processing program of a snapshot volume, the IO processing program of the snapshot volume, when executed by a processor, implementing the steps of the IO processing method of the snapshot volume according to any one of claims 1-7.
CN202311263946.2A 2023-09-27 2023-09-27 IO processing method, system, terminal and storage medium of snapshot volume Pending CN117193662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311263946.2A CN117193662A (en) 2023-09-27 2023-09-27 IO processing method, system, terminal and storage medium of snapshot volume

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311263946.2A CN117193662A (en) 2023-09-27 2023-09-27 IO processing method, system, terminal and storage medium of snapshot volume

Publications (1)

Publication Number Publication Date
CN117193662A true CN117193662A (en) 2023-12-08

Family

ID=88999685

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311263946.2A Pending CN117193662A (en) 2023-09-27 2023-09-27 IO processing method, system, terminal and storage medium of snapshot volume

Country Status (1)

Country Link
CN (1) CN117193662A (en)

Similar Documents

Publication Publication Date Title
CN110716845B (en) Log information reading method of Android system
CN112597153A (en) Data storage method and device based on block chain and storage medium
CN111708787A (en) Multi-center service data management system
CN115686932B (en) Backup set file recovery method and device and computer equipment
CN113656149A (en) Application processing method and device and related equipment
CN111857600B (en) Data reading and writing method and device
CN113157491A (en) Data backup method and device, communication equipment and storage medium
US11855868B2 (en) Reducing the impact of network latency during a restore operation
CN110569112B (en) Log data writing method and object storage daemon device
CN117193662A (en) IO processing method, system, terminal and storage medium of snapshot volume
US20240095211A1 (en) Published File System And Method
CN116226041A (en) File read/write method, device and equipment in distributed file system
CN113849317B (en) Memory pool resource using method and related device
CN115470041A (en) Data disaster recovery management method and device
US9971532B2 (en) GUID partition table based hidden data store system
CN113296685B (en) Data processing method and device and computer readable storage medium
CN114675995A (en) Data backup method and device and electronic equipment
US7543001B2 (en) Storing object recovery information within the object
CN113468105A (en) Data structure of data snapshot, related data processing method, device and system
CN112445413A (en) Data storage method and device and related equipment
CN115103020B (en) Data migration processing method and device
CN112860694B (en) Service data processing method, device and equipment
CN113434477B (en) Method, system, medium and server for storing log file
US20230393952A1 (en) Intelligent merge of primary and backup data
KR101887663B1 (en) Method and apparatus for processing data using dummy page

Legal Events

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