CN107861685A - Virtual disk wiring method and device, storage medium based on copy-on-write - Google Patents

Virtual disk wiring method and device, storage medium based on copy-on-write Download PDF

Info

Publication number
CN107861685A
CN107861685A CN201710472651.4A CN201710472651A CN107861685A CN 107861685 A CN107861685 A CN 107861685A CN 201710472651 A CN201710472651 A CN 201710472651A CN 107861685 A CN107861685 A CN 107861685A
Authority
CN
China
Prior art keywords
write
virtual disk
written
file
copy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710472651.4A
Other languages
Chinese (zh)
Inventor
刘仁仕
张齐国
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201710472651.4A priority Critical patent/CN107861685A/en
Publication of CN107861685A publication Critical patent/CN107861685A/en
Priority to PCT/CN2018/083778 priority patent/WO2018233369A1/en
Pending legal-status Critical Current

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
    • 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/0644Management of space entities, e.g. partitions, extents, pools
    • 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/0671In-line storage system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of virtual disk wiring method based on copy-on-write, this method includes:When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;When said write multiplication factor is equal to or more than default threshold value, then to said write operate open copy-on-write, by said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, and the file to be written in the caching is written in the virtual disk.The invention also discloses a kind of virtual disk writing station based on copy-on-write, and a kind of storage medium.The present invention, which solves virtual disk in the prior art, after repeatedly write-in file, can produce write-in amplification, the technical problem for causing virtual disk write performance to reduce.

Description

