WO2021120137A1 - 一种数据存储方法及存储装置 - Google Patents

一种数据存储方法及存储装置 Download PDF

Info

Publication number
WO2021120137A1
WO2021120137A1 PCT/CN2019/126789 CN2019126789W WO2021120137A1 WO 2021120137 A1 WO2021120137 A1 WO 2021120137A1 CN 2019126789 W CN2019126789 W CN 2019126789W WO 2021120137 A1 WO2021120137 A1 WO 2021120137A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
storage medium
storage
threshold
life cycle
Prior art date
Application number
PCT/CN2019/126789
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 PCT/CN2019/126789 priority Critical patent/WO2021120137A1/zh
Priority to CN201980102966.7A priority patent/CN114830077A/zh
Publication of WO2021120137A1 publication Critical patent/WO2021120137A1/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

Definitions

  • This application relates to the storage field, and in particular to a data storage method and storage device.
  • a computer system In a computer system, the execution of each operation depends on different input and output (Input Output, IO) commands (such as read IO commands, write IO commands, etc.).
  • IO input and output
  • a computer system usually consists of a host and a storage device.
  • the host can write data into the storage device by issuing a write IO command.
  • the storage device may be a solid state drive (Solid State Device, SSD), or may be another memory component capable of storing information such as data and instructions.
  • SSD Solid State Device
  • the prior art has some problems. For example, take an SSD as the storage medium. When the SSD includes multiple storage media with different writing rates, the data that needs to be written to the SSD will be randomly stored in a storage medium with a higher or lower writing rate. SSD cannot manage the storage location of data in different storage media, which makes the layout of data in SSD not ideal, which in turn affects the storage performance and lifespan of SSD.
  • the embodiments of the present application provide a data storage method and storage device, so that the SSD can optimize the layout of data in the SSD, and improve the storage performance and life of the SSD.
  • embodiments of the present application provide a data storage method, which can be applied to a storage device including a first storage medium and a second storage medium.
  • the storage device may be a solid state drive (SSD), and the write rate of the first storage medium is higher than the write rate of the second storage medium.
  • the method may include: the solid state drive receives an IO command, and the IO command is used to request the When data is written to the storage device, the IO command also carries the lifetime of the first data; in response to the IO command, when the lifetime of the first data is greater than the first threshold, the solid-state drive writes the first data into the first data. 2.
  • the IO command may be initiated by the host to the solid state drive.
  • the SSD can know the life cycle of the data processed by the IO command, so that the SSD can write the data to the corresponding storage medium, for example, directly write data with a longer life cycle
  • NAND which can store data for a long time
  • the SSD can optimize the layout of data in the SSD and improve the storage performance and life of the SSD.
  • the SSD when the life cycle of the first data is less than the second threshold, the solid-state hard disk writes the first data into the first storage medium, and the second threshold is less than the first threshold.
  • the SSD can write data with a short life cycle into the NVM, so that the data can be replaced or deleted quickly after the end of the life cycle, further enabling the SSD to optimize the data layout in the SSD and improve the storage of the SSD Performance and life.
  • the IO command also carries a deadline.
  • the deadline is used to indicate the response time delay of the solid-state hard disk returning the IO command processing result to the host.
  • the solid-state drive When the life cycle of the first data is greater than the first threshold, the solid-state drive writes the first data to the second storage medium, including: when the life cycle of the first data is greater than the first threshold and the deadline is greater than the third threshold, the solid-state The hard disk writes the first data into the second storage medium.
  • the deadline is carried in the IO command, so that the SSD can know the delay requirements for returning the IO command, and write data with lower delay requirements into the NAND that can store data for a long time, further enabling the SSD to be optimized
  • the layout of data in the SSD improves the storage performance and lifespan of the SSD.
  • the solid state drive when the life cycle of the first data is greater than the second threshold and less than the first threshold, or the expiration time of the first data is less than the third threshold, the solid state drive writes the first data to the first storage medium .
  • the SSD can cache data that meets the above conditions into the NVM, and appropriately increase the processing speed of these data, further enabling the SSD to optimize the data layout in the SSD, and improve the storage performance and life of the SSD.
  • the solid-state hard disk when the first storage medium is fully occupied, the solid-state hard disk writes the second data stored in the first storage medium into the second storage medium; wherein, the second data is stored in the first storage medium.
  • the data with the longest life cycle in the data when the NVM is fully occupied, the SSD can write the longest life cycle data into the NAND that can store data for a long time, further enabling the SSD to optimize the data layout in the SSD, and improve the storage performance and life of the SSD .
  • the solid state drive divides the physical storage block of the second storage medium into multiple physical storage block groups, and different physical storage block groups correspond to different life cycle intervals; the solid state drive writes the first data
  • the second storage medium includes: the solid state drive determines the first physical storage block group according to the life cycle of the first data, wherein the life cycle of the first data falls within the life cycle interval corresponding to the first physical storage block group; the solid state drive The first data is written into the first physical storage block group.
  • SSD can configure different blocks for data with different life cycles, so that data with similar life cycles can be written into the same block, so that when the life cycles of these data ends, the entire block can be set to be invalid. There is no need to filter the data in the block whose life cycle has not yet ended and transfer these data.
  • the solid-state drive divides the physical storage block of the second storage medium into multiple physical storage block groups, including: according to the concurrent write bandwidth of the second storage medium, the second storage medium and The number of physical storage blocks corresponding to the concurrent write bandwidth is divided into multiple physical storage block groups, and the concurrent write bandwidth is the maximum number of physical storage blocks that can perform data writing at the same time as the second storage medium.
  • the SSD can allocate the number of blocks for data whose life cycle falls into different intervals according to the concurrent write bandwidth, so that the corresponding data in each life cycle interval can be written into the block in parallel, which improves the efficiency of data writing.
  • an embodiment of the present application provides a storage device that includes a controller, a first storage medium, and a second storage medium, wherein the writing rate of the first storage medium is higher than that of the second storage medium
  • the controller is used to receive input and output (IO) commands, the IO commands are used to request the first data to be written to the storage device, and the IO commands also carry the lifetime of the first data; the controller It is also used to write the first data into the second storage medium when the life cycle of the first data is greater than the first threshold.
  • IO input and output
  • the controller is further configured to write the first data into the first storage medium when the life cycle of the first data is less than the second threshold, and the second threshold is less than the first threshold.
  • the IO command also carries a deadline; the controller is also used for when the life cycle of the first data is greater than the first threshold, and the deadline is greater than the third threshold, the first data Write to the second storage medium.
  • the controller is also used to write the first data when the life cycle of the first data is greater than the second threshold and less than the first threshold, or the expiration time of the first data is less than the third threshold The first storage medium.
  • the controller is also used to write the second data stored in the first storage medium into the second storage medium when the first storage medium is fully occupied; wherein, the second data is the first storage medium.
  • the controller is also used to divide the physical storage block of the second storage medium into multiple physical storage block groups, and different physical storage block groups correspond to different life cycle intervals; the controller is also It is used to determine the first physical storage block group according to the life cycle of the first data, and the life cycle of the first data falls within the life cycle interval corresponding to the first physical storage block group; the controller sets the first physical storage block group to Data is written into the first physical storage block group.
  • the controller is also used to divide the number of physical storage blocks corresponding to the concurrent write bandwidth in the second storage medium into multiple physical storage block groups according to the concurrent write bandwidth of the second storage medium, and concurrently
  • the write bandwidth is the maximum number of physical storage blocks that can perform data writing at the same time as the second storage medium.
  • the embodiments of the present application provide a computer-readable storage medium containing instructions that, when the instructions run on a computer, cause the computer to execute the first aspect or any of the first aspects.
  • the computer-readable storage medium is a non-volatile storage medium.
  • the embodiments of the present application provide a computer program product, which when running on a computer, enables the first aspect or any one of the possible implementation methods of the first aspect to be executed.
  • embodiments of the present application provide a controller, which is coupled with a memory.
  • the memory may include the computer-readable storage medium as provided in the third aspect.
  • an embodiment of the present application provides a chip, including: a processing circuit and an interface, the processing circuit is used to call from a storage medium and run a computer program stored in the storage medium to execute the first aspect or the first aspect. Steps executed by the processor in any possible implementation manner of the aspect.
  • the aforementioned storage medium may be a computer-readable storage medium as provided in the third aspect.
  • an embodiment of the present application provides a computer system.
  • the computer system may include a host and a storage device.
  • the storage device may be any storage device in the second aspect and its possible designs.
  • the host is used to send input and output (IO) commands for requesting to write data to the storage device to the storage device
  • the data processor device is used to execute any of the above-mentioned first aspect and possible designs in response to the IO command.
  • IO input and output
  • Figure 1 is a schematic diagram of the composition of a NAND
  • FIG. 2 is a schematic diagram of the composition of a storage system provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of the composition of an SSD provided by an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a lifetime and deadline provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of data writing provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of yet another data writing provided by an embodiment of the application.
  • FIG. 8 is a schematic flowchart of another data storage method provided by an embodiment of this application.
  • FIG. 9 is a schematic flowchart of another data storage method provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of the composition of a storage device provided by an embodiment of the application.
  • FIG. 11 is a schematic diagram of the composition of another storage device provided by an embodiment of the application.
  • SSD is widely used as a storage device with excellent performance.
  • NAND flash NAND flash
  • FIG. 1 is a schematic diagram of a NAND composition.
  • each NAND is composed of multiple wafers (Die), each Die has multiple physical memory blocks (Block), and each Block has multiple pages (Page).
  • Die wafers
  • Block physical memory blocks
  • Page pages
  • the SSD can write the data to different pages to achieve permanent storage of the data.
  • NVM non-volatile memory
  • PCRAM phase Change Random Access Memory
  • MRAM magnetoresistive Random Access Memory
  • RRAM resistive random access memory
  • phase is a concept in physical chemistry, which refers to multiple states where the chemical properties of an object are exactly the same, but the physical properties are different.
  • water has three different states, namely water vapor (vapor phase), liquid water (liquid phase) and solid water (solid phase).
  • phase change such as the transformation of water from a liquid state to a solid state.
  • phase transitions of substances that are not only the three phases of gas, liquid, and solid.
  • MRAM is a non-volatile memory technology that is expected to replace flash memory and dynamic random access memory (Dynamic Random Access Memory, DRAM) as a new general-purpose memory.
  • the MRAM memory is composed of a transistor and a magnetic tunnel junction (MTJ). Among them, there are three layers inside the MTJ, the top layer is the free layer, the middle is the tunnel junction, and the bottom is the fixed layer.
  • the polarization direction of the magnetic field of the free layer can be changed, while the direction of the magnetic field of the fixed layer is fixed. When the direction of the magnetic field of the free layer and the fixed layer are parallel, the memory cell exhibits low resistance; when the direction of the magnetic field is opposite, it exhibits high resistance.
  • the MRAM memory determines whether the stored data is 0 or 1 by detecting the resistance of the memory cell. Therefore, MRAM can quickly read data without changing the memory state.
  • RRAM is currently the hottest new storage medium that is very likely to replace flash memory. In theory, memory is not new.
  • Professor Cai Shaotang of the University of California at Berkeley published a paper entitled “Memristor-The Missing Circuit Element”, and proposed the theoretical basis of memristive. While studying the relationship between current, voltage, charge, and magnetic flux, Cai Jiao concluded that in addition to capacitance, inductance, and resistance, electronic circuits should also have a fourth basic element-memristive. Memristive can control the change of its resistance through the change of current.
  • RRAM can achieve a latency of about 100ns, the read latency is one order of magnitude higher than that of flash memory devices, and the write latency is increased by 3 orders of magnitude; 2).
  • RRAM Endurance can reach 1E6-1E12, more than 2 orders of magnitude higher than flash memory devices; 3) Retention: RRAM Retention can reach 10 years, which is 10 times that of flash memory devices; 4) Density and capacity: RRAM can achieve less than 5nm , Supports three-dimensional (3D) stacking, supports multibit, and NAND will stop at about 15nm; 5), RRAM supports byte addressing, which can solve the problem of random writing of small data in storage.
  • the data written to the SSD is randomly mixed and stored.
  • the storage media with a higher write rate may be stored in the storage media with a higher write rate, thereby reducing the higher write rate.
  • some data with a higher frequency of use will be stored in a storage medium with a lower write rate, so that these data cannot be quickly recalled during the process of frequent use (such as reading, etc.). This makes the layout of the data in the SSD not ideal, which in turn affects the storage performance and lifespan of the SSD.
  • embodiments of the present application provide a data storage method and storage device, so that the SSD can optimize the layout of data in the SSD, and improve the storage performance and life of the SSD.
  • FIG. 2 is a schematic diagram of the composition of a storage system provided by an embodiment of this application.
  • the storage system may include a host (Host) 210 and one or more SSD 220.
  • each SSD 220 of the one or more SSDs 220 may include a controller (Controller) 221 and a plurality of storage media 222.
  • the host 210 may be a host using the SSD 220, or a server or an array using the SSD 220.
  • the foregoing multiple storage media 222 may be NAND and/or NVM.
  • the ratio of the capacity of the NVM to the NAND in the SSD 220 can be flexibly selected according to specific usage scenarios, which is not limited in the embodiment of the present application.
  • the host 210 and the controller 221 of each of the one or more SSDs 220 pass through the Small Computer System Interface (SCSI)/Non-Volatile Memory Express , NVMe).
  • the host 210 may send a write IO command to the controller 221. After the controller 221 receives the write IO command, it can write the data processed by the write IO command into the storage medium 222.
  • the host 210 may also send a read IO command to the controller 221. After the controller 221 receives the read IO command, according to the address in the read IO command, it can find out whether the data to be read is stored in its cache.
  • the controller 221 and the storage medium 222 may be integrated in one storage device (SSD as shown in FIG. 2), or may be located in two independent devices.
  • the positional relationship of the medium 222 is subject to any limitation.
  • FIG. 3 shows a schematic diagram of the composition of the SSD 220 in FIG. 2.
  • the SSD 220 may include a controller 221, a first storage medium (such as NVM), and a second storage medium (such as NAND).
  • the controller 221 may receive the IO command sent by the host 210, and write the data processed by the IO command request to the first storage medium or the second storage medium, or read the data requested by the IO command from the first storage medium or the second storage medium.
  • the storage medium is read and sent to the host 210.
  • the NAND in the SSD 220 may be a three-dimensional TLC (3 dimensional Trinary-Level Cell, 3D TLC), or a three-dimensional QLC (3 dimensional Quad-Level Cell, 3D QLC) or other NAND.
  • the NVM in the SSD 220 may be RRAM or other forms of NVM such as PCRAM or MRAM. It is understandable that NVM has better read and write performance, can respond to IO commands faster, and can process data requested to be processed by IO commands faster at the same time.
  • the data storage methods provided in the embodiments of the present application can all be implemented based on the storage system shown in FIG. 2. It should be noted that in the above description in FIG. 2, the storage device is an SSD as an example for description. In practical applications, the storage device involved in the data storage method may also be other memory components capable of storing data, instructions and other information. The embodiments of the application are not limited here.
  • the SSD by carrying the lifetime in the IO command, the SSD can know the lifetime of the data processed by the IO command, so that the SSD can write the data into the corresponding storage medium. Furthermore, by carrying a deadline in the IO command, the SSD can efficiently arrange the storage order or the storage sequence of the data to ensure that the SSD can return the storage result of the data to the host within a specified time. At the same time, the SSD can also store data with similar lifetimes in the same physical block according to the lifetime, so that when the SSD finds a physical block with invalid data when reclaiming a blank block, it can directly erase the entire physical block. , Instead of migrating the valid data on the physical block.
  • the SSD includes two storage media, NAND and NVM.
  • the IO command is a write request, and the IO command includes the lifetime and expiration time. (deadline) is an example for detailed explanation.
  • FIG. 4 is a schematic flowchart of a data storage method provided by an embodiment of this application. As shown in FIG. 4, the method may include S401-S402.
  • the host issues an IO command for requesting to write the first data to the SSD.
  • the IO command can carry the lifetime and deadline of the first data.
  • the lifetime carried in the IO command may be set by the host according to the lifetime of the first data processed by the computer system for the IO command request.
  • the lifetime can be used to indicate the length of time that the first data is valid data. That is, within the lifetime, the first data is valid, and outside the lifetime, the first data is invalid and can be overwritten by other valid data or deleted.
  • the lifetime can be indicated by the structure of "field C + field B + field A".
  • the field A can be a 1-bit number (such as 0 or 1), which is used to indicate whether the data becomes invalid data after the lifetime of the data expires. For example, when field A is set to 1, the corresponding data will automatically become invalid data after expiration, which can be automatically eliminated by SSD. When field A is set to 0, the corresponding data will not automatically become invalid data after expiration.
  • Field B may include 2 bits of data, which is used to indicate the unit corresponding to the lifetime. For example, use 00 to indicate minutes, 01 to indicate hours, 10 to indicate days, and 11 to indicate months.
  • the field C may include N bits of data, which is used to indicate the duration of the lifetime in the unit indicated by the field B. Wherein, N is an integer greater than or equal to 1, and the value of N can be determined according to the number of bytes included in the command structure corresponding to the IO command.
  • an IO command requests that video surveillance data be written to the storage medium of the SSD, and the video surveillance data generally has a set storage duration. If the duration can be 3 months, the host can use the lifetime of the IO command The field C of is set to 11 (that is, the binary number of 3), and the field B of lifetime is set to 11 (that is, the unit of lifetime is month). At the same time, the host can set the lifetime field A according to whether the data needs to be actively eliminated by the SSD, so that the SSD can actively set it as invalid data after the data lifetime expires.
  • the IO command requests to write host metadata or user data to the storage medium of the SSD. Since the lifetime of this kind of data is short and will be rewritten more frequently, the host can set the lifetime field B and field C according to the speed of metadata update, for example, set it to 1 hour or 1 day.
  • the field A can be set to 1 or 0.
  • the lifetime carried in the IO command can be set by the host according to the delay requirement of the computer system for the IO command.
  • deadline is used to indicate the response delay of returning the processing result of the IO command. That is, the IO command needs to be executed within the deadline, and the processing result is returned to the host.
  • the processing result may be the IO callback result after the IO command is executed.
  • the deadline can be indicated by the structure of "field E + field D".
  • the field D may include 2 bits of data, which is used to indicate the unit of the deadline. For example, use 00 to indicate microseconds, 01 to indicate milliseconds, and 10 to indicate seconds.
  • the field E may include M bits of data, which is used to indicate the duration of the deadline in the unit indicated by the field D.
  • M is an integer greater than or equal to 1, and the value of M can be determined according to the number of bytes included in the command structure corresponding to the IO command.
  • the IO command is a request to write the data generated internally during the operation of the array/server into the storage medium of the SSD. Since the data is not sensitive to the delay requirement, the host can set the deadline of the IO command to a larger one. Numerical value, such as the deadline in milliseconds (ms) to seconds (s). For another example, the IO command requests that host metadata or user data be written to the storage medium of the SSD, and the host metadata or user data needs to be updated to the storage medium of the SSD as soon as possible, that is, the data is more sensitive to latency requirements. Then the host can set the deadline of the IO command to a small value, such as a deadline of microseconds (us) to milliseconds (ms).
  • FIG. 5 shows a schematic diagram of the data structure of lifetime and deadline.
  • the length of the data structure in the command structure of the IO command as 64 bits, and each row corresponds to 4 bytes as an example.
  • some marks have been set in the 0th row and the 1st row. According to these marks, the SSD can complete the action of writing the data corresponding to the IO command into the storage medium. For example, in line 0, byte (Byte) 0 is marked with Opcode, and the first two bits of byte 1 (that is, the 8th and 9th) indicate whether the command is in a combined operation.
  • the last two digits of byte 1 (ie, the 14th and 15th) are marked with PSDT (PSDT: PRP or SGL for Data Transfer, indicating the organization of the memory corresponding to the command)
  • PSDT PSDT
  • SGL SGL for Data Transfer
  • the command identifier (Command Identifier) is marked in byte 2 and byte 3.
  • bytes 0-4 are marked with a Namespace Identifier.
  • two bytes (8 bits) of the 4 bytes may be used to indicate the deadline, and the other two bytes may be used to indicate the lifetime.
  • 16 bits in byte 0 and byte 1 are used to indicate deadline, and 16 bits in byte 2 and byte 3 are used to indicate lifetime.
  • the 14th and 15th bits can be used to indicate the deadline field D
  • the 0th to 13th bits can be used to indicate the deadline field E. If byte 0 and byte 1 are set to 0000000011110001, the corresponding deadline is 11100 milliseconds (binary), that is, 60 milliseconds (decimal).
  • the 16th bit can be used to indicate the lifetime field C
  • the 17th and 18th bits can be used to indicate the lifetime field B
  • the 19th to 31st bits can be used to indicate the lifetime field A.
  • deadline is set to the default unit of 100 microseconds
  • lifetime is set to The default unit is 1 minute, and the corresponding bit only needs to be set to the duration in the above default unit.
  • the SSD receives the IO command, and writes the first data processed by the IO command request to the first storage medium or the second storage medium according to the deadline and lifetime carried in the IO command.
  • the first storage medium may be NVM
  • the second storage medium may be NAND
  • the SSD can determine the valid duration of the data processed by the IO command, and the SSD can write data with a longer valid duration into the NAND, and write data with a shorter valid duration Write to NVM.
  • the SSD can determine the delay requirements of the data processed by the IO command, and the SSD can write the data with higher delay requirements into the NVM, which will reduce the delay requirements. Data is written to NAND.
  • the SSD may determine the lifetime of the data (that is, the first data) requested by the IO command according to the lifetime carried in the IO command.
  • the lifetime of the first data is long (for example, the first data is video surveillance data), that is, the first data is valid for a long period of time
  • the SSD can directly write the first data into the NAND.
  • the lifetime of the first data is short (for example, the first data is host metadata or user data), that is, the first data will be updated in a short time, or it will become invalid data after a short time. Then the SSD can write the first data into the NVM, so that subsequent updates and other operations on the first data can be performed faster.
  • the controller receives an IO command, according to the lifetime carried by the IO command, when the lifetime is greater than a first threshold (for example, f hours), the first data is written into the NAND.
  • a first threshold for example, f hours
  • the second threshold such as g minutes
  • the first data is written into the NVM.
  • the second threshold is less than the first threshold.
  • the SSD may also write the first data into the NVM or NAND according to the lifetime and deadline carried by the IO command.
  • the first data can be cached in the NVM.
  • the method of caching may be: temporarily writing these data to the NVM, and when the NVM is fully occupied, select the data with the largest lifetime from the data stored in the NVM and write it to the NAND.
  • the first threshold, the second threshold, and the third threshold in the foregoing example may be flexibly set according to different usage scenarios.
  • the lifetime of the data may be minutes or hours.
  • the first threshold may be set to hours in units, and the second threshold may be set in minutes.
  • the duration of the unit is a duration of milliseconds, and the third threshold can be set to a duration in seconds or milliseconds.
  • the lifetime of the data is related to the attributes of the data. Therefore, the above-mentioned first threshold and the second threshold may also be set according to the attributes of the data. For example, when the data is video surveillance data, because the data has the property of longer storage time, that is, the lifetime of the data is longer, therefore, in the use scenario of the data, the first threshold or the second threshold can be set Set to a larger duration. For another example, when the data is host metadata, because the data has the attribute of shorter storage time, that is, the lifetime of the data is shorter, therefore, in the use scenario of the data, the first threshold or the second threshold can be set. The threshold is set to a smaller duration. Similarly, the deadline of the data is related to the attributes of the data. Therefore, in different data usage scenarios, the setting of the above-mentioned third threshold may be determined according to the attributes of the data.
  • the setting of these thresholds may be preset in the SSD, or may be set by the user in different scenarios.
  • the embodiments of the application are not limited here.
  • S402 in FIG. 4 may include S801-S803 as shown in FIG. 8.
  • the SSD receives an IO command.
  • the following S802 is executed; when the lifetime is less than the second threshold, or the lifetime is greater than the second threshold and less than the first threshold, or the deadline is less than the third threshold, the following S803 is executed.
  • the host may also only set the deadline of the IO command. Then the SSD can determine the delay requirement of the first data processed by the IO command according to the deadline carried in the IO command.
  • the first data is sensitive to time delay (for example, the first data is host metadata or user data), that is, the IO command needs to be executed as soon as possible and the execution result is returned to the host, the storage device can write the first data Enter the NVM with a faster write rate, and return the execution result to the host.
  • the execution result can be an IO callback message of an IO command, which is used to indicate that the data requested by the hostIO command has been written.
  • the storage device When the first data is not sensitive to delay (for example, the first data is data generated internally during the operation of the array/server), that is, the IO command does not need to be executed in a short time and the execution result is returned to the host, the storage device The first data can be written into NAND with a slower writing rate, and the execution result can be returned to the host.
  • write amplification When data is written to NAND, the existing data needs to be erased and then written, and a large amount of user data and metadata needs to be migrated during this process, so that when writing data, the actual amount of data processed by the SSD is much larger than The amount of data to be written, this process can also be called write amplification. It is understandable that due to the existence of write amplification, it will increase a lot of data processing pressure on the SSD, and will also affect the life of the SSD's firmware. In order to solve this problem, further, when performing data writing to NAND in the embodiment of the present application, data with similar lifetimes can be written to the same block according to the difference in the lifetime carried by the IO command, without changing the existing hardware. Down, reduce the write amplification.
  • the above S802 may include the following S901-S902.
  • data with different lifetimes are divided into 16 groups of blocks, and each group of blocks can correspond to a lifetime interval.
  • the lifetime intervals corresponding to 16 groups of blocks can be (0,24h), (1d, 2d), (2d, 4d), (4d, 8d), (8d, 16d), (16d, 32d), (32d, 2m], (2m, 4m), (4m, 6m), (6m, 8m), (8m, 10m), (10m, 12m), (1y, 2y), (2y, 3y), (3y, 4y) , [4y, ⁇ ).
  • h represents the unit of hours
  • d represents the unit of days
  • m represents the unit of months
  • y represents the unit of years.
  • the process of dividing block groups into multiple lifetimes may be implemented in multiple methods, and an exemplary description will be given below.
  • block groups can be divided according to the concurrent write bandwidth of NAND.
  • the concurrent write bandwidth of NAND is the maximum number of blocks that can perform data write at the same time. For example, if the concurrent write bandwidth of NAND is 64 and the lifetime interval is 16 as an example, a maximum of 4 blocks can be allocated to the data corresponding to each lifetime interval, so that the data of the lifetime included in 16 different intervals can be written to NAND in parallel. in.
  • a corresponding number of blocks may be allocated to data corresponding to different lifetime intervals according to the IO write bandwidth of the lifetime interval.
  • the IO write bandwidth of the first group of data corresponding to lifetime interval 1 is a M/s
  • the IO write bandwidth of the second group of data corresponding to lifetime interval 2 is 3 a M/s
  • the block allocated for the second group of data The number can be 3 times the number of blocks allocated for the first set of data.
  • the IO write bandwidth size of the lifetime interval and the write rate of each block may be combined to allocate a corresponding number of blocks to data corresponding to different lifetime intervals.
  • the IO write bandwidth of the first group of data corresponding to lifetime interval 3 is a M/s
  • the IO write bandwidth of the second group of data corresponding to lifetime interval 4 is 3a M/s. s as an example.
  • 1 block can be allocated to both the first group of data and the second group of data to increase the utilization rate of the block; if b is greater than 2a and b is less than 3a, then 1 can be allocated to the first group of data One block, two blocks are allocated to the second group of data, which can also improve the utilization rate of the block.
  • a block can be allocated to each group of data in N groups of data, and the remaining storage space of the block can be monitored.
  • the storage space of 1 block allocated for a group of data has been allotted Occupied or will be fully occupied, a new block is allocated to the group of data to store other data in the group of data.
  • the above methods for dividing blocks are merely exemplary descriptions. In the embodiments of this application, the above methods can be used alone, or multiple methods can be used in combination at the same time, and the embodiments of this application are not limited here. .
  • the block division strategy can also be adjusted periodically, or it can be triggered after a major change in the IO model or the life cycle of the data is detected.
  • the controller of the SSD may write the first data into the block group allocated to it in the NAND according to the interval of the lifetime carried by the IO command.
  • the IO command is taken as an example of a write command.
  • the data storage method provided in the embodiment of the present application can also be used in a scenario where the IO command is a read command.
  • the host can set the deadline in the read IO command before issuing the read IO command, so that the SSD can determine how long the data to be read needs to be returned to the host according to the deadline carried in the read IO command. So that when the host needs to read some data as soon as possible, the SSD can respond efficiently.
  • the SSD can determine which data needs to be written to the NVM with a higher write rate but limited capacity according to the lifetime and/or deadline carried in the IO command, and which data needs to be written to the NAND with a larger capacity .
  • This enables the SSD to independently optimize the layout of the stored data, realize the hierarchical storage of data, simplify the interaction process between the host and the SSD, and increase the lifespan of the SSD.
  • the SSD can efficiently arrange the storage order or the storage sequence of the data according to the deadline carried in the IO command to ensure that the SSD can return the storage result of the data to the host within a specified time.
  • SSD can write data with similar lifetimes to the same block. Without changing the existing hardware, when the SSD is reclaiming blank blocks, when it finds a physical block with invalid data, it can directly write the entire block. The physical block can be erased without migrating the valid data on the physical block.
  • the embodiment of the present application may divide the above-mentioned SSD into functional modules according to the above-mentioned method examples.
  • the SSD may be a storage device, and the storage device may divide each functional module corresponding to each function, or divide two or more functions into one. Integrated in a processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. It should be noted that the division of modules in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 10 is a schematic diagram of the composition of a storage device provided by an embodiment of this application.
  • the storage device can be used to execute any data storage method provided in the embodiments of the present application, such as the data storage method shown in FIG. 4 or FIG. 8 or FIG. 9.
  • the storage device may include a receiving unit 1001, a writing unit 1002, a first storage medium, and a second storage medium.
  • the writing rate of the first storage medium is higher than that of the second storage medium. The write rate.
  • the receiving unit 1001 is configured to receive an input and output (IO) command, the IO command is used to request the first data to be written to the storage device, and the IO command includes the life cycle of the first data (lifetime). To indicate the length of time that the first data is valid data.
  • the receiving unit 1001 may be used to perform S402 as shown in FIG. 4 or S801 as shown in FIG. 8.
  • the writing unit 1002 is configured to write the first data into the second storage medium when the life cycle of the first data is greater than the first threshold.
  • the writing unit 1002 may be used to execute S402 as shown in FIG. 4 or S802 as shown in FIG. 8.
  • the writing unit 1002 is further configured to write the first data to the first storage medium when the life cycle of the first data is less than the second threshold, and the second threshold is less than the first threshold.
  • the writing unit 1002 may also be used to execute S803 as shown in FIG. 8.
  • the IO command further includes a deadline (deadline), and the deadline is used to indicate the response delay of returning the processing result of the IO command.
  • a deadline deadline
  • the writing unit 1002 is further configured to write the first data into the second storage medium when the life cycle of the first data is greater than the first threshold and the expiration time is greater than the third threshold.
  • the writing unit 1002 may also be used to execute S802 as shown in FIG. 8.
  • the writing unit 1002 is further configured to write the first data into the first data when the life cycle of the first data is greater than the second threshold and less than the first threshold, or the expiration time of the first data is less than the third threshold. Storage medium.
  • the writing unit 1002 is further configured to write the second data stored in the first storage medium into the second storage medium when the first storage medium is fully occupied; wherein, the second data is the first storage medium
  • the writing unit 1002 may also be used to perform the data transfer process as shown by the dotted line in FIG. 9.
  • the device further includes: a dividing unit 1003; a dividing unit 1003, configured to divide the physical storage block of the second storage medium into multiple physical storage block groups, and different physical storage block groups correspond to different life cycle intervals .
  • the dividing unit 1003 may also be used to execute S901 as shown in FIG. 9.
  • the writing unit 1002 is further configured to write the first data into the first physical storage block group according to the life cycle of the first data, and the life cycle interval corresponding to the first physical storage block group includes the life cycle of the first data.
  • the dividing unit 1003 may also be used to perform S902 as shown in FIG. 9.
  • the dividing unit 1003 is further configured to divide the number of physical storage blocks corresponding to the concurrent writing bandwidth in the second storage medium into multiple physical storage block groups according to the concurrent writing bandwidth of the second storage medium, where the concurrent writing bandwidth is The maximum number of physical storage blocks that can perform data writing at the same time as the second storage medium.
  • the receiving unit 1001, the writing unit 1002, and the dividing unit 1003 can be implemented by a certain pin of the chip where the storage device is located or a certain circuit on it.
  • FIG. 11 is a schematic block diagram of another storage device provided in an embodiment of this application.
  • the storage device can be used to execute any data storage method provided in the embodiments of the present application, such as the data storage method shown in FIG. 4 or FIG. 8 or FIG. 9.
  • the storage device may include a controller 1101, a first storage medium 1102, and a second storage medium 1103.
  • the writing rate of the first storage medium is higher than the writing rate of the second storage medium.
  • the first storage medium may be NVM
  • the second storage medium may be NAND.
  • the controller 1101 can be used to implement the receiving unit 1001, the writing unit 1002 and related control functions as shown in FIG. 10.
  • the controller 1101 is configured to receive an input and output IO command, the IO command is used to request the first data to be written to the storage device, and the IO command also carries the life cycle of the first data; the controller 1101 also It is used to write the first data to the second storage medium 1103 when the life cycle of the first data is greater than the first threshold.
  • the controller 1101 is further configured to write the first data to the first storage medium 1102 when the life cycle of the first data is less than a second threshold, and the second threshold is less than the first threshold.
  • the IO command further includes an expiration time; the controller 1101 is further configured to write the first data when the life cycle of the first data is greater than the first threshold and the expiration time is greater than the third threshold The second storage medium 1103.
  • controller 1101 is further configured to: when the life cycle of the first data is greater than the second threshold and less than the first threshold, or the expiration time of the first data is less than the third threshold, Data is written into the first storage medium 1102.
  • the controller 1101 is further configured to write the second data stored in the first storage medium 1102 into the second storage medium 1103 after the first storage medium 1102 is fully occupied; wherein, the second storage medium 1103 is The data is the data with the longest life cycle among the data stored in the first storage medium 1102.
  • the controller 1101 is further configured to divide the physical storage block block of the second storage medium 1103 into multiple physical storage block groups, and different physical storage block groups correspond to different life cycle intervals; the controller 1101 is also configured to According to the life cycle of the first data, determine the first physical storage block group, and the life cycle of the first data falls within the life cycle interval corresponding to the first physical storage block group; the controller 1101 writes the first data Enter the first physical storage block group.
  • the controller 1101 is further configured to divide the number of physical storage blocks corresponding to the concurrent write bandwidth in the second storage medium 1103 into multiple physical storage block groups according to the concurrent write bandwidth of the second storage medium 1103 ,
  • the concurrent write bandwidth is the maximum number of physical storage blocks that the second storage medium 1103 can perform data writing at the same time.
  • An embodiment of the present application also provides a controller, which may include a processing circuit and an interface.
  • the processing circuit is used to call and run the computer program stored in the computer-readable storage medium from the computer-readable storage medium storing instructions to execute the data storage method involved in the above description.
  • the controller may be the controller 1101 as shown in FIG. 11.
  • the embodiments of the present application also provide a data processing system.
  • the processing system may be a computer system.
  • the system includes any of the foregoing storage devices.
  • the system further includes storage devices of a first storage medium and a second storage medium.
  • the write rate of the first storage medium is higher than the write rate of the second storage medium.
  • the first storage medium is NVM and the second storage medium is NAND.
  • the data processing system can process data according to the data storage method shown in FIG. 4 or FIG. 8 or FIG. 9.
  • the program can be stored in a computer-readable storage medium.
  • the aforementioned storage medium may be a read-only memory, a random access memory, and the like.
  • the aforementioned processing unit or processor may be a central processing unit, a general-purpose processor, an application specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), and a field programmable gate array (field programmable gate array).
  • FPGA field programmable gate array
  • the embodiments of the present application also provide a computer program product containing instructions, which when the instructions run on a computer, cause the computer to execute any one of the methods in the foregoing embodiments.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part.
  • the computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • computer instructions can be transmitted from a website, computer, server, or data center through a cable (such as Coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (such as infrared, wireless, microwave, etc.) transmission to another website site, computer, server or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or may include one or more data storage devices such as a server or a data center that can be integrated with the medium.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
  • the foregoing devices for storing computer instructions or computer programs provided in the embodiments of the present application are non-transitory. .

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)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

