WO2017193967A1 - Data inspection method and device in solid state memory - Google Patents

Data inspection method and device in solid state memory Download PDF

Info

Publication number
WO2017193967A1
WO2017193967A1 PCT/CN2017/083988 CN2017083988W WO2017193967A1 WO 2017193967 A1 WO2017193967 A1 WO 2017193967A1 CN 2017083988 W CN2017083988 W CN 2017083988W WO 2017193967 A1 WO2017193967 A1 WO 2017193967A1
Authority
WO
WIPO (PCT)
Prior art keywords
linked list
enabled
storage block
list group
storage
Prior art date
Application number
PCT/CN2017/083988
Other languages
French (fr)
Chinese (zh)
Inventor
吴黎明
赵万
黄斌
杨虓
王永良
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017193967A1 publication Critical patent/WO2017193967A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • 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/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • the present invention relates to the field of storage technologies, and in particular, to a data inspection method and apparatus in a solid state memory.
  • Solid State Disk also known as electronic hard disk or solid state electronic disk, is a hard disk implemented by solid-state electronic storage devices, mainly composed of a controller and a memory.
  • the SSD has the same interface specification, physical size, and usage mode as the ordinary hard disk.
  • the special feature is that there is no mechanical structure, and the unique storage medium NAND Flash feature is used to perform the write operation in units of blocks.
  • the page performs an erase operation for the unit.
  • the SSD solid state drive frees the mechanical heads of the mechanical hard disk, the rotating shaft of the disk and the mechanical components such as the control motor. There is no motor to accelerate the rotation process. There are no mechanical moving parts inside, no mechanical failure, no collision, shock and vibration.
  • NAND Flash is a non-volatile random access storage medium, which is characterized by the fact that data does not disappear after power off. NAND Flash is based on a floating gate transistor design. The purpose of writing "0" or “1” is achieved by charging and discharging to the floating gate in the memory, and the data stored in the current memory cell is obtained by determining the amount of charge in the floating gate.
  • the method for implementing the patrol inspection by the SSD may be: according to the mapping table of the storage logical address to the physical address, according to the order of the logical addresses in the mapping table, the valid data in the storage block corresponding to the physical address mapped to the logical address is in turn Read out and write to a new blank block (a blank block is a block that has no data written, such as a block that is reclaimed and erased by the garbage collection module).
  • the existing SSD inspection methods have at least the following problems:
  • the foregoing patrol method is to patrol the storage blocks in the SSD according to the logical address, the stable data that has not been erased for a long time and the active data that has just been written are migrated to the same storage block during the patrol process. Since the active data in the memory block may be updated soon to become an invalid data page, and the stable data is not updated, it is still a valid data page, so that when the memory block is erased, it is required to be updated. Valid data pages are migrated, which increases write amplification.
  • an embodiment of the present invention provides a data inspection method in a solid state memory. And equipment.
  • the technical solution is as follows:
  • a data patrol method in a solid state memory comprising a plurality of memory blocks, each memory block being configured to store a plurality of data pages, wherein the solid chain memory further stores a first linked list a group and a second linked list group, wherein the first linked list group is mounted with a plurality of storage blocks, the second linked list group is for mounting an enabled storage block, and the enabled storage block is a storage enabled to write a data page
  • the method includes: reading, in the current patrol period, the time in the first linked list group according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group a valid data page stored in the mounted memory block; storing the read valid data page to the enabled memory block, the enabled memory block being a blank memory block used to write the data page;
  • the enabled enabled storage block in the cycle is mounted to the second linked list group according to the time when the enabled storage block is enabled, and the second linked list group is taken as the beginning of the next inspection cycle of the current inspection cycle.
  • the first linked list group the first Group list as the second list set.
  • the first linked list group includes multiple linked lists, where each linked list is used to mount a storage block that is enabled in a same time period;
  • the sequence of time periods corresponding to each linked list in the first linked list group reads the valid data pages stored in the storage blocks mounted in each linked list; and the enabled storage blocks enabled in the patrol cycle are enabled according to the storage block.
  • Time-mounting to the second linked list group includes: mounting the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled.
  • the method when the valid data page in the storage block mounted by the target linked list in the first linked list group is read, the method further includes:
  • the target linked list establishes a plurality of child linked lists, each of which corresponds to an invalid data page, and the child linked list is sorted according to the number of invalid data pages; and the invalid data in the storage block mounted by the target linked list is determined.
  • the number of pages; the storage block in the target linked list is mounted to the child linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages; according to the child linked list in the target linked list
  • the number of valid invalid data pages in the middle reads the valid data pages in the storage blocks mounted in each sub-linked list in order of increasing number.
  • the method when the read valid data page is stored to the enabled memory block, the method further includes: when the enabled memory block is already full, Gets the valid data page read by the next enabled block store. By storing the valid data page to the enabled memory block, and after the enabled memory block is full, the next enabled memory block can achieve stable data cohesion and reduce write amplification.
  • the method further includes: after the valid data pages in the storage block are all read, the storage block from the first linked list Remove from the group. Before the inspection, the storage block that performs the recovery operation is removed from the first linked list group, and the data in the storage block can be prevented from being patrolled again during the inspection, thereby further reducing the inspection process. The number of reads and writes.
  • a data patrol device in a solid state memory comprising a plurality of functional modules for performing the method of the first aspect described above.
  • the apparatus further includes other functional modules for performing the methods described in the various possible implementations of the first aspect described above.
  • a data patrol device in a solid state memory comprising:
  • a memory for storing processor executable instructions
  • the processor is configured to read the first time according to a time when the storage block mounted in the first linked list group is mounted to the first linked list group in a current patrol period. a valid data page stored in a storage block mounted in the linked list group; storing the read valid data page to the enabled storage block, the enabled storage block being a blank storage block used to write a data page;
  • the enabled enabled storage block in the patrol period is mounted to the second linked list group according to the time when the enabled storage block is enabled, and the second linked list is started at the beginning of the next patrol period of the current patrol period As the first linked list group, the first linked list group is used as the second linked list group.
  • stable data can be cohesive to a part of the storage block, and the number of storage blocks that can be used for the unstable data is increased, so that the redundancy ratio of the SSD can be significantly improved, thereby achieving the write amplification of the SSD. Reduce the wear and tear on SSD and extend the service life of SSD.
  • the first linked list group includes multiple linked lists, where each linked list is used to mount a storage block that is enabled in a same time period;
  • the sequence of time periods corresponding to each linked list in the first linked list group reads the valid data pages stored in the storage blocks mounted in each linked list; and the enabled storage blocks enabled in the patrol cycle are enabled according to the storage block.
  • Time-mounting to the second linked list group includes: mounting the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled.
  • the method when the valid data page in the storage block mounted by the target linked list in the first linked list group is read, the method further includes:
  • the target linked list establishes a plurality of child linked lists, each of which corresponds to an invalid data page, and the child linked list is sorted according to the number of invalid data pages; and the invalid data in the storage block mounted by the target linked list is determined.
  • the number of pages; the storage block in the target linked list is mounted to the child linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages; according to the child linked list in the target linked list
  • the number of valid invalid data pages in the middle reads the valid data pages in the storage blocks mounted in each sub-linked list in order of increasing number.
  • the method when the read valid data page is stored to the enabled memory block, the method further includes: when the enabled memory block is already full, Gets the valid data page read by the next enabled block store. By storing the valid data page to the enabled memory block, and after the enabled memory block is full, the next enabled memory block can achieve stable data cohesion and reduce write amplification.
  • the method further includes: after the valid data pages in the storage block are all read, the storage block from the first linked list Remove from the group. Before the inspection, the storage block that performs the recovery operation is removed from the first linked list group, and the data in the storage block can be prevented from being patrolled again during the inspection, thereby further reducing the inspection process. The number of reads and writes.
  • FIG. 1 is a schematic structural diagram of a solid state memory according to an embodiment of the present invention.
  • FIG. 2A is a flowchart of a data inspection method in a solid state memory according to an embodiment of the present invention
  • 2B is a schematic diagram of a first linked list set according to an embodiment of the present invention.
  • 2C is a schematic diagram of a target linked list according to an embodiment of the present invention.
  • FIG. 3 is a block diagram of a data patrol device in a solid state memory according to an embodiment of the present invention.
  • FIG. 1 is a schematic structural diagram of a solid state memory according to an embodiment of the present invention, where the solid state memory includes a plurality of memory blocks, each of the memory blocks is configured to store a plurality of data pages, and the first linked list is further stored in the solid state memory. And a second linked list group, the first linked list group is mounted with a plurality of storage blocks, the second linked list group is used for mounting an enabled storage block, and the enabled storage block is a storage block enabled to write a data page .
  • the solid state memory is mainly composed of a controller, a memory, and a memory.
  • the memory is used to provide a data storage service, and the controller allocates a data processing path for the data write operation, so that the host or the server accesses the data stored in the solid-state memory, thereby performing processes such as data reading, writing, and deleting.
  • the memory is a solid state storage array, and the solid state storage array may be a flash array or a DRAM (Dynamic Random Access Memory) array, which is a core component of a solid state hard disk with hardware write protection function for emitting solid state.
  • the SSD In order to avoid an error in the stored data due to electronic leakage of the storage medium, the SSD periodically performs a patrol and carry operation on the stored data to solve the above problem. Since the service life of the SSD is related to the rewritable number of the SSD, during the patrol process, the erase operation is repeatedly performed on the memory block in the SSD, thus affecting the service life of the SSD. In order to minimize the impact of the inspection operation on the life of the SSD, the present invention provides a data inspection method, which is used to store different time periods by introducing a linked list group.
  • the storage block of the data store performs the patrol operation in the order of mounting to achieve the purpose of stable data cohesion, thereby reducing the write amplification, reducing the number of erasing and writing to the SSD, and thereby reducing the patrol during the subsequent patrol process.
  • FIG. 2A is a flowchart of a data patrol method in a solid state memory according to an embodiment of the present invention.
  • the solid state memory includes a plurality of memory blocks, each of which is used to store a plurality of data pages, and the solid state memory further includes Storing a first linked list group and a second linked list group, the first linked list group is mounted with a plurality of storage blocks, the second linked list group is for mounting an enabled storage block, and the enabled storage block is enabled to be written
  • the storage block of the data page see Figure 2A, the method includes:
  • the first linked list group is stored in the solid-state memory, and the first linked list group includes a plurality of linked lists, each linked list is used for mounting a storage block whose enabled time is in the same time period; the enabled time may be a storage block
  • the time at which the data is written may also be the time when the storage block performs the erasing operation; the number of linked lists included in the first linked list group is determined by the span of the patrol period and the mounting time period in the first linked list group. For the determination of the span of the mounting time period, it may be set to any fixed value.
  • the specific value and the determining method of the spanning period span are not limited in the embodiment of the present invention.
  • each storage block in all the storage blocks of the SSD corresponds to an index value, and the corresponding storage block can be uniquely determined according to each index value; for example, all storage blocks in the SSD form a one-dimensional array, and each The logical position of the memory block in the one-dimensional array is the index value of the corresponding memory block.
  • each storage block corresponds to a structure, and the structure corresponding to each storage block includes a precursor node pointer and a subsequent node pointer.
  • the storage block After the storage block is mounted to the linked list, Obtaining an index value of a previous storage block in the linked list of the mounted storage block, storing the index value at a precursor pointer of the structure of the mounted storage block, and storing the mounted storage block
  • the index value of the block is stored at the backdrive pointer of the previous memory block.
  • three storage blocks a, b, and c are sequentially mounted under a certain linked list, and the index value of the a storage block is stored in the precursor node pointer of the corresponding structure of the b storage block, and the corresponding structure of the b storage block
  • the index value of the c memory block is stored in the subsequent node pointer of the body.
  • the storage block mounted in the first linked list group when the storage block mounted in the first linked list group is mounted to the first linked list group, the valid data page stored in the storage block mounted in the first linked list group is read. Previously, the storage block is mounted to the linked list corresponding to the corresponding time period of the first linked list group according to the order of the activation time of each storage block from first to last.
  • the number of the linked list included in the first linked list group is determined according to the patrol period and the span of the mounting time period, so that the storage blocks are sequentially mounted in the order of the activation time to the corresponding linked list of the first linked list group, which is convenient for
  • the data in the storage block mounted under the first linked list group is inspected and managed.
  • the first The number of linked lists included in a linked list is 7*24. It should be noted that if any storage block is not enabled within an hour, the storage block may not be mounted under the linked list in the first linked list group corresponding to the period of time.
  • the subsequent storage of the stored data can be performed according to the first linked list group.
  • the mounting order of the storage blocks inspects the mounted storage blocks in the first linked list group.
  • reading the valid data page stored in the storage block mounted in the first linked list group includes: according to the first linked list Sequential reading of each time period in the group A valid data page stored in a storage block mounted in a linked list corresponding to each time period. That is, according to the span of the mounting time period, the storage block mounted under the first linked list of the first linked list group is inspected during the first time period of the patrol period, and the second in the patrol period. The time period patrols the storage blocks mounted in the second linked list of the first linked list group, and so on, until the patrol operation of all the storage blocks mounted under the first linked list group is completed.
  • the figure is a schematic diagram of the first linked list group, wherein the linked list A, B, C, and D respectively represent a linked list for mounting a storage block corresponding to each of the mounting time periods in the first linked list group.
  • a1, a2, a3, and a4 represent storage blocks sequentially mounted in the A linked list in the first linked list group.
  • b1, b2, and b3 indicate storages sequentially mounted under the B linked list in the first linked list group.
  • the blocks, c1, c2, c3, and c4 represent memory blocks sequentially mounted under the C linked list in the first linked list group
  • d1 and d2 represent memory blocks sequentially mounted under the D linked list in the first linked list group.
  • the valid data pages in the storage block in the first linked list group are read in order from first to last, that is, Read the data in the storage block mounted under the A, B, C, and D lists.
  • the data in the a1 storage block is enabled before the a2, a2 storage block.
  • the data is enabled before a3, and the data in the a3 memory block is enabled before a4. Therefore, the mount order is a1, a2, a3, and a4.
  • the valid data pages of the a1, a2, a3, and a4 memory blocks are also sequentially read in the order of the activation time.
  • the method further includes: creating a plurality of sub-linked lists for the target linked list, and each sub-linked list corresponds to the number of invalid data pages And the child linked list is sorted according to the number of invalid data pages; determining the number of invalid data pages in the storage block mounted by the target linked list; storing the target linked list according to the determined number of invalid data pages The block is mounted to the child linked list corresponding to the determined number of invalid data pages; and the number of corresponding invalid data pages in the child linked list in the target linked list is read in the order of the number of invalid data pages in the descending order. A valid data page in the mounted memory block.
  • the target linked list includes 129 sub-linked lists, that is, the number of valid data pages in each storage block may be 0-128, and there are 129 cases.
  • a memory block that does not contain a valid data page is mounted under the first child linked list in the target linked list, and a memory block containing one invalid data page is mounted under the second child linked list of the target linked list, and contains 128 invalid data pages.
  • the storage block is mounted under the 129th sub-list of the target linked list, and the target linked list can be represented by FIG. 2C. In FIG. 2C, if there is no corresponding amount of invalid data in the storage block that needs to be sorted according to the number of invalid data pages.
  • the storage block of the page does not mount the storage block under the corresponding sub-chain list of the target linked list.
  • the valid data pages in the corresponding storage block are sequentially traversed and recovered in order, and the storage block that does not contain the valid data page is also mounted on the first list of the target linked list.
  • the memory block under the sub-chain table because it does not contain the memory block of the valid data page, can be used as a blank memory block only when it is directly erased, and does not need to perform effective data relocation operation. Therefore, when the memory block is recovered,
  • the storage blocks under the first sub-chain list of the target linked list are preferentially processed, and then the other storage blocks are sequentially processed according to the mounting order of the target linked list.
  • the numbers in the boxes indicate sub-chain lists for mounting the memory blocks containing the corresponding number of valid data pages
  • the memory blocks a1, a2, a3, and a4 not including the valid data pages are mounted on the Under the first sub-chain list of the target linked list, that is, the sub-chain list labeled 0
  • the storage blocks b1, b2, and b3 including one valid data page are mounted under the second sub-chain list of the target linked list, that is, labeled 1.
  • the child linked list, and so on, the memory blocks n1, n2, n3, and n4 including 128 valid data pages are mounted under the 129th child linked list of the target linked list, that is, the child linked list labeled 128.
  • the plurality of storage blocks may sequentially read the valid data pages in each storage block according to the mounting order, or may randomly read the valid data pages of each of the plurality of storage blocks without following the mounting order.
  • the data of each of the plurality of storage blocks may be read in other orders, which is not limited by the embodiment of the present invention.
  • the plurality of storage blocks are sequentially read according to the order of the number of invalid data pages included in the plurality of storage blocks.
  • the valid data pages of each memory block can free up blank memory blocks for writing new data or for relocating data during the inspection process.
  • the enabled storage block may be used to store data that is relocated during the patrol process, and may also be used to store newly written data, which is not limited in this embodiment of the present invention.
  • the mounting sequence is patrolled, and the data in the storage block with the earlier activation time can be stored in the same enabled storage block to achieve stable data cohesion.
  • the storage block can be patrolled. All the stable data stored in the storage block is migrated.
  • the stable data in the storage block is dispersed in a plurality of storage blocks, the stable data in the plurality of storage blocks needs to be migrated, so the stable data is cohesive.
  • the stable data refers to the data in the SSD stored data that has not been overwritten or deleted for a long time, and can be regarded as stable data, and vice versa.
  • the specific method of mounting the enabled storage block in the patrol period to the second linked list group according to the time when the storage block is enabled is: mounting the enabled storage block to the time period corresponding to the time when the enabled storage block is enabled. In the linked list.
  • the valid data page in the next storage block is continuously read according to the mounting order of the storage blocks in the first linked list group, and the valid data page is written into the enabled storage block. Until the fill block is filled. After the enabled storage block is full, the valid data page read by the next enabled storage block storage is obtained, and the enabled storage storage block is mounted under the corresponding linked list of the second linked list.
  • the enabled storage block When the enabled storage block is enabled, the enabled storage block is mounted under the second linked list group according to the enabled time of the enabled storage block, and the second linked list group is used for mounting according to the storage block's enable time.
  • the enable time of the enabled memory block may be the time when the write operation is performed on the enabled memory block, or the time when the erase operation is performed on the enabled memory block, where the erase operation refers to The erase operation performed before this write operation is performed.
  • the storage blocks that perform the write operation in the current patrol period are sequentially mounted to the second linked list group in the order of activation time; in the next patrol period of the current patrol period, in the second linked list group
  • the storage blocks that perform the write operation in the patrol cycle are sequentially mounted in the first linked list group in the order of activation time.
  • the storage block that performs the write operation in the current patrol period is the enabled storage block, which includes writing the data according to the write request of the application.
  • the storage block also includes the first write from the first during the inspection A storage block of data that is relocated by a storage block mounted in a linked list group.
  • the mount order performs the patrol operation.
  • the process of performing the patrol inspection by the data patrol method may be: if a patrol period is 7 natural days, and the span of the first linked list group and the second linked list group spans one hour, the first The linked list group and the second linked list group respectively comprise 7*24 linked lists, and the storage blocks of the written data are sequentially mounted to the corresponding linked list of the first linked list group according to the activation time order of the storage blocks, for example,
  • the storage block enabled in the first hour is mounted in the first linked list of the first linked list group
  • the storage block enabled in the second hour is mounted in the second linked list of the first linked list group to This type of push is mounted to a block of memory under the same linked list with an enable interval of no more than one hour.
  • the patrol operation is not performed, and only the storage block of the newly written data is subjected to the mount operation, and in the second patrol period, the first linked list group is hanged.
  • the data in the storage block performs a patrol operation, and the storage block of the newly written data is mounted in the second linked list group, and the data in the newly written storage block includes valid data and basis for relocation during the patrol inspection process.
  • the application's write requests the newly written data.
  • the data in the storage block of the first linked list group is patrolled, and the valid data in the storage block mounted under the first linked list group is relocated, and the storage blocks are After being recycled or erased, it is mounted under the erase block linked list group or the blank block linked list group to wait for the data to be erased or rewritten.
  • the data in the storage block of the second linked list group is patrolled, and the storage block of the newly written data is mounted in the first linked list group.
  • the purpose of stable data cohesion can be achieved, and when the storage block is patrolled again, all the stored in the storage block can be stored. Stable data is migrated. If the stable data in the storage block is dispersed in multiple storage blocks, the stable data in the multiple storage blocks needs to be migrated, so that the stable data is cohesively integrated into one storage block, which can be avoided.
  • the data is divided and erased, and the SSD write amplification can be reduced in the process of patrolling the data in the storage block in the first linked list group, thereby prolonging the service life of the SSD.
  • the storage block is from the first linked list group. Excluding, if the valid data in the memory block is relocated, but the erase operation is not performed, the memory block is removed from the first linked list, and the memory block is mounted in the erase block linked list group, if the memory block An erase operation is performed to mount the memory block to the blank block linked list group.
  • the preset time period of the patrol cycle the patrol operation of all the storage blocks mounted in the first linked list group is performed.
  • the preset time period can be set to any time period, which is not limited by the embodiment of the present invention. For example, if a patrol period is 7 natural days, and the span of the first linked list group spans one hour, the first linked list group includes 7*24 linked lists, and the second linked list group The mounting time period corresponding to the 6th/th +1th linked list is used to patrol the data in the storage blocks of the first to seventh linked lists of the first linked list, and the seven linked lists are logged.
  • the data in the storage block is patrolled within one hour, and the 6th to 24th linked list in the second linked list group corresponds to the 8th to 14th linked list of the first linked list.
  • the data in the storage block is patrolled, and the data in the storage block under the seven linked lists is patrolled within one hour, and so on, and a mount time span can be determined according to the patrol period.
  • the patrol process of all the data in the storage block mounted in the first linked list group is completed.
  • the storage blocks that perform the write operation in the first 6 days are sequentially mounted in the order of the write time to the corresponding linked list of the second linked list group, and on the seventh day, according to the above method, the first linked list group is Mount the data in the storage block to perform the patrol operation.
  • the newly enabled storage blocks are mounted to the corresponding linked list group according to the writing time or the erasing time, and data is carried on the data of different linked list groups in different inspection periods. Inspections can achieve the cohesion of stable data and reduce the purpose of write amplification.
  • step 201 is repeatedly performed.
  • next inspection cycle the same cycle as the storage block in the first linked list group is patrolled, and the next cycle of the inspection operation is performed, and so on.
  • the patrol process can be performed during the patrol process.
  • Separate stable data and unstable data into different storage blocks which can greatly reduce the capacity occupied by stable data and increase the redundant space corresponding to unstable data, thereby effectively reducing write amplification, reducing wear and tear, and improving Performance and stability, extending the service life; further, by removing the storage block that performs the recovery operation from the first linked list group before the inspection, it is possible to avoid data in the storage block again during the inspection process.
  • the inspection can further reduce the number of reading and writing in the inspection process; by performing the recycling operation on multiple storage blocks to be recycled in order of the number of invalid pages included, the number of invalid pages can be maximized.
  • the storage blocks are recycled faster, which in turn optimizes garbage collection.
  • the valid data is moved to the blank storage block, and the storage block occupied by the valid data is released.
  • the inspection process is a storage block that coheres the stable data into a new storage block and occupies the original valid data. The process of releasing invalid data contained in it.
  • stable data can be cohesive to a part of the storage block, and the number of storage blocks that can be used for the unstable data is increased, so that the redundancy ratio of the SSD can be significantly improved by each of the plurality of storage blocks to be recycled.
  • the storage blocks contain the order of invalid pages from most to less, and the plurality of to-be-recovered storage blocks are sequentially recovered, so that the available blank storage blocks can be obtained quickly, thereby optimizing the effect of garbage collection, thereby reducing the write of the SSD. Zoom in to reduce the wear and tear on the SSD and extend the life of the SSD.
  • FIG. 3 is a block diagram of a data patrol device in a solid state memory according to an embodiment of the present invention.
  • the apparatus includes a reading module 301, a storage module 302, and a processing module 303.
  • the reading module 301 is configured to read the time in the first linked list group according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group in the current patrol period. a valid data page stored in the stored memory block;
  • a storage module 302 configured to store the read valid data page to the enabled storage block
  • the processing module 303 is configured to mount the enabled enabled storage block in the patrol period to the second linked list group according to the time when the enabled storage block is enabled, and at the beginning of the next patrol period of the current patrol period,
  • the second linked list group is used as the first linked list group
  • the first linked list group is used as the second linked list group.
  • the first linked list group includes multiple linked lists, and each linked list is used to mount a storage block that is enabled in a same time period;
  • the reading module 301 is configured to read valid data pages stored in the storage blocks mounted in the linked lists according to the time period corresponding to each linked list in the first linked list;
  • the processing module 303 is configured to mount the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled.
  • the device further includes:
  • a linked list establishing module configured to create a plurality of sub-linked lists for the target linked list, each sub-linked list corresponding to an invalid data page, and the sub-linked list is sorted according to the number of invalid data pages;
  • a determining module configured to determine the number of invalid data pages in the storage block mounted by the target linked list
  • a mounting module configured to mount the storage block in the target linked list to the sub-linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages;
  • the reading module 301 is further configured to read valid data pages in the storage blocks mounted in each sub-chain list according to the number of corresponding invalid data pages in the sub-chain table in the target linked list. .
  • the device further includes:
  • the device further includes:
  • the data patrol device provided in the above embodiment is only exemplified by the division of the above functional modules when performing data patrol inspection.
  • the functions may be assigned different functions according to needs.
  • the module can be completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the data patrol device and the data patrol method are provided in the same embodiment. The specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