Virtual disk wiring method and device, storage medium based on copy-on-write
Technical field
The present invention relates to virtual disk technology field, more particularly to a kind of virtual disk wiring method based on copy-on-write And device, storage medium.
Background technology
Virtual disk (Virtual disk), exactly fictionalizes the magnetic inside a remote computer inside local computing Disk, perceptual image are that the hard disk in the machine is the same, but in fact it not in the machine.Virtual disk is exactly with fictionalizing one in internal memory The technology of individual or multiple disks, as virtual memory, the speed of internal memory is more faster than hard disk, using this point, inside The data exchange speed that one or more disk cans accelerate disk is fictionalized in depositing, so as to improve the speed of service of computer.
Virtual disk is used widely in current cloud computing environment, and at present, virtual disk is in repeatedly write-in file After can form fragment, i.e. continuously and virtually address space is distributed in discontinuous file address space, thus can be inevitable Ground brings write-in to amplify, i.e., can be amplified as multiple file write operations to a write operation of virtual disk, write performance is brought Certain influence.Such as when the data block size of write-in is 2MB, when the size for giving tacit consent to cluster is 64KB, then need to write 32 numbers According to cluster, and this 32 aggregates of data discrete may be distributed in discontinuous file address.Now, write operation will be amplified to 32 times, cause the write performance of virtual disk to reduce.
The content of the invention
It is a primary object of the present invention to propose a kind of virtual disk wiring method based on copy-on-write and device, storage Medium, it is intended to which solving virtual disk in the prior art after repeatedly write-in file, can produce write-in amplification, cause virtual disk to be write Enter the technical problem of performance reduction.
To achieve the above object, the present invention provides a kind of virtual disk wiring method based on copy-on-write, described to be based on The virtual disk wiring method of copy-on-write includes:
When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;
When said write multiplication factor is equal to or more than default threshold value, then answered when being write to said write operation unlatching System, by said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;
When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, And the file to be written in the caching is written in the virtual disk.
Preferably, continuous address space is distributed in the virtual disk for said write operation, and by the caching In the step that is written in the virtual disk of file to be written include:
It is that the file to be written distributes continuous cluster in the virtual disk;
File to be written in the caching is written in the continuous cluster, and updated to be written in the caching The virtual address offset of file.
Preferably, the step of virtual address offset for updating the file to be written in the caching, includes:
According to the top of file of the file to be written, the virtual address offset of the file to be written is indexed out;
The virtual address offset of the file to be written in the caching is updated, and is discharged occupied in the virtual disk Cluster.
Preferably, the step of discharging in the virtual disk occupied cluster includes:
Reference count corresponding to the occupied cluster is subtracted 1.
Preferably, continuous address space is distributed in the virtual disk for said write operation, and by the caching In the step that is written in the virtual disk of file to be written also include:
Head and the tail data segment corresponding to occupied cluster is read, and after being spliced with the file to be written in the caching It is written to simultaneously in the virtual disk.
In addition, to achieve the above object, the present invention also provides a kind of virtual disk writing station based on copy-on-write, institute Stating the virtual disk writing station based on copy-on-write includes:Memory, processor and it is stored on the memory and can be The virtual disk write-in program based on copy-on-write run on the processor, the virtual disk based on copy-on-write are write Following steps are realized when entering program by the computing device:
When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;
When said write multiplication factor is equal to or more than default threshold value, then answered when being write to said write operation unlatching System, by said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;
When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, And the file to be written in the caching is written in the virtual disk.
Preferably, can also be real when the virtual disk write-in program based on copy-on-write is by the computing device Existing following steps:
It is that the file to be written distributes continuous cluster in the virtual disk;
File to be written in the caching is written in the continuous cluster, and updated to be written in the caching The virtual address offset of file.
Preferably, can also be real when the virtual disk write-in program based on copy-on-write is by the computing device Existing following steps:
According to the top of file of the file to be written, the virtual address offset of the file to be written is indexed out;
The virtual address offset of the file to be written in the caching is updated, and is discharged occupied in the virtual disk Cluster.
Preferably, can also be real when the virtual disk write-in program based on copy-on-write is by the computing device Existing following steps:
Head and the tail data segment corresponding to occupied cluster is read, and after being spliced with the file to be written in the caching It is written to simultaneously in the virtual disk.
In addition, to achieve the above object, the present invention also provides a kind of storage medium, is stored with and is based in the storage medium The virtual disk write-in program of copy-on-write, it is real when the virtual disk write-in program based on copy-on-write is executed by processor Now each step corresponding to the virtual disk wiring method based on copy-on-write as described above.
Virtual disk wiring method and device, storage medium provided by the present invention based on copy-on-write, can be realized: Detecting that virtual disk has write operation, and when the write-in multiplication factor of the write operation is equal to or more than default threshold value, Copy-on-write then is opened to the write operation, file to be written corresponding to the write operation is temporarily written the slow of virtual disk In depositing, rather than write direct in virtual disk, when receiving store instruction, just grasped in above-mentioned virtual disk for the write-in Make to distribute continuous address space, then the file to be written in caching is written in above-mentioned virtual disk.Due to the present invention When virtual disk produces multiple write operations, copy-on-write just is opened to write operation each time, so as to be written into In file write-in virtual disk in continuous address space, therefore the write-in multiplication factor of virtual disk can be effectively controlled, protected Protect virtual disk write performance, solve in the prior art virtual disk repeatedly write-in file after, can produce write-in amplification, The technical problem for causing virtual disk write performance to reduce.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the virtual disk wiring method first embodiment of the invention based on copy-on-write;
Fig. 2 is the refinement step schematic flow sheet of step S30 shown in Fig. 1 of the present invention;
Fig. 3 is the structural representation for the software runtime environment that the virtual disk writing station of the invention based on copy-on-write is related to Figure.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
The preferred embodiments of the present invention are illustrated below in conjunction with Figure of description, it will be appreciated that described herein Preferred embodiment is merely to illustrate and explain the present invention, and is not intended to limit the present invention, and in the case where not conflicting, this hair The feature in embodiment and embodiment in bright can be mutually combined.
Following examples of the present invention provide a kind of virtual disk wiring method based on copy-on-write, in this method, are examining Measuring virtual disk has write operation, and when the write-in multiplication factor of the write operation is equal to or more than default threshold value, then it is right Copy-on-write is opened in the write operation, and file to be written corresponding to the write operation is temporarily written to the caching of virtual disk In, rather than write direct in virtual disk, just it is the write operation in above-mentioned virtual disk when receiving store instruction Continuous address space is distributed, then the file to be written in caching is written in above-mentioned virtual disk.I.e. this method is in void When intending disk generation multiple write operations, copy-on-write just is opened to write operation each time, so as to be written into file Write in virtual disk in continuous address space, therefore can effectively control the write-in multiplication factor of virtual disk, protection is empty Intend the write performance of disk.
Reference picture 1, Fig. 1 are the flow signal of the virtual disk wiring method first embodiment of the invention based on copy-on-write Scheme, in the virtual disk wiring method first embodiment of the invention based on copy-on-write, the above-mentioned virtual magnetic based on copy-on-write Disk wiring method includes:
Step S10, when detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation.
Wherein, the virtual disk described in the present embodiment, refer to data, file, network file, internal memory etc. to pass through technology Means " camouflage " allow user's perceptual image to be with existing for a true disk " disk " into disk.Specifically, client can lead to The iSCSI Cake servers crossed in LAN connection server, go out one piece of hard disk in local virtual, be total to reaching by network Enjoy the effect of server hard disc.For example, Internet bar owner only needs to add catalogue and installation in iSCSI Cake on the server Games Software, just there is corresponding Games Software in the local virtual hard disk of client, it is not necessary to installed to every machine.
Above-mentioned write operation refers to the process of file to be written to write and stores above-mentioned virtual disk, specifically can profit Instrument is write with Vhd (Microsoft Virtual Hard Disk format, MICROSOFT VIRTUAL disk file) virtual disk Carry out.
Wherein, file to be written corresponding to above-mentioned write operation includes Qcow2 mirror-image format files, Qcow2 mirror-image formats File belongs to a kind of disk mirroring file of QEMU (Quick Emulator, virtual opetrating system simulator) simulator support, It can represent the block device disk of one piece of fixed size with the form of a file.
Wherein, write-in amplification is a kind of undesirable phenomenon in virtual disk, that is, the physical message amount being actually written into be by More times of the amount of logic to be write.Because flash memory must be wiped first before it can re-write data, the mistake of these operations is performed Journey just generates the movement (or re-writing) of the user data and metadata more than once, and this multiplier effect can increase request and write The number entered causes write-in to be amplified, and asks the number of write-in as to write multiplication factor.
In the present embodiment, when detecting that virtual disk has write operation, just detect write-in corresponding to the write operation and put Big multiple.
Wherein, the step of detecting write-in multiplication factor corresponding to above-mentioned write operation includes:Detect the data to be write The size of block, and the size of write operation corresponding data cluster each time, according to the size of the data block and the size of aggregate of data, Calculate write-in multiplication factor corresponding to above-mentioned write operation.For example, the data block size for working as write-in is 2MB, write each time When the size for operating corresponding data cluster is 64KB, then need altogether to write 32 aggregates of data, and this 32 aggregates of data may be discrete It is distributed in discontinuous file address, now, write-in multiplication factor is 32 times corresponding to above-mentioned write operation.
Step S20, when said write multiplication factor is equal to or more than default threshold value, then said write is operated and opened Copy-on-write, by said write operate corresponding to file to be written be temporarily written in the caching of virtual disk.
In the present embodiment, a write-in multiplication factor threshold value is pre-set, such as is arranged to 5 times, 10 times etc., is write when above-mentioned When entering multiplication factor and being equal to or more than the threshold value, then copy-on-write is opened to above-mentioned write operation.
Wherein, copy-on-write is COW (copy-on-write, copy-on-write) technology, and COW technologies, which have used, " quotes meter Number " (refcount), have a variable be used for preserve reference quantity.When first class constructs, character string (string) Constructed fuction can according to incoming parameter from heap storage allocation, when there is other classes to need this block internal memory, the reference count To be automatic cumulative, when there is class destructed, the reference count can subtract 1, and when to the last a class is destructed, reference count now is 1 or 0.
For example, it is necessary to constantly write according to the data that are transmitted on network or user when some program will write file, If fwrite (write-in file) operations each time or fprintf (transferring formatted is output in a file) will be carried out The I/O operation (referring to the operation for the interface circuit being connected to equipment with cpu, such as the write operation of virtual disk) of one virtual disk If, then huge loss can be brought to the write performance of virtual disk.Therefore, in order to protect the write performance of virtual disk, The present embodiment uses COW technologies, each write operation is all first write in the caching of virtual disk in (disk internal memory), only when When closing file or receiving store instruction, just it is written in virtual disk.
Specifically, in the present embodiment, when above-mentioned write-in multiplication factor is equal to or more than default threshold value, then to the write-in Copy-on-write is opened in operation.
Step S30, when receiving store instruction, in the virtual disk for said write operation distribution continuously Location space, and the file to be written in the caching is written in the virtual disk.
In order to be better understood from the present invention, illustrated by taking the ablation process of qcow2 files in the prior art as an example.It is existing In technology, when a long data block is write in virtual disk, because the address for writing virtual disk is discrete distribution, because This, write-in amplification is still likely to result in when the long data block is write into virtual disk.
In the present embodiment, before by the file to be written write-in virtual disk in caching, it is in the virtual disk first Write operation corresponding to file to be written distributes continuous address space, and it is virtual that above-mentioned file to be written then is written into this again In disk.
Wherein, when user wants to be written into file write-in virtual disk, store instruction can be triggered and (" protected as clicked on Deposit "), virtual disk writing station is corresponding to file to be written in above-mentioned virtual disk after the store instruction is received Write operation distributes continuous address space, and then above-mentioned file to be written is written in the virtual disk again.
The virtual disk wiring method based on copy-on-write described in the present embodiment, grasped detecting that virtual disk has to write Make, and when the write-in multiplication factor of the write operation is equal to or more than default threshold value, then answered when being write to write operation unlatching System, file to be written corresponding to the write operation is temporarily written in the caching of virtual disk, rather than is write direct virtual In disk, when receiving store instruction, continuous address space just is distributed for the write operation in above-mentioned virtual disk, so The file to be written in caching is written in above-mentioned virtual disk afterwards.Repeatedly write because the present embodiment produces in virtual disk During operation, copy-on-write just is opened to write operation each time, it is continuous in file write-in virtual disk so as to be written into Address space in, therefore can effectively control the write-in multiplication factor of virtual disk, protect the write performance of virtual disk, solve Virtual disk in the prior art of having determined after repeatedly write-in file, can produce write-in amplification, cause virtual disk write performance to drop Low technical problem.
Further, reference picture 2, Fig. 2 is the refinement step schematic flow sheet of step S30 shown in Fig. 1 of the present invention, based on this Virtual disk wiring method first embodiment of the invention based on copy-on-write, virtual disk write-in of the present invention based on copy-on-write In method second embodiment, described in the step S30 shown in above-mentioned Fig. 1 is said write operation point in the virtual disk With continuous address space, and the file to be written in the caching is written to the virtual disk included:
Step S31, it is that the file to be written distributes continuous cluster in the virtual disk;
Step S32, the file to be written in the caching is written in the continuous cluster, and updated in the caching File to be written virtual address offset.
In the present embodiment, so that qcow2 files are above-mentioned file to be written as an example, qcow2 files are by many fixed sizes Cluster (cluster) forms, wherein, if above-mentioned virtual disk is made up of multiple sectors, several sectors are combined into a cluster;Separately Outside, writing with reading for file is also in units of cluster in virtual disk.
According to the function of each cluster, qcow2 files can be divided into following a few classes:
(1)、header:Top of file, by the data in header, l1_table, reference count table can be indexed (refcount table);
(2)、l1_table:Deposit l2_table deviation post;
(3)、l2_table:Virtual address offset, deposit the deviation post of data block;
(4)、refcount_table:Reference count table, the bits of offset of storage reference count block (refcount block) Put;
(5)、refcount_block:Reference count block, deposit reference count (refcount) value;
(6)、snapshot table:Snapshot table, for depositing the essential information of snapshot.
Wherein, above-mentioned snapshot refers to a completely available copy on specifying data acquisition system, and the copy includes respective counts According to the image at some time point (time point that copy starts), snapshot can be a copy of the data represented by it, Can be a duplicate of data.The effect of snapshot can mainly carry out online data backup with recovering, and work as storage device Quick data recovery can be carried out when generation application and trouble or file corruption, some available time point by data recovery State.Another effect of snapshot is to provide another data access channel for storage user, when former data are carried out online During using processing, user can access snapshot data, can also carry out the work such as testing using snapshot.
Wherein, copy-on-write is being opened to above-mentioned write operation, i.e., is being written to virtual disk for the first time in file to be written During some storage location, it is necessary first to read out original content, writing another position, (storage retained for snapshot is empty Between, we are referred to as snapshot space in this text), file is then written into again to be written in virtual disk, and next time is directed to this The write operation of storage location no longer will be performed copy on write.
Place during qcow2 files are realized from logical address to actual file by l1_table, l2_table two-stage index The conversion in region, used time distribution is supported so as to realize, even a certain region does not have write operation, then unactual for region distribution Address space.
It is the file distribution to be written in virtual disk specifically, in above-mentioned file write-in virtual disk to be written Continuous cluster, then the file to be written is written in the continuous cluster distributed, and updates the virtual of the file to be written Address offset amount.
The virtual disk wiring method based on copy-on-write described in the present embodiment, when virtual disk writes file, first Distribute continuous cluster in virtual disk for the file to be written, then the file to be written is written to distributed it is continuous In cluster, and the virtual address offset of the file to be written is updated, so as to effectively control the write-in times magnification of virtual disk Number, protect the write performance of virtual disk.
Further, based on virtual disk wiring method first, second embodiment of the invention described above based on copy-on-write, In virtual disk wiring method 3rd embodiment of the invention based on copy-on-write, shown in above-mentioned Fig. 2 described in step S32 more The virtual address offset of file to be written in the new caching includes:
According to the top of file of the file to be written, the virtual address offset of the file to be written is indexed out;
The virtual address offset of the file to be written in the caching is updated, and is discharged occupied in the virtual disk Cluster.
Wherein, by the top of file header of file to be written, l1_table can be indexed, and then can basis L1_table indexes virtual address offset l2_table.In addition, by above-mentioned top of file, reference count can be indexed Table refcount_table, can be to index cluster where reference count block refcount block by reference count table;Separately Outside, by above-mentioned top of file, snapshot table snapshot table can also be indexed, and then index the data of snapshot, i.e., Above-mentioned file to be written.
Further, in the above-mentioned release virtual disk occupied cluster the step of include:
Reference count corresponding to the occupied cluster is subtracted 1.
In the present embodiment, reference count refcount is data block index value, and each cluster has one in qcow2 files Corresponding reference count, if this cluster is not previously allocated, then its reference count is 0, if the cluster is allocated, it draws It is more than 0 with counting.For some cluster, it often performs a copy-on-write, and its corresponding reference count value adds 1.Therefore, can be with By subtracting 1 by reference count corresponding to above-mentioned occupied cluster, to discharge in virtual disk occupied cluster.
The virtual disk wiring method based on copy-on-write described in the present embodiment, can be according to the file header of file to be written Portion indexes out the virtual address offset of file to be written, so as to updating the virtual address offset of the file to be written, and To reference count corresponding to occupied cluster subtracts 1 in virtual disk, thus occupied cluster is discharged in virtual disk, on State in the i.e. writable virtual disk of file to be written in allocated continuous address space, so as to effectively control virtual disk Multiplication factor is write, protects the write performance of virtual disk.
Further, it is real based on virtual disk wiring method first, second, third of the invention described above based on copy-on-write Example is applied, in the virtual disk wiring method fourth embodiment of the invention based on copy-on-write, in the step S30 shown in above-mentioned Fig. 1 Described distributes continuous address space in the virtual disk for said write operation, and will be to be written in the caching File, which is written to the virtual disk, to be included:
Head and the tail data segment corresponding to occupied cluster is read, and after being spliced with the file to be written in the caching It is written to simultaneously in the virtual disk.
In the present embodiment, it is necessary to update to be written during above-mentioned file to be written is written into above-mentioned virtual disk Enter the virtual address offset of file, and need to discharge occupied cluster in virtual disk, consequently, it is possible to causing above-mentioned write Enter the loss of data of file some write operation write-in, it is therefore, above-mentioned above-mentioned file to be written is written in the present embodiment During virtual disk, head and the tail data segment corresponding to occupied cluster is read, and after being spliced with above-mentioned file to be written simultaneously It is written in virtual disk.
The virtual disk wiring method based on copy-on-write described in the present embodiment, it will treated corresponding to above-mentioned write operation Write-in file is when being written in virtual disk, reads head and the tail data segment corresponding to occupied cluster, and with above-mentioned text to be written After part is spliced while it is written in virtual disk so that file to be written can all write corresponding to above-mentioned write operation Into virtual disk, so as to ensure that the accuracy of virtual disk data write-in.
The present invention also provides a kind of virtual disk writing station based on copy-on-write, should the virtual magnetic based on copy-on-write Disk writing station includes:Memory, processor and be stored on the memory and can run on the processor based on The virtual disk write-in program of copy-on-write, the device can be realized:Detecting that virtual disk has write operation, and the write-in When the write-in multiplication factor of operation is equal to or more than default threshold value, then copy-on-write is opened to the write operation, this is write File to be written corresponding to entering operation is temporarily written in the caching of virtual disk, rather than is write direct in virtual disk, when connecing When receiving store instruction, continuous address space just is distributed for the write operation in above-mentioned virtual disk, in then caching File to be written be written in above-mentioned virtual disk.It is just right because the present apparatus is when virtual disk produces multiple write operations Copy-on-write is opened in write operation each time, so as to be written into continuous address space in file write-in virtual disk It is interior, therefore the write-in multiplication factor of virtual disk can be effectively controlled, protect the write performance of virtual disk.
Specifically, the above-mentioned virtual disk write-in program based on copy-on-write is realized following step during the computing device Suddenly:
When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;
When said write multiplication factor is equal to or more than default threshold value, then answered when being write to said write operation unlatching System, by said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;
When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, And the file to be written in the caching is written in the virtual disk.
In order to be better understood from the present invention, reference picture 3, Fig. 3 is virtual disk write-in dress of the present invention based on copy-on-write Put the structural representation for the software runtime environment being related to, in the present embodiment, the above-mentioned virtual disk write-in dress based on copy-on-write Putting may include:Processor 1001, such as CPU, network interface 1004, user interface 1003, memory 1005, communication bus 1002.Wherein, communication bus 1002 is used to realize the connection communication between these components;User interface 1003 can include display Shield (Display), input block such as keyboard (Keyboard), optional user interface 1003 can also connect including the wired of standard Mouth, wave point;Network interface 1004 can optionally include wireline interface, the wave point (such as WI-FI interfaces) of standard;Deposit Reservoir 1005 can be high-speed RAM memory or stable memory (non-volatile memory), such as magnetic Disk storage;Memory 1005 optionally can also be the storage device independently of aforementioned processor 1001.
It will be understood by those skilled in the art that the structure shown in Fig. 3 is not formed to the above-mentioned void based on copy-on-write Intend the restriction of disk writing station, the device can include parts more more or less than diagram, or some parts of combination, or The different part arrangement of person.
As shown in figure 3, as in a kind of memory 1005 of computer-readable storage medium, operating system, network can be included Communication module, Subscriber Interface Module SIM and the virtual disk write-in program based on copy-on-write.
As shown in figure 3, network interface 1004 is mainly used in connecting background server, carrying out data with background server leads to Letter;User interface 1003 is mainly used in connecting client (user terminal), enters row data communication with client;And processor 1001 can For calling the virtual disk write-in program based on copy-on-write stored in memory 1005, and perform corresponding operation.
Wherein, should based on embodiment corresponding to the virtual disk writing station of copy-on-write with above-mentioned based on copy-on-write Each embodiment is essentially identical corresponding to virtual disk wiring method, therefore will not be repeated here.
The present invention also provides a kind of storage medium, and the virtual disk write-in based on copy-on-write is stored with the storage medium Program, the storage medium can be realized:Detecting that virtual disk has write operation, and the write-in multiplication factor of the write operation During equal to or more than default threshold value, then copy-on-write is opened to the write operation, will be to be written corresponding to the write operation File is temporarily written in the caching of virtual disk, rather than is write direct in virtual disk, when receiving store instruction, is just existed Continuous address space is distributed for the write operation in above-mentioned virtual disk, is then written to the file to be written in caching State in virtual disk.Because the present apparatus is when virtual disk produces multiple write operations, just write operation each time is opened and write When replicate, so as to be written into file write-in virtual disk in continuous address space, therefore can effectively control void Intend the write-in multiplication factor of disk, protect the write performance of virtual disk.
Specifically, the above-mentioned virtual disk write-in program based on copy-on-write realizes following steps when being executed by processor:
When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;
When said write multiplication factor is equal to or more than default threshold value, then answered when being write to said write operation unlatching System, by said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;
When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, And the file to be written in the caching is written in the virtual disk.
Wherein, embodiment corresponding to the storage medium is corresponding with the above-mentioned virtual disk wiring method based on copy-on-write Each embodiment is essentially identical, therefore will not be repeated here.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row His property includes, so that process, method, article or device including a series of elements not only include those key elements, and And also include the other element being not expressly set out, or also include for this process, method, article or device institute inherently Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this Other identical element also be present in the process of key element, method, article or device.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on such understanding, technical scheme is substantially done to prior art in other words Going out the part of contribution can be embodied in the form of software product, and the computer software product is stored in one as described above In storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions are make it that it is each that a station terminal equipment performs the present invention Method described in individual embodiment.
The preferred embodiments of the present invention are these are only, are not intended to limit the scope of the invention, it is every to utilize this hair The equivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skills Art field, is included within the scope of the present invention.

