CN104461390B - The method of writing data to the hard disk smr imbricated magnetic recording apparatus and - Google Patents

The method of writing data to the hard disk smr imbricated magnetic recording apparatus and Download PDF

Info

Publication number
CN104461390B
CN104461390B CN 201410736477 CN201410736477A CN104461390B CN 104461390 B CN104461390 B CN 104461390B CN 201410736477 CN201410736477 CN 201410736477 CN 201410736477 A CN201410736477 A CN 201410736477A CN 104461390 B CN104461390 B CN 104461390B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
data
chunk
used
index
smr
Prior art date
Application number
CN 201410736477
Other languages
Chinese (zh)
Other versions
CN104461390A (en )
Inventor
张雷
肖垒
Original Assignee
华为技术有限公司
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
Grant date

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from or digital output to record carriers, e.g. RAID, emulated record carriers, networked record carriers

Abstract

本发明实施例提供了一种将数据写入叠瓦状磁记录SMR硬盘的方法及装置,涉及计算机技术领域。 Embodiment of the present invention provides a method and apparatus for writing data into the magnetic recording SMR imbricated disk, relates to the field of computer technology. 所述将数据写入叠瓦状磁记录SMR硬盘的方法包括:接收写数据指令,写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记;根据数据记录的长度向正在使用的chunk申请空间,数据记录包括写数据指令中的键、数据和标记;将数据记录写入申请的空间中;保存键、标记与数据被写入正在使用的chunk中的地址。 The method of writing data to the magnetic recording SMR imbricated disk comprising: receiving a write data command, the write command includes a key data, tag data and key identification data, labeled as write flag, delete or modify the tag marking; The application to the length of the space being used chunk data comprises recording data in the write data instruction key, and the data tag; spatial data is recorded in the write request; sAVE key, and the flag data is written in the chunk is being used the address of. 本发明通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上的问题;达到了提高在SMR硬盘写入数据的灵活性的效果。 The present invention will contain a data chunk is written record key, and the data being used in marker; solves the problem of distributed storage system can not be directly ported to SMR layout scheme hard; achieve improved write data in the hard disk SMR flexibility effect.

Description

将数据写入叠瓦状磁记录SMR硬盘的方法及装置 The method of writing data to the hard disk SMR imbricated magnetic recording apparatus and

技术领域 FIELD

[0001]本发明涉及计算机技术领域,特别涉及一种将数据写入叠瓦状磁记录SMR硬盘的方法及装置。 [0001] The present invention relates to computer technology, and particularly relates to a method and apparatus for writing data into the magnetic recording SMR imbricated disk.

背景技术 Background technique

[0002] SMR (Shingled Magnetic Record,叠瓦状磁记录)技术可以通过对现有硬盘磁道进行部分重叠覆盖来减小磁道宽度,从而提高记录密度。 [0002] SMR (Shingled Magnetic Record, imbricated recording) techniques may be used to reduce the track width by partially overlapping coverage of existing hard track, thereby improving the recording density.

[0003] 分布式Key-Value存储系统具有查询速度快、存放数据量大、支持高并发等优点, 非常适合通过主键进行查询。 [0003] Key-Value distributed storage systems with fast query speed, the amount of data storage, the advantages of high concurrency support, is suitable for the query by the primary key.

[0004] 在实现本发明的过程中,发明人发现现有技术至少存在以下问题:由于SMR硬盘的磁道很窄,在将数据写入某一个磁道中时将会对其相邻一定数量的磁道中的数据产生写覆盖,从而导致相邻磁道中的数据失效。 [0004] During the implementation of the present invention, the inventors found that the prior art at least has the following problems: Since the hard drive is very narrow SMR track, the track will be a certain number of its neighboring when data is written in one track overwriting the data generated, resulting in the failure data of the adjacent tracks. 因此,不能直接将Key-Value存储系统布局方案移植到SMR硬盘上,导致SMR硬盘的写入性能较低。 Thus, not directly to the Key-Value storage system SMR layout scheme grafted onto the hard disk, resulting in lower write performance of hard disk SMR.

发明内容 SUMMARY

[0005] 为了解决不能直接将Key-Value存储系统布局方案移植到Si®硬盘上的问题,本发明实施例提供了一种将数据写入叠瓦状磁记录SMR硬盘的方法及装置。 [0005] In order to solve the problem on the hard disk can not directly Si® Key-Value storage system layout program ported to, embodiments of the present invention provide a method and apparatus for writing data into the magnetic recording SMR imbricated disk. 所述技术方案如下: The technical solutions are as follows:

[0006] 第一方面,提供了一种将数据写入叠瓦状磁记录SMR硬盘的方法,所述SMR硬盘包括多个根据磁轨带band虚拟化后得到的chunk,所述方法包括: [0006] In a first aspect, there is provided a method of writing data to a magnetic recording SMR imbricated disk, a hard disk comprising a plurality of the SMR comprising the chunk, the method tracks with the obtained virtual band:

[0007] 接收写数据指令,所述写数据指令包括键、数据和标记,所述键用于标识所述数据,所述标记为写标记、删除标记或修改标记,所述写标记用于表示将所述数据写入所述SMR硬盘中,所述删除标记用于表示删除所述SMR硬盘中具有所述键的数据,所述修改标记用于表示利用所述数据修改具有相同键且己被写入所述SMR硬盘的数据; [0007] receiving a write data command, the write command data includes a key, data and tag, the data identifying the key, the label is written mark, modify, or delete flag mark, for indicating the write flag the SMR data is written to the hard disk, deleting the deletion indicates the SMR hard disk data having the key, using the modified numerals are used to modify the data with the same key and have been the SMR disk write transactions;

[0008] 根据数据记录的长度向正在使用的chunk申请空间,所述数据记录包括所述写数据指令中的所述键、所述数据和所述标记; [0008] Application to the chunk of space being used, the data comprises recording the write data of the key instructions, the data and the mark according to the length of the data record;

[0009] 将所述数据记录写入申请的所述空间中; [0009] The recording space of the data written in the application;

[0010] 保存所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址。 [0010] The save button, the mark and the data written to the address of the chunk is being used in.

[0011] 在第一方面的第一种可能的实施方式中,所述正在使用的chunk中包含用于存储数据记录的数据区,所述根据数据记录的长度向正在使用的chunk申请空间,包括: [0011] In a first possible embodiment of the first aspect, the chunk being used contains a data area for storing data records, the data record according to the length of the chunk being used to space applications, comprising :

[0012] 根据所述数据记录的长度向所述正在使用的chunk中的所述数据区申请空间。 [0012] Application of the spatial data chunk according to the length of the area to the data recording is being used by.

[0013] 结合第一方面或者第一方面的第一种可能的实施方式,在第二种可能的实施方式中,所述正在使用的chunk中包含用于存储索引记录的索引区,所述保存所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址,包括: [0013] with the first aspect or the first possible embodiment of the first aspect, in a second possible embodiment, the chunk is being used in the area for storing the index includes an index record, saving the said key, said data being written to the tag address of the chunk being used, comprising:

[0014]将所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址组成索引"i 己; [0014] the key, the indicia and the data written to the address of the chunk is being used in the composition of the index "i-hexyl;

[0015]将所述索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在所述正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区。 Alternatively, when the remaining space in the chunk is being used is not sufficient to assign a data write instruction data to be written; [0015] The index records stored in memory to the first memory area and the corresponding chunk is being used , the index area of ​​the chunk index within the memory of the first storage area to store the records being used in.

[G016]结合第一方面、第一方面的第一种可能的实施方式或者第一方面的第二种可能的实施方式,在第三种可能的实施方式中,所述将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区之后,还包括: [G016] binding a first aspect, the first possible embodiment of the first aspect or the second aspect of the first possible embodiment, in a third possible embodiment, the memory of the after said storing the index record to the chunk being used in the index area in the first storage area, further comprising:

[0017]将所述正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0017] The properties of the chunk is being used to modify the used and unused chunk apply as the next write data chunk being used;

[0018]将所述第一存储区域内的所述索引记录存储至所述内存中与已使用的chunk对应的第二存储区域; [0018] The index of the first storage area in the record stored in said second storage area in memory and corresponding to the used chunk;

[0019]清除所述第一存储区域内的所述索引记录。 [0019] clearing the index record in said first storage area.

[0020]结合第一方面、第一方面的第一种可能的实施方式、第一方面的第二种可能的实施方式或者第一方面的第三种可能的实施方式,在第四种可能的实施方式中,所述方法还包括: [0020] with the first aspect, the first possible embodiment of the first aspect, a second possible embodiment of the first aspect of the first aspect or the third possible embodiment, in a fourth possible embodiment, the method further comprising:

[0021] 在重启所述硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; [0022] 将所述已使用的chunk中存储的索引记录,写入所述内存中与已使用的chunk对应的第二存储区域; [0021] When restarting the hard disk, and determining chunk chunk being used according to the attributes used in the chunk; [0022] The index records stored in the chunk has been used, has been written in the memory and used a second storage area corresponding to chunk;

[0023] 根据所述正在使用的chunk中存储的数据记录,重建与所述数据记录对应的索引记录,并将重建得到的所述索引记录写入所述内存中与正在使用的chunk对应的第一存储区域。 [0023] The data recording in use of the chunk stored in the index and the reconstructed data record corresponding to the record index record, and writes the resulting reconstructed memory chunk being used with the corresponding first a storage area.

[0024]结合第一方面、第一方面的第一种可能的实施方式至第一方面的第四种可能的实施方式中的任一种实施方式,在第五种可能的实施方式中,所述重建得到的所述索引记录包括:所述数据记录中数据的键、与所述数据对应的标记以及所述数据被写入所述正在使用的chunk中的地址。 [0024] with the first aspect, one embodiment of any of the first possible embodiment of the first aspect to the fourth aspect of the first embodiment is possible, in a fifth possible embodiment, as the index of said reconstructed obtained recording comprises: recording said data in the key data, corresponding to the data tag and the data written to the address of the chunk is being used in.

[0025] 第二方面,提供了一种将数据写入叠瓦状磁记录SMR硬盘的装置,所述SMR硬盘包括多个根据磁轨带band虚拟化后得到的chunk,所述装置包括: [0025] a second aspect, there is provided a data writing apparatus imbricated SMR magnetic disk, a hard disk SMR chunk comprises a plurality of tracks in accordance with the obtained virtual band, the apparatus comprising:

[0026]接收模块,用于接收写数据指令,所述写数据指令包括键、数据和标记,所述键用于标识所述数据,所述标记为写标记、删除标记或修改标记,所述写标记用于表示将所述数据写入所述SMR硬盘中,所述删除标记用于表示删除所述SMR硬盘中具有所述键的数据,所述修改标记用于表示利用所述数据修改具有相同键且已被写入所述SMR硬盘的数据; [0026] a receiving module configured to receive a write data command, the write command data includes a key, data and tag, the data identifying the key, the label is written mark, modify, or delete flag tag, the write flag for indicating data written to the hard disk in the SMR, the deletion of the SMR indicates deleting data having the hard disk key, using the modified numerals are used to modify the data having the same key and have been written into the hard disk data SMR;

[0027] 申请模块,用于根据数据记录的长度向正在使用的chunk申请空间,所述数据记录包括所述写数据指令中的所述键、所述数据和所述标记; [0027] The application module configured to apply spatial chunk being used, according to the data record length of the data record comprises a write data command in said key, the data and the marker;

[0028] 第一写入模块,用于将所述数据记录写入申请的所述空间中; [0028] The first write module, the space for recording the data written in the application;

[0029] 保存模块,用于保存所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址。 [0029] The storage module, for storing the keys, the marking of the data written to the address of said chunk being used in.

[0030] 在第二方面的第一种可能的实施方式中,所述正在使用的chunk中包含用于存储数据记录的数据区,所述申请模块用于根据所述数据记录的长度向所述正在使用的chunk 中的所述数据区申请空间。 [0030] In a first possible embodiment of the second aspect, the chunk is in use contained in the data area for storing data records, the length of the application module according to the data record the chunk data area being used in space applications.

[0031] 结合第二方面或者第二方面的第一种可能的实施方式,在第二种可能的实施方式中,所述正在使用的chunk中包含用于存储索引记录的索引区,所述保存模块,包括: [0031] or in combination with the second aspect of the first possible embodiment of the second aspect, the chunk in a second possible embodiment, the index being used contains a recording area for storing an index of the preservation modules, including:

[0032]组成单元,用于将所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址组成索引记录; [0032] The composition unit for the key, the indicia and the data written to the address of the chunk is being used in the composition of the index record;

[0033]保存单元,用于将所述索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在所述正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区。 [0033] storage unit, for saving the storage area to the first index record in memory corresponding to the chunk being used; or the write instruction requires data chunk in the remaining space is insufficient to use in the dispensing when writing data, the index area of ​​the chunk index within the memory of the first storage area to store the records being used in.

[0034]结合第二方面、第二方面的第一种可能的实施方式或者第二方面的第二种可能的实施方式,在第三种可能的实施方式中,所述装置还包括: [0034] combination with the second aspect, the first possible embodiment of the second aspect or the second possible embodiment of the second aspect, in a third possible embodiment, the apparatus further comprising:

[0035]修改模块,用于将所述正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0035] The modification module, for the chunk is being used to modify the properties of used and unused chunk apply as the next write data chunk being used;

