CN106557385B - Data snapshot method and storage device - Google Patents

Data snapshot method and storage device Download PDF

Info

Publication number
CN106557385B
CN106557385B CN201510626065.1A CN201510626065A CN106557385B CN 106557385 B CN106557385 B CN 106557385B CN 201510626065 A CN201510626065 A CN 201510626065A CN 106557385 B CN106557385 B CN 106557385B
Authority
CN
China
Prior art keywords
lun
logical address
snapshot
address
source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510626065.1A
Other languages
Chinese (zh)
Other versions
CN106557385A (en
Inventor
黄发
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Huawei Technology Co Ltd
Original Assignee
Chengdu Huawei 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 Chengdu Huawei Technology Co Ltd filed Critical Chengdu Huawei Technology Co Ltd
Priority to CN201510626065.1A priority Critical patent/CN106557385B/en
Priority to PCT/CN2016/087913 priority patent/WO2017054539A1/en
Publication of CN106557385A publication Critical patent/CN106557385A/en
Application granted granted Critical
Publication of CN106557385B publication Critical patent/CN106557385B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a data snapshot method and storage equipment, wherein the method comprises the following steps: acquiring the reading frequency of a first logical address in a source LUN or a snapshot LUN, wherein the first logical address is any one of the source LUN and the snapshot LUN; when the reading frequency of the first logic address in the source LUN or the snapshot LUN is greater than the preset frequency, inquiring a physical address corresponding to the first logic address in the snapshot LUN according to the first logic address; when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, and backing up data corresponding to the first logical address in the source LUN to the snapshot LUN according to the first physical address. When the first logical address in the snapshot LUN needs to be read, the data reading in the source LUN does not need to be carried out, unnecessary signaling forwarding is avoided, and the data reading efficiency is improved.

Description

Data snapshot method and storage device
Technical Field
The embodiment of the invention relates to the technical field of storage, in particular to a data snapshot method and storage equipment.
Background
With the continuous increase of the demand of centralized storage applications, users need to protect data in an online manner to shorten a backup window, a snapshot technology is one of effective methods for preventing data loss of online storage devices, and more storage devices start to support this function. The virtual snapshot is a technology for realizing the snapshot function, and Copy-on-write (English: Copy on write, for short: COW) is an implementation mode of the virtual snapshot, and the specific process is as follows: a mapping table is stored on a source Logical Unit Number (LUN), where the mapping table records a mapping relationship between a Logical address and a physical address of each data on a source LUN, and when a virtual snapshot is activated (i.e., a snapshot of the source LUN is activated), a mapping table is also stored on the snapshot LUN, and the mapping table records a mapping relationship between a Logical address and a physical address of each data on the snapshot LUN, where the Logical address of each data on the snapshot LUN is the same as the Logical address of each data on the source LUN, and it needs to be noted that when the virtual snapshot is activated, no data is stored on the snapshot LUN at this time, and thus, the mapping table on the snapshot LUN is empty; only when new data is written into the source LUN, the source data in the source LUN corresponding to the logical address of the new data is moved into the snapshot LUN, and then the mapping relationship between the logical address of the source data and the physical address in the snapshot LUN is recorded in the snapshot LUN, and the new data is written into the source LUN.
However, in the prior art, only when a source LUN is written, data is stored in a snapshot LUN, if new data is not written to a certain block logical address in the source LUN, the block logical address in the snapshot LUN does not store the data, and when the block logical address in the snapshot LUN needs to be read, the block logical address needs to be redirected to the source LUN to read the data, which causes unnecessary information forwarding and reduces data reading efficiency.
Disclosure of Invention
The embodiment of the invention provides a data snapshot method and storage equipment, which are used for avoiding unnecessary information forwarding and improving data reading efficiency.
In a first aspect, an embodiment of the present invention provides a data snapshot method, including:
acquiring a first logical address in a source LUN or a read frequency of the first logical address in a snapshot LUN, wherein the source LUN and the snapshot LUN have the same logical address, and the first logical address is any one of the source LUN and the snapshot LUN;
when the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, querying a physical address corresponding to the first logical address in the snapshot LUN according to the first logical address;
when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, and backing up data corresponding to the first logical address in the source LUN to the snapshot LUN according to the first physical address.
In a first possible implementation manner of the first aspect, the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN;
before establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, the method further includes:
when a read command is acquired and a physical address corresponding to the first logical address is not queried in the snapshot LUN according to the read command, determining a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN and a physical address in the source LUN stored in the snapshot LUN; the read command is used for reading data corresponding to the first logical address in the snapshot LUN;
and reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN corresponding to the first logical address.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the method further includes:
when the snapshot LUN is activated, backing up the corresponding relation between the logical address in the source LUN and the physical address in the source LUN to the snapshot LUN.
With reference to the first aspect, or the first possible implementation manner of the first aspect, or the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, after the establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, the method further includes:
when a write command is acquired, the write command is used for writing data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, determining a physical address in the source LUN corresponding to the first logical address according to a corresponding relationship between the logical address in the source LUN and the physical address in the source LUN;
and writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
With reference to the first aspect, or the first possible implementation manner of the first aspect, or the second possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, after the establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, the method further includes:
when a write command is obtained, the write command is used for writing data to be written into the snapshot LUN according to the first logical address, and determining that the first physical address is a physical address in the snapshot LUN corresponding to the first logical address according to a corresponding relationship between the first logical address in the snapshot LUN and the first physical address;
and writing the data to be written into the snapshot LUN according to the first physical address.
In a second aspect, an embodiment of the present invention provides a storage device, including:
an obtaining unit, configured to obtain a first logical address in a source LUN or a read frequency of the first logical address in a snapshot LUN, where the source LUN and the snapshot LUN have a same logical address, and the first logical address is any one of the source LUN and the snapshot LUN;
a determining unit, configured to determine whether a read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency;
a processing unit, configured to, when the determining unit determines that the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, query, according to the first logical address, a physical address corresponding to the first logical address in the snapshot LUN; when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relation between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN; and according to the first physical address, backing up data corresponding to the first logical address in the source LUN to the snapshot LUN.
In a first possible implementation manner of the second aspect, the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN;
the acquisition unit is also used for acquiring a read command;
the processing unit is further configured to, before establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, determine, when the obtaining unit obtains the read command and does not query, according to the read command, a physical address corresponding to the first logical address in the source LUN according to a correspondence between a logical address in the source LUN and a physical address in the source LUN stored in the snapshot LUN; the read command is used for reading data corresponding to the first logical address in the snapshot LUN; and reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN corresponding to the first logical address.
With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the processing unit is further configured to backup, when the snapshot LUN is activated, a correspondence between a logical address in the source LUN and a physical address in the source LUN to the snapshot LUN.
With reference to the second aspect, or the first possible implementation manner of the second aspect, or the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the obtaining unit is further configured to obtain a write command;
the processing unit is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit obtains a write command, the write command is used to write data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, determine a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN and a physical address in the source LUN; and writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
With reference to the second aspect, or the first possible implementation manner of the second aspect, or the second possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the obtaining unit is further configured to obtain a write command;
the processing unit is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit obtains a write command, write the data to be written into the snapshot LUN according to the first logical address, and determine, according to the correspondence between the first logical address in the snapshot LUN and the first physical address, that the first physical address is a physical address in the snapshot LUN corresponding to the first logical address; and writing the data to be written into the snapshot LUN according to the first physical address.
The embodiment of the invention provides a data snapshot method and storage equipment, wherein by acquiring a first logical address in a source LUN or a read frequency of the first logical address in a snapshot LUN, when the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency and a physical address corresponding to the first logical address is not inquired in the snapshot LUN according to the first logical address, a corresponding relation between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN is established, and data corresponding to the first logical address in the source LUN is backed up to the snapshot LUN according to the first physical address; the data is not required to be backed up to the snapshot LUN when the first logical address is written, and when the first logical address in the snapshot LUN is required to be read, the data can be directly obtained from the snapshot LUN without reading the data from the source LUN, so that unnecessary signaling forwarding is avoided, and the data reading efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart of a first embodiment of a data snapshot method of the present invention;
FIG. 2 is a flowchart of a second embodiment of a data snapshot method of the present invention;
FIG. 3 is a flowchart of a third embodiment of a data snapshot method of the present invention;
FIG. 4 is a flowchart of a fourth embodiment of a data snapshot method of the present invention;
FIG. 5 is a schematic structural diagram of a first embodiment of a memory device according to the present invention;
fig. 6 is a schematic structural diagram of a second embodiment of the memory device according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a first embodiment of a data snapshot method of the present invention, and as shown in fig. 1, the method of this embodiment may include:
s101, obtaining a first logical address in a source LUN or a reading frequency of the first logical address in a snapshot LUN, wherein the source LUN and the snapshot LUN have the same logical address, and the first logical address is any one of the source LUN and the snapshot LUN.
The snapshot LUN in this embodiment is a snapshot LUN of the source LUN, and the source LUN and the snapshot LUN have the same logical address, for example: the source LUN has a logical address: 0. 1, 2, 3, 4, 5, 6, 7, then the snapshot LUN also has a logical address: 0. 1, 2, 3, 4, 5, 6 and 7. The present embodiment may count a read frequency of any logical address in the source LUN or the snapshot LUN, so that the read frequency may represent the number of reads within a preset time, where the any logical address is referred to as a first logical address, for example, the first logical address is 3, and then the present embodiment may obtain the read frequency that the logical address in the source LUN is 3, or obtain the read frequency that the logical address in the snapshot LUN is 3.
S102, when the reading frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, inquiring a physical address corresponding to the first logical address in the snapshot LUN according to the first logical address.
In this embodiment, after obtaining the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN, the read frequency of the first logical address in the source LUN or the read frequency of the first logical address in the snapshot LUN is compared with the preset frequency, when it is determined that the read frequency of the first logical address in the source LUN is greater than the preset frequency or when it is determined that the read frequency of the first logical address in the snapshot LUN is greater than the preset frequency, whether a corresponding physical address exists in the snapshot LUN for the first logical address may be queried according to the first logical address, if a physical address corresponding to the first logical address is queried in the snapshot LUN, the process is ended, and if a physical address corresponding to the first logical address is not queried in the snapshot LUN, S103 is executed.
S103, when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, and backing up data corresponding to the first logical address in the source LUN to the snapshot LUN according to the first physical address.
In this embodiment, when the physical address in the snapshot LUN corresponding to the first logical address is not queried in the snapshot LUN, that is, the mapping relationship of the first logical address is empty in the snapshot LUN, which indicates that the data corresponding to the first logical address in the source LUN is not stored in the snapshot LUN, so that the backup of the data corresponding to the first logical address in the source LUN can be triggered, that is, the data corresponding to the first logical address in the source LUN is backed up into the snapshot LUN, so that the data corresponding to the first logical address is stored in the snapshot LUN, specifically, a physical address of a storage area for storing the data corresponding to the first logical address in the source LUN is first allocated in the snapshot LUN, where the physical address is referred to as a first physical address, and a correspondence relationship between the first logical address and the first physical address is established, and according to the first physical address, backing up data corresponding to the first logical address in the source LUN to the snapshot LUN (i.e., to a storage area corresponding to the first physical address in the snapshot LUN); the data does not need to be backed up into the snapshot LUN until the first logical address is written.
After the data corresponding to the first logical address in the source LUN is backed up to the snapshot LUN according to the read frequency of the first logical address in this embodiment, if the first logical address in the snapshot LUN needs to be read subsequently, according to the first logical address and the above-mentioned established correspondence between the first logical address and the first physical address, it may be determined that the physical address corresponding to the first logical address in the snapshot LUN is the first physical address, and then the data in the storage area corresponding to the first physical address is read without reading the data in the source LUN, which avoids unnecessary signaling forwarding, and improves the data reading efficiency.
In the data snapshot method provided by this embodiment, by obtaining a first logical address in a source LUN or a read frequency of the first logical address in the snapshot LUN, when the read frequency of the first logical address in the source LUN or the read frequency of the first logical address in the snapshot LUN is greater than a preset frequency, and according to the first logical address, a physical address corresponding to the first logical address is not queried in the snapshot LUN, a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN is established, and according to the first physical address, data corresponding to the first logical address in the source LUN is backed up to the snapshot LUN; the data is not required to be backed up to the snapshot LUN when the first logical address is written, and when the first logical address in the snapshot LUN is required to be read, the data can be directly obtained from the snapshot LUN without reading the data from the source LUN, so that unnecessary signaling forwarding is avoided, and the data reading efficiency is improved.
Fig. 2 is a flowchart of a second embodiment of the data snapshot method of the present invention, as shown in fig. 2, on the basis of the embodiment of the method shown in fig. 1, optionally, before executing S103 shown in fig. 1, the method of this embodiment may further include:
s201, when a read command is acquired and a physical address corresponding to the first logical address is not queried in the snapshot LUN according to the read command, determining a physical address in the source LUN corresponding to the first logical address according to a corresponding relationship between a logical address in the source LUN and a physical address in the source LUN, wherein the logical address is stored in the snapshot LUN; the read command is used for reading data corresponding to the first logical address in the snapshot LUN.
S202, reading the data stored in the source LUN according to the physical address in the source LUN corresponding to the first logical address, wherein the data is the data required to be read by the read command.
In this embodiment, the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN; optionally, the source LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN, for example: logical address in source LUN: 0. 1, 2, 3, 4, 5, 6, 7, and, the physical address in the source LUN: 20. 21, 22, 23, 24, 25, 26, and 27 have a one-to-one correspondence relationship, so that when the snapshot LUN is activated, the correspondence relationship between the logical address in the source LUN and the physical address in the source LUN is backed up to the snapshot LUN, so that the correspondence relationship between the logical address in the source LUN and the physical address in the source LUN is stored in the snapshot LUN, and it should be noted that the snapshot LUN needs to be created before the snapshot LUN is activated.
Therefore, in this embodiment, when the read command is obtained, the read command is used to read the data corresponding to the first logical address in the snapshot LUN, and whether a physical address corresponding to the first logical address exists in the snapshot LUN is queried according to the read command. If the physical address corresponding to the first logical address is found in the snapshot LUN, data is read according to the physical address corresponding to the first logical address, which is similar to the prior art and is not described here again. If the physical address corresponding to the first logical address is not queried in the snapshot LUN, that is, the mapping relationship of the first logical address is null in the snapshot LUN, which indicates that the data corresponding to the first logical address is not stored in the snapshot LUN, the data needs to be obtained from the source LUN, and then the physical address in the source LUN corresponding to the first logical address is determined according to the corresponding relationship between the logical address in the source LUN stored in the snapshot LUN and the physical address in the source LUN. And after the physical address in the source LUN corresponding to the first logical address is determined, reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN.
In this embodiment, because the corresponding relationship between the logical address in the source LUN and the physical address in the source LUN is stored in the snapshot LUN, when data corresponding to the first logical address is not read in the snapshot LUN, the physical address in the source LUN corresponding to the first logical address is directly determined according to the corresponding relationship between the logical address in the source LUN stored in the snapshot LUN and the physical address in the source LUN, without being redirected to the source LUN to query the corresponding relationship between the logical address and the physical address stored in the source LUN as in the prior art, and particularly, when the source LUN has multiple snapshot LUNs, a large number of concurrent query requests and unnecessary information forwarding are avoided.
Fig. 3 is a flowchart of a third embodiment of the data snapshot method of the present invention, and as shown in fig. 3, on the basis of the first or second embodiment of the method of the present invention, optionally, after the corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN is established in this embodiment, the method of this embodiment may further include:
s301, when a write command is obtained, the write command is used to write data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, the physical address in the source LUN corresponding to the first logical address is determined according to a correspondence between the logical address in the source LUN and the physical address in the source LUN.
S302, writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
In this embodiment, when the write command is obtained, the write command is used to write data to be written into the source LUN according to the first logical address, and query whether a physical address corresponding to the first logical address exists in the snapshot LUN according to the write command. Because the corresponding relationship between the first logical address and the first physical address is established in the snapshot LUN, it can be queried that the physical address of the first logical address corresponding to the snapshot LUN is the first physical address, which indicates that the data corresponding to the first logical address has been stored in the snapshot LUN. Then, in this embodiment, according to a correspondence between a logical address in the source LUN and a physical address in the source LUN (which may be stored in the source LUN or stored in the snapshot LUN), the physical address in the source LUN corresponding to the first logical address is determined. And after the physical address in the source LUN corresponding to the first logical address is determined, writing the data to be written into the source LUN according to the physical address in the source LUN.
Fig. 4 is a flowchart of a fourth embodiment of the data snapshot method of the present invention, as shown in fig. 4, on the basis of the first or second embodiment of the method of the present invention, optionally, after the corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN is established in this embodiment, the method of this embodiment may further include:
s401, when a write command is obtained, the write command is used for writing data to be written into the snapshot LUN according to the first logical address, and the first physical address is determined to be a physical address in the snapshot LUN corresponding to the first logical address according to a corresponding relation between the first logical address in the snapshot LUN and the first physical address.
S402, writing the data to be written into the snapshot LUN according to the first physical address.
In this embodiment, when the write command is obtained, the write command is used to write data to be written into the snapshot LUN according to the first logical address, and query whether a physical address corresponding to the first logical address exists in the snapshot LUN according to the write command. Because the corresponding relationship between the first logical address and the first physical address is established in the snapshot LUN, it can be queried that the physical address in the snapshot LUN corresponding to the first logical address is the first physical address, which indicates that the data corresponding to the first logical address has been stored in the snapshot LUN, and before the data to be written is written into the source LUN, it is not necessary to backup the data corresponding to the first logical address in the source LUN into the snapshot LUN as in the prior art. Then, according to the first physical address, the present embodiment writes the data to be written into the snapshot LUN.
Fig. 5 is a schematic structural diagram of a first embodiment of a storage device in the present invention, and as shown in fig. 5, the storage device in this embodiment may include: an acquisition unit 11, a determination unit 12, and a processing unit 13; the acquiring unit 11 is configured to acquire a first logical address in a source LUN or a read frequency of the first logical address in a snapshot LUN, where the source LUN and the snapshot LUN have the same logical address, and the first logical address is any one of the source LUN and the snapshot LUN; a determining unit 12, configured to determine whether a read frequency of a first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency; a processing unit 13, configured to, when the determining unit 12 determines that the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, query, according to the first logical address, a physical address corresponding to the first logical address in the snapshot LUN; when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relation between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN; and according to the first physical address, backing up data corresponding to the first logical address in the source LUN to the snapshot LUN.
Optionally, the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN; an obtaining unit 11, further configured to obtain a read command; the processing unit 13 is further configured to, before establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit 11 obtains the read command and does not query a physical address corresponding to the first logical address in the snapshot LUN according to the read command, determine a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN stored in the snapshot LUN and a physical address in the source LUN; the read command is used for reading data corresponding to the first logical address in the snapshot LUN; and reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN corresponding to the first logical address.
Optionally, the processing unit 13 is further configured to backup, when the snapshot LUN is created and activated, a correspondence between a logical address in the source LUN and a physical address in the source LUN into the snapshot LUN.
Optionally, the obtaining unit 11 is further configured to obtain a write command; the processing unit 13 is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit 11 obtains a write command, the write command is used to write data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, determine a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN and a physical address in the source LUN; and writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
Optionally, the obtaining unit 11 is further configured to obtain a write command; the processing unit 13 is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit 11 obtains a write command, the write command is used to write data to be written into the snapshot LUN according to the first logical address, and determine, according to the correspondence between the first logical address in the snapshot LUN and the first physical address, that the first physical address is a physical address in the snapshot LUN corresponding to the first logical address; and writing the data to be written into the snapshot LUN according to the first physical address.
The storage device of this embodiment may be configured to execute the technical solutions of the above method embodiments of the present invention, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 6 is a schematic structural diagram of a second embodiment of the storage device of the present invention, and as shown in fig. 6, the storage device of this embodiment may include: a processor 21, a memory 22 and a communication interface 23, wherein the above components are connected in communication, for example, the above components can be connected by a bus and communicate with each other, and the communication interface 23 is connected with an external device and communicates with the external device; the memory 22 is used to store code for performing a data snapshot method. The processor 21 and the communication interface 23 are used to call the code to perform the following operations:
the processor 21 is configured to obtain a read frequency of a first logical address in a source LUN or a first logical address in a snapshot LUN, where the source LUN and the snapshot LUN have the same logical address, and the first logical address is any one of the source LUN and the snapshot LUN; when the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, querying a physical address corresponding to the first logical address in the snapshot LUN according to the first logical address; when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, and backing up data corresponding to the first logical address in the source LUN to the snapshot LUN according to the first physical address.
Optionally, the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN;
a communication interface 23 for acquiring a read command;
the processor 21 is further configured to, before establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, determine, according to a correspondence between a logical address in the source LUN and a physical address in the source LUN stored in the snapshot LUN, a physical address in the source LUN corresponding to the first logical address when the communication interface 23 obtains a read command and the physical address corresponding to the first logical address is not queried in the snapshot LUN according to the read command; the read command is used for reading data corresponding to the first logical address in the snapshot LUN; and reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN corresponding to the first logical address.
Optionally, the processor 21 is further configured to backup a correspondence between a logical address in the source LUN and a physical address in the source LUN into the snapshot LUN when the snapshot LUN is created and activated.
Optionally, the communication interface 23 is further configured to obtain a write command;
the processor 21 is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the communication interface 23 obtains a write command, the write command is used to write data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, determine a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN and a physical address in the source LUN; and writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
Optionally, the communication interface 23 is further configured to obtain a write command;
the processor 21 is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the communication interface 23 obtains a write command, the write command is used to write data to be written into the snapshot LUN according to the first logical address, and determine, according to the correspondence between the first logical address in the snapshot LUN and the first physical address, that the first physical address is a physical address in the snapshot LUN corresponding to the first logical address; and writing the data to be written into the snapshot LUN according to the first physical address.
The storage device of this embodiment may be configured to execute the technical solutions of the above method embodiments of the present invention, and the implementation principles and technical effects are similar, which are not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: Read-Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for data snapshot, comprising:
acquiring a first logical address in a source Logical Unit Number (LUN) or a read frequency of the first logical address in a snapshot LUN, wherein the source LUN and the snapshot LUN have the same logical address, and the first logical address is any one of the source LUN and the snapshot LUN;
when the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, querying a physical address corresponding to the first logical address in the snapshot LUN according to the first logical address;
when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relationship between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, and backing up data corresponding to the first logical address in the source LUN to the snapshot LUN according to the first physical address.
2. The method according to claim 1, wherein the snapshot LUN has stored therein a correspondence of a logical address in the source LUN and a physical address in the source LUN;
before establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, the method further includes:
when a read command is acquired and a physical address corresponding to the first logical address is not queried in the snapshot LUN according to the read command, determining a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN and a physical address in the source LUN stored in the snapshot LUN; the read command is used for reading data corresponding to the first logical address in the snapshot LUN;
and reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN corresponding to the first logical address.
3. The method of claim 2, further comprising:
when the snapshot LUN is activated, backing up the corresponding relation between the logical address in the source LUN and the physical address in the source LUN to the snapshot LUN.
4. The method according to any one of claims 1 to 3, wherein after the establishing the correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, the method further comprises:
when a write command is acquired, the write command is used for writing data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, determining a physical address in the source LUN corresponding to the first logical address according to a corresponding relationship between the logical address in the source LUN and the physical address in the source LUN;
and writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
5. The method according to any one of claims 1 to 3, wherein after the establishing the correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, the method further comprises:
when a write command is obtained, the write command is used for writing data to be written into the snapshot LUN according to the first logical address, and determining that the first physical address is a physical address in the snapshot LUN corresponding to the first logical address according to a corresponding relationship between the first logical address in the snapshot LUN and the first physical address;
and writing the data to be written into the snapshot LUN according to the first physical address.
6. A storage device, comprising:
an obtaining unit, configured to obtain a first logical address in a source logical unit number LUN or a read frequency of the first logical address in a snapshot LUN, where the source LUN and the snapshot LUN have the same logical address, and the first logical address is any one of the source LUN and the snapshot LUN;
a determining unit, configured to determine whether a read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency;
a processing unit, configured to, when the determining unit determines that the read frequency of the first logical address in the source LUN or the first logical address in the snapshot LUN is greater than a preset frequency, query, according to the first logical address, a physical address corresponding to the first logical address in the snapshot LUN; when the physical address in the snapshot LUN corresponding to the first logical address is not queried, establishing a corresponding relation between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN; and according to the first physical address, backing up data corresponding to the first logical address in the source LUN to the snapshot LUN.
7. The storage device according to claim 6, wherein the snapshot LUN stores therein a correspondence between a logical address in the source LUN and a physical address in the source LUN;
the acquisition unit is also used for acquiring a read command;
the processing unit is further configured to, before establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, determine, when the obtaining unit obtains the read command and does not query, according to the read command, a physical address corresponding to the first logical address in the source LUN according to a correspondence between a logical address in the source LUN and a physical address in the source LUN stored in the snapshot LUN; the read command is used for reading data corresponding to the first logical address in the snapshot LUN; and reading the data stored in the source LUN as the data required to be read by the read command according to the physical address in the source LUN corresponding to the first logical address.
8. The storage device according to claim 7, wherein the processing unit is further configured to backup a correspondence between a logical address in the source LUN and a physical address in the source LUN into the snapshot LUN when the snapshot LUN is activated.
9. The storage device according to any one of claims 6 to 8,
the acquisition unit is also used for acquiring a write command;
the processing unit is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit obtains a write command, the write command is used to write data to be written into the source LUN according to the first logical address, and when the first physical address corresponding to the first logical address is queried in the snapshot LUN according to the first logical address, determine a physical address in the source LUN corresponding to the first logical address according to a correspondence between a logical address in the source LUN and a physical address in the source LUN; and writing the data to be written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
10. The storage device according to any one of claims 6 to 8,
the acquisition unit is also used for acquiring a write command;
the processing unit is further configured to, after establishing a correspondence between a first logical address in the snapshot LUN and a first physical address in the snapshot LUN, when the obtaining unit obtains a write command, write the data to be written into the snapshot LUN according to the first logical address, and determine, according to the correspondence between the first logical address in the snapshot LUN and the first physical address, that the first physical address is a physical address in the snapshot LUN corresponding to the first logical address; and writing the data to be written into the snapshot LUN according to the first physical address.
CN201510626065.1A 2015-09-28 2015-09-28 Data snapshot method and storage device Active CN106557385B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201510626065.1A CN106557385B (en) 2015-09-28 2015-09-28 Data snapshot method and storage device
PCT/CN2016/087913 WO2017054539A1 (en) 2015-09-28 2016-06-30 Data snapshot method and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510626065.1A CN106557385B (en) 2015-09-28 2015-09-28 Data snapshot method and storage device

Publications (2)

Publication Number Publication Date
CN106557385A CN106557385A (en) 2017-04-05
CN106557385B true CN106557385B (en) 2020-01-21

Family

ID=58416464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510626065.1A Active CN106557385B (en) 2015-09-28 2015-09-28 Data snapshot method and storage device

Country Status (2)

Country Link
CN (1) CN106557385B (en)
WO (1) WO2017054539A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109165120B (en) * 2018-08-08 2022-04-05 华为技术有限公司 Method and product for generating management snapshot and difference bitmap in distributed storage system
CN113986128B (en) * 2021-10-26 2024-05-28 杭州宏杉科技股份有限公司 LUN data copying method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359301A (en) * 2008-08-19 2009-02-04 成都市华为赛门铁克科技有限公司 Auto snapshot method and device
CN102929748A (en) * 2012-11-08 2013-02-13 华为技术有限公司 Method and device for data backup
US8959388B1 (en) * 2012-12-28 2015-02-17 Emc Corporation Managing TLU recovery using pre-allocated LUN slices
CN104407935A (en) * 2014-11-07 2015-03-11 华为数字技术(成都)有限公司 Snapshot rollback method and storage equipment
CN104572478A (en) * 2013-10-14 2015-04-29 联想(北京)有限公司 Data access method and data access device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100439675B1 (en) * 2002-10-24 2004-07-14 한국전자통신연구원 An efficient snapshot technique for shated large storage
US8028136B2 (en) * 2007-03-09 2011-09-27 International Business Machines Corporation Retaining disk identification in operating system environment after a hardware-driven snapshot restore from a snapshot-LUN created using software-driven snapshot architecture
CN102591790B (en) * 2011-12-30 2015-11-25 记忆科技(深圳)有限公司 Data based on solid state hard disc store snapshot implementing method and solid state hard disc
CN104331344A (en) * 2014-11-11 2015-02-04 浪潮(北京)电子信息产业有限公司 Data backup method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359301A (en) * 2008-08-19 2009-02-04 成都市华为赛门铁克科技有限公司 Auto snapshot method and device
CN102929748A (en) * 2012-11-08 2013-02-13 华为技术有限公司 Method and device for data backup
US8959388B1 (en) * 2012-12-28 2015-02-17 Emc Corporation Managing TLU recovery using pre-allocated LUN slices
CN104572478A (en) * 2013-10-14 2015-04-29 联想(北京)有限公司 Data access method and data access device
CN104407935A (en) * 2014-11-07 2015-03-11 华为数字技术(成都)有限公司 Snapshot rollback method and storage equipment

Also Published As

Publication number Publication date
CN106557385A (en) 2017-04-05
WO2017054539A1 (en) 2017-04-06

Similar Documents

Publication Publication Date Title
EP3153987B1 (en) Duplicate data deletion method and device
US10331584B2 (en) Internal system namespace exposed through use of two local processors and controller memory buffer with two reserved areas
EP2709018A1 (en) Method of managing main memory
CN110908609B (en) Method, system and equipment for processing disk and readable storage medium
EP2711841A1 (en) Data processing method, device and system based on block storage
US10152274B2 (en) Method and apparatus for reading/writing data from/into flash memory, and user equipment
US10552089B2 (en) Data processing for managing local and distributed storage systems by scheduling information corresponding to data write requests
CN106201652B (en) Data processing method and virtual machine
US9658799B2 (en) Data storage device deferred secure delete
US20150019830A1 (en) Dynamic address mapping for finish in the field
US10803109B2 (en) Method and device for reading and writing video data in NAS device
CN107229421B (en) Method and device for creating video data storage system, method and device for writing file into video data storage system and method and device for reading video data storage system
CN104408126B (en) A kind of persistence wiring method of database, device and system
CN104035728A (en) Hard disk hot plug handling method, device and node
CN104866388B (en) Data processing method and device
CN106557385B (en) Data snapshot method and storage device
US9875046B2 (en) Tape backup and restore in a disk storage environment with intelligent data placement
CN104063284A (en) Method and device operating application program
CN105264608B (en) Method, Memory Controller Hub and the central processing unit of data storage
US10235089B2 (en) Storage control device, method and storage system to backup data using allocation information
KR20150139017A (en) Apparatus and method for controlling memory
CN106775456B (en) A kind of data processing method, apparatus and system
CN111399774B (en) Data processing method and device based on snapshot under distributed storage system
US20130262804A1 (en) Data duplication system, data duplication method, and program thereof
CN105260132B (en) A kind of method and apparatus of heat load disk filter driving

Legal Events

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