CN106502587A - Data in magnetic disk management method and magnetic disk control unit - Google Patents

Data in magnetic disk management method and magnetic disk control unit Download PDF

Info

Publication number
CN106502587A
CN106502587A CN201610912077.5A CN201610912077A CN106502587A CN 106502587 A CN106502587 A CN 106502587A CN 201610912077 A CN201610912077 A CN 201610912077A CN 106502587 A CN106502587 A CN 106502587A
Authority
CN
China
Prior art keywords
data
log area
mapping relations
space
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610912077.5A
Other languages
Chinese (zh)
Other versions
CN106502587B (en
Inventor
丁敬文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610912077.5A priority Critical patent/CN106502587B/en
Publication of CN106502587A publication Critical patent/CN106502587A/en
Application granted granted Critical
Publication of CN106502587B publication Critical patent/CN106502587B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device

Landscapes

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

Abstract

The embodiment of the invention discloses data in magnetic disk management method and magnetic disk control unit is planted, for the fragment on high-efficiency management disk.The embodiment of the present invention is applied to the magnetic disk control unit for including disk, and the disk includes that data field and log area, method include:To caching device write data;Judge whether data are hot spot datas, wherein hot spot data be stored on disk after preset times modification and release after can make disk produce predetermined number fragment data;If data are not hot spot datas, data field space is write data in data separation with data field space for data;If data are hot spot datas, distribute log area space for data in log area, write data into log area space.It is managed by different types of data are stored in different regions on disk in a different manner, the debris management efficiency on disk can be improved, high-efficiency management of the log area to disk fragmentses can reduces the generation of disk fragmentses.

Description

Data in magnetic disk management method and magnetic disk control unit
Technical field
The present invention relates to data processing field, more particularly to a kind of data in magnetic disk management method and magnetic disk control unit.
Background technology
For common mechanical hard disk, because which relies on mechanical rotation disk and moving head locating read-write position, Hard disk order read-write is optimal read-write model.If disk space fragmentation, then when writing data, it is impossible to be assigned to Continuous space, causes magnetic head shake serious, the main time consumption of data transfer on positioning magnetic track and sector, so as to leave for The time of transmission data is little.Because the data of file are more discrete, then when these files of reading, efficiency also compared with Low.
Therefore, most of disk file systems are all as possible avoiding producing substantial amounts of fragment space, but fragmentation is still Cannot avoid.
Such as, the advantage of disk sequential write can be utilized using COW mechanism.When to change write a block number according to when, be not The data of early version are directly covered, but reads the data of early version, after modification is good, is write a new position, number will be write According to data be all aggregating, sequentially write on disk, discharge early version data.Because the change in location of data, need Pointer in the last layer index block of sensing data is modified, such recurrence is to top.Can thus discharge substantial amounts of Data, cause to produce substantial amounts of fragment on disk.
Content of the invention
A kind of data in magnetic disk management method and magnetic disk control unit is embodiments provided, for high-efficiency management disk On fragment.
First aspect present invention provides a kind of data in magnetic disk management method, and the method is applied to the disk control for including disk Device, disk include that data field and log area, the method include:
To caching device write data, the caching device can for example be internal memory, flash cards, solid-state to magnetic disk control unit The memory device different from disk such as hard disk, then, magnetic disk control unit judges whether the data are hot spot datas, wherein focus Data be stored on disk after preset times modification and release after can make disk produce predetermined number fragment data.Logical Cross and the data for writing are judged on caching device, determine the type of the data, different to execute to different data Processing mode.
When data are write to disk, if the data are not hot spot datas, empty with data field in data separation for data Between, write data into data field space;If the data are hot spot datas, distribute log area space for data in log area, will Data write log area space.
The data in magnetic disk management method of first aspect present invention, the data for being written into disk are divided into hot spot data and non-thermal Point data, hot spot data are easy to cause disk to produce fragment, focus number is stored on log area, is managed with log mode Reason, even if the data on log area frequently change generation disk fragmentses, is also convenient for carrying out reclaiming etc. management to these fragments, and incite somebody to action Non-thermal point data is stored in data field, and the release of non-thermal point data is not easily caused disk and produces fragment, and data field can be Disk fragmentses management distribution excess resource, so as to, by disk by different types of data be stored in different regions with Different modes are managed, and can improve the debris management efficiency on disk, effectively the fragment on disk are managed, is evaded Or reduce disk fragmentses generation.
In conjunction with a first aspect, in the first possible implementation, caching device is internal memory, is the data in log area After distribution log area space, the first possible implementation also includes:The mapping for setting up the data and log area space is closed System.I.e. magnetic disk control unit be the data log area distribution log area space after, caching device on set up mapping relations, For the data and the corresponding relation in its log area space being assigned to, by the mapping relations record data log area storage Situation, is managed so as to eliminate operation using the mapping relations to the data that the data of log area are eased up in memory device.Its In, in the first possible implementation, caching device is internal memory, but caching device can also be other situations.
In conjunction with the first possible implementation of first aspect, set up in second possible implementation data and The mapping relations in log area space, including:Set up the log area space that multiple target datas and multiple target datas are assigned to Mapping relations, wherein target data belong to hot spot data;
Log area space is write data into, including:Multiple write operations of multiple target datas are combined as affairs;Will All target data write log area spaces of affairs.And the write operation for working as one of target data of affairs executes failure When, the write operation that other target datas of affairs are executed fails.Multiple target datas refer at least two target datas, accordingly, Multiple write operations refer at least two write operations.So, the concept of database field affairs is introduced, in units of multiple hot spot datas To operating, such as mapping relations, and all hot spot datas with affairs are set up with multiple hot spot datas for belonging to same affairs Write operation execute the write operation to log area together.The efficiency of data processing can so be improved.
In conjunction with second possible implementation of first aspect, the third possible implementation also includes:In internal memory Upper caching belongs to the data of hot spot data.Hot spot data is buffered on internal memory, for example, hot spot data log area is being write When, also these data are retained on internal memory or, read hot spot data thereon from log area before data are write to internal memory, And be buffered on internal memory, so, when subsequently writing data to content, directly data can be modified on internal memory, data exist Migrate in internal memory, reduce the generation of fragment on disk, and the data of log area can be arranged according to migration situation.
In conjunction with the third possible implementation of first aspect, by the institute of affairs in the 4th kind of possible implementation Before having target data write log area space, the 4th kind of possible implementation also includes:
Data link table is set up according to multiple target datas, wherein, data link table is used for management objectives data, data link table pipe The target data of reason is identical with the target data of affairs;Then, target data is managed according to data link table, and, according to Data link table is managed to target data, including:After setting up the second data link table, when the second mesh of the second data link table management When mark data are obtained by the first object data modification of the first data link table management for pre-building, on the first data link table Release the management to first object data;First object data are deleted in the first mapping relations corresponding with the first data link table Information.So, on internal memory, by the migration of data between the different affairs of management by data link table.
According to data link table to the mode that the data on internal memory are managed can be:Under default release conditions, according to Foundation order of the data link table from after arriving first, the data that searching data chained list does not decontrol;Target data is discharged on internal memory The data that chained list does not decontrol, and retain the corresponding target mapping relations of target data chained list on internal memory.By discharging mesh Data on mark data link table can expand the capacity of memory management data.Inquiry of the system by target mapping relations, you can from Corresponding data are read on log area.
In conjunction with the 4th kind of possible implementation of first aspect, in default release in the 6th kind of possible implementation Under the conditions of, according to data link table from after arriving first foundation order, the data that searching data chained list does not decontrol, including:When interior Deposit when reaching the first preset water level, the foundation order according to data link table from after arriving first, searching data chained list do not decontrol Data;In addition, the method also includes that the internal storage data of second stage is eliminated, i.e., on internal memory, release target data chained list is not released After the data of management, the method also includes:When internal memory reaches the second preset water level, target mapping relations are read from log area The data of sensing;The data write data field that target mapping relations are pointed to;Delete target mapping relations on internal memory.By two The internal storage data eliminative mechanism in stage can expand management capacity of the internal memory to data, and the internal storage data in second stage is eliminated In, the data that now target mapping relations are pointed to are sluggish data, and the probability that is changed is relatively low, can by these data from Log area moves to data field preservation, and this will not excessively increase the fragment of data field.
In conjunction with the 4th kind of possible implementation of first aspect, also wrap in the 6th kind of possible implementation the method Include:It is that the corresponding data link table of affairs distributes transaction number according to incremental rule according to the write sequence of affairs.By for Data-Link Table distributes transaction number, you can data link table is managed according to transaction number, improves the efficiency of management.Such as, from Current transaction Number minimum data link table starts, according to the data that the ascending sequential search data link table of transaction number does not decontrol, this Sample can achieve the foundation order according to data link table from after arriving first, the data that searching data chained list does not decontrol.
In conjunction with the 4th kind of possible implementation of first aspect, in the 7th kind of possible implementation, the method is also wrapped Include:Under default recovering condition, the step of execution journal area data are moved.The step of for example execution journal area data are moved, bag Include:
Search mapping relations;
Information according to mapping relations record judges whether the data on the first log area corresponding with mapping relations migrate Complete;
If the data on the first log area have not been migrated, according to the information of mapping relations record, the first log area is determined On space availability ratio;
When the space availability ratio of the first log area is less than default utilization rate threshold values, by the Data Migration of the first log area extremely Second log area, and update mapping relations corresponding with the data that is moved, wherein the second log area be idle log area or The used log area when log area is reclaimed;
When current log area total space water level reaches pre-set space threshold values, then stop the data resettlement of execution journal area Step, the step of otherwise continuing executing with log area data and move.
In conjunction with the 7th kind of possible implementation of first aspect, in the 8th kind of possible implementation, the method is also wrapped Include:According to the write sequence of affairs be the corresponding data link table of affairs according to incremental rule distribute transaction number, according to transaction number come Data link table is managed, the efficiency of management can be improved.For example, from the beginning of the minimum data link table of Current transaction number, according to thing Business number ascending sequential search mapping relations corresponding with data link table, you can realize the lookup to mapping relations.
In conjunction with the 7th kind of possible implementation of first aspect, recovery article is preset in the 9th kind of possible implementation Part includes timer expiry, the reclaimer operation of internal storage data is completed, the total water level in log area is reached in preset water level threshold values extremely Few one.
In conjunction with the first possible implementation of first aspect, in the tenth kind of possible implementation, on internal memory Caching belongs to the data of hot spot data, has various ways, such as after judging whether data are hot spot data, if data are focuses Data, then retain the data on internal memory;Or, to before caching device write data, data are read to caching from log area Device is cached.
In conjunction with first aspect or second to the tenth kind arbitrary possible implementation of first aspect, can in the tenth one kind In the implementation of energy, hot spot data includes that size of data is less than the data of preset data threshold values and/or hot spot data and includes first number According to.The preset data threshold values can for example be 128KB or other space sizes, and specific numerical value can be adjusted according to type of service Whole, if the size of data of data is less than the preset data threshold values, the frequent release of the data may make disk generation broken in a large number Piece.And metadata includes the management data to data, for example, the indirect block of data address is preserved, and conservation object manages structure Meta data block.Metadata may also lead to disk and produce a large amount of fragments.These hot spot datas to be filtered out, to be stored in daily record Area.
In conjunction with first aspect or second to the tenth kind arbitrary possible implementation of first aspect, can at the 12nd kind Distribute log area space for data in log area in the implementation of energy, write data into log area space, including:Exist for data Log area distributes log area space in order, and data order is added write log area space.So can achieve data to exist Log area order read-write, so as to move log area data when, the expense without metadata.Arrange expense smaller, have Effect ensure that the stability of systematic function.
In conjunction with first aspect or second to the tenth kind arbitrary possible implementation of first aspect, can at the 13rd kind In the implementation of energy, the method also includes:When the space availability ratio of data field utilizes threshold values more than preset data area, ought Front idle log area is converted into data field;When the space availability ratio of log area utilizes threshold values more than default log area, will be by The data field that idle log area changes into is converted into log area.So, log area and data field are mutually converted with adaption system The change of capacity.Can flexible adaptation specifically using scene, improve the service efficiency of disk.
In conjunction with first aspect or second to the tenth kind arbitrary possible implementation of first aspect, can at the 14th kind In the implementation of energy, disk also includes superblock, and each log area is assigned identification information, and superblock is used in log area quilt The identification information of the log area that is changed is recorded after modification.Further log area is managed by superblock, if for example After system cut-off or collapse recover, magnetic disk control unit can be searched according to the information of the superblock record day that is changed in time Will area.
In conjunction with first aspect or second to the tenth kind arbitrary possible implementation of first aspect, can at the 15th kind In the implementation of energy, log area and data field are arranged alternately on disk.So, the data of log area and data field can be caused Arrange closer.
In conjunction with first aspect or second to the tenth kind arbitrary possible implementation of first aspect, can at the 16th kind Can implementation in disk also include block group, block group includes the log area and data field of predetermined number, the log area of chunk and Data field is continuously arranged, and can coordinate the use of the data field and log area in adjustment chunk by chunk, for example, according to block group After management information determines idle target data area, it is that data distribute data field space in target data area;So as to data are write After entering data field space, method also includes:Target metadata is generated according to data and data field space;To caching device write Target metadata, after magnetic disk control unit judges that metadata is hot spot data, determines the object block group belonging to target data area; Determine the available log area of object block group;Target metadata is write available log area.So can be by metadata in disk On be located proximate to the position that the corresponding data of metadata are stored on disk, the convenient read-write to data.
In conjunction with second to the tenth kind arbitrary possible implementation of first aspect, the 17th kind of possible realization side In formula, the method also includes:Distribute log area space on log area for mapping relations, then, mapping relations write mapping is closed The log area space that system is assigned to.Will mapping relations be also stored on log area so that mapping relations can on disk Preserve by ground.
Second aspect present invention provides a kind of magnetic disk control unit, and the magnetic disk control unit includes disk, and the disk includes Data field and log area, the magnetic disk control unit have the function of magnetic disk control unit in said method.The function can pass through Hardware is realized, it is also possible to is executed corresponding software by hardware and is realized.The hardware or software include one or more with above-mentioned work( The corresponding module of energy.
In a kind of possible implementation, the magnetic disk control unit includes:
Writing unit, for caching device write data;
Cache manager, for judging whether data are hot spot datas, wherein hot spot data for after being stored on disk Disk can be made to produce the data of predetermined number fragment after the modification of preset times and release;
Data management system, if not being hot spot data for data, matches somebody with somebody data field space for data in data separation, by number According to write data field space;
Log manager, if being hot spot data for data, distributes log area space for data in log area, by data Write log area space.
In alternatively possible implementation, the magnetic disk control unit includes:
Processor;
The following action of the computing device:To caching device write data;
The following action of the computing device:Judge whether data are hot spot datas, wherein hot spot data is to be stored in disk After the modification and release of preset times disk can be made to produce the data of predetermined number fragment after upper;
The following action of the computing device:If data are not hot spot datas, empty with data field in data separation for data Between, write data into data field space;
The following action of the computing device:If data are hot spot datas, distribute log area space for data in log area, Write data into log area space.
The third aspect, the embodiment of the present application provide a kind of computer-readable storage medium, and the computer-readable storage medium is stored with journey Sequence code, the program code are used for the method for indicating to execute above-mentioned first aspect.
As can be seen from the above technical solutions, the embodiment of the present invention has advantages below:
On the magnetic disk control unit for including disk, the disk includes data field and log area, to caching device write number According to rear, magnetic disk control unit judges whether the data are hot spot datas, if the data are not hot spot datas, is counting for the data Distribute data field space according to area, write the data into data field space;If the data are hot spot datas, it is the data in daily record Area distributes log area space, writes the data into log area space.So, be written into disk data be divided into hot spot data and Non-thermal point data, hot spot data be stored on disk after preset times modification and release after can make disk produce present count The data of amount fragment, hot spot data are easy to cause disk to produce fragment, focus number is stored on log area, is entered with log mode Row management, even if the data on log area frequently change generation disk fragmentses, is also convenient for these fragments are carried out the management such as reclaiming, And non-thermal point data is stored in data field, the release of non-thermal point data is not easily caused disk and produces fragment, and data field can nothing Need to be disk fragmentses management distribution excess resource, so as to by different types of data are stored in different areas on disk Domain is managed in a different manner, can improve the debris management efficiency on disk, high-efficiency management of the log area to disk fragmentses, The generation of disk fragmentses can be reduced.
Description of the drawings
Fig. 1 is the logical view of an object on log area provided in an embodiment of the present invention;
A kind of flow chart of data in magnetic disk management methods of the Fig. 2 shown in one embodiment of the invention;
Fig. 3 is the schematic diagram that the data involved by embodiment illustrated in fig. 2 are migrated in internal memory;
Fig. 4 is the schematic diagram that the data involved by embodiment illustrated in fig. 2 are cached in internal memory;
A kind of structural representation of magnetic disk control unit that Fig. 5 is provided for another embodiment of the present invention;
Fig. 6 is the structural representation of the recovery unit of the magnetic disk control unit shown in Fig. 5;
A kind of hardware architecture diagram of magnetic disk control unit that Fig. 7 is provided for another embodiment of the present invention.
Specific embodiment
A kind of data in magnetic disk management method and magnetic disk control unit is embodiments provided, on high-efficiency management disk Fragment.
First, the implementation environment involved by the data in magnetic disk management method of the embodiment of the present invention
A kind of data in magnetic disk management system of the embodiment of the present invention, the data in magnetic disk management system include disk, internal memory, should Internal memory can be divided into data field Date zone and log area Journal zone, the wherein day as caching device, the disk Will area is managed to data thereon with log mode.
In data in magnetic disk management system to before the disk write data, the number is write to elder generation as the internal memory of caching device According to, if data in magnetic disk management system judges the data for hot spot data, the hot spot data for after being stored on disk default Disk can be made to produce the data of predetermined number fragment after the modification of number of times and release, these hot spot datas are on the data field of disk Disk will be caused after modification to produce a large amount of fragments.So, to after internal memory write data, if the data are not hot spot datas, for Then the data, write the data into the data field space in data separation with data field space.If the data are focus numbers According to, then be data log area distribute log area space, write data into log area space.
Wherein, data field space is the memory space on data field, can be the segment space on a data field, also may be used Being the whole spaces on a data field.Log area space is the memory space on data field, can be on a log area Segment space, or a log area on whole spaces.
So, the data for being written into disk are divided into hot spot data and non-thermal point data, and hot spot data is to be stored in disk After the modification and release of preset times disk can be made to produce the data of predetermined number fragment after upper, hot spot data is easy to cause magnetic Disk produces fragment, focus number is stored on log area, is managed with log mode, even if the data on log area are frequently repaiied Change products raw disk fragmentses, be also convenient for these fragments are carried out the management such as reclaiming, and non-thermal point data is stored in data field, non-thermal The release of point data is not easily caused disk and produces fragment, and excess resource can be distributed without the need for managing for disk fragmentses in data field, from And, it is managed by different types of data are stored in different regions on disk in a different manner, magnetic can be improved Debris management efficiency on disk, is effectively managed to the fragment on disk, has also been reached by the management of log area and has evaded magnetic The effect that disk fragment is produced.
The setting of the log area and data field of disk can have various ways, be carried out as follows detailed description, using as which In a kind of implementation.
Disk is divided into the two kinds of region in data field and log area, the space size sheet to data field and log area Inventive embodiments are not especially limited, for example, can be 256M.The data field and log area can be arranged alternately, such as one institute of table Show, table one is an a kind of example of disk space layout, and disk is divided into superblock, data field and log area.Alternatively, exist In the set of log area, used as fixed fixed log area, which is evenly spaced to be distributed on disk 0.1% ratio, this type Log area can only use as log area, and other log areas can be converted into data when Insufficient disk space Area.
Table one
There is on disk multiple set-up modes, above-mentioned data field and log area to be only arranged alternately for data field and log area It is a kind of mode therein, the present invention is not especially limited to this, for example, can also be that data field is continuously disposed in the one of disk Region, log area are continuously disposed in another region of disk, or multiple data fields are continuously set to data district's groups, multiple daily records Area is continuously set to daily record district's groups, and then data district's groups and daily record district's groups are arranged alternately, etc..
Data field can preserve non-thermal point data, and the data that for example will be greater than 128KB are write direct data field.Wherein, exist Data field, after writing data into data field, will produce the metadata of management data, after the writable caching device of these metadata, Again for its in log area allocation space, to be stored.
Log area can preserve hot spot data, such as by the data less than 128KB and meta-data preservation in log area, In some embodiments, hot spot data can be stored on log area in the way of adding, in the embodiment having, can also be right Distribute an identification information ID in order in log area.In log area, data are managed with log mode.
In the embodiment having, in log area, adding WriteMode in order carries out io process, when a data block needs Write log area, from the afterbody allocation space of the last write in the log area, when log area cannot accommodate a data block Wait, reselecting an idle maximum log area carries out additional writing.
As shown in Table 2, wherein Journal ctrl are identification information ID to the layout of log area, and Map is mapping relations, Record is data, and the data are, for example, the data and metadata less than 128KB.
Table two
As shown in Table 1, in the embodiment having, on the disk of magnetic disk control unit, superblock is additionally provided with, is write in data Behind log area, log area is changed, and superblock will record the flag information ID of the log area that is changed.For example, a collection of to When the write operation of log area is combined as affairs, after the data of affairs are saved in hard disk, can be by this affairs modification The identification information ID of log area recorded in the corresponding bitmap of superblock.
For the space size of superblock, the embodiment of the present invention is not especially limited, and can be carried out according to equipment concrete condition Adjustment, for example, the disk of a 4T, log area have 4T/256M/2=8192, need a 1024B to record day in superblock The service condition of the totality in will area.
The layout of superblock can be as shown in Table 3.Wherein Super Blkctrk are used for recording overall management information, example If disk is using capacity, total capacity, total idle capacity, log area number, data field number.Journalbitmap is used In the transaction number that record has been processed.The capacity of Super blkctrk and Journalbitmap can be 4K respectively
Table three
Super blkctrk Journalbitmap
In order to make the data for being assigned to data field and log area close, in the embodiment having, can be by multiple log areas A chunk is combined into data district's groups, the log area and data field on chunk is continuously arranged.Each block group has a space management Object, manages the service condition of the disk space in this block group by the way of bitmap file bitmap.For example, it is possible to will be even Continuous 16 log areas for arranging and data district's groups are combined into a block group.
Table four and table five show the relation of chunk, data field and log area three.Table four is to magnetic in units of chunk The signal of the layout of disk, table five are that the layout to the chunk 1 in table four is illustrated.
Table four
Table five
As shown in Table 2, be also stored with log area mapping relations Map, and the mapping relations could be for log The corresponding relation in the log area space that the data and the data distribution in area are arrived, as shown in figure 1, it illustrates patrolling for object disk View is collected, mapping relations is illustrated according to the figure.
As shown in figure 1, it illustrates an object on log area.One object can be divided into many levels, most bottom Level level is 0 layer by layer, the data block of corresponding objects.It is indirect block on level0, level is 1.The superiors are Object Management groups Structure place block, level is 2.In the case that data block is a lot, the address that indirect block cannot preserve so many data blocks refers to Pin, now needs the number of plies of multiple indirect blocks, object to also increase.The block of same layer according to numbering from left to right, such as most bottom The blkid number consecutivelies of the data block of layer are 0,1,2 and 3.
In affairs when data block is changed, the relation in the log area space for arriving data and the data distribution is needed to remember Record in mapping relations.For example, affairs create the object in Fig. 1, then need to record such as in mapping relations The information of table six.In table six, in the mapping relations, per string, the information type of the data of record is followed successively by objsetid, Objid, levelid, blkid, journalid, offset, size.
Wherein, objsetid refers to that object set ID, objid refer to that object ID, levelid refer to the number of plies that data block is located, blkid Refer to data block in the place number of plies, sequence number from left to right, journalid refer to that the id of the log area of data block write, offset refer to Data block writes the relative skew of log area, and size refers to the size of data block write.
It is appreciated that the information type of mapping relations record can include above-mentioned all information types, it is also possible to wrap The some types of above- mentioned information type are included, can also include that more other information types, the embodiment of the present invention are not made to this Concrete restriction.
Table six
It is appreciated that in the embodiment having, the caching device can replace internal memory by other devices, such as Nvdimm, Flash cards, SSD (solid state hard disc, Solid State Drives) etc..It is appreciated that in the embodiment having, can be with disk Do not include log area, and hot spot data is stored on caching device, the embodiment of the present invention is not specifically limited to this.
It is appreciated that the magnetic disk control unit of the embodiment of the present invention can be used on the equipment such as computer, server, this Inventive embodiments are not specifically limited to this.
Fig. 2 is a kind of flow chart of the data in magnetic disk management method according to an exemplary embodiment.The method application On magnetic disk control unit, the magnetic disk control unit includes disk, and the disk includes data field and log area.In conjunction with foregoing description Part I, i.e. implementation environment involved by the data in magnetic disk management method of the embodiment of the present invention held with magnetic disk control unit As a example by the angle of row method provided in an embodiment of the present invention, referring to Fig. 2, method flow provided in an embodiment of the present invention includes:
Step 201:Data are write to internal memory;
In equipment to before disk write data, magnetic disk control unit first writes the data into caching device, to be write Management before disk, for example, be managed to the data using the cache manager of magnetic disk control unit.
The caching device can be internal memory, or the caching device such as flash memory, and the embodiment of the present invention is not made to this specifically Limit.
In embodiments of the present invention, illustrated with caching device as internal memory.The data of the write internal memory include disk control Write the metadata produced during data in all external datas of device processed and the data field to disk.
Wherein, include that modification is write and two ways is write in establishment to internal memory write data, the number i.e. to internal memory write is write in modification According to for modifying to the data on internal memory, the data changed by new data cover are created and are write i.e. to the number that internal memory write is new According to not caching the initial data of the new data on internal memory.
Step 202:Judge whether the data are hot spot datas, if the data are not hot spot datas, execution step 203, If the data are hot spot datas, execution step 204.
To after internal memory write data, magnetic disk control unit judges whether the data are hot spot datas, such as passes through disk control The cache manager module of device processed is judged.Magnetic disk control unit judges whether the data of disk to be written are hot spot datas Afterwards, different processing modes are executed according to judged result.
Wherein, hot spot data be stored on disk after after the modification and release of preset times to produce can disk default The data of quantity fragment.For example, in the present embodiment, the hot spot data may refer to size of data less than preset data threshold values Data, and/or the hot spot data may also mean that metadata.
Size of data is small data less than the data of preset data threshold values, and frequently modification and release are easily produced the small data Disk fragmentses, even and if size of data more than certain predetermined data threshold values data on disk frequently modification will not also produce big The disk fragmentses of amount.Wherein, the setting of the preset data threshold values is relevant with business model, for example, can be set to 64KB, 128KB Deng.
And metadata is the data block for recording object management architecture and record data block address.When data in magnetic disk area will be changed On data block when, what factor data area generally used is COW mechanism, i.e. when to change write a block number according to when, be not direct The data of early version are covered, but reads the data of early version, after modification is good, write a new position, discharge early version Data.Because the change in location of data, need the pointer in the last layer index block of sensing data is modified, i.e., will Modification metadata, amended new data allocations to new space, and the old metadata that is changed needs to discharge, so Recurrence is to top.Thus substantial amounts of data can will be discharged because of the modification of metadata, the position of the data discharged on disk Fragment is produced just, so as to accelerate the process of disk fragmentses.
So as to data and/or metadata of the embodiment of the present invention by size of data less than preset data threshold values are classified as focus Data, these data are easily caused disk and produce fragment, need to manage which accordingly.
Step 203:Data field space is write the data in data separation with data field space for data.
Be judged as be not hot spot data data because which is not easy to make disk to produce fragment, so as to disk can be saved it in On data field.Wherein, data field is the region for being used for data storage on disk, and the region can use COW mechanism to thereon Data are managed.Data field can be the region on disk with pre-set space size, and the pre-set space size for example can be with It is 256M.Description of the above-mentioned implementation environment part to data field is referred to the description of the data field.
For example, when the size of data is more than 128KB, cache manager judges that the data are not hot spot datas, then magnetic The dina base administration device module of disk control unit can distribute data field space for the data on data field, then write the data Enter the data field space being assigned to.
Wherein, metadata can be produced after writing data into data field.The metadata is used for the address for recording the data, so as to The convenient management to the data.For example, general by the way of multiple index when tissue multi-block data, that is, in data The last layer of block distributes an index block, and its content is the address of record data block, can be by multiple data by the index block Block is spliced into a continuous object in logic.This index block is exactly a type of metadata.Write data into data field After producing metadata, the metadata write internal memory can be executed above-mentioned step 201.Cache manager can determine whether out this yuan of number According to for hot spot data, so as to be saved on log area and internal memory.
It is appreciated that in the embodiment having, the disk of magnetic disk control unit also includes that block group, block group include predetermined number Log area and data field, the log area and data field of block group continuously arrange, and in the magnetic disk control unit for including block group, is several It is to select suitable block group according to the concrete executive mode in data separation with data field space, such as space uses less block The more block group in group or idle data area, then distributes the data field space of data field in the block group of the selection for the data. After allocation space, the service condition for recording space is needed, that is, need to search in the space management bitmap of block group and distribute After idle data block, the management structure of modified block group.Subsequently can be according to the space service condition of block group record to belonging to this The log area of block group writes the metadata, if the block group does not have the log area of free time, needs to select neighbouring log area to write The metadata.So that data being located proximate on disk that the metadata is pointed to the metadata.
Wherein, the block group refers to corresponding description of the above-mentioned implementation environment part to block group.
It is appreciated that write data field on data can also include in addition to being judged as the data of non-thermal point data interior The data that eliminates because space is inadequate are deposited, for example, is reclaimed in second stage in subsequent memory, mapping relations is pointed to Data move to data field from log area.The data that these are migrated can also be matched somebody with somebody in data separation by data space management device Behind the space of data field, data field space is write.
Step 204:Distribute log area space for data in log area.
Log area is additionally provided with disk, the data on log area is managed by log mode on log area.
When the data of step 201 are judged as hot spot data, and it is empty to distribute log area on log area for the data Between, log manager is delivered the data to for example, the log manager distributes log area on log area for the hot spot data Space, so that the hot spot data is stored on log area.
In the embodiment of the present invention, in order to more easily be managed to the data on log area, can be according to write log area Order be to belong to the data of hot spot data allocation space on log area.Certainly, in other embodiments, can not be heat Point data order-assigned log area space, the embodiment of the present invention are not especially limited to this,
And the data for belonging to hot spot data are stored on log area, when the hot spot data on internal memory is lost because of power down When, can by the digital independent on log area to internal memory, so that equipment executes operation, also, internal memory and log area use cooperatively, Hot spot data is stored in log area, the data volume of the manageable hot spot data of internal memory can be caused to be expanded.
The log area can be the region on disk with certain space size, for example, can be 256M.Can on disk So that with multiple log areas and data field, the log area can have identification information according to the setting order-assigned on disk.Close Corresponding description of the above-mentioned implementation environment part to log area is referred in the specific set-up mode in log area.
The set-up mode of log area and data interval on disk, can have various ways, such as log area and data Area is disposed alternately on disk, shown in table described above.Certainly data field and log area can also be arranged in another manner, The embodiment of the present invention is not especially limited to this, specifically refers to what above-mentioned implementation environment part was arranged to data field and log area Corresponding description.
Step 205:Set up the mapping relations in the log area space that multiple target datas and the plurality of target data are assigned to.
Wherein target data belongs to hot spot data.
Write after multiple data to internal memory, after being whether the judgement of hot spot data, may obtain on internal memory multiple Belong to the data of hot spot data.Multiple target datas for belonging to hot spot data on internal memory are determined by magnetic disk control unit, It is managed with multiple to target data together, improves treatment effeciency.It is empty that target data is all assigned log area on log area Between, magnetic disk control unit sets up mapping relations according to the log area space that these target datas and target data are assigned to.Wherein These target datas belong to hot spot data, i.e. target data includes metadata and/or size of data less than preset data threshold values Data.
The all data for writing log area are required for the mapping relations in record data and log area space, by mapping relations Data on log area are recorded, to be entered to the hot spot data on internal memory or the data on log area according to the mapping relations Row management, for example, corresponding number of the equipment according to the index reading and saving of the mapping relations being buffered on internal memory on log area According to, or log area is reclaimed according to the data message of mapping relations record, to carry out debris management to log area.
The information type of the mapping relations record can include objsetid, objid, levelid, blkid, The information such as journalid, offset, size,
More contents with regard to the mapping relations refer to the corresponding description of above-mentioned implementation environment part.
Step 206:Mapping relations are cached on internal memory.
After mapping relations are established, which is preserved on internal memory, think that subsequent operation prepares.
In the embodiment having, it is also possible to which the mapping relations are saved in log area, when needing to be saved on internal memory, then The mapping relations are read from log area, to be buffered on internal memory.Certainly, in the embodiment having, can be by the mapping relations It is stored on internal memory and log area simultaneously.
Step 207:Multiple write operations of the plurality of target data are combined as affairs.
After multiple target datas are determined, write operation be executed to the plurality of target data to write log area, disk Multiple write operations of this multiple target data are combined as affairs by control device, execute write magnetic disk behaviour in units of affairs Make.Wherein affairs are the addresses combined by the plurality of write operation, are not the execution of write operation.And multiple target datas refer at least Two target datas, accordingly, multiple write operations refer at least two write operations.
In order to improve write efficiency and ensure write reliability, when equipment is to log area write data, it is generally not only to hold Write operation of row, but execute in the operation that data are write to log area once multiple write operations of multiple data.These Belong to the multiple target datas with a batch of write operation, or being write as work(during write disk entirely, or writing full mistake Lose.This is combined as affairs with multiple write operations of a batch of multiple target datas.
It is appreciated that the embodiment of the present invention is not especially limited to the execution sequence of step 207 and step 205.I.e. multiple The write operation of target data is combined as affairs, can set up mapping relations according to these target datas, so as to affairs and Mapping relations are corresponding.
In the embodiment having, the method for the embodiment of the present invention also includes setting up Data-Link according to the plurality of target data Table, i.e., form a data link table, the number according to a series of metadata in affairs and less than the data of pre-set threshold value It is used for management objectives data according to chained list.When mapping relations are formed, can be existed according to the data on the data link table and these data Set up mapping relations in the space that distributes on log area.
Step 208:All target data write log area spaces by affairs.
All target data write log area spaces of affairs, multiple target datas are combined as one by magnetic disk control unit After affairs, when the write operation of one of target data of affairs executes failure, what other target datas of affairs were executed writes Operation failure.The write operation of only each target data is carried out successfully, and the write operation of the affairs could success.
After the completion of mapping relations are set up, distribute log area space by log area manager for the mapping relations, belong to heat The data of point data are also assigned with log area space, so that the mapping relations and target data can be all write what both were assigned to Log area space, to preserve to mapping relations and target data on log area.
Mapping relations are stored in behind log area, system can read the mapping relations on internal memory, so as to internal memory can To reacquire the mapping relations, this to internal memory power down after rework and be particularly useful, certainly, in the embodiment having, can The mapping relations are not stored on log area, so as to without being mapping relations in log area allocation space, this also can be real The effect of data field on disk fragmentses is now reduced, and the embodiment of the present invention is not especially limited to this.
In the embodiment of the present invention, the order in the target data write log area space of mapping relations and affairs is not made specifically Limit.
In the embodiment having, it is that data distribute log area space in log area, writes the data into log area space It is that the data distribute log area space in order in log area that concrete mode is, the data order is added and writes the daily record Area space.It is empty according to sequencing distribution i.e. on the memory space of log area that order-assigned space and order add write data Between or write data.
By distributing log area space for the data in order in log area, the data order is added and writes the daily record The mode in area space, can sequentially read and write data when being managed to the data of log area, improve the effect of data management Rate, and the data on log area are determined according to order, and mapping relations record has the data and these numbers for being stored in log area According to log area space corresponding relation, the effect that can replace metadata using mapping relations determined without using metadata Data on log area, from without extra metadata management expense.And when log area adds mode with order and writes data, The information of memory space of the mapping relations record data on log area can be facilitated.
In an embodiment of the present invention, the method for the embodiment of the present invention also includes:If data are hot spot datas, in internal memory Upper caching data, will affairs all target datas write log area spaces, and in the target data of affairs is buffered in Deposit, that is, after judging whether data are hot spot data, if the data are hot spot datas, retain the data on internal memory, this Sample, during subsequent operation, if writing data to internal memory, if the write operation is to the target data that has been buffered on internal memory Modification write, then directly the data can be modified on internal memory, with execute above-mentioned according to data link table to target data The step of being managed.So as to the data are retained on internal memory, so that the data are migrated on internal memory, because of hot spot data It is easily caused disk and produces fragment, these data buffer storages is not stored in data field on internal memory, can be avoided on data field Because the migration of the data produces fragment.
In the embodiment having, it is also possible to if it is hot spot data not execute data, cache the step of the data on internal memory Suddenly, but before step 201, data are read from log area and is cached to internal memory, i.e., to before caching device write data, Data are read to caching device caching from log area.So can also realize directly on internal memory modifying the data, this is complete Into above-mentioned target data is managed according to data link table the step of.So as to the data are retained on internal memory, with The data are made to migrate on internal memory, it is to avoid the migration because of the data on data field produces fragment.
In the embodiment having, magnetic disk control unit also includes superblock, when each log area is assigned identification information, The superblock can be used for the identification information for recording the log area that is changed after log area is changed.So as to, after internal memory power down, The data on corresponding log area can be read according to the identification information of the log area of superblock record, then, delayed on internal memory The data on the log area for reading are deposited, to continue executing with follow-up data operation.
For example, after by all target datas of affairs and mapping relations write log area space, when owning for affairs When write operation is fully completed, by the identification information recording of the log area of modification in the bitmap of superblock.
It is appreciated that in the embodiment having, disk also includes block group, the block group includes the log area sum of predetermined number According to area, the log area and data field of chunk are continuously arranged, now, as described above, match somebody with somebody data field space for data in data separation, Can be specifically:Idle target data area is determined according to the management information of block group;Distribute data for data in target data area Area space.
So as to, after writing data into data field space, target metadata can be generated according to data and data field space, should Target metadata is used for the address for recording the data on the data field, with to being conveniently managed to the data and inquiring about.
After generating metadata, target metadata is write to internal memory;After judging that metadata is hot spot data, number of targets is determined According to the object block group belonging to area;Determine the available log area of object block group, that is, search available log area in the object block group, so Target metadata is write the available log area afterwards.Search if not nearest near target data area or object block group Available log area.
Wherein, when being with affairs as unit to log area write data, it is the multiple target datas distribution log areas of affairs Space can make with the aforedescribed process, the data allocations of target data to be obtained the data that points near the metadata.
So, after the data storage that points to metadata and the metadata according to said method is on the disk, the metadata The storage location of data pointed near the metadata of storage location, so as to reduce the displacement of magnetic head, improve disk Read-write efficiency.
In the embodiment that the present invention has, it is with the side of chained list to the multiple target datas for belonging to same affairs on internal memory Formula is managed.As described above, the method for the embodiment of the present invention is after multiple target datas are determined, can be according to the plurality of target Data set up data link table, and data link table is used for management objectives data.It is that data and metadata of each affairs are submitted to firmly After disk, the data of corresponding log area are got up with chained list management by methods,
Because the write operation of these target datas is combined as affairs, so as to affairs correspond to a Data-Link Table, the target data of data link table management are identical with the target data of affairs.And have a mapping according to these target datas foundation Relation, so as to the corresponding mapping relations of a data link table, the mapping relations have recorded the data of the data link table management in day Storage condition in will area.
Target data can be managed according to data link table, specific management method is as follows:
According to above-mentioned execution step, after determining the multiple first object data for belonging to hot spot data on internal memory, root The first data link table is set up according to these first object data, these first object data belong to the first affairs, i.e. these first mesh Mark data, when log area is write, are according to same write batch write log area, as long as there is first object data to write Enter failure, then other data write failures of the first affairs.These first object data have also set up one first mapping relations.Should First mapping relations are buffered on internal memory.For example, on the first data link table managing internal memory first object data A1, first object Data B1, first object data C1, first object data D1.Corresponding first mapping relations record have first object data A1, The log area that first object data B1, first object data C1, first object data D1 and these data are assigned in log area The relation in space.In subsequent process, magnetic disk control unit sets up the second data link table according to multiple second target datas, the plurality of Second target data belongs to hot spot data, belongs simultaneously to the second affairs, and being set up according to the plurality of second target data has second to reflect Penetrate relation, the data link table can for example manage the second target data A2, the second target data E1, the second target data F1, second Target data D2.
When the second target data of the second data link table management is by the first of the first data link table management for pre-building When target data modification is obtained, the management to first object data is released on the first data link table;With the first data link table The information of first object data is deleted in corresponding first mapping relations.So, it is achieved that target data on data link table With the migration in mapping relations.For example, when the second target data A2 of the second data link table management is by the first data link table When the modification of first object data A1 is obtained, because first object data A1 on internal memory are modified to the second target data A2, the One target data A1 no longer needs, so as to release management of first data link table to first object data A1, accordingly, first Mapping is shut the information with regard to first object data A1 of record and can also be deleted.First object because of the first mapping relations record The information of data A1 is deleted, when log area is reclaimed, according to first mapping relations, you can judge with this first The corresponding log area of target data A1 has fragment to produce, and when migration merges the data on log area, because closing from the first mapping The information read less than first object data A1 is fastened, new so as to not arriving the first object data A1 resettlement on log area First object data A1 on log area, i.e. log area are releasable.
Fig. 3 is the schematic diagram that data are migrated in internal memory, and wherein, each affairs includes multiple target datas, in Fig. 3 is Label mark has been carried out to partial data block therein.As shown in figure 3, because affairs are constantly produced, affairs below are because of io's Locality, have modified the data managed in the first affairs.For example the second affairs have modified first object data A1 and obtain the second mesh Mark data A2, the 5th affairs have modified first object data B1 and obtain the 5th target data B2, and the 4th affairs have modified the first mesh Mark data C1 obtain the 4th target data C2, and the second affairs have modified first object data D1 and obtain the second target data D2, the Three affairs have modified the second target data D3 and obtain the 3rd target data D3.So according to the first affairs are corresponding and the first data Chained list understands that all data of the first affairs all move to affairs below, corresponding, and log area can all discharge first The target data of affairs.As shown in table 7, the target data of first affairs that are stored with log area 1, in all of the first affairs After data all move to affairs below, 1 data above block of log area all moves to affairs below, writes other In log area, i.e., the data of the corresponding redaction of data that log area 1 is preserved in other log areas, this when, in daily record When area reclaims, log area 1 can just discharge, used as empty log area.The migration of other target datas is similar to, and goes to When five affairs, in internal memory, actual caching situation is as shown in Figure 4.
Table 7
In order to be more easily managed to target data according to data link table, in the embodiment having, the present invention is implemented In the method for example, also include according to the write sequence of affairs being that the corresponding data link table of affairs distributes affairs according to incremental rule Number, the write sequence of affairs refers to the sequencing for writing log area between different affairs, the corresponding Data-Link of the affairs for first writing The transaction number that table is assigned to is less, and and then the transaction number of the corresponding data link table of the affairs of write log area increases a unit, So each data link table can have corresponding mark, and these marks also have the rule being incremented by.So as to can be square according to transaction number That just determines the data link table on internal memory sets up sequencing.
For example, the data link table of the first affairs is initially set up, first affairs first write log area, so as to for first thing The data link table distribution transaction number 1 of business, then sets up the data link table of the second affairs according to multiple second target datas, and this second The data of affairs will write log area after the first affairs, so as to distribute thing for corresponding second data link table of second affairs Business number 2, similarly, is the 3rd data link table distribution transaction number 3, and so on.
Above-mentioned is partial content data being managed according to data link table.Belong to the data write day of hot spot data Will area, by caching data that this belongs to hot spot data or reading after data, by the number of the reading from log area on internal memory According to being buffered on internal memory, so as to be managed to data according to data link table on internal memory, hot spot data is allowed to move on internal memory Move, reduce migration of the data on disk, to reduce the fragment that the data produce disk.
By data buffer storage on internal memory, can be with when data be read, directly from memory read data, it is to avoid read daily record Data in area.
And by being managed to data according to data link table on internal memory, to be set up to mapping relations and be changed Become, the data of log area and fragment can be arranged according to mapping relations, with the fragment for avoiding or reducing disk, moreover it is possible to Improve the efficiency that fragment is processed.In order to make full use of the space on internal memory, the hot spot data being buffered on internal memory can be carried out Release, reclaims the space of internal memory, so that memory cache other more data.So, the method for the embodiment of the present invention, pre- If under release conditions, can reclaim to memory headroom.For example, reach Installed System Memory recovery water level when, triggering caching eliminate. An exemplary recovery method is illustrated below, the recovery method is divided into two benches.
First stage
When internal memory reaches the first preset water level, from the beginning of the minimum data link table of Current transaction number, according to transaction number by The little data not decontroled to big sequential search data link table.Then, the target data chained list to finding, on internal memory The data that release target data chained list does not decontrol, and retain the corresponding target mapping pass of target data chained list on internal memory System.
Because being managed to data by way of data link table, the data of the data link table management that first sets up may be because Eliminated on internal memory by the modification of the data of rear write, the data that these eliminate have been completed solution from data link table Remove.In this regard, referring to the description of the above-mentioned management method to data link table.Capable recovery is internally deposited into, i.e. searching data chained list does not have Superseded data, discharge these data that does not also eliminate on internal memory.Belonging to these data being released in Memory recycle Data link table can be described as target data chained list.And the corresponding mapping relations of target data chained list are remained on internal memory.First The Memory recycle in stage just stops when memory headroom reaches default stopping water level.
Through above-mentioned step, daily record is write less than or equal to data and the metadata for writing data generation of preset data threshold values Area, while cache in internal memory.To these log areas and the hot spot data on internal memory, as above, using the order pipe of affairs priority Reason is got up, so when system operation for a period of time, caching triggers backstage cache garbage collection thread when reach the first preset water level Order according to transaction number from small to large is reclaimed memory headroom.For example, from the beginning of the minimum data link table of Current transaction number, root According to the data that the ascending sequential search data link table of transaction number does not decontrol, it is achieved that from the data link table that sets up at first Start the data in releasing memory.
The data that the data link table of more early foundation is remaining not to be eliminated in internal memory are more sluggish data, and equipment is read to which The probability for taking modification is less, so as to these data can be discharged from internal memory, so the data reading performance using redundancy of equipment is affected compared with Little.And be stored on internal memory because of target mapping relations, when equipment will read data, if not reading from internal memory, according to interior The mapping relations for depositing reservation are inquired about, if determining data to be inquired about according to target mapping relations, can be according to target Mapping relations read corresponding data from log area.So, internal memory can the more hot spot datas of management.
It is appreciated that internal memory reaches the first preset water level, one kind of release conditions is simply preset, searching data chained list is not solved Except the data of management can also trigger under other default release conditions, the timer for for example setting then etc., present invention reality Apply example to be not especially limited this.
Second stage
After internal memory carries out the recovery of first stage, when internal memory reaches the second preset water level, target is read from log area and reflected Penetrate the data of relation sensing;The data write data field that target mapping relations are pointed to;Delete target mapping relations on internal memory.
In order to further make full use of the space of internal memory, second recovery can be carried out to memory headroom in second stage.Its In, during the second preset water level, triggering internal memory executes the water level that second stage is reclaimed.Second preset water level can be with the first default water Position is identical, it is also possible to differ with the first preset water level, the embodiment of the present invention is not specifically limited to this, to the first preset water level Also be not specifically limited with the concrete numerical value embodiment of the present invention of the second preset water level, for example, can according to actual amount of memory and Type of service flexibly sets.
After the data for reading that target mapping relations are pointed to from log area, the data that can be pointed to target mapping relations write number According to area.When internal memory reaches the second preset water level, now internal memory has run the regular hour, the mapping relations being buffered in internal memory More and more, when finally also reaching caching water level, need to read the data that these mapping relations are pointed to, be written to data field In.
When internal memory reaches the second preset water level, because performing the management method of above-mentioned data link table, currently more early build The probability changed by the data not being released from of vertical data link table is less, because, if the data of the management on data link table The data modification for being write below, then the data move to the corresponding data link table of affairs below from the data link table.So as to, The remaining data of the data link table of more early foundation can determine that for sluggish data, these sluggish data can because changed Energy property is less, and so as to them because the disk fragmentses that modification is produced are also less, the data that can be pointed to target mapping relations write number According to area.For example, these data are read according to target mapping relations from log area, then divided on data field by dina base administration device Prepare on data field space, then the data field that these data writes are assigned to.
After the execution of above-mentioned steps, when equipment wants the data in reading disk, for example, have to having been written into daily record The data in area conduct interviews, and magnetic disk control unit first can be searched on internal memory, if hit in internal memory, directly can be returned Return the data.After because of the first stage of Memory recycle, part hot spot data is deleted from internal memory, and remains corresponding mapping Relation, if so as to not find data to be accessed in internal memory, but can find in the mapping relations of memory cache, These to be accessed data then can be directly read in the corresponding log area of the mapping relations.If in mapping relations, Search less than data to be searched, then search in data field and read data.
It is appreciated that log area is entered in the embodiment of row write data in the additional mode that writes in order, when continuous many The data link table of individual affairs is eliminated after finishing, such as, after executing the recovery of above-mentioned internal memory second stage, reflect with deleted Penetrate the corresponding log area of relation also to release completely, can use as an empty log area again.Specific release day The method of will area and recovery log area will be described below.
In the embodiment having, after executing said method, the embodiment of the present invention also includes the operation reclaimed by log area.From And the fragment on log area is reduced, make full use of the space of log area.
The recovery of log area, can be carried out to log area in the way of adding in order and writing below based on above-mentioned method The embodiment for writing data is illustrated to the recovery of log area.I.e. step 208 is, the target data order of affairs is added write Data on log area space, i.e. log area are stored according to the sequencing of affairs,
The concrete recovery method of log area, for example, may include following step:
A1:Under default recovering condition, the step of execution journal area data are moved;
Wherein, default recovering condition include timer expiry, the reclaimer operation of internal storage data completed, the total water level in log area Reach at least one of preset water level threshold values.When completing to refer to above-mentioned Memory recycle to the reclaimer operation of internal storage data, Each stage executes and completes, and all triggers log area data resettlement step, i.e. triggering daily record is reclaimed thread execution journal area and reclaims stream Journey.
A2:When current log area total space water level reaches pre-set space threshold values, then stop execution journal area data and remove The step of moving, the step of otherwise continuing executing with log area data and move.
Wherein, the step of execution journal area data are moved, including:
B1:From the beginning of the minimum data link table of Current transaction number, according to the ascending sequential search of transaction number and data The corresponding mapping relations of chained list.
Above-mentioned method perform according to the write sequence of affairs be the corresponding data link table of affairs according to incremental rule After the step of distribution transaction number, sequential search of the magnetic disk control unit according to transaction number from small to large is corresponding with data link table Mapping relations, because mapping relations have recorded the relation in the space that data and the data are assigned on log area, so as to analyze Distribution situation of the data block in mapping relations on log area, you can know also how many data are not moved on corresponding log area Move, the data not migrated are located on corresponding log area.
And because affairs are when propulsion, using being just switched to next log area after finishing a log area, because The data of this continuous affairs can be write in continuous log area.According to transaction number sequence analysis mapping relations from small to large, i.e., The data storage situation on continuous log area can be got.
B2:Information according to mapping relations record judges data on corresponding with the mapping relations the first log area whether Migration is finished;
When being managed to the data on internal memory according to data link table, to the data migrated on internal memory, to also change Corresponding mapping relations, if the data on the message reflection log area of data link table record are finished with migrating on internal memory, example The such as corresponding data in the log area all have new version in other log areas, or after the second stage of Memory recycle, By the data resettlement on corresponding log area to data field, now, the data of the corresponding log area of the mapping relations have been judged Through having migrated.
B3:If the Data Migration of the first log area is finished, first log area is reclaimed;
If the data of the first log area have been moved finishing, first log area is reclaimed.Day is being recorded by superblock In the embodiment of the service condition in will area, now information corresponding with the first log area in superblock can be understood.
B4:If the data on the first log area have not been migrated, according to the information of mapping relations record, the first daily record is determined Space availability ratio in area;
Because of the relation in mapping relations have recorded data and the data are assigned on log area space, so as to can be according to reflecting Penetrate the space availability ratio that the information analysiss of relation record go out on the first log area.
B5:When the space availability ratio of the first log area is less than default utilization rate threshold values, the data of the first log area are moved The second log area is moved to, and updates mapping relations corresponding with the data that is moved.
Wherein the second log area be idle log area or when log area is reclaimed used log area, for example front next day Used log area when will area reclaims.The default utilization threshold values can be set according to specifically used situation, for example, in log area Using more when, but the utilization rate of each log area can reduce the default utilization threshold value when relatively low.For example this is preset 50% etc. can be set to using threshold values, the embodiment of the present invention is not especially limited to this.Update reflect corresponding with the data that is moved Penetrate relation, after can be data move on log area, the data that upgrade in time in the mapping relations related to the data and The corresponding relation in new log area space.
By above-mentioned log area recovery method, you can achieve the recovery of log area, the fragment on log area is reduced, is filled Divide the space that make use of log area.And because log area be order read-write, with the transaction number of data link table order from small to large Corresponding, so as to according to the corresponding mapping relations of the transaction number size of data link table inquiry, and data can be being moved, now without the need for unit Data come the position of the data in log area, so as to reduce the expense of metadata.
The method of the embodiment of the present invention, on the magnetic disk control unit for including disk, the disk includes data field and daily record Area, to after caching device write data, magnetic disk control unit judges whether the data are hot spot datas, if the data are not focuses Data, then match somebody with somebody data field space for the data in data separation, write the data into data field space;If the data are focus numbers According to, then be the data log area distribute log area space, write the data into log area space.So, disk is written into Data be divided into hot spot data and non-thermal point data, hot spot data be stored on disk after preset times modification and release Disk can be made afterwards to produce the data of predetermined number fragment, hot spot data is easy to cause disk to produce fragment, focus number is stored in On log area, it is managed with log mode, even if the data on log area frequently change generation disk fragmentses, is also convenient for this A little fragments carry out the management such as reclaiming, and non-thermal point data is stored in data field, and the release of non-thermal point data is not easily caused disk Produce fragment, data field can be without the need for for disk fragmentses management distribution excess resource, so as to by will be dissimilar on disk Data be stored in different regions and be managed in a different manner, the debris management efficiency on disk, log area can be improved High-efficiency management to disk fragmentses, can reduce the generation of disk fragmentses.
Data in log area because the locality of hot spot data, is migrated away, actual arrange log area when Wait, the data of reading are less, so as to the data management efficiency of log area is higher.And hot spot data is stored in log area, because of heat Point data easily produces fragment, so as to fragment concentrates on log area, further increases the efficiency to defragmentation.
When data are write to log area in the way of adding and writing by order, only need to order in log area and read data and suitable Sequence writes data, moves the expense that data do not produce metadata, and log area carries out defragmentation efficiency high.By arranging daily record The data in area, can be prevented effectively from or reduce disk fragmentses.
In the embodiment having, it is also possible to do not add mode with order and write data to log area, knowing log area During the distribution condition of space, it is possible to use bitmap file bitmap corresponds to journal zone to manage.
For example, the corresponding fixed block size of each bit, e.g. 4K, then the journal zone of 256M need 8K writes journal zone every time and is required for changing this bitmap managing.
It is appreciated that in an embodiment of the present invention, data field and log area can be classification storage, i.e. data field and day Will area is in different levels, when log area is reclaimed, the accumulation layer that hot spot data is moved to lower-level.
It is appreciated that in the embodiment having, can otherwise search mapping relations, such as random challenge mapping is closed System, then analyzes the space storage condition of corresponding log area, then carries out log area data according to the mapping relations that finds Resettlement, now can be without the target data of affairs be write log area space in the way of order is added, to specific write Mode is not limited.But, such mode can may not react whole space storage conditions of log area because of mapping relations, and Cause the recovering effect of log area not ideal enough.
It is appreciated that in the embodiment including multiple log areas and multiple data fields of the present invention, in order to more fully Using data field and log area, so as to make full use of the method for disk space, the embodiment of the present invention also to include data field and daily record The step of converting in area, for example, when the space availability ratio of data field utilizes threshold values more than preset data area, by the day of current idle Will area is converted into data field;When the space availability ratio of log area utilizes threshold values more than default log area, by by idle daily record The data field that area changes into is converted into log area.
For example, when initialized on disk, preset, the disk space for having half is log area, and others are several According to area.When system operation for a period of time after, the utilization rate of data field is higher, looks into according to the identification information incremental order of log area The log area of free time is looked for, data field is translated into.After being converted into data field, in the embodiment for including block group, using block The space management object of group is managed.The state of log area is set to data field, and recorded the management knot of block group In structure, disk preservation is write to this.When the data on data field are deleted, disk space is discharged, and one is changed into by log area The space of data field all discharge, the state of the data field is switched to log area by this when, and is recorded in block group Management structure in, write disk preservation.
Fig. 5 is a kind of structural representation of the magnetic disk control unit according to an exemplary embodiment, the disk control Device includes that disk, disk include data field and log area, and the magnetic disk control unit is used for executing the corresponding embodiments of above-mentioned Fig. 2 The function that middle magnetic disk control unit is executed.Referring to Fig. 5, the magnetic disk control unit includes:
Writing unit 501, for caching device write data;
Cache manager 502, for judging whether data are hot spot datas, wherein hot spot data is for after being stored on disk After the modification and release of preset times disk can be made to produce the data of predetermined number fragment;
Data management system 503, if not being hot spot data for data, matches somebody with somebody data field space for data in data separation, Write data into data field space;
Log manager 504, if being hot spot data for data, distributes log area space for data in log area, will Data write log area space.
Alternatively, device is cached for internal memory, and magnetic disk control unit also includes:
Mapping relations set up unit 505, for setting up the mapping relations in data and log area space in internal memory;
Alternatively, magnetic disk control unit also includes:
Buffer unit 506, for the data that caching on internal memory belongs to hot spot data.
Alternatively,
Mapping relations set up unit 505, are additionally operable to set up the daily record that multiple target datas and multiple target datas are assigned to The mapping relations in area space, wherein target data belong to hot spot data;
Log manager 504, is additionally operable to for multiple write operations of multiple target datas to be combined as affairs by affairs All target datas write log area space, when the write operation of one of target data of affairs executes failure, affairs The write operation failure that other target datas are executed.
Alternatively,
Magnetic disk control unit also includes:
Chained list sets up unit 509, and for setting up data link table according to multiple target datas, wherein, data link table is used for managing Reason target data, the target data of data link table management are identical with the target data of affairs;
Chained list administrative unit 510, for being managed to target data according to data link table;
Searching unit 511, for, under default release conditions, the foundation according to data link table from after arriving first sequentially, is searched The data that data link table does not decontrol;
Memory management unit 512, for the data that release target data chained list on internal memory does not decontrol, and in internal memory The upper reservation corresponding target mapping relations of target data chained list;
Wherein, chained list administrative unit 510, is additionally operable to:
After setting up the second data link table, when the second target data of the second data link table management is by first for pre-building When the first object data modification of data link table management is obtained, the pipe to first object data is released on the first data link table Reason;The information of first object data is deleted in the first mapping relations corresponding with the first data link table
Alternatively,
Searching unit 511, the foundation being additionally operable to when internal memory reaches the first preset water level, according to data link table from after arriving first Sequentially, the data that searching data chained list does not decontrol;
Magnetic disk control unit also includes:
Reading unit 523, for when internal memory reaches the second preset water level, reading target mapping relations from log area and pointing to Data;
Mapping data write unit 513, for the data write data field for pointing to target mapping relations;
Unit 514 is deleted, for delete target mapping relations on internal memory.
Alternatively,
Magnetic disk control unit also includes:
Transaction number allocation unit 515, for according to the write sequence of affairs be the corresponding data link table of affairs according to be incremented by Rule distribution transaction number;
Searching unit 511, from the beginning of being additionally operable to the data link table minimum from Current transaction number, ascending according to transaction number The data that sequential search data link table does not decontrol.
Alternatively,
Magnetic disk control unit also includes:
Recovery unit 516, for the step of under default recovering condition, execution journal area data are moved;
As shown in fig. 6, in the step of execution journal area data are moved, recovery unit 516, including:
Searching modul 517 is reclaimed, for searching mapping relations;
Judge module 518 is reclaimed, the information for recording according to mapping relations judges corresponding with mapping relations first day Whether the data in will area have migrated;
Determining module 519 is reclaimed, if not migrated for the data on the first log area, according to mapping relations record Information, determines the space availability ratio on the first log area;
Performing module 520 is reclaimed, for when the space availability ratio of the first log area is less than default utilization rate threshold values, by the The Data Migration of one log area is to the second log area, and updates mapping relations corresponding with the data that is moved, wherein second day Will area be idle log area or when log area is reclaimed used log area;
Recycling module 521, for when current log area total space water level reaches pre-set space threshold values, then stopping executing The step of log area data are moved, the step of otherwise continuing executing with log area data and move.
Alternatively,
Magnetic disk control unit also includes:
Transaction number allocation unit 515, for according to the write sequence of affairs be the corresponding data link table of affairs according to be incremented by Rule distribution transaction number;
Reclaim searching modul 517, from the beginning of being additionally operable to the data link table minimum from Current transaction number, according to transaction number by little to Big sequential search mapping relations corresponding with data link table;
Alternatively, default recovering condition include timer expiry, the reclaimer operation of internal storage data completed, log area Zong Shui Position reaches at least one of preset water level threshold values.
Alternatively,
Buffer unit 506, if it is hot spot data to be additionally operable to data, data cached on internal memory;Or, read from log area Fetch data caching device caching.
Alternatively, hot spot data includes that size of data is less than the data of preset data threshold values and/or hot spot data and includes unit Data.
Alternatively,
Log manager 504, is additionally operable to distribute log area space for data in order in log area, data order is chased after Plus write log area space.
Alternatively,
Magnetic disk control unit also includes:
Data field conversion unit 522, for when the space availability ratio of data field utilizes threshold values more than preset data area, inciting somebody to action The log area of current idle is converted into data field;
Log area conversion unit 524, for when the space availability ratio of log area utilizes threshold values more than default log area, inciting somebody to action The data field changed into by idle log area is converted into log area.
Alternatively,
Disk also includes superblock, and each log area is assigned identification information, and superblock is used for after log area is changed The identification information of the log area changed by record.
Alternatively, log area and data field are arranged alternately on disk.
Alternatively,
Disk also includes that block group, block group include the log area and data field of predetermined number, the log area and data field of chunk Continuous setting,
Data management system 503, including:
Free area determining module 525, for determining idle target data area according to the management information of block group;
Distribute module 508, for distributing data field space for data in target data area;
Magnetic disk control unit also includes:
Metadata generation module 507, for generating target metadata according to data and data field space;
Writing unit 501, is additionally operable to caching device write target metadata;
Cache manager judges metadata for, after hot spot data, log manager 504 is additionally operable to determine target data area Affiliated object block group;Determine the available log area of object block group;Target metadata is write available log area.
Alternatively,
Log manager 504, is additionally operable to distribute log area space on log area for mapping relations;Mapping relations are write The log area space that mapping relations are assigned to.
In sum, on the magnetic disk control unit for including disk, the disk includes data field and log area, writing unit 501 to after caching device write data, and cache manager 502 judges whether the data are hot spot datas, if the data are not heat Point data, then data management system 503 is that the data match somebody with somebody data field space in data separation, writes the data into data field space; If the data are hot spot datas, log manager 504 is that the data distribute log area space in log area, writes the data into Log area space.So, the data for being written into disk are divided into hot spot data and non-thermal point data, and hot spot data is to be stored in magnetic After the modification and release of preset times disk can be made to produce the data of predetermined number fragment after on disk, hot spot data is easy to cause Disk produces fragment, focus number is stored on log area, is managed with log mode, even if the data on log area are frequent Modification produces disk fragmentses, is also convenient for these fragments are carried out the management such as reclaiming, and non-thermal point data is stored in data field, non- The release of hot spot data is not easily caused disk and produces fragment, and excess resource can be distributed without the need for managing for disk fragmentses in data field, So as to being managed by different types of data are stored in different regions on disk in a different manner, being improved Debris management efficiency on disk, high-efficiency management of the log area to disk fragmentses, can reduce the generation of disk fragmentses.
A kind of hardware architecture diagram of magnetic disk control unit that Fig. 7 is provided for another embodiment of the present invention, the disk control Device processed includes processor CPU701, caching device 703 and disk 702, and Magnetic Disk Controler 705 and bus 704.Disk 702 include data field and log area, and in the embodiment having, caching device can for example be internal memory.
Step in above-described embodiment performed by magnetic disk control unit can be based on the magnetic disk control unit shown in the Fig. 7 Structure.
701 configuration processor of processor so that the method that magnetic disk control unit executes above-mentioned data in magnetic disk management method, lifts The various optional designs of example are specific as follows.
701 configuration processor of processor so that magnetic disk control unit has following function:To caching device write data; Judge whether data are hot spot datas, wherein hot spot data be stored on disk after preset times modification and release after energy Disk is made to produce the data of predetermined number fragment;If data are not hot spot datas, empty with data field in data separation for data Between, write data into data field space;If data are hot spot datas, distribute log area space for data in log area, by number According to write log area space.
A kind of optional design, caching device be internal memory, 701 configuration processor of processor so that magnetic disk control unit has Following function:Be data log area distribution log area space after, set up the mapping relations in data and log area space.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:Set up many The mapping relations in the log area space that individual target data and multiple target datas are assigned to, wherein target data belong to focus number According to;Multiple write operations of multiple target datas are combined as affairs;Will be empty for all target data write log areas of affairs Between, when the write operation of one of target data of affairs executes failure, the write operation of other target datas execution of affairs Failure.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:In internal memory Upper caching belongs to the data of hot spot data.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:By affairs All target datas write log area spaces before, set up data link table according to multiple target datas, wherein, data link table is used In management objectives data, the target data of data link table management is identical with the target data of affairs;According to data link table to target Data are managed;Under default release conditions, sequentially, searching data chained list is not solved the foundation according to data link table from after arriving first Data except management;The data that release target data chained list does not decontrol on internal memory, and retain target data on internal memory The corresponding target mapping relations of chained list;Wherein, target data is managed according to data link table, including:Set up the second data After chained list, when the second target data of the second data link table management is by the first mesh of the first data link table management for pre-building When mark data modification is obtained, the management to first object data is released on the first data link table;With the first data link table pair The information of first object data is deleted in the first mapping relations that answers
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:Work as internal memory When reaching the first preset water level, according to data link table from after arriving first foundation order, the number that searching data chained list does not decontrol According to;
After discharging, on internal memory, the data that target data chained list does not decontrol, the second preset water level is reached in internal memory When, the data that target mapping relations are pointed to are read from log area;
The data write data field that target mapping relations are pointed to;
Delete target mapping relations on internal memory.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
It is that the corresponding data link table of affairs distributes transaction number according to incremental rule according to the write sequence of affairs;
From the beginning of the minimum data link table of Current transaction number, according to the ascending sequential search data link table of transaction number not The data for decontroling.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:Default Under recovering condition, the step of execution journal area data are moved;
The step of execution journal area data are moved, including:
Search mapping relations;
Information according to mapping relations record judges whether the data on the first log area corresponding with mapping relations migrate Complete;
If the data on the first log area have not been migrated, according to the information of mapping relations record, the first log area is determined On space availability ratio;
When the space availability ratio of the first log area is less than default utilization rate threshold values, by the Data Migration of the first log area extremely Second log area, and update mapping relations corresponding with the data that is moved, wherein the second log area be idle log area or The used log area when log area is reclaimed;
When current log area total space water level reaches pre-set space threshold values, then stop the data resettlement of execution journal area Step, the step of otherwise continuing executing with log area data and move.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
It is that the corresponding data link table of affairs distributes transaction number according to incremental rule according to the write sequence of affairs;From current thing A business number minimum data link table starts, according to the ascending sequential search of transaction number mapping relations corresponding with data link table;
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
Default recovering condition includes timer expiry, the reclaimer operation of internal storage data is completed, the total water level in log area reaches At least one of preset water level threshold values.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
After judging whether data are hot spot data, if data are hot spot datas, data cached on internal memory;Or,
To before caching device write data, data are read to caching device caching from log area.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
Hot spot data includes that size of data is less than the data of preset data threshold values and/or hot spot data and includes metadata.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
Distribute log area space for data in order in log area, data order is added write log area space.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
When the space availability ratio of data field utilizes threshold values more than preset data area, the log area of current idle is converted into Data field;
When the space availability ratio of log area utilizes threshold values more than default log area, by changed into by idle log area Data field is converted into log area.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
Disk also includes superblock, and each log area is assigned identification information, and superblock is used for after log area is changed The identification information of the log area changed by record.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:
Log area and data field are arranged alternately on disk.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:Disk is also Including block group, block group includes the log area and data field of predetermined number, and the log area and data field of chunk are continuously arranged, according to block The management information of group determines idle target data area;Distribute data field space for data in target data area;
After writing data into data field space, target metadata is generated according to data and data field space;To buffer Part writes target metadata;After judging that metadata is hot spot data, the object block group belonging to target data area is determined;Determine mesh The available log area of mark block group;Target metadata is write available log area.
A kind of optional design, 701 configuration processor of processor so that magnetic disk control unit has following function:For mapping Relation distributes log area space on log area;Mapping relations are write the log area space that mapping relations are assigned to.
In sum, on the magnetic disk control unit for including disk, the disk includes data field and log area, the processor 701 to after caching device write data, and the processor 701 judges whether the data are hot spot datas, if the data are not focuses Data, then the processor 701 is that the data match somebody with somebody data field space in data separation, writes the data into data field space;If should Data are hot spot datas, then the processor 701 is that the data distribute log area space in log area, writes the data into log area Space.So, the data for being written into disk are divided into hot spot data and non-thermal point data, and hot spot data is for after being stored on disk After the modification and release of preset times, disk can be made to produce the data of predetermined number fragment, hot spot data is easy to cause disk to produce Raw fragment, focus number is stored on log area, is managed with log mode, even if the data on log area frequently change product Raw disk fragmentses, are also convenient for these fragments are carried out the management such as reclaiming, and non-thermal point data are stored in data field, non-thermal points According to release be not easily caused disk produce fragment, data field can without the need for for disk fragmentses management distribution excess resource, so as to, lead to Cross and different types of data are stored in different regions on disk are managed in a different manner, can improve on disk Debris management efficiency, high-efficiency management of the log area to disk fragmentses, can reduce the generation of disk fragmentses.
Those skilled in the art can be understood that, for convenience and simplicity of description, the system of foregoing description, Device and the specific work process of unit, may be referred to the corresponding process in preceding method embodiment, will not be described here.
In several embodiments provided herein, it should be understood that disclosed system, apparatus and method can be with Realize by another way.For example, device embodiment described above is only schematic, for example, the unit Divide, only a kind of division of logic function can have other dividing mode, for example multiple units or component when actually realizing Can in conjunction with or be desirably integrated into another system, or some features can be ignored, or not execute.Another, shown or The coupling each other for discussing or direct-coupling or communication connection can be the indirect couplings by some interfaces, device or unit Close or communicate to connect, can be electrical, mechanical or other forms.
The unit that illustrates as separating component can be or may not be physically separate, aobvious as unit The part for showing can be or may not be physical location, you can be located at a place, or can also be distributed to multiple On NE.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme 's.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated list Unit both can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is realized and as independent production marketing or use using in the form of SFU software functional unit When, can be stored in a computer read/write memory medium.Such understanding is based on, technical scheme is substantially The part that in other words prior art is contributed or all or part of the technical scheme can be in the form of software products Embody, the computer software product is stored in a storage medium, use so that a computer including some instructions Equipment (can be personal computer, server, or network equipment etc.) executes the complete of each embodiment methods described of the invention Portion or part steps.And aforesaid storage medium includes:USB flash disk, portable hard drive, read only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can store journey The medium of sequence code.
The above, above example only in order to technical scheme to be described, rather than a limitation;Although with reference to front State embodiment to be described in detail the present invention, it will be understood by those within the art that:Which still can be to front State the technical scheme described in each embodiment to modify, or equivalent is carried out to which part technical characteristic;And these Modification is replaced, and does not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.

Claims (26)

1. a kind of data in magnetic disk management method, it is characterised in that methods described is applied to the magnetic disk control unit for including disk, institute Stating disk includes that data field and log area, methods described include:
To caching device write data;
Judge whether the data are hot spot datas, wherein described hot spot data for after being stored on the disk in preset times Modification and release after the disk can be made to produce the data of predetermined number fragment;
If the data are not hot spot datas, match somebody with somebody data field space for the data in the data separation, by the data Write the data field space;
If the data are hot spot datas, distribute log area space for the data in the log area, the data are write Enter the log area space.
2. method according to claim 1, it is characterised in that the caching device is internal memory,
Described be the data the log area distribution log area space after, methods described also includes:
Set up the mapping relations in the data and the log area space.
3. method according to claim 2, it is characterised in that
The mapping relations for setting up the data and the log area space, including:
Set up the mapping relations in the log area space that multiple target datas and the plurality of target data are assigned to, wherein described mesh Mark data belong to hot spot data;
Described the data are write the log area space, including:
Multiple write operations of the plurality of target data are combined as affairs;
By all target datas write log area spaces of the affairs, when one of target data of the affairs writes behaviour When making to execute failure, the write operation that other target datas of the affairs are executed fails.
4. method according to claim 3, it is characterised in that methods described also includes:
On the internal memory, caching belongs to the data of the hot spot data.
5. method according to claim 4, it is characterised in that
Before all target data write log area spaces by the affairs, methods described also includes:
Data link table is set up according to the plurality of target data, wherein, the data link table is used for managing the target data, institute The target data for stating data link table management is identical with the target data of the affairs;
The target data is managed according to the data link table;
Under default release conditions, the foundation according to the data link table from after arriving first sequentially, is searched the data link table and is not solved Data except management;
The data that release target data chained list does not decontrol on the internal memory, and retain the number of targets on the internal memory According to the corresponding target mapping relations of chained list;
Wherein, described the target data is managed according to the data link table, including:
After setting up the second data link table, when the second target data of second data link table management is by first for pre-building When the first object data modification of data link table management is obtained, release on first data link table to the first object number According to management;The information of the first object data is deleted in the first mapping relations corresponding with first data link table.
6. method according to claim 5, it is characterised in that
Described under default release conditions, foundation order according to the data link table from after arriving first searches the data link table The data not decontroled, including:
When the internal memory reaches the first preset water level, the foundation according to the data link table from after arriving first sequentially, is searched described The data that data link table does not decontrol;
After the data that release target data chained list does not decontrol on the internal memory, methods described also includes:
When the internal memory reaches the second preset water level, the data that the target mapping relations are pointed to are read from the log area;
The data that the target mapping relations are pointed to write the data field;
The target mapping relations are deleted on the internal memory.
7. method according to claim 5, it is characterised in that
Methods described also includes:
Under default recovering condition, the step of execution journal area data are moved;
The step of execution journal area data are moved, including:
Search the mapping relations;
Information according to mapping relations record judges whether the data on the first log area corresponding with the mapping relations migrate Complete;
If the data on first log area have not been migrated, according to the information of mapping relations record, first is determined Space availability ratio in will area;
When the space availability ratio of first log area is less than default utilization rate threshold values, the data of first log area are moved The second log area is moved to, and updates mapping relations corresponding with the data that is moved, wherein described second day will area is sky Not busy log area or when log area is reclaimed used log area;
When current log area total space water level reaches pre-set space threshold values, then stop the step of execution journal area data resettlement Suddenly, the step of otherwise continuing executing with log area data and move.
8. method according to claim 7, it is characterised in that
Methods described also includes:
It is that the corresponding data link table of the affairs distributes transaction number according to incremental rule according to the write sequence of the affairs;
In the step of execution journal area data are moved, described search the mapping relations, including:
From the beginning of the minimum data link table of Current transaction number, according to the ascending sequential search of the transaction number and the data The corresponding mapping relations of chained list.
9. method according to claim 4, it is characterised in that
The caching on the internal memory belongs to the data of the hot spot data, including:
Described judge whether the data are hot spot data after, if the data are hot spot datas, on the internal memory protect Stay the data;Or,
Before the device write data to caching, data are read to the caching device caching from the log area.
10. the method according to any one of claim 1 to 9, it is characterised in that the hot spot data includes that size of data is little In preset data threshold values data and/or the hot spot data include metadata.
11. methods according to any one of claim 1 to 9, it is characterised in that
Described is that the data distribute log area space in the log area, and the data are write the log area space, bag Include:
Distribute log area space for the data in order in the log area, the data order is added the write day Will area space.
12. methods according to any one of claim 1 to 9, it is characterised in that
Methods described also includes:
When the space availability ratio of the data field utilizes threshold values more than preset data area, the log area of current idle is converted into Data field;
When the space availability ratio of the log area utilizes threshold values more than default log area, by changed into by idle log area Data field is converted into log area.
13. methods according to any one of claim 2 to 9, it is characterised in that
Methods described also includes:
Distribute log area space on log area for the mapping relations;
The mapping relations are write the log area space that the mapping relations are assigned to.
14. a kind of magnetic disk control units, it is characterised in that the magnetic disk control unit includes:
Writing unit, for writing data to buffer;
Cache manager, for judging whether the data are hot spot datas, wherein described hot spot data is to be stored in the magnetic After on disk, after the modification and release of preset times the disk can be made to produce the data of predetermined number fragment;
Data management system, if not being hot spot data for the data, matches somebody with somebody data for data separation of the data in disk The data are write the data field space by area space;
Log manager, if being hot spot data for the data, distributes day for the data in the log area of the disk The data are write the log area space by will area space.
15. magnetic disk control units according to claim 14, it is characterised in that the caching device be internal memory, the magnetic Disk control unit also includes:
Mapping relations set up unit, for setting up the mapping relations of the data and the log area space.
16. magnetic disk control units according to claim 15, it is characterised in that
The mapping relations set up unit, are additionally operable to set up the daily record that multiple target datas and the plurality of target data are assigned to The mapping relations in area space, wherein described target data belong to hot spot data;
The log manager, is additionally operable to for multiple write operations of the plurality of target data to be combined as affairs;Will be described All target data write log area spaces of affairs, when the write operation of one of target data of the affairs executes failure When, the write operation that other target datas of the affairs are executed fails.
17. methods according to claim 16, it is characterised in that the magnetic disk control unit also includes:
Buffer unit, for the data that caching on the internal memory belongs to the hot spot data.
18. magnetic disk control units according to claim 17, it is characterised in that
The magnetic disk control unit also includes:
Chained list sets up unit, and for setting up data link table according to the plurality of target data, wherein, the data link table is used for managing The target data is managed, the target data of the data link table management is identical with the target data of the affairs;
Chained list administrative unit, for being managed to the target data according to the data link table;
Searching unit, for, under default release conditions, the foundation according to the data link table from after arriving first sequentially, is searched described The data that data link table does not decontrol;
Memory management unit, for the data that release target data chained list on the internal memory does not decontrol, and described interior Deposit the corresponding target mapping relations of the reservation target data chained list;
Wherein, the chained list administrative unit, is additionally operable to:
After setting up the second data link table, when the second target data of second data link table management is by first for pre-building When the first object data modification of data link table management is obtained, release on first data link table to the first object number According to management;The information of the first object data is deleted in the first mapping relations corresponding with first data link table.
19. magnetic disk control units according to claim 18, it is characterised in that
The searching unit, is additionally operable to when the internal memory reaches the first preset water level, according to the data link table from after arriving first Foundation order, search the data that the data link table does not decontrol;
The magnetic disk control unit also includes:
Reading unit, for when the internal memory reaches the second preset water level, reading the target mapping from the log area and closing Mean to data;
Mapping data write unit, the data for pointing to the target mapping relations write the data field;
Unit is deleted, for the target mapping relations are deleted on the internal memory.
20. magnetic disk control units according to claim 18, it is characterised in that
The magnetic disk control unit also includes:
Recovery unit, for the step of under default recovering condition, execution journal area data are moved;
In the step of execution journal area data are moved, the recovery unit, including:
Searching modul is reclaimed, for searching the mapping relations;
Judge module is reclaimed, the information for recording according to mapping relations judges the first log area corresponding with the mapping relations On data whether migrated;
Determining module is reclaimed, if not migrated for the data on first log area, is recorded according to the mapping relations Information, determine the space availability ratio on the first log area;
Performing module is reclaimed, for when the space availability ratio of first log area is less than default utilization rate threshold values, will be described The Data Migration of the first log area is to the second log area, and updates mapping relations corresponding with the data that is moved, wherein Second log area be idle log area or when log area is reclaimed used log area;
Recycling module, for when current log area total space water level reaches pre-set space threshold values, then stopping execution journal area The step of data are moved, the step of otherwise continuing executing with log area data and move.
21. magnetic disk control units according to claim 20, it is characterised in that
The magnetic disk control unit also includes:
Transaction number allocation unit, for according to the write sequence of the affairs be the corresponding data link table of the affairs according to be incremented by Rule distribution transaction number;
In the step of execution journal area data are moved, described search the mapping relations, including:
From the beginning of the minimum data link table of Current transaction number, according to the ascending sequential search of the transaction number and the data The corresponding mapping relations of chained list.
22. magnetic disk control units according to claim 17, it is characterised in that
The buffer unit, if it is hot spot data to be additionally operable to the data, retains the data on the internal memory;Or, Data are read to the caching device caching from the log area.
23. magnetic disk control units according to any one of claim 14 to 22, it is characterised in that the hot spot data includes Size of data is less than the data of preset data threshold values and/or the hot spot data includes metadata.
24. magnetic disk control units according to any one of claim 14 to 22, it is characterised in that
The log manager, is additionally operable to distribute log area space for the data in order in the log area, will be described Data order adds the write log area space.
25. magnetic disk control units according to any one of claim 14 to 22, it is characterised in that
The magnetic disk control unit also includes:
Data field conversion unit, for when the data field space availability ratio more than preset data area utilize threshold values when, ought Front idle log area is converted into data field;
Log area conversion unit, for when the space availability ratio of the log area utilizes threshold values more than default log area, will be by The data field that idle log area changes into is converted into log area.
26. magnetic disk control units according to any one of claim 15 to 22, it is characterised in that
The log manager, is additionally operable to distribute log area space on log area for the mapping relations;The mapping is closed The log area space that system's write mapping relations are assigned to.
CN201610912077.5A 2016-10-19 2016-10-19 Hard disk data management method and hard disk control device Active CN106502587B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610912077.5A CN106502587B (en) 2016-10-19 2016-10-19 Hard disk data management method and hard disk control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610912077.5A CN106502587B (en) 2016-10-19 2016-10-19 Hard disk data management method and hard disk control device

Publications (2)

Publication Number Publication Date
CN106502587A true CN106502587A (en) 2017-03-15
CN106502587B CN106502587B (en) 2019-10-25

Family

ID=58294298

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610912077.5A Active CN106502587B (en) 2016-10-19 2016-10-19 Hard disk data management method and hard disk control device

Country Status (1)

Country Link
CN (1) CN106502587B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107197191A (en) * 2017-05-27 2017-09-22 深圳市景阳科技股份有限公司 The wiring method and device of network hard disc video recording
CN107506156A (en) * 2017-09-28 2017-12-22 焦点科技股份有限公司 A kind of io optimization methods of block device
CN107688442A (en) * 2017-09-04 2018-02-13 郑州云海信息技术有限公司 A kind of virtual block management method for solid state hard disc
CN107885455A (en) * 2016-09-30 2018-04-06 郑州云海信息技术有限公司 A kind of Disk Logs area dynamic adjusting method
CN108920095A (en) * 2018-06-06 2018-11-30 深圳市脉山龙信息技术股份有限公司 A kind of data store optimization method and apparatus based on CRUSH
CN109558457A (en) * 2018-12-11 2019-04-02 浪潮(北京)电子信息产业有限公司 A kind of method for writing data, device, equipment and storage medium
WO2020000492A1 (en) * 2018-06-30 2020-01-02 华为技术有限公司 Storage fragment managing method and terminal
CN110955610A (en) * 2018-09-27 2020-04-03 三星电子株式会社 Method for operating storage device, storage device and storage system
CN111125033A (en) * 2018-10-31 2020-05-08 深信服科技股份有限公司 Space recovery method and system based on full flash memory array
CN111694703A (en) * 2019-03-13 2020-09-22 阿里巴巴集团控股有限公司 Cache region management method and device and computer equipment
CN113010616A (en) * 2021-04-26 2021-06-22 广州小鹏汽车科技有限公司 Data processing method and data processing system
CN116069261A (en) * 2023-03-03 2023-05-05 苏州浪潮智能科技有限公司 Data processing method, system, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060174156A1 (en) * 2005-02-01 2006-08-03 Sridhar Balasubramanian Cache redundancy for lsi raid controllers
CN103514260A (en) * 2013-08-13 2014-01-15 中国科学技术大学苏州研究院 Internal storage log file system and achieving method thereof
CN103544045A (en) * 2013-10-16 2014-01-29 南京大学镇江高新技术研究院 HDFS-based virtual machine image storage system and construction method thereof
CN105224237A (en) * 2014-05-26 2016-01-06 华为技术有限公司 A kind of date storage method and device
CN105956090A (en) * 2016-04-27 2016-09-21 中国科学技术大学 I/O self-adaption-based file system log mode

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060174156A1 (en) * 2005-02-01 2006-08-03 Sridhar Balasubramanian Cache redundancy for lsi raid controllers
CN103514260A (en) * 2013-08-13 2014-01-15 中国科学技术大学苏州研究院 Internal storage log file system and achieving method thereof
CN103544045A (en) * 2013-10-16 2014-01-29 南京大学镇江高新技术研究院 HDFS-based virtual machine image storage system and construction method thereof
CN105224237A (en) * 2014-05-26 2016-01-06 华为技术有限公司 A kind of date storage method and device
CN105956090A (en) * 2016-04-27 2016-09-21 中国科学技术大学 I/O self-adaption-based file system log mode

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885455A (en) * 2016-09-30 2018-04-06 郑州云海信息技术有限公司 A kind of Disk Logs area dynamic adjusting method
CN107197191B (en) * 2017-05-27 2021-05-11 深圳市景阳科技股份有限公司 Writing method and device for network hard disk video
CN107197191A (en) * 2017-05-27 2017-09-22 深圳市景阳科技股份有限公司 The wiring method and device of network hard disc video recording
CN107688442A (en) * 2017-09-04 2018-02-13 郑州云海信息技术有限公司 A kind of virtual block management method for solid state hard disc
CN107688442B (en) * 2017-09-04 2020-11-20 苏州浪潮智能科技有限公司 Virtual block management method for solid state disk
CN107506156A (en) * 2017-09-28 2017-12-22 焦点科技股份有限公司 A kind of io optimization methods of block device
CN108920095A (en) * 2018-06-06 2018-11-30 深圳市脉山龙信息技术股份有限公司 A kind of data store optimization method and apparatus based on CRUSH
CN108920095B (en) * 2018-06-06 2021-06-29 深圳市脉山龙信息技术股份有限公司 Data storage optimization method and device based on CRUSH
US11842046B2 (en) 2018-06-30 2023-12-12 Huawei Technologies Co., Ltd. Storage fragment management method and terminal
WO2020000492A1 (en) * 2018-06-30 2020-01-02 华为技术有限公司 Storage fragment managing method and terminal
CN110955610A (en) * 2018-09-27 2020-04-03 三星电子株式会社 Method for operating storage device, storage device and storage system
CN111125033A (en) * 2018-10-31 2020-05-08 深信服科技股份有限公司 Space recovery method and system based on full flash memory array
CN111125033B (en) * 2018-10-31 2024-04-09 深信服科技股份有限公司 Space recycling method and system based on full flash memory array
CN109558457B (en) * 2018-12-11 2022-04-22 浪潮(北京)电子信息产业有限公司 Data writing method, device, equipment and storage medium
CN109558457A (en) * 2018-12-11 2019-04-02 浪潮(北京)电子信息产业有限公司 A kind of method for writing data, device, equipment and storage medium
CN111694703A (en) * 2019-03-13 2020-09-22 阿里巴巴集团控股有限公司 Cache region management method and device and computer equipment
CN111694703B (en) * 2019-03-13 2023-05-02 阿里云计算有限公司 Cache region management method and device and computer equipment
CN113010616A (en) * 2021-04-26 2021-06-22 广州小鹏汽车科技有限公司 Data processing method and data processing system
CN116069261A (en) * 2023-03-03 2023-05-05 苏州浪潮智能科技有限公司 Data processing method, system, equipment and storage medium

Also Published As

Publication number Publication date
CN106502587B (en) 2019-10-25

Similar Documents

Publication Publication Date Title
CN106502587B (en) Hard disk data management method and hard disk control device
CN103186350B (en) The moving method of mixing storage system and hot spot data block
CN110825748B (en) High-performance and easily-expandable key value storage method by utilizing differentiated indexing mechanism
US10176113B2 (en) Scalable indexing
CN104346357B (en) The file access method and system of a kind of built-in terminal
US9189389B2 (en) Memory controller and memory system
CN101980177B (en) Method and device for operating Flash
CN109582593B (en) FTL address mapping reading and writing method based on calculation
CN108139902A (en) The method and apparatus of SSD drive are accessed for providing mixed mode
CN104035729A (en) Block device thin-provisioning method for log mapping
CN103577339A (en) Method and system for storing data
CN109710541B (en) Optimization method for Greedy garbage collection of NAND Flash main control chip
CN101488153A (en) Method for implementing high-capacity flash memory file system in embedded type Linux
CN109671458A (en) The method of management flash memory module and relevant flash controller
CN104598386B (en) By following the trail of and reusing solid-state drive block using two level map index
CN100424699C (en) Attribute extensible object file system
CN109240939B (en) Method for rapidly processing solid state disk TRIM
CN101634967A (en) Block management method for flash memory, storage system and controller
CN110968269A (en) SCM and SSD-based key value storage system and read-write request processing method
CN108628542A (en) A kind of Piece file mergence method and controller
CN102819494A (en) Optimization method for writing in flash memory in sequence
CN103399915A (en) Optimal reading method for index file of search engine
CN114676072A (en) Data processing method and device
CN103020077A (en) Method for managing memory of real-time database of power system
US11818197B2 (en) Data stream management method and device

Legal Events

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