一种数据存储方法及存储装置,涉及存储领域,使得SSD(220)能够优化数据在SSD(220)中的布局,提高SSD(220)的存储性能及寿命。具体方案为:SSD(220)接收IO命令,IO命令用于请求将第一数据写入存储器件,IO命令还携带有第一数据的lifetime,当第一数据的生命周期大于第一阈值时,SSD(220)将第一数据写入第二存储介质(1103)。

Description

一种数据存储方法及存储装置 技术领域
本申请涉及存储领域,尤其涉及一种数据存储方法及存储装置。
背景技术
在计算机系统中,各个操作的执行依赖于不同的输入输出(Input Output,IO)命令(如读IO命令,写IO命令等)实现。示例性的,计算机系统通常由主机(host)和存储器件组成。主机可以通过下发写IO命令将数据写入存储器件。其中,该存储器件可以是固态硬盘(Solid State Device,SSD),也可以是其他能够存储数据以及指令等信息的记忆部件。
然而,基于现有对IO命令的处理机制,现有技术存在一些问题。例如,以存储介质为SSD为例。当SSD中包括多种具有不同写入速率的存储介质时,需要写入SSD的数据会被随机存储在写入速率较高或较低的存储介质中。SSD无法对数据在不同存储介质中的存储位置进行管理,使得数据在SSD的布局不够理想,进而影响SSD的存储性能以及寿命。
发明内容
本申请实施例提供了一种数据存储方法及存储装置,使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
本申请采用如下技术方案:
第一方面,本申请实施例提供了一种数据存储方法,该方法可以应用于包括第一存储介质和第二存储介质的存储器件。其中,该存储器件可以为固态硬盘(SSD),第一存储介质的写入速率高于第二存储介质的写入速率,该方法可以包括:固态硬盘接收IO命令,IO命令用于请求将第一数据写入存储器件,IO命令还携带有第一数据的生命周期(lifetime);响应于该IO命令,当第一数据的生命周期大于第一阈值时,固态硬盘将第一数据写入第二存储介质。在一些实施例中,该IO命令可以是主机(Host)向固态硬盘发起的。
基于该方案,通过在IO命令中携带生命周期,SSD能够知晓IO命令请求处理的数据的生命周期,以便SSD将数据写入对应的存储介质中,例如,将生命周期较长的数据直接写入能够长时间存储数据的NAND中,使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
在一种可能的设计中,当第一数据的生命周期小于第二阈值时,固态硬盘将第一数据写入第一存储介质,第二阈值小于第一阈值。基于该方案,SSD可以将生命周期较短的数据写入NVM中,使得该数据能够在生命周期结束后快速被替换或删除,进一步地使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
在一种可能的设计中,IO命令还携带有截止时间(deadline)。其中,该截止时间用于指示固态硬盘向主机返回IO命令处理结果的响应时延。当第一数据的生命周期大于第一阈值时,固态硬盘将第一数据写入第二存储介质,包括:当第一数据的生命 周期大于第一阈值,且截止时间大于第三阈值时,固态硬盘将第一数据写入第二存储介质。基于该方案,在IO命令中携带deadline,使得SSD能够知晓返回该IO命令的时延要求,将将时延要求较低的数据写入能够长时间存储数据的NAND中,进一步地使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
在一种可能的设计中,当第一数据的生命周期大于第二阈值且小于第一阈值,或第一数据的截止时间小于第三阈值时,固态硬盘将第一数据写入第一存储介质。基于该方案,SSD可以将符合上述条件的数据缓存到NVM中,适当提高这些数据的处理速度,进一步地使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
在一种可能的设计中,当第一存储介质被全部占用后,固态硬盘将第一存储介质中存储的第二数据写入第二存储介质;其中,第二数据是第一存储介质中存储的数据中生命周期最长的数据。基于该方案,当NVM全部占用时,SSD可以将生命周期最长的数据写入能够长时间存储数据的NAND中,进一步地使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
在一种可能的设计中,固态硬盘将第二存储介质的物理存储块(block)划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间;固态硬盘将第一数据写入第二存储介质,包括:固态硬盘根据第一数据的生命周期,确定第一物理存储块组,其中,第一数据的生命周期落入第一物理存储块组对应的生命周期区间内;固态硬盘将第一数据写入第一物理存储块组。基于该方案,SSD可以为具有不同生命周期的数据配置不同的block,以便将具有相近生命周期的数据写入同一个block中,使得当这些数据生命周期结束时,可以将整个block设置为无效,而不需要筛选block中生命周期尚未结束的数据并转移这些数据。
在一种可能的设计中,固态硬盘将第二存储介质的物理存储块(block)划分为多个物理存储块组,包括:根据第二存储介质的并发写带宽,将第二存储介质中与并发写带宽对应数量的物理存储块划分为多个物理存储块组,并发写带宽是第二存储介质的同时能够执行数据写入的物理存储块的最大数量。基于该方案,SSD可以根据并发写带宽来为生命周期落入不同区间的数据分配block数量,使得每个生命周期区间内对应的数据可以并行写入block中,提高了数据写入的效率。
第二方面,本申请实施例提供一种存储装置,该装置包括:控制器(Controller),第一存储介质以及第二存储介质,其中,第一存储介质的写入速率高于第二存储介质的写入速率;该控制器,用于接收输入输出(IO)命令,IO命令用于请求将第一数据写入存储器件,IO命令还携带有第一数据的生命周期(lifetime);控制器还用于当第一数据的生命周期大于第一阈值时,将第一数据写入第二存储介质。
在一种可能的设计中,该控制器,还用于当第一数据的生命周期小于第二阈值时,将第一数据写入第一存储介质,第二阈值小于第一阈值。
在一种可能的设计中,IO命令还携带有截止时间(deadline);该控制器还用于当第一数据的生命周期大于第一阈值,且截止时间大于第三阈值时,将第一数据写入第二存储介质。
在一种可能的设计中,该控制器还用于当第一数据的生命周期大于第二阈值且小 于第一阈值,或第一数据的截止时间小于第三阈值时,将第一数据写入第一存储介质。
在一种可能的设计中,该控制器还用于当第一存储介质被全部占用后,将第一存储介质中存储的第二数据写入第二存储介质;其中,第二数据是第一存储介质中存储的数据中生命周期最长的数据。
在一种可能的设计中,该控制器还用于将第二存储介质的物理存储块(block)划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间;该控制器还用于根据该第一数据的生命周期,确定第一物理存储块组,该第一数据的生命周期落入该第一物理存储块组对应的生命周期区间内;该控制器,将该第一数据写入第一物理存储块组。
在一种可能的设计中,该控制器还用于根据第二存储介质的并发写带宽,将第二存储介质中与并发写带宽对应数量的物理存储块划分为多个物理存储块组,并发写带宽是第二存储介质的同时能够执行数据写入的物理存储块的最大数量。
第三方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质中包含指令,当该指令在计算机上运行时,使得该计算机执行第一方面或第一方面的任意一种可能的实现方式的方法。在一些实施例中,该计算机可读存储介质是非易失性存储介质。
第四方面,本申请实施例提供了一种计算机程序产品,当其在计算机上运行时,使得第一方面或第一方面的任意一种可能的实现方式的方法被执行。
第五方面,本申请实施例提供了一种控制器,该控制器与存储器耦合,在一些实施例中,该存储器可以包括如第三方面提供的计算机可读存储介质。当该处理器执行该存储器中的计算机程序或指令时,使得第一方面或第一方面的任意一种可能的实现方式的方法被执行。
第六方面,本申请实施例提供了一种芯片,包括:处理电路和接口,该处理电路用于从存储介质中调用并运行该存储介质中存储的计算机程序,以执行第一方面或第一方面的任意一种可能的实现方式中处理器所执行的步骤。在一些实施例中,上述存储介质可以为如第三方面提供的计算机可读存储介质。
第七方面,本申请实施例提供一种计算机系统,该计算机系统可以包括主机以及存储装置,例如,该存储装置可以为上述第二方面以及其可能的设计中任意一种存储装置。其中,主机用于向存储装置发送用于请求将数据写入存储装置的输入输出(IO)命令,数据处理器装置用于响应于IO命令,执行如上述第一方面及其可能的设计中任意一种所述的方法。
应当理解的是,上述第二方面提供的存储装置及其任一种可能的设计,上述第三方面提供的计算机可读存储介质,上述第四方面提供的计算机程序产品,上述第五方面提供的控制器,上述第六方面提供的芯片以及上述第七方面提供的计算机系统的有益效果均可以对应参考上文对应方面提供的方法实施例的有益效果,此处不再赘述。
附图说明
图1为一种NAND的组成示意图;
图2为本申请实施例提供的一种存储系统的组成示意图;
图3为本申请实施例提供的一种SSD的组成示意图;
图4为本申请实施例提供的一种数据存储方法的流程示意图;
图5为本申请实施例提供的一种lifetime和deadline的结构示意图;
图6为本申请实施例提供的一种数据写入的示意图;
图7为本申请实施例提供的又一种数据写入的示意图;
图8为本申请实施例提供的又一种数据存储方法的流程示意图;
图9为本申请实施例提供的又一种数据存储方法的流程示意图;
图10为本申请实施例提供的一种存储装置的组成示意图;
图11为本申请实施例提供的又一种存储装置的组成示意图。
具体实施方式
在计算机系统的运行过程中,需要将大量的数据存储在存储器件中。其中,SSD作为一种性能优异的存储器件正在被广泛地使用。
一般而言,SSD大多采用NAND闪存(NAND flash,在本实施例中,可简称为NAND)作为存储介质来保存数据。示例性的,请参考图1,为一种NAND的组成示意图。如图1所示,每个NAND由多个晶元(Die)组成,每个Die有多个物理存储块(Block),每个Block有多个页(Page)。当有数据需要写入SSD时,SSD可以将该数据写入到不同Page上,实现对该数据的永久存储。
随着计算机系统对存储器件的读写能力要求的逐步提升,SSD也开始使用其他一些性能更加优异的存储介质,如非易失性存储介质(non-volatile memory,NVM)作为其存储介质。例如,NVM可以包括相变内存(Phase Change Random Access Memory,PCRAM),磁阻式随机存取内存(Magnetoresistive Random Access Memory,MRAM),以及阻变式随机存取内存(Resistive Random Access Memory,ReRAM或RRAM)等。
示例性的,PCRAM(又称为PCM),能够利用硫族化合物在晶态(或者称为晶相)和非晶态(或者称为非晶相)巨大的导电性差异进行数据的存储。其中,相(phase)是物理化学上的一个概念,它是指物体的化学性质完全相同,但是物理性质不同的多个状态。例如,水有三种不同的状态,即水蒸气(汽相),液态水(液相)以及固态水(固相)。物质从一种相变成另外一种相的过程可以称为“相变”,如水从液态转化为固态。而还有很多物质的相变不只有气,液,固这三相。PCRAM就是利用特殊材料在晶态和非晶态之间相互转化时所表现出来的导电性差异来存储数据的。
MRAM是一种非挥发性内存技术,有望取代快闪存储器与动态随机存取存储器(Dynamic Random Access Memory,DRAM)成为新的通用型内存。MRAM存储器由一个晶体管和一个磁性隧道结存储单元(magnetic tunnel junction,MTJ)构成。其中,MTJ内部有三个层面,最上面的层为自由层,中间的是隧道结,下面的是固定层。自由层的磁场极化方向是可以改变的,而固定层的磁场方向固定不变。当自由层与固定层的磁场方向平行时,存储单元呈现低电阻;当磁场方向相反时,呈现高电阻。MRAM存储器通过检测存储单元电阻的高低,来判断所存储的数据是0还是1。因此,MRAM不需改变内存状态,便能快速读取数据。
RRAM是当前最炙手可热、极有可能取代闪存的新型存储介质。从理论上讲,忆阻并非新鲜事物。早在1971年,加州大学伯克利分校的蔡少棠教授就发表过名为《Memristor——The Missing Circuit Element》的论文,提出了忆阻的理论基础。蔡教 授在研究电流、电压、电荷和磁通量的关系时推断,除电容、电感和电阻之外,电子电路还应该存在第四种基本元件——忆阻。忆阻可通过电流的变化控制其阻值的变化。对材料施压电压脉冲后,材料会产生高电阻值;反之,从另一个方向施加电压脉冲则会使材料转变成低电阻值,并且其阻值在断电之后亦能保持。RRAM的发展日新月异,特别是最近几年,RRAM的所有指标相比闪存器件都有数量级的提升,将给存储设备带来革命性的变化。例如:1)、读写时延:RRAM能够实现100ns左右的时延,读时延比闪存器件提升1个数量级,写时延提升3个数量级;2)、耐久(Endurance):RRAM Endurance可达到1E6-1E12,比闪存器件提升2个数量级以上;3)、保存时间(Retention):RRAM Retention可达到10年,是闪存器件Retention的10倍;4)、密度与容量:RRAM可做到5nm以下,支持三维(three dimensional,3D)堆叠,支持多位数(multibit),而NAND将止步15nm左右;5)、RRAM支持字节(Byte)寻址,在存储上可解决小数据随机写问题。
但是,由于上述NVM的使用会带来较高的成本。因此,在SSD中,使用上述NVM代替NAND flash作为存储介质将会是一个很漫长的过程。也就是说,为了在考虑成本的基础上提升现有SSD的读写性能,同时包括NAND以及NVM两种或更多种类的存储介质的SSD已经成为必不可免的发展趋势。
然而,基于现有技术中对IO命令及其对应的数据的处理机制,写入SSD的数据是随机凑杂在一起存储的。这种数据的存储情况会出现一些问题。例如,当SSD中包括多种写入速率不同的存储介质时,一些使用频率较低的数据可能会被存储在写入速率较高的存储介质中,由此降低了该具有较高写入速率的存储介质的使用效率。同时,还会有一些使用频率较高的数据会被存储在写入速率较低的存储介质中,使得这些数据在频繁地被使用(如读出等)的过程中,无法被快速地调用。这样使得数据在SSD的布局不够理想,进而影响SSD的存储性能以及寿命。
为了解决上述问题,本申请实施例提供一种数据存储方法及存储装置,使得SSD能够优化数据在SSD中的布局,提高SSD的存储性能及寿命。
以下结合附图对本申请实施例的具体实施方式进行详细说明。
请参考图2,为本申请实施例提供的一种存储系统的组成示意图。如图2所示,该存储系统可以包括主机(Host)210和一个或多个SSD 220。其中,一个或多个SSD 220中的每个SSD 220可以包括控制器(Controller)221和多个存储介质222。
其中,主机210可以是使用SSD 220的主机,也可以是使用SSD 220的服务器或者阵列。上述多个存储介质222可以为NAND和/或NVM。当SSD 220同时包括NAND和NVM时,SSD 220中的NVM和NAND的容量大小的比例,可以根据具体使用场景灵活选取,本申请实施例在此不做限制。
主机210和一个或多个SSD 220中的每一个SSD 220的控制器221之间通过小型计算机系统接口(Small Computer System Interface,SCSI)/非易失性内存主机控制器接口(Non-Volatile Memory express,NVMe)。示例性的,主机210可以向控制器221发送写IO命令。控制器221接收该写IO命令之后,可以将该写IO命令请求处理的数据写入存储介质222中。另外,主机210还可以向控制器221发送读IO命令。控制器221接收该读IO命令之后,根据该读IO命令中的地址,可查找其缓存中是否保存 有待读取的数据。如果有,则将待读取的数据发送给主机210,如果没有,则从存储介质222中获得该数据并发送给主机210。在实际应用中,控制器221和存储介质222可以集成在一个存储设备(如图2所示的SSD)中,也可以位于相互独立的两个设备中,本发明实施例不对控制器221和存储介质222的位置关系做任何限定。
作为一种示例,图3示出了图2中SSD 220的一种组成示意图。如图3所示,SSD 220中可以包括控制器221、第一存储介质(如NVM)以及第二存储介质(如NAND)。控制器221可以接收主机210发送的IO命令,并将IO命令请求处理的数据写入第一存储介质或第二存储介质中,或将IO命令请求读取的数据从第一存储介质或第二存储介质中读出发送给主机210。其中,SSD 220中的NAND可以是三维TLC(3 dimensional Trinary-Level Cell,3D TLC),也可以是三维QLC(3 dimensional Quad-Level Cell,3D QLC)或其他NAND。SSD 220中的NVM可以是RRAM,也可以是PCRAM或MRAM等其他形态的NVM。可以理解的是,NVM具有更好的读写性能,能够更快地对IO命令进行响应,同时能够对IO命令请求处理的数据进行快速的处理。
本申请实施例提供的数据存储方法均可基于如图2所示的存储系统实现。需要说明的是,上述图2中的说明中,均以存储器件为SSD为例进行说明。在实际应用中,该数据存储方法中涉及的存储器件还可以是其他能够存储数据以及指令等信息的记忆部件。本申请实施例在此不做限制。
本申请实施例提供的数据存储方法,通过在IO命令中携带生命周期(lifetime),SSD能够知晓IO命令请求处理的数据的生命周期,以便SSD将数据写入对应的存储介质中。进一步的,通过在IO命令中携带截止时间(deadline),使得SSD能够高效地安排数据的存储顺序或者存储的先后顺序,以确保在规定的时间内,SSD能够向host返回该数据的保存结果。同时,SSD还可以根据lifetime将lifetime相近的数据保存在相同的物理block中,这样SSD在回收空白块的时候,找到存储有无效数据的物理block时,可以直接把整个物理block擦除掉即可,而不用将该物理block上的有效数据迁移出去。
为了更加清楚地说明本申请实施例提供的数据存储方法,以下以存储器件为SSD,SSD包括NAND和NVM两种存储介质,IO命令为写请求,IO命令中包括生命周期(lifetime)和截止时间(deadline)为例进行详细说明。
请参考图4,为本申请实施例提供的一种数据存储方法的流程示意图,如图4所示,该方法可以包括S401-S402。
S401、主机下发IO命令,用于请求将第一数据写入SSD。
其中,主机(host)在下发用于请求将第一数据写入SSD的IO命令,如IO命令时,可以在该IO命令中携带该第一数据的生命周期(lifetime)和截止时间(deadline)。
示例性的,IO命令中携带的lifetime可以由host根据计算机系统对于IO命令请求处理的第一数据的lifetime来设置。
其中,lifetime可以用于指示该第一数据是有效数据的时长。即在该lifetime内,该第一数据是有效的,在该lifetime之外,该第一数据无效,可以被其他有效数据覆盖或者被删除。示例性的,lifetime可以通过“字段C+字段B+字段A”的结构来标示。其中,字段A可以为1bit的数(如0或1),用于标示该数据的lifetime到期后是否 变为无效数据。例如,字段A被设置为1时,对应数据到期后自动变为无效数据,可以由SSD自动淘汰,字段A被设置为0时,对应数据到期不会自动变为无效数据,SSD将该数据作为有效数据进行存储,直到收到其他将该数据设置为无效的指示。字段B可以包括2bit的数据,用于标示lifetime对应的单位。例如,用00标示分钟,用01标示小时,用10标示天,用11标示月。字段C可以包括N bit的数据,用于标示在字段B所标示的单位下的lifetime的时长。其中,N为大于或等于1的整数,N的值可以根据IO命令对应命令结构体中包括的字节数决定。
例如,IO命令请求将视频监控的数据写入SSD的存储介质中,而视频监控的数据一般都具有设置好的保存时长,如该时长可以为3个月,则host可以将该IO命令的lifetime的字段C设置为11(即3的二进制数),将lifetime的字段B设置为11(即lifetime的单位为月)。同时,host可以根据该数据是否需要由SSD主动淘汰,设置lifetime的字段A,以便SSD可以在该数据lifetime到期后主动将其置为无效数据。又如,IO命令请求将host的元数据或者用户数据写入SSD的存储介质。由于这类数据的lifetime较短,会较为频繁地被改写,则host可根据元数据更新的快慢来设置lifetime的字段B和字段C,比如设置为1个小时或设置为1天。
需要说明的是,由于lifetime较短的数据(如元数据)会比较频繁的更新,不需要SSD在lifetime到期后,将该数据设置为无效数据。因此,本申请实施例中,此类数据对应的IO命令的lifetime中,字段A可以设置为1,也可以设置为0。
本申请实施例中,IO命令中携带的lifetime可以由host根据计算机系统对于IO命令的时延要求来设置。
其中,deadline用于指示返回IO命令的处理结果的响应时延。即IO命令需要在deadline内被执行完毕,并向主机返回处理结果。例如,该处理结果可以是IO命令执行完毕后的IO回调结果。示例性的,deadline可以通过“字段E+字段D”的结构来标示。其中,字段D可以包括2bit的数据,用于标示deadline的单位。例如,用00标示微秒,用01标示毫秒,用10标示秒。字段E可以包括M bit的数据,用于标示在字段D所标示的单位下的deadline的时长。其中,M为大于或等于1的整数,M的值可以根据IO命令对应命令结构体中包括的字节数决定。
例如,IO命令为请求将阵列/服务器运行过程中内部产生的数据写入SSD的存储介质中,由于该数据对时延要求不敏感,则host可以将该IO命令的deadline设置为一个较大的数值,如毫秒(ms)到秒(s)量级的deadline时长。又如,IO命令请求将host的元数据或者用户数据写入SSD的存储介质中,而host的元数据或者用户数据需要尽快更新到SSD的存储介质中,即该数据对时延要求较为敏感,则host可以将该IO命令的deadline设置为一个较小的数值,如微秒(us)到毫秒(ms)量级的deadline时长。
为了更加清楚地说明lifetime和deadline的设置方法,图5示出了一种lifetime和deadline的数据结构示意图。以IO命令的命令结构体中数据结构的长度为64bit,每一行对应4个字节为例进行说明。如图5所示,在第0行和第1行中已设置有一些标示,根据这些标识,SSD可以完成将该IO命令对应的数据写入存储介质的动作。例如,在第0行中,字节(Byte)0中标示有操作码(Opcode),字节1前两个bit位(即第8 位和第9位)中标示命令是否是组合操作中的某一个命令(FUSE:Fused operation),字节1后两位(即第14位和第15位)中标示有PSDT(PSDT:PRP or SGL for Data Transfer,表示该命令对应的内存的组织方式),字节2以及字节3中标示有命令标识符(Command Identifier)。又如,在第1行中,字节0-4标示有命名空间标识符(Namespace Identifier)。本申请实施例中,可以在第3行中,用4个字节中的两个字节(8个bit)标示deadline,用另两个字节标示lifetime。例如,用字节0和字节1中的16个bit来标示deadline,用字节2和字节3中的16个bit来标示lifetime。其中,第14位和第15位可以用于标示deadline的字段D,第0位至第13位可以用于标示deadline的字段E。如字节0和字节1设置为0000000011110001,则对应的deadline的时长为11100毫秒(二进制),即60毫秒(十进制)。类似的,第16位可以用于标示lifetime的字段C,第17位和第18位可以用于标示lifetime的字段B,第19位至第31位可以用于标示lifetime的字段A。需要说明的是,上述示例仅为一种deadline和lifetime的设置方法的示意,对于deadline以及lifetime的设置方法还可以遵循其他规则,如deadline被设置为默认以100微秒为单位,lifetime被设置为默认以1分钟为单位,则在对应的bit位只需设置在上述默认单位下的时长即可。
S402、SSD接收IO命令,根据该IO命令携带的deadline以及lifetime,将IO命令请求处理的第一数据写入第一存储介质或第二存储介质中。
其中,第一存储介质可以为NVM,第二存储介质可以为NAND。
本申请实施例中,根据携带在IO命令中的lifetime,SSD可以确定IO命令请求处理的数据的有效时长,则SSD可以将有效时长较长的数据写入NAND中,将有效时长较短的数据写入NVM中。根据携带在IO命令中的deadline,SSD可以确定IO命令请求处理的数据对时延的要求,则SSD可以将对时延要求较高的数据写入NVM中个,将对时延要求较低的数据写入NAND中。
示例性的,在一些实施例中,SSD可以根据IO命令携带的lifetime,确定IO命令请求处理数据(即第一数据)lifetime的时长。当第一数据的lifetime较长时(如第一数据为视频监控的数据),即该第一数据在较长时间内均为有效状态,则SSD可以直接将该第一数据写入NAND中。当第一数据的lifetime较短时(如第一数据为host的元数据或者用户数据),即该第一数据在短时间内就会被更新,或在短时间之后就会变成无效数据,则SSD可以将该第一数据写入NVM中,以便后续更新等针对该第一数据的操作可以被更快地执行。
例如,如图6所示,控制器接收到IO命令后,根据该IO命令携带的lifetime,当lifetime大于第一阈值(如f小时)时,将第一数据写入NAND。当lifetime小于第二阈值(如g分钟)时,将第一数据写入NVM。其中,第二阈值小于第一阈值。
在另一些实施例中,SSD还可以根据IO命令携带的lifetime以及deadline,将第一数据写入NVM或NAND中。
例如,如图7中的(a)以及图7中的(b)所示,控制器接收到IO命令后,根据该IO命令携带的lifetime以及deadline,当lifetime大于第一阈值(如f小时),且deadline大于第三阈值(如e毫秒)时,将第一数据写入NAND。当lifetime小于第二阈值(如g分钟)时,将第一数据写入NVM,第二阈值小于第一阈值。
另外,当IO命令携带的lifetime以及deadline不满足上述条件时(如lifetime大于g分钟且小于f小时,或deadline小于e毫秒时),可以将第一数据缓存到NVM中。作为一种示例,该缓存的方法可以是:将这些数据暂时写入NVM,当NVM全部占用时,从NVM中存储的数据中选取lifetime最大的数据,写入到NAND中。
需要说明的是,上述示例中的第一阈值、第二阈值以及第三阈值,可以是根据不同的使用场景灵活设置的。例如,在一些使用场景下,数据的lifetime可能是分钟级别的时长,也可能是小时级别的时长,则第一阈值可以被设置为以小时为单位的时长,第二阈值可以被设置为以分钟为单位的时长。又如,在另一些使用场景下,IO命令的deadline为毫秒级别的时长,则第三阈值可以被设置为以秒或毫秒为单位的时长。
可以理解的是,数据的lifetime与数据的属性是相关的,因此,上述第一阈值、以及第二阈值的设置也可以是根据数据的属性确定的。例如,当数据为视频监控的数据时,由于该数据具有较长保存时间的属性,即该数据的lifetime较长,因此,在针对该数据的使用场景下,可以将第一阈值或第二阈值设置为一个较大的时长。又如,当数据为host的元数据时,由于该数据具有较短保存时间的属性,即该数据的lifetime较短,因此,在针对该数据的使用场景下,可以将第一阈值或第二阈值设置为一个较小的时长。类似的,数据的deadline与数据的属性是相关的,因此,在针对不同数据的使用场景下,上述第三阈值的设置可以是根据数据的属性确定的。
另外,该这些阈值(如第一阈值、第二阈值以及第三阈值)的设置可以是预置在SSD中的,也可以是在不同的场景下由用户自行设置的。本申请实施例在此不做限制。
示例性的,图4中的S402可以包括如图8所示的S801-S803。
S801、SSD接收IO命令。
当deadline大于第三阈值且lifetime大于第一阈值时,执行以下S802;当lifetime小于第二阈值,或lifetime大于第二阈值且小于第一阈值,或deadline小于第三阈值时,执行以下S803。
S802、将第一数据写入NAND中。
S803、将第一数据写入NVM中。
需要说明的是,本申请实施例中,host也可以只设置IO命令的deadline。则SSD可以根据IO命令携带的deadline,确定IO命令请求处理的第一数据对时延的要求。当第一数据对时延较为敏感时(如第一数据为host的元数据或者用户数据),即该IO命令需求被尽快执行并向host返回执行结果,则存储器件可以将该第一数据写入写入速率较快的NVM中,并向host返回执行结果,如该执行结果可以为IO命令的IO回调消息,用于指示hostIO命令请求处理的数据已经完成写入。当第一数据对时延不敏感时(如第一数据为阵列/服务器运行过程中内部产生的数据),即该IO命令不需要被在短时间内执行并向host返回执行结果,则存储器件可以将该第一数据写入写入速率较慢的NAND中,并向host返回执行结果。
由于数据在写入NAND时,需要先擦除现有数据再写入,而该过程中需要对大量 的用户数据和元数据进行迁移,就使得写入数据时,SSD实际处理的数据量远大于要写入数据的数据量,该过程也可以称为写入放大。可以理解的是,由于写入放大的存在,会对SSD增加大量的数据处理压力,同时也会影响SSD的固件寿命。为了解决该问题,进一步的,本申请实施例在执行将数据写入NAND时,可以根据IO命令携带的lifetime的不同,将lifetime相近的数据写入相同的block,在不改变现有硬件的情况下,减小写入放大。
因此,如图9所示,上述S802可以包括以下S901-S902。
S901、将第二存储介质的block划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间。
可以理解的是,在实际使用过程中,会有大量的数据需要被写入NAND中进行存储。而这些数据的lifetime也不尽相同,可能会覆盖很大的时间区域。本申请实施例中,可以在NAND中,为具有不同lifetime的数据划分不同的block。
示例性的,在NAND中为具有不同lifetime的数据划分16组block,则每组block可以对应一个lifetime区间。例如,16组block对应的lifetime区间可以为(0,24h]、(1d、2d]、(2d、4d]、(4d、8d]、(8d、16d]、(16d、32d]、(32d、2m]、(2m、4m]、(4m、6m]、(6m、8m]、(8m、10m]、(10m、12m]、(1y、2y]、(2y、3y]、(3y、4y]、[4y,∞)。其中,h表示以小时为单位,d表示以天为单位,m表示以月为单位,y表示以年为单位。
本申请实施例中,针对上述多个lifetime划分block组的过程,可以通过多种方法实现,以下进行示例性的说明。
在一些实施例中,可以根据NAND的并发写带宽,进行block组的划分。其中,NAND的并发写带宽为同一时刻,能够同时执行数据写入的block的最大数量。例如,以NAND的并发写带宽为64,lifetime区间为16个为例,可以为每个lifetime区间对应的数据分配最多4个block,使lifetime分别包括在16个不同区间的数据可以并行写入NAND中。
在另一些实施例中,可以根据lifetime区间的IO写带宽大小,为不同lifetime区间对应的数据分别分配对应数量的block。例如,lifetime区间1对应的第一组数据的IO写带宽为a M/s,lifetime区间2对应的第二组数据的IO写带宽为3a M/s,则为第二组数据分配的block的数量可以为第一组数据分配的block数量的3倍。
在另一些实施例中,可以结合lifetime区间的IO写带宽大小以及每个block的写入速率,为不同lifetime区间对应的数据分别分配对应数量的block。以NAND中的block的写速率为b M/s,lifetime区间3对应的第一组数据的IO写带宽为a M/s,lifetime区间4对应的第二组数据的IO写带宽为3a M/s为例。如果3a小于b,则可以为第一组数据以及第二组数据均分配1个block,以此提高block的利用率;如果b大于2a,且b小于3a,则可以为第一组数据分配1个block,为第二组数据分配2个block,同样可以提高block的利用率。
在另一些实施例中,可以为N组数据中的每组数据都分配1个block,并实施监控该block的存储空间剩余情况,当为一组数据分配的1个block的存储空间已经被全部占用或者即将被全部占用,则为该组数据分配1个新的block用于存储该组数据中的其他数据。
需要说明的是,上述对block的划分方法仅仅为一些示例性的说明,本申请实施例中,上述方法可以单独使用,也可以同时采用多个方法结合使用,本申请实施例在此不做限制。当然,block的划分策略还可以是周期性调整的,也可以在检测到IO模型或者数据的生命周期有较大变化后才触发调整的。
S902、将第一数据写入IO命令携带的lifetime所在区间对应的block组中。
示例性的,SSD的控制器可以根据IO命令携带的lifetime所在区间,将第一数据写入NAND中为其分配的block组中。
可以理解的是,在执行如图8所示的S803以及S804之后,当NVM的存储空间已经全部被占用时,SSD可以按照如图9所示的S901-S902将NVM中存储的所有数据中,lifetime最大的数据写入NAND中。
需要说明的是,上述说明中,均以SSD中包括NAND以及NVM两种存储介质为例进行说明的。当SSD中包括三种或三种以上具有不同写入速率的存储介质时,仍然可以将上述图4或图8或图9所示的方法应用在数据存储的过程中,其具体的实施过程与上述示例类似,此处不再赘述。
另外,以上说明中均以IO命令为写命令为例进行说明。本申请实施例提供的数据存储方法,也可以用于IO命令为读命令的场景。例如,host可以在下发读IO命令之前,在该读IO命令中设置deadline,以便SSD可以根据该读IO命令中携带的deadline,确定要读取的数据需要在多长时间之内返回给host,以使得host在需要尽快读取一些数据时,SSD可以进行高效的响应。
这样,SSD可以根据IO命令中携带的lifetime和/或deadline,确定需要将哪些数据写入具有较高写入速率但是容量有限的NVM中,以及需要将哪些数据写入具有较大容量的NAND中。由此使得SSD能够对存储数据的布局进行自主优化,实现数据的分级存储,简化了host和SSD的交互过程,提高SSD的寿命。进一步的,SSD可以根据IO命令中携带的deadline,高效地安排数据的存储顺序或者存储的先后顺序,以确保在规定的时间内,SSD能够向host返回该数据的保存结果。
另外,SSD可以将lifetime相近的数据写入到相同的block中,在不改变现有硬件的情况下,这样SSD在回收空白块的时候,找到存储有无效数据的物理block时,可以直接把整个物理block擦除掉即可,而不用将该物理block上的有效数据迁移出去。
上述主要从方法的角度对本申请实施例提供的方案进行了介绍。为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对上述SSD进行功能模块的划分,例如,该SSD可以为存储装置,该存储装置可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块 的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
请参考图10,为本申请实施例提供的一种存储装置的组成示意图。该存储装置可以用于执行本申请实施例提供的任意一种数据存储方法,如图4或图8或图9所示的数据存储方法。
如图10所示,该存储装置可以包括接收单元1001,写入单元1002,第一存储介质以及第二存储介质,其中,所述第一存储介质的写入速率高于所述第二存储介质的写入速率。
其中,接收单元1001,用于接收输入输出(IO)命令,该IO命令用于请求将第一数据写入该存储器件,该IO命令包括第一数据的生命周期(lifetime),该生命周期用于指示该第一数据是有效数据的时长。示例性的,接收单元1001可以用于执行如图4所示的S402或如图8所示的S801。
写入单元1002,用于当第一数据的生命周期大于第一阈值时,将第一数据写入第二存储介质。示例性的,写入单元1002可以用于执行如图4所示的S402或如图8所示的S802。
可选的,写入单元1002,还用于当第一数据的生命周期小于第二阈值时,将第一数据写入第一存储介质,第二阈值小于第一阈值。示例性的,写入单元1002还可以用于执行如图8所示的S803。
可选的,IO命令还包括截止时间(deadline),截止时间用于指示返回IO命令处理结果的响应时延。
写入单元1002,还用于当第一数据的生命周期大于第一阈值,且截止时间大于第三阈值时,将第一数据写入第二存储介质。示例性的,写入单元1002还可以用于执行如图8所示的S802。
可选的,写入单元1002,还用于当第一数据的生命周期大于第二阈值且小于第一阈值,或第一数据的截止时间小于第三阈值时,将第一数据写入第一存储介质。
可选的,写入单元1002,还用于当第一存储介质被全部占用后,将第一存储介质中存储的第二数据写入第二存储介质;其中,第二数据是第一存储介质中存储的数据中生命周期最长的数据。示例性的,写入单元1002还可以用于执行如图9中虚线所示的数据转移过程。
可选的,该装置还包括:划分单元1003;划分单元1003,用于将第二存储介质的物理存储块(block)划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间。示例性的,划分单元1003还可以用于执行如图9所示的S901。
写入单元1002,还用于根据第一数据的生命周期,将第一数据写入第一物理存储块组,第一物理存储块组对应的生命周期区间包含第一数据的生命周期。示例性的,划分单元1003还可以用于执行如图9所示的S902。
可选的,划分单元1003,还用于根据第二存储介质的并发写带宽,将第二存储介质中与并发写带宽对应数量的物理存储块划分为多个物理存储块组,并发写带宽是第二存储介质的同时能够执行数据写入的物理存储块的最大数量。
上述提供的任一种存储装置中相关内容的解释以及有益效果的描述等均可参考上述对应的方法实施例,此处不再赘述。在一个示例中,接收单元1001、写入单元1002以及划分单元1003可以通过存储装置所在芯片的某个引脚或其上的某块电路实现。
请参考图11,为本申请实施例提供的又一种存储装置的示意性框图。该存储装置可以用于执行本申请实施例提供的任意一种数据存储方法,如图4或图8或图9所示的数据存储方法。
如图11所示,该存储装置可以包括控制器1101,第一存储介质1102以及第二存储介质1103,其所述第一存储介质的写入速率高于所述第二存储介质的写入速率。示例性的,第一存储介质可以为NVM,第二存储介质可以为NAND。
其中,控制器1101可以用于实现如图10所示的接收单元1001,写入单元1002以及相关控制功能。
示例性的,控制器1101,用于接收输入输出IO命令,该IO命令用于请求将第一数据写入该存储器件,该IO命令还携带有第一数据的生命周期;控制器1101,还用于当该第一数据的生命周期大于第一阈值时,将该第一数据写入该第二存储介质1103。
可选的,控制器1101,还用于当该第一数据的生命周期小于第二阈值时,将该第一数据写入该第一存储介质1102,该第二阈值小于该第一阈值。
可选的,该IO命令还包括截止时间;控制器1101,还用于当该第一数据的生命周期大于该第一阈值,且该截止时间大于第三阈值时,将该第一数据写入该第二存储介质1103。
可选的,控制器1101,还用于当该第一数据的生命周期大于该第二阈值且小于该第一阈值,或该第一数据的截止时间小于该第三阈值时,将该第一数据写入该第一存储介质1102。
可选的,控制器1101,还用于当该第一存储介质1102被全部占用后,将该第一存储介质1102中存储的第二数据写入该第二存储介质1103;其中,该第二数据是该第一存储介质1102中存储的数据中生命周期最长的数据。
可选的,控制器1101,还用于将该第二存储介质1103的物理存储块block划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间;控制器1101,还用于根据该第一数据的生命周期,确定第一物理存储块组,该第一数据的生命周期落入该第一物理存储块组对应的生命周期区间内;控制器1101,将该第一数据写入第一物理存储块组。
可选的,控制器1101,还用于根据该第二存储介质1103的并发写带宽,将该第二存储介质1103中与该并发写带宽对应数量的物理存储块划分为多个物理存储块组,该并发写带宽是该第二存储介质1103的同时能够执行数据写入的物理存储块的最大数量。
本申请实施例还提供一种控制器,该控制器可以包括处理电路和接口。处理电路用于从存储有指令的计算机可读存储介质中调用并运行计算机可读存储介质中存储的计算机程序,以执行上述说明中涉及的数据存储方法。示例性的,该控制器可以为如图11中所示的控制器1101。
上述提供的任一种存储装置中相关内容的解释以及有益效果的描述等均可参考上 述对应的方法实施例,此处不再赘述。
本申请实施例还提供了一种数据处理系统,该处理系统可以为计算机系统,该系统包括上述任一种存储装置,该系统还包括第一存储介质和第二存储介质的存储器件。其中,第一存储介质的写入速率高于第二存储介质的写入速率,例如,第一存储介质为NVM,第二存储介质为NAND。该数据处理系统可以根据如图4或图8或图9所示的数据存储方法对数据进行处理。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可通过程序来指令相关的硬件完成。所述的程序可以存储于一种计算机可读存储介质中。上述提到的存储介质可以是只读存储器,随机接入存储器等。上述处理单元或处理器可以是中央处理器,通用处理器、特定集成电路(application specific integrated circuit,ASIC)、微处理器(digital signal processor,DSP),现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。
本申请实施例还提供了一种包含指令的计算机程序产品,当该指令在计算机上运行时,使得计算机执行上述实施例中的任意一种方法。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或者数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可以用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
应注意,本申请实施例提供的上述用于存储计算机指令或者计算机程序的器件,例如但不限于,上述存储器、计算机可读存储介质和通信芯片等,均具有非易失性(non-transitory)。
在实施所要求保护的本申请过程中,本领域技术人员通过查看附图、公开内容、以及所附权利要求书,可理解并实现公开实施例的其他变化。在权利要求中,“包括”(comprising)一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其他单元可以实现权利要求中列举的若干项功能。相互不同的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。
尽管结合具体特征及其实施例对本申请进行了描述,在不脱离本申请的精神和范围的情况下,可对其进行各种修改和组合。相应地,本说明书和附图仅仅是所附权利要求所界定的本申请的示例性说明,且视为已覆盖本申请范围内的任意和所有修改、变化、组合或等同物。

