WO2023169142A1 - 一种存储装置及相关数据分区管理方法 - Google Patents

一种存储装置及相关数据分区管理方法 Download PDF

Info

Publication number
WO2023169142A1
WO2023169142A1 PCT/CN2023/075459 CN2023075459W WO2023169142A1 WO 2023169142 A1 WO2023169142 A1 WO 2023169142A1 CN 2023075459 W CN2023075459 W CN 2023075459W WO 2023169142 A1 WO2023169142 A1 WO 2023169142A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage
data
area
target
storage area
Prior art date
Application number
PCT/CN2023/075459
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 WO2023169142A1 publication Critical patent/WO2023169142A1/zh

Links

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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • 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/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0658Controller construction arrangements
    • 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/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling

Definitions

  • the present application relates to the field of computer technology, and in particular, to a storage device and related data partition management method.
  • Solid state drives and mechanical hard drives are essentially hardware used for data storage. The essential difference lies in the different storage media.
  • Traditional mechanical hard disks use mechanical disks as storage media, and store and read data through the mechanical structure between the magnetic arm, magnetic head, and disk; while solid-state hard disks use NAND flash memory (non-volatile memory) as the storage medium. Data is read and written through the number of charges inside the memory, that is, the power on and off of the cell, thereby realizing data storage.
  • NAND flash memory can be divided into different blocks (Block), and each block is composed of multiple pages (Page); NAND flash memory is read and written in units of pages, and erased in units of blocks. (erase), that is, after a page in a block has been written, the page cannot be erased directly, but all the data in the block where it is located needs to be erased before it can be written again. Therefore, during the Garbage Collection (GC) operation of NAND flash memory, data distribution needs to be managed through FTL (Flash Translation Layer), and the valid data in the block must be backed up to other blocks before erasing. In addition, the writing and erasing of data during this process will increase the hardware wear of the SSD and reduce the service life of the SSD.
  • GC Garbage Collection
  • the technical problem to be solved by the embodiments of the present application is to provide a storage device and related data partition management method to improve the service life of the storage device.
  • an implementation example of this application provides a storage device, which is characterized in that the storage device includes a controller and M storage blocks Block, where M is an integer greater than 0, wherein the controller is used to: determine area configuration Information, the area configuration information includes the number N of storage areas, the size of each storage area, and the longest data storage time corresponding to each storage area, N is an integer greater than 1; according to the number N of storage areas and the size of each storage area
  • the size of the M storage blocks Block is divided into N storage areas; each storage area in the N storage areas includes one or more Blocks; the N storage areas are configured according to the area configuration information.
  • Each storage area in Configure its own maximum data retention time.
  • the storage blocks (Blocks) in the external storage are partitioned by the controller of the external storage (such as SSD) to obtain different storage areas, and the longest data storage time of these different storage areas is achieved through software configuration.
  • the controller of the external storage such as SSD
  • data with different storage time requirements can be stored based on the different characteristics of multiple storage areas (that is, the characteristics of different maximum data storage times) (such as storing data that needs to be saved for a long time in a storage with a long maximum data storage time).
  • area the data that only needs to be stored temporarily is stored in the storage area with the longest data storage time and the shortest data storage time), so that the data storage of the entire external memory can maximize the use of the storage characteristics of each storage area, effectively improving the utilization of external memory rate and service life.
  • the controller first divides multiple blocks in the external memory into N storage areas; further, since the maximum data storage time of the storage block can be directly configured through parameters, the controller in the external memory
  • the maximum data retention time of multiple storage blocks included in different storage areas can be directly configured through software to achieve different maximum data retention times in different storage areas.
  • the target storage time of the data to be stored is not perceived.
  • the storage block has the characteristic that the longer the maximum data storage time is, the fewer the number of erasable times, so all storage blocks must be configured according to the minimum number of erasing times, resulting in the storage capacity of the storage block not being fully utilized, resulting in Waste of storage resources.
  • the controller can reasonably configure the number of erasable times of the storage block according to the maximum data retention time of the storage area, avoiding all Data is stored according to the same maximum data retention time, which leads to the problem of wasting storage resources and thus improves the utilization and service life of storage devices.
  • the field effect transistor characteristics of the memory block are utilized (that is, the greater the programming voltage of the memory block, the longer the data storage time). Based on this characteristic, the storage device can save data according to the target of the data to be stored. Time controls the programming voltage of the storage block so that the storage block stores data according to the target storage time required for the data to be stored, thereby improving the utilization and service life of storage resources.
  • the programming voltage of the current memory block has been fixed during the production process and cannot be adjusted through software, and the programming voltage of the memory block cannot be directly configured, additional requirements need to be raised with the manufacturer, leading to an increase in the overall cost.
  • the utilization rate and service life of the external memory can be improved without increasing costs.
  • the correlation between the data retention time of storage media and the number of erasures can be used to manage the maximum data retention time requirements of different storage blocks through software, and the corresponding number of erasures can be calculated based on the retention time requirements.
  • the controller is further configured to: receive the area configuration information sent by the host, or negotiate the area configuration information with the host.
  • the area configuration information can be generated by the host according to the host-side requirements and delivered to the storage device, or can be obtained through negotiation between the storage device and the host, so that the controller of the storage device can configure the storage block based on the configuration information.
  • Block is partitioned, and the controller can also be configured through software to make the maximum data storage time of different storage areas different, so that the controller can store data based on multiple storage areas, improving the efficiency of storage devices (such as external storage SSD) Utilization and service life.
  • the controller is further configured to: generate a corresponding area identification for each storage area, and establish a maximum data storage time of each storage area and the corresponding area identification. mapping relationship between.
  • a region identifier can also be generated for each storage area, so that one area identifier corresponds to one Storage area, then the mapping relationship between the longest data storage time of each storage area and the area identifier can be established, and then the mapping relationship between the longest data storage time of each of these N storage areas and the area identifier can be sent to the host. , so that when the host generates a write command, it can select the target storage area according to the target storage time of the data to be stored, and use the area identification of the target storage area as the area identification information.
  • the controller is further configured to: divide the available logical address space of the storage system into N logical address segments; establish the maximum data storage time of each storage area and the Among the N logical address segments The mapping relationship between a logical address segment.
  • the available logical address space of the storage system can also be divided into N logical address segments to Make a logical address segment correspond to a storage area, and then establish a mapping relationship between the maximum data storage time of each storage area and the logical address segment, and then send the maximum data storage time of each of these N storage areas to the host.
  • the mapping relationship with the logical address segment allows the host to select the target storage area based on the target storage time of the data to be stored when generating a write command, and use the logical address segment of the target storage area as area identification information.
  • the controller is further configured to: receive a write command sent by the host; the write command includes the data to be stored and the target area identification information of the target storage area; the target storage area is One of the N storage areas, each of the storage areas corresponding to one area identification information; based on the target area identification information in the write command, write the data to be stored into the target storage area .
  • the controller in the storage device divides multiple storage blocks into N storage areas based on the area configuration information
  • the write command received by the controller includes the data to be stored and the target area identification information
  • the controller can store the data to be stored in the target storage area based on the target area identification information, thereby achieving data storage according to the target storage time of the data to be stored, avoiding the need for all data to be stored according to the same and maximum data storage time. storage, leading to the problem of wasting storage resources, thereby improving the utilization and service life of external memory.
  • the controller is further configured to: based on the longest data storage time corresponding to each storage area, configure the maximum erasability of the Block included in each storage area. The shorter the maximum data storage time corresponding to the storage area, the greater the maximum erasability number of the Block included in the storage area.
  • the shorter the maximum data storage time is configured the smaller the hardware wear on the storage block every time data is written, so a greater number of erasable times can be configured.
  • Improve storage block utilization the longer the maximum data storage time is configured, the greater the hardware wear on the storage block every time data is written. To ensure that the data to be stored is not lost, a smaller number of erasable times can be configured to avoid excessive
  • the problem of erasing memory blocks reduces data stability and improves the utilization and service life of external memory.
  • the implementation example of this application provides a processing device, which is characterized in that it includes a host, and the host is used to: generate area configuration information.
  • the area configuration information includes the number of storage areas N, the size of each storage area, and the size of each storage area. The longest data storage time corresponding to the storage area, N is an integer greater than 1; send the area configuration information to the storage device, the area configuration information is used by the storage device to divide M storage blocks into N storage areas , each storage area corresponds to a maximum data storage time, and M is an integer greater than 1.
  • the host sends area configuration information to the external storage (such as a storage device SSD), and then the storage blocks (Blocks) in the external storage can be partitioned through the controller of the external storage to obtain different storage areas.
  • the maximum data storage time of these different storage areas is different, so that data with different storage time requirements (such as Store the data that needs to be saved for a long time in the storage area with the longest data storage time, and store the data that needs to be stored briefly in the storage area with the shortest data storage time), so that the data storage of the entire external memory can be maximized Make good use of the storage characteristics of each storage area to effectively improve the utilization and service life of external memory.
  • the host is further configured to: select a target storage area from the N storage areas according to the demand information of the data to be stored; the demand information includes the desired storage area of the data to be stored.
  • Target storage time the maximum data storage time corresponding to the target storage area is greater than or equal to the target storage time; each storage area corresponds to a region identification information; send a write command to the storage device, the write The command includes the number to be stored and the target area identification information of the target storage area.
  • the host selects a target area whose longest data storage time is greater than or equal to the target storage time from multiple storage areas based on the target storage time required for the data to be stored. Further, when the host issues a write command, the write command not only needs to include the data to be stored, but also needs to carry information used to identify the target storage area, so that the storage device can store the data to be stored after receiving the write command. It is stored in the target storage area, thereby realizing data storage according to the target storage time of the data to be stored, avoiding the problem of wasting storage resources due to all data being stored according to the same and longest data storage time, thereby improving external performance. storage utilization and service life.
  • the host is further configured to determine the target storage time according to the data type of the data to be stored, where the data type includes temporary data generated during application use, background application anonymous The stack data corresponding to the page, one or more types of data that can be discarded after the application is closed.
  • the host since the host has different access requirements for different types of data, the data storage time required for different types of data may be different. Therefore, the host can determine the required target storage time based on the data type of the data to be stored. Then the target storage area can be determined based on the target storage time, so that after the storage device receives the write command, it can store the data to be stored in the target storage area, thereby achieving data storage according to the target storage time of the data to be stored, and avoiding All data is stored according to the same and maximum data retention time, which leads to the problem of wasting storage resources, thereby improving the utilization and service life of external memory.
  • the host is specifically configured to: from the N storage areas, determine a storage area whose maximum data storage time is greater than or equal to the target storage time as the target storage area. ; Send a write command to the controller, where the write command includes the data to be stored and a target area identifier corresponding to the target storage area.
  • the host can save the data from the N storage areas based on the target storage time of the data to be stored.
  • the storage area whose maximum data storage time is greater than or equal to the target storage time is determined as the target storage area.
  • the host can use the area identification corresponding to the target storage area as the area identification information, so that after the storage device receives the write command, it can store the data to be stored in the area based on the area identification.
  • the target storage area it is possible to store data according to the target storage time of the data to be stored, avoiding the problem that all data is stored according to the same and longest data storage time, resulting in a waste of storage resources, thus improving the efficiency of external storage. Utilization and service life.
  • the write command also includes a target logical address, and the target logical address is any address in the available logical address space of the host; the target logical address and the target storage There is a mapping relationship between target physical addresses in the area, and the target physical address is the physical address where the data to be stored is actually stored in the target storage area.
  • the area identification can be used as area identification information.
  • the write command in addition to the data to be stored and target area identification information, the write command also needs to include a logical address so that the subsequent host can read data from the storage device based on the logical address.
  • the host is specifically configured to: from the N storage areas, determine a storage area whose maximum data storage time is greater than or equal to the target storage time as the target storage area. ; Determine the target logical address segment corresponding to the target area, select the target logical address from the target logical address segment; send a write command to the controller, the write command carries the data to be stored and the target logical address.
  • the host can select from the N storage areas based on the target storage time of the data to be stored. Determine the storage area whose maximum data storage time is greater than or equal to the target storage time as the target storage area. Further, when the host generates a write command for the data to be stored, it can select an address from the logical address segment corresponding to the target storage area as the target. Mark the logical address, and use the target logical address as the area identification information, so that after the storage device receives the write command, it can store the data to be stored in the target storage area based on the target logical address, thereby realizing the method according to the data to be stored. Data is stored according to the target storage time, which avoids the problem of wasting storage resources due to all data being stored according to the same and maximum data storage time, thus improving the utilization rate and service life of external memory.
  • the implementation example of this application provides a data partition management method, which is characterized in that it is applied to a storage device.
  • the storage device includes M storage blocks Block, where M is an integer greater than 0.
  • the method includes: determining an area. Configuration information.
  • the area configuration information includes the number N of storage areas, the size of each storage area, and the longest data storage time corresponding to each storage area.
  • N is an integer greater than 1; according to the number N of storage areas and the size of each storage area, The size of the area, the M storage blocks Block is divided into N storage areas; each storage area in the N storage areas includes one or more Blocks; the N storage areas are configured according to the area configuration information.
  • Each storage area in the region is configured with its own maximum data retention time.
  • the method further includes: receiving the area configuration information sent by the host, or negotiating the area configuration information with the host.
  • the method further includes: generating a corresponding area identification for each storage area, and establishing a relationship between the longest data storage time of each storage area and the corresponding area identification. Mapping relations.
  • the method further includes: dividing the available logical address space of the storage system into N logical address segments; establishing the maximum data storage time of each storage area and the N The mapping relationship between a logical address segment in a logical address segment.
  • the method further includes: receiving a write command sent by the host; the write command includes the data to be stored and the target area identification information of the target storage area; the target storage area is the One of N storage areas, each storage area corresponding to one area identification information; based on the target area identification information in the write command, write the data to be stored into the target storage area.
  • the method further includes: based on the longest data storage time corresponding to each storage area, configuring the maximum erasable number of times for the Block included in each storage area. ; The shorter the maximum data storage time corresponding to the storage area, the greater the maximum erasability number of Blocks included in the storage area.
  • the implementation example of this application provides a data partition management method, which is characterized in that the method includes: generating area configuration information, the area configuration information includes the number of storage areas N, the size of each storage area, the size of each storage area, The corresponding longest data storage time, N is an integer greater than 1; send the area configuration information to the storage device, the area configuration information is used by the storage device to divide the M storage blocks into N storage areas, each Each of the storage areas corresponds to a maximum data storage time, and M is an integer greater than 1.
  • the method further includes: selecting a target storage area from the N storage areas according to the demand information of the data to be stored; the demand information includes the desired target of the data to be stored Storage time, the maximum data storage time corresponding to the target storage area is greater than or equal to the target storage time; each storage area corresponds to a region identification information; send a write command to the storage device, the write command Target area identification information including the data to be stored and the target storage area.
  • the method further includes: determining the target storage time according to the data type of the data to be stored.
  • the data type includes temporary data generated during application use, background application anonymous pages Corresponding stack data, one or more types of data that can be discarded after the application is closed.
  • sending a write command to the controller includes: from the N storage areas , determine the storage area whose maximum data storage time is greater than or equal to the target storage time as the target storage area; send a write command to the controller, where the write command includes the data to be stored and the The target area identifier corresponding to the target storage area.
  • the write command also includes a target logical address, and the target logical address is any address in the available logical address space; the target logical address is the same as the target in the target storage area.
  • the target physical address is the physical address where the data to be stored is actually stored in the target storage area.
  • sending a write command to the controller includes: determining, from the N storage areas, a storage area in which the maximum data storage time is greater than or equal to the target storage time. for the target storage area; determine the target logical address segment corresponding to the target area, select the target logical address from the target logical address segment; send a write command to the controller, the write command carries the to-be- Store data and the target logical address.
  • the present application provides a computer storage medium, characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the above third aspects is implemented, or It is the method described in any one of the above fourth aspects.
  • inventions of the present application provide an electronic device.
  • the electronic device includes a processor.
  • the processor is configured to support the electronic device in implementing corresponding functions in a data partition management method provided in the third aspect, or Implement corresponding functions in a data partition management method provided in the fourth aspect.
  • the electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device.
  • the electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
  • the present application provides a chip system, which includes a processor and is used to support an electronic device to implement the functions involved in the third aspect and to implement the functions involved in the fourth aspect, for example, generating Or process the information involved in the above data partition management method.
  • the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the electronic device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • the present application provides a computer program, characterized in that the computer program includes instructions that, when the computer program is executed by a computer, cause the computer to perform any of the methods described in the third aspect. , perform the method described in any one of the above fourth aspects.
  • FIG. 1A is a schematic structural diagram of a host and a storage device provided by an embodiment of the present invention.
  • FIG. 1B is a schematic structural diagram of a storage device provided by an embodiment of the present invention.
  • Figure 2 is a schematic diagram of a storage system provided by an embodiment of the present invention.
  • Figure 3 is a schematic diagram of data interaction between a host and a storage device according to an embodiment of the present invention.
  • Figure 4 is a schematic flowchart of a storage device configuring a storage area according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of data writing provided by an embodiment of the present invention.
  • Figure 6 is a schematic diagram of partition data management provided by an embodiment of the present invention.
  • Figure 7 is a schematic diagram of another partition data management provided by an embodiment of the present invention.
  • Figure 8 is a schematic diagram of a data partition provided by an embodiment of the present invention.
  • Figure 9 is a flow chart of a data partition management method provided by an embodiment of the present invention.
  • Figure 10 is a flow chart of another data partition management method provided by an embodiment of the present invention.
  • an embodiment means that a particular feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application.
  • the appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those skilled in the art understand, both explicitly and implicitly, that the embodiments described herein may be combined with other embodiments.
  • NAND Flash (Not AND Flash, NAND Flash) is a non-volatile storage medium that can still save data after power is turned off. Its development goal is to reduce the cost of storage per bit and increase storage capacity. Usually, NAND Flash is read and written in page units and erased in block units. Due to the principle of Flash storage, writing data to Flash can only change the data (bit) from 1 to 0; while erasing can only change all data (bit) from 0 to 1. Therefore, modified data or newly written data must be written to the free page that has been erased, otherwise the data will be messed up.
  • Solid State Drive Solid State Disk or Solid State Drive, SSD
  • Solid state drive is a hard drive made of an array of solid-state electronic storage chips.
  • SSD consists of a control unit and a storage unit (FLASH chip, DRAM chip).
  • FLASH chip DRAM chip
  • the FLASH chip in SSD usually uses the above-mentioned NAND Flash chip as its storage unit.
  • the interface specifications and definitions, functions and usage methods of solid-state drives are exactly the same as those of ordinary hard drives.
  • the product appearance and size are also completely consistent with ordinary hard drives. It is widely used in military, vehicle, industrial control, video surveillance, network monitoring, network terminals, electric power, medical, aviation, navigation equipment and many other fields.
  • Flash Friendly File System is a storage architecture for files on the operating system. It is a new open source flash file system specially designed for NAND-based storage devices. F2FS supports Linux operating system. It is suitable for NAND and other flash memory devices (such as solid state drives, eMMC and SD cards, etc.), which is more suitable for current mobile devices.
  • GC Garbage Collection
  • Figure 1A is a schematic structural diagram of a host and a storage device provided by an embodiment of the present invention.
  • the host 10 can be any computing device that generates data, such as a server, a personal computer, a tablet, a mobile phone, or a personal digital assistant. , smart wearable devices and other types of equipment; storage devices
  • the device 103 may be any non-volatile memory that provides the host 10 with the function of storing/reading data.
  • the storage device 103 may be built into the host 10 , or may be an independent device from the host 10 , or the storage device 103 and the host 10 may be co-located in an electronic device.
  • the host 10 or the storage device 103 may specifically be a chip or chipset or a circuit board equipped with the chip or chipset.
  • the chip or chipset or the circuit board equipped with the chip or chipset can work under necessary software drivers. specifically,
  • the host 10 may include a processor (central processing unit, CPU) 100 and an internal memory 101.
  • the host controller 102 may also be included.
  • all physical devices on the application processing side such as power supplies, other input/output controllers, and interfaces not shown in FIG. 1A may also be included. in,
  • Processor 100 can run an operating system, a file system (such as a flash file system F2FS) or an application program, etc., to control multiple hardware or software components connected to the processor 100, and can process various data and perform operations.
  • the processor 100 can load the instructions or data stored in the storage device 103 into the internal memory 101, and transfer the instructions or data that require operation to the processor 100 for operation. After the operation is completed, the processor 100 temporarily stores the results.
  • instructions or data that require long-term storage are stored in the storage device 103 through the host controller 102.
  • the processor 100 may include one or more processing units (also called processing cores).
  • the processor 100 may include a central processing unit (CPU), an application processor (application processor, AP), a modem processing unit, a graphics Processing unit (graphics processing unit, GPU), image signal processing unit (image signal processor, ISP), video encoding and decoding unit, digital signal processing unit (digital signal processor, DSP), baseband processing unit and neural network processing unit (neural- One or more of network processing unit, NPU), etc.
  • CPU central processing unit
  • AP application processor
  • modem processing unit graphics Processing unit
  • graphics Processing unit graphics Processing unit
  • image signal processor, ISP image signal processor
  • video encoding and decoding unit video encoding and decoding unit
  • digital signal processing unit digital signal processor, DSP
  • baseband processing unit baseband processing unit
  • neural network processing unit neural- One or more of network processing unit, NPU
  • different processing units can be independent devices or integrated in one or more devices.
  • the processor 100 may also be provided with a memory for storing instructions and data.
  • the memory in processor 100 is a cache memory (C
  • the processor 100 may also be implemented as a system on chip (SoC).
  • SoC system on chip
  • the internal memory 101 is usually a power-off volatile memory. The contents stored therein will be lost when the power is off. It can also be called memory or main memory.
  • the internal memory 101 in this application includes a readable and writable running memory, which is used to temporarily store the operation data in the processor 100 and to interact with the storage device 103 or other external memories. It can be used as an operating system or other ongoing memory. A storage medium for temporary data of running programs. For example, the operating system running on the processor 100 transfers the data that needs to be calculated from the internal memory 101 to the processor 100 for calculation. When the calculation is completed, the processor 100 transmits the result.
  • the internal memory 101 may include one or more of dynamic random access memory (DRAM), static random access memory (SRAM), synchronous dynamic random access memory (SDRAM), and the like.
  • DRAM also includes Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), referred to as DDR, second-generation double-rate synchronous dynamic random access memory (DDR2), and third-generation double-rate synchronous dynamic random access memory (DDR SDRAM).
  • DDR SDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • DDR2 second-generation double-rate synchronous dynamic random access memory
  • DDR SDRAM third-generation double-rate synchronous dynamic random access memory
  • DDR3 the fourth generation of low power double data rate synchronous dynamic random access memory
  • LPDDR4 Low Power Double Data Rate 4
  • LPDDR5 Low Power Double Data Rate 5
  • LPDDR5 Low Power Double Data Rate 5
  • the host controller 102 is used to manage and control the communication between the host 10 and the storage device 103, and provide a standardized (for example, universal flash storage UFS standard) interface for the communication between the host 10 and the storage device 103. Specifically, the host controller 102 can transmit commands (for example, write, read, erase, etc. commands) and data to the storage device 103 according to read/write requests issued by the processor 100, and read/write data according to the storage device 103. Write data and other results to feed back events to the host 10 (such as Command completion events, command status events, hardware error events, etc.).
  • the host controller 102 can convert the commands or data into data packets supporting a certain protocol through encapsulation, and for data received by the host 10, the host controller 102 performs the reverse operation.
  • a host can support multiple host controllers (Host Controller) to support communication with storage devices of different protocols.
  • the host controller 102 generates the write command involved in this application according to the protocol (such as the UFS protocol) supported between the host 10 and the storage device 103, and the generated command can carry data.
  • Area identification information to indicate to the storage device 103 the area where data needs to be stored.
  • the functions of the host controller 102 can also be integrated into the processor 100, that is, the processor 100 completes the above functions of the host controller 102, which are not specifically limited here.
  • the storage device 103 may include multiple storage blocks.
  • the multiple storage blocks may be partitioned so that the storage device 103 at least includes a first storage area 1031 and a second storage area 1032 .
  • the storage device 103 may also include a storage controller 1033.
  • the storage performance of the first storage area 1031 and the second storage area 1032 are different, so that they are respectively used to store data with different performance requirements. That is to say, the data storage time of blocks included in different storage areas is different. in,
  • the storage device 103 is a non-volatile memory, and its stored content will not be lost after power failure.
  • the storage device 103 (which may include the first storage area 1031 and the second storage area 1032, etc.) may be used for long-term storage of instructions and data involved in the operation of the host 10, such as startup programs, operating systems, application programs, and data.
  • the processor 100 in the host 10 cannot directly read instructions and data in the storage device 103 nor directly write instructions or data to the storage device 103, when the processor 100 executes a read (or load) command, it actually The host controller 102 temporarily loads the content to be read (including instructions and/or data) stored in the storage device 103 into the internal memory 101, and then the processor 100 reads it out from the internal memory 101; and in When executing a write (ie, store) command, the processor 100 actually first temporarily writes the data to be stored (including instructions and/or data) into the internal memory 101, and then stores it from the internal memory 101 through the host controller 102. to storage device 103. If the available life of the storage device 103 is short, the performance of the host 10 will be affected.
  • the storage blocks in the storage device 103 are partitioned, that is, the storage device 103 at least includes a first storage area 1031 and a second storage area 1032, and the first storage area 1031 and the second storage area 1032 are The maximum data storage time is different. Therefore, the embodiment of the present invention can store data with different storage times in corresponding storage areas based on the target storage time required for the data to be stored, that is, perform partition management on the host data to avoid all data Storage according to the same storage time leads to the problem of wasting storage resources.
  • the service life of the storage device 103 can also be improved without increasing costs, reducing available space, and affecting the reliability of key host data. This will be further explained in subsequent embodiments and will not be described in detail here.
  • the storage device 103 may include Flash memory (for example, NAND flash memory, NOR flash memory, etc.), universal flash memory (universal flash storage, UFS), embedded multimedia card eMMC, universal flash memory storage multi-chip package uMCP memory, embedded multimedia card multi-chip Package one or more of eMCP memory, solid state drive (SSD), etc.
  • the storage device 103 at least includes a first storage area 1031 and a second storage area 1032, and both the first storage area 1031 and the second storage area 1032 may include a single-layer unit SLC storage area, a multi-layer unit SLC storage area, or a multi-layer unit SLC storage area.
  • the storage device 103 may also include other storage media such as a mechanical hard disk (Hard Disk Drive, HDD), etc.
  • FIG. 1B is a schematic structural diagram of a storage device according to an embodiment of the present invention.
  • the first storage area 1031 may include M blocks, and each Block may include N pages. ), and each page It also contains a certain number of cells (cells). All cells in all pages in all blocks in the first storage area 1031 can be single-level cells (Single-Level Cell, SLC), multi-level cells (Multi-Level Cell, MLC) or triple-level cell (Triple-level Cell, TLC), one or more, which is not limited here.
  • SLC Single-Level Cell
  • MLC multi-level cells
  • TLC triple-level Cell
  • the second storage area may include L blocks, each block may include N pages (the number may not be N), and each page may include a certain number of cells, and the second storage area All cells in all pages in all blocks in 1032 may also be one or more of single-level cells (SLC), multi-level cells (MLC), or three-level cells (TLC), which are not limited here.
  • the storage medium can be configured through software so that the maximum data retention time of blocks in different storage areas is different.
  • Page is the smallest addressing unit in NAND Flash, that is, the smallest unit of read/write.
  • the number of Pages in a Block varies depending on the specifications of different manufacturers, and the size of the Pages themselves is also different. For example, there are 1024 pages in a Block, and the size of each page is (16KB+2208B).
  • 16KB is the data area used to store data
  • 2208B is the metadata area used to store metadata.
  • 16KB is used to store a or multiple target data
  • 2208B is used to store the area identification information respectively corresponding to the one or more target data.
  • the erasure performance of SLC and MLC is similar, while the read performance (including read speed), write performance (including write speed) and storage performance (including storage life) of SLC flash memory are better than MLC/TLC flash memory.
  • the storage controller 1033 is an interface device between the host 10 and the storage device 103. Its main function is to convert the interface and convert the read, write, delete and other commands issued by the host 10 (for example, the host controller in the host 10) into storage devices.
  • the signal that the device 103 can recognize can also complete address decoding between the host 10 and the storage device 103 (for example, the mapping between the logical address of the host 10 and the physical address in the storage device 103), and the conversion of data formats (such as data bit width). )wait.
  • the storage controller 1033 can perform necessary control of access to the storage device 103 where it is located according to certain timing rules, including the control of address signals, data signals and various command signals, so that the host 10 can use the storage device according to needs.
  • the storage controller 1033 receives and parses the read command or write command sent by the host controller 102 in the host 10, and converts the logical address of the data according to the fixed address according to the logical address of the data carried in the read command or write command.
  • the mapping relationship is parsed into a physical address, and then the location of the data to be read or written is found, and finally a control signal corresponding to the command is sent to the first storage area 1031 or the second storage area 1032.
  • the computer program used to implement any of the data partition management methods in this application involves and includes multiple functions. , part of which is the process of determining the target storage time of the data to be stored on the host 10 side, and carrying the area identification information of the data to be stored in the write command; the other part is the process of partitioning the storage block on the storage device 103 side, And receive the data to be stored and perform the storage process.
  • the prediction function of the target storage time can be implemented by the data partition management program in the operating system running by the processor 100.
  • the storage management function after the target storage time is determined can be implemented by the file system in the operating system running by the processor 100.
  • the storage block partitioning and data storage can be implemented as a control program running in the storage controller 1033.
  • the usable life of the storage device 103 is improved. This will be further explained in subsequent embodiments and will not be described in detail here.
  • the structures of the host 10 or the storage device 103 in Figure 1A or 1B are only some exemplary implementations provided by the embodiment of the present invention.
  • the structures of the host 10 and the storage device 103 in the embodiment of the present invention include but Not limited to the above implementation methods.
  • the processor 100, the internal memory 101, the host controller and the storage device 103 can communicate with each other through the system bus, or can also communicate through other connection methods, which are not specifically limited in the embodiment of the present invention. .
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation of the host 10 or the storage device 103.
  • the host 10 or the storage device 103 may include more or less components than shown in the figures, or some components may be combined, or some components may be separated, or may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • Figure 2 is a schematic diagram of a storage system provided by an embodiment of the present invention.
  • the storage device and processing device in the embodiment of the present application will be described in detail below with reference to Figure 2.
  • the storage system 20 includes: a host 201 (which can be used as a processing device) and a storage device 202 (which can be used as a storage device).
  • the storage device 202 also includes a controller 2021 and M storage blocks Block, M is an integer greater than 0.
  • the functions of the host 201 may include all the functions of the host 10 in FIG. 1A
  • the functions of the storage device 202 may include all the functions of the storage device 103 in FIG. 1A
  • the controller 2021 may be the function of the storage device 103 in FIG. 1A .
  • the storage controller 1033, the storage block Block is the storage medium in the storage device 202. in,
  • the controller 2021 is used to determine area configuration information.
  • the area configuration information includes the number of storage areas N, the size of each storage area, and the longest data storage time corresponding to each storage area.
  • N is an integer greater than 1.
  • the area configuration information needs to be determined first, that is, it is first determined how many storage areas need to be divided into which the storage medium needs to be divided. How many storage blocks need to be included in the area (that is, the size of the storage area), and the maximum data storage time corresponding to each storage area.
  • the ratio of user data (User Data) and exchange data (Swap Data) can be determined to be 7:3 based on the user model, and the storage time requirements of these two types of data are 40°C 1Year respectively (in a 40°C environment, the longest storage time time is 1 year) and 40°C 1Month (in a 40°C environment, the maximum storage time is 1 month), so the area configuration information can divide the storage medium into 2 storage areas, and the first storage area occupies 50% of the total space 70%, the second storage area accounts for 30% of the total space, the maximum data retention time of the first storage area is 1 year, and the maximum data retention time of the second storage area is 1 month.
  • a processing device which is characterized in that it includes a host 201, and the host 201 is used to: generate area configuration information, where the area configuration information includes the number of storage areas N, the size of each storage area, The longest data storage time corresponding to each storage area, N is an integer greater than 1; send the area configuration information to the storage device 202, the area configuration information is used by the storage device to divide the M storage blocks into N Storage area, each storage area corresponds to a maximum data storage time, and M is an integer greater than 1.
  • the controller 2021 is also configured to: receive the area configuration information sent by the host 201, or negotiate the area configuration information with the host 201.
  • the area configuration information can be generated by the host 201 according to the requirements on the host 201 side and delivered to the storage device 202, or can be obtained through negotiation between the storage device 202 and the host 201, so that the controller 2021 of the storage device 202 can configure the configuration information based on the configuration information.
  • Partition the storage block (Block) and the controller 2021 can also configure the software to make the maximum data storage time of different storage areas different, so that the controller 2021 can store data based on multiple storage areas, improving the utilization of external memory. rate and service life.
  • Figure 3 is a schematic diagram of data interaction between a host and a storage device provided by an embodiment of the present invention.
  • a regional configuration module can be added to the controller 2021 of the storage device 202 for receiving host data.
  • the area configuration information sent in 201 further, the area configuration module can divide the storage area based on the area configuration information.
  • the controller 2021 is also configured to divide the M storage blocks Block into N storage areas according to the number N of storage areas and the size of each storage area; each of the N storage areas
  • the storage area includes one or more Blocks.
  • the storage block Block is a storage medium in the storage device 202 and is used to actually store data. Specifically, after the controller 2021 of the storage device 202 determines the area configuration information, it first divides the multiple storage blocks into N storage areas according to the number N of areas in the area configuration information and the size of each area.
  • a zone can include one or more storage block. For example, as shown in Figure 3, a region configuration module can be added to the controller 2021.
  • the region configuration module can divide multiple storage blocks into N storage regions according to the number N of regions in the region configuration information and the size of each region ( As shown in the first storage area, the second storage area, the Nth storage area, etc. in Figure 3, it should be noted that the NAND in the figure may include one or more storage blocks (Block).
  • the controller 2021 is also configured to configure a respective maximum data storage time for each of the N storage areas according to the area configuration information. Specifically, the controller 2021 configures the maximum data storage time of each of the N storage areas according to the maximum data storage time corresponding to each storage area. For storage blocks, the maximum data storage time can be configured through software to achieve different maximum data storage times in different storage areas. Therefore, the controller 2021 can store data based on multiple storage areas, improving the utilization of external memory. and service life.
  • Figure 4 is a schematic flowchart of a storage device configuring a storage area according to an embodiment of the present invention. In the figure, the host 201 (Host) allocates corresponding data to the storage device 202 (such as an external SSD) according to needs.
  • the SSD parses the command and obtains the size of the storage interval and the corresponding storage time requirement; the SSD allocates blocks of corresponding sizes to form a storage area based on the size of the storage interval, and provides The maximum data retention time corresponding to each storage area configuration.
  • the controller 2021 is further configured to: based on the longest data storage time corresponding to each storage area, configure the maximum available block size of the Block included in each storage area.
  • the shorter the maximum data storage time is configured the smaller the hardware wear on the storage block each time data is written. Therefore, a larger number of erase times can be configured to improve the storage block's performance. Utilization.
  • the longer the maximum data storage time is configured the greater the hardware wear on the storage block every time data is written.
  • the storage system further includes a host 201, the host 201 is configured to: select a target storage area from the N storage areas according to the demand information of the data to be stored; the demand information includes the expected target storage time of the data to be stored, and the maximum data storage time corresponding to the target storage area is greater than or equal to the target storage time; each storage area corresponds to a region identification information; to the The controller 2021 sends a write command, which includes the data to be stored and the target area identification information of the target storage area. Specifically, the host 201 selects a target area whose longest data storage time is greater than or equal to the target storage time from multiple storage areas based on the target storage time required for the data to be stored.
  • the write command not only needs to include the data to be stored, but also needs to carry information for identifying the target storage area, so that the storage device 202 can store the data to be stored after receiving the write command.
  • the stored data is stored in the target storage area, thereby achieving data storage according to the target storage time of the data to be stored, avoiding the problem of wasting storage resources due to all data being stored according to the same and longest data storage time, thereby improving The utilization rate and service life of external memory are improved.
  • Figure 5 is a schematic flow chart of data writing provided by an embodiment of the present invention.
  • the Host appends Region information (i.e., region identification) to the command reserved field according to the written data storage time requirement. information), then after receiving the command, the SSD controller 2021 first parses to obtain the corresponding Region information, and compares the configuration information to obtain the location information where the data is written. Finally, the SSD writes the data to the storage area corresponding to the NAND Flash based on the Host's command information. .
  • Region information i.e., region identification
  • the target storage time of the data to be stored is first predicted to obtain a predicted value, and then the programming voltage of the memory block is controlled based on the predicted value. If there is a large deviation between the predicted value and the actual value, will lead to The key data is lost and the storage block as a whole does not meet the storage time requirement.
  • the different maximum data storage times of each storage area are first uniformly configured, and then the data with corresponding time storage requirements are scheduled to the storage area with the longest data storage time, and the target is guaranteed
  • the maximum data storage time of the storage area can be greater than or equal to the target storage time of the data to be stored. Even if there is an error in the target storage time of some data to be stored, it will only have some impact on this part of the data, which can guarantee the data to a certain extent. Stability does not waste resources in the entire storage area.
  • the host 201 is also configured to determine the target storage time according to the data type of the data to be stored, which data type includes but is not limited to temporary data generated during application use. , the stack data corresponding to the anonymous page of the background application, and one or more types of data that can be discarded after the application is closed. Specifically, since the host 201 has different access requirements for different types of data, the data storage time required for different types of data may be different.
  • the host 201 can determine the required target storage time based on the data type of the data to be stored, and then based on The target storage time determines the target storage area, so that after the storage device 202 receives the write command, it can store the data to be stored in the target storage area, thereby achieving data storage according to the target storage time of the data to be stored, and avoiding all data They are all stored according to the same and maximum data retention time, which leads to the problem of wasting storage resources, thereby improving the utilization and service life of external memory.
  • the data to be stored is temporary data generated during the use of the application, or stack data corresponding to the anonymous page of the background application, or data whose life cycle is limited to the opening stage of the application and can be discarded after the application is closed. Due to the storage time of this type of data, The demand is shorter than normal data, so it can be determined that the target storage data of the data to be stored is shorter.
  • the controller 2021 is also configured to: receive a write command sent by the host 201; the write command includes the data to be stored and the target area identification information of the target storage area; the target storage area The area is one of the N storage areas, and each storage area corresponds to one area identification information; based on the target area identification information in the write command, the data to be stored is written to the target storage area.
  • the write command received by the controller 2021 includes the data to be stored and the target area identification information, and then The controller 2021 can store the data to be stored in the target storage area based on the target area identification information, thereby achieving data storage according to the target storage time of the data to be stored, and avoiding all data being stored according to the same and maximum data storage time. storage, leading to the problem of wasting storage resources, thereby improving the utilization and service life of external memory.
  • the controller 2021 (Controller) inside the SSD manages the data arrangement and arrangement in the NAND Flash.
  • Related configurations are responsible for processing commands issued by HOST.
  • a region configuration module (Region Config) and a data access module (Data Access) functional sub-module can be added to the controller 2021, and then the optimal configuration of different regions can be controlled with the help of these functional sub-modules. Long data storage time is configured and accessed.
  • the regional configuration module divides the NAND Flash into different regions to meet the Host's needs for different storage times.
  • the controller 2021 is also configured to: generate a corresponding area identification for each storage area, and establish the longest data storage time and corresponding area identification for each storage area. mapping relationship between them.
  • the controller 2021 is also configured to send the mapping relationship to the host 201. Specifically, after the controller 2021 in the storage device 202 divides multiple storage blocks into N storage areas based on the area configuration information, a region identifier can also be generated for each storage area, so that one area identifier corresponds to one storage area.
  • the mapping relationship between the longest data storage time of each storage area and the area identifier can be established, and then the mapping relationship between the longest data storage time of each of the N storage areas and the area identifier is sent to the host 201, Therefore, when generating a write command, the host 201 can select a target storage area according to the target storage time of the data to be stored, and use the area identification of the target storage area as the area identification information. For example, assume that the storage device 202 includes two storage areas, and the longest number of the first storage area The data retention time is 1 year, and the maximum data retention time in the second storage area is 3 days. The storage device 202 can generate an area identifier for each storage area, and establish a mapping relationship between the respective longest data storage time and the area identifier.
  • the area identifier of the first storage area is 001 and the identifier is related to the longest data storage area.
  • the storage time is associated with 1 year.
  • the area ID of the second storage area is 002 and this ID is associated with the maximum data storage time of 3 days.
  • the storage device 202 will send the mapping relationship between the two area identifiers and the longest data storage time to the host 201, so that the host 201 can select one of the two storage areas as the target storage time according to the target storage time of the data to be stored.
  • Target storage area is 001 and the identifier is related to the longest data storage area.
  • the storage time is associated with 1 year.
  • the area ID of the second storage area is 002 and this ID is associated with the maximum data storage time of 3 days.
  • the host 201 is specifically configured to: from the N storage areas, determine a storage area whose maximum data storage time is greater than or equal to the target storage time as the target storage. area; send a write command to the controller 2021, where the write command includes the data to be stored and a target area identifier corresponding to the target storage area. Specifically, after the host 201 obtains the mapping relationship between the maximum data storage time of each of the N storage areas and the area identifier, the host 201 can save the maximum data from the N storage areas based on the target storage time of the data to be stored. The storage area whose storage time is greater than or equal to the target storage time is determined as the target storage area.
  • the host 201 when the host 201 generates a write command for the data to be stored, the host 201 can use the area identification corresponding to the target storage area as the area identification information, so that after the storage device 202 receives the write command, the data to be stored can be stored based on the area identification. It is stored in the target storage area, thereby realizing data storage according to the target storage time of the data to be stored, avoiding the problem of wasting storage resources due to all data being stored according to the same and longest data storage time, thereby improving external performance. storage utilization and service life.
  • the write command also includes a target logical address, and the target logical address is any address in the available logical address space of the storage system; the target logical address is used to communicate with the target logical address.
  • a mapping relationship is established between the target physical address in the target storage area, and the target physical address is the physical address where the data to be stored is actually stored in the target storage area. Specifically, if each storage area has a unique area identification, then the area identification can be used as area identification information.
  • the write command in addition to the data to be stored and the target area identification information, the write command also needs to include a logical address so that the subsequent host 201 can read data from the storage device 202 based on the logical address.
  • Figure 6 is a schematic diagram of partition data management provided by an embodiment of the present invention.
  • the HOST side can pass data characteristics (that is, data with different characteristics may have different target storage times). Divide different intervals, including the common region (Common Region) corresponding to normal user data and the relaxed storage time region LR Region 1 ⁇ N. Furthermore, the division and management of the storage area on the SSD side can be informed through configuration. When writing data, it is necessary to carry area identification information (including but not limited to through characteristic identifiers, through logical address intervals, etc.) to inform the SSD of the location where the data is written.
  • area identification information including but not limited to through characteristic identifiers, through logical address intervals, etc.
  • the configuration process of the storage area is: First, the HOST can confirm the required interval and corresponding storage time according to the data type. Next, the host 201 can deliver the number of partitions (Region number), respective partition sizes (Region size) and storage time requirements to the storage device 202 (such as external storage SSD) through custom commands or protocol reserved fields. Further, the SSD controller 2021 parses the configuration command of the HOST, obtains the corresponding number of partitions, respective partition sizes and storage time, which can be saved to the region configuration module (Region Config) in the controller 2021. Then, the SSD controller 2021 allocates a certain Block according to the respective partition size to form a corresponding storage area.
  • the region configuration module (Region Config)
  • the controller 2021 restores the HOST settings successfully; if the remaining number of available blocks is not enough to meet the Region size requirements, the SSD controller 2021 returns the setting failure.
  • the data writing process is: first, the HOST attaches the Region number (i.e., region identification information) to the save field of the write command according to the type of data to be stored, and frames it and sends it to the SSD. Next, connect the SSD When receiving the write command issued by HOST, the corresponding Region number (i.e., region identifier) is parsed. Further, the SSD controller 2021 queries the corresponding Region Config information to confirm whether it matches the Region number in the write command issued by the Host. If the corresponding Region information is queried, the writable location of the corresponding Region is obtained and the data is written.
  • the Region number i.e., region identification information
  • Corresponding Region if the corresponding Region information cannot be queried, the data will be written to the common region (Common Region) and processed as normal user data. Finally, the SSD controller 2021 replies that the HOST write is successful.
  • the SSD can choose to reply that the HOST write failed. For example, assume that the write command includes the data to be stored and the target area identifier 001. When the SSD receives the write command, it will parse and identify the target area identifier 001, and then store the data to be stored in the storage area corresponding to 001.
  • the embodiment of the present invention does not need to adjust the physical medium of the storage block, and does not require additional customization, so no additional cost will be added; the embodiment of the present invention does not use SLC/TLC Mode switching in exchange for writing volume, so it does not affect the user's available space; the embodiment of the present invention combines business characteristics and performs partition management according to the data type on the host 201 side (that is, different types of data, the data storage time may be different) to avoid data Lost question.
  • the controller 2021 is also configured to: divide the available logical address space of the storage system into N logical address segments; establish the maximum data storage time and the maximum data storage time of each storage area. The mapping relationship between one of the N logical address segments.
  • the controller 2021 is also configured to send the mapping relationship to the host 201. Specifically, after the controller 2021 in the storage device 202 divides multiple storage blocks into N storage areas based on the area configuration information, the available logical address space of the storage system can also be divided into N logical address segments, so that one The logical address segment corresponds to a storage area.
  • mapping relationship between the longest data storage time of each storage area and the logical address segment can be established, and then the longest data storage time and the longest data storage time of each of these N storage areas are sent to the host 201.
  • the mapping relationship between logical address segments allows the host 201 to select a target storage area according to the target storage time of the data to be stored when generating a write command, and use the logical address segment of the target storage area as area identification information. For example, assume that the storage device 202 includes two storage areas, and the maximum data retention time of the first storage area is 1 year, and the maximum data retention time of the second storage area is 3 days.
  • the storage device 202 divides the available logical address space in the storage system into two logical address segments, and establishes a mapping relationship between the longest data storage time and the logical address segment.
  • the logical address segment of the first storage area is LBA0. ⁇ LBAm and this logical address segment is associated with the maximum data retention time of 1 year.
  • the logical address segment of the second storage area is LBAm+1 ⁇ LBAn and this logical address segment is associated with the maximum data retention time of 3 days. Then, the storage device 202 will send the mapping relationship between the two area identifiers and the longest data storage time to the host 201, so that the host 201 can select one of the two storage areas as the target storage time according to the target storage time of the data to be stored. Target storage area.
  • the host 201 is specifically configured to: from the N storage areas, determine a storage area whose maximum data storage time is greater than or equal to the target storage time as the target storage. area; determine the target logical address segment corresponding to the target area, select the target logical address from the target logical address segment; send a write command to the controller 2021, the write command carries the data to be stored and the Describe the target logical address. Specifically, after the host 201 obtains the mapping relationship between the maximum data storage time of each of the N storage areas and the logical address segment, the host 201 can obtain the maximum data storage time from the N storage areas based on the target storage time of the data to be stored.
  • the storage area whose data storage time is greater than or equal to the target storage time is determined as the target storage area. Further, when generating a write command for data to be stored, the host 201 can select an address from the logical address segment corresponding to the target storage area as the target logical address, and use the target logical address as the area identification information, so that the storage device After receiving the write command, 202 can store the data to be stored in the target storage area based on the target logical address, thereby realizing data storage according to the target storage time of the data to be stored, and avoiding the need for all data to be stored according to the same and longest storage time. Data retention time is stored, resulting in storage The problem of resource waste is eliminated, thereby improving the utilization rate and service life of external memory.
  • Figure 7 is a schematic diagram of another partition data management provided by an embodiment of the present invention.
  • the Host data identifies the storage time requirement of the data through a logical address range, and the SSD writes the data according to different LBA ranges. Enter different areas, as shown in Figure 8.
  • Figure 8 is a schematic diagram of a data partition provided by an embodiment of the present invention.
  • the OS partition in the figure can represent system files, and User Data can represent normal user data. They all need to be in accordance with 40°C 1Year (In a 40 degrees Celsius environment, the maximum data retention time is 1 year) specifications are stored in the storage medium, and Swap Data corresponds to the anonymous page data of the background application in the file system.
  • the temporary anonymous page data corresponding to some temporarily unused background applications will be temporarily stored in the SSD partition to facilitate quick response when subsequent applications are switched back to the foreground.
  • the overall storage time of this part of the data is short, generally no more than 7 days. , and when an abnormal power outage occurs, there is no demand for power recovery and has no impact on the reliability of the entire machine and user experience. It can be placed separately in the swap partition and the storage time is relaxed to increase the available life.
  • the configuration process of the storage area is: First, HOST obtains User Data and Swap Data based on the data type and user model. The ratio is 7:3, and the storage time requirements are 40°C 1Year (in In an environment of 40 degrees Celsius, the maximum data storage time is 1 year) and 40°C 1Month (in an environment of 40 degrees Celsius, the maximum data storage time is 1 month), according to the storage time and P/E (number of erasable times) ) corresponding relationship, 40°C 1Year corresponds to the P/E specification of 3000 times, and 40°C 1Month corresponds to the P/E specification of 8000 times (different media have differences and can be adjusted according to the actual situation).
  • the host 201 can deliver the partition number (Region number) and LBA range (respective logical address segment) to the SSD through custom commands or protocol reserved fields, and 86 of the logical address according to the allocated partition size ratio.
  • % is agreed to be the user data area
  • 14% is agreed to be the Swap data area.
  • the first 86% can be set as the user data area
  • the last 14% can be set as the Swap data area.
  • controller 2021 of the storage device 202 parses the configuration command of the HOST, obtains the corresponding number of partitions and LBA range, performs regional configuration, and saves them in the controller 2021. Finally, the SSD controller 2021 can reply that the HOST setting is successful.
  • the data writing process is: First, the Host applies for space from different logical address ranges according to the data type. In this example, user data is written in the range of 0% to 86% of the total space logically. Address range, Swap Data writes the logical address range between 86% and 100% of the total space. Next, after receiving the write command from the Host, the SSD controller 2021 parses the corresponding logical address LBA and write length, and manages the write direction of the data according to the agreed logical address partition configuration. Further, when the controller 2021 recognizes a request to write a logical address in the range of 0% to 86%, it writes the data to the corresponding Common Region.
  • the SSD can write the data into the NAND Flash based on the logical address LBA information and then reply to the HOST that the writing is successful.
  • the storage blocks are partitioned by the controller 2021 of the external memory (such as SSD), and the maximum data storage time of different storage areas is different through software configuration, so that the controller 2021 can be based on multiple A storage area is used to store data, which improves the utilization and service life of external memory.
  • the controller 2021 first divides multiple Block blocks into N storage areas. Further, the controller 2021 configures one or more Block blocks included in each storage area through software based on the longest data storage time corresponding to each storage area in the configuration information. Maximum data storage time to achieve different maximum data storage times in different storage areas.
  • the controller 2021 can store the data in the corresponding storage area according to the required storage time of the data to be stored, avoiding the problem of wasting hardware resources due to all storage blocks being configured according to the same maximum data storage time, and improving Utilization and service life of external storage.
  • the storage blocks are partitioned, data management can be facilitated, and it is also beneficial to maintaining and maintaining the overall performance of the storage device 202.
  • the maximum data retention time of the Block in this application is configured through software, there is no need to carry out personalized hardware customization with the external memory manufacturer, and it can be achieved without increasing costs, reducing available space, and without affecting data reliability. On the premise of ensuring safety, the service life of external memory is improved.
  • Figure 9 is a flow chart of a data partition management method provided by an embodiment of the present invention. This method is applicable to a storage system in Figure 2 and devices including the storage system. The method may include the following steps S301 to S303.
  • the storage system includes a storage device, and the storage device includes a controller and M storage blocks, where M is an integer greater than 0.
  • M is an integer greater than 0.
  • Step S301 Determine regional configuration information through the controller.
  • the area configuration information includes the number of storage areas N, the size of each storage area, and the longest data storage time corresponding to each storage area, where N is an integer greater than 1;
  • Step S302 The controller divides the M storage blocks into N storage areas according to the number N of storage areas and the size of each storage area.
  • each of the N storage areas includes one or more Blocks
  • Step S303 Use the controller to configure the maximum data storage time of each of the N storage areas according to the maximum data storage time corresponding to each storage area.
  • the method further includes: receiving, through the controller, the area configuration information sent by the host, or negotiating the area configuration information with the host.
  • the method further includes: generating, through the controller, a corresponding area identifier for each storage area, and establishing a maximum data storage time and corresponding location for each storage area.
  • the method further includes: dividing the available logical address space of the storage system into N logical address segments through the controller; establishing the longest data of each storage area The mapping relationship between the storage time and one of the N logical address segments.
  • the method further includes: receiving a write command sent by the host through the controller; the write command includes the data to be stored and the target area identification information of the target storage area;
  • the target storage area is one of the N storage areas, and each storage area corresponds to one area identification information; based on the target area identification information in the write command, the data to be stored is written to the Describe the target storage area.
  • the method further includes: using the controller, configuring the Block included in each storage area based on the longest data storage time corresponding to each storage area. The maximum number of erasable times; the shorter the maximum data storage time corresponding to the storage area, the greater the maximum number of erasable times of the Block included in the storage area.
  • the service life of the storage device can be improved.
  • Figure 10 is a flow chart of another data partition management method provided by an embodiment of the present invention. This method is applicable to a processing device in Figure 2 and equipment including the processing device. The method may include the following steps S401 and step S402. The detailed description is as follows:
  • Step S401 Generate area configuration information.
  • the area configuration information includes the number of storage areas N, the size of each storage area, and the longest data storage time corresponding to each storage area, where N is an integer greater than 1;
  • Step S402 Send the area configuration information to the storage device.
  • the area configuration information is used by the storage device to divide M storage blocks into N storage areas.
  • Each storage area corresponds to a maximum data storage time, and M is an integer greater than 1.
  • the method further includes: selecting a target storage area from the N storage areas according to the demand information of the data to be stored; the demand information includes the desired target of the data to be stored Storage time, the maximum data storage time corresponding to the target storage area is greater than or equal to the target storage time; each storage area corresponds to a region identification information; send a write command to the storage device, the write command Target area identification information including the data to be stored and the target storage area.
  • the method further includes: determining the target storage time according to the data type of the data to be stored.
  • the data type includes temporary data generated during application use, background application anonymous pages Corresponding stack data, one or more types of data that can be discarded after the application is closed.
  • sending a write command to the controller includes: determining, from the N storage areas, a storage area in which the maximum data storage time is greater than or equal to the target storage time. For the target storage area; send a write command to the controller, where the write command includes the data to be stored and a target area identifier corresponding to the target storage area.
  • the write command also includes a target logical address, and the target logical address is any address in the available logical address space; the target logical address is the same as the target in the target storage area.
  • the target physical address is the physical address where the data to be stored is actually stored in the target storage area.
  • sending a write command to the controller includes: determining, from the N storage areas, a storage area in which the maximum data storage time is greater than or equal to the target storage time. for the target storage area; determine the target logical address segment corresponding to the target area, select the target logical address from the target logical address segment; send a write command to the controller, the write command carries the to-be- Store data and the target logical address.
  • the present application provides a computer storage medium, which is characterized in that the computer storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above data partition management methods is implemented.
  • An embodiment of the present application provides an electronic device.
  • the electronic device includes a processor.
  • the processor is configured to support the electronic device to implement corresponding functions in any of the above data partition management methods.
  • the electronic device may also include a memory coupled to the processor that stores necessary program instructions and data for the electronic device.
  • the electronic device may also include a communication interface for the electronic device to communicate with other devices or communication networks.
  • the present application provides a chip system, which includes a processor and is used to support an electronic device to implement the above-mentioned functions, for example, generate or process information involved in the above-mentioned data partition management method.
  • the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the electronic device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • the present application provides a computer program, which is characterized in that the computer program includes instructions, which when the computer program is executed by a computer, causes the computer to execute the above-mentioned data partition management method.
  • the disclosed device can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the above units is only a logical function division. In actual implementation, there may be other divisions.
  • multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separated.
  • the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to cause a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to execute all or part of the steps of the above methods in various embodiments of the present application.
  • a computer device which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device
  • the aforementioned storage media may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviation: ROM) or random access memory (Random Access Memory, abbreviation: RAM), etc.
  • U disk mobile hard disk
  • magnetic disk magnetic disk
  • optical disk read-only memory
  • read-only memory Read-Only Memory
  • RAM random access memory

