CN112988040B - Data storage method, device and equipment and readable storage medium - Google Patents

Data storage method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN112988040B
CN112988040B CN201911310513.1A CN201911310513A CN112988040B CN 112988040 B CN112988040 B CN 112988040B CN 201911310513 A CN201911310513 A CN 201911310513A CN 112988040 B CN112988040 B CN 112988040B
Authority
CN
China
Prior art keywords
data
timestamp
updating
period
target
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.)
Active
Application number
CN201911310513.1A
Other languages
Chinese (zh)
Other versions
CN112988040A (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.)
Shenzhen Dapu Microelectronics Co Ltd
Original Assignee
Shenzhen Dapu Microelectronics 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 Shenzhen Dapu Microelectronics Co Ltd filed Critical Shenzhen Dapu Microelectronics Co Ltd
Priority to CN201911310513.1A priority Critical patent/CN112988040B/en
Priority to PCT/CN2020/115543 priority patent/WO2021120731A1/en
Publication of CN112988040A publication Critical patent/CN112988040A/en
Application granted granted Critical
Publication of CN112988040B publication Critical patent/CN112988040B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • 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/061Improving I/O performance
    • 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
    • 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/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket

Abstract

The application discloses a data storage method, a data storage device, data storage equipment and a readable storage medium. The method disclosed by the application comprises the following steps: acquiring a logic address and an operation I/O timestamp corresponding to the I/O data; judging whether the recording I/O time stamp of the logical address is an initial time stamp or not; if not, updating the update cycle of the logic address into the difference value of the operation I/O time stamp and the record I/O time stamp; updating the recording I/O timestamp to an operating I/O timestamp; respectively calculating the difference between the updating period and the preset period of each group; and storing the I/O data to a target physical block corresponding to the target grouping corresponding to the minimum difference degree. The application can store data with similar liveness in the same physical block, and separate storage of cold data and hot data is realized, so that the service life and the performance of the storage medium can be improved. The data storage device, the equipment and the readable storage medium disclosed by the application also have the technical effects.

Description