[OO36]存储模块,用于将所述第一存储区域内的所述索引记录存储至所述内存中与已使用的chunk对应的第二存储区域; [OO36] storage module for the index in the first storage area to the second storage area storing records of said memory and corresponding to the used chunk;

[0037]清除模块,用于清除所述第一存储区域内的所述索引记录。 [0037] Clear means for recording the index in the first storage area to clear.

[0038]结合第二方面、第二方面的第一种可能的实施方式、第二方面的第二种可能的实施方式或者第二方面的第三种可能的实施方式,在第四种可能的实施方式中,所述装置还包括: [0038] combination with the second aspect, the first possible embodiment of the second aspect, a second possible embodiment of the second aspect or the third aspect of the second possible embodiment, in a fourth of the possible embodiment, the apparatus further comprising:

[0039] 确定模块,用于在重启所述硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; [0039] The determining module, configured to, when restarting the hard disk, and determining chunk chunk being used according to the attributes used in the chunk;

[0040] 第二写入模块,用于将所述己使用的chunk中存储的索引记录,写入所述内存中与已使用的chunk对应的第二存储区域; [0040] The second writing means for recording the index of the chunk used already stored in the second storage area is written in the memory corresponding to the chunk has already been used;

[0041] 重建模块,用于根据所述正在使用的chunk中存储的数据记录,重建与所述数据记录对应的索引记录,并将重建得到的所述索引记录写入所述内存中与正在使用的chunk对应的第一存储区域。 [0041] The reconstruction module, according to the data recording is being used chunk stored in the index and the reconstructed data record corresponding to the record index record, and writes the resulting reconstructed memory is being used and a first chunk of the corresponding memory area.

[0042] 结合第二方面、第二方面的第一种可能的实施方式至第二方面的第四种可能的实施方式中的任一种实施方式,在第五种可能的实施方式中,所述重建得到的所述索引记录包括:所述数据记录中数据的键、与所述数据对应的标记以及所述数据被写入所述正在使用的chunk中的地址。 [0042] combination with the second aspect, one embodiment of any of the first possible embodiment of the second aspect to the fourth aspect of the second embodiment is possible, in a fifth possible embodiment, as the index of said reconstructed obtained recording comprises: recording said data in the key data, corresponding to the data tag and the data written to the address of the chunk is being used in.

[0043] 第三方面,提供了一种将数据写入叠瓦状磁记录SMR硬盘的装置,应用于包含有所述SMR硬盘的设备中,所述SMR硬盘包括多个根据磁轨带band虚拟化后得到的chunk,所述装置包括:接收机和处理器,其中处理器与接收机耦合; [0043] a third aspect, there is provided an apparatus for writing data to a magnetic recording SMR imbricated disk, applied with a hard disk device of the SMR, the SMR virtual hard disk comprises a plurality of tracks in accordance with a band after the obtained product chunk, the apparatus comprising: a receiver and a processor, wherein the processor coupled to the receiver;

[0044] 所述接收机,用于接收写数据指令,所述写数据指令包括键、数据和标记,所述键用于标识所述数据,所述标记为写标记、删除标记或修改标记,所述写标记用于表不将所述数据写入所述SMR硬盘中,所述删除标记用于表示删除所述SMR硬盘中具有所述键的数据, 所述修改标记用于表示利用所述数据修改具有相同键且已被写入所述SMR硬盘的数据; [0044] The receiver for receiving a write data command, the write command data includes a key, data and tag, the data identifying the key, the label is written mark, modify, or delete flag tag, the table does not write flag for writing the data into the hard disk SMR, deleting the deletion indicates the SMR hard disk data having the bond, the modified numerals are used with the data modification and data with the same key that has been written to the hard disk of the SMR;

[0045] 所述处理器,用于根据数据记录的长度向正在使用的chunk申请空间,所述数据记录包括所述写数据指令中的所述键、所述数据和所述标记; [0045] The processor is configured to apply spatial chunk being used, according to the data record length of the data record comprises a write data command in said key, the data and the marker;

[0046] 所述处理器,还用于将所述数据记录写入申请的所述空间中; [0046] The processor is further configured to record the spatial data to the application, write;

[0047] 所述处理器,还用于保存所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址。 The [0047] processor is further configured to store the key, the indicia and the data written to the address of the chunk is being used in.

[0048] 在第三方面的第一种可能的实施方式中,所述正在使用的chunk中包含用于存储数据记录的数据区,所述处理器还用于根据所述数据记录的长度向所述正在使用的chunk 中的所述数据区申请空间。 [0048] In a first possible embodiment of the third aspect, the chunk is in use contained in the data recording area for storing data, said processor is further configured according to the length of the data record to the applying said data area of ​​said space in the chunk is being used.

[0049]结合第三方面或者第三方面的第一种可能的实施方式,在第二种可能的实施方式中,所述正在使用的chunk中包含用于存储索引记录的索引区,所述处理器,还用于将所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址组成索引记录; [0049] reference to the third aspect or the first possible embodiment of the third aspect, in a second possible embodiment, the chunk is being used in the area for storing the index includes an index record, the process , further for the key, the indicia and the data written to the address of the chunk is being used in the composition of the index record;

[0050]所述处理器,还用于将所述索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在所述正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区。 [0050] The processor is further configured to store the index record area in memory to the first memory and corresponding to the chunk being used; alternatively, the remaining space in the chunk is being used is not sufficient to write data distribution instruction data to be written, the index within the memory of the first storage area of ​​the index recording area to store the chunk is being used by.

[0051]结合第三方面、第三方面的第一种可能的实施方式或者第三方面的第二种可能的实施方式,在第三种可能的实施方式中,所述处理器,还用于将所述正在使用的chunk的属性修改为己使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0051] reference to the third aspect, the first possible embodiment of the third aspect or the second aspect of the third embodiment may, in a third possible embodiment, the processor is further configured to the attribute being used to modify the chunk used for himself, and apply a chunk as unused chunk next write data being used;

[OO52]所述处理器,还用于将所述第一存储区域内的所述索引记录存储至所述内存中与已使用的chunk对应的第二存储区域; [OO52] The processor is further configured to index said first storage area in the record stored in said second storage area in memory and corresponding to the used chunk;

[0053] 所述处理器,还用于清除所述第一存储区域内的所述索引记录。 [0053] The processor is further configured to remove the index record in the first storage area.

[0054]结合第三方面、第三方面的第一种可能的实施方式、第三方面的第二种可能的实施方式或者第三方面的第三种可能的实施方式,在第四种可能的实施方式中,所述处理器, 还用于在重启所述硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; [0054] reference to the third aspect, the first possible embodiment of the third aspect, a second possible embodiment of the third aspect or the third aspect of the embodiment of a third possible embodiment, in a fourth possible embodiment, the processor is further configured to, when restarting the hard disk, and determining chunk chunk being used according to the attributes used in the chunk;

[OO55] 所述处理器,还用于将所述已使用的chunk中存储的索引记录,写入所述内存中与已使用的chunk对应的第二存储区域; [OO55] The processor is further configured to index records used in the chunk stored in the second memory area is written to the memory has been used with a corresponding chunk;

[00¾]所述处理器,还用于根据所述正在使用的chunk中存储的数据记录,重建与所述数据记录对应的索引记录,并将重建得到的所述索引记录写入所述内存中与正在使用的chunk对应的第一存储区域。 [00¾] The processor is further configured to record the data of the chunk is stored using the index to the data recording reconstruction index record corresponding to the record, and writes the resulting reconstructed memory the first storage area corresponding to the chunk being used.

[0057]结合第三方面、第三方面的第一种可能的实施方式至第三方面的第四种可能的实施方式中的任一种实施方式,在第五种可能的实施方式中,所述重建得到的所述索引记录包括:所述数据记录中数据的键、与所述数据对应的标记以及所述数据被写入所述正在使用的chunk中的地址。 Any one of Embodiment [0057] reference to the third aspect, the first possible embodiment of the third aspect to the third aspect of a fourth possible embodiment, in a fifth possible embodiment, as the index of said reconstructed obtained recording comprises: recording said data in the key data, corresponding to the data tag and the data written to the address of the chunk is being used in.

[0058]本发明实施例提供的技术方案带来的有益效果是: [0058] Embodiments of the invention provide a technical solution is beneficial effects:

[0059]通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上,导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得至IJ,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0059] By comprising the data record key, and the data tag writes the chunk being used; as the write data generated in accordance with command data recording and data keys, and therefore, can not be solved directly distributed storage system layout SMR program ported to the hard disk, resulting in lower write performance of hard disk SMR problems; chunk the band due to too virtualization IJ, between each chunk of data can be written randomly, thus achieving the hard disk write can be improved SMR flexibility effect data.

附图说明 BRIEF DESCRIPTION

[0060]为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。 [0060] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, as briefly described in the introduction to the accompanying drawings required for use in describing the embodiments. Apparently, the drawings in the following description are only some of the present invention. embodiments, those of ordinary skill in the art is concerned, without creative efforts, can derive from these drawings other drawings.

[0061]图1是本发明一实施例中提供的SMR硬盘的空间布局示意图; [0061] FIG. 1 is a hard disk provided in the SMR spatial layout diagram of a embodiment of the present invention;

[0062]图2是本发明一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的方法流程图; [0063]图3A是本发明另一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的方法流程图; [0062] FIG 2 is a flowchart of a method to write data provided in the examples imbricated magnetic recording disk of the present invention, a SMR embodiment; [0063] FIG 3A is an embodiment of the data provided in another embodiment of the present invention, the write stack the method of tile-like magnetic recording disk SMR flowchart;

[0064]图3B是本发明一实施例中提供的chunk的切换过程的示意图; [0064] FIG. 3B is a schematic diagram of handover process in providing a chunk of the embodiment of the present invention;

[0065]图4是本发明一实施例中提供的垃圾清理过程的示意图; [0065] FIG. 4 is a schematic view of the present invention, waste disposal process according to an embodiment is provided;

[0066]图5是本发明再一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的方法流程图; [0066] FIG. 5 is a flowchart of a method of the present invention is further provided in the embodiment to write data imbricated one embodiment of the magnetic recording disk SMR;

[0067]图6是本发明一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的装置的结构方框图; [0067] FIG. 6 is a block diagram showing the data provided in SMR hard magnetic writing means imbricated to an embodiment of the present invention;

[0068]图7是本发明另一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的装置的结构方框图; [0068] FIG. 7 is a block diagram of the data provided in a hard disk writing device SMR magnetic imbricate structure of another embodiment of the present invention;

[0069]图8是本发明一实施例中提供的包含有SMR硬盘的设备的结构方框图; [0069] FIG. 8 is a block diagram of a hard disk with SMR device structure of the embodiment of the present invention is provided in a;

[0070]图9是本发明另一实施例中提供的包含有SMR硬盘的设备的结构方框图。 [0070] FIG. 9 is a block diagram showing a configuration of a hard disk with SMR device according to another embodiment of the present invention.

具体实施方式 detailed description

[0071]为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。 [0071] To make the objectives, technical solutions, and advantages of the present invention will become apparent in conjunction with the accompanying drawings of the following embodiments of the present invention will be described in further detail.

[0072]请参考图1,其示出了本发明一实施例中提供的SMR硬盘的空间布局示意图,该SMR 硬盘在逻辑上可以划分为系统元数据区110和记录区120。 [0072] Please refer to FIG. 1, which shows the spatial layout of the embodiment provides a schematic view of a hard disk SMR embodiment of the present invention, the SMR hard disk can be logically divided into a system area 110 and the metadata recording area 120.

[0073]系统元数据区110包括至少一个超级记录块130,超级记录块130包括至少一个超级块140,超级块140用于记录记录区120中各个chunkl50的属性和使用信息。 [0073] The system 110 includes at least a metadata region records a super block 130, the super block 130 comprises recording at least one super-block 140, 120 in each super-block 140 chunkl50 attribute area and for recording usage information.

[0074]由于超级块140需要频繁地更新记录区120中各个chunkl50的属性和使用信息,如果固定使用一个超级块140进行记录,可能导致超级块140所在磁盘空间故障。 [0074] Because the superblock needs to be frequently updated attribute 140 and 120 use the information recording area of ​​each chunkl50, if using a super fixed block 140 is recorded, may lead to block 140 where the super disk space fault. 因此,需要多个超级块140来记录记录区120中各个chunkl50的属性和使用信息。 Accordingly, the plurality of super-blocks 140 to 120 in the respective recording chunkl50 recording area attribute information and use. 超级块140的大小可以根据记录区120中信息的大小来确定,超级块140的个数可以根据超级块140能被重复写入的次数来确定,且超级块140能被重复写入的次数越多,超级块140的个数可以设置得越少。 Size of superblock 140 may be determined according to the size of the information recording area 120, the number of super-block 140 may be determined according to the number of super-block 140 can be written to duplicate, and the super block number 140 can be written to duplicate the more, the number of super block 140, the less may be provided. 而超级记录块130的个数则可以根据超级块140的个数以及大小来确定。 The number of super block 130 is recorded may be determined according to the number and the size of superblock 140. 在实际应用场景中,超级记录块130中的超级块140的个数,以及超级块140中包含的信息可以根据实际使用时的情况进行变化。 In the practical application scenarios, the number of super-super-block 140 in the recording block 130, and the information contained in the super block 140 may vary according to the time of actual use.