A data inspection method and device in a solid state memory, relating to the technical field of storage. The method comprises: reading, in a current inspection cycle and according to the time when a memory block mounted in a first linked list group is mounted in the first linked list group, a valid data page stored in the memory block mounted in the first linked list group (201); storing the read valid data page into an enabled memory block, the enabled memory block being a blank memory block used for a data page to be written to (202); mounting the enabled memory block enabled in the inspection cycle to a second linked list group according to the time when the enabled memory block is enabled (203); and when a next inspection cycle of the current inspection cycle starts, using the second linked list group as a first linked list group, and using the first linked list group as a second linked list group (204). On the basis of optimization of data stability, the method can cohere stable data to some memory blocks, and increase the number of memory blocks that can be used for unstable data, so as to increase the redundancy rate, reduce write amplification and SSD wear, and prolong the service life of the SSD.

Description

固态存储器中的数据巡检方法及装置Data inspection method and device in solid state memory 技术领域Technical field
本发明涉及存储技术领域,特别涉及一种固态存储器中的数据巡检方法及装置。The present invention relates to the field of storage technologies, and in particular, to a data inspection method and apparatus in a solid state memory.
背景技术Background technique
固态硬盘(Solid State Disk或Solid State Drive),也称作电子硬盘或者固态电子盘,是采用固态电子存储器件实现的硬盘,主要由控制器和存储器组成。固态硬盘在接口规范、物理尺寸、使用方式上和普通硬盘相同,其特别之处在于没有机械结构,利用独有的存储介质NAND Flash特性,以存储块(block)为单位执行写入操作,以页为单位执行擦除操作。SSD固态硬盘摆脱了机械硬盘的磁头,盘片转轴及控制电机等机械部件,没有电机加速旋转的过程,内部不存在任何机械活动部件,不会发生机械故障,也不怕碰撞、冲击和振动。Solid State Disk (Solid State Disk), also known as electronic hard disk or solid state electronic disk, is a hard disk implemented by solid-state electronic storage devices, mainly composed of a controller and a memory. The SSD has the same interface specification, physical size, and usage mode as the ordinary hard disk. The special feature is that there is no mechanical structure, and the unique storage medium NAND Flash feature is used to perform the write operation in units of blocks. The page performs an erase operation for the unit. The SSD solid state drive frees the mechanical heads of the mechanical hard disk, the rotating shaft of the disk and the mechanical components such as the control motor. There is no motor to accelerate the rotation process. There are no mechanical moving parts inside, no mechanical failure, no collision, shock and vibration.
NAND Flash是一种非易失性随机访问存储介质,其特点是断电后数据不消失。NAND Flash是基于浮栅(Floating Gate)晶体管设计。通过向存储器中的浮置栅极进行充放电来达到写入“0”或者“1”的目的,而通过判决浮置栅极中的电荷量来获得当前存储单元中所存储的数据。NAND Flash is a non-volatile random access storage medium, which is characterized by the fact that data does not disappear after power off. NAND Flash is based on a floating gate transistor design. The purpose of writing "0" or "1" is achieved by charging and discharging to the floating gate in the memory, and the data stored in the current memory cell is obtained by determining the amount of charge in the floating gate.
各种泄漏机理的存在,使得电子在浮栅上保存的特性受到严重影响,伴随反复地擦写,通道绝缘层会发生损伤,浮栅中的电子会因为绝缘层受损而加快泄漏电荷,称应力诱导漏电流(SILC),同样使内部阈值电压减小;绝缘层中捕获的电子可能被浮栅反捕获,并且温度越高而越明显,称固有电荷损失(ICL),这会使内部阈值电压减小;这些均被成为数据保持(Data Retention)错误。The existence of various leakage mechanisms makes the characteristics of electrons stored on the floating gate seriously affected. With repeated erasing, the channel insulation layer will be damaged, and the electrons in the floating gate will accelerate the leakage of charges due to the damage of the insulation layer. Stress-induced leakage current (SILC) also reduces the internal threshold voltage; electrons trapped in the insulating layer may be trapped by the floating gate, and the higher the temperature, the more obvious, called the inherent charge loss (ICL), which makes the internal threshold The voltage is reduced; these are all Data Retention errors.
数据长时间存放于NAND Flash中存在产生Data Retention错误造成数据丢失的风险,特别是在主机长时间不更新数据的情况下,这种风险也会变大。为了防止Data Retention错误的发生,需采用巡检的方式刷新数据,避免数据被长时间存放。Long-term storage of data in NAND Flash poses a risk of data loss due to Data Retention errors, especially if the host does not update the data for a long time. In order to prevent Data Retention errors from occurring, you need to use the inspection method to refresh the data to prevent the data from being stored for a long time.
目前,SSD实现巡检的方法可以为:根据存储逻辑地址到物理地址的映射表,按映射表中逻辑地址的排列顺序,将逻辑地址映射到的物理地址所对应的存储块中的有效数据依次读取出来,并写入新的空白存储块中(空白存储块为没有写入数据的存储块,例如通过垃圾回收模块回收并擦除的存储块)。At present, the method for implementing the patrol inspection by the SSD may be: according to the mapping table of the storage logical address to the physical address, according to the order of the logical addresses in the mapping table, the valid data in the storage block corresponding to the physical address mapped to the logical address is in turn Read out and write to a new blank block (a blank block is a block that has no data written, such as a block that is reclaimed and erased by the garbage collection module).
现有的SSD巡检方法至少存在以下问题:The existing SSD inspection methods have at least the following problems:
由于上述巡检方法为根据逻辑地址对SSD中的存储块进行巡检,这样会使长时间未被擦除的稳定数据和刚被写入的活跃数据在巡检过程中被迁移至同一存储块,由于存储块中活跃数据可能很快就会被更新而变成无效数据页,而稳定数据不会被更新,仍然为有效数据页,这样,在擦除存储块时,需要对未被更新的有效数据页进行迁移,从而增加了写放大。Since the foregoing patrol method is to patrol the storage blocks in the SSD according to the logical address, the stable data that has not been erased for a long time and the active data that has just been written are migrated to the same storage block during the patrol process. Since the active data in the memory block may be updated soon to become an invalid data page, and the stable data is not updated, it is still a valid data page, so that when the memory block is erased, it is required to be updated. Valid data pages are migrated, which increases write amplification.
发明内容Summary of the invention
为了解决现有技术的问题,本发明实施例提供了一种固态存储器中的数据巡检方法 及装置。所述技术方案如下:In order to solve the problem of the prior art, an embodiment of the present invention provides a data inspection method in a solid state memory. And equipment. The technical solution is as follows:
第一方面,提供了一种固态存储器中的数据巡检方法,所述固态存储器包括多个存储块,每个存储块用于存储多个数据页,所述固态存储器中还存储有第一链表组和第二链表组,所述第一链表组挂载有多个存储块,所述第二链表组用于挂载启用存储块,所述启用存储块为被启用以写入数据页的存储块;所述方法包括:在当前巡检周期内,根据所述第一链表组中所挂载的存储块被挂载至所述第一链表组的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页;将所读取的有效数据页存储至所述启用存储块,所述启用存储块为被用于写入数据页的空白存储块;将巡检周期内的所启用的启用存储块按照启用存储块被启用的时间挂载至所述第二链表组,在当前巡检周期的下一个巡检周期开始时,将所述第二链表组作为所述第一链表组,将所述第一链表组作为所述第二链表组。通过基于数据稳定性的优化,能够将稳定数据内聚到部分存储块中,非稳定数据可使用的存储块增多,从而能够明显提升SSD的冗余比,进而能够达到减小SSD的写放大,减少对SSD的磨损,延长SSD使用寿命的目的。In a first aspect, a data patrol method in a solid state memory is provided, the solid state memory comprising a plurality of memory blocks, each memory block being configured to store a plurality of data pages, wherein the solid chain memory further stores a first linked list a group and a second linked list group, wherein the first linked list group is mounted with a plurality of storage blocks, the second linked list group is for mounting an enabled storage block, and the enabled storage block is a storage enabled to write a data page The method includes: reading, in the current patrol period, the time in the first linked list group according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group a valid data page stored in the mounted memory block; storing the read valid data page to the enabled memory block, the enabled memory block being a blank memory block used to write the data page; The enabled enabled storage block in the cycle is mounted to the second linked list group according to the time when the enabled storage block is enabled, and the second linked list group is taken as the beginning of the next inspection cycle of the current inspection cycle. The first linked list group, the first Group list as the second list set. Through the optimization based on data stability, stable data can be cohesive to a part of the storage block, and the number of storage blocks that can be used for the unstable data is increased, so that the redundancy ratio of the SSD can be significantly improved, thereby achieving the write amplification of the SSD. Reduce the wear and tear on SSD and extend the service life of SSD.
在本发明的第一方面的第一种可能实现方式中,所述第一链表组包括多个链表,每个链表用于挂载被启用的时间在同一时间段内的存储块;所述根据所述第一链表组中所挂载的存储块被挂载至所述第一链表的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页包括:根据所述第一链表组中各链表对应的时间段的顺序读取各链表中挂载的存储块中存储的有效数据页;所述将巡检周期内所启用的启用存储块按照存储块被启用的时间挂载至所述第二链表组包括:将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中。通过根据第一链表组中各时间段的顺序读取各时间段对应的链表中挂载的存储快中存储的有效数据页,以及将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中,能够保证在每次巡检操作时,都能够按照存储块的启用时间对存储块执行巡检操作。In a first possible implementation manner of the first aspect of the present invention, the first linked list group includes multiple linked lists, where each linked list is used to mount a storage block that is enabled in a same time period; The time when the storage block mounted in the first linked list group is mounted to the first linked list, and the valid data page stored in the storage block mounted in the first linked list group is read: The sequence of time periods corresponding to each linked list in the first linked list group reads the valid data pages stored in the storage blocks mounted in each linked list; and the enabled storage blocks enabled in the patrol cycle are enabled according to the storage block. Time-mounting to the second linked list group includes: mounting the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled. Reading the valid data page stored in the storage cache linked in the linked list corresponding to each time period according to the sequence of each time period in the first linked list, and enabling the enabled storage block to be mounted to the enabled storage block is enabled In the linked list corresponding to the time period in which the time is located, it can be ensured that the patrol operation can be performed on the storage block according to the activation time of the storage block during each patrol operation.
在本发明的第一方面的第二种可能实现方式中,在读取所述第一链表组中的目标链表所挂载的存储块中的有效数据页时,所述方法进一步包括:为所述目标链表建立多个子链表,每个子链表对应一个无效数据页的个数,且所述子链表按照无效数据页的个数进行排序;确定所述目标链表所挂载的存储块中的无效数据页的个数;根据所确定的无效数据页的个数将目标链表中的存储块挂载至与所确定的无效数据页的个数对应的子链表中;根据所述目标链表中的子链表中对应的无效数据页的个数从多到少的顺序读取各子链表中所挂载的存储块中的有效数据页。通过按照该多个存储块中所包含无效页面的数量从多到少的顺序,依次读取该多个存储块中每个存储块的有效数据页,能够尽快腾出空白存储块,以供写入新数据或者供巡检过程中搬迁数据所用。In a second possible implementation manner of the first aspect of the present invention, when the valid data page in the storage block mounted by the target linked list in the first linked list group is read, the method further includes: The target linked list establishes a plurality of child linked lists, each of which corresponds to an invalid data page, and the child linked list is sorted according to the number of invalid data pages; and the invalid data in the storage block mounted by the target linked list is determined. The number of pages; the storage block in the target linked list is mounted to the child linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages; according to the child linked list in the target linked list The number of valid invalid data pages in the middle reads the valid data pages in the storage blocks mounted in each sub-linked list in order of increasing number. By sequentially reading the valid data pages of each of the plurality of memory blocks in order of the number of invalid pages included in the plurality of memory blocks, the blank memory blocks can be freed as soon as possible for writing Enter new data or use it to relocate data during the inspection process.
在本发明的第一方面的第三种可能实现方式中,在将所读取的有效数据页存储至启用存储块时,所述方法还包括:当所述启用存储块已经存满之后,则获取下一个启用存储块存储所读取的有效数据页。通过将有效数据页存储至启用存储块,并待该启用存储块存满后,获取下一个启用存储块,都能够达到稳定数据的内聚,降低写放大的目的。In a third possible implementation manner of the first aspect of the present invention, when the read valid data page is stored to the enabled memory block, the method further includes: when the enabled memory block is already full, Gets the valid data page read by the next enabled block store. By storing the valid data page to the enabled memory block, and after the enabled memory block is full, the next enabled memory block can achieve stable data cohesion and reduce write amplification.
在本发明的第一方面的第四种可能实现方式中,所述方法还包括:在在所述存储块中的有效数据页被全部读取之后,将所述存储块从所述第一链表组中摘除。过将在巡检之前,执行回收操作的存储块从该第一链表组中摘除,能够避免在巡检过程中再次对该存储块中的数据进行巡检,从而能够进一步减少巡检过程中的读写次数。 In a fourth possible implementation manner of the first aspect of the present invention, the method further includes: after the valid data pages in the storage block are all read, the storage block from the first linked list Remove from the group. Before the inspection, the storage block that performs the recovery operation is removed from the first linked list group, and the data in the storage block can be prevented from being patrolled again during the inspection, thereby further reducing the inspection process. The number of reads and writes.
第二方面,提供一种固态存储器中的数据巡检装置,所述装置包括多个功能模块用于执行上述第一方面所述的方法。在一种可能的实现方式中,所述装置还包括其他功能模块用于执行上述第一方面中多种可能的实现方式所述的方法。In a second aspect, a data patrol device in a solid state memory is provided, the device comprising a plurality of functional modules for performing the method of the first aspect described above. In a possible implementation, the apparatus further includes other functional modules for performing the methods described in the various possible implementations of the first aspect described above.
第三方面,提供了一种固态存储器中的数据巡检装置,所述装置包括:In a third aspect, a data patrol device in a solid state memory is provided, the device comprising:
处理器;processor;
用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
其中,所述处理器被配置为:在当前巡检周期内,根据所述第一链表组中所挂载的存储块被挂载至所述第一链表组的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页;将所读取的有效数据页存储至所述启用存储块,所述启用存储块为被用于写入数据页的空白存储块;将巡检周期内的所启用的启用存储块按照启用存储块被启用的时间挂载至所述第二链表组,在当前巡检周期的下一个巡检周期开始时,将所述第二链表组作为所述第一链表组,将所述第一链表组作为所述第二链表组。通过基于数据稳定性的优化,能够将稳定数据内聚到部分存储块中,非稳定数据可使用的存储块增多,从而能够明显提升SSD的冗余比,进而能够达到减小SSD的写放大,减少对SSD的磨损,延长SSD使用寿命的目的。The processor is configured to read the first time according to a time when the storage block mounted in the first linked list group is mounted to the first linked list group in a current patrol period. a valid data page stored in a storage block mounted in the linked list group; storing the read valid data page to the enabled storage block, the enabled storage block being a blank storage block used to write a data page; The enabled enabled storage block in the patrol period is mounted to the second linked list group according to the time when the enabled storage block is enabled, and the second linked list is started at the beginning of the next patrol period of the current patrol period As the first linked list group, the first linked list group is used as the second linked list group. Through the optimization based on data stability, stable data can be cohesive to a part of the storage block, and the number of storage blocks that can be used for the unstable data is increased, so that the redundancy ratio of the SSD can be significantly improved, thereby achieving the write amplification of the SSD. Reduce the wear and tear on SSD and extend the service life of SSD.
在本发明的第一方面的第一种可能实现方式中,所述第一链表组包括多个链表,每个链表用于挂载被启用的时间在同一时间段内的存储块;所述根据所述第一链表组中所挂载的存储块被挂载至所述第一链表的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页包括:根据所述第一链表组中各链表对应的时间段的顺序读取各链表中挂载的存储块中存储的有效数据页;所述将巡检周期内所启用的启用存储块按照存储块被启用的时间挂载至所述第二链表组包括:将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中。通过根据第一链表组中各时间段的顺序读取各时间段对应的链表中挂载的存储快中存储的有效数据页,以及将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中,能够保证在每次巡检操作时,都能够按照存储块的启用时间对存储块执行巡检操作。In a first possible implementation manner of the first aspect of the present invention, the first linked list group includes multiple linked lists, where each linked list is used to mount a storage block that is enabled in a same time period; The time when the storage block mounted in the first linked list group is mounted to the first linked list, and the valid data page stored in the storage block mounted in the first linked list group is read: The sequence of time periods corresponding to each linked list in the first linked list group reads the valid data pages stored in the storage blocks mounted in each linked list; and the enabled storage blocks enabled in the patrol cycle are enabled according to the storage block. Time-mounting to the second linked list group includes: mounting the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled. Reading the valid data page stored in the storage cache linked in the linked list corresponding to each time period according to the sequence of each time period in the first linked list, and enabling the enabled storage block to be mounted to the enabled storage block is enabled In the linked list corresponding to the time period in which the time is located, it can be ensured that the patrol operation can be performed on the storage block according to the activation time of the storage block during each patrol operation.
在本发明的第一方面的第二种可能实现方式中,在读取所述第一链表组中的目标链表所挂载的存储块中的有效数据页时,所述方法进一步包括:为所述目标链表建立多个子链表,每个子链表对应一个无效数据页的个数,且所述子链表按照无效数据页的个数进行排序;确定所述目标链表所挂载的存储块中的无效数据页的个数;根据所确定的无效数据页的个数将目标链表中的存储块挂载至与所确定的无效数据页的个数对应的子链表中;根据所述目标链表中的子链表中对应的无效数据页的个数从多到少的顺序读取各子链表中所挂载的存储块中的有效数据页。通过按照该多个存储块中所包含无效页面的数量从多到少的顺序,依次读取该多个存储块中每个存储块的有效数据页,能够尽快腾出空白存储块,以供写入新数据或者供巡检过程中搬迁数据所用。In a second possible implementation manner of the first aspect of the present invention, when the valid data page in the storage block mounted by the target linked list in the first linked list group is read, the method further includes: The target linked list establishes a plurality of child linked lists, each of which corresponds to an invalid data page, and the child linked list is sorted according to the number of invalid data pages; and the invalid data in the storage block mounted by the target linked list is determined. The number of pages; the storage block in the target linked list is mounted to the child linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages; according to the child linked list in the target linked list The number of valid invalid data pages in the middle reads the valid data pages in the storage blocks mounted in each sub-linked list in order of increasing number. By sequentially reading the valid data pages of each of the plurality of memory blocks in order of the number of invalid pages included in the plurality of memory blocks, the blank memory blocks can be freed as soon as possible for writing Enter new data or use it to relocate data during the inspection process.
在本发明的第一方面的第三种可能实现方式中,在将所读取的有效数据页存储至启用存储块时,所述方法还包括:当所述启用存储块已经存满之后,则获取下一个启用存储块存储所读取的有效数据页。通过将有效数据页存储至启用存储块,并待该启用存储块存满后,获取下一个启用存储块,都能够达到稳定数据的内聚,降低写放大的目的。 In a third possible implementation manner of the first aspect of the present invention, when the read valid data page is stored to the enabled memory block, the method further includes: when the enabled memory block is already full, Gets the valid data page read by the next enabled block store. By storing the valid data page to the enabled memory block, and after the enabled memory block is full, the next enabled memory block can achieve stable data cohesion and reduce write amplification.
在本发明的第一方面的第四种可能实现方式中,所述方法还包括:在在所述存储块中的有效数据页被全部读取之后,将所述存储块从所述第一链表组中摘除。过将在巡检之前,执行回收操作的存储块从该第一链表组中摘除,能够避免在巡检过程中再次对该存储块中的数据进行巡检,从而能够进一步减少巡检过程中的读写次数。In a fourth possible implementation manner of the first aspect of the present invention, the method further includes: after the valid data pages in the storage block are all read, the storage block from the first linked list Remove from the group. Before the inspection, the storage block that performs the recovery operation is removed from the first linked list group, and the data in the storage block can be prevented from being patrolled again during the inspection, thereby further reducing the inspection process. The number of reads and writes.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1是本发明实施例提供的一种固态存储器的结构示意图;1 is a schematic structural diagram of a solid state memory according to an embodiment of the present invention;
图2A是本发明实施例提供的一种固态存储器中的数据巡检方法流程图;2A is a flowchart of a data inspection method in a solid state memory according to an embodiment of the present invention;
图2B是本发明实施例提供的一种第一链表组的示意图;2B is a schematic diagram of a first linked list set according to an embodiment of the present invention;
图2C是本发明实施例提供的一种目标链表的示意图;2C is a schematic diagram of a target linked list according to an embodiment of the present invention;
图3是本发明实施例提供的一种固态存储器中的数据巡检装置框图。FIG. 3 is a block diagram of a data patrol device in a solid state memory according to an embodiment of the present invention.
具体实施方式detailed description
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
图1是本发明实施例提供的一种固态存储器的结构示意图,该固态存储器包括多个存储块,每个存储块用于存储多个数据页,所述固态存储器中还存储有第一链表组和第二链表组,所述第一链表组挂载有多个存储块,所述第二链表组用于挂载启用存储块,所述启用存储块为被启用以写入数据页的存储块。1 is a schematic structural diagram of a solid state memory according to an embodiment of the present invention, where the solid state memory includes a plurality of memory blocks, each of the memory blocks is configured to store a plurality of data pages, and the first linked list is further stored in the solid state memory. And a second linked list group, the first linked list group is mounted with a plurality of storage blocks, the second linked list group is used for mounting an enabled storage block, and the enabled storage block is a storage block enabled to write a data page .
参见图1,该固态存储器主要由控制器、存储器及内存组成。存储器用于提供数据存储服务,控制器为数据写入操作分配数据处理路径,以供主机或服务器通过对固态存储器中存储的数据进行访问,从而进行如数据读取、写入、删除等过程,该存储器即为固态存储阵列,该固态存储阵列可以是闪存阵列或者DRAM (Dynamic Random Access Memory,动态随机存储器)阵列,该控制器是具有硬件写保护功能的固态硬盘的核心部件,用于发出固态存储器的读取、写入数据和垃圾回收等请求,该内存中存储有程序指令,该控制器执行内存中的程序指令以对存储器中数据的进行处理。Referring to Figure 1, the solid state memory is mainly composed of a controller, a memory, and a memory. The memory is used to provide a data storage service, and the controller allocates a data processing path for the data write operation, so that the host or the server accesses the data stored in the solid-state memory, thereby performing processes such as data reading, writing, and deleting. The memory is a solid state storage array, and the solid state storage array may be a flash array or a DRAM (Dynamic Random Access Memory) array, which is a core component of a solid state hard disk with hardware write protection function for emitting solid state. A request for reading, writing data, and garbage collection of a memory in which program instructions are stored, and the controller executes program instructions in the memory to process data in the memory.
由于数据长时间存放于NAND Flash中存在产生Data Retention错误造成数据丢失的风险,特别是在主机长时间不更新数据的情况下,这种风险也会变大。为了防止DataRetention错误的发生,需采用巡检的方式刷新数据,避免数据被长时间存放。Since data is stored in NAND Flash for a long time, there is a risk of data loss caused by Data Retention errors, especially in the case where the host does not update the data for a long time. In order to prevent DataRetention errors from occurring, you need to use the inspection method to refresh the data to prevent the data from being stored for a long time.
为了避免由于存储介质发生电子泄露,造成存储数据发生错误的情况,通常SSD会周期性地对已存储的数据执行巡检搬移操作,以解决上述问题。由于SSD的使用寿命与该SSD的可擦写次数有关,而在巡检过程中,会对SSD中的存储块(block)重复执行擦除操作,因此会影响SSD的使用寿命。为了尽量减小巡检操作对SSD寿命的影响,本发明提供了一种数据巡检方法,该方法通过引入链表组,管理不同时间段内被用于存 储数据的存储块,通过挂载顺序执行巡检操作,以达到稳定数据内聚的目的,从而使得在后续巡检过程中,降低写放大,减小对SSD的擦写次数,进而减小巡检操作对SSD寿命的影响。In order to avoid an error in the stored data due to electronic leakage of the storage medium, the SSD periodically performs a patrol and carry operation on the stored data to solve the above problem. Since the service life of the SSD is related to the rewritable number of the SSD, during the patrol process, the erase operation is repeatedly performed on the memory block in the SSD, thus affecting the service life of the SSD. In order to minimize the impact of the inspection operation on the life of the SSD, the present invention provides a data inspection method, which is used to store different time periods by introducing a linked list group. The storage block of the data store performs the patrol operation in the order of mounting to achieve the purpose of stable data cohesion, thereby reducing the write amplification, reducing the number of erasing and writing to the SSD, and thereby reducing the patrol during the subsequent patrol process. The impact of inspection operations on the life of the SSD.
图2A是本发明实施例提供的一种固态存储器中的数据巡检方法流程图,所述固态存储器包括多个存储块,每个存储块用于存储多个数据页,所述固态存储器中还存储有第一链表组和第二链表组,所述第一链表组挂载有多个存储块,所述第二链表组用于挂载启用存储块,所述启用存储块为被启用以写入数据页的存储块;参见图2A,该方法包括:FIG. 2A is a flowchart of a data patrol method in a solid state memory according to an embodiment of the present invention. The solid state memory includes a plurality of memory blocks, each of which is used to store a plurality of data pages, and the solid state memory further includes Storing a first linked list group and a second linked list group, the first linked list group is mounted with a plurality of storage blocks, the second linked list group is for mounting an enabled storage block, and the enabled storage block is enabled to be written The storage block of the data page; see Figure 2A, the method includes:
201、在当前巡检周期内,根据第一链表组中所挂载的存储块被挂载至该第一链表组的时间,读取该第一链表组中所挂载的存储块中存储的有效数据页。201. During the current patrol period, according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group, the storage stored in the storage block mounted in the first linked list group is read. Valid data page.
该第一链表组存储于该固态存储器中,该第一链表组包括多个链表,每个链表用于挂载被启用的时间在同一时间段内的存储块;该被启用时间可以是存储块写入数据的时间,也可以是存储块执行擦除操作的时间;该第一链表组所包括链表数量由巡检周期和该第一链表组内挂载时间段的跨度确定。对于确定该挂载时间段的跨度,可以设置为任一固定值,本发明实施例对该挂载时间段跨度的具体数值及确定方法均不作限定。The first linked list group is stored in the solid-state memory, and the first linked list group includes a plurality of linked lists, each linked list is used for mounting a storage block whose enabled time is in the same time period; the enabled time may be a storage block The time at which the data is written may also be the time when the storage block performs the erasing operation; the number of linked lists included in the first linked list group is determined by the span of the patrol period and the mounting time period in the first linked list group. For the determination of the span of the mounting time period, it may be set to any fixed value. The specific value and the determining method of the spanning period span are not limited in the embodiment of the present invention.
需要说明的是,SSD的所有存储块中的每个存储块对应一个索引值,根据每个索引值能够唯一确定对应的存储块;例如,该SSD中所有存储块组成一个一维数组,每个存储块在该一维数组中的逻辑位置即为对应存储块的索引值。为了实现SSD中存储块的挂载操作,每个存储块对应一个结构体,每个存储块对应的结构体均包括一个前驱结点指针和后继结点指针,在存储块挂载至链表后,则获取被挂载的存储块的在所述链表中的前一个存储块的索引值,将该索引值存储至被挂载的存储块的结构体的前驱指针处,并将被挂载的存储块的索引值存储至所述前一个存储块的后驱指针处。例如,某一链表下挂载有顺序挂载的a、b和c三个存储块,则b存储块对应结构体的前驱结点指针中存储有a存储块的索引值,b存储块对应结构体的后继结点指针中存储有c存储块的索引值。It should be noted that each storage block in all the storage blocks of the SSD corresponds to an index value, and the corresponding storage block can be uniquely determined according to each index value; for example, all storage blocks in the SSD form a one-dimensional array, and each The logical position of the memory block in the one-dimensional array is the index value of the corresponding memory block. In order to implement the mounting operation of the storage blocks in the SSD, each storage block corresponds to a structure, and the structure corresponding to each storage block includes a precursor node pointer and a subsequent node pointer. After the storage block is mounted to the linked list, Obtaining an index value of a previous storage block in the linked list of the mounted storage block, storing the index value at a precursor pointer of the structure of the mounted storage block, and storing the mounted storage block The index value of the block is stored at the backdrive pointer of the previous memory block. For example, three storage blocks a, b, and c are sequentially mounted under a certain linked list, and the index value of the a storage block is stored in the precursor node pointer of the corresponding structure of the b storage block, and the corresponding structure of the b storage block The index value of the c memory block is stored in the subsequent node pointer of the body.
需要说明的是,在根据第一链表组中所挂载的存储块被挂载至该第一链表组的时间,读取该第一链表组中所挂载的存储块中存储的有效数据页之前,根据每个存储块的启用时间从先到后的顺序,将存储块挂载至第一链表组的相应时间段对应的链表下。It should be noted that, when the storage block mounted in the first linked list group is mounted to the first linked list group, the valid data page stored in the storage block mounted in the first linked list group is read. Previously, the storage block is mounted to the linked list corresponding to the corresponding time period of the first linked list group according to the order of the activation time of each storage block from first to last.
通过根据巡检周期和挂载时间段跨度,确定该第一链表组所包括链表数量,能够实现将存储块按启用时间的先后顺序依次挂载至该第一链表组的相应链表下,便于对该第一链表组下所挂载的存储块中的数据进行巡检和管理。The number of the linked list included in the first linked list group is determined according to the patrol period and the span of the mounting time period, so that the storage blocks are sequentially mounted in the order of the activation time to the corresponding linked list of the first linked list group, which is convenient for The data in the storage block mounted under the first linked list group is inspected and managed.
例如,当一个巡检周期为7个自然日,且该第一链表组的挂载时间段的跨度为一个小时,即同一个小时内启用的存储块挂载在同一个链表下,则该第一链表组所包括的链表数量为7*24个。需要说明的是,如果在某一个小时内,未启用任何存储块,则该段时间对应的该第一链表组中的链表下可以不挂载存储块。For example, when a patrol period is 7 natural days, and the span time period of the first linked list group spans one hour, that is, the storage blocks enabled in the same hour are mounted under the same linked list, then the first The number of linked lists included in a linked list is 7*24. It should be noted that if any storage block is not enabled within an hour, the storage block may not be mounted under the linked list in the first linked list group corresponding to the period of time.
通过根据每个存储块的启用时间从先到后的顺序,将存储块挂载至该第一链表组中,能够在后续对已存储数据进行巡检时,按照该第一链表组所挂载的存储块的挂载顺序巡检该第一链表组中已挂载的存储块。By mounting the storage block to the first linked list group according to the activation time of each storage block from the first to the last, the subsequent storage of the stored data can be performed according to the first linked list group. The mounting order of the storage blocks inspects the mounted storage blocks in the first linked list group.
该根据第一链表组中所挂载的存储块被挂载至该第一链表的时间,读取该第一链表组中所挂载的存储块中存储的有效数据页包括:根据第一链表组中各时间段的顺序读取 各时间段对应的链表中挂载的存储块中存储的有效数据页。也即是,根据挂载时间段的跨度,在巡检周期的第一时间段对该第一链表组的第一个链表下所挂载的存储块进行巡检,在巡检周期的第二时间段对该第一链表组的第二个链表下所挂载的存储块进行巡检,以此类推,直至完成对该第一链表组下所挂载的所有存储块的巡检操作。According to the time when the storage block mounted in the first linked list group is mounted to the first linked list, reading the valid data page stored in the storage block mounted in the first linked list group includes: according to the first linked list Sequential reading of each time period in the group A valid data page stored in a storage block mounted in a linked list corresponding to each time period. That is, according to the span of the mounting time period, the storage block mounted under the first linked list of the first linked list group is inspected during the first time period of the patrol period, and the second in the patrol period. The time period patrols the storage blocks mounted in the second linked list of the first linked list group, and so on, until the patrol operation of all the storage blocks mounted under the first linked list group is completed.
如图2B所示,该图为该第一链表组的示意图,其中,链表A、B、C、D分别表示该第一链表组中各挂载时间段对应的用于挂载存储块的链表,a1、a2、a3、a4表示依次挂载在该第一链表组中A链表下的存储块,同理,b1、b2、b3表示依次挂载在该第一链表组中B链表下的存储块,c1、c2、c3、c4表示依次挂载在该第一链表组中C链表下的存储块,d1、d2表示依次挂载在该第一链表组中D链表下的存储块。As shown in FIG. 2B, the figure is a schematic diagram of the first linked list group, wherein the linked list A, B, C, and D respectively represent a linked list for mounting a storage block corresponding to each of the mounting time periods in the first linked list group. , a1, a2, a3, and a4 represent storage blocks sequentially mounted in the A linked list in the first linked list group. Similarly, b1, b2, and b3 indicate storages sequentially mounted under the B linked list in the first linked list group. The blocks, c1, c2, c3, and c4 represent memory blocks sequentially mounted under the C linked list in the first linked list group, and d1 and d2 represent memory blocks sequentially mounted under the D linked list in the first linked list group.
在图2B中,根据该第一链表组中所挂载存储块的写入时间从先到后的顺序,读取该第一链表组中所挂载存储块内的有效数据页,即为依次读取A、B、C、D链表下所挂载存储块中的数据,具体地,对于A链表下所挂载的存储块,a1存储块中数据的启用时间先于a2,a2存储块中数据的启用时间先于a3,a3存储块中数据的启用时间先于a4,因此,挂载顺序依次为a1、a2、a3、a4,在读取该链表下所挂载存储块中的数据时,也按照该启用时间的先后顺序依次读取a1、a2、a3、a4存储块的有效数据页。In FIG. 2B, according to the write time of the memory block mounted in the first linked list group, the valid data pages in the storage block in the first linked list group are read in order from first to last, that is, Read the data in the storage block mounted under the A, B, C, and D lists. Specifically, for the storage block mounted under the A-chain table, the data in the a1 storage block is enabled before the a2, a2 storage block. The data is enabled before a3, and the data in the a3 memory block is enabled before a4. Therefore, the mount order is a1, a2, a3, and a4. When reading the data in the storage block under the linked list, The valid data pages of the a1, a2, a3, and a4 memory blocks are also sequentially read in the order of the activation time.
在读取该第一链表组中的目标链表所挂载的存储块中的有效数据页时,该方法进一步包括:为该目标链表建立多个子链表,每个子链表对应一个无效数据页的个数,且该子链表按照无效数据页的个数进行排序;确定该目标链表所挂载的存储块中的无效数据页的个数;根据所确定的无效数据页的个数将目标链表中的存储块挂载至与所确定的无效数据页的个数对应的子链表中;根据该目标链表中的子链表中对应的无效数据页的个数从多到少的顺序读取各子链表中所挂载的存储块中的有效数据页。When the valid data page in the storage block mounted by the target linked list in the first linked list is read, the method further includes: creating a plurality of sub-linked lists for the target linked list, and each sub-linked list corresponds to the number of invalid data pages And the child linked list is sorted according to the number of invalid data pages; determining the number of invalid data pages in the storage block mounted by the target linked list; storing the target linked list according to the determined number of invalid data pages The block is mounted to the child linked list corresponding to the determined number of invalid data pages; and the number of corresponding invalid data pages in the child linked list in the target linked list is read in the order of the number of invalid data pages in the descending order. A valid data page in the mounted memory block.
例如,当每个存储块包含128个页面时,该目标链表中包含129个子链表,也即是,每个存储块中包含有效数据页的个数可以为0—128个,有129种情况,不包含有效数据页的存储块挂载在该目标链表中的第1个子链表下,含有1个无效数据页的存储块挂载在该目标链表的第2个子链表下,含有128个无效数据页的存储块挂载在该目标链表的第129个子链表下,该目标链表可以用图2C表示,在图2C中,如果需要按照无效数据页多少进行排序的存储块中不存在包含对应数量无效数据页的存储块,则在该目标链表的对应子链表下不挂载存储块。对于该目标链表所挂载存储块的情况,依次按顺序遍历并回收相应存储块中的有效数据页,对于不包含有效数据页的存储块,也即是挂载在该目标链表的第一个子链表下的存储块,由于不包含有效数据页的存储块,在回收时,只需直接擦除即可作为空白存储块使用,无需进行有效数据搬迁操作,因此,在进行存储块回收时,优先处理该目标链表的第一个子链表下的存储块,再依次按该目标链表的挂载顺序依次对其他存储块进行处理。For example, when each storage block contains 128 pages, the target linked list includes 129 sub-linked lists, that is, the number of valid data pages in each storage block may be 0-128, and there are 129 cases. A memory block that does not contain a valid data page is mounted under the first child linked list in the target linked list, and a memory block containing one invalid data page is mounted under the second child linked list of the target linked list, and contains 128 invalid data pages. The storage block is mounted under the 129th sub-list of the target linked list, and the target linked list can be represented by FIG. 2C. In FIG. 2C, if there is no corresponding amount of invalid data in the storage block that needs to be sorted according to the number of invalid data pages. The storage block of the page does not mount the storage block under the corresponding sub-chain list of the target linked list. For the case where the storage block is mounted in the target linked list, the valid data pages in the corresponding storage block are sequentially traversed and recovered in order, and the storage block that does not contain the valid data page is also mounted on the first list of the target linked list. The memory block under the sub-chain table, because it does not contain the memory block of the valid data page, can be used as a blank memory block only when it is directly erased, and does not need to perform effective data relocation operation. Therefore, when the memory block is recovered, The storage blocks under the first sub-chain list of the target linked list are preferentially processed, and then the other storage blocks are sequentially processed according to the mounting order of the target linked list.
例如,在图2C中,方框中的数字表示用于挂载包含相应个数有效数据页的存储块的子链表,不包含有效数据页的存储块a1、a2、a3和a4挂载在该目标链表的第一个子链表下,即标号为0的子链表,包含1个有效数据页的存储块b1、b2和b3挂载在该目标链表的第二个子链表下,即标号为1的子链表,依次类推,包含128个有效数据页的存储块n1、n2、n3和n4挂载在该目标链表的第129个子链表下,即标号为128的子链表。For example, in FIG. 2C, the numbers in the boxes indicate sub-chain lists for mounting the memory blocks containing the corresponding number of valid data pages, and the memory blocks a1, a2, a3, and a4 not including the valid data pages are mounted on the Under the first sub-chain list of the target linked list, that is, the sub-chain list labeled 0, the storage blocks b1, b2, and b3 including one valid data page are mounted under the second sub-chain list of the target linked list, that is, labeled 1. The child linked list, and so on, the memory blocks n1, n2, n3, and n4 including 128 valid data pages are mounted under the 129th child linked list of the target linked list, that is, the child linked list labeled 128.
需要说明的是,对于该目标链表的任一子链表下所挂载的多个无效数据页数量相同 的多个存储块,可以按照挂载顺序依次读取每个存储块中的有效数据页,也可以不按照挂载顺序,随机读取该多个存储块中每个存储块的有效数据页,还可以按照其他顺序读取该多个存储块中每个存储块的数据,本发明实施例对此不作限定。It should be noted that the number of invalid data pages mounted under any sub-linked list of the target linked list is the same. The plurality of storage blocks may sequentially read the valid data pages in each storage block according to the mounting order, or may randomly read the valid data pages of each of the plurality of storage blocks without following the mounting order. The data of each of the plurality of storage blocks may be read in other orders, which is not limited by the embodiment of the present invention.
通过当该第一链表组内的一个链表中挂载有多个存储块时,按照该多个存储块中所包含无效数据页的数量从多到少的顺序,依次读取该多个存储块中每个存储块的有效数据页,能够尽快腾出空白存储块,以供写入新数据或者供巡检过程中搬迁数据所用。When a plurality of storage blocks are mounted in a linked list in the first linked list group, the plurality of storage blocks are sequentially read according to the order of the number of invalid data pages included in the plurality of storage blocks. The valid data pages of each memory block can free up blank memory blocks for writing new data or for relocating data during the inspection process.
202、将所读取的有效数据页存储至启用存储块,该启用存储块为被用于写入数据页的空白存储块。202. Store the read valid data page to an enabled memory block, which is a blank memory block used to write a data page.
该启用存储块可以用于存储巡检过程中搬迁的数据,也可以用于存储新写入的数据,本发明实施例对此不作限定。通过将巡检过程中读取到的该第一链表组中的有效数据页存储至启用存储块,而由于该第一链表组是将存储块按启用时间挂载,因此按照该第一链表组的挂载顺序进行巡检,能够将启用时间较早的存储块中的数据存储至同一启用存储块中,达到了稳定数据内聚的目的,当再次对该存储块进行巡检时,能够将该存储块中所存储的全部稳定数据进行迁移,如果该存储块中的稳定数据分散在多个存储块中,就需要对该多个存储块中的稳定数据进行迁移,因此将稳定数据内聚到一个存储块中,能够避免对数据进行分次写入、擦除操作,进而能够减小写入放大,延长SSD的使用寿命。其中,稳定数据是指SSD已存储数据中,长时间未被覆盖写或者删除的数据,即可认为是稳定数据,反之则为非稳定数据。The enabled storage block may be used to store data that is relocated during the patrol process, and may also be used to store newly written data, which is not limited in this embodiment of the present invention. By storing the valid data page in the first linked list group read during the patrol process to the enabled storage block, and because the first linked list group is to mount the storage block according to the enable time, according to the first linked list group The mounting sequence is patrolled, and the data in the storage block with the earlier activation time can be stored in the same enabled storage block to achieve stable data cohesion. When the storage block is patrolled again, the storage block can be patrolled. All the stable data stored in the storage block is migrated. If the stable data in the storage block is dispersed in a plurality of storage blocks, the stable data in the plurality of storage blocks needs to be migrated, so the stable data is cohesive. By going to a memory block, it is possible to avoid the division writing and erasing operations on the data, thereby reducing the write amplification and prolonging the service life of the SSD. Among them, the stable data refers to the data in the SSD stored data that has not been overwritten or deleted for a long time, and can be regarded as stable data, and vice versa.
203、将巡检周期内的所启用的启用存储块按照启用存储块被启用的时间挂载至第二链表组。203. Mount the enabled enabled storage block in the patrol cycle to the second linked list group according to the time when the enabled storage block is enabled.
该将巡检周期内启用存储块按照存储块被启用的时间挂载至第二链表组的具体方法为:将该启用存储块挂载至该启用存储块被启用的时间所在的时间段对应的链表中。The specific method of mounting the enabled storage block in the patrol period to the second linked list group according to the time when the storage block is enabled is: mounting the enabled storage block to the time period corresponding to the time when the enabled storage block is enabled. In the linked list.
当该启用存储块未填满时,按照该第一链表组中存储块的挂载顺序,继续读取下一存储块中的有效数据页,并将该有效数据页写入该启用存储块中,直至填满该启用存储块。当该启用存储块已经存满之后,则获取下一个启用存储块存储所读取的有效数据页,并将已存满的该启用存储块挂载至第二链表组的对应链表下。When the enabled storage block is not full, the valid data page in the next storage block is continuously read according to the mounting order of the storage blocks in the first linked list group, and the valid data page is written into the enabled storage block. Until the fill block is filled. After the enabled storage block is full, the valid data page read by the next enabled storage block storage is obtained, and the enabled storage storage block is mounted under the corresponding linked list of the second linked list.
在启用该启用存储块时,按照该启用存储块的启用时间将该启用存储块挂载至第二链表组下,该第二链表组用于按照存储块的启用时间进行挂载。需要说明的是,该启用存储块的启用时间可以是指对该启用存储块执行写入操作的时间,也可以是指对该启用存储块执行擦除操作的时间,该擦除操作是指在执行本次写入操作之前执行的擦除操作。When the enabled storage block is enabled, the enabled storage block is mounted under the second linked list group according to the enabled time of the enabled storage block, and the second linked list group is used for mounting according to the storage block's enable time. It should be noted that the enable time of the enabled memory block may be the time when the write operation is performed on the enabled memory block, or the time when the erase operation is performed on the enabled memory block, where the erase operation refers to The erase operation performed before this write operation is performed.
在该SSD中维持第一链表组和第二链表组两个链表组,当在当前巡检周期内,对该第一链表组中所挂载存储块中的数据执行巡检操作时,将在该当前巡检周期内执行写入操作的存储块,按照启用时间顺序依次挂载至该第二链表组中;在该当前巡检周期的下一巡检周期内,对该第二链表组中所挂载存储块中的数据执行巡检操作时,将在该巡检周期内执行写入操作的存储块,按照启用时间顺序依次挂载至该第一链表组中。Maintaining two linked list groups of the first linked list group and the second linked list group in the SSD, when performing a patrol operation on the data in the storage block in the first linked list group during the current patrol period, The storage blocks that perform the write operation in the current patrol period are sequentially mounted to the second linked list group in the order of activation time; in the next patrol period of the current patrol period, in the second linked list group When the data in the mounted storage block performs the patrol operation, the storage blocks that perform the write operation in the patrol cycle are sequentially mounted in the first linked list group in the order of activation time.
需要说明的是,由于对任一存储块中的数据执行巡检操作是指将该存储块中的有效数据从该存储块读出,并写入另一存储块中的过程;因此,在对第一链表组中所挂载存储块中的数据执行巡检操作时,在该当前巡检周期内执行写入操作的存储块即启用存储块,既包括根据应用的写入请求写入数据的存储块,也包括巡检过程中写入从所述第一 链表组中挂载的存储块搬迁的数据的存储块。It should be noted that, since performing a patrol operation on data in any storage block refers to a process of reading valid data in the storage block from the storage block and writing it into another storage block; When the data in the storage block in the first linked list group performs the patrol operation, the storage block that performs the write operation in the current patrol period is the enabled storage block, which includes writing the data according to the write request of the application. The storage block also includes the first write from the first during the inspection A storage block of data that is relocated by a storage block mounted in a linked list group.
如果在该SSD中维持两个用于管理巡检过程的链表组,包括第一链表组和第二链表组,使得在巡检过程中能够按照该两个链表组中所挂载的存储块的挂载顺序执行巡检操作。通过上述数据巡检方法进行巡检的过程可以为:如果一个巡检周期为7个自然日,且该第一链表组及第二链表组内挂载时间段的跨度为一个小时,该第一链表组和该第二链表组分别包含7*24个链表,按照该存储块的启用时间顺序,将该写入数据的存储块依次挂载至该第一链表组的对应链表下,例如,在第一个小时内启用的存储块挂载至该第一链表组的第一个链表中,在第二个小时内启用的存储块挂载至该第一链表组的第二个链表中,以此类推,挂载至同一链表下的存储块,启用时间间隔不超过一个小时。If two linked list groups for managing the patrol process are maintained in the SSD, including the first linked list group and the second linked list group, the storage blocks mounted in the two linked list groups can be followed during the patrol process. The mount order performs the patrol operation. The process of performing the patrol inspection by the data patrol method may be: if a patrol period is 7 natural days, and the span of the first linked list group and the second linked list group spans one hour, the first The linked list group and the second linked list group respectively comprise 7*24 linked lists, and the storage blocks of the written data are sequentially mounted to the corresponding linked list of the first linked list group according to the activation time order of the storage blocks, for example, The storage block enabled in the first hour is mounted in the first linked list of the first linked list group, and the storage block enabled in the second hour is mounted in the second linked list of the first linked list group to This type of push is mounted to a block of memory under the same linked list with an enable interval of no more than one hour.
也即是,在第一个巡检周期内,不执行巡检操作,仅将新写入数据的存储块执行挂载操作,在第二个巡检周期内,对该第一链表组所挂载存储块中的数据执行巡检操作,并将新写入数据的存储块挂载至该第二链表组中,该新写入存储块中的数据包括巡检过程中搬迁的有效数据和根据应用的写入请求新写入的数据。That is, during the first patrol period, the patrol operation is not performed, and only the storage block of the newly written data is subjected to the mount operation, and in the second patrol period, the first linked list group is hanged. The data in the storage block performs a patrol operation, and the storage block of the newly written data is mounted in the second linked list group, and the data in the newly written storage block includes valid data and basis for relocation during the patrol inspection process. The application's write requests the newly written data.
在对该第一链表组执行巡检操作时,在该第二链表组的第一个挂载时间段,对该第一链表组的第一个链表下所挂载存储块中的有效数据进行搬迁,在该第二链表组的第二个挂载时间段,向该第二链表组的第二个链表下挂载存储块时,对该第一链表组的第二个链表下所挂载存储块中的有效数据进行搬迁,以此类推。When performing the patrol operation on the first linked list group, performing valid data in the storage block of the first linked list of the first linked list group in the first mounting time period of the second linked list group Relocating, when the storage block is mounted to the second linked list of the second linked list group in the second mounting time period of the second linked list group, the second linked list of the first linked list group is mounted The valid data in the storage block is moved, and so on.
当第二巡检周期结束后,对该第一链表组所挂载存储块中的数据巡检完毕,挂载在该第一链表组下的存储块中的有效数据被搬迁后,这些存储块被回收或被擦除后,挂载至擦除块链表组或空白块链表组下,以等待被擦除或重新写入数据。在第三巡检周期,对该第二链表组所挂载存储块中的数据进行巡检,并将新写入数据的存储块挂载至该第一链表组中。After the second patrol period ends, the data in the storage block of the first linked list group is patrolled, and the valid data in the storage block mounted under the first linked list group is relocated, and the storage blocks are After being recycled or erased, it is mounted under the erase block linked list group or the blank block linked list group to wait for the data to be erased or rewritten. In the third patrol period, the data in the storage block of the second linked list group is patrolled, and the storage block of the newly written data is mounted in the first linked list group.
通过按照启用时间将存储块挂载至该第二链表组的对应链表下,能够达到稳定数据内聚的目的,当再次对该存储块进行巡检时,能够将该存储块中所存储的全部稳定数据进行迁移,如果该存储块中的稳定数据分散在多个存储块中,就需要对该多个存储块中的稳定数据进行迁移,因此将稳定数据内聚到一个存储块中,能够避免对数据进行分次写入、擦除操作,进而能够在对第一链表组中所挂载存储块中的数据进行巡检的过程中减小SSD写放大,延长SSD的使用寿命。By mounting the storage block to the corresponding linked list of the second linked list group according to the activation time, the purpose of stable data cohesion can be achieved, and when the storage block is patrolled again, all the stored in the storage block can be stored. Stable data is migrated. If the stable data in the storage block is dispersed in multiple storage blocks, the stable data in the multiple storage blocks needs to be migrated, so that the stable data is cohesively integrated into one storage block, which can be avoided. The data is divided and erased, and the SSD write amplification can be reduced in the process of patrolling the data in the storage block in the first linked list group, thereby prolonging the service life of the SSD.
在本发明另一实施例中,在SSD的运行过程中,该第一链表组中所挂载的任一存储块在未被巡检之前被回收时,该存储块从该第一链表组中摘除,如果该存储块中有效数据搬迁完毕,但未执行擦除操作,将该存储块从该第一链表中摘除,并将该存储块挂载至擦除块链表组中,如果该存储块执行了擦除操作,将该存储块挂载至空白块链表组中。In another embodiment of the present invention, during the operation of the SSD, when any of the storage blocks mounted in the first linked list group is reclaimed before being patrolled, the storage block is from the first linked list group. Excluding, if the valid data in the memory block is relocated, but the erase operation is not performed, the memory block is removed from the first linked list, and the memory block is mounted in the erase block linked list group, if the memory block An erase operation is performed to mount the memory block to the blank block linked list group.
通过将在巡检之前,执行回收操作的存储块从该第一链表组中摘除,能够避免在巡检过程中再次对该存储块中的数据进行巡检,从而能够进一步减少巡检过程中的读写次数。By removing the memory block that performs the recovery operation from the first linked list group before the patrol inspection, it is possible to prevent the data in the storage block from being patrolled again during the patrol process, thereby further reducing the patrol process. The number of reads and writes.
在巡检周期的预设时间段内,执行对该第一链表组中所挂载的全部存储块的巡检操作。该预设时间段可以设置为任一时间段,本发明实施例对此不作限定。例如,如果一个巡检周期为7个自然日,且该第一链表组内挂载时间段的跨度为一个小时,该第一链表组包含7*24个链表,在该第二链表组中的第6*24+1个链表对应的挂载时间段,对该第一链表组的第1~7个链表下所挂载存储块中的数据进行巡检,该7个链表下所挂载存 储块中的数据在一个小时内巡检完毕,在该第二链表组中的第6*24+2个链表对应的挂载时间段,对该第一链表组的第8~14个链表下所挂载存储块中的数据进行巡检,该7个链表下所挂载存储块中的数据在一个小时内巡检完毕,以此类推,可以根据巡检周期,确定一个挂载时间跨度内需要完成巡检的链表数量。During the preset time period of the patrol cycle, the patrol operation of all the storage blocks mounted in the first linked list group is performed. The preset time period can be set to any time period, which is not limited by the embodiment of the present invention. For example, if a patrol period is 7 natural days, and the span of the first linked list group spans one hour, the first linked list group includes 7*24 linked lists, and the second linked list group The mounting time period corresponding to the 6th/th +1th linked list is used to patrol the data in the storage blocks of the first to seventh linked lists of the first linked list, and the seven linked lists are logged. The data in the storage block is patrolled within one hour, and the 6th to 24th linked list in the second linked list group corresponds to the 8th to 14th linked list of the first linked list. The data in the storage block is patrolled, and the data in the storage block under the seven linked lists is patrolled within one hour, and so on, and a mount time span can be determined according to the patrol period. The number of linked lists that need to complete the inspection.
也即是,在该巡检周期的最后一天,完成对该第一链表组中所挂载存储块中所有数据的巡检过程。在下一个巡检周期,前6天将执行写入操作的存储块按照写入时间顺序依次挂载至该第二链表组的对应链表下,第7天根据上述方法对该第一链表组中所挂载存储块中的数据执行巡检操作。That is, on the last day of the patrol cycle, the patrol process of all the data in the storage block mounted in the first linked list group is completed. In the next patrol cycle, the storage blocks that perform the write operation in the first 6 days are sequentially mounted in the order of the write time to the corresponding linked list of the second linked list group, and on the seventh day, according to the above method, the first linked list group is Mount the data in the storage block to perform the patrol operation.
在SSD不同的使用环境下,对新启用的存储块按照写入时间或擦除时间挂载至相应的链表组下,并在不同的巡检周期,对挂载在不同链表组的数据进行数据巡检,都能够达到稳定数据的内聚,降低写放大的目的。In different usage environments of the SSD, the newly enabled storage blocks are mounted to the corresponding linked list group according to the writing time or the erasing time, and data is carried on the data of different linked list groups in different inspection periods. Inspections can achieve the cohesion of stable data and reduce the purpose of write amplification.
204、在当前巡检周期的下一个巡检周期开始时,将该第二链表组作为该第一链表组,将该第一链表组作为该第二链表组,重复执行步骤201。204. At the beginning of the next patrol period of the current patrol period, the second linked list group is used as the first linked list group, and the first linked list group is used as the second linked list group, and step 201 is repeatedly performed.
在下一个巡检周期,采用与巡检第一链表组中所挂载存储块相同的方法,执行下一周期的巡检操作,依次类推。In the next inspection cycle, the same cycle as the storage block in the first linked list group is patrolled, and the next cycle of the inspection operation is performed, and so on.
通过根据启用时间从先到后的顺序,读取所述第一链表组中所挂载存储块内的有效数据,并将读取到的有效数据存储至空白存储块,能够在巡检过程中,将稳定数据和非稳定数据分开存储到不同的存储块中,能够极大地减少稳定数据所占据的容量,提升非稳定数据对应的冗余空间,从而能够有效地降低写放大,减少磨损,提升性能和稳定性,延长使用寿命;进一步地,通过将在巡检之前,执行回收操作的存储块从该第一链表组中摘除,能够避免在巡检过程中再次对该存储块中的数据进行巡检,从而能够进一步减少巡检过程中的读写次数;通过按照所包含无效页面数量从多到少的顺序,依次对多个待回收的存储块执行回收操作,能够使含有无效页面数量最多的存储块较快地被回收,进而能够达到优化垃圾回收的目的。By reading the valid data in the storage block in the first linked list group according to the activation time from the first to the last, and storing the read valid data to the blank storage block, the patrol process can be performed during the patrol process. Separate stable data and unstable data into different storage blocks, which can greatly reduce the capacity occupied by stable data and increase the redundant space corresponding to unstable data, thereby effectively reducing write amplification, reducing wear and tear, and improving Performance and stability, extending the service life; further, by removing the storage block that performs the recovery operation from the first linked list group before the inspection, it is possible to avoid data in the storage block again during the inspection process. The inspection can further reduce the number of reading and writing in the inspection process; by performing the recycling operation on multiple storage blocks to be recycled in order of the number of invalid pages included, the number of invalid pages can be maximized. The storage blocks are recycled faster, which in turn optimizes garbage collection.
例如,容量为100GB的SSD,实际物理容量为128GB,如果该SSD中已存储了100GB的有效数据,整盘冗余比为(128-100)/100=28%,在这100GB的有效数据中,有50GB的数据为稳定数据,很少被修改或删除,另外50GB数据为非稳定数据,存储时间较短,且经常被修改或删除,需要说明的是,128GB的实际容量均参与了读写过程。For example, an SSD with a capacity of 100 GB has an actual physical capacity of 128 GB. If 100 GB of valid data has been stored in the SSD, the overall redundancy ratio is (128-100)/100=28%, in the 100 GB of valid data. 50GB of data is stable data, rarely modified or deleted, another 50GB of data is unsteady data, storage time is short, and often modified or deleted, it should be noted that 128GB of actual capacity is involved in reading and writing. process.
在执行巡检操作时,50GB稳定数据对应的存储块中包含部分无效页面,也即是,该50GB稳定数据实际占据约(50/100)*128=64GB的存储块,通过上述巡检操作后,有效数据被搬迁到空白存储块中,这些有效数据之前占据的存储块被释放,该巡检过程,即为将稳定数据内聚到新的存储块中,并将原来有效数据占据的存储块中所包含的无效数据释放出来的过程。When the patrol operation is performed, the memory block corresponding to the 50 GB stable data contains a part of the invalid page, that is, the 50 GB stable data actually occupies a storage block of about (50/100)*128=64 GB, after the patrol operation. The valid data is moved to the blank storage block, and the storage block occupied by the valid data is released. The inspection process is a storage block that coheres the stable data into a new storage block and occupies the original valid data. The process of releasing invalid data contained in it.
经过巡检操作后,该SSD中原来100GB的有效数据,其中50GB的稳定数据内聚至接近于50GB的存储块中,另外50GB的非稳定数据的可用容量为128-50=78GB,冗余比为(78-50)/50=56%,该冗余比为原来整盘冗余比的2倍,由于此时该盘相当于这样一块逻辑盘,逻辑容量为50GB,物理容量为78GB,已用容量50GB,该盘实际冗余比为56%,因此该盘具有更多的存储空间可供垃圾回收时存储有效数据使用,能够有效减少垃圾回收时搬迁的数据量,从而减小该SSD的写放大,延长该SSD的使用寿命。After the patrol operation, the original 100GB of valid data in the SSD, 50GB of stable data is cohesive to a memory block close to 50GB, and the available capacity of 50GB of unstable data is 128-50=78GB, redundancy ratio For (78-50)/50=56%, the redundancy ratio is twice the redundancy ratio of the original whole disk. Since the disk is equivalent to such a logical disk at this time, the logical capacity is 50 GB and the physical capacity is 78 GB. With a capacity of 50GB, the actual redundancy ratio of the disk is 56%, so the disk has more storage space for storing valid data during garbage collection, which can effectively reduce the amount of data moved during garbage collection, thereby reducing the SSD. Write amplification to extend the life of the SSD.
进一步地,该100GB有效数据中50GB的非稳定数据也内聚到新的存储块中,由于 非稳定数据存储时间较短,且经常被修改或删除,因此存储非稳定数据的存储块中的无效页面会较快地成为无效数据,通过在垃圾回收时,优先回收包含无效页面多的存储块,能够使得包含无效页面数量较多的存储块能够较快地被回收。Further, 50 GB of unsteady data in the 100 GB of valid data is also cohesive into a new memory block due to Unstable data storage time is short and often modified or deleted. Therefore, invalid pages in memory blocks storing unstable data will become invalid data faster. By garbage collection, priority is given to reclaiming memory blocks containing many invalid pages. It is possible to enable memory blocks containing a large number of invalid pages to be recycled faster.
通过基于数据稳定性的优化,能够将稳定数据内聚到部分存储块中,非稳定数据可使用的存储块增多,从而能够明显提升SSD的冗余比,通过按照多个待回收存储块中每个存储块包含无效页面从多到少的顺序,依次回收该多个待回收存储块,能够较快得到可供使用的空白存储块,进而能够优化垃圾回收的效果,从而达到减小SSD的写放大,减少对SSD的磨损,延长SSD使用寿命的目的。Through the optimization based on data stability, stable data can be cohesive to a part of the storage block, and the number of storage blocks that can be used for the unstable data is increased, so that the redundancy ratio of the SSD can be significantly improved by each of the plurality of storage blocks to be recycled. The storage blocks contain the order of invalid pages from most to less, and the plurality of to-be-recovered storage blocks are sequentially recovered, so that the available blank storage blocks can be obtained quickly, thereby optimizing the effect of garbage collection, thereby reducing the write of the SSD. Zoom in to reduce the wear and tear on the SSD and extend the life of the SSD.
图3是本发明实施例提供的一种固态存储器中的数据巡检装置框图。参照图3,该装置包括读取模块301,存储模块302和处理模块303。FIG. 3 is a block diagram of a data patrol device in a solid state memory according to an embodiment of the present invention. Referring to FIG. 3, the apparatus includes a reading module 301, a storage module 302, and a processing module 303.
读取模块301,用于在当前巡检周期内,根据第一链表组中所挂载的存储块被挂载至所述第一链表组的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页;The reading module 301 is configured to read the time in the first linked list group according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group in the current patrol period. a valid data page stored in the stored memory block;
存储模块302,用于将所读取的有效数据页存储至启用存储块;a storage module 302, configured to store the read valid data page to the enabled storage block;
处理模块303,用于将巡检周期内的所启用的启用存储块按照启用存储块被启用的时间挂载至第二链表组,在当前巡检周期的下一个巡检周期开始时,将所述第二链表组作为所述第一链表组,将所述第一链表组作为所述第二链表组。The processing module 303 is configured to mount the enabled enabled storage block in the patrol period to the second linked list group according to the time when the enabled storage block is enabled, and at the beginning of the next patrol period of the current patrol period, The second linked list group is used as the first linked list group, and the first linked list group is used as the second linked list group.
在本发明提供的第一种可能实现方式中,所述第一链表组包括多个链表,每个链表用于挂载被启用的时间在同一时间段内的存储块;In a first possible implementation manner provided by the present invention, the first linked list group includes multiple linked lists, and each linked list is used to mount a storage block that is enabled in a same time period;
所述读取模块301用于根据第一链表组中各链表对应的时间段的顺序读取各链表中挂载的存储块中存储的有效数据页;The reading module 301 is configured to read valid data pages stored in the storage blocks mounted in the linked lists according to the time period corresponding to each linked list in the first linked list;
所述处理模块303用于将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中。The processing module 303 is configured to mount the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled.
在本发明提供的第二种可能实现方式中,所述装置进一步包括:In a second possible implementation manner provided by the present invention, the device further includes:
链表建立模块,用于为所述目标链表建立多个子链表,每个子链表对应一个无效数据页的个数,且所述子链表按照无效数据页的个数进行排序;a linked list establishing module, configured to create a plurality of sub-linked lists for the target linked list, each sub-linked list corresponding to an invalid data page, and the sub-linked list is sorted according to the number of invalid data pages;
确定模块,用于确定所述目标链表所挂载的存储块中的无效数据页的个数;a determining module, configured to determine the number of invalid data pages in the storage block mounted by the target linked list;
挂载模块,用于根据所确定的无效数据页的个数将目标链表中的存储块挂载至与所确定的无效数据页的个数对应的子链表中;a mounting module, configured to mount the storage block in the target linked list to the sub-linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages;
所述读取模块301还用于根据所述目标链表中的子链表中对应的无效数据页的个数从多到少的顺序读取各子链表中所挂载的存储块中的有效数据页。The reading module 301 is further configured to read valid data pages in the storage blocks mounted in each sub-chain list according to the number of corresponding invalid data pages in the sub-chain table in the target linked list. .
在本发明提供的第三种可能实现方式中,所述装置还包括:In a third possible implementation manner provided by the present invention, the device further includes:
获取模块,当所述启用存储块已经存满之后,则获取下一个启用存储块存储所读取的有效数据页。Obtaining a module, after the enabled storage block is full, acquiring a valid data page read by the next enabled storage block storage.
在本发明提供的第四种可能实现方式中,所述装置还包括:In a fourth possible implementation manner provided by the present invention, the device further includes:
摘除模块,用于在所述存储块中的有效数据页被全部读取之后,将所述存储块从所述第一链表组中摘除。And an excerpt module, configured to remove the memory block from the first linked list group after the valid data pages in the storage block are all read.
需要说明的是:上述实施例提供的数据巡检装置在进行数据巡检时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功 能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的数据巡检装置与数据巡检方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that the data patrol device provided in the above embodiment is only exemplified by the division of the above functional modules when performing data patrol inspection. In actual applications, the functions may be assigned different functions according to needs. The module can be completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data patrol device and the data patrol method are provided in the same embodiment. The specific implementation process is described in detail in the method embodiment, and details are not described herein again.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。 The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.

