WO2019000982A1 - 一种存储系统、固态硬盘和数据存储方法 - Google Patents

一种存储系统、固态硬盘和数据存储方法 Download PDF

Info

Publication number
WO2019000982A1
WO2019000982A1 PCT/CN2018/076895 CN2018076895W WO2019000982A1 WO 2019000982 A1 WO2019000982 A1 WO 2019000982A1 CN 2018076895 W CN2018076895 W CN 2018076895W WO 2019000982 A1 WO2019000982 A1 WO 2019000982A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
controller
metadata
logical address
solid state
Prior art date
Application number
PCT/CN2018/076895
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 华为技术有限公司
Publication of WO2019000982A1 publication Critical patent/WO2019000982A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • 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 application relates to the field of storage technologies, and in particular, to a storage system, a solid state hard disk, and a data storage method.
  • a flash array is a storage system that contains solid state drives and controllers.
  • a solid state drive contains multiple erase blocks (English: erase block).
  • the controller sends the received data to the SSD storage.
  • the controller also generates metadata for these data in the process of processing various operational requests. Metadata refers to data that manages data. Similarly, the controller also needs to send metadata to the SSD for persistent storage.
  • the SSD After the controller sends the data and metadata to the SSD, the SSD writes the data and metadata to one or more erase blocks in the order in which they are received. Then, for an erase block, it holds both data and metadata. Normally, the frequency at which data is modified by access is much lower than the frequency at which metadata is accessed, so the likelihood that the metadata becomes invalid is greater than the likelihood that the data becomes invalid.
  • the metadata in an erase block becomes invalid data the data contained in the erase block is likely to remain valid data.
  • the SSD is garbage collected, it is necessary to copy the valid data in this erase block to other blank erase blocks. Then, the valid data is actually written into the erase block of the solid state hard disk again, thereby causing a problem of write amplification of the solid state hard disk.
  • the present application proposes a storage system and a data storage method that can reduce the number of write amplifications inside a solid state drive.
  • the first aspect of the present application provides a storage system including a controller and a solid state hard disk.
  • the solid state hard disk includes a plurality of erase blocks.
  • the erase blocks can be divided into at least two sets, wherein the first set of erase blocks includes one or more erase blocks dedicated to storing data; the second set of erase blocks includes one or more erase blocks, dedicated to Store metadata.
  • the erase block included in the first erase block set and the erase block included in the second erase block set do not coincide.
  • the controller is configured to send data to the solid state hard disk and a first logical address of the data, where the first logical address is a subset of the first address interval allocated by the controller for the data.
  • the controller is further configured to send metadata to the solid state hard disk and a second logical address of the metadata, where the second logical address is also allocated by the controller for the metadata, and belongs to a second address interval. set.
  • the SSD After receiving the data, the metadata, and the first logical address and the second logical address, the SSD identifies that the first logical address and the second logical address belong to different address intervals, and then writes the data to the first erase block. A collection that writes metadata to a second set of erase blocks.
  • the above storage system stores data and metadata separately into different erase blocks. Then, for one erase block, either the data is stored or the metadata is stored, and the data cannot be stored and stored.
  • the metadata stored in the erase block is metadata
  • the probability that the metadata becomes invalid data is high, and the erase operation can be directly performed on the erase block during garbage collection without copying the valid data.
  • the erase block stores data, since the probability that the data becomes invalid data is low, the erase block may not perform an erase operation on the erase block, and retain the stored valid data. Therefore, regardless of whether the erase block stores metadata or data, write amplification can be reduced.
  • the controller is located outside of the solid state drive and is different from a controller internal to the solid state drive.
  • the SSD sends a logical address interval to the controller before the controller allocates a logical address, and the controller divides the logical address interval into the first Address range and second address range.
  • the controller may further feed back the first address interval and the second address interval to the SSD.
  • the controller includes a memory, where the memory is divided into a first area for storing data and a second area for storing metadata. This division can be logical or physical. In this way, the controller can identify whether the attribute of the data is data or metadata based on the area in which the data is obtained, thereby assigning a corresponding logical address thereto.
  • a data label is set to the data, where the data label is used to indicate that the attribute of the data is data, and a metadata label is set to the metadata, where the metadata label is used to indicate the
  • the attributes of metadata are metadata. Therefore, the controller can directly identify the attribute according to the tag, thereby assigning a corresponding logical address to the data or the metadata.
  • the solid state drive is further configured to perform garbage collection. Specifically, when the preset garbage collection condition is satisfied, the erase block included in the solid state hard disk is scanned, and the valid data in the erase block is copied into the blank erase block. However, for the first erase block set, since the probability that the metadata is overwritten is high, when the garbage collection is performed, the metadata stored in the erase block included in the first erase block set becomes invalid data. Therefore, these erase blocks can be directly erased without copying the valid data contained therein before erasing.
  • the second aspect of the present application provides a solid state hard disk having the functions implemented by the solid state hard disk in the storage system provided by the first aspect.
  • a third aspect of the present application provides a data storage method.
  • the method is applied to the storage system provided by the first aspect, and is executed by a controller or a solid state hard disk.
  • a fourth 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 solid state hard disk of the second aspect 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 schematic structural diagram of a solid state hard disk according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of a method for data storage according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of another method for data storage according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a module of a solid state hard disk according to an embodiment of the present invention.
  • the embodiment of the invention provides a storage system and a data storage 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 one controller (the controller 11 as shown) and a plurality of solid state drives 44.
  • the controller 11 is connected to a host (not shown) through a storage area network (SAN).
  • Controller 11 can be a computing device such as a server, 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.
  • the controller 11 also generates metadata related to the I/O request when processing the I/O request.
  • Metadata is data that manages data. For example, when the I/O request is a write file request, then the data carried in the I/O request is the data to be written to the target file. If the target file does not exist before, the target file is created first, and thus the metadata related to the write file request includes but is not limited to: the file name of the target file, the save path of the target file, the creation time of the target file, The time at which the data is written to the target file and the directory to which the target file belongs. For another example, when the I/O request is a modification file request, the data carried in the I/O request is data for modifying the original data of the target file. The metadata associated with this modified file request includes, but is not limited to, the modification time of the target file, the modified file name (if the file name is modified), and the modified directory name (if the directory name is modified). This metadata is also written to the SSD 44 for persistent storage.
  • 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 embodiment does not limit the controller 11 and other controllers. 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, a processor 112, and an 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.
  • 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.
  • the controller 11 belongs to a system controller, which is an independent device, unlike a control chip in a 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 drive 44 includes a solid state drive controller and a storage medium (as shown in FIG. 3).
  • 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 assigned by the controller. Specifically, the solid state hard disk 44 can send a set of a plurality of logical addresses to the controller 11, and the plurality of logical addresses contained in the set are continuous. The controller 11 allocates a subset from this set to the target data.
  • the logical address of the data includes a starting logical address and a length, a starting logical address indicating the starting position of the data, 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.
  • the storage medium includes one or more flash chips.
  • Each flash chip has its own control circuit (English: control circuit), and the control circuit is different from the solid state disk controller. Functionally speaking, the control circuit can only passively receive the read command or write command or erase command of the SSD controller, read/write the specified page, erase the specified erase block, and cannot autonomously The page or erase block performs other operations.
  • control circuit and the solid state hard disk controller are composed of one or more logic circuits, the logic circuit included in the solid state disk controller is more complicated.
  • Each flash chip includes several erase blocks.
  • the flash chip is based on a page (English: page) when reading or writing, but the erase operation can only be based on one erase block.
  • the erase operation means that all bits of the erase block are Set to "1".
  • the SSD controller needs to first copy the valid data in this erase block to the blank page of another erase block.
  • the valid data in the erase block refers to the unmodified data stored in the erase block, and this part of the data may be read.
  • the invalid data in the erase block refers to the data that has been modified in the erase block, and this part of the data cannot be read.
  • Each erase block contains multiple pages (English: page).
  • a solid state drive performs a write data request, it writes data in units of pages.
  • the erase block, page, and physical address in the SSD are invisible to the controller, so the controller cannot directly access the erase blocks and pages in the SSD.
  • the work of accessing erase blocks and pages is done by the SSD controller.
  • 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 data sent by the controller, the SSD controller continuously writes the data into one or more erase blocks in the order of received time. Writing one or more erase blocks in succession means that the solid state drive finds a blank erase block and writes the data to the blank erase block until the blank erase block is filled.
  • the SSD controller searches for the next blank erase 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 controller 11 sends a read data request to the solid state hard disk controller requesting to read the data
  • the read data request includes the logical address.
  • the SSD controller reads the data according to the logical address and the correspondence between the logical address and the actual address, and transmits the data to the controller 11.
  • the metadata generated by the controller 11 when processing these I/O requests is also sent to the SSD for storage.
  • the controller 11 transmits all the data stored in the memory 111 to the solid state hard disk. If the SSD controller continuously writes the data and the metadata in one or more erase blocks in the received chronological order, then both the data and the erase block written for each (or some) are included. Metadata. Since the frequency of data being modified by access is generally much lower than the frequency at which the metadata is accessed, the probability that the metadata becomes invalid data is greater than the likelihood that the data becomes invalid. When the metadata in an erase block becomes invalid data, the data contained in the erase block is still valid data. When the SSD is garbage collected, it is necessary to move the valid data in this erase block to other blank erase blocks. As a result, the problem of write amplification of the solid state hard disk is caused.
  • WF Write amplification
  • the amount of data actually written into the SSD is greater than the amount of data in the data itself.
  • the data in the original erased block here, the valid data
  • the copied data is written to other erase blocks again (the first write refers to writing the data to an erase block when it is received from the outside), then the data is actually The amount of data written to the SSD is greater than the amount of data of the data itself. Due to the limited number of erasures of SSDs, write amplification problems can reduce the life of SSDs.
  • the garbage collection inside the SSD is done by the SSD itself. First, copy the valid data in each erase block to the blank erase block, and then erase the original erase block.
  • the trigger for garbage collection is that the number of blank erase blocks of the solid state drive is insufficient.
  • the data and the metadata are separately stored to different erase blocks. Then, for one erase block, either the data is stored or the metadata is stored, and the data cannot be stored and stored. Therefore, when metadata is stored in the erase block, the probability that the metadata becomes invalid data is high, and the erase operation can be directly performed on the erase block during garbage collection without copying the valid data.
  • the erase block stores data, since the probability that the data becomes invalid data is low, the erase block may not perform an erase operation on the erase block, and retain the stored valid data. Therefore, regardless of whether the erase block stores metadata or data, write amplification can be reduced.
  • the data storage method provided in this embodiment is described below with reference to FIG. 4, which may be applied to the application scenario shown in FIG. 1.
  • the method includes the following steps:
  • the controller 11 receives the write data command sent by the host, and writes the data carried in the write data command 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 write data command in step S301 is sent by the host to the controller 11, which is different from the write data request sent by the controller 11 to the solid state hard disk 44.
  • processor 112 generates some metadata when processing write data instructions, and these generated metadata are also stored in memory 111.
  • the controller 11 can recognize data and metadata in at least the following two ways.
  • the controller 11 logically divides the memory 111 into at least two areas, one of which is for storing data and the other for storing metadata. This division is only logical, not physical.
  • the page included in the memory 111 is divided into at least two parts, one of which is designated for storing data, and the other is designated for storing metadata.
  • the second way is that when the controller 11 stores the data and the metadata, it gives a label indicating the data attribute, wherein the label of the data is used to indicate that the attribute is data, and the label of the metadata is used to indicate that the attribute is metadata. .
  • the controller 11 assigns a logical address to the data and the metadata, respectively. 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 continuous logical address range that the SSD controller sends to the controller 11 in advance is 1024 KB - 2047 KB.
  • the controller 11 divides the continuous logical address interval into two parts.
  • the first partial address interval is 1024 KB-2000 KB for allocating logical addresses for data.
  • the second part of the address range is 2001KB-2047KB, which is used to assign logical addresses to metadata.
  • the controller 11 can notify the solid state hard disk 44 of the division of the consecutive logical address intervals.
  • the logical address interval sent by the solid state hard disk 44 to the controller 11 may be continuous or discontinuous.
  • the continuous logical address interval described above is only 1024 KB-2047 KB.
  • controller 11 When the size of the data and metadata in the memory 111 reaches a predetermined threshold, the controller 11 needs to transmit the data and metadata to the solid state hard disk 44 for persistent storage. Prior to transmission, controller 11 assigns logical addresses to data and metadata, respectively. Taking the data allocation logical address as an example, the controller 11 can determine an idle address interval from the first partial address interval as the logical address of the data. The free address interval is a subset of the first partial address interval and has not been allocated to other data. Similarly, for metadata, the controller 11 may determine that it is metadata, rather than data, based on the area of the memory 111 in which the metadata is located or the tag, and then determine a free address from the second partial address interval. Interval, as the logical address of the metadata.
  • the controller 11 sends the data and the assigned logical address to the solid state hard disk 44.
  • the controller 11 may encapsulate the data and the logical address allocated for the data in a write data request, and send the write data request to the solid state hard disk 44. If the size of the data is large, it may be encapsulated in a plurality of write data requests and sent to the solid state hard disk 44.
  • the solid state hard disk 44 recognizes that the received data is data, rather than metadata, according to the assigned logical address, and writes the data to one or more erase blocks. As explained in step S302, the controller 11 can notify the solid state hard disk 44 of the division of the continuous logical address interval. Thus, the SSD controller can identify the data or metadata according to the address interval to which the received logical address belongs. For example, when the received logical address is a subset of 1024KB-2000KB, then this is the logical address of the data. Thus, the received data is written into one or more erase blocks. In one case, the solid state hard disk 44 may preset an erase block dedicated to storing data, and an erase block dedicated to storing metadata.
  • the SSD controller does not specify an erase block dedicated to storing data. If an erase block stores data for the first time, the erase block is used to store data from then on. Conversely, if an erase block is stored for metadata when it is first used, then the erase block is used to store data from then on. For convenience of identification, a specific tag may be used to identify that the erase block stores data or metadata.
  • the address in which the data is stored in the erase block is the actual address.
  • the SSD controller saves the correspondence between the assigned logical address and the actual address in the flash translation layer after writing the data to the erase block.
  • the controller 11 sends the metadata and the assigned logical address to the solid state hard disk 44.
  • the controller 11 may encapsulate the metadata and the logical address assigned to the metadata in one or more write data requests for transmission to the solid state hard disk 44.
  • the solid state hard disk 44 identifies, according to the allocated logical address, that metadata is received instead of data, and writes the metadata to one or more erase blocks.
  • the solid state hard disk controller writes the metadata to a pre-set erase block dedicated to storing metadata, or an erase block in which metadata has been saved.
  • the SSD copies the valid data in the erase block to the blank erase block, and then erases the original erase block.
  • the preset garbage collection conditions here include but are not limited to: (1) the number of blank erase blocks in the solid state drive is below a certain threshold; and (2) the amount of invalid data stored in the solid state drive reaches a certain amount. Threshold.
  • the SSD checks each erase block in turn for efficient data replication. For an erase block, either store data or store metadata, not both data and metadata. Therefore, when metadata is stored in the erase block, the probability that the metadata becomes invalid data is high, and the erase operation can be directly performed on the erase block during garbage collection without copying the valid data.
  • the erase block stores data, since the probability that the data becomes invalid data is low, the erase block may not perform an erase operation on the erase block, and retain the stored valid data. Therefore, regardless of whether the erase block stores metadata or data, write amplification can be reduced.
  • this embodiment also provides another data storage method, which can also reduce write amplification inside the solid state hard disk.
  • the difference from the data storage method shown in FIG. 4 is that, when writing data to the solid state hard disk 44, the embodiment does not distinguish the attributes of the data, but writes different erase blocks according to the degree of heat and cold of the data. in. Specifically, please refer to FIG. 5.
  • FIG. 5 is a schematic flowchart of the data storage method. As shown in FIG. 5, the method includes the following steps.
  • the controller 11 receives the write data command sent by the host, and writes the data carried in the write data command into the memory 111 of the controller 11.
  • the write data instruction includes, in addition to the data, a host logical address of the data.
  • the host logical address is the address visible to the host and controller 11, while the logical address previously described is the address visible to controller 11 and solid state hard disk 44.
  • the host logical address includes a logical start address and the length of the data.
  • the controller 11 can determine the degree of coldness and heat of the data based on the host logical address of the data. For example, the frequency of access by the host to the logical address of the host is considered to be hot data when the access frequency is higher than a set threshold, otherwise the data is considered cold data.
  • the controller 11 may store the cold data and the hot data in different areas of the memory 111, respectively, or set different identifiers for the cold data and the hot data, the identifiers for indicating that the data is Cold data or hot data. This portion is similar to S301 shown in FIG. 4, and can be referred to the description in section S301.
  • the controller 11 assigns logical addresses to the cold data and the hot data, respectively.
  • the controller 11 respectively assigns different logical addresses to the cold data and the hot data. For example, the controller 11 divides the continuous logical address interval sent by the solid state hard disk 44 into the first partial address interval. And a second portion of the address interval, wherein the first portion of the address interval is dedicated to assigning a logical address to the cold data, and the second portion of the address interval is dedicated to assigning a logical address to the hot data.
  • the solid state drives 44 can identify cold data or hot data based on the address ranges to which their logical addresses belong. Specifically, step S402 is similar to step S302, and reference may be made to the description of step S302.
  • the controller 11 sends the cold data and the assigned logical address to the solid state hard disk 44.
  • the solid state hard disk 44 identifies that the received cold data is based on the allocated logical address, and writes the cold data to one or more erase blocks.
  • the one or more erase blocks are dedicated to storing cold data, which may be preset or may be set after the cold data is written for the first time.
  • the controller 11 sends the hot data and the assigned logical address to the solid state hard disk 44.
  • the solid state hard disk 44 identifies that the received hot data is based on the allocated logical address, and writes the hot data to one or more erase blocks.
  • the erase block written by the hot data is an erase block dedicated to storing hot data, unlike an erase block dedicated to storing cold data.
  • cold data and hot data are separately stored to different erase blocks. Then, for one erase block, either cold data is stored or hot data is stored, and neither cold data nor hot data can be stored. Therefore, when the hot data is stored in the erase block, the probability that the metadata becomes invalid data is high, and the erase operation can be directly performed on the erase block during garbage collection without copying the valid data.
  • the erase block stores cold data, since the probability that the data becomes invalid data is low, the erase block may not perform an erase operation on the erase block, and retain the stored valid data. Therefore, regardless of whether the erase block stores cold data or hot data, the write amplification can be reduced.
  • the SSD copies the valid data in the erase block to the blank erase block, and then erases the original erase block.
  • the preset garbage collection conditions here include but are not limited to: (1) the number of blank erase blocks in the solid state drive is below a certain threshold; and (2) the amount of invalid data stored in the solid state drive reaches a certain amount. Threshold.
  • the SSD checks each erase block in turn for efficient data replication. For an erase block, either store data or store metadata, not both data and metadata. Therefore, when metadata is stored in the erase block, the probability that the metadata becomes invalid data is high, and the erase operation can be directly performed on the erase block during garbage collection without copying the valid data.
  • the erase block stores data, since the probability that the data becomes invalid data is low, the erase block may not perform an erase operation on the erase block, and retain the stored valid data. Therefore, regardless of whether the erase block stores metadata or data, write amplification can be reduced.
  • the embodiment further provides a solid state hard disk, including a receiving module 501 and a writing module 502.
  • the receiving module 501 is configured to receive data and a first logical address of the data, and receive metadata and a second logical address of the metadata, where the metadata is data that manages the data, where the first The logical address is a subset of the first address interval and the second logical address is a subset of the second address interval.
  • the writing module 502 is configured to, when determining that the first logical address and the second logical address belong to different address intervals, write the data into the first erase block set, and write the metadata into the first a second erase block set, the first erase block set including one or more erase blocks, the second erase block set including one or more erase blocks, the first erase block set included The erase block is different from the erase block included in the second erase block set.
  • the receiving module 501 can be a solid state hard disk controller itself, or a functional module of the solid state hard disk controller, and assumes functions of a part of the solid state hard disk controller, such as a receiving function.
  • the writing module 502 can be a solid state hard disk controller itself or a functional module of the solid state hard disk controller for writing data and metadata sent from the controller 11 to the erase block. For details, refer to the steps in FIG. 4 . S304, step 306, and description of step 404, step 406 of FIG.
  • the solid state drive may further include a sending module 503, configured to send a logical address interval to the controller 11, so that the controller 11 divides the logical address interval into the first address interval and the second address interval.
  • the sending module 503 can be a solid state hard disk controller itself, or a functional module of the solid state hard disk controller, and can even be the same functional module as the receiving module 501.
  • the solid state hard disk may further include a garbage collection module 504, configured to erase the first erase block set when a preset garbage collection condition is satisfied, without requiring valid data in the first erase block set Make a copy.
  • the garbage collection module 504 can be a solid state disk controller itself or a functional module of the solid state disk controller. For details, refer to the previous description of garbage collection.
  • 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 be in the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, etc.), or a combination of software and hardware aspects, They are collectively referred to herein as "circuits," "mode erase blocks,” 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 of the flowchart, or in the blocks in the block diagrams may not occur in the order noted.
  • the two steps shown in succession, or two erase blocks may in fact be executed substantially concurrently, or the erase blocks may sometimes be performed in the reverse order.