[0075]可选的,超级记录块130中的超级块140还可以包括第一全局变量,该第一全局变量用于标识各个超级块140的先后使用顺序。 [0075] Alternatively, in block 130 the super super record block 140 may further include a first global variables, global variables used to identify the first super block 140 has respective order of use. 举例来讲,可以在每申请一个超级块140后,将第一全局变量加1后作为申请到的超级块140的第一全局变量。 After speaking example, after each application may be a super block 140, the global variable is incremented by a first super block of the first application to the global variable 140. 比如,当前,在申请到超级块140后,查找到前一次申请的超级块140的第一全局变量为100,则将该第一全局变量加1得到新的第一全局变量101,将该第一全局变量101作为当前超级块140的第一全局变量。 For example, the current, after applying to the super block 140, the first global variable to find the super block 140 to the previous application is 100, then the global variable is incremented by 1 to obtain a first new first global variables 101, the first a global variable 101 as the current super block 140 of the first global variable. 需要说明的是,第一全局变量每次增加的数值也可以是其它值,比如2,3等,只需要保证在后申请的超级块140的第一全局变量大于在前申请的超级块140的第一全局变量。 Incidentally, the first global variable is incremented value may be other values, such as 2, 3, etc., only to ensure that the super block is the first global variable 140 after application is greater than the earlier applications superblock 140 The first global variables.

[0076] 记录区120包括至少一个chunkl50,这里的chunkl50是根据SMR硬盘中的磁轨带band虚拟化后得到的。 [0076] 120 includes at least one recording area chunkl50, chunkl50 SMR here is based on the hard disk with a magnetic track band obtained after virtualization. 根据chunkl50的使用情况,可以将chunkl50分为已使用的chunk、正在使用的chunk和未使用的chunk。 According to the use of chunkl50, chunkl50 can be divided chunk has been used, chunk chunk is being used and unused. 记录区120用于存储数据记录以及与数据记录对应的索引记录。 A recording area 120 for storing data records and index records corresponding to the data recording.

[0077] 需要说明的是,记录区120中Chunkl50的种类可以根据实际使用时的情况进行变化,可选的,记录区120中还可以包含其它种类的chunk。 [0077] Incidentally, in the recording area 120 Chunkl50 species may vary depending on the time of actual use, optionally, recording area 120 may also include other types of chunk.

[0078] 可选的,记录区120中的chunkl50包括数据区160和索引区170。 [0078] Alternatively, chunkl50 region 120 includes a data recording area 160 and the index area 170.

[0079] 数据区160可以用于存储至少一条数据记录,每条数据记录至少包括键、标记和数据中的前两种或全部。 [0079] The data area 160 may be used to store at least one data record, each data record comprising at least the first two or all of the key, tag and data.

[0080] 数据记录中包含的信息种类可以根据数据记录的标记类型来确定。 [0080] Data type information contained in the record may be determined according to the type of data record mark. 比如,当数据记录的标记是删除标记时,该删除记录内可以只包括键和标记;当数据记录的标记类型是写标记或修改标记时,该写入记录或修改记录内可以包括键、标记和数据。 For example, when the marker tag data record is deleted, the delete key may include only the recording and marking; type when the flag data record mark is written or modified mark, the written record or modify the record may include a key, tag and data.

[0081] 可选的,数据记录还可以包括其他信息,比如,校验信息、键长度信息和数据长度信息等,本实施例对数据记录中包含的其他信息不作具体限定。 [0081] Alternatively, the data record may also include other information, such as parity information, key length information and data length information, etc., the present embodiment to other information contained in the data record is not particularly limited.

[0082] 可选的,数据记录还可以包括第二全局变量,该第二全局变量用于标识各条数据记录的被写入的先后顺序。 [0082] Alternatively, the data records may also include a second global variables, global variables of the second order for writing the pieces of identification data records. 举例来讲,在每写一条数据记录时,可以将前一次写入的数据记录的第二全局变量加1后作为当前写入的数据记录的第二全局变量。 The second example of global variables in terms of data records, one at each write data record can be written to once before after adding a second global variable data record currently being written to. 比如,在写入当前的数据记录时,查找到前一次写入的数据记录的第二全局变量为200,则将该第二全局变量加1 得到新的第二全局变量201,将该第二全局变量201作为当前数据记录的第二全局变量。 For example, when writing the current data record, find data record previous to the second write global variable 200, then the second global variable is incremented by 1 to obtain the new second global variables 201, and the second global variables global variables 201 as the second current data record. 需要说明的是,第二全局变量每次增加的数值也可以是其它值,比如2,3等,只需要保证在后写入的数据记录的第二全局变量大于在前写入的数据记录的第二全局变量。 Incidentally, the second increments the value of the global variables may also be other values, such as 2, 3, etc., to ensure that only the second write global variable after the data record is greater than a previous write data record The second global variables.

[0083]需要说明的是,数据记录中的键、标记和数据的相对位置可以根据实际使用时的情况进行变化。 [0083] Incidentally, the relative position of the key, and data labeled data record may vary depending on the time of actual use.

[0084]索引区170用于存储与数据记录一一对应的索引记录,与数据记录对应的索引记录至少包括与数据记录中相同的键、标记以及数据记录在SMR硬盘上的地址。 [0084] The index area 170 for storing the data record index record one correspondence with the recording data corresponding to the index record comprises at least an address of the same key, and the data recording mark SMR on the hard disk with the data record.

[0085] 数据区160中的数据记录与索引区170中的索引记录是一一对应关系,举例来讲, 如图1所示,数据记录1对应索引记录1,数据记录2对应索引记录2。 [0085] data area in the data recording area 160 of the index record 170 is index-one relationship, in terms of for example, as shown, an index record corresponding to the recording data 1, data 2 corresponding to the record index record in FIG. 12. 需要说明的是,图1中数据记录1、数据记录2、索引记录1和索引记录2的相对位置仅是示意,本实施例对此不作限定。 Incidentally, the data record 1 in FIG. 1, 2 recording data, recording the relative positions of the index 1 and index 2 record merely illustrative, the present embodiment is not limited to this embodiment.

[0086] 可选的,索引记录还可以包括与数据记录对应的第二全局变量。 [0086] Alternatively, the recording may also include a second index of global variables corresponding to the data recording. 且索引记录中的键、标记以及地址的相对位置可以根据实际使用时的情况进行变化。 The relative position of the key, and the address of the marker and the index record may vary depending on the time of actual use.

[0087] 需要说明的是,系统元数据区110和记录区120在SMR硬盘上的相对位置可以根据实际使用时的情况进行变化。 [0087] Note that the relative position of the system area 110 and the metadata recording area 120 on the hard disk SMR may vary depending on the time of actual use.

[0088] 综上所述,本实施例提供的SMR硬盘,通过将SMR硬盘划分成系统元数据区和记录区,记录区用于存储数据记录以及与数据记录对应的索引记录,系统元数据区用于记录记录区中各个chunk的属性和使用信息;由于为SMR硬盘中每条数据记录都建立了索引记录, 因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上,导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0088] In summary, SMR hard disk provided in this embodiment, by a hard disk into the SMR system metadata area and recording area, a recording area for storing data corresponding to the data recording, and recording the index record, the system metadata area recording area for each attribute and chunk usage information; SMR due to the hard disk, each data record index record is established, therefore, to solve the distributed storage system can not be directly ported to SMR layout scheme hard disk, resulting in SMR lower write performance of hard disk problems; as obtained according to the band virtualization chunk may be randomly write data between each chunk, thereby achieving an effect that can increase the flexibility of writing data in the hard disk SMR.

[0089] 请参考图2,其示出了本发明一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的方法流程图,该将数据写入叠瓦状磁记录SMR硬盘的方法可以用于包含有SMR硬盘的设备中,该将数据写入叠瓦状磁记录SMR硬盘的方法,可以包括: Method [0089] Please refer to FIG 2, which shows a flowchart of a method of the present invention, the data provided in the magnetic recording write imbricated SMR embodiment a hard disk, writing data to the magnetic recording imbricated disk SMR SMR may be used with a hard disk apparatus, the data writing method imbricated SMR magnetic disk, may include:

[0090] 步骤201,接收写数据指令,写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记,写标记用于表示将该数据写入SMR硬盘中,删除标记用于表示删除SMR硬盘中具有该键的数据,修改标记用于表示利用该数据修改具有相同键且已被写入SMR硬盘的数据; [0090] Step 201 receives the write data command, the write command includes a key data, tag data and key identification data, write flag marked, labeled or modified to delete mark, for indicating the write flag data is written to the hard disk SMR , the deletion flag for indicating to delete the data having the SMR hard keys, numerals are used to modify the modified data using the data with the same key and have been written to the hard disk of the SMR;

[0091] 步骤202,根据数据记录的长度向正在使用的chunk申请空间,数据记录包括写数据指令中的键、数据和标记; [0091] Step 202, according to the space length of the data record to the application being used chunk, data recording instruction includes a write data key, and the data tag;

[0092] 步骤203,将数据记录写入申请的空间中; [0092] Step 203, the space in the data record is written application;

[0093] 步骤204,保存键、标记与数据被写入正在使用的chunk中的地址。 [0093] Step 204, the save button, the data is written to address tag being used in the chunk.

[0094]综上所述,本实施例提供的将数据写入叠瓦状磁记录SMR硬盘的方法,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上, 导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0094] In summary, the method of writing data according to SMR imbricated magnetic disk of the present embodiment, by containing key data record, data and tag writes the chunk being used; Since the write data generating instruction data record includes key data and, therefore, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization It may be randomly write data between each chunk, thereby achieving an effect that can increase the flexibility of writing data in the hard disk SMR.

[0095] 在实际使用时,为了便于读取SMR硬盘中存入的数据,SMR所在的设备需要对chunk 的索引记录进行持久化,具体请参考图3A,其示出了本发明另一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的方法流程图,该将数据写入叠瓦状磁记录SMR硬盘的方法可以用于包含有SMR硬盘的设备中,该将数据写入叠瓦状磁记录SMR硬盘的方法,可以包括: [0095] In actual use, in order to facilitate the reading of the data stored in the hard disk SMR, SMR device where chunk index records need to be persistent, details, please refer to Figure 3A, which shows another embodiment of the present invention the methods flowchart write data supplied imbricated SMR magnetic disk, writing data to the magnetic recording imbricated SMR SMR hard disk may be used with apparatus, which writes the data stack the method of tile-like magnetic recording disk SMR, may include:

[0096]步骤301,接收写数据指令; [0096] Step 301 receives the write command data;

[0097]这里的写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记,写标记用于表示将该数据写入SMR硬盘中,删除标记用于表示删除SMR硬盘中具有该键的数据,修改标记用于表示利用该数据修改具有相同键且已被写入SMR硬盘的数据。 [0097] Here the write command includes a key data, tag data and key identification data, write flag marked, labeled or modified to delete mark, for indicating the write flag data is written to the hard disk SMR, a deletion mark It means to delete the data having the SMR hard keys, numerals are used to modify the modified data using the data with the same key and have been written to the hard disk SMR.

[0098] 步骤302,根据数据记录的长度向正在使用的chunk中的数据区申请空间; [0098] Step 302, the chunk is being used to apply space in the data area according to the length of the data record;

[0099] 数据记录包括写数据指令中的键、数据和标记。 [0099] Data recording instruction includes a write data key, and the data tag.

[0100]可选的,在步骤302之前,通常还可以包括根据写数据指令生成数据记录。 [0100] Optionally, prior to step 302, typically also may include generating a data record according to the write data command.

[0101] SMR所在的设备在接收到写数据指令后,可以根据该写数据指令按照数据记录的格式生成一条数据记录。 [0101] SMR device is located after receiving the write command data, a data record may be generated in accordance with the data recording format of the write data based on the instruction. 当写数据指令中不包括数据或包含的数据为空时,数据记录可以只包括键和标记,比如该写数据指令的标记为删除标记时,该写数据指令通常不包括数据。 When the write data comprises data or instructions do not include empty, the data record may include only the keys and tags, such as the write data when the instruction is marked for deletion flag, the write data is the data typically do not include instructions. [0102] SMR所在的设备在接收到写数据指令后,确定该写数据指令的标记类型,根据该写数据指令的标记类型生成相应的数据记录,具体实现可以参见以下三种实现方式。 [0102] SMR device is located after the write data command is received, the type determination flag of the write data instruction, generating a corresponding data record in accordance with a type of the mark write data instruction, the specific implementation can refer to the following three implementations.

[0103] 在一种实现方式中,当写数据指令包括的标记为删除标记时,按照数据记录的格式,将写数据指令中携带的键和标记组合成一条数据记录。 [0103] In one implementation, when a write command including data of mark marked for deletion, according to the format of the data recording, the write data instruction carries keys and combined into a data record mark.

[0104] 在另一种实现方式中,当写数据指令包括的标记为写标记时,按照数据记录的格式,将写数据指令中携带的数据、键以及标记组合成一条数据记录。 [0104] In another implementation, when the flag of the write data comprises a write instruction mark, according to the format of the data recording, the write data instruction carries data, keys and combined into a data record mark.