Claims (10)

  1. A kind of 1. virtual disk wiring method based on copy-on-write, it is characterised in that the virtual magnetic based on copy-on-write Disk wiring method includes:
    When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;
    When said write multiplication factor is equal to or more than default threshold value, then said write is operated and open copy-on-write, with By said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;
    When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, and will File to be written in the caching is written in the virtual disk.
  2. 2. the virtual disk wiring method based on copy-on-write as claimed in claim 1, it is characterised in that in the virtual magnetic Continuous address space is distributed for said write operation in disk, and the file to be written in the caching is written to described virtual Step in disk includes:
    It is that file to be written in the caching distributes continuous cluster in the virtual disk;
    File to be written in the caching is written in the continuous cluster, and updates the file to be written in the caching Virtual address offset.
  3. 3. the virtual disk wiring method based on copy-on-write as claimed in claim 2, it is characterised in that update the caching In file to be written virtual address offset the step of include:
    According to the top of file of the file to be written, the virtual address offset of the file to be written is indexed out;
    The virtual address offset of the file to be written in the caching is updated, and is discharged occupied in the virtual disk Cluster.
  4. 4. the virtual disk wiring method based on copy-on-write as claimed in claim 3, it is characterised in that release is described virtual In disk occupied cluster the step of include:
    Reference count corresponding to the occupied cluster is subtracted 1.
  5. 5. the virtual disk wiring method based on copy-on-write as described in claim 3 or 4, it is characterised in that in the void Intend distributing continuous address space in disk for said write operation, and the file to be written in the caching is written to described Step in virtual disk also includes:
    Head and the tail data segment corresponding to occupied cluster is read, and after being spliced with the file to be written in the caching simultaneously It is written in the virtual disk.
  6. A kind of 6. virtual disk writing station based on copy-on-write, it is characterised in that the virtual magnetic based on copy-on-write Disk writing station includes:Memory, processor and be stored on the memory and can run on the processor based on The virtual disk write-in program of copy-on-write, the virtual disk write-in program based on copy-on-write is by the computing device Shi Shixian following steps:
    When detecting that virtual disk has write operation, the write-in multiplication factor of detection said write operation;
    When said write multiplication factor is equal to or more than default threshold value, then said write is operated and open copy-on-write, with By said write operate corresponding to file to be written be temporarily written in the caching of virtual disk;
    When receiving store instruction, continuous address space is distributed for said write operation in the virtual disk, and will File to be written in the caching is written in the virtual disk.
  7. 7. the virtual disk writing station based on copy-on-write as claimed in claim 6, it is characterised in that described based on when writing When the virtual disk write-in program of duplication is by the computing device, following steps can also be realized:
    It is that the file to be written distributes continuous cluster in the virtual disk;
    File to be written in the caching is written in the continuous cluster, and updates the file to be written in the caching Virtual address offset.
  8. 8. the virtual disk writing station based on copy-on-write as claimed in claim 7, it is characterised in that described based on when writing When the virtual disk write-in program of duplication is by the computing device, following steps can also be realized:
    According to the top of file of the file to be written, the virtual address offset of the file to be written is indexed out;
    The virtual address offset of the file to be written in the caching is updated, and is discharged occupied in the virtual disk Cluster.
  9. 9. the virtual disk writing station based on copy-on-write as claimed in claim 8, it is characterised in that described based on when writing When the virtual disk write-in program of duplication is by the computing device, following steps can also be realized:
    Head and the tail data segment corresponding to occupied cluster is read, and after being spliced with the file to be written in the caching simultaneously It is written in the virtual disk.
  10. 10. a kind of storage medium, it is characterised in that the virtual disk write-in based on copy-on-write is stored with the storage medium Program, realized when the virtual disk write-in program based on copy-on-write is executed by processor as any in claim 1 to 5 Each step corresponding to the virtual disk wiring method based on copy-on-write described in one.