Claims (10)

  1. 一种固态存储器中的数据巡检方法,所述固态存储器包括多个存储块,每个存储块用于存储多个数据页,所述固态存储器中还存储有第一链表组和第二链表组,所述第一链表组挂载有多个存储块,所述第二链表组用于挂载启用存储块,所述启用存储块为被启用以写入数据页的存储块;其特征在于,所述方法包括:A data patrol method in a solid-state memory, the solid-state memory comprising a plurality of memory blocks, each memory block for storing a plurality of data pages, wherein the solid-state memory further stores a first linked list group and a second linked list group The first linked list group is mounted with a plurality of storage blocks, the second linked list group is configured to mount an enabled storage block, and the enabled storage block is a storage block that is enabled to write a data page; The method includes:
    在当前巡检周期内,根据所述第一链表组中所挂载的存储块被挂载至所述第一链表组的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页;将所读取的有效数据页存储至所述启用存储块;During the current patrol period, according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group, the storage block mounted in the first linked list group is read. a valid data page stored; storing the read valid data page to the enabled memory block;
    将巡检周期内的所启用的启用存储块按照被启用的时间挂载至所述第二链表组,在当前巡检周期的下一个巡检周期开始时,将所述第二链表组作为所述第一链表组,将所述第一链表组作为所述第二链表组。And enabling the enabled enabled storage block in the patrol period to be mounted to the second linked list group according to the enabled time, and at the beginning of the next patrol period of the current patrol period, the second linked list group is taken as The first linked list group is the first linked list group as the second linked list group.
  2. 根据权利要求1所述的方法,其特征在于,所述第一链表组包括多个链表,每个链表用于挂载被启用的时间在同一时间段内的存储块;The method according to claim 1, wherein the first linked list group comprises a plurality of linked lists, each linked list for mounting a storage block whose enabled time is within a same time period;
    所述根据所述第一链表组中所挂载的存储块被挂载至所述第一链表的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页包括:And reading, according to a time when the storage block mounted in the first linked list group is mounted to the first linked list, reading a valid data page stored in the storage block mounted in the first linked list group includes :
    根据所述第一链表组中各链表对应的时间段的顺序读取各链表中挂载的存储块中存储的有效数据页;And reading valid data pages stored in the storage blocks mounted in each linked list according to the time period corresponding to each linked list in the first linked list group;
    所述将巡检周期内所启用的启用存储块按照被启用的时间挂载至所述第二链表组包括:The mounting the enabled storage block enabled in the patrol period to the second linked list group according to the enabled time includes:
    将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中。The enabled storage block is mounted in a linked list corresponding to a time period in which the enabled storage block is enabled.
  3. 根据权利要求2所述的方法,其特征在于,在读取所述第一链表组中的目标链表所挂载的存储块中的有效数据页时,所述方法进一步包括:The method according to claim 2, wherein when the valid data page in the storage block mounted by the target linked list in the first linked list is read, the method further comprises:
    为所述目标链表建立多个子链表,每个子链表对应一个无效数据页的个数,且所述子链表按照无效数据页的个数进行排序;Establishing a plurality of sub-linked lists for the target linked list, each sub-linked list corresponding to an invalid data page, and the sub-linked list is sorted according to the number of invalid data pages;
    确定所述目标链表所挂载的存储块中的无效数据页的个数;Determining the number of invalid data pages in the storage block mounted by the target linked list;
    根据所确定的无效数据页的个数将目标链表中的存储块挂载至与所确定的无效数据页的个数对应的子链表中;Storing the storage blocks in the target linked list to the child linked list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages;
    根据所述目标链表中的子链表中对应的无效数据页的个数从多到少的顺序读取各子链表中所挂载的存储块中的有效数据页。The valid data pages in the storage blocks mounted in the respective child linked lists are read in order from the number of corresponding invalid data pages in the child linked list in the target linked list.
  4. 根据权利要求1所述的方法,其特征在于,在将所读取的有效数据页存储至启用存储块时,所述方法还包括:The method of claim 1, wherein when the read valid data page is stored to the enabled memory block, the method further comprises:
    当所述启用存储块已经存满之后,则获取下一个启用存储块存储所读取的有效数据页。After the enabled memory block is full, the valid data page read by the next enabled memory block is fetched.
  5. 根据权利要求1所述的方法,其特征在于,在所述存储块中的有效数据页被全 部读取之后,将所述存储块从所述第一链表组中摘除。The method of claim 1 wherein the valid data page in said memory block is fully After the reading, the memory block is removed from the first linked list.
  6. 一种固态存储器中的数据巡检装置,所述固态存储器包括多个存储块,每个存储块用于存储多个数据页,所述固态存储器中还存储有第一链表组和第二链表组,所述第一链表组挂载有多个存储块,所述第二链表组用于挂载启用存储块,所述启用存储块为被启用以写入数据页的存储块;其特征在于,所述装置包括:A data patrol device in a solid-state memory, the solid-state memory comprising a plurality of memory blocks, each memory block for storing a plurality of data pages, wherein the solid-state memory further stores a first linked list group and a second linked list group The first linked list group is mounted with a plurality of storage blocks, the second linked list group is configured to mount an enabled storage block, and the enabled storage block is a storage block that is enabled to write a data page; The device includes:
    读取模块,用于在当前巡检周期内,根据所述第一链表组中所挂载的存储块被挂载至所述第一链表组的时间,读取所述第一链表组中所挂载的存储块中存储的有效数据页;a reading module, configured to read, in the current patrol period, the time in the first linked list group according to the time when the storage block mounted in the first linked list group is mounted to the first linked list group A valid data page stored in the mounted memory block;
    存储模块,用于将所读取的有效数据页存储至所述启用存储块,所述启用存储块为被用于写入数据页的空白存储块;a storage module, configured to store the read valid data page to the enabled storage block, where the enabled storage block is a blank storage block used to write a data page;
    处理模块,用于将巡检周期内的所启用的启用存储块按照启用存储块被启用的时间挂载至所述第二链表组,在当前巡检周期的下一个巡检周期开始时,将所述第二链表组作为所述第一链表组,将所述第一链表组作为所述第二链表组。a processing module, configured to mount the enabled enabled storage block in the patrol period to the second linked list group according to a time when the enabled storage block is enabled, at the beginning of the next patrol period of the current patrol period, The second linked list group is used as the first linked list group, and the first linked list group is used as the second linked list group.
  7. 根据权利要求6所述的装置,其特征在于,所述第一链表组包括多个链表,每个链表用于挂载被启用的时间在同一时间段内的存储块;The apparatus according to claim 6, wherein the first linked list group comprises a plurality of linked lists, each linked list for mounting a storage block whose enabled time is within a same time period;
    所述读取模块用于根据第一链表组中各链表对应的时间段的顺序读取各链表中挂载的存储块中存储的有效数据页;The reading module is configured to read valid data pages stored in the storage blocks mounted in each linked list according to the time period corresponding to each linked list in the first linked list;
    所述处理模块用于将所述启用存储块挂载至所述启用存储块被启用的时间所在的时间段对应的链表中。The processing module is configured to mount the enabled storage block to a linked list corresponding to a time period in which the enabled storage block is enabled.
  8. 根据权利要求7所述的装置,其特征在于,所述装置进一步包括:The device according to claim 7, wherein the device further comprises:
    链表建立模块,用于为要被读取的目标链表建立多个子链表,每个子链表对应一个无效数据页的个数,且所述子链表按照无效数据页的个数进行排序;a linked list establishing module, configured to create a plurality of sub-linked lists for the target linked list to be read, each sub-linked list corresponding to an invalid data page, and the sub-linked list is sorted according to the number of invalid data pages;
    确定模块,用于确定所述目标链表所挂载的存储块中的无效数据页的个数;a determining module, configured to determine the number of invalid data pages in the storage block mounted by the target linked list;
    挂载模块,用于根据所确定的无效数据页的个数将所述目标链表中的存储块挂载至与所确定的无效数据页的个数对应的子链表中;a mounting module, configured to mount the storage block in the target linked list to a sub-chain list corresponding to the determined number of invalid data pages according to the determined number of invalid data pages;
    所述读取模块还用于根据所述目标链表中的子链表中对应的无效数据页的个数从多到少的顺序读取各子链表中所挂载的存储块中的有效数据页。The reading module is further configured to read valid data pages in the storage blocks mounted in each sub-chain list according to the order of the number of corresponding invalid data pages in the sub-chain table in the target linked list.
  9. 根据权利要求6所述的装置,其特征在于,所述装置还包括:The device according to claim 6, wherein the device further comprises:
    获取模块,当所述启用存储块已经存满之后,则获取下一个启用存储块存储所读取的有效数据页。Obtaining a module, after the enabled storage block is full, acquiring a valid data page read by the next enabled storage block storage.
  10. 根据权利要求6所述的装置,其特征在于,所述装置还包括:The device according to claim 6, wherein the device further comprises:
    摘除模块,用于在所述存储块中的有效数据页被全部读取之后,将所述存储块从所述第一链表组中摘除。 And an excerpt module, configured to remove the memory block from the first linked list group after the valid data pages in the storage block are all read.