Landscapes

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

Abstract

一种存储系统及固态硬盘(44),该存储系统包括控制器(11)和固态硬盘(44)。控制器(11)用于向固态硬盘(44)发送数据以及数据的第一逻辑地址,以及用于向固态硬盘(44)发送元数据以及元数据的第二逻辑地址。固态硬盘(44)用于当确定第一逻辑地址和第二逻辑地址属于不同的地址区间时,将数据写入第一擦除块集合,将元数据写入第二擦除块集合。所述第一擦除块集合包括一个或多个擦除块,所述第二擦除块集合包括一个或多个擦除块,所述第一擦除块集合所包含的擦除块与所述第二擦除块集合所包含的擦除块均不相同。在固态硬盘进行垃圾回收时,可以减小写放大。

Description

一种存储系统、固态硬盘和数据存储方法 技术领域
本申请涉及存储技术领域,特别是一种存储系统、固态硬盘和数据存储方法。
背景技术
闪存阵列是指包含固态硬盘和控制器的存储系统。固态硬盘包含多个擦除块(英文:erase block)。控制器将接收的数据发送给固态硬盘存储。除了数据本身之外,控制器在处理各种操作请求的过程还会生成这些数据的元数据。元数据是指管理数据的数据。同样的,控制器也需要将元数据发送给固态硬盘进行持久化存储。
控制器将数据以及元数据发送给固态硬盘之后,固态硬盘按照其接收的时间顺序依次将这些数据以及元数据写入一个或多个擦除块中。那么,对于一个擦除块而言,它既保存有数据也保存有元数据。通常情况下,数据被访问修改的频率远低于元数据被访问修改的频率,因此元数据变成无效数据的可能性大于数据变成无效数据的可能性。当一个擦除块中的元数据变成无效数据后,这个擦除块所包含的数据很可能仍然是有效数据。在固态硬盘进行垃圾回收时,就需要将这个擦除块中的有效数据复制到其他空白擦除块。那么,这些有效数据实际上是被再次写入固态硬盘的擦除块中,由此,造成了固态硬盘的写放大问题。
发明内容
本申请提出了一种存储系统和数据存储方法,可以减少固态硬盘内部的写放大的次数。
本申请第一方面提供了一种存储系统,包括控制器和固态硬盘。其中,固态硬盘包括多个擦除块。这些擦除块可以分为至少两个集合,其中第一擦除块集合包括一个或多个擦除块,专用于存储数据;第二擦除块集合包括一个或多个擦除块,专用于存储元数据。第一擦除块集合所包含的擦除块和第二擦除块集合所包含的擦除块不重合。所述控制器用于向所述固态硬盘发送数据以及该数据的第一逻辑地址,第一逻辑地址是所述控制器为该数据分配的,属于第一地址区间的子集。另外,所述控制器还用于向所述固态硬盘发送元数据以及该元数据的第二逻辑地址,第二逻辑地址也是所述控制器为该元数据分配的,属于第二地址区间的子集。所述固态硬盘接收所述数据、元数据以及第一逻辑地址、第二逻辑地址之后,识别出第一逻辑地址和第二逻辑地址属于不同的地址区间后,将数据写入第一擦除块集合,将元数据写入第二擦除块集合。
上述存储系统将数据和元数据分开存储到不同的擦除块中,那么,对于一个擦除块而言,要么存储数据,要么存储元数据,不能既存储数据又存储元数据。当这个擦除块中存储的是元数据时,这些元数据变成无效数据的概率较高,那么垃圾回收时可以直接对这个擦除块执行擦除操作,无需复制有效数据。当这个擦除块存储的是数据时,由于数据变成无效数据的概率较低,那么垃圾回收时可以不对这个擦除块执行擦除操作,保留其存储的有效数据。因此无论这个擦除块存储的是元数据还是数据,都可以减小写放大。
第一方面的第一种实现方式中,所述控制器位于所述固态硬盘的外部,不同于所述固态硬盘内部的控制器。
第一方面的第二种实现方式中,所述固态硬盘会在所述控制器分配逻辑地址之前向所述控制器发送一段逻辑地址区间,所述控制器将所述逻辑地址区间划分为第一地址区间和第二地址区间。为了让固态硬盘能够根据逻辑地址所属的地址区间识别出数据的属性,所述控制器还可以将所述第一地址区间和第二地址区间反馈给固态硬盘。由此,控制器和固态硬盘能够统一对地址区间的理解。
第一方面的第三种实现方式中,所述控制器包括存储器,所述存储器分为第一区域和第二区域,第一区域用于存储数据,第二区域用于存储元数据。这种划分可以是逻辑上的,也可以是物理上的。按照这种方式,控制器可以根据获得一个数据的区域识别出这个数据的属性是数据还是元数据,由此对其分配相应的逻辑地址。
第一方面的第四种实现方式中,给数据设置数据标签,所述数据标签用于指示所述数据的属性是数据;给元数据设置元数据标签,所述元数据标签用于指示所述元数据的属性是元数据。因此,控制器可以直接根据标签对属性进行识别,由此对数据或者元数据分配相应的逻辑地址。
第一方面的第五种实现方式中,所述固态硬盘还用于执行垃圾回收。具体的,当预设的垃圾回收的条件满足时,扫描所述固态硬盘所包含的擦除块,将擦除块中的有效数据复制到空白的擦除块中。然而,对于第一擦除块集合,由于元数据被改写的概率较高,在执行垃圾回收时,第一擦除块集合所包含的擦除块中存储的元数据都变成了无效数据,因此可以直接擦除这些擦除块,而不需要在擦除之前对其包含的有效数据进行复制。
本申请第二方面提供了一种固态硬盘,具有第一方面提供的存储系统中由固态硬盘实现的功能。
本申请第三方面提供了一种数据存储方法。该方法应用于第一方面提供的存储系统中,由控制器或者固态硬盘执行。
本申请第四方面提供了一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可以由上述第二方面的固态硬盘执行。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍。
图1是本发明实施例提供的应用场景图;
图2是本发明实施例提供的控制器的结构图;
图3是本发明实施例提供的固态硬盘的结构示意图。
图4是本发明实施例提供的一种数据存储的方法流程图
图5是本发明实施例提供的另一种数据存储的方法流程图;
图6是本发明实施例提供的固态硬盘的模块示意图。
具体实施方式
本发明实施例提出了一种存储系统和数据存储方法,可以减少固态硬盘内部的 写放大的次数。
图1描绘了本发明实施例提供的存储系统的组成图,图1所示的存储系统包括至少一个控制器(如图所示的控制器11)和多个固态硬盘44。
控制器11通过存储区域网络(英文:storage area network,SAN)与主机(图中未示出)连接。控制器11可以是一种计算设备,如服务器、台式计算机等等。在控制器11上安装有操作系统以及应用程序。控制器11可以接收来自主机的输入输出(I/O)请求。控制器11还可以存储I/O请求中携带的数据(如果有的话),并且将该数据写入固态硬盘44中。
另外,控制器11在处理I/O请求时,还会产生和所述I/O请求有关的元数据。元数据是管理数据的数据。例如,当所述I/O请求是一个写文件请求时,那么所述I/O请求中携带的数据就是待写入目标文件的数据。如果目标文件之前并不存在,那么首先会创建这个目标文件,由此与这个写文件请求相关的元数据包括但不限于:目标文件的文件名、目标文件的保存路径、目标文件的创建时间、数据写入所述目标文件的时间、目标文件所属的目录。又如,当所述I/O请求是一个修改文件请求时,那么所述I/O请求中携带的数据就是对所述目标文件原有的数据进行修改的数据。与这个修改文件请求相关的元数据包括但不限于:目标文件的修改时间、修改后的文件名(如果涉及文件名的修改)、修改后的目录名(如果涉及目录名的修改)。这些元数据也会被写入固态硬盘44中,以实现持久化存储。
固态硬盘(英文:Solid State Disk,SSD)是以闪存(英文:flash memory)芯片为存储介质的存储器,又名固态驱动器(Solid State Drive,SSD)。
图1仅是示例性说明,在实际应用中存储系统可包含多个控制器,每个控制器的物理结构和功能与控制器11类似,并且本实施例并不限定控制器11与其他控制器之间,以及任意一个控制器与固态硬盘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。
可选地,控制器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存储。
控制器11属于系统控制器,系统控制器是独立的设备,不同于固态硬盘中的控制芯片。本实施例将固态硬盘的控制芯片称为固态硬盘控制器。如无特别指明,本实施例中的控制器都是指系统控制器。
固态硬盘44包括固态硬盘控制器和存储介质(如图3所示)。其中,固态硬盘控制器用于执行控制器11或控制器22发送的写数据请求或者读数据请求等操作。
固态硬盘控制器中包含闪存翻译层(英文:flash translation layer,FTL)。闪存翻译层用于保存有数据的逻辑地址与实际地址之间的对应关系。因此,闪存翻译层用于将控制器发送的写数据请求或者读数据请求中的逻辑地址转化为固态硬盘中数据的实际地址。数据的逻辑地址是由控制器分配的,具体的,固态硬盘44可以向控制器11发送多个逻辑地址的集合,并且这个集合内包含的多个逻辑地址是连续的。控制器11从这个集合中分配一段子集给目标数据。数据的逻辑地址包括起始逻辑地址和长度,起始逻辑地址指示所述数据的起始位置,长度代表所述数据的大小。数据的实际地址可以是固态硬盘中该数据的物理地址,也可以是在所述物理地址的基础上经过虚拟化,只对固态硬盘控制器可见的地址。该经过虚拟化的实际地址对系统控制器不可见。
存储介质包括一个或多个闪存芯片。每个闪存芯片有自己的控制电路(英文:control circuit),控制电路不同于固态硬盘控制器。从功能上来说,控制电路只能被动地接收固态硬盘控制器的读指令或者写指令或者擦除指令,对指定的页进行读/写,对指定的擦除块进行擦除,不能自主地对页或者擦除块执行其他操作。从硬件结构上来说,虽然控制电路和固态硬盘控制器都是由一个或多个逻辑电路组成,但而固态硬盘控制器所包含的逻辑电路更为复杂。
每个闪存芯片包括若干个擦除块。闪存芯片在读取或写入时是以一个页(英文:page)为基础的,但擦除操作只能以一个擦除块为基础,擦除操作是指将这个擦除块的所有位都设置为“1”。在擦除之前,固态硬盘控制器需要先将这个擦除块中的有效数据复制到另一个擦除块的空白页中去。擦除块中的有效数据是指该擦除块中保存的没有被修改过的数据,这部分数据可能会被读取。擦除块中的无效数据是指该擦除块中保存的已经被修改过的数据,这部分数据不可能会被读取。
每个擦除块包含多个页(英文:page)。固态硬盘在执行写数据请求时,是以页为单位来写数据的。固态硬盘中的擦除块、页以及实际地址对控制器来说是不可见的,因此控制器不能直接访问固态硬盘中的擦除块和页。访问擦除块和页的工作是由固态硬盘控制器来完成的。举例来说,控制器11向固态硬盘控制器发送一个写数据请求。所述写数据请求包括数据的逻辑地址。固态硬盘控制器在接收控制器发送的数据之后,按照接收的时间顺序将所述数据连续写入一个或多个擦除块中。连续写入一个或多个擦除块是指,固态硬盘查找一个空白的擦除块,将数据写入所述空白的擦除块,直至将所述空白的擦除块填满,当所述数据的大小超过擦除块的容量时,固态硬盘控制器再查找下一个空白的擦除块,继续写入。闪存翻译层建立并保存所述逻辑地址与写入所述数据的页的实际地址之间的对应关系。当控制器11向固 态硬盘控制器发送读数据请求,要求读取所述数据时,所述读数据请求中包括所述逻辑地址。固态硬盘控制器根据所述逻辑地址、以及所述逻辑地址与实际地址之间的对应关系读取所述数据,并将该数据发送给控制器11。然而,如同前面所说,除了I/O请求携带的数据本身之后,控制器11在处理这些I/O请求时所生成的元数据也会被发送给固态硬盘进行存储。例如,当存储器111中存储的所有数据(包括I/O请求所携带的数据以及元数据)达到一定阈值时,控制器11将所述存储器111中存储的所有数据发送给固态硬盘。如果固态硬盘控制器按照接收的时间顺序将这些数据以及元数据连续写入一个或多个擦除块中,那么对于每个(或者某个)被写入的擦除块中既包括数据也包括元数据。由于通常情况下,数据被访问修改的频率远低于元数据被访问修改的频率,因此元数据变成无效数据的可能性大于数据变成无效数据的可能性。当一个擦除块中的元数据变成无效数据后,这个擦除块所包含的数据仍然是有效数据。在固态硬盘进行垃圾回收时,就需要将这个擦除块中的有效数据搬移到其他空白擦除块。由此,造成了固态硬盘的写放大问题。
写放大(write amplification,WF)是固态硬盘以及闪存装置中的一个不良现象,具体是指实际写入固态硬盘的数据量大于数据本身的数据量。举例而言,由于闪存颗粒必须先擦除才能写入数据,所以在擦除之前需将原来擦除块中的数据(这里指有效数据)复制到其他擦除块中。那么在执行这些操作时,会导致这些被复制的数据再次被写入其他擦除块(第一次写入是指从外部接收该数据时将其写入一个擦除块),那么该数据实际写入固态硬盘的数据量大于所述数据本身的数据量。由于固态硬盘的擦除次数有限,因此写放大问题会减少固态硬盘的使用寿命。
固态硬盘内部的垃圾回收是由固态硬盘自己完成的,先将各个擦除块中的有效数据复制到空白的擦除块,再擦除原来的擦除块。垃圾回收的触发条件是该固态硬盘的空白的擦除块的数量不足。
本实施例将数据和元数据分开存储到不同的擦除块,那么,对于一个擦除块而言,要么存储数据,要么存储元数据,不能既存储数据又存储元数据。因此,当这个擦除块中存储的是元数据时,这些元数据变成无效数据的概率较高,那么垃圾回收时可以直接对这个擦除块执行擦除操作,无需复制有效数据。当这个擦除块存储的是数据时,由于数据变成无效数据的概率较低,那么垃圾回收时可以不对这个擦除块执行擦除操作,保留其存储的有效数据。因此无论这个擦除块存储的是元数据还是数据,都可以减小写放大。
下面结合图4介绍本实施例提供的数据存储方法,该方法可以应用于图1所示的应用场景中,示例性的,该方法包括以下步骤:
S301,控制器11接收主机发送的写数据指令,将写数据指令中携带的数据写入控制器11的存储器111。
具体的,可以由处理器112通过接口卡110接收主机的数据,将其写入存储器111中。通常情况下,所述数据是携带在写数据指令中发送给控制器11的。需要说明的是,步骤S301中的写数据指令是由主机发送给控制器11的,不同于控制器11发送给固态硬盘44的写数据请求。
另外,如同前面介绍的,处理器112在处理写数据指令时,会产生一些元数据,这些生成的元数据也保存在存储器111中。为了区分数据和元数据,控制器11至少 可以采用以下两种方式识别出数据和元数据。
第一种方式是,控制器11在逻辑上将存储器111划分成至少两个区域,其中一个区域用于存储数据,另一个区域用于存储元数据。这种划分仅仅是逻辑上的,不是物理上。例如,将存储器111所包含的页面分为至少两部分,指定其中一部分页面用于存储数据,指定另一部分页面用于存储元数据。
第二种方式是,控制器11在存储数据以及元数据时,赋予其一个表明数据属性的标签,其中数据的标签用于指示其属性是数据,元数据的标签用于指示其属性是元数据。
S302,当存储器111中的数据和元数据的大小达到预先设定的阈值时,控制器11分别为数据和元数据分配逻辑地址。由于存储器111的容量有限,当其中存储的数据达到所述预先设定的阈值时就需要将存储器111中的数据写入固态硬盘44。
固态硬盘控制器事先发送给控制器11的连续逻辑地址区间为1024KB-2047KB。控制器11接收固态硬盘控制器发送的连续逻辑地址区间之后,将所述连续逻辑地址区间分为两部分,例如,第一部分地址区间是1024KB-2000KB,用于为数据分配逻辑地址。第二部分地址区间是2001KB-2047KB,用于为元数据分配逻辑地址。为了让固态硬盘44能够区分数据和元数据,控制器11可以将所述连续逻辑地址区间的划分情况通知固态硬盘44。需要说明的是,固态硬盘44发送给控制器11的逻辑地址区间可以是连续的,也可以是不连续的,前面描述的连续逻辑地址区间为1024KB-2047KB只是一个示例。
当存储器111中的数据和元数据的大小达到预先设定的阈值时,控制器11需要将这些数据和元数据发送给固态硬盘44以进行持久化存储。在发送之前,控制器11分别为数据和元数据分配逻辑地址。以为数据分配逻辑地址为例,控制器11可以从上述第一部分地址区间中确定一个空闲的地址区间,作为所述数据的逻辑地址。所述空闲的地址区间是所述第一部分地址区间的子集,并且尚未分配给其他数据。同样的,对于元数据,控制器11可以根据所述元数据所在的存储器111的区域或者所述标签确定其是元数据,而不是数据,再从上述第二部分地址区间中确定一个空闲的地址区间,作为元数据的逻辑地址。
S303,控制器11将所述数据以及分配的逻辑地址发送给固态硬盘44。
具体的,控制器11可以将所述数据和为所述数据分配的逻辑地址封装在一个写数据请求中,将所述写数据请求发送给固态硬盘44。如果所述数据的尺寸较大,也可以封装在多个写数据请求中发送给固态硬盘44。
S304,固态硬盘44根据所述分配的逻辑地址识别出接收到的是数据,而不是元数据,将所述数据写入一个或多个擦除块。在步骤S302中曾交代过,控制器11可以所述连续逻辑地址区间的划分情况通知固态硬盘44。由此,固态硬盘控制器可以根据接收的逻辑地址所属的地址区间对数据或者元数据进行识别。例如,当接收的逻辑地址是1024KB-2000KB的子集时,则说明这是数据的逻辑地址。由此,将所述接收的数据写入一个或多个擦除块中。一种情况下,固态硬盘44可以预先设定专门用于存储数据的擦除块,以及专门用于存储元数据的擦除块。另一种情况下,固态硬盘控制器不指定专门用于存储数据的擦除块,如果一个擦除块首次使用时存储的是数据,那么从此以后所述擦除块都用于存储数据。反之,如果一个擦除块首次使 用时存储的是元数据,那么从此以后所述擦除块都用于存储数据。为了方便识别,可以用一个特定的标记标识所述擦除块所存储的是数据或者元数据。
所述数据保存在擦除块中的地址为实际地址。固态硬盘控制器在将所述数据写入所述擦除块之后,将所述分配的逻辑地址与所述实际地址之间的对应关系保存在闪存翻译层中。
S305,控制器11将所述元数据以及分配的逻辑地址发送给固态硬盘44。
与步骤S304类似,控制器11可以将所述元数据和为所述元数据分配的逻辑地址封装在一个或多个写数据请求中,发送给固态硬盘44。
S306,固态硬盘44根据所述分配的逻辑地址识别出接收到的是元数据,而不是数据,将所述元数据写入一个或多个擦除块。
与步骤S304类似,固态硬盘控制器将所述元数据写入预先设定的专门用于存储元数据的擦除块,或者已经保存有元数据的擦除块。
当预设的垃圾回收的条件满足时,固态硬盘会将擦除块中的有效数据复制到空白擦除块,再对原来的擦除块进行擦除操作。这里的预设的垃圾回收的条件包括但不限于:(1)固态硬盘中的空白擦除块的数量低于某一阈值;(2)固态硬盘中所存储的无效数据的数据量达到某一阈值。在垃圾回收的执行过程中,固态硬盘依次检查每个擦除块从而进行有效数据的复制。对于一个擦除块而言,要么存储数据,要么存储元数据,不能既存储数据又存储元数据。因此,当这个擦除块中存储的是元数据时,这些元数据变成无效数据的概率较高,那么垃圾回收时可以直接对这个擦除块执行擦除操作,无需复制有效数据。当这个擦除块存储的是数据时,由于数据变成无效数据的概率较低,那么垃圾回收时可以不对这个擦除块执行擦除操作,保留其存储的有效数据。因此无论这个擦除块存储的是元数据还是数据,都可以减小写放大。
另外,本实施例还提供了另一种数据存储方法,同样可以减小固态硬盘内部的写放大。与图4所示的数据存储方法的不同之处在于,本实施例在将数据写入固态硬盘44时,不对数据的属性进行辨别,而是根据数据的冷热程度写入不同的擦除块中。具体的,请参见图5,图5是所述数据存储方法的流程示意图。如图5所示,该方法包括以下步骤。
S401,控制器11接收主机发送的写数据指令,将写数据指令中携带的数据写入控制器11的存储器111。
所述写数据指令除了携带所述数据之外,还包括所述数据的主机逻辑地址。主机逻辑地址是主机和控制器11可见的地址,而前面描述的逻辑地址是控制器11和固态硬盘44可见的地址。通常情况下,主机逻辑地址包括逻辑起始地址和所述数据的长度。控制器11可以根据所述数据的主机逻辑地址确定所述数据的冷热程度。例如,统计主机对于所述主机逻辑地址的访问频率,当访问频率高于设定的阈值时则认为所述数据是热数据,否则认为所述数据是冷数据。为了对冷热数据进行区分,控制器11可以将冷数据和热数据分别存储至存储器111的不同区域中,或者给冷数据和热数据设置不同的标识,所述标识用于指示所述数据是冷数据或者热数据。该部分与图4所示的S301类似,可参见S301部分的描述。
S402,当存储器111中的所有数据(包括冷数据和热数据)的大小达到预先设 定的阈值时,控制器11分别为冷数据和热数据分配逻辑地址。
为了使固态硬盘44识别出冷数据和热数据,控制器11为冷数据和热数据分别分配不同的逻辑地址,例如,控制器11将固态硬盘44发送的连续逻辑地址区间分为第一部分地址区间和第二部分地址区间,其中第一部分地址区间专用于为冷数据分配逻辑地址,第二部分地址区间专用于为热数据分配逻辑地址。固态硬盘44可以根据它们的逻辑地址所属的地址区间识别冷数据或者热数据。具体的,步骤S402与步骤S302类似,可参见步骤S302的描述。
S403,控制器11将所述冷数据以及分配的逻辑地址发送给固态硬盘44。
S404,固态硬盘44根据所述分配的逻辑地址识别出接收到的是冷数据,将所述冷数据写入一个或多个擦除块。所述一个或多个擦除块专用于存储冷数据,可以是预先设定的,也可以是第一次写入冷数据之后再设置的。
S405,控制器11将所述热数据以及分配的逻辑地址发送给固态硬盘44。
S406,固态硬盘44根据所述分配的逻辑地址识别出接收到的是热数据,将所述热数据写入一个或多个擦除块。热数据所写入的擦除块是专用于存储热数据的擦除块,不同于专用于存储冷数据的擦除块。
本实施例将冷数据和热数据分开存储到不同的擦除块,那么,对于一个擦除块而言,要么存储冷数据,要么存储热数据,不能既存储冷数据又存储热数据。因此,当这个擦除块中存储的是热数据时,这些元数据变成无效数据的概率较高,那么垃圾回收时可以直接对这个擦除块执行擦除操作,无需复制有效数据。当这个擦除块存储的是冷数据时,由于数据变成无效数据的概率较低,那么垃圾回收时可以不对这个擦除块执行擦除操作,保留其存储的有效数据。因此无论这个擦除块存储的是冷数据还是热数据,都可以减小写放大。
当预设的垃圾回收的条件满足时,固态硬盘会将擦除块中的有效数据复制到空白擦除块,再对原来的擦除块进行擦除操作。这里的预设的垃圾回收的条件包括但不限于:(1)固态硬盘中的空白擦除块的数量低于某一阈值;(2)固态硬盘中所存储的无效数据的数据量达到某一阈值。在垃圾回收的执行过程中,固态硬盘依次检查每个擦除块从而进行有效数据的复制。对于一个擦除块而言,要么存储数据,要么存储元数据,不能既存储数据又存储元数据。因此,当这个擦除块中存储的是元数据时,这些元数据变成无效数据的概率较高,那么垃圾回收时可以直接对这个擦除块执行擦除操作,无需复制有效数据。当这个擦除块存储的是数据时,由于数据变成无效数据的概率较低,那么垃圾回收时可以不对这个擦除块执行擦除操作,保留其存储的有效数据。因此无论这个擦除块存储的是元数据还是数据,都可以减小写放大。
另外,如图6所示,本实施例还提供了一种固态硬盘,包括接收模块501和写入模块502。
其中,接收模块501用于接收数据和所述数据的第一逻辑地址,以及接收元数据和所述元数据的第二逻辑地址,所述元数据是管理所述数据的数据,所述第一逻辑地址是第一地址区间的子集,所述第二逻辑地址是第二地址区间的子集。写入模块502用于当确定所述第一逻辑地址和所述第二逻辑地址属于不同的地址区间时,将所述数据写入第一擦除块集合,以及将所述元数据写入第二擦除块集合,所述第 一擦除块集合包括一个或多个擦除块,所述第二擦除块集合包括一个或多个擦除块,所述第一擦除块集合所包含的擦除块与所述第二擦除块集合所包含的擦除块均不相同。
在实现上,接收模块501可以是固态硬盘控制器本身,也可以是固态硬盘控制器的一个功能模块,承担部分固态硬盘控制器的功能,例如接收功能。写入模块502可以是固态硬盘控制器本身,也可以是固态硬盘控制器的一个功能模块,用于将从控制器11发送的数据和元数据写入擦除块,具体可以参考图4的步骤S304、步骤306,以及图5的步骤404、步骤406的描述。
另外,固态硬盘还可以包括发送模块503,用于向控制器11发送一段逻辑地址区间,使得控制器11将这段逻辑地址区间划分为第一地址区间和第二地址区间。发送模块503可以是固态硬盘控制器本身,也可以是固态硬盘控制器的一个功能模块,甚至还可以和接收模块501是同一个功能模块。固态硬盘还可以包括垃圾回收模块504,用于当预设的垃圾回收的条件满足时,擦除所述第一擦除块集合,而不需要对所述第一擦除块集合中的有效数据进行复制。垃圾回收模块504可以是固态硬盘控制器本身,也可以是固态硬盘控制器的一个功能模块,具体的可以参考前面关于垃圾回收的描述。
本领域普通技术人员将会理解,本发明的各个方面、或各个方面的可能实现方式可以被具体实施为系统、方法或者计算机程序产品。因此,本发明的各方面、或各个方面的可能实现方式可以采用完全硬件实施例、完全软件实施例(包括固件、驻留软件等等),或者组合软件和硬件方面的实施例的形式,在这里都统称为“电路”、“模擦除块”或者“系统”。此外,本发明的各方面、或各个方面的可能实现方式可以采用计算机程序产品的形式,计算机程序产品是指存储在计算机可读介质中的计算机可读程序代码。
计算机可读介质包含但不限于电子、磁性、光学、电磁、红外或半导体系统、设备或者装置,或者前述的任意适当组合,如随机访问存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、光盘。
计算机中的处理器读取存储在计算机可读介质中的计算机可读程序代码,使得处理器能够执行在流程图中每个步骤、或各步骤的组合中规定的功能动作。
计算机可读程序代码可以完全在用户的计算机上执行、部分在用户的计算机上执行、作为单独的软件包、部分在用户的计算机上并且部分在远程计算机上,或者完全在远程计算机或者服务器上执行。也应该注意,在某些替代实施方案中,在流程图中各步骤、或框图中各擦除块所注明的功能可能不按图中注明的顺序发生。例如,依赖于所涉及的功能,接连示出的两个步骤、或两个擦除块实际上可能被大致同时执行,或者这些擦除块有时候可能被以相反顺序执行。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,本领域普通技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。