[0105]在还一种实现方式中,当写数据指令包括的标记为修改标记时,按照数据记录的格式,将写数据指令中携带的数据、键以及标记组合成一条数据记录。 [0105] In yet another implementation, the write data when the flag modifying instruction is included in the tag, according to the format of the data recording, the write data instruction carries data, keys and combined into a data record mark.

[0106] 也就是说,当写数据指令包括的标记为删除标记时,根据该写数据指令生成的数据记录中通常包含键和标记;而当写数据指令包括的标记为写标记或修改标记时,根据该写数据指令生成的数据记录中通常包含键、标记和数据。 Whereas when the tag data write instruction includes a write mark or flag modification; [0106] That is, when the write instruction included in the data marked as deleted tag, write data to the data recording command generated keys and indicia generally comprise the data recording to the write data command generated generally contains the key, tag and data.

[0107] SMR所在的设备可以计算数据记录的长度,并通过SMR硬盘中系统元数据区内的超级块来获取记录区中各个chunk的属性,根据各个chunk的属性确定出当前正在使用的chunk,并在内存中查找到与该正在使用的chunk中的数据记录对应的索引记录,根据查找到的索引记录中的最后被写入数据的地址以及最后被写入数据的长度,确定该正在使用的chunk最后被写入的位置。 [0107] SMR device is located may be calculated length of the data recorded in the recording area and acquires attribute of each chunk of the hard disk through the superblock SMR system metadata area, chunk currently being used is determined according to the attribute of each chunk, and recording the data to find the chunk is being used by a corresponding index record in memory, the address of the last written data is found in the index record and the length of the last written data being used to determine the the last chunk is written. 这里确定的最后被写入的位置是指最后被写入数据的末尾位置。 Determining the position of the last written herein refers to the end of the last written location data. [0108] SMR所在的设备根据生成的数据记录的长度从当前正在使用的chunk中最后被写入的位置开始分配与生成的数据记录的长度相同的空间。 [0108] SMR device where the same length are allocated beginning with the generation of the position data record length generated from the last written chunk currently being used in the data recording space.

[0109]需要说明的是,当正在使用的chunk中的剩余空间小于生成的数据记录的长度时, 需要申请一个未使用的chunk来进行空间分配。 [0109] Incidentally, when the remaining space in the chunk is less than the data used to generate the record length, a chunk need to apply to unused space allocation.

[0110] 步骤303,将数据记录写入申请的空间中; [0110] Step 303, the space in the data record is written application;

[0111] 步骤304,将键、标记与数据被写入正在使用的chunk中的地址组成索引记录; [0111] Step 304, the key, and the flag is written to address chunk being used in the composition of the index record;

[0112] 这里的键和标记与数据记录里的键和标记相同,SMR所在的设备将键、标记和数据被写入正在使用的chunk中的地址的组合确定为该数据记录的索引记录。 [0112] with the same numerals and the key data in the record where the mark and the key, where the key SMR device, and marking the address and data is written in the chunk is being used for determining the index records the data record.

[0113] 需要说明的是,本实施例对索引记录中的键、标记和地址的相对位置不作限定。 [0113] Incidentally, the present embodiment of the relative position of the key, and the address mark of the index register is not defined.

[0114] 步骤305,将索引记录保存至内存中与正在使用的chunk对应的第一存储区域; [0114] Step 305, the index record saved to the first storage area in memory and corresponding to the chunk being used;

[0115] 这里的第一存储区域用于临时存储当前正在使用的chunk中写入的各条数据记录所对应的索引记录,这里的内存可以是SMR所在的设备的系统内存。 [0115] Here the index of the first storage area for temporarily storing recording data chunk currently being used is written in the corresponding pieces of memory where the memory device may be a system where the SMR.

[0116] 在实际使用时,当检测到正在使用的chunk中的空间被分配完毕后,SMR所在的设备需要对该正在使用的chunk的索引记录进行持久化,并需要申请新的正在使用的chunk以进行后续的数据写入,对应的,还需要申请新的超级块以记录相应记录信息,具体流程请参见下述步骤306至309。 [0116] In actual use, when the space is being used to detect chunk are allocated is completed, the device needs SMR index record where the chunk being used in a persistent and need to apply a new chunk being used for subsequent data writing, corresponding need to apply a new superblock recording the record information corresponding to the specific procedures see steps 306-309.

[0117] 步骤306,在正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将内存中的第一存储区域内的索引记录存储至正在使用的chunk中的索引区; When [0117] Step 306, the remaining space in the chunk is being used is not sufficient to assign a data write instruction data to be written, chunk index records stored in the first storage area of ​​memory being used to index Area;

[0118]当正在使用的chunk的数据区中剩余的空间不足以存储当前接收到的写数据指令中所对应的数据时,SMR所在的设备则确定该正在使用的chunk的空间被分配完毕。 [0118] When being used chunk data area is insufficient space remaining in the data write command data corresponding to the received current, where the space of the SMR device being used is determined that the chunk is allocated. 此时, SMR所在的设备将内存中的第一存储区域内的索引记录存储至正在使用的chunk中的索引区。 At this time, SMR device region where the index chunk index record is stored in the first storage area to the memory is being used in.

[0119] 步骤307,将正在使用的chunk的属性修改为己使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0119] Step 307, the chunk is being used to modify the properties for their own use, and apply a chunk as unused chunk next write data being used;

[0120] SMR所在的设备在检测到正在使用的chunk的空间被分配完毕,并将第一存储区域中存储的各条索引记录写入到该正在使用的chunk的索引区后,该正在使用的chunk不再继续被写入数据记录,因此,此时可以将该正在使用的chunk的属性更改为己使用,进而使得该正在使用的chunk变成已使用的chunk。 [0120] where the SMR device is allocated is completed upon detection of space being used chunk, and writes the index records stored in the first storage area to the pieces of the chunk index area after being used, this being used chunk is written to the data recording does not continue, and therefore, the properties at this time can change the chunk being used for its own use, and further such that the chunk is being used becomes chunk has been used.

[0121]同时,SMR所在的设备需要在系统元数据区中申请下一个超级块,并在申请到的超级块中记录当前记录区中各个chunk的属性和使用信息。 [0121] Meanwhile, where the SMR device need to apply the next superblock system metadata area, and records the recording region of each attribute of the current chunk in the application and usage information to the super block.

[0122] 举例来讲,请参见图3B,其是本发明一实施例中提供的chunk的切换过程的示意图。 [0122] For example concerned, see Figure 3B, there is provided a schematic diagram of the handover process in a chunk of the embodiment of the present invention. 如图3B所示,SMR所在的设备在检测到正在使用的chunk320的数据区321被分配完毕后, 将与该正在使用的chunk320的数据区321的数据记录所对应的索引记录从内存中的第一存储区域存储至该正在使用的chunk320的索引区322中,并将该正在使用的chunk320的属性更改为己使用,进而变成已使用的chUnk330。 As shown, the SMR device is located after the detection being used chunk320 data area 321 is assigned is completed, the chunk320 being used with the data area 321 of the data recording 3B corresponding to the index records from memory a storage area is being used to chunk320 the index area 322, and properties of the chunk320 being used for its own use changes, then into chUnk330 been used. 同时,SMR所在的设备申请一块未使用的chunk340,将该未使用的chunk340的属性更改为正在使用,进而变成正在使用的chunk350, 并在该正在使用的chunk350的数据区351中开始分配空间。 Meanwhile, where the application apparatus SMR chunk340 an unused, the unused chunk340 attributes are used to change, and then into chunk350 being used, and the start of the data area 351 is being used to allocate space chunk350. SMR所在的设备在将正在使用的chunk320和未使用的chunk340的属性更改后,申请一块超级块360,并在该新申请的超级块360中记录当前记录区中各个chunk的属性和使用信息。 SMR device is located after a property change chunk320 chunk340 unused and being used to apply a super-block 360, the current recording area and recording the attribute of each chunk and use the information in the new superblock 360 application.

[0123] 步骤308,将第一存储区域内的索引记录存储至内存中与已使用的chunk对应的第二存储区域; [0123] Step 308, the index recorded in the first storage area to the second storage area storing the memory and corresponding to the used chunk;

[0124] 这里的第二存储区域用于存储SMR硬盘中所有已使用的chunk中的索引记录。 [0124] where the second storage area for storing a record of all SMR chunk index hard disk has been used in.

[0125] 为了便于查找SMR硬盘中保存的有效数据,SMR所在的设备在将当前的第一存储区域中存储的各条索引记录写入到正在使用的chunk的索引区后,还需要将这些索引记录写入到内存中的第二存储区域。 After [0125] For ease of valid data stored in the hard disk SMR, SMR index recording device where the current stored in the first storage area to write the pieces of the chunk index area being used, but also these indexes record is written to the second storage area in memory.

[0126] 在将第一存储区域中的索引记录写入内存中的第二存储区域时,SMR所在的设备需要依次从第一存储区域中读取将要被写入第二存储区域的索引记录,并根据读取到的索引记录中的标记进行相应操作,具体请参见下述三种情况: [0126] When the index record is written into the first memory area the second storage area in the memory, where the SMR device needs to read from the first storage area to be written to the second memory area index record, and a corresponding operation according to the read index marks in the recording details, see the following three conditions:

[0127] 第一种情况,当读取的索引记录中的标记为删除标记时,删除第二存储区域中键与读取的索引记录中的键相同的索引记录,并丢弃读取的索引记录; [0127] The first case, when the index recorded in the read mark marked for deletion, deleting the record the same second index key index record storage area and the read key and discards the index records ;

[0128] 第二种情况,当读取的索引记录中的标记为修改标记时,删除第二存储区域中键与读取的索引记录中的键相同的索引记录,并将读取的索引记录写入第二存储区域中; [0128] The second case, when the same key index record index record index recorded in the read modify flag is marked for deletion in the second storage area and the read key, and records the read index written in the second storage area;

[0129] 第三种情况,当读取的索引记录中的标记为写标记时,将读取的索引记录写入第二存储区域中。 [0129] The third case, when the index mark recorded in the read write mark, the index records are written in the second storage area.

[0130] 需要说明的是,当第一存储区域中的所有索引记录均读取完并保存至第二存储区域之后,第二存储区域中各个索引记录所对应的数据记录均为有效数据。 [0130] Incidentally, when all of the index records are first storage area has been read and stored to the second storage area after each index recorded in the second storage area corresponding to the recording data are valid data. 此时,SMR所在的设备可以根据各个chunk中未保存到第二存储区域中的索引记录,确定该chunk中无效数据所占的比例。 In this case, the device can be located according to each SMR chunk is not stored in the index storage area of ​​the second record, to determine the proportion occupied by the chunk data invalid.

[0131] 步骤309,清除第一存储区域内的索引记录; [0131] Step 309, the index record in the clear first storage area;

[0132] SMR所在的设备在将内存中第一存储区域中的索引记录写入内存中的第二存储区域后,需要清除该第一存储区域内的索引记录,以减少内存的占用率。 [0132] SMR device is located after the index records stored in the first memory area into the second storage area of ​​memory, it is necessary to clear the index record in the first storage area, in order to reduce memory usage.

[0133] 也就是说,第一存储区域被申请后通常用于存储当前正在使用的chunk中生成的索引记录,如果将第一存储区域中记录的索引记录均持久化到该正在使用的chunk之后,该第一存储区域内的索引记录通常会被清除掉。 [0133] That is, the first storage area after application is typically used to store the index used to record the current chunk is generated, if after recording the first storage area index records are persisted to the chunk being used the index record in the first storage area are usually cleared out. 这样,被申请的第一存储区域通常对应一个正在使用的chunk。 Thus, a first storage area corresponding to chunk a disclosure generally being used.

[0134] 综上所述,本实施例提供的将数据写入叠瓦状磁记录SMR硬盘的方法,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上, 导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0134] In summary, the method of writing data according to SMR imbricated magnetic disk of the present embodiment, by containing key data record, data and tag writes the chunk being used; Since the write data generating instruction data record includes key data and, therefore, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization It may be randomly write data between each chunk, thereby achieving an effect that can increase the flexibility of writing data in the hard disk SMR.

[0135] 另外,通过将第一存储区域内的索引记录存储至内存中与已使用的chunk对应的第二存储区域;由于将SMR硬盘中己使用的chunk的索引记录持久化到内存中,因此,解决了顺序读取SMR硬盘时的读取效率较低的问题;达到了提高SMR硬盘的读取效率的效果。 [0135] Further, by the second storage area in the index records stored in the first storage area in the memory corresponding to the used chunk; chunk index record since the hard disk of the SMR has persisted in the use of memory, and therefore solve the low efficiency of the reading order reads SMR hard problem; to achieve the effect of improving the efficiency of reading the hard drive of SMR.

[0136] 在实际使用时,为了保证SMR硬盘的高效使用,SMR所在的设备需要对SMR硬盘进行垃圾清理。 [0136] In actual use, in order to ensure efficient use of SMR hard disk, where the need for equipment SMR SMR hard disk garbage. 具体请参考下述步骤: Refer to the following steps:

[0137] 第一,当SMR硬盘的空间使用率达到指定使用阈值时,查找第一全局变量最大的超级块; [0137] First, when SMR disk space usage reaches a specified threshold value used to find the maximum of the first global variable superblock;

