CN107229414A - Memory space recovery method and device - Google Patents

Memory space recovery method and device Download PDF

Info

Publication number
CN107229414A
CN107229414A CN201610175965.3A CN201610175965A CN107229414A CN 107229414 A CN107229414 A CN 107229414A CN 201610175965 A CN201610175965 A CN 201610175965A CN 107229414 A CN107229414 A CN 107229414A
Authority
CN
China
Prior art keywords
segment
data
chained list
target
identification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610175965.3A
Other languages
Chinese (zh)
Other versions
CN107229414B (en
Inventor
曾凡丽
林鹏
林起芊
汪渭春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201610175965.3A priority Critical patent/CN107229414B/en
Publication of CN107229414A publication Critical patent/CN107229414A/en
Application granted granted Critical
Publication of CN107229414B publication Critical patent/CN107229414B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks

Landscapes

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

Abstract

The embodiments of the invention provide memory space recovery method and device.Wherein, this method includes:When meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, to be recycled to be designated:To with full block identification and space availability ratio less than the mark set by the data block of predetermined utilization rate threshold value;Generation takes section chained list and free segment chained list, and free segment chained list includes:With the segment identification deleted corresponding to the data segment of mark, taking section chained list includes:The segment identification corresponding to the data segment of predetermined occupancy condition is met, predetermined occupancy condition is:Do not have and delete mark and section start offset is more than free segment chained list and covers minimum value in the section start offset of data segment;Based on free segment chained list and occupancy section chained list, Data Migration in block is performed to target data block;The target data block that Data Migration in block is finished is updated to the data block of space reclamation completion.By scheme, the amount of movement that can reduce data is larger and improve utilization ratio of storage resources.

Description

Memory space recovery method and device
Technical field
The present invention relates to space reclamation technical field, more particularly to memory space recovery method and device.
Background technology
Data storage is one of principal mode of data processing, wherein, certain form of data are according to data block Stored, for example:Video monitoring data etc..And in the case of by data block data storage for, Carried out in data block after business processing, cavity more or less occurs, be particularly to add WriteMode (i.e. When writing data, skew since using at the end of space write data backward) stored when, for once Full data block (the full block) through writing, even if there is partial data content to be deleted in block, these deleted numbers It can not be reused according to the space shared by content, so as to cause the wasting of resources.In order that memory space is obtained Make full use of, it is necessary to carry out memory space recovery.
Existing memory space recovery method is when carrying out memory space recovery, it is necessary to account in units of data block Data Migration is completed with the memory space of another data block.Although prior art realizes memory space Reclaim, but be due to need to take additional storage space, so that the amount of movement of data is larger and storage is provided Source utilization rate is relatively low.
The content of the invention
The purpose of the embodiment of the present invention is to provide memory space recovery method and device, to solve prior art Existing data amount of movement is larger and the problem of relatively low utilization ratio of storage resources.Concrete technical scheme is as follows:
In a first aspect, the embodiments of the invention provide a kind of memory space recovery method, including:
When meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, wherein, It is described to be recycled to be designated:Data to being less than predetermined utilization rate threshold value with full block identification and space availability ratio Mark set by block, the full block identification is:It is less than the number of minimum data bag unit to available free capacity According to the mark set by block, the available free capacity is:The capacity in the space of data can be write;
Occupancy section chained list and the free segment chained list corresponding to the target data block are generated, wherein, the target Data block includes the multiple data segments formed based on data storage operations and/or data deletion action, the sky Not busy section chained list includes:There is the segment identification corresponding to the data segment for deleting mark, institute in the target data block Stating occupancy section chained list includes:The section corresponding to the data segment of predetermined occupancy condition is met in the target data block Identify, the predetermined occupancy condition is:There is no deletion mark and section start offset is more than the free segment chain Table covers the minimum value in the section start offset of data segment, and the deletion is designated:To being deleted data Data segment set by mark;
Based on the free segment chained list and occupancy section chained list, data in block are performed to the target data block Migration;
The target data block that Data Migration in block is finished is updated to the data block of space reclamation completion.
Optionally, the occupancy section chained list and free segment chained list corresponding to the generation target data block, bag Include:
The rule of section start offset ascending sort is closed according to segment identifier in chained list, the target data block is built Corresponding occupancy section chained list and free segment chained list;
It is described to be based on the free segment chained list and occupancy section chained list, the target data block is performed in block Data Migration, including:
From the free segment chained list, selection belongs to the segment identification of current chained list starting point as pending Target segment identification;
Based on segment mark in the space size of data segment corresponding to the target segment identification and occupancy section chained list Know the space size of corresponding data segment, perform the data for being directed to data segment corresponding to the target segment identification Migration;
After being finished and being directed to the Data Migration of data segment corresponding to the target segment identification, judge described Take section chained list and currently whether there is segment identification, if it is, return described in execution from the free segment chained list, Selection belongs to the step of segment identification of current chained list starting point is as pending target segment identification.
Optionally, it is described based on the free segment chained list and occupancy section chained list, to the target data block Data Migration in block is performed, including:
The rule of section start offset ascending sort is closed according to segment identifier in chained list, the free segment chain is initialized Table and occupancy section chained list;
From the free segment chained list, selection belongs to the segment identification of current chained list starting point as pending Target segment identification;
Based on segment mark in the space size of data segment corresponding to the target segment identification and occupancy section chained list Know the space size of corresponding data segment, perform the data for being directed to data segment corresponding to the target segment identification Migration;
After being finished and being directed to the Data Migration of data segment corresponding to the target segment identification, judge described Take section chained list and currently whether there is segment identification, if it is, it is described according to segment identifier in chained list to return to execution The rule of section start offset ascending sort is closed, the step of the free segment chained list and occupancy section chained list is initialized Suddenly.
Optionally, it is described based on the space size of data segment corresponding to the target segment identification and occupancy section The space size of data segment corresponding to segment identification in chained list, execution is directed to number corresponding to the target segment identification According to the Data Migration of section, including:
It whether there is at least one for meeting predetermined transition condition in the segment identification for judging the occupancy section chained list Segment identification, wherein, the predetermined transition condition is:The space size of corresponding data segment is equal to the target The space size of data segment corresponding to segment identification, or, the space size of the combined segment of corresponding data segment Equal to the space size of data segment corresponding to the target segment identification;
When judged result is to be, meet number corresponding at least one segment identification of predetermined transition condition by described Copy the deviation post of data segment corresponding to the target segment identification to according to the data content of section, copy is completed Afterwards, delete the target segment identification from the free segment chained list, and meet predetermined transition condition by described At least one segment identification is transferred in the free segment chained list from the occupancy section chained list;
When judged result is no, data segment corresponding to segment identification to be utilized in the occupancy section chained list is judged Whether space size is more than the space size of data segment corresponding to the target segment identification, if it is, will be described Data segment corresponding to segment identification to be utilized is divided into subdata section, and by the data content of subdata section successively It is copied to after the completion of the deviation post of data segment corresponding to the target segment identification, copy, from the occupancy section The mark to be utilized is deleted in chained list, the target segment identification is deleted from the free segment chained list, and Change after the section start offset of data segment corresponding to the target segment identification and to add the target segment identification again Enter the free segment chained list, wherein, the segment identification to be utilized belongs to current for described take in section chained list The segment identification of chained list starting point;
Otherwise, the data content of data segment corresponding to the segment identification to be utilized is copied to the target segment mark Know in corresponding data segment, after the completion of copy, the segment identification to be utilized is deleted from the occupancy section chained list Remove, the target segment identification is deleted from the free segment chained list, and it is right to change the target segment identification institute Answer after the section start offset of data segment and the target segment identification is rejoined into the free segment chained list.
Optionally, a kind of memory space recovery method that the embodiment of the present invention is provided also includes:
During execution is directed to the Data Migration of data segment corresponding to the target segment identification, if institute The address for stating data segment corresponding at least two segment identifications in free segment chained list is continuous, by described at least two Data segment corresponding to segment identification merges, and forms the new segment identification corresponding at least two segment identification, profit At least two segment identification in the free segment chained list is replaced with the new segment identification.
Optionally, a kind of memory space recovery method that the embodiment of the present invention is provided also includes:
During execution is directed to the Data Migration of data segment corresponding to the target segment identification, pin is obtained For the deletion instruction of the data segment in the target data block;
If the targeted data segment of instruction of deleting is copied, epicycle deletes instruction institute to described For data segment without reclaim;
If the section start offset for deleting the targeted data segment of instruction is more right than target segment identification institute Answer the section start offset of data segment big, then described delete is instructed into the segment identification of targeted data segment from described Section chained list is taken to be transferred in the space segment chained list;
If the section start offset for deleting the targeted data segment of instruction is more right than target segment identification institute Answer the section start offset of data segment small, epicycle is to the targeted data segment of instruction of deleting without reclaiming.
Optionally, the target data block that Data Migration in block is finished is updated to space reclamation completion Data block, including:
The full block identification for the target data block that Data Migration in block is finished and mark to be recycled are deleted, and Update the free space capacity and space availability ratio of the target data block.
Optionally, the target data block that Data Migration in block is finished is updated to space reclamation completion Data block before, methods described also includes:
The mark to be recycled of the target data block is revised as reclaiming mark;
The target data block that Data Migration in block is finished is updated to the data of space reclamation completion Block, including:
The full block identification for the target data block that Data Migration in block is finished and described reclaiming mark Delete, and update the free space capacity and space availability ratio of the target data block.
Optionally, it is described when meeting predetermined space recovery condition, it is determined that the number of targets with mark to be recycled According to block, including:
When detecting current system business I/O load less than intended service load value, it is determined that with to be recycled The target data block of mark.
Optionally, a kind of memory space recovery method that the embodiment of the present invention is provided also includes:
When detecting current system business I/O load not less than the intended service load value, terminate to reclaim Flow.
Optionally, the determination mode of the intended service load value includes:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
Optionally, it is described when meeting predetermined space recovery condition, it is determined that the number of targets with mark to be recycled According to block, including:
When system memory space utilization rate reaches predetermined utilization rate threshold value, it is determined that the mesh with mark to be recycled Mark data block.
Second aspect, the embodiments of the invention provide a kind of memory space retracting device, including:
Target data block determining module, for when meeting predetermined space recovery condition, it is determined that with to be recycled The target data block of mark, wherein, it is described to be recycled to be designated:To with full block identification and space availability ratio Less than the mark set by the data block of predetermined utilization rate threshold value, the full block identification is:Available free is held Amount is less than the mark set by the data block of minimum data bag unit, and the available free capacity is:It can write Enter the capacity in the space of data;
Chained list generation module, for generating occupancy section chained list and free segment chain corresponding to the target data block Table, wherein, the target data block includes what is formed based on data storage operations and/or data deletion action Multiple data segments, the free segment chained list includes:There is the data segment for deleting mark in the target data block Corresponding segment identification, the occupancy section chained list includes:Predetermined occupancy condition is met in the target data block Data segment corresponding to segment identification, the predetermined occupancy condition is:There is no deletion mark and section starting is inclined Move the minimum value covered more than the free segment chained list in the section start offset of data segment, the deletion mark For:To the mark being deleted set by the data segment of data;
Data Migration module in block, for based on the free segment chained list and occupancy section chained list, to described Target data block performs Data Migration in block;
Target data block processing module, the target data block for Data Migration in block to be finished is updated to The data block that space reclamation is completed.
Optionally, the chained list generation module includes:
Chained list generation unit, the rule for closing section start offset ascending sort according to segment identifier in chained list, Build occupancy section chained list and the free segment chained list corresponding to the target data block;
Data Migration module includes in described piece:
Target segment identification determining unit, for from the free segment chained list, the chained list that selection belongs to current to rise The segment identification of initial point is used as pending target segment identification;
Data migration unit, for based on the space size of data segment corresponding to the target segment identification and described The space size of data segment corresponding to segment identification in section chained list is taken, execution is directed to the target segment identification institute The Data Migration of corresponding data section;
First segment identification judging unit, for being directed to data corresponding to the target segment identification being finished After the Data Migration of section, judge that the occupancy section chained list currently whether there is segment identification, held if it is, returning The row target segment identification determining unit.
Optionally, Data Migration module includes in described piece:
Initialization unit, the free segment chained list and the occupancy are based on for Data Migration module in described piece Section chained list, performs in block before Data Migration to the target data block, section is closed according to segment identifier in chained list The rule of start offset ascending sort, initializes generated free segment chained list and occupancy section chained list;
Target segment identification determining unit, for from the free segment chained list, the chained list that selection belongs to current to rise The segment identification of initial point is used as pending target segment identification;
Data migration unit, for based on the space size of data segment corresponding to the target segment identification and described The space size of data segment corresponding to segment identification in section chained list is taken, execution is directed to the target segment identification institute The Data Migration of corresponding data section;
Second segment identification judging unit, for being directed to data corresponding to the target segment identification being finished After the Data Migration of section, judge that the occupancy section chained list currently whether there is segment identification, held if it is, returning The row initialization unit.
Optionally, the data migration unit includes:
Whether first takes section chained list judgment sub-unit, deposited in the segment identification for judging the occupancy section chained list Meeting at least one segment identification of predetermined transition condition, wherein, the predetermined transition condition is:It is corresponding The space size of data segment is equal to the space size of the data segment corresponding to the target segment identification, or, institute The space that the space size of the combined segment of corresponding data section is equal to data segment corresponding to the target segment identification is big It is small;
First processing subelement, during for being when judged result, meets predetermined transition condition extremely by described The data content of data segment copies data segment corresponding to the target segment identification to corresponding to a few segment identification Deviation post, after the completion of copy, delete the target segment identification from the free segment chained list, and by institute State and meet at least one segment identification of predetermined transition condition and be transferred to the free time from the occupancy section chained list In section chained list;
Second takes section chained list judgment sub-unit, for when judged result is no, judging the occupancy section chain Whether the space size of data segment corresponding to segment identification to be utilized is more than corresponding to the target segment identification in table The space size of data segment, if it is, triggering second processing subelement, otherwise, processing of triggering the 3rd are single Member;
The second processing subelement, for data segment corresponding to the segment identification to be utilized to be divided into subdata Section, and the data content of subdata section is copied to data segment corresponding to the target segment identification successively After the completion of deviation post, copy, the mark to be utilized is deleted from the occupancy section chained list, by the mesh Bid section mark is deleted from the free segment chained list, and changes the section of data segment corresponding to the target segment identification The target segment identification is rejoined into the free segment chained list after start offset, wherein, described to be utilized section It is designated the segment identification for belonging to current chained list starting point in the occupancy section chained list;
The 3rd processing subelement, for by the data content of data segment corresponding to the segment identification to be utilized Copy in data segment corresponding to the target segment identification, after the completion of copy, by the segment identification to be utilized from Delete, the target segment identification is deleted from the free segment chained list, and change in the occupancy section chained list The target segment identification is rejoined into institute after the section start offset of data segment corresponding to the target segment identification State free segment chained list.
Optionally, a kind of memory space retracting device that the embodiment of the present invention is provided also includes:
Segment identification merging module, for performing the data for being directed to data segment corresponding to the target segment identification During migration, if the address of data segment corresponding at least two segment identifications in the free segment chained list Continuously, data segment corresponding at least two segment identification is merged, forms at least two segment identifications institute Corresponding new segment identification, using the new segment identification replace in the free segment chained list described at least two Individual segment identification.
Optionally, a kind of memory space retracting device that the embodiment of the present invention is provided also includes:
Delete instruction and obtain module, for performing the number for being directed to data segment corresponding to the target segment identification During migration, the deletion instruction for the data segment being directed in the target data block is obtained;
First deletes instruction respond module, if carried out for the targeted data segment of instruction of deleting Copy, epicycle is to the targeted data segment of instruction of deleting without reclaiming;
Second deletes instruction respond module, if for the section starting for deleting the targeted data segment of instruction The section start offset of data segment corresponding to target segment identification described in deviation ratio is big, then described delete is instructed into institute's pin To the segment identification of data segment from the occupancy section chained list be transferred to the space segment chained list;
3rd deletes instruction respond module, if for the section starting for deleting the targeted data segment of instruction The section start offset of data segment corresponding to target segment identification described in deviation ratio is small, and epicycle deletes instruction institute to described For data segment without reclaim.
Optionally, the target data block processing module includes:
First object data block processing unit, for the target data block that finishes Data Migration in block Full block identification and mark to be recycled are deleted, and update the free space capacity and space profit of the target data block With rate.
Optionally, a kind of memory space retracting device that the embodiment of the present invention is provided also includes:
Mark change module, the target data block for Data Migration in block to be finished is updated to space and returned Before the data block harvested, the mark to be recycled of the target data block is revised as reclaiming mark;
The target data block processing module includes:
Second target data block processing unit, for the target data block that finishes Data Migration in block Full block identification and the mark that reclaims are deleted, and update the target data block free space capacity and Space availability ratio.
Optionally, the target data block determining module includes:
First object data block determining unit, for detecting current system business I/O load less than predetermined During traffic load values, it is determined that the target data block with mark to be recycled.
Optionally, a kind of memory space retracting device that the embodiment of the present invention is provided also includes:
End trigger module, for detecting current system business I/O load not less than the intended service During load value, terminate recovery process.
Optionally, the determination mode of the intended service load value includes:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
Optionally, the target data block determining module includes:
Second target data block determining unit, for reaching predetermined utilization rate threshold in system memory space utilization rate During value, it is determined that the target data block with mark to be recycled.
In the embodiment of the present invention, when meeting predetermined space recovery condition, it is determined that the mesh with mark to be recycled Mark data block;Generate occupancy section chained list and the free segment chained list corresponding to the target data block;Based on the free time Section chained list and occupancy section chained list, Data Migration in block is performed to the target data block;By Data Migration in block The target data block finished is updated to the data block of space reclamation completion.It can be seen that, this programme is to be recycled Data block, using Data Migration mode in block, needs to take the side of additional storage space relative to prior art For formula, the amount of movement of data can be reduced and utilization ratio of storage resources is improved.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to implementing The accompanying drawing used required in example or description of the prior art is briefly described, it should be apparent that, describe below In accompanying drawing be only some embodiments of the present invention, for those of ordinary skill in the art, do not paying On the premise of going out creative work, other accompanying drawings can also be obtained according to these accompanying drawings.
The first flow chart for the memory space recovery method that Fig. 1 is provided by the embodiment of the present invention;
Second of flow chart of the memory space recovery method that Fig. 2 is provided by the embodiment of the present invention;
The third flow chart for the memory space recovery method that Fig. 3 is provided by the embodiment of the present invention;
Target segment identification institute is directed in the memory space recovery method that Fig. 4 is provided by the embodiment of the present invention right Answer the flow chart of the Data Migration of data segment;
Data Migration schematic diagram in the block that Fig. 5 is provided by the embodiment of the present invention;
The first structural representation for the memory space retracting device that Fig. 6 is provided by the embodiment of the present invention;
Second of structural representation of the memory space retracting device that Fig. 7 is provided by the embodiment of the present invention;
The third structural representation for the memory space retracting device that Fig. 8 is provided by the embodiment of the present invention;
4th kind of structural representation of the memory space retracting device that Fig. 9 is provided by the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear Chu, it is fully described by, it is clear that described embodiment is only a part of embodiment of the invention, rather than Whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creation Property work under the premise of the every other embodiment that is obtained, belong to the scope of protection of the invention.
In order to solve, data amount of movement present in prior art is larger and utilization ratio of storage resources is relatively low asks Topic, the embodiments of the invention provide memory space recovery method and device, with by interior Data Migration mode come Reach the migration amount of reduction data and improve utilization ratio of storage resources.
The memory space recovery method provided first below the embodiment of the present invention is introduced.
It is emphasized that the executive agent for the memory space recovery method that the embodiment of the present invention is provided can be with For memory space retracting device, wherein, the memory space retracting device can be independently of responsible data storage Data-storage system, can also as be responsible for data storage data-storage system inside functional module, This is all rational.In addition, the data that the data block involved by the embodiment of the present invention is stored can be video Monitoring data, or other data, also, the write-in form of data block can add write-in, or, Other carry out the writing mode that cavity occurs after business processing in data block, wherein, so-called additional write-in Form is referred specifically to:When writing data, skew since using at the end of space write data backward.
As shown in figure 1, the memory space recovery method that the embodiment of the present invention is provided, can include following step Suddenly:
S101, when meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled;
Wherein, memory space retracting device can in real time or regularly detect whether that meeting predetermined space reclaims bar Part, and when meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, and then It is follow-up that memory space recovery is carried out to the target data block;Certainly, predetermined space recovery condition can be by data Storage system come in real time or timing detect, and detect meet predetermined space reclaim condition when, to the storage Space reclamation device sends trigger notice, and then, the memory space retracting device is after trigger notice is received The target data block with mark to be recycled is determined to perform, this is also rational.Wherein, the mark to be recycled Know and be:To with full block identification and space availability ratio less than the mark set by the data block of predetermined utilization rate threshold value Know, the full block identification is:Mark set by the data block of minimum data bag unit is less than to available free capacity Know, the available free capacity is:The capacity in the space of data can be write.It is understood that data block Space availability ratio be:The ratio of the space size for the data that are stored with and the gross space size of data segment;Also, Meet predetermined space reclaim condition when, the data block with mark to be recycled there may be it is multiple, for tool Have for each data block of mark to be recycled, it can be used as target data block, that is to say, that have The memory space recovery method that each data block of mark to be recycled is provided according to the embodiment of the present invention comes Realize that memory space is reclaimed.
It is emphasized that for memory space retracting device is independently of data-storage system:In one kind In implementation, data-storage system can monitor and record the available free capacity and sky of each data block Between utilization rate, and full block identification and mark to be recycled are set from the satisfactory data block of behavior, specifically, The monitoring of available free capacity and record, the monitoring of space availability ratio and record, the setting of full block identification and treat Reclaiming the setting of mark can be realized by one or more of data-storage system functional module;Another In kind of implementation, memory space retracting device with self monitor and can record the available free of each data block Capacity and space availability ratio, and full block identification and mark to be recycled are set from the satisfactory data block of behavior Know, or, each data that memory space retracting device can be monitored and recorded based on data-storage system Available free capacity and space availability ratio, set from the satisfactory data block of behavior full block identification and Mark to be recycled, this is all rational.And for memory space retracting device as data-storage system inside Functional module for:In one implementation, the memory space retracting device in data-storage system with Outer one or more functions module realizes monitoring and record, the prison of space availability ratio of available free capacity Survey and record, the setting of full block identification and the setting of mark to be recycled;In another implementation, data Memory space retracting device in storage system with self monitor and can record the available free of each data block Capacity and space availability ratio, and full block identification and mark to be recycled are set from the satisfactory data block of behavior Know, this is all rational.
It will be appreciated by persons skilled in the art that meeting premise of the mark to be recycled different from full block identification Under, the occurrence of mark to be recycled and full block identification can be set according to actual conditions, and the embodiment of the present invention exists This is not limited.Also, predetermined space reclaim condition there may be it is a variety of, in order to which scheme understands follow-up combination Specific embodiment is introduced.
S102, generates occupancy section chained list and the free segment chained list corresponding to the target data block;
, can be with order to realize Data Migration in block after the target data block with mark to be recycled is determined Generate occupancy section chained list and the free segment chained list corresponding to the target data block, and then two chained lists of later use To complete Data Migration in block.Wherein, the target data block includes deleting based on data storage operations and/or data Multiple data segments that division operation is formed, the free segment chained list includes:Have in the target data block and delete mark Segment identification corresponding to the data segment of knowledge, occupancy section chained list includes:Predetermined account for is met in the target data block With the segment identification corresponding to the data segment of condition, the predetermined occupancy condition is:Do not have and delete mark and section Begin to offset the minimum value covered more than the free segment chained list in the section start offset of data segment, deletion mark For:To the mark being deleted set by the data segment of data.
Wherein, due to some not there is no the data segment that the free time is not present before the data segment for deleting mark, does not have There is necessity of migration, therefore, set predetermined occupancy condition to include section start offset more than the free segment chained list Minimum value in the section start offset of covered data segment, unnecessary migration is avoided with this, so as to reduce The migration amount of data.For example:The data segment A that section start offset is 0 is first data in data block Section, it is assumed that data segment A, which does not have, deletes mark, then, in block during Data Migration, data segment A It need not be migrated.
It is understood that for a data block, can be written into repeatedly, will so generate many Individual data segment, it is similar, data can also be deleted, each position of data block can be located at by deleting part, Such as:Head or afterbody, so can also generate multiple data segments.Also, it is only for memory space retracting device Stand on for data-storage system, deleting mark can be returned by data-storage system sets itself or memory space Receiving apparatus sets itself, this is all rational;And belong to data-storage system for memory space retracting device In functional module for, delete mark can be beyond the memory space retracting device of data-storage system Other functional modules setting, can also be set by the memory space retracting device, this is all rational.Separately Outside, on the premise of the occurrence for deleting mark is met different from full block identification and mark to be recycled, delete The occurrence of mark is not limited herein.
S103, based on the free segment chained list and occupancy section chained list, data in block are performed to the target data block Migration;
, can be based on the free segment chained list and the occupancy after the free segment chained list and occupancy section chained list is generated Section chained list, Data Migration in block is performed to the target data block.
In order to which solution layout understands, subsequently in conjunction with specific embodiments to based on the free segment chained list and occupancy section Chained list, Data Migration in block is performed to the target data block and is described in detail.
S104, the target data block that Data Migration in block is finished is updated to the data of space reclamation completion Block.
After Data Migration is finished in block, the target data block that Data Migration in block is finished can be updated to The data block that space reclamation is completed, so that obtaining data-storage system can subsequently be carried out using the target data block Data storage operations.
In the embodiment of the present invention, when meeting predetermined space recovery condition, it is determined that the mesh with mark to be recycled Mark data block;Generate occupancy section chained list and the free segment chained list corresponding to the target data block;Based on the free time Section chained list and occupancy section chained list, Data Migration in block is performed to the target data block;By Data Migration in block The target data block finished is updated to the data block of space reclamation completion.It can be seen that, this programme is to be recycled Data block, using Data Migration mode in block, needs to take the side of additional storage space relative to prior art For formula, the amount of movement of data can be reduced and utilization ratio of storage resources is improved.
With reference to specific embodiment, the memory space recovery method provided the embodiment of the present invention is situated between Continue.
It is emphasized that the executive agent for the memory space recovery method that the embodiment of the present invention is provided can be with For memory space retracting device, wherein, the memory space retracting device can be independently of responsible data storage Data-storage system, can also as be responsible for data storage data-storage system inside functional module, This is all rational.In addition, the data that the data block involved by the present embodiment is stored can be video monitoring Data, or other data, also, the write-in form of data block can add write-in, or, its He carries out occurring after business processing the writing mode in cavity in data block.
As shown in Fig. 2 a kind of memory space recovery method, may include steps of:
S201, when meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled;
Wherein, memory space retracting device can in real time or regularly detect whether that meeting predetermined space reclaims bar Part, and when meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, and then It is follow-up that memory space recovery is carried out to the target data block;Certainly, predetermined space recovery condition can be by data Storage system come in real time or timing detect, and detect meet predetermined space reclaim condition when, to the storage Space reclamation device sends trigger notice, and then, the memory space retracting device is after trigger notice is received The target data block with mark to be recycled is determined to perform, this is also rational.Wherein, the mark to be recycled Know and be:To with full block identification and space availability ratio less than the mark set by the data block of predetermined utilization rate threshold value Know, the full block identification is:Mark set by the data block of minimum data bag unit is less than to available free capacity Know, the available free capacity is:The capacity in the space of data can be write.It is understood that data block Space availability ratio be:The ratio of the space size for the data that are stored with and the gross space size of data segment;Also, Meet predetermined space reclaim condition when, the data block with mark to be recycled there may be it is multiple, for tool Have for each data block of mark to be recycled, it can be used as target data block, that is to say, that have The memory space recovery method that each data block of mark to be recycled is provided according to the embodiment of the present invention comes Realize that memory space is reclaimed.
Specifically, in one implementation, it is described when meeting predetermined space recovery condition, it is determined that having The target data block of mark to be recycled, can include:
When system memory space utilization rate reaches predetermined utilization rate threshold value, it is determined that the mesh with mark to be recycled Mark data block.
Wherein, in this kind of implementation, predetermined utilization rate threshold value can be empirical value.
In another implementation, influence is brought on data service in order to avoid memory space is reclaimed, it is described When meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, can include:
When detecting current system business I/O load less than intended service load value, it is determined that with to be recycled The target data block of mark.Wherein, system business I/O load is business datum I/O throughput in the unit time.
Wherein, in this kind of implementation, further, current system business I/O load is being detected During not less than the intended service load value, terminate recovery process.
Specifically, the intended service load value can be empirical value, or, pass through certain calculation institute The value determined, for example, the determination mode of the intended service load value can include:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
For example, the scheduled time slot can be 24 hours, 48 hours, 72 hours etc., and occurrence can be with Set, do not limited herein according to actual conditions.Furthermore it is possible to gather scheduled time slot using prior art Interior system business I/O load.
It is emphasized that for memory space retracting device is independently of data-storage system:In one kind In implementation, data-storage system can monitor and record the available free capacity and sky of each data block Between utilization rate, and full block identification and mark to be recycled are set from the satisfactory data block of behavior, specifically, The monitoring of available free capacity and record, the monitoring of space availability ratio and record, the setting of full block identification and treat Reclaiming the setting of mark can be realized by one or more of data-storage system functional module;Another In kind of implementation, memory space retracting device with self monitor and can record the available free of each data block Capacity and space availability ratio, and full block identification and mark to be recycled are set from the satisfactory data block of behavior Know, or, each data that memory space retracting device can be monitored and recorded based on data-storage system Available free capacity and space availability ratio, set from the satisfactory data block of behavior full block identification and Mark to be recycled, this is all rational.And for memory space retracting device as data-storage system inside Functional module for:In one implementation, the memory space retracting device in data-storage system with Outer one or more functions module realizes monitoring and record, the prison of space availability ratio of available free capacity Survey and record, the setting of full block identification and the setting of mark to be recycled;In another implementation, data Memory space retracting device in storage system with self monitor and can record the available free of each data block Capacity and space availability ratio, and full block identification and mark to be recycled are set from the satisfactory data block of behavior Know, this is all rational.
It will be appreciated by persons skilled in the art that meeting premise of the mark to be recycled different from full block identification Under, the occurrence of mark to be recycled and full block identification can be set according to actual conditions.
S202, the rule of section start offset ascending sort is closed according to segment identifier in chained list, the number of targets is built According to the occupancy section chained list and free segment chained list corresponding to block;
After the target data block with mark to be recycled is determined, in order to realize Data Migration and guarantor in block The data segment with deletion mark of card target data block comes occupied from front to back, can be according to chained list inner segment Mark meets a section rule for start offset ascending sort, builds the occupancy section chained list corresponding to the target data block With free segment chained list, and then later use two chained lists complete Data Migration in block.Wherein, the number of targets The multiple data segments for including being formed based on data storage operations and/or data deletion action according to block, the free segment Chained list includes:There is the segment identification corresponding to the data segment for deleting mark, occupancy section in the target data block Chained list includes:The segment identification corresponding to the data segment of predetermined occupancy condition is met in the target data block, this is pre- Surely taking condition is:There is no deletion mark and section start offset covers data segment more than the free segment chained list Section start offset in minimum value, the deletion is designated:To being deleted set by the data segment of data Mark.
Wherein, due to some not there is no the data segment that the free time is not present before the data segment for deleting mark, does not have There is necessity of migration, therefore, set predetermined occupancy condition to include section start offset more than the free segment chained list Minimum value in the section start offset of covered data segment, unnecessary migration is avoided with this, so as to reduce The migration amount of data.For example:The data segment A that section start offset is 0 is first data in data block Section, it is assumed that data segment A, which does not have, deletes mark, then, in block during Data Migration, data segment A It need not be migrated.
It is emphasized that the so-called rule that section start offset ascending sort is closed according to segment identifier in chained list, Occupancy section chained list and the free segment chained list corresponding to the target data block are built, that is, is shown:Every time to occupancy section When adding segment identification in chained list and free segment chained list, it is required to follow segment identifier in chained list and closes section start offset The rule of ascending sort, so that add data corresponding to segment identification in the chained list that segment identification is formed every time The section start offset of section is in ascending order.
It is understood that for a data block, can be written into repeatedly, will so generate many Individual data segment, it is similar, data can also be deleted, each position of data block can be located at by deleting part, Such as:Head or afterbody, so can also generate multiple data segments.Also, it is only for memory space retracting device Stand on for data-storage system, deleting mark can be returned by data-storage system sets itself or memory space Receiving apparatus sets itself, this is all rational;And belong to data-storage system for memory space retracting device In functional module for, delete mark can be beyond the memory space retracting device of data-storage system Other functional modules setting, can also be set by the memory space retracting device, this is all rational.Separately Outside, on the premise of the occurrence for deleting mark is met different from full block identification and mark to be recycled, delete The occurrence of mark is not limited herein.
S203, from the free segment chained list, selection belongs to the segment identification of current chained list starting point as waiting to locate The target segment identification of reason;
In the present embodiment, S203~S205 implements step for the S103's in embodiment illustrated in fig. 1.
Wherein, when carrying out Data Migration in block to target data block, due to needing to ensure target data block Come occupied from front to back with the data segment for deleting mark, therefore, it can first from the free segment chained list, Selection belongs to the segment identification of current chained list starting point as pending target segment identification, the target segment identification For:In the free segment chained list, the segment identification of the section start offset minimum of corresponding data segment.
S204, based on segment mark in the space size of data segment corresponding to the target segment identification and occupancy section chained list Know the space size of corresponding data segment, the data that execution is directed to data segment corresponding to the target segment identification are moved Move;
Specifically, as shown in figure 4, it is described based on the space size of data segment corresponding to the target segment identification and The space size of data segment corresponding to segment identification in occupancy section chained list, execution is directed to the target segment identification institute The Data Migration of corresponding data section, can include:
It whether there is in S401, the segment identification for judging occupancy section chained list and meet at least the one of predetermined transition condition Individual segment identification, if it is, performing S402, otherwise, performs S403;
Wherein, after current target data segment is determined, it can be determined that in the segment identification of occupancy section chained list Performed not with the presence or absence of at least one segment identification for meeting predetermined transition condition, and according to different judged results Same operation.Wherein, the predetermined transition condition is:The space size of corresponding data segment is equal to the target phase The space size of the corresponding data segment of mark, or, space size of the combined segment of corresponding data segment etc. In the space size of data segment corresponding to the target segment identification.
S402, this is met the data content of data segment corresponding at least one segment identification of predetermined transition condition After the completion of copying the deviation post of data segment corresponding to the target segment identification, copy to, from the free segment chained list It is middle to delete the target segment identification, and this is met at least one segment identification of predetermined transition condition from the occupancy It is transferred in section chained list in the free segment chained list;
Wherein, when in the segment identification for judging occupancy section chained list with the presence or absence of meeting predetermined transition condition extremely During a few segment identification, it is right at least one segment identification institute for meeting predetermined transition condition to be done directly Answer the Data Migration of data segment corresponding to the data content to the target segment identification of data segment.
S403, judges whether the space size of data segment corresponding to segment identification to be utilized in occupancy section chained list is big In the space size of data segment corresponding to the target segment identification, if it is, performing S404, otherwise, S405 is performed;
Wherein, when judge the occupancy section chained list segment identification in be not present meet predetermined transition condition at least During one segment identification, it can continue to judge the sky of data segment corresponding to segment identification to be utilized in occupancy section chained list Between size whether be more than the space size of data segment corresponding to the target segment identification, and according to different judgement knots Fruit performs different operations.
Wherein, the segment identification to be utilized is to belong to the segment mark of current chained list starting point in occupancy section chained list Know.
S404, by data segment corresponding to the segment identification to be utilized be divided into subdata section, and by the subdata section Data content is copied to after the completion of the deviation post of data segment corresponding to the target segment identification, copy successively, from The mark to be utilized is deleted in occupancy section chained list, the target segment identification is deleted from the free segment chained list, And change after the section start offset of data segment corresponding to the target segment identification and to rejoin the target segment identification The free segment chained list;
Wherein, when the space size for judging data segment corresponding to segment identification to be utilized in occupancy section chained list is big , can be according to number corresponding to the target segment identification when space size of data segment corresponding to the target segment identification According to the space size of section, data segment corresponding to the segment identification to be utilized is divided into subdata section, and then after execution Continuous Data Migration.
S405, copies the data content of data segment corresponding to the segment identification to be utilized to the target segment identification institute In corresponding data section, after the completion of copy, the segment identification to be utilized is deleted from occupancy section chained list, by this Target segment identification is deleted from the free segment chained list, and changes the section of data segment corresponding to the target segment identification Begin that the target segment identification is rejoined into the free segment chained list after skew.
Wherein, when judge the occupancy section chained list in data segment corresponding to segment identification to be utilized space size not , can be directly by the segment identification institute to be utilized more than corresponding to the target segment identification during space size of data segment The data content of corresponding data section is copied in data segment corresponding to the target segment identification.Also, so-called modification The section start offset of data segment is referred specifically to corresponding to the target segment identification:By data corresponding to the target segment identification The section start offset of section moves down the space size of data segment corresponding to the segment identification to be utilized.
S205, after being finished and being directed to the Data Migration of data segment corresponding to the target segment identification, judges Occupancy section chained list currently whether there is segment identification, and S203 is performed if it is, returning;Otherwise, S206 is performed;
Wherein, can be with after being finished and being directed to the Data Migration of data segment corresponding to the target segment identification Judge that occupancy section chained list currently whether there is segment identification, and corresponding operation is performed according to judged result.Its In, when judge the occupancy section chained list not there is no segment identification currently, show that Data Migration in block can be performed Data segment be processed finish, therefore, it can perform S206;And work as and judge occupancy section chained list Segment identification is there is currently, shows that also presence can be performed the data segment of Data Migration in block, therefore, it can Return and perform S203, the step of circulation performs S203~S205.It is emphasized that to free segment chained list , it is necessary to ensure that free segment chained list follows in chained list segment identifier and closed during middle increase segment identification or when updating segment identification The rule of section start offset ascending sort.
Also, during execution is directed to the Data Migration of data segment corresponding to the target segment identification, such as Really the address of data segment corresponding at least two segment identifications in the free segment chained list is continuous, by this at least two Data segment corresponding to segment identification merges, and forms the new segment identification corresponding at least two segment identification, utilizes The new segment identification replaces at least two segment identification in the free segment chained list.
S206, the target data block that Data Migration in block is finished is updated to the data of space reclamation completion Block.
In the block that is finished to the target data block after Data Migration, the target data block can be updated to The data block that space reclamation is completed, so that obtaining data-storage system can subsequently be carried out using the target data block Data storage operations.
Specifically, in one implementation, described target data block for finishing Data Migration in block is more The new data block completed for space reclamation, can include:
The full block identification for the target data block that Data Migration in block is finished and mark to be recycled are deleted, and more The free space capacity and space availability ratio of the new target data block.
Further, the target data block of Data Migration and other are carrying out in block in order to distinguish well Data block, described target data block for finishing Data Migration in block is updated to the data of space reclamation completion Before block, the memory space recovery method that the present embodiment is provided can also include:
The mark to be recycled of the target data block is revised as reclaiming mark;
Accordingly, described target data block for finishing Data Migration in block is updated to space reclamation completion Data block, including:
The full block identification for the target data block that Data Migration in block is finished reclaims mark with this and deleted, And update the free space capacity and space availability ratio of the target data block.
Further, the method that the present embodiment is provided, can also include:
During execution is directed to the Data Migration of data segment corresponding to the target segment identification, it is directed to The deletion instruction of data segment in the target data block;
If the deletion instructs targeted data segment to be copied, epicycle deletes instruction institute pin to described To data segment without reclaim;
If the deletion instructs the section start offset of targeted data segment than number corresponding to the target segment identification It is big according to the section start offset of section, then the deletion is instructed to the segment identification of targeted data segment from occupancy section chain Table is transferred in the space segment chained list;
If the deletion instructs the section start offset of targeted data segment than number corresponding to the target segment identification Small according to the section start offset of section, epicycle instructs targeted data segment to the deletion without reclaiming.
It is understood that it can be to receive the deletion that user sends by data-storage system to delete instruction Memory space retracting device is sent to during order, also, it is targeted to the deletion instruction for epicycle Data segment without recovery situation, data-storage system can epicycle reclaim terminate after voluntarily delete this and delete Except targeted data segment is instructed, certainly, memory space retracting device can be instructed targeted with record deletion Data segment, and voluntarily when next round is reclaimed, instruct corresponding data segment voluntarily to add the free time deletion In section chained list, this is all rational.
It can be seen that, this programme is to data block to be recycled, using Data Migration mode in block, relative to existing skill Art is needed for the mode of occupancy additional storage space, can be reduced the amount of movement of data and be improved storage resource Utilization rate.
A kind of memory space recovery side provided with reference to another specific embodiment the embodiment of the present invention Method is introduced.
It is emphasized that the executive agent for the memory space recovery method that the embodiment of the present invention is provided can be with For memory space retracting device, wherein, the memory space retracting device can be independently of responsible data storage Data-storage system, can also as be responsible for data storage data-storage system inside functional module, This is all rational.In addition, the data that the data block involved by the present embodiment is stored can be video monitoring Data, or other data, also, the write-in form of data block can add write-in, or, its He carries out occurring after business processing the writing mode in cavity in data block.
As shown in figure 3, a kind of memory space recovery method, may include steps of:
S301, when meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled;
Wherein, this to be recycled is designated:To being less than predetermined utilization rate threshold with full block identification and space availability ratio Mark set by the data block of value, the full block identification is:Minimum data Bao Dan is less than to available free capacity Mark set by the data block of member, the available free capacity is:The capacity in the space of data can be write.
Specifically, in one implementation, it is described when meeting predetermined space recovery condition, it is determined that having The target data block of mark to be recycled, can include:
When system memory space utilization rate reaches predetermined utilization rate threshold value, it is determined that the mesh with mark to be recycled Mark data block.
Wherein, in this kind of implementation, predetermined utilization rate threshold value can be empirical value.
In another implementation, influence is brought on data service in order to avoid memory space is reclaimed, it is described When meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, can include:
When detecting current system business I/O load less than intended service load value, it is determined that with to be recycled The target data block of mark;
Further, current system business I/O load is being detected not less than the intended service load value When, terminate recovery process.
Specifically, the intended service load value can be empirical value, or, pass through certain calculation institute The value determined, the determination mode of the specific intended service load value can include:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
S301 in the present embodiment is similar to the S201 of above-described embodiment, will not be described here.
S302, generates occupancy section chained list and the free segment chained list corresponding to the target data block;
Wherein, after the target data block with mark to be recycled is determined, in order to realize Data Migration in block, Occupancy section chained list and the free segment chained list corresponding to the target data block can be generated.Wherein, the target data Block includes the multiple data segments formed based on data storage operations and/or data deletion action, the free segment chain Table includes:There is the segment identification corresponding to the data segment for deleting mark, occupancy section chain in the target data block Table includes:The segment identification corresponding to the data segment of predetermined occupancy condition is met in the target data block, this makes a reservation for Occupancy condition is:There is no deletion mark and section start offset covers data segment more than the free segment chained list Minimum value in section start offset, the deletion is designated:To the mark being deleted set by the data segment of data Know.
Wherein, due to some not there is no the data segment that the free time is not present before the data segment for deleting mark, does not have There is necessity of migration, therefore, set predetermined occupancy condition to include section start offset more than the free segment chained list Minimum value in the section start offset of covered data segment, unnecessary migration is avoided with this, so as to reduce The migration amount of data.For example:The data segment A that section start offset is 0 is first data in data block Section, it is assumed that data segment A, which does not have, deletes mark, then, in block during Data Migration, data segment A It need not be migrated.
It is understood that for a data block, can be written into repeatedly, will so generate many Individual data segment, it is similar, data can also be deleted, each position of data block can be located at by deleting part, Such as:Head or afterbody, so can also generate multiple data segments.Also, it is only for memory space retracting device Stand on for data-storage system, deleting mark can be returned by data-storage system sets itself or memory space Receiving apparatus sets itself, this is all rational;And belong to data-storage system for memory space retracting device In functional module for, delete mark can be beyond the memory space retracting device of data-storage system Other functional modules setting, can also be set by the memory space retracting device, this is all rational.
S303, the rule of section start offset ascending sort is closed according to segment identifier in chained list, the free time is initialized Section chained list and occupancy section chained list;
In the present embodiment, S303~S306 implements step for the S103's in embodiment illustrated in fig. 1.
Wherein, after the free segment chained list and occupancy section chained list is generated, block is being performed to the target data block During interior Data Migration, in order to ensure that having for target data block deletes the data segment identified from front to back Come it is occupied, i.e., clear area and data area concentrate respectively presence and data area be located at clear area it Before, it therefore, it can close the rule of section start offset ascending sort according to segment identifier in chained list, initialization should Free segment chained list and occupancy section chained list, wherein, after initialization, data segment corresponding to segment identification in chained list Start offset be in ascending order.
S304, from the free segment chained list, selection belongs to the segment identification of current chained list starting point as waiting to locate The target segment identification of reason;
When carrying out Data Migration in block to target data block, it can be selected first from the free segment chained list Belong to the segment identification of current chained list starting point as pending target segment identification, the target phase is designated: In the free segment chained list, the segment identification of the section start offset minimum of corresponding data segment ensure that target with this The data segment with deletion mark of data block comes occupied from front to back.
S305, based on segment mark in the space size of data segment corresponding to the target segment identification and occupancy section chained list Know the space size of corresponding data segment, the data that execution is directed to data segment corresponding to the target segment identification are moved Move;
In the present embodiment, S305 is similar to the S204 of above-described embodiment, will not be described here.
S306, after being finished and being directed to the Data Migration of data segment corresponding to the target segment identification, judges Occupancy section chained list currently whether there is segment identification, and S303 is performed if it is, returning, and otherwise, perform S307;
Wherein, can be with after being finished and being directed to the Data Migration of data segment corresponding to the target segment identification Judge that occupancy section chained list currently whether there is segment identification, and corresponding operation is performed according to judged result.Its In, when judge the occupancy section chained list not there is no segment identification currently, show that Data Migration in block can be performed Data segment be processed finish, therefore, it can perform S307;And work as and judge occupancy section chain Table there is currently segment identification, show that also presence can be performed the data segment of Data Migration in block, also, by New segment identification is added in free segment chained list, therefore, it can return to execution S303, circulation is performed The step of S303~S306.
It is emphasized that, it is necessary to protect when increasing segment identification into free segment chained list or when updating segment identification Card free segment chained list follows the rule that segment identifier in chained list closes section start offset ascending sort.
Also, during execution is directed to the Data Migration of data segment corresponding to the target segment identification, such as Really the address of data segment corresponding at least two segment identifications in the free segment chained list is continuous, by this at least two Data segment corresponding to segment identification merges, and forms the new segment identification corresponding at least two segment identification, utilizes The new segment identification replaces at least two segment identification in the free segment chained list.
S307, the target data block that Data Migration in block is finished is updated to the data of space reclamation completion Block.
Specifically, in one implementation, described target data block for finishing Data Migration in block is more The new data block completed for space reclamation, can include:
The full block identification for the target data block that Data Migration in block is finished and mark to be recycled are deleted, and more The free space capacity and space availability ratio of the new target data block.
Further, the target data block of Data Migration and other are carrying out in block in order to distinguish well Data block, described target data block for finishing Data Migration in block is updated to the data of space reclamation completion Before block, the memory space recovery method that the present embodiment is provided can also include:
The mark to be recycled of the target data block is revised as reclaiming mark;
Accordingly, described target data block for finishing Data Migration in block is updated to space reclamation completion Data block, including:
The full block identification for the target data block that Data Migration in block is finished reclaims mark with this and deleted, And update the free space capacity and space availability ratio of the target data block.
Further, the process of the Data Migration of data segment corresponding to the target segment identification is directed in execution In, obtain the deletion instruction for the data segment being directed in the target data block;
If the deletion instructs targeted data segment to be copied, epicycle deletes instruction institute pin to described To data segment without reclaim;
If the deletion instructs the section start offset of targeted data segment than number corresponding to the target segment identification It is big according to the section start offset of section, then the deletion is instructed to the segment identification of targeted data segment from occupancy section chain Table is transferred in the space segment chained list;
If the deletion instructs the section start offset of targeted data segment than number corresponding to the target segment identification Small according to the section start offset of section, epicycle instructs targeted data segment to the deletion without reclaiming.
S307 in the present embodiment is similar to the S206 of above-described embodiment, will not be described here.
It can be seen that, this programme is to data block to be recycled, using Data Migration mode in block, relative to existing skill Art is needed for the mode of occupancy additional storage space, can be reduced the amount of movement of data and be improved storage resource Utilization rate.
With reference to Data Migration schematic diagram in the block shown in Fig. 5, the storage provided the embodiment of the present invention Space reclamation method is introduced.
(1):When meeting predetermined space recovery condition, the number of targets with mark to be recycled determined According to there is 7 data segments in block, specifically, as shown in Fig. 5 (step1), segment identification Seg1, Seg3 and Seg6 It has been labeled with deleting mark, therefore, has been added into free segment chained list L1, and segment identification Seg2, Seg4, Seg5 It is not labeled with deleting mark with Seg7 and section start offset is more than the section that free segment chained list L1 covers data segment Minimum value in start offset, therefore, is added into occupancy section chained list L2;Wherein, segment identification is being added When entering to free segment chained list L1 and taking in section chained list L2, it then follows segment identifier closes section start offset liter in chained list The rule of sequence sequence;
(2):For free segment chained list L1 first segment identification Seg1, the space of its corresponding data segment is big The small data segment sum for being exactly equal to segment identification Seg2 and Seg7, then by number corresponding to segment identification Seg2 and Seg7 The deviation post of data segment corresponding to segment identification Seg1, now, segment identification are copied to according to the data content of section The space that data segment corresponding to Seg2 and segment identification Seg7 occupied originally becomes idle, corresponding to segment identification Seg1 Data segment is occupied, therefore, segment identification Seg1 is deleted from free segment chained list L1, by segment identification Seg2 Deleted with Seg7 from section chained list L2 is taken, be added to free segment chained list L1, also, segment identification Seg6 and Seg7 Corresponding data segment merges into an idle data segment, after the completion of processing as shown in figure 5 above (step2).
(3):For first segment identification Seg2 current in free segment chained list L1, section chained list L2 is being taken In do not find space size equal to its segment identification or segment identification sum, then will take section chained list L2 current The data content of data segment corresponding to first segment identification Seg4 is moved to the data corresponding to segment identification Seg2 The deviation post of section, and because the space size of data segment corresponding to segment identification Seg4 is more right than segment identification Seg2 institutes Answer data segment big, so, it is impossible to complete copy is carried out, by data segment corresponding to segment identification Seg4 according to segment mark The size for knowing data segment corresponding to Seg2 is segmented, and data segment corresponding to segment identification Seg2 is copied to paragraph by paragraph After the completion of deviation post, copy, segment identification Seg4 is deleted from section chained list L2 is taken, segment identification Seg2 A new segment identification is merged into Seg3, shown in such as Fig. 5 (step3);
(4):For free segment chained list L1 first segment identification Seg2+3, section chained list L2 is being taken In do not find suitable segment identification, i.e., do not find space size equal to its section in section chained list L2 is taken Mark or segment identification sum, then by the data segment corresponding to occupancy section chained list L2 first segment identification Seg5 Data content is moved to the deviation post of data segment corresponding to segment identification Seg2+3, and because segment identification Seg5 institutes are right Answer the space size of data segment smaller than data segment corresponding to segment identification Seg2+3, so, directly by segment identification The deviation post of data segment corresponding to data content complete copy to segment identification Seg2+3 corresponding to Seg5, by section The section start offset of data segment moves down the space of data segment corresponding to segment identification Seg5 corresponding to mark Seg2+3 Size, and segment identification Seg5 is deleted from section chained list L2 is taken, section Seg2, Seg3, Seg6 and Seg7 Corresponding data segment merges into a data segment, and forms the segment identification of merged into data segment, such as Fig. 5 (step4) shown in.
(5):Taking in section chained list L2 does not have segment identification, and recovery terminates.
It should be noted that in target data block shown in Fig. 5, data segment for data storage content and The data segment of data content of not being stored with is made a distinction using different filling contents, and is limited without any Meaning.
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of memory space retracting device, As described in Figure 6, the device can include:
Target data block determining module 610, for when meeting predetermined space recovery condition, being treated it is determined that having The target data block of mark is reclaimed, wherein, it is described to be recycled to be designated:To with full block identification and space profit With rate less than the mark set by the data block of predetermined utilization rate threshold value, the full block identification is:To available sky Not busy capacity is less than the mark set by the data block of minimum data bag unit, and the available free capacity is:Energy Enough write the capacity in the space of data;
Chained list generation module 620, for generating occupancy section chained list and free time corresponding to the target data block Section chained list, wherein, the target data block includes being based on data storage operations and/or data deletion action institute shape Into multiple data segments, the free segment chained list includes:There is the number for deleting mark in the target data block According to the segment identification corresponding to section, the occupancy section chained list includes:Predetermined take is met in the target data block Segment identification corresponding to the data segment of condition, the predetermined occupancy condition is:Do not have and delete mark and section Begin to offset the minimum value covered more than the free segment chained list in the section start offset of data segment, the deletion It is designated:To the mark being deleted set by the data segment of data;
Data Migration module 630 in block is right for based on the free segment chained list and occupancy section chained list The target data block performs Data Migration in block;
Target data block processing module 640, for the target data block that finishes Data Migration in block more The new data block completed for space reclamation.
It can be seen that, this programme is to data block to be recycled, using Data Migration mode in block, relative to existing skill Art is needed for the mode of occupancy additional storage space, can be reduced the amount of movement of data and be improved storage resource Utilization rate.
Specifically, in a kind of specific embodiment, as shown in fig. 7, the chained list generation module 620 can be wrapped Include:
Chained list generation unit 621, the rule for closing section start offset ascending sort according to segment identifier in chained list Then, occupancy section chained list and the free segment chained list corresponding to the target data block are built;
Data Migration module 630 can include in described piece:
Target segment identification determining unit 631, for from the free segment chained list, selection to belong to current chain The segment identification of table starting point is used as pending target segment identification;
Data migration unit 632, for based on the space size of data segment corresponding to the target segment identification and The space size for taking data segment corresponding to segment identification in section chained list, execution is directed to the target segment mark Know the Data Migration of corresponding data segment;
First segment identification judging unit 633, for being directed to corresponding to the target segment identification being finished After the Data Migration of data segment, judge that the occupancy section chained list currently whether there is segment identification, if it is, returning Target segment identification determining unit 631 described in receipt row.
Specifically, in another specific embodiment, as shown in figure 8, Data Migration module 630 in described piece It can include:
Initialization unit 634, the free segment chained list is based on and described for Data Migration module in described piece Section chained list is taken, the target data block is performed in block before Data Migration, according to segment identifier in chained list The rule of section start offset ascending sort is closed, generated free segment chained list and occupancy section chain is initialized Table;
Target segment identification determining unit 631, for from the free segment chained list, selection to belong to current chain The segment identification of table starting point is used as pending target segment identification;
Data migration unit 632, for based on the space size of data segment corresponding to the target segment identification and The space size for taking data segment corresponding to segment identification in section chained list, execution is directed to the target segment mark Know the Data Migration of corresponding data segment;
Second segment identification judging unit 635, for being directed to corresponding to the target segment identification being finished After the Data Migration of data segment, judge that the occupancy section chained list currently whether there is segment identification, if it is, returning Initialization unit 634 described in receipt row.
Further, as shown in figure 9, the data migration unit 632 can include:
First takes section chained list judgment sub-unit 6321, is in the segment identification for judging the occupancy section chained list It is no to there is at least one segment identification for meeting predetermined transition condition, wherein, the predetermined transition condition is:Institute The space size of corresponding data section is equal to the space size of the data segment corresponding to the target segment identification, or Person, the space size of the combined segment of corresponding data segment is equal to the sky of data segment corresponding to the target segment identification Between size;
First processing subelement 6322, during for being when judged result, meets predetermined transition condition by described At least one segment identification corresponding to the data content of data segment copy corresponding to the target segment identification number to According to the deviation post of section, after the completion of copy, the target segment identification is deleted from the free segment chained list, and Described at least one segment identification for meeting predetermined transition condition is transferred to from the occupancy section chained list described In free segment chained list;
Second takes section chained list judgment sub-unit 6323, for when judged result is no, judging described take Whether the space size of data segment corresponding to segment identification to be utilized is more than the target segment identification institute in section chained list The space size of corresponding data section, if it is, triggering second processing subelement 6324, otherwise, triggering the 3rd Handle subelement 6325;
The second processing subelement 6324, for data segment corresponding to the segment identification to be utilized to be divided into son Data segment, and the data content of subdata section is copied to data corresponding to the target segment identification successively After the completion of the deviation post of section, copy, the mark to be utilized is deleted from the occupancy section chained list, by institute State target segment identification to delete from the free segment chained list, and change data segment corresponding to the target segment identification Section start offset after the target segment identification is rejoined into the free segment chained list, wherein, it is described to treat profit With segment identification to belong to the segment identification of current chained list starting point in the occupancy section chained list;
The 3rd processing subelement 6325, for by the data of data segment corresponding to the segment identification to be utilized In data segment corresponding to copy content to the target segment identification, after the completion of copy, by the segment mark to be utilized Know and deleted from the occupancy section chained list, the target segment identification is deleted from the free segment chained list, and Change after the section start offset of data segment corresponding to the target segment identification and to add the target segment identification again Enter the free segment chained list.
Further, section chained list judgment sub-unit, the first processing subelement, second are being taken including first On the premise of taking section chained list judgment sub-unit, second processing subelement and the 3rd processing subelement, the present invention A kind of memory space retracting device that embodiment is provided can also include:
Segment identification merging module, for performing the data for being directed to data segment corresponding to the target segment identification During migration, if the address of data segment corresponding at least two segment identifications in the free segment chained list Continuously, data segment corresponding at least two segment identification is merged, forms at least two segment identifications institute Corresponding new segment identification, using the new segment identification replace in the free segment chained list described at least two Individual segment identification.
Further, section chained list judgment sub-unit, the first processing subelement, second are being taken including first On the premise of taking section chained list judgment sub-unit, second processing subelement and the 3rd processing subelement, the present invention A kind of memory space retracting device that embodiment is provided can also include:
Delete instruction and obtain module, for performing the number for being directed to data segment corresponding to the target segment identification During migration, the deletion instruction for the data segment being directed in the target data block is obtained;
First deletes instruction respond module, if carried out for the targeted data segment of instruction of deleting Copy, epicycle is to the targeted data segment of instruction of deleting without reclaiming;
Second deletes instruction respond module, if for the section starting for deleting the targeted data segment of instruction The section start offset of data segment corresponding to target segment identification described in deviation ratio is big, then described delete is instructed into institute's pin To the segment identification of data segment from the occupancy section chained list be transferred to the space segment chained list;
3rd deletes instruction respond module, if for the section starting for deleting the targeted data segment of instruction The section start offset of data segment corresponding to target segment identification described in deviation ratio is small, and epicycle deletes instruction institute to described For data segment without reclaim.
Specifically, being directed to embodiment illustrated in fig. 6, the target data block processing module 640 can include:
First object data block processing unit, for the target data block that finishes Data Migration in block Full block identification and mark to be recycled are deleted, and update the free space capacity and space profit of the target data block With rate.
Specifically, on the basis of embodiment illustrated in fig. 6, the memory space that the embodiment of the present invention is provided is returned Receiving apparatus can also include:
Mark change module, the target data block for Data Migration in block to be finished is updated to space and returned Before the data block harvested, the mark to be recycled of the target data block is revised as reclaiming mark;
The target data block processing module 640 can include:
Second target data block processing unit, for the target data block that finishes Data Migration in block Full block identification and the mark that reclaims are deleted, and update the target data block free space capacity and Space availability ratio.
Specifically, being directed to embodiment illustrated in fig. 6, the target data block determining module 610 can include:
First object data block determining unit, for detecting current system business I/O load less than predetermined During traffic load values, it is determined that the target data block with mark to be recycled.
Further, on the basis of the embodiment comprising first object data block determining unit, the present invention The memory space retracting device that embodiment is provided can also include:
End trigger module, for detecting current system business I/O load not less than the intended service During load value, terminate recovery process.
Specifically, the determination mode of the intended service load value includes:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
Specifically, being directed to embodiment illustrated in fig. 6, the target data block determining module 610 can include:
Second target data block determining unit, for reaching predetermined utilization rate threshold in system memory space utilization rate During value, it is determined that the target data block with mark to be recycled.
It should be noted that herein, such as first and second or the like relational terms be used merely to by One entity or operation make a distinction with another entity or operation, and not necessarily require or imply these There is any this actual relation or order between entity or operation.Moreover, term " comprising ", " bag Containing " or any other variant thereof is intended to cover non-exclusive inclusion, so that including a series of key elements Process, method, article or equipment not only include those key elements, but also including being not expressly set out Other key elements, or also include for this process, method, article or the intrinsic key element of equipment. In the case of there is no more limitations, the key element limited by sentence "including a ...", it is not excluded that including Also there is other identical element in process, method, article or the equipment of the key element.
Each embodiment in this specification is described by the way of related, identical phase between each embodiment As part mutually referring to, what each embodiment was stressed be it is different from other embodiment it Place.For system embodiment, because it is substantially similar to embodiment of the method, so description Fairly simple, the relevent part can refer to the partial explaination of embodiments of method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the protection model of the present invention Enclose.Any modification, equivalent substitution and improvements made within the spirit and principles of the invention etc., are wrapped Containing within the scope of the present invention.

Claims (24)

1. a kind of memory space recovery method, it is characterised in that including:
When meeting predetermined space recovery condition, it is determined that the target data block with mark to be recycled, wherein, It is described to be recycled to be designated:Data to being less than predetermined utilization rate threshold value with full block identification and space availability ratio Mark set by block, the full block identification is:It is less than the number of minimum data bag unit to available free capacity According to the mark set by block, the available free capacity is:The capacity in the space of data can be write;
Occupancy section chained list and the free segment chained list corresponding to the target data block are generated, wherein, the target Data block includes the multiple data segments formed based on data storage operations and/or data deletion action, the sky Not busy section chained list includes:There is the segment identification corresponding to the data segment for deleting mark, institute in the target data block Stating occupancy section chained list includes:The section corresponding to the data segment of predetermined occupancy condition is met in the target data block Identify, the predetermined occupancy condition is:There is no deletion mark and section start offset is more than the free segment chain Table covers the minimum value in the section start offset of data segment, and the deletion is designated:To being deleted data Data segment set by mark;
Based on the free segment chained list and occupancy section chained list, data in block are performed to the target data block Migration;
The target data block that Data Migration in block is finished is updated to the data block of space reclamation completion.
2. according to the method described in claim 1, it is characterised in that the generation target data block institute Corresponding occupancy section chained list and free segment chained list, including:
The rule of section start offset ascending sort is closed according to segment identifier in chained list, the target data block is built Corresponding occupancy section chained list and free segment chained list;
It is described to be based on the free segment chained list and occupancy section chained list, the target data block is performed in block Data Migration, including:
From the free segment chained list, selection belongs to the segment identification of current chained list starting point as pending Target segment identification;
Based on segment mark in the space size of data segment corresponding to the target segment identification and occupancy section chained list Know the space size of corresponding data segment, perform the data for being directed to data segment corresponding to the target segment identification Migration;
After being finished and being directed to the Data Migration of data segment corresponding to the target segment identification, judge described Take section chained list and currently whether there is segment identification, if it is, return described in execution from the free segment chained list, Selection belongs to the step of segment identification of current chained list starting point is as pending target segment identification.
3. according to the method described in claim 1, it is characterised in that it is described based on the free segment chained list and The occupancy section chained list, Data Migration in block is performed to the target data block, including:
The rule of section start offset ascending sort is closed according to segment identifier in chained list, the free segment chain is initialized Table and occupancy section chained list;
From the free segment chained list, selection belongs to the segment identification of current chained list starting point as pending Target segment identification;
Based on segment mark in the space size of data segment corresponding to the target segment identification and occupancy section chained list Know the space size of corresponding data segment, perform the data for being directed to data segment corresponding to the target segment identification Migration;
After being finished and being directed to the Data Migration of data segment corresponding to the target segment identification, judge described Take section chained list and currently whether there is segment identification, if it is, it is described according to segment identifier in chained list to return to execution The rule of section start offset ascending sort is closed, the step of the free segment chained list and occupancy section chained list is initialized Suddenly.
4. according to the method in claim 2 or 3, it is characterised in that described to be based on the target segment mark Know the space of data segment corresponding to segment identification in the space size and occupancy section chained list of corresponding data segment Size, performs the Data Migration for being directed to data segment corresponding to the target segment identification, including:
It whether there is at least one for meeting predetermined transition condition in the segment identification for judging the occupancy section chained list Segment identification, wherein, the predetermined transition condition is:The space size of corresponding data segment is equal to the target The space size of data segment corresponding to segment identification, or, the space size of the combined segment of corresponding data segment Equal to the space size of data segment corresponding to the target segment identification;
When judged result is to be, meet number corresponding at least one segment identification of predetermined transition condition by described Copy the deviation post of data segment corresponding to the target segment identification to according to the data content of section, copy is completed Afterwards, delete the target segment identification from the free segment chained list, and meet predetermined transition condition by described At least one segment identification is transferred in the free segment chained list from the occupancy section chained list;
When judged result is no, data segment corresponding to segment identification to be utilized in the occupancy section chained list is judged Whether space size is more than the space size of data segment corresponding to the target segment identification, if it is, will be described Data segment corresponding to segment identification to be utilized is divided into subdata section, and by the data content of subdata section successively It is copied to after the completion of the deviation post of data segment corresponding to the target segment identification, copy, from the occupancy section The mark to be utilized is deleted in chained list, the target segment identification is deleted from the free segment chained list, and Change after the section start offset of data segment corresponding to the target segment identification and to add the target segment identification again Enter the free segment chained list, wherein, the segment identification to be utilized belongs to current for described take in section chained list The segment identification of chained list starting point;
Otherwise, the data content of data segment corresponding to the segment identification to be utilized is copied to the target segment mark Know in corresponding data segment, after the completion of copy, the segment identification to be utilized is deleted from the occupancy section chained list Remove, the target segment identification is deleted from the free segment chained list, and it is right to change the target segment identification institute Answer after the section start offset of data segment and the target segment identification is rejoined into the free segment chained list.
5. method according to claim 4, it is characterised in that also include:
During execution is directed to the Data Migration of data segment corresponding to the target segment identification, if institute The address for stating data segment corresponding at least two segment identifications in free segment chained list is continuous, by described at least two Data segment corresponding to segment identification merges, and forms the new segment identification corresponding at least two segment identification, profit At least two segment identification in the free segment chained list is replaced with the new segment identification.
6. method according to claim 4, it is characterised in that also include:
During execution is directed to the Data Migration of data segment corresponding to the target segment identification, pin is obtained For the deletion instruction of the data segment in the target data block;
If the targeted data segment of instruction of deleting is copied, epicycle deletes instruction institute to described For data segment without reclaim;
If the section start offset for deleting the targeted data segment of instruction is more right than target segment identification institute Answer the section start offset of data segment big, then described delete is instructed into the segment identification of targeted data segment from described Section chained list is taken to be transferred in the space segment chained list;
If the section start offset for deleting the targeted data segment of instruction is more right than target segment identification institute Answer the section start offset of data segment small, epicycle is to the targeted data segment of instruction of deleting without reclaiming.
7. according to the method described in claim 1, it is characterised in that described to finish Data Migration in block The target data block is updated to the data block of space reclamation completion, including:
The full block identification for the target data block that Data Migration in block is finished and mark to be recycled are deleted, and Update the free space capacity and space availability ratio of the target data block.
8. according to the method described in claim 1, it is characterised in that described to finish Data Migration in block The target data block is updated to before the data block of space reclamation completion, and methods described also includes:
The mark to be recycled of the target data block is revised as reclaiming mark;
The target data block that Data Migration in block is finished is updated to the data of space reclamation completion Block, including:
The full block identification for the target data block that Data Migration in block is finished and described reclaiming mark Delete, and update the free space capacity and space availability ratio of the target data block.
9. according to the method described in claim 1, it is characterised in that described to meet predetermined space recovery bar During part, it is determined that the target data block with mark to be recycled, including:
When detecting current system business I/O load less than intended service load value, it is determined that with to be recycled The target data block of mark.
10. method according to claim 9, it is characterised in that also include:
When detecting current system business I/O load not less than the intended service load value, terminate to reclaim Flow.
11. the method according to claim 9 or 10, it is characterised in that the intended service load value Determination mode include:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
12. according to the method described in claim 1, it is characterised in that described to meet predetermined space recovery During condition, it is determined that the target data block with mark to be recycled, including:
When system memory space utilization rate reaches predetermined utilization rate threshold value, it is determined that the mesh with mark to be recycled Mark data block.
13. a kind of memory space retracting device, it is characterised in that including:
Target data block determining module, for when meeting predetermined space recovery condition, it is determined that with to be recycled The target data block of mark, wherein, it is described to be recycled to be designated:To with full block identification and space availability ratio Less than the mark set by the data block of predetermined utilization rate threshold value, the full block identification is:Available free is held Amount is less than the mark set by the data block of minimum data bag unit, and the available free capacity is:It can write Enter the capacity in the space of data;
Chained list generation module, for generating occupancy section chained list and free segment chain corresponding to the target data block Table, wherein, the target data block includes what is formed based on data storage operations and/or data deletion action Multiple data segments, the free segment chained list includes:There is the data segment for deleting mark in the target data block Corresponding segment identification, the occupancy section chained list includes:Predetermined occupancy condition is met in the target data block Data segment corresponding to segment identification, the predetermined occupancy condition is:There is no deletion mark and section starting is inclined Move the minimum value covered more than the free segment chained list in the section start offset of data segment, the deletion mark For:To the mark being deleted set by the data segment of data;
Data Migration module in block, for based on the free segment chained list and occupancy section chained list, to described Target data block performs Data Migration in block;
Target data block processing module, the target data block for Data Migration in block to be finished is updated to The data block that space reclamation is completed.
14. device according to claim 13, it is characterised in that the chained list generation module includes:
Chained list generation unit, the rule for closing section start offset ascending sort according to segment identifier in chained list, Build occupancy section chained list and the free segment chained list corresponding to the target data block;
Data Migration module includes in described piece:
Target segment identification determining unit, for from the free segment chained list, the chained list that selection belongs to current to rise The segment identification of initial point is used as pending target segment identification;
Data migration unit, for based on the space size of data segment corresponding to the target segment identification and described The space size of data segment corresponding to segment identification in section chained list is taken, execution is directed to the target segment identification institute The Data Migration of corresponding data section;
First segment identification judging unit, for being directed to data corresponding to the target segment identification being finished After the Data Migration of section, judge that the occupancy section chained list currently whether there is segment identification, held if it is, returning The row target segment identification determining unit.
15. device according to claim 13, it is characterised in that Data Migration module bag in described piece Include:
Initialization unit, the free segment chained list and the occupancy are based on for Data Migration module in described piece Section chained list, performs in block before Data Migration to the target data block, section is closed according to segment identifier in chained list The rule of start offset ascending sort, initializes generated free segment chained list and occupancy section chained list;
Target segment identification determining unit, for from the free segment chained list, the chained list that selection belongs to current to rise The segment identification of initial point is used as pending target segment identification;
Data migration unit, for based on the space size of data segment corresponding to the target segment identification and described The space size of data segment corresponding to segment identification in section chained list is taken, execution is directed to the target segment identification institute The Data Migration of corresponding data section;
Second segment identification judging unit, for being directed to data corresponding to the target segment identification being finished After the Data Migration of section, judge that the occupancy section chained list currently whether there is segment identification, held if it is, returning The row initialization unit.
16. the device according to claims 14 or 15, it is characterised in that the data migration unit bag Include:
Whether first takes section chained list judgment sub-unit, deposited in the segment identification for judging the occupancy section chained list Meeting at least one segment identification of predetermined transition condition, wherein, the predetermined transition condition is:It is corresponding The space size of data segment is equal to the space size of the data segment corresponding to the target segment identification, or, institute The space that the space size of the combined segment of corresponding data section is equal to data segment corresponding to the target segment identification is big It is small;
First processing subelement, during for being when judged result, meets predetermined transition condition extremely by described The data content of data segment copies data segment corresponding to the target segment identification to corresponding to a few segment identification Deviation post, after the completion of copy, delete the target segment identification from the free segment chained list, and by institute State and meet at least one segment identification of predetermined transition condition and be transferred to the free time from the occupancy section chained list In section chained list;
Second takes section chained list judgment sub-unit, for when judged result is no, judging the occupancy section chain Whether the space size of data segment corresponding to segment identification to be utilized is more than corresponding to the target segment identification in table The space size of data segment, if it is, triggering second processing subelement, otherwise, processing of triggering the 3rd are single Member;
The second processing subelement, for data segment corresponding to the segment identification to be utilized to be divided into subdata Section, and the data content of subdata section is copied to data segment corresponding to the target segment identification successively After the completion of deviation post, copy, the mark to be utilized is deleted from the occupancy section chained list, by the mesh Bid section mark is deleted from the free segment chained list, and changes the section of data segment corresponding to the target segment identification The target segment identification is rejoined into the free segment chained list after start offset, wherein, described to be utilized section It is designated the segment identification for belonging to current chained list starting point in the occupancy section chained list;
The 3rd processing subelement, for by the data content of data segment corresponding to the segment identification to be utilized Copy in data segment corresponding to the target segment identification, after the completion of copy, by the segment identification to be utilized from Delete, the target segment identification is deleted from the free segment chained list, and change in the occupancy section chained list The target segment identification is rejoined into institute after the section start offset of data segment corresponding to the target segment identification State free segment chained list.
17. device according to claim 16, it is characterised in that also include:
Segment identification merging module, for performing the data for being directed to data segment corresponding to the target segment identification During migration, if the address of data segment corresponding at least two segment identifications in the free segment chained list Continuously, data segment corresponding at least two segment identification is merged, forms at least two segment identifications institute Corresponding new segment identification, using the new segment identification replace in the free segment chained list described at least two Individual segment identification.
18. device according to claim 16, it is characterised in that also include:
Delete instruction and obtain module, for performing the number for being directed to data segment corresponding to the target segment identification During migration, the deletion instruction for the data segment being directed in the target data block is obtained;
First deletes instruction respond module, if carried out for the targeted data segment of instruction of deleting Copy, epicycle is to the targeted data segment of instruction of deleting without reclaiming;
Second deletes instruction respond module, if for the section starting for deleting the targeted data segment of instruction The section start offset of data segment corresponding to target segment identification described in deviation ratio is big, then described delete is instructed into institute's pin To the segment identification of data segment from the occupancy section chained list be transferred to the space segment chained list;
3rd deletes instruction respond module, if for the section starting for deleting the targeted data segment of instruction The section start offset of data segment corresponding to target segment identification described in deviation ratio is small, and epicycle deletes instruction institute to described For data segment without reclaim.
19. device according to claim 13, it is characterised in that the target data block processing module Including:
First object data block processing unit, for the target data block that finishes Data Migration in block Full block identification and mark to be recycled are deleted, and update the free space capacity and space profit of the target data block With rate.
20. device according to claim 13, it is characterised in that also include:
Mark change module, the target data block for Data Migration in block to be finished is updated to space and returned Before the data block harvested, the mark to be recycled of the target data block is revised as reclaiming mark;
The target data block processing module includes:
Second target data block processing unit, for the target data block that finishes Data Migration in block Full block identification and the mark that reclaims are deleted, and update the target data block free space capacity and Space availability ratio.
21. device according to claim 13, it is characterised in that the target data block determining module Including:
First object data block determining unit, for detecting current system business I/O load less than predetermined During traffic load values, it is determined that the target data block with mark to be recycled.
22. device according to claim 21, it is characterised in that also include:
End trigger module, for detecting current system business I/O load not less than the intended service During load value, terminate recovery process.
23. the device according to claim 21 or 22, it is characterised in that the intended service load value Determination mode include:
Gather the system business I/O load in scheduled time slot;
Calculate the average value of the system business I/O load in the scheduled time slot gathered;
It regard the average value as intended service load value.
24. device according to claim 13, it is characterised in that the target data block determining module Including:
Second target data block determining unit, for reaching predetermined utilization rate threshold in system memory space utilization rate During value, it is determined that the target data block with mark to be recycled.
CN201610175965.3A 2016-03-24 2016-03-24 Storage space recovery method and device Active CN107229414B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610175965.3A CN107229414B (en) 2016-03-24 2016-03-24 Storage space recovery method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610175965.3A CN107229414B (en) 2016-03-24 2016-03-24 Storage space recovery method and device

Publications (2)

Publication Number Publication Date
CN107229414A true CN107229414A (en) 2017-10-03
CN107229414B CN107229414B (en) 2020-01-17

Family

ID=59932014

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610175965.3A Active CN107229414B (en) 2016-03-24 2016-03-24 Storage space recovery method and device

Country Status (1)

Country Link
CN (1) CN107229414B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508146A (en) * 2018-10-11 2019-03-22 广西师范大学 A kind of periodical memory space recovery method of block chain
CN110647294A (en) * 2019-09-09 2020-01-03 Oppo(重庆)智能科技有限公司 Storage block recovery method and device, storage medium and electronic equipment
CN111556367A (en) * 2018-12-31 2020-08-18 德州仪器公司 Method and system for releasing an amount of space from a shared buffer
CN111949200A (en) * 2019-05-17 2020-11-17 北京兆易创新科技股份有限公司 Memory and control method and control device thereof
CN112667148A (en) * 2020-11-30 2021-04-16 上海七牛信息技术有限公司 Method and system for cluster storage data online migration
CN113641304A (en) * 2021-07-05 2021-11-12 深圳市宏旺微电子有限公司 Method, device, terminal equipment and storage medium for managing data blocks
CN113687774A (en) * 2021-07-19 2021-11-23 锐捷网络股份有限公司 Space recovery method, device and equipment
CN115442388A (en) * 2022-10-21 2022-12-06 四川省华存智谷科技有限责任公司 Capacity expansion method, device and system for 100% utilization rate of distributed storage cluster

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104933169A (en) * 2015-06-29 2015-09-23 南开大学 File system defragmentation method based on hotspot file priority
EP2990952A1 (en) * 2014-08-29 2016-03-02 EMC Corporation Method and system for garbage collection in a storage system based on longevity of stored data

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2990952A1 (en) * 2014-08-29 2016-03-02 EMC Corporation Method and system for garbage collection in a storage system based on longevity of stored data
CN104933169A (en) * 2015-06-29 2015-09-23 南开大学 File system defragmentation method based on hotspot file priority

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508146A (en) * 2018-10-11 2019-03-22 广西师范大学 A kind of periodical memory space recovery method of block chain
CN109508146B (en) * 2018-10-11 2021-07-23 广西师范大学 Method for recycling periodic storage space of block chain
CN111556367A (en) * 2018-12-31 2020-08-18 德州仪器公司 Method and system for releasing an amount of space from a shared buffer
US11947477B2 (en) 2018-12-31 2024-04-02 Texas Instruments Incorporated Shared buffer for multi-output display systems
CN111556367B (en) * 2018-12-31 2024-10-29 德州仪器公司 Method and system for freeing amount of space from shared buffers
CN111949200A (en) * 2019-05-17 2020-11-17 北京兆易创新科技股份有限公司 Memory and control method and control device thereof
CN110647294A (en) * 2019-09-09 2020-01-03 Oppo(重庆)智能科技有限公司 Storage block recovery method and device, storage medium and electronic equipment
CN112667148A (en) * 2020-11-30 2021-04-16 上海七牛信息技术有限公司 Method and system for cluster storage data online migration
CN113641304A (en) * 2021-07-05 2021-11-12 深圳市宏旺微电子有限公司 Method, device, terminal equipment and storage medium for managing data blocks
CN113641304B (en) * 2021-07-05 2023-10-20 深圳市宏旺微电子有限公司 Method, device, terminal equipment and storage medium for managing data blocks
CN113687774A (en) * 2021-07-19 2021-11-23 锐捷网络股份有限公司 Space recovery method, device and equipment
CN115442388A (en) * 2022-10-21 2022-12-06 四川省华存智谷科技有限责任公司 Capacity expansion method, device and system for 100% utilization rate of distributed storage cluster

Also Published As

Publication number Publication date
CN107229414B (en) 2020-01-17

Similar Documents

Publication Publication Date Title
CN107229414A (en) Memory space recovery method and device
CN103502957B (en) Data processing method and device
CN110399310A (en) A kind of recovery method and device of memory space
CN102945278A (en) Method and device for redoing logs of database records
CN106201904A (en) Method and device for internal memory garbage reclamation
CN115543871B (en) Data storage method and related equipment
CN112631953A (en) TRIM method and device for solid state disk data, electronic equipment and storage medium
CN105988719B (en) Storage device and its method for handling data
CN106293497A (en) The recovery method of junk data and device in watt record filesystem-aware
CN103377125A (en) Code testing method, device and system
CN112306408A (en) Storage block processing method, device, equipment and storage medium
CN106055404A (en) Method and device for cleaning up background application programs
CN107329836A (en) Multi-system memory management method and device and mobile terminal
CN114924923A (en) Method, system, equipment and medium for verifying correctness of hard disk write-in point
CN110377616A (en) A kind of data-erasure method, device, electronic equipment and storage medium
CN110413577A (en) Data-erasure method, device, electronic equipment and computer readable storage medium
CN104700900B (en) A kind of detecting system and method for memory Single event upset effecf
CN103729301B (en) Data processing method and device
CN107463555A (en) The mthods, systems and devices of layer data among deleting
CN106202374A (en) A kind of data processing method and device
CN104090838A (en) Method for generating test case
CN107193485A (en) Storage device, control unit thereof and data storage method for storage device
CN113407163B (en) Module association assignment method, device, computer equipment and readable storage medium
CN106611364A (en) Storage fragmentation arrangement method and device
CN109144423A (en) memory bad block management method, device and flash memory

Legal Events

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