Claims (14)

  1. 一种存储系统,其特征在于,包括控制器和固态硬盘,所述固态硬盘和所述控制器连接,所述固态硬盘包括多个擦除块,其中,
    所述控制器,用于向所述固态硬盘发送数据以及所述数据的第一逻辑地址,所述第一逻辑地址是第一地址区间的子集;
    所述控制器,还用于向所述固态硬盘发送元数据以及所述元数据的第二逻辑地址,所述元数据是管理所述数据的数据,所述第二逻辑地址是第二地址区间的子集;
    所述固态硬盘,用于当确定所述第一逻辑地址和所述第二逻辑地址属于不同的地址区间时,将所述数据写入第一擦除块集合,以及将所述元数据写入第二擦除块集合,所述第一擦除块集合包括一个或多个擦除块,所述第二擦除块集合包括一个或多个擦除块,所述第一擦除块集合所包含的擦除块与所述第二擦除块集合所包含的擦除块均不相同。
  2. 根据权利要求1所述的存储系统,其特征在于,所述控制器位于所述固态硬盘的外部,不同于所述固态硬盘内部的控制器。
  3. 根据权利要求1或2所述的存储系统,其特征在于,
    所述固态硬盘,还用于向所述控制器发送一段逻辑地址区间;
    所述控制器,还用于将所述逻辑地址区间划分为所述第一地址区间和所述第二地址区间;
    所述控制器,还用于将所述第一地址区间和所述第二地址区间发送给所述固态硬盘,以指示所述第一地址区间和所述第二地址区间分别用于为不同属性的数据分配逻辑地址。
  4. 根据权利要求1或2所述的存储系统,其特征在于,所述控制器包括存储器,所述存储器包括第一区域和第二区域,所述第一区域用于存储所述数据,所述第二区域用于存储所述元数据;
    所述控制器还用于从所述第一区域读取所述数据,为所述数据分配所述第一逻辑地址;以及
    所述控制器还用于从所述第二区域读取所述元数据,为所述元数据分配所述第二逻辑地址。
  5. 根据权利要求1或2所述的存储系统,其特征在于,所述数据具有数据标签,所述数据标签用于指示所述数据的属性是数据,所述元数据具有元数据标签,所述元数据标签用于指示所述元数据的属性是元数据;
    所述控制器,还用于根据所述数据标签为所述数据分配所述第一逻辑地址;以及根据所述元数据标签为所述元数据分配所述第二逻辑地址。
  6. 根据权利要求1-5任一所述的存储系统,其特征在于,
    所述固态硬盘,还用于当预设的垃圾回收的条件满足时,擦除所述第一擦除块 集合,在擦除之前不对所述第一擦除块集合中的有效数据进行复制。
  7. 一种固态硬盘,其特征在于,包括固态硬盘控制器和多个擦除块,
    所述固态硬盘控制器,用于接收数据和所述数据的第一逻辑地址,以及接收元数据和所述元数据的第二逻辑地址,所述元数据是管理所述数据的数据,所述第一逻辑地址是第一地址区间的子集,所述第二逻辑地址是第二地址区间的子集;
    所述固态硬盘控制器,还用于当确定所述第一逻辑地址和所述第二逻辑地址属于不同的地址区间时,将所述数据写入第一擦除块集合,以及将所述元数据写入第二擦除块集合,所述第一擦除块集合包括一个或多个擦除块,所述第二擦除块集合包括一个或多个擦除块,所述第一擦除块集合所包含的擦除块与所述第二擦除块集合所包含的擦除块均不相同。
  8. 根据权利要求7的固态硬盘,其特征在于,
    所述固态硬盘控制器,还用于向控制器发送一段逻辑地址区间,所述控制器位于所述固态硬盘的外部;
    所述固态硬盘控制器,还用于接收所述控制器发送的第一地址区间和第二地址区间,所述第一地址区间和所述第二地址区间是由所述逻辑地址区间划分而来的。
  9. 根据权利要求7或8的固态硬盘,其特征在于,
    所述固态硬盘控制器,还用于当预设的垃圾回收的条件满足时,擦除所述第一擦除块集合,在擦除之前不对所述第一擦除块集合中的有效数据进行复制。
  10. 一种数据存储方法,其特征在于,包括:
    控制器向固态硬盘发送数据以及所述数据的第一逻辑地址,所述第一逻辑地址是第一地址区间的子集;
    所述控制器向所述固态硬盘发送元数据以及所述元数据的第二逻辑地址,所述第二逻辑地址是第二地址区间的子集;
    当所述固态硬盘确定所述第一逻辑地址和所述第二逻辑地址属于不同的地址区间时,所述数据写入第一擦除块集合,以及将所述元数据写入第二擦除块集合,所述第一擦除块集合包括一个或多个擦除块,所述第二擦除块集合包括一个或多个擦除块,所述第一擦除块集合所包含的擦除块与所述第二擦除块集合所包含的擦除块均不相同。
  11. 根据权利要求10所述的方法,其特征在于,还包括:
    所述固态硬盘向所述控制器发送一段逻辑地址区间;
    所述控制器将所述逻辑地址区间划分为所述第一地址区间和所述第二地址区间;
    所述控制器将所述第一地址区间和所述第二地址区间发送给所述固态硬盘,以指示所述第一地址区间和所述第二地址区间分别用于为不同属性的数据分配逻辑地址。
  12. 根据权利要求10所述的方法,其特征在于,还包括:
    所述控制器从所述控制器的存储器的第一区域读取所述数据,为所述数据分配所述第一逻辑地址;
    所述控制器从所述控制器的存储器的第二区域读取所述元数据,为所述元数据分配所述第二逻辑地址。
  13. 根据权利要求10所述的方法,其特征在于,所述数据具有数据标签,所述数据标签用于指示所述数据的属性是数据,所述元数据具有元数据标签,所述元数据标签用于指示所述元数据的属性是元数据;所述方法还包括:
    所述控制器根据所述数据标签为所述数据分配所述第一逻辑地址;
    所述控制器根据所述元数据标签为所述元数据分配所述第二逻辑地址。
  14. 根据权利要求10-13任一所述的方法,其特征在于,
    当预设的垃圾回收的条件满足时,所述固态硬盘擦除所述第一擦除块集合,在擦除之前不对所述第一擦除块集合中的有效数据进行复制。