[0138] 需要说明的是,SMR硬盘中的超级块还可以包括第一全局变量,通常来讲,在后被申请的超级块的第一全局变量大于在前被申请的超级块的第一全局变量。 [0138] Incidentally, the SMR hard disk may further comprise a first super block global variable, generally speaking, in the application of the first global variable after the super block is larger than the previous super block is the first global application of variable. 举例来讲,当SMR 所在的设备在系统元数据区中申请下一个超级块时,会将当前的第一全局变量加1并作为申请得到的超级块第一全局变量。 For example speaking, when the device is located SMR next superblock application system metadata area, the current will be the first global variable is incremented by 1 and the super block as a first application obtained a global variable.

[0139] 超级块中的使用信息可以包括每个已使用chunk中无效数据记录的占用比例,无效数据记录为索引记录未记载在内存的第二存储区域中的数据记录。 [0139] A superblock may include invalid data chunk occupying ratio recorded for each use, invalid data is recorded as an index record is not recorded in the second data storage area of ​​the memory in the description.

[0140] 需要说明的是,这里的无效数据记录的占用比例的详细获取过程可以参见图3A对应实施例中的步骤308,这里不再累述。 [0140] Incidentally, the proportion occupied by invalid data records here detailed acquisition process may see FIG. 3A corresponds to the procedure of Example 308, there is no longer tired.

[0141] SMR所在的设备检测当前SMR硬盘的空间使用率,当检测到SMR硬盘的空间使用率高于指定使用阈值时,在SMR硬盘的系统元数据区内查找第一全局变量最大的超级块。 [0141] The current detecting device is located SMR SMR disk space utilization, when the detected SMR disk space usage is above a specified threshold value used to find the maximum of the first global variable superblock SMR system metadata area of ​​the hard disk . 由于在后被申请的超级块的第一全局变量大于在前被申请的超级块的第一全局变量,因此该第一全局变量最大的超级块中记录了当前SMR硬盘中的记录区内各个chunk的属性和使用信息。 Since the first global variable in the superblock after application is greater than the first super block are global variables preceding the application, so that the first global variable maximum current super block is recorded in the recording area of ​​each chunk in the hard disk SMR properties and usage information.

[0142] 举例来讲,指定使用阈值为85 %,SMR所在的设备检测到当前SMR硬盘的空间使用率为90%,则此时SMR硬盘的空间使用率高于指定使用阈值。 [0142] For example in terms of 85% is specified using a threshold, where the device detects the current SMR SMR hard disk space utilization rate of 90% at this time SMR disk space usage is above a specified threshold value used. SMR所在的设备将在SMR硬盘的系统元数据区内查找第一全局变量最大的超级块。 SMR device will look for where the first global variables largest superblock SMR system metadata area of ​​the hard disk.

[0143] 可选的,由于该垃圾清理过程可能需要频繁地写入和读出,因此,为了不影响SMR 所在的设备的正常使用,SMR所在的设备可以先检测系统的使用情况,当检测到系统空闲时,执行该垃圾清理过程。 [0143] Alternatively, since this may take rubbish frequently written and read out, therefore, in order not to affect the normal use of the device where the SMR, SMR device is located may first detecting system usage, when detecting when the system is idle, the implementation of the garbage cleanup process.

[0144] 第二,从查找到的超级块中的使用信息中,读取每个已使用的chunk中无效数据记录的占用比例; [0144] Second, the use of the information found from the super block, the read data record occupied proportion per chunk used invalidated;

[0145] SMR所在的设备可以根据查找到的超级块获取每个已使用的chunk的使用信息,根据每个已使用的chunk的使用信息确定每个己使用的chunk中无效数据记录的占用比例。 [0145] SMR device is located can be acquired using the information for each chunk has been used according to the found super block, to determine the proportion of each chunk occupancy data recorded already in use in accordance with invalid usage information for each chunk of use.

[0146] 第三,确定出无效数据记录的占用比例达到预定比例阈值的己使用的chunk,对该已使用的chunk进行垃圾清理。 [0146] Third, it is determined that an invalid record occupancy ratio data chunk has reached a predetermined threshold ratio used is, for the chunk garbage has been used.

[0147] SMR所在的设备在确定出无效数据记录的占用比例达到预定比例阈值的已使用的chunk后,确定出己使用的chunk中的索引记录,在内存中的第二存储区域中查找该索引记录,若查找到该索引记录,则将该索引记录对应的数据记录写入当前的正在使用的chunk 中,若未查找到该索引记录,则对该索引记录对应的数据记录进行垃圾清理。 [0147] Equipment SMR located upon a determination is invalid chunk used occupancy ratio data recorded reaches a predetermined ratio threshold value, it is determined that the index records chunk already used in the second memory area in memory find the index record, if it can find the index record, the index recorded a corresponding write data record is currently being used in the chunk, if not find the index record, the record corresponding to the index data records garbage.

[0148]举例来讲,请参见图4,其是本发明一实施例中提供的垃圾清理过程的示意图。 [0148] For example concerned, see Figure 4, which is a schematic view of waste disposal process according to an embodiment of the present invention is provided. 如图4所不,SMR所在的设备在确定出己使用的chunk420中的无效数据记录的占用比例达到预定比例阈值后,将该已使用的chunk420的数据区中的有效数据记录0、有效数据记录2和有效数据记录4写入正在使用的chunk430的数据区中,生成与有效数据记录0、有效数据记录2 和有效数据记录4对应的索引记录,并将这些索引记录保存到内存的第一存储区域中。 Valid data is not recorded in FIG. 4, where the SMR device after determining the proportion occupied chunk420 been used in the invalid data recorded reaches a predetermined threshold ratio, has been used chunk420 the data area 0, the valid data recorded 4 being used to write and chunk430 2 valid data recorded in the data area, generating a valid data record 0, 2 effective and efficient data recording data recording corresponding to the index record, and saves the index records to the first storage memory area. SMR 所在的设备在将已使用的chunk420中有效数据全部写入到正在使用的chunk430后,将该已使用的chunk420的属性更改为未使用,进而变成未使用的chunk440,并申请一块超级块450,在该超级块450中记录当前记录区中各个chunk的属性和使用信息。 After all of the devices located SMR chunk420 valid data which has been written to use the chunk430 being used, the properties of the used chunk420 change the unused, then into chunk440 unused, and apply a superblock 450 using the information on the super block attributes of the current record 450 is recorded in each area and the chunk.

[0149] 在实际使用时,当SMR硬盘重启后,为了保证SMR硬盘的正常使用,SMR所在的设备需要在内存中重建数据,具体请参考图5,其示出了本发明再一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的方法流程图,该将数据写入叠瓦状磁记录SMR硬盘的方法可以用于包含有SMR硬盘的设备中,该将数据写入叠瓦状磁记录SMR硬盘的方法,可以包括: [0149] In actual use, when SMR hard reboot, in order to ensure the normal use of SMR hard disk device SMR where the need to rebuild the data in memory, specifically refer to FIG. 5, which illustrate the present invention, another embodiment methods flowchart write data supplied imbricated SMR magnetic disk, writing data to the magnetic recording imbricated SMR SMR hard disk may be used with apparatus, which writes data shingled method SMR-shaped magnetic disk may include:

[0150]步骤501,接收写数据指令; [0150] Step 501 receives the write command data;

[0151]步骤502,根据数据记录的长度向正在使用的chunk中的数据区申请空间; [0151] Step 502, the chunk is being used to apply space in the data area according to the length of the data record;

[0152] 步骤503,将数据记录写入申请的空间中; [0152] Step 503, the space in the data record is written application;

[0153] 步骤504,将键、标记与数据被写入正在使用的chunk中的地址组成索引记录; [0153] Step 504, the key, and the flag is written to address chunk being used in the composition of the index record;

[0154] 步骤505,将索引记录保存至内存中与正在使用的chunk对应的第一存储区域; [0154] Step 505, the index record saved to the first storage area in memory and corresponding to the chunk being used;

[0155] 步骤506,在正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将内存中的第一存储区域内的索引记录存储至正在使用的chunk中的索引区; When [0155] Step 506, the remaining space in the chunk is being used is not sufficient to assign a data write instruction data to be written, chunk index records stored in the first storage area of ​​memory being used to index Area;

[0156] 步骤507,将正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0156] Step 507, the chunk is being used to modify the properties of used and unused chunk apply as the next write data chunk being used;

[0157] 步骤508,将第一存储区域内的索引记录存储至内存中与己使用的chunk对应的第二存储区域; [0157] Step 508, the index recorded in the first storage area to the second storage area storing the memory and corresponding to the used chunk hexyl;

[0158] 步骤509,清除第一存储区域内的索引记录; [0158] Step 509, the index record in the clear first storage area;

[0159] 上述步骤501至509是SMR所在的设备向SMR硬盘内写入数据记录以及对chunk的索引记录进行持久化的过程,详细描述请参考与图3A对应的实施例,这里就不再累述。 [0159] The steps 501-509 are SMR device data records are to be written into the hard disk and SMR chunk index of the recording process for persistence, refer to the detailed description of FIG. 3A embodiment corresponding, here not tired above.

[0160] 在实际使用时,当硬盘重启后,为了保证SMR硬盘的正常使用,SMR所在的设备需要在内存中重建数据,具体流程请参见下述步骤510至512。 [0160] In actual use, when the hard reboot, in order to ensure the normal use of the hard disk SMR, SMR device is located needs to be rebuilt data in memory, see the specific process steps 510-512.

[0161] 步骤510,在重启硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; [0161] Step 510, the hard disk during restart, and to determine chunk chunk being used according to the attributes used in the chunk;

[0162] 当SMR硬盘重启后,SMR所在的设备可以根据chunk的属性确定已使用的chunk和正在使用的chunk。 [0162] When SMR hard reboot, the device may determine where the SMR chunk and chunk being used according to the attributes used in the chunk.

[0163] 可选的,SMR所在的设备可以从SMR硬盘中系统元数据区内的最新的超级块中来获取各个chunk的属性,从而确定己使用的chunk和正在使用的chunk。 [0163] Alternatively, where the SMR device may be acquired from the attribute of each chunk of the latest hard disk superblock SMR system metadata area, the already used to determine the chunk and the chunk is being used.

[0164] 可选的,超级块还可以包括第一全局变量,在后被申请的超级块的第一全局变量大于在前被申请的超级块的第一全局变量。 [0164] Alternatively, a first super block may further include a global variable, the first global variable in the superblock after application is greater than the first super block of the global variable being requested front. 举例来讲,当SMR所在的设备在系统元数据区中申请下一个超级块时,会将当前的第一全局变量加1并作为申请得到的超级块第一全局变量。 For example speaking, when the device is located SMR next superblock application system metadata area, the current will be the first global variable is incremented by 1 and the super block as a first application obtained a global variable. SMR所在的设备在检测到硬盘重新启动后,在SMR硬盘中的系统元数据区内查找第一全局变量最大的超级块。 SMR device is located in the hard disk after the restart is detected, the system metadata area of ​​the hard disk in the SMR global variable to find the largest first superblock. 该第一全局变量最大的超级块中记录了当前SMR硬盘中的记录区内各个chunk的属性和使用信息。 The first global variable maximum current super block is recorded in the recording area of ​​each chunk in the hard disk SMR properties and usage information. SMR所在的设备根据超级块中记录的各个chunk的属性和使用信息确定已使用的chunk和正在使用的chunk。 SMR device is located is determined chunk and chunk being used and used according to the attribute of each chunk usage information recorded in the superblock.

[0165] 步骤511,将已使用的chunk中存储的索引记录,写入内存中与已使用的chunk对应的苐二存储k域; [0165] Step 511, the index of the used chunk records stored in the memory and writes the chunk used Ti corresponding second storage field k;

[0166]需要说明的是,索引记录还包括与数据记录唯一对应的第二全局变量,在后写入的索引记录的第二全局变量大于在前写入的索引记录的第二全局变量。 [0166] Incidentally, the index record further comprises a second global variables unique to the data recording, the second global variable index records written after recording is greater than the first index of the second write global variables.

[0167] SMR所在的设备在获取已使用的chunk中的索引记录后,根据各条索引记录的第二全局变量,将已使用的chunk中的索引记录依次写入内存的第二存储区域。 [0167] chunk index recording apparatus SMR located after obtaining the index records used in the chunk, the pieces according to a second global variable index record, which has been used sequentially written in the second storage area of ​​memory. SMR所在的设备在依次写入索引记录时,提取各条索引记录的标记,并根据标记的类型执行相应操作,具体可以分为下述三种情况。 SMR device is located in the index record is written sequentially extracting pieces of index record mark, and performs a corresponding operation according to the type of marker, specifically divided into the following three cases.

[0168]第一种情况,3腿所在的设备提取出的索引记录的标记为删除标记时,丢弃键与提取的索引记录的键相同且第二全局变量小于提取的索引记录的第二全局变量的索引记录, 直到所有键与提取的索引记录的键相同且第二全局变量小于提取的索引记录的第二全局变量的索引记录均被丢弃后,丢弃提取的索引记录。 [0168] The first case, where the marking device 3 leg extracted index record is marked for deletion, and discards the second global variable key index key extracted and the second record is the same global variable is less than the extracted index records index records, the index record second global variables until all the extracted index keys of the key record and the second is the same global variable is less than the extracted index record are discarded, discarding the extracted index record.

