CN104238962A - Method and device for writing data into cache - Google Patents

Method and device for writing data into cache Download PDF

Info

Publication number
CN104238962A
CN104238962A CN201410471711.7A CN201410471711A CN104238962A CN 104238962 A CN104238962 A CN 104238962A CN 201410471711 A CN201410471711 A CN 201410471711A CN 104238962 A CN104238962 A CN 104238962A
Authority
CN
China
Prior art keywords
metadata
free block
queue
block
data
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
CN201410471711.7A
Other languages
Chinese (zh)
Other versions
CN104238962B (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.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201410471711.7A priority Critical patent/CN104238962B/en
Publication of CN104238962A publication Critical patent/CN104238962A/en
Priority to PCT/CN2015/083383 priority patent/WO2016041401A1/en
Application granted granted Critical
Publication of CN104238962B publication Critical patent/CN104238962B/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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems

Landscapes

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

Abstract

The embodiment of the invention relates to a method and a device for writing data into a cache. The method comprises the following steps: receiving a writing IO request command, wherein the command comprises metadata of data to be written; acquiring a first metadata set, and judging whether remaining free blocks exist in the first metadata set or not; if so, writing the metadata of the data to be written into one of the remaining free blocks, and writing the metadata of the data to be written into metadata blocks which correspond to the first metadata set; otherwise, judging whether remaining free blocks exist in a second metadata set or not, acquiring the second metadata set if the remaining free blocks exist in the second metadata set, and writing the metadata of the data to be written into one of the remaining free blocks of the second metadata set; writing the metadata of the data to be written into metadata blocks which correspond to the second metadata set. By adopting the method and the device, the problem of influence on the service life of Flash due to frequent writing of the metadata into the Flash can be solved.

Description

Method and the device of data is write in buffer memory
Technical field
The present invention relates to field of data storage, particularly relate to a kind of in buffer memory, write data method and device.
Background technology
In the industry cycle in existing read-write cache (Cache), the storage medium of general employing is all based on nonvolatile memory (A Non-Volatile Dual In-line Memory Module, or nonvolatile random access memory (Non-Volatile Random Access Memory NVDIMM), NVRAM), but based on the said equipment, the capacity writing Cache is usually smaller, is difficult to the scene tackling a large amount of random write pressure.
In prior art, adopt flash memory (Flash) equipment as Cache.Owing to will ensure the security of data, write request all needs the IO of 2 times each time, is once write data IO, and metadata IO is write in another time.And the life-span of Flash is directly related with the number of times write, such as, multi-layered unit flash memory (Multi-Level Cell, MLC) only has about 5000-10000 time usually.And the size of metadata is generally between 30B-64B, if each metadata is according to the direct IO of the size of metadata, then can not give full play to the performance of Flash, if IO under the size that metadata is alignd according to 4K, then may there is the problem writing amplification, can affect greatly the life-span of whole Flash.
Summary of the invention
Embodiments provide a kind of in buffer memory, write data method and device, can solve and frequently in Flash, write metadata, and affect the problem in the life-span of Flash.
First aspect, provide a kind of method writing data in buffer memory Cache, the storage area of the flash memory Flash of described Cache comprises multiple storage block chunk, a described chunk comprises a chunk meta-data region and a chunk data field, a described chunk meta-data region comprises at least one meta data block, a described chunk data field comprises at least one data field corresponding with at least one meta data block described, described meta data block comprises multiple metadata, described data field comprises multiple data block, described meta data block and described data field one_to_one corresponding, described metadata and described data block one_to_one corresponding, described method comprises:
Receive the order of write I/O request, the order of said write I/O request comprises the metadata of data to be written;
Obtaining the current set of metadata processed is the first set of metadata, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory;
Judge whether there is residue free block in described first set of metadata;
When there being residue free block in described first set of metadata, then to the metadata of the described data to be written of free block write in described residue free block, and in the meta data block corresponding with described first set of metadata, write the metadata of described data to be written;
When not remaining free block in described first set of metadata, then judge whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata;
The metadata of described data to be written is write in the meta data block corresponding with described second set of metadata.
In conjunction with first aspect, in the first implementation of first aspect, the number of the free block comprised in described set of metadata calculates according to the size of the size of described meta data block and metadata corresponding to described data block.
In conjunction with first aspect, in the second implementation of first aspect, the free block comprised in described set of metadata is continuously arranged by address.
In conjunction with first aspect, in the third implementation of first aspect, the number of the free block comprised in described set of metadata is recorded in the multi-queue of internal memory, and wherein, in described multi-queue, the number of the free block that the second set of metadata of individual queue record comprises is not identical.
In conjunction with the third implementation of first aspect, in the 4th kind of implementation of first aspect, according to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
Described judge the second set of metadata whether have residue free block comprise:
According to the total number of the free block that each second set of metadata of individual queue record comprises, judge whether the second set of metadata has residue free block.
In conjunction with any one implementation in above-mentioned four kinds of implementations of first aspect or first aspect, in the 5th kind of implementation of first aspect, after the order of described reception write I/O request, before the current set of metadata processed of described acquisition is the first set of metadata, described method also comprises:
According to the size of described data block, judge whether to need to split the order of said write I/O request;
If desired split, then according to the size of described data block, the order of said write I/O request is split, obtain multiple first write I/O request order;
To described multiple first write I/O request order, judge whether the metadata of the data to be written that each the first write I/O request order comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
In conjunction with the 4th kind of implementation of first aspect, in the 6th kind of implementation of first aspect, when multiple second set of metadata of queue record arbitrary in described multi-queue, then the number of the free block comprised according to described second set of metadata, arranges described multiple second set of metadata.
In conjunction with the third implementation of first aspect, in the 7th kind of implementation of first aspect, described method also comprises:
Receive and reclaim metadata instructions, described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled;
According to the address of described free block, obtain the set of metadata belonging to described free block;
If described set of metadata is the first set of metadata, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata;
If described set of metadata is the second set of metadata, then judge whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then from the queue of recording described second set of metadata, delete described second set of metadata, after described free block is added described second set of metadata, described second set of metadata is recorded in other queue of multi-queue, if not, then described free block is added in described second set of metadata.
In conjunction with the 7th kind of implementation of first aspect, in the 8th kind of implementation of first aspect, described other queue described second set of metadata being recorded to multi-queue comprises:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue.
In conjunction with the 7th kind or the 8th kind of implementation of first aspect, in the 9th kind of implementation of first aspect, described method also comprises:
From the queue of recording described second set of metadata, delete described second set of metadata described, after described free block is added described second set of metadata, after described second set of metadata being recorded in other queue of multi-queue, described method also comprises:
The total number of the free block recorded in the queue of more the second set of metadata described in new record, and the total number upgrading the free block recorded in the queue that described second set of metadata adds.
Second aspect, embodiments provide a kind of device writing data in buffer memory Cache, the storage area of the flash memory Flash of described device comprises multiple storage block chunk, a described chunk comprises a chunk meta-data region and a chunk data field, a described chunk meta-data region comprises at least one meta data block, a described chunk data field comprises at least one data field corresponding with at least one meta data block described, described meta data block comprises multiple metadata, described data field comprises multiple data block, described meta data block and described data field one_to_one corresponding, described metadata and described data block one_to_one corresponding, described device comprises: receiving element, first acquiring unit, judging unit, first writing unit, second acquisition unit and the second writing unit,
Described receiving element, for receiving the order of write I/O request, the order of said write I/O request comprises the metadata of data to be written;
Described first acquiring unit is the first set of metadata for obtaining the current set of metadata processed, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory;
Described judging unit, for judging whether there is residue free block in described first set of metadata that described first acquiring unit obtains;
Described first writing unit, during for judging there is residue free block in described first set of metadata when described judging unit, then to the metadata of the described data to be written of free block write in described residue free block, and in the meta data block corresponding with described first set of metadata, write the metadata of described data to be written;
Described second acquisition unit, during for judging when described judging unit not remain free block in described first set of metadata, then judge whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata;
Described second writing unit, for writing the metadata of described data to be written in the meta data block corresponding with described second set of metadata.
In conjunction with second aspect, in the first implementation of second aspect, the number of the free block comprised in described set of metadata calculates according to the size of the size of described meta data block and metadata corresponding to described data block.
In conjunction with second aspect, in the second implementation of second aspect, the free block comprised in described set of metadata is continuously arranged by address.
In conjunction with second aspect, in the third implementation of second aspect, the number of the free block comprised in described set of metadata is recorded in the multi-queue of internal memory, and wherein, in described multi-queue, the number of the free block that the second set of metadata of individual queue record comprises is not identical.
In conjunction with the third implementation of second aspect, in the 4th kind of implementation of second aspect, described device also comprises: record cell, for the number of free block comprised according to described second set of metadata, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
Described second acquisition unit specifically for: according to the total number of the free block that each second set of metadata of individual queue record comprises, judge whether the second set of metadata has residue free block.
In conjunction with any one implementation in above-mentioned four kinds of implementations of second aspect or second aspect, in the 5th kind of implementation of second aspect, device also comprises: split cells;
Described judging unit, also for the size according to described data block, judges whether to need to split the order of said write I/O request;
Described split cells, if judge that needs split for described judging unit, then according to the size of described data block, splits the order of said write I/O request, obtains multiple first write I/O request order;
Described judging unit, described multiple first write I/O request orders also for obtaining described split cells, judge whether the metadata of the data to be written that each the first write I/O request order comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
In conjunction with the 4th kind of implementation of second aspect, in the 6th kind of implementation of second aspect, described device also comprises: arrangement units, for when multiple second set of metadata of queue record arbitrary in described multi-queue, the number of the free block then comprised according to described second set of metadata, arranges described multiple second set of metadata.
In conjunction with the third implementation of second aspect, in the 7th kind of implementation of second aspect, add unit;
Described receiving element, also for receiving recovery metadata instructions, described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled;
Described first acquiring unit, the address of described free block also for receiving according to described receiving element, obtains the set of metadata belonging to described free block;
Describedly add unit, if the described set of metadata obtained for described first acquiring unit is the first set of metadata, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata;
Described judging unit, if the described set of metadata also obtained for described first acquiring unit is the second set of metadata, then judge whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then from the queue of recording described second set of metadata, delete described second set of metadata, after described free block is added described second set of metadata, described second set of metadata is recorded in other queue of multi-queue, if not, then described free block is added in described second set of metadata.
In conjunction with the 7th kind of implementation of second aspect, in the 8th kind of implementation of second aspect, described judging unit specifically for:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue.
In conjunction with the 7th kind or the 8th kind of implementation of second aspect, in the 9th kind of implementation of second aspect, described device also comprises: updating block, for the total number of free block recorded in the queue of more the second set of metadata described in new record, and upgrade the total number of the free block recorded in the queue that described second set of metadata adds.
In buffer memory, write data method and device that the embodiment of the present invention provides.By the free block in set of metadata record internal memory, when receiving write I/O request order, free block is obtained from above-mentioned set of metadata, and the metadata of the data to be written order of above-mentioned write I/O request comprised writes in the free block got, thus the merging probability of metadata can be increased, and then can solve and frequently in Flash, write metadata, cause writing amplification, and affect the problem in the life-span of Flash.
Accompanying drawing explanation
Fig. 1 is a kind of data layout schematic diagram of Flash provided by the invention;
Fig. 2 is the another kind of data layout schematic diagram of Flash provided by the invention;
Fig. 3 is metadata provided by the invention a kind of relation schematic diagram of the position of actual persistence in position and Flash in internal memory;
The method flow diagram writing data in Cache that Fig. 4 provides for the embodiment of the present invention one;
Fig. 5 is the relation schematic diagram of multi-queue and the second set of metadata;
The device schematic diagram writing data in Cache that Fig. 6 provides for the embodiment of the present invention two;
The structural representation of the calculating storage all-in-one that Fig. 7 provides for the embodiment of the present invention.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
For ease of the understanding to the embodiment of the present invention, be further explained explanation below in conjunction with accompanying drawing with specific embodiment, embodiment does not form the restriction to the embodiment of the present invention.
Fig. 1 is a kind of data layout schematic diagram of Flash provided by the invention.As shown in Figure 1, the storage area of Flash can comprise superblock, meta-data region and data field three part.
Superblock, for storing the global data in Cache, mainly for the data needed when system is delayed and recovered after machine.Wherein, this global data can comprise the size of meta data block, the size etc. of data block.
Metadata (metadata), safeguards the data of the data block in storage system, and for describing the relation with organising data block, its size determines according to the data structure size defined in system.
Meta-data region, refers to the region for storing metadata.
Data field, for storing real data in Cache, can comprise multiple data block under it.
Fig. 2 is the another kind of data layout schematic diagram of Flash provided by the invention.As shown in Figure 2, Flash comprises superblock and multiple storage block (chunk), each chunk comprises a chunk meta-data region and a chunk data field, each chunk meta-data region comprises one or more meta data block, and each chunk data field comprises data field corresponding to meta data block one or more with this.Meta data block one_to_one corresponding under the chunk meta-data region that data field under each chunk data field is corresponding with it.Meta data block safeguards a corresponding data field, particularly, comprises multiple metadata under each meta-data region, and each metadata corresponds to a data block under data field.
In Fig. 2, although contain 4 meta data block in 1 chunk meta-data region, not representing that 1 chunk meta-data region can only comprise 4 meta data block, can also be 1,2 or other numerical value.Same, the number of the chunk shown in Fig. 2, in chunk data field, in the number of data field, meta-data region, in the number of metadata, data field, the number of data block is all not limited to the numerical value shown in Fig. 2.
Each data field corresponds to a different meta data block, and the data block corresponding to metadata in a meta data block forms a data field.That is, a data field comprises the data corresponding to metadata of a meta data block size, and the size of a data field is decided by the number of metadata in a meta data block and the size of a data block.
In Flash, the size of a page write is 4K.Therefore, a kind of preferred scheme, the size of a meta data block is 4K.Might as well suppose that the size of a metadata is 32B, the size of a data block is 16K, then the size of a data field is 2M (16K* (4K/32B)).
It should be noted that, a chunk meta-data region may comprise one or more meta data block, and the size of a chunk meta-data region is variable.A kind of preferred scheme, can, using the size of the size of a data block as a chunk meta-data region, like this, can make, when Flash loads initialization, to divide according to the storage area of size to Flash of data block.Such as, the size of a data block is 4K, then the size of a chunk meta-data region is also 4K, and the number of its meta data block is 1 (4K/4K).Again such as, the size of a data block is 16K, then the size of a chunk meta-data region is also 16K, and the number of its meta data block is 4 (16K/4K).The size of data block can by operating system or storage device configuration, and its size can be 4K, 8K, 16K, 32K or 64K etc., and this is not restricted for the embodiment of the present invention.
Certainly, the size of data block also can with the varying in size of chunk meta-data region.Such as, the size of data block can also be 512B, 1K, 2K etc., and at least comprises 1 meta data block in chunk meta-data region, obviously large than a data block.
Again such as, when the size of data block is 8K, 16K, 32K or 64K etc., the size of chunk meta-data region also can be also less than the size of data block, only includes 1 meta data block in such as chunk meta-data region.
Fig. 3 is metadata provided by the invention a kind of relation schematic diagram of the position of actual persistence in position and Flash in internal memory.In Fig. 3, a data structure p_head array can be designed in internal memory, store the metadata that in data field, each data block is corresponding.Might as well suppose that the size of the metadata required for each data block is 64 bytes, so p_head array can be divided into one group according to 64 (4K/64B=64) metadata.
In internal memory, metadata corresponds to an element of p_head array, its data structure flashcache_wbhead and implication as follows:
As shown in Figure 3, also can design a data structure metadata_head array in internal memory, be maintained in the relation of the metadata of data in EMS memory and the memory location (namely corresponding meta data block) of the reality of these metadata in actual persistence equipment (Flash).
The set of metadata that a metadata in Flash is corresponding in internal memory, corresponding to the element of in metadata_head array, its data structure metadata_head and implication can be as follows:
As shown in Figure 3, store the metadata information of a data block by flashCache_wbhead in internal memory, store again the information of same group metadata (i.e. a meta data block) by metadata_head, writing according to meta data block when writing to facilitate.
The method flow diagram writing data in Cache that Fig. 4 provides for the embodiment of the present invention one.The executive agent of described method can be buffer storage, and this buffer storage comprises flash memory Falsh.
Below, the method for data structure to Fig. 4 of composition graphs 3 and metadata, meta data block is described.Certain Fig. 4 also can be applicable to other Flash data layout type comprising multiple meta-data region, and this is not restricted for the embodiment of the present invention.
S410, receive the order of write I/O request, the order of said write I/O request comprises the metadata of data to be written.
Alternatively, after the order of reception write I/O request, described method can also comprise the steps:
According to the size of described data block, judge whether to need to split the order of said write I/O request;
If desired split, then according to the size of described data block, the order of said write I/O request is split, obtain multiple first write I/O request order;
To described multiple first write I/O request order, judge whether the metadata of the data to be written that each the first write I/O request order comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
Particularly, buffer storage obtains the size of the data block in Flash in advance, and for example, the size of the data block got can be 16K.After receiving the order of write I/O request, suppose that the size of this write I/O request order is 32K (2 times of data block), then need to split the order of above-mentioned write I/O request.When splitting, when the skew of this write I/O request order is 0, then above-mentioned I/O request order is split as the order of two first write I/O request, wherein, the size of each first write I/O request order is 16K; When the skew of this write I/O request order is not 0, then above-mentioned I/O request order is split as the order of three first write I/O request.This step can ensure the size of buffer storage to writing data blocks in Flash and the data block size unification mutually of Flash inside, thus can improve the efficiency writing data in Flash.
It should be noted that, judge in step S410 that the step whether metadata of the data to be written that described multiple first write I/O request order comprises has been buffered in described internal memory can with reference to existing techniques in realizing, the embodiment of the present invention does not repeat at this.
S420, obtaining the current set of metadata processed is the first set of metadata, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory.
It should be noted that, can obtain in advance in internal memory and be used for total size of the storage space storing metadata corresponding to data block, and obtain the size of metadata corresponding to data block in Flash, then by the size of total size of storage space divided by metadata corresponding to data block, total number of free block in internal memory can just be obtained.Be understandable that, the size of free block is the size of metadata.In addition, set of metadata corresponds to the meta data block in Flash, the number then comprising free block in set of metadata can calculate according to the size of the size of meta data block in Flash and metadata corresponding to data block, for example, the size of meta data block is 4K, the size of the metadata that data block is corresponding is 64B, then the number that set of metadata comprises free block is 4K/64B=64, and namely a set of metadata can comprise 64 free blocks.Alternatively, the free block comprised in set of metadata is continuously arranged by address.Wherein, each free block is for storing the metadata of data to be written.Illustrate at this, the metadata that the size of the metadata of data to be written is corresponding with data block in Flash in the same size.
This illustrate, buffer storage using the current set of metadata processed as the first set of metadata, and using current not process set of metadata as the second set of metadata.Be understandable that, when buffer storage processes the first set of metadata, and when starting to process the second set of metadata, then this second set of metadata is as the first set of metadata.Namely above-mentioned title be only used to distinguish set of metadata whether process.S430, judges whether there is residue free block in described first set of metadata.
Illustrate at this, because free block is the metadata for storing data to be written, therefore after the order of buffer storage process multiple write I/O request, in the first set of metadata, the number of free block will reduce accordingly.As in previous example, can comprise 64 free blocks in a set of metadata, when buffer storage writes 64 metadata in this set of metadata, then this set of metadata no longer includes residue free block.Therefore, when buffer storage writes metadata in free block at every turn, need to judge whether the first set of metadata has residue free block.Particularly, residue free block can have been judged whether by the metadata_head corresponding according to the first set of metadata.
S440, when there being residue free block in described first set of metadata, then to the metadata of the described data to be written of free block write in described residue free block, and in the meta data block corresponding with described first set of metadata, write the metadata of described data to be written.
It should be noted that, metadata_head that can be corresponding according to the first set of metadata, obtain the meta data block that the first set of metadata is corresponding in Flash, and in this data block, write the metadata of above-mentioned data to be written.
Alternatively, before write the metadata of described data to be written in the meta data block corresponding with described first set of metadata, described method can also comprise:
Buffer storage judges whether to process and completes the first all write I/O request orders, if do not have process to complete, then continues the process other the first write I/O request order being made to S420-S440; If processed, then judge whether these write I/O request orders can merge, if can merge, then according to the I/O request order after merging, in Flash, write data.In the present invention, every second priority obtains free block from the first set of metadata, address due to the free block obtained from same group is all continuous print, can increase the merging probability of write I/O request order thus, thus can reduce the number of times writing data in Flash.
It should be noted that, judge whether the order of write I/O request can merge and with reference to existing techniques in realizing, can not repeat at this.
S450, when not remaining free block in described first set of metadata, then judge whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata.
Particularly, by multi-queue, the second set of metadata is managed, the relation schematic diagram of multi-queue shown in Figure 5 and the second set of metadata.In Fig. 5, data structure multi_q_node and the implication of multi-queue are as follows:
Alternatively, described method can also comprise: according to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
Wherein, described judge the second set of metadata whether have residue free block comprise:
According to the total number of the free block that each second set of metadata of individual queue record comprises, judge whether the second set of metadata has residue free block.
It should be noted that, according to the data structure invalid_q_type of the type of queue, in multi-queue, the type of individual queue is different, the number only recording free block as first queue is less than or equal to second set of metadata of 8, the number that free block is only recorded in second queue is greater than the second set of metadata that 8 are less than or equal to 16, such the like.Therefore, if when the number of free block that the second set of metadata comprises is 4, then this second set of metadata is recorded in first queue.In addition, the total number of the free block each second set of metadata comprised also is needed to be recorded in corresponding queue, for example, if, first queue record, 5 the second set of metadata, each second set of metadata contains 4,3,2,1 and 1 free blocks respectively, then need 11 (4+3+2+1+1) to be recorded in the total_num of first queue.When buffer storage judge the second set of metadata whether have residue free block time, then judge according to the total_numl of individual queue record in multi-queue.
Particularly, see Fig. 5, corresponding second set of metadata of each metadata_head, multi-queue comprises 5 queues, wherein, in the first two queue, have recorded the second set of metadata, and the number that free block is only recorded in the first queue is less than or equal to second set of metadata of 4.As in Fig. 5, second set of metadata of the first queue record contains 4,3,2,1 and 1 free blocks respectively, the total number of the free block finally each second set of metadata comprised is recorded in the first queue, as, be recorded in the total_num of first queue, be also about to 11 and be recorded in the total_num of the first queue; In like manner, the second set of metadata that the number that free block is only recorded in second queue is greater than 4, second set of metadata of the second queue record contains 7,6,5,5 and 5 free blocks respectively, the total number of the free block finally the second set of metadata each in second queue comprised also is recorded in the second queue, is also about to 28 (7+6+5+5+5) and is recorded in the total_num of second queue.Alternatively, when recording multiple described second set of metadata in arbitrary queue of described multi-queue, then the number of the free block comprised according to described second set of metadata, arranges described second set of metadata.
See Fig. 5, the second set of metadata is have recorded in the first two queue, first queue record, 5 the second set of metadata, each second set of metadata contains 4,3,2,1 and 1 free blocks respectively, and each second set of metadata in first queue is arranged in order according to the number of each self-contained free block.Particularly, each second set of metadata in the first queue is arranged in order from big to small according to the number of the free block comprised.Second queue record, 5 the second set of metadata, each second set of metadata contains 7,6,5,5 and 5 free blocks respectively, and each second set of metadata in second queue is arranged in order according to the number of each self-contained free block, be also that each second set of metadata in the second queue is also arranged in order from big to small according to the number of the free block comprised.
Preferably, when judging whether there is residue free block in the second set of metadata, buffer storage preferentially judges the total_num in the queue that the scope of the number recording free block in multi-queue is maximum, if its value is 0, judge the total_num in the secondary large queue of the scope of the number recording free block in multi-queue again, such the like; If be not 0, then obtain the second set of metadata that the number that comprises free block in this queue is maximum, as in previous example, each second set of metadata in individual queue is arranged in order according to the number of each self-contained free block, therefore obtains first the second set of metadata in this queue.As in Fig. 5, first judge the total_num of second queue, this value is 28 is not 0, then obtain first the second set of metadata in this queue, 7 free blocks are comprised in this second set of metadata, this second set of metadata is deleted from above-mentioned queue simultaneously, upgrade the total_num of above-mentioned queue simultaneously, the total_num=total_num-5 after also namely upgrading.
It should be noted that, when judging that in multi-queue, the total_num of individual queue is 0, then buffer storage does not process the order of write I/O request, this write I/O request order is joined in waiting list, when there being residue free block in the second set of metadata, then the order of above-mentioned write I/O request is processed.
For above-mentioned the second set of metadata got, comprise 7 free blocks, from these 7 free blocks, win a free block, then the residue free block that above-mentioned second set of metadata comprises is 6, and writes the metadata of described data to be written in the above-mentioned free block won.
S460, writes the metadata of described data to be written in the meta data block corresponding with described second set of metadata.
Alternatively, before S460, described method can also comprise: buffer storage completes the first all write I/O request orders by judging whether to process, if do not have process to complete, then continues the process other the first write I/O request order being made to S420-S450; If processed, then judge whether these write I/O request orders can merge, if can merge, then according to the write I/O request order after merging, in Flash, write data.In the present invention, every second priority obtains free block from the first set of metadata, address due to the free block obtained from same group is all continuous print, can increase the merging probability of write I/O request order thus, thus can reduce the number of times writing data in Flash.
The method writing data in buffer memory that the embodiment of the present invention provides, by the free block in set of metadata record internal memory, when receiving write I/O request order, free block is obtained from above-mentioned set of metadata, and the metadata of the data to be written order of above-mentioned write I/O request comprised writes in the free block got, thus the merging probability of metadata can be increased, and then can solve and frequently in Flash, write metadata, and affect the problem in the life-span of Flash.
To the free block got by said method, when the metadata writing this free block is invalid metadata, then buffer storage needs this free block to be recovered in internal memory, particularly, is rejoined in the set of metadata belonging to it by this free block.Wherein, the step reclaiming free block can comprise:
Receive and reclaim metadata instructions, described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled;
According to the address of described free block, obtain the set of metadata belonging to described free block;
If described set of metadata is the first set of metadata, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata;
If described set of metadata is the second set of metadata, then judge whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then from the queue of recording described second set of metadata, delete described second set of metadata, after described free block is added described second set of metadata, described second set of metadata is recorded in other queue of multi-queue, if not, then described free block is added in described second set of metadata.
Particularly, described other queue described second set of metadata being recorded to multi-queue comprises:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue.It should be noted that, judge whether free block number that described second set of metadata comprises is greater than the step of Second Threshold, is the number in order to ensure the free block that can comprise according to the second set of metadata, the second set of metadata is recorded in corresponding queue.Such as, suppose in multi-queue, there are two queues, the number that free block is only recorded in first queue is less than or equal to second set of metadata of 8, and the second set of metadata that the number of the second queue record free block is greater than 8, and the number supposing the free block that a certain second set of metadata comprises when starting is 8, then this second set of metadata is recorded in the first queue, when this second set of metadata is recovered to a free block, the number of the free block that this second set of metadata comprises is 9, does not meet the number of the free block of the second set of metadata of first team's row record.Therefore, need this second set of metadata to be recorded in the second queue.
Alternatively, from the queue of recording described second set of metadata, described second set of metadata is deleted described, after described free block is added described second set of metadata, after described second set of metadata being recorded in other queue of multi-queue, described method also comprises:
The total number of the free block recorded in the queue of more the second set of metadata described in new record, and the total number upgrading the free block recorded in the queue that described second set of metadata adds.
As in previous example, upgrading the total_num of the first queue, is also the total_num=total_num-8 after the first queue upgrades; Upgrade the total_num of the second queue, be also the total_num=total_num+8+1 after the second queue upgrades simultaneously; Wherein, 1 is the free block that above-mentioned second set of metadata newly reclaims.
By the step of above-mentioned recovery free block, can the free block of recovery be recovered in the set of metadata belonging to it, thus can ensure by method of the present invention, when obtaining free block, the address of the free block got is continuous print, the merging probability of metadata can be increased thus, and then can solve and frequently in Flash, write metadata, and affect the problem in the life-span of Flash.
The method embodiments provided, pass through metadata management, merge in conjunction with metadata, greatly increase the probability that metadata merges, thus minimizing metadata IO that can be a large amount of, to providing the effect that the performance of system is specifically great, build the number of times writing IO simultaneously, a large amount of minimizings because the operation IO of metadata, the effect specifically great to the life-span of improving FLASH card.
For the IO of bulk, by metadata management, the IO as far as possible to bulk, the position of free block in physical card distributed also connects together as far as possible, the effect brought like this, can pass through WriteV interface, several IO be carried out merging and writes, in the scene of bulk, the number of times of minimizing IO that can be a large amount of, can reduce the utilization factor of the CPU of system, greatly by the test of reality, in the scene of bulk, the utilization factor of CPU can reduce 20-30%.
Due to when distribution free block, the physical location of IO connects together as far as possible, so when brush, in bulk scene, or in the scene of order IO, falls the effect increasing greatly and read to merge; Also a large amount of minimizings the request of IO can be read, very large to the utilization factor effect reducing CPU.
The device schematic diagram writing data in Cache that Fig. 6 provides for the embodiment of the present invention two.Described device is for performing the method described in Fig. 4.In Fig. 6, the storage area of the flash memory Flash of this device comprises multiple storage block chunk, a described chunk comprises a chunk meta-data region and a chunk data field, a described chunk meta-data region comprises at least one meta data block, a described chunk data field comprises at least one data field corresponding with at least one meta data block described, described meta data block comprises multiple metadata, described data field comprises multiple data block, described meta data block and described data field one_to_one corresponding, described metadata and described data block one_to_one corresponding, comprise: receiving element 601, first acquiring unit 602, judging unit 603, first writing unit 604, second acquisition unit 605 and the second writing unit 606.
Receiving element 601, for receiving the order of write I/O request, the order of said write I/O request comprises the metadata of data to be written.
First acquiring unit 602 is the first set of metadata for obtaining the current set of metadata processed, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory.
Judging unit 603, for judging whether there is residue free block in described first set of metadata that the first acquiring unit 602 obtains.
First writing unit 604, during for judging there is residue free block in described first set of metadata when judging unit 603, then to the metadata of the described data to be written of free block write in described residue free block, and in the meta data block corresponding with described first set of metadata, write the metadata of described data to be written.
Second acquisition unit 605, during for judging when judging unit 603 not remain free block in described first set of metadata, then judge whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata.
Second writing unit 606, for writing the metadata of described data to be written in the meta data block corresponding with described second set of metadata.
Alternatively, the number of the free block comprised in described set of metadata calculates according to the size of the size of described meta data block and metadata corresponding to described data block.
Alternatively, the free block comprised in described set of metadata is continuously arranged by address.
Alternatively, in described multi-queue, the number of the free block that the second set of metadata of individual queue record comprises is not identical.
Alternatively, described device also comprises: record cell 607, for the number of free block comprised according to described second set of metadata, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
Second acquisition unit 605 specifically for: according to the total number of the free block that each second set of metadata of individual queue record comprises, judge whether the second set of metadata has residue free block.
Alternatively, device also comprises: split cells 608.
Judging unit 603, also for the size according to described data block, judges whether to need to split the order of said write I/O request.
Split cells 608, if judge that needs split for judging unit 603, then according to the size of described data block, splits the order of said write I/O request, obtains multiple first write I/O request order.
Judging unit 603, described multiple first write I/O request orders also for obtaining split cells 608, judge whether the metadata of the data to be written that each the first write I/O request order described comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
Alternatively, described device also comprises: arrangement units 609, and for when multiple second set of metadata of queue record arbitrary in described multi-queue, then the number of the free block comprised according to described second set of metadata, arranges described multiple second set of metadata.
Alternatively, described device also comprises: add unit 610.
Receiving element 601, also for receiving recovery metadata instructions, described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled.
First acquiring unit 602, the address of described free block also for receiving according to receiving element 601, obtains the set of metadata belonging to described free block.
Add unit 610, if be the first set of metadata for the described set of metadata of the first acquiring unit 602 acquisition, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata.
Judging unit 603, if the described set of metadata also obtained for the first acquiring unit 602 is the second set of metadata, then judge whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then from the queue of recording described second set of metadata, delete described second set of metadata, after described free block is added described second set of metadata, described second set of metadata is recorded in other queue of multi-queue, if not, then described free block is added in described second set of metadata.
Alternatively, judging unit 603 specifically for:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue.
Alternatively, described device also comprises: updating block 611, for the total number of free block recorded in the queue of more the second set of metadata described in new record, and upgrades the total number of the free block recorded in the queue that described second set of metadata adds.
The device writing data in buffer memory that the embodiment of the present invention provides, by the free block in set of metadata record internal memory, when receiving write I/O request order, free block is obtained from above-mentioned set of metadata, and the metadata of the data to be written order of above-mentioned write I/O request comprised writes in the free block got, thus the merging probability of metadata can be increased, and then can solve and frequently in Flash, write metadata, and affect the problem in the life-span of Flash.
Accordingly, the embodiment of the present invention additionally provides a kind of calculating and stores all-in-one, as shown in Figure 7, comprises the cache (in figure, Flash 701 being only shown), internal memory 702 and the processor 703 that use flash memory Flash 701.
The storage area of flash memory Flash 701 comprises multiple storage block chunk, a described chunk comprises a chunk meta-data region and a chunk data field, a described chunk meta-data region comprises at least one meta data block, a described chunk data field comprises at least one data field corresponding with at least one meta data block described, described meta data block comprises multiple metadata, described data field comprises multiple data block, described meta data block and described data field one_to_one corresponding, described metadata and described data block one_to_one corresponding.
Processor 703 receives the order of write I/O request, and the order of said write I/O request comprises the metadata of data to be written;
It is the first set of metadata that processor 703 obtains the current set of metadata processed, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory 702;
Processor 703 judges whether there is residue free block in described first set of metadata;
When there being residue free block in described first set of metadata, processor 703 to the metadata of the described data to be written of free block write in described residue free block, and writes the metadata of described data to be written in the meta data block corresponding with described first set of metadata;
When not remaining free block in described first set of metadata, processor 703 judges whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata;
Processor 703 writes the metadata of described data to be written in the meta data block corresponding with described second set of metadata.
Further, to be processor 703 calculate according to the size of the size of described meta data block and metadata corresponding to described data block for the number of the free block comprised in described set of metadata.
Further, the free block comprised in described set of metadata is continuously arranged by address.
Further, the number of the free block comprised in described set of metadata is recorded in the multi-queue of internal memory 702, and wherein, in described multi-queue, the number of the free block that the second set of metadata of individual queue record comprises is not identical.
Further, the number of the free block that processor 703 comprises according to described second set of metadata, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
The total number of the free block that processor 703 comprises according to each second set of metadata of individual queue record, judges whether the second set of metadata has residue free block.
Further, after processor 703 receives the order of write I/O request, and before the current set of metadata processed of acquisition is the first set of metadata, processor 703, also according to the size of described data block, judges whether to need to split the order of said write I/O request;
If desired split, then processor 703 is according to the size of described data block, splits the order of said write I/O request, obtains multiple first write I/O request order;
Processor 703 is to described multiple first write I/O request order, judge whether the metadata of the data to be written that each the first write I/O request order comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
Further, when multiple second set of metadata of queue record arbitrary in described multi-queue, the number of the free block that processor 703 comprises according to described second set of metadata, arranges described multiple second set of metadata.
Further, processor 703 receives and reclaims metadata instructions, and described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled; According to the address of described free block, obtain the set of metadata belonging to described free block; If described set of metadata is the first set of metadata, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata; If described set of metadata is the second set of metadata, then processor 703 judges whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then processor 703 deletes described second set of metadata from the queue of recording described second set of metadata, after described free block is added described second set of metadata, be recorded in other queue of multi-queue by described second set of metadata, if not, then described free block adds in described second set of metadata by processor 703.Wherein, other queue that described second set of metadata is recorded to multi-queue is comprised: according to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue by processor 703.
Further, after the second set of metadata to be recorded in other queue of multi-queue by processor 703, the total number of the free block recorded in the queue of processor 703 more the second set of metadata described in new record, and the total number upgrading the free block recorded in the queue that described second set of metadata adds.
The calculating that the embodiment of the present invention provides stores all-in-one, by the free block in set of metadata record internal memory, when receiving write I/O request order, free block is obtained from above-mentioned set of metadata, and the metadata of the data to be written order of above-mentioned write I/O request comprised writes in the free block got, thus the merging probability of metadata can be increased, and then can solve and frequently in Flash, write metadata, and affect the problem in the life-span of Flash.
Professional should recognize further, in conjunction with unit and the algorithm steps of each example of embodiment disclosed herein description, can realize with electronic hardware, computer software or the combination of the two, in order to the interchangeability of hardware and software is clearly described, generally describe composition and the step of each example in the above description according to function.These functions perform with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel can use distinct methods to realize described function to each specifically should being used for, but this realization should not thought and exceeds scope of the present invention.
The software module that the method described in conjunction with embodiment disclosed herein or the step of algorithm can use hardware, processor to perform, or the combination of the two is implemented.Software module can be placed in the storage medium of other form any known in random access memory (RAM), internal memory, ROM (read-only memory) (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field.
Above-described embodiment; object of the present invention, technical scheme and beneficial effect are further described; be understood that; the foregoing is only the specific embodiment of the present invention; the protection domain be not intended to limit the present invention; within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (20)

1. one kind writes the method for data in buffer memory Cache, it is characterized in that, the storage area of the flash memory Flash of described Cache comprises multiple storage block chunk, a described chunk comprises a chunk meta-data region and a chunk data field, a described chunk meta-data region comprises at least one meta data block, a described chunk data field comprises at least one data field corresponding with at least one meta data block described, described meta data block comprises multiple metadata, described data field comprises multiple data block, described meta data block and described data field one_to_one corresponding, described metadata and described data block one_to_one corresponding, described method comprises:
Receive the order of write I/O request, the order of said write I/O request comprises the metadata of data to be written;
Obtaining the current set of metadata processed is the first set of metadata, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory;
Judge whether there is residue free block in described first set of metadata;
When there being residue free block in described first set of metadata, then to the metadata of the described data to be written of free block write in described residue free block, and in the meta data block corresponding with described first set of metadata, write the metadata of described data to be written;
When not remaining free block in described first set of metadata, then judge whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata;
The metadata of described data to be written is write in the meta data block corresponding with described second set of metadata.
2. method according to claim 1, is characterized in that, the number of the free block comprised in described set of metadata calculates according to the size of the size of described meta data block and metadata corresponding to described data block.
3. method according to claim 1, is characterized in that, the free block comprised in described set of metadata is continuously arranged by address.
4. method according to claim 1, it is characterized in that, the number of the free block comprised in described set of metadata is recorded in the multi-queue of internal memory, and wherein, in described multi-queue, the number of the free block that the second set of metadata of individual queue record comprises is not identical.
5. method according to claim 4, is characterized in that, described method also comprises:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
Described judge the second set of metadata whether have residue free block comprise:
According to the total number of the free block that each second set of metadata of individual queue record comprises, judge whether the second set of metadata has residue free block.
6. according to the arbitrary described method of claim 1-5, it is characterized in that, after the order of described reception write I/O request, before the current set of metadata processed of described acquisition is the first set of metadata, described method also comprises:
According to the size of described data block, judge whether to need to split the order of said write I/O request;
If desired split, then according to the size of described data block, the order of said write I/O request is split, obtain multiple first write I/O request order;
To described multiple first write I/O request order, judge whether the metadata of the data to be written that each the first write I/O request order comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
7. method according to claim 5, is characterized in that, when multiple second set of metadata of queue record arbitrary in described multi-queue, then the number of the free block comprised according to described second set of metadata, arranges described multiple second set of metadata.
8. method according to claim 4, is characterized in that, described method also comprises:
Receive and reclaim metadata instructions, described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled;
According to the address of described free block, obtain the set of metadata belonging to described free block;
If described set of metadata is the first set of metadata, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata;
If described set of metadata is the second set of metadata, then judge whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then from the queue of recording described second set of metadata, delete described second set of metadata, after described free block is added described second set of metadata, described second set of metadata is recorded in other queue of multi-queue, if not, then described free block is added in described second set of metadata.
9. method according to claim 8, is characterized in that, described other queue described second set of metadata being recorded to multi-queue comprises:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue.
10. method according to claim 8 or claim 9, it is characterized in that, from the queue of recording described second set of metadata, described second set of metadata is deleted described, after described free block is added described second set of metadata, after described second set of metadata being recorded in other queue of multi-queue, described method also comprises:
The total number of the free block recorded in the queue of more the second set of metadata described in new record, and the total number upgrading the free block recorded in the queue that described second set of metadata adds.
11. 1 kinds of devices writing data in buffer memory Cache, it is characterized in that, the storage area of the flash memory Flash of described device comprises multiple storage block chunk, a described chunk comprises a chunk meta-data region and a chunk data field, a described chunk meta-data region comprises at least one meta data block, a described chunk data field comprises at least one data field corresponding with at least one meta data block described, described meta data block comprises multiple metadata, described data field comprises multiple data block, described meta data block and described data field one_to_one corresponding, described metadata and described data block one_to_one corresponding, described device comprises: receiving element, first acquiring unit, judging unit, first writing unit, second acquisition unit and the second writing unit,
Described receiving element, for receiving the order of write I/O request, the order of said write I/O request comprises the metadata of data to be written;
Described first acquiring unit is the first set of metadata for obtaining the current set of metadata processed, and a described set of metadata corresponds to a described meta data block, comprises the multiple free blocks in internal memory;
Described judging unit, for judging whether there is residue free block in described first set of metadata that described first acquiring unit obtains;
Described first writing unit, during for judging there is residue free block in described first set of metadata when described judging unit, then to the metadata of the described data to be written of free block write in described residue free block, and in the meta data block corresponding with described first set of metadata, write the metadata of described data to be written;
Described second acquisition unit, during for judging when described judging unit not remain free block in described first set of metadata, then judge whether the second set of metadata has residue free block, described second set of metadata is current not in the set of metadata of process, if described second set of metadata has residue free block, then obtain described second set of metadata, and write the metadata of described data to be written to a free block in the residue free block of described second set of metadata;
Described second writing unit, for writing the metadata of described data to be written in the meta data block corresponding with described second set of metadata.
12. devices according to claim 11, is characterized in that, the number of the free block comprised in described set of metadata calculates according to the size of the size of described meta data block and metadata corresponding to described data block.
13. devices according to claim 11, is characterized in that, the free block comprised in described set of metadata is continuously arranged by address.
14. methods according to claim 11, it is characterized in that, the number of the free block comprised in described set of metadata is recorded in the multi-queue of internal memory, and wherein, in described multi-queue, the number of the free block that the second set of metadata of individual queue record comprises is not identical.
15. devices according to claim 14, it is characterized in that, described device also comprises: record cell, for the number of free block comprised according to described second set of metadata, described second set of metadata is recorded in the individual queue of multi-queue, the total number of the free block that each second set of metadata that described individual queue also comprises this queue record comprises;
Described second acquisition unit specifically for: according to the total number of the free block that each second set of metadata of individual queue record comprises, judge whether the second set of metadata has residue free block.
16. according to the arbitrary described device of claim 11-15, and it is characterized in that, device also comprises: split cells;
Described judging unit, also for the size according to described data block, judges whether to need to split the order of said write I/O request;
Described split cells, if judge that needs split for described judging unit, then according to the size of described data block, splits the order of said write I/O request, obtains multiple first write I/O request order;
Described judging unit, described multiple first write I/O request orders also for obtaining described split cells, judge whether the metadata of the data to be written that each the first write I/O request order comprises has been buffered in described internal memory respectively, if, then directly carry out write operation, if not, then the step that the current set of metadata processed of acquisition is the first set of metadata is performed.
17. devices according to claim 15, it is characterized in that, described device also comprises: arrangement units, for when multiple second set of metadata of queue record arbitrary in described multi-queue, the number of the free block then comprised according to described second set of metadata, arranges described multiple second set of metadata.
18. devices according to claim 14, is characterized in that, described device also comprises: add unit;
Described receiving element, also for receiving recovery metadata instructions, described recovery metadata instructions comprises the address of the affiliated free block of metadata to be recycled;
Described first acquiring unit, the address of described free block also for receiving according to described receiving element, obtains the set of metadata belonging to described free block;
Describedly add unit, if the described set of metadata obtained for described first acquiring unit is the first set of metadata, then described free block is added in described first set of metadata, and to the free block rearrangement in described first set of metadata;
Described judging unit, if the described set of metadata also obtained for described first acquiring unit is the second set of metadata, then judge whether the free block number that described second set of metadata comprises is greater than Second Threshold, if, then from the queue of recording described second set of metadata, delete described second set of metadata, after described free block is added described second set of metadata, described second set of metadata is recorded in other queue of multi-queue, if not, then described free block is added in described second set of metadata.
19. devices according to claim 18, is characterized in that, described judging unit specifically for:
According to the number of the free block that described second set of metadata comprises, described second set of metadata is recorded in other queue of multi-queue.
20. devices according to claim 18 or 19, it is characterized in that, described device also comprises: updating block, for the total number of free block recorded in the queue of more the second set of metadata described in new record, and upgrade the total number of the free block recorded in the queue that described second set of metadata adds.
CN201410471711.7A 2014-09-16 2014-09-16 The method and device of data is write into caching Active CN104238962B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201410471711.7A CN104238962B (en) 2014-09-16 2014-09-16 The method and device of data is write into caching
PCT/CN2015/083383 WO2016041401A1 (en) 2014-09-16 2015-07-06 Method and device for writing data to cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410471711.7A CN104238962B (en) 2014-09-16 2014-09-16 The method and device of data is write into caching

Publications (2)

Publication Number Publication Date
CN104238962A true CN104238962A (en) 2014-12-24
CN104238962B CN104238962B (en) 2018-02-06

Family

ID=52227129

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410471711.7A Active CN104238962B (en) 2014-09-16 2014-09-16 The method and device of data is write into caching

Country Status (2)

Country Link
CN (1) CN104238962B (en)
WO (1) WO2016041401A1 (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778131A (en) * 2015-04-29 2015-07-15 浪潮电子信息产业股份有限公司 Data caching method and buffer memory
CN105117351A (en) * 2015-09-08 2015-12-02 华为技术有限公司 Method and apparatus for writing data into cache
WO2016041401A1 (en) * 2014-09-16 2016-03-24 华为技术有限公司 Method and device for writing data to cache
CN106445405A (en) * 2015-08-13 2017-02-22 北京忆恒创源科技有限公司 Flash storage-oriented data access method and apparatus
WO2017079974A1 (en) * 2015-11-13 2017-05-18 华为技术有限公司 File writing method and file server
CN109521945A (en) * 2017-09-20 2019-03-26 爱思开海力士有限公司 Memory device, storage system and its operating method
CN109683823A (en) * 2018-12-20 2019-04-26 湖南国科微电子股份有限公司 A kind of method and device managing the more concurrent requests of memory
CN110007853A (en) * 2019-01-30 2019-07-12 青岛镕铭半导体有限公司 A kind of Nandflash command handling method, device, terminal and storage medium
CN110968268A (en) * 2019-11-15 2020-04-07 成都智邦科技有限公司 Storage management method and storage structure based on spiflash
CN113050893A (en) * 2021-03-30 2021-06-29 重庆紫光华山智安科技有限公司 High-concurrency file storage method, system, medium and electronic terminal
CN113467698A (en) * 2020-03-30 2021-10-01 珠海全志科技股份有限公司 Writing method and device based on file system, computer equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11586554B2 (en) 2020-07-23 2023-02-21 Arm Limited Cache arrangements for data processing systems
CN112035065B (en) * 2020-08-28 2022-06-07 北京浪潮数据技术有限公司 Data writing method, device and equipment and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
CN101493794A (en) * 2009-01-19 2009-07-29 成都市华为赛门铁克科技有限公司 Flash memory data processing method and device
US20120079231A1 (en) * 2010-09-23 2012-03-29 Phison Electronics Corp. Data writing method, memory controller, and memory storage apparatus
CN103425438A (en) * 2013-07-15 2013-12-04 记忆科技(深圳)有限公司 Solid state disk and method for optimizing write request of solid state disk
CN103473185A (en) * 2013-09-06 2013-12-25 华为数字技术(苏州)有限公司 Cache writing method, caching device and storing system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049394A (en) * 2012-11-30 2013-04-17 记忆科技(深圳)有限公司 Method and system for data caching of solid state disk
CN104238962B (en) * 2014-09-16 2018-02-06 华为技术有限公司 The method and device of data is write into caching

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
CN101493794A (en) * 2009-01-19 2009-07-29 成都市华为赛门铁克科技有限公司 Flash memory data processing method and device
US20120079231A1 (en) * 2010-09-23 2012-03-29 Phison Electronics Corp. Data writing method, memory controller, and memory storage apparatus
CN103425438A (en) * 2013-07-15 2013-12-04 记忆科技(深圳)有限公司 Solid state disk and method for optimizing write request of solid state disk
CN103473185A (en) * 2013-09-06 2013-12-25 华为数字技术(苏州)有限公司 Cache writing method, caching device and storing system

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016041401A1 (en) * 2014-09-16 2016-03-24 华为技术有限公司 Method and device for writing data to cache
CN104778131B (en) * 2015-04-29 2017-07-21 浪潮电子信息产业股份有限公司 A kind of data cache method and a kind of buffer storage
CN104778131A (en) * 2015-04-29 2015-07-15 浪潮电子信息产业股份有限公司 Data caching method and buffer memory
CN106445405A (en) * 2015-08-13 2017-02-22 北京忆恒创源科技有限公司 Flash storage-oriented data access method and apparatus
CN106445405B (en) * 2015-08-13 2020-02-07 北京忆恒创源科技有限公司 Data access method and device for flash memory storage
US10409502B2 (en) 2015-09-08 2019-09-10 Huawei Technologies Co., Ltd. Method and apparatus for writing metadata into cache
CN105117351A (en) * 2015-09-08 2015-12-02 华为技术有限公司 Method and apparatus for writing data into cache
WO2017041570A1 (en) * 2015-09-08 2017-03-16 华为技术有限公司 Method and apparatus for writing data to cache
CN105117351B (en) * 2015-09-08 2018-07-03 华为技术有限公司 To the method and device of buffering write data
EP3309685A4 (en) * 2015-09-08 2018-07-25 Huawei Technologies Co., Ltd. Method and apparatus for writing data to cache
WO2017079974A1 (en) * 2015-11-13 2017-05-18 华为技术有限公司 File writing method and file server
CN109521945A (en) * 2017-09-20 2019-03-26 爱思开海力士有限公司 Memory device, storage system and its operating method
CN109683823A (en) * 2018-12-20 2019-04-26 湖南国科微电子股份有限公司 A kind of method and device managing the more concurrent requests of memory
CN110007853A (en) * 2019-01-30 2019-07-12 青岛镕铭半导体有限公司 A kind of Nandflash command handling method, device, terminal and storage medium
CN110007853B (en) * 2019-01-30 2022-06-28 镕铭微电子(济南)有限公司 Nandflash command processing method, Nandflash command processing device, terminal and storage medium
CN110968268A (en) * 2019-11-15 2020-04-07 成都智邦科技有限公司 Storage management method and storage structure based on spiflash
CN110968268B (en) * 2019-11-15 2023-03-17 成都智邦科技有限公司 Storage management method and storage structure based on spiflash
CN113467698A (en) * 2020-03-30 2021-10-01 珠海全志科技股份有限公司 Writing method and device based on file system, computer equipment and storage medium
CN113050893A (en) * 2021-03-30 2021-06-29 重庆紫光华山智安科技有限公司 High-concurrency file storage method, system, medium and electronic terminal
CN113050893B (en) * 2021-03-30 2022-08-30 重庆紫光华山智安科技有限公司 High-concurrency file storage method, system, medium and electronic terminal

Also Published As

Publication number Publication date
WO2016041401A1 (en) 2016-03-24
CN104238962B (en) 2018-02-06

Similar Documents

Publication Publication Date Title
CN104238962A (en) Method and device for writing data into cache
CN105117351A (en) Method and apparatus for writing data into cache
US10810127B2 (en) Solid-state hard disk and data access method for use with solid-state hard disk
US9990276B2 (en) Read-write control method for memory, and corresponding memory and server
US20160188227A1 (en) Method and apparatus for writing data into solid state disk
US11232073B2 (en) Method and apparatus for file compaction in key-value store system
CN104346357A (en) File accessing method and system for embedded terminal
CN102722455B (en) Method and device for storing data in flash memory equipment
CN107391544B (en) Processing method, device and equipment of column type storage data and computer storage medium
CN101983376A (en) Access device, information recording device, information recording system, file management method, and program
CN103646063A (en) Satellite-borne high-speed file management system
CN103019884A (en) Memory page de-weight method and memory page de-weight device based on virtual machine snapshot
CN103399823A (en) Method, equipment and system for storing service data
CN109407985B (en) Data management method and related device
CN107506466B (en) Small file storage method and system
CN104050057A (en) Historical sensed data duplicate removal fragment eliminating method and system
CN102339318A (en) File system management method and system
CN104035822A (en) Low-cost efficient internal storage redundancy removing method and system
CN109408416B (en) Address mapping table entry page management method and device
CN106528703A (en) Deduplication mode switching method and apparatus
CN109445693A (en) A kind of data compression method and device
US10007601B2 (en) Data storage device and operating method for flash memory
CN102737171B (en) Method and device for storing virus file and storage equipment
US9507794B2 (en) Method and apparatus for distributed processing of file
CN108334457B (en) IO processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220214

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Patentee after: Huawei Cloud Computing Technology Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right