PCT/CN2018/076895 2017-06-30 2018-02-14 一种存储系统、固态硬盘和数据存储方法 WO2019000982A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710527793.6A CN107479825A (zh) 2017-06-30 2017-06-30 一种存储系统、固态硬盘和数据存储方法
CN201710527793.6 2017-06-30

Publications (1)

Publication Number Publication Date
WO2019000982A1 true WO2019000982A1 (zh) 2019-01-03

Family

ID=60596484

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/076895 WO2019000982A1 (zh) 2017-06-30 2018-02-14 一种存储系统、固态硬盘和数据存储方法

Country Status (2)

Country Link
CN (1) CN107479825A (zh)
WO (1) WO2019000982A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107479825A (zh) * 2017-06-30 2017-12-15 华为技术有限公司 一种存储系统、固态硬盘和数据存储方法
JP2019169101A (ja) * 2018-03-26 2019-10-03 東芝メモリ株式会社 電子機器、コンピュータシステム、および制御方法
CN110688323B (zh) * 2018-07-06 2023-11-17 华为技术有限公司 一种系统控制器和系统垃圾回收方法
CN109284233B (zh) * 2018-09-18 2022-02-18 郑州云海信息技术有限公司 一种存储系统的垃圾回收方法及相关装置
CN109753240B (zh) * 2018-11-28 2021-12-21 上海威固信息技术股份有限公司 一种采用垃圾回收机制的数据存储方法
CN109766059A (zh) * 2019-01-09 2019-05-17 郑州云海信息技术有限公司 一种在linux中优化固态硬盘的方法与装置
CN112650691B (zh) * 2019-10-10 2024-05-24 戴尔产品有限公司 基于改变频率的分层数据存储和垃圾回收系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488578A (zh) * 2012-12-28 2014-01-01 晶天电子(深圳)有限公司 虚拟存储设备(vmd)应用/驱动器
US20140215125A1 (en) * 2013-01-29 2014-07-31 Rotem Sela Logical block address remapping
CN104536903A (zh) * 2014-12-25 2015-04-22 华中科技大学 一种按数据属性分类存放的混合存储方法及系统
CN106326133A (zh) * 2015-06-29 2017-01-11 华为技术有限公司 存储系统、存储管理装置、存储器、混合存储装置及存储管理方法
CN107479825A (zh) * 2017-06-30 2017-12-15 华为技术有限公司 一种存储系统、固态硬盘和数据存储方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488578A (zh) * 2012-12-28 2014-01-01 晶天电子(深圳)有限公司 虚拟存储设备(vmd)应用/驱动器
US20140215125A1 (en) * 2013-01-29 2014-07-31 Rotem Sela Logical block address remapping
CN104536903A (zh) * 2014-12-25 2015-04-22 华中科技大学 一种按数据属性分类存放的混合存储方法及系统
CN106326133A (zh) * 2015-06-29 2017-01-11 华为技术有限公司 存储系统、存储管理装置、存储器、混合存储装置及存储管理方法
CN107479825A (zh) * 2017-06-30 2017-12-15 华为技术有限公司 一种存储系统、固态硬盘和数据存储方法