[0169]第二种情况,SMR所在的设备提取出的索引记录的标记为修改标记时,丢弃键与提取的索引记录的键相同且第二全局变量小于提取的索引记录的第二全局变量的索引记录, 直到所有键与提取的索引记录的键相同且第二全局变量小于提取的索引记录的第二全局变量的索引记录均被丢弃后,将提取的索引记录写入第二存储区域。 [0169] The second case, where the device SMR extracted index record mark is marked modified, discard the second key with the same global variable record the extracted index key and the second global variable is less than the index of the extracted records index record, until after all the extracted index keys and key record are the same and the second global variable is less than a second index record index records the extracted global variables are discarded, the extracted index record written to the second storage area.

[0170]第三种情况,SMR所在的设备提取出的索引记录的标记为写标记时,将提取的索引记录写入第二存储区域。 [0170] The third case, where the marking device SMR extracted index record mark is written, the extracted index record written to the second storage area.

[0171]步骤512,根据正在使用的chunk中存储的数据记录,重建与该数据记录对应的索弓丨记录,并将重建得到的索引记录写入内存中与正在使用的chunk对应的第一存储区域。 [0171] Step 512, the data being used chunk records stored in the record index rebuild bow Shu corresponding to the recording data, and the reconstruction obtained index record written in the first memory and the memory corresponding to the chunk being used area. [0172]重建得到的索引记录可以包括:数据记录中数据的键、与该数据对应的标记以及数据被写入正在使用的chunk中的地址。 [0172] Reconstruction obtained index record may include: a data recording key data corresponding to the data tag and the data is written to address the chunk being used.

[0173]综上所述,本实施例提供的将数据写入叠瓦状磁记录SMR硬盘的方法,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上, 导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0173] In summary, the method of writing data according to SMR imbricated magnetic disk of the present embodiment, by containing key data record, data and tag writes the chunk being used; Since the write data generating instruction data record includes key data and, therefore, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization It may be randomly write data between each chunk, thereby achieving an effect that can increase the flexibility of writing data in the hard disk SMR.

[0174] 另外,通过将已使用的chunk中存储的索引记录写入内存中的第二存储区域,并将重建得到的索引记录写入内存中的第一存储区域;由于能够在硬盘重启后及时重建数据, 因此,解决了SMR硬盘重启后无法正常工作的问题;到达了提高SMR硬盘的使用性能的效果。 [0174] Furthermore, the index records used by the chunk stored in the second storage area is written in the memory, and index records are written in the reconstruction of a first memory area of ​​the memory; since the hard disk can be promptly restarted after reconstruction of data, therefore, to solve the problem after restarting SMR hard disk is not working; the effect of increasing the reach SMR performance of the hard disk.

[0175] 请参考图6,其示出了本发明一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的装置的结构方框图,该将数据写入叠瓦状磁记录SMR硬盘的装置可以用于包含有SMR硬盘的设备中,该将数据写入叠瓦状磁记录SMR硬盘的装置,可以包括:接收模块601、申请模块602、第一写入模块603和保存換块604; [0175] Please refer to FIG. 6, which shows a block diagram of the present invention the data provided in the recording apparatus writes imbricate structure of a hard disk SMR embodiment, the data is written to the imbricated disk recording SMR SMR device may be used with a hard disk apparatus, the apparatus writes data imbricated SMR magnetic disk, may include: a receiving module 601, application module 602, a first writing module 603 and the storage 604 for the block;

[0176] 接收模块601,用于接收写数据指令,写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记,写标记用于表示将数据写入SMR硬盘中,删除标记用于表示删除SMR硬盘中具有键的数据,修改标记用于表示利用数据修改具有相同键且已被写入SS/IR硬盘的数据; [0176] a receiving module 601, for receiving a write data command, the write command includes a key data, tag data and key identification data, labeled as write flag, delete or modify the tag marking, writing numerals are used to write data SMR hard disk, delete numerals are used to delete data having a hard disk SMR bond numerals are used to modify the data by using modification data with the same key and have been written to SS / IR hard disk;

[0177] 申请模块602,用于根据数据记录的长度向正在使用的chunk申请空间,数据记录包括写数据指令中的键、数据和标记; [0177] Application module 602, a key data and instruction tag write data to the chunk being used in space applications, comprising a data record length of the data record;

[0178] 第一写入模块603,用于将数据记录写入申请的空间中; [0178] The first writing module 603, a space for recording data written in the application;

[0179] 保存模块604,用于保存键、标记与数据被写入正在使用的chunk中的地址。 [0179] storing module 604, configured to store the key, and the flag is written to address the chunk being used.

[0180] 综上所述,本实施例提供的将数据写入叠瓦状磁记录SMR硬盘的装置,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上, 导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0180] In summary, the apparatus provided by the write data imbricated SMR magnetic disk of the present embodiment, by containing key data record, data and tag writes the chunk being used; Since the write data generating instruction data record includes key data and, therefore, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization It may be randomly write data between each chunk, thereby achieving an effect that can increase the flexibility of writing data in the hard disk SMR.

[0181] 请参考图7,其示出了本发明另一实施例中提供的将数据写入叠瓦状磁记录SMR硬盘的装置的结构方框图,该将数据写入叠瓦状磁记录SMR硬盘的装置可以用于包含有SMR硬盘的设备中,该将数据写入叠瓦状磁记录SMR硬盘的装置,可以包括:接收模块701、申请模块702、第一写入模块703和保存模块704; [0181] Please refer to FIG. 7, which shows a block diagram showing the structure of the data provided in the magnetic recording write imbricated disk SMR another embodiment of the present invention, the data write imbricated hard magnetic SMR the SMR device may be used with a hard disk apparatus, the apparatus writes data imbricated SMR magnetic disk, may include: a receiving module 701, application module 702, a first writing module 703 and storage module 704;

[0182] 接收模块701,用于接收写数据指令,写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记,写标记用于表示将数据写入SMR硬盘中,删除标记用于表示删除SMR硬盘中具有键的数据,修改标记用于表示利用数据修改具有相同键且已被写入SMR硬盘的数据; [0182] a receiving module 701, for receiving a write data command, the write command includes a key data, tag data and key identification data, labeled as write flag, delete or modify the tag marking, writing numerals are used to write data SMR hard disk, delete numerals are used to delete data having a hard disk SMR bond numerals are used to modify the data by using modification data with the same key and have been written to the hard disk of the SMR;

[0183] 申请模块702,用于根据数据记录的长度向正在使用的chunk申请空间,数据记录包括写数据指令中的键、数据和标记; [0183] Application module 702, a key data and instruction tag write data to the chunk being used in space applications, comprising a data record length of the data record;

[0184] 第一写入模块703,用于将数据记录写入申请的空间中; [0184] The first writing module 703, a space for recording data written in the application;

[0185] 保存模块704,用于保存键、标记与数据被写入正在使用的chunk中的地址。 [0185] storing module 704, configured to store the key, and the flag is written to address the chunk being used.

[0186]在本实施例中的第一种可能的实现方式中,该申请模块702用于根据数据记录的长度向正在使用的chunk中的数据区申请空间。 [0186] In the present embodiment a first possible implementation of the embodiment, the application module 702 to the chunk being used for the application data area according to the space length of the data record.

[0187]在本实施例中的第二种可能的实现方式中,该保存模块704可以包括:组成单元704a和保存单元704b; [0187] In the present embodiment a second possible implementation of the embodiment, the storage module 704 may include: constituent units 704a and 704b holding unit;

[0188]该组成单元704a,用于将键、标记与数据被写入正在使用的chunk中的地址组成索引记录; [0188] The constituent unit 704a, for the key, and the flag is written to address chunk being used in the composition of the index record;

[0189]该保存单元7〇4b,用于将索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将内存中的第一存储区域内的索引记录存储至正在使用的chunk中的索引区。 [0189] The storage unit 7〇4b, index record for saving the storage area to the first memory and corresponding to the chunk being used; or the write instruction required data in the remaining space being used chunk allocation is not sufficient when writing data, the index area chunk index record is stored in the first storage area to the memory is being used in.

[0190] 在本实施例中的第三种可能的实现方式中,该装置还可以包括:修改模块705、存储模块706和清除模块707。 [0190] In the present embodiment a third possible implementation, the apparatus may further comprising: a modification module 705, memory module 706 and a clearing module 707.

[0191]该修改模块705,用于将正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0191] The modification module 705, the attributes are used for chunk is used to modify and apply a chunk as unused chunk next write data being used;

[0192]该存储模块706,用于将第一存储区域内的索引记录存储至内存中与已使用的chunk对应的第二存储区域; [0192] The memory module 706, for storing the index recorded in the first storage area to the second storage area in memory and corresponding to the used chunk;

[0193]该清除模块707,用于清除第一存储区域内的索引记录。 [0193] The clearing module 707 for removing index record in the first storage area.

[0194]在本实施例中的第四种可能的实现方式中,该装置还可以包括:确定模块708、第二写入模块7〇9和重建模块710。 [0194] In the present embodiment, the fourth possible implementation, the apparatus may further comprise: determining module 708, and a second writing module 7〇9 reconstruction module 710.

[0195]该确定模块7〇8,用于在重启硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; [0195] The 7〇8 determining module, configured to restart the hard disk, and determining chunk chunk being used according to the attributes used in the chunk;

[0196]该第二写入模块709,用于将已使用的chunk中存储的索引记录,写入内存中与己使用的chunk对应的第二存储区域; [0196] The second writing module 709, used for the chunk stored in the index records, written to the second storage area in the memory corresponding to the used chunk hexyl;

[0197]该重建模块710,用于根据正在使用的chunk中存储的数据记录,重建与数据记录对应的索引记录,并将重建得到的索引记录写入内存中与正在使用的chunk对应的第一存储区域。 [0197] The reconstruction module 710, based on the index for the corresponding recording data stored in the chunk is being used to rebuild the index record corresponding to the record data, and are written in the chunk memory reconstructed with the first being used storage area.

[0198] 在本实施例中的第五种可能的实现方式中,重建得到的索引记录包括:数据记录中数据的键、与数据对应的标记以及数据被写入正在使用的chunk中的地址。 [0198] In a fifth possible embodiment of the present implementation embodiment, the index rebuild obtained recorded comprising: a data record key data, and data corresponding to the tag address and the data is written in the chunk is being used.

[0199] 综上所述,本实施例提供的将数据写入叠瓦状磁记录SMR硬盘的装置,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上, 导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据,因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0199] In summary, the apparatus provided by the write data imbricated SMR magnetic disk of the present embodiment, by containing key data record, data and tag writes the chunk being used; Since the write data generating instruction data record includes key data and, therefore, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization It may be randomly write data between each chunk, thereby achieving an effect that can increase the flexibility of writing data in the hard disk SMR.

[0200]另外,通过将第一存储区域内的索引记录存储至内存中与已使用的chunk对应的第二存储区域;由于将SMR硬盘中已使用的chunk的索引记录持久化到内存中,因此,解决了顺序读取SMR硬盘时的读取效率较低的问题;达到了提高SMR硬盘的读取效率的效果。 [0200] Further, by the second storage area in the index records stored in the first storage area in the memory corresponding to the used chunk; SMR since the index record in the hard disk has been used persistence chunk into memory, and therefore solve the low efficiency of the reading order reads SMR hard problem; to achieve the effect of improving the efficiency of reading the hard drive of SMR.

[0201]另外,通过将已使用的chunk中存储的索引记录写入内存中的第二存储区域,并将重建得到的索引记录写入内存中的第一存储区域;由于能够在硬盘重启后及时重建数据, 因此,解决了SMR硬盘重启后无法正常工作的问题;到达了提高SMR硬盘的使用性能的效果。 [0201] Furthermore, the index records used by the chunk stored in the second storage area is written in the memory, and index records are written in the reconstruction of a first memory area of ​​the memory; since the hard disk can be promptly restarted after reconstruction of data, therefore, to solve the problem after restarting SMR hard disk is not working; the effect of increasing the reach SMR performance of the hard disk. [0202]需要说明的是:上述实施例提供的将数据写入叠瓦状磁记录SMR硬盘的装置在将数据写入叠瓦状磁记录SMR硬盘时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将SMR所在的设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。 [0202] Note that: the above-described embodiments provide a data writing apparatus imbricated SMR magnetic disk when data is written in the imbricated SMR magnetic hard disk, a division of the foregoing functional modules Examples description, the practical application, the above functions may be required to complete the different functional modules, the internal construction of the apparatus where the upcoming SMR divided into different functional modules to complete all or part of the functions described above. 另外,上述实施例提供的将数据写入叠瓦状磁记录SMR硬盘的装置与将数据写入叠瓦状磁记录SMR硬盘的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。 Further, the above-described embodiments provide a data writing imbricated embodiment SMR same concept magnetic disk device and writing data to the hard disk SMR imbricated magnetic recording method, the specific embodiments of the method implementation process, not repeat them here.

[0203] 请参见图8,其示出了本发明一实施例中提供的包含有SMR硬盘的设备的结构方框图,该设备可以包括:接收机802和处理器804,其中处理器804和接收机802耦合。 [0203] Referring to FIG. 8, which shows a block diagram of the structure of the present invention SMR disk apparatus provided with an embodiment example, the apparatus may comprise: a receiver 802 and a processor 804, wherein processor 804 and a receiver 802 is coupled.