CN201710472651.4A 2017-06-20 2017-06-20 Virtual disk wiring method and device, storage medium based on copy-on-write Pending CN107861685A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710472651.4A CN107861685A (en) 2017-06-20 2017-06-20 Virtual disk wiring method and device, storage medium based on copy-on-write
PCT/CN2018/083778 WO2018233369A1 (en) 2017-06-20 2018-04-19 Copy-on-write based write method and device for virtual disk, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710472651.4A CN107861685A (en) 2017-06-20 2017-06-20 Virtual disk wiring method and device, storage medium based on copy-on-write

Publications (1)

Publication Number Publication Date
CN107861685A true CN107861685A (en) 2018-03-30

Family

ID=61699112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710472651.4A Pending CN107861685A (en) 2017-06-20 2017-06-20 Virtual disk wiring method and device, storage medium based on copy-on-write

Country Status (2)

Country Link
CN (1) CN107861685A (en)
WO (1) WO2018233369A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108845908A (en) * 2018-06-21 2018-11-20 郑州云海信息技术有限公司 A kind of SSD method for testing hard disk, device, equipment and medium
CN109086002A (en) * 2018-06-28 2018-12-25 平安科技(深圳)有限公司 Space management, device, computer installation and the storage medium of storage object
WO2018233369A1 (en) * 2017-06-20 2018-12-27 平安科技(深圳)有限公司 Copy-on-write based write method and device for virtual disk, and storage medium
CN109491620A (en) * 2018-11-23 2019-03-19 柏科数据技术(深圳)股份有限公司 Stored data rewrite method, apparatus, server and storage medium
WO2021223638A1 (en) * 2020-05-08 2021-11-11 安徽寒武纪信息科技有限公司 Data processing method and device, and related product
CN113867630A (en) * 2021-09-10 2021-12-31 长沙市致存科技有限责任公司 Data batch writing method and device of memory, terminal equipment and storage medium
CN115629716A (en) * 2022-12-07 2023-01-20 广东睿江云计算股份有限公司 Defragmentation method and defragmentation system based on disk mirror image file

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104503710A (en) * 2015-01-23 2015-04-08 福州瑞芯微电子有限公司 Method and device for increasing writing speed of nand flash
CN104765575A (en) * 2015-04-23 2015-07-08 成都博元时代软件有限公司 Information storage processing method
CN106020718A (en) * 2016-05-09 2016-10-12 福建联迪商用设备有限公司 A method and a system for improving virtual disk write-in performance
CN106201916A (en) * 2016-07-25 2016-12-07 中国人民解放军国防科学技术大学 A kind of nonvolatile cache mechanism towards SSD

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8239617B1 (en) * 2010-02-12 2012-08-07 Emc Corporation Enterprise data storage system using multi-level cell flash memory
US8848445B2 (en) * 2011-05-17 2014-09-30 Sandisk Technologies Inc. System and method for minimizing write amplification while maintaining sequential performance using logical group striping in a multi-bank system
CN104834607B (en) * 2015-05-19 2018-02-23 华中科技大学 A kind of hit rate for improving distributed caching and the method for reducing solid state hard disc abrasion
CN107861685A (en) * 2017-06-20 2018-03-30 平安科技(深圳)有限公司 Virtual disk wiring method and device, storage medium based on copy-on-write

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104503710A (en) * 2015-01-23 2015-04-08 福州瑞芯微电子有限公司 Method and device for increasing writing speed of nand flash
CN104765575A (en) * 2015-04-23 2015-07-08 成都博元时代软件有限公司 Information storage processing method
CN106020718A (en) * 2016-05-09 2016-10-12 福建联迪商用设备有限公司 A method and a system for improving virtual disk write-in performance
CN106201916A (en) * 2016-07-25 2016-12-07 中国人民解放军国防科学技术大学 A kind of nonvolatile cache mechanism towards SSD

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018233369A1 (en) * 2017-06-20 2018-12-27 平安科技(深圳)有限公司 Copy-on-write based write method and device for virtual disk, and storage medium
CN108845908A (en) * 2018-06-21 2018-11-20 郑州云海信息技术有限公司 A kind of SSD method for testing hard disk, device, equipment and medium
CN109086002A (en) * 2018-06-28 2018-12-25 平安科技(深圳)有限公司 Space management, device, computer installation and the storage medium of storage object
CN109491620A (en) * 2018-11-23 2019-03-19 柏科数据技术(深圳)股份有限公司 Stored data rewrite method, apparatus, server and storage medium
CN109491620B (en) * 2018-11-23 2020-08-14 柏科数据技术(深圳)股份有限公司 Storage data rewriting method, device, server and storage medium
WO2021223638A1 (en) * 2020-05-08 2021-11-11 安徽寒武纪信息科技有限公司 Data processing method and device, and related product
CN113867630A (en) * 2021-09-10 2021-12-31 长沙市致存科技有限责任公司 Data batch writing method and device of memory, terminal equipment and storage medium
CN115629716A (en) * 2022-12-07 2023-01-20 广东睿江云计算股份有限公司 Defragmentation method and defragmentation system based on disk mirror image file
CN115629716B (en) * 2022-12-07 2023-04-11 广东睿江云计算股份有限公司 Defragmentation method and defragmentation system based on disk mirror image file