Also Published As

Publication number Publication date
CN107479825A (zh) 2017-12-15

Similar Documents

Publication Publication Date Title
US10592117B2 (en) Memory system and method for controlling nonvolatile memory
WO2019000982A1 (zh) 一种存储系统、固态硬盘和数据存储方法
US10191688B2 (en) Memory system and information processing system
US10761731B2 (en) Array controller, solid state disk, and method for controlling solid state disk to write data
WO2017000658A1 (zh) 存储系统、存储管理装置、存储器、混合存储装置及存储管理方法
KR100923990B1 (ko) 플래시 저장 장치의 특성을 기반으로 한 컴퓨팅 시스템
US10209894B2 (en) Memory system and method for controlling nonvolatile memory
US9116622B2 (en) Storage system having nonvolatile semiconductor storage device with nonvolatile semiconductor memory
US11928053B2 (en) System garbage collection method and method for garbage collection in solid state disk
EP3346387B1 (en) Storage system and system garbage collection method
TWI712881B (zh) 電子機器及其控制方法、電腦系統及其控制方法以及主機之控制方法
US20190121567A1 (en) Data storage device including shared memory area and dedicated memory area
TWI786288B (zh) 儲存裝置、儲存裝置的控制方法及記錄媒體
JP2019194780A (ja) 情報処理装置、データ管理プログラム及びデータ管理方法
TWI826236B (zh) 記憶體系統及控制方法
JP2018160189A (ja) メモリシステム
WO2018041258A1 (zh) 去分配命令处理的方法与存储设备
EP3929753B1 (en) Storage device for classifying data based on stream class number and operating method thereof
CN114610654A (zh) 一种固态存储设备以及向其写入数据的方法
TWI697778B (zh) 資料儲存裝置與資料處理方法
TWI486966B (zh) 快閃記憶體儲存裝置、其控制器與寫入管理方法
US20140281160A1 (en) Non-volatile semiconductor storage apparatus
EP4287028A1 (en) Storage device providing high purge performance and memory block management method thereof
WO2020052216A1 (zh) 一种系统垃圾回收方法和固态硬盘中的垃圾回收方法
KR20230166803A (ko) 높은 퍼지 성능을 제공하는 스토리지 장치 및 그것의 메모리 블록 관리 방법

Legal Events

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

Ref document number: 18824972

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18824972

Country of ref document: EP

Kind code of ref document: A1