WO2017054539A1 - 数据快照方法和存储设备 - Google Patents

数据快照方法和存储设备 Download PDF

Info

Publication number
WO2017054539A1
WO2017054539A1 PCT/CN2016/087913 CN2016087913W WO2017054539A1 WO 2017054539 A1 WO2017054539 A1 WO 2017054539A1 CN 2016087913 W CN2016087913 W CN 2016087913W WO 2017054539 A1 WO2017054539 A1 WO 2017054539A1
Authority
WO
WIPO (PCT)
Prior art keywords
lun
logical address
snapshot
address
source
Prior art date
Application number
PCT/CN2016/087913
Other languages
English (en)
French (fr)
Inventor
黄发
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017054539A1 publication Critical patent/WO2017054539A1/zh

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

Definitions

  • the embodiments of the present invention relate to the field of storage technologies, and in particular, to a data snapshot method and a storage device.
  • Snapshot technology is one of the effective methods to prevent data loss on online storage devices. More and more storage devices are beginning to be used. This feature is supported.
  • the virtual snapshot is a technology for implementing the snapshot function, and the copy-write (English: Copy on write, COW for short) is an implementation method of the virtual snapshot.
  • the specific process is: the source logical unit number (English: Logical Unit)
  • a mapping table is stored on the LUN. The mapping table records the mapping between the logical address and the physical address of each data on the source LUN.
  • the virtual snapshot is activated (that is, the snapshot of the source LUN is activated), the snapshot is taken.
  • a mapping table is also stored on the LUN.
  • the mapping table records the mapping between the logical address and the physical address of each data on the snapshot LUN.
  • the logical address of each data on the snapshot LUN is the same as the logical address of each data on the source LUN. It should be noted that when the virtual snapshot is activated, no data is stored on the snapshot LUN at this time. Therefore, the mapping table on the snapshot LUN is empty; only when new data is written to the source LUN will it be new.
  • the source data in the source LUN corresponding to the logical address of the data is moved to the snapshot LUN, and then the logical address of the source data and the physical in the snapshot LUN are recorded in the snapshot LUN. Mapping relationship site, and writes new data to the source LUN.
  • data is stored in the snapshot LUN only when the source LUN is written. If a logical address of the source LUN is not written with new data, the logical address in the snapshot LUN is not stored. Data, when you need to read the logical address in the snapshot LUN, you need to redirect to the source LUN to read the data, which causes unnecessary information forwarding and reduces data reading efficiency.
  • Embodiments of the present invention provide a data snapshot method and a storage device, which are used to avoid unnecessary letters. Information forwarding, improve data reading efficiency.
  • an embodiment of the present invention provides a data snapshot method, including:
  • the 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 is used to back up data corresponding to the first logical address in the source LUN to the snapshot LUN.
  • the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN.
  • the method further includes:
  • the logical address and the logical LUN in the source LUN stored in the snapshot LUN are obtained. Determining a physical address in the source LUN, where the physical address in the source LUN corresponding to the first logical address is determined, where the read command is used to read the first logic in the snapshot LUN The data corresponding to the address;
  • the method further includes:
  • the snapshot LUN When the snapshot LUN is activated, the corresponding relationship between the logical address in the source LUN and the physical address in the source LUN is backed up to the snapshot LUN.
  • the write command is used to write the data to be written into the source LUN according to the first logical address, and query the snapshot LUN according to the first logical address. Determining, according to the correspondence between the logical address in the source LUN and the physical address in the source LUN, the source LUN corresponding to the first logical address, when the first physical address corresponding to the first logical address is Physical address in ;
  • the establishing the snapshot LUN After the correspondence between the first logical address and the first physical address in the snapshot LUN, the method further includes:
  • the write command is used to write the data to be written into the snapshot LUN according to the first logical address, according to the first logical address in the snapshot LUN and the first Determining, by a physical address, the first physical address is a physical address in the snapshot LUN corresponding to the first logical address;
  • an embodiment of the present invention provides a storage device, including:
  • An acquiring unit configured to acquire a first logical address in the source LUN or a read frequency of the first logical address in the snapshot LUN, where the source LUN and the snapshot LUN have the same logical address, the first logical address Any logical address in the source LUN and the snapshot LUN;
  • a determining unit configured to determine whether 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
  • a processing unit configured to: when the determining unit determines that 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, according to the first a logical address, the physical address corresponding to the first logical address is queried in the snapshot LUN; when the physical address in the snapshot LUN corresponding to the first logical address is not queried, the snapshot LUN is established. Corresponding relationship between the first logical address 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.
  • the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN.
  • the obtaining unit is further configured to acquire a read command.
  • the processing unit is further configured to: before the establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, when the acquiring unit acquires a read command, and according to the When the read command does not query the physical address corresponding to the first logical address in the snapshot LUN, the correspondence between the logical address in the source LUN and the physical address in the source LUN is stored according to the snapshot LUN. a relationship, the physical address in the source LUN corresponding to the first logical address is determined; wherein the read command is used to read data corresponding to the first logical address in the snapshot LUN; The physical address in the source LUN corresponding to the first logical address reads data stored in the source LUN as data to be read by the read command.
  • the processing unit is further configured to: when the snapshot LUN is activated, back up the source LUN The correspondence between the logical address and the physical address in the source LUN is in the snapshot LUN.
  • the acquiring unit is further used Obtain a write command
  • the processing unit is further configured to: after establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, when the acquiring unit acquires a write command, the writing The command is used to write the data to be written into the source LUN according to the first logical address, and query the first logical address corresponding to the first logical address according to the first logical address. Determining, according to the corresponding relationship between the logical address in the source LUN and the physical address in the source LUN, a physical address in the source LUN corresponding to the first logical address; The physical address in the source LUN corresponding to a logical address, and the data to be written is written into the source LUN.
  • the acquiring unit is further used Obtain a write command
  • the processing unit is further configured to: when the correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN is established, when the acquiring unit acquires a write command The write command is used to write the data to be written into the snapshot LUN according to the first logical address, according to the correspondence between the first logical address and the first physical address in the snapshot LUN. a relationship, the first physical address is determined as a physical address in the snapshot LUN corresponding to the first logical address; and the to-be-written data is written into the snapshot LUN according to the first physical address .
  • the embodiment of the present invention provides a data snapshot method and a storage device.
  • the first logical address or the snapshot LUN in the source LUN is obtained by obtaining the first logical address in the source LUN or the read frequency of the first logical address in the snapshot LUN.
  • the first logical address and the snapshot LUN in the snapshot LUN are established.
  • the data corresponding to the first physical address in the source LUN is backed up to the snapshot LUN according to the first physical address; the data is not backed up to the snapshot until the first logical address is written.
  • On the LUN when you need to read the first logical address in the snapshot LUN, you can directly obtain data from the snapshot LUN. You do not need to read the data in the source LUN, which avoids unnecessary signaling forwarding and improves data reading efficiency.
  • Embodiment 1 is a flowchart of Embodiment 1 of a data snapshot method according to the present invention
  • Embodiment 2 is a flowchart of Embodiment 2 of a data snapshot method according to the present invention
  • Embodiment 3 is a flowchart of Embodiment 3 of a data snapshot method according to the present invention.
  • Embodiment 4 is a flowchart of Embodiment 4 of a data snapshot method according to the present invention.
  • FIG. 5 is a schematic structural diagram of Embodiment 1 of a storage device according to the present invention.
  • FIG. 6 is a schematic structural diagram of Embodiment 2 of a storage device according to the present invention.
  • FIG. 1 is a flowchart of Embodiment 1 of a data snapshot method according to the present invention. As shown in FIG. 1 , the method in this embodiment may include:
  • S101 Obtain a first logical address in a source LUN or a read frequency of 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 the Source LUN and any logical address in the snapshot LUN.
  • the snapshot LUN in this embodiment is the snapshot LUN of the source LUN, and the source LUN has the same logical address as the snapshot LUN.
  • the source LUN has logical addresses: 0, 1, 2, 3, 4, 5, 6, 7,
  • the snapshot LUN also has logical addresses: 0, 1, 2, 3, 4, 5, 6, and 7.
  • the read frequency of any logical address in the source LUN or the snapshot LUN can be counted, so that the read frequency and the read frequency indicate the number of reads in the preset time, wherein the logical address is called the first
  • the logical address for example, the first logical address is 3, in this embodiment, the read frequency of the logical address of the source LUN is 3, or the read frequency of the logical address of the snapshot LUN is 3.
  • the read frequency of the first logical address in the source LUN or the first logic in the snapshot LUN is obtained.
  • the frequency of reading the address 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 the read frequency of the first logical address in the snapshot LUN is greater than the preset frequency, If the physical address corresponding to the first logical address is queried in the snapshot LUN, the process ends. If the physical address corresponding to the first logical address is queried in the snapshot LUN, the process ends. If the physical address corresponding to the first logical address is queried, S103 is performed.
  • the mapping relationship of the first logical address is empty in the snapshot LUN, indicating the snapshot LUN.
  • the data corresponding to the first logical address in the active LUN is not stored, so that the backup of the data corresponding to the first logical address in the source LUN may be triggered, that is, the first logical address in the source LUN is backed up.
  • the data is sent to the snapshot LUN, so that the data corresponding to the first logical address is stored in the snapshot LUN.
  • the storage for storing the data corresponding to the first logical address in the source LUN is first allocated in the snapshot LUN.
  • the physical address of the area which is referred to herein as the first physical address, and establishes a correspondence between the first logical address and the first physical address, and backs up the first one of the source LUNs according to the first physical address.
  • the data corresponding to the logical address is in the snapshot LUN (that is, the storage area corresponding to the first physical address in the snapshot LUN); the data is not backed up to the snapshot LUN until the first logical address is written.
  • 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, if the first logical address in the snapshot LUN needs to be read later, according to the first logical address. And the corresponding relationship between the first logical address and the first physical address, the physical address of the first logical address in the snapshot LUN is determined to be the first physical address, and then the storage area corresponding to the first physical address is read. Data, no need to read data in the source LUN, avoiding unnecessary signaling forwarding, improving data reading efficiency.
  • the data snapshot method provided in this embodiment is to obtain the first logical address in the source LUN or the first logical address in the snapshot LUN, and the first logical address in the source LUN or the first logical address in the snapshot LUN.
  • the read frequency is greater than the preset frequency, and the physical address corresponding to the first logical address is not queried in the snapshot LUN according to the first logical address, the first logical address in the snapshot LUN and the first physical in the snapshot LUN are established.
  • the data is not backed up to the snapshot LUN when the first logical address is written, when needed
  • the data can be directly obtained from the snapshot LUN. The data is not read in the source LUN, which avoids unnecessary signaling forwarding and improves data reading efficiency.
  • FIG. 2 is a flowchart of a second embodiment of a data snapshot method according to the present invention. As shown in FIG. 2, the method in this embodiment is based on the method embodiment shown in FIG. 1. Optionally, the embodiment is implemented in FIG. Before S103, it may also include:
  • S202 Read, according to the physical address in the source LUN corresponding to the first logical address, data stored in the source LUN as data to be read by the read command.
  • the snapshot LUN stores the corresponding relationship between the logical address in the source LUN and the physical address in the source LUN.
  • the source LUN stores the logical address in the source LUN.
  • Correspondence between physical addresses in the source LUN for example, logical addresses in the source LUN: 0, 1, 2, 3, 4, 5, 6, and 7.
  • Physical addresses in the source LUN 20, 21, 22
  • the snapshot LUN is associated with the physical address of the source LUN and the physical address of the source LUN.
  • the snapshot LUN needs to be created before the snapshot LUN is activated.
  • the read command 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 query whether the first logical address exists in the snapshot LUN according to the read command. Physical address. If the physical address corresponding to the first logical address is queried in the snapshot LUN, the data is read according to the physical address corresponding to the first logical address, which is similar to the prior art, and details are not described herein again. If the physical address corresponding to the first logical address is not found in the snapshot LUN, that is, the mapping relationship of the first logical address is empty in the snapshot LUN, indicating that the first logical address is not stored in the snapshot LUN.
  • the data is obtained from the source LUN, and the source LUN corresponding to the first logical address is determined according to the correspondence between the logical address in the source LUN and the physical address in the source LUN.
  • the physical address in After the physical address in the source LUN corresponding to the first logical address is determined, the data stored in the source LUN is read as the data to be read by the read command according to the physical address in the source LUN.
  • the relationship between the logical address in the active LUN and the physical address in the source LUN is stored in the snapshot LUN. Therefore, when the data corresponding to the first logical address is not read in the snapshot LUN, the data is directly
  • the mapping between the logical address of the source LUN and the physical address of the source LUN in the snapshot LUN determines the physical address of the source LUN corresponding to the first logical address. You need to redirect to the source LUN to query the mapping between the logical address and the physical address in the source LUN. In particular, if there are multiple snapshot LUNs on the source LUN, a large number of concurrent query requests are avoided. And unnecessary information forwarding.
  • FIG. 3 is a flowchart of a third embodiment of a data snapshot method according to the present invention. As shown in FIG. 3, the method in this embodiment is based on the first or second embodiment of the method of the present invention. After the mapping between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, the method may further include:
  • the write command is used to write data to be written into the source LUN according to the first logical address, and query the snapshot LUN according to the first logical address. Determining, according to the correspondence between the logical address in the source LUN and the physical address in the source LUN, the corresponding to the first logical address, to the first physical address corresponding to the first logical address The physical address in the source LUN.
  • the write command when the write command is obtained, the write command is used to write the data to be written into the source LUN according to the first logical address, and query whether the first logical address exists in the snapshot LUN according to the write command.
  • Physical address The physical address corresponding to the first logical address in the snapshot LUN is the first physical address, indicating that the snapshot LUN has been stored in the snapshot LUN.
  • the data corresponding to a logical address the data corresponding to the first logical address in the source LUN is not backed up to the snapshot LUN, as in the prior art, before the data to be written is written to the source LUN.
  • the source corresponding to the first logical address is determined according to the mapping between the logical address of the source LUN and the physical address of the source LUN, which may be stored in the source LUN or in the snapshot LUN.
  • the physical address in the LUN After the physical address in the source LUN corresponding to the first logical address is determined, the data to be written is written into the source LUN according to the physical address in the source LUN.
  • Embodiment 4 is a flowchart of Embodiment 4 of a data snapshot method according to the present invention. As shown in FIG. 4, the method in this embodiment is based on Embodiment 1 or 2 of the method of the present invention. Optionally, the embodiment is used to establish the method. After the mapping between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, the method may further include:
  • the write command is used to wait according to the first logical address.
  • the write command when the write command is obtained, the write command is used to write the data to be written into the snapshot LUN according to the first logical address, and query whether the first logical address exists in the snapshot LUN according to the write command.
  • Physical address The physical address of the snapshot LUN corresponding to the first logical address is the first physical address, and the first LUN is stored in the snapshot LUN.
  • the data corresponding to a logical address the data corresponding to the first logical address in the source LUN is not backed up to the snapshot LUN, as in the prior art, before the data to be written is written to the source LUN. Then, in this embodiment, the data to be written is written into the snapshot LUN according to the first physical address.
  • FIG. 5 is a schematic structural diagram of Embodiment 1 of a storage device according to the present invention.
  • the storage device in this embodiment may include: an obtaining unit 11, a determining unit 12, and a processing unit 13; wherein the obtaining unit 11 is configured to obtain a first logical address in the source LUN or a read frequency of the first logical address in the snapshot LUN, where the source LUN and the snapshot LUN have the same logical address, and the first logical address is the source LUN and Any one of the logical addresses of the snapshot LUN; the determining unit 12, configured to determine whether a read frequency of the first logical address or the first logical address in the snapshot LUN is greater than a preset frequency; 13.
  • the determining unit 12 determines that 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, according to the first logical address, in the Querying a physical address corresponding to the first logical address in the snapshot LUN; and establishing a first logical address and location in the snapshot LUN when the physical address in the snapshot LUN corresponding to the first logical address is not queried Express Corresponding to the first physical address in the 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.
  • the snapshot LUN stores a correspondence between a logical address in the source LUN and a physical address in the source LUN; the acquiring unit 11 is further configured to acquire a read command, and the processing unit 13 is further configured to: Before the mapping between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN is established, the obtaining unit 11 acquires a read command, and is not in the snapshot LUN according to the read command.
  • the physical address corresponding to the first logical address is queried, according to the Determining, by the snapshot LUN, a correspondence between a logical address in the source LUN and a physical address in the source LUN, determining a physical address in the source LUN corresponding to the first logical address; wherein the reading The command is used to read the data corresponding to the first logical address in the snapshot LUN; and read the data stored in the source LUN according to the physical address in the source LUN corresponding to the first logical address. The data that needs to be read for the read command.
  • the processing unit 13 is further configured to: when the snapshot LUN is created and activated, back up a correspondence between a logical address in the source LUN and a physical address in the source LUN to the snapshot LUN.
  • the obtaining unit 11 is further configured to acquire a write command
  • the processing unit 13 is further configured to: after establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN,
  • the write command is used to write data to be written into the source LUN according to the first logical address, and is in the snapshot LUN according to the first logical address.
  • the first physical address corresponding to the first logical address is queried, the corresponding location of the first logical address is determined according to the correspondence between the logical address in the source LUN and the physical address in the source LUN.
  • the physical address in the source LUN is written; and the data to be written is written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
  • the obtaining unit 11 is further configured to acquire a write command
  • the processing unit 13 is further configured to: after establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN,
  • the write command is used to write the data to be written into the snapshot LUN according to the first logical address, according to the first logical address in the snapshot LUN. Determining, by the first physical address, the physical address in the snapshot LUN corresponding to the first logical address; and writing the to-be-written according to the first physical address Data is written to the snapshot LUN.
  • the storage device of this embodiment may be used to implement the technical solutions of the foregoing method embodiments of the present invention, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
  • FIG. 6 is a schematic structural diagram of Embodiment 2 of a storage device according to the present invention.
  • the storage device of this embodiment may include: a processor 21, a memory 22, and a communication interface 23, wherein a communication connection between the components is performed, for example.
  • the above components may be connected and communicated by a bus, and the communication interface 23 is connected and communicated with an external device; the memory 22 is used to store code for executing 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 acquire a read frequency of a first logical address in the source LUN or a first logical address in the snapshot LUN, where the source LUN and the snapshot LUN have the same logical address, the first logical address a logical address of the source LUN and the snapshot LUN; 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, according to the first logical address, the 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 correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, and backing up the first logical address in the source LUN according to the first physical address Data to the snapshot LUN.
  • 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 configured to acquire a read command
  • the processor 21 is further configured to: before establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, when the communication interface 23 acquires a read command and according to the read command
  • the corresponding relationship between the logical address in the source LUN and the physical address in the source LUN that is stored in the snapshot LUN is determined.
  • the physical address in the source LUN is read, and the data stored in the source LUN is read as data to be read by the read command.
  • the processor 21 is further configured to: when the snapshot LUN is created and activated, back up a correspondence between a logical address in the source LUN and a physical address in the source LUN to the snapshot LUN.
  • the communication interface 23 is further configured to acquire a write command.
  • the processor 21 is further configured to: after establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, when the communication interface 23 acquires a write command, the write command is used by the write command
  • the data to be written is written into the source LUN according to the first logical address, and the first physical medium corresponding to the first logical address is queried in the snapshot LUN according to the first logical address.
  • the physical location in the source LUN corresponding to the first logical address is determined according to the correspondence between the logical address in the source LUN and the physical address in the source LUN.
  • the data to be written is written into the source LUN according to the physical address in the source LUN corresponding to the first logical address.
  • the communication interface 23 is further configured to acquire a write command.
  • the processor 21 is further configured to: after establishing a correspondence between the first logical address in the snapshot LUN and the first physical address in the snapshot LUN, when the communication interface 23 acquires a write command, the write command is used by the write command And the data to be written is written into the snapshot LUN according to the first logical address, and the first is determined according to the correspondence between the first logical address and the first physical address in the snapshot LUN.
  • the physical address is a physical address in the snapshot LUN corresponding to the first logical address; and the data to be written is written into the snapshot LUN according to the first physical address.
  • the storage device of this embodiment may be used to implement the technical solutions of the foregoing method embodiments of the present invention, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the steps of the foregoing method embodiments are performed; and the foregoing storage medium includes: read-only memory (English: Read-Only Memory, ROM for short), random access memory (English: Random Access Memory, Abbreviation: RAM), disk or CD-ROM, etc.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • CD-ROM Compact Disc-ROM

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

