Specific embodiment
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work
It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, "
Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way
Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein.In addition, term " includes " and " tool
Have " and their any deformation, it is intended that cover it is non-exclusive include, for example, containing a series of steps or units
Process, method, system, product or equipment those of are not necessarily limited to be clearly listed step or unit, but may include without clear
Other step or units listing to Chu or intrinsic for these process, methods, product or equipment.
The embodiment of the invention provides a kind of data processing equipment for data storage, which can pass through computer
Equipment realizes its function.
Fig. 1 is the schematic diagram of the data processing equipment for data storage according to a first embodiment of the present invention.Such as Fig. 1 institute
Show, this be used for data storage data processing equipment include first acquisition unit 10, writing unit 30, second acquisition unit 50,
Selection unit 70 and storage unit 90.
First acquisition unit 10 is used to obtain the data of the application layer of the storage system for data storage.
Storage system can be in computer to be believed by the various storage equipment of storage program and data, control unit and management
Cease system composed by the equipment (hardware) dispatched and algorithm (software).The data of application layer can be the business from application layer
Data, the data of application layer have certain cold and hot degree, and the cold and hot degree is for indicating the frequency that data are modified or are written
Degree.Cold data and dsc data can be splitted data into according to the cold and hot degree of data, wherein cold data can be expression and be modified
The lesser data of frequency, will not be modified for a long time;Dsc data can be expression by the biggish data of modification frequency, show hot number
It is high according to the frequency used.The data of application layer are obtained by first acquisition unit 10 in order to carry out the data of the application layer
Storage.Storage system in the embodiment of the present invention can be solid state hard disk (Solid State Disk, referred to as SSD) storage system
System.
Data for being equably written in the logical address space of storage system by writing unit 30.
Logical address space can refer to source program institute used in instruction and data after compiling or linking assembly
There is the space of relative address.It, can be by the data of the application layer after first acquisition unit 10 gets the data of application layer
It is stored in a manner of key-value pair (Key-Value).The data of application layer can be counted by Hash (hash) algorithm
Calculation obtains the corresponding logical address of the data, enables data to equably be written in logical address space, specifically, can be
Logical address space is divided, multiple logical address sections as unit of presetting size are divided into, is then calculated by Hash
Data are evenly dispersed into each logical address section by method.Data are equably written to storage system by writing unit 30
In the logical address space of system, guarantee data in the uniformity of logical address space, to keep the frequency of the write-in of data
Stability.
Second acquisition unit 50 is used to obtain the update frequency of logical address in logical address space.
Logical address, which can be, in logical address space patrols what logical address space carried out etc. obtaining after units divide
Collect the logical address in region.The update frequency of logical address can be the update frequency of logical address in logical address region,
Pass through the cold and hot degree of the corresponding data of the available logical address region of the update frequency.For example, working as logical address more
New frequency is bigger, then it represents that the corresponding data of logical address region are dsc data, i.e. the frequency of the data modified is big;Instead
It, then it represents that the corresponding data of logical address region are cold data, i.e. the frequency of the data modified is small.Specifically, second
The update frequency for the logical address that acquiring unit 50 obtains, which can be, is written number by the data of logical address to judge, according to
The update frequency of number decision logic address is written in data, so as to obtain the cold and hot degree of data.
Selection unit 70 is used to choose the physical block of storage system by update frequency.
Physical block can be in storage system, the physical region of the storing data in recording medium, usually in storage system
In, physical block is broadly divided into free block, used block, erroneous block and four kinds of scrub block, wherein free block b is indicated can be with
The physical block of used free time, used block indicate that the physical block used, erroneous block indicate the physics for mistake occur
Block, scrub block indicate the physical block for needing to move.It can be by the physical block that update frequency chooses storage system using dynamic
The mode of abrasion equilibrium is chosen, wherein Dynamic wear equilibrium refers to that the upper layer logic of storage system needs to obtain a sky
Not busy physical block when writing data, selects suitable physical block using certain rule.Specifically, Dynamic wear equilibrium makes
Method can be the cold and hot degree for determining data by update frequency first, i.e. the frequency modified of data, if it is determined that
What data will not be modified for a long time, then the most physical block of selective erasing number from idle physical block, stores data into
In the physical block;If it is determined that the modification frequency of data is higher, or can not determine the modification frequency of data, then selective erasing
The physical block of number the smallest free time, stores data into the smallest physical block of the erasing times.
Storage unit 90 is used for the physical block storing data by choosing.
After selection unit 70 is chosen to material resources block, the data of application layer are stored the physics to selection by storage unit 90
On block.
In the embodiment of the present invention, storage system can also have the function of static wear equilibrium, wherein static wear is balanced
It can refer to and find the smallest physical block of erasing times in the physical block used, then the data on the physical block are removed
It moves on on the more physical block of erasing times, for example, finding the smallest A of erasing times in the physical block group used
Block finds the most B block of erasing times in idle physical block group, going above the data-moving on A block to B block, B block
It is inserted into the material resources block group used, is inserted into idle physical block group after the data of A block are wiped.Static wear is equal
Weighing apparatus can be divided into several modes, and passing through different mode, to trigger static wear balanced, wherein the trigger condition of each pattern is not
The same, the mode of static wear equilibrium is as follows:
1) foreground mode, when physical block because of abrasion equilibrium when something goes wrong, for example garbage reclamation can not find expected physics
Block triggers foreground abrasion equilibrium, and it is balanced to execute static wear.
2) background mode: when storage system is in the free time, can trigger backstage abrasion equilibrium, execute static state by backstage
Abrasion equilibrium.
3) periodicity pattern: when data are written to storage system, needing the physical block to the storage system application free time,
In, when one section of idle physical block of every application, the abrasion of storage system is counted plus one, when, when abrasion reaches certain threshold value, touching
It is balanced to send out static wear.
4) balanced mode: when the difference of the maximum erasing times of physical block and minimum erasing times is greater than certain threshold value, touching
It is balanced to send out static wear.
Static wear equilibrium can make storage system after being stored in data, pass through sentencing for the erasing times to material resources block
It is disconnected that data are moved, realize the abrasion equilibrium to physical block.
According to embodiments of the present invention, by being equably written to the data of application layer in logical address space, guarantee number
According to the stability of write-in, and the update frequency of the logical address by getting chooses material resources block, to storing data, due to patrolling
The update frequency for collecting address can reflect the cold and hot degree of data, the corresponding data of the big logical address of update frequency can be deposited
The few physical block of erasing times is stored up, by the physics more than the corresponding data storage to erasing times of the small logical address of update frequency
Block reduces the starting of static wear equilibrium, reduces invalid data-moving so that the abrasion equilibrium of physical block reaches rationalization,
It solves the problems, such as that the service life of storage system in the prior art is short, has reached the effect for extending the service life of storage system
Fruit.
Fig. 2 is the schematic diagram of the data processing equipment for data storage according to a second embodiment of the present invention.The implementation
The data processing equipment for data storage of example can be used as the data processing equipment for data storage of above-described embodiment
A kind of preferred embodiment.As shown in Fig. 2, this be used for data storage data processing equipment include first acquisition unit 10,
Writing unit 30, second acquisition unit 50, selection unit 70 and storage unit 90.Wherein, writing unit 30 includes division module
301, computing module 303 and writing module 305.First acquisition unit 10, second acquisition unit 50, selection unit 70 and storage are single
Member 90 successively with first acquisition unit 10 shown in FIG. 1, second acquisition unit 50, selection unit 70 and storage unit 90 function
It is identical, it is not described herein.
Division module 301 is used to as unit of the logical address region for presetting size divide logical address space,
Obtain multiple logical address regions.
Division module 301 divides logical address space, can be logical address region according to default size into
Row divides, wherein and default size, which can be, to be carried out as needed for example, divided as unit of 2Gb to logical address space,
To which logical address space to be divided into the logical address region of multiple 2Gb sizes.Specifically, in memory retain bucket index and
Flash memory nandflash in storage system is divided into the small table collection that 2Gb is unit, with the big of BLOCK SIZE by big recording indexes
The small unit for sequential write, in order to uniformly be distributed to data in each small table by hash algorithm, wherein each is small
Table is a logical address region.
Computing module 303 is for calculating data by hash algorithm.
Data are calculated by hash algorithm, i.e., Hash processing are carried out to the data of application layer.Wherein, which calculates
Method can be used for enabling data to being uniformly distributed in logical address space.Due to the data by hash algorithm to application layer
It is calculated, obtains the corresponding logical address of data, enable data to be uniformly distributed in logical address space.
Writing module 305 is used to for the data after calculating equably being written in multiple logical address regions.
According to the corresponding logical address of the data being calculated, data can be equably written to multiple logical address areas
In domain, so that the data in each region are kept uniformly, so that the data of entire logical address space keep uniformity, in turn
The stability of the update frequency of the data in logical address region can be kept for a long time.
Preferably, the selection unit 70 of the embodiment of the present invention may include the first acquisition module, and the first acquisition module is used for
The cold and hot degree of data is obtained by update frequency, and the physical block of storage system is chosen according to the cold and hot degree of data.It updates
Frequency is the update frequency of logical address, and the update frequency of logical address can be the update of logical address in logical address region
Frequency passes through the cold and hot degree of the corresponding data of the available logical address region of the update frequency.For example, working as logical address
Update frequency it is bigger, then it represents that the corresponding data of logical address region are dsc data, i.e. the frequency of the data modified is big;
When the update frequency of logical address is smaller, then it represents that the corresponding data of logical address region are cold data, i.e. the data are repaired
The frequency changed is small.Wherein, the first acquisition module includes acquisition submodule, computational submodule and determining submodule.
Acquisition submodule is used to obtain the data write-in number of logical address.
Specifically, the data write-in number of logical address can be the logical address area divided to logical address
Number is written in the data in domain, and the cold and hot degree of data can be determined by the write-in number.For example, logical address space is divided into
2Gb is the small table of unit, and the data write-in number in the small table can reflect the cold and hot degree of the corresponding data of the small table.It obtains
The data write-in number of logical address, which can be, counts the number of mathematical logic write-in, in order to true by the statistical value
The cold and hot degree of fixed number evidence.
Determine submodule for the cold and hot degree that number determines data to be written by data.
After number is written in the data for getting logical address, number can be written by the data and judge this logically
The cold and hot degree of the corresponding data in location.Wherein, when data are written, number is larger, and is more than the threshold value of preset data write-in number
When, it is determined that the corresponding data of the logical address are dsc data, i.e. the frequency modified of the data is larger;When number is written in data
It is smaller, and lower than preset data write-in number threshold value when, it is determined that the corresponding data of the logical address be cold data, i.e., should
The frequency that data are modified is smaller.After determining the cold and hot degree of data, it is suitable to be chosen based on the cold and hot degree of data
Physical block, to store the data.
The description of static wear equilibrium can be seen that since static wear equilibrium starts according to embodiments of the present invention
When, it also corresponds to be the primary operation wiped and data are written to physical block, therefore, if the starting of static wear equilibrium
In frequent, burden can be brought to system, increase invalid data-moving operation.By the data write-in time for obtaining logical address
Number, and the cold and hot degree that number determines data is written by the data, it can be improved the accuracy to the identification of data cold and hot degree, from
And invalid data-moving operation of the storage system after storing data is reduced, and then further extend the use longevity of storage system
Life.
Fig. 3 is the schematic diagram of the data processing equipment for data storage according to a third embodiment of the present invention.The implementation
The data processing equipment for data storage of example can be used as the data processing equipment for data storage of above-described embodiment
A kind of preferred embodiment.As shown in figure 3, this be used for data storage data processing equipment include first acquisition unit 10,
Writing unit 30, second acquisition unit 50, selection unit 70 and storage unit 90.Wherein, selection unit 70 includes the second acquisition
Module 701 and selection module 703.First acquisition unit 10, writing unit 30, second acquisition unit 50 and storage unit 90 are successively
It is identical as the function of first acquisition unit 10 shown in FIG. 1, writing unit 30, second acquisition unit 50 and storage unit 90, but
It is without being limited thereto, it is not described herein.
Second acquisition module 701 is used to obtain the erasing times of physical block available free in storage system.
Due in storage system mainly include free block, four kinds of used block, erroneous block and scrub block physical blocks,
When being stored in data into storage system, physical block, that is, free block idle in storage system is preferably chosen, sky is stored data into
On not busy physical block.Since the erasing times of the physical block in storage system are limited, in order to avoid due to the erasing of physical block time
The problem of number is more than the peak of physical block erasing times and storage system is caused to fail, can be by obtaining available free object
The erasing times for managing block, are stored in order to choose suitable physical block from available free physical block, in order to realize
The abrasion equilibrium of storage system.
Module 703 is chosen to be used to choose physical block according to the cold and hot degree of erasing times and data.
After getting the erasing times of physical block, can erasing times and data based on physical block cold and hot degree
Choose physical block, wherein the cold and hot degree of data can be determined by the update frequency of logical address.For example, for data quilt
When the frequency of modification is smaller, it can choose the most free physical block of erasing times and store the data;Data are modified
When frequency is larger or uncertain, it can choose the least free physical block of erasing times and store the data.
According to embodiments of the present invention, it after the update frequency by logical address determines the cold and hot degree of data, obtains
The erasing times of the erasing times of free physical block, cold and hot degree and physical block based on data choose suitable physical block, mention
The high efficiency of abrasion equilibrium, reduces the number of starts of static wear.
Preferably, choosing module 703 includes judging submodule, the first selection submodule and the second selection submodule.
Judging submodule is used to be judged by the cold and hot degree of data whether data to be cold data, and cold data is by modification frequency
Low data.
Judge whether data are that cold data can be and judge number by the frequency that data are modified by the cold and hot degree of data
According to whether being cold data, wherein cold data is the data low by modification frequency, can be the data that will not be modified for a long time.
First selection submodule is used for when judging data is cold data, chooses erasing time in available free physical block
The most physical block of number.
Second, which chooses submodule, is used for when judging data not is cold data, chooses in available free physical block and wipes
The least physical block of number.
When to judge data not be cold data, show that the data can be the high dsc data of the frequency modified, it can also be with
It is the uncertain data of frequency modified, the least physical block of erasing times is in the available free physical block of selection to store this
Data, so that the physical block storage modification frequency for realizing that erasing times are few in storage system is high when data are modified
Data, the low data of physical block storage modification frequency more than erasing times, further improve the efficiency of abrasion equilibrium.
The embodiment of the invention also provides a kind of data processing methods for data storage.This method operates in computer
In equipment.It should be noted that the data processing method for data storage of the embodiment of the present invention can be real through the invention
It applies and is executed provided by example for the data processing equipment of data storage, the data for data storage of the embodiment of the present invention
Processing unit can be used for executing the data processing method provided by the embodiment of the present invention for data storage.
Fig. 4 is the flow chart of the data processing method for data storage according to a first embodiment of the present invention.Such as Fig. 4 institute
Show, which comprises the following steps that
Step S402 obtains the data of the application layer of the storage system for data storage.
Storage system can be in computer to be believed by the various storage equipment of storage program and data, control unit and management
Cease system composed by the equipment (hardware) dispatched and algorithm (software).The data of application layer can be the business from application layer
Data, the data of application layer have certain cold and hot degree, and the cold and hot degree is for indicating the frequency that data are modified or are written
Degree.Cold data and dsc data can be splitted data into according to the cold and hot degree of data, wherein cold data can be expression and be modified
The lesser data of frequency, will not be modified for a long time;Dsc data can be expression by the biggish data of modification frequency, show hot number
It is high according to the frequency used.The data of application layer are obtained in order to store the data of the application layer.
Data are equably written in the logical address space of storage system by step S404.
Logical address space can refer to source program institute used in instruction and data after compiling or linking assembly
There is the space of relative address.It, can be by the data of the application layer with key-value pair (Key- after getting the data of application layer
Value mode) is stored.It can carry out that the data pair are calculated by data of Hash (hash) algorithm to application layer
The logical address answered enables data to equably be written in logical address space, specifically, can be logical address space
Divided, be divided by preset size as unit of multiple logical address sections, then by hash algorithm by data equably
It is distributed in each logical address section.By being equably written to data in the logical address space of storage system, guarantee
Data logical address space uniformity, to keep the stability of the frequency of the write-in of data.
Step S406 obtains the update frequency of logical address in logical address space.
Logical address, which can be, in logical address space patrols what logical address space carried out etc. obtaining after units divide
Collect the logical address in region.The update frequency of logical address can be the update frequency of logical address in logical address region,
Pass through the cold and hot degree of the corresponding data of the available logical address region of the update frequency.For example, working as logical address more
New frequency is bigger, then it represents that the corresponding data of logical address region are dsc data, i.e. the frequency of the data modified is big;Instead
It, then it represents that the corresponding data of logical address region are cold data, i.e. the frequency of the data modified is small.Specifically, it obtains
The update frequency of logical address, which can be, is written number by the data of logical address to judge, number judgement is written according to data
The update frequency of logical address.
Step S408 chooses the physical block of storage system by update frequency.
Physical block can be in storage system, the physical region of the storing data in recording medium, usually in storage system
In, physical block is broadly divided into free block, used block, erroneous block and four kinds of scrub block, wherein free block b is indicated can be with
The physical block of used free time, used block indicate that the physical block used, erroneous block indicate the physics for mistake occur
Block, scrub block indicate the physical block for needing to move.It can be by the physical block that update frequency chooses storage system using dynamic
The mode of abrasion equilibrium is chosen, wherein Dynamic wear equilibrium refers to that the upper layer logic of storage system needs to obtain a sky
Not busy physical block when writing data, selects suitable physical block using certain rule.Specifically, Dynamic wear equilibrium makes
Method can be the cold and hot degree for determining data by update frequency first, i.e. the frequency modified of data, if it is determined that
What data will not be modified for a long time, then the most physical block of selective erasing number from idle physical block, stores data into
In the physical block;If it is determined that the modification frequency of data is higher, or can not determine the modification frequency of data, then selective erasing
The physical block of number the smallest free time, stores data into the smallest physical block of the erasing times.
Step S410 passes through the physical block storing data of selection.
It, will be in the data storage to the physical block of selection of application layer after choosing to material resources block.
In the embodiment of the present invention, storage system can also have the function of static wear equilibrium, wherein static wear is balanced
It can refer to and find the smallest physical block of erasing times in the physical block used, then the data on the physical block are removed
It moves on on the more physical block of erasing times, for example, finding the smallest A of erasing times in the physical block group used
Block finds the most B block of erasing times in idle physical block group, going above the data-moving on A block to B block, B block
It is inserted into the material resources block group used, is inserted into idle physical block group after the data of A block are wiped.Static wear is equal
Weighing apparatus can be divided into several modes, and passing through different mode, to trigger static wear balanced, wherein the trigger condition of each pattern is not
The same, the mode of static wear equilibrium is as follows:
1) foreground mode, when physical block because of abrasion equilibrium when something goes wrong, for example garbage reclamation can not find expected physics
Block triggers foreground abrasion equilibrium, and it is balanced to execute static wear.
2) background mode: when storage system is in the free time, can trigger backstage abrasion equilibrium, execute static state by backstage
Abrasion equilibrium.
3) periodicity pattern: when data are written to storage system, needing the physical block to the storage system application free time,
In, when one section of idle physical block of every application, the abrasion of storage system is counted plus one, when, when abrasion reaches certain threshold value, touching
It is balanced to send out static wear.
4) balanced mode: when the difference of the maximum erasing times of physical block and minimum erasing times is greater than certain threshold value, touching
It is balanced to send out static wear.
Static wear equilibrium can make storage system after being stored in data, pass through sentencing for the erasing times to material resources block
It is disconnected that data are moved, realize the abrasion equilibrium to physical block.
According to embodiments of the present invention, by being equably written to the data of application layer in logical address space, guarantee number
According to the stability of write-in, and the update frequency of the logical address by getting chooses material resources block, to storing data, due to patrolling
The update frequency for collecting address can reflect the cold and hot degree of data, the corresponding data of the big logical address of update frequency can be deposited
The few physical block of erasing times is stored up, by the physics more than the corresponding data storage to erasing times of the small logical address of update frequency
Block reduces the starting of static wear equilibrium, reduces invalid data-moving so that the abrasion equilibrium of physical block reaches rationalization,
It solves the problems, such as that the service life of storage system in the prior art is short, has reached the effect for extending the service life of storage system
Fruit.
Fig. 5 is the flow chart of the data processing method for data storage according to a second embodiment of the present invention.The implementation
The data processing method of example can be used as a kind of preferred embodiment of the data processing method of above-described embodiment.As shown in figure 5,
The data processing method for being used for data storage comprises the following steps that
Step S502 obtains the data of the application layer of the storage system for data storage.
Storage system can be in computer to be believed by the various storage equipment of storage program and data, control unit and management
Cease system composed by the equipment (hardware) dispatched and algorithm (software).The data of application layer can be the business from application layer
Data, the data of application layer have certain cold and hot degree, and the cold and hot degree is for indicating the frequency that data are modified or are written
Degree.Cold data and dsc data can be splitted data into according to the cold and hot degree of data, wherein cold data, which can be, indicates the data
The frequency modified it is smaller, will not be modified for a long time;Conversely, the frequency that dsc data is modified is big.Obtain the data of application layer
In order to which the data of the application layer are stored.
Step S504 divides logical address space as unit of the logical address region for presetting size, obtains more
A logical address region.
Logical address space is divided, can be and divided according to the logical address region of default size, wherein
Default size can be to be carried out for example, being divided as unit of 2Gb to logical address space, thus will logically as needed
Location space is divided into the logical address region of multiple 2Gb sizes.Specifically, retain bucket index and big recording indexes in memory,
Flash memory nandflash in storage system is divided into the small table collection that 2Gb is unit, using the size of BLOCK SIZE as sequential write
Unit, in order to uniformly be distributed to data in each small table by hash algorithm, wherein each small table is one and patrols
Collect address area.
Step S506 calculates data by hash algorithm.
Data are calculated by hash algorithm, which can be used for enabling data to being uniformly distributed in
Logical address space.Due to being calculated by data of the hash algorithm to application layer, the corresponding logical address of data is obtained, is made
Obtaining data can be uniformly distributed in logical address space.
Data after calculating are equably written in multiple logical address regions by step S508.
According to the corresponding logical address of the data being calculated, data can be equably written to multiple logical address areas
In domain, so that the data in each region are kept uniformly, so that the data of entire logical address space keep uniformity, in turn
The stability of the update frequency of the data in logical address region can be kept for a long time.
Step S510 obtains the update frequency of logical address in logical address space.
Logical address, which can be, in logical address space patrols what logical address space carried out etc. obtaining after units divide
Collect the logical address in region.The update frequency of logical address can be the update frequency of logical address in logical address region,
Pass through the cold and hot degree of the corresponding data of the available logical address region of the update frequency.For example, working as logical address more
New frequency is bigger, then it represents that the corresponding data of logical address region are dsc data, i.e. the frequency of the data modified is big;Instead
It, then it represents that the corresponding data of logical address region are cold data, i.e. the frequency of the data modified is small.Specifically, it obtains
The update frequency of logical address, which can be, is written number by the data of logical address to judge, number judgement is written according to data
The update frequency of logical address.
Step S512 chooses the physical block of storage system by update frequency.
Physical block can be in storage system, the physical region of the storing data in recording medium, usually in storage system
In, physical block is broadly divided into free block, used block, erroneous block and four kinds of scrub block, wherein free block b is indicated can be with
The physical block of used free time, used block indicate that the physical block used, erroneous block indicate the physics for mistake occur
Block, scrub block indicate the physical block for needing to move.It can be by the physical block that update frequency chooses storage system using dynamic
The mode of abrasion equilibrium is chosen, wherein Dynamic wear equilibrium refers to that the upper layer logic of storage system needs to obtain a sky
Not busy physical block when writing data, selects suitable physical block using certain rule.Specifically, Dynamic wear equilibrium makes
Method can be the cold and hot degree for determining data by update frequency first, i.e. the frequency modified of data, if it is determined that
What data will not be modified for a long time, then the most physical block of selective erasing number from idle physical block, stores data into
In the physical block;If it is determined that the modification frequency of data is higher, or can not determine the modification frequency of data, then selective erasing
The physical block of number the smallest free time, stores data into the smallest physical block of the erasing times.
Step S514 passes through the physical block storing data of selection.
It, will be in the data storage to the physical block of selection of application layer after choosing to material resources block.
Preferably, step S408 or step S512 includes: the cold and hot degree that data are obtained by update frequency, and according to
The cold and hot degree of data chooses the physical block of storage system.Update frequency is the update frequency of logical address, and logical address is more
New frequency can be the update frequency of logical address in logical address region, pass through the available logical address of the update frequency
The cold and hot degree of the corresponding data in region.For example, the update frequency when logical address is bigger, then it represents that logical address region is corresponding
Data be dsc data, i.e. the frequency of the data modified is big;When the update frequency of logical address is smaller, then it represents that logically
The corresponding data in location region are cold data, i.e. the frequency of the data modified is small.Wherein, data are obtained by following steps
Cold and hot degree:
Step 1 obtains the data write-in number of logical address.
Specifically, the data write-in number of logical address can be the logical address area divided to logical address
Number is written in the data in domain, and the cold and hot degree of data can be determined by the write-in number.For example, logical address space is divided into
2Gb is the small table of unit, and the data write-in number in the small table can reflect the cold and hot degree of the corresponding data of the small table.It obtains
The data write-in number of logical address, which can be, counts the number of mathematical logic write-in, in order to true by the statistical value
The cold and hot degree of fixed number evidence.
The cold and hot degree that number determines data is written by data in step 2.
After number is written in the data for getting logical address, number can be written by the data and judge this logically
The cold and hot degree of the corresponding data in location.Wherein, when data are written, number is larger, and is more than the threshold value of preset data write-in number
When, it is determined that the corresponding data of the logical address are dsc data, i.e. the frequency modified of the data is larger;When number is written in data
It is smaller, and lower than preset data write-in number threshold value when, it is determined that the corresponding data of the logical address be cold data, i.e., should
The frequency that data are modified is smaller.After determining the cold and hot degree of data, it is suitable to be chosen based on the cold and hot degree of data
Physical block, to store the data.
The description of static wear equilibrium can be seen that since static wear equilibrium starts according to embodiments of the present invention
When, it also corresponds to be the primary operation wiped and data are written to physical block, therefore, if the starting of static wear equilibrium
In frequent, burden can be brought to system, increase invalid data-moving operation.By the data write-in time for obtaining logical address
Number, and the cold and hot degree that number determines data is written by the data, it can be improved the accuracy to the identification of data cold and hot degree, from
And invalid data-moving operation of the storage system after storing data is reduced, and then further extend the use longevity of storage system
Life.
Fig. 6 is the flow chart of the data processing method for data storage according to a third embodiment of the present invention.The implementation
The data processing method for data storage of example can be the data processing method for data storage of above-described embodiment
A kind of preferred embodiment.As shown in fig. 6, the data processing method for being used for data storage comprises the following steps that
Step S602 obtains the data of the application layer of the storage system for data storage.
Storage system can be in computer to be believed by the various storage equipment of storage program and data, control unit and management
Cease system composed by the equipment (hardware) dispatched and algorithm (software).The data of application layer can be the business from application layer
Data, the data of application layer have certain cold and hot degree, and the cold and hot degree is for indicating the frequency that data are modified or are written
Degree.Cold data and dsc data can be splitted data into according to the cold and hot degree of data, wherein cold data, which can be, indicates the data
The frequency modified it is smaller, will not be modified for a long time;Conversely, the frequency that dsc data is modified is big.Obtain the data of application layer
In order to which the data of the application layer are stored.
Data are equably written in the logical address space of storage system by step S604.
Logical address space can refer to source program institute used in instruction and data after compiling or linking assembly
There is the space of relative address.It, can be by the data of the application layer with key-value pair (Key- after getting the data of application layer
Value mode) is stored.It can carry out that the data pair are calculated by data of Hash (hash) algorithm to application layer
The logical address answered enables data to equably be written in logical address space, specifically, can be logical address space
Divided, be divided by preset size as unit of multiple logical address sections, then by hash algorithm by data equably
It is distributed in each logical address section.By being equably written to data in the logical address space of storage system, guarantee
Data logical address space uniformity, to keep the stability of the frequency of the write-in of data.
Step S606 obtains the update frequency of logical address in logical address space.
Logical address, which can be, in logical address space patrols what logical address space carried out etc. obtaining after units divide
Collect the logical address in region.The update frequency of logical address can be the update frequency of logical address in logical address region,
Pass through the cold and hot degree of the corresponding data of the available logical address region of the update frequency.For example, working as logical address more
New frequency is bigger, then it represents that the corresponding data of logical address region are dsc data, i.e. the frequency of the data modified is big;Instead
It, then it represents that the corresponding data of logical address region are cold data, i.e. the frequency of the data modified is small.Specifically, it obtains
The update frequency of logical address, which can be, is written number by the data of logical address to judge, number judgement is written according to data
The update frequency of logical address.
Step S608 obtains the erasing times of physical block available free in storage system.
Due in storage system mainly include free block, four kinds of used block, erroneous block and scrub block physical blocks,
When being stored in data into storage system, physical block, that is, free block idle in storage system is preferably chosen, sky is stored data into
On not busy physical block.Since the erasing times of the physical block in storage system are limited, in order to avoid due to the erasing of physical block time
The problem of number is more than the peak of physical block erasing times and storage system is caused to fail, can be by obtaining available free object
The erasing times for managing block, are stored in order to choose suitable physical block from available free physical block, in order to realize
The abrasion equilibrium of storage system.
Step S610 chooses physical block according to the cold and hot degree of erasing times and data.
After getting the erasing times of physical block, can erasing times and data based on physical block cold and hot degree
Choose physical block, wherein the cold and hot degree of data can be determined by the update frequency of logical address.For example, for data quilt
When the frequency of modification is smaller, it can choose the most free physical block of erasing times and store the data;Data are modified
When frequency is larger or uncertain, it can choose the least free physical block of erasing times and store the data.
Step S612 passes through the physical block storing data of selection.
It, will be in the data storage to the physical block of selection of application layer after choosing to material resources block.
According to embodiments of the present invention, it after the update frequency by logical address determines the cold and hot degree of data, obtains
The erasing times of the erasing times of free physical block, cold and hot degree and physical block based on data choose suitable physical block, mention
The high efficiency of abrasion equilibrium, reduces the number of starts of static wear.
Fig. 7 is the flow chart of the data processing method for data storage according to a fourth embodiment of the present invention.The implementation
The data processing method for data storage of example can be the data processing method for data storage of above-described embodiment
A kind of preferred embodiment.As shown in fig. 7, the data processing method for being used for data storage comprises the following steps that
Step S702 obtains the data of the application layer of the storage system for data storage.
Storage system can be in computer to be believed by the various storage equipment of storage program and data, control unit and management
Cease system composed by the equipment (hardware) dispatched and algorithm (software).The data of application layer can be the business from application layer
Data, the data of application layer have certain cold and hot degree, and the cold and hot degree is for indicating the frequency that data are modified or are written
Degree.Cold data and dsc data can be splitted data into according to the cold and hot degree of data, wherein cold data, which can be, indicates the data
The frequency modified it is smaller, will not be modified for a long time;Conversely, the frequency that dsc data is modified is big.Obtain the data of application layer
In order to which the data of the application layer are stored.
Data are equably written in the logical address space of storage system by step S704.
Logical address space can refer to source program institute used in instruction and data after compiling or linking assembly
There is the space of relative address.It, can be by the data of the application layer with key-value pair (Key- after getting the data of application layer
Value mode) is stored.It can carry out that the data pair are calculated by data of Hash (hash) algorithm to application layer
The logical address answered enables data to equably be written in logical address space, specifically, can be logical address space
Divided, be divided by preset size as unit of multiple logical address sections, then by hash algorithm by data equably
It is distributed in each logical address section.By being equably written to data in the logical address space of storage system, guarantee
Data logical address space uniformity, to keep the stability of the frequency of the write-in of data.
Step S706 obtains the update frequency of logical address in logical address space.
Logical address, which can be, in logical address space patrols what logical address space carried out etc. obtaining after units divide
Collect the logical address in region.The update frequency of logical address can be the update frequency of logical address in logical address region,
Pass through the cold and hot degree of the corresponding data of the available logical address region of the update frequency.For example, working as logical address more
New frequency is bigger, then it represents that the corresponding data of logical address region are dsc data, i.e. the frequency of the data modified is big;Instead
It, then it represents that the corresponding data of logical address region are cold data, i.e. the frequency of the data modified is small.Specifically, it obtains
The update frequency of logical address, which can be, is written number by the data of logical address to judge, number judgement is written according to data
The update frequency of logical address.
Step S708 obtains the erasing times of physical block available free in storage system.
Due in storage system mainly include free block, four kinds of used block, erroneous block and scrub block physical blocks,
When being stored in data into storage system, physical block, that is, free block idle in storage system is preferably chosen, sky is stored data into
On not busy physical block.Since the erasing times of the physical block in storage system are limited, in order to avoid due to the erasing of physical block time
The problem of number is more than the peak of physical block erasing times and storage system is caused to fail, can be by obtaining available free object
The erasing times for managing block, are stored in order to choose suitable physical block from available free physical block, in order to realize
The abrasion equilibrium of storage system.
Step S710 judges whether data are cold data by the cold and hot degree of data, and cold data is low by modification frequency
Data.
Judge whether data are that cold data can be and judge number by the frequency that data are modified by the cold and hot degree of data
According to whether being cold data, wherein cold data is the data low by modification frequency, can be the data that will not be modified for a long time.
It is most to choose erasing times in available free physical block when judging data is cold data by step S712
Physical block.
It is minimum to choose erasing times in available free physical block when judging data not is cold data by step S714
Physical block.
When to judge data not be cold data, show that the data can be the high dsc data of the frequency modified, it can also be with
It is the uncertain data of frequency modified, the least physical block of erasing times is in the available free physical block of selection to store this
Data.
For example, in storage system include three idle physical blocks be respectively the first physical block, the second physical block and third
Physical block, wherein the erasing times of these three physical blocks got are respectively 10,100 and 1000.When storage system needs are write
When entering data data, since the erasing times of the first physical block are minimum, data data1 can be directly stored in existing way
In first physical block.When storage system needs that data data2 is written again, data data2 can be stored in the by existing mode
In two physical blocks.But when the frequency of use of data data1 and data data2 difference, if data data1 is for a long time
It does not need inside to modify, and data data2 is whithin a period of time, the frequency modified is very high, will ultimately result in the first physics
Erasing times still very little on block, and the erasing times of the second physical block can be gradually increased, and cause abrasion equilibrium unreasonable.At this
In inventive embodiments, by the cold and hot degree to data data1 and data data2, it that is to say that the frequency modified is judged,
It will be stored on the first few physical block of erasing times by the high data data2 of modification frequency, by the data low by modification frequency
Data1 is stored on the second few physical block of erasing times, so that being able to maintain physical block when follow-up data is modified
Abrasion equilibrium.
So that the physical block storage modification frequency for realizing that erasing times are few in storage system is high when data are modified
Data, the low data of physical block storage modification frequency more than erasing times further improve the efficiency of abrasion equilibrium.
Step S716 passes through the physical block storing data of selection.
It, will be in the data storage to the physical block of selection of application layer after choosing to material resources block.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of
Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because
According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention
It is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed device, it can be by another way
It realizes.For example, the apparatus embodiments described above are merely exemplary, such as the division of the unit, it is only a kind of
Logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine or can
To be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit,
It can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially
The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words
It embodies, which is stored in a storage medium, including some instructions are used so that a computer
Equipment (can be personal computer, mobile terminal, server or network equipment etc.) executes side described in each embodiment of the present invention
The all or part of the steps of method.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field
For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair
Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.