Claims (17)

  1. 一种数据存储方法,其特征在于,应用于包括第一存储介质和第二存储介质的固态硬盘SSD,所述第一存储介质的写入速率高于所述第二存储介质的写入速率,所述方法包括:
    所述固态硬盘接收输入输出IO命令,所述IO命令用于请求将第一数据写入所述固态硬盘,所述IO命令还携带有第一数据的生命周期lifetime;
    响应于所述IO命令,当所述第一数据的生命周期大于第一阈值时,所述固态硬盘将所述第一数据写入所述第二存储介质。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    当所述第一数据的生命周期小于第二阈值时,所述固态硬盘将所述第一数据写入所述第一存储介质,所述第二阈值小于所述第一阈值。
  3. 根据权利要求1或2所述的方法,其特征在于,所述IO命令还携带有截止时间deadline;
    所述当所述第一数据的生命周期大于第一阈值时,所述固态硬盘将所述第一数据写入所述第二存储介质,包括:
    当所述第一数据的生命周期大于所述第一阈值,且所述截止时间大于第三阈值时,所述固态硬盘将所述第一数据写入所述第二存储介质。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    当所述第一数据的生命周期大于所述第二阈值且小于所述第一阈值,或所述第一数据的截止时间小于所述第三阈值时,所述固态硬盘将所述第一数据写入所述第一存储介质。
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:
    当所述第一存储介质被全部占用后,所述固态硬盘将所述第一存储介质中存储的第二数据写入所述第二存储介质;
    其中,所述第二数据是所述第一存储介质中存储的数据中生命周期最长的数据。
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述方法还包括:
    所述固态硬盘将所述第二存储介质的物理存储块block划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间;
    所述固态硬盘将所述第一数据写入所述第二存储介质,包括:
    所述固态硬盘根据所述第一数据的生命周期,确定第一物理存储块组,所述第一数据的生命周期落入所述第一物理存储块组对应的生命周期区间内;
    所述固态硬盘将所述第一数据写入第一物理存储块组。
  7. 根据权利要求6所述的方法,其特征在于,所述固态硬盘将所述第二存储介质的物理存储块划分为多个物理存储块组,包括:
    所述固态硬盘根据所述第二存储介质的并发写带宽,将所述第二存储介质中与所述并发写带宽对应数量的物理存储块划分为多个物理存储块组,所述并发写带宽是所述第二存储介质的同时能够执行数据写入的物理存储块的最大数量。
  8. 一种存储装置,其特征在于,所述装置包括:控制器,第一存储介质以及第二存储介质,其中,所述第一存储介质的写入速率高于所述第二存储介质的写入速率;
    所述控制器,用于接收输入输出IO命令,所述IO命令用于请求将第一数据写入所述存储装置,所述IO命令还携带有第一数据的生命周期lifetime;
    所述控制器,还用于当所述第一数据的生命周期大于第一阈值时,将所述第一数据写入所述第二存储介质。
  9. 根据权利要求8所述的装置,其特征在于,
    所述控制器,还用于当所述第一数据的生命周期小于第二阈值时,将所述第一数据写入所述第一存储介质,所述第二阈值小于所述第一阈值。
  10. 根据权利要求8或9所述的装置,其特征在于,所述IO命令还携带有截止时间deadline;
    所述控制器,还用于当所述第一数据的生命周期大于所述第一阈值,且所述截止时间大于第三阈值时,将所述第一数据写入所述第二存储介质。
  11. 根据权利要求10所述的装置,其特征在于,
    所述控制器,还用于当所述第一数据的生命周期大于所述第二阈值且小于所述第一阈值,或所述第一数据的截止时间小于所述第三阈值时,将所述第一数据写入所述第一存储介质。
  12. 根据权利要求11所述的装置,其特征在于,
    所述控制器,还用于当所述第一存储介质被全部占用后,将所述第一存储介质中存储的第二数据写入所述第二存储介质;
    其中,所述第二数据是所述第一存储介质中存储的数据中生命周期最长的数据。
  13. 根据权利要求8-12中任一项所述的装置,其特征在于
    所述控制器,还用于将所述第二存储介质的物理存储块block划分为多个物理存储块组,不同物理存储块组对应不同生命周期区间;
    所述控制器,还用于根据所述第一数据的生命周期,确定第一物理存储块组,所述第一数据的生命周期落入所述第一物理存储块组对应的生命周期区间内;
    所述控制器,还用于将所述第一数据写入第一物理存储块组。
  14. 根据权利要求13所述的装置,其特征在于,
    所述控制器,还用于根据所述第二存储介质的并发写带宽,将所述第二存储介质中与所述并发写带宽对应数量的物理存储块划分为多个物理存储块组,所述并发写带宽是所述第二存储介质的同时能够执行数据写入的物理存储块的最大数量。
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中包含指令,当所述指令在计算机上运行时,所述计算机执行如权利要求1-7中任一项所述的方法。
  16. 一种控制器,其特征在于,所述控制器包括处理电路和接口;所述处理电路用于从如权利要求15所述的计算机可读存储介质中调用并运行所述计算机可读存储介质中存储的计算机程序,以执行如权利要求1-7中任一项所述的方法。
  17. 一种计算机系统,其特征在于,所述计算机系统包括主机以及如权利要求8-14中任一种存储装置;所述主机用于向所述存储装置发送用于请求将第一数据写入所述存储装置的输入输出IO命令,所述存储装置用于响应于所述IO命令,执行如权利要求1-7中任一项所述的方法。
