Background technology
When data move on memory device because the existence of disk partition, can be divided into stride subregion move with subregion in move:
Stride subregion and move, be meant data are moved to another subregion from a subregion; For bottom, be that (Logical Block Address LBA) moves to another logical address, or data are moved to another group logical address from one group of logical address from a logical address with data.
Move in the subregion, have two kinds of situation: a kind of is that data still leave original logical address in, only through revising the file allocation table or the similar data structure on upper strata, realizes moving of data or file, for example the shearing manipulation of file between different directories; Another kind is that data move to the different logical address, for example, the disk fragments arrangement function that WINDOWS provides, it can force data are moved between the different logical address.
Because there are constant basically unique corresponding relation in conventional hard logical address and physical address, therefore, data moving between logical address, corresponding bottom layer realization is data moving between physical address.
When data move between physical address, at first need data be read from source address, be kept in the buffer memory or Installed System Memory of hard disk; Carry out data write operation then, data are written to destination address, thereby accomplish moving of data.
At present for the moving of data between the Different Logic address in the solid-state hard attitude, also be adopt and above-mentioned conventional hard in the similar method of data mobile phase between logical address.
The inventor is in realizing process of the present invention, and it is following not enough to find that above-mentioned prior art exists:
When data move between the Different Logic address, exist data to read and ablation process, take more I/O (Input/Output, I/O) resource; It is also longer that command execution is accomplished the required time, especially under the bigger situation of the data that move; And have the memory device of age limit to some, for example FLASH memory device (flash memory) can increase its loss, influences serviceable life.
Summary of the invention
The purpose of the embodiment of the invention is to provide a kind of solid-state hard disk data management method and equipment; In order to realize the fast moving of solid state hard disc data between the Different Logic address; Reduce the I/O resource occupation, improve command execution speed, reduce the loss of solid state hard disc read/write, prolong solid state hard disc serviceable life.
For realizing above-mentioned purpose, the embodiment of the invention provides a kind of solid-state hard disk data management method, and this method comprises:
Through logical address of searching said solid state hard disc and the mapping relations table that is stored in the physical address of the data in the said solid state hard disc; Obtain the dynamic mapping relationship of physical address of logical address and the said data of said solid state hard disc; Said mapping relations table comprises the value of element entry and element entry; Said element entry comprises the logical address of said solid state hard disc, and the value of said element entry is and the logical address of the said solid state hard disc physical address of mapped data mutually; When obtaining said dynamic mapping relationship, at first according to the logical address of said solid state hard disc, find element entry corresponding in the said mapping relations table, and then search the value of the corresponding element entry of this element entry;
Value through exchanging element entry in the said mapping relations table is revised said dynamic mapping relationship, carries out moving of said data between logical address.
For realizing above-mentioned purpose, the embodiment of the invention provides a kind of solid-state hard disk data management equipment, and this equipment comprises:
Acquisition module; The mapping relations table that is used for logical address and the physical address of the data that are stored in said solid state hard disc through searching said solid state hard disc; Obtain the dynamic mapping relationship of physical address of logical address and said data of the data of said solid state hard disc; Said mapping relations table comprises the value of element entry and element entry, and said element entry comprises the logical address of said solid state hard disc, and the value of said element entry is and the logical address of the said solid state hard disc physical address of mapped data mutually; When obtaining said dynamic mapping relationship, at first according to the logical address of said solid state hard disc, find element entry corresponding in the said mapping relations table, and then search the value of the corresponding element entry of this element entry;
Modified module is used for revising said dynamic mapping relationship through the value that exchanges said mapping relations table element entry, carries out the moving of said data between logical address.
The beneficial effect of the embodiment of the invention is, during mobile in carrying out solid state hard disc between data logical address, obtains the logical address and the dynamic mapping relationship that is stored in the physical address of the data in the said solid state hard disc of said solid state hard disc earlier; Again through revising said dynamic mapping relationship; Carry out the moving of said data between logical address; With realize that through reading the technical scheme that data move compares between the Different Logic address in the prior art with ablation process, the embodiment of the invention realizes the fast moving of data between logical address in the solid state hard disc through revising dynamic mapping relationship; Reducing data reads and write operation; Have that the I/O of taking resource is little, command execution advantage fast, and can effectively reduce the read/write loss of solid state hard disc, prolong the serviceable life of solid state hard disc.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, the embodiment of the invention is further elaborated below in conjunction with Figure of description.At this, illustrative examples of the present invention and explanation thereof are used to explain the present invention, but not as to qualification of the present invention.
Embodiment one
The inventor considers that for conventional hard, logical address is corresponding with well-determined physical address, under the normal condition not in time or reading and writing data and changing; But; For solid state hard disc, different with conventional hard is, because the requirement of bad block management and wear leveling; Its logical address is dynamic changes with the mapping relations of the physical address of the data of storing; Therefore, present embodiment is through the logical address of revising solid state hard disc and the dynamic mapping relationship that is stored in the physical address of the data in the said solid state hard disc, and then the fast moving of data between logical address in the realization solid state hard disc.
As shown in Figure 1, the solid-state hard disk data management method flow process in the present embodiment can comprise:
Step 101, the logical address of obtaining said solid state hard disc and the dynamic mapping relationship that is stored in the data physical address in the said solid state hard disc.
Step 102, through revising said dynamic mapping relationship, carry out the moving of said data between logical address.
Flow process shown in Figure 1 need not to carry out that data are read and write operation; Can realize the fast moving of data between logical address in the solid state hard disc through revising said dynamic mapping relationship; Actual physical does not take place and moves in data during enforcement on solid state hard disc; For constant data physical address, data have realized moving between the different logical address, have that the I/O of taking resource is little, a command execution advantage fast; And can effectively reduce the read/write loss of solid state hard disc, prolong the serviceable life of solid state hard disc.
Embodiment two
Present embodiment carries out further detailed explanation to flow process shown in Figure 1.
In the present embodiment, in the mapping relations table of the logical address that the dynamic mapping relationship of the logical address of solid state hard disc and the physical address of data can be stored in solid state hard disc and the physical address of the data of storing, can obtain this dynamic mapping relationship through tabling look-up; Perhaps; The dynamic mapping relationship of the logical address of solid state hard disc and the physical address of data also can be the logical address of solid state hard disc and the transfer function of the physical address of the data of storing, and promptly can the logical address of solid state hard disc and the physical address of the data of storing be shone upon through this transfer function; When obtaining dynamic mapping relationship, aforementioned mode of tabling look-up with transfer function can be used separately, also can be used in combination.Certainly; When the physical address of the logical address of solid state hard disc and the data of storing shines upon; Alternate manner can also be arranged,, repeat no more here as long as the physical address of the logical address that can realize solid state hard disc and storage data is corresponding one by one and the mapping relations of the two can be modified.
Dynamic mapping relationship with the logical address of obtaining solid state hard disc through tabling look-up and the physical address of the data of being stored is an example below, the practical implementation of description of step 101.
As shown in Figure 2, suppose that the solid state hard disc of storage data has N+1 physical address; The mapping relations table that is used for dynamic mapping relationship between the physical address of logical address and data of this solid state hard disc has N+1 item element entry; Element entry comprises the logical address of solid state hard disc, and the value of element entry is and the logical address of the solid state hard disc physical address of mapped data mutually.When searching the dynamic mapping relationship of physical address of logical address and data of solid state hard disc,, find the element entry X in the mapping relations table at first according to the logical address X of solid state hard disc; And then the value of searching the corresponding element entry of element entry X, can see that from Fig. 2 the value of the element entry that element entry X is corresponding is 0, the physical address of the data that then the logical address X of solid state hard disc is corresponding is 0.
In the enforcement, when revising the dynamic mapping relationship of physical address of logical address and data of solid state hard disc, can revise and the solid state hard disc logical address physical address of mapped data mutually; Certainly; Also can revise the solid state hard disc logical address of shining upon mutually, as long as can make the dynamic mapping relationship of physical address of logical address and the data of solid state hard disc change, realize data moving between the Different Logic address with the physical address of data.
Dynamic mapping relationship is an example in the mapping relations table to revise below, the practical implementation of description of step 102.
Through the value of element entry in the change mapping relations table, can a certain logical address be mapped to any physical address of solid state hard disc.Through the value of element entry in the exchange mapping relations table, realize the change of solid state hard disc logical address and data physical address dynamic mapping relationship in this example.That is to say, the solid state hard disc of bottom, the value of two element entries in the exchange mapping relations table, for the operating system on upper strata, exchange has taken place in two corresponding data of logical address.
Act one is for example shown in Figure 3, and logical address L1 maps to physical address D1, and logical address L2 maps to physical address D2; Through the value of the element entry among logical address L1 and the logical address L2 in the exchange mapping relations table, logical address L1 maps to physical address D2, and logical address L2 maps to physical address D1.Be valid data if physical address D1, physical address D2 deposit, what aforesaid operations was realized is the exchanges of data between the Different Logic address; If among the physical address D1, physical address D2 wherein one be blank block, what then realize is the mobile of data.
When step 102 is implemented; Whether the target disk subregion of the solid state hard disc that also can first specified data moves has enough remaining spaces (for example having free sector enough, that be not used); When the target disk subregion of confirming solid state hard disc has enough remaining spaces; Just revise the logical address of solid state hard disc and the dynamic mapping relationship of the physical address of the data of storing, can improve the success ratio that data move like this, the situation of loss of data takes place when avoiding data to move.
In the enforcement, before step 101 is carried out, can also comprise: (Advanced Technology Attachment ATA) orders data sent to move notice through self-defined Advanced Technology Attachment to receive main frame; Then when step 101 is carried out, can move notice, obtain the logical address of solid state hard disc and the dynamic mapping relationship of the physical address of the data of storing according to these data.Here main frame sends data through self-defined ata command and moves notice, is to consider in the existing ATA standard, and still therefore the related command that moves of no datat can be used for the transmission that data move notice by self-defined ata command in the present embodiment.
In the enforcement; The host notification solid state hard disc is mobile data between the Different Logic address, can realize through the mode of aforementioned self-defined ata command, but also can realize the interface or the agreement of solid state hard disc transmitting control commands through other; FC (Fiber Channel for example; Optical-fibre channel), SCSI (Small Computer System Interface, small computer system interface), USB interface or agreements such as (Universal Serial BUS, USBs).
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Described program can be stored in the computer read/write memory medium; This program is when carrying out; Can comprise all or part of step in the foregoing description method, described storage medium can comprise: ROM, RAM, disk, CD etc.
Based on same inventive concept, a kind of solid-state hard disk data management equipment also is provided in the embodiment of the invention, of following embodiment three.Because the principle that this memory device is dealt with problems is similar with solid-state hard disk data management method, so the enforcement of this equipment can repeat part and repeat no more referring to the enforcement of method.
Embodiment three
The structure of solid-state hard disk data management equipment is as shown in Figure 4 in the present embodiment, can comprise:
Acquisition module 401 is used for obtaining the dynamic mapping relationship of logical address and the physical address of the data that are stored in said solid state hard disc of the data of said solid state hard disc;
Modified module 402 is used for through revising said dynamic mapping relationship, carries out the moving of said data between logical address.
As shown in Figure 5, equipment shown in Figure 4 in the enforcement can also comprise:
Receiver module 403 is used to receive main frame and moves notice through self-defined ata command data sent;
Then this moment, acquisition module 401 can also be used for moving notice according to said data, obtains said dynamic mapping relationship.
In the enforcement; Acquisition module 401 can also be used for the mapping relations table through the physical address of logical address of searching said solid state hard disc and said data; And/or the transfer function of the logical address of said solid state hard disc and the physical address of said data obtains said dynamic mapping relationship.
In the enforcement, modified module 402 can also be used for when the target disk subregion of confirming the said solid state hard disc that said data move has enough remaining spaces, revising said dynamic mapping relationship.
In the enforcement, modified module 402 can also be used to revise the physical address of said solid state hard disc of the logical address mapping of said data.
Can learn by the foregoing description, in the embodiment of the invention, in carrying out solid state hard disc, during data mobile between logical address, obtain the logical address and the dynamic mapping relationship that is stored in the physical address of the data in the said solid state hard disc of said solid state hard disc earlier; Again through revising said dynamic mapping relationship; Carry out the moving of said data between logical address; With realize that through reading the technical scheme that data move compares between the Different Logic address in the prior art with ablation process; The embodiment of the invention only can realize the fast moving of data between logical address in the solid state hard disc through revising dynamic mapping relationship, and need not to carry out that data are read and write operation, has that the I/O of taking resource is little, a command execution advantage fast; And can effectively reduce the read/write loss of solid state hard disc, prolong the serviceable life of solid state hard disc.
Embodiment of the invention method and apparatus can be applied to the other technologies field equally.Realize that for existing the design that similar mapping relations and mapping relations can dynamic change the embodiment of the invention all has certain application value.
Above-described specific embodiment; The object of the invention, technical scheme and beneficial effect have been carried out further explain, and institute it should be understood that the above is merely specific embodiment of the present invention; And be not used in qualification protection scope of the present invention; All within spirit of the present invention and principle, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.