CN114327279A - Data migration method and device - Google Patents
Data migration method and device Download PDFInfo
- Publication number
- CN114327279A CN114327279A CN202111645541.6A CN202111645541A CN114327279A CN 114327279 A CN114327279 A CN 114327279A CN 202111645541 A CN202111645541 A CN 202111645541A CN 114327279 A CN114327279 A CN 114327279A
- Authority
- CN
- China
- Prior art keywords
- data
- target
- data block
- determining
- duration
- 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.)
- Pending
Links
- 230000005012 migration Effects 0.000 title claims abstract description 65
- 238000013508 migration Methods 0.000 title claims abstract description 65
- 238000000034 method Methods 0.000 title claims abstract description 57
- 230000002159 abnormal effect Effects 0.000 claims abstract description 13
- 230000009471 action Effects 0.000 claims description 33
- 238000003860 storage Methods 0.000 claims description 20
- 238000012545 processing Methods 0.000 claims description 8
- 238000005516 engineering process Methods 0.000 abstract description 8
- 238000013500 data storage Methods 0.000 abstract description 7
- 238000004590 computer program Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 10
- 230000008569 process Effects 0.000 description 9
- 239000007787 solid Substances 0.000 description 9
- 230000006870 function Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 230000014759 maintenance of location Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 238000007667 floating Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 230000032683 aging Effects 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 239000002245 particle Substances 0.000 description 1
- 230000005641 tunneling Effects 0.000 description 1
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
The invention discloses a method and a device for migrating data. The invention comprises the following steps: traversing a plurality of data blocks contained in a block pool for storing user data and determining a target data block in a closed state under the condition that a task request is detected, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; and under the condition that the target closing time length is greater than or equal to the threshold value, executing data migration operation on the data stored in the data block. By the method and the device, the problems of long data storage time, data loss and abnormity in the related technology are solved.
Description
Technical Field
The invention relates to the field of data migration, in particular to a method and a device for data migration.
Background
In the related art, the stored data cannot be permanently stored, and a storage time limit exists. The problem of Data storage time in flash memory is called Data Retention, and when the Data is due to deadline, the Data will be in error, and the Data read from the flash memory cannot be corrected successfully by using an instruction error correction technique (ECC). The mechanism of flash memory storage is that electrons jump to the floating gate layer and remain there through quantum tunneling effect, and as time goes by, the electrons leave the floating gate layer with a certain probability and return to the channel, and the separated electrons may cause the read result of the written cell to be the same as that of the erased cell, and data errors occur.
The data retention time in flash memory is very limited, and in the flash memory (SLC) era in which 1BIT data is stored in a memory cell, the data retention time can last for several years, and in the flash memory (TLC) era in which 3BIT data is stored in a memory cell, the data retention time is less than one year, and some are only several months. Meanwhile, as the flash memory is used for a longer time, the erasing times of the flash memory are more, and the storage time of the data is shorter, and when the rated erasing times are reached, for example, the erasing times reach 3000 times, newly stored data are easy to make mistakes.
In view of the above problems in the related art, no effective solution has been proposed.
Disclosure of Invention
The invention mainly aims to provide a method and a device for migrating data, so as to solve the problems of long data storage time, data loss and abnormity in the related technology.
To achieve the above object, according to one aspect of the present invention, there is provided a method of migrating data. The invention comprises the following steps: traversing a plurality of data blocks contained in a block pool for storing user data and determining a target data block in a closed state under the condition that a task request is detected, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; and under the condition that the target closing time length is greater than or equal to the threshold value, executing data migration operation on the data stored in the data block.
Further, determining a target closing duration corresponding to the target data block includes: acquiring current system time and opening time corresponding to the latest write-in data of a target data block; determining the difference time length between the system time and the opening time to determine the initial closing time length corresponding to the target data block; determining whether the target data block corresponds to a penalty value; determining a punishment duration corresponding to the punishment value under the condition that the target data block corresponds to the punishment value; and determining the total duration of the initial closing duration and the punishment duration as a target closing duration.
Further, determining whether the target data block corresponds to a penalty value includes: determining whether the target data block corresponds to historical erasing actions, wherein when data is written into the target data block, clearing operation is carried out on the data in the target data block to finish one erasing action; and determining that the target data block corresponds to a penalty value under the condition that the target data block corresponds to the historical erasing action.
Further, under the condition that the target data block corresponds to the penalty value, determining a penalty duration corresponding to the penalty value includes: acquiring erasing times corresponding to the erasing actions, wherein the erasing times correspond to the erasing actions one by one; determining a setting rule of the punishment duration, wherein the setting rule is that when the erasing frequency reaches a first preset value, the punishment duration is determined to be increased by the first preset duration; and calculating punishment duration according to the erasing times and the set rule.
Further, in a case that the target closing duration is greater than or equal to the threshold, after the data migration operation is performed on the data stored in the data block, the method further includes: recording operation time corresponding to the data migration operation; after the second preset time length passes after the operation time, determining whether the current execution condition meets the preset condition; and under the condition that the current execution condition meets the preset condition, triggering a task request to execute data migration operation on the target data block.
Further, after a second preset duration passes after the operation time, determining whether the current execution condition meets a preset condition, including: judging whether the second preset time length is greater than or equal to the trigger threshold time length corresponding to the data migration operation or not; judging whether a data migration operation is executed in a block pool or not; and under the condition that the second preset time length is greater than or equal to the trigger threshold time length and no data migration operation exists in the block pool, determining that the current execution condition meets the preset condition.
To achieve the above object, according to another aspect of the present invention, there is provided an apparatus for migrating data. The device includes: the traversing unit traverses a plurality of data blocks contained in a block pool for storing user data and determines a target data block in a closed state under the condition of detecting a task request, wherein the task request is used for triggering a task to clear out-of-date or abnormal data; the first determining unit is used for determining the target closing time length corresponding to the target data block; the judging unit is used for judging whether the target closing time length is greater than or equal to a threshold value; and the execution unit executes data migration operation on the data stored in the data block under the condition that the target closing time length is greater than or equal to the threshold value.
Further, the obtaining subunit obtains the current system time and the opening time corresponding to the latest write-in data of the target data block; the first determining subunit determines an initial closing time length corresponding to the target data block according to the difference time length between the system time and the opening time; the second determining subunit determines whether the target data block corresponds to a penalty value; the third determining subunit determines a penalty duration corresponding to the penalty value under the condition that the target data block corresponds to the penalty value; and the fourth determining subunit determines the total duration of the initial closing duration and the penalty duration as the target closing duration.
To achieve the above object, according to another aspect of the present application, there is provided a computer-readable storage medium including a stored program, wherein the program performs a method of migrating data of any one of the above.
To achieve the above object, according to another aspect of the present application, there is provided a processor for executing a program, wherein the program performs a method of migrating data of any one of the above.
The invention adopts the following steps: traversing a plurality of data blocks contained in a block pool for storing user data and determining a target data block in a closed state under the condition that a task request is detected, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; under the condition that the target closing time is longer than or equal to the threshold value, data migration operation is carried out on the data stored in the data block, the problems that data storage time is long and data loss and abnormity occur in the related technology are solved, and the technical effect of greatly improving the effectiveness of the data is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow chart of a method for migrating data according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for garbage collecting data according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an apparatus for migrating data according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged under appropriate circumstances in order to facilitate the description of the embodiments of the invention herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Interpretation of terms:
ssd (solid state disk): a solid state disk;
gc (garpage collection): garbage collection for collecting the physical storage space occupied by invalid data;
PB (pool Block): a data block within a block pool;
SWL (static Wear leving): static equalization;
SLC: (Single Level Cell): a flash memory with a memory cell for storing 1bit data;
TLC: (Triple Level Cell): a flash memory with a memory cell for storing 3-bit data.
According to an embodiment of the present invention, a method of migrating data is provided.
FIG. 1 is a flow chart of a method of migrating data in accordance with an embodiment of the present invention. As shown in fig. 1, the present invention comprises the steps of:
step S101, under the condition that a task request is detected, traversing a plurality of data blocks contained in a block pool used for storing user data, and determining a target data block in a closed state, wherein the task request is used for triggering a task to clear out-of-date or abnormal data.
The application provides a method for migrating expired data to guarantee validity of the data on a DDS medium aiming at data stored on an SSD, wherein the SSD comprises a plurality of PBs, each PB stores data, the PBs in the SSD can be in different states, such as an open state, a state in write-in data or a closed state, and the application detects the data of the PB in the closed state aiming at the PB in the closed state.
Further, the traversal unit traverses a plurality of PBs in the shutdown state contained in the block pool of the user data upon detecting a task request triggering cleaning of expired or abnormal data.
And step S102, determining the target closing time length corresponding to the target data block.
In the above, in the present application, it is determined whether the data stored in the PB needs to be migrated by determining the closing duration when the PB is in the closing state.
It should be noted that in an alternative embodiment, data migration is equal to garbage collection of data.
Step S103, judging whether the target closing time length is larger than or equal to a threshold value.
In the foregoing, the relationship between the target closing duration and the threshold is compared, where the threshold is the longest duration of the PB stored data, and when the threshold is exceeded, the PB stored data may have a problem of data loss or data abnormality, where a specific threshold is specifically set according to a specific situation of the PB in different block pools.
And step S104, executing data migration operation on the data stored in the data block under the condition that the target closing duration is greater than or equal to the threshold value.
In the foregoing manner, when the determined target closing duration is greater than or equal to the threshold, the data migration operation is performed on the data stored in the data block, so as to avoid the problem of data loss or data anomaly.
By the method, the application is applied to the solid state disks of different projects and different versions, and the method has strong usability.
According to the method and the device, the target data block in the closed state is checked, so that the stability of the service flow of the solid state disk is ensured. The data block traversing task is periodically and regularly triggered at the background, the whole process does not need human intervention, and the method has the characteristics of convenience and easiness in use and effectively reduces the maintenance cost. The requirement of the solid state disk on the validity of the stored data is improved, so that the quality of the solid state disk is further improved.
In an optional example, determining a target closing duration corresponding to a target data block includes: acquiring current system time and opening time corresponding to the latest write-in data of a target data block; determining the difference time length between the system time and the opening time to determine the initial closing time length corresponding to the target data block; determining whether the target data block corresponds to a penalty value; determining a punishment duration corresponding to the punishment value under the condition that the target data block corresponds to the punishment value; and determining the total duration of the initial closing duration and the punishment duration as a target closing duration.
In the above, when the system is initially powered on, the running time of the current system is refreshed, and the timer is started, preferably, the period is 1 second, and the time for acquiring the initial power-on of the system is the time of the current system, and the range is 1-24 hours. In the system power-on time, a task request is triggered to determine the opening time corresponding to the latest written data of a target data block, the initial closing time corresponding to the target data block is the difference value between the opening time corresponding to the latest written data of the target data block and the system time, meanwhile, whether the target data block has a corresponding penalty value needs to be determined, and if the penalty value is determined, the penalty time corresponding to the penalty value needs to be added to the target closing time.
In an alternative example, determining whether the target data block corresponds to a penalty value includes: determining whether the target data block corresponds to historical erasing actions, wherein when data is written into the target data block, clearing operation is carried out on the data in the target data block to finish one erasing action; and determining that the target data block corresponds to a penalty value under the condition that the target data block corresponds to the historical erasing action.
In the above, in an embodiment provided by the application, the historical erasing and writing actions of the PB correspondingly generate a penalty value, and when the PB writes data once, the old data is erased and then written into the new data, the erasing and writing actions may cause aging and other problems of the PB.
It should be noted that the penalty value is specifically set in a specific case.
In an alternative example, in the case that the target data block corresponds to the penalty value, determining a penalty duration corresponding to the penalty value includes: acquiring erasing times corresponding to the erasing actions, wherein the erasing times correspond to the erasing actions one by one; determining a setting rule of the punishment duration, wherein the setting rule is that when the erasing frequency reaches a first preset value, the punishment duration is determined to be increased by the first preset duration; and calculating punishment duration according to the erasing times and the set rule.
As described above, the setting rule of the punishment duration is determined according to the erasing times corresponding to the erasing actions, for example, the first preset value is 500 times, the first preset value can be set according to different usage scenarios, the punishment duration corresponding to the erasing times of 500 times is 50 days, the first preset duration can be set according to different usage scenarios, for example, for the first data block and the second data block, the punishment duration is increased by 50 days when the erasing times reach 500 times. The initial closing time of the first data block is 366 days, the historical erasing times do not exist, the threshold value is 365 days, and if the 366 days is larger than 365 days, the data migration operation is executed. The initial closing time of the second data block is 266 days, the erasing times reach 1000 times, the corresponding penalty time is 100 days, the target closing time is 366 days, 366 days are larger than 365 days, and the data migration operation also needs to be executed.
In an optional example, in a case that the target shutdown duration is greater than or equal to the threshold, after the data migration operation is performed on the data stored in the data block, the method further includes: recording operation time corresponding to the data migration operation; after the second preset time length passes after the operation time, determining whether the current execution condition meets the preset condition; and under the condition that the current execution condition meets the preset condition, triggering a task request to execute data migration operation on the target data block.
In the foregoing, in the power-on process of the system in the application, it is dynamically and cyclically determined whether the target data block needs the data migration operation, preferably, the second preset time duration is 24 hours, the second preset time duration may be set according to different usage scenarios, the operation time corresponding to the data migration operation is recorded, and after the operation time passes through the correspondingly set period time duration, when it is determined that the execution condition of the current data block meets a certain condition, the task request is triggered to execute the data migration operation on the target data block.
In an optional example, after the second preset time period passes after the operation time, determining whether the current execution condition meets the preset condition includes: judging whether the second preset time length is greater than or equal to the trigger threshold time length corresponding to the data migration operation or not; judging whether a data migration operation is executed in a block pool or not; and under the condition that the second preset time length is greater than or equal to the trigger threshold time length and no data migration operation exists in the block pool, determining that the current execution condition meets the preset condition.
The meeting of the preset condition includes the following cases:
1. because the data migration operation can not be performed at any time, but is performed periodically, it is necessary to determine whether the time length after the last data migration operation reaches the period time length corresponding to the data migration, if so, perform the data migration operation, and if not, ignore the request;
2. and judging whether a data migration operation is executed in the block pool, and if so, ignoring the request.
In an embodiment provided by the application, a method for ensuring validity storage of data on an SSD solid state disk is provided for data stored on the SSD solid state disk, a timing task is started in a background to SCAN valid user data contained in a POOL of the SSD solid state disk, and whether a lifetime of the PB stored data exceeds a set threshold is determined, if the lifetime exceeds the threshold, the PB needs to be sent to a background GC for garbage recovery to perform data migration, thereby solving a problem that the data on NAND particles is invalid after a time limit due to long-term unavailability of host access or access of a background SCAN.
Fig. 2 is a flowchart of a method for performing garbage collection on data according to an embodiment of the present invention, and the specific process is as shown in fig. 2, where a task request is submitted, an initial system running time is obtained, a PB is traversed, whether the PB exceeds 1 day from the end of the last traversal task is regularly checked, if not, the task is ignored, if yes, it is continuously determined whether the PB is in a closed state and the target running time exceeds a threshold value, if not, the task is ignored, if yes, it is continuously determined whether a background task is processing, if yes, the task is ignored, and if not, the following operation needs to be performed: 1. and inquiring whether the erasing and writing times of the PB reach a preset value, and increasing a penalty value when the erasing and writing times of the PB exceed the preset value. 2. And checking the state of the PB, and adding 50 days to the punishment duration if the erasing times exceed the punishment value, or else, adding 0 day to the punishment duration. 3. And accumulating whether the target closing duration and the punishment duration exceed the threshold value. If not, ignoring the task, if all tasks are yes, calling GC garbage recovery, finishing the current PB processing, if traversing is not finished, continuing to scan the PB, otherwise, finishing the background check.
According to the method for migrating data, provided by the embodiment of the invention, under the condition that a task request is detected, traversing a plurality of data blocks contained in a block pool for storing user data, and determining a target data block in a closed state, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; under the condition that the target closing time is longer than or equal to the threshold value, data migration operation is carried out on the data stored in the data block, the problems that data storage time is long and data loss and abnormity occur in the related technology are solved, and the technical effect of greatly improving the effectiveness of the data is achieved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The embodiment of the present invention further provides a device for migrating data, and it should be noted that the device for migrating data of the embodiment of the present invention may be used to execute the method for migrating data provided by the embodiment of the present invention. The following describes an apparatus for migrating data according to an embodiment of the present invention.
FIG. 3 is a diagram illustrating an apparatus for migrating data according to an embodiment of the present invention. As shown in fig. 3, the apparatus includes: the traversal unit 301, when detecting a task request, traverses a plurality of data blocks included in a block pool for storing user data, and determines a target data block in a closed state, where the task request is used to trigger a task to clean out expired or abnormal data; a first determining unit 302, configured to determine a target closing duration corresponding to a target data block; the judging unit 303 judges whether the target closing time length is greater than or equal to a threshold value; the execution unit 304 performs a data migration operation on the data stored in the data block when the target closing duration is greater than or equal to the threshold value.
In an alternative example, the first determining unit 302 includes: the acquisition subunit acquires the current system time and the opening time corresponding to the latest write-in data of the target data block; the first determining subunit determines an initial closing time length corresponding to the target data block according to the difference time length between the system time and the opening time; the second determining subunit determines whether the target data block corresponds to a penalty value; the third determining subunit determines a penalty duration corresponding to the penalty value under the condition that the target data block corresponds to the penalty value; and the fourth determining subunit determines the total duration of the initial closing duration and the penalty duration as the target closing duration.
In an alternative example, the second determining subunit includes: the first determining module is used for determining whether the target data block corresponds to historical erasing actions, wherein when data are written into the target data block, the data in the target data block are emptied to finish one erasing action; and the second determining module is used for determining that the target data block correspondingly has a penalty value under the condition that the target data block correspondingly has historical erasing and writing actions.
In an alternative example, the third determining subunit includes: the acquisition module is used for acquiring the erasing times corresponding to the erasing actions, wherein the erasing times correspond to the erasing actions one by one; the third determining module is used for determining a setting rule of the punishment duration, wherein the setting rule is that when the erasing frequency reaches a first preset value, the punishment duration is determined to be increased by the first preset duration; and the calculation module calculates punishment duration according to the erasing times and the setting rule.
In an optional example, the apparatus further comprises: the recording unit is used for recording the operation time corresponding to the data migration operation after the data migration operation is performed on the data stored in the data block under the condition that the target closing duration is greater than or equal to the threshold value; a second determination unit that determines whether the current execution condition meets a preset condition after a second preset duration after the operation time; and the triggering unit is used for triggering the task request to execute data migration operation on the target data block under the condition that the current execution condition meets the preset condition.
In an optional example, the second determining unit includes: the first judgment subunit judges whether the second preset time length is greater than or equal to a trigger threshold time length corresponding to the data migration operation; the second judgment subunit judges whether the data migration operation is executed in the block pool or not; and the fifth determining subunit determines that the current execution condition meets the preset condition under the condition that the second preset time length is greater than or equal to the trigger threshold time length and no data migration operation exists in the block pool.
According to the device for migrating data, provided by the embodiment of the invention, under the condition that a task request is detected, a plurality of data blocks contained in a block pool for storing user data are traversed, and a target data block in a closed state is determined, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; under the condition that the target closing time is longer than or equal to the threshold value, data migration operation is carried out on the data stored in the data block, the problems that data storage time is long and data loss and abnormity occur in the related technology are solved, and the technical effect of greatly improving the effectiveness of the data is achieved.
The device for migrating data comprises a processor and a memory, wherein the traversal unit 301 and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the technical problems of long data storage time, data loss and abnormity in the related technology are solved by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a computer-readable storage medium on which a program is stored, which, when executed by a processor, implements the method for migrating data.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program executes the method for migrating data when running.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps: traversing a plurality of data blocks contained in a block pool for storing user data and determining a target data block in a closed state under the condition that a task request is detected, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; and under the condition that the target closing time length is greater than or equal to the threshold value, executing data migration operation on the data stored in the data block.
In an optional example, determining a target closing duration corresponding to a target data block includes: acquiring current system time and opening time corresponding to the latest write-in data of a target data block; determining the difference time length between the system time and the opening time to determine the initial closing time length corresponding to the target data block; determining whether the target data block corresponds to a penalty value; determining a punishment duration corresponding to the punishment value under the condition that the target data block corresponds to the punishment value; and determining the total duration of the initial closing duration and the punishment duration as a target closing duration.
In an alternative example, determining whether the target data block corresponds to a penalty value includes: determining whether the target data block corresponds to historical erasing actions, wherein when data is written into the target data block, clearing operation is carried out on the data in the target data block to finish one erasing action; and determining that the target data block corresponds to a penalty value under the condition that the target data block corresponds to the historical erasing action.
In an alternative example, in the case that the target data block corresponds to the penalty value, determining a penalty duration corresponding to the penalty value includes: acquiring erasing times corresponding to the erasing actions, wherein the erasing times correspond to the erasing actions one by one; determining a setting rule of the punishment duration, wherein the setting rule is that when the erasing frequency reaches a first preset value, the punishment duration is determined to be increased by the first preset duration; and calculating punishment duration according to the erasing times and the set rule.
In an optional example, in a case that the target shutdown duration is greater than or equal to the threshold, after the data migration operation is performed on the data stored in the data block, the method further includes: recording operation time corresponding to the data migration operation; after the second preset time length passes after the operation time, determining whether the current execution condition meets the preset condition; and under the condition that the current execution condition meets the preset condition, triggering a task request to execute data migration operation on the target data block.
In an optional example, after the second preset time period passes after the operation time, determining whether the current execution condition meets the preset condition includes: judging whether the second preset time length is greater than or equal to the trigger threshold time length corresponding to the data migration operation or not; judging whether a data migration operation is executed in a block pool or not; and under the condition that the second preset time length is greater than or equal to the trigger threshold time length and no data migration operation exists in the block pool, determining that the current execution condition meets the preset condition.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The invention also provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: traversing a plurality of data blocks contained in a block pool for storing user data and determining a target data block in a closed state under the condition that a task request is detected, wherein the task request is used for triggering a task to clean out expired or abnormal data; determining a target closing time length corresponding to the target data block; judging whether the target closing time length is greater than or equal to a threshold value; and under the condition that the target closing time length is greater than or equal to the threshold value, executing data migration operation on the data stored in the data block.
In an optional example, determining a target closing duration corresponding to a target data block includes: acquiring current system time and opening time corresponding to the latest write-in data of a target data block; determining the difference time length between the system time and the opening time to determine the initial closing time length corresponding to the target data block; determining whether the target data block corresponds to a penalty value; determining a punishment duration corresponding to the punishment value under the condition that the target data block corresponds to the punishment value; and determining the total duration of the initial closing duration and the punishment duration as a target closing duration.
In an alternative example, determining whether the target data block corresponds to a penalty value includes: determining whether the target data block corresponds to historical erasing actions, wherein when data is written into the target data block, clearing operation is carried out on the data in the target data block to finish one erasing action; and determining that the target data block corresponds to a penalty value under the condition that the target data block corresponds to the historical erasing action.
In an alternative example, in the case that the target data block corresponds to the penalty value, determining a penalty duration corresponding to the penalty value includes: acquiring erasing times corresponding to the erasing actions, wherein the erasing times correspond to the erasing actions one by one; determining a setting rule of the punishment duration, wherein the setting rule is that when the erasing frequency reaches a first preset value, the punishment duration is determined to be increased by the first preset duration; and calculating punishment duration according to the erasing times and the set rule.
In an optional example, in a case that the target shutdown duration is greater than or equal to the threshold, after the data migration operation is performed on the data stored in the data block, the method further includes: recording operation time corresponding to the data migration operation; after the second preset time length passes after the operation time, determining whether the current execution condition meets the preset condition; and under the condition that the current execution condition meets the preset condition, triggering a task request to execute data migration operation on the target data block.
In an optional example, after the second preset time period passes after the operation time, determining whether the current execution condition meets the preset condition includes: judging whether the second preset time length is greater than or equal to the trigger threshold time length corresponding to the data migration operation or not; judging whether a data migration operation is executed in a block pool or not; and under the condition that the second preset time length is greater than or equal to the trigger threshold time length and no data migration operation exists in the block pool, determining that the current execution condition meets the preset condition.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present invention, and are not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims (10)
1. A method of migrating data, comprising:
traversing a plurality of data blocks contained in a block pool for storing user data and determining a target data block in a closed state under the condition that a task request is detected, wherein the task request is used for triggering a task to clean out expired or abnormal data;
determining a target closing time length corresponding to the target data block;
judging whether the target closing time length is greater than or equal to a threshold value;
and under the condition that the target closing duration is greater than or equal to the threshold value, executing data migration operation on the data stored in the data block.
2. The method of claim 1, wherein determining the target closing duration corresponding to the target data block comprises:
acquiring current system time and opening time corresponding to the latest write-in data of the target data block;
determining the initial closing time length corresponding to the target data block according to the difference time length between the system time and the opening time;
determining whether the target data block corresponds to a penalty value;
determining a penalty duration corresponding to the penalty value under the condition that the target data block corresponds to the penalty value;
and determining the total duration of the initial closing duration and the punishment duration as the target closing duration.
3. The method of claim 2, wherein determining whether the target data block corresponds to a penalty value comprises:
determining whether the target data block corresponds to historical erasing actions, wherein when data is written into the target data block, clearing operation is carried out on the data in the target data block to finish one erasing action;
and determining that the target data block corresponds to the penalty value under the condition that the target data block corresponds to the historical erasing action.
4. The method according to claim 3, wherein determining a penalty duration corresponding to the penalty value in the case that the target data block corresponds to the penalty value comprises:
acquiring erasing times corresponding to the erasing actions, wherein the erasing times correspond to the erasing actions one by one;
determining a setting rule of the punishment duration, wherein the setting rule is that when the erasing frequency reaches a first preset value, the punishment duration is determined to be increased by a first preset duration;
and calculating the punishment duration according to the erasing times and the set rule.
5. The method according to claim 1, wherein after performing a data migration operation on the data stored in the data block if the target shutdown duration is greater than or equal to the threshold value, the method further comprises:
recording operation time corresponding to the data migration operation;
after the second preset time length passes after the operation time, determining whether the current execution condition meets the preset condition;
and under the condition that the current execution condition meets the preset condition, triggering the task request to execute the data migration operation on the target data block.
6. The method of claim 5, wherein determining whether the current execution condition meets a preset condition after a second preset duration after the operating time comprises:
judging whether the second preset time length is greater than or equal to a trigger threshold time length corresponding to the data migration operation;
judging whether the data migration operation is executed in the block pool;
and determining that the current execution condition meets the preset condition under the condition that the second preset time length is greater than or equal to the trigger threshold time length and the data migration operation does not exist in the block pool.
7. An apparatus for migrating data, comprising:
the system comprises a traversing unit, a storage unit and a processing unit, wherein the traversing unit traverses a plurality of data blocks contained in a block pool for storing user data and determines a target data block in a closed state under the condition of detecting a task request, and the task request is used for triggering a task to clear out-of-date or abnormal data;
the first determining unit is used for determining a target closing time length corresponding to the target data block;
the judging unit is used for judging whether the target closing time length is greater than or equal to a threshold value;
and the execution unit executes data migration operation on the data stored in the data block under the condition that the target closing time length is greater than or equal to the threshold value.
8. The apparatus of claim 7, wherein the first determining unit comprises:
the acquisition subunit acquires the current system time and the opening time corresponding to the latest write-in data of the target data block;
the first determining subunit determines an initial closing time length corresponding to the target data block according to a difference time length between the system time and the opening time;
the second determining subunit determines whether the target data block corresponds to a penalty value;
the third determining subunit determines a penalty duration corresponding to the penalty value under the condition that the target data block corresponds to the penalty value;
and the fourth determining subunit determines the total duration of the initial closing duration and the penalty duration as the target closing duration.
9. A computer-readable storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform a method for migrating data according to any one of claims 1 through 6.
10. A processor configured to execute a program, wherein the program executes a method for migrating data according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111645541.6A CN114327279A (en) | 2021-12-29 | 2021-12-29 | Data migration method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111645541.6A CN114327279A (en) | 2021-12-29 | 2021-12-29 | Data migration method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114327279A true CN114327279A (en) | 2022-04-12 |
Family
ID=81016065
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111645541.6A Pending CN114327279A (en) | 2021-12-29 | 2021-12-29 | Data migration method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114327279A (en) |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102081576A (en) * | 2011-03-01 | 2011-06-01 | 华中科技大学 | Flash memory wear balance method |
CN104268099A (en) * | 2014-08-29 | 2015-01-07 | 浪潮(北京)电子信息产业有限公司 | Management data reading and writing method and device |
CN105183386A (en) * | 2015-09-14 | 2015-12-23 | 联想(北京)有限公司 | Information processing method and electronic equipment |
CN106598484A (en) * | 2016-11-17 | 2017-04-26 | 华为技术有限公司 | Data storage method, flash memory chip and storage device |
CN110347335A (en) * | 2019-07-30 | 2019-10-18 | 河南文正电子数据处理有限公司 | A kind of solid state hard disk date storage method, device |
CN111104045A (en) * | 2018-10-25 | 2020-05-05 | 深圳市中兴微电子技术有限公司 | Storage control method, device, equipment and computer storage medium |
CN111414138A (en) * | 2020-03-19 | 2020-07-14 | 青岛镕铭半导体有限公司 | Wear leveling method and device for solid state disk |
CN112015347A (en) * | 2020-08-28 | 2020-12-01 | 北京浪潮数据技术有限公司 | Data migration method and device and related equipment |
CN112306989A (en) * | 2020-10-26 | 2021-02-02 | 北京健康之家科技有限公司 | Database instance processing method and device, storage medium and electronic device |
CN112732179A (en) * | 2020-12-29 | 2021-04-30 | 北京浪潮数据技术有限公司 | Data management method of SSD (solid State disk) and related device |
CN113535082A (en) * | 2021-06-09 | 2021-10-22 | 杭州电子科技大学 | Method for realizing wear inverse equilibrium |
-
2021
- 2021-12-29 CN CN202111645541.6A patent/CN114327279A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102081576A (en) * | 2011-03-01 | 2011-06-01 | 华中科技大学 | Flash memory wear balance method |
CN104268099A (en) * | 2014-08-29 | 2015-01-07 | 浪潮(北京)电子信息产业有限公司 | Management data reading and writing method and device |
CN105183386A (en) * | 2015-09-14 | 2015-12-23 | 联想(北京)有限公司 | Information processing method and electronic equipment |
CN106598484A (en) * | 2016-11-17 | 2017-04-26 | 华为技术有限公司 | Data storage method, flash memory chip and storage device |
CN111104045A (en) * | 2018-10-25 | 2020-05-05 | 深圳市中兴微电子技术有限公司 | Storage control method, device, equipment and computer storage medium |
CN110347335A (en) * | 2019-07-30 | 2019-10-18 | 河南文正电子数据处理有限公司 | A kind of solid state hard disk date storage method, device |
CN111414138A (en) * | 2020-03-19 | 2020-07-14 | 青岛镕铭半导体有限公司 | Wear leveling method and device for solid state disk |
CN112015347A (en) * | 2020-08-28 | 2020-12-01 | 北京浪潮数据技术有限公司 | Data migration method and device and related equipment |
CN112306989A (en) * | 2020-10-26 | 2021-02-02 | 北京健康之家科技有限公司 | Database instance processing method and device, storage medium and electronic device |
CN112732179A (en) * | 2020-12-29 | 2021-04-30 | 北京浪潮数据技术有限公司 | Data management method of SSD (solid State disk) and related device |
CN113535082A (en) * | 2021-06-09 | 2021-10-22 | 杭州电子科技大学 | Method for realizing wear inverse equilibrium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8230192B2 (en) | System and method for QoS-based storage tiering and migration technique | |
US8745318B2 (en) | Parameter tracking for memory devices | |
US10592134B1 (en) | Open block stability scanning | |
CN108369818B (en) | Flash memory device refreshing method and device | |
US20140059405A1 (en) | Solid-state drive retention monitor using reference blocks | |
US20120151260A1 (en) | System and Method for Autonomous NAND Refresh | |
US20140254042A1 (en) | Dynamic allocation of lba to un-shingled media partition | |
US9086805B2 (en) | Dynamic tracking of storage region operating parameters | |
JP2009512119A (en) | How to store and process corrected data | |
US9996423B2 (en) | Point in time snapshots using copy on predicted write | |
US10204693B2 (en) | Retiring computer memory blocks | |
US10452280B2 (en) | Hybrid storage system employing reconfigurable memory | |
US9785438B1 (en) | Media cache cleaning based on workload | |
US20140047281A1 (en) | Memory system and memory controller | |
JP5343817B2 (en) | Storage device | |
CN107402726B (en) | Method and system for determining data inspection cycle of solid state disk | |
RU2600525C2 (en) | Method of controlling service life of non-volatile memory | |
US20220171562A1 (en) | Garbage collection in a memory component using an adjusted parameter | |
US9336250B1 (en) | Systems and methods for efficiently backing up data | |
CN115269451A (en) | Flash memory garbage recycling method and device and readable storage medium | |
CN105204958A (en) | Coding method for prolonging NAND Flash data reliable storage time | |
US9892033B1 (en) | Management of memory units | |
CN114327279A (en) | Data migration method and device | |
US20140304557A1 (en) | Primary memory module with record of usage history | |
WO2023138264A1 (en) | Ssd data management method and related component |
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 |