PCT/CN2019/126789 2019-12-19 2019-12-19 一种数据存储方法及存储装置 WO2021120137A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/126789 WO2021120137A1 (zh) 2019-12-19 2019-12-19 一种数据存储方法及存储装置
CN201980102966.7A CN114830077A (zh) 2019-12-19 2019-12-19 一种数据存储方法及存储装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/126789 WO2021120137A1 (zh) 2019-12-19 2019-12-19 一种数据存储方法及存储装置

Publications (1)

Publication Number Publication Date
WO2021120137A1 true WO2021120137A1 (zh) 2021-06-24

Family

ID=76478079

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/126789 WO2021120137A1 (zh) 2019-12-19 2019-12-19 一种数据存储方法及存储装置

Country Status (2)

Country Link
CN (1) CN114830077A (zh)
WO (1) WO2021120137A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023169142A1 (zh) * 2022-03-07 2023-09-14 华为技术有限公司 一种存储装置及相关数据分区管理方法

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140181452A1 (en) * 2012-12-26 2014-06-26 Nvidia Corporation Hardware command training for memory using read commands
CN104881259A (zh) * 2015-06-29 2015-09-02 联想(北京)有限公司 一种数据处理方法和装置以及存储设备
CN105204783A (zh) * 2015-10-13 2015-12-30 华中科技大学 一种基于数据生存期的固态盘垃圾回收方法
CN107967121A (zh) * 2017-10-25 2018-04-27 华为技术有限公司 数据写入方法和存储设备
CN108710474A (zh) * 2018-05-18 2018-10-26 郑州云海信息技术有限公司 一种数据存储方法、装置及计算机存储介质
CN109164975A (zh) * 2018-06-28 2019-01-08 华为技术有限公司 一种将数据写入固态硬盘的方法以及固态硬盘

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140181452A1 (en) * 2012-12-26 2014-06-26 Nvidia Corporation Hardware command training for memory using read commands
CN104881259A (zh) * 2015-06-29 2015-09-02 联想(北京)有限公司 一种数据处理方法和装置以及存储设备
CN105204783A (zh) * 2015-10-13 2015-12-30 华中科技大学 一种基于数据生存期的固态盘垃圾回收方法
CN107967121A (zh) * 2017-10-25 2018-04-27 华为技术有限公司 数据写入方法和存储设备
CN108710474A (zh) * 2018-05-18 2018-10-26 郑州云海信息技术有限公司 一种数据存储方法、装置及计算机存储介质
CN109164975A (zh) * 2018-06-28 2019-01-08 华为技术有限公司 一种将数据写入固态硬盘的方法以及固态硬盘

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023169142A1 (zh) * 2022-03-07 2023-09-14 华为技术有限公司 一种存储装置及相关数据分区管理方法