Abstract

本申请实施例公开了一种存储装置及相关数据分区管理方法,其特征在于,所述存储装置包括控制器和M个存储块Block,M为大于0的整数,其中,所述控制器用于:确定区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域;所述N个存储区域中的每个存储区域包括一个或多个Block;根据所述区域配置信息为所述N个存储区域中的每个存储区域配置各自的最长数据保存时间。采用本申请实施例能够提升存储设备的使用寿命。

Description

一种存储装置及相关数据分区管理方法
本申请要求于2022年03月07日提交中国专利局、申请号为202210223806.1、申请名称为“一种存储装置及相关数据分区管理方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种存储装置及相关数据分区管理方法。
背景技术
当前计算机服务器的主流存储器件主要分为两种:机械硬盘(Hard Disk Driver,HDD)和固态硬盘(Solid State Disk,SSD)。固态硬盘和机械硬盘本质上都是用于数据存储的硬件,其本质上的区别在于存储介质不同。传统的机械硬盘以机械磁盘作为存储介质,通过磁臂和磁头、磁盘之间的机械构造进行数据存储和读取;而固态硬盘则是以NAND闪存(非易失性的存储器)作为存储介质,通过存储器内部的电荷数,即cell的通断电进行数据的读取和写入,进而实现数据存储。随着固态硬盘小型化以及其性价比不断提升,越来越多企业消费者和个人消费者采用固态硬盘进行数据的存储。目前,业界开始探索使用NAND闪存代替或卸载部分昂贵内存,如通过算法将手机内存中的数据暂存到SSD中,从而降低手机内存的开销,但这也对SSD的使用寿命提出了一定的挑战。
NAND闪存根据逻辑结构的划分,内部可分为不同的块(Block),每个块又由多个页(Page)组成;NAND闪存是以页为单位进行读写,以块为单位进行擦除(erase),即当一个块内的页被写过之后,不能直接对该页进行擦除操作,而需要将其所在块内的数据全部擦除,才能再次写入。因此,在NAND闪存的垃圾回收(Garbage Collection,GC)操作过程中,需要通过FTL(Flash Translation Layer,闪存转换层)管理数据分布,将块中的有效数据先备份到其他的块,才能进行擦除,在此过程中数据的写入和擦除都会增加SSD的硬件磨损,降低SSD使用寿命。
发明内容
本申请实施例所要解决的技术问题在于,提供一种存储装置及相关数据分区管理方法,以提升存储设备的使用寿命。
第一方面,本申请实施案例提供一种存储装置,其特征在于,所述存储装置包括控制器和M个存储块Block,M为大于0的整数,其中,所述控制器用于:确定区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域;所述N个存储区域中的每个存储区域包括一个或多个Block;根据所述区域配置信息为所述N个存储区域中的每个存储区域配置各自的最长数据保存时间。
在本发明实施例中,通过外存(如SSD)的控制器对外存中的存储块(Block)进行分区,得到不同的存储区域,并且通过软件配置使得这些不同存储区域的最长数据保存时间不同, 从而可基于多个存储区域的不同的特性(即最长数据保存时间不同的特性)来存储对保存时间需求不同的数据(如将需要长时间保存的数据存储在最长数据保存时间长的存储区域,将只需短暂存储的数据存储在最长数据保存时间短的存储区域),使得整个外存的数据存储可以最大化的利用好各个存储区域的存储特性,有效地提升了外存的利用率和使用寿命。具体地,控制器基于配置信息,首先将外存中的多个Block分为N个存储区域;进一步地,由于存储块的最长数据保存时间可通过参数直接配置,因此外存中的控制器可直接通过软件配置不同存储区域中所包括的多个存储块的最长数据保存时间,以实现不同存储区域的最大数据保存时间不同。而在一种现有技术中,不对待存储数据的目标保存时间进行感知,在进行数据存储时,为了保证数据不丢失,存储设备中的所有存储块都需要按照相同的且最大的最长数据保存时间来进行配置。但是,由于存储块具有最长数据保存时间越长,可擦除次数越少的特性,因此所有存储块都必须按照最低的擦除次数来配置,导致存储块未能充分发挥存储的能力,造成存储资源的浪费。但是,在本发明实施例中,由于不同存储区域的最长数据保存时间不同,因此控制器可以根据存储区域的最长数据保留时间对存储块的可擦除次数进行合理的配置,避免了所有数据都按照相同的且最大的最长数据保存时间来存储数据,导致存储资源浪费的问题,从而提升了存储设备的利用率和使用寿命。此外,在另一种现有技术中,利用了存储块的场效应管特性(即存储块的编程电压越大,数据保存时间越长),基于该特性存储设备可根据待存储数据的目标保存时间去控制存储块的编程电压,以使得存储块按照待存储数据所需的目标保存时间存储数据,从而提升存储资源的利用率和使用寿命。但是,由于当前存储块的编程电压在生产过程中已经固定,无法通过软件调整,进而无法直接配置存储块的编程电压,因此需要和制造商提出额外的需求,导致整体成本上升的问题,而在本发明实施例中,由于不依赖于介质的内部实现,仅根据介质的特性,无需与制造商提出额外的需求,因此能够在不增加成本的前提下,提升外存的利用率和使用寿命。例如,利用存储介质的数据保留时间和擦除次数的相关性,通过软件方式管理不同存储块的最长数据保存时间需求,并根据保留时间需求,可折算对应的擦除次数。
在一种可能的实现方式中,所述控制器还用于:接收主机发送的所述区域配置信息,或者与所述主机协商所述区域配置信息。
在本发明实施例中,区域配置信息可以由主机根据主机侧需求生成并下发给存储设备,也可以由存储设备与主机协商得到,从而使得存储设备的控制器能够基于该配置信息对存储块(Block)进行分区,并且控制器还可通过软件配置使得不同存储区域的最长数据保存时间不同,从而控制器可基于多个存储区域来存储数据,提升了存储设备(如外存SSD)的利用率和使用寿命。
在一种可能的实现方式中,所述控制器还用于:为每个所述存储区域生成对应的区域标识,并建立每个所述存储区域的最长数据保存时间和对应的区域标识之间的映射关系。
在本发明实施例中,当存储设备中的控制器基于区域配置信息将多个存储块划分为N个存储区域后,还可以为每个存储区域生成一个区域标识,以使得一个区域标识对应一个存储区域,接下来可建立每个存储区域的最长数据保存时间与区域标识之间的映射关系,然后向主机发送这N个存储区域各自的最长数据保存时间与区域标识之间的映射关系,以使得主机在生成写命令时,可以根据待存储数据的目标保存时间选择出目标存储区域,并将该目标存储区域的区域标识作为区域识别信息。
在一种可能的实现方式中,所述控制器还用于:将所述存储系统的可用逻辑地址空间划分为N个逻辑地址段;建立每个所述存储区域的最长数据保存时间与所述N个逻辑地址段中 的一个逻辑地址段之间的映射关系。
在本发明实施例中,当存储设备中的控制器基于区域配置信息将多个存储块划分为N个存储区域后,还可以将存储系统的可用逻辑地址空间划分为N个逻辑地址段,以使得一个逻辑地址段对应一个存储区域,接下来可建立每个存储区域的最长数据保存时间与逻辑地址段之间的映射关系,然后向主机发送这N个存储区域各自的最长数据保存时间与逻辑地址段之间的映射关系,以使得主机在生成写命令时,可以根据待存储数据的目标保存时间选择出目标存储区域,并可将该目标存储区域的逻辑地址段作为区域识别信息。
在一种可能的实现方式中,所述控制器还用于:接收所述主机发送的写命令;所述写命令包括待存储数据和目标存储区域的目标区域识别信息;所述目标存储区域为所述N个存储区域中的一个,每个所述存储区域对应一个区域识别信息;基于所述写命令中的所述目标区域识别信息,将所述待存储数据写入到所述目标存储区域。
在本发明实施例中,当存储设备中的控制器基于区域配置信息将多个存储块划分为N个存储区域后,控制器所接收到的写命令中包括待存储数据和目标区域识别信息,进而控制器可基于目标区域识别信息将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
在一种可能的实现方式中,所述控制器还用于:基于每个所述存储区域对应的所述最长数据保存时间,配置每个所述存储区域中所包括的Block的最大可擦除次数;存储区域对应的所述最长数据保存时间越短,所述存储区域中包括的Block的所述最大可擦除次数越大。
在本发明实施例中,对于存储块来说,最长数据保存时间被配置的越短,每次数据写入时对存储块的硬件磨损越小,因此可配置较多的可擦除次数,提升存储块的利用率。相反地,最长数据保存时间被配置的越长,每次数据写入时对存储块的硬件磨损越大,为保证待存储数据不丢失,可配置较少的可擦除次数,避免过多的擦除存储块降低数据稳定性的问题,提升了外存的利用率和使用寿命。
第二方面,本申请实施案例提供一种处理装置,其特征在于,包括主机,所述主机用于:生成区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;向存储设备发送所述区域配置信息,所述区域配置信息用于所述存储设备将M个存储块Block划分为N个存储区域,每个所述存储区域对应一个最长数据保存时间,M为大于1的整数。
在本发明实施例中,由主机向外存(如存储设备SSD)发送区域配置信息,进而可通过外存(的控制器对外存中的存储块(Block)进行分区,得到不同的存储区域,并且通过软件配置使得这些不同存储区域的最长数据保存时间不同,从而可基于多个存储区域的不同的特性(即最长数据保存时间不同的特性)来存储对保存时间需求不同的数据(如将需要长时间保存的数据存储在最长数据保存时间长的存储区域,将只需短暂存储的数据存储在最长数据保存时间短的存储区域),使得整个外存的数据存储可以最大化的利用好各个存储区域的存储特性,有效地提升了外存的利用率和使用寿命。
在一种可能的实现方式中,所述主机还用于:根据待存储数据的需求信息,从所述N个存储区域中选择目标存储区域;所述需求信息中包括所述待存储数据期望的目标保存时间,所述目标存储区域对应的所述最大数据保存时间大于或等于所述目标保存时间;每个所述存储区域对应一个区域识别信息;向所述存储设备发送写命令,所述写命令包括所述待存储数 据和所述目标存储区域的目标区域识别信息。
在本发明实施例中,由主机根据待存储数据所需的目标保存时间,从多个存储区域中选择最长数据保存时间大于或等于目标保存时间的目标区域。进一步地,在主机下发写命令时,写命令中不仅需要包括待存储数据,还需要携带上用于识别该目标存储区域的信息,以使得存储设备接收到写命令后,能够将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
在一种可能的实现方式中,所述主机还用于:根据所述待存储数据的数据类型,确定所述目标保存时间,所述数据类型包括应用使用过程中产生的临时数据、后台应用匿名页对应的堆栈数据,应用关闭后可丢弃的数据中的一种或多种。
在本发明实施例中,由于主机对不同类型的数据访问需求不同,导致不同类型的数据所需的数据保存时间可能不同,因此主机可基于待存储数据的数据类型确定所需的目标保存时间,然后可基于目标保存时间确定目标存储区域,以使得存储设备接收到写命令后,能够将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
在一种可能的实现方式中,所述主机具体用于:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;向所述控制器发送写命令,所述写命令包括所述待存储数据和所述目标存储区域对应的目标区域标识。
在本发明实施例中,当主机获取到N个存储区域各自的最长数据保存时间与区域标识之间的映射关系后,主机可基于待存储数据的目标保存时间从N个存储区域中,将最大数据保存时间大于或等于目标保存时间的存储区域确定为目标存储区域。进一步地,主机在生成针对待存储数据的写命令时,可将目标存储区域对应的区域标识作为区域识别信息,以使得存储设备接收到写命令后,能够基于该区域标识将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
在一种可能的实现方式中,所述写命令中还包括目标逻辑地址,所述目标逻辑地址为所述主机的可用逻辑地址空间中的任意一个地址;所述目标逻辑地址与所述目标存储区域中的目标物理地址存在映射关系,所述目标物理地址为所述待存储数据在所述目标存储区域中实际存储的物理地址。
在本发明实施例中,若每个存储区域都具有一个唯一的区域标识,那么该区域标识可以作为区域识别信息。在此情况下,写命令中除了需要包括待存储数据和目标区域识别信息,还需要包括一个逻辑地址,以便后续主机能够基于该逻辑地址向存储设备读取数据。
在一种可能的实现方式中,所述主机具体用于:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;确定所述目标区域对应的目标逻辑地址段,从所述目标逻辑地址段中选择目标逻辑地址;向所述控制器发送写命令,所述写命令中携带所述待存储数据和所述目标逻辑地址。
在本发明实施例中,当主机获取到N个存储区域各自的最长数据保存时间与逻辑地址段之间的映射关系后,主机可基于待存储数据的目标保存时间从N个存储区域中,将最大数据保存时间大于或等于目标保存时间的存储区域确定为目标存储区域。进一步地,主机在生成针对待存储数据的写命令时,可以从目标存储区域对应的逻辑地址段中选择一个地址作为目 标逻辑地址,并将该目标逻辑地址作为区域识别信息,以使得存储设备接收到写命令后,能够基于该目标逻辑地址将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
第三方面,本申请实施案例提供一种数据分区管理方法,其特征在于,应用于存储装置,所述存储装置包括M个存储块Block,M为大于0的整数,所述方法包括:确定区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域;所述N个存储区域中的每个存储区域包括一个或多个Block;根据所述区域配置信息为所述N个存储区域中的每个存储区域配置各自的最长数据保存时间。
在一种可能的实现方式中,所述方法还包括:接收主机发送的所述区域配置信息,或者与所述主机协商所述区域配置信息。
在一种可能的实现方式中,所述方法还包括:为每个所述存储区域生成对应的区域标识,并建立每个所述存储区域的最长数据保存时间和对应的区域标识之间的映射关系。
在一种可能的实现方式中,所述方法还包括:将所述存储系统的可用逻辑地址空间划分为N个逻辑地址段;建立每个所述存储区域的最长数据保存时间与所述N个逻辑地址段中的一个逻辑地址段之间的映射关系。
在一种可能的实现方式中,所述方法还包括:接收所述主机发送的写命令;所述写命令包括待存储数据和目标存储区域的目标区域识别信息;所述目标存储区域为所述N个存储区域中的一个,每个所述存储区域对应一个区域识别信息;基于所述写命令中的所述目标区域识别信息,将所述待存储数据写入到所述目标存储区域。
在一种可能的实现方式中,所述方法还包括:基于每个所述存储区域对应的所述最长数据保存时间,配置每个所述存储区域中所包括的Block的最大可擦除次数;存储区域对应的所述最长数据保存时间越短,所述存储区域中包括的Block的所述最大可擦除次数越大。
第四方面,本申请实施案例提供一种数据分区管理方法,其特征在于,所述方法包括:生成区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;向存储设备发送所述区域配置信息,所述区域配置信息用于所述存储设备将M个存储块Block划分为N个存储区域,每个所述存储区域对应一个最长数据保存时间,M为大于1的整数。
在一种可能的实现方式中,所述方法还包括;根据待存储数据的需求信息,从所述N个存储区域中选择目标存储区域;所述需求信息中包括所述待存储数据期望的目标保存时间,所述目标存储区域对应的所述最大数据保存时间大于或等于所述目标保存时间;每个所述存储区域对应一个区域识别信息;向所述存储设备发送写命令,所述写命令包括所述待存储数据和所述目标存储区域的目标区域识别信息。
在一种可能的实现方式中,所述方法还包括:根据所述待存储数据的数据类型,确定所述目标保存时间,所述数据类型包括应用使用过程中产生的临时数据、后台应用匿名页对应的堆栈数据,应用关闭后可丢弃的数据中的一种或多种。
在一种可能的实现方式中,所述向所述控制器发送写命令,包括:从所述N个存储区域 中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;向所述控制器发送写命令,所述写命令包括所述待存储数据和所述目标存储区域对应的目标区域标识。
在一种可能的实现方式中,所述写命令中还包括目标逻辑地址,所述目标逻辑地址为可用逻辑地址空间中的任意一个地址;所述目标逻辑地址与所述目标存储区域中的目标物理地址存在映射关系,所述目标物理地址为所述待存储数据在所述目标存储区域中实际存储的物理地址。
在一种可能的实现方式中,所述向所述控制器发送写命令,包括:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;确定所述目标区域对应的目标逻辑地址段,从所述目标逻辑地址段中选择目标逻辑地址;向所述控制器发送写命令,所述写命令中携带所述待存储数据和所述目标逻辑地址。
第五方面,本申请提供了一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述第三方面任意一项所述的方法,或是上述第四方面任意一项所述的方法。
第六方面,本申请实施例提供一种电子设备,该电子设备中包括处理器,处理器被配置为支持该电子设备实现第三方面提供的一种数据分区管理方法中相应的功能,或是实现第四方面提供的一种数据分区管理方法中相应的功能。该电子设备还可以包括存储器,存储器用于与处理器耦合,其保存该电子设备必要的程序指令和数据。该电子设备还可以包括通信接口,用于该电子设备与其他设备或通信网络通信。
第七方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持电子设备实现上述第三方面中所涉及的功能,实现上述第四方面中所涉及的功能,例如,生成或处理上述数据分区管理方法中所涉及的信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存电子设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
第八方面,本申请提供一种计算机程序,其特征在于,所述计算机程序包括指令,当所述计算机程序被计算机执行时,使得所述计算机执行上述第三方面中任意一项所述的方法,执行上述第四方面中任意一项所述的方法。
附图说明
图1A为本发明实施例提供的一种主机和存储设备的结构示意图。
图1B为本发明实施例提供的一种存储设备的结构示意图。
图2为本发明实施例提供的一种存储系统示意图。
图3为本发明实施例提供的一种主机与存储设备进行数据交互的示意图。
图4为本发明实施例提供的一种存储设备配置存储区域的流程示意图。
图5为本发明实施例提供的一种数据写入的流程示意图。
图6为本发明实施例提供的一种分区数据管理示意图。
图7为本发明实施例提供的另一种分区数据管理示意图。
图8为本发明实施例提供的一种数据分区示意图。
图9是本发明实施例提供的一种数据分区管理方法的流程图。
图10是本发明实施例提供的另一种数据分区管理方法的流程图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例进行描述。
本申请的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
首先,对本申请实施例涉及的一些术语进行简单介绍。
(1)与非闪存(Not AND Flash,NAND Flash)是一种非易失性存储介质,即断电后仍能保存数据。它的发展目标就是降低每比特存储成本、提高存储容量。通常,NAND Flash以页(page)为单位读写,以块(Block)为单位擦除(erase)。由于Flash存储原理的原因,向Flash中写入数据,只能把数据(bit)从1改为0;而擦除只能把所有数据(bit)从0改为1。所以修改数据或者新写入数据,都必须写到已经擦除过的空闲页,否则数据会乱掉。
(2)固态驱动器(Solid State Disk或Solid State Drive,SSD),俗称固态硬盘,固态硬盘是用固态电子存储芯片阵列而制成的硬盘。SSD由控制单元和存储单元(FLASH芯片、DRAM芯片)组成。其中,SSD中的FLASH芯片通常采用上述NAND Flash芯片作为其存储单元。固态硬盘在接口的规范和定义、功能及使用方法上与普通硬盘的完全相同,在产品外形和尺寸上也完全与普通硬盘一致。被广泛应用于军事、车载、工控、视频监控、网络监控、网络终端、电力、医疗、航空、导航设备等诸多领域。
(3)闪存文件系统(Flash Friendly File System,F2FS),是文件在操作系统上的一种存储架构,是专门为基于NAND的存储设备设计的新型开源flash文件系统。F2FS支持Linux操作系统。适合用于NAND一类的闪存设备(例如固态硬盘、eMMC和SD卡等),也就是更加适合现在的移动端设备。
(4)垃圾回收(Garbage Collection,GC),是一种存储资源回收方法。当在操作系统(例如Windows)中删除文件时,操作系统只是在其内部文件表中做标记表示该文件已删除。由于NAND闪存设备不能覆盖现有数据,所以在固态硬盘SSD上,当前无效的数据仍然保存在硬盘上。这样的话就会产生大量的失效数据,也称为数据垃圾。为了提升SSD的利用效率,固态硬盘控制器会先复制所有有效数据(仍在使用中的数据)并将其写入不同数据区的空白页、擦除当前数据区中的所有数据单元,然后开始将新数据写入刚刚擦除过的数据区。
基于上述,本发明实施例提供一种主机和存储设备。请参见图1A,图1A为本发明实施例提供的一种主机和存储设备的结构示意图,该主机10可以为任何产生数据的计算设备,如服务器、个人计算机、平板电脑、手机、个人数字助理、智能穿戴设备等各类设备;存储设 备103可以是任何为主机10提供存储/读取数据功能的非易失性存储器。在本发明实施例中,存储设备103可以内置于主机10中,也可与主机10分别为独立的设备,还可以是存储设备103和主机10共同位于一个电子设备中,本申请对此不做具体限定。主机10或存储设备103具体可以是芯片或芯片组或搭载有芯片或者芯片组的电路板,该芯片或芯片组或搭载有芯片或芯片组的电路板可在必要的软件驱动下工作。具体地,
主机10,可包括处理器(central processing unit,CPU)100、内存储器101。可选的,还可以包括主机控制器102,进一步地,还可以包括图1A中未示出的电源、其他输入输出控制器和接口等应用处理侧的所有物理器件。其中,
处理器100:可运行操作系统、文件系统(如闪存文件系统F2FS)或应用程序等,以控制连接到处理器100的多个硬件或软件元件,并且可处理各种数据并执行操作。处理器100可将存储设备103中存储的指令或数据加载到内存储器101中,并把需要运算的指令或数据调到处理器100中进行运算,当运算完成后处理器100再将结果临时存储在内存储器101中,并将需要长期存储的指令或数据通过主机控制器102存储至存储设备103中。处理器100可以包括一个或多个处理单元(也可称处理核),例如:处理器100可以包括中央处理单元(CPU)、应用处理单元(application processor,AP)、调制解调处理单元、图形处理单元(graphics processing unit,GPU)、图像信号处理单元(image signal processor,ISP)、视频编解码单元、数字信号处理单元(digital signal processor,DSP)、基带处理单元和神经网络处理单元(neural-network processing unit,NPU)等中的一个或多个。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个器件中。可选的,处理器100中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器100中的存储器为高速缓冲存储器(Cache)。所述Cache可以保存处理器100刚用过或循环使用的指令或数据。如果处理器100需要再次使用该指令或数据,可从所述Cache中直接调用。避免了重复存取,减少了处理器100的等待时间,因而提高了系统的效率。进一步地,处理器100还可被实现为片上系统(System on Chip,SoC)。
内存储器101,通常为掉电易失性存储器,断电时会丢失其上存储的内容,也可称为内存(Memory)或主存储器。本申请中的内存储器101包括可读可写的运行内存,其作用是用于暂时存放处理器100中的运算数据,以及与存储设备103或其他外部存储器交互数据,可作为操作系统或其他正在运行中的程序的临时数据的存储媒介。例如,运行于处理器100上的操作系统把需要运算的数据从内存储器101调到处理器100中进行运算,当运算完成后处理器100再将结果传送出来。
内存储器101可以包括,动态随机存取存储器(DRAM)、静态随机存取存储器(SRAM)、同步动态随机存取存储器(SDRAM)等中的一种或多种。其中,DRAM又包括双倍速率同步动态随机存储器(Double Data Rate Synchronous Dynamic Random Access Memory,DDR SDRAM)简称DDR、二代双倍速率同步动态随机存储器(DDR2)、三代双倍速率同步动态随机存储器(DDR3)、四代低功耗双倍数据率同步动态随机存储器(Low Power Double Data Rate 4,LPDDR4)和五代低功耗双倍数据率同步动态随机存储器(Low Power Double Data Rate 5,LPDDR5)等。
主机控制器102,用于管理并控制主机10与存储设备103之间的通信,并为主机10和存储设备103之间的通信提供标准化(例如通用闪存存储UFS标准)的接口。具体地,主机控制器102可以根据处理器100发出的读/写等请求,向存储设备103传递命令(例如,写入、读取、擦除等命令)及数据,以及根据存储设备103读/写数据等结果向主机10反馈事件(如 命令完成事件、命令状态事件、硬件出错事件等)。对于从处理器100发出的命令或数据,主机控制器102可将命令或数据通过封装的方式转换为支持某个协议的数据包,而对于主机10接收的数据主机控制器102则进行反向操作。可选的,一个主机可以支持多个主机控制器(Host Controller),以支持与不同协议的存储设备之间的通信。在本发明实施例中,主机控制器102根据主机10与存储设备103之间所支持的协议(例如UFS协议)生成本申请中所涉及的写命令,并在生成的上述命令中可携带数据的区域识别信息,以向存储设备103指示数据需存放的区域。具体请参见后续关于一种存储系统及数据分区管理方法的具体描述,此处不作详细描述。可选的,该主机控制器102的功能也可以集成在处理器100中,即由处理器100完成主机控制器102的上述功能,此处不作具体限定。
存储设备103可包括多个存储块,在本发明实施例中,可将多个存储块进行分区,以使得存储设备103至少包括第一存储区域1031和第二存储区域1032。进一步地,该存储设备103还可以包括存储控制器1033。在本发明实施例中,第一存储区域1031和第二存储区域1032的存储性能不同,以分别用于存储不同性能需求的数据。也即是不同的存储区域中包括的块(Block)的数据保存时间不同。其中,
存储设备103,为非易失性存储器,断电后其存储的内容不会丢失。存储设备103(可包括第一存储区域1031和第二存储区域1032等)可用于长期存储主机10运行所涉及的指令和数据,如启动程序、操作系统、应用程序和数据等。由于主机10中的处理器100不能直接读取存储设备103中的指令和数据也不能直接向存储设备103写入指令或数据,因此,处理器100在执行读(或加载)命令时,实际上是通过主机控制器102将存储在存储设备103中的待读内容(包括指令和/或数据)先临时加载至内存储器101中,然后再由处理器100从内存储器101中读出;而在执行写(即存储)命令时,实际上是由处理器100先将待存储数据(包括指令和/或数据)临时写入至内存储器101中,然后再通过主机控制器102从内存储器101存储至存储设备103中。若存储设备103的可用寿命较短,则会影响主机10的性能,因此,如何提升存储设备103的使用寿命是亟待解决的问题。由于在本申请中,将存储设备103中的存储块进行了分区,即存储设备103中至少包括第一存储区域1031和第二存储区域1032,且第一存储区域1031和第二存储区域1032的最长数据保存时间不同,因此,本发明实施例可基于待存储数据所需的目标保存时间,将不同保存时间的数据存储在对应的存储区域,即对主机数据进行分区管理,避免了所有数据按照相同的保存时间来进行存储导致存储资源浪费的问题,也可以在不增加成本、不降低可用空间且不影响主机关键数据可靠性的前提下,提升存储设备103的使用寿命。后续实施例中将对此进行进一步说明,此处不作详述。
存储设备103可以包括Flash闪存(例如,NAND闪存、NOR闪存等)、通用闪存存储器(universal flash storage,UFS)、嵌入式多媒体卡eMMC、通用闪存存储多芯片封装uMCP存储器、嵌入式多媒体卡多芯片封装eMCP存储器、固态驱动器(SSD)等中的一个或多个。在一种可能的实现方式中,存储设备103至少包括第一存储区域1031和第二存储区域1032,且第一存储区域1031和第二存储区域1032都可包括单层单元SLC存储区域、多层单元MLC存储区域、三层单元TLC存储区域、四层单元QLC存储区域、五层单元PLC存储区域中的一种或多种。但是,第一存储区域1031和第二存储区域1032所配置的最长数据保存时间不同。进一步地,存储设备103还可以包括其他存储介质如机械硬盘(Hard Disk Drive,HDD)等。
例如,如图1B所示,图1B为本发明实施例提供的一种存储设备的结构示意图,其中,第一存储区域1031可包括M个块(Block),每个Block包括N个页(page),而每个page 中又包含一定数量的单元(cell),该第一存储区域1031中的所有Block中的所有page中的所有cell可以为单层单元(Single-Level Cell,SLC)、多层单元(Multi-Level Cell,MLC)或三层单元(Triple-level Cell,TLC)中的一种或多种,在此不作限定。同理,第二存储区域中可包括L个Block,每个Block包括N个page(此处数量也可以不为N),而每个page中又包含一定数量的cell,而该第二存储区域1032中的所有Block中的所有page中的所有cell也可以为单层单元(SLC)、多层单元(MLC)或三层单元(TLC)中的一种或多种,在此不作限定。进一步地,可通过软件对存储介质进行配置,使得不同存储区域中的Block的最长数据保存时间不同。
需要说明的是,Page是NAND Flash中最小的寻址单位,即读/写的最小单位。一个Block中的Page数量根据不同的厂家不同的规格,数量是不一样的,Page本身的大小也不一样。例如,一个Block中有1024页,每页大小为(16KB+2208B),其中,16KB为数据区用于存储数据,2208B为元数据区用于存储元数据,比如16KB用于存储申请中的一个或多个目标数据,而2208B用于存储所述一个或多个目标数据分别对应的区域识别信息。其中,SLC和MLC的擦除性能类似,而SLC闪存的读性能(包括读速度)、写性能(包括写速度)和存储性能(包括存储寿命)等均优于MLC/TLC闪存。
存储控制器1033,是主机10与存储设备103的接口设备,其作用主要就是进行接口的转换,将主机10(例如主机10中的主机控制器)发出的读、写、删除等命令转换成存储设备103能够识别的信号,还可以完成主机10与存储设备103之间地址译码(例如,主机10逻辑地址和存储设备103中物理地址之间的映射)、数据格式的转换(比如数据位宽)等。总之,存储控制器1033可以按照一定的时序规则对其所在的存储设备103的访问进行必要控制的设备,包括地址信号、数据信号以及各种命令信号的控制,使主机10能够根据需求使用存储设备103上的存储资源。例如,存储控制器1033接收并解析主机10中的主机控制器102发送的读命令或写命令等,并根据读命令或写命令等中携带的数据的逻辑地址,将数据的逻辑地址根据固定地址映射关系解析为物理地址,进而查找待读或者待写数据的位置,并最终向第一存储区域1031或第二存储区域1032发出与命令对应的控制信号。
需要说明的是,用于实现本申请中的任意一种数据分区管理方法的计算机程序(简称数据分区管理程序,可包括相关指令和相关数据,后续不再重复说明),涉及并包括多部分功能,其中一部分是主机10侧对于待存储数据的目标保存时间的确定,以及在写命令中携带该待存储数据的区域识别信息的过程;另一部分是存储设备103侧对于存储块进行分区的过程,以及接收到待存储数据,进行存储的处理过程。其中,目标保存时间的预测功能可以由处理器100所运行的操作系统中的数据分区管理程序来实现,目标保存时间确定后的保存管理功能可以由处理器100所运行的操作系统中的文件系统(如F2FS)来实现,存储块分区以及数据存储则可作为存储控制器1033中所运行的控制程序来实现。最终,通过上述数据分区管理程序所包含的多部分功能,提升存储设备103可用寿命。后续实施例中将对此进行进一步说明,此处不作详述。
可以理解的是,图1A或图1B中的主机10或存储设备103的结构只是本发明实施例提供的一些示例性的实施方式,本发明实施例中的主机10和存储设备103的结构包括但不仅限于以上实现方式。
还可以理解的是,处理器100与内存储器101、主机控制器和存储设备103之间可以通过系统总线的方式相互通信,也可以通过其他连接方式进行通信,本发明实施例对此不作具体限定。本发明实施例示意的结构并不构成主机10或存储设备103的具体限定。在本申请另 一些实施例中,主机10或存储设备103可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
下面结合本发明实施例中的附图对本发明实施例进行描述。
请参见图2,图2为本发明实施例提供的一种存储系统示意图,下面将结合附图2对本申请实施例中的存储装置及处理装置进行详细描述。如图2所示,该存储系统20包括:主机201(可作为处理装置)和存储设备202(可作为存储装置),此外,存储设备202中又包括控制器2021和M个存储块Block,M为大于0的整数。需要说明的是,主机201的功能可包括上述图1A中的主机10的所有功能,存储设备202的功能可包括上述图1A中的存储设备103的所有功能,控制器2021可以为上述图1A中的存储控制器1033,存储块Block为存储设备202中的存储介质。其中,
所述控制器2021用于,确定区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数。具体地,在存储设备202(如外存SSD)的控制器2021将多个存储块进行分区前,需要先确定区域配置信息,即先确定需要将存储介质划分为多少个存储区域,每个存储区域中需要包括多少个存储块(即存储区域的大小),以及每个存储区域对应的最长数据保存时间。例如,可基于用户模型确定用户数据(User Data)与交换数据(Swap Data)比例为7:3,而这两类数据的保存时间需求分别为40℃ 1Year(在40摄氏度环境下,最长保存时间为1年)和40℃ 1Month(在40摄氏度环境下,最长保存时间为1个月),从而区域配置信息可以为将存储介质划分为2个存储区域,第一存储区域占总空间的70%,第二个存储区域占总空间的30%,第一存储区域的最长数据保存时间为1年,第二个存储区域的最长数据保存时间为1个月。
在本发明实施例中,提供一种处理装置,其特征在于,包括主机201,所述主机201用于:生成区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;向存储设备202发送所述区域配置信息,所述区域配置信息用于所述存储设备将M个存储块Block划分为N个存储区域,每个所述存储区域对应一个最长数据保存时间,M为大于1的整数。
在一种可能的实现方式中,所述控制器2021还用于:接收主机201发送的所述区域配置信息,或者与所述主机201协商所述区域配置信息。具体地,区域配置信息可以由主机201根据主机201侧需求生成并下发给存储设备202,也可以由存储设备202与主机201协商得到,从而使得存储设备202的控制器2021能够基于该配置信息对存储块(Block)进行分区,并且控制器2021还可通过软件配置使得不同存储区域的最长数据保存时间不同,从而控制器2021可基于多个存储区域来存储数据,提升了外存的利用率和使用寿命。例如,如图3所示,图3为本发明实施例提供的一种主机与存储设备进行数据交互的示意图,图中存储设备202的控制器2021中可以增加一个区域配置模块,用于接收主机201发送的区域配置信息,进一步地,区域配置模块可以基于该区域配置信息进行存储区域的划分。
所述控制器2021还用于,根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域;所述N个存储区域中的每个存储区域包括一个或多个Block。存储块Block为存储设备202中的存储介质,用于实际存储数据。具体地,当存储设备202的控制器2021确定了区域配置信息后,先按照该区域配置信息中的区域数量N和各个区域的大小,将多个存储块划分为N个存储区域,每个存储区域中可以包括一个或多 个存储块。例如,如图3所示,控制器2021中可以增加一个区域配置模块,区域配置模块可按照区域配置信息中的区域数量N和各个区域的大小,将多个存储块划分为N个存储区域(如图3中的第一存储区域、第二存储区域、第N存储区域等,需要说明的是,图中NAND中可以包括一个或多个存储块Block)。
所述控制器2021还用于,根据所述区域配置信息为所述N个存储区域中的每个存储区域配置各自的最长数据保存时间。具体地,控制器2021根据所述各个存储区域对应的最长数据保存时间,配置所述N个存储区域中每个存储区域的所述最长数据保存时间。对于存储块来说,可通过软件配置最长数据保存时间,以实现不同存储区域的最长数据保存时间不同,从而控制器2021可基于多个存储区域来存储数据,提升了外存的利用率和使用寿命。例如,如图4所示,图4为本发明实施例提供的一种存储设备配置存储区域的流程示意图,图中主机201(Host)根据需求,向存储设备202(如外存SSD)分配对应的保存区间大小和保存时间需求;SSD获取到配置命令后,解析命令,并获取保存区间大小,以及对应的保存时间需求;SSD根据保存区间的大小,分配对应大小的Block组成存储区域,并为每个存储区域配置对应的最长数据保存时间。
在一种可能的实现方式中,所述控制器2021还用于:基于每个所述存储区域对应的所述最长数据保存时间,配置每个所述存储区域中所包括的Block的最大可擦除次数;存储区域对应的所述最长数据保存时间越短,所述存储区域中包括的Block的所述最大可擦除次数越大。具体地,对于存储块来说,最长数据保存时间被配置的越短,每次数据写入时对存储块的硬件磨损越小,因此可配置较多的可擦除次数,提升存储块的利用率。相反地,最长数据保存时间被配置的越长,每次数据写入时对存储块的硬件磨损越大,为保证待存储数据不丢失,可配置较少的可擦除次数,避免过多的擦除存储块降低数据稳定性的问题,提升了外存的利用率和使用寿命。此外,由于本申请中Block的最长数据保存时间是通过软件来进行配置的,因此无需与外存制造厂商进行个性化的硬件定制,可以在不增加成本、不降低可用空间且不影响数据可靠性的前提下,提升外存的使用寿命。
在一种可能的实现方式中,所述存储系统还包括主机201,所述主机201用于:根据待存储数据的需求信息,从所述N个存储区域中选择目标存储区域;所述需求信息中包括所述待存储数据期望的目标保存时间,所述目标存储区域对应的所述最大数据保存时间大于或等于所述目标保存时间;每个所述存储区域对应一个区域识别信息;向所述控制器2021发送写命令,所述写命令包括所述待存储数据和所述目标存储区域的目标区域识别信息。具体地,由主机201根据待存储数据所需的目标保存时间,从多个存储区域中选择最长数据保存时间大于或等于目标保存时间的目标区域。进一步地,在主机201下发写命令时,写命令中不仅需要包括待存储数据,还需要携带上用于识别该目标存储区域的信息,以使得存储设备202接收到写命令后,能够将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。例如,如图5所示,图5为本发明实施例提供的一种数据写入的流程示意图,图中Host根据写入的数据保存时间需求,在命令预留字段附加Region信息(即区域识别信息),然后SSD控制器2021接收到命令后,先解析获取对应的Region信息,对照配置信息获取数据写入的位置信息,最后SSD根据Host的命令信息,将数据写入NAND Flash对应的存储区域。
在现有技术方案中,是先对待存储数据的目标保存时间进行预测得到一个预测值,然后再根据该预测值去控制存储块的编程电压,若该预测值与实际值有较大的偏差,则会导致关 键数据丢失且该存储块整体均不满足保存时间需求的问题。而在本发明实施例中,则是先统一配置好各个存储区域的不同的最长数据保存时间,再将有相应时间保存需求的数据调度至最长数据保存时间匹配的存储区域,且保证目标存储区域的最长数据保存时间可以大于或等于待存储数据的目标保存时间,即使部分待存储数据的目标保存时间存在误差,也仅对该部分数据造成一些影响,能够在一定程度上保证数据的稳定性,并不会使得整个存储区域的资源浪费。
在一种可能的实现方式中,所述主机201还用于:根据所述待存储数据的数据类型,确定所述目标保存时间,所述数据类型包括但不限于应用使用过程中产生的临时数据、后台应用匿名页对应的堆栈数据,应用关闭后可丢弃的数据中的一种或多种。具体地,由于主机201对不同类型的数据访问需求不同,导致不同类型的数据所需的数据保存时间可能不同,因此主机201可基于待存储数据的数据类型确定所需的目标保存时间,然后基于目标保存时间确定目标存储区域,以使得存储设备202接收到写命令后,能够将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。例如,待存储数据为应用程序使用过程中产生的临时数据,或是后台应用匿名页对应的堆栈数据,或是生命周期仅限于应用开启阶段应用关闭后可丢弃的数据,由于此类型数据保存时间需求相较于正常数据更短,因此可以确定待存储数据的目标保存数据较短。
在一种可能的实现方式中,所述控制器2021还用于:接收所述主机201发送的写命令;所述写命令包括待存储数据和目标存储区域的目标区域识别信息;所述目标存储区域为所述N个存储区域中的一个,每个所述存储区域对应一个区域识别信息;基于所述写命令中的所述目标区域识别信息,将所述待存储数据写入到所述目标存储区域。具体地,当存储设备202中的控制器2021基于区域配置信息将多个存储块划分为N个存储区域后,控制器2021所接收到的写命令中包括待存储数据和目标区域识别信息,进而控制器2021可基于目标区域识别信息将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
综上,在本发明实施例主机201(HOST)与存储设备202(如外存SSD)进行参数和数据交互过程中,由SSD内部的控制器2021(Controller)管理NAND Flash中的数据排布和相关配置,承担HOST下发命令的处理。需要说明的是,在本发明实施例中可以在控制器2021中增加区域配置模块(Region Config)和数据存取模块(Data Access)功能子模块,进而可以借助这些功能子模块对不同区域的最长数据保存时间进行配置和访问,其中区域配置模块将NAND Flash划分为不同的区域,以满足Host对不同保存时间的需求。
在一种可能的实现方式中,所述控制器2021还用于:为每个所述存储区域生成对应的区域标识,并建立每个所述存储区域的最长数据保存时间和对应的区域标识之间的映射关系。可选的,控制器2021还用于向所述主机201发送所述映射关系。具体地,当存储设备202中的控制器2021基于区域配置信息将多个存储块划分为N个存储区域后,还可以为每个存储区域生成一个区域标识,以使得一个区域标识对应一个存储区域,接下来可建立每个存储区域的最长数据保存时间与区域标识之间的映射关系,然后向主机201发送这N个存储区域各自的最长数据保存时间与区域标识之间的映射关系,以使得主机201在生成写命令时,可以根据待存储数据的目标保存时间选择出目标存储区域,并将该目标存储区域的区域标识作为区域识别信息。例如,假设存储设备202中包括两个存储区域,且第一个存储区域的最长数 据保存时间为1年,第二个存储区域的最长数据保存时间为3天。存储设备202可以为每个存储区域生成一个区域标识,并且建立各自的最长数据保存时间与区域标识之间的映射关系,如第一个存储区域的区域标识为001且该标识与最长数据保存时间1年关联,第二个存储区域的区域标识为002且该标识与最长数据保存时间3天关联。而后,存储设备202会将两个区域标识和最长数据保存时间之间的映射关系发送给主机201,以便主机201根据待存储数据的目标保存时间,从这两个存储区域中选择出一个作为目标存储区域。
在一种可能的实现方式中,所述主机201具体用于:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;向所述控制器2021发送写命令,所述写命令包括所述待存储数据和所述目标存储区域对应的目标区域标识。具体地,当主机201获取到N个存储区域各自的最长数据保存时间与区域标识之间的映射关系后,主机201可基于待存储数据的目标保存时间从N个存储区域中,将最大数据保存时间大于或等于目标保存时间的存储区域确定为目标存储区域。进一步地,主机201在生成针对待存储数据的写命令时,可将目标存储区域对应的区域标识作为区域识别信息,以使得存储设备202接收到写命令后,能够基于该区域标识将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储资源浪费的问题,从而提升了外存的利用率和使用寿命。
在一种可能的实现方式中,所述写命令中还包括目标逻辑地址,所述目标逻辑地址为所述存储系统的可用逻辑地址空间中的任意一个地址;所述目标逻辑地址用于与所述目标存储区域中的目标物理地址建立映射关系,所述目标物理地址为所述待存储数据在所述目标存储区域中实际存储的物理地址。具体地,若每个存储区域都具有一个唯一的区域标识,那么该区域标识可以作为区域识别信息。在此情况下,写命令中除了需要包括待存储数据和目标区域识别信息,还需要包括一个逻辑地址,以便后续主机201能够基于该逻辑地址向存储设备202读取数据。
例如,如图6所示,图6为本发明实施例提供的一种分区数据管理示意图,图中HOST侧可通过数据的特点(即特点不同的数据,所需的目标保存时间可能不同),划分不同的区间,包括正常用户数据对应的公共区域(Common Region)和放宽保存时间区域LR Region 1~N。进一步地,可通过配置的方式告知SSD侧存储区域的划分和管理。在数据写入时,需要携带区域识别信息(包括但不限于通过特性标识、通过逻辑地址区间等)来告知SSD数据写入的位置。
需要说明的是,在该例子中,存储区域的配置过程为:首先,HOST可根据数据类型,确认需要的区间和对应的保存时间。接下来,主机201可通过自定义命令或协议预留字段,将分区数量(Region number)、各自的分区大小(Region size)和保存时间需求下发到存储设备202(如外存SSD)。进一步地,SSD控制器2021解析HOST的配置命令,获取对应的分区数量、各自的分区大小和保存时间,可保存到控制器2021内的区域配置模块(Region Config)。然后,SSD控制器2021根据各自的分区大小分配一定的Block,组成对应的存储区域,如果剩余的可用块数满足Region大小需求,则按照Region size分配对应的块数并记录分配的结果,SSD控制器2021恢复HOST设置成功;如果剩余的可用块数不足以满足Region大小需求,则SSD控制器2021返回设置失败。
还需要说明的是,在该例子中,数据写入过程为:首先,HOST根据待存储数据的类型,在写命令的保存字段附带Region号(即区域识别信息),组帧下发给SSD。接下来,SSD接 收到HOST下发的写命令时,解析对应的Region编号(即区域标识)。进一步地,SSD控制器2021查询对应的Region Config信息,确认是否与Host下发的写命令中Region编号匹配,如果查询到对应的Region信息,则获取对应Region的可写入位置,将数据写入对应的Region;如果查询不到对应的Region信息,则将数据写入公共区域(Common Region),按照正常用户数据处理。最后,SSD控制器2021回复HOST写入成功。可选的,若主机201下发的写命令Region无法匹配时,SSD可以选择回复HOST写入失败。例如,假设写命令中包括待存储数据,以及目标区域标识001。当SSD接收到该写命令后,会解析并识别目标区域标识001,然后将待存储数据存储在001对应的存储区域。
本发明实施例与现有技术相比,本发明实施例无需要调整存储块的物理介质,进而无需要额外的定制,因此不会增加额外的成本;本发明实施例没有采用SLC/TLC Mode切换的方式来换取写入量,因此不影响用户的可用空间;本发明实施例结合业务特点,根据主机201侧的数据类型(即不同类型的数据,数据保存时间可能不同)进行分区管理,避免数据丢失的问题。
在一种可能的实现方式中,所述控制器2021还用于:将所述存储系统的可用逻辑地址空间划分为N个逻辑地址段;建立每个所述存储区域的最长数据保存时间与所述N个逻辑地址段中的一个逻辑地址段之间的映射关系。可选的,控制器2021还用于向所述主机201发送所述映射关系。具体地,当存储设备202中的控制器2021基于区域配置信息将多个存储块划分为N个存储区域后,还可以将存储系统的可用逻辑地址空间划分为N个逻辑地址段,以使得一个逻辑地址段对应一个存储区域,接下来可建立每个存储区域的最长数据保存时间与逻辑地址段之间的映射关系,然后向主机201发送这N个存储区域各自的最长数据保存时间与逻辑地址段之间的映射关系,以使得主机201在生成写命令时,可以根据待存储数据的目标保存时间选择出目标存储区域,并将该目标存储区域的逻辑地址段作为区域识别信息。例如,假设存储设备202中包括两个存储区域,且第一个存储区域的最长数据保存时间为1年,第二个存储区域的最长数据保存时间为3天。存储设备202将存储系统中可用逻辑地址空间划分为两个逻辑地址段,并且建立各自的最长数据保存时间与逻辑地址段之间的映射关系,如第一个存储区域的逻辑地址段为LBA0~LBAm且该逻辑地址段与最长数据保存时间1年关联,第二个存储区域的逻辑地址段为LBAm+1~LBAn且该逻辑地址段与最长数据保存时间3天关联。而后,存储设备202会将两个区域标识和最长数据保存时间之间的映射关系发送给主机201,以便主机201根据待存储数据的目标保存时间,从这两个存储区域中选择出一个作为目标存储区域。
在一种可能的实现方式中,所述主机201具体用于:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;确定所述目标区域对应的目标逻辑地址段,从所述目标逻辑地址段中选择目标逻辑地址;向所述控制器2021发送写命令,所述写命令中携带所述待存储数据和所述目标逻辑地址。具体地,当主机201获取到N个存储区域各自的最长数据保存时间与逻辑地址段之间的映射关系后,主机201可基于待存储数据的目标保存时间从N个存储区域中,将最大数据保存时间大于或等于目标保存时间的存储区域确定为目标存储区域。进一步地,主机201在生成针对待存储数据的写命令时,可以从目标存储区域对应的逻辑地址段中选择一个地址作为目标逻辑地址,并将该目标逻辑地址作为区域识别信息,以使得存储设备202接收到写命令后,能够基于该目标逻辑地址将待存储数据存储在目标存储区域内,从而实现了按照待存储数据的目标保存时间进行数据存储,避免了所有数据都按照相同的且最长数据保存时间进行存储,导致存储 资源浪费的问题,从而提升了外存的利用率和使用寿命。
例如,如图7所示,图7为本发明实施例提供的另一种分区数据管理示意图,图中Host数据通过逻辑地址范围来标识数据的保存时间需求,SSD根据不同的LBA范围将数据写入不同的区域,如图8所示,图8为本发明实施例提供的一种数据分区示意图,图中OS分区可表示系统文件,User Data可表示正常的用户数据,都需要按照40℃ 1Year(在40摄氏度环境下,最长数据保存时间为1年)的规格保存在存储介质中,而Swap Data则对应文件系统中后台应用的匿名页数据,为了缓解内存(Dynamic Random Access Memory,DRAM)压力,会将一部分暂时不用的后台应用对应的临时匿名页数据放到SSD的分区中暂存,便于后面应用切回前台时的快速响应,该部分数据整体保存时间较短,一般不超过7天,且出现异常掉电时,没有保电恢复的诉求,对整机可靠性和用户体验没有影响,可以单独放到swap分区,放宽保存时间来提升可用寿命。
需要说明的是,在该例子中,存储区域的配置过程为:首先,HOST根据数据类型,基于用户模型获取User Data与Swap Data比例为7:3,而保存时间需求分别为40℃ 1Year(在40摄氏度的环境下,最长数据保存时间为1年)和40℃ 1Month(在40摄氏度的环境下,最长数据保存时间为1个月),根据保存时间与P/E(可擦除次数)对应关系,40℃ 1Year对应P/E规格为3000次,40℃ 1Month对应P/E规格为8000次(不同介质有差异,可根据实际情况调整),要达到不同分区均衡的目的,User Data与Swap Data大小分配需满足7/3000*X=3/8000*(1-X),得出比例为User Data:Swap Data=0.86:0.14。接下来,主机201可通过自定义命令或协议预留字段,将分区数量(Region number)、LBA范围(各自的逻辑地址段)下发到SSD,根据分配的分区大小比例,将逻辑地址的86%约定为用户数据区,14%约定为Swap数据区,在本发明实施例中可将前86%设定为用户数据区,将后14%设定为Swap数据区。进一步地,存储设备202的控制器2021解析HOST的配置命令,获取对应的分区数量、LBA范围进行区域配置,并保存到控制器2021内。最后,SSD控制器2021可回复HOST设置成功。
还需要说明的是,在该例子中,数据写入过程为:首先,Host根据数据类型从不同的逻辑地址区间申请空间,在该例子中,用户数据写入总空间0%~86%范围逻辑地址区间,Swap Data写入总空间86%~100%范围逻辑地址区间。接下来,SSD控制器2021接收到Host的写命令后,解析对应的逻辑地址LBA和写入长度,按照约定的逻辑地址分区配置,管理数据的写入方向。进一步地,控制器2021识别到写入0%~86%范围逻辑地址请求时,将数据写入对应的Common Region,类似的,识别到写入86%~100%范围逻辑地址的请求时,将数据写入对应的Swap Region。最后,SSD可根据逻辑地址LBA信息将数据写入NAND Flash后,回复HOST写入成功。
可以理解的是,按照用户的数据比例,可以保证公共区域(Common Region)使用到3K P/E(可擦除3000次)时,Swap Region使用到8K P/E(可擦除8000次),由于Host侧Swap数据的特性,不要求发生异常断电时保存Swap数据,因此,在发生异常断电后,Swap区域的数据可以清除,不需要进行对应的恢复重建。
在本发明实施例中,通过外存(如SSD)的控制器2021对存储块(Block)进行分区,并且通过软件配置使得不同存储区域的最长数据保存时间不同,从而控制器2021可基于多个存储区域来存储数据,提升了外存的利用率和使用寿命。具体地,控制器2021基于配置信息,首先将多个Block块分为N个存储区域。进一步地,控制器2021基于配置信息中的各个存储区域对应的最长数据保存时间,通过软件配置每个存储区域中包括的一个或多个Block块的 最长数据保存时间,以实现不同存储区域的最大数据保存时间不同。最终,控制器2021可按照待存储数据所需的保存时间将数据存储在对应的存储区域中,避免了所有存储块按照相同的最长数据保存时间进行配置,导致硬件资源浪费的问题,提升了外存的利用率和使用寿命。同时,由于将存储块进行分区使用,能够便于数据管理,也有利于存储设备202整体的性能保持和维护。此外,由于本申请中Block的最长数据保存时间是通过软件来进行配置的,因此无需与外存制造厂商进行个性化的硬件定制,可以在不增加成本、不降低可用空间且不影响数据可靠性的前提下,提升外存的使用寿命。
上述详细阐述了本发明实施例的存储系统,下面提供了本发明实施例的相关方法。
请参见图9,图9是本发明实施例提供的一种数据分区管理方法的流程图,该方法适用于上述图2中的一种存储系统以及包含所述存储系统的设备。该方法可以包括以下步骤S301-步骤S303。所述存储系统包括存储设备,所述存储设备包括控制器和M个存储块Block,M为大于0的整数。详细描述如下:
步骤S301:通过所述控制器,确定区域配置信息。
具体地,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;
步骤S302:通过所述控制器,根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域。
具体地,所述N个存储区域中的每个存储区域包括一个或多个Block;
步骤S303:通过所述控制器,根据所述各个存储区域对应的最长数据保存时间,配置所述N个存储区域中每个存储区域的所述最长数据保存时间。
在一种可能的实现方式中,所述方法还包括:通过所述控制器,接收主机发送的所述区域配置信息,或者与所述主机协商所述区域配置信息。
在一种可能的实现方式中,所述方法还包括:通过所述控制器,为每个所述存储区域生成对应的区域标识,并建立每个所述存储区域的最长数据保存时间和对应的区域标识之间的映射关系。
在一种可能的实现方式中,所述方法还包括:通过所述控制器,将所述存储系统的可用逻辑地址空间划分为N个逻辑地址段;建立每个所述存储区域的最长数据保存时间与所述N个逻辑地址段中的一个逻辑地址段之间的映射关系。
在一种可能的实现方式中,所述方法还包括:通过所述控制器,接收所述主机发送的写命令;所述写命令包括待存储数据和目标存储区域的目标区域识别信息;所述目标存储区域为所述N个存储区域中的一个,每个所述存储区域对应一个区域识别信息;基于所述写命令中的所述目标区域识别信息,将所述待存储数据写入到所述目标存储区域。
在一种可能的实现方式中,所述方法还包括:通过所述控制器,基于每个所述存储区域对应的所述最长数据保存时间,配置每个所述存储区域中所包括的Block的最大可擦除次数;存储区域对应的所述最长数据保存时间越短,所述存储区域中包括的Block的所述最大可擦除次数越大。
通过本发明实施例提供的方法,能够提升存储设备的使用寿命。
请参见图10,图10是本发明实施例提供的另一种数据分区管理方法的流程图,该方法适用于上述图2中的一种处理装置以及包含所述处理装置的设备。该方法可以包括以下步骤 S401和步骤S402。详细描述如下:
步骤S401:生成区域配置信息。
具体地,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;
步骤S402:向存储设备发送所述区域配置信息。
具体地,所述区域配置信息用于所述存储设备将M个存储块Block划分为N个存储区域,每个所述存储区域对应一个最长数据保存时间,M为大于1的整数。
在一种可能的实现方式中,所述方法还包括;根据待存储数据的需求信息,从所述N个存储区域中选择目标存储区域;所述需求信息中包括所述待存储数据期望的目标保存时间,所述目标存储区域对应的所述最大数据保存时间大于或等于所述目标保存时间;每个所述存储区域对应一个区域识别信息;向所述存储设备发送写命令,所述写命令包括所述待存储数据和所述目标存储区域的目标区域识别信息。
在一种可能的实现方式中,所述方法还包括:根据所述待存储数据的数据类型,确定所述目标保存时间,所述数据类型包括应用使用过程中产生的临时数据、后台应用匿名页对应的堆栈数据,应用关闭后可丢弃的数据中的一种或多种。
在一种可能的实现方式中,所述向所述控制器发送写命令,包括:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;向所述控制器发送写命令,所述写命令包括所述待存储数据和所述目标存储区域对应的目标区域标识。
在一种可能的实现方式中,所述写命令中还包括目标逻辑地址,所述目标逻辑地址为可用逻辑地址空间中的任意一个地址;所述目标逻辑地址与所述目标存储区域中的目标物理地址存在映射关系,所述目标物理地址为所述待存储数据在所述目标存储区域中实际存储的物理地址。
在一种可能的实现方式中,所述向所述控制器发送写命令,包括:从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;确定所述目标区域对应的目标逻辑地址段,从所述目标逻辑地址段中选择目标逻辑地址;向所述控制器发送写命令,所述写命令中携带所述待存储数据和所述目标逻辑地址。
本申请提供了一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述任意一种数据分区管理方法。
本申请实施例提供一种电子设备,该电子设备中包括处理器,处理器被配置为支持该电子设备实现上述任意一种数据分区管理方法中相应的功能。该电子设备还可以包括存储器,存储器用于与处理器耦合,其保存该电子设备必要的程序指令和数据。该电子设备还可以包括通信接口,用于该电子设备与其他设备或通信网络通信。
本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持电子设备实现上述所涉及的功能,例如,生成或处理上述一种数据分区管理方法中所涉及的信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存电子设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本申请提供一种计算机程序,其特征在于,所述计算机程序包括指令,当所述计算机程序被计算机执行时,使得所述计算机执行上述一种数据分区管理方法。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可能可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以为个人计算机、服务器或者网络设备等,具体可以是计算机设备中的处理器)执行本申请各个实施例上述方法的全部或部分步骤。其中,而前述的存储介质可包括:U盘、移动硬盘、磁碟、光盘、只读存储器(Read-Only Memory,缩写:ROM)或者随机存取存储器(Random Access Memory,缩写:RAM)等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (26)

  1. 一种存储装置,其特征在于,所述存储装置包括控制器和M个存储块Block,M为大于0的整数,其中,
    所述控制器用于:
    确定区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;
    根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域;所述N个存储区域中的每个存储区域包括一个或多个Block;
    根据所述区域配置信息为所述N个存储区域中的每个存储区域配置各自的最长数据保存时间。
  2. 如权利要求1所述的存储装置,其特征在于,所述控制器还用于:
    接收主机发送的所述区域配置信息,或者与所述主机协商所述区域配置信息。
  3. 如权利要求2所述的存储装置,其特征在于,所述控制器还用于:
    为每个所述存储区域生成对应的区域标识,并建立每个所述存储区域的最长数据保存时间和对应的区域标识之间的映射关系。
  4. 如权利要求2所述的存储装置,其特征在于,所述控制器还用于:
    将所述存储系统的可用逻辑地址空间划分为N个逻辑地址段;
    建立每个所述存储区域的最长数据保存时间与所述N个逻辑地址段中的一个逻辑地址段之间的映射关系。
  5. 如权利要求1-4任意一项所述的存储装置,其特征在于,所述控制器还用于:
    接收所述主机发送的写命令;所述写命令包括待存储数据和目标存储区域的目标区域识别信息;所述目标存储区域为所述N个存储区域中的一个,每个所述存储区域对应一个区域识别信息;
    基于所述写命令中的所述目标区域识别信息,将所述待存储数据写入到所述目标存储区域。
  6. 如权利要求1-5任意一项所述的存储装置,其特征在于,所述控制器还用于:
    基于每个所述存储区域对应的所述最长数据保存时间,配置每个所述存储区域中所包括的Block的最大可擦除次数;存储区域对应的所述最长数据保存时间越短,所述存储区域中包括的Block的所述最大可擦除次数越大。
  7. 一种处理装置,其特征在于,包括主机,所述主机用于:
    生成区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;
    向存储设备发送所述区域配置信息,所述区域配置信息用于所述存储设备将M个存储块Block划分为N个存储区域,每个所述存储区域对应一个最长数据保存时间,M为大于1的 整数。
  8. 如权利要求7所述的处理装置,其特征在于,所述主机还用于:
    根据待存储数据的需求信息,从所述N个存储区域中选择目标存储区域;所述需求信息中包括所述待存储数据期望的目标保存时间,所述目标存储区域对应的所述最大数据保存时间大于或等于所述目标保存时间;每个所述存储区域对应一个区域识别信息;
    向所述存储设备发送写命令,所述写命令包括所述待存储数据和所述目标存储区域的目标区域识别信息。
  9. 如权利要求8所述的处理装置,其特征在于,所述主机还用于:
    根据所述待存储数据的数据类型,确定所述目标保存时间,所述数据类型包括应用使用过程中产生的临时数据、后台应用匿名页对应的堆栈数据,应用关闭后可丢弃的数据中的一种或多种。
  10. 如权利要求9所述的处理装置,其特征在于,所述主机具体用于:
    从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;
    向所述控制器发送写命令,所述写命令包括所述待存储数据和所述目标存储区域对应的目标区域标识。
  11. 如权利要求10所述的处理装置,其特征在于,所述写命令中还包括目标逻辑地址,所述目标逻辑地址为所述主机的可用逻辑地址空间中的任意一个地址;所述目标逻辑地址与所述目标存储区域中的目标物理地址存在映射关系,所述目标物理地址为所述待存储数据在所述目标存储区域中实际存储的物理地址。
  12. 如权利要求9所述的处理装置,其特征在于,所述主机具体用于:
    从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;
    确定所述目标区域对应的目标逻辑地址段,从所述目标逻辑地址段中选择目标逻辑地址;
    向所述控制器发送写命令,所述写命令中携带所述待存储数据和所述目标逻辑地址。
  13. 一种数据分区管理方法,其特征在于,应用于存储装置,所述存储装置包括M个存储块Block,M为大于0的整数,所述方法包括:
    确定区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;
    根据所述存储区域数量N和所述各个存储区域的大小,将所述M个存储块Block划分为N个存储区域;所述N个存储区域中的每个存储区域包括一个或多个Block;
    根据所述区域配置信息为所述N个存储区域中的每个存储区域配置各自的最长数据保存时间。
  14. 如权利要求13所述的方法,其特征在于,所述方法还包括:
    接收主机发送的所述区域配置信息,或者与所述主机协商所述区域配置信息。
  15. 如权利要求14所述的方法,其特征在于,所述方法还包括:
    为每个所述存储区域生成对应的区域标识,并建立每个所述存储区域的最长数据保存时间和对应的区域标识之间的映射关系。
  16. 如权利要求14所述的方法,其特征在于,所述方法还包括:
    将所述存储系统的可用逻辑地址空间划分为N个逻辑地址段;
    建立每个所述存储区域的最长数据保存时间与所述N个逻辑地址段中的一个逻辑地址段之间的映射关系。
  17. 如权利要求13-16任意一项所述的方法,其特征在于,所述方法还包括:
    接收所述主机发送的写命令;所述写命令包括待存储数据和目标存储区域的目标区域识别信息;所述目标存储区域为所述N个存储区域中的一个,每个所述存储区域对应一个区域识别信息;
    基于所述写命令中的所述目标区域识别信息,将所述待存储数据写入到所述目标存储区域。
  18. 如权利要求13-17任意一项所述的方法,其特征在于,所述方法还包括:
    基于每个所述存储区域对应的所述最长数据保存时间,配置每个所述存储区域中所包括的Block的最大可擦除次数;存储区域对应的所述最长数据保存时间越短,所述存储区域中包括的Block的所述最大可擦除次数越大。
  19. 一种数据分区管理方法,其特征在于,所述方法包括:
    生成区域配置信息,所述区域配置信息包括存储区域数量N、各个存储区域的大小、各个存储区域对应的最长数据保存时间,N为大于1的整数;
    向存储设备发送所述区域配置信息,所述区域配置信息用于所述存储设备将M个存储块Block划分为N个存储区域,每个所述存储区域对应一个最长数据保存时间,M为大于1的整数。
  20. 如权利要求19所述的方法,其特征在于,所述方法还包括;
    根据待存储数据的需求信息,从所述N个存储区域中选择目标存储区域;所述需求信息中包括所述待存储数据期望的目标保存时间,所述目标存储区域对应的所述最大数据保存时间大于或等于所述目标保存时间;每个所述存储区域对应一个区域识别信息;
    向所述存储设备发送写命令,所述写命令包括所述待存储数据和所述目标存储区域的目标区域识别信息。
  21. 如权利要求20所述的方法,其特征在于,所述方法还包括:
    根据所述待存储数据的数据类型,确定所述目标保存时间,所述数据类型包括应用使用过程中产生的临时数据、后台应用匿名页对应的堆栈数据,应用关闭后可丢弃的数据中的一种或多种。
  22. 如权利要求21所述的方法,其特征在于,所述向所述控制器发送写命令,包括:
    从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;
    向所述控制器发送写命令,所述写命令包括所述待存储数据和所述目标存储区域对应的目标区域标识。
  23. 如权利要求22所述的方法,其特征在于,所述写命令中还包括目标逻辑地址,所述目标逻辑地址为可用逻辑地址空间中的任意一个地址;所述目标逻辑地址与所述目标存储区域中的目标物理地址存在映射关系,所述目标物理地址为所述待存储数据在所述目标存储区域中实际存储的物理地址。
  24. 如权利要求20所述的系统,其特征在于,所述向所述控制器发送写命令,包括:
    从所述N个存储区域中,将所述最大数据保存时间大于或等于所述目标保存时间的存储区域确定为所述目标存储区域;
    确定所述目标区域对应的目标逻辑地址段,从所述目标逻辑地址段中选择目标逻辑地址;
    向所述控制器发送写命令,所述写命令中携带所述待存储数据和所述目标逻辑地址。
  25. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述权利要求13-18中任意一项所述的方法,或是上述权利要求19-24中任意一项所述的方法。
  26. 一种计算机程序,其特征在于,所述计算机程序包括指令,当所述计算机程序被计算机或处理器执行时,使得所述计算机或处理器执行如权利要求13-18中任意一项所述的方法,或是如权利要求19-24中任意一项所述的方法。