Data storage method, device and equipment and readable storage medium
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a data storage method, apparatus, device, and readable storage medium.
Background
In a solid state disk and a Nand Flash storage medium, the space occupied by invalid data pages can be released through an erasing block, so that the recovery of available space is realized. The erase block may cause migration of valid data pages, and when there are many valid data pages, the data writing amount may be increased (i.e., write amplification), and the increase of the data writing amount may aggravate wear of the storage medium, and reduce the life and performance of the storage medium.
Taking a solid state disk as an example, the solid state disk includes a plurality of physical blocks, and each physical block includes a plurality of data pages. If the storage space is released by the erase block, the data in the valid data page in the current physical block needs to be migrated to another physical block, so as to release the storage space of the current physical block. If the number of valid data pages in the current physical block is large, the data migration volume and the write volume are large, and therefore the performance of the solid state disk is directly affected.
Therefore, how to reduce the wear of the storage medium and improve the life and performance of the storage medium is a problem to be solved by those skilled in the art.
Disclosure of Invention
In view of the above, an object of the present application is to provide a data storage method, apparatus, device and readable storage medium, so as to reduce the wear of the storage medium and improve the life and performance of the storage medium. The specific scheme is as follows:
in a first aspect, the present application provides a data storage method, including:
acquiring a logic address and an operation I/O timestamp corresponding to the I/O data;
judging whether the recording I/O timestamp of the logical address is an initial timestamp;
if not, updating the update cycle of the logic address to be the difference value of the operation I/O time stamp and the recording I/O time stamp;
updating the record I/O timestamp to the operation I/O timestamp;
respectively calculating the difference degree between the updating period and the preset period of each group;
and storing the I/O data to a target physical block corresponding to a target group corresponding to the minimum difference degree.
Preferably, the method further comprises the following steps:
if the recorded I/O timestamp is the initial timestamp, judging whether the updating period is the initial period;
if so, updating the recording I/O timestamp to the operation I/O timestamp, and updating the updating period to a minimum preset period;
and storing the I/O data to an object physical block corresponding to the object group corresponding to the minimum preset period.
Preferably, the method further comprises the following steps:
if the updating period is not the initial period, keeping the updating period, and updating the recording I/O timestamp into the operating I/O timestamp; respectively calculating the difference degree between the updating period and the preset period of each group; and storing the I/O data to a target physical block corresponding to a target group corresponding to the minimum difference degree.
Preferably, the storing the I/O data to the target physical block corresponding to the target packet corresponding to the minimum difference degree includes:
and writing the I/O data into a target data page corresponding to the target grouping, wherein the target data page is a physical data page in the target physical block.
Preferably, the method further comprises the following steps:
and updating the preset period of the target grouping to be the average value of the updating periods of all the logic addresses corresponding to the target grouping.
Preferably, the method further comprises the following steps:
judging whether the number of the data pages corresponding to the target group is twice of the number of the data pages corresponding to other groups;
if so, closing the group with the least data page number in all the groups, splitting the target group into two groups, and establishing the corresponding relation between the two groups and the target physical block.
Preferably, the determining whether the recording I/O timestamp of the logical address is before the initial timestamp further includes:
and determining an address range to which the logical address belongs, and determining a recording I/O timestamp and an updating period of the address range as the recording I/O timestamp and the updating period of the logical address.
In a second aspect, the present application provides a data storage device comprising:
the acquisition module is used for acquiring a logic address and an operation I/O timestamp corresponding to the I/O data;
the judging module is used for judging whether the recording I/O time stamp of the logic address is an initial time stamp or not;
a first updating module, configured to update an updating period of the logical address to a difference between the operation I/O timestamp and the recording I/O timestamp if the recording I/O timestamp is not the initial timestamp;
a second updating module for updating the recording I/O timestamp to the operating I/O timestamp;
the calculation module is used for calculating the difference degree between the updating period and the preset period of each group;
and the storage module is used for storing the I/O data to a target physical block corresponding to the target group corresponding to the minimum difference degree.
In a third aspect, the present application provides a data storage device, comprising: a storage unit and a main controller, wherein:
the storage unit comprises a physical block, and a physical data page in the physical block is used for storing I/O data;
the main controller is used for executing the data storage method disclosed in the foregoing.
In a fourth aspect, the present application provides a readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the data storage method disclosed above.
According to the scheme, the data storage method comprises the following steps: acquiring a logic address and an operation I/O timestamp corresponding to the I/O data; judging whether the recording I/O timestamp of the logical address is an initial timestamp; if not, updating the update cycle of the logic address to be the difference value of the operation I/O time stamp and the recording I/O time stamp; updating the record I/O timestamp to the operation I/O timestamp; respectively calculating the difference degree between the updating period and the preset period of each group; and storing the I/O data to a target physical block corresponding to a target group corresponding to the minimum difference degree.
In the present application, the logical address corresponds to a record I/O timestamp and an update period. If I/O data needs to be written in the logical address, judging whether the recording I/O time stamp of the logical address is the initial time stamp or not; and if not, updating the recorded I/O timestamp and the updating period of the logical address, further determining the difference degree between the updating period and the preset period of each group, and storing the current I/O data to a target physical block corresponding to the target group corresponding to the minimum difference degree. Therefore, a plurality of groups are preset in the application, each group has a preset period, and each group has a corresponding relation with a physical block. The updating period of the logic address represents the activity of data written by the logic address, and the shorter the updating period is, the more active the data is; the longer the update period, the less active the data is. Active data may be considered hot data and inactive data may be considered cold data. Therefore, if the difference between the update cycle of the logical address and the preset cycle of the packet is smaller, it indicates that the activity of the I/O data to be written is similar to that of the written data, the current I/O data is stored to the target physical block corresponding to the target packet with the minimum difference, so that the data with similar activity can be stored in the same physical block, and the separate storage of the cold data and the hot data is also realized. Therefore, if the storage space is released by erasing the block, the number of valid data pages remaining in the physical block is greatly reduced, so that the data writing amount and the wear of the storage medium can be reduced, and the service life and the performance of the storage medium can be improved.
Accordingly, the data storage device, the equipment and the readable storage medium provided by the application also have the technical effects.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of a data storage method disclosed herein;
FIG. 2 is a flow chart of a data processing method disclosed herein;
FIG. 3 is a flow chart of another data processing method disclosed herein;
FIG. 4 is a schematic diagram of a data storage device according to the present disclosure;
fig. 5 is a schematic diagram of a data storage device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
At present, when the storage space is released by an erase block in the prior art, the data migration amount and the write-in amount are large, which may aggravate the wear of the storage medium and reduce the life and performance of the storage medium. Therefore, the data storage scheme is provided, the abrasion of the storage medium can be reduced, and the service life and the performance of the storage medium can be improved.
Referring to fig. 1, an embodiment of the present application discloses a data storage method, including:
s101, obtaining a logical address and an operation I/O time stamp corresponding to the I/O data.
S102, judging whether a recording I/O time stamp of the logic address is an initial time stamp or not; if yes, executing S107; if not, S103 is executed.
And S103, updating the update cycle of the logical address into the difference value of the operation I/O time stamp and the recording I/O time stamp.
And S104, updating the recording I/O time stamp into an operation I/O time stamp.
And S105, respectively calculating the difference degree between the updating period and the preset period of each group.
And when the difference degree between the updating period and the preset period is calculated, the updated updating period is used. For example: the step S103 updates the update cycle from a to B, and then the step S105 calculates the degree of difference between B and the preset cycle of each packet, thereby obtaining a plurality of degrees of difference.
And S106, storing the I/O data to a target physical block corresponding to the target group corresponding to the minimum difference degree.
It should be noted that, in this embodiment, a plurality of packets are preset, each packet corresponds to a preset period, and each packet has a corresponding relationship with a physical block. If the current storage medium is a solid state disk, the number of the groups is not greater than the parallelism of the solid state disk, and the parallelism refers to the maximum number of physical blocks which can be written simultaneously. The updating period of the logic address represents the activity of data written by the logic address, and the shorter the updating period is, the more active the data is; the longer the update period, the less active the data is. Active data may be considered hot data and inactive data may be considered cold data. The preset period corresponding to each group represents the activity of the written data, so that if the difference between the update period of the logical address and the preset period of the group is smaller, the activity of the I/O data which needs to be written at present is similar to that of the written data.
For example: if the parallelism of the solid state disk is 3, at most 3 groups can be preset: a first packet, a second packet, and a third packet. Assume that the current preset period of the first packet is 8ms, the current preset period of the second packet is 16ms, and the current preset period of the third packet is 32ms. After the solid state disk is initialized, the first preset period of the grouping can be artificially determined according to experience or the rule of the service supported by the current solid state disk. Assuming that the updated update period corresponding to the logical address is 16ms, the difference between the update period and the preset period of the second packet is minimum, so that the I/O data corresponding to the logical address is stored in the physical block corresponding to the second packet.
In a preferred embodiment, storing the I/O data to a target physical block corresponding to a target packet corresponding to the minimum difference degree includes: and writing the I/O data into a target data page corresponding to the target grouping, wherein the target data page is a physical data page in the target physical block. The I/O data may be data corresponding to a host write operation, or may be data corresponding to a garbage collection operation (i.e., data in an active data page that needs to be migrated).
Specifically, storing the I/O data to the target physical block corresponding to the target packet corresponding to the minimum difference degree includes: determining a target group corresponding to the minimum difference degree; and marking the current logical address so that the current logical address corresponds to the target grouping, and writing the I/O data into a target data page corresponding to the target grouping. The corresponding relation between the logic address and the grouping changes along with the change of the updating period and the preset period, so that the corresponding relation between the logic address and the grouping changes in real time.
It should be noted that the preset period corresponding to the packet is updated according to the update of the update period of the corresponding logical address. For example: the current preset period of a certain group is 8, and the difference between the update period of the logical address corresponding to the I/O data and the preset period 8 is the minimum, so that after the current I/O data is written into the physical block corresponding to the group, the preset period of the current group can be updated according to the update period of the current logical address. In a preferred embodiment, the preset period may be updated to an average value of the update periods of all the logical addresses corresponding to the current packet.
In this embodiment, the preset period of the target packet may be updated to an average value of update periods of all logical addresses corresponding to the target packet.
In a preferred embodiment, after storing the I/O data to the target physical block corresponding to the target packet corresponding to the minimum preset period, the method further includes a packet splitting step. The packet splitting step specifically includes: judging whether the number of the data pages corresponding to the target group is twice of the number of the data pages corresponding to other groups; if so, closing the group with the least data page number in all the groups, splitting the target group into two groups, and establishing the corresponding relation between the two groups and the target physical block.
In a preferred embodiment, before storing the I/O data to the target physical block corresponding to the target packet corresponding to the minimum preset period, a packet splitting step is further included. The packet splitting step specifically includes: judging whether the number of the data pages corresponding to the target group is twice of the number of the data pages corresponding to other groups; if so, closing the group with the least data page number in all the groups, splitting the target group into two groups, and establishing the corresponding relation between the two groups and the target physical block.
That is, when the number of data pages corresponding to the target group is large, the target group is split into 2 groups. If the number of the current groups is equal to the parallelism of the solid state disk, in order to avoid the situation that the number of the groups is larger than the parallelism of the solid state disk, the group with the least number of data pages in all the groups is closed. From the above, it can be seen that: when the packet splitting condition is satisfied, the splitting step of the packet may be performed before the I/O data is stored to the physical block or after the I/O data is stored to the physical block.
According to the core idea of the splitting step, the packet splitting step may include:
judging whether the number of the data pages corresponding to the target group is N times of the number of the data pages corresponding to other groups; n is a real number and is not less than 2; if so, sequencing all the groups from small to large according to the number of the corresponding data pages of the groups to obtain a group sequence, and deleting the first N-1 groups in the group sequence; and splitting the target packet into N-1 sub-packets, and establishing a corresponding relation between the N-1 sub-packets and the target physical block.
S107, judging whether the updating period is an initial period or not; if yes, executing S108; if not, the update period is reserved, and S104 is executed.
And S108, updating the recording I/O timestamp to an operation I/O timestamp, and updating the updating period to a minimum preset period.
And S109, storing the I/O data to the object physical block corresponding to the object group corresponding to the minimum preset period.
It should be noted that, if the update period of the current logical address and the recording I/O timestamp are both initial values, indicating that data has never been written to the logical address, in this case, it cannot be accurately determined which preset period has the smallest difference between the current update period and the current update period, and therefore, the I/O data is directly stored in the object physical block corresponding to the object group corresponding to the minimum preset period. The updating period of the minimum preset period is shortest, the possibility of garbage recovery in a short time is greatest, the I/O data can be subjected to garbage recovery in advance to expose whether grouping is accurate or not as soon as possible, and if the grouping is not accurate, grouping adjustment is carried out in time (namely the updating period of the logic address is updated, so that the data is stored to a physical block closer to the heat of the logic address when the data is written on the logic address next time). The minimum preset period is the minimum value of all the current preset periods. Since the preset period of each packet is changed in real time, the minimum preset period is also changed in real time.
The object group and the target group may be the same group or two different groups. The object physical block and the target physical block may be the same physical block or may be two different physical blocks.
In a preferred embodiment, storing the I/O data to the object physical block corresponding to the object group corresponding to the minimum preset period includes: and writing the I/O data into an object data page corresponding to the object group, wherein the object data page is a physical data page in the object physical block.
In this embodiment, the preset period of the object group may be updated to an average value of the update periods of all the logical addresses corresponding to the object group.
In a preferred embodiment, after storing the I/O data to the object physical block corresponding to the object group corresponding to the minimum preset period, a group splitting step is further included. The packet splitting step specifically includes: judging whether the number of the data pages corresponding to the object group is twice of the number of the data pages corresponding to other groups; if so, closing the group with the least data page number in all the groups, splitting the object group into two groups, and establishing the corresponding relation between the two groups and the object physical block.
In a preferred embodiment, before storing the I/O data to the object physical block corresponding to the object group corresponding to the minimum preset period, a group splitting step is further included. The packet splitting step specifically includes: judging whether the number of the data pages corresponding to the object group is twice of the number of the data pages corresponding to other groups; if so, closing the group with the least data page number in all the groups, splitting the object group into two groups, and establishing the corresponding relation between the two groups and the object physical block.
That is, when the number of data pages corresponding to the object group is large, the object group is divided into 2 groups. If the number of the current groups is equal to the parallelism of the solid state disk, in order to avoid the situation that the number of the groups is larger than the parallelism of the solid state disk, the group with the minimum number of data pages in all the groups is closed. From the above, it can be seen that: when the packet splitting condition is satisfied, the splitting step of the packet may be performed before the I/O data is stored to the physical block or after the I/O data is stored to the physical block.
According to the core idea of the splitting step, the packet splitting step may include:
judging whether the number of the data pages corresponding to the object group is N times of the number of the data pages corresponding to other groups; n is a real number and is not less than 2; if so, sequencing all the groups from small to large according to the number of the corresponding data pages of the groups to obtain a group sequence, and deleting the first N-1 groups in the group sequence; the object grouping is divided into N-1 sub-groupings, and the corresponding relation between the N-1 sub-groupings and the object physical blocks is established.
In a preferred embodiment, the determining whether the recording I/O timestamp of the logical address is before the initial timestamp further includes: and determining an address range to which the logical address belongs, and determining a recording I/O time stamp and an updating period of the address range as the recording I/O time stamp and the updating period of the logical address.
It should be noted that the number of the logical addresses is large, and if each logical address corresponds to one recording I/O timestamp and one update cycle, the number of the recording I/O timestamps and update cycles that need to be maintained is very large, which is not favorable for implementation of the scheme, and the calculation overhead is increased. Therefore, the logical addresses can be segmented, and after segmentation, a plurality of logical addresses belonging to the same address segment (namely, address range) correspond to the same recording I/O timestamp and the same updating period, so that the calculation overhead is reduced.
It can be seen that in the embodiment of the present application, the logical address corresponds to the record I/O timestamp and the update period. The record I/O timestamp may be used to determine an update period. If I/O data needs to be written in the logical address, judging whether the recording I/O time stamp of the logical address is the initial time stamp or not; if not, the recorded I/O timestamp and the updating period of the logical address are updated, the difference degree between the updating period and the preset period of each group is further determined, and the current I/O data is stored to the target physical block corresponding to the target group corresponding to the minimum difference degree, so that the data with similar activity degrees are stored in the same physical block, and the cold data and the hot data are separately stored. Therefore, if the storage space is released by erasing the block, the number of valid data pages remaining in the physical block is greatly reduced, so that the data writing amount and the wear of the storage medium can be reduced, and the service life and the performance of the storage medium can be improved.
Based on the data storage method shown in fig. 1, if a garbage collection instruction is received, the data processing method shown in fig. 2 may be implemented, including:
s201, receiving a garbage collection instruction.
And S202, determining a physical data page corresponding to the garbage collection instruction.
S203, inquiring a logical address corresponding to the physical data page.
Specifically, the garbage collection instruction carries a physical address of a physical data page, so that the physical address can be obtained from the garbage collection instruction, and the logical address is determined according to a mapping table of the physical address and the logical address.
And S204, increasing the update period of the logic address to obtain a target update period.
Wherein the update period represents the liveness of data in the physical data page. The shorter the update period is, the more active the data is; the longer the update period, the less active the data is. Active data may be considered hot data and inactive data may be considered cold data.
S205, calculating the difference degree between the target updating period and the preset period of each group.
And S206, migrating the data in the physical data page to the physical block corresponding to the grouping corresponding to the minimum difference degree.
In a preferred embodiment, increasing the update cycle of the logical address to obtain the target update cycle includes: and doubling the updating period to obtain the target updating period. For example: the original update period is 3, and after the update period is doubled, the obtained target update period is 3+3=6. After the target update period is obtained, the difference between the target update period and the preset period of each group can be calculated, and the data in the physical data page is migrated to the physical block corresponding to the group corresponding to the minimum difference, so that the cold and hot data can be stored separately.
It should be noted that if an effective physical data page exists in a certain physical block, the effective physical data page needs to be migrated when garbage collection is performed; if more effective physical data pages need to be migrated when one physical block is subjected to garbage collection, the grouping is inaccurate. Thus, once garbage is reclaimed, valid physical data pages need to be moved, indicating that the grouping of valid physical data pages is inaccurate, requiring punitive re-adjustment grouping. Therefore, in this embodiment, the effective physical data page to be migrated is determined by the garbage collection instruction, the logical address corresponding to the effective physical data page is queried by the physical address of the effective physical data page, and finally, the penalty adjustment grouping is performed by increasing the update cycle of the logical address.
In this embodiment, the logical address corresponds to not only the update cycle but also the recording I/O timestamp. The record I/O timestamp may be used to determine an update period.
It should be noted that, after the separate storage of the cold and hot data is realized, if the garbage collection operation is executed again, the amount of data to be migrated is greatly reduced, and therefore, the execution efficiency of the garbage collection operation can be further improved.
It can be seen that, in the embodiment of the present application, the logical address corresponds to an update cycle. If the garbage collection operation is executed on the logical address (namely, the data in the physical data page corresponding to the logical address is erased), the update cycle of the logical address is increased, so that the activity of the currently migrated data is reduced, the currently migrated data and other data (data with activity close to that of the currently migrated data) are stored in the same physical block, and the separated storage of cold and hot data is realized. Therefore, if the storage space is released by erasing the block, the number of valid data pages remaining in the physical block is greatly reduced, so that the data writing amount and the wear of the storage medium can be reduced, and the service life and the performance of the storage medium can be improved.
Based on the data storage method shown in fig. 1, if a Trim operation instruction is received, the data processing method shown in fig. 3 may be implemented, including:
s301, if the Trim operation instruction is received, determining a logic address according to the Trim operation instruction.
Specifically, the Trim operation instruction carries a logical address, so that the logical address can be obtained from the Trim operation instruction so as to determine the logical address.
S302, updating the update cycle of the logic address into the difference value between the instruction time stamp of the Trim operation instruction and the recording I/O time stamp of the logic address.
Wherein the update period represents the activity of the data stored by the logical address. The shorter the update period is, the more active the data is; the longer the update period, the less active the data is.
S303, updating the recording I/O time stamp of the logical address to the initial time stamp.
And S304, if the I/O data corresponding to the logical address is acquired, storing the I/O data according to the updating period and the recorded I/O timestamp.
In this embodiment, the logical address corresponds to a record I/O timestamp and an update period. The record I/O timestamp may be used to determine an update period.
After updating the record I/O timestamp and the update period of the logical address corresponding to the Trim operation, the I/O data at the logical address may be stored according to the update period and the record I/O timestamp. The shorter the update period is, the more active the data is; the longer the update period, the less active the data is. Active data may be considered hot data and inactive data may be considered cold data. Therefore, the data is stored according to the updating period and the recording I/O time stamp, and the cold and hot data can be stored separately.
After the cold and hot data are separately stored, if the Trim operation needs to be executed, invalid data needing to be processed is also reduced, so that the execution efficiency of the Trim operation can be improved.
It can be seen that in the embodiment of the present application, the logical address corresponds to the record I/O timestamp and the update period. If receiving a Trim operation instruction, determining a logic address according to the Trim operation instruction; updating the update cycle of the logic address into the difference value of the instruction timestamp of the Trim operation instruction and the recording I/O timestamp of the logic address; updating the recording I/O time stamp of the logical address to an initial time stamp; and if the I/O data corresponding to the logical address is acquired subsequently, storing the I/O data according to the updating period and the recorded I/O timestamp. In this way, if the storage space is released by erasing the block, the valid data pages remaining in the physical block are greatly reduced, so that the data writing amount and the wear of the storage medium can be reduced, and the service life and the performance of the storage medium can be improved.
Referring to the method flows shown in fig. 1, fig. 2, and fig. 3, the following schemes can be implemented, and the specific implementation process includes: an initialization section and an update section.
1. The initialization section includes: a Logical Block Address (LBA) life cycle table and an initialization packet are initialized.
(1) Initializing the LBA lifecycle table includes:
an LBA life cycle table is established inside the solid state disk, and the fields included in the LBA life cycle table are shown in table 1.
TABLE 1
Row number (r) Recording I/O timestamps Update period
1 1.244542359 2.35969464
In table 1, a row number indicates a certain address range including a plurality of logical addresses; and recording the I/O timestamp and the updating period, namely recording the I/O timestamp and the updating period corresponding to the current address range. In the present embodiment, the operation I/O timestamp of any one logical address closest to the current time is recorded as the recording I/O timestamp. Of course, the average of the operation I/O time stamps for all logical addresses included in the current row number may also be recorded as the recording I/O time stamp.
The initial timestamp corresponding to each row number is-1, and the initial period is 0. Since a plurality of logical addresses correspond to a row, a write operation occurs at any one logical address, and the recording I/O timestamp and update period of the row may change.
The time interval between two write operations on the same logical address is called the update period of the current logical address, and is expressed by the difference of the I/O time stamps of the two operations, and the unit is generally microsecond. Of course, the time interval of the last write operation of different logical addresses of the same row number also becomes the update cycle of the current logical address, and is expressed by the difference of two operations of two different logical addresses and the I/O timestamp, and the unit is generally a microsecond. The shorter the update period, the more active the data being operated on (i.e., the hotter the data); the longer the update period, the less active the data being operated on (i.e., the cooler the data).
The recording I/O timestamp may be calculated by using a unit of a floating point number microsecond, or may be calculated by using an integer through a custom timer (for example, several clock cycles are one timing cycle). If floating point numbers are utilized, 64 bits are required to record the I/O timestamp, and if integers are utilized, 32 bits are required to record the I/O timestamp.
(2) The initialization packet specifically includes:
8 groups are built in the solid state disk, the groups are numbered from 0 to 7, a preset period corresponding to each group is set, and a physical block corresponding to each group is set. Wherein different packets correspond to different physical blocks. And 8 is the parallelism of the current solid state disk. See table 2 for each packet and the predetermined period.
TABLE 2
Packet numbering 0 1 2 3 4 5 6 7
Preset period/ms 8 16 32 64 128 256 512 1024
2. The update section includes: the LBA lifecycle table is updated and the preset cycle is updated.
(1) Updating the LBA lifecycle table specifically includes:
if a write operation (which may be a host write operation or a migration write operation on an effective data page during a garbage collection operation) occurs on any logical address, determining an operation I/O timestamp of the current write operation; meanwhile, judging whether the recording I/O time stamp of the logical address is an initial time stamp or not; if not, updating the update cycle of the logic address into the difference value of the operation I/O time stamp and the record I/O time stamp; updating the recording I/O timestamp to an operating I/O timestamp; if the recorded I/O timestamp is the initial timestamp, judging whether the updating period is the initial period; and if so, updating the recording I/O timestamp to an operation I/O timestamp, and updating the updating period to the minimum preset period. If the update period is not the initial period, the update period is reserved, and the recorded I/O timestamp is updated to the operating I/O timestamp. After the I/O time stamp is recorded and the updating is completed in the updating period, the data corresponding to the current write operation can be written according to the corresponding flow, so that the cold and hot data can be stored separately. For a specific process, refer to fig. 2, which is not described in detail in this embodiment.
If a Trim operation instruction is received, determining a logic address according to the Trim operation instruction; updating the update cycle of the logic address into the difference value of the instruction timestamp of the Trim operation instruction and the recording I/O timestamp of the logic address; updating the recording I/O time stamp of the logical address to an initial time stamp; and if the I/O data corresponding to the logical address is acquired subsequently, storing the I/O data according to the updating period and the recorded I/O timestamp, thereby realizing the separate storage of cold and hot data.
If the garbage collection operation is executed on the logical address (namely, the data in the physical data page corresponding to the logical address is erased), the updating period of the logical address is increased, and a target updating period is obtained; calculating the difference degree between the target updating period and the preset period of each group; and migrating the data in the physical data page to the physical block corresponding to the grouping corresponding to the minimum difference degree, so that the data with similar activity degrees are stored in the same physical block, and the separated storage of cold and hot data is realized.
(2) The updating of the preset period specifically includes:
and updating the preset period of the packet corresponding to the current logical address according to the current updating period corresponding to the current logical address. Namely: and updating the preset period of the current grouping to be the average value of the updating periods of all the logic addresses corresponding to the current grouping.
Therefore, the scheme provided by the implementation stores cold and hot data in a grouping idea, so that write amplification can be reduced, the service life of the solid state disk is prolonged, the cost is reduced, and meanwhile, the performance of the solid state disk is improved.
In the following, a data storage device provided by an embodiment of the present application is described, and a data storage device described below and a data storage method described above may be referred to with each other.
Referring to fig. 4, an embodiment of the present application discloses a data storage device, including:
an obtaining module 401, configured to obtain a logical address and an operation I/O timestamp corresponding to the I/O data;
a judging module 402, configured to judge whether a recording I/O timestamp of the logical address is an initial timestamp;
a first updating module 403, configured to update an updating period of the logical address to a difference between the operation I/O timestamp and the recording I/O timestamp if the recording I/O timestamp is not the initial timestamp;
a second updating module 404, configured to update the recording I/O timestamp to an operation I/O timestamp;
a calculating module 405, configured to calculate a difference between the update period and a preset period of each packet respectively;
and the storage module 406 is configured to store the I/O data to a target physical block corresponding to the target packet corresponding to the minimum difference degree.
In a preferred embodiment, the method further comprises:
the updating period judging module is used for judging whether the updating period is the initial period or not if the I/O time stamp is recorded as the initial time stamp;
the third updating module is used for updating the recording I/O timestamp into an operation I/O timestamp if the updating period is the initial period and updating the updating period into the minimum preset period;
and storing the I/O data to an object physical block corresponding to the object group corresponding to the minimum preset period.
In a preferred embodiment, the method further comprises:
and the execution module is used for reserving the updating period and executing the steps in the second updating module, the calculation module and the storage module if the updating period is not the initial period.
In a preferred embodiment, the storage module is specifically configured to:
and writing the I/O data into a target data page corresponding to the target grouping, wherein the target data page is a physical data page in the target physical block.
In a preferred embodiment, the method further comprises:
and the fourth updating module is used for updating the preset period of the target grouping to the average value of the updating periods of all the logic addresses corresponding to the target grouping.
In a preferred embodiment, the method further comprises:
the grouping and splitting judgment module is used for judging whether the number of the data pages corresponding to the target grouping is twice of the number of the data pages corresponding to other groupings;
and the splitting module is used for closing the group with the least data page number in all the groups, splitting the target group into two groups and establishing the corresponding relation between the two groups and the target physical block if the number of the data pages corresponding to the target group is twice of the number of the data pages corresponding to other groups.
In a preferred embodiment, the method further comprises:
and the determining module is used for determining the address range to which the logical address belongs and determining the recording I/O time stamp and the updating period of the address range as the recording I/O time stamp and the updating period of the logical address.
For more specific working processes of each module and unit in this embodiment, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not described here again.
It can be seen that the present embodiment provides a data storage device, which can store data with similar liveness in the same physical block, and also realize separate storage of cold and hot data. Therefore, if the storage space is released by erasing the block, the number of valid data pages remaining in the physical block is greatly reduced, so that the data writing amount and the wear of the storage medium can be reduced, and the service life and the performance of the storage medium can be improved.
In the following, a data storage device provided in an embodiment of the present application is introduced, and a data storage device described below and a data storage method and apparatus described above may be referred to each other.
Referring to fig. 5, an embodiment of the present application discloses a data storage device, including: a memory unit 501 and a main controller 502, wherein:
the storage unit comprises a physical block, wherein a physical data page in the physical block is used for storing I/O data;
the main controller is used for executing the method disclosed by any of the previous embodiments.
A readable storage medium provided by the embodiments of the present application is introduced below, and a readable storage medium described below and a data storage method, apparatus, and device described above may be referred to with each other.
A readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the data storage method disclosed in the foregoing embodiments. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
References in this application to "first," "second," "third," "fourth," etc., if any, are intended to distinguish between similar elements and not necessarily to describe a particular order or sequence. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be implemented in other sequences than those illustrated or described herein. Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, 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, or apparatus.
It should be noted that the descriptions relating to "first", "second", etc. in this application are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of readable storage medium known in the art.
The principle and the implementation of the present application are explained herein by applying specific examples, and the above description of the embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of storing data, comprising:
acquiring a logic address and an operation I/O timestamp corresponding to the I/O data;
judging whether the recording I/O time stamp of the logical address is an initial time stamp or not;
if not, updating the update cycle of the logic address to be the difference value of the operation I/O time stamp and the recording I/O time stamp;
updating the record I/O timestamp to the operation I/O timestamp;
respectively calculating the difference degree between the updating period and the preset period of each group;
and storing the I/O data to a target physical block corresponding to a target group corresponding to the minimum difference degree.
2. The data storage method of claim 1, further comprising:
if the recorded I/O timestamp is the initial timestamp, judging whether the updating period is the initial period;
if so, updating the recording I/O timestamp to the operation I/O timestamp, and updating the updating period to a minimum preset period;
and storing the I/O data to an object physical block corresponding to the object group corresponding to the minimum preset period.
3. The data storage method of claim 2, further comprising:
if the updating period is not the initial period, reserving the updating period, and updating the recording I/O timestamp to the operation I/O timestamp; respectively calculating the difference degree between the updating period and the preset period of each group; and storing the I/O data to a target physical block corresponding to a target group corresponding to the minimum difference degree.
4. The data storage method according to claim 1, wherein the storing the I/O data to the target physical block corresponding to the target group corresponding to the minimum difference degree comprises:
and writing the I/O data into a target data page corresponding to the target grouping, wherein the target data page is a physical data page in the target physical block.
5. The data storage method of claim 4, further comprising:
and updating the preset period of the target grouping to be the average value of the updating periods of all the logic addresses corresponding to the target grouping.
6. The data storage method of claim 4, further comprising:
judging whether the number of the data pages corresponding to the target group is twice of the number of the data pages corresponding to other groups;
if so, closing the group with the least data page number in all the groups, splitting the target group into two groups, and establishing the corresponding relation between the two groups and the target physical block.
7. The data storage method according to any one of claims 1 to 6, wherein the determining whether the recording I/O timestamp of the logical address is before the initial timestamp further comprises:
and determining an address range to which the logical address belongs, and determining a recording I/O timestamp and an updating period of the address range as the recording I/O timestamp and the updating period of the logical address.
8. A data storage device, comprising:
the acquisition module is used for acquiring a logic address and an operation I/O timestamp corresponding to the I/O data;
the judging module is used for judging whether the recording I/O time stamp of the logic address is an initial time stamp or not;
a first updating module, configured to update an updating period of the logical address to a difference between the operation I/O timestamp and the recording I/O timestamp if the recording I/O timestamp is not the initial timestamp;
a second updating module for updating the recording I/O timestamp to the operating I/O timestamp;
the calculation module is used for calculating the difference degree between the updating period and the preset period of each group;
and the storage module is used for storing the I/O data to a target physical block corresponding to the target group corresponding to the minimum difference degree.
9. A data storage device, comprising: a storage unit and a host controller, wherein:
the storage unit comprises a physical block, wherein a physical data page in the physical block is used for storing I/O data;
the master controller is configured to perform the data storage method of any one of claims 1 to 7.
10. A readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements a data storage method as claimed in any one of claims 1 to 7.
CN201911310513.1A 2019-12-18 2019-12-18 Data storage method, device and equipment and readable storage medium Active CN112988040B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911310513.1A CN112988040B (en) 2019-12-18 2019-12-18 Data storage method, device and equipment and readable storage medium
PCT/CN2020/115543 WO2021120731A1 (en) 2019-12-18 2020-09-16 Data storage method and assembly, and data processing method and assembly

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911310513.1A CN112988040B (en) 2019-12-18 2019-12-18 Data storage method, device and equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112988040A CN112988040A (en) 2021-06-18
CN112988040B true CN112988040B (en) 2023-02-24