PCT/CN2017/083988 2016-05-12 2017-05-11 Data inspection method and device in solid state memory WO2017193967A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610319569.3 2016-05-12
CN201610319569.3A CN107368257B (en) 2016-05-12 2016-05-12 Data routing inspection method and device in solid-state memory

Publications (1)

Publication Number Publication Date
WO2017193967A1 true WO2017193967A1 (en) 2017-11-16

Family

ID=60266187

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/083988 WO2017193967A1 (en) 2016-05-12 2017-05-11 Data inspection method and device in solid state memory

Country Status (2)

Country Link
CN (1) CN107368257B (en)
WO (1) WO2017193967A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597469A (en) * 2019-10-23 2019-12-20 Oppo广东移动通信有限公司 Storage partition write protection method and device and computer readable storage medium
CN111078122A (en) * 2018-10-18 2020-04-28 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN111078498A (en) * 2019-12-03 2020-04-28 山东华芯半导体有限公司 Data polling method in SSD
CN111324288A (en) * 2018-12-14 2020-06-23 北京兆易创新科技股份有限公司 Memory device
CN111324284A (en) * 2018-12-14 2020-06-23 北京兆易创新科技股份有限公司 Memory device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI658462B (en) * 2018-01-19 2019-05-01 慧榮科技股份有限公司 Method for managing flash memory module and associated flash memory controller and electronic device
CN116126254B (en) * 2023-04-19 2023-07-14 苏州浪潮智能科技有限公司 Disk redundant array inspection method, device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101354681A (en) * 2008-09-23 2009-01-28 美商威睿电通公司 Memory system, abrasion equilibrium method and apparatus of non-volatile memory
CN102768645A (en) * 2012-06-14 2012-11-07 国家超级计算深圳中心(深圳云计算中心) Solid state disk (SSD) prefetching method for mixed caching and SSD
CN103049713A (en) * 2012-12-20 2013-04-17 华为技术有限公司 Method, device and system for inspecting data in storage device
US20160011971A1 (en) * 2014-07-14 2016-01-14 Jae-Il Lee Storage medium, memory system, and method of managing storage area in memory system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5826046A (en) * 1994-12-30 1998-10-20 International Business Machines Corporation Method and apparatus for polling and selecting any paired device in any drawer
CN1162782C (en) * 2001-08-03 2004-08-18 华为技术有限公司 Processing method of rapid memory file
CN101425041B (en) * 2007-10-30 2010-09-15 安凯(广州)微电子技术有限公司 Optimizing method for establishing FAT file systems on NAND FLASH memory
CN101329656B (en) * 2008-05-06 2010-06-02 无锡紫芯集成电路系统有限公司 Management method of Nand-Flash memory system
CN102097128B (en) * 2010-11-25 2014-03-19 中国人民大学 Self-adaptive buffer area replacement method based on flash memory
CN103226516A (en) * 2012-01-31 2013-07-31 上海华虹集成电路有限责任公司 Method for sequencing physical blocks of NandFlash according to number of invalid pages

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101354681A (en) * 2008-09-23 2009-01-28 美商威睿电通公司 Memory system, abrasion equilibrium method and apparatus of non-volatile memory
CN102768645A (en) * 2012-06-14 2012-11-07 国家超级计算深圳中心(深圳云计算中心) Solid state disk (SSD) prefetching method for mixed caching and SSD
CN103049713A (en) * 2012-12-20 2013-04-17 华为技术有限公司 Method, device and system for inspecting data in storage device
US20160011971A1 (en) * 2014-07-14 2016-01-14 Jae-Il Lee Storage medium, memory system, and method of managing storage area in memory system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078122A (en) * 2018-10-18 2020-04-28 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN111078122B (en) * 2018-10-18 2024-01-12 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN111324288A (en) * 2018-12-14 2020-06-23 北京兆易创新科技股份有限公司 Memory device
CN111324284A (en) * 2018-12-14 2020-06-23 北京兆易创新科技股份有限公司 Memory device
CN111324288B (en) * 2018-12-14 2024-02-23 兆易创新科技集团股份有限公司 Memory device
CN111324284B (en) * 2018-12-14 2024-02-23 兆易创新科技集团股份有限公司 Memory device
CN110597469A (en) * 2019-10-23 2019-12-20 Oppo广东移动通信有限公司 Storage partition write protection method and device and computer readable storage medium
CN111078498A (en) * 2019-12-03 2020-04-28 山东华芯半导体有限公司 Data polling method in SSD