PCT/CN2023/075459 2022-03-07 2023-02-10 一种存储装置及相关数据分区管理方法 WO2023169142A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210223806.1A CN116774905A (zh) 2022-03-07 2022-03-07 一种存储装置及相关数据分区管理方法
CN202210223806.1 2022-03-07

Publications (1)

Publication Number Publication Date
WO2023169142A1 true WO2023169142A1 (zh) 2023-09-14

Family

ID=87937139

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/075459 WO2023169142A1 (zh) 2022-03-07 2023-02-10 一种存储装置及相关数据分区管理方法

Country Status (2)

Country Link
CN (1) CN116774905A (zh)
WO (1) WO2023169142A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002149469A (ja) * 2001-09-18 2002-05-24 Matsushita Graphic Communication Systems Inc データ格納装置
CN106598484A (zh) * 2016-11-17 2017-04-26 华为技术有限公司 数据的存储方法、闪存芯片以及存储装置
CN108733325A (zh) * 2018-05-25 2018-11-02 山东大学 一种基于非挥发性存储器的数据自毁方法及系统
WO2021120137A1 (zh) * 2019-12-19 2021-06-24 华为技术有限公司 一种数据存储方法及存储装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002149469A (ja) * 2001-09-18 2002-05-24 Matsushita Graphic Communication Systems Inc データ格納装置
CN106598484A (zh) * 2016-11-17 2017-04-26 华为技术有限公司 数据的存储方法、闪存芯片以及存储装置
CN108733325A (zh) * 2018-05-25 2018-11-02 山东大学 一种基于非挥发性存储器的数据自毁方法及系统
WO2021120137A1 (zh) * 2019-12-19 2021-06-24 华为技术有限公司 一种数据存储方法及存储装置