[0204] 接收机802,用于接收写数据指令,写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记,写标记用于表示将数据写入SMR硬盘中,删除标记用于表示删除SMR硬盘中具有键的数据,修改标记用于表示利用数据修改具有相同键且已被写入SMR硬盘的数据; [0204] The receiver 802 for receiving a write data command, the write command includes a key data, tag data and key identification data, labeled as write flag, delete or modify the tag marking, writing numerals are used to write data SMR hard disk, delete numerals are used to delete data having a hard disk SMR bond numerals are used to modify the data by using modification data with the same key and have been written to the hard disk of the SMR;

[0205] 处理器804,用于根据数据记录的长度向正在使用的chunk申请空间,数据记录包括写数据指令中的键、数据和标记; [0205] processor 804, to the chunk used for space applications are used in accordance with the length of the data record, the data record comprises a write data command key, and the data tag;

[0206] 处理器804,还用于将数据记录写入申请的空间中; [0206] processor 804, a space for further recording data is written in the application;

[0207] 处理器804,还用于保存键、标记与数据被写入正在使用的chunk中的地址。 [0207] processor 804, further configured to store the key, and the flag is written to address the chunk being used.

[0208] 综上所述,本实施例提供的包含有SMR硬盘的设备,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上,导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据, 因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0208] In summary, the SMR of the hard disk device provided with the present embodiment, by containing key data record, data and tag writes the chunk being used; since the write data comprises a data recording command is generated there are keys and data, thus, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization, between each chunk can random write data, so we can achieve the effect of improving the flexibility of writing data in the hard disk SMR.

[0209]请参见图9,其示出了本发明另一实施例中提供的包含有SMR硬盘的设备的结构方框图,该设备可以包括:接收机902、处理器904和存储器906,其中处理器904分别与接收机902和存储器906耦合,存储器906中存储有至少一种计算机软件,处理器904可以根据存储器906存储的计算机软件执行相关的操作。 [0209] Referring to FIG. 9, which shows a block diagram of the structure of the present invention, the apparatus includes a hard disk SMR embodiment to another embodiment, the apparatus may comprise: a receiver 902, a processor 904 and memory 906, wherein the processor respectively with 904 and memory 906 coupled to the receiver 902, stored in the memory 906 at least one computer software, processor 904 may perform related operations in accordance with computer software stored in memory 906.

[0210]接收机902,用于接收写数据指令,写数据指令包括键、数据和标记,键用于标识数据,标记为写标记、删除标记或修改标记,写标记用于表示将数据写入SMR硬盘中,删除标记用于表示删除SMR硬盘中具有键的数据,修改标记用于表示利用数据修改具有相同键且已被写入SMR硬盘的数据; [0210] The receiver 902 for receiving a write data command, the write command includes a key data, tag data and key identification data, labeled as write flag, delete or modify the tag marking, writing numerals are used to write data SMR hard disk, delete numerals are used to delete data having a hard disk SMR bond numerals are used to modify the data by using modification data with the same key and have been written to the hard disk of the SMR;

[0211] 处理器904,用于根据数据记录的长度向正在使用的chunk申请空间,数据记录包括写数据指令中的键、数据和标记; [0211] processor 904, to the chunk used for space applications are used in accordance with the length of the data record, the data record comprises a write data command key, and the data tag;

[0212] 处理器904,还用于将数据记录写入申请的空间中; [0212] processor 904, a space for further recording data is written in the application;

[0213] 处理器904,还用于保存键、标记与数据被写入正在使用的chunk中的地址。 [0213] The processor 904 is further configured to save key, the data is written to address tag being used in the chunk.

[0214] 在本实施例中的第一种可能的实现方式中,处理器904,还用于根据数据记录的长度向正在使用的chunk中的数据区申请空间。 [0214] In the present embodiment a first possible implementation of this embodiment, the processor 904 is further configured to chunk being used by the application data area according to the space length of the data record.

[0215] 在本实施例中的第二种可能的实现方式中,处理器904,还用于将键、标记与数据被写入正在使用的chunk中的地址组成索引记录; [0215] In the present embodiment a second possible implementation of this embodiment, the processor 904, the key is further configured to mark the data chunk being written to the address used in the composition of the index record;

[0216] 处理器904,还用于将索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将内存中的第一存储区域内的索引记录存储至正在使用的chunk中的索引区。 [0216] The processor 904 is further configured to save the storage area to the first index record in memory corresponding to the chunk being used; alternatively, the remaining space in the chunk is being used is not sufficient to assign a write data command to be written when data chunk index area index record is stored in the first storage area to the memory is being used in.

[0217] 在本实施例中的第三种可能的实现方式中,处理器904,还用于将正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; [0217] In a third possible implementation of this embodiment, the processor 904 is further configured to attribute to the chunk being modified to use the used and unused chunk apply as the next write data being used chunk;

[0218] 处理器904,还用于将第一存储区域内的索引记录存储至内存中与已使用的chunk 对应的第二存储区域; [0218] The processor 904 is further configured to store the index recorded in the first storage area to the second storage area in memory and corresponding to the used chunk;

[0219] 处理器904,还用于清除第一存储区域内的索引记录。 [0219] The processor 904 is further configured to clear the index record in the first storage area.

[0220] 在本实施例中的第四种可能的实现方式中,处理器904,还用于在重启硬盘时,根据chunk的属性确定己使用的chunk和正在使用的chunk; [0220] In the present embodiment, the fourth possible implementation, the processor 904 is further configured to restart the hard disk, and used to determine chunk chunk already being used according to the attribute of the chunk;

[0221] 处理器904,还用于将已使用的chunk中存储的索引记录,写入内存中与己使用的chunk对应的第二存储区域; [0221] The processor 904 is further configured to record index which has been used chunk stored in the second storage area is written in the memory corresponding to the used chunk hexyl;

[0222] 处理器904,还用于根据正在使用的chunk中存储的数据记录,重建与该数据记录对应的索引记录,并将重建得到的索引记录写入内存中与正在使用的chunk对应的第一存储区域。 [0222] The processor 904 is further configured to record the data being used chunk stored in the corresponding index record with the data record reconstruction, reconstruction and index records are written in the first memory and corresponding to the chunk being used a storage area.

[0223] 在本实施例中的第五种可能的实现方式中,重建得到的索引记录包括:数据记录中数据的键、与数据对应的标记以及数据被写入正在使用的chunk中的地址。 [0223] In a fifth possible embodiment of the present implementation embodiment, the index rebuild obtained recorded comprising: a data record key data, and data corresponding to the tag address and the data is written in the chunk is being used.

[0224] 综上所述,本实施例提供的包含有SMR硬盘的设备,通过将包含有键、数据和标记的数据记录写入正在使用的chunk中;由于根据写数据指令生成的数据记录包含有键和数据,因此,解决了不能直接将分布式存储系统布局方案移植到SMR硬盘上,导致SMR硬盘的写入性能较低的问题;由于chunk根据band虚拟化得到,在各个chunk之间可以随机写入数据, 因此达到了可以提高在SMR硬盘写入数据的灵活性的效果。 [0224] In summary, the SMR of the hard disk device provided with the present embodiment, by containing key data record, data and tag writes the chunk being used; since the write data comprises a data recording command is generated there are keys and data, thus, to solve the distributed storage system can not be directly ported to SMR layout scheme hard, resulting in lower write performance of hard disk SMR problems; obtained according to the band since the chunk virtualization, between each chunk can random write data, so we can achieve the effect of improving the flexibility of writing data in the hard disk SMR.

[0225]另外,通过将第一存储区域内的索引记录存储至内存中与已使用的chunk对应的第二存储区域;由于将SMR硬盘中已使用的索引记录持久化到内存中,因此,解决了顺序读取SMR硬盘时的读取效率较低的问题;达到了提高SMR硬盘的读取效率的效果。 [0225] Further, by the second storage area in the index records stored in the first storage area in the memory corresponding to the used chunk; SMR since the index recorded in the hard disk has been used to persistent memory, and therefore, to solve lower reading efficiency of reading order of questions SMR hard; achieve the effect of improving the efficiency of reading SMR hard disc.

[0226]另外,通过将已使用的chunk中存储的索引记录写入内存中的第二存储区域,并将重建得到的索引记录写入内存中的第一存储区域;由于能够在硬盘重启后及时重建数据, 因此,解决了SMR硬盘重启后无法正常工作的问题;到达了提高SMR硬盘的使用性能的效果。 [0226] Furthermore, the index records used by the chunk stored in the second storage area is written in the memory, and index records are written in the reconstruction of a first memory area of ​​the memory; since the hard disk can be promptly restarted after reconstruction of data, therefore, to solve the problem after restarting SMR hard disk is not working; the effect of increasing the reach SMR performance of the hard disk. [0227]本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。 [0227] Those of ordinary skill in the art may be aware, incorporated herein disclosed units and algorithm steps described in the respective exemplary embodiments, it is possible to incorporate electronic hardware, computer software and electronic hardware, or be implemented. 这些功能宄竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。 These features traitor to actually perform hardware or software depends upon the particular application and design constraints of the technical solutions. 专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。 Professional technical staff may use different methods for each specific application to implement the described functionality, but such implementation should not be considered outside the scope of the present invention.

[0228]所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、 装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。 [0228] Those skilled in the art may clearly understand that, for convenience and brevity of description, specific working process of the foregoing system, apparatus, and unit may refer to the corresponding process in the foregoing method embodiments, not described herein again .

[0229]在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。 [0229] In several embodiments provided herein present embodiment, it should be understood that the system, apparatus and method disclosed may be implemented in other manners. 例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,可以仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。 For example, the described apparatus embodiments are merely illustrative of, for example, the division unit, may be merely logical function division, there may be other division in actual implementation, for example, a plurality of units or components may be combined or it may be integrated into another system, or some features may be ignored or not performed. 另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。 Another point, displayed or coupling or direct coupling or communication between interconnected in question may be through some interface, device, or indirect coupling or communication connection unit, may be electrical, mechanical, or other forms.

[0230] 所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。 [0230] The unit described as separate components may be or may not be physically separate, parts displayed as units may be or may not be physical units, i.e. may be located in one place, or may be distributed to a plurality of networks unit. 可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。 You can select some or all of the units according to actual needs to achieve the object of the solutions of the embodiments.

[0231]另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。 [0231] Additionally, functional units may be integrated in various embodiments of the present invention in a processing unit, separate units may be physically present, may be two or more units are integrated into one unit.

[0232] 所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。 [0232] If the function is implemented as a separate product sold or used in the form of a software functional unit may be stored in a computer-readable storage medium. 基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若千指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。 Based on such understanding, the technical solutions of the present invention per se or contributing to the prior art or part of the technical solutions may be embodied in a software product, which computer software product is stored in a storage medium, comprising If one thousand instructions that enable a computer device (may be a personal computer, a server, or network device) to perform all or part of the steps of the methods of the various embodiments of the present invention. 而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,R0M)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。 The storage medium comprising: a variety of medium U disk, mobile hard disk, a read-only memory (Read-Only Memory, R0M), a random access memory (Random Access Memory, RAM), magnetic disk, or an optical disc capable of storing program code .

[0233]以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。 [0233] The above are only specific embodiments of the present invention, but the scope of the present invention is not limited thereto, any skilled in the art in the art within the technical scope of the present invention is disclosed, variations may readily occur or Alternatively, it shall fall within the protection scope of the present invention. 因此,本发明的保护范围应所述以权利要求的保护范围为准。 Accordingly, the scope of the present invention should be in the scope of the claims and their equivalents.

