WO2011120335A1 - 数据操作的方法、装置及计算机 - Google Patents

数据操作的方法、装置及计算机 Download PDF

Info

Publication number
WO2011120335A1
WO2011120335A1 PCT/CN2011/000547 CN2011000547W WO2011120335A1 WO 2011120335 A1 WO2011120335 A1 WO 2011120335A1 CN 2011000547 W CN2011000547 W CN 2011000547W WO 2011120335 A1 WO2011120335 A1 WO 2011120335A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
address
storage block
sector
new
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.)
Ceased
Application number
PCT/CN2011/000547
Other languages
English (en)
French (fr)
Other versions
WO2011120335A8 (zh
Inventor
汤良
郭昌盛
刘春梅
郭轶尊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Beijing Ltd
Beijing Lenovo Software Ltd
Original Assignee
Lenovo Beijing Ltd
Beijing Lenovo Software 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 Lenovo Beijing Ltd, Beijing Lenovo Software Ltd filed Critical Lenovo Beijing Ltd
Priority to US13/581,397 priority Critical patent/US9535796B2/en
Publication of WO2011120335A1 publication Critical patent/WO2011120335A1/zh
Publication of WO2011120335A8 publication Critical patent/WO2011120335A8/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 operations
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/109Address translation for multiple virtual address spaces, e.g. segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 operations
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 operations
    • G06F11/1402Saving, restoring, recovering or retrying
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/84Using snapshots, i.e. a logical point-in-time copy of the data
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks

Definitions

  • the present invention relates to the field of computers, and more particularly to a method, device and computer for data operation. Background technique
  • QCOW QEMU Copy On Write
  • Block storage block
  • L1 corresponds to the first-level hard disk address page table in QCOW
  • L2 corresponds to the secondary hard disk address page table in QCOW.
  • the role of L1 and L2 is to convert a virtual sector number into a physical sector number, where the virtual sector number is UOS.
  • the Virtual hard disk accesses the address of the virtual hard disk, reads and writes the contents of the virtual hard disk through the virtual sector number
  • the physical sector number is the physical hard disk sector address
  • the block offset is the offset sector number of the virtual sector number inside a block
  • the restore point is The status of the hard disk that the user can roll back.
  • QCOW uses the Copy On Write storage method to write the sector. After the restore point is established, if the sector in the existing restore point is modified, the data in the original block to which the sector belongs needs to be copied to the new block. Then write the data to be written into the new block, and record the address of the new block, so that each time you write, you need to copy the contents of the original block to be written to the new block, and then write the contents to be written to the new block. Block, when you need to write sectors frequently, you need to copy, which will greatly affect the performance of the computer, resulting in performance loss.
  • a restore point corresponds to a virtual address index table, including the L1 table and the L2 table, as shown in FIG.
  • the L1 table may be referred to as a primary address index of the restore point
  • the L2 table may be referred to as a secondary address index of the restore point
  • the L1 table and the L2 table may also be combined to form a table to represent the storage of the restore point.
  • the address index of the block When restoring to the restore point, the virtual hard disk address access is converted to an access to the physical hard disk address through the virtual address index table.
  • addressing conversion first look up the corresponding index of the physical address from the LI, L2 table of the latest restore point. If the corresponding address index is not found in the LI and L2 tables of the latest restore point, look for the previous one by recursion. Restore the table of points, always find the corresponding index, or have recursed all the restore points. Summary of the invention
  • the technical problem to be solved by the present invention is to provide a data operation method, device and computer, which can save copy and write operation time and improve computer performance when writing to a sector of a storage device.
  • a method for data operation including: When performing a data write operation on a sector of the storage device, determining whether the sector belongs to the original storage block of the storage device restore point;
  • the table includes: an address of the original storage block, an address of the new storage block, and a first identifier, where the first identifier has a first identifier corresponding to a sector in the original storage block and the new storage block respectively An element, each of the first identification elements having a first state for reading data from the original storage block when data for restoring the corresponding sector is used, and a new storage block for indicating data for restoring the corresponding sector The second state in which the data is read;
  • the method further includes:
  • the method further includes:
  • Adding a second identifier to the address of the original storage block in the address index table of the restore point, where the second identifier has a first state and a second state, where the first state is used to indicate that data is restored The data is directly read according to the address of the original storage block, and the second state is used to indicate that the data is read according to the state of the first identification element of the first identifier in the table when the data is restored.
  • the method further includes:
  • the data is directly read according to the address of the storage block
  • the data is read according to the state of the corresponding first identity element of the first identity in the table.
  • the method further includes:
  • the data of the corresponding sector is restored, the data is directly read from the new storage block according to the address of the new storage block.
  • the table is released.
  • the step of reading data from the original storage block according to the address of the original storage block comprises: adding an address of the original storage block to an offset address of a sector in the original storage block, to obtain Describe the physical address of the sector in the original storage block, and read out the data in the sector according to the physical address of the sector;
  • the step of reading data from the new storage block according to the address of the new storage block includes:
  • the table is represented by a bitmap table or structure data
  • the first identifier is represented by a bitmap.
  • a method for data write operation including:
  • the table includes: an address of the original storage block, an address of the new storage block, and a first identifier, where the first identifier has a first identifier corresponding to a sector in the original storage block and the new storage block respectively An element, each of the first identification elements having a first state for reading data from the original storage block when data for restoring the corresponding sector is used, and a new storage block for indicating data for restoring the corresponding sector The second state in which the data is read;
  • an apparatus for data operation including:
  • a write operation module configured to write a new storage block and write data into the new storage block when writing a sector of a original storage block of the storage device restore point
  • a creating module configured to create a table, where the table includes: an address of the original storage block, an address of the new storage block, and a first identifier, where the first identifier has a sector different from the original storage block and the new storage block Corresponding first identification elements, each of the first identification elements having a first state for reading data from the original storage block when restoring data of the corresponding sector and a data for indicating restoration of the corresponding sector Reading a second state of the data in the new memory block;
  • a read operation module configured to: when recovering data of a sector, if the first identifier corresponds to the sector An identification element is in a first state, reading data from the original storage block according to an address of the original storage block, and if the first identification element is in a second state, according to an address of the new storage block from the Read data in a new memory block.
  • a computer including:
  • a second operating system module configured to perform a read/write operation on the storage device by using the first operating system module and a virtual machine manager;
  • the first operating system module includes:
  • a write operation module configured to: when a write operation is performed on a sector of the original storage block of the storage device restore point, allocate a new storage block, and write data into the new storage block;
  • a creating module configured to create a table, where the table includes: an address of the original storage block, an address of the new storage block, and a first identifier; the first identifier has a difference from a sector in the original storage block and the new storage block Corresponding first identification elements, each of the first identification elements having a first state for reading data from the original storage block when restoring data of the corresponding sector and a data for indicating restoration of the corresponding sector Reading a second state of the data in the new memory block;
  • a read operation module configured to: when recovering data of a sector, if the first identifier element corresponding to the sector in the first identifier is in a first state, according to an address of the original storage block, from the original storage block Reading data, if the first identification element is in the second state, reading data from the new storage block according to the address of the new storage block.
  • the first operating system module further includes:
  • a release module when the first identifier element of the first identifier in the table is all in the second state, directly reading data from the new storage block according to the address of the new storage block, and releasing The form.
  • a table such as a bitmap table
  • the address of the original memory block (original block) is expressed, and the newly allocated memory block is stored.
  • (New Block) address when restoring data, the newly written sector needs to be read from the new block, and the sector of the original memory block is read from the original memory block, so that when writing a new sector, there is no need to copy the original
  • the content of the block sector to the new block can be directly written in the new block and the corresponding state of the first identifier can be recorded. If the block is updated to the newly written sector, it can be directly
  • the index is changed to a new block address, saving write time and improving the performance of the computer. Attached sleep instructions
  • Figure 1 is an address index table of an existing restore point
  • FIG. 2 is a flow chart of a method of data operation according to an embodiment of the present invention.
  • 3 is an address index table of a restore point of the present invention
  • FIG. 4 is a flow chart of a data write operation method of a restore point of a storage device in the method shown in FIG. 2;
  • FIG. 5 is a flow chart of a data read operation method of a restore point of a storage device in the method shown in FIG. 2;
  • DETAILED DESCRIPTION OF THE INVENTION A specific implementation block diagram of a computer. detailed description
  • the embodiment of the present invention is directed to a write operation of a storage device in a manner of copy on write in the prior art.
  • a copy is required, which greatly affects the performance of the computer and causes performance loss. , providing a method, device, and computer for data manipulation.
  • a method for data operation of an embodiment of the present invention includes:
  • Step 21 When writing a sector of the original storage block of the storage device restore point, allocate a new storage block, and write new data into the new storage block;
  • Step 22 Create a table, where the table includes: an address of the original storage block, an address of the new storage block, and a first identifier, where the first identifier has: used to indicate when the data is restored from the original storage a first state in which data is read in the block and a second state in which data is read from the new memory block;
  • Step 23 When data is restored, according to the first state of the first identifier, data is read from the original storage block according to an address of the original storage block, according to the second state of the first identifier, according to the The address of the new memory block reads data from the new memory block.
  • the specific form of the form created in step 22 may be a Bitmap table (ie, a bitmap table, the bitmap table includes: an address of the original storage block, an address of the new storage block, and a bitmap, Wherein the bitmap corresponds to the first identifier, the bitmap has a first state indicating that data is read from the original storage block when the data is restored, and a second state in which data is read from the new storage block)
  • the table may also be a data representation of a structure, wherein member 1 of the structure data represents the address of the original storage block, member 2 represents the address of the new storage block, and member 1 represents the first Identification;
  • member 1 of the structure data represents the address of the original storage block
  • member 2 represents the address of the new storage block
  • member 1 represents the first Identification
  • a table is created to represent the address of the original memory block (the original block), and the newly allocated memory block (new block) Address
  • the first identifier in the table describes which sectors are newly written sectors, which are the sectors of the original storage block, when restoring data, the newly written sector needs to be read from the new block, the sector of the original storage block Read from the original storage block, so that when writing a new sector, the content of the sector of the original block is not copied to the new block, and the state of the first identifier can be directly written and recorded in the new block. That is, if the block is updated to a new write sector, the index can be directly changed to a new block address, saving write time and improving the performance of the computer.
  • the first state of the bitmap (ie, the first identifier) in the bitmap table may be 0, the second state may be 1; or the first state is 1, the second state It may be 0; respectively, indicating which sectors in the memory block are newly written sectors, which are sectors of the original memory block; if the bitmap is 1 when reading data from the new block; when the bitmap is 0, from the original block Read the data.
  • a restore point corresponds to a virtual address index table, where the virtual address index table includes: an L1 table, an L2 table, and a block offset, where the L1 table stores the address of the L2 page table, and the L2 table stores The address of the block is Block, which means that the virtual sector number is offset within the block by a sector number; L1 and L2 can also be combined into a table to represent the virtual address index of the restore point;
  • the new data to be written is also recorded.
  • a new block needs to be allocated, which needs to be written.
  • the new data is written into the sector of the new block, so that when the data is restored, the newly written data can be read from the new block, and the previously written data is read from the original block. Therefore, in the above method, the new data will be read.
  • the new memory block it also includes:
  • Adding a second identifier (the block address column in the L2 table in the figure) to the address of the original storage block in the address index table of the restore point, where the second identifier also has a first state and a second
  • the first state of the second identifier is used to indicate that the data is directly read according to the address of the original storage block when the data is restored
  • the second state of the second identifier is used to indicate that when the data is restored, according to the The status of the first identifier in the table reads data.
  • the second identifier is represented by a binary bit such as Directly, such as the Directly bit being 1 (as in the first state of the second identifier above, of course, the first state may also be replaced by another identifier other than 1), Directly find the physical address of the corresponding sector according to the Block address and Block offset in the Block address column, and read the contents of the sector; if the Directly bit is 0 (such as the second state of the second identifier above, of course The second state can also be replaced by a flag other than 0, indicating that it is necessary to read data from the original block or read data from the new block according to the state of the bitmap of the bitmap table (Bitmap table) below; In the above method, after the new data is written into the new storage block, the method may further include: Writing a write operation to the sector in the new memory block, directly writing new data of the write operation into the new memory block, and placing the first identifier in the table corresponding to the new memory block Second state
  • the data to be written can be directly written into the new block, and when the data is recovered from the block, the sector is directly found according to the new block address and the Block offset.
  • the physical address, and the data in the sector can be read according to the physical address of the sector.
  • the first identifier in the table is all in the second state, it is indicated that all sectors in the storage block of the restore point are subjected to a rewrite operation, and the data is directly restored according to the new storage block.
  • the address reads data from the sector of the new memory block;
  • bitmap bits in the bitmap table are 1, it indicates that all the sectors in the block to be restored are newly written sectors, and when the data is restored, directly according to the address of the new block and Block offset finds the physical address of the sector and reads data from the sector based on the physical address of the sector.
  • step 23 the step of reading data from the original storage block according to the address of the original storage block is specifically:
  • the step of reading data from the new storage block according to the address of the new storage block is specifically:
  • the specific implementation of the foregoing method of the present invention is described below in conjunction with a specific process.
  • the foregoing method may be divided into a write operation process and a read operation flow, where
  • an embodiment of the present invention also protects a data write operation of a sector of a storage device restore point, the method comprising:
  • Step 41 When writing a sector of the original storage block of the storage device restore point, allocate a new storage block, and write new data into the new storage block;
  • Step 42 Create a table, where the table includes: an address of the original storage block, an address of the new storage block, and a first identifier, where the first identifier has read from the original storage block when the data is restored Taking a first state of data and a second state of reading data from the new memory block when restoring data;
  • Step 43 Point the address of the original storage block in the address index table of the restore point to the table.
  • the specific form of the form created in the above step 42 may be a Bitmap table (ie, a bitmap table, the bitmap table includes: an address of the original storage block, an address of the new storage block, and a bitmap, wherein the bitmap Corresponding to the first identifier, the bitmap has a first shape indicating that data is read from the original storage block when data is restored.
  • a second state of reading data from the new memory block which may also be a table of data representations of a structure, wherein member 1 of the structure data represents an address of the original memory block, member 2 Indicated is the address of the new memory block, the first identifier indicated by member 3; of course, the embodiment of the present invention does not exclude the expression of the table in other manners.
  • the write sector operation begins;
  • Bitmap table Bitmap table
  • the Bitmap table includes: the original Block Address, address and bitmap of the new block; where, the address of the new block points to the new block, the address of the original block points to the original block, when the data is restored, the newly written data is read from the new block, and the original data is from the original block.
  • Allocate a new block write new data into the new block, and set the bitmap in the Bitmap table.
  • the new block is set to 1 and the original block is set to 0.
  • When restoring data according to the state of the bitmap in the Bitmap table. Read the data in the corresponding block, the state of the bitmap is 1, read data from the new block, the state of the bitmap is 0, read data from the original block;
  • the newly written sector is not a sector that has previously had a restore point, that is, a sector that has never been written, a new block is allocated, new data is written into the new block, and the block address is changed in the L2 table. New block address.
  • an embodiment of the present invention further protects a data read operation of a sector of a storage device restore point, including:
  • Step 51 Find an address index table of a restore point of the storage device, and obtain an address of the storage block to be restored.
  • the table in this step 52 is the same as the table created in step 42 of Fig. 4 above.
  • Directly bit is 1 (ie, the first state of the second flag), it means that the data can be read directly from the block;
  • the data in the original block is read according to the original block address in the Bitmap table; specifically: according to the original block address and the Block offset (block offset)
  • Block offset block offset
  • the physical address of the sector in the original block is found, and the data in the sector is read according to the physical address of the sector.
  • the state of the block address and the newly written first identifier can be directly written and recorded in the new block. It can save the time of sector write operation and improve the performance of the computer. Then, when waiting for the block to be updated to the new write sector, you can directly change the block address column in the index L2 table to new one. Block address; at the same time, the updated block content can be updated in the background or shutdown, and then the block address index in the L2 table is changed to the new block address.
  • an embodiment of the present invention further provides a computer, including:
  • a storage device such as a hard disk storage device; a virtual machine manager (VMM);
  • VMM virtual machine manager
  • a first operating system module (such as Domain 0) running on the virtual machine manager;
  • the second operating system module (such as the user operating system U0S), the read/write operation of the storage device is implemented by the first operating system module and the virtual machine manager; wherein the first operating system module includes: a write operation module, configured to perform a write operation on a sector of the original storage block of the storage device restore point, allocate a new storage block, and write new data into the new storage block;
  • a creating module configured to create a table, the table includes: an address of the original storage block, an address of the new storage block, and a first identifier; the first identifier has: a first state of reading data in the original memory block and a second state of reading data from the new memory block;
  • a read operation module configured to: when the data is restored, read data from the original storage block according to the first state of the first identifier according to the address of the original storage block, according to the second state of the first identifier Reading data from the new memory block according to the address of the new memory block.
  • the specific form of the form created by the creating module may be a Bitmap table (ie, a bitmap table, the bitmap table includes: an address of the original storage block, an address of the new storage block, and a bitmap, wherein the bitmap is equivalent In the first identifier, the bitmap has a first state of reading data from the original storage block when the data is restored and a second state of reading data from the new storage block, or may be a structure.
  • Embodiments of the invention also do not preclude the representation of the form in other ways.
  • the first operating system module further includes:
  • a release module configured to read data from the new storage block directly according to an address of the new storage block when the first identifier in the bitmap table is all in a second state, and release the table.
  • the foregoing write operation module, the creation module, the read operation module, and the release module may all be in the data recovery engine module of Domain 0; the specific implementation process is as follows:
  • the write sector process includes:
  • UOS performs sector write access
  • QEMU performs virtual sector write operations
  • QCOW data recovery engine finds the block address of the virtual sector in the LI, L2 table; finds the address column of the storage block to which the virtual sector belongs in the L2 table;
  • Bitmap table Bitmap table
  • Newly allocate the block write the new data into the new block, and set the bitmap in the Bitmap table.
  • the new block is set to 1 and the original block is set to 0.
  • the read sector process includes:
  • UOS performs sector read access
  • QEMU performs read command simulation
  • QEMU performs virtual sector reading
  • the QCOW indexes the virtual sector address, that is, searches the LI, L2 table for the address of the block to which the virtual sector belongs;
  • the data in the original block is read according to the original block address in the Bitmap table, and the sector in the original block is found according to the original block address and the block offset (the offset of the sector in the block).
  • the data in the sector is read according to the physical address of the sector;
  • QEMU After the QCOW read operation is completed, QEMU returns the corresponding result to UOS.
  • an embodiment of the present invention further provides an apparatus for data operation of a storage device corresponding to the method shown in FIG. 2, including:
  • a write operation module configured to write a new memory block to the sector of the original memory block of the storage device restore point, and write new data into the new memory block
  • a creating module configured to create a table, where the table includes: an address of the original storage block, an address of the new storage block, and a first identifier, where the first identifier has: used to indicate when the data is restored from the original a first state of reading data in the memory block and a second state of reading data from the new memory block;
  • a read operation module configured to: when the data is restored, read data from the original storage block according to the first state of the first identifier according to the address of the original storage block, according to the second state of the first identifier Reading data from the new memory block according to the address of the new memory block.
  • the table created by the creation module is the same as the table created by the creation module in the above computer, and may be a Bitmap bitmap table.
  • the write operation module may specifically execute the write operation flow shown in FIG. 4; the read operation module may specifically execute the read operation flow shown in FIG. 5, and also directly write new data when writing a new sector.
  • Read and read the data together to restore the hard disk to the state after the sector write operation to the original block. In this process, the original block content is not copied to the new block, saving the write operation time and improving. The performance of the computer.

Landscapes

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

Description

数据操作的方法、 装置及计算机
技术领域
本发明涉及计算机领域, 特别是指一种数据操作的方法、 装置及计算机。 背景技术
在计算机的存储设备的存储领域中, QCOW ( QEMU Copy On Write )是一种支持 能够回退到还原点的方法, 在 QCOW中, 硬盘管理的单位为 Block (存储块), 如图 1所示, L1对应于 QCOW中一级硬盘地址页表, L2对应于 QCOW中二级硬盘地址 页表, 该 L1和 L2的作用是将一个虚拟扇区号转换成物理扇区号, 其中, 虚拟扇区号 是 UOS (用户操作系统)访问虚拟硬盘的地址, 通过虚拟扇区号读写虚拟硬盘内容, 物理扇区号是物理硬盘扇区地址, Block offset是虚拟扇区号在一个 Block内部的偏移 扇区号, 还原点是用户可以回退的硬盘状态。
QCOW采用 Copy On Write存储方式进行扇区的写操作, 在还原点建立后, 如果 是修改已有还原点里面的扇区, 需要将该扇区所属的原 Block里面的数据拷贝到新 Block中, 然后将需要写的数据写入新 Block中, 并记录该新 Block的地址, 这样每写 入一次, 就需要将要写入的原 Block的内容拷贝到新 Block, 再将需要写的内容写入 新 Block, 当需要频繁写扇区时, 都要进行拷贝, 这样会大大影响计算机的性能, 造 成性能损失。
一个还原点对应一个虚拟地址索引表, 包括 L1表和 L2表, 如图 1所示。 该 L1 表可称为该还原点的一级地址索引, L2表可称为该还原点的二级地址索引, L1表和 L2表也可以合起来成为一张表, 来表示该还原点的存储块的地址索引)。 在恢复到还 原点时, 通过虚拟地址索引表, 将虚拟硬盘地址访问转换成一个对物理硬盘地址的访 问。 当寻址转换的时候, 先从一个最新的还原点的 LI , L2表查找物理地址的相应的 索引, 如果最新的还原点的 LI , L2表中没有找到相应的地址索引, 通过递归查找前 一个还原点的表, 一直找到相应的索引, 或者已经递归完所有还原点。 发明内容
本发明要解决的技术问题是提供一种数据操作的方法、 装置及计算机, 能够在对 存储设备的扇区进行写操作时, 不需要拷贝, 节省读写操作时间,提高计算机的性能。
根据本发明实施例, 提供一种数据操作的方法, 包括: 在对存储设备的扇区进行写数据操作时, 判断该扇区是否属于存储设备还原点的 原存储块;
如果是,
分配新存储块, 将数据写入所述新存储块中;
创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地址和第一标识, 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标识元素, 每一个 第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中读取数据的第 一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据的第二状态; 以 及
将所述还原点的地址索引表中的所述原存储块的地址指向所述表格;
如果否,
分配新存储块, 将数据写入所述新存储块中; 以及
将所述还原点的地址索引表中的所述原存储块的地址修改为新存储块的地址。 优选的, 所述方法还包括:
在恢复扇区的数据时, 如果所述第一标识中对应于该扇区的第一标识元素处于第 一状态, 按照所述原存储块的地址从所述原存储块中读取数据, 如果所述第一标识元 素处于第二状态, 按照所述新存储块的地址从所述新存储块中读取数据。
优选的, 当扇区属于存储设备还原点的原存储块时, 将新数据写入所述新存储块 中之后, 所述方法还包括:
针对所述还原点的地址索引表中的所述原存储块的地址, 添加第二标识, 所述第 二标识具有第一状态和第二状态, 所述第一状态用于表示在恢复数据时直接根据原存 储块的地址读取数据, 所述第二状态用于表示在恢复数据时根据所述表格中所述第一 标识的第一标识元素的状态读取数据。
优选的, 所述方法还包括:
恢复数据时, 查找存储设备的还原点的地址索引表, 得到要从中读取数据的存储 块的地址;
若针对所述地址的第二标识处于第一状态, 则直接根据该存储块的地址读取数 据;
若针对所述地址的第二标识处于第二状态, 根据所述表格中第一标识的相应第一 标识元素的状态读取数据。
优选的, 当扇区属于存储设备还原点的原存储块时, 将新数据写入所述新存储块 中之后, 所述方法还包括:
在对所述新存储块中的扇区又进行写数据操作时, 直接将此次写操作的数据写入 所述新存储块中, 同时将所述表格中的对应于该扇区的第一标识元素置于第二状态。
优选的, 若所述第一标识的第一标识元素全为第二状态, 恢复对应扇区的数据时 直接根据所述新存储块的地址从所述新存储块中读取数据。
优选的, 若所述第一标识的第一标识元素全为第二状态, 释放所述表格。
优选的 , 按照所述原存储块的地址从所述原存储块中读取数据的步骤包括: 将所述原存储块的地址加上所述原存储块中扇区的偏移地址, 得到所述原存储块 中扇区的物理地址, 根据所述扇区的物理地址读出所述扇区中的数据;
按照所述新存储块的地址从所述新存储块中读取数据的步骤包括:
将所述新存储块的地址加上所述新存储块中扇区的偏移地址, 得到所述新存储块 中扇区的物理地址, 根据所述扇区的物理地址读出所述扇区中的数据。
优选的, 所述表格由位图表格或结构体数据表示, 所述第一标识由位图表示。 根据本发明实施例, 提供一种数据写操作的方法, 包括:
对存储设备还原点的原存储块的扇区进行写操作时, 分配新存储块, 将数据写入 所述新存储块中;
创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地址和第一标识, 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标识元素, 每一个 第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中读取数据的第 一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据的第二状态; 以 及
将所述还原点的地址索引表中的所述原存储块的地址指向所述表格。
根据本发明实施例, 提供一种数据操作的装置, 包括:
写操作模块, 用于对存储设备还原点的原存储块的扇区进行写操作时, 分配新存 储块, 将数据写入所述新存储块中;
创建模块, 用于创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地 址和第一标识, 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标 识元素, 每一个第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中 读取数据的第一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据 的第二状态; 以及
读操作模块, 用于在恢复扇区的数据时, 如果所述第一标识中对应于该扇区的第 一标识元素处于第一状态, 按照所述原存储块的地址从所述原存储块中读取数据, 如 果所述第一标识元素处于第二状态, 按照所述新存储块的地址从所述新存储块中读取 数据。
根据本发明实施例, 提供一种计算机, 包括:
存储设备;
虚拟机管理器;
第一操作系统模块, 运行在所述虚拟机管理器上;
第二操作系统模块, 通过所述第一操作系统模块和虚拟机管理器实现对所述存储 设备的读 /写操作;
所述第一操作系统模块包括:
写操作模块, 用于对所述存储设备还原点的原存储块的扇区进行写操作时, 分配 新存储块, 将数据写入所述新存储块中;
创建模块, 用于创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地 址和第一标识; 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标 识元素, 每一个第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中 读取数据的第一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据 的第二状态;
读操作模块, 用于在恢复扇区的数据时, 如果所述第一标识中对应于该扇区的第 一标识元素处于第一状态, 按照所述原存储块的地址从所述原存储块中读取数据, 如 果所述第一标识元素处于第二状态, 按照所述新存储块的地址从所述新存储块中读取 数据。
优选地 , 第一操作系统模块还包括:
释放模块, 用于在所述表格中的第一标识的第一标识元素全为第二状态时, 直接 才艮据所述新存储块的地址从所述新存储块中读取数据, 并释放所述表格。
根据本发明实施例, 在对一个已有还原点的原存储块的扇区进行写操作时, 创建 一个表格 (如 bitmap表格), 表述原存储块(原 Block )的地址, 新分配的存储块(新 Block )的地址, 恢复数据时, 新写的扇区需要从新 Block中读取, 原存储块的扇区从 原存储块中读取,这样在写入一个新扇区时,不用拷贝原 Block的扇区的内容到新 Block 中, 可以在新 Block里面直接写入并做相应的记录第一标识的状态即可, 若该 Block 都更新为新写入扇区的时候,就可以直接将索引改为新的 Block地址,节省写入时间, 提高计算机的性能。 附困说明
图 1为现有的还原点的地址索引表;
图 2为本发明的实施例数据操作的方法的流程图;
图 3为本发明的还原点的地址索引表;
图 4为图 2所示方法中, 存储设备的还原点的数据写操作方法流程图; 图 5为图 2所示方法中, 存储设备的还原点的数据读操作方法流程图; 图 6为本发明的实施例计算机的具体实现结构图。 具体实施方式
为使本发明的实施例要解决的技术问题、 技术方案和优点更加清楚, 下面将结合 附图及具体实施例进行详细描述。
本发明的实施例针对现有技术中按照 Copy on write的方式对存储设备进行写入 操作, 当需要频繁写扇区时, 都要进行拷贝, 这样会大大影响计算机的性能, 造成性 能损失的问题, 提供一种数据操作的方法、 装置和计算机。
如图 2所示, 本发明的实施例数据操作的方法, 包括:
步骤 21, 对存储设备还原点的原存储块的扇区进行写操作时, 分配一新存储块, 将新数据写入所述新存储块中;
步骤 22, 创建一表格, 所述表格包括: 原存储块的地址, 所述新存储块的地址, 和一第一标识, 所述第一标识具有: 用于表示恢复数据时从所述原存储块中读取数据 的第一状态和从所述新存储块中读取数据的第二状态;
步骤 23, 恢复数据时, 根据所述第一标识的第一状态, 按照所述原存储块的地址 从所述原存储块中读取数据, 根据所述第一标识的第二状态, 按照所述新存储块的地 址从所述新存储块中读取数据。
其中, 该实施例中 , 步骤 22中创建的表格具体形式可以是一个 Bitmap表格(即 位图表格, 该位图表格包括: 原存储块的地址, 所述新存储块的地址, 和一位图, 其 中该位图相当于上述第一标识, 该位图具有表示恢复数据时从所述原存储块中读取数 据的第一状态和从所述新存储块中读取数据的第二状态), 也可以是一个结构体的数 据表示的该表格, 其中该结构体数据的成员 1表示的是原存储块的地址, 成员 2表示 的是所述新存储块的地址, 成员 3表示的上述第一标识; 当然, 本发明的实施例也不 排除用其它的方式表述该表格。 该实施例的方法, 在对一个已有还原点的原存储块的扇区进行写操作时, 创建一 个表格, 表述原存储块(原 Block )的地址, 新分配的存储块(新 Block )的地址, 表 格中的第一标识描述哪些扇区是新写的扇区, 哪些是原存储块的扇区, 恢复数据时, 新写的扇区需要从新 Block中读取, 原存储块的扇区从原存储块中读取, 这样在写入 一个新扇区时,不用拷贝原 Block的扇区的内容到新 Block中, 可以在新 Block里面直 接写入并做相应的记录第一标识的状态即可,若该 Block都更新为新写入扇区的时候, 就可以直接将索引改为新的 Block地址, 节省写入时间, 提高计算机的性能。
其中, 上述表格为位图表格时, 该位图表格中的位图 (即第一标识)的第一状态 如可以是 0, 第二状态可以是 1; 或者第一状态是 1 , 第二状态可以是 0; 分别表示存 储块中哪些扇区是新写的扇区, 哪些是原存储块的扇区; 如位图是 1时从新 Block中 读取数据; 位图是 0时从原 Block中读取数据。
如图 3所示, 一个还原点对应一个虚拟地址索引表, 该虚拟地址索引表包括: L1 表, L2表及 Block offset, 其中, L1表中存放的是 L2页表的地址, L2表中存放的是 存储块( Block ) 的地址, Block offset是指虚拟扇区号在一个 Block内部偏移扇区号; L1和 L2也可合并为一个表, 表述还原点的虚拟地址索引;
其中, 在对已有还有点的原 Block中的扇区进行写操作时, 除了要保留原 Block 的内容, 还要记录写入的新数据, 此时, 需要分配一个新 Block, 将需要写入的新数 据写入新 Block的扇区中, 这样数据恢复时, 可以从新 Block中读取新写入的数据, 从原 Block中读取以前写入的数据, 因此, 在上述方法中, 将新数据写入所述新存储 块中之后还包括:
在所述还原点的地址索引表中的所述原存储块的地址中添加一第二标识(如图中 L2表中的 Block地址栏), 所述第二标识也具有第一状态和第二状态, 所述第二标识 的第一状态用于表示在恢复数据时直接根据该原存储块的地址读取数据, 所述第二标 识的第二状态用于表示:在恢复数据时,根据所述表格中的第一标识的状态读取数据。
如果该第二标识用 Directly这样一个二进制位表示, 如 Directly位为 1 (如上述第 二标识的第一状态, 当然该第一状态也可以用除 1之外的其它标识代替) 时, 表示可 以直接按照该 Block地址栏中的 Block地址和 Block offset找到对应的扇区的物理地 址, 并读出扇区中的内容; 如果该 Directly位为 0 (如上述第二标识的第二状态, 当 然该第二状态也可以用除 0之外的其它标识代替), 表示需要根据下面的位图表格 ( Bitmap表格 ) 的位图的状态, 从原 Block中读取数据或者从新 Block中读取数据; 在上述方法中, 在将新数据写入所述新存储块中之后还可包括: 对所述新存储块中的扇区又进行写操作, 直接将此次写操作的新数据写入所述新 存储块中, 同时将所述新存储块对应的表格中的第一标识置于第二状态;
如对新 Block中的扇区又进行写操作, 此时, 就可以直接将要写入的数据写入该 新 Block, 从该 Block中恢复数据时, 直接根据该新 Block地址和 Block offset找到扇 区的物理地址, 并根据该扇区的物理地址读取扇区中的数据即可。
在上述方法中, 若所述表格中的第一标识全为第二状态时, 说明该还原点的存储 块中的所有扇区均被执行重新写操作, 恢复数据时直接根据所述新存储块的地址从所 述新存储块的扇区中读取数据;
具体来讲, 若所述位图表格中的位图位全为 1, 说明该要恢复的 Block中全部扇 区是新写入数据的扇区, 恢复数据时, 直接根据该新 Block的地址和 Block offset找到 扇区的物理地址, 并根据该扇区的物理地址从扇区中读取数据。
另外, 上述方法中, 步骤 23 中, 按照所述原存储块的地址从所述原存储块中读 取数据的步骤具体为:
将所述原存储块的地址加上所述原存储块中扇区的偏移地址, 得到所述原存储块 中扇区的物理地址, 根据所述扇区的物理地址读出所述扇区中的数据;
按照所述新存储块的地址从所述新存储块中读取数据的步骤具体为:
将所述新存储块的地址加上所述新存储块中扇区的偏移地址, 得到所述新存储块 中扇区的物理地址, 根据所述扇区的物理地址读出所述扇区中的数据。
下面结合具体流程说明本发明的上述方法的具体实现, 上述方法可以分为写操作 流程和读操作流程, 其中,
如图 4所示, 本发明的实施例还保护一种存储设备还原点的扇区的数据写操作的 方法, 该方法包括:
步骤 41 , 对存储设备还原点的原存储块的扇区进行写操作时, 分配一新存储块, 将新数据写入所述新存储块中;
步骤 42, 创建一表格, 所述表格包括: 原存储块的地址, 所述新存储块的地址, 和一第一标识, 所述第一标识具有表示恢复数据时从所述原存储块中读取数据的第一 状态和恢复数据时从所述新存储块中读取数据的第二状态;
步骤 43, 将所述还原点的地址索引表中的所述原存储块的地址指向所述表格。 其中,上述步骤 42中创建的表格具体形式可以是一个 Bitmap表格(即位图表格, 该位图表格包括: 原存储块的地址, 所述新存储块的地址, 和一位图, 其中该位图相 当于上述第一标识, 该位图具有表示恢复数据时从所述原存储块中读取数据的第一状 态和从所述新存储块中读取数据的第二状态), 也可以是一个结构体的数据表示的该 表格, 其中该结构体数据的成员 1表示的是原存储块的地址, 成员 2表示的是所述新 存储块的地址, 成员 3表示的上述第一标识; 当然, 本发明的实施例也不排除用其它 的方式表述该表格。
下面举例说明上述写操作流程:
写扇区操作开始;
判断该扇区是否是已有还原点的原存储块(Block )的扇区, 即该扇区是否写过数 据;
如果是, 而且不是新还原点第一次写的 BLOCK, 则在内存中新建一位图表格 ( Bitmap表格 ),将 L2表中的 Block地址栏指向该 Bitmap表格;该 Bitmap表格包括: 原 Block的地址, 新 Block的地址和位图; 其中, 新 Block的地址指向新 Block, 原 Block的地址指向原 Block, 数据恢复时, 新写入的数据从新 Block读取, 原有的数据 从原 Block中读取;
分配新 Block,将新数据写入新 Block中,并设置 Bitmap表格中的位图,新 Block 对应设置为 1 , 原 Block对应设置为 0; 恢复数据时, 根据该 Bitmap表格中的位图的 状态读取相应 Block中的数据, 位图的状态为 1, 从新 Block中读数据, 位图的状态 为 0, 从原 Block中读取数据;
写扇区完成后, 判断位图的状态是否全部为 1, 若是, 将 L2表中的 Block地址修 改为新 Block地址, 释放 Bitmap表格;
如果新写入的扇区不是以前已有还原点的扇区, 即从来没有写过的扇区, 则分配 新 Block, 将新数据写入新 Block中, 并在 L2表中将 Block地址改为新 Block地址。
如果写操作的扇区不是新还原点第一次写的 BLOCK, 判断 Block地址数据的第 二标识位(Directly位);
若该 Directly位为 1, 说明可以直接写入该 Block中;
若该 Directly位为 0, 根据 Block地址栏中的 Block地址指向, 找到 Bitmap表格 在内存中的位置和新 Block地址, 将新数据写入新 Block中 , 并设置 Bitmap表格中的 位图。
如图 5所示, 本发明的实施例还保护一种存储设备还原点的扇区的数据读操作的 方法, 包括:
步骤 51, 查找存储设备的还原点的地址索引表, 得到要恢复的存储块的地址; 步骤 52,若所述要恢复的存储块的地址中的第二标识表示该存储块的地址指向一 表格时, 则根据所述表格中第一标识的第一状态, 按照所述表格中原存储块的地址从 所述原存储块中读取数据, 根据所述第一标识的第二状态, 按照所述新存储块的地址 从所述新存储块中读取数据; 进一步的, 如果要恢复的存储块的第二标识表示该存储 块的地址直接指向该存储块的物理扇区, 则直接根据该存储块的地址读取该存储块对 应的物理扇区中的数据。
该步骤 52中的所述表格与上述图 4的步骤 42中所创建的表格相同。
下面举例说明上述读操作流程:
通过虚拟地址高位 LI , L2表, 得到 L2表中 Block地址栏;
判断 Block地址数据的第二标识( Directly位);
若该 Directly位为 1 (即第二标识的第一状态), 说明可以直接从该 Block中读数 据;
若该 Directly位为 0 (即第二标识的第二状态), 根据 Block地址栏中的 Block地 址指向, 找到 Bitmap表格在内存中的位置, 读出 Bitmap表格;
判断该 Bitmap表格中的位图是否为 1 , 若为 1 (即第一标识的第二状态), 则根 据 Bitmap表格中的新 Block地址读取该新 Block中的数据; 具体是: 根据该新 Block 地址和 Block offset ( Block偏移 )找到该新 Block中扇区的物理地址, 根据该扇区的 物理地址读取扇区中的数据;
若位图为 0 (即第一标识的第一状态), 则根据 Bitmap表格中的原 Block地址读 取该原 Block中的数据; 具体是: 根据该原 Block地址和 Block offset ( Block偏移) 找到该原 Block中扇区的物理地址, 根据该扇区的物理地址读取扇区中的数据。
上述方案中, 在写入一个新的扇区的时候,不用 copy原有的 Block内容到一个新 Block,可以在新 Block里面直接写入并记录该 Block地址和新写入的第一标识的状态 就可以, 节省了扇区写操作的时间, 提高了计算机的性能; 然后等待这个 Block都更 新为新的写入扇区的时候,就可以直接将索引 L2表中的 Block地址栏改为新的 Block 地址;同时可以在后台或者关机的时候进行更新的 Block内容,然后将 L2表中的 Block 地址索引改为新 Block地址。
如图 6所示, 本发明的实施例还提供一种计算机, 包括:
存储设备(如可以是硬盘存储设备); 虚拟机管理器(VMM );
第一操作系统模块(如 Domain 0 ), 运行在所述虚拟机管理器上;
第二操作系统模块(如用户操作系统 U0S ), 通过所述第一操作系统模块和虚拟 机管理器实现对所述存储设备的读 /写操作; 其中, 所述第一操作系统模块包括: 写操作模块, 用于对所述存储设备还原点的原存储块的扇区进行写操作时, 分配 一新存储块, 将新数据写入所述新存储块中;
创建模块, 用于为创建一表格, 所述表格包括: 原存储块的地址, 所述新存储块 的地址和一第一标识; 所述第一标识具有: 用于表示恢复数据时从所述原存储块中读 取数据的第一状态和从所述新存储块中读取数据的第二状态;
读操作模块, 用于恢复数据时, 根据所述第一标识的第一状态, 按照所述原存储 块的地址从所述原存储块中读取数据, 根据所述第一标识的第二状态, 按照所述新存 储块的地址从所述新存储块中读取数据。
其中, 该创建模块创建的表格具体形式可以是一个 Bitmap表格(即位图表格, 该位图表格包括: 原存储块的地址, 所述新存储块的地址, 和一位图, 其中该位图相 当于上述第一标识, 该位图具有表示恢复数据时从所述原存储块中读取数据的第一状 态和从所述新存储块中读取数据的第二状态), 也可以是一个结构体的数据表示的该 表格, 其中该结构体数据的成员 1表示的是原存储块的地址, 成员 2表示的是所述新 存储块的地址, 成员 3表示的上述第一标识; 当然, 本发明的实施例也不排除用其它 的方式表述该表格。
另外, 所述第一操作系统模块还包括:
释放模块, 用于在所述位图表格中的第一标识全为第二状态时 , 直接根据所述新 存储块的地址从所述新存储块中读取数据, 并释放所述表格。
具体来讲,上述写操作模块,创建模块 ,读操作模块和释放模块均可以是在 Domain 0的数据恢复引擎模块中; 具体实现流程如下:
写扇区流程包括:
UOS进行扇区写访问;
QEMU进行写命令模拟;
QEMU进行虚拟扇区写操作;
QCOW (数据恢复引擎)在 LI , L2表中查找虚拟扇区所属 Block地址; 在 L2表中找到该虚拟扇区所属的存储块的地址栏;
判断该虚拟扇区是否写过数据;
如果是, 则在内存中新建一位图表格 ( Bitmap表格), 将 L2表中的 Block地址指 向该 Bitmap表格;
新分配 Block,将新数据写入新 Block中,并设置 Bitmap表格中的位图,新 Block 对应设置为 1, 原 Block对应设置为 0; 写扇区完成后, 判断位图是否全部为 1, 若是, 将 L2表中的 Block地址修改为新 Block地址, 释放 Bitmap表格;
如果新写入的扇区不是以前已有还原点的扇区, 即从来没有写过的扇区, 则新建 Block, 将新数据写入新 Block中, 并在 L2表中将 Block地址改为新 Block地址; QCOW写操作完成后, QEMU返回相应的写操作结果给 UOS。
读扇区流程包括:
UOS进行扇区读访问;
QEMU进行读命令模拟;
QEMU进行虚拟扇区读;
QCOW对虚拟扇区地址进行索引, 即在 LI , L2表中查找该虚拟扇区所属 Block 的地址;
在 L2表中找到该虚拟扇区所属的存储块的地址栏;
判断 Block地址栏的第二标识( Directly位);
若该 Directly位为 1, 说明可以直接从该 Block中的扇区读数据;
若该 Directly位为 0, 根据 Block地址栏中的 Block地址指向, 找到 Bitmap表格 在内存中的位置, 读出 Bitmap表格;
判断该 Bitmap表格中的位图是否为 1, 若为 1 , 则根据 Bitmap表格中的新 Block 地址读取该新 Block中的数据, 具体根据该新 Block地址和 Block offset ( Block偏移) 找到该新 Block中扇区的物理地址, 才艮据该扇区的物理地址读取扇区中的数据;
若位图为 0, 则根据 Bitmap表格中的原 Block地址读取该原 Block中的数据, 具 体根据该原 Block地址和 Block offset ( Block中扇区的偏移量)找到该原 Block中扇 区的物理地址, 根据该扇区的物理地址读取扇区中的数据;
QCOW读操作完成后, QEMU返回相应的结果给 UOS。
该实施例中, 在写入一个新的扇区的时候, 直接将新数据写入一个新 Block, 并 在 Bitmap表格中, 记录该新 Block地址和新 Block的位图的状态, 恢复数据 (即读扇 区操作时), 新数据从新 Block中读出, 原数据从原 Block中读出, 读出来的数据合并 在一起可以使硬盘恢复到对该原 Block的扇区写操作后的状态, 在这个过程中, 不用 copy原 Block内容到新 Block, 节省了写操作时间, 提高了计算机的性能;
然后等待这个 Block都更新为新的写入扇区的时候, 可以直接将索引 L2表中的 Block地址栏改为新的 Block地址; 同时可以在后台或者关机的时候进行更新的 Block 内容, 然后将 L2表中的 Block地址索引改为新 Block地址。 另外, 本发明的实施列还提供一种与上述图 2所示方法对应的存储设备的数据操 作的装置, 包括:
写操作模块, 用于对存储设备还原点的原存储块的扇区进行写操作时, 分配一新 存储块, 将新数据写入所述新存储块中;
创建模块, 用于创建一表格, 所述表格包括: 原存储块的地址, 所述新存储块的 地址和一第一标识, 所述第一标识具有: 用于表示恢复数据时从所述原存储块中读取 数据的第一状态和从所述新存储块中读取数据的第二状态;
读操作模块, 用于恢复数据时, 根据所述第一标识的第一状态, 按照所述原存储 块的地址从所述原存储块中读取数据, 根据所述第一标识的第二状态, 按照所述新存 储块的地址从所述新存储块中读取数据。
其中, 该创建模块创建的表格和上述计算机中的创建模块创建的表格相同, 具体 可以是一个 Bitmap位图表格。
其中, 该写操作模块具体可以执行图 4所示的写操作流程; 读操作模块具体可以 执行图 5所示的读操作流程, 同样在写入一个新的扇区的时候, 直接将新数据写入一 个新 Block, 并在 Bitmap表格中, 记录该新 Block地址和新 Block的位图的状态, 恢 复数据(即读扇区操作时), 新数据从新 Block中读出, 原数据从原 Block中读出, 读 出来的数据合并在一起可以使硬盘恢复到对该原 Block的扇区写操作后的状态, 在这 个过程中, 不用 copy原 Block内容到新 Block, 节省了写操作时间, 提高了计算机的 性能。
以上所述是本发明的优选实施方式, 应当指出, 对于本技术领域的普通技术人员 来说, 在不脱离本发明所述原理的前提下, 还可以作出若干改进和润饰, 这些改进和 润饰也应视为本发明的保护范围。

Claims

权 利 要 求
1.一种数据操作的方法, 包括:
在对存储设备的扇区进行写数据操作时, 判断该扇区是否属于存储设备还原点的 原存储块;
如果是,
分配新存储块, 将数据写入所述新存储块中;
创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地址和第一标识, 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标识元素, 每一个 第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中读取数据的第 一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据的第二状态; 以 及
将所述还原点的地址索引表中的所述原存储块的地址指向所述表格;
如果否,
分配新存储块, 将数据写入所述新存储块中; 以及
将所述还原点的地址索引表中的所述原存储块的地址修改为新存储块的地址。
2. 根据权利要求 1所述的方法, 还包括:
在恢复扇区的数据时, 如果所述第一标识中对应于该扇区的第一标识元素处于第 一状态, 按照所述原存储块的地址从所述原存储块中读取数据, 如果所述第一标识元 素处于第二状态 , 按照所述新存储块的地址从所述新存储块中读取数据。
3. 根据权利要求 1 所述的方法, 其中, 当扇区属于存储设备还原点的原存储块 时, 将新数据写入所述新存储块中之后, 所述方法还包括:
针对所述还原点的地址索引表中的所述原存储块的地址, 添加第二标识, 所述第 二标识具有第一状态和第二状态, 所述第一状态用于表示在恢复数据时直接根据原存 储块的地址读取数据, 所述第二状态用于表示在恢复数据时根据所述表格中所述第一 标识的第一标识元素的状态读取数据。
4. 根据权利要求 3所述的方法, 还包括:
恢复数据时, 查找存储设备的还原点的地址索引表, 得到要从中读取数据的存储 块的地址;
若针对所述地址的第二标识处于第一状态, 则直接根据该存储块的地址读取数 据; 若针对所述地址的第二标识处于第二状态, 根据所述表格中第一标识的相应第一 标识元素的状态读取数据。
5. 根据权利要求 1 所述的方法, 其中, 当扇区属于存储设备还原点的原存储块 时, 将新数据写入所述新存储块中之后, 所述方法还包括:
在对所述新存储块中的扇区又进行写数据操作时, 直接将此次写操作的数据写入 所述新存储块中, 同时将所述表格中的对应于该扇区的第一标识元素置于第二状态。
6. 根据权利要求 1 所述的方法, 其中, 若所述第一标识的第一标识元素全为第 二状态, 恢复对应扇区的数据时直接根据所述新存储块的地址从所述新存储块中读取 数据。
7. 根据权利要求 1所述的方法, 其中, 若所述第一标识的第一标识元素全为第二 状态, 释放所述表格。
8. 根据权利要求 2所述的方法, 其中, 按照所述原存储块的地址从所述原存储 块中读取数据的步骤包括:
将所述原存储块的地址加上所述原存储块中扇区的偏移地址, 得到所述原存储块 中扇区的物理地址, 根据所述扇区的物理地址读出所述扇区中的数据;
按照所述新存储块的地址从所述新存储块中读取数据的步骤包括:
将所述新存储块的地址加上所述新存储块中扇区的偏移地址, 得到所述新存储块 中扇区的物理地址, 根据所述扇区的物理地址读出所述扇区中的数据。
9. 根据权利要求 1所述的方法, 其中, 所 格由位图表格或结构体数据表示, 所述第一标识由位图表示。
10. 一种数据写操作的方法, 包括:
对存储设备还原点的原存储块的扇区进行写操作时, 分配新存储块, 将数据写入 所述新存储块中;
创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地址和第一标识, 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标识元素, 每一个 第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中读取数据的第 一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据的第二状态; 以 及
将所述还原点的地址索引表中的所述原存储块的地址指向所述表格。
11. 一种数据操作的装置, 包括:
写操作模块, 用于对存储设备还原点的原存储块的扇区进行写操作时, 分配新存 储块, 将数据写入所述新存储块中;
创建模块, 用于创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地 址和第一标识, 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标 识元素, 每一个第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中 读取数据的第一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据 的第二状态; 以及
读操作模块, 用于在恢复扇区的数据时, 如果所述第一标识中对应于该扇区的第 一标识元素处于第一状态, 按照所述原存储块的地址从所述原存储块中读取数据, 如 果所述第一标识元素处于第二状态 , 按照所述新存储块的地址从所述新存储块中读取 数据。
12. 一种计算机, 包括:
存储设备;
虚拟机管理器;
第一操作系统模块, 运行在所述虚拟机管理器上;
第二操作系统模块, 通过所述第一操作系统模块和虚拟机管理器实现对所述存储 设备的读 /写操作;
所述第一操作系统模块包括:
写操作模块, 用于对所述存储设备还原点的原存储块的扇区进行写操作时, 分配 新存储块, 将数据写入所述新存储块中;
创建模块, 用于创建表格, 所述表格包括: 原存储块的地址, 所述新存储块的地 址和第一标识; 所述第一标识具有与原存储块和新存储块中的扇区分别对应的第一标 识元素, 每一个第一标识元素具有用于表示恢复对应扇区的数据时从所述原存储块中 读取数据的第一状态和用于表示恢复对应扇区的数据时从所述新存储块中读取数据 的第二状态;
读操作模块, 用于在恢复扇区的数据时, 如果所述第一标识中对应于该扇区的第 一标识元素处于第一状态, 按照所述原存储块的地址从所述原存储块中读取数据, 如 果所述第一标识元素处于第二状态, 按照所述新存储块的地址从所述新存储块中读取 数据。
13. 根据权利要求 12所述的计算机, 所述第一操作系统模块还包括: 释放模块, 用于在所述表格中的第一标识的第一标识元素全为第二状态时, 直接 才艮据所述新存储块的地址从所述新存储块中读取数据, 并释放所述表格。
PCT/CN2011/000547 2010-03-30 2011-03-30 数据操作的方法、装置及计算机 Ceased WO2011120335A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US13/581,397 US9535796B2 (en) 2010-03-30 2011-03-30 Method, apparatus and computer for data operation

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010137051.0 2010-03-30
CN2010101370510A CN102207907B (zh) 2010-03-30 2010-03-30 数据操作的方法、装置及计算机

Publications (2)

Publication Number Publication Date
WO2011120335A1 true WO2011120335A1 (zh) 2011-10-06
WO2011120335A8 WO2011120335A8 (zh) 2012-09-27

Family

ID=44696750

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/000547 Ceased WO2011120335A1 (zh) 2010-03-30 2011-03-30 数据操作的方法、装置及计算机

Country Status (3)

Country Link
US (1) US9535796B2 (zh)
CN (1) CN102207907B (zh)
WO (1) WO2011120335A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114840358A (zh) * 2022-04-28 2022-08-02 济南浪潮数据技术有限公司 一种基于虚拟磁盘的数据修复方法、装置及其介质
CN120560592A (zh) * 2025-07-30 2025-08-29 深圳市志奋领科技有限公司 数据存储方法、装置、传感器

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103810246B (zh) * 2013-12-27 2017-10-13 北京天融信软件有限公司 一种索引创建方法和装置以及索引查询方法和装置
CN104731872B (zh) * 2015-03-05 2018-04-03 长沙新弘软件有限公司 基于位图的存储空间管理系统及其方法
CN106294007B (zh) * 2016-08-05 2020-03-24 联想(北京)有限公司 一种数据恢复方法及装置
CN109325026B (zh) * 2018-08-14 2023-09-26 中国平安人寿保险股份有限公司 基于大数据平台的数据处理方法、装置、设备及介质
CN119512470B (zh) * 2025-01-15 2025-04-08 麒麟软件有限公司 一种在逻辑卷管理模块中实现qcow格式的方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1700189A (zh) * 2005-06-01 2005-11-23 瑞程科技股份有限公司 闪存储存系统
US20090083503A1 (en) * 2007-09-20 2009-03-26 Inventec Corporation System of creating logical volume and method thereof
CN101515276A (zh) * 2008-12-29 2009-08-26 北京握奇数据系统有限公司 一种文件数据写操作的方法、文件数据恢复方法及系统

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6061770A (en) * 1997-11-04 2000-05-09 Adaptec, Inc. System and method for real-time data backup using snapshot copying with selective compaction of backup data
US6934822B2 (en) * 2002-08-06 2005-08-23 Emc Corporation Organization of multiple snapshot copies in a data storage system
US7165156B1 (en) * 2002-09-06 2007-01-16 3Pardata, Inc. Read-write snapshots
US7743031B1 (en) * 2002-09-06 2010-06-22 3Par, Inc. Time and space efficient technique for creating virtual volume copies
CN1331063C (zh) * 2003-06-10 2007-08-08 联想(北京)有限公司 基于数据卷快照的在线数据备份方法
US7035881B2 (en) * 2003-09-23 2006-04-25 Emc Corporation Organization of read-write snapshot copies in a data storage system
US7555504B2 (en) * 2003-09-23 2009-06-30 Emc Corporation Maintenance of a file version set including read-only and read-write snapshot copies of a production file
CN100383759C (zh) * 2004-02-25 2008-04-23 昊亚科技股份有限公司 全硬盘多点动态还原方法
JP4439960B2 (ja) * 2004-03-22 2010-03-24 株式会社日立製作所 ストレージ装置
US20060143412A1 (en) * 2004-12-28 2006-06-29 Philippe Armangau Snapshot copy facility maintaining read performance and write performance
US7870356B1 (en) * 2007-02-22 2011-01-11 Emc Corporation Creation of snapshot copies using a sparse file for keeping a record of changed blocks
US8364643B2 (en) * 2007-12-04 2013-01-29 Red Hat Israel, Ltd. Method and system thereof for restoring virtual desktops

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1700189A (zh) * 2005-06-01 2005-11-23 瑞程科技股份有限公司 闪存储存系统
US20090083503A1 (en) * 2007-09-20 2009-03-26 Inventec Corporation System of creating logical volume and method thereof
CN101515276A (zh) * 2008-12-29 2009-08-26 北京握奇数据系统有限公司 一种文件数据写操作的方法、文件数据恢复方法及系统

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114840358A (zh) * 2022-04-28 2022-08-02 济南浪潮数据技术有限公司 一种基于虚拟磁盘的数据修复方法、装置及其介质
CN120560592A (zh) * 2025-07-30 2025-08-29 深圳市志奋领科技有限公司 数据存储方法、装置、传感器

Also Published As

Publication number Publication date
CN102207907B (zh) 2013-12-25
WO2011120335A8 (zh) 2012-09-27
CN102207907A (zh) 2011-10-05
US9535796B2 (en) 2017-01-03
US20120324186A1 (en) 2012-12-20

Similar Documents

Publication Publication Date Title
CN101840362B (zh) 一种改进的写时拷贝快照的实现方法和装置
JP6556911B2 (ja) 注釈付きアトミック書き込み操作を行う方法および装置
CN102594849B (zh) 数据备份、恢复方法、虚拟机快照删除、回滚方法及装置
CN105718217B (zh) 一种精简配置存储池数据一致性维护的方法及装置
TWI417724B (zh) 使用替代頁池管理直接記憶器存取寫入頁錯誤之電腦執行方法、裝置、及電腦程式產品
WO2011120335A1 (zh) 数据操作的方法、装置及计算机
CN103049224B (zh) 将数据导入物理磁带的方法、装置和系统
CN105164657A (zh) 程序数据至非易失性存储器的选择性备份
CN107291883A (zh) 一种分布式存储系统的快照方法及装置
WO2016127658A1 (zh) 一种快照处理方法及装置
CN106055431A (zh) 基于快照在线回滚的数据备份与恢复的方法及装置
WO2017132872A1 (zh) 虚拟机备份方法、备份装置及宿主机
CN103034566A (zh) 虚拟机还原的方法和装置
CN104572242A (zh) 一种扩展虚拟机磁盘空间的方法、装置及虚拟机系统
CN109074308A (zh) 适应性的块转换表(btt)
CN106886370A (zh) 一种基于ssd去重技术的数据安全删除方法及系统
CN102662799B (zh) 数据备份的方法、服务器及热备份系统
CN102841894A (zh) 一种文件分配表的数据存储方法
WO2021169163A1 (zh) 一种文件数据存取方法、装置和计算机可读存储介质
CN106293994A (zh) 网络文件系统中的虚拟机克隆方法和网络文件系统
CN100504800C (zh) 磁盘快照的方法
JP2005182615A (ja) エミュレーションシステムおよびエミュレーション方法
CN103403698A (zh) 分布式计算方法和分布式计算系统
US12536076B2 (en) Leveraging backup process metadata for data recovery optimization
CN103067506B (zh) 一种块设备异步数据迁移方法和系统

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: 11761910

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13581397

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11761910

Country of ref document: EP

Kind code of ref document: A1