WO2018086075A1 - 一种存储系统和系统垃圾回收方法 - Google Patents

一种存储系统和系统垃圾回收方法 Download PDF

Info

Publication number
WO2018086075A1
WO2018086075A1 PCT/CN2016/105512 CN2016105512W WO2018086075A1 WO 2018086075 A1 WO2018086075 A1 WO 2018086075A1 CN 2016105512 W CN2016105512 W CN 2016105512W WO 2018086075 A1 WO2018086075 A1 WO 2018086075A1
Authority
WO
WIPO (PCT)
Prior art keywords
controller
segment
segments
data
managed
Prior art date
Application number
PCT/CN2016/105512
Other languages
English (en)
French (fr)
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 华为技术有限公司
Priority to CA2978845A priority Critical patent/CA2978845C/en
Priority to SG11201707296QA priority patent/SG11201707296QA/en
Priority to AU2016397188A priority patent/AU2016397188B2/en
Priority to PCT/CN2016/105512 priority patent/WO2018086075A1/zh
Priority to BR112017019425-2A priority patent/BR112017019425B1/pt
Priority to EP16898146.2A priority patent/EP3346387B1/en
Priority to CN201680003336.0A priority patent/CN108475230B/zh
Priority to JP2017553091A priority patent/JP6455900B2/ja
Publication of WO2018086075A1 publication Critical patent/WO2018086075A1/zh
Priority to US16/059,938 priority patent/US10621085B2/en
Priority to US16/792,431 priority patent/US20200183831A1/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/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • 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/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication 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]
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C16/00Erasable programmable read-only memories
    • G11C16/02Erasable programmable read-only memories electrically programmable
    • G11C16/06Auxiliary circuits, e.g. for writing into memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7201Logical to physical mapping or translation of blocks or pages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7202Allocation control and policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7205Cleaning, compaction, garbage collection, erase control