Also Published As

Publication number Publication date
CN107368257A (en) 2017-11-21
CN107368257B (en) 2019-11-12

Similar Documents

Publication Publication Date Title
WO2017193967A1 (en) Data inspection method and device in solid state memory
US7941692B2 (en) NAND power fail recovery
US9411522B2 (en) High speed input/output performance in solid state devices
US10649661B2 (en) Dynamically resizing logical storage blocks
KR101176702B1 (en) Nand error management
KR102229648B1 (en) Apparatus and method of wear leveling for storage class memory
US9026734B2 (en) Memory system and data deleting method
US9507719B2 (en) Garbage collection in hybrid memory system
US20080177937A1 (en) Storage apparatus, computer system, and method for managing storage apparatus
KR102087495B1 (en) Changing storage parameters
US20140129758A1 (en) Wear leveling in flash memory devices with trim commands
US9666244B2 (en) Dividing a storage procedure
US10360155B1 (en) Multi-tier memory management
US10168940B2 (en) Data storage using SLC and TLC memory banks and data maintenance method thereof
CN110955384A (en) Data storage device and non-volatile memory control method
US10754785B2 (en) Checkpointing for DRAM-less SSD
TWI718710B (en) Data storage device and non-volatile memory control method
WO2017176860A1 (en) 3d stackable hybrid phase change memory with improved endurance and non-volatility
JP2011227802A (en) Data recording device
US20240070061A1 (en) Logical to physical (l2p) address mapping with fast l2p table load times
US11995328B2 (en) Single-level cell block storing data for migration to multiple multi-level cell blocks
US20230236964A1 (en) Storage controller deallocating memory block, method of operating the same, and method of operating storage device including the same
TWI724550B (en) Data storage device and non-volatile memory control method
KR20130086692A (en) Data process method for reading/writing data in non-volatile memory cache having ring structure
US20240061577A1 (en) Recycle optimization in storage engine

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17795585

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17795585

Country of ref document: EP

Kind code of ref document: A1