Invention content
In view of this, this application provides a kind of date storage method and device and solid state disk, to improve depositing for SSD
Store up performance.
To achieve the above object, the application provides the following technical solutions:A kind of date storage method is applied to solid state disk
SSD, the method includes:
Obtain current target data to be written;
If it is determined that the target data is the data for needing to cache, then from the first caching and the second caching, determine
Target cache for storing the target data, wherein first caching is preset buffer area in host memory, described
Second caching is the intrinsic caching in the SSD;
The target data is cached to the target cache.
It is preferably, described to determine the target cache for storing the target data from the first caching and the second caching,
Including:
Determine that the data type belonging to the target data, the data type include first kind data and Second Type
The access frequency of estimating of data, the first kind data estimates access frequency more than the Second Type data;
When the target data is first kind data, first caching is determined as target cache;
When the target data is Second Type data, second caching is determined as target cache.
Preferably, the target data is cached to the target cache, further includes:
Count the access frequency of the target data;
When the access frequency based on the target data determines that the data type belonging to the target data changes
When, update the data type belonging to the target data.
Preferably, when the access frequency based on the target data determines that the data type belonging to the target data is sent out
After changing, further include:
Based on the current affiliated target data type of the target data, the target data is transferred to and the target
In the corresponding caching of data type.
Preferably, further include:
Monitor whether current residual space in first caching and the second caching is less than preset value respectively;
If current residual space is less than preset value in first caching, chosen at least from first buffer area
Partial data is migrated to second caching;
If current residual space is less than preset value in second caching, chosen at least from second buffer area
Partial data is migrated to first caching.
Preferably, further include:
Based on the digital independent frequency of first caching and the second caching, the first adjustment amount of first caching is determined
With the second adjustment amount of the second buffer area;
According to the first adjustment amount, the spatial cache size of adjustment first caching;
According to the second adjustment amount, the spatial cache size of adjustment second caching.
On the other hand, present invention also provides a kind of data storage devices, are applied to solid-state hard disk SSD, described device packet
It includes:
Data capture unit, for obtaining current target data to be written;
Determination unit is cached, for if it is determined that the target data is the data for needing to cache, then from the first caching
In the second caching, the target cache for storing the target data is determined, wherein first caching is in host memory
Preset buffer area, second caching are the intrinsic caching in the SSD;
Data write unit, for caching the target data to the target cache.
Preferably, the caching determination unit, including:
Type determination unit, for determining the data type belonging to the target data, the data type includes the
One categorical data and Second Type data, the first kind data estimate access frequency more than the Second Type data
Estimate access frequency;
First caching subelement, for when the target data is first kind data, first caching to be determined
For target cache;
Second caching subelement, for when the target data is Second Type data, second caching to be determined
For target cache.
Preferably, further include:
Frequency statistics unit, for the data write unit by the target data cache to the target cache it
Afterwards, the access frequency of the target data is counted;
Type changing unit, for being determined belonging to the target data when the access frequency based on the target data
When data type changes, the data type belonging to the target data is updated.
Preferably, further include:
Data transfer unit, for determining that the data type belonging to the target data is sent out in the type changing unit
After changing, based on the target data it is current belonging to target data type, by the target data be transferred to it is described
In the corresponding caching of target data type.
Preferably, further include:
Space monitoring unit, for monitoring whether current residual space in first caching and the second caching is less than respectively
Preset value;
First migration units, if being less than preset value for current residual space in first caching, from described the
Chosen in one buffer area at least partly Data Migration to it is described second caching;
Second migration units, if being less than preset value for current residual space in second caching, from described the
Chosen in two buffer areas at least partly Data Migration to it is described first caching.
Preferably, further include:
Adjustment amount determination unit, for based on it is described first caching and second caching digital independent frequency, determine described in
The second adjustment amount of the first adjustment amount and the second buffer area of first caching;
The first adjustment unit, for according to the first adjustment amount, the spatial cache size of adjustment first caching;
Second adjustment unit, for according to the second adjustment amount, the spatial cache size of adjustment second caching.
On the other hand, present invention also provides a kind of solid state disks, including:
Controller and the second caching;
Wherein, the controller, for obtaining current target data to be written;If it is determined that the target data is
The data cached are needed, then from the first caching and second caching, determine that the target for storing the target data is slow
It deposits;The target data is cached to the target cache;Wherein, first caching is preset caching in host memory
Area.
Preferably, the controller determines the mesh for storing the target data from the first caching and the second caching
Mark caching, specially:
The controller determines that the data type belonging to the target data, the data type include first kind data
With the access frequency of estimating of Second Type data, the first kind data access frequency is estimated more than the Second Type data
Rate;When the target data is first kind data, first caching is determined as target cache;When the target data
For Second Type data when, by it is described second caching be determined as target cache.
Preferably, the controller is additionally operable to:It is cached to the target cache by the target data, counts institute
State the access frequency of target data;When the access frequency based on the target data determines the data belonging to the target data
When type changes, the data type belonging to the target data is updated.
Preferably, the controller is additionally operable to:When the access frequency based on the target data determines the number of targets
After changing according to affiliated data type, based on the current affiliated target data type of the target data, by the mesh
Mark data are transferred in caching corresponding with the target data type.
Preferably, the controller is additionally operable to:Current residual space in first caching and the second caching is monitored respectively
Whether preset value is less than;If current residual space is less than preset value in first caching, from first buffer area
Choose at least partly Data Migration to it is described second caching;If current residual space is less than preset value in second caching,
Then chosen from second buffer area at least partly Data Migration to it is described first caching.
Preferably, the controller is additionally operable to:Based on the digital independent frequency of first caching and the second caching, determine
The second adjustment amount of the first adjustment amount and the second buffer area of first caching;According to the first adjustment amount, described in adjustment
The spatial cache size of first caching;According to the second adjustment amount, the spatial cache size of adjustment second caching.
It can be seen via above technical scheme that get current target data to be written be when data cached, then from
Target cache is determined in first caching and the second caching, and the target data is cached to the target cache, due to the first caching
For preset buffer area in host memory, and the second caching is caching intrinsic in the SSD, and therefore, target data can basis
Need to store buffer area intrinsic in preset buffer area either SSD in host memory, to using in host memory
Buffer area, realize to SSD be used for data cached spatial cache extension, the available spatial caches of SSD are increased, to have
Conducive to the storage performance of raising SSD.
Specific implementation mode
The embodiment of the present application provides a kind of date storage method and device, using the partial memory in host as SSD
Caching improve the storage performance of SSD to extend the spatial cache of SSD.
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
A kind of date storage method of the application is introduced first.
Referring to Fig. 1, it illustrates a kind of flow diagram of date storage method one embodiment of the application, the present embodiment
Method can be applied to solid-state hard disk SSD, this method may include:
101, obtain current target data to be written.
Wherein, the process of the current target data to be written of SSD acquisitions can be similar to existing mode, as SSD is obtained
The target data to be written of processor transmission.
102, if it is determined that it is the data for needing to cache to go out the target data, then from the first caching and the second caching, really
The fixed target cache for storing the target data.
Wherein, which is preset buffer area in host memory, which is intrinsic slow in the SSD
It deposits.
Unlike existing, in the present embodiment, which can operate the spatial cache accessed in other words actually
There are two parts, a caching is spatial cache intrinsic in the SSD, that is, the caching is current SSD data cached used, and position
Spatial cache inside the SSD;Another caching is preset buffer area in host memory, which is the host memory
A part of space.For the ease of distinguishing, in the embodiment of the present application, by the preset buffer memory in the addressable host memories of SSD
Area is known as the first caching, and by inherently caching is known as the second caching in the SSD.
The part of cache of host memory is extended to the available cachings of the SSD in the embodiment of the present application, to be conducive to
Improve the caching performance of SSD.
In practical applications, SSD is got after the target data cached, can be from the first caching and the second caching, really
Fixed one is currently used in the caching for storing the target data, to store the target data to the caching determined.In order to
Convenient for distinguishing, the caching for being stored to the target data in the first caching and the second caching is known as target cache.
It is understood that after getting target data to be determined, determine what whether the target data needed to cache
Mode equally can be similar to existing mode, if target data is according to the difference of access frequency or the purposes of target data
Difference, then the storage mode for being directed to the target data may be different, and e.g., data necessary to being run for processor are then
It may need to be buffered, and the data that some are not frequently used then are not necessarily to caching.
103, which is cached to the target cache.
In the embodiment of the present application, it is then to delay from first when data cached to get current target data to be written
It deposits and determines target cache in the second caching, and the target data is cached to the target cache, since the first caching is host
Preset buffer area in memory, and the second caching is caching intrinsic in the SSD, therefore, target data can deposit as needed
Buffer area intrinsic in preset buffer area either SSD in host memory is stored up, to utilize the caching in host memory
Area realizes the extension for being used for data cached spatial cache to SSD, the available spatial caches of SSD is increased, to be conducive to carry
The storage performance of high SSD.
It should be noted that in the application any one embodiment, preset buffer area can be managed in the host memory
Solution is the space that can be accessed by the SSD reserved in the host memory, and the space which reserves can not be led again
Machine acts on memory.Specifically, by the BIOS program of host area reporting can will be specified in memory during opening host
To the host, which does not include the preset buffer area, then after host-initiated, can only be used only in the memory
Specified region, without using the preset buffer area in memory.
It is understood that determining the target cache for storing the target data from the first caching and the second caching
Mode can there are many.
In one possible implementation, SSD can determine target cache at random.
In alternatively possible realization method, SSD can be according to first caching and the second caching current residual
The size in available cache memory space determines the target cache for being currently used in and storing the target data.Such as, the original based on load balancing
Reason chooses remaining available cache memory space the greater, as the target cache from the first caching and the second caching.
It is, of course, also possible to there are other to determine the mode of target cache, it is equally applicable to the application.
Below in the way of a kind of determining target cache for, describe in detail.Referring to Fig. 2, it illustrates the application
A kind of flow diagram of another embodiment of date storage method, the method for the present embodiment can be applied to solid-state hard disk SSD,
This method may include:
201, obtain current target data to be written.
202, if it is determined that it is the data for needing to cache to go out the target data, determines the data class belonging to the target data
Type.
Wherein, data type can characterize the accessed frequency of the data, which may include first kind number
According to Second Type data.The access frequency of estimating of first kind data estimates access frequency more than the Second Type data.
For SSD, some data are frequently necessary to be read, and some data then can't may often be read
It takes, and for the data often transferred, if the reading speed to such data is excessively slow, also influence whether electronic equipment
Data processing performance.Therefore, in the embodiment of the present application, target data to be stored is classified, with according to data type
Determine that target cache is arrived in storage needed for target storage.
203, when the target data is first kind data, the first caching is determined as target cache.
204, when the target data is Second Type data, which is determined as target cache.
Wherein, which is preset buffer area in host memory, which is intrinsic slow in the SSD
It deposits.
It is understood that the reading and writing data performance of the buffer area in host memory is higher than and is inherently cached in the SSD
Therefore reading and writing data performance if target data is the higher data of access frequency, illustrates that such data wants readwrite performance
It asks higher, the target data can be stored at this time into first caching;And other class data then can be stored directly
Into the second caching of the SSD.
It wherein, in the embodiment of the present application can be according to the data access frequency of storage record and preset data type
Corresponding access frequency determines the data type belonging to the target data;Can also be to preset belonging to different data
Data type.
205, which is cached to the target cache.
After determining target cache, can directly it store data into the target cache.
Optionally, since the first caching readwrite performance is higher than the readwrite performance of the second caching, when the target data is
When first kind data, the first data write rate can be based on, target data is written into first caching;And work as the mesh
When mark data are Second Type data, the second data write rate can be based on, the target data is written into the second caching,
Wherein, which is more than second data write rate.
Optionally, on the basis of embodiment shown in Fig. 2, after caching the target data to the target cache, also
May include:Count the access frequency of the target data.Then when the access frequency based on the target data determines the target
When data type belonging to data changes, the data type belonging to the target data is updated.
The access frequency of data is counted after storing target data, to determine the data class of target data
The change of type is conducive to the follow-up accurate data type for determining data to be stored, and from the first caching and the second caching, rationally
Determine store the target data buffer area.
Further, when the access frequency based on target data determines that the data type belonging to the target data becomes
After change, can also include:
Based on the current affiliated target data type of the target data, which is transferred to and the target data class
In the corresponding caching of type.
According to the variation of the data type of target data, dynamic adjustment stores the target cache of the target data, realizes
Dynamic is conducive to more reasonably distribute solid inside SSD using the fixed caching in preset buffer memory area in host memory and the SSD
There is the use of memory and host memory.
It is understood that in any of the above one embodiment, target data is stored specifically can be with to the first caching
Direct memory access (DMA, the Direct Memory Access) operation for borrowing host carries out data-moving, without warp
Cross host interface module.
And storing the target data to the second caching can be:Target data is stored to by host interface module
Two cachings..
Referring to Fig. 3, it illustrates a kind of flow diagram of another embodiment of date storage method of the application, this implementations
The method of example can be applied to solid-state hard disk SSD, and this method may include:
301, obtain current target data to be written.
302, if it is determined that it is the data for needing to cache to go out the target data, then from the first caching and the second caching, really
The fixed target cache for storing the target data.
Wherein, which is preset buffer area in host memory, which is intrinsic slow in the SSD
It deposits.
303, which is cached to the target cache.
Above step 301 to 303 may refer to the related introduction of any one embodiment of front, and details are not described herein.
304, based on first caching and second caching digital independent frequency, determine this first caching the first adjustment amount and
The second adjustment amount of second buffer area.
In the present embodiment according to the digital independent frequency of the first caching, to judge the current memory space of first caching
Whether disclosure satisfy that the corresponding digital independent frequency of the first caching, if the digital independent frequency of the first caching is higher, illustrates
Higher to the frequency of use of the first caching, the first buffer memory a large amount of data being often accessed.In order to adapt to digital independent
Demand then can suitably increase the spatial content of first caching, then the second adjustment amount can be that the first caching needs to increase
Memory space;Correspondingly, if the reading frequency of the first caching is relatively low, the storage that can suitably reduce first caching is empty
Between size.
It is similar for the second caching, can according to its digital independent frequency, come determine the need for increasing or decreasing this
The capacity of two cachings.
305, according to the first adjustment amount, adjust the spatial cache size of first caching.
First caching is adjusted based on the first adjustment amount, can be by the first adjustment amount and to first caching
The request that is adjusted of spatial cache size be sent to host, so as to host BIOS program after detecting host-initiated,
Reconfigure the capacity of first caching.
306, according to the second adjustment amount, adjust the spatial cache size of second caching.
Adjustment for second caching, then can reconfigure the size of the second caching, such as increase the appearance of the second caching
Amount, then can accordingly reduce the size of other memory spaces in SSD;Accordingly and, such as reduce the capacity of the second caching, then it can be corresponding
Increase the size of other memory spaces in SSD.
The present embodiment realizes the dynamic modification to the space size of the first caching and the second caching, is conducive to adapt to data
Access requirement.
Referring to Fig. 4, it illustrates a kind of flow diagram of another embodiment of date storage method of the application, this implementations
The method of example can be applied to solid-state hard disk SSD, and this method may include:
401, obtain current target data to be written.
402, if it is determined that it is the data for needing to cache to go out the target data, then from the first caching and the second caching, really
The fixed target cache for storing the target data.
Wherein, which is preset buffer area in host memory, which is intrinsic slow in the SSD
It deposits.
403, which is cached to the target cache.
Above step 401 to 403 may refer to the related introduction of any one embodiment of front, and details are not described herein.
404, monitor whether current residual space in the first caching and the second caching is less than preset value respectively.
Wherein, which can be set as needed, and the first caching and the corresponding preset value of the second caching can be with
It is identical to can also be different.
By the monitoring of this step, it can reduce due to the first caching and the second cache residual space deficiency and lead to data
Store abnormal situation.
405, if current residual space is less than preset value in first caching, chosen at least from first buffer area
Partial data is migrated to second caching.
406, if current residual space is less than preset value in second caching, chosen at least from second buffer area
Partial data is migrated to first caching.
It, can will be in one of caching if current residual space is less than preset value in the first caching or the second caching
In the Data Migration of storage to another caching.
It, can be according to the access frequency of data in the caching for the Data Migration in any one caching, it is determined whether
It will be in the Data Migration to another caching.
Such as, for by the Data Migration in the first caching to the second caching the case where, when the residue for detecting the first caching
When memory space is less than preset value, determine cached during current time first caches stored data estimate access frequency;Root
The sequence of access frequency from high to low is estimated according to the target data stored in target data storage region, by the finger of sequence rearward
The target data of fixed number amount is transferred in the second caching.
For another example, for by the Data Migration in the second caching to the first caching the case where, when detecting the surplus of the second caching
When remaining memory space is less than preset value, determine cached during current time second caches stored data estimate access frequency;
The sequence of access frequency from high to low is estimated according to the target data stored in target data storage region, it is forward by sorting
The target data of specified quantity is transferred in first caching.
A kind of date storage method of corresponding the application, the embodiment of the present application also provides a kind of data processing equipments.
Referring to Fig. 5, it illustrates a kind of structural schematic diagram of data storage device one embodiment of the application, the present embodiment
Device be applied to solid-state hard disk SSD, described device may include:
Data capture unit 501, for obtaining current target data to be written;
Determination unit 502 is cached, for if it is determined that the target data be to need the data that cache, then delaying from first
It deposits in the second caching, determines the target cache for storing the target data, wherein first caching is the host
Preset buffer area in memory, second caching are the intrinsic caching in the SSD;
Data write unit 503, for caching the target data to the target cache.
In the embodiment of the present application, it is then to delay from first when data cached to get current target data to be written
It deposits and determines target cache in the second caching, and the target data is cached to the target cache, since the first caching is host
Preset buffer area in memory, and the second caching is caching intrinsic in the SSD, therefore, target data can deposit as needed
Buffer area intrinsic in preset buffer area either SSD in host memory is stored up, to utilize the caching in host memory
Area realizes the extension for being used for data cached spatial cache to SSD, the available spatial caches of SSD is increased, to be conducive to carry
The storage performance of high SSD.
Referring to Fig. 6, it illustrates a kind of structural schematic diagram of another embodiment of data storage device of the application, this implementations
Device and the previous one embodiment of example the difference is that:
The caching determination unit 502, including:
Type determination unit 5021, for determining the data type belonging to the target data, the data type packet
First kind data and Second Type data are included, the access frequency of estimating of the first kind data is more than the Second Type number
According to estimate access frequency;
First caching subelement 5022, for when the target data is first kind data, described first to be cached
It is determined as target cache;
Second caching subelement 5023, for when the target data is Second Type data, described second to be cached
It is determined as target cache.
Optionally, the present embodiment can also include:
Frequency statistics unit, for the data write unit by the target data cache to the target cache it
Afterwards, the access frequency of the target data is counted;
Type changing unit, for being determined belonging to the target data when the access frequency based on the target data
When data type changes, the data type belonging to the target data is updated.
Further, the device of the present embodiment can also include:
Data transfer unit, for determining that the data type belonging to the target data is sent out in the type changing unit
After changing, based on the target data it is current belonging to target data type, by the target data be transferred to it is described
In the corresponding caching of target data type.
Optionally, in the embodiment of one device of any of the above, which can also include:
Space monitoring unit, for monitoring whether current residual space in first caching and the second caching is less than respectively
Preset value;
First migration units, if being less than preset value for current residual space in first caching, from described the
Chosen in one buffer area at least partly Data Migration to it is described second caching;
Second migration units, if being less than preset value for current residual space in second caching, from described the
Chosen in two buffer areas at least partly Data Migration to it is described first caching.
Optionally, in the embodiment of one device of any of the above, which can also include:
Adjustment amount determination unit, for based on it is described first caching and second caching digital independent frequency, determine described in
The second adjustment amount of the first adjustment amount and the second buffer area of first caching;
The first adjustment unit, for according to the first adjustment amount, the spatial cache size of adjustment first caching;
Second adjustment unit, for according to the second adjustment amount, the spatial cache size of adjustment second caching.
On the other hand, present invention also provides a kind of solid state disks.
Referring to Fig. 7, it illustrates a kind of structural schematic diagram of solid state disk one embodiment of the application, the present embodiment is consolidated
State hard disk 70 may include:
The caching of controller 701 and second 702;
Wherein, the controller 701, for obtaining current target data to be written;If it is determined that the number of targets
According to need the data cached, then from the first caching 801 and second caching 702, determine for storing the number of targets
According to target cache;The target data is cached to the target cache;Wherein, first caching is pre- in host memory
If buffer area.
It is understood that the solid state disk can also include storage medium, which can be flash memory.
Wherein, the controller of the solid state disk and the first caching of the host memory can pass through host interface module phase
Even,
Optionally, the controller determines the mesh for storing the target data from the first caching and the second caching
Mark caching, specially:
The controller determines that the data type belonging to the target data, the data type include first kind data
With the access frequency of estimating of Second Type data, the first kind data access frequency is estimated more than the Second Type data
Rate;When the target data is first kind data, first caching is determined as target cache;When the target data
For Second Type data when, by it is described second caching be determined as target cache.
Optionally, the controller is additionally operable to:It is cached to the target cache by the target data, counts institute
State the access frequency of target data;When the access frequency based on the target data determines the data belonging to the target data
When type changes, the data type belonging to the target data is updated.
Further, the controller can be also used for:Described in being determined when the access frequency based on the target data
It, will based on the current affiliated target data type of the target data after data type belonging to target data changes
The target data is transferred in caching corresponding with the target data type.
Optionally, the controller is additionally operable to:Current residual space in first caching and the second caching is monitored respectively
Whether preset value is less than;If current residual space is less than preset value in first caching, from first buffer area
Choose at least partly Data Migration to it is described second caching;If current residual space is less than preset value in second caching,
Then chosen from second buffer area at least partly Data Migration to it is described first caching.
Optionally, the controller is additionally operable to:Based on the digital independent frequency of first caching and the second caching, determine
The second adjustment amount of the first adjustment amount and the second buffer area of first caching;According to the first adjustment amount, described in adjustment
The spatial cache size of first caching;According to the second adjustment amount, the spatial cache size of adjustment second caching.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other
The difference of embodiment, just to refer each other for identical similar portion between each embodiment.For device disclosed in embodiment
For, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related place is said referring to method part
It is bright.
The foregoing description of the disclosed embodiments enables professional and technical personnel in the field to realize or use the application.
Various modifications to these embodiments will be apparent to those skilled in the art, as defined herein
General Principle can in other embodiments be realized in the case where not departing from spirit herein or range.Therefore, the application
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest range caused.