Claims (12)

  1. 1. 一种将数据写入叠瓦状磁记录SMR硬盘的方法,其特征在于,所述SMR硬盘包括多个根据磁轨带band虚拟化后得到的chunk,所述方法包括: 接收写数据指令,所述写数据指令包括键、数据和标记,所述键用于标识所述数据,所述标记为写标记、删除标记或修改标记,所述写标记用于表示将所述数据写入所述SMR硬盘中,所述删除标记用于表示删除所述SMR硬盘中所述键标识的所述数据,所述修改标记用于表示利用所述数据修改具有相同键且已被写入所述SMR硬盘的数据; 根据数据记录的长度向正在使用的chunk申请空间,所述数据记录包括所述写数据指令中的所述键、所述数据和所述标记; 将所述数据记录写入申请的所述空间中; 保存所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址。 1. A method of writing data imbricated SMR magnetic disk, wherein said SMR chunk comprises a plurality of magnetic hard disk track obtained with the virtual band, the method comprising: receiving a write data command the write command includes a key data, and the data tag, the data identifying the key, the label is written mark, modify or delete flag mark, the write flag for writing the data representing SMR said hard disk, said data deleting the deletion mark the hard drive of the SMR key identifier for representing the modification numerals are used with the modified data with the same key have been written and the SMR hard data; chunk to the application space is being used, the data comprises recording the write data of the key instructions, the data and the mark according to the length of the data record; the data record is written aPPLICATIONS the space; the saved key, the data is written to the tag address of the chunk is being used in.
  2. 2. 根据权利要求1所述的方法,其特征在于,所述正在使用的chunk中包含用于存储数据记录的数据区,所述根据数据记录的长度向正在使用的chunk申请空间,包括: 根据所述数据记录的长度向所述正在使用的chunk中的所述数据区申请空间。 2. The method according to claim 1, wherein, in use of the chunk contains a data area for storing data records, the length of the data recording according to the chunk being used in space applications, comprising: the the application data area space length of the data chunk to the recording is being used by.
  3. 3. 根据权利要求2所述的方法,其特征在于,所述正在使用的chunk中包含用于存储索引记录的索引区,所述保存所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址,包括: 将所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址组成索引记录; 将所述索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在所述正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区。 3. The method according to claim 2, characterized in that, the chunk containing said index being used by the index recording area for storing the said key storage, the mark and the data is written to the the address of said chunk being used, comprising: the key, the indicia and the data written to the address of the chunk is being used in the composition of the index record; the saved to memory and the index record is a first memory area corresponding to the chunk used; or when the remaining space in the chunk is being used is not sufficient to assign a write data command to be written, to the memory of the first memory region the index of the index recording area to store the chunk is being used by.
  4. 4. 根据权利要求3所述的方法,其特征在于,在所述将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区之后,还包括: 将所述正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; 将所述第一存储区域内的所述索引记录存储至所述内存中与已使用的chunk对应的第二存储区域; 清除所述第一存储区域内的所述索引记录。 4. The method according to claim 3, characterized in that, the chunk within the index in said memory of said first storage area to store the records being used in the index area Thereafter, further comprising: a chunk being used to modify the properties of used and unused chunk apply as the next write data chunk being used; the index in the first storage area record stored in the memory and the second storage area corresponding to chunk has already been used; clearing the index record in said first storage area.
  5. 5. 根据权利要求2至4中任一所述的方法,其特征在于,所述方法还包括: 在重启所述硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; 将所述已使用的chunk中存储的索引记录,写入所述内存中与已使用的chunk对应的第二存储区域; 根据所述正在使用的chunk中存储的数据记录,重建与所述数据记录对应的索引记录, 并将重建得到的所述索引记录写入所述内存中与正在使用的chunk对应的第一存储区域。 5. The method according to any of claims 2 to 4, characterized in that, said method further comprising: upon reboot of the hard disk based on the attribute determined chunk chunk chunk being used and has been used; The said index record has been used chunk stored in the second storage area is written in the memory corresponding to the used chunk; chunk according to the data recording is stored using reconstructed data record corresponding to the index records, the index records are written in the reconstruction and the first storage area of ​​said memory with a corresponding chunk is being used.
  6. 6. 根据权利要求5所述的方法,其特征在于,所述重建得到的所述索引记录包括:所述数据记录中用于标识所述数据的所述键、与所述数据对应的标记以及所述数据被写入所述正在使用的chunk中的地址。 6. The method according to claim 5, characterized in that the index rebuild the obtained recording comprises: recording said data in said key for identifying the data, the data corresponding to the indicia and the data is written to address the chunk is being used in.
  7. 7. —种将数据写入叠瓦状磁记录SMR硬盘的装置,其特征在于,所述SMR硬盘包括多个根据磁轨带band虚拟化后得到的chunk,所述装置包括: 接收模块,用于接收写数据指令,所述写数据指令包括键、数据和标记,所述键用于标识所述数据,所述标记为写标记、删除标记或修改标记,所述写标记用于表示将所述数据写入所述SMR硬盘中,所述删除标记用于表示删除所述SMR硬盘中所述键标识的所述数据,所述修改标记用于表示利用所述数据修改具有相同键且已被写入所述SMR硬盘的数据; 申请模块,用于根据数据记录的长度向正在使用的chunk申请空间,所述数据记录包括所述写数据指令中的所述键、所述数据和所述标记; 第一写入模块,用于将所述数据记录写入申请的所述空间中; 保存模块,用于保存所述键、所述标记与所述数据被写入所述正在使用的chunk 7. - the kind of data writing means imbricated SMR magnetic disk, wherein said SMR chunk comprises a plurality of magnetic hard disk track obtained with the virtual band, the apparatus comprising: a receiving module, with receiving an instruction to write data, the write data command includes a key, data and tag, the data identifying the key, the label is written mark, modify, or delete flag mark, the write flag is used to indicate the the SMR said data written in the hard disk, the delete mark for deleting the data indicating the SMR said hard key identified using the modified numerals are used to modify the data with the same key and have been SMR data is written to the hard disk; application means for applying to the space being used chunk, the data record comprises data record according to the length of the key data of the write command, the data and the label ; writing a first module, the space for recording the data written in the application; storing module, for storing the keys, the data is written to the flag with the chunk being used 的地址。 the address of.
  8. 8. 根据权利要求7所述的装置,其特征在于,所述正在使用的chunk中包含用于存储数据记录的数据区,所述申请模块用于根据所述数据记录的长度向所述正在使用的chunk中的所述数据区申请空间。 8. The apparatus according to claim 7, characterized in that, the chunk is being used in the data area for storing data comprising records, the application module is being used for according to the length of the data record the chunk data area in space applications.
  9. 9. 根据权利要求8所述的装置,其特征在于,所述正在使用的chunk中包含用于存储索引记录的索引区,所述保存模块,包括: 组成单元,用于将所述键、所述标记与所述数据被写入所述正在使用的chunk中的地址组成索引记录; 保存单元,用于将所述索引记录保存至内存中与正在使用的chunk对应的第一存储区域;或者,在所述正在使用的chunk中的剩余空间不足以分配写数据指令中需要写入的数据时,将所述内存中的所述第一存储区域内的所述索引记录存储至所述正在使用的chunk中的所述索引区。 9. The apparatus according to claim 8, characterized in that, the chunk containing said index being used by the index recording area for storing the storage module, comprising: a composition unit for the key, the said mark and said data to be written is the address of the chunk used in the composition of the index record; storage unit, the index for the record-keeping to a first storage area in memory and corresponding to the chunk being used; or when the remaining space in the chunk is being used is not sufficient to assign a data write instruction to be written data, the index within the memory of the first storage area to store the records being used the chunk index in the region.
  10. 10. 根据权利要求9所述的装置,其特征在于,所述装置还包括: 修改模块,用于将所述正在使用的chunk的属性修改为已使用,并申请一个未使用的chunk作为下次写入数据的正在使用的chunk; 存储模块,用于将所述第一存储区域内的所述索引记录存储至所述内存中与已使用的chunk对应的第二存储区域; 清除模块,用于清除所述第一存储区域内的所述索引记录。 10. The apparatus according to claim 9, characterized in that said apparatus further comprising: a modification module, the attribute being used for chunk is used to modify and apply a chunk is not used in the next writing data chunk being used; a storage module, for storing the index record in said first storage area and second storage area in the memory corresponding to the used chunk to the; clearing module, for clearing the index record in the first storage area.
  11. 11. 根据权利要求8至10中任一所述的装置,其特征在于,所述装置还包括: 确定模块,用于在重启所述硬盘时,根据chunk的属性确定已使用的chunk和正在使用的chunk; 第二写入模块,用于将所述已使用的chunk中存储的索引记录,写入所述内存中与已使用的chunk对应的第二存储区域; 重建模块,用于根据所述正在使用的chunk中存储的数据记录,重建与所述数据记录对应的索引记录,并将重建得到的所述索引记录写入所述内存中与正在使用的chunk对应的第一存储区域。 11. An apparatus according to any of 8-10 claims, characterized in that, said apparatus further comprising: a determining module, configured to, when restarting the hard disk, the used chunk is determined according to the attribute being used chunk and a chunk; second writing means for recording the index used in the chunk stored in the second memory area is written to the memory has been used with a corresponding chunk; reconstruction module, according to the data records stored in the chunk is being used to rebuild the index record corresponding to the record data, the record index and the resulting reconstructed into the first memory area of ​​said memory with a corresponding chunk is being used.
  12. 12. 根据权利要求11所述的装置,其特征在于,所述重建得到的所述索引记录包括:所述数据记录中用于标识所述数据的所述键、与所述数据对应的标记以及所述数据被写入所述正在使用的chunk中的地址。 12. The apparatus as claimed in claim 11, wherein the index of the obtained reconstructed record comprises: recording said data identifying the key for the data, the data corresponding to the indicia and the data is written to address the chunk is being used in.
CN 201410736477 2014-12-05 2014-12-05 The method of writing data to the hard disk smr imbricated magnetic recording apparatus and CN104461390B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201410736477 CN104461390B (en) 2014-12-05 2014-12-05 The method of writing data to the hard disk smr imbricated magnetic recording apparatus and

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201410736477 CN104461390B (en) 2014-12-05 2014-12-05 The method of writing data to the hard disk smr imbricated magnetic recording apparatus and
PCT/CN2015/095997 WO2016086819A1 (en) 2014-12-05 2015-11-30 Method and apparatus for writing data into shingled magnetic record smr hard disk

Publications (2)

Publication Number Publication Date
CN104461390A true CN104461390A (en) 2015-03-25
CN104461390B true CN104461390B (en) 2017-10-24

Family

ID=52907519

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201410736477 CN104461390B (en) 2014-12-05 2014-12-05 The method of writing data to the hard disk smr imbricated magnetic recording apparatus and

Country Status (2)

Country Link
CN (1) CN104461390B (en)
WO (1) WO2016086819A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461390B (en) * 2014-12-05 2017-10-24 华为技术有限公司 The method of writing data to the hard disk smr imbricated magnetic recording apparatus and
CN106293497A (en) * 2015-05-27 2017-01-04 华为技术有限公司 Recycling method and device for junk data in shingle-aware file system
CN105491101B (en) * 2015-11-17 2018-09-21 华为技术有限公司 Data processing method and apparatus
CN105677243A (en) * 2015-12-31 2016-06-15 华为技术有限公司 Data writing device and method
CN106201355A (en) * 2016-07-12 2016-12-07 腾讯科技(深圳)有限公司 Method and device for processing data and storage system
CN106201353A (en) * 2016-07-12 2016-12-07 曹蕊 Data writing device and method for key value storage system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6631478B1 (en) * 1999-06-18 2003-10-07 Cisco Technology, Inc. Technique for implementing high performance stable storage hierarchy in a computer network
CN103955433A (en) * 2014-05-09 2014-07-30 华为技术有限公司 Shingled magnetic recording hard disk, and method and device for writing data in shingled magnetic recording hard disk
CN104049908A (en) * 2013-03-15 2014-09-17 希捷科技有限公司 Dynamic granule-based intermediate storage
CN104156172A (en) * 2013-01-17 2014-11-19 西部数据技术公司 Data management for a data storage device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010006099A1 (en) * 2008-07-11 2010-01-14 Marvell World Trade, Ltd. Access point rotation for sharing power load
US20140304525A1 (en) * 2013-04-01 2014-10-09 Nexenta Systems, Inc. Key/value storage device and method
CN104461390B (en) * 2014-12-05 2017-10-24 华为技术有限公司 The method of writing data to the hard disk smr imbricated magnetic recording apparatus and

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6631478B1 (en) * 1999-06-18 2003-10-07 Cisco Technology, Inc. Technique for implementing high performance stable storage hierarchy in a computer network
CN104156172A (en) * 2013-01-17 2014-11-19 西部数据技术公司 Data management for a data storage device
CN104049908A (en) * 2013-03-15 2014-09-17 希捷科技有限公司 Dynamic granule-based intermediate storage
CN103955433A (en) * 2014-05-09 2014-07-30 华为技术有限公司 Shingled magnetic recording hard disk, and method and device for writing data in shingled magnetic recording hard disk

Also Published As

Publication number Publication date Type
CN104461390A (en) 2015-03-25 application
WO2016086819A1 (en) 2016-06-09 application

Similar Documents

Publication Publication Date Title
US8806115B1 (en) NVRAM data organization using self-describing entities for predictable recovery after power-loss
US20070162692A1 (en) Power controlled disk array system using log storage area
US20120030408A1 (en) Apparatus, system, and method for atomic storage operations
US8909894B1 (en) Automatically aligning virtual blocks to physical blocks
US20100262802A1 (en) Reclamation of Thin Provisioned Disk Storage
US20140282514A1 (en) Virtualization support for storage devices
US8463825B1 (en) Hybrid file system for virtual machine storage
US20130166855A1 (en) Systems, methods, and interfaces for vector input/output operations
US20130166820A1 (en) Methods and appratuses for atomic storage operations
CN102323958A (en) Data de-duplication method
CN1963814A (en) Managing method of data of memorizer
US20140006685A1 (en) Systems, methods, and interfaces for managing persistent data of atomic storage operations
CN101986285A (en) Virtual machine storage space management method, system and physical host
CN101840362A (en) Method and device for achieving copy-on-write snapshot
CN101122885A (en) Data cache processing method, system and data cache device
JP2007200182A (en) Device and system for storage
CN101814044A (en) Method and device for processing metadata
CN102185929A (en) Storage area network (SAN)-resource-based video monitoring data storage method and device
CN101656094A (en) Data storage method and storage device
US8402069B2 (en) Use of delete notifications by file systems and applications to release storage space
US20130124785A1 (en) Data deleting method and apparatus
US20120106309A1 (en) Elimination of duplicate written records
CN101320392A (en) High-capacity data access method and device of internal memory database
CN102096561A (en) Hierarchical data storage processing method, device and storage equipment
CN103197988A (en) Data backup and recovery method, device and database system

Legal Events

Date Code Title Description
C06 Publication
GR01