一种数据快照方法和存储设备,此方法包括:获取源逻辑单元号LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址(S101);当源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率大于预设频率时,根据第一逻辑地址,在快照LUN中查询第一逻辑地址对应的物理地址(S102);当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系,并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中(S103)。当需要读快照LUN中的第一逻辑地址时,无需再去源LUN中读数据,避免了不必要地信令转发,提高了数据读取效率。

Description

数据快照方法和存储设备 技术领域
本发明实施例涉及存储技术领域,尤其涉及一种数据快照方法和存储设备。
背景技术
随着集中存储应用需求的不断提高,用户需要以在线方式对数据进行保护,以缩短备份窗口,快照技术就是对在线存储设备防范数据丢失的有效方法之一,越来越多的存储设备都开始支持这项功能。其中,虚拟快照是实现快照功能的一种技术,而写时拷贝(英文:Copy on write,简称:COW)是虚拟快照的一种实现方式,具体过程为:源逻辑单元号(英文:Logical Unit Number,简称:LUN)上存储有一张映射表,这张映射表记录了源LUN上各个数据的逻辑地址与物理地址的映射关系,当虚拟快照被激活时(即激活源LUN的快照),快照LUN上也存储一张映射表,这张映射表记录了快照LUN上各个数据的逻辑地址与物理地址的映射关系,其中,快照LUN上各个数据的逻辑地址与源LUN上各个数据的逻辑地址相同,需要说明的是,在虚拟快照被激活时,此时还没有数据存储到快照LUN上,因此,快照LUN上的映射表为空;只有当有新数据写入源LUN时,才会将新数据的逻辑地址所对应地在源LUN中的源数据移动至快照LUN中,然后在快照LUN中记录该源数据的逻辑地址与在快照LUN中的物理地址的映射关系,并将新数据写入至源LUN中。
然而,现有技术中,只有在写源LUN时,才会有数据存储到快照LUN,如果源LUN中的某块逻辑地址没有写入新数据,则快照LUN中的这块逻辑地址不会存储数据,当需要读快照LUN中的这块逻辑地址时,需要重定向至源LUN中去读数据,这样造成不必要地信息转发,降低了数据读取效率。
发明内容
本发明实施例提供一种数据快照方法和存储设备,用于避免不必要地信 息转发,提高数据读取效率。
第一方面,本发明实施例提供一种数据快照方法,包括:
获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址;
当所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址;
当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系,并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
在第一方面的第一种可能的实现方式中,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;
在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之前,还包括:
当获取到读命令且根据所述读命令在所述快照LUN中未查询到所述第一逻辑地址对应的物理地址时,根据所述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据;
根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
结合第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,还包括:
当激活所述快照LUN时,备份所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系至所述快照LUN中。
结合第一方面或第一方面的第一种可能的实现方式或第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之 后,还包括:
当获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;
根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
结合第一方面或第一方面的第一种可能的实现方式或第一方面的第二种可能的实现方式,在第一方面的第四种可能的实现方式中,所述建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,还包括:
当获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址;
根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
第二方面,本发明实施例提供一种存储设备,包括:
获取单元,用于获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址;
确定单元,用于确定所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率是否大于预设频率;
处理单元,用于当所述确定单元确定所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址;当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系;并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
在第二方面的第一种可能的实现方式中,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;
所述获取单元,还用于获取读命令;
所述处理单元,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之前,当所述获取单元获取到读命令,且根据所述读命令在所述快照LUN中未查询到所述第一逻辑地址对应的物理地址时,根据所述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据;以及根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
结合第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述处理单元,还用于当激活所述快照LUN时,备份所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系至所述快照LUN中。
结合第二方面或第二方面的第一种可能的实现方式或第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述获取单元,还用于获取写命令;
所述处理单元,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当所述获取单元获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;以及根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
结合第二方面或第二方面的第一种可能的实现方式或第二方面的第二种可能的实现方式,在第二方面的第四种可能的实现方式中,所述获取单元,还用于获取写命令;
所述处理单元,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当所述获取单元获取到写命令 时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址;以及根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
本发明实施例提供一种数据快照方法和存储设备,通过获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,当源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率大于预设频率时,以及根据所述第一逻辑地址在快照LUN中未查询第一逻辑地址对应的物理地址时,建立快照LUN中的第一逻辑地址与快照LUN中的第一物理地址的对应关系,并根据第一物理地址,备份源LUN中的第一逻辑地址所对应的数据至快照LUN中;无需等到写第一逻辑地址时才将该数据备份至快照LUN中,当需要读快照LUN中的第一逻辑地址时,可从快照LUN中直接获取数据,无需再去源LUN中读数据,避免了不必要地信令转发,提高了数据读取效率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明数据快照方法实施例一的流程图;
图2为本发明数据快照方法实施例二的流程图;
图3为本发明数据快照方法实施例三的流程图;
图4为本发明数据快照方法实施例四的流程图;
图5为本发明存储设备实施例一的结构示意图;
图6为本发明存储设备实施例二的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述, 显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
图1为本发明数据快照方法实施例一的流程图,如图1所示,本实施例的方法可以包括:
S101、获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址。
本实施例中的快照LUN为该源LUN的快照LUN,而且源LUN与该快照LUN具有相同的逻辑地址,例如:源LUN具有逻辑地址:0、1、2、3、4、5、6、7,则快照LUN也具有逻辑地址:0、1、2、3、4、5、6、7。本实施例可以统计源LUN或快照LUN中的任一逻辑地址的读频率,从而可以这一读频率,读频率表示在预设时间内的读次数,其中,该任一逻辑地址称为第一逻辑地址,例如第一逻辑地址为3,则本实施例可以获取源LUN中的逻辑地址为3的读频率,或者,获取快照LUN中的逻辑地址为3的读频率。
S102、当所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址。
本实施例中,在获取到源LUN中的第一逻辑地址或者快照LUN中的第一逻辑地址的读频率后,将源LUN中的第一逻辑地址的读频率或快照LUN中的第一逻辑地址的读频率与预设频率进行对比,当确定源LUN中的第一逻辑地址的读频率大于预设频率时或者当确定快照LUN中的第一逻辑地址的读频率大于预设频率时,可以根据该第一逻辑地址在快照LUN中查询该第一逻辑地址是否存在对应的物理地址,如果在快照LUN中查询到该第一逻辑地址对应的物理地址,则结束流程,如果在快照LUN中未查询到该第一逻辑地址对应的物理地址,则执行S103。
S103、当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系,并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
本实施例中,当在快照LUN中未查询到该第一逻辑地址对应的该快照LUN中的物理地址时,也就是第一逻辑地址的映射关系在该快照LUN中为空,表示该快照LUN中未存储有源LUN中的该第一逻辑地址对应的数据,因此可以触发该源LUN中的该第一逻辑地址对应的数据的备份,即备份该源LUN中的该第一逻辑地址所对应的数据至该快照LUN中,使得快照LUN中存储有该第一逻辑地址对应的数据,具体地,先在快照LUN中分配用于存储该源LUN中的第一逻辑地址所对应的数据的存储区域的物理地址,该物理地址此处称为第一物理地址,并建立该第一逻辑地址与该第一物理地址的对应关系,以及根据该第一物理地址,备份该源LUN中的第一逻辑地址所对应的数据至快照LUN中(即至快照LUN中该第一物理地址对应的存储区域);无需等到写第一逻辑地址时才将该数据备份至快照LUN中。
在本实施例根据第一逻辑地址的读频率将源LUN中的第一逻辑地址所对应的数据备份至快照LUN中之后,如果后续需要读快照LUN中的第一逻辑地址,根据第一逻辑地址以及上述建立的第一逻辑地址与第一物理地址的对应关系,可以确定第一逻辑地址在快照LUN中对应的物理地址为第一物理地址,然后读取第一物理地址对应的存储区域中的数据,无需再去源LUN中读数据,避免了不必要地信令转发,提高了数据读取效率。
本实施例提供的数据快照方法,通过获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,当源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率大于预设频率时,以及根据所述第一逻辑地址在快照LUN中未查询第一逻辑地址对应的物理地址时,建立快照LUN中的第一逻辑地址与快照LUN中的第一物理地址的对应关系,并根据第一物理地址,备份源LUN中的第一逻辑地址所对应的数据至快照LUN中;无需等到写第一逻辑地址时才将该数据备份至快照LUN中,当需要读快照LUN中的第一逻辑地址时,可从快照LUN中直接获取数据,无需再去源LUN中读数据,避免了不必要地信令转发,提高了数据读取效率。
图2为本发明数据快照方法实施例二的流程图,如图2所示,本实施例的方法在图1所示方法实施例的基础上,可选地,本实施例在执行图1所示S103之前,还可以包括:
S201、当获取到读命令且根据所述读命令在所述快照LUN中未查询到所 述第一逻辑地址对应的物理地址时,根据所述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据。
S202、根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
本实施例中,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;可选地,源LUN中存储有该源LUN中的逻辑地址与该源LUN中的物理地址的对应关系,例如:源LUN中的逻辑地址:0、1、2、3、4、5、6、7,与,源LUN中的物理地址:20、21、22、23、24、25、26、27存在一一对应关系,因此可以是在激活该快照LUN时,备份该源LUN中的该源LUN中的逻辑地址与该源LUN中的物理地址的对应关系至该快照LUN中,使得快照LUN中存储有该源源LUN中的逻辑地址与该源LUN中的物理地址的对应关系,需要说明的是,在激活该快照LUN前需要创建该快照LUN。
因此,本实施例在获取到读命令时,该读命令用于读取该快照LUN中的该第一逻辑地址对应的数据,根据该读命令查询该快照LUN中是否存在该第一逻辑地址对应的物理地址。如果在快照LUN中查询到该第一逻辑地址对应的物理地址,则根据该第一逻辑地址对应的物理地址读取数据,其与现有技术类似,此处不再赘述。如果在快照LUN中未查询到该第一逻辑地址对应的物理地址,也就是第一逻辑地址的映射关系在该快照LUN中为空,表示该快照LUN中未存储有该第一逻辑地址对应的数据,则需要从源LUN中获取该数据,然后根据该快照LUN中存储的该源LUN中的逻辑地址与该源LUN中的物理地址的对应关系,确定该第一逻辑地址对应的该源LUN中的物理地址。当确定第一逻辑地址对应的该源LUN中的物理地址后,根据该源LUN中的物理地址,读取该源LUN中存储的数据为该读命令所需读取的数据。
本实施例中,由于快照LUN中存储有源LUN中的逻辑地址与源LUN中的物理地址的对应关系,因此,当在快照LUN中未读取到第一逻辑地址对应的数据时,直接根据快照LUN中存储的源LUN中的逻辑地址与源LUN中的物理地址的对应关系,确定第一逻辑地址对应的源LUN中的物理地址,而无 需如现有技术那样重定向至源LUN中去查询源LUN中存储的逻辑地址与物理地址的对应关系,尤其是在该源LUN存在多个快照LUN的情况下,避免了大量的并发查询请求以及不必要的信息转发。
图3为本发明数据快照方法实施例三的流程图,如图3所示,本实施例的方法在本发明方法实施例一或二的基础上,可选地,本实施例在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,还可以包括:
S301、当获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址。
S302、根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
本实施例在获取到写命令时,该写命令用于根据第一逻辑地址将待写入数据写入该源LUN中,根据该写命令查询该快照LUN中是否存在该第一逻辑地址对应的物理地址。由于快照LUN中已建立第一逻辑地址与第一物理地址的对应关系,因此可以查询到第一逻辑地址对应在快照LUN中的物理地址为第一物理地址,表示该快照LUN中已存储有第一逻辑地址对应的数据,在将待写入数据写入源LUN之前,无需如现有技术那样再将源LUN中的第一逻辑地址对应的数据再备份至快照LUN中。然后本实施例根据源LUN中的逻辑地址与源LUN中的物理地址的对应关系(可以是源LUN中存储的,也可以是快照LUN中存储的),确定该第一逻辑地址对应的该源LUN中的物理地址。当确定第一逻辑地址对应的该源LUN中的物理地址后,根据该源LUN中的物理地址,将该待写入数据写入该源LUN中。
图4为本发明数据快照方法实施例四的流程图,如图4所示,本实施例的方法在本发明方法实施例一或二的基础上,可选地,本实施例在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,还可以包括:
S401、当获取到写命令时,所述写命令用于根据所述第一逻辑地址将待 写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址。
S402、根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
本实施例在获取到写命令时,该写命令用于根据第一逻辑地址将待写入数据写入该快照LUN中,根据该写命令查询该快照LUN中是否存在该第一逻辑地址对应的物理地址。由于快照LUN中已建立第一逻辑地址与第一物理地址的对应关系,因此可以查询到第一逻辑地址对应的快照LUN中的物理地址为第一物理地址,表示该快照LUN中已存储有第一逻辑地址对应的数据,在将待写入数据写入源LUN之前,无需如现有技术那样再将源LUN中的第一逻辑地址对应的数据再备份至快照LUN中。然后本实施例根据该第一物理地址,将该待写入数据写入该快照LUN中。
图5为本发明存储设备实施例一的结构示意图,如图5所示,本实施例的存储设备可以包括:获取单元11、确定单元12、处理单元13;其中,获取单元11,用于获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址;确定单元12,用于确定所述源LUN中的第一逻辑地址或快照LUN中的所述第一逻辑地址的读频率是否大于预设频率;处理单元13,用于当确定单元12确定所述源LUN中的第一逻辑地址或快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址;当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系;并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
可选地,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;获取单元11,还用于获取读命令;处理单元13,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之前,当获取单元11获取到读命令,且根据所述读命令在所述快照LUN中未查询到所述第一逻辑地址对应的物理地址时,根据所 述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据;以及根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
可选地,处理单元13,还用于当创建并激活所述快照LUN时,备份所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系至所述快照LUN中。
可选地,获取单元11,还用于获取写命令;处理单元13,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当获取单元11获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;以及根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
可选地,获取单元11,还用于获取写命令;处理单元13,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当获取单元11获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址;以及根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
本实施例的存储设备,可以用于执行本发明上述各方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
图6为本发明存储设备实施例二的结构示意图,如图6所示,本实施例的存储设备可以包括:处理器21、存储器22和通信接口23,其中,上述组件之间通信连接,例如上述组件之间可以总线进行连接并通信,而且该通信接口23与外部设备连接并通信;存储器22用于存储用于执行数据快照方法的代码。处理器21和通信接口23用于调用所述代码以执行如下操作:
处理器21用于获取源LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址;当所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址;当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系,并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
可选地,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;
通信接口23,用于获取读命令;
处理器21,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之前,当通信接口23获取到读命令且根据所述读命令在所述快照LUN中未查询到所述第一逻辑地址对应的物理地址时,根据所述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据;根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
可选地,处理器21,还用于当创建并激活所述快照LUN时,备份所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系至所述快照LUN中。
可选地,通信接口23,还用于获取写命令;
处理器21,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当通信接口23获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地 址;根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
可选地,通信接口23,还用于获取写命令;
处理器21,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当通信接口23获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址;根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
本实施例的存储设备,可以用于执行本发明上述各方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:只读内存(英文:Read-Only Memory,简称:ROM)、随机存取存储器(英文:Random Access Memory,简称:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (10)

  1. 一种数据快照方法,其特征在于,包括:
    获取源逻辑单元号LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址;
    当所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址;
    当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系,并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
  2. 根据权利要求1所述的方法,其特征在于,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;
    在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之前,还包括:
    当获取到读命令且根据所述读命令在所述快照LUN中未查询到所述第一逻辑地址对应的物理地址时,根据所述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据;
    根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
  3. 根据权利要求2所述的方法,其特征在于,还包括:
    当激活所述快照LUN时,备份所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系至所述快照LUN中。
  4. 根据权利要求1-3任意一项所述的方法,其特征在于,所述建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,还包括:
    当获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数 据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;
    根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
  5. 根据权利要求1-3任意一项所述的方法,其特征在于,所述建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,还包括:
    当获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址;
    根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
  6. 一种存储设备,其特征在于,包括:
    获取单元,用于获取源逻辑单元号LUN中的第一逻辑地址或快照LUN中的第一逻辑地址的读频率,其中,所述源LUN与所述快照LUN具有相同的逻辑地址,所述第一逻辑地址为所述源LUN与所述快照LUN中的任一逻辑地址;
    确定单元,用于确定所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率是否大于预设频率;
    处理单元,用于当所述确定单元确定所述源LUN中的所述第一逻辑地址或所述快照LUN中的所述第一逻辑地址的读频率大于预设频率时,根据所述第一逻辑地址,在所述快照LUN中查询所述第一逻辑地址对应的物理地址;当未查询到所述第一逻辑地址对应的所述快照LUN中的物理地址时,建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系;并根据所述第一物理地址,备份所述源LUN中的所述第一逻辑地址所对应的数据至所述快照LUN中。
  7. 根据权利要求6所述的存储设备,其特征在于,所述快照LUN中存储有所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系;
    所述获取单元,还用于获取读命令;
    所述处理单元,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之前,当所述获取单元获取到读命令,且根据所述读命令在所述快照LUN中未查询到所述第一逻辑地址对应的物理地址时,根据所述快照LUN中存储的所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;其中,所述读命令用于读取所述快照LUN中的所述第一逻辑地址对应的数据;以及根据所述第一逻辑地址对应的所述源LUN中的物理地址,读取所述源LUN中存储的数据为所述读命令所需读取的数据。
  8. 根据权利要求7所述的存储设备,其特征在于,所述处理单元,还用于当激活所述快照LUN时,备份所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系至所述快照LUN中。
  9. 根据权利要求6-8任意一项所述的存储设备,其特征在于,
    所述获取单元,还用于获取写命令;
    所述处理单元,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当所述获取单元获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述源LUN中,且根据所述第一逻辑地址在所述快照LUN中查询到所述第一逻辑地址对应的所述第一物理地址时,根据所述源LUN中的逻辑地址与所述源LUN中的物理地址的对应关系,确定所述第一逻辑地址对应的所述源LUN中的物理地址;以及根据所述第一逻辑地址对应的所述源LUN中的物理地址,将所述待写入数据写入所述源LUN中。
  10. 根据权利要求6-8任意一项所述的存储设备,其特征在于,
    所述获取单元,还用于获取写命令;
    所述处理单元,还用于在建立所述快照LUN中的第一逻辑地址与所述快照LUN中的第一物理地址的对应关系之后,当所述获取单元获取到写命令时,所述写命令用于根据所述第一逻辑地址将待写入数据写入所述快照LUN中,根据所述快照LUN中的所述第一逻辑地址与所述第一物理地址的对应关系,确定所述第一物理地址为所述第一逻辑地址对应的所述快照LUN中的物理地址;以及根据所述第一物理地址,将所述待写入数据写入所述快照LUN中。
PCT/CN2016/087913 2015-09-28 2016-06-30 数据快照方法和存储设备 WO2017054539A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510626065.1 2015-09-28
CN201510626065.1A CN106557385B (zh) 2015-09-28 2015-09-28 数据快照方法和存储设备

Publications (1)

Publication Number Publication Date
WO2017054539A1 true WO2017054539A1 (zh) 2017-04-06

Family

ID=58416464

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/087913 WO2017054539A1 (zh) 2015-09-28 2016-06-30 数据快照方法和存储设备

Country Status (2)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109165120A (zh) * 2018-08-08 2019-01-08 华为技术有限公司 分布式存储系统中管理快照和差异位图生成方法和产品
CN113986128A (zh) * 2021-10-26 2022-01-28 杭州宏杉科技股份有限公司 Lun数据复制方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040083345A1 (en) * 2002-10-24 2004-04-29 Kim Young Ho System and method of an efficient snapshot for shared large storage
US20080222373A1 (en) * 2007-03-09 2008-09-11 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
CN102591790A (zh) * 2011-12-30 2012-07-18 记忆科技(深圳)有限公司 基于固态硬盘的数据存储快照实现方法及固态硬盘
CN102929748A (zh) * 2012-11-08 2013-02-13 华为技术有限公司 数据备份方法及装置
CN104331344A (zh) * 2014-11-11 2015-02-04 浪潮(北京)电子信息产业有限公司 一种数据备份的方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359301A (zh) * 2008-08-19 2009-02-04 成都市华为赛门铁克科技有限公司 一种自动快照的方法及设备
US8959388B1 (en) * 2012-12-28 2015-02-17 Emc Corporation Managing TLU recovery using pre-allocated LUN slices
CN104572478B (zh) * 2013-10-14 2018-07-06 联想(北京)有限公司 数据存取方法和数据存取装置
CN104407935B (zh) * 2014-11-07 2018-05-18 华为数字技术(成都)有限公司 快照回滚方法和存储设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040083345A1 (en) * 2002-10-24 2004-04-29 Kim Young Ho System and method of an efficient snapshot for shared large storage
US20080222373A1 (en) * 2007-03-09 2008-09-11 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
CN102591790A (zh) * 2011-12-30 2012-07-18 记忆科技(深圳)有限公司 基于固态硬盘的数据存储快照实现方法及固态硬盘
CN102929748A (zh) * 2012-11-08 2013-02-13 华为技术有限公司 数据备份方法及装置
CN104331344A (zh) * 2014-11-11 2015-02-04 浪潮(北京)电子信息产业有限公司 一种数据备份的方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109165120A (zh) * 2018-08-08 2019-01-08 华为技术有限公司 分布式存储系统中管理快照和差异位图生成方法和产品
CN109165120B (zh) * 2018-08-08 2022-04-05 华为技术有限公司 分布式存储系统中管理快照和差异位图生成方法和产品
CN113986128A (zh) * 2021-10-26 2022-01-28 杭州宏杉科技股份有限公司 Lun数据复制方法及装置
CN113986128B (zh) * 2021-10-26 2024-05-28 杭州宏杉科技股份有限公司 Lun数据复制方法及装置

Also Published As

Publication number Publication date
CN106557385A (zh) 2017-04-05
CN106557385B (zh) 2020-01-21

Similar Documents

Publication Publication Date Title
US9256384B2 (en) Method and system for reducing write latency in a data storage system by using a command-push model
US10331584B2 (en) Internal system namespace exposed through use of two local processors and controller memory buffer with two reserved areas
US10860494B2 (en) Flushing pages from solid-state storage device
WO2021098267A1 (zh) 一种磁盘处理的方法、系统、设备及可读存储介质
JP5922740B2 (ja) メモリデバイスのための装置、メモリデバイスおよびメモリデバイスの制御のための方法
EP2711841A1 (en) Data processing method, device and system based on block storage
WO2017132872A1 (zh) 虚拟机备份方法、备份装置及宿主机
US9182912B2 (en) Method to allow storage cache acceleration when the slow tier is on independent controller
EP3142014B1 (en) Method, device and user equipment for reading/writing data in nand flash
US10552089B2 (en) Data processing for managing local and distributed storage systems by scheduling information corresponding to data write requests
WO2016101165A1 (zh) 事务处理的方法、装置及计算机系统
WO2018120844A1 (zh) 一种差异数据备份方法和差异数据备份装置
EP2707802B1 (en) Preventing data loss during reboot and logical storage resource management device
WO2018076633A1 (zh) 一种远程数据复制方法、存储设备及存储系统
US20230384979A1 (en) Data processing method, apparatus, and system
WO2016188373A1 (zh) 存储系统中融合san及nas存储架构的方法及装置
WO2017054539A1 (zh) 数据快照方法和存储设备
WO2016091124A1 (zh) 一种文件截断方法和装置
US8713257B2 (en) Method and system for shared high speed cache in SAS switches
US20130346657A1 (en) File system on i/o daughter card
US20210133109A1 (en) Methods and systems for servicing data requests
JP5910596B2 (ja) ストレージ管理システム、ストレージ管理方法、プログラム、および、情報処理システム
US20130031320A1 (en) Control device, control method and storage apparatus
US9703497B2 (en) Storage system and storage control method
US10209906B2 (en) Target port processing of a data transfer

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16850163

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16850163

Country of ref document: EP

Kind code of ref document: A1