Also Published As

Publication number Publication date
WO2018233369A1 (en) 2018-12-27

Similar Documents

Publication Publication Date Title
CN107861685A (en) Virtual disk wiring method and device, storage medium based on copy-on-write
CN106843755B (en) Data balancing method and device for server cluster
CN108737325A (en) A kind of multi-tenant data partition method, apparatus and system
US20160140054A1 (en) Method and system for determining fifo cache size
CN107766374B (en) Optimization method and system for storage and reading of massive small files
CN109684231A (en) The system and method for dsc data in solid-state disk and stream for identification
CN110399333B (en) Method, apparatus and computer program product for deleting snapshots
CN103150267B (en) Cache synchronization method among multiple controllers
CN115168259B (en) Data access method, device, equipment and computer readable storage medium
CN106817388A (en) The system that virtual machine, host obtain the method, device and access data of data
CN110413413A (en) A kind of method for writing data, device, equipment and storage medium
CN112463058B (en) Fragmented data sorting method and device and storage node
CN109471843A (en) A kind of metadata cache method, system and relevant apparatus
CN115048254B (en) Simulation test method, system, equipment and readable medium for data distribution strategy
CN104969167B (en) Control device and control method
CN112835528A (en) Dirty page refreshing method and device, electronic equipment and storage medium
CN107168891A (en) A kind of I/O characteristic recognition methods and device
CN103229150B (en) data control method and system
US8239427B2 (en) Disk layout method for object-based storage devices
CN107329904A (en) Method for reading data and device
CN114238249B (en) File system aging evaluation method and device, storage medium and terminal
CN107133183B (en) Cache data access method and system based on TCMU virtual block device
CN108287760A (en) Terminal equipment control method and device, terminal device and computer readable storage medium
CN112181870B (en) Memory page management method, device and equipment and readable storage medium
CN103955432B (en) The method and device of data storage

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180330