Definitions

  • the present application relates to the field of storage technologies, and in particular, to a storage system and a system garbage collection method.
  • a flash array is a storage system that contains a solid state drive and at least two controllers.
  • the controller manages the storage space of the solid state hard disk in the form of segments (English: segment).
  • a segment is an area of a contiguous logical address assigned by a controller. Segments are also the basic unit of system garbage collection.
  • Each controller can write the received data to its managed segment.
  • the data received by the SSD from each controller is continuously written into the block of the SSD (English: block) in the order in which it was received. Therefore, data sent by each controller may be written to the same block within a period of time. Therefore, the data stored in each block may correspond to segments managed by different controllers.
  • the block is not erased for a block of a solid state drive because it still contains data for other segments that are not garbage collected by the system. Therefore, when the SSD performs its own garbage collection, it still needs to write the data of other segments in this block that have not been garbage collected by the system into the blank block. The number of write amplifications that occur inside the solid state drive is high.
  • the present application proposes a storage system and system garbage collection method, which can reduce the number of write amplifications inside the solid state hard disk.
  • a first aspect of the present application provides a storage system.
  • the storage system includes a first controller, a second controller, and a solid state drive.
  • the solid state drive is connected to the first controller, and the solid state drive is connected to the second controller.
  • the first controller or the second controller manages the storage space of the solid state hard disk in units of segments.
  • the first controller is configured to perform system garbage collection on the plurality of segments in the segment managed by the first controller.
  • the second controller pairs Multiple segments in the segment managed by the controller perform system garbage collection.
  • the plurality of segments in the segment managed by the first controller are allocated by the first controller in a time period, and the plurality of segments in the segment managed by the second controller are also in the second segment in the time segment Assigned by the controller.
  • the first controller performs system garbage collection on a plurality of segments in the segment managed by the first controller
  • the second controller also performs system garbage collection on multiple segments in the segment managed by the second controller
  • the segment in which the controller performs system garbage collection and the segment in which the second controller performs system garbage collection are allocated in the same period of time. Since the segment is a unit in which the first controller or the second controller manages the storage space of the solid state hard disk, writing data to the segment is a storage space for writing data to the solid state hard disk.
  • the segments in which the first controller and the second controller perform system garbage collection are allocated in the same period of time, so the data of the segments is written to the solid state hard disk at similar times.
  • the solid state hard disk continuously writes one or more blocks in the time sequence of receiving data when writing data
  • the blocks corresponding to the segments are executed after the allocated segments in the same time period are garbage collected by the system.
  • the valid data in the block has been copied to other blocks, and the data in the block corresponding to these segments becomes invalid data.
  • the block corresponding to the segment of the system garbage collection does not need to copy the valid data again, thereby reducing the number of write amplifications inside the SSD.
  • the plurality of segments in the segment managed by the first controller are all segments allocated by the first controller during the time period.
  • the plurality of segments in the segment managed by the second controller are all segments allocated by the second controller during the time period. Therefore, it can be ensured that all the segments allocated during the time period are garbage collected by the system, and then more valid data in more blocks in the solid state hard disk is copied to other blocks, which is called invalid data.
  • the segment of the time period that is allocated by the first controller or the second controller during the time period The number ends when it reaches the first preset threshold.
  • the first controller and the second controller facilitate the counting of the number of segments respectively allocated, which is convenient to operate.
  • the fourth implementation in the first aspect The time period ends when the sum of the number of segments allocated by the first controller and the second controller during the time period reaches a second predetermined threshold.
  • the first controller or the second controller needs to send a message to the other party to query the number of segments allocated by the other party, and operate More complicated.
  • the upper limit of the number of segments allocated in each time period is the same. Subsequent statistics of the amount of invalid data contained in each segment group make it more accurate to select the segment group that contains the most invalid data.
  • the plurality of segments in the segment managed by the first controller and the plurality of segments managed by the second controller Segments belong to the same segment group.
  • This segment group contains invalid data with a larger amount of data than any other segment group contains invalid data.
  • the first controller may send a message to the second controller to query the amount of data of the invalid data included in the segment managed by the second controller, and the first controller calculates the self-managed The sum of the data amount of the invalid data included in the segment and the data amount of the invalid data included in the segment managed by the second controller, thereby obtaining the segment group containing the most invalid data. This ensures that the segment group that performs system garbage collection is the segment group that contains the most invalid data, which improves the efficiency of system garbage collection.
  • the plurality of segments and the second controller in the segment managed by the first controller Multiple segments in a managed segment belong to the same segment group.
  • the plurality of segments in the segment managed by the first controller contain data amount of invalid data larger than data amount of invalid data included in the plurality of segments belonging to any other segment group in the segment managed by the first controller.
  • the first controller only needs to count the data amount of the invalid data included in the segment managed by itself, and does not need to send a message to the second controller to query the segment managed by the second controller. The amount of data contained in invalid data.
  • the first controller sends the group identity of the segment group to the second controller. Determining, by the second controller, the plurality of segments managed by the second controller according to a correspondence between the group identifier saved in advance and an identifier of each of the plurality of segments in the segment managed by the second controller Segments.
  • the group identifier of the segment group of the system garbage collection is determined by the first controller, and the group identifier is sent to the second controller, and the second controller may search for multiple groups belonging to the segment group according to the group identifier. segment.
  • the identifier of each segment managed by the first controller is allocated by the first controller, and each segment managed by the first controller The identification is assigned by the second controller.
  • the identification of each segment managed by the first controller is assigned by the first controller.
  • the identifier of each segment managed by the second controller is also assigned by the first controller.
  • the second controller sends a request for the segment identifier to the first controller to obtain the identifier.
  • the specific operation of the first controller when performing system garbage collection is: using the first controller
  • the source logical address of the valid data contained in each of the plurality of segments in the managed segment is sent to the SSD.
  • the first controller allocates a target logical address to the valid data and sends the target logical address to the solid state hard disk to instruct the SSD to copy the valid data from the source logical address to the target logical address.
  • the first controller sends a demapping command to the solid state hard disk.
  • the demapping command includes a logical address interval of each segment of the plurality of segments in the segment managed by the first controller, to instruct the SSD to delete a logical address of each segment saved by the SSD Correspondence with the actual address.
  • a second aspect of the present application provides a system garbage collection method. The method is applied to the storage system provided by the first aspect, and is performed by the first controller and the second controller of the first aspect.
  • a third aspect of the present application provides a computer program product comprising a computer readable storage medium storing program code, the program code comprising instructions executable by the first controller and the second controller of the first aspect, And at least one method for performing the second aspect described above.
  • FIG. 1 is an application scenario diagram provided by an embodiment of the present invention
  • FIG. 2 is a structural diagram of a controller according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a method for writing data according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of a method for garbage collection of a system according to an embodiment of the present invention.
  • the embodiment of the invention provides a storage system and a garbage collection method, which can reduce the number of times of write amplification inside the solid state hard disk.
  • FIG. 1 depicts a composition diagram of a storage system provided by an embodiment of the present invention.
  • the storage system illustrated in FIG. 1 includes at least two controllers (a controller 11 and a controller 22 as shown) and a plurality of solid state drives 44.
  • the controller 11 and the controller 22 are respectively connected to a host (not shown) through a storage area network (SAN). Communication between the controller 11 and the controller 22 is possible. Controller 11 and controller 22 have the same physical structure and function. Taking the controller 11 as an example, it can be a computing device such as a server, a desktop computer or the like. An operating system and an application are installed on the controller 11. The controller 11 can receive input and output (I/O) requests from the host. The controller 11 can also store the data (if any) carried in the I/O request and write the data to the SSD 44.
  • I/O input and output
  • SSD Solid State Disk
  • SSD Solid State Drive
  • FIG. 1 is merely an exemplary illustration.
  • the storage system may include multiple controllers, each of which has a physical structure and function similar to that of the controller 11, and the present embodiment does not limit the controller 11 and the controller 22. Between, and the connection between any controller and SSD 44. As long as the respective controllers, and the respective controllers and the solid state hard disks 44 can communicate with each other.
  • the controller 11 includes an interface card 110, Processor 112 and interface card 113.
  • the interface card 110 is used to communicate with the host, and the controller 11 can receive an operation instruction of the host through the interface card 110.
  • the processor 112 may be a central processing unit (CPU). In an embodiment of the present invention, the processor 112 may be configured to receive an I/O request from a host and process the I/O request. The I/O request may be a write data request or a read data request, and the processor 112 may also send the data in the write data request to the solid state hard disk 44. In addition, the processor 112 can also be used to perform system garbage collection operations.
  • the controller 11 may further include a memory 111.
  • the memory 111 is for temporarily storing data received from the host or data read from the solid state hard disk 44.
  • the controller 11 receives a plurality of write data requests sent by the host, the data in the plurality of write data requests may be temporarily stored in the memory 111.
  • the capacity of the memory 111 reaches a certain threshold, the data stored in the memory 111 and the logical address assigned to the data are transmitted to the solid state hard disk 44.
  • the solid state hard disk 44 stores the data.
  • Memory 111 includes volatile memory, non-volatile memory, or a combination thereof.
  • the volatile memory is, for example, a random access memory (RAM).
  • Non-volatile memory such as a floppy disk, a hard disk, a solid state disk (SSD), an optical disk, and the like, and various machine readable media that can store program code.
  • the memory 111 has a power-saving function, and the power-preserving function means that the data stored in the memory 111 is not lost when the system is powered off and re-powered.
  • the interface card 113 is configured to communicate with the solid state hard disk 44.
  • the controller 11 can send a write data request (including data and a logical address allocated by the controller 11 for the data) to the solid state hard disk 44 through the interface card 113.
  • controller 22 The structure of the controller 22, and the functions of the respective components are similar to those of the controller 11, and will not be described again here.
  • both the controller 11 and the controller 22 belong to the system controller, which is a separate device, unlike the control chip in the solid state hard disk.
  • the control chip of the solid state hard disk is referred to as a solid state hard disk controller.
  • the controller in this embodiment refers to a system controller.
  • the solid state hard disk 44 includes a solid state hard disk controller and a storage medium.
  • the SSD controller is configured to perform operations such as a write data request or a read data request sent by the controller 11 or the controller 22.
  • the SSD controller includes a flash translation layer (FTL).
  • the flash translation layer is used to store the correspondence between the logical address with data and the actual address. Therefore, the flash translation layer is used to translate the logical address in the write data request or read data request sent by the controller into the actual address of the data in the SSD.
  • the logical address of the data is a subset of the logical address range of a segment that is allocated by the controller.
  • the logical address of the data includes a starting logical address and a length, a starting logical address indicating the location of the segment in which the data is located, and a length representing the size of the data.
  • the actual address of the data may be the physical address of the data in the SSD, or may be an address that is virtualized on the basis of the physical address and only visible to the SSD controller. This virtualized actual address is not visible to the system controller.
  • Storage media typically includes one or more flash chips. Each flash chip includes several blocks. The flash chip is based on one page (English: page) when reading or writing, but the erase operation can only be based on one block. The erase operation means that all bits of the block are set to "1". ". Before erasing, the SSD controller needs to copy the valid data in this block to the blank page of another block.
  • the valid data in the block refers to the data that has not been modified in the block, and this part of the data may be read.
  • the invalid data in the block refers to the data that has been modified in the block, and this part of the data cannot be read.
  • Each block contains multiple pages (English: page).
  • controller 11 sends a write data request to the solid state drive controller.
  • the write data request includes a logical address of the data.
  • the SSD controller after receiving the write data request, continuously writes the data into one or more blocks in chronological order of receipt. Writing one or more blocks in succession means that the solid state hard disk searches for a blank block, and writes data to the blank block until the blank block is filled, when the size of the data exceeds the capacity of the block.
  • the SSD controller finds the next blank block and continues writing.
  • the flash translation layer establishes and maintains a correspondence between the logical address and the actual address of the page in which the data is written.
  • the read data request includes the logical address.
  • the SSD controller is based on the logical address and the location The correspondence between the logical address and the actual address reads the data and transmits the data to the controller 11.
  • the system controller divides the storage space of the solid state hard disk into several segments according to the set size, and the segment is the basic unit of system garbage collection, each segment is a collection of multiple logical addresses, and these logical addresses It is continuous.
  • the set size is 1024 KB.
  • the logical address range corresponding to one segment is 0KB-1023KB; the logical address interval corresponding to another segment is 1024KB-2047KB; the logical address interval corresponding to one segment is 2048KB-3071KB, and so on.
  • data When data is written to a segment, it can be written in units of sectors. For example, one sector includes 520 bytes. Among them, 512 bytes are data, and 8 bytes are data integrity fields (English: data integrity field, DIF) of 512 bytes of data. In other words, the data written each time must be an integer multiple of 512 bytes. If the size of the data does not satisfy an integer multiple of 512 bytes, zero complement can be added. Similarly, when reading data from a segment, it is also read in units of sectors. In addition, after the data is written to the segment, the validity of the data needs to be recorded. The validity of the data is determined by whether the data is modified. If the data is written for the first time, the data can be recorded as valid (referred to as valid data).
  • the pre-modification data is recorded as invalid (referred to as invalid data).
  • the validity of the data can be recorded using a bitmap.
  • each "bit" of the bitmap corresponds to a logical address of data of a size of 1 KB, and when "bit" is 1, it represents that the data stored in the logical address is valid, and when "bit" is 0, it represents the The data stored in the logical address is invalid.
  • System garbage collection means that the controller performs garbage collection on a segment basis.
  • the controller acquires a logical address of the valid data in the segment according to the bitmap, sends the logical address of the valid data to the solid state hard disk, and the controller allocates a new logical address to the valid data, and sends the logical address to the solid state hard disk.
  • the solid state drive reads the valid data from the old logical address and writes it into the new logical address. Then, the controller sends a demapping (English: unmap) command to the SSD.
  • the demapping command includes a logical address interval of the segment to be reclaimed, and after receiving the demapping command, the SSD deletes a correspondence between a logical address and an actual address of the logical address interval saved in the flash translation layer.
  • the SSD can also mark the block corresponding to the actual address as a block that does not contain valid data.
  • System garbage collection is different from garbage collection inside the solid state drive.
  • the garbage collection inside the SSD is done by the SSD itself and does not require the controller to cooperate.
  • the SSD controller first copies the valid data in each block to the blank block and then erases the original block.
  • the trigger condition of system garbage collection is usually that the number of free segments in the storage system is insufficient (for example, below a certain threshold), and the trigger condition of garbage collection inside the solid state hard disk is that the number of blank blocks of the solid state hard disk is insufficient. .
  • Segments usually have four states, which are free (English: free), writing (English: writing), full (English: full), and corrupt (English: bad).
  • a segment of an idle state refers to a segment without content.
  • the segment being written to is the segment that has written data but has not yet been filled.
  • a segment that is full is a segment in which all spaces have been filled.
  • the segment that is writing the state and the segment that is in the full state may become segments of the idle state after being erased.
  • a segment in a damaged state is a segment that cannot be used due to damage.
  • the method for writing data provided in this embodiment is described below with reference to FIG. 3.
  • the method can be applied to the application scenario shown in FIG. 1 and executed by the controller 11 or the controller 22 shown in FIG.
  • the method includes the following steps:
  • the controller 11 receives the data of the host and writes the data to the memory 111 of the controller 11.
  • the data of the host may be received by the processor 112 through the interface card 110 and written into the memory 111.
  • the data is carried in the write data command and sent to the controller 11.
  • the controller 11 looks for a segment in the write state. Since the capacity of the memory 111 is limited, it is necessary to write the data in the memory 111 to the solid state hard disk 44 when the data stored therein reaches the predetermined threshold.
  • the controller 11 looks for a segment in which the state is being written. For example, a logical address range is a segment of 0 KB - 1023 KB, in which a logical address of 0 KB - 100 KB has been written, and a logical address of 101 KB to 1023 KB is still not written. Then the controller 11 can assign a logical address to the data starting from 101 KB. If the size of the data is 2 KB, the controller 11 allocates a starting logical address of 101 KB for the data and a length of 2 KB.
  • step S303 is performed.
  • the controller 11 searches for an idle segment, allocates a logical address for the data from the free segment, and sends the allocated logical address to the solid state hard disk 44. For example, a segment whose logical address range is 1024KB-2047KB is an idle segment.
  • the controller 11 can assign a logical address to the data starting from 1024 KB. If the size of the data is 2 KB, the logical address assigned by the controller 11 to the data is 1024 KB - 1026 KB KB.
  • the controller 11 sends the data and the assigned logical address to the solid state hard disk 44.
  • the solid state drive 44 continuously writes the data to one or more blocks.
  • the address in which the data is stored in the block is the actual address.
  • the solid state hard disk 44 saves the correspondence between the assigned logical address and the actual address in the flash translation layer after writing the data to the block.
  • the ownership relationship between the segment and the controller is determined. For example, the controller 11 selects a segment having an idle logical address interval of 1024 KB - 2047 KB and writes data to the segment, and the segment can only receive data written by the controller 11 and cannot receive data written by the controller 22.
  • the controller 11 can also assign an identification to the free segment. The identification is used to uniquely identify the assigned segment.
  • the SSD controller does not distinguish which controller the data is from, but continuously writes the blocks in chronological order of receiving data.
  • the controller 11 transmits data of a size of 2 KB and a logical address of 1024 KB to 1026 KB to the solid state hard disk 44.
  • the SSD controller writes the data into a blank block. Assuming that the block has a capacity of 1M, the block has 1022KB of storage space to store data.
  • the controller 22 also sends a write data request to the solid state hard disk 44.
  • the write data request includes a size of 3 KB Data, the logical address of this data is 2048KB-2051KB.
  • the segment corresponding to the data is a segment having a logical address interval of 2048 KB - 3071 KB, and the segment is attributed to the controller 22 (assigned by the controller 22).
  • the SSD controller also writes the data into the above block.
  • the block still has 1019KB of storage space to store data. If there are other controllers that send write data requests to the SSD 44, the SSD controller will continue to write data from other controllers (ie, other segments) to the block. Alternatively, the SSD controller can also write the data of another segment sent by the controller 11 (if the previous segment has been filled) into the block. Therefore, the data stored in one block may belong to different segments.
  • the identifier of a segment may be a number, a letter, or other symbol used to uniquely identify the segment, or any combination of numbers, letters, or other symbols. If the controller does not assign an identifier for the segment, the controller can identify each segment with the logical address interval of the segment. In addition, the identifier may also be a serial number. After the controller 11 assigns the identifier, the correspondence between the identifier and the logical address interval of the segment is saved. The process of assigning an identifier to a segment is described in detail later.
  • the controller assigns an identifier (called a segment identifier) to the segment according to the time period.
  • each controller in the storage system (such as controller 11 and controller 22) has the function of assigning an identifier.
  • only one controller in the storage system has an assigned identifier. Function, in which case a controller that does not have an allocation function can send a request for a segment identification to a controller having the function to obtain an identification.
  • Example 1 both the controller 11 and the controller 22 have the function of assigning an identification.
  • the controller 11 allocates an idle segment, the controller 11 assigns an identification to the segment.
  • controller 22 allocates another free segment, controller 22 also assigns an identification to the other free segment.
  • the segments that are assigned the identifiers in the same time period belong to the same segment group, and the end time points of the same time segment are: the time when the total number of identifiers assigned by any one controller reaches a preset threshold.
  • the preset threshold is 100.
  • the controller 11 may send a notification message to the controller 22 to indicate that the controller 22 ends the current time period.
  • the time (the starting point of this time is that the controller 11 or the controller 22 assigns the first identifier, the end point is that the controller 11 assigns the 100th identifier) the segment to which the controller 11 assigns an identifier, and the controller 22 assigns it
  • the identified segments belong to the same group (called a segment group).
  • the controller 11 or the controller 22 assigns a group identification to the group and notifies the other party of the group identification.
  • the controller 11 maintains a correspondence between the group identification and the identification of each segment managed by the controller 11 in the group, and the controller 22 saves the group identification and the identification of each segment managed by the controller 22 in the group. Correspondence between them.
  • Example 2 only the controller 11 has the function of assigning an identification.
  • the controller 22 when the controller 22 allocates an idle segment, the controller 22 sends a request message to the controller 11 to request the controller 11 to assign an identification to the segment.
  • the end time point of the same time period is: the time when the total number of identifiers assigned by the controller that identifies the allocation function reaches a preset threshold.
  • the preset threshold is 100.
  • the segments to which the controller 11 assigns the identifier belong to the same group.
  • the segments in this group have both segments managed by the controller 11 and segments managed by the controller 22, except that the identifiers of the segments are assigned by the controller 11.
  • the controller 11 then assigns a group identification to the group and notifies the controller 22 of the group identification.
  • the controller 11 maintains a correspondence between the group identification and the identification of each segment managed by the controller 11 in the group, and the controller 22 saves the group identification and the identification of each segment managed by the controller 22 in the group. Correspondence between them.
  • group identifiers are assigned, and each controller records the correspondence between the group identifier and the identifier of the segment. If the identifier of the segment is not allocated, and each segment is identified by the logical address interval of the segment, the controller also assigns the group identifier and records the correspondence between the group identifier and the logical address interval of the segment. If the segment number is identified by a sequence number according to a specific rule, the group ID is not required. At this time, it is possible to determine which segments belong to the same group by the law of the serial number.
  • both the controller 11 and the controller 22 have a function of assigning a serial number, and the controller 11 and the controller 22 can pre-agreed the starting serial number of each group.
  • the first group has a starting sequence number of 1
  • the second group has a starting sequence number of 101
  • the third group has a starting sequence number of 201, and so on.
  • the starting sequence number assigned by the controller 11 and the starting sequence assigned by the controller 22 The number is the same.
  • Each controller starts with a starting sequence number and assigns serial numbers to the segments in turn, each serial number being equal to the value of the previous serial number plus one.
  • Example 4 only the controller 11 has the function of assigning an identification, and the identification refers to a serial number.
  • the function of the controller 11 having the assigned serial number is taken as an example.
  • the controller 11 presets the starting sequence number of each group, starting with the starting sequence number, and sequentially assigning serial numbers to its own segment and the segment of the controller 22, each serial number being equal to the value of the previous serial number plus one.
  • allocation is started from the start sequence number of the next group.
  • the controller 22 needs to assign a serial number to its own segment, the controller 22 sends a request message to the controller 11, and the controller 11 assigns a serial number according to the request message and transmits it to the controller 22.
  • the data stored in one block of the solid state hard disk belongs to different segments.
  • the data stored in one block belongs to the segment with sequence number 1, the segment with sequence number 2, and the segment with sequence number 3. If the controller garbage collects the segment with serial number 1 and the segment with serial number 2, the SSD copies the valid data corresponding to the two segments to other segments.
  • the data of the segment with sequence number 3 is still retained. Therefore, when the SSD performs its own garbage collection, it still needs to read valid data from the block and copy it to other blocks. As a result, write amplification occurs inside the solid state drive.
  • the embodiment of the present invention performs garbage collection on the segment in units of the segment groups described above when performing the system garbage collection operation. Due to the Each segment is allocated during the same time period, and the data of these segments is also written to the SSD in the same period of time. Further, since the solid state hard disk continuously writes one or more blocks in the time sequence of receiving data when writing data, the blocks corresponding to the segments are executed after the allocated segments in the same time period are garbage collected by the system. The valid data in has been copied to other blocks, and the data in the block corresponding to these segments is invalid data. When the SSD performs internal garbage collection, the block corresponding to the segment of the system garbage collection does not need to copy the valid data again, thereby reducing the number of write amplifications inside the SSD.
  • An embodiment of the present invention provides a method for system garbage collection, which is applied to the storage system shown in FIG. 1.
  • the storage system includes a plurality of segments, wherein some segments belong to the controller 11, and some segments belong to the controller 22.
  • the plurality of segments included in the storage system may be divided into a plurality of segment groups. Among them, the segments in each segment group are allocated in the same time period. Each segment group has a unique group ID.
  • the system garbage collection provided in this embodiment is performed in units of segment groups.
  • the method can include the following steps:
  • the controller 11 counts the data amount of the invalid data included in each segment group.
  • the controller 11 can trigger a system garbage collection operation. Before performing system garbage collection, the controller 11 can count the amount of data of invalid data contained in each segment group. Since each segment included in a segment group has both a segment managed by the controller 11 and a segment managed by the controller 22 (here, two controllers are taken as an example, this embodiment may also include other controllers). . One implementation is that the controller 11 only counts the data amount of the invalid data of those segments managed by itself in each group, and uses the segment group containing the most invalid data as the current group to be recycled.
  • controller 11 not only needs to count the amount of data of invalid data of those segments managed by itself in each group, but also the amount of data of invalid data of those segments managed by other controllers in each group.
  • the controller 11 may send a query instruction to another controller (for example, the controller 22), where the query instruction includes a group identifier, and the controller 22 queries the data of the invalid data of the segment included in the segment group according to the group identifier. The amount is fed back to the controller 11.
  • bitmap can be used to record whether the data is valid. Therefore, the amount of data of invalid data included in one segment can also be counted according to the bitmap.
  • the controller 11 compares the data amount of the invalid data included in each segment group, and determines the segment group including the most invalid data.
  • the controller 11 can determine, according to the amount of data counted by itself, or according to the amount of data counted by itself and the amount of data counted by the controller 22, which segment group has the largest amount of invalid data, and uses it as the current segment to be recycled. group.
  • the controller 11 performs a system garbage collection operation on the segment included in the determined segment group.
  • the controller 11 instructs the solid state hard disk 44 to perform a system garbage collection operation on the segments included in the determined segment group.
  • the "indication” herein means that the controller 11 sends a read data request, a write data request, and a demapping command to the solid state hard disk 44, so that the solid state hard disk 44 executes these requests and commands. It can be understood that the solid state hard disk 44 does not actively perform the system garbage collection operation, but only passively executes the requests and commands sent by the controller 11.
  • the controller 11 instructs the SSD 44 to perform a system garbage collection operation on the segment included in the determined segment group, and specifically includes the following steps: (1) The controller 11 sends a read data request to the SSD 44, the read data request Includes source logical address.
  • the source logical address refers to the logical address of valid data in a segment.
  • the solid state drive 44 After receiving the read data request, the solid state drive 44 reads the valid data from the actual address corresponding to the source logical address and writes it into the memory of the SSD controller.
  • the controller 11 sends a write data request to the solid state hard disk 44, the write data request including the target logical address.
  • the target logical address refers to a logical address that the controller 11 reallocates for the valid data.
  • the target logical address and the source logical address correspond to different segments, wherein the segment corresponding to the source logical address is a segment to be reclaimed, and the segment corresponding to the target logical address is an idle segment or a segment in a state of being written.
  • the solid state drive 44 After receiving the write data request, the solid state drive 44 reads the valid data from the memory of the SSD controller and writes it into the actual address corresponding to the target logical address. (3) The controller 11 sends a demapping command to the solid state hard disk 44, the demapping command including the logic of the segment to be recovered In the address range, after receiving the demapping command, the SSD 44 deletes the correspondence between each logical address and the actual address in the logical address interval in the flash translation layer.
  • the controller 11 sends the group identifier of the segment group to the controller 22, and the controller 22 performs a system garbage collection operation on the segment included in the segment group.
  • the controller 22 determines the segment to be recovered according to the group identifier and the correspondence between the group identifier and the identifier of the segment, and performs a system garbage collection operation on the segment to be recovered, and the specific process is similar to 403. I won't go into details here.
  • the segment in which the controller 11 performs system garbage collection in step 403 and the segment in which the controller 22 performs system garbage collection in step 404 are allocated in the same time period.
  • the same period of time ends when the number of segments allocated by the first controller or the second controller within the time period reaches a first predetermined threshold.
  • the same period of time may also end when the sum of the number of segments allocated by the first controller and the second controller during the time period reaches a second preset threshold.
  • the second preset threshold may be the same as or different from the first preset threshold.
  • the first controller or the second controller needs to send a message to the other party to query the number of segments allocated by the other party, thereby obtaining the sum of the number of segments allocated during this time.
  • the same time period described herein may also reach a second predetermined threshold for the number of identifications assigned by the controller having the function of assigning the identification. The time is over.
  • another implementation of the embodiment is to specify a controller in the storage system, specifically for counting data of invalid data contained in each segment group.
  • the specified controller sends a query instruction to the controller 11 and the controller 22, respectively, to acquire the data amount of the invalid data contained in the segment managed by the controller 11 in each segment group, and in each segment group.
  • the data managed by the segment managed by the controller 22 contains invalid data.
  • the segment group containing the most invalid data is determined, and the group identification of the segment group is sent to the controller 11 and the controller 22, respectively.
  • the controller 11 and the controller 22 respectively determine the group identifier Determining a segment to be recovered, and performing a system garbage collection operation on the segment to be recovered.
  • the embodiment may not compare the data amount of the invalid data included in each segment group, but monitor the data amount of the invalid data included in each segment group, and the data of the invalid data included in a segment group.
  • the garbage collection operation is performed on the segment group in which the data amount of the invalid data reaches the preset threshold.
  • the controller may perform a system garbage collection operation on each segment group in turn, regardless of the size of the invalid data in the segment group.
  • the controller may select the segment group that has not performed system garbage collection for the longest time as the object of the current system garbage collection operation according to the time when the system garbage collection operation is performed last time for each segment group.
  • the controller 22 performs a system garbage collection operation on the segment allocated by the controller 22 in the determined segment group when the controller 11 performs system garbage collection.
  • the controller 11 and the controller 22 do not perform absolutely at the same time when performing the system garbage collection operation.
  • the controller 11 and the controller 22 complete the system garbage collection of the determined segment group as long as the system garbage collection of the next segment group is started.
  • the controller 11 and the controller 22 perform system garbage collection operations in units of segment groups. After all the segments included in a segment group complete the system garbage collection operation, the system garbage collection operation of the next segment group is started.
  • the completion of the system garbage collection operation for all the segments included in the segment group herein means that the controller 11 completes the system garbage collection operation of the segment in the segment group it manages, and the controller 22 also completes the segment group managed by it.
  • System garbage collection operation in the segment Illustratively, when the controller 11 and the controller 22 complete the system garbage collection of the segment group containing the most invalid data, the next segment group containing the most invalid data is searched for and the system garbage collection is started.
  • aspects of the present invention, or possible implementations of various aspects may be embodied as a system, method, or computer program product.
  • aspects of the invention, or possible implementations of various aspects may employ an entirely hardware embodiment, full software Embodiments (including firmware, resident software, etc.), or a combination of software and hardware aspects, are collectively referred to herein as "circuits," “modules,” or “systems.”
  • aspects of the invention, or possible implementations of various aspects may take the form of a computer program product, which is a computer readable program code stored in a computer readable medium.
  • Computer readable media include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing, such as random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM), optical disc.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable Programmable read only memory
  • the processor in the computer reads the computer readable program code stored in the computer readable medium such that the processor can perform the functional actions specified in each step or combination of steps in the flowchart.
  • the computer readable program code can execute entirely on the user's computer, partly on the user's computer, as a separate software package, partly on the user's computer and partly on the remote computer, or entirely on the remote computer or server.
  • the functions noted in the various steps in the flowcharts or in the blocks in the block diagrams may not occur in the order noted. For example, two steps, or two blocks, shown in succession may be executed substantially concurrently or the blocks may be executed in the reverse order.

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)
  • Memory System (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Retry When Errors Occur (AREA)

Abstract

一种存储系统及系统垃圾回收方法。存储系统包括第一控制器、第二控制器和固态硬盘。第一控制器或第二控制器以段为单位管理所述固态硬盘的存储空间。第一控制器用于对所述第一控制器管理的段中的多个段进行系统垃圾回收,所述第二控制器,用于当所述第一控制器进行系统垃圾回收时,对所述第二控制器管理的段中的多个段进行系统垃圾回收。第一控制器管理的段中的多个段与第二控制器管理的段中的多个段是在相同的时间段内分配的。因此,可以减少固态硬盘内部出现的写放大的次数。

Description

一种存储系统和系统垃圾回收方法 技术领域
本申请涉及存储技术领域,特别是一种存储系统和系统垃圾回收方法。
背景技术
闪存阵列是指包含固态硬盘和至少两个控制器的存储系统。其中,控制器以段(英文:segment)的形式管理固态硬盘的存储空间。段是由控制器分配的一段连续的逻辑地址的区域。段也是系统垃圾回收的基本单位。每个控制器都可以将接收的数据写入其管理的段中。固态硬盘从各个控制器接收的数据按照接收的时间顺序连续写入固态硬盘的块(英文:block)中。因此,在一个时间段内,各个控制器发送的数据可能被写入同一个块中。因此,每个块中存储的数据可能对应不同控制器管理的段。
闪存阵列进行系统垃圾回收并释放一些段后,对于一个固态硬盘的一个块来说,这个块并没有被擦除干净,因为它仍然包含其他未进行系统垃圾回收的段的数据。所以,当固态硬盘进行自己的垃圾回收时,仍然需要将这个块中其他未进行系统垃圾回收的段的数据写入空白的块中。导致固态硬盘内部出现的写放大的次数多。
发明内容
本申请提出了一种存储系统和系统垃圾回收方法,可以减少固态硬盘内部的写放大的次数。
本申请第一方面提供了一种存储系统。该存储系统包括第一控制器、第二控制器和固态硬盘。所述固态硬盘与所述第一控制器连接,并且所述固态硬盘与所述第二控制器连接。第一控制器或第二控制器以段为单位管理所述固态硬盘的存储空间。第一控制器用于对所述第一控制器管理的段中的多个段进行系统垃圾回收。当第一控制器进行系统垃圾回收时,第二控制器对第 二控制器管理的段中的多个段进行系统垃圾回收。其中,第一控制器管理的段中的多个段是在一个时间段内由第一控制器分配的,第二控制器管理的段中的多个段也是在所述时间段内由第二控制器分配的。
在本申请提供的存储系统中,第一控制器对其管理的段中的多个段进行系统垃圾回收,第二控制器也对其管理的段中的多个段进行系统垃圾回收,并且第一控制器进行系统垃圾回收的段与第二控制器进行系统垃圾回收的段是在相同的时间段内分配的。由于段是第一控制器或第二控制器管理固态硬盘的存储空间的单位,因此将数据写入段就是将数据写入固态硬盘的存储空间。第一控制器和第二控制器进行系统垃圾回收的段是在相同的时间段内分配的,因此这些段的数据写入固态硬盘的时间相近。进一步地,由于固态硬盘在写入数据时是按照接收数据的时间顺序连续写入一个或多个块,因此,相同的时间段内分配的段被执行系统垃圾回收之后,这些段所对应的块中的有效数据已经被全部复制到其他块中,这些段所对应的块中的数据就都变成无效数据了。当固态硬盘进行内部的垃圾回收时,被执行系统垃圾回收的段所对应的块无需再次进行有效数据的复制,从而减少了固态硬盘内部的写放大的次数。
结合第一方面,在第一方面的第一种实现中,第一控制器管理的段中的多个段是所述时间段内由第一控制器分配的所有的段。并且,第二控制器管理的段中的多个段是所述时间段内由第二控制器分配的所有的段。由此,可以保证在所述时间段内分配的所有的段都被系统垃圾回收了,那么固态硬盘中也有更多的块中的有效数据被全部复制到其他块,从而称为无效数据。
结合第一方面或者第一方面的第二种实现,在第一方面的第三种实现中,所述时间段在所述第一控制器或者第二控制器在所述时间段内分配的段的数量达到第一预设阈值时结束。按照这种实现方式,第一控制器和第二控制器便于统计各自分配的段的数量,操作方便。
结合第一方面或者第一方面的第二种实现,在第一方面的第四种实现 中,所述时间段在第一控制器以及第二控制器在所述时间段内分配的段的数量的总和达到第二预设阈值时结束。与第一方面的第三种实现方式相比,在第一方面的第四种实现方式中,第一控制器或者第二控制器需要给对方发送消息以查询对方分配的段的数量,操作起来较为复杂。然而,按照这种实现方式,在各个时间段内分配的段的数量上限相同。后续统计每个段组所包含的无效数据的数据量,从而选择出包含无效数据最多的段组时会更加准确。
结合第一方面或者第一方面的以上任意一种实现,在第一方面的第五种实现中,第一控制器管理的段中的多个段与第二控制器管理的段中的多个段属于同一个段组。这个段组包含的无效数据的数据量大于其他任意一个段组包含的无效数据的数据量。在第一方面的第五种实现中,第一控制器可以向第二控制器发送消息以查询第二控制器管理的段所包含的无效数据的数据量,第一控制器通过计算自己管理的段所包含的无效数据的数据量与第二控制器管理的段所包含的无效数据的数据量的和,从而得到包含无效数据最多的段组。这就保证了进行系统垃圾回收的段组是包含无效数据最多的段组,提高了系统垃圾回收的效率。
结合第一方面或者第一方面的第一种实现至第四种实现的任意一个,在第一方面的第六种实现中,第一控制器管理的段中的多个段与第二控制器管理的段中的多个段属于同一个段组。第一控制器管理的段中的多个段包含的无效数据的数据量大于第一控制器管理的段中的属于其他任意一个段组的多个段包含的无效数据的数据量。与第一方面的第五种实现相比,第一控制器只需统计自己管理的段所包含的无效数据的数据量,不需要向第二控制器发送消息以查询第二控制器管理的段所包含的无效数据的数据量。
结合第一方面的第五种实现或者第一方面的第六种实现,在第一方面的第七种实现中,第一控制器将所述段组的组标识发送给第二控制器。第二控制器根据预先保存的所述组标识与第二控制器管理的段中的多个段中每个段的标识之间的对应关系,确定第二控制器管理的段中的所述多个段。在第 七种实现中,由第一控制器确定系统垃圾回收的段组的组标识,将这个组标识发送给第二控制器,第二控制器可以根据所述组标识查找属于这个段组的多个段。
结合第一方面的第七种实现,在第一方面的第八种实现中,第一控制器管理的每个段的标识是第一控制器分配的,第一控制器管理的每个段的标识是第二控制器分配的。
结合第一方面的第七种实现,在第一方面的第九种实现中,第一控制器管理的每个段的标识是第一控制器分配的。第二控制器管理的每个段的标识也是第一控制器分配的,例如,第二控制器向第一控制器发送申请段标识的请求,以获得标识。
结合第一方面或者第一方面的以上任意一种实现,在第一方面的第十种实现中,所述第一控制器在执行系统垃圾回收时的具体操作是:将所述第一控制器管理的段中的多个段的每个段包含的有效数据的源逻辑地址发送给所述固态硬盘。第一控制器为所述有效数据分配目标逻辑地址并将所述目标逻辑地址发送给所述固态硬盘,以指示所述固态硬盘将所述有效数据从所述源逻辑地址复制到所述目标逻辑地址。然后,第一控制器向所述固态硬盘发送去映射命令。所述去映射命令包括所述第一控制器管理的段中的多个段的每个段的逻辑地址区间,以指示所述固态硬盘删除所述固态硬盘保存的所述每个段的逻辑地址与实际地址之间的对应关系。
本申请第二方面提供了一种系统垃圾回收方法。该方法应用于第一方面提供的存储系统中,由第一方面的第一控制器和第二控制器执行。
本申请第三方面提供了一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可以由上述第一方面的第一控制器和第二控制器执行,并用于执行上述第二方面的至少一种方法。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要 使用的附图作简单地介绍。
图1是本发明实施例提供的应用场景图;
图2是本发明实施例提供的控制器的结构图;
图3是本发明实施例提供的写数据的方法流程图;
图4是本发明实施例提供的系统垃圾回收的方法流程图。
具体实施方式
本发明实施例提出了一种存储系统和垃圾回收方法,可以减少固态硬盘内部的写放大的次数。
图1描绘了本发明实施例提供的存储系统的组成图,图1所示的存储系统包括至少两个控制器(如图所示的控制器11以及控制器22)和多个固态硬盘44。
控制器11和控制器22分别通过存储区域网络(英文:storage area network,SAN)与主机(图中未示出)连接。控制器11与控制器22之间可以通信。控制器11和控制器22具有相同的物理结构和功能。以控制器11为例,它可以是一种计算设备,如服务器、台式计算机等等。在控制器11上安装有操作系统以及应用程序。控制器11可以接收来自主机的输入输出(I/O)请求。控制器11还可以存储I/O请求中携带的数据(如果有的话),并且将该数据写入固态硬盘44中。
固态硬盘(英文:Solid State Disk,SSD)是以闪存(英文:flash memory)芯片为存储介质的存储器,又名固态驱动器(Solid State Drive,SSD)。
图1仅是示例性说明,在实际应用中存储系统可包含多个控制器,每个控制器的物理结构和功能与控制器11类似,并且本实施例并不限定控制器11与控制器22之间,以及任意一个控制器与固态硬盘44之间的连接方式。只要各个控制器之间,以及各个控制器和固态硬盘44之间能够相互通信。
图2是控制器11的结构示例图,如图2所示,控制器11包括接口卡110、 处理器112和接口卡113。
接口卡110用于和主机通信,控制器11可以通过接口卡110接收主机的操作指令。处理器112可能是一个中央处理器(英文:central processing unit,CPU)。在本发明实施例中,处理器112可以用于接收来自主机的I/O请求、处理所述I/O请求。所述I/O请求可以是写数据请求或者读数据请求,处理器112还可以将写数据请求中的数据发送给固态硬盘44。此外,处理器112还可以用于执行系统垃圾回收操作。
可选地,控制器11还可以包括存储器111。存储器111用于临时存储从主机接收的数据或从固态硬盘44读取的数据。控制器11接收主机发送的多个写数据请求时,可以将所述多个写数据请求中的数据暂时保存在存储器111中。当存储器111的容量达到一定阈值时,将存储器111存储的数据以及为所述数据分配的逻辑地址发送给固态硬盘44。固态硬盘44存储所述数据。存储器111包括易失性存储器,非易失性存储器或其组合。易失性存储器例如为随机访问存储器(英文:random-access memory,RAM)。非易失性存储器例如软盘、硬盘、固态硬盘(solid state disk,SSD)、光盘等各种可以存储程序代码的机器可读介质。存储器111具有保电功能,保电功能是指系统发生掉电又重新上电时,存储器111中存储的数据也不会丢失。
接口卡113,用于和固态硬盘44通信,控制器11可以通过接口卡113将写数据请求(包括数据以及控制器11为所述数据分配的逻辑地址)发送给固态硬盘44存储。
控制器22的结构,以及各个部件的功能与控制器11类似,这里不再赘述。另外,控制器11和控制器22都属于系统控制器,系统控制器是独立的设备,不同于固态硬盘中的控制芯片。本实施例将固态硬盘的控制芯片称为固态硬盘控制器。如无特别指明,本实施例中的控制器都是指系统控制器。
固态硬盘44包括固态硬盘控制器和存储介质。其中,固态硬盘控制器用于执行控制器11或控制器22发送的写数据请求或者读数据请求等操作。
固态硬盘控制器中包含闪存翻译层(英文:flash translation layer,FTL)。闪存翻译层用于保存有数据的逻辑地址与实际地址之间的对应关系。因此,闪存翻译层用于将控制器发送的写数据请求或者读数据请求中的逻辑地址转化为固态硬盘中数据的实际地址。数据的逻辑地址是由控制器分配的,一个段的逻辑地址区间的子集。数据的逻辑地址包括起始逻辑地址和长度,起始逻辑地址指示所述数据位于的所述段的位置,长度代表所述数据的大小。数据的实际地址可以是固态硬盘中该数据的物理地址,也可以是在所述物理地址的基础上经过虚拟化,只对固态硬盘控制器可见的地址。该经过虚拟化的实际地址对系统控制器不可见。
存储介质通常包括一个或多个闪存芯片。每个闪存芯片包括若干个块。闪存芯片在读取或写入时是以一个页(英文:page)为基础的,但擦除操作只能以一个块为基础,擦除操作是指将这个块的所有位都设置为“1”。在擦除之前,固态硬盘控制器需要先将这个块中的有效数据复制到另一个块的空白页中去。块中的有效数据是指该块中保存的没有被修改过的数据,这部分数据可能会被读取。块中的无效数据是指该块中保存的已经被修改过的数据,这部分数据不可能会被读取。
每个块包含多个页(英文:page)。固态硬盘在执行写数据请求时,是以页为单位来写数据的。举例来说,控制器11向固态硬盘控制器发送一个写数据请求。所述写数据请求包括数据的逻辑地址。固态硬盘控制器在接收所述写数据请求之后,按照接收的时间顺序将所述数据连续写入一个或多个块中。连续写入一个或多个块是指,固态硬盘查找一个空白的块,将数据写入所述空白的块,直至将所述空白的块填满,当所述数据的大小超过块的容量时,固态硬盘控制器再查找下一个空白的块,继续写入。闪存翻译层建立并保存所述逻辑地址与写入所述数据的页的实际地址之间的对应关系。当控制器11向固态硬盘控制器发送读数据请求,要求读取所述数据时,所述读数据请求中包括所述逻辑地址。固态硬盘控制器根据所述逻辑地址、以及所 述逻辑地址与实际地址之间的对应关系读取所述数据,并将该数据发送给控制器11。
固态硬盘中的块、页以及实际地址对控制器来说是不可见的,因此控制器不能直接访问固态硬盘中的块和页。为了进行系统垃圾回收,系统控制器将固态硬盘的存储空间按照设定大小划分为若干个段,段是系统垃圾回收的基本单位,每个段均是多个逻辑地址的集合,并且这些逻辑地址是连续的。例如,所述设定大小是1024KB。一个段对应的逻辑地址区间是0KB-1023KB;另一个段对应的逻辑地址区间是1024KB-2047KB;再一个段对应的逻辑地址区间是2048KB-3071KB,依此类推。
在将数据写入段时,可以以扇区为单位写入。例如,一个扇区包括520个字节。其中512个字节是数据,8个字节是512字节的数据的数据完整性字段(英文:data integrity field,DIF)。也就是说,每次写入的数据须是512个字节的整数倍。如果所述数据的大小不满足512个字节的整数倍,可以添零补足。同样的,从段中读取数据时,也是以扇区为单位读取。另外,当数据写入段之后,需要记录该数据的有效性。数据的有效性是以所述数据是否被修改来确定的。如果所述数据是第一次写入,可以将所述数据记录为有效(称为有效数据)。如果所述数据被修改,则将所述修改前的数据记录为无效(称为无效数据)。具体的,可以用位图记录数据的有效性。例如,位图的每个“位”对应大小为1KB的数据的逻辑地址,当“位”为1时,代表所述逻辑地址中存储的数据有效,当“位”为0时,代表所述逻辑地址中存储的数据无效。
系统垃圾回收是指控制器以段为单位执行垃圾回收。控制器根据位图获取一个段中有效数据的逻辑地址,将所述有效数据的逻辑地址发送给固态硬盘,并且所述控制器为所述有效数据分配新的逻辑地址,发送给所述固态硬盘。所述固态硬盘从旧的逻辑地址中读取所述有效数据,写入所述新的逻辑地址中。然后,控制器再给固态硬盘发送去映射(英文:unmap)命令,所 述去映射命令包括所述待回收的段的逻辑地址区间,固态硬盘接收所述去映射命令之后,删除闪存翻译层中保存的所述逻辑地址区间的逻辑地址与实际地址之间的对应关系。固态硬盘还可以将所述实际地址对应的块标记为不包含有效数据的块。
系统垃圾回收有别于固态硬盘内部的垃圾回收。固态硬盘内部的垃圾回收是由固态硬盘自己完成的,不需要控制器配合。固态硬盘控制器先将各个块中的有效数据复制到空白的块,再擦除原来的块。另外,系统垃圾回收的触发条件通常是存储系统中空闲的段的数量不足(例如,低于某个阈值),而固态硬盘内部的垃圾回收的触发条件是该固态硬盘的空白的块的数量不足。
段通常具有四种状态,分别是空闲(英文:free)、正在写入(英文:writing)、写满(英文:full)和损坏(英文:bad)。空闲状态的段是指无内容的段。正在写入状态的段是指已写入数据但还没有被写满的段。写满状态的段是指全部空间均已被写满的段。正在写入状态的段和写满状态的段经过擦除之后可以成为空闲状态的段。损坏状态的段是指发生损坏不能使用的段。
下面结合图3介绍本实施例提供的写数据的方法,该方法可以应用于图1所示的应用场景中,由图1所示的控制器11或者控制器22执行。示例性的,该方法包括以下步骤:
S301,控制器11接收主机的数据,将数据写入控制器11的存储器111。
具体的,可以由处理器112通过接口卡110接收主机的数据,将其写入存储器111中。通常情况下,所述数据是携带在写数据指令中发送给控制器11的。
S302,当存储器111中的数据的大小达到预先设定的阈值时,控制器11查找正在写入状态的段。由于存储器111的容量有限,当其中存储的数据达到所述预先设定的阈值时就需要将存储器111中的数据写入固态硬盘44。
具体的,控制器11查找是否存在正在写入状态的段。例如,逻辑地址区间为0KB-1023KB的段,其中0KB-100KB的逻辑地址已写入数据,而101KB至1023KB的逻辑地址仍然没有被写入数据。那么控制器11就可以从101KB开始为所述数据分配逻辑地址。如果所述数据的大小为2KB,那么控制器11为所述数据分配的起始逻辑地址为101KB,长度为2KB。
若当前不存在已经写入数据但未被写满的段,则执行步骤S303。
S303,控制器11查找空闲的段,从所述空闲的段中为所述数据分配逻辑地址,将所述分配的逻辑地址发送给固态硬盘44。例如,逻辑地址区间为1024KB-2047KB的段是空闲的段。控制器11可以从1024KB开始为所述数据分配逻辑地址。如果所述数据的大小为2KB,那么控制器11为所述数据分配的逻辑地址为1024KB-1026KB KB。
S304,控制器11将所述数据以及分配的逻辑地址发送给固态硬盘44。
S305,固态硬盘44将所述数据连续写入一个或多个块。所述数据保存在块中的地址为实际地址。固态硬盘44在将所述数据写入所述块之后,将所述分配的逻辑地址与所述实际地址之间的对应关系保存在闪存翻译层中。
当一个段被控制器分配之后,这个段与这个控制器之间的归属关系也就确定了。例如控制器11选择空闲的逻辑地址区间为1024KB-2047KB的段,并向该段写入数据,那么该段就只能接收控制器11写入的数据,不能接收控制器22写入的数据。另外,当一个空闲的段被控制器11分配出来时,控制器11还可以为所述空闲的段分配标识。所述标识用以唯一识别所述分配的段。然而,固态硬盘控制器在将数据写入块时,不会区分所述数据是来自哪个控制器,只是按照接收数据的时间顺序连续写入所述块中。例如,控制器11将大小为2KB,逻辑地址为1024KB-1026KB的数据发送给固态硬盘44。固态硬盘控制器将该数据写入一个空白的块中,假设块的容量为1M,那么这个块还有1022KB的存储空间可以存储数据。此时,如果控制器22也向固态硬盘44发送一个写数据请求。所述写数据请求包括大小为3KB的 数据,该数据的逻辑地址为2048KB-2051KB。该数据对应的段是逻辑地址区间为2048KB-3071KB的段,并且该段是归属于控制器22的(控制器22分配的)。那么,固态硬盘控制器也将所述数据写入上述块中。此时,该块仍有1019KB的存储空间可以存储数据。如果还有其他控制器向固态硬盘44发送写数据请求,固态硬盘控制器会继续将其他控制器(也就是其他段)的数据写入所述块。或者,固态硬盘控制器也可以将控制器11发送的另一个段的数据(如果上一个段已被写满)写入所述块中。因此,一个块中存储的数据可能属于不同的段。
段的标识可以是数字、字母或者其他用于唯一标识所述段的符号,也可以是数字、字母或者其他符号之间的任意组合。如果控制器不分配段的标识,控制器可以用段的逻辑地址区间识别各个段。另外,所述标识也可以是序列号。在控制器11分配了标识之后,保存所述标识与所述段的逻辑地址区间之间的对应关系。后续将详细介绍为段分配标识的过程。
下面介绍控制器为段分配标识的过程。
控制器按照时间段为段分配标识(称为段标识)。在某些应用场景中,存储系统中的每个控制器(例如控制器11和控制器22)都具有分配标识的功能,在另外一些应用场景中,存储系统中只有一个控制器具有分配标识的功能,在这种情况下不具有分配功能的控制器可以给具有该功能的控制器发送申请段标识的请求,以获得标识。
示例一,控制器11和控制器22都具有分配标识的功能。当控制器11分配一个空闲的段时,控制器11为该段分配标识。同样的,当控制器22分配另一个空闲的段时,控制器22也为所述另一个空闲的段分配标识。在相同时间段内分配标识的段都属于同一个段组,所述相同时间段的结束时间点为:任意一个控制器分配的标识的总数达到预设阈值的时刻。例如,所述预设阈值为100,当控制器11分配的标识的总数达到100时,控制器11可以向控制器22发送通知消息,以指示控制器22当前时间段结束。那么在这段 时间内(这段时间的起点是控制器11或控制器22分配第一个标识,终点是控制器11分配第100个标识)控制器11为其分配标识的段,以及控制器22为其分配标识的段属于同一个组(称为段组)。控制器11或控制器22为该组分配组标识,并将所述组标识通知对方。控制器11保存所述组标识与该组中由控制器11管理的各个段的标识之间的对应关系,控制器22保存所述组标识与该组中由控制器22管理的各个段的标识之间的对应关系。
示例二,只有控制器11具有分配标识的功能。在这种情况下,当控制器22分配一个空闲的段时,控制器22会向控制器11发送请求消息,以请求控制器11为该段分配标识。此时,所述相同时间段的结束时间点为:具有标识分配功能的控制器分配的标识的总数达到预设阈值的时刻。例如,所述预设阈值为100,在控制器11分配第1个标识至控制器11分配第100个标识的时间段内,控制器11为其分配标识的段属于同一个组。这个组中的段既有控制器11管理的段,也有控制器22管理的段,只是这些段的标识都是控制器11分配的。控制器11再为这个组分配组标识,并将所述组标识通知控制器22。控制器11保存所述组标识与该组中由控制器11管理的各个段的标识之间的对应关系,控制器22保存所述组标识与该组中由控制器22管理的各个段的标识之间的对应关系。
在示例一和示例二中,都分配组标识,各个控制器记录组标识和段的标识之间的对应关系。如果不分配段的标识,并用段的逻辑地址区间识别各个段,控制器也分配组标识,并记录组标识和段的逻辑地址区间之间的对应关系。如果用序列号根据特定的规律标识段,组标识不是必需的。此时,可以以序列号的规律来判定哪些段属于同一个组。
例如,在示例三中,控制器11和控制器22都具有分配序列号的功能,并且控制器11和控制器22可以预先约定每个组的起始序列号。例如,第一组的起始序列号为1,第二个组的起始序列号为101,第三个组的起始序列号为201,等等。控制器11分配的起始序列号与控制器22分配的起始序列 号相同。每个控制器分别从起始序列号开始,依次为段分配序列号,每个序列号等于上一个序列号的数值加1。对于每个组,当任意一个控制器分配的序列号的总数达到预设阈值时,所有控制器都从下一个组的起始序列号开始分配。除了段的标识为序列号之外,示例三的其余内容与示例一类似,这里不再赘述。
示例四,只有控制器11具有分配标识的功能,并且所述标识是指序列号。以控制器11具有分配序列号的功能为例。控制器11预先设置每个组的起始序列号,从起始序列号开始,依次为自己的段以及控制器22的段分配序列号,每个序列号等于前一个序列号的数值加1。当控制器11分配的序列号的总数达到预设阈值时,则从下一个组的起始序列号开始分配。具体的,当控制器22需要为自己的段分配序列号时,控制器22向控制器11发送请求消息,控制器11根据所述请求消息分配序列号,并发送给控制器22。与示例三不同之处在于,在示例三中,由于控制器11和控制器22都可以为段分配序列号,因此这些序列号之间并不总是连续的,甚至可能会重复。而在示例四中,由于所有的序列号都是由控制器11分配的,所以这些序列号是连续的,并且不会重复。除了段的标识为序列号之外,示例四的其余内容与示例二类似,这里不再赘述。
由上面的描述可知,固态硬盘的一个块中存储的数据属于不同的段。假设一个块存储的数据分别属于序列号为1的段,序列号为2的段以及序列号为3的段。如果控制器对序列号为1的段以及序列号为2的段进行垃圾回收,固态硬盘将这两个段对应的有效的数据复制到其他段中。然而,对于上述块来说,仍然保留有序列号为3的段的数据。因此,当固态硬盘进行自己的垃圾回收时,仍然需要从该块中读取有效数据,并复制到其他块。从而导致固态硬盘内部出现写放大。
为了减少固态硬盘内部的写放大的次数,本发明实施例在执行系统垃圾回收操作时,以上面描述的段组为单位对段进行垃圾回收。由于该段组中的 各个段是在相同时间段内分配的,那么这些段的数据也是在相同的时间段内写入固态硬盘的。进一步地,由于固态硬盘在写入数据时是按照接收数据的时间顺序连续写入一个或多个块,因此,相同的时间段内分配的段被执行系统垃圾回收之后,这些段所对应的块中的有效数据已经被全部复制到其他块中,这些段所对应的块中的数据都是无效数据。当固态硬盘进行内部的垃圾回收时,被执行系统垃圾回收的段所对应的块无需再次进行有效数据的复制,从而减少了固态硬盘内部的写放大的次数。
下面介绍本实施例提供的系统垃圾回收的方法。
本发明实施例提供了一种系统垃圾回收的方法,应用在图1所示的存储系统中,所述存储系统包含多个段,其中部分段属于控制器11,部分段属于控制器22,所述存储系统包含的多个段可以划分为若干个段组。其中,每个段组中的段是在相同的时间段内分配的。每个段组具有唯一的组标识。本实施例提供的系统垃圾回收是以段组为单位来执行的。示例性的,该方法可以包括以下步骤:
401,控制器11统计各个段组包含的无效数据的数据量。
当空闲的段的数量低于预设阈值时,控制器11可以触发系统垃圾回收操作。在执行系统垃圾回收之前,控制器11可以统计每个段组包含的无效数据的数据量。由于一个段组所包含的各个段中,既有控制器11管理的段,又有控制器22管理的段(这里是以两个控制器为例,但本实施例还可以包括其他控制器)。一种实现是,控制器11只统计每个组中自己管理的那些段的无效数据的数据量,并且将包含无效数据最多的段组作为当前待回收的组。另一种实现是,控制器11不仅需要统计每个组中自己管理的那些段的无效数据的数据量,还需要获取每个组中其他控制器管理的那些段的无效数据的数据量。具体的,控制器11可以向其他控制器(例如控制器22)发送查询指令,所述查询指令包括组标识,控制器22根据所述组标识查询该段组所包括的段的无效数据的数据量,并反馈给控制器11。
另外,由前面的描述可知,当数据写入段之后,可以用位图来记录所述数据是否有效。因此,根据所述位图也可以统计一个段所包括的无效数据的数据量。
402,控制器11比较各个段组包含的无效数据的数据量,确定包含无效数据最多的段组。
控制器11根据自己统计的数据量,或者根据自己统计的数据量以及控制器22统计的数据量,可以得出哪个段组所包括的无效数据的数据量最多,将其作为当前待回收的段组。
403,控制器11对所述确定出的段组所包含的段执行系统垃圾回收操作。
具体的,在步骤403中控制器11指示固态硬盘44对所述确定出的段组所包含的段执行系统垃圾回收操作。这里的“指示”是指控制器11向固态硬盘44发送读数据请求、写数据请求以及去映射命令,使得固态硬盘44执行这些请求及命令。可以理解的是,固态硬盘44并不会主动地执行系统垃圾回收操作,只是被动地执行控制器11发送的请求及命令。控制器11指示固态硬盘44对所述确定出的段组所包含的段执行系统垃圾回收操作具体包括下述步骤:(1)控制器11向固态硬盘44发送读数据请求,所述读数据请求包括源逻辑地址。所述源逻辑地址是指一个段中有效数据的逻辑地址。固态硬盘44接收所述读数据请求之后,从所述源逻辑地址对应的实际地址中读取有效数据,写入固态硬盘控制器的存储器中。(2)控制器11向固态硬盘44发送写数据请求,所述写数据请求包括目标逻辑地址。所述目标逻辑地址是指控制器11为所述有效数据重新分配的逻辑地址。并且,目标逻辑地址与源逻辑地址对应不同的段,其中源逻辑地址对应的段是待回收的段,而目标逻辑地址对应的段是一个空闲的段或者处于正在写入状态的段。固态硬盘44接收所述写数据请求之后,从固态硬盘控制器的存储器中读取所述有效数据,并写入所述目标逻辑地址对应的实际地址中。(3)控制器11向固态硬盘44发送去映射命令,所述去映射命令包括所述待回收的段的逻辑 地址区间,固态硬盘44接收所述去映射命令之后,在闪存翻译层中删除所述逻辑地址区间中的每个逻辑地址与实际地址之间的对应关系。
404,控制器11将所述段组的组标识发送给控制器22,控制器22对所述段组所包含的段执行系统垃圾回收操作。
控制器22根据所述组标识,以及所述组标识与段的标识之间的对应关系,确定待回收的段,对所述待回收的段执行系统垃圾回收操作,具体的过程与403类似,这里不再赘述。
步骤403中控制器11执行系统垃圾回收的段与步骤404中控制器22执行系统垃圾回收的段是在相同的时间段内分配的。所述相同的时间段在所述第一控制器或所述第二控制器在所述时间段内分配的段的数量达到第一预设阈值时结束。当每个段都分配有标识并且每个控制器都具有分配标识的功能时,这里的相同的时间段与上面描述的示例一中的时间段一致。
另外,所述相同的时间段也可以在所述第一控制器以及第二控制器在所述时间段内分配的段的数量的总和达到第二预设阈值时结束。第二预设阈值可以与第一预设阈值相同,也可以不同。在这种情况下,第一控制器或者第二控制器需要给对方发送消息以查询对方分配的段的数量,从而获得这段时间内分配的段的数量的总和。当每个段都分配有标识并且只有一个控制器都具有分配标识的功能时,这里描述的相同的时间段也可以在具有分配标识的功能的控制器分配的标识的数量达到第二预设阈值时结束。
除了由控制器11统计各个段组包含的无效数据的数据量之外,本实施例还有一种实现是,在存储系统中指定一个控制器,专门用于统计各个段组包含的无效数据的数据量,例如,所述指定的控制器分别向控制器11和控制器22发送查询指令,以获取每个段组中控制器11管理的段包含的无效数据的数据量,以及每个段组中控制器22管理的段包含的无效数据的数据量。根据查询结果,确定包含无效数据最多的段组,并将所述段组的组标识分别发送给控制器11和控制器22。控制器11和控制器22分别根据所述组标识 与段的标识之间的对应关系,确定待回收的段,对所述待回收的段执行系统垃圾回收操作。
另外,本实施例也可以不对各个段组所包含的无效数据的数据量进行比较,而是监控每个段组所包含的无效数据的数据量,当某一个段组所包含的无效数据的数据量达到预设阈值时,对所述无效数据的数据量达到预设阈值的段组执行垃圾回收操作。
或者,控制器还可以依次对每个段组执行系统垃圾回收操作,不考虑段组中无效数据的大小。
或者,控制器还可以根据每个段组上一次执行系统垃圾回收操作的时间,选择最长时间未进行系统垃圾回收的段组作为当前系统垃圾回收操作的对象。
在上述步骤404中,控制器22是在控制器11执行系统垃圾回收时,对所述确定出的段组中由控制器22分配的段执行系统垃圾回收操作的。但是,控制器11和控制器22在执行系统垃圾回收操作时,并不是绝对同时进行的。只要在启动下一个段组的系统垃圾回收之前,控制器11和控制器22都完成了所述确定出的段组的系统垃圾回收即可。在实际应用中,控制器11和控制器22是以段组为单位来执行系统垃圾回收操作的。当一个段组中所包含的所有段都完成系统垃圾回收操作之后,再启动下一个段组的系统垃圾回收操作。这里的段组中所包含的所有段都完成系统垃圾回收操作是指,控制器11完成其管理的该段组中的段的系统垃圾回收操作,并且控制器22也完成了其管理的段组中的段的系统垃圾回收操作。示例性的,当控制器11和控制器22完成对包含无效数据最多的段组的系统垃圾回收时,再查找下一个包含无效数据最多的段组并启动系统垃圾回收。
本领域普通技术人员将会理解,本发明的各个方面、或各个方面的可能实现方式可以被具体实施为系统、方法或者计算机程序产品。因此,本发明的各方面、或各个方面的可能实现方式可以采用完全硬件实施例、完全软件 实施例(包括固件、驻留软件等等),或者组合软件和硬件方面的实施例的形式,在这里都统称为“电路”、“模块”或者“系统”。此外,本发明的各方面、或各个方面的可能实现方式可以采用计算机程序产品的形式,计算机程序产品是指存储在计算机可读介质中的计算机可读程序代码。
计算机可读介质包含但不限于电子、磁性、光学、电磁、红外或半导体系统、设备或者装置,或者前述的任意适当组合,如随机访问存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、光盘。
计算机中的处理器读取存储在计算机可读介质中的计算机可读程序代码,使得处理器能够执行在流程图中每个步骤、或各步骤的组合中规定的功能动作。
计算机可读程序代码可以完全在用户的计算机上执行、部分在用户的计算机上执行、作为单独的软件包、部分在用户的计算机上并且部分在远程计算机上,或者完全在远程计算机或者服务器上执行。也应该注意,在某些替代实施方案中,在流程图中各步骤、或框图中各块所注明的功能可能不按图中注明的顺序发生。例如,依赖于所涉及的功能,接连示出的两个步骤、或两个块实际上可能被大致同时执行,或者这些块有时候可能被以相反顺序执行。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,本领域普通技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。

Claims (12)

  1. 一种存储系统,其特征在于,包括第一控制器、第二控制器和固态硬盘,所述固态硬盘和所述第一控制器连接,所述固态硬盘和所述第二控制器连接,所述第一控制器或第二控制器以段为单位管理所述固态硬盘的存储空间,其中,
    所述第一控制器,用于对所述第一控制器管理的段中的多个段进行系统垃圾回收,所述第一控制器管理的段中的多个段是在一个时间段内由所述第一控制器分配的;并且,
    所述第二控制器,用于当所述第一控制器进行系统垃圾回收时,对所述第二控制器管理的段中的多个段进行系统垃圾回收,所述第二控制器管理的段中的多个段是在所述时间段内由所述第二控制器分配的。
  2. 根据权利要求1所述的存储系统,其特征在于,所述第一控制器管理的段中的多个段是所述时间段内由所述第一控制器分配的所有的段,所述第二控制器管理的段中的多个段是所述时间段内由所述第二控制器分配的所有的段。
  3. 根据权利要求1或2所述的存储系统,其特征在于,所述时间段在所述第一控制器或所述第二控制器在所述时间段内分配的段的数量达到第一预设阈值时结束。
  4. 根据权利要求1-3任一所述的存储系统,其特征在于,所述第一控制器管理的段中的多个段与所述第二控制器管理的段中的多个段属于同一个段组,所述段组包含的无效数据的数据量大于其他任意一个段组包含的无效数据的数据量。
  5. 根据权利要求4所述的存储系统,其特征在于,
    所述第一控制器,还用于将所述段组的组标识发送给所述第二控制器;
    所述第二控制器,还用于根据预先保存的所述组标识与所述第二控制器管理的段中的多个段中每个段的标识之间的对应关系,确定所述第二控制器管理的段中的所述多个段。
  6. 根据权利要求1-5任一所述的存储系统,其特征在于,
    所述第一控制器,用于将所述第一控制器管理的段中的多个段的每个段包含的有效数据的源逻辑地址发送给所述固态硬盘;为所述有效数据分配目标逻辑地址并将所述目标逻辑地址发送给所述固态硬盘,以指示所述固态硬盘将所述有效数据从所述源逻辑地址复制到所述目标逻辑地址;向所述固态硬盘发送去映射命令,所述去映射命令包括所述第一控制器管理的段中的多个段的每个段的逻辑地址区间,以指示所述固态硬盘删除所述固态硬盘保存的所述每个段的逻辑地址与实际地址之间的对应关系。
  7. 一种系统垃圾回收方法,其特征在于,所述方法应用于存储系统中,所述存储系统包括第一控制器、第二控制器和固态硬盘,所述固态硬盘和所述第一控制器连接,所述固态硬盘和所述第二控制器连接,所述第一控制器或第二控制器以段为单位管理所述固态硬盘的存储空间,所述方法包括:
    所述第一控制器对所述第一控制器管理的段中的多个段进行系统垃圾回收,所述第一控制器管理的段中的多个段是在一个时间段内由所述第一控制器分配的;
    当所述第一控制器进行系统垃圾回收时,所述第二控制器对所述第二控制器管理的段中的多个段进行系统垃圾回收,所述第二控制器管理的段中的多个段是在所述时间段内由所述第二控制器分配的。
  8. 根据权利要求7所述的方法,其特征在于,所述第一控制器管理的段中的多个段是所述时间段内由所述第一控制器分配的所有的段,所述第二控制器管理的段中的多个段是所述时间段内由所述第二控制器分配的所有的段。
  9. 根据权利要求7或8所述的方法,其特征在于,所述时间段在所述第一控制器或所述第二控制器在所述时间段内分配的段的数量达到第一预设阈值时结束。
  10. 根据权利要求7-9任一所述的方法,其特征在于,所述第一控制器管理的段中的多个段与所述第二控制器管理的段中的多个段属于同一个段组,所述段组包含的无效数据的数据量大于其他任意一个段组包含的无效数据的数据量。
  11. 根据权利要求10所述的方法,其特征在于,所述方法还包括:
    所述第一控制器将所述段组的组标识发送给所述第二控制器;
    所述第二控制器根据预先保存的所述组标识与所述第二控制器管理的段中的多个段中每个段的标识之间的对应关系,确定所述第二控制器管理的段中的所述多个段。
  12. 根据权利要求7-11任一所述的方法,其特征在于,
    所述第一控制器对所述第一控制器管理的段中的多个段进行系统垃圾回收包括:
    所述第一控制器将所述第一控制器管理的段中的多个段的每个段包含的有效数据的源逻辑地址发送给所述固态硬盘;
    所述第一控制器为所述有效数据分配目标逻辑地址并将所述目标逻辑地址发送给所述固态硬盘,以指示所述固态硬盘将所述有效数据从所述源逻辑地址复制到所述目标逻辑地址;
    所述第一控制器向所述固态硬盘发送去映射命令,所述去映射命令包括所述第一控制器管理的段中的多个段的每个段的逻辑地址区间,以指示所述固态硬盘删除所述固态硬盘保存的所述每个段的逻辑地址与实际地址之间的对应关系。
PCT/CN2016/105512 2016-11-11 2016-11-11 一种存储系统和系统垃圾回收方法 WO2018086075A1 (zh)

Priority Applications (10)

Application Number Priority Date Filing Date Title
CA2978845A CA2978845C (en) 2016-11-11 2016-11-11 Storage system and system garbage collection method
SG11201707296QA SG11201707296QA (en) 2016-11-11 2016-11-11 Storage system and system garbage collection method
AU2016397188A AU2016397188B2 (en) 2016-11-11 2016-11-11 Storage system and system garbage collection method
PCT/CN2016/105512 WO2018086075A1 (zh) 2016-11-11 2016-11-11 一种存储系统和系统垃圾回收方法
BR112017019425-2A BR112017019425B1 (pt) 2016-11-11 2016-11-11 Sistema de armazenamento e método de coleta de lixo de sistema
EP16898146.2A EP3346387B1 (en) 2016-11-11 2016-11-11 Storage system and system garbage collection method
CN201680003336.0A CN108475230B (zh) 2016-11-11 2016-11-11 一种存储系统和系统垃圾回收方法
JP2017553091A JP6455900B2 (ja) 2016-11-11 2016-11-11 ストレージシステムおよびシステムガベージコレクション方法
US16/059,938 US10621085B2 (en) 2016-11-11 2018-08-09 Storage system and system garbage collection method
US16/792,431 US20200183831A1 (en) 2016-11-11 2020-02-17 Storage system and system garbage collection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/105512 WO2018086075A1 (zh) 2016-11-11 2016-11-11 一种存储系统和系统垃圾回收方法

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/059,938 Continuation US10621085B2 (en) 2016-11-11 2018-08-09 Storage system and system garbage collection method

Publications (1)

Publication Number Publication Date
WO2018086075A1 true WO2018086075A1 (zh) 2018-05-17

Family

ID=62104425

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/105512 WO2018086075A1 (zh) 2016-11-11 2016-11-11 一种存储系统和系统垃圾回收方法

Country Status (9)

Country Link
US (2) US10621085B2 (zh)
EP (1) EP3346387B1 (zh)
JP (1) JP6455900B2 (zh)
CN (1) CN108475230B (zh)
AU (1) AU2016397188B2 (zh)
BR (1) BR112017019425B1 (zh)
CA (1) CA2978845C (zh)
SG (1) SG11201707296QA (zh)
WO (1) WO2018086075A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI711048B (zh) * 2020-02-07 2020-11-21 大陸商合肥兆芯電子有限公司 快閃記憶體之資料整理方法、控制電路單元與儲存裝置
JP2021509981A (ja) * 2018-09-12 2021-04-08 ホアウェイ・テクノロジーズ・カンパニー・リミテッド システムガベージコレクションの方法およびソリッドステートディスクにおけるガベージコレクションの方法
JP2021529406A (ja) * 2018-07-06 2021-10-28 華為技術有限公司Huawei Technologies Co.,Ltd. システムコントローラおよびシステムガベージコレクション方法
US11321229B2 (en) 2018-07-06 2022-05-03 Huawei Technologies Co., Ltd. System controller and system garbage collection method

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11288185B2 (en) * 2019-01-03 2022-03-29 Silicon Motion, Inc. Method and computer program product for performing data writes into a flash memory
CN113490922B (zh) * 2019-02-27 2023-07-18 华为技术有限公司 固态硬盘写放大优化方法
CN113377686A (zh) * 2020-03-10 2021-09-10 阿里巴巴集团控股有限公司 调度方法、装置、电子设备及计算机可读介质
CN112364758B (zh) * 2020-11-10 2024-06-25 北京呈创科技股份有限公司 基于多目标图像识别的垃圾分类回收方法及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479060A (zh) * 2010-11-30 2012-05-30 英业达股份有限公司 储存系统的双控制器的运作方法
CN103412826A (zh) * 2013-07-18 2013-11-27 记忆科技(深圳)有限公司 固态硬盘的垃圾回收方法及系统
CN103577338A (zh) * 2013-11-14 2014-02-12 华为技术有限公司 一种回收垃圾数据的方法及存储设备
CN103902465A (zh) * 2014-03-19 2014-07-02 华为技术有限公司 一种固态硬盘垃圾回收的方法、系统和固态硬盘控制器
US20150074327A1 (en) * 2013-09-10 2015-03-12 Lsi Corporation Active Recycling for Solid State Drive

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8285946B2 (en) * 2009-12-15 2012-10-09 International Business Machines Corporation Reducing access contention in flash-based memory systems
US8966172B2 (en) * 2011-11-15 2015-02-24 Pavilion Data Systems, Inc. Processor agnostic data storage in a PCIE based shared storage enviroment
CN102622308B (zh) * 2012-02-23 2014-12-24 深圳市硅格半导体有限公司 多通道的管理方法及管理系统
US10180951B2 (en) * 2013-03-15 2019-01-15 Amazon Technologies, Inc. Place snapshots
US20150378886A1 (en) * 2013-04-08 2015-12-31 Avalanche Technology, Inc. Software-defined ssd and system using the same
US9727456B2 (en) * 2014-11-03 2017-08-08 Pavilion Data Systems, Inc. Scheduled garbage collection for solid state storage devices
KR20160075229A (ko) * 2014-12-19 2016-06-29 삼성전자주식회사 가비지 컬렉션 동작 방법 및 이를 적용하는 레이드 스토리지 시스템
JP6459644B2 (ja) * 2015-03-05 2019-01-30 富士通株式会社 ストレージ制御装置、制御システム及び制御プログラム
US9811462B2 (en) 2015-04-30 2017-11-07 Toshiba Memory Corporation Memory system executing garbage collection
EP3220275B1 (en) 2015-12-03 2020-11-04 Huawei Technologies Co., Ltd. Array controller, solid state disk and data writing control method for solid state disk
US10684795B2 (en) * 2016-07-25 2020-06-16 Toshiba Memory Corporation Storage device and storage control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479060A (zh) * 2010-11-30 2012-05-30 英业达股份有限公司 储存系统的双控制器的运作方法
CN103412826A (zh) * 2013-07-18 2013-11-27 记忆科技(深圳)有限公司 固态硬盘的垃圾回收方法及系统
US20150074327A1 (en) * 2013-09-10 2015-03-12 Lsi Corporation Active Recycling for Solid State Drive
CN103577338A (zh) * 2013-11-14 2014-02-12 华为技术有限公司 一种回收垃圾数据的方法及存储设备
CN103902465A (zh) * 2014-03-19 2014-07-02 华为技术有限公司 一种固态硬盘垃圾回收的方法、系统和固态硬盘控制器

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3346387A4 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021529406A (ja) * 2018-07-06 2021-10-28 華為技術有限公司Huawei Technologies Co.,Ltd. システムコントローラおよびシステムガベージコレクション方法
US11321229B2 (en) 2018-07-06 2022-05-03 Huawei Technologies Co., Ltd. System controller and system garbage collection method
JP7146054B2 (ja) 2018-07-06 2022-10-03 華為技術有限公司 システムコントローラおよびシステムガベージコレクション方法
JP2021509981A (ja) * 2018-09-12 2021-04-08 ホアウェイ・テクノロジーズ・カンパニー・リミテッド システムガベージコレクションの方法およびソリッドステートディスクにおけるガベージコレクションの方法
US11928053B2 (en) 2018-09-12 2024-03-12 Huawei Technologies Co., Ltd. System garbage collection method and method for garbage collection in solid state disk
TWI711048B (zh) * 2020-02-07 2020-11-21 大陸商合肥兆芯電子有限公司 快閃記憶體之資料整理方法、控制電路單元與儲存裝置

Also Published As

Publication number Publication date
EP3346387B1 (en) 2020-09-02
BR112017019425A2 (pt) 2018-08-14
EP3346387A1 (en) 2018-07-11
CN108475230A (zh) 2018-08-31
CN108475230B (zh) 2021-07-16
AU2016397188B2 (en) 2019-02-21
AU2016397188A1 (en) 2018-05-31
CA2978845C (en) 2021-08-31
JP2018536908A (ja) 2018-12-13
BR112017019425B1 (pt) 2023-01-24
JP6455900B2 (ja) 2019-01-23
US20200183831A1 (en) 2020-06-11
EP3346387A4 (en) 2018-12-05
SG11201707296QA (en) 2018-06-28
US20180349272A1 (en) 2018-12-06
US10621085B2 (en) 2020-04-14
CA2978845A1 (en) 2018-05-11

Similar Documents

Publication Publication Date Title
WO2018086075A1 (zh) 一种存储系统和系统垃圾回收方法
US10761731B2 (en) Array controller, solid state disk, and method for controlling solid state disk to write data
US10191688B2 (en) Memory system and information processing system
US20150378888A1 (en) Controller, flash memory apparatus, and method for writing data into flash memory apparatus
US12111759B2 (en) Method and storage device for parallelly processing the deallocation command
US10203899B2 (en) Method for writing data into flash memory apparatus, flash memory apparatus, and storage system
US11928053B2 (en) System garbage collection method and method for garbage collection in solid state disk
JP6526235B2 (ja) データチェック方法および記憶システム
US11995318B2 (en) Deallocated block determination
WO2019000982A1 (zh) 一种存储系统、固态硬盘和数据存储方法
WO2020007030A1 (zh) 一种系统控制器和系统垃圾回收方法
JP2019194780A (ja) 情報処理装置、データ管理プログラム及びデータ管理方法
WO2018041258A1 (zh) 去分配命令处理的方法与存储设备
CN110389706B (zh) 一种指纹回收方法以及存储系统
US20210191851A1 (en) System and method for facilitating reduction of latency and mitigation of write amplification in a multi-tenancy storage drive
CN110580228A (zh) 去分配命令处理方法及其存储设备
WO2020052216A1 (zh) 一种系统垃圾回收方法和固态硬盘中的垃圾回收方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2978845

Country of ref document: CA

WWE Wipo information: entry into national phase

Ref document number: 11201707296Q

Country of ref document: SG

WWE Wipo information: entry into national phase

Ref document number: 2017553091

Country of ref document: JP

ENP Entry into the national phase

Ref document number: 2016397188

Country of ref document: AU

Date of ref document: 20161111

Kind code of ref document: A

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

Ref document number: 16898146

Country of ref document: EP

Kind code of ref document: A1

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112017019425

Country of ref document: BR

ENP Entry into the national phase

Ref document number: 112017019425

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20170912

NENP Non-entry into the national phase

Ref country code: DE