Family

ID=76343960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911310513.1A Active CN112988040B (en) 2019-12-18 2019-12-18 Data storage method, device and equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112988040B (en)

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002300200A (en) * 2001-03-30 2002-10-11 Oki Electric Ind Co Ltd Fluctuation absorbing device for absorbing fluctuation among packet reception interval
CN101930404A (en) * 2010-08-27 2010-12-29 威盛电子股份有限公司 Memory device and operation method thereof
CN102789368A (en) * 2012-06-21 2012-11-21 记忆科技(深圳)有限公司 Solid-state hard disk, and data management method and system thereof
CN104134027A (en) * 2014-07-23 2014-11-05 华为技术有限公司 Sequence flow recognition method and sequence flow recognition device
CN104156317A (en) * 2014-08-08 2014-11-19 浪潮(北京)电子信息产业有限公司 Wiping and writing management method and system for non-volatile flash memory
CN105485846A (en) * 2015-12-21 2016-04-13 广东美的暖通设备有限公司 Self-adaptive static pressure adjustment method and device for outdoor unit
CN105718328A (en) * 2016-01-12 2016-06-29 珠海煌荣集成电路科技有限公司 Data backup method and system for memory bad block
CN106354667A (en) * 2016-08-30 2017-01-25 浪潮(北京)电子信息产业有限公司 Method and device for solid-state drive cache control
CN107102819A (en) * 2014-12-12 2017-08-29 西安三星电子研究有限公司 The method and apparatus of data is write to solid state hard disc
CN107291374A (en) * 2016-03-31 2017-10-24 慧荣科技股份有限公司 Method and device for recording use time of data block
CN108363813A (en) * 2018-03-15 2018-08-03 北京小度信息科技有限公司 Date storage method, device and system
CN109471875A (en) * 2018-09-25 2019-03-15 网宿科技股份有限公司 Based on data cached temperature management method, server and storage medium
CN110023939A (en) * 2016-12-30 2019-07-16 英特尔公司 Method and apparatus for the checkpoint in storage device based on range
CN110535944A (en) * 2019-08-29 2019-12-03 广州华多网络科技有限公司 The method and device of user's alive data processing
CN111459939A (en) * 2020-03-31 2020-07-28 中国银行股份有限公司 Data processing method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4859595B2 (en) * 2006-09-01 2012-01-25 株式会社日立製作所 Storage system, data relocation method thereof, and data relocation program
US10764473B2 (en) * 2016-01-14 2020-09-01 Disney Enterprises, Inc. Automatically synchronizing multiple real-time video sources

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002300200A (en) * 2001-03-30 2002-10-11 Oki Electric Ind Co Ltd Fluctuation absorbing device for absorbing fluctuation among packet reception interval
CN101930404A (en) * 2010-08-27 2010-12-29 威盛电子股份有限公司 Memory device and operation method thereof
CN102789368A (en) * 2012-06-21 2012-11-21 记忆科技(深圳)有限公司 Solid-state hard disk, and data management method and system thereof
CN104134027A (en) * 2014-07-23 2014-11-05 华为技术有限公司 Sequence flow recognition method and sequence flow recognition device
CN104156317A (en) * 2014-08-08 2014-11-19 浪潮(北京)电子信息产业有限公司 Wiping and writing management method and system for non-volatile flash memory
CN107102819A (en) * 2014-12-12 2017-08-29 西安三星电子研究有限公司 The method and apparatus of data is write to solid state hard disc
CN105485846A (en) * 2015-12-21 2016-04-13 广东美的暖通设备有限公司 Self-adaptive static pressure adjustment method and device for outdoor unit
CN105718328A (en) * 2016-01-12 2016-06-29 珠海煌荣集成电路科技有限公司 Data backup method and system for memory bad block
CN107291374A (en) * 2016-03-31 2017-10-24 慧荣科技股份有限公司 Method and device for recording use time of data block
CN106354667A (en) * 2016-08-30 2017-01-25 浪潮(北京)电子信息产业有限公司 Method and device for solid-state drive cache control
CN110023939A (en) * 2016-12-30 2019-07-16 英特尔公司 Method and apparatus for the checkpoint in storage device based on range
CN108363813A (en) * 2018-03-15 2018-08-03 北京小度信息科技有限公司 Date storage method, device and system
CN109471875A (en) * 2018-09-25 2019-03-15 网宿科技股份有限公司 Based on data cached temperature management method, server and storage medium
CN110535944A (en) * 2019-08-29 2019-12-03 广州华多网络科技有限公司 The method and device of user's alive data processing
CN111459939A (en) * 2020-03-31 2020-07-28 中国银行股份有限公司 Data processing method and device