Also Published As

Publication number Publication date
CN114830077A (zh) 2022-07-29

Similar Documents

Publication Publication Date Title
KR102569783B1 (ko) 비순차적 구역 네임스페이스들
WO2021061190A1 (en) Zoned namespaces in solid-state drives
US11650742B2 (en) Accessing stored metadata to identify memory devices in which data is stored
US10296250B2 (en) Method and apparatus for improving performance of sequential logging in a storage device
US10014056B1 (en) Changing storage parameters
US20200409601A1 (en) Hold of Write Commands in Zoned Namespaces
US10481816B2 (en) Dynamically assigning data latches
EP3462320A1 (en) Dynamic page allocation in memory
CN110447075B (zh) 多内核管芯上存储器微控制器
US20160124639A1 (en) Dynamic storage channel
CN111580747A (zh) 用于ssd任务的主机定义的带宽分配
US11762590B2 (en) Memory system and data processing system including multi-core controller for classified commands
US11494318B2 (en) Controller and operation method thereof
WO2017151262A1 (en) Method and apparatus for providing a contiguously addressable memory region by remapping an address space
CN115904221A (zh) 高速缓存块预算技术
CN115248662A (zh) 动态超级块
US11537293B2 (en) Wear leveling methods for zoned namespace solid state drive
WO2021120137A1 (zh) 一种数据存储方法及存储装置
US20210373809A1 (en) Write Data-Transfer Scheduling in ZNS Drive
JP2023503026A (ja) ロードコマンドの存続時間
CN114730250A (zh) 根据存储设备中的分区对读取命令加权
KR20220050177A (ko) 3단의 계층적 메모리 시스템
CN112181274A (zh) 提升存储设备性能稳定性的大块的组织方法及其存储设备
US11188474B2 (en) Balanced caching between a cache and a non-volatile memory based on rates corresponding to the cache and the non-volatile memory
US20230418491A1 (en) Memory block utilization in memory systems

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: 19956232

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: 19956232

Country of ref document: EP

Kind code of ref document: A1