CN107203331A - Write the method and device of data - Google Patents

Write the method and device of data Download PDF

Info

Publication number
CN107203331A
CN107203331A CN201610159006.2A CN201610159006A CN107203331A CN 107203331 A CN107203331 A CN 107203331A CN 201610159006 A CN201610159006 A CN 201610159006A CN 107203331 A CN107203331 A CN 107203331A
Authority
CN
China
Prior art keywords
data
address
write
target
snapshot
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610159006.2A
Other languages
Chinese (zh)
Other versions
CN107203331B (en
Inventor
包俊
高洪
韩银俊
郭斌
陈正华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201610159006.2A priority Critical patent/CN107203331B/en
Priority to PCT/CN2017/075058 priority patent/WO2017157158A1/en
Publication of CN107203331A publication Critical patent/CN107203331A/en
Application granted granted Critical
Publication of CN107203331B publication Critical patent/CN107203331B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Abstract

The invention discloses a kind of device for writing data, the device of write data includes:First acquisition module, is redirected in snapshot processes during for writing, and before snapshot generation order is not got, when receiving the write operation order to source book, obtains the size information for the write-in data that the write operation order is included;Write operation module, the memory space matched for the size information according to said write data from preset storage region application with the size information carries out write operation in the memory space applied.The invention also discloses a kind of method for writing data.The present invention, which is realized, to be redirected in snapshot processes when writing without the data for reading former memory block, efficiently writes the purpose of data.

Description

Write the method and device of data
Technical field
The present invention relates to technical field of data storage, more particularly to write the method and device of data.
Background technology
With the development of information technology, digitalization resource is more and more, and the safety of data is weighed all the more with backup Will.The backup to data is realized usually using snapping technique at present, according to storage network industries association The definition of (Storage Networking Industry Association, SNIA), snapshot is on formulating number According to a completely available copy of set, the image of initial runtime is being copied comprising corresponding data.It is existing Snapshot mainstream technology be divided into two kinds, one kind be first time copy-on-write (Copy OnFirst Write, COFW), another technology is redirection (Redirect On Write, ROW) when writing.
Under the scene of distributed storage, the storage of data is for least unit, so with block (Chunk) And when carrying out write operation in the snapping technique redirected at present when writing, generally distribute a chunk size New chunk spaces carry out write operation, when in write operation write data be less than chunk sizes when, first read Old chunk data in source book, are then carried out data merging and write new chunk spaces again, write due to this The method of data needs to carry out first reading data, merging data and writes chunk again, and write operation process is cumbersome, Particularly when write operation is frequent, substantial amounts of reading, union operation reduce the performance for writing data.
The content of the invention
It is a primary object of the present invention to provide a kind of method and device for writing data, it is intended to weight during for writing Orient in snapshot processes, improve the purpose of the performance of write operation.
To achieve the above object, the present invention provides a kind of device for writing data, the device bag of write data Include:
First acquisition module, is redirected in snapshot processes during for writing, and snapshot generation order is not being got Before, when receiving the write operation order to source book, the write-in number that the write operation order is included is obtained According to size information;
Write operation module, for the size information according to said write data from preset storage region application The memory space matched with the size information, write operation is carried out in the memory space applied.
Preferably, the write operation order includes said write data, and said write data will write The first object write address of the source book;
Then the write operation module includes:
Memory space application unit, for the size information according to said write data from the storage region Apply for the first memory space, first storage size be equal to the write the sizes of data with it is described The size of data sum of first object write address;
Memory cell, for storing said write data and the first object in first memory space Write address;
Updating block, for the first of the first object write address and first memory space to be stored Corresponding relation between address is updated in mapping table, and records in the mapping table corresponding relation Renewal time, the mapping table be used for preserve the address in the source book and the storage of the storage region The renewal time of corresponding relation and the corresponding relation between address.
Preferably, the device of write data also includes:
Second acquisition module, is redirected in snapshot processes for writing, and snapshot generation order is not being got Before, when receiving the read operation order to the source book, the target obtained in the read operation order is read Address;
First judge module, if for reading address comprising the target in the mapping table, judging described Target reads whether address corresponding renewal time in the mapping table is read in last time based on the target After address generation snapshot;
Data combiners block, for reading address and target reading ground comprising the target in the mapping table Location corresponding renewal time in the mapping table reads address generation snapshot in last time based on the target When afterwards, the second storage address corresponding with target reading address is searched in the mapping table, is obtained Data described in the storage region in the second storage address, by the data in second storage address The second data are merged into the first data of acquisition, are preserved in the memory space of storage region application second Second data, pair between address and the storage address of second memory space is read by the target It should be related to and be updated in the mapping table, first data are that the target reads address on the source book Data in corresponding memory block;
Read operation module, reads in address or the mapping table for not including the target in the mapping table Address is read comprising the target but target reading address corresponding renewal time in the mapping table does not exist When last time is based on after target reading address generation snapshot, reads the target and read address described Data on source book in corresponding memory block.
Preferably, the device of write data also includes:
Receiving module, if for being redirected when writing in snapshot processes, receiving the snapshot to the source book Generation order, then judge the source book before the snapshot generation order is received according to the mapping table Whether write operation is had;
Second judge module, for being write when the source book exists before the snapshot generation order is received During operation, it is the 3rd target write address to obtain to the address of the write operation of source book, is looked into according to the mapping table The address looked in the storage region corresponding with the 3rd target write address, is obtained in the address Data are the 3rd data, while obtaining the size of the 3rd data;
Snapshot generation module, for according to the 3rd data, the size of the 3rd data and described Three target write address generate snapshot.
Preferably, the snapshot generation module includes:
Judging unit, for judging the sizes of the 3rd data with the 3rd target write address described Whether the size of the 3rd memory block corresponding to source book is equal;
Write operation unit, for the equal in magnitude of the size when the 3rd data and the 3rd memory block When, the 3rd data are written back in the 3rd memory block of the source book;
Snapshot generation unit, the size for the size when the 3rd data and the 3rd memory block is not When equal, the data in the 3rd memory block are obtained, by the 3rd data and the 3rd memory block In data be merged into the 4th data, the 4th data are written back in the 3rd memory block of the source book.
The present invention further provides a kind of method for writing data, the method for write data comprises the following steps:
Redirected when writing in snapshot processes, before snapshot generation order is not got, when receiving to source During the write operation order of volume, the size information for the write-in data that the write operation order is included is obtained;
According to the size information of said write data from preset storage region application and the size information The memory space matched somebody with somebody, write operation is carried out in the memory space applied.
Preferably, said write data are also included in the write operation order, and said write data will be write Enter the first object write address of the source book;
Then the size information according to said write data is from preset storage region application and the size The memory space of information matches, carrying out write operation in the memory space applied includes:
It is described according to the size information of said write data from the memory space of storage region application first The size and the data of the first object write address that first storage size is equal to the write data are big Small sum;
Said write data and the first object write address are stored in first memory space;
Will be corresponding between the first object write address and the first storage address of first memory space Relation is updated in mapping table, and records in the mapping table renewal time of the corresponding relation, institute Stating mapping table is used to preserve corresponding between the address in the source book and the storage address of the storage region The renewal time of relation and the corresponding relation.
Preferably, the method for write data also includes:
Write in redirection snapshot processes, before snapshot generation order is not got, when receiving to described During the read operation order of source book, the target obtained in the read operation order reads address;
If reading address comprising the target in the mapping table, judge that the target is read address and reflected described Whether corresponding renewal time is after last time reads generation snapshot in address based on the target in firing table;
If reading address comprising the target in the mapping table and the target reading address in the mapping table Corresponding renewal time is read in last time based on the target after address generation snapshot, then is reflected described The second storage address corresponding with target reading address is searched in firing table, institute in the storage region is obtained The data in the second storage address are stated, by the data in second storage address and the first data of acquisition The second data are merged into, second data are preserved in the memory space of storage region application second, will The corresponding relation that the target is read between address and the storage address of second memory space is updated to described In mapping table, first data are that the target reads address on the source book in corresponding memory block Data;
If not including the target in the mapping table to read in address or the mapping table comprising target reading Address but target reading address corresponding renewal time in the mapping table are not based on institute in last time State after target reads address generation snapshot, then read the target and read that address is corresponding on the source book to deposit Store up the data in block.
Preferably, the method for write data also includes:
If being redirected when writing in snapshot processes, receive and order is generated to the snapshot of the source book, then root Judge whether the source book has write operation before the snapshot generation order is received according to the mapping table;
When the source book has write operation before the snapshot generation order is received, obtain to source book Write operation address be the 3rd target write address, according to it is described mapping table search write with the 3rd target Address in the corresponding storage region in address, it is the 3rd data to obtain the data in the address, together When obtain the sizes of the 3rd data;
It is fast according to the generation of the 3rd data, the size of the 3rd data and the 3rd target write address According to.
Preferably, it is described according to the 3rd data, the size and the 3rd target of the 3rd data Write address generation snapshot includes:
Judge the sizes of the 3rd data and the 3rd target write address in the corresponding to the source book Whether the size of three memory blocks is equal;
If so, then the 3rd data are written back in the 3rd memory block of the source book;
If it is not, then obtaining the data in the 3rd memory block, the 3rd data are deposited with the described 3rd Data in storage block are merged into the 4th data, and the 4th data are written back to the 3rd storage of the source book In block.
The method and apparatus proposed by the present invention for writing data, redirect in snapshot processes when writing, are not obtaining To before snapshot generation order, when receiving the write operation order to source book, the write operation life is obtained Make the size information of the write-in data included;According to the size information of said write data from preset storage The memory space that region application is matched with the size information, write operation is carried out in the memory space applied. The data space that size information application by writing data according to write operation matches, write-in write operation life Make the write-in data included and to write the address of source book, the data without reading original chunk are realized high Effect writes the purpose of data.
Brief description of the drawings
Fig. 1 writes the high-level schematic functional block diagram of the device first embodiment of data for the present invention;
Fig. 2 is the schematic diagram of the refinement functional module of write operation module 20 in embodiment illustrated in fig. 1 of the present invention;
Fig. 3 writes the high-level schematic functional block diagram of the device 3rd embodiment of data for the present invention;
Fig. 4 writes the high-level schematic functional block diagram of the device fourth embodiment of data for the present invention;
Fig. 5 is the high-level schematic functional block diagram of snapshot generation module 90 in embodiment illustrated in fig. 4 of the present invention;
Fig. 6 writes the schematic flow sheet of the method first embodiment of data for the present invention;
Fig. 7 be in embodiment illustrated in fig. 6 of the present invention step S20 according to the sizes of said write data from preset Storage region application memory space, carry out the refinement flow signal of write operation in the memory space applied Figure;
Fig. 8 writes the schematic flow sheet of the method 3rd embodiment of data for the present invention;
Fig. 9 writes the schematic flow sheet of the method fourth embodiment of data for the present invention;
Figure 10 is step S100 in embodiment illustrated in fig. 9 of the present invention according to the 3rd data, the 3rd number According to size and the 3rd target write address generate snapshot refinement schematic flow sheet.
The realization, functional characteristics and advantage of the object of the invention will be done further referring to the drawings in conjunction with the embodiments Explanation.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, limit is not used to The fixed present invention.
A kind of device for writing data of present invention offer, reference picture 1, in the first embodiment, this writes data Device includes:
First acquisition module 10, is redirected in snapshot processes during for writing, and snapshot generation life is not being got Before order, when receiving the write operation order to source book, the write-in that the write operation order is included is obtained The size information of data;
Write operation module 20, for the size information according to said write data from preset storage region Shen The memory space please matched with the size information, write operation is carried out in the memory space applied.
The device that what the present invention was provided write data is mainly used in distributed storage technology, is using when writing A kind of device for writing data during the snapping technique of redirection.Under usual distributed storage scene, data Storage is that, for least unit, each storage system can be empty by storage as needed with block (Chunk) Between be divided into several chunk of the same size, data are deposited in chunk, for example can will storage it is empty Between be divided into several blocks, wherein the size of each block, which is divided into 4,000,000, to be 112 bytes.
In the present embodiment, redirected when writing in snapshot processes, when having generated old snapshot but do not received also When generating order to new snapshot, or first part of snapshot be not when receiving snapshot generation order, all may Receive the write operation order to source book.When redirecting A, B, C tri- in snapshot processes for example when writing Quarter does snapshot respectively, after the A moment completes snapshot, before the generation of B moment snapshot, that is, receives snapshot Before generation order, write operation order or read operation order may be received, snapshot processes are redirected when writing The write operation of middle generation or read operation, which are specifically, to be write redirection operation or reads to redirect operation.Above-mentioned first Source book refers to the data space that will be backed up in snapshot processes in acquisition module 10, can be as needed Snapshot is done to some pieces.Above-mentioned write operation is directed to source book write-in data, and behaviour is write to source book when receiving When ordering, the size information for the write-in data that write operation order is included is obtained, above-mentioned write-in data are will Write source book data, usual data be to be stored in the form of byte in internal memory, therefore obtain write-in number According to size information the byte numbers of data can be write by obtaining obtain.
According to the size information of write-in data in preset storage after the size information of write-in data is got Memory space is applied in region, rather than according to chunk size information application memory space, then exists again Write operation is carried out in the memory space newly applied.Above-mentioned preset storage region is except source in memory space Other memory spaces beyond volume, specifically can select new space to be deposited as needed.
In the present embodiment, redirected when writing in snapshot processes, before snapshot generation order is not got, When receiving the write operation order to source book, the big of the write-in data that the write operation order is included is obtained Small information;Believed according to the size information of said write data from preset storage region application and the size The memory space of matching is ceased, write operation is carried out in the memory space applied.By being write according to write operation The data space that the size information application of data matches, the write-in data that include of write-in write operation order and The address of source book is write, the data without reading original chunk realize the purpose for efficiently writing data.
Further, the device first embodiment of data is write based on the present invention, the dress of data is write in the present invention In the second embodiment put, write operation order includes said write data, and said write data will be write Enter the first object write address of the source book;
Then reference picture 2, the refinement functional module of the write operation module 20 includes:
Memory space application unit 21, for the size information according to said write data from the memory block The first memory space is applied in domain, and first storage size is equal to the write size and the institute of data State the size of data sum of first object write address;
Memory cell 22, for storing said write data and first mesh in first memory space Mark write address;
Updating block 23, for the first object write address to be deposited with the first of first memory space Corresponding relation between storage address is updated in mapping table, and is recorded in the mapping table correspondence and closed Deposited with the storage region the renewal time of system, the address that the mapping table is used to preserve in the source book Store up the renewal time of the corresponding relation and the corresponding relation between address.
It is to write the number of source book in write operation order that data are write in the present embodiment, in above-mentioned acquiring unit According to above-mentioned first object write address is the write-in data address to be write, and can be that write-in data will be write The chunk on source book entered address or the ground of the chunk on the write-in data source book to be write The offset address of location and data in chunk.Above-mentioned first memory space is the data for storing write-in With to write the address of data on source book, the size of the first memory space is equal to the size of write-in data and the The size of data sum of one target write address is after data are write, by the first object write address of source book and the Corresponding relation between first storage address of one memory space is updated in mapping table, above-mentioned first storage Address is the address of the first memory space, while recording renewal time in the mapping table, it is to be understood that Renewal time can be not limited to record in the mapping table, can also be recorded elsewhere, passage time It can decide when to have carried out write operation.After mapping table updates, it can be found by mapping table preset Storage region storage new write-in data, can also find on the source book corresponding to new write-in data Chunk addresses.
For example, first chunk deposits data abcd in source book, before snapshot generation order is not received Receive in first chunk d positions write-in m order, preset storage region application one is new Memory space storage the data m to be write and to write the ground of first piece of fourth data position of source book The address of location, i.e. d, the size for the memory space now applied is equal to data m size with source book d's Address size sum.Then the address and m address of d in mapping table is updated, enabling reading d When find the data m newly write.
In the present embodiment, it is equal in preset storage region application storage size in write operation and writes The size of data and the size of data sum of write address, the data without reading original chunk, improve and write Efficiency, save memory space.
Further, reference picture 3, the device second embodiment of data is write based on the present invention, is write in the present invention In the device 3rd embodiment of data, the device of write data also includes:
Second acquisition module 30, is redirected in snapshot processes for writing, and snapshot generation order is not being got Before, when receiving the read operation order to the source book, the target in the read operation order is obtained Read address;
First judge module 40, if for reading address comprising the target in the mapping table, judging institute State target and read whether address corresponding renewal time in the mapping table is based on the target in last time After reading address generation snapshot;
Data combiners block 50, for when reading address and the target comprising the target in the mapping table Read address corresponding renewal time in the mapping table and address generation is read based on the target in last time When after snapshot, the second storage address corresponding with target reading address is searched in the mapping table, The data in the second storage address described in the storage region are obtained, by second storage address Data are merged into the second data with the first data obtained, in the memory space of storage region application second Second data are preserved, the target is read between address and the storage address of second memory space Corresponding relation be updated in the mapping table, first data be the target read address in the source Data on volume in corresponding memory block;
Read operation module 60, for reading address or the mapping when not including the target in the mapping table Address is read comprising the target but the target reads address corresponding renewal time in the mapping table in table Not when last time is read based on the target after address generation snapshot, the reading target is read address and existed Data on the source book in corresponding memory block.
In the present embodiment, redirected when writing in snapshot processes, when having generated old snapshot but do not received also When generating order to new snapshot, or first part of snapshot be not when receiving snapshot generation order, all may Receive the read operation order to source book, read operation order can read source book may also only read wherein certain Several chunk.Meanwhile, write operation order may be received before read operation order is received, it is also possible to Write operation order was not received, i.e., write operation may be carried out before read operation order is received, Write operation may not be carried out.
It is to get the data to be read in read operation order that target, which reads address, in above-mentioned second acquisition module 30 Address.When receiving read operation order, the target first obtained in read operation order reads address, according to reading The address search mapping table of operational order, sees in mapping table the record for whether having the target to read address, when depositing When, show the target read address as target write address carried out write operation record, further according to target read Address record renewal time judge target reading address in the mapping table corresponding renewal time whether last Once it is based on after target reading address generation snapshot, it is therefore an objective to judge whether the time of write operation reads in target Address shines this in last generation and received between read operation soon.When target to be read reads address in mapping table In do not record, show that the target to be read reads address and do not carried out write operation, then target is read on address Data, which have no, to change, and can now directly read target and read address on source book in corresponding memory block Data.When the block or source book to be read carried out write operation, but the renewal that address is recorded is read according to target Time judges to obtain the renewal time of write operation before the last time generation snapshot, then illustrates at last Secondary generation snapshot did not carry out write operation between read operation is received to this, the block or source book now to be read On data last time generation snapshot after and it is unchanged, can now directly read target read address Data on source book in corresponding memory block.When the record and mesh that include target reading address in the mapping table Mark read address in the mapping table corresponding renewal time last time based on target read address generation snapshot it Afterwards, illustrate that target reading address carried out write operation after generation snapshot, that is, showed secondary at last The data that target is read to be stored in the corresponding memory block in address after into snapshot have renewal, and write behaviour due to working as When making, the data for being actually subjected to write-in are only written with, therefore works as and reading behaviour is carried out to whole block or source book , it is necessary to which source book is combined into reading with the data write in space when making.
Judge to obtain target when carrying out read operation to read address to shine this soon in last generation and receive reading Carried out between operation in the case of write operation, and showed that target was read address and once write as target write address Operation.Second storage address is when the second target write address performs write operation, in preset storage The address of data is write in the space storage that region is newly applied, the second storage address reads the corresponding pass of address with target System can be obtained by mapping table.Above-mentioned first data are that target reads that address is corresponding on the source book deposits Store up the data in block.After the data in the first data and the second storage address are obtained, by the second storage Address merges with the first data, is specifically the phase for the data in the second storage address being merged into the first data Position is answered, the data after merging are the second data.Above-mentioned second memory space is in the default new Shen in memory block The memory space for being used to preserve the second data please, now the second data are by newest after write operation The address of the second data source book corresponding with the second data can be preserved in data, the second memory space.Read number According to when read the second data now in the second memory space.When newly, the second memory space of application preserves second After data, the corresponding relation between the address of the second target write address and the second memory space is updated to and reflected In firing table, and discharge former space, that is, discharge being used for of applying during original write-in data store write-in data and The space of storage address.
For example, being redirected when writing in snapshot processes, sequentially in tri- moment generations of A, B, C Snapshot, after the snapshot generation at A moment, if getting the read operation order to source book, now obtains and reads Reading address in operational order.When it is three chunk to read address, according to the 3rd chunk in lookup mapping table Record judge whether this position had during read operation order and last time generation snapshot is received and write behaviour Make, when the record without the 3rd chunk or the renewal time of the 3rd chunk record be not or not the A moment Afterwards, the data in the 3rd chunk are directly read.If the data deposited in the 3rd chunk are abcde, From mapping table get the 3rd chunk record and renewal time after the A moment, show after the A moment Write operation was carried out, then finds ground in storage region corresponding with the 3rd chunk by searching mapping table Location, the data that the address search in storage region corresponding with the 3rd chunk is deposited to storage region For m, location revision is the 5th offset address in the 3rd chunk, i.e., e in abcde is revised as into m, Now m is merged with abcde, is specifically to write m to generate new data abcdm at the 3rd chunk e, The 3rd chunk of abcdm and correspondence address is preserved in the preset new space of storage region application, renewal is reflected The 3rd chunk preserves the address in abcdm new space in the address of source book and storage region in firing table, And discharge storage e space.When reading data, newest data abcdm is read.
In the present embodiment, by judging to receive read command and being newly generated between snapshot whether write behaviour Make to carry out the reading of data, it is newest real time data to make the data read.
Further, reference picture 4, device above-described embodiment of data is write based on the present invention, is write in the present invention In the fourth embodiment of the device of data, the device of write data also includes:
Receiving module 70, if for being redirected when writing in snapshot processes, receiving to the fast of the source book According to generation order, then judge that the source book is receiving the snapshot generation order according to the mapping table It is preceding whether to have write operation;
Second judge module 80, for existing when the source book before the snapshot generation order is received During write operation, it is the 3rd target write address to obtain to the address of the write operation of source book, according to the mapping table The address in the storage region corresponding with the 3rd target write address is searched, is obtained in the address Data be the 3rd data, while obtaining the size of the 3rd data;
Snapshot generation module 90, for according to the 3rd data, the size of the 3rd data and described 3rd target write address generates snapshot.
In the present embodiment, redirected when writing in snapshot processes, life is generated when receiving the snapshot to source book Can be now that snapshot is carried out to source book for the first time or feelings are produced in the snapshot having had been friends in the past when making The new snapshot generation order received under condition.When before snapshot generation order is received, source book may be carried out Write data operation or read data operation, when had write redirection when, show the data in source book There is the modification for writing data, in order to generate newest data snapshot, first judge the source book receiving Whether there is write operation before stating snapshot generation order.When no progress write operation, the content of source book this moment It is exactly newest data.
Data are write when the 3rd target write address is the write operation on source book in above-mentioned second judge module Address.3rd target write address and the corresponding address in storage region can be inquired about by mapping table, obtained It is the 3rd data to take the data in the corresponding address in storage region, and reading behaviour is not carried out when having carried out write operation When making, what is deposited in the corresponding address is the write-in data deposited when writing data in storage region, works as progress When write operation has carried out read operation again, deposited in the corresponding address be when reading data by original write data with The latest data that former chunk merges.Data merging specifically how is carried out in the device second for writing data to implement Elaborated, repeated no more here in example.
Judge whether the source book has the method for write operation can be with before snapshot generation order is received Obtained by searching mapping table.The size of above-mentioned 3rd data can by obtain the 3rd data byte number Mode obtain, then according to the write address of the 3rd data, the size of the 3rd data and the 3rd data generate Snapshot.
Preferably, in reference picture 5, the present embodiment, above-mentioned snapshot generation module 90 includes:
Judging unit 91, for judging the size and the 3rd target write address of the 3rd data in institute Whether the size for stating the 3rd memory block corresponding to source book is equal;
Write operation unit 92, the size phase for size and the 3rd memory block when the 3rd data Deng when, the 3rd data are written back in the 3rd memory block of the source book;
Snapshot generation unit 93, for the size when the 3rd data and the size of the 3rd memory block When unequal, the data in the 3rd memory block are obtained, by the 3rd data and the described 3rd storage Data in block are merged into the 4th data, and the 4th data are written back to the 3rd memory block of the source book In.
In the present embodiment, above-mentioned 3rd memory block refers to the 3rd target write address in the block corresponding to source book, Block as when performing write operation corresponding to write operation, for example, receive write operation by the chunk of source book the 2nd In aaaa when being write as aaac, the 3rd target write address is exactly the 2nd chunk address, the data write It is exactly c, the 3rd memory block corresponding to the 3rd target write address is exactly the 2nd chunk.Judge the 3rd data Size it is whether equal with the size of the 3rd memory block, when equal, show to write data by write operation Former chunk data are all rewritten, or read operation was produced after write operation, redirection is now write Memory space in data of writing be latest data, the 3rd data are written back to the 3rd memory block of source book In, that is, it is written back at the chunk for producing write operation.
When the size of the 3rd data and the unequal size of the 3rd memory block, show now to perform and write behaviour Make, but only rewritten the partial data in chunk and do not carried out read operation, needed during generation snapshot Obtain this moment newest data.The data in the 3rd memory block when now obtaining write operation, at this moment the 3rd Data in memory block are the data before write operation, and the data in the 3rd data and the 3rd memory block are closed And the 4th data are generated, now the 4th data are the latest data corresponding to the 3rd memory block of source book, will 4th data are write back in the 3rd memory block of source book.
For example, before snapshot generation order is received, the data that the 3rd chunk is deposited on source book are abcde Performed write operation and e is revised as m, and do not receive read operation order, ordered when receiving snapshot generation When, obtaining source book by searching mapping table had write operation.In the memory space for now obtaining write operation Data, that is, obtain m, and m size is compared with chunk size, and the size for being readily obtained m is less than Chunk size, then obtain the data of the 3rd chunk on source book, by the abcde in m and the 3rd chunk Merge generation new data.The m correspondence positions for writing the 3rd chunk are specifically saved as into new data Abcdm, now abcdm is the chunk of source book the 3rd latest data, and abcdm is write the on source book At three chunk, now the data in the 3rd chunk are the content of the snapshot generated.
In the present embodiment, by judging whether there is write operation before receiving snapshot generation order, and obtain The data of write operation, the generation of snapshot is carried out according to the size of the data of write operation, it is ensured that snapshot is generated When data be newest real time data, while selectively being write by the size of the data to write operation Enter data, improve the efficiency of snapshot generation.
Reference picture 6, it is proposed that the present invention is write in the first embodiment of the method for data, the embodiment, writes number According to method include step:
Step S10, is redirected in snapshot processes when writing, before snapshot generation order is not got, when connecing When receiving the write operation order to source book, the size letter for the write-in data that the write operation order is included is obtained Breath;
Step S20, according to the size information of said write data from preset storage region application with it is described big The memory space of small information matches, write operation is carried out in the memory space applied.
The method that what the present invention was provided write data is mainly used in distributed storage technology, is using when writing A kind of method for writing data during the snapping technique of redirection.Under usual distributed storage scene, data Storage is that, for least unit, each storage system can be empty by storage as needed with block (Chunk) Between be divided into several chunk of the same size, data are deposited in chunk, for example can will storage it is empty Between be divided into several blocks, wherein the size of each block, which is divided into 4,000,000, to be 112 bytes.
In the present embodiment, redirected when writing in snapshot processes, when having generated old snapshot but do not received also When generating order to new snapshot, or first part of snapshot be not when receiving snapshot generation order, all may Receive the write operation order to source book.When redirecting A, B, C tri- in snapshot processes for example when writing Quarter does snapshot respectively, after the A moment completes snapshot, before the generation of B moment snapshot, that is, receives snapshot Before generation order, write operation order or read operation order may be received, snapshot processes are redirected when writing The write operation of middle generation or read operation, which are specifically, to be write redirection operation or reads to redirect operation.Above-mentioned source book Refer to the data space that will be backed up in snapshot processes, snapshot can be done to some pieces as needed. Above-mentioned write operation is directed to source book write-in data, and when receiving the write operation order to source book, acquisition is write The size information for the write-in data that operational order is included, above-mentioned write-in data are the data of source book to be write, Usual data be to be stored in the form of byte in internal memory, therefore obtain the size information of write-in data can be with Obtained by obtaining the byte number of write-in data.
According to the size information of write-in data in preset storage after the size information of write-in data is got Memory space is applied in region, rather than according to chunk size information application memory space, then exists again Write operation is carried out in the memory space newly applied.Above-mentioned preset storage region is except source in memory space Other memory spaces beyond volume, specifically can select new space to be deposited as needed.
In the present embodiment, redirected when writing in snapshot processes, before snapshot generation order is not got, When receiving the write operation order to source book, the big of the write-in data that the write operation order is included is obtained Small information;Believed according to the size information of said write data from preset storage region application and the size The memory space of matching is ceased, write operation is carried out in the memory space applied.By being write according to write operation The data space that the size information application of data matches, the write-in data that include of write-in write operation order and The address of source book is write, the data without reading original chunk realize the purpose for efficiently writing data.
Further, the method first embodiment of data is write based on the present invention, the side of data is write in the present invention In the second embodiment of method, said write data, and said write number are also included in above-mentioned write operation order According to writing the first object write address of the source book,
Then reference picture 7, above-mentioned steps S20 refinement step includes:
Step S21, sky is stored according to the size information of said write data from the storage region application first Between, first storage size is equal to the write the size and the first object write address of data Size of data sum;
Step S22, stores said write data in first memory space and the first object writes ground Location;
Step S23, by the first storage address of the first object write address and first memory space it Between corresponding relation be updated in mapping table, and record in the mapping table renewal of the corresponding relation Time, the mapping table be used to preserving address in the source book and the storage region storage address it Between corresponding relation and the corresponding relation renewal time.
In the present embodiment, above-mentioned write-in data are to write the data of source book, above-mentioned in write operation order One target write address is the write-in data address to be write, and can write on the source book that data will write Chunk address or write-in the data source book to be write on chunk address and data exist Offset address in chunk.Above-mentioned first memory space is write in the data and source book of write-in for storing Enter the address of data, the size of the first memory space is equal to the size and first object write address of write-in data Size of data sum.After data are write, by the first object write address and the first memory space of source book The first storage address between corresponding relation be updated in mapping table, above-mentioned first storage address is first The address of memory space, while recording renewal time in the mapping table, it is to be understood that renewal time It can be not limited to record in the mapping table, can also be recorded elsewhere, passage time can determine When write operation has been carried out.After mapping table updates, it can be found by mapping table in preset memory block The new write-in data of domain storage, can also find the chunk addresses on the source book corresponding to new write-in data.
For example, first chunk deposits data abcd in source book, before snapshot generation order is not received Receive in first chunk d positions write-in m order, preset storage region application one is new Memory space storage the data m to be write and to write the ground of first piece of fourth data position of source book The address of location, i.e. d, the size for the memory space now applied is equal to data m size with source book d's Address size sum.Then the address and m address of d in mapping table is updated, enabling reading d When find the data m newly write.
In the present embodiment, it is equal in preset storage region application storage size in write operation and writes The size of data and the size of data sum of write address, the data without reading original chunk, improve and write Efficiency, save memory space.
Further, reference picture 8, the method second embodiment of data is write based on the present invention, is write in the present invention In the 3rd embodiment of the method for data, the method for write data also includes step:
Step S30, writes in redirection snapshot processes, before snapshot generation order is not got, works as reception During to the read operation order of the source book, the target obtained in the read operation order reads address;
Step S40, judges whether read address comprising the target in the mapping table;If so, then performing step Rapid S70;Otherwise step S50 is performed;
Step S50, judge the target read address in the mapping table corresponding renewal time whether most Once it is based on afterwards after target reading address generation snapshot;If so, then performing step S60;Otherwise, hold Row step S70;
Step S60, searches the second storage address corresponding with target reading address in the mapping table, The data in the second storage address described in the storage region are obtained, by second storage address Data are merged into the second data with the first data obtained, in the memory space of storage region application second Second data are preserved, the target is read between address and the storage address of second memory space Corresponding relation be updated in the mapping table, first data be the target read address in the source Data on volume in corresponding memory block;
Step S70, reads the target and reads data of the address on the source book in corresponding memory block.
In the present embodiment, redirected when writing in snapshot processes, when having generated old snapshot but do not received also When generating order to new snapshot, or first part of snapshot be not when receiving snapshot generation order, all may Receive the read operation order to source book, read operation order can read source book may also only read wherein certain Several chunk.Meanwhile, write operation order may be received before read operation order is received, it is also possible to Write operation order was not received, i.e., write operation may be carried out before read operation order is received, Write operation may not be carried out.
It is the address for getting the data to be read in read operation order that above-mentioned target, which reads address,.When receiving reading During operational order, the target first obtained in read operation order reads address, is looked into according to the address of read operation order Mapping table is looked for, the record for whether having the target to read address is seen in mapping table, when it is present, shows the target Address is read as target write address and carried out write operation record, when reading the renewal of address record further according to target Between judge target read address in the mapping table corresponding renewal time whether last time based on target read ground After location generation snapshot, it is therefore an objective to judge whether the time of write operation reads address in target and generated at last This is shone soon to receive between read operation.Address is read when target to be read not record in the mapping table, is shown The target to be read reads address and did not carry out write operation, then the data that target is read on address, which have no, to change, Target can now be directly read and read data of the address on source book in corresponding memory block.When the block to be read Or source book carried out write operation, but the renewal time for reading address record according to target judges to obtain write operation Renewal time the last time generation snapshot before, then illustrate last time generation shine soon this receipts To write operation was not carried out between read operation, the data on the block or source book now to be read are in last time It is after generation snapshot and unchanged, it can now directly read target and read address corresponding storage on source book Data in block.When the record and target of reading address comprising target in the mapping table read address in the mapping table Corresponding renewal time is read in last time based on target after address generation snapshot, is illustrated in generation snapshot The target reads address and carried out write operation afterwards, that is, shows that target reads ground after last time generation snapshot The data stored in the corresponding memory block in location have a renewal, and due to when write operation, being only written with reality The border data to be write, thus when to carry out read operation to whole block or source book, it is necessary to by source book with Write the data in space and combine reading.
Judge to obtain target when carrying out read operation to read address to shine this soon in last generation and receive reading Carried out between operation in the case of write operation, and showed that target was read address and once write as target write address Operation.Second storage address is when the second target write address performs write operation, in preset storage The address of data is write in the space storage that region is newly applied, the second storage address reads the corresponding pass of address with target System can be obtained by mapping table.Above-mentioned first data are that target reads that address is corresponding on the source book deposits Store up the data in block.After the data in the first data and the second storage address are obtained, by the second storage Address merges with the first data, is specifically the phase for the data in the second storage address being merged into the first data Position is answered, the data after merging are the second data.Above-mentioned second memory space is in the default new Shen in memory block The memory space for being used to preserve the second data please, now the second data are by newest after write operation The address of the second data source book corresponding with the second data can be preserved in data, the second memory space.Read number According to when read the second data now in the second memory space.When newly, the second memory space of application preserves second After data, the corresponding relation between the address of the second target write address and the second memory space is updated to and reflected In firing table, and discharge former space, that is, discharge being used for of applying during original write-in data store write-in data and The space of storage address.
For example, being redirected when writing in snapshot processes, sequentially in tri- moment generations of A, B, C Snapshot, after the snapshot generation at A moment, if getting the read operation order to source book, now obtains and reads Reading address in operational order.When it is three chunk to read address, according to the 3rd chunk in lookup mapping table Record judge whether this position had during read operation order and last time generation snapshot is received and write behaviour Make, when the record without the 3rd chunk or the renewal time of the 3rd chunk record be not or not the A moment Afterwards, the data in the 3rd chunk are directly read.If the data deposited in the 3rd chunk are abcde, From mapping table get the 3rd chunk record and renewal time after the A moment, show after the A moment Write operation was carried out, then finds ground in storage region corresponding with the 3rd chunk by searching mapping table Location, the data that the address search in storage region corresponding with the 3rd chunk is deposited to storage region For m, location revision is the 5th offset address in the 3rd chunk, i.e., e in abcde is revised as into m, Now m is merged with abcde, is specifically to write m to generate new data abcdm at the 3rd chunk e, The 3rd chunk of abcdm and correspondence address is preserved in the preset new space of storage region application, renewal is reflected The 3rd chunk preserves the address in abcdm new space in the address of source book and storage region in firing table, And discharge storage e space.When reading data, newest data abcdm is read.
In the present embodiment, by judging to receive read command and being newly generated between snapshot whether write behaviour Make to carry out the reading of data, it is newest real time data to make the data read.
Further, reference picture 9, method above-described embodiment of data is write based on the present invention, is write in the present invention In the fourth embodiment of the method for data, the method for write data also includes step:
Step S80, if being redirected when writing in snapshot processes, receives and generates life to the snapshot of the source book Order, then judge whether the source book has before the snapshot generation order is received according to the mapping table Write operation;
Step S90, when the source book has write operation before the snapshot generation order is received, is obtained It is the 3rd target write address to take to the address of the write operation of source book, according to the mapping table search and described the Address in the corresponding storage region of three target write address, it is the 3rd to obtain the data in the address Data, while obtaining the size of the 3rd data;
Step S100, writes according to the 3rd data, the size of the 3rd data and the 3rd target Address generates snapshot.
In the present embodiment, redirected when writing in snapshot processes, life is generated when receiving the snapshot to source book Can be now that snapshot is carried out to source book for the first time or feelings are produced in the snapshot having had been friends in the past when making The new snapshot generation order received under condition.When before snapshot generation order is received, source book may be carried out Write data operation or read data operation, when had write redirection when, show the data in source book There is the modification for writing data, in order to generate newest data snapshot, first judge the source book receiving Whether there is write operation before stating snapshot generation order.When no progress write operation, the content of source book this moment It is exactly newest data.
Above-mentioned 3rd target write address will write the address of data when being the write operation on source book.Pass through mapping Table can inquire about the 3rd target write address and the corresponding address in storage region, obtain in storage region Data in corresponding address are the 3rd data, and when having carried out write operation and not carrying out read operation, this is accordingly What is deposited in location is the write-in data deposited when writing data in storage region, is carried out again when having carried out write operation During read operation, what is deposited in the corresponding address is that original write into data when reading data with original chunk to merge Latest data.Data merging specifically how is carried out to have carried out in the method second embodiment for write data in detail Illustrate, repeat no more here.
Judge whether the source book has the method for write operation can be with before snapshot generation order is received Obtained by searching mapping table.The size of above-mentioned 3rd data can by obtain the 3rd data byte number Mode obtain, then according to the write address of the 3rd data, the size of the 3rd data and the 3rd data generate Snapshot.
Preferably, in reference picture 10, the present embodiment, it is above-mentioned according to the 3rd data, it is described 3rd number According to size and the 3rd target write address generation snapshot include:
Step S110, judges the size and the 3rd target write address of the 3rd data in the source book Whether the size of the 3rd corresponding memory block is equal;If so, then performing step S120;Otherwise, perform Step S130;
Step S120, the 3rd data are written back in the 3rd memory block of the source book;
Step S130, obtains the data in the 3rd memory block, by the 3rd data and the described 3rd Data in memory block are merged into the 4th data, and the 4th data are written back into the 3rd of the source book deposits Store up in block.
In the present embodiment, above-mentioned 3rd memory block refers to the 3rd target write address in the block corresponding to source book, Block as when performing write operation corresponding to write operation, for example, receive write operation by the chunk of source book the 2nd In aaaa when being write as aaac, the 3rd target write address is exactly the 2nd chunk address, the data write It is exactly c, the 3rd memory block corresponding to the 3rd target write address is exactly the 2nd chunk.Judge the 3rd data Size it is whether equal with the size of the 3rd memory block, when equal, show to write data by write operation Former chunk data are all rewritten, or read operation was produced after write operation, redirection is now write Memory space in data of writing be latest data, the 3rd data are written back to the 3rd memory block of source book In, that is, it is written back at the chunk for producing write operation.
When the size of the 3rd data and the unequal size of the 3rd memory block, show now to perform and write behaviour Make, but only rewritten the partial data in chunk and do not carried out read operation, needed during generation snapshot Obtain this moment newest data.The data in the 3rd memory block when now obtaining write operation, at this moment the 3rd Data in memory block are the data before write operation, and the data in the 3rd data and the 3rd memory block are closed And the 4th data are generated, now the 4th data are the latest data corresponding to the 3rd memory block of source book, will 4th data are write back in the 3rd memory block of source book.
For example, before snapshot generation order is received, the data that the 3rd chunk is deposited on source book are abcde Performed write operation and e is revised as m, and do not receive read operation order, ordered when receiving snapshot generation When, obtaining source book by searching mapping table had write operation.In the memory space for now obtaining write operation Data, that is, obtain m, and m size is compared with chunk size, and the size for being readily obtained m is less than Chunk size, then obtain the data of the 3rd chunk on source book, by the abcde in m and the 3rd chunk Merge generation new data.The m correspondence positions for writing the 3rd chunk are specifically saved as into new data Abcdm, now abcdm is the chunk of source book the 3rd latest data, and abcdm is write the on source book At three chunk, now the data in the 3rd chunk are the content of the snapshot generated.
In the present embodiment, by judging whether there is write operation before receiving snapshot generation order, and obtain The data of write operation, the generation of snapshot is carried out according to the size of the data of write operation, it is ensured that snapshot is generated When data be newest real time data, while selectively being write by the size of the data to write operation Enter data, improve the efficiency of snapshot generation.
The preferred embodiments of the present invention are these are only, are not intended to limit the scope of the invention, it is every The equivalent structure or equivalent flow conversion made using description of the invention and accompanying drawing content, or directly or Connect and be used in other related technical fields, be included within the scope of the present invention.

Claims (10)

1. a kind of device for writing data, it is characterised in that the device of write data includes:
First acquisition module, is redirected in snapshot processes during for writing, and snapshot generation order is not being got Before, when receiving the write operation order to source book, the write-in number that the write operation order is included is obtained According to size information;
Write operation module, for the size information according to said write data from preset storage region application The memory space matched with the size information, write operation is carried out in the memory space applied.
2. the device as claimed in claim 1 for writing data, it is characterised in that in the write operation order The first object write address of the source book is write including said write data, and said write data;
Then the write operation module includes:
Memory space application unit, for the size information according to said write data from the storage region Apply for the first memory space, first storage size be equal to the write the sizes of data with it is described The size of data sum of first object write address;
Memory cell, for storing said write data and the first object in first memory space Write address;
Updating block, for the first of the first object write address and first memory space to be stored Corresponding relation between address is updated in mapping table, and records in the mapping table corresponding relation Renewal time, the mapping table be used for preserve the address in the source book and the storage of the storage region The renewal time of corresponding relation and the corresponding relation between address.
3. the device as claimed in claim 2 for writing data, it is characterised in that the device of write data Also include:
Second acquisition module, is redirected in snapshot processes for writing, and snapshot generation order is not being got Before, when receiving the read operation order to the source book, the target obtained in the read operation order is read Address;
First judge module, if for reading address comprising the target in the mapping table, judging described Target reads whether address corresponding renewal time in the mapping table is read in last time based on the target After address generation snapshot;
Data combiners block, for the target to read address and the target is read when being included in the mapping table Address corresponding renewal time in the mapping table reads address generation soon in last time based on the target When according to after, the second storage address corresponding with target reading address is searched in the mapping table, is obtained The data in the second storage address described in the storage region are taken, by the number in second storage address The second data are merged into according to the first data with acquisition, are protected in the memory space of storage region application second Second data are deposited, the target is read between address and the storage address of second memory space Corresponding relation is updated in the mapping table, and first data are that the target reads address in the source book Data in upper corresponding memory block;
Read operation module, for reading address or the mapping table when not including the target in the mapping table In read address but the target comprising the target and read address in the mapping table corresponding renewal time is not When last time is read based on the target after address generation snapshot, read the target and read address in institute State the data in corresponding memory block on source book.
4. the device of data is write as claimed in claim 2 or claim 3, it is characterised in that write data Device also includes:
Receiving module, if for being redirected when writing in snapshot processes, receiving the snapshot to the source book Generation order, then judge the source book before the snapshot generation order is received according to the mapping table Whether write operation is had;
Second judge module, for being write when the source book exists before the snapshot generation order is received During operation, it is the 3rd target write address to obtain to the address of the write operation of source book, is looked into according to the mapping table The address looked in the storage region corresponding with the 3rd target write address, is obtained in the address Data are the 3rd data, while obtaining the size of the 3rd data;
Snapshot generation module, for according to the 3rd data, the size of the 3rd data and described Three target write address generate snapshot.
5. the device as claimed in claim 4 for writing data, it is characterised in that the snapshot generation module Including:
Judging unit, for judging the sizes of the 3rd data with the 3rd target write address described Whether the size of the 3rd memory block corresponding to source book is equal;
Write operation unit, for the equal in magnitude of the size when the 3rd data and the 3rd memory block When, the 3rd data are written back in the 3rd memory block of the source book;
Snapshot generation unit, the size for the size when the 3rd data and the 3rd memory block is not When equal, the data in the 3rd memory block are obtained, by the 3rd data and the 3rd memory block In data be merged into the 4th data, the 4th data are written back in the 3rd memory block of the source book.
6. a kind of method for writing data, it is characterised in that the method for write data comprises the following steps:
Redirected when writing in snapshot processes, before snapshot generation order is not got, when receiving to source During the write operation order of volume, the size information for the write-in data that the write operation order is included is obtained;
According to the size information of said write data from preset storage region application and the size information The memory space matched somebody with somebody, write operation is carried out in the memory space applied.
7. the method as claimed in claim 6 for writing data, it is characterised in that in the write operation order Also include said write data, and said write data will write the first object write address of the source book;
Then the size information according to said write data is from preset storage region application and the size The memory space of information matches, carrying out write operation in the memory space applied includes:
It is described according to the size information of said write data from the memory space of storage region application first The size and the data of the first object write address that first storage size is equal to the write data are big Small sum;
Said write data and the first object write address are stored in first memory space;
Will be corresponding between the first object write address and the first storage address of first memory space Relation is updated in mapping table, and records in the mapping table renewal time of the corresponding relation, institute Stating mapping table is used to preserve corresponding between the address in the source book and the storage address of the storage region The renewal time of relation and the corresponding relation.
8. the method as claimed in claim 7 for writing data, it is characterised in that the method for write data Also include:
Write in redirection snapshot processes, before snapshot generation order is not got, when receiving to described During the read operation order of source book, the target obtained in the read operation order reads address;
If reading address comprising the target in the mapping table, judge that the target is read address and reflected described Whether corresponding renewal time is after last time reads generation snapshot in address based on the target in firing table;
If reading address comprising the target in the mapping table and the target reading address in the mapping table Corresponding renewal time is read in last time based on the target after address generation snapshot, then is reflected described The second storage address corresponding with target reading address is searched in firing table, institute in the storage region is obtained The data in the second storage address are stated, by the data in second storage address and the first data of acquisition The second data are merged into, second data are preserved in the memory space of storage region application second, will The corresponding relation that the target is read between address and the storage address of second memory space is updated to described In mapping table, first data are that the target reads address on the source book in corresponding memory block Data;
If not including the target in the mapping table to read to include the target in address, or the mapping table Reading address but target reading address corresponding renewal time in the mapping table are not based in last time The target is read after address generation snapshot, then reads the target reading address corresponding on the source book Data in memory block.
9. the method for writing data as claimed in claim 7 or 8, it is characterised in that write data Method also includes:
If being redirected when writing in snapshot processes, receive and order is generated to the snapshot of the source book, then root Judge whether the source book has write operation before the snapshot generation order is received according to the mapping table;
When the source book has write operation before the snapshot generation order is received, obtain to source book Write operation address be the 3rd target write address, according to it is described mapping table search write with the 3rd target Address in the corresponding storage region in address, it is the 3rd data to obtain the data in the address, together When obtain the sizes of the 3rd data;
It is fast according to the generation of the 3rd data, the size of the 3rd data and the 3rd target write address According to.
10. the as claimed in claim 9 method for writing data, it is characterised in that described according to described the Three data, the size of the 3rd data and the 3rd target write address generation snapshot include:
Judge the sizes of the 3rd data and the 3rd target write address in the corresponding to the source book Whether the size of three memory blocks is equal;
If so, then the 3rd data are written back in the 3rd memory block of the source book;
If it is not, then obtaining the data in the 3rd memory block, the 3rd data are deposited with the described 3rd Data in storage block are merged into the 4th data, and the 4th data are written back to the 3rd storage of the source book In block.
CN201610159006.2A 2016-03-17 2016-03-17 Method and device for writing data Active CN107203331B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610159006.2A CN107203331B (en) 2016-03-17 2016-03-17 Method and device for writing data
PCT/CN2017/075058 WO2017157158A1 (en) 2016-03-17 2017-02-27 Data writing method and apparatus, and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610159006.2A CN107203331B (en) 2016-03-17 2016-03-17 Method and device for writing data

Publications (2)

Publication Number Publication Date
CN107203331A true CN107203331A (en) 2017-09-26
CN107203331B CN107203331B (en) 2022-05-06

Family

ID=59850735

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610159006.2A Active CN107203331B (en) 2016-03-17 2016-03-17 Method and device for writing data

Country Status (2)

Country Link
CN (1) CN107203331B (en)
WO (1) WO2017157158A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144416A (en) * 2018-08-03 2019-01-04 华为技术有限公司 The method and apparatus for inquiring data
CN110209351A (en) * 2019-05-10 2019-09-06 星辰天合(北京)数据科技有限公司 Distributed storage data processing method and device
CN110309100A (en) * 2018-03-22 2019-10-08 腾讯科技(深圳)有限公司 A kind of snapshot object generation method and device
CN116991542A (en) * 2023-09-26 2023-11-03 苏州元脑智能科技有限公司 Virtual machine snapshot method, system, electronic equipment and computer storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111061429B (en) * 2019-11-22 2022-06-17 北京浪潮数据技术有限公司 Data access method, device, equipment and medium
CN112099943A (en) * 2020-08-13 2020-12-18 深圳云天励飞技术股份有限公司 Memory allocation method and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667161A (en) * 2008-09-02 2010-03-10 联想(北京)有限公司 Method and device for protecting data of storage device and computer system
WO2013001568A1 (en) * 2011-06-28 2013-01-03 Hitachi, Ltd. Data storage apparatus and control method therefor
CN103761190A (en) * 2013-12-19 2014-04-30 华为技术有限公司 Data processing method and apparatus
CN104407936A (en) * 2014-11-18 2015-03-11 华为数字技术(成都)有限公司 Data snapshot method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193842A (en) * 2010-03-15 2011-09-21 成都市华为赛门铁克科技有限公司 Data backup method and device
CN101997918B (en) * 2010-11-11 2013-02-27 清华大学 Method for allocating mass storage resources according to needs in heterogeneous SAN (Storage Area Network) environment
CN104102521A (en) * 2014-07-25 2014-10-15 浪潮(北京)电子信息产业有限公司 Method and device for updating nonvolatile storage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667161A (en) * 2008-09-02 2010-03-10 联想(北京)有限公司 Method and device for protecting data of storage device and computer system
WO2013001568A1 (en) * 2011-06-28 2013-01-03 Hitachi, Ltd. Data storage apparatus and control method therefor
CN103761190A (en) * 2013-12-19 2014-04-30 华为技术有限公司 Data processing method and apparatus
CN104407936A (en) * 2014-11-18 2015-03-11 华为数字技术(成都)有限公司 Data snapshot method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110309100A (en) * 2018-03-22 2019-10-08 腾讯科技(深圳)有限公司 A kind of snapshot object generation method and device
CN109144416A (en) * 2018-08-03 2019-01-04 华为技术有限公司 The method and apparatus for inquiring data
US11579986B2 (en) 2018-08-03 2023-02-14 Huawei Cloud Computing Technologies Co., Ltd. Data query method and apparatus
CN110209351A (en) * 2019-05-10 2019-09-06 星辰天合(北京)数据科技有限公司 Distributed storage data processing method and device
CN116991542A (en) * 2023-09-26 2023-11-03 苏州元脑智能科技有限公司 Virtual machine snapshot method, system, electronic equipment and computer storage medium
CN116991542B (en) * 2023-09-26 2024-02-13 苏州元脑智能科技有限公司 Virtual machine snapshot method, system, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN107203331B (en) 2022-05-06
WO2017157158A1 (en) 2017-09-21

Similar Documents

Publication Publication Date Title
CN107203331A (en) Write the method and device of data
US10248356B2 (en) Using scratch extents to facilitate copying operations in an append-only storage system
US11481121B2 (en) Physical media aware spacially coupled journaling and replay
US8024383B2 (en) Fat directory structure for use in transaction safe file
US9690823B2 (en) Synchronizing copies of an extent in an append-only storage system
CN102779180B (en) The operation processing method of data-storage system, data-storage system
US7130873B2 (en) File system image transfer between dissimilar file systems
US8271456B2 (en) Efficient backup data retrieval
US9772783B2 (en) Constructing an index to facilitate accessing a closed extent in an append-only storage system
CN105988723A (en) Snapshot processing method and device
US9569515B2 (en) Facilitating distributed deletes in a replicated storage system
CN108733761A (en) A kind of data processing method apparatus and system
US20150149500A1 (en) Multi-level lookup architecture to facilitate failure recovery
CN106528071B (en) The choosing method and device of object code
US9720607B2 (en) Append-only storage system supporting open and closed extents
CN106227731A (en) A kind of data processing method, device and distributed file system
US10289321B1 (en) Bad block table recovery in a solid state drives
US20160139980A1 (en) Erasure-coding extents in an append-only storage system
JP4755244B2 (en) Information generation method, information generation program, and information generation apparatus
CN110187834B (en) Data processing method and device for duplicate copies and electronic equipment
KR100637787B1 (en) Method and program for file information write processing
CN103838647B (en) A kind of method and system of the data mode conversion remapped based on snapshot
CN108241557A (en) The method of data backup in HDFS
CN112131194A (en) File storage control method and device of read-only file system and storage medium
US9967310B2 (en) Using an RPC framework to facilitate out-of-band data transfers

Legal Events

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