Also Published As

Publication number Publication date
CN116774905A (zh) 2023-09-19

Similar Documents

Publication Publication Date Title
US11797180B2 (en) Apparatus and method to provide cache move with non-volatile mass memory system
CN107844431B (zh) 映射表更新方法、存储器控制电路单元与存储器存储装置
TWI682278B (zh) 記憶體系統及控制方法
US10540094B2 (en) Extended utilization area for a memory device
WO2017000658A1 (zh) 存储系统、存储管理装置、存储器、混合存储装置及存储管理方法
CN112035381B (zh) 一种存储系统及存储数据处理方法
TW201716980A (zh) 資料儲存設備及其操作方法
US9436267B2 (en) Data storage device
KR102585883B1 (ko) 메모리 시스템의 동작 방법 및 메모리 시스템
CN111108488B (zh) 内存块回收方法和装置
KR20150055413A (ko) 데이터 저장 장치
US20240086092A1 (en) Method for managing namespaces in a storage device and storage device employing the same
CN107943710B (zh) 存储器管理方法及使用所述方法的存储控制器
CN116795735B (zh) 固态硬盘空间分配方法、装置、介质及系统
WO2023169142A1 (zh) 一种存储装置及相关数据分区管理方法
US11775188B2 (en) Communications to reclaim storage space occupied by proof of space plots in solid state drives
US20230244394A1 (en) Gradually Reclaim Storage Space Occupied by a Proof of Space Plot in a Solid State Drive
CN107766262B (zh) 调节并发写命令数量的方法与装置
TWI648629B (zh) 映射表更新方法、記憶體控制電路單元與記憶體儲存裝置
CN117348789A (zh) 数据访问方法、存储设备、硬盘、存储系统及存储介质

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

Country of ref document: EP

Kind code of ref document: A1