Also Published As

Publication number Publication date
CN112988040A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN105242871B (en) A kind of method for writing data and device
US7948798B1 (en) Mixed multi-level cell and single level cell storage device
CN109656486B (en) Configuration method of solid state disk, data storage method, solid state disk and storage controller
CN111125447A (en) Metadata access method, device and equipment and readable storage medium
WO2011072538A1 (en) Method and apparatus for nand flash erase leveling
KR102349999B1 (en) Semiconductor device and operating method thereof
CN110377233B (en) SSD (solid State disk) reading performance optimization method and device, computer equipment and storage medium
CN107506138B (en) Method for prolonging service life of solid state disk
CN110389712B (en) Data writing method and device, solid state disk and computer readable storage medium
CN104731713A (en) Phase change memory abrasion balancing method and system based on random mapping
CN110989918A (en) Write control method, data storage device and controller thereof
CN104714894A (en) Layered phase-change memory abrasion equilibrating method and system based on random mapping
CN115756312A (en) Data access system, data access method, and storage medium
CN110673789A (en) Metadata storage management method, device, equipment and storage medium of solid state disk
CN107273306B (en) Data reading and writing method for solid state disk and solid state disk
CN107391035B (en) A method of being perceived by misprogrammed reduces solid-state mill damage
KR100624973B1 (en) An Efficient Wear-leveling Scheme for Flash MemoryK-leveling
CN105512047A (en) Method and device for write operation and erasure operation of Flash memory
CN112988040B (en) Data storage method, device and equipment and readable storage medium
CN112988042B (en) Data storage method, device and equipment and readable storage medium
CN112988612B (en) Data processing method, device, equipment and readable storage medium
CN111078136A (en) Method for preventing flash service life reduction caused by BMS dynamic data storage
CN115857811A (en) Data processing method and device, solid state disk and readable storage medium
KR100817204B1 (en) Method and apparatus for mapping flash memory
CN107832234B (en) Quick log block hit method for NAND FLASH

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