Date storage method and system

文档序号:1741929 发布日期:2019-11-26 浏览:23次 中文

阅读说明:本技术 数据存储方法及系统 (Date storage method and system ) 是由 乔晖 于 2018-05-18 设计创作,主要内容包括:本发明实施例提供了一种数据存储方法及系统,该方法包括:针对待写入数据,按照存储Zone与缓存Zone的映射状态,将待写入数据在存储Zone中的地址,转化为缓存Zone中的目标缓存偏移地址;按照目标缓存偏移地址,将待写入数据写入到缓存Zone中;在满足预设同步条件时,按照存储Zone与缓存Zone的映射状态,将缓存Zone中的数据顺序写入到SMR硬盘的存储Zone中。利用非易失性存储介质掉电不丢失的特性通过该软件逻辑实现解决了SMR硬盘存储Zone只能顺序写的设计短板,用户上层应用视角即在SMR硬盘存储Zone的任意指定位置实现了数据随机写入。(The embodiment of the invention provides a kind of date storage method and systems, this method comprises: being directed to data to be written, according to the mapping status of storage Zone and caching Zone, it is written into address of the data in storage Zone, the target cache offset address being converted into caching Zone;According to target cache offset address, it is written into data and is written in caching Zone;When meeting pre-determined synchronization condition, according to the mapping status of storage Zone and caching Zone, the data cached in Zone are sequentially written in the storage Zone of SMR hard disk.The characteristic that do not lost using non-volatile memory medium power down realized by the software logic solve SMR hard-disc storage Zone can only sequential write design short slab, user's upper layer application visual angle is to realize data random writing in any given position of SMR hard-disc storage Zone.)

1. a kind of date storage method, which is characterized in that be applied to data-storage system, the data-storage system includes read-write Equipment, non-volatile memory medium and stacked tile type Magnetographic Technology SMR hard disk, the read-write equipment and the non-volatile memories Medium connection, the read-write equipment are connect with the SMR hard disk;The SMR hard disk includes multiple storage region Zone, each described Storage Zone corresponds to different offset address;The non-volatile memory medium logical partitioning is multiple caching Zone, each described Storage Zone maps different caching Zone;The read-write equipment records the mapping shape of the storage Zone and the caching Zone State, which comprises

For data to be written, the read-write equipment is according to the storage Zone and the mapping status for caching Zone, by institute State data to be written it is to be written, it is described storage Zone in address, be converted into caching Zone in offset address, as mesh Mark caching offset address;

The read-write equipment is written to corresponding caching Zone according to the target cache offset address, by the data to be written In;

When meeting pre-determined synchronization condition, the read-write equipment is according to the storage Zone and the mapping shape for caching Zone Data in the caching Zone are written in the storage Zone of the caching Zone mapping by state.

2. the method according to claim 1, wherein each caching Zone corresponds to different caching Zone ropes Draw, the mapping status of caching Zone index characterization the caching Zone and the storage Zone, the caching Zone index It is also used to characterize the state of each page in the caching Zone, the read-write equipment includes radix tree, described in the radix tree mounting Cache Zone index;

Described to be directed to data to be written, the read-write equipment stores Zone and the mapping status for caching Zone according to described, The address data to be written are to be written, in the storage Zone, the offset address being converted into caching Zone are made For target cache offset address, comprising:

For data to be written, the page offset of the data to be written with being converted to the offset for storing Zone by the read-write equipment Location stores offset address as target;

Whether the read-write equipment is inquired in the radix tree comprising the corresponding caching Zone rope of target storage offset address Draw;

In the radix tree when caching Zone index corresponding comprising target storage offset address, the read-write equipment is pressed According to the corresponding caching Zone index of target storage offset address, convert target storage offset address to described slow The offset address in Zone is deposited, as target cache offset address;

The read-write equipment is written to corresponding caching Zone according to the target cache offset address, by the data to be written In, comprising:

The read-write equipment determines page offset of the target cache offset address in the caching Zone, inclined as page object It moves, deviates, the data to be written are written in the corresponding page of the caching Zone, and in the mesh according to the page object It is in the corresponding caching Zone index of mark storage offset address, the corresponding page set of caching Zone is dirty.

3. according to the method described in claim 2, whether being wrapped it is characterized in that, being inquired in the radix tree in the read-write equipment After the corresponding caching Zone index of the storage offset address containing the target, the method also includes:

In the radix tree when caching Zone index corresponding not comprising target storage offset address, the read-write equipment Judge the caching Zone that whether there is non-mapping storage Zone in the non-volatile memory medium;

The caching Zone of non-mapping storage Zone, the read-write equipment select in the caching Zone of non-mapping storage Zone if it exists A caching Zone is taken, the caching Zone of the storage Zone mapping to be written as the data to be written;

The read-write equipment is the caching Zone distribution caching Zone rope of the data to be written storage Zone mapping to be written Draw, and configure the mapping status of caching Zone index, and each page set of caching Zone index is clean.

4. according to the method described in claim 3, it is characterized in that, judging that the non-volatile memories are situated between in the read-write equipment After the caching Zone that whether there is non-mapping storage Zone in matter, the method also includes:

The caching Zone of non-mapping storage Zone if it does not exist, the read-write equipment are chosen to be recycled according to default selection rule Cache Zone index;

The data to be recycled cached in the corresponding caching Zone of Zone index are written to described wait return by the read-write equipment It receives in the corresponding storage Zone of caching Zone index, caches Zone rope using the caching Zone index to be recycled as having recycled Draw;

Described recycled is cached the corresponding caching Zone of Zone index by the read-write equipment, to be written as the data to be written Enter storage Zone mapping caching Zone, by it is described recycled caching each page set of Zone index it is clean, and configure described in The mapping status of recycling caching Zone index are as follows: described to have recycled the corresponding caching Zone mapping said write of caching Zone index Data storage Zone to be written.

5. according to the method described in claim 2, it is characterized in that, the non-volatile memory medium further includes index management Area, the SMR hard disk further include index backup area;The index management area is used to manage and save the slow of each caching Zone Zone index is deposited, the index backup area is used to store the caching Zone index of the storage Zone of the SMR hard disk;The method Further include:

In data-storage system starting, Zone index is cached most in the read-write equipment index management area Renewal time and the final updating time for indexing caching Zone index in backup area afterwards;

If caching the final updating time of Zone index earlier than caching Zone in the index management area in the index backup area The final updating time of index, the read-write equipment is according to rope described in each caching Zone index upgrade in the index management area Draw backup area.

6. according to the method described in claim 5, it is characterized in that, in the read-write equipment index management Qu Zhonghuan It is described after depositing the final updating time for caching Zone index in the final updating time and the index backup area of Zone index Method further include:

If caching the final updating time of Zone index in the index management area earlier than caching Zone in the index backup area The final updating time of index, the read-write equipment is according to each caching Zone index in the index backup area, described in update Caching Zone index in index management area;

The read-write equipment updates the data in the caching Zone according to the data in the storage Zone;

Wherein, the caching Zone index in the updated index management area is mounted in the radix tree in the read-write equipment.

7. according to the method described in claim 5, it is characterized in that, in the read-write equipment according in the index management area Each caching Zone index, before configuring the caching Zone index in the radix tree, the method also includes:

In data-storage system starting, the read-write equipment reads each described slow from the non-volatile memory medium Zone index is deposited, according to each caching Zone index of reading, judges whether there is new storage Zone, it is new if it exists to deposit Zone is stored up, for the new storage Zone allocating cache Zone index.

8. the method according to claim 1, wherein the pre-determined synchronization condition includes the data-storage system Power-off restarting.

9. a kind of data-storage system, which is characterized in that the system comprises:

Read-write equipment, non-volatile memory medium and stacked tile type Magnetographic Technology SMR hard disk, the read-write equipment and it is described it is non-easily The property lost storage medium connection, the read-write equipment are connect with the SMR hard disk;

The SMR hard disk includes multiple storage region Zone, and each storage Zone corresponds to different offset address;It is described non-easy The property lost storage medium logical partitioning is multiple caching Zone, and each storage Zone maps different caching Zone;The read-write Equipment records the mapping status of the storage Zone and the caching Zone;

The read-write equipment stores Zone and the mapping status for caching Zone according to described for being directed to data to be written, The address data to be written are to be written, in the storage Zone, the offset address being converted into caching Zone are made For target cache offset address;According to the target cache offset address, the data to be written are written to corresponding caching In Zone;It, will be described slow according to the mapping status of the storage Zone and the caching Zone when meeting pre-determined synchronization condition The data in Zone are deposited to be written in the storage Zone of the caching Zone mapping.

10. system according to claim 9, which is characterized in that each caching Zone corresponds to different caching Zone ropes Draw, the mapping status of caching Zone index characterization the caching Zone and the storage Zone, the caching Zone index It is also used to characterize the state of each page in the caching Zone, the read-write equipment includes radix tree, described in the radix tree mounting Cache Zone index;

The read-write equipment is specifically used for being directed to data to be written, and the page offset of the data to be written is converted to storage The offset address of Zone stores offset address as target;It whether inquires in the radix tree comprising target storage offset The corresponding caching Zone index in address;Include the corresponding caching Zone rope of target storage offset address in the radix tree When drawing, according to the corresponding caching Zone index of target storage offset address, convert target storage offset address to Offset address in the caching Zone, as target cache offset address;Determine the target cache offset address in institute The page offset in caching Zone is stated, is deviated as page object, is deviated according to the page object, the data to be written are written to It, will be described slow in the corresponding page of the caching Zone, and in the corresponding caching Zone index of target storage offset address It is dirty to deposit the corresponding page set of Zone;When meeting pre-determined synchronization condition, according to reflecting for the storage Zone and caching Zone State is penetrated, the data in the caching Zone are written in the storage Zone of the caching Zone mapping.

11. system according to claim 10, which is characterized in that the read-write equipment is also used to: in the radix tree When not comprising the target storage corresponding caching Zone index of offset address, judge in the non-volatile memory medium whether In the presence of the caching Zone of non-mapping storage Zone;The caching Zone of non-mapping storage Zone if it exists, in non-mapping storage Zone Caching Zone in choose a caching Zone, as the data to be written it is to be written storage Zone map caching Zone;Caching Zone distribution for the data to be written storage Zone mapping to be written caches Zone index, and configuring should The mapping status of Zone index is cached, and each page set of caching Zone index is clean.

12. system according to claim 11, which is characterized in that the read-write equipment is also used to:

The caching Zone of non-mapping storage Zone if it does not exist chooses caching Zone index to be recycled according to default selection rule; By it is described it is to be recycled caching Zone index it is corresponding caching Zone in data be written to the caching Zone index pair to be recycled In the storage Zone answered, using the caching Zone index to be recycled as recycled caching Zone index;By it is described recycled it is slow The corresponding caching Zone of Zone index is deposited, the caching Zone of the storage Zone mapping to be written as the data to be written will Described to have recycled caching each page set of Zone index clean, and configures the mapping status for having recycled and having cached Zone index are as follows: It is described to have recycled the corresponding caching Zone mapping said write data of caching Zone index storage Zone to be written.

13. system according to claim 10, which is characterized in that the non-volatile memory medium further includes index management Area, the SMR hard disk further include index backup area;The index management area is used to manage and save the slow of each caching Zone Zone index is deposited, the index backup area is used to store the caching Zone index of the storage Zone of the SMR hard disk;

The read-write equipment, is also used to: in data-storage system starting, caching Zone in the index management area The final updating time of Zone index is cached in the final updating time of index and the index backup area;If the index backup Final updating time of the final updating time earlier than caching Zone index in the index management area of Zone index is cached in area, Backup area is indexed according to described in each caching Zone index upgrade in the index management area.

14. system according to claim 13, which is characterized in that the read-write equipment is also used to: if the index management Final updating time of the final updating time earlier than caching Zone index in the index backup area of Zone index is cached in area, According to each caching Zone index in the index backup area, the caching Zone index in the index management area is updated;According to Data in the storage Zone update the data in the caching Zone;Wherein, it is hung in the radix tree in the read-write equipment Connect the caching Zone index in the updated index management area.

15. system according to claim 13, which is characterized in that the read-write equipment is also used to: being stored in the data When system starts, each caching Zone index is read from the non-volatile memory medium, according to each described slow of reading Zone index is deposited, new storage Zone is judged whether there is, if it exists new storage Zone, it is slow for the new storage Zone configuration Deposit Zone index.

16. system according to claim 9, which is characterized in that the pre-determined synchronization condition includes data storage system System power-off restarting.

The present invention relates to technical field of data storage, more particularly to date storage method and system.

With the arriving of network big data era, data storage technology faces unprecedented challenge.For example, being led in monitoring Domain, with the continuous promotion of high Qinghua and intelligent requirements, the requirement for data storage is higher and higher.

In order to cope with the feature that data storage capacity is big in video monitoring and data throughput is high, SMR (Shingled Magnetic Recording, stacked tile type Magnetographic Technology) it is born in succession.SMR hard disk readjusts data by overlapping magnetic track The mode of storage, and then improve track density, to increase the capacity of single dish, SMR disk be divided into Host Manage, Two kinds of Host Aware and Drive Manage, Device Manage prevailing models.But no matter which kind of mode being used, SMR is hard The case where disk only supports being sequentially written in for data, can not cope with out-of-order write-in in video monitoring.

The embodiment of the present invention is designed to provide a kind of date storage method and system, to realize the random ordering of SMR hard disk Write-in.Specific technical solution is as follows:

In a first aspect, being applied to data-storage system, the number the embodiment of the invention provides a kind of date storage method It include read-write equipment, non-volatile memory medium and stacked tile type Magnetographic Technology SMR hard disk, the read-write equipment according to storage system It is connect with the non-volatile memory medium, the read-write equipment is connect with the SMR hard disk;The SMR hard disk includes multiple Storage region Zone, each storage Zone correspond to different offset address;The non-volatile memory medium logical partitioning is Multiple caching Zone, each storage Zone map different caching Zone;The read-write equipment record the storage Zone with The mapping status of the caching Zone, which comprises

For data to be written, the read-write equipment stores Zone and the mapping status for caching Zone according to described, The address data to be written are to be written, in the storage Zone, the offset address being converted into caching Zone are made For target cache offset address;

The read-write equipment is written to corresponding caching according to the target cache offset address, by the data to be written In Zone;

When meeting pre-determined synchronization condition, the read-write equipment is according to the storage Zone and the mapping for caching Zone Data in the caching Zone are written in the storage Zone of the caching Zone mapping by state.

Optionally, in the date storage method of the embodiment of the present invention, each caching Zone corresponds to different cachings Zone index, the mapping status of caching Zone index characterization the caching Zone and the storage Zone, the caching Zone index is also used to characterize the state of each page in the caching Zone, and the read-write equipment includes radix tree, the radix tree Mount the caching Zone index;

Described to be directed to data to be written, the read-write equipment is according to the storage Zone and the mapping shape for caching Zone State, the address data to be written are to be written, in the storage Zone, with being converted into the offset in caching Zone Location, as target cache offset address, comprising:

For data to be written, the page offset of the data to be written is converted to the inclined of storage Zone by the read-write equipment Address is moved, stores offset address as target;

Whether the read-write equipment is inquired in the radix tree comprising the corresponding caching of target storage offset address Zone index;

In the radix tree when caching Zone index corresponding comprising target storage offset address, the read-write is set It is standby to store the corresponding caching Zone index of offset address according to the target, it converts target storage offset address in institute The offset address in caching Zone is stated, as target cache offset address;

The read-write equipment is written to corresponding caching according to the target cache offset address, by the data to be written In Zone, comprising:

The read-write equipment determines page offset of the target cache offset address in the caching Zone, as target Page offset, deviates according to the page object, the data to be written is written in the corresponding page of the caching Zone, and in institute It states in the corresponding caching Zone index of target storage offset address, the corresponding page set of caching Zone is dirty.

Optionally, it is inquired in the read-write equipment whether corresponding comprising target storage offset address in the radix tree Caching Zone index after, the method also includes:

In the radix tree when caching Zone index corresponding not comprising target storage offset address, the read-write Equipment judges the caching Zone that whether there is non-mapping storage Zone in the non-volatile memory medium;

The caching Zone of non-mapping storage Zone if it exists, caching Zone of the read-write equipment in non-mapping storage Zone One caching Zone of middle selection, the caching Zone of the storage Zone mapping to be written as the data to be written;

The read-write equipment is that the caching Zone of the data to be written storage Zone mapping to be written distributes caching Zone index, and the mapping status of caching Zone index is configured, and each page set of caching Zone index is clean.

Optionally, judge in the non-volatile memory medium in the read-write equipment with the presence or absence of non-mapping storage Zone Caching Zone after, the method also includes:

The caching Zone of non-mapping storage Zone if it does not exist, the read-write equipment according to default selection rule, choose to Recycling caching Zone index;

The data to be recycled cached in the corresponding caching Zone of Zone index are written to described by the read-write equipment In the corresponding storage Zone of caching Zone index to be recycled, using the caching Zone index to be recycled as having recycled caching Zone Index;

The read-write equipment has recycled the corresponding caching Zone of caching Zone index for described, as the data to be written The caching Zone of storage Zone mapping to be written, to have recycled caching each page set of Zone index clean by described, and configures institute State the mapping status for having recycled caching Zone index are as follows: described to have recycled described in the corresponding caching Zone mapping of caching Zone index Data storage Zone to be written is written.

Optionally, the non-volatile memory medium further includes index management area, and the SMR hard disk further includes index backup Area;The index management area is used to manage and save the caching Zone index of each caching Zone, and the index backup area is used In the caching Zone index for the storage Zone for storing the SMR hard disk;The method also includes:

In data-storage system starting, Zone index is cached in the read-write equipment index management area The final updating time and it is described index backup area in cache Zone index the final updating time;

If caching the final updating time of Zone index earlier than caching in the index management area in the index backup area The final updating time of Zone index, the read-write equipment is according to each caching Zone index upgrade institute in the index management area State index backup area.

Optionally, in the read-write equipment index management area cache Zone index the final updating time and After the final updating time for caching Zone index in the index backup area, the method also includes:

If caching the final updating time of Zone index in the index management area earlier than caching in the index backup area The final updating time of Zone index, the read-write equipment are updated according to each caching Zone index in the index backup area Caching Zone index in the index management area;

The read-write equipment updates the data in the caching Zone according to the data in the storage Zone;

Wherein, the caching Zone rope in the updated index management area is mounted in the radix tree in the read-write equipment Draw.

Optionally, the base is configured according to each caching Zone index in the index management area in the read-write equipment Before caching Zone index in number tree, the method also includes:

In data-storage system starting, the read-write equipment reads each institute from the non-volatile memory medium It states caching Zone index and new storage Zone is judged whether there is, if it exists newly according to each caching Zone index of reading Storage Zone, for the new storage Zone allocating cache Zone index.

Optionally, in the date storage method of the embodiment of the present invention, the pre-determined synchronization condition includes that the data are deposited Storage system power-off restarting.

Second aspect, the embodiment of the invention provides a kind of data-storage system, the system comprises:

Read-write equipment, non-volatile memory medium and stacked tile type Magnetographic Technology SMR hard disk, the read-write equipment with it is described Non-volatile memory medium connection, the read-write equipment are connect with the SMR hard disk;

The SMR hard disk includes multiple storage region Zone, and each storage Zone corresponds to different offset address;It is described Non-volatile memory medium logical partitioning is multiple caching Zone, and each storage Zone maps different caching Zone;It is described Read-write equipment records the mapping status of the storage Zone and the caching Zone;

The read-write equipment, for being directed to data to be written, according to the mapping of the storage Zone and the caching Zone State, the address data to be written are to be written, in the storage Zone, with being converted into the offset in caching Zone Location, as target cache offset address;According to the target cache offset address, the data to be written are written to accordingly It caches in Zone;When meeting pre-determined synchronization condition, according to the mapping status of the storage Zone and the caching Zone, by institute The data in caching Zone are stated to be written in the storage Zone of the caching Zone mapping.

Optionally, in the data-storage system of the embodiment of the present invention, each caching Zone corresponds to different cachings Zone index, the mapping status of caching Zone index characterization the caching Zone and the storage Zone, the caching Zone index is also used to characterize the state of each page in the caching Zone, and the read-write equipment includes radix tree, the radix tree Mount the caching Zone index;

The read-write equipment is specifically used for being directed to data to be written, and the page offset of the data to be written is converted to and is deposited The offset address for storing up Zone stores offset address as target;It inquires whether inclined comprising target storage in the radix tree Move the corresponding caching Zone index in address;Include the corresponding caching Zone of target storage offset address in the radix tree When index, according to the corresponding caching Zone index of target storage offset address, by target storage offset address conversion For it is described caching Zone in offset address, as target cache offset address;Determine that the target cache offset address exists Page offset in the caching Zone, deviates as page object, deviates according to the page object, and the data to be written are written It, will be described into the corresponding page of the caching Zone, and in the corresponding caching Zone index of target storage offset address It is dirty to cache the corresponding page set of Zone;When meeting pre-determined synchronization condition, according to the storage Zone's and caching Zone Data in the caching Zone are written in the storage Zone of the caching Zone mapping by mapping status.

Optionally, in the data-storage system of the embodiment of the present invention, the read-write equipment is also used to: in the radix In tree when caching Zone index corresponding not comprising target storage offset address, judge in the non-volatile memory medium With the presence or absence of the caching Zone of non-mapping storage Zone;The caching Zone of non-mapping storage Zone if it exists, in non-mapping storage A caching Zone is chosen in the caching Zone of Zone, the caching of the storage Zone mapping to be written as the data to be written Zone;Caching Zone distribution for the data to be written storage Zone mapping to be written caches Zone index, and configuring should The mapping status of Zone index is cached, and each page set of caching Zone index is clean.

Optionally, in the data-storage system of the embodiment of the present invention, the read-write equipment is also used to:

The caching Zone of non-mapping storage Zone if it does not exist chooses caching Zone to be recycled according to default selection rule Index;By it is described it is to be recycled caching Zone index it is corresponding caching Zone in data be written to the caching Zone rope to be recycled Draw in corresponding storage Zone, using the caching Zone index to be recycled as recycled caching Zone index;It has been returned described The corresponding caching Zone of caching Zone index is received, the caching of the storage Zone mapping to be written as the data to be written Zone, to have recycled caching each page set of Zone index clean by described, and configures the mapping recycled and cached Zone index State are as follows: described to have recycled the corresponding caching Zone mapping said write data of caching Zone index storage Zone to be written.

Optionally, in the data-storage system of the embodiment of the present invention, the non-volatile memory medium further includes index Directorial area, the SMR hard disk further include index backup area;The index management area is for managing and saving each caching Zone Caching Zone index, it is described index backup area be used for store the SMR hard disk storage Zone caching Zone index;

The read-write equipment, is also used to: in data-storage system starting, caching in the index management area The final updating time of Zone index is cached in the final updating time of Zone index and the index backup area;If the index The final updating time of Zone index is cached in backup area earlier than the final updating for caching Zone index in the index management area Time indexes backup area according to described in each caching Zone index upgrade in the index management area.

Optionally, in the data-storage system of the embodiment of the present invention, the read-write equipment is also used to: if the index The final updating time of Zone index is cached in directorial area earlier than the final updating for caching Zone index in the index backup area Time updates the caching Zone index in the index management area according to each caching Zone index in the index backup area; The data in the caching Zone are updated according to the data in the storage Zone;Wherein, the radix tree in the read-write equipment Caching Zone index in the middle updated index management area of mounting.

Optionally, in the data-storage system of the embodiment of the present invention, the read-write equipment is also used to: in the data When storage system starts, each caching Zone index is read from the non-volatile memory medium, according to each institute of reading Caching Zone index is stated, new storage Zone is judged whether there is, if it exists new storage Zone, matches for the new storage Zone Set caching Zone index.

Optionally, in the data-storage system of the embodiment of the present invention, the pre-determined synchronization condition includes that the data are deposited Storage system power-off restarting.

Date storage method provided in an embodiment of the present invention and system, SMR hard disk include multiple storage region Zone, are respectively deposited Storage Zone corresponds to different offset address;Non-volatile memory medium logical partitioning is multiple caching Zone, and each Zone that stores reflects Penetrate different caching Zone;The mapping status of read-write equipment record storage Zone and caching Zone;For data to be written, read-write Equipment according to storage Zone and cache Zone mapping status, be written into data it is to be written, storage Zone in address, The offset address being converted into caching Zone, as target cache offset address;Read-write equipment according to target cache offset address, Data are written into be written in corresponding caching Zone;When meeting pre-determined synchronization condition, read-write equipment is according to storage Zone With the mapping status of caching Zone, the data in Zone will be cached and be written in the storage Zone of caching Zone mapping.By The specific page write-in data (out-of-order can be written) of caching Zone, and the data cached in Zone are sequentially written in SMR hard disk Storage Zone in, logically solve SMR hard disk there are Zone can only sequential write technology short slab, user is with upper layer application Visual angle be to have carried out data write-in in any given position of SMR hard-disc storage Zone, that is, realize data random writing.When So, it implements any of the products of the present invention or method does not necessarily require achieving all the advantages described above at the same time.

In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.

Fig. 1 is a kind of schematic diagram of the data-storage system of the embodiment of the present invention;

Fig. 2 is a kind of schematic diagram of the caching Zone index of the embodiment of the present invention;

Fig. 3 is a kind of schematic diagram of the radix tree mounting caching Zone index of the embodiment of the present invention;

Fig. 4 is the first flow diagram of the date storage method of the embodiment of the present invention;

Fig. 5 is second of flow diagram of the date storage method of the embodiment of the present invention;

Fig. 6 is the third flow diagram of the date storage method of the embodiment of the present invention.

Specific embodiment

Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.

In the memory technology of relevant SMR hard disk, SMR hard disk can only carry out data by way of being sequentially written in and deposit Storage.The case where concurrently write-in and out-of-order write-in can not be coped with, in view of this, the embodiment of the invention provides a kind of data storage systems System, referring to Fig. 1, which includes:

Read-write equipment 101, non-volatile memory medium 102 and stacked tile type Magnetographic Technology SMR hard disk 103, above-mentioned read-write Equipment 101 is connect with above-mentioned non-volatile memory medium 102, and above-mentioned read-write equipment 101 is connect with above-mentioned SMR hard disk 103;

Above-mentioned SMR hard disk 103 includes multiple storage region Zone, and each above-mentioned storage Zone corresponds to different offset address; Above-mentioned 102 logical partitioning of non-volatile memory medium is multiple caching Zone, and each above-mentioned storage Zone maps different cachings Zone;Above-mentioned read-write equipment 101 records the mapping status of above-mentioned storage Zone Yu above-mentioned caching Zone;

Above-mentioned read-write equipment 101, for being directed to data to be written, according to reflecting for above-mentioned storage Zone and above-mentioned caching Zone State is penetrated, address above-mentioned data to be written are to be written, in above-mentioned storage Zone, the offset being converted into caching Zone Address, as target cache offset address;According to above-mentioned target cache offset address, above-mentioned data to be written are written to accordingly Caching Zone in;It, will according to the mapping status of above-mentioned storage Zone and above-mentioned caching Zone when meeting pre-determined synchronization condition Data in above-mentioned caching Zone are written in the storage Zone of above-mentioned caching Zone mapping.

Read-write equipment 101 can mount non-volatile memory medium 102 by Memory Controller Hub, and read-write equipment 101 can be with Pass through SATA (Serial Advanced Technology Attachment, Serial Advanced Technology Attachment) or SAS (Serial Attached Small Computer System Interface, serial SCSI) control one or more SMR hard disk of mounting 103.Above-mentioned non-volatile memory medium 102 can carry out out-of-order write-in, read-write equipment 101 further include CPU, memory and other with The relevant peripheral hardware of business.

Respectively storage Zone maps different caching Zone, and optionally, storage Zone and caching Zone are mapping relations one by one, And store the equal in magnitude of the caching Zone that Zone and storage Zone maps.

For the data to be written of SMR hard disk to be written, read-write equipment 101 determines the ground of data position to be written to be written Location, i.e., address to be written convert the address to be written to and are caching according to the mapping status of storage Zone and caching Zone Offset address in Zone, i.e. target cache offset address.

Non-volatile memory medium 102 can carry out out-of-order write-in, read-write equipment 101 according to target cache offset address, Data are written into be written in caching Zone.When meeting pre-determined synchronization condition, read-write equipment will cache the data in Zone, It is sequentially written in the corresponding storage Zone of caching Zone.Data are written by the designated position in caching Zone, then will Data in caching Zone are sequentially written in storage Zone, are logically realized in the write-in of the designated position of SMR hard disk 103 Data.

Optionally, meeting pre-determined synchronization condition includes: to meet default write back cycle.Read-write equipment 101 is according to default write-back Period will periodically cache the data in Zone, be written in the corresponding storage Zone of caching Zone.Read-write equipment 101 shines Default write back cycle, by the storage Zone of the data write-in SMR hard disk 103 in the caching Zone of non-volatile memory medium 102 In, it ensure that the normal storage of data, while the caching Zone in non-volatile memory medium 102 can be discharged.

In the embodiment of the present invention, by the way that data (out-of-order can be written) is written in the specific page of caching Zone, and will caching Data in Zone are sequentially written in the corresponding storage Zone of caching Zone, logically realize the random ordering of SMR hard disk Write-in, solve SMR hard disk can only sequential write technology short slab, user with the visual angle of upper layer application i.e. in SMR hard-disc storage The designated position of Zone has carried out data write-in, that is, realizes data random writing.And it is directed to each storage Zone of SMR hard disk Data write-in is carried out respectively, can be suitable for the case where being concurrently written.

Optionally, in the data-storage system of the embodiment of the present invention, each above-mentioned caching Zone corresponds to different cachings Zone index, above-mentioned caching Zone index characterize the mapping status of above-mentioned caching Zone and above-mentioned storage Zone, above-mentioned caching Zone index is also used to characterize the state of each page in above-mentioned caching Zone, and above-mentioned read-write equipment 101 includes radix tree, above-mentioned radix Rime connects above-mentioned caching Zone index;

The read-write equipment is specifically used for being directed to data to be written, and the page offset of the data to be written is converted to and is deposited The offset address for storing up Zone stores offset address as target;It inquires whether inclined comprising target storage in the radix tree Move the corresponding caching Zone index in address;Include the corresponding caching Zone of target storage offset address in the radix tree When index, according to the corresponding caching Zone index of target storage offset address, by target storage offset address conversion For it is described caching Zone in offset address, as target cache offset address;Determine that the target cache offset address exists Page offset in the caching Zone, deviates as page object, deviates according to the page object, and the data to be written are written It, will be described into the corresponding page of the caching Zone, and in the corresponding caching Zone index of target storage offset address It is dirty to cache the corresponding page set of Zone;When meeting pre-determined synchronization condition, according to the storage Zone's and caching Zone Data in the caching Zone are written in the storage Zone of the caching Zone mapping by mapping status.

The caching Zone index that each caching Zone has oneself exclusive, caching Zone index characterization caching Zone and storage The corresponding relationship of Zone, the corresponding caching Zone index of a caching Zone are each to cache the corresponding caching Zone index of Zone It is different.Optionally, referring to fig. 2, caching Zone index includes: that the byte offset of Zone is stored in SMR hard disk (as unit of byte Offset), cache Zone inside page bitmap (bitmap file), cache Zone storage domain offset, caching Zone it is nearest Synchronization time, the region that Zone is stored in SMR hard disk deviate (offset as unit of Zone), and caching Zone is the last The caching of page time, mapping status and affiliated caching indexing head information etc..The caching indexing head of caching Zone index includes: storage Zone information, SMR hard disk information and storage first caching index address of Zone.

As shown in figure 3, the radix tree of the super fast upper building management caching Zone index in read-write equipment 101, if The mapping status of caching Zone index is to have mapped, then the leaf in radix tree is directed toward being somebody's turn to do in non-volatile memory medium 102 Cache Zone index point;Otherwise leaf pointer is NULL, and expression does not mount caching Zone index.Wherein, it is articulated in radix tree Upper position is determined by the offset as unit of Zone for caching Zone index.

It in embodiments of the present invention, being capable of quickly access cache Zone and storage by radix tree and caching Zone index Zone facilitates the corresponding relationship for obtaining caching Zone and storing Zone, facilitates the management and storage of data.

Optionally, SMR hard disk 103 be can be Host Manage Mode S MR hard disk, the software view of read-write equipment 101 It can support that the ZAC/ZBC for Zone management is instructed (more than Linux-4.4 version using operation (SuSE) Linux OS, kernel Kernel supported the instruction set).

I/O (Input/Output, input/output) is as unit of 4K pages in the related technology, in embodiments of the present invention, will Page offset file-based is converted to the address offset based on storage Zone, is then initiated according to the offset address storage Zone I/O operation.Storage Zone size based on SMR hard disk is divided into multiple caching Zone to non-volatile memory medium 102, deposits It stores up Zone and caching Zone is equal in magnitude.For example, the storage Zone size of SMR hard disk is 256MB, non-volatile memory medium 102 size is 16GB, is by caching Zone and a 256MB that non-volatile memory medium 102 is divided into 63 256MB Index management area.The mapping relations for caching and storing Zone in Zone and SMR hard disk 103 are established in non-volatile memory medium 102, Storage Zone information and hard disk information etc. are stored in caching index head, mapping relations, state etc. are stored in caching Zone rope In drawing, the space Zone is individually retained on SMR hard disk, the index for opening up SMR hard disk backs up and for indexing synchronization.

In embodiments of the present invention, by the way that data (out-of-order can be written) is written in the specific page of caching Zone, and will delay It deposits the data in Zone to be sequentially written in the storage Zone of SMR hard disk, logically solve inside SMR hard-disc storage Zone Can only sequential write technology short slab, user with the visual angle of upper layer application i.e. carried out in the designated position of SMR hard-disc storage Zone Data write-in, that is, realize data random writing.It caches Zone and storage Zone is equal in magnitude, by the specified of caching Zone Page write-in data, and data in caching Zone are written in the corresponding storage Zone of caching Zone, it can be realized SMR hard disk In each storage space Zone mileage evidence be sequentially written in, can adapt to the scene being concurrently written.

Optionally, in the data-storage system of the embodiment of the present invention, above-mentioned read-write equipment 101 is also used in above-mentioned base In number tree when caching Zone index corresponding not comprising above-mentioned target storage offset address, above-mentioned non-volatile memory medium is judged It whether there is the caching Zone of non-mapping storage Zone in 102;The caching Zone of non-mapping storage Zone if it exists is not mapping It stores and chooses a caching Zone in the caching Zone of Zone, the storage Zone mapping to be written as above-mentioned data to be written Cache Zone;Caching Zone distribution for the storage Zone mapping to be written of above-mentioned data to be written caches Zone index, and matches The mapping status of caching Zone index is set, and each page set of caching Zone index is clean.

Read-write equipment is clean by each page set in the caching Zone index of selection, according to the storage that data to be written are to be written The address of Zone is arranged in the corresponding caching Zone index of caching Zone of selection and stores the offset of Zone, and caching rope is arranged Leader etc..It is obtaining characterizing data to be written storage Zone to be written and is caching the caching Zone index of Zone corresponding relationship Afterwards, read-write equipment 101 determines page offset of the target cache offset address in caching Zone, presses according to caching Zone index It is deviated according to the page, is written into data and is written in caching Zone;By the page having been written into cache set in Zone index dirty;In When meeting pre-determined synchronization condition, the data cached in Zone are written to corresponding by read-write equipment 101 according to caching Zone index It stores in Zone.

In embodiments of the present invention, the corresponding pass with caching Zone is not established in the storage Zone that data to be written are written When being, a caching Zone is chosen in idle caching Zone, establishes the caching Zone of the choosing and data to be written are written Storage Zone corresponding relationship, allocating cache Zone index can guarantee the use that Zone is stored to new addition.

Optionally, above-mentioned read-write equipment 101 is also used to the caching Zone of non-mapping storage Zone if it does not exist, according to pre- If selection rule, caching Zone index to be recycled is chosen;It will be in the corresponding caching Zone of above-mentioned caching Zone index to be recycled Data are written in the corresponding storage Zone of above-mentioned caching Zone index to be recycled, using above-mentioned caching Zone index to be recycled as Caching Zone index is recycled;The corresponding caching Zone of caching Zone index is recycled by above-mentioned, as above-mentioned data to be written The caching Zone of storage Zone mapping to be written, to have recycled caching each page set of Zone index clean by above-mentioned, and in configuration State the mapping status for having recycled caching Zone index are as follows: above-mentioned recycled caches the corresponding caching Zone of Zone index, in mapping State write-in data storage Zone to be written.

Default selection rule is the rule for choosing caching Zone index to be recycled, is averagely visited for example, choosing in the unit time Ask number least caching Zone index;Or the caching Zone index of nearest least referenced is chosen, LRU (Least can be passed through Recently Used, least recently used) algorithm, choose caching Zone index of nearest least referenced etc..It will be according to default choosing The caching Zone index for taking rule to choose, as caching Zone index to be recycled.

Optionally, in the data-storage system of the embodiment of the present invention, above-mentioned read-write equipment 101 will be above-mentioned to be recycled slow The data deposited in the corresponding caching Zone of Zone index are written in the corresponding storage Zone of above-mentioned caching Zone index to be recycled, Include:

Read-write equipment 101 determines the corresponding caching of the caching Zone index to be recycled according to caching Zone index to be recycled Whether clean page is had in Zone;

If having clean page in the corresponding caching Zone of caching Zone index to be recycled, the address of each clean page is obtained, is pressed According to the address of each clean page, the corresponding data of each clean page are read in the corresponding storage Zone of caching Zone index to be recycled, It is written in the clean page of caching Zone, by the data whole sequential write in the corresponding caching Zone of caching Zone index to be recycled Enter into the corresponding storage Zone of caching Zone index to be recycled;

If caching Zone index to be recycled is corresponded to without clean page in the corresponding caching Zone of caching Zone index to be recycled Caching Zone in data be all sequentially written in and need in the corresponding storage Zone of caching Zone index that recycles.

Optionally, in the data-storage system of the embodiment of the present invention, above-mentioned read-write equipment 101 will be above-mentioned to be recycled slow The data deposited in the corresponding caching Zone of Zone index are written in the corresponding storage Zone of above-mentioned caching Zone index to be recycled, Include:

Read-write equipment 101 determines the corresponding caching of the caching Zone index to be recycled according to caching Zone index to be recycled Whether first containing dirty pages and the last one containing dirty pages in Zone judge to have between first containing dirty pages and the last one containing dirty pages clean Page;

If there is clean page between first containing dirty pages and the last one containing dirty pages, first containing dirty pages and the last one containing dirty pages are obtained Between the address of each clean page read in the corresponding storage Zone of caching Zone index to be recycled according to the address of each clean page The corresponding data of each clean page are taken, are written to caching Zone accordingly in clean page, caching Zone index to be recycled is corresponding Data in caching Zone between first containing dirty pages and the last one containing dirty pages are sequentially written in caching Zone index to be recycled and correspond to Storage Zone in;

If without clean page between first containing dirty pages and the last one containing dirty pages, by the corresponding caching of caching Zone index to be recycled Continuous data in Zone between first containing dirty pages and the last one containing dirty pages, is written to that caching Zone index to be recycled is corresponding to be deposited It stores up in Zone.

Optionally, by it is above-mentioned it is to be recycled caching Zone index it is corresponding caching Zone in data be written to it is above-mentioned wait return After receiving in the corresponding storage Zone of caching Zone index, above-mentioned read-write equipment 101 is also used to update index management area and index The access time to be recycled for caching Zone index in backup area.

After the data record for completing the corresponding caching Zone of caching Zone index to be recycled, by above-mentioned caching to be recycled Zone index, which is used as, has recycled caching Zone index.Read-write equipment 101 is using the above-mentioned caching Zone index that recycled as to be written The caching Zone index of the data corresponding caching Zone of storage Zone to be written, and update and recycled reflecting for caching index characterization Relationship is penetrated, each page set in caching Zone index is clean.

Read-write equipment 101 has recycled caching Zone index according to updated, determines that target cache offset address is caching Page offset in Zone, deviates according to the page, is written into data and is written in caching Zone;It will be corresponding according to page offset Page set is dirty;When meeting pre-determined synchronization condition, read-write equipment 101 will cache Zone according to updated caching Zone index In data be written in corresponding storage Zone.

During data I/O, because of the Limited Number of caching Zone index, it is possible that caching Zone index has been used Complete situation, it is therefore desirable to which caching Zone index and caching Zone are recycled.Need first to recycle the number in caching Zone According to, find the transregional of containing dirty pages, if it is transregional it is middle there are clean page if need to read clean page from the storage Zone of SMR hard disk it is right The data answered, then will be in the transregional storage Zone for being continuously written into SMR hard disk of the containing dirty pages.It can be by being based on lru algorithm Caching Zone index to be recycled is chosen, after data are synchronized to the storage Zone of SMR hard disk, has been recycled caching Zone index, Recycled caching Zone index can be to be used by new other storage Zone write requests.Read-write equipment cleaning caching Parameter in Zone index about storage Zone, each page set in new caching Zone index is clean, according to data to be written The address of storage Zone to be written, is arranged the offset that Zone is stored in target cache Zone index, and caching indexing head is arranged Deng.

In embodiments of the present invention, caching Zone index and caching Zone are recycled, passes through allocating cache Zone rope Draw the mapping relations for establishing the storage Zone of the caching Zone and data to be written that have recycled, copes with caching Zone index number The limited situation of mesh guarantees the use of newly added storage Zone.

Optionally, above-mentioned non-volatile memory medium 102 further includes index management area, and above-mentioned SMR hard disk 103 further includes rope Draw backup area;

Above-mentioned index management area is used to manage and save the caching Zone index of each above-mentioned caching Zone, above-mentioned index backup Area is used to store the caching Zone index of the storage Zone of above-mentioned SMR hard disk 103;

Above-mentioned read-write equipment 101 is also used to when above-mentioned data-storage system starts, more above-mentioned index management Qu Zhonghuan The final updating time that Zone index is cached in the final updating time and above-mentioned index backup area of Zone index is deposited, if above-mentioned rope Draw in backup area cache Zone index the final updating time earlier than in above-mentioned index management area cache Zone index finally more The new time updates above-mentioned index backup area according to each caching Zone index in above-mentioned index management area.

The final updating time of Zone index is cached in index backup area earlier than caching Zone index in index management area The final updating time when, illustrate that data are newer in index management area, read-write equipment 101 is according to each in above-mentioned index management area Zone index is cached, updates and respectively caches Zone index in above-mentioned index backup area, and the data in each caching Zone are synchronized to It stores in Zone.Read-write equipment 101 according to index management area caching Zone index mapping status and cache Zone index with Zone is the offset of unit, and caching Zone index is articulated in the radix tree of superblock.

For example, the mapping status of caching Zone index is to have mapped, caching offset of the Zone index as unit of Zone is 3, then in radix tree order be 3 leaf pointer on mount caching Zone index.If caching the mapping status of Zone index Not map, caching offset of the Zone index as unit of Zone is 4, then the leaf pointer that order is 4 in radix tree is NULL。

In embodiments of the present invention, the final updating time of Zone index is cached in index backup area earlier than index management When the final updating time for caching Zone index in area, according to each caching Zone index in index management area, above-mentioned base is configured Caching Zone index in number tree can guarantee that caching Zone index is newest caching Zone index, is to ensure to store Newest data.

Optionally, above-mentioned read-write equipment 101, if being also used to cache the final updating of Zone index in above-mentioned index management area Time earlier than in above-mentioned index backup area cache Zone index the final updating time, according in above-mentioned index backup area it is each delay Zone index is deposited, the caching Zone index in above-mentioned index management area is updated, is updated according to the data in above-mentioned storage Zone State the data in caching Zone, wherein mounted in updated above-mentioned index management area in the radix tree in above-mentioned read-write equipment Caching Zone index.

The final updating time of Zone index is cached in index management area earlier than caching Zone index in index backup area The final updating time when, illustrate index backup area in data it is newer, read-write equipment 101 will index backup area in each caching Zone index is synchronized in index management area, and according to the bitmap of caching Zone index, reads each containing dirty pages from storage Zone And store into caching Zone, read-write equipment 101 is according to the mapping status and caching Zone index of caching Zone index with Zone For the offset of unit, caching Zone index is articulated in the radix tree of superblock.

In embodiments of the present invention, the final updating time that Zone index is cached in index management area backs up earlier than index When the final updating time for caching Zone index in area, each caching Zone index indexed in backup area is synchronized to index management Qu Zhong configures the caching Zone index in above-mentioned radix tree, can guarantee according to each caching Zone index in index management area Caching Zone index is newest caching Zone index, and the data stored in Zone are synchronized to caching according to caching Zone index Zone can guarantee in non-volatile memory medium to be newest data.

Optionally, above-mentioned read-write equipment 101 is also used to when above-mentioned data-storage system starts, from above-mentioned non-volatile Each above-mentioned caching Zone index is read in storage medium 102, according to each above-mentioned caching Zone index of reading, is judged whether there is New storage Zone, if it exists new storage Zone, for the new storage Zone allocating cache Zone index.

Read-write equipment 101 reads the caching Zone index in non-volatile memory medium 102, while obtaining each storage Zone Information distribute new caching Zone index for the storage Zone of the SMR hard disk newly accessed, when data to be written are to be written Storage Zone when being the storage Zone of the SMR hard disk newly accessed, the mapping shape of the caching Zone index of the no initializtion is set State and parameter, and mount radix tree.

In embodiments of the present invention, it is new storage Zone allocating cache Zone index, is guaranteeing new storage Zone just It is often used.

Optionally, in the data-storage system of the embodiment of the present invention, above-mentioned pre-determined synchronization condition includes that above-mentioned data are deposited Storage system power-off restarting.

Non-volatile memory medium 102 is for the caching between above-mentioned data-storage system memory and SMR hard disk 103.It can Choosing, non-volatile memory medium is Optane memory, and Optane memory has high bandwidth, low delay, high-quality service and height The characteristic in service life can be improved the buffer efficiency of data-storage system, improve data cached reliability.Non-volatile memories are situated between Matter can be made of one or more Optane memories, and non-volatile memory medium is divided into multiple caching Zone (region). For each caching Zone, what the size of caching Zone can be mapped with caching Zone stores the equal in magnitude of Zone.

In abnormal power-down, the data that disk is had not been written in read-write equipment memory can lose, and deposit to increase data The reliability of storage, using non-volatile memory medium as the embodiment of the present invention data-storage system memory and SMR hard disk it Between caching.In the data-storage system power-off restarting of the embodiment of the present invention, read-write equipment 101 is according to storage Zone and caching The corresponding relationship of Zone, for each caching Zone, by the storage of data and caching Zone mapping in caching Zone Zone is synchronized.

In embodiments of the present invention, by data buffer storage in the caching Zone of non-volatile memory medium, in accident power-off Afterwards, the data in non-volatile memory medium will not lose, after power-off restarting, by non-volatile memory medium data and The storage Zone of SMR hard disk is synchronized, it is possible to reduce the case where data power-off is lost can increase the reliable of data storage Property.And different storage Zone facilitates data management, reads and writes with data write-in dynamic mapping caching Zone in SMR hard disk The data cached in Zone directly can be saved in storage Zone by the corresponding relationship of storage Zone and caching Zone by equipment In, the fast storage efficiency of storage speed is high.

The embodiment of the invention also provides a kind of date storage methods, referring to fig. 4, are applied to data-storage system, above-mentioned Data-storage system includes that read-write equipment, non-volatile memory medium and stacked tile type Magnetographic Technology SMR hard disk, above-mentioned read-write are set Standby to connect with above-mentioned non-volatile memory medium, above-mentioned read-write equipment is connect with above-mentioned SMR hard disk;Above-mentioned SMR hard disk includes more A storage region Zone, each above-mentioned storage Zone correspond to different offset address;Above-mentioned non-volatile memory medium logical partitioning Different caching Zone is mapped for multiple caching Zone, each above-mentioned storage Zone;Above-mentioned read-write equipment records above-mentioned storage Zone With the mapping status of above-mentioned caching Zone, the above method includes:

S401, for data to be written, above-mentioned read-write equipment according to above-mentioned storage Zone and above-mentioned caching Zone mapping State, address above-mentioned data to be written are to be written, in above-mentioned storage Zone, with being converted into the offset in caching Zone Location, as target cache offset address;

Above-mentioned data to be written are written to accordingly by S402, above-mentioned read-write equipment according to above-mentioned target cache offset address Caching Zone in;

S403, when meeting pre-determined synchronization condition, above-mentioned read-write equipment is according to above-mentioned storage Zone and above-mentioned caching Zone Mapping status, the data in above-mentioned caching Zone are written in the storage Zone of above-mentioned caching Zone mapping.

In the embodiment of the present invention, by the way that data (out-of-order can be written) is written in the specific page of caching Zone, and will caching Data in Zone are sequentially written in the corresponding storage Zone of caching Zone, logically realize the random ordering of SMR hard disk Write-in, solve SMR hard disk can only sequential write technology short slab, user with the visual angle of upper layer application i.e. in SMR hard-disc storage The designated position of Zone has carried out data write-in, that is, realizes data random writing.And it is directed to each storage Zone of SMR hard disk Data write-in is carried out respectively, can be suitable for the case where being concurrently written.

Optionally, in the date storage method of the embodiment of the present invention, above-mentioned pre-determined synchronization condition includes that above-mentioned data are deposited Storage system power-off restarting.

In embodiments of the present invention, by data buffer storage in the caching Zone of non-volatile memory medium, in accident power-off Afterwards, the data in non-volatile memory medium will not lose, after power-off restarting, by non-volatile memory medium data and SMR hard disk synchronizes, it is possible to reduce the case where data power-off is lost can increase the reliability of data storage.And hard disk Middle different storage Zone caches Zone with data write-in dynamic mapping, facilitates data management, read-write equipment can be by depositing It stores up Zone and caches the corresponding relationship of Zone, directly the data cached in Zone are saved in storage Zone, storage speed is fast Storage efficiency is high.

Optionally, in the date storage method of the embodiment of the present invention, each above-mentioned caching Zone corresponds to different cachings Zone index, above-mentioned caching Zone index characterize the mapping status of above-mentioned caching Zone and above-mentioned storage Zone, above-mentioned caching Zone index is also used to characterize the state of each page in above-mentioned caching Zone, and above-mentioned read-write equipment includes radix tree, above-mentioned radix tree Mount above-mentioned caching Zone index;

It is above-mentioned be directed to data to be written, above-mentioned read-write equipment according to above-mentioned storage Zone and above-mentioned caching Zone mapping shape State, address above-mentioned data to be written are to be written, in above-mentioned storage Zone, with being converted into the offset in caching Zone Location, as target cache offset address, comprising:

For data to be written, the page offset of above-mentioned data to be written is converted to the inclined of storage Zone by above-mentioned read-write equipment Address is moved, stores offset address as target;

Whether above-mentioned read-write equipment is inquired in above-mentioned radix tree comprising the corresponding caching of above-mentioned target storage offset address Zone index;

In above-mentioned radix tree when caching Zone index corresponding comprising above-mentioned target storage offset address, above-mentioned read-write is set It is standby to store the corresponding caching Zone index of offset address according to above-mentioned target, it converts above-mentioned target storage offset address to upper The offset address in caching Zone is stated, as target cache offset address;

Above-mentioned read-write equipment is written to corresponding caching according to above-mentioned target cache offset address, by above-mentioned data to be written In Zone, comprising:

Above-mentioned read-write equipment determines page offset of the above-mentioned target cache offset address in above-mentioned caching Zone, as target Page offset, deviates according to above-mentioned page object, above-mentioned data to be written is written in the above-mentioned corresponding page of caching Zone, and upper It states in the corresponding caching Zone index of target storage offset address, the corresponding page set of above-mentioned caching Zone is dirty.

Optionally, it is inquired in above-mentioned read-write equipment whether corresponding comprising above-mentioned target storage offset address in above-mentioned radix tree Caching Zone index after, the above method further include:

Step 1, in above-mentioned radix tree when caching Zone index corresponding not comprising above-mentioned target storage offset address, Above-mentioned read-write equipment judges the caching Zone that whether there is non-mapping storage Zone in above-mentioned non-volatile memory medium;

Step 2, the caching Zone of non-mapping storage Zone if it exists, above-mentioned read-write equipment is non-mapping storage Zone's It caches and chooses a caching Zone in Zone, the caching Zone of the storage Zone mapping to be written as above-mentioned data to be written;

Step 3, above-mentioned read-write equipment are the caching Zone distribution of above-mentioned data to be written storage Zone mapping to be written Zone index is cached, and configures the mapping status of caching Zone index, and each page set of caching Zone index is clean.

In embodiments of the present invention, the corresponding pass with caching Zone is not established in the storage Zone that data to be written are written When being, a caching Zone is chosen in idle caching Zone, establishes the caching Zone of the choosing and data to be written are written Storage Zone corresponding relationship, be configured in caching Zone indexing parameter, can guarantee the use to new addition storage Zone.

Optionally, judge in above-mentioned non-volatile memory medium in above-mentioned read-write equipment with the presence or absence of non-mapping storage Zone Caching Zone after, the above method further include:

Step 1, the caching Zone of non-mapping storage Zone if it does not exist, above-mentioned read-write equipment according to default selection rule, Choose caching Zone index to be recycled;

The above-mentioned Zone index corresponding data cached in Zone to be recycled that cache are written for step 2, above-mentioned read-write equipment It is into the corresponding storage Zone of above-mentioned caching Zone index to be recycled, above-mentioned caching Zone index to be recycled is slow as having recycled Deposit Zone index;

Step 3, above-mentioned read-write equipment have recycled the caching corresponding caching Zone of Zone index for above-mentioned, as it is above-mentioned to Be written data it is to be written storage Zone mapping caching Zone, by it is above-mentioned recycled caching each page set of Zone index it is clean, And configure the above-mentioned mapping status for having recycled caching Zone index are as follows: above-mentioned to have recycled the corresponding caching of caching Zone index Zone maps above-mentioned write-in data storage Zone to be written.

Optionally, the above-mentioned data to be recycled cached in the corresponding caching Zone of Zone index are written to above-mentioned to be recycled It caches in the corresponding storage Zone of Zone index, comprising:

Read-write equipment determines the corresponding caching Zone of the caching Zone index to be recycled according to caching Zone index to be recycled In first containing dirty pages and the last one containing dirty pages, judge whether there is clean page between first containing dirty pages and the last one containing dirty pages;

If there is clean page between first containing dirty pages and the last one containing dirty pages, first containing dirty pages and the last one containing dirty pages are obtained Between the address of each clean page read in the corresponding storage Zone of caching Zone index to be recycled according to the address of each clean page The corresponding data of each clean page are taken, are written to caching Zone accordingly in clean page, caching Zone index to be recycled is corresponding Data in caching Zone between first containing dirty pages and the last one containing dirty pages are sequentially written in caching Zone index to be recycled and correspond to Storage Zone in;

If without clean page between first containing dirty pages and the last one containing dirty pages, by the corresponding caching of caching Zone index to be recycled Continuous data in Zone between first containing dirty pages and the last one containing dirty pages, is written to that caching Zone index to be recycled is corresponding to be deposited It stores up in Zone.

In embodiments of the present invention, caching Zone index and caching Zone are recycled, establishes the caching Zone of recycling With the corresponding relationship of the storage Zone of new data to be written, and allocating cache Zone index copes with and caches Zone index number The limited situation of mesh guarantees the use of newly added storage Zone.

Optionally, above-mentioned to be directed to data to be written as shown in figure 5, in the date storage method of the embodiment of the present invention, on Read-write equipment is stated according to above-mentioned caching Zone index, above-mentioned data to be written are saved in above-mentioned data to be written are to be written to deposit It stores up in the corresponding caching Zone of Zone, comprising:

S501, for data to be written, the page offset for being written into data is converted to the offset address of storage Zone, as Target stores offset address.

Whether S502 inquires comprising the corresponding caching Zone index of target storage offset address in radix tree, if radix tree In comprising the corresponding caching Zone index of target storage offset address execute S509, deviated if not including target in radix tree and storing The corresponding caching Zone index in address executes S503.

S503 judges with the presence or absence of the caching Zone of not corresponding storage Zone in non-volatile memory medium, if it exists not The caching Zone of corresponding storage Zone executes S507, and the caching Zone of not corresponding storage Zone executes S504 if it does not exist.

S504 chooses the caching Zone index for needing to recycle according to default selection rule.

S505, read-write equipment find the caching Zone index for needing to recycle, and the caching Zone index for needing to recycle is corresponded to Caching Zone in data be written in the corresponding storage Zone of target cache Zone index.

The caching Zone index that read-write equipment recycles as required determines that the caching Zone index of needs recycling is corresponding First containing dirty pages and the last one containing dirty pages in Zone are cached, judge whether to have between first containing dirty pages and the last one containing dirty pages dry Net page;

If there is clean page between first containing dirty pages and the last one containing dirty pages, read-write equipment obtains first containing dirty pages and last The address of each clean page between a containing dirty pages, according to the address of each clean page, in the corresponding storage Zone of target cache Zone index It is middle to read the corresponding data of each clean page, caching Zone is read into accordingly in clean page, then by target cache Zone index Continuous data in corresponding caching Zone between first containing dirty pages and the last one containing dirty pages is sequentially written in target cache Zone It indexes in corresponding storage Zone;

If without clean page between first containing dirty pages and the last one containing dirty pages, read-write equipment corresponds to target cache Zone index Caching Zone in continuous data between first containing dirty pages and the last one containing dirty pages be sequentially written in target cache Zone index In corresponding storage Zone, complete recycling.

S506, read-write equipment choose storage Zone pair to be written as data to be written of the caching Zone index recycled It is clean will to have recycled the corresponding each page set of caching Zone index, and has updated caching for the caching Zone index of the caching Zone answered Zone index.

Parameter in the new caching Zone index of read-write equipment cleaning about storage Zone, will newly cache each page in Zone index Set is clean, according to the address of data to be written storage Zone to be written, is arranged in target cache Zone index and stores Zone Offset, mapping relations, and caching indexing head etc. is set.

S507 chooses a caching Zone in the caching Zone of not corresponding storage Zone, to be written as data to be written The corresponding caching Zone of the storage Zone entered;

S508, read-write equipment are written into the caching Zone index of the data corresponding caching Zone of storage Zone to be written Carry out parameter cleaning, and allocating cache Zone index.

Read-write equipment is clean by each page set in the caching Zone index of selection, according to the storage that data to be written are to be written The address of Zone is arranged in the corresponding caching Zone index of caching Zone of selection and stores the offset of Zone, and caching rope is arranged Leader etc..

S509 converts target storage offset address to according to the corresponding caching Zone index of target storage offset address Offset address in caching Zone, as target cache offset address.

S510 determines page offset of the target cache offset address in caching Zone, deviates as page object, according to target Page offset, is written into data on demand and (can be out of order) and be written in caching Zone, and according to page object offset by corresponding page Caching, set in Zone index is dirty.

In embodiments of the present invention, specific method in data write-in caching Zone to be written is given, can be guaranteed to new The use of addition storage Zone, supports out-of-order data to be written in caching Zone, and then caches number between Zone and storage Zone According to sequence synchronization, overcome SMR hard disk can only sequential write technology short slab.It, can be fast by radix tree and caching Zone index Fast access cache Zone, management caching Zone and the corresponding relationship for storing Zone, more preferably realize the management and storage of data.

Optionally, above-mentioned non-volatile memory medium further includes index management area, and above-mentioned SMR hard disk further includes index backup Area;Above-mentioned index management area is used to manage and save the caching Zone index of each above-mentioned caching Zone, and above-mentioned index backup area is used In the caching Zone index for the storage Zone for storing above-mentioned SMR hard disk;The above method further include:

In the starting of above-mentioned data-storage system, Zone index is cached in the above-mentioned more above-mentioned index management area of read-write equipment The final updating time and above-mentioned index backup area in cache Zone index the final updating time;

If caching the final updating time of Zone index in above-mentioned index backup area earlier than caching in above-mentioned index management area The final updating time of Zone index, above-mentioned read-write equipment are updated according to each caching Zone index in above-mentioned index management area Above-mentioned index backup area.

In embodiments of the present invention, the final updating time of Zone index is cached in index backup area earlier than index management When the final updating time for caching Zone index in area, according to each caching Zone index in index management area, above-mentioned base is configured Caching Zone index in number tree can guarantee that caching Zone index is newest caching Zone index, is to ensure to store Newest data.

Optionally, in the more above-mentioned index management area of above-mentioned read-write equipment cache Zone index the final updating time and After the final updating time for caching Zone index in above-mentioned index backup area, the above method further include:

If caching the final updating time of Zone index in above-mentioned index management area earlier than caching in above-mentioned index backup area The final updating time of Zone index, above-mentioned read-write equipment are updated according to each caching Zone index in above-mentioned index backup area Caching Zone index in above-mentioned index management area;

Above-mentioned read-write equipment updates the data in above-mentioned caching Zone according to the data in above-mentioned storage Zone;

Wherein, the caching Zone rope in updated above-mentioned index management area is mounted in the radix tree in above-mentioned read-write equipment Draw.

In embodiments of the present invention, the final updating time that Zone index is cached in index management area backs up earlier than index When the final updating time for caching Zone index in area, each caching Zone index indexed in backup area is synchronized to index management Qu Zhong configures the caching Zone index in above-mentioned radix tree, can guarantee according to each caching Zone index in index management area Caching Zone index is newest caching Zone index.

Optionally, above-mentioned base is configured according to each caching Zone index in above-mentioned index management area in above-mentioned read-write equipment Before caching Zone index in number tree, the above method further include:

In the starting of above-mentioned data-storage system, above-mentioned read-write equipment is read on each from above-mentioned non-volatile memory medium It states caching Zone index and new storage Zone is judged whether there is, if it exists newly according to each above-mentioned caching Zone index of reading Storage Zone, for the new storage Zone allocating cache Zone index.

In embodiments of the present invention, it is new storage Zone distribution caching Zone index, is guaranteeing new storage Zone just It is often used.

In the date storage method of the embodiment of the present invention, in the starting of above-mentioned data-storage system, need superblock It is bound with storage Zone, that is, the mounting caching Zone index in radix tree is completed, optionally, as shown in fig. 6, its step packet It includes:

S601 checks and is arranged buffer address of each caching Zone index in non-volatile memory medium.

The buffer address of read-write equipment inspection and each caching Zone index of setting in non-volatile memory medium, and obtain Buffer address of each caching Zone index in non-volatile memory medium.

S602 is obtained in non-volatile memory medium and is cached indexing head, and verification hard disk information, which judges whether it is, newly to be accessed Hard disk.

Read-write equipment obtain non-volatile memory medium in respectively cache indexing head, according to hard disk information judge hard disk whether be The hard disk newly accessed executes S607 if hard disk is the hard disk newly accessed, if SMR hard disk is not that the hard disk newly accessed executes S603。

S603 judges whether that the archive index for indexing backup area is newer.

Read-write equipment compares the final updating time for caching Zone index in index management area and caches in index backup area The final updating time of Zone index judges whether that the caching Zone index for indexing backup area is newer, if index backup area is slow It deposits Zone index and relatively newly executes S604, if caching Zone index in index management area relatively newly executes S606.

S604, the synchronous caching Zone indexed in backup area are indexed in index management area.

Read-write equipment will index each caching Zone index in backup area, copy in index management area.

S605 reads containing dirty pages to caching Zone according to the bitmap of caching Zone index.

Read-write equipment determines each containing dirty pages, and read from storage Zone according to the bitmap of each page in caching Zone index The data of each containing dirty pages, and store into caching Zone, wherein caching Zone's and storage Zone is equal in magnitude.

Index is articulated to super fast radix tree according to the mapping status of caching Zone index and zone offset by S606 On.

Offset of the read-write equipment according to the mapping status and caching Zone index of caching Zone index as unit of Zone, will Caching Zone index is articulated in the radix tree of superblock.

S607 establishes caching indexing head for the storage Zone of the hard disk newly accessed, according to new access hard disk and storage Zone Parameter, initialization caching indexing head parameter.

Storage Zone for the SMR hard disk newly accessed configures the caching Zone index of no initializtion, when data to be written When storage Zone to be written is the storage Zone of the SMR hard disk newly accessed, the caching Zone index of the no initializtion is set Mapping status and parameter, and mount radix tree.If there is new storage Zone write-in again, new caching Zone index point is carried out Match and instantiate, caches and form doubly linked list relationship between Zone index convenient for lookup and delete operation, caching Zone index knot The storage Zone of indexing head information labeling inside structure belonging to it, such as cache the quantity of Zone in non-volatile memory medium and be 63, then the quantity of corresponding caching Zone index is also 63.

In embodiments of the present invention, when giving data-storage system starting, the side of radix tree mounting caching Zone index Method can guarantee that storage is newest data, while guarantee the normal use of new storage Zone.

It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.

Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.

The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

25页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于ARM的高速采样信号乒乓存储实现方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类