CN115145468A - Method for obtaining address space attribute, data backup method and storage device - Google Patents

Method for obtaining address space attribute, data backup method and storage device Download PDF

Info

Publication number
CN115145468A
CN115145468A CN202110341520.9A CN202110341520A CN115145468A CN 115145468 A CN115145468 A CN 115145468A CN 202110341520 A CN202110341520 A CN 202110341520A CN 115145468 A CN115145468 A CN 115145468A
Authority
CN
China
Prior art keywords
address space
command
data
address
read
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110341520.9A
Other languages
Chinese (zh)
Inventor
贾舒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Starblaze Technology Co ltd
Original Assignee
Chengdu Starblaze Technology Co ltd
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 Chengdu Starblaze Technology Co ltd filed Critical Chengdu Starblaze Technology Co ltd
Priority to CN202110341520.9A priority Critical patent/CN115145468A/en
Publication of CN115145468A publication Critical patent/CN115145468A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

A method for obtaining address space attributes, a data backup method and a storage device are provided. The method for obtaining the address space attribute is applied to a host and comprises the following steps: sending a read address space attribute command to a control component, wherein the read address space attribute command is used for reading at least one attribute of an address or a segment of address space; receiving first data fed back by the control unit, wherein the first data corresponds to at least one attribute indicated by the read address space attribute command.

Description

Method for obtaining address space attribute, data backup method and storage device
Technical Field
The present application relates to storage technologies, and in particular, to a method for obtaining address space attributes, a data backup method, and a storage device.
Background
FIG. 1 illustrates a block diagram of a storage device. The storage device 102 is coupled to a host for providing storage capabilities to the host. The host and the storage device 102 may be coupled by various methods, including but not limited to, connecting the host and the storage device 102 by, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIE, high speed Peripheral Component Interconnect), NVMe (NVM Express, high speed nonvolatile storage), ethernet, fibre channel, wireless communication network, etc. The host may be an information processing device, such as a personal computer, tablet, server, portable computer, network switch, router, cellular telephone, personal digital assistant, etc., capable of communicating with the storage device in the manner described above. The Memory device 102 includes an interface 103, a control section 104, one or more NVM chips 105, and a DRAM (Dynamic Random Access Memory) 110.
NAND flash Memory, phase change Memory, feRAM (Ferroelectric RAM), MRAM (magnetoresistive Memory), RRAM (Resistive Random Access Memory), XPoint Memory, and the like are common NVM.
The interface 103 may be adapted to exchange data with a host by means such as SATA, IDE, USB, PCIE, NVMe, SAS, ethernet, fibre channel, etc.
Control component 104 is used to control the transfer of data between interface 103, NVM chip 105, and DRAM 110, as well as for memory management, host logical address to flash physical address mapping, erase leveling, bad block management, etc. The control component 104 can be implemented in various manners of software, hardware, firmware, or a combination thereof, for example, the control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application-Specific Integrated Circuit), or a combination thereof. The control component 104 may also include a processor or controller in which software is executed to manipulate the hardware of the control component 104 to process IO (Input/Output) commands. The control component 104 may also be coupled to the DRAM 110 and may access data of the DRAM 110. FTL tables and/or cached IO command data may be stored in the DRAM.
Control section 104 includes a flash interface controller (or referred to as a media interface controller, a flash channel controller) that is coupled to NVM chip 105 and issues commands to NVM chip 105 in a manner that conforms to an interface protocol of NVM chip 105 to operate NVM chip 105 and receive command execution results output from NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI", etc.
In the storage device, mapping information from logical addresses to physical addresses is maintained by using a Flash Translation Layer (FTL). The logical addresses constitute storage space of the storage device as perceived by upper level software, such as an operating system. The physical address is an address for accessing a physical memory location of the memory device. Address mapping may also be implemented using an intermediate address modality in the related art. E.g. mapping the logical address to an intermediate address, which in turn is further mapped to a physical address. In these cases, the read/write commands received by the storage device indicate logical addresses.
A table structure storing mapping information from a Logical address To a Physical address is called an L2P table (Logical address To Physical address) (also called an FTL table). The L2P table is important metadata in the storage device. Usually, an entry (also referred to as an L2P entry) of the L2P table records an address mapping relationship in units of data pages in the storage device.
The FTL of some memory devices is provided by a host to which the memory device is coupled, the L2P table is stored by a memory of the host, and the FTL is provided by a CPU of the host executing software. Still other storage management devices disposed between hosts and storage devices provide FTLs. In these cases, the read/write commands received by the storage device indicate physical addresses.
Commands provided by the host to the storage device may access the logical address space corresponding to one or more entries of the L2P. And the control component may morph the command received from the interface 103 (e.g., split the command according to the logical address space size corresponding to the L2P entry) and process the morphed command. For purposes of clarity, commands provided by a host to a storage device are referred to herein as IO commands.
Fig. 2 shows a schematic diagram of a prior art L2P table.
As shown in fig. 2, the L2P table includes a plurality of L2P entries, each L2P entry storing an NVM data frame address. The NVM data frame address is a physical address in the NVM chip. For example, L2P entry 0 stores NVM data frame address 0. The entries in the L2P table are ordered, for example, in such a way that the logical address increases, such as L2P entry 0 having a logical address of LBA0, L2P entry 1 having a logical address of LBA1, L2P entry 2 having a logical address of LBA2, … …, and so on.
Fig. 3 shows a block diagram of a control unit in the prior art.
Hosts access storage devices with IO commands that follow a storage protocol. The control component generates one or more storage commands according to the IO commands from the host and provides the storage commands to the media interface controller. The media interface controller generates storage media access commands (e.g., program commands, read commands, erase commands) in accordance with the interface protocol of the NVM chip in accordance with the storage commands. The control unit also tracks that all storage commands generated from one IO command are completed by execution and indicates the processing result of the IO command to the host.
Referring to fig. 3, the control means includes, for example, a host interface, a host command processing unit, a storage command processing unit, a media interface controller, and a storage media management unit. The host interface acquires the IO command provided by the host, generates a storage command and provides the storage command to the storage command processing unit. The storage command accesses, for example, a storage space of the same size, for example, 4KB. A data unit recorded in the NVM chip corresponding to data accessed by one storage command is referred to as a data frame. A physical page records one or more frames of data. For example, the physical page size is 17664 bytes, while the data frame size is 4KB, one physical page can store 4 frames of data.
Disclosure of Invention
It is a common requirement to backup or mirror storage devices. Generally, backing up a storage device includes 2 ways. One is to accurately obtain the valid data of the storage device by using the file system and backup the valid data, and the backup data in this way has a small amount of data but strictly needs to use the file system. The second way is to backup the data corresponding to each address in the complete address space of the storage device without a file system, which results in a large amount of invalid data being copied, thereby wasting a large amount of time, energy and data transmission bandwidth. According to the embodiment of the application, by reading the address space attribute command, all data in the storage device do not need to be copied in the backup process of the storage device even under the condition that a file system does not exist, so that the data amount of backup is greatly reduced, and the time, energy and data transmission bandwidth required by the backup of the data are reduced.
According to the address space attribute reading command provided by the embodiment of the application, the address space attribute reading command can be used for multiple purposes of storage device defragmentation, sequential stream detection, address space attribute table copying and the like besides being used for storage backup. The read address space command also serves as an architected interface for the storage device to enrich the functionality and facilitate use of the storage device.
According to a first aspect of the present application, there is provided a first method for obtaining address space attributes according to the first aspect of the present application, which is applied to a host, and includes: a read address space attribute command is sent to the control unit, the read address space attribute command is used for reading at least one attribute of an address or a section of address space; receiving first data fed back by the control unit, wherein the first data corresponds to at least one attribute indicated by the read address space attribute command.
According to the first method for obtaining address space attributes of the first aspect of the present application, there is provided the second method for obtaining address space attributes of the first aspect of the present application, where the attributes include an effective element, an effective element fraction, a continuous data block size, a degree of randomness, and a time variation value of each attribute.
According to the first or second method for obtaining address space attributes of the first aspect of the present application, there is provided a third method for obtaining address space attributes of the first aspect of the present application, where an address indicated by the read address space attribute command is a logical address.
According to the first method for obtaining address space attributes of the first aspect of the present application, there is provided a fourth method for obtaining address space attributes of the first aspect of the present application, where the first data is part or all of an address space attribute table; or, the first data is at least one attribute required by the read address space attribute command.
According to a fourth method for obtaining address space attributes of the first aspect of the present application, there is provided the fifth method for obtaining address space attributes of the first aspect of the present application, where if the first data is part or all of an address space attribute table, the address space attribute table represents whether each address of an address space corresponds to an effective element, and the method further includes: and processing the first data to obtain the at least one attribute.
According to a second aspect of the present application, there is provided a first method for obtaining address space attributes according to the second aspect of the present application, applied to a control component, including: receiving a read address space attribute command sent by a host, wherein the read address space attribute command is used for reading at least one attribute of an address or a section of address space; accessing an address space attribute table according to the address space attribute reading command to acquire first data, wherein the first data correspond to at least one attribute indicated by the address space attribute reading command, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not; and feeding back the first data to the host.
According to the second aspect of the present application, the attributes include effective elements, effective element ratios, continuous data block sizes, randomness, and time variation values of each attribute.
According to the first or second method for obtaining address space attributes of the second aspect of the present application, there is provided a third method for obtaining address space attributes of the second aspect of the present application, where the address indicated by the read address space attribute command is a logical address.
According to one of the first to third methods of acquiring address space attributes of the second aspect of the present application, there is provided a fourth method of acquiring address space attributes of the second aspect of the present application, the method further comprising: responding to the address space attribute reading command, and acquiring a first address index according to an address carried by the address space attribute reading command; and acquiring the first data from the address space attribute table according to the first address index, wherein the first data is part or all of the address space attribute table.
According to a fourth method for obtaining address space attributes of the second aspect of the present application, there is provided a fifth method for obtaining address space attributes of the second aspect of the present application, where obtaining the first data from the address space attribute table includes: reading second data from the address space attribute table; and compressing the second data to obtain the first data.
According to the first method for obtaining address space attributes of the second aspect of the present application, there is provided a sixth method for obtaining address space attributes of the second aspect of the present application, the method further comprising: responding to the address space attribute reading command, and acquiring a first address index according to an address carried by the address space attribute reading command; reading a plurality of effective elements from the address space attribute table according to the first address index; and processing the plurality of effective elements according to the attribute indicated by the address space attribute reading command to acquire the first data, wherein the first data is the attribute required by the address space attribute reading command.
According to a third aspect of the present application, there is provided a data backup method of a first storage device according to the third aspect of the present application, including: acquiring third data by using an address space attribute reading command, wherein the third data is part or all of an address space attribute table, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not; accessing a first storage device according to a first plurality of logical addresses corresponding to effective elements in the third data to read a first plurality of data to be backed up from the first storage device, wherein the first plurality of data to be backed up correspond to the first plurality of logical addresses; writing the first plurality of data to be backed up into a second storage device to obtain backup data; wherein each valid element corresponds to a logical address, and the obtaining of the third data using the read address space attribute command is implemented by a method as described in any of the above first aspects.
According to the data backup method of the first storage device in the third aspect of the present application, there is provided a data backup method of the second storage device in the third aspect of the present application, where writing the data to be backed up into the second storage device includes: and writing the data to be backed up into the second storage device according to the corresponding relation between the effective elements and the logical addresses, so that the corresponding relation between the backup data and the logical addresses in the second storage device is the same as the corresponding relation between the effective elements and the logical addresses.
According to a fourth aspect of the present application, there is provided a method for acquiring a first address space attribute according to the fourth aspect of the present application, including: the host sends a first read address space attribute command to the control component, wherein the first read address space attribute command is used for reading at least one attribute of an address or a section of address space; responding to the first address space attribute reading command, the control component accesses an address space attribute table to acquire first data, wherein the address space attribute table represents whether each address of an address space corresponds to an effective element or not; the control component feeds back the first data to the host, the first data corresponding to at least one attribute indicated by the first read address space attribute command.
According to the fourth aspect of the present application, there is provided a method for obtaining a second address space attribute, when the first read address space attribute command indicates to obtain a randomness of a first address space, the method comprising: responding to the first address space attribute reading command, and acquiring a second address space with the randomness being larger than a preset threshold value in the first address space by the control part; the control means acquires an effective element within the second address space; the control means tagging the second address space according to an active element within the second address space; and the control part feeds back the marked address corresponding to the second address space to the host.
According to the fourth aspect of the present application, there is provided a method for obtaining a third address space attribute, when the first address space attribute read command indicates to obtain the address space attribute table, the method further includes; in response to the first read address space attribute command, the control component feeding back the address space attribute table to the host; the host stores the address space attribute table.
According to a fifth aspect of the present application, there is provided a method of accessing a first storage device according to the fifth aspect of the present application, the storage device including an address space attribute table, the method comprising: the host sends a first access command to the control component, wherein the first access command comprises a read command and a write command; the control component processes the first access command according to the address space attribute table; or, the control unit adjusts the address space attribute table according to the first access command.
According to an access method of a first storage device of a fifth aspect of the present application, there is provided the access method of a second storage device according to the fifth aspect of the present application, wherein when the first access command is a write command, the control section writes data to a storage medium according to the write command, and modifies the address space attribute table.
According to an access method of a second storage device of a fifth aspect of the present application, there is provided an access method of a third storage device of the fifth aspect of the present application, wherein the control unit writes data to a storage medium according to the write command and modifies the address space attribute table, and the method includes: the control part allocates a physical address for data to be written, the physical address corresponds to a second logical address, and the write command indicates the second logical address; the control component updates an L2P table according to the second logical address and the physical address; the control part writes data to be written into a storage space corresponding to the physical address; and the control component modifies the address space attribute table according to the second logical address.
According to an access method of a third storage device of a fifth aspect of the present application, there is provided an access method of a fourth storage device of the fifth aspect of the present application, wherein the modifying, by the control unit, the address space attribute table according to the second logical address includes: the control part modifies the value of at least one element corresponding to the second logic address in the address space attribute table, so that the modified second logic address in the address space attribute table corresponds to an effective element; and/or the control unit modifies at least one attribute in the address space attribute table.
According to one of the access methods of the first to fourth memory devices of the fifth aspect of the present application, there is provided the access method of the fifth memory device of the fifth aspect of the present application, when the first access command is a first read command, the method including: the host sends the first read command to the control component; in response to the first read command, the control component judges whether the first read command belongs to a sequential stream read command according to a third address space indicated by the read command; if yes, the control part acquires the randomness of the third address space; and the control part judges whether the first read command belongs to a sequential stream read command again according to the randomness of the third address space.
According to an access method of a fifth storage device of a fifth aspect of the present application, there is provided the access method of the sixth storage device of the fifth aspect of the present application, wherein the control section judges again whether the first read command belongs to a sequential stream read command according to the randomness of the third address space, the method including: the control component judges whether the randomness of the third address space is larger than a preset threshold value; when yes, the control section marks the first read command as not belonging to a sequential stream read command.
According to the fifth or sixth storage device access method of the fifth aspect of the present application, there is provided the seventh storage device access method of the fifth aspect of the present application, wherein when either of the determination results is no, the control section marks the first read command as belonging to a sequential stream read command.
According to the access method of the first storage device of the fifth aspect of the present application, there is provided the access method of the eighth storage device of the fifth aspect of the present application, when the first access command is the second read command, the method including: the host sends a second read command to the control component; in response to the second read command, the control unit judges whether a third address space indicated by the read command commands a first cache; when yes, the control part acquires first read data from the first cache; the control section feeds back the first read data to the host.
According to an access method of an eighth storage device of the fifth aspect of the present application, there is provided the access method of the ninth storage device of the fifth aspect of the present application, in the case of no, the control unit acquires second read data from the storage medium and transfers the second read data to a second cache; the control section feeds back the second read data to the host.
According to an access method of an eighth storage device of the fifth aspect of the present application, there is provided the access method of the tenth storage device of the fifth aspect of the present application, wherein the control section further acquires a randomness variation of the third address space; the control part judges whether the random degree change is larger than a preset threshold value or not; and when the random degree change is larger than a preset threshold value, the control component releases the second cache after feeding back the second read data to the host.
According to an access method of an eighth storage device of the fifth aspect of the present application, there is provided the access method of the eleventh storage device of the fifth aspect of the present application, wherein when the randomness variation is smaller than a preset threshold, the control unit reserves the second cache after feeding back the second read data to the host.
According to a sixth aspect of the present application, there is provided a first storage system according to the sixth aspect of the present application, including a host, a control section, and a storage medium; the control part maintains an L2P table and an address space attribute table, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not; the storage system performs the method of any one of the first to fifth aspects described above.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a block diagram of a prior art memory device;
FIG. 2 is a diagram of a prior art L2P table;
FIG. 3 is a block diagram of a control component in the prior art;
FIG. 4 is a diagram illustrating an example of a read address space attribute command according to the present application;
fig. 5A is a schematic diagram of an L2P table provided in an embodiment of the present application;
fig. 5B is a flowchart of a method for obtaining address space attributes according to an embodiment of the present application;
fig. 5C is a schematic diagram of a bitmap corresponding to an L2P table according to an embodiment of the present application;
FIG. 6A is a block diagram of a control component provided in an embodiment of the present application;
FIG. 6B illustrates a flow chart of a method of updating an address space attribute table;
FIG. 7A is a flowchart of a method for processing a read command according to an embodiment of the present disclosure;
FIG. 7B is a flowchart of a method for processing a write command according to an embodiment of the present disclosure;
fig. 8 is a flowchart of a data backup method according to an embodiment of the present application;
fig. 9 is a flowchart of a defragmentation method according to an embodiment of the present application;
fig. 10 is a flowchart of an address space attribute table backup method according to an embodiment of the present application;
FIG. 11 is a flowchart of yet another method for processing a read command according to an embodiment of the present application;
fig. 12 is a flowchart of yet another method for processing a read command according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be understood that the terms "first," "second," "third," and "fourth," etc. in the claims, description, and drawings of the present application are used for distinguishing between different objects and not for describing a particular order. The terms "comprises" and "comprising," when used in the specification and claims of this application, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only, and is not intended to be limiting of the application. As used in the specification and claims of this application, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should be further understood that the term "and/or" as used in the specification and claims of this application refers to any and all possible combinations of one or more of the associated listed items and includes such combinations.
As used in this specification and claims, the term "if" may be interpreted contextually as "when.. Or" once "or" in response to a determination "or" in response to a detection ".
Specific embodiments of the present application are described in detail below with reference to the accompanying drawings.
FIG. 4 is a diagram illustrating a read address space attribute command according to an embodiment of the present application.
As shown in fig. 4, embodiments of the present application provide a plurality of read address space attribute commands (denoted as read address space attribute commands in fig. 4), each indicating an address space range and an attribute type.
And the address space range indicated by the read address space attribute command indicates the range of the address space of the storage device of which the attribute is to be acquired by the read address space attribute command. For example, the address space of the storage device is LBA space, the full range of which is LBA0 to LBA2000, then the full space of the address space range is LBA0-LBA 2000, and the read address space property command may indicate the address range that is part or all of the full space, such as LBA0-LBA 1000, LBA101-LBA 1520. Wherein, the full space can also be represented by a specific identification bit.
The type of attribute indicated by the read address space attribute command indicates the category of attribute corresponding to the address space range to be obtained by the read address space attribute command. The attributes include an effective element (which refers to an address of an address space in which effective data is recorded), an effective element ratio, a continuous data block size (which refers to, for example, the number of a plurality of addresses of an address space in which effective data is continuously recorded), a degree of randomness (which refers to a degree of randomness of distribution of addresses in the address space in which effective data is recorded), and time-varying values of the foregoing respective attributes. The attribute type is information indicating a type of an attribute to be acquired in the read address space attribute command, for example, the attribute type of the valid element is 1, the attribute type of the valid element ratio is 2, the attribute type of the continuous data block size is 3, and the attribute type of the randomness is 4. And the time variation value of each attribute comprises a time variation value of an effective element, a time variation value of an effective element ratio, a time variation value of a continuous data block size, a time variation value of a random degree and the like. The attribute type of the time variation value of the effective element is 51, the attribute type of the time variation value of the effective element proportion is 52, the attribute type of the time variation value of the continuous data block size is 53, and the attribute type of the time variation value of the randomness is 54.
Optionally, the valid element in this application refers to a recorded valid address or a recorded valid element identifier in the L2P entry corresponding to the address space from which the attribute is to be obtained. The valid element identifier represents that the logical address corresponding to the entry stores valid data, but not blank data or garbage data after garbage collection.
Fig. 5A illustrates a schematic diagram of an L2P table provided in an embodiment of the present application.
As shown in FIG. 5A, the L2P table includes 6L 2P entries, L2P entry 0, L2P entry 1, … …, and L2P entry 5, respectively. In fig. 5A, a dashed box is an address index, which indicates that the address index is not necessarily stored in the L2P entry in the form of data, but the L2P entry corresponds to a logical address one-to-one, and the logical address is the index of the L2P entry. For example, L2P entries 0-5 correspond to logical addresses LBA 0-5, respectively, and logical address LBA3 is the index corresponding to L2P entry 3. In this embodiment, stored in each entry of the L2P table is an NVM data frame address, which includes an effective address and an invalid address. For example, the NVM data frame address 5 stored in the L2P entry 5 is a physical address of the NVM, and data stored in the physical address can be read out by accessing the NVM data frame address 5. In this embodiment, the invalid address is optionally a physical address or a specific identifier (e.g., N/a) indicating the invalid address, but data cannot be read out by accessing the invalid address. For example, accessing the physical address stored in L2P entry 4, an error may occur and the data may not be read. The invalid address in this embodiment may be any physical address in the NVM, and one physical address is preset as the invalid address. For example, if physical address 0 or physical address 100 is set to an invalid address, data cannot be written and data cannot be read by accessing physical address 0 or physical address 100. Further, after the mapping relationship between the logical address and the physical address is changed, the L2P table is also updated, for example, after data is written in the physical address corresponding to the logical address LBA0, the invalid address stored in the L2P entry 0 in the L2P table is modified to be an effective address; for another example, after the logical address LBA2 is executed, for example, a deallocation command, the effective address stored in L2P entry 2 in the L2P table is modified to an invalid address.
Fig. 5B shows a flowchart of a method for obtaining address space attributes according to an embodiment of the present application.
By way of example, the read address space attribute command in FIG. 5B indicates that the read attribute type is a valid element, and the address space indicated by the read address space attribute command is expressed by an L2P table as shown in FIG. 5A. The following describes the flow of fig. 5B by taking an example that the read address space attribute command is sent by the host and the control unit receives the read address space attribute command.
At step 510, a read address space attribute command is received.
Step 520, indexing the L2P table entry according to the address. After receiving the read address attribute command, the control component obtains the address space range indicated by the read address space attribute command, and each logical address in the address space range can be used as an address index for accessing the L2P table. For example, if the control unit obtains the address range of LBA 21 to LBA50, the control unit obtains 30 entries in total of LBA 21 to LBA50 in the L2P table. Further, the control section acquires one entry in the L2P table from one address index at a time.
Step 530, determine whether the address recorded in the L2P table entry is valid. Continuing with the previous example, specifically, the control unit determines 30L 2P entries corresponding to each of the logical addresses LBA 21 to LBA50 in the L2P table, and whether the 30 entries are recorded as valid addresses. Specifically, the control section makes a judgment once for each entry.
If the determination result is negative, the process returns to step 520 to continue determining whether the address recorded in the next L2P entry is an effective address. If yes, step 540 is executed to mark the bitmap of the corresponding address space with the used address. Fig. 5C shows a schematic diagram of a bitmap provided by an embodiment of the present application. Referring to fig. 5C, the bitmap includes valid element information corresponding to 6 addresses of LBA0 to LBA 5. Wherein LBA0, LBA2, LBA3, and LBA5 correspond to valid elements, and LBA1 and LBA4 correspond to invalid elements; alternatively, LBA0, LBA2, LBA3, and LBA5 correspond to an invalid element, and LBA1 and LBA4 correspond to a valid element.
The generated bitmap includes a plurality of bits, each bit corresponding to an element of the address space range indicated by the read address space attribute command. By way of example, for the address space range of logical addresses LBA 21 through LBA50, the generated bitmap includes 30 bits, with the value of each bit indicating one of its corresponding logical addresses of the address space range in turn.
Optionally, all of the active elements or all of the inactive elements are recorded in the bitmap before performing step 540. For example, all 0's or all 1's are recorded in the bitmap before step 540 is performed. As another example, the bitmap is "101101" shown in fig. 5C, for example, before step 540 is performed.
Optionally, when the step 540 is executed, each time the step 540 is executed to modify 1 bit in the bitmap, the step 520 is returned after the step 540 is executed, and the steps 520 to 540 are executed in a loop until the bitmap update corresponding to the address range is completed. In other embodiments, step 540 is performed by updating all or a plurality of bits in the bitmap corresponding to the address range, and after step 540 is performed, step 550 is continued.
Step 550 responds to the read address space attribute command with a bitmap corresponding to the address space. After the latest bitmap corresponding to the address range is acquired, the control section feeds back the bitmap to the host as a response to the read address space attribute command.
In this embodiment, the host sends a read address space attribute command to the control unit. The control component responds to the received read address space attribute command, generates a bitmap according to the L2P table, and takes the bitmap as a response of the read address space attribute command.
Another embodiment of the present application provides another method for obtaining address space attributes, which is applied to a host, and includes: sending an address space attribute reading command to the control component, wherein the address space attribute reading command is used for acquiring at least one attribute of an address or a segment of address space; and receiving first data fed back by the control unit, wherein the first data corresponds to at least one attribute indicated by the read address space attribute command. Optionally, the attributes in this embodiment include an effective element, an effective element ratio, a continuous data block size, a degree of randomness, and a time variation value of each attribute. Optionally, the address indicated by the address space attribute reading command or the address carried by the address space attribute reading command is a logical address or a physical address.
For example, a read address space attribute command is used to obtain the size of the contiguous block of data at which LBA52 begins, or the size of the largest contiguous block of data within some specified address space range. As another example, a read address space attribute command is used to obtain the percentage of active elements and the degree of randomness within the range of LBAs 52-LBA 103. As another example, a read address space attribute command is used to obtain a value of the randomness of the active elements of LBAs 128-256 over time during a first period of time.
In an alternative embodiment, the control unit provides an address space attribute table to facilitate processing of the read address space attribute command. The control component generates and maintains an address space attribute table, which may be as shown in tables 1 and 2. The first data is part or all of an address space attribute table; alternatively, the first data is at least one attribute required by the read address space attribute command. In this embodiment, the first data fed back by the control unit may be an address space attribute table, a part (one or more entries) of the address space attribute table, or the first data is an attribute acquired according to the address space attribute table. Alternatively, the manner in which the control unit generates the address space attribute table may refer to the method illustrated in fig. 5B in the previous embodiment, that is, the control unit generates the address space attribute table after receiving an instruction of a read address space attribute command. Alternatively, the control section is configured to generate an address space attribute table in advance and maintain the table at all times. For example, the control section of the storage device generates the address space attribute table before shipment of the storage device from the factory, and updates the address space attribute table after receiving an access command (read command and/or write command). Further optionally, the control section updates the address space attribute table after receiving an instruction to read the address space attribute table.
TABLE 1
Address indexing Effective element
LBA 100 0
LBA 101 1
LBA 102 0
LBA 103 0
LBA 104 1
LBA 105 0
LBA 106 1
LBA 107 1
Table 1 shows an address space attribute table. The address space attribute table of table 1 includes a plurality of entries, each indexed by LBA, each entry being, for example, 1 bit in size.
Table 1 records whether the address indices LBA100 to LBA107 correspond to valid elements. Taking "1" as an example, table 1 indicates that there are 4 logical addresses storing valid elements.
In one embodiment, the control component obtains an entry in the address space attribute table corresponding to an address index of the read address space attribute command. Or the control part acquires an address space attribute table (all entries) corresponding to the address index according to the address index of the read address space attribute command. For example, if the read address space attribute command indicates to obtain valid elements of the LBA 102-LBA 105 range, the control component obtains 4 entries corresponding to the LBA 102-LBA 105 in table 1, and feeds back the 4 entries to the host. As another example, if the read address space attribute command indicates to obtain valid elements of LBA100-LBA107, the control unit obtains all entries in table 1 and feeds back these 8 entries to the host. For another example, if the read address space attribute command indicates to obtain the valid elements of the LBAs 102 to 105, the control component parses that the address index of the read address space attribute command belongs to table 1, so that the control component obtains all the entries in table 1 and feeds back the 8 entries to the host.
In yet another embodiment, when the first data is at least one attribute required by the read address space attribute command, the control section acquires the required at least one attribute according to the address space attribute table. For example, the read address space attribute command indicates to obtain the valid elements and the randomness corresponding to the LBAs 100 to 107, and the control unit reads all the entries in the address space attribute table in table 1 to obtain the valid elements required by the read address space attribute command. The control section calculates the degree of randomness from all the entries of table 1, thereby acquiring the degree of randomness. The way to calculate the randomness can be seen in the prior art, and is not limited herein. The control unit feeds back the acquired effective elements and the randomness to the host as a response to the read address space attribute command.
TABLE 2
Figure BDA0002999244080000131
Table 2 shows another address space attribute table. As shown in table 2, in addition to the valid elements corresponding to the LBA 108 to LBA115, table 2 also has three attributes of the size of the corresponding continuous data block and the ratio of the valid elements.
In one embodiment, when the first data is part or all of the address space attribute table, the control unit obtains an entry corresponding to an address index in the address space attribute table according to the address index of the command for reading the address space attribute. Or the control part acquires an address space attribute table (all entries) corresponding to the address index according to the address index of the address space attribute reading command. When the address space attribute table is, for example, the address space attribute table of table 2, the control unit reads part or all of the entries of the address space attribute table as feedback in response to the read address space attribute command, and the method of reading the entries may be as described in the above embodiments, and is not expanded here.
In yet another embodiment, when the first data is at least one attribute required by the read address space attribute command, the control section acquires the required at least one attribute according to the address space attribute table. When the address space attribute table is, for example, the address space attribute table of table 2, the control section may directly read at least one attribute in the address space attribute table. For example, the control component reads LBA 108-LBA 114 as "1113" or "3" (the maximum number of consecutive data blocks within the LBA range).
Further, if the first data is part or all of the address space attribute table, and the address space attribute table represents whether the address of the address space corresponds to an effective element (that is, the address space attribute table is shown in table 1), the host processes the first data after receiving the first data, and acquires at least one attribute.
Fig. 6A shows a block diagram of a control unit. In fig. 6A, the control section includes a host interface, a host command processing unit, a storage command processing unit, a media interface controller, and a storage media management unit. The media interface controller is coupled with the NVM chip, and the control unit receives a read address space attribute command sent by the host through the host interface. The host command processing unit parses the read address space attribute command and generates a command suitable for the storage command processing unit. In response to receiving the command, the storage command processing unit performs an operation of the media interface controller to access the NVM chip or performs an operation of the storage media management unit to maintain the L2P table and the address space attribute table. In this embodiment, the storage medium management unit maintains an address space attribute table in addition to the L2P table.
The embodiment of the present application provides another method for obtaining an address space attribute, which is applied to a control component, and includes: and receiving a read address space attribute command sent by a host, wherein the read address space attribute command is used for reading at least one attribute of an address or a section of address space. Accessing an address space attribute table according to the address space attribute reading command to acquire first data, wherein the first data correspond to at least one attribute indicated by the address space attribute reading command, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not; feeding back the first data to the host.
Optionally, the address indicated by the read address space attribute command is a logical address.
Further optionally, in response to the address space attribute reading command, the first address index is obtained according to the address carried by the address space attribute reading command. And acquiring first data from the address space attribute table according to the first address index, wherein the first data is part or all of the address space attribute table. In this embodiment, the address indicated by the address space attribute reading command is an address index of the address space attribute table, that is, a logical address. Or the address indicated by the command for reading the address space attribute is not the address index of the address space attribute table, and at this time, the control component needs to obtain the address index according to the address carried by the command.
Further optionally, the control unit reads the second data from the address space attribute table, i.e. the second data is an entry of the address space attribute table. The control component compresses the second data to obtain the first data, namely the first data is the data obtained by compressing the items of the address space attribute table, so that the data volume fed back to the host by the control component can be further reduced, and the time length of data transmission is further reduced. In some cases, it may be beneficial to compress the second data. For example, when the number of 0 s and 1 s in the address space attribute table is significantly unbalanced, the data size can be significantly reduced by compression. By way of further example, when the number of 0 s and 1 s of the second data is significantly unbalanced (e.g., the number of 0 s is significantly less than 1), and only the data having 0 s and their positions (indexes) in the address space attribute table are transmitted, the size of the data to be transmitted can also be significantly reduced.
In other embodiments, in response to the address space attribute read command, the control component obtains the first address index according to an address carried by the address space attribute read command. The control unit reads a number of valid elements from the address space attribute table according to the first address index. And the control part processes the effective elements according to the attribute indicated by the address space attribute reading command to acquire first data, wherein the first data is the attribute required by the address space attribute reading command. The manner of obtaining the address index in this embodiment may refer to the description in the above embodiments, and is not expanded herein. In this embodiment, the control component does not directly feed back the entry of the address space attribute table or the data recorded in the address space attribute table, but processes the effective element to obtain the first data, thereby reducing the load of the host.
FIG. 6B illustrates a flow chart of a method of updating an address space attribute table.
At step 610, an update address space attribute command is received. In this embodiment, the update address space attribute command instructs the control component to update the address space attribute table.
At step 620, the logical address range(s) indicated by the update address space attribute command are obtained. After receiving the command for updating the address space attribute, the control component analyzes the command to obtain at least one logical address range. It is noted that a logical address range comprises one or more logical addresses.
Step 630, update the entry of the address space attribute table corresponding to the logical address (es). The control unit updates the entries in the address space attribute table corresponding to the at least one logical address range. In this embodiment, the command for updating the address space attribute does not necessarily indicate the update value of the entry, for example, when the address space attribute table is the address space attribute table shown in table 1, since the recorded entry value is 0 or 1, the control unit only needs to adjust the entry to be updated between these two values.
Optionally, in step 640, the entry of the L2P table corresponding to the logical address (es) is cleared or set to a specified value. In this embodiment, after the control component completes maintenance of the address space attribute table, the control component further updates the L2P table, and the updating manner includes clearing the table entry or modifying the table entry to a specified value. The value is designated as a physical address.
By the update address space attribute command, the host is able to indicate to the storage device that the attributes of one or more logical address ranges are invalid.
According to embodiments of the present application, the entries of the L2P table do not necessarily reflect the attributes of the latest logical address space due to the presence of the address space attribute table. For example, referring also to FIG. 6B, after the completion of the execution of step 630, before the completion of the execution of step 640, the address space attribute table has been updated, while the L2P table has not been updated, when part of the data recorded in the L2P table is outdated. Therefore, in order to correctly process the read command, the processing procedure of the read command needs to be adjusted, see also fig. 7A.
Fig. 7A is a flowchart illustrating a method for processing a read command according to an embodiment of the present application. The following description will be made taking as an example the control section executing the flow in fig. 7A.
In step 710, a read command is received. The control component receives a read command sent by the host instructing the control component to access the NVM chip and read data.
At step 712, it is determined whether the read logical address corresponds to a valid element. For example, the control section reads the attribute of "effective element" in the address space attribute table. For example, the control unit accesses the address space attribute table according to the LBA 512 to LBA 520, thereby acquiring whether the LBA 512 to LBA 520 correspond to a valid element. If the determination result is negative, step 714 is performed. If yes, go to step 716. Optionally, in this embodiment, determining whether the logical address is valid is performed by using an address space attribute table. In the embodiment, whether the logical address is valid or not is judged in advance, and the condition that the logical address corresponds to an invalid physical address or does not correspond to a physical address is eliminated, so that the probability of data reading failure or data reading error is reduced, the time length required by data reading is further reduced, and errors caused by inconsistency of the address space attribute table and the L2P table are avoided.
Step 714 responds to the read command with, for example, all 0 s or a specified value. The control unit uses all 0 s as a response to the read command, and in addition to smoothly processing the read command, the control unit can also inform the host that a certain LBA cannot currently read valid data.
By way of example, the read command carries logical addresses LBA 512-LBA 520, where at step 712 it is identified that LBA 512 is not valid, and other LBAs are valid, then step 714 is performed for LBA 512, and for other valid LBAs, step 716 is performed to complete the processing of the read command.
In a step 716, the process is executed, and querying the L2P table to obtain a physical address corresponding to the logical address to be read. If the determination result is yes, the control component queries the L2P table according to each valid LBA in the LBAs 512 to 520, and obtains a physical address corresponding to the valid LBA.
In step 718, data is read from the physical address in response to the read command. The control section accesses the NVM chip according to the obtained physical address, and reading out the data.
The control section feeds back the read data to the host as a response to the read command.
Fig. 7B is a flowchart illustrating a method for processing a write command according to an embodiment of the present application. The following description will be made taking as an example the control section executing the flow in fig. 7B.
At step 720, a write command is received. The control unit receives a write command sent by the host.
At step 722, a physical address is assigned for the write command and the L2P table is updated. The control part acquires the logical address indicated or carried by the write command and allocates a physical address for the logical address. After allocating a physical address to the logical address, the control component needs to maintain the L2P table, so that the control component updates the L2P table according to the correspondence between the logical address and the allocated physical address.
In step 724, data is written into the physical address, and write command processing completion information is fed back. And the control part accesses the NVM chip according to the physical address, writes the data into the physical address and feeds back write command processing completion information to the host.
At step 726, the address space attribute table is updated. In this embodiment, the control component further updates the address space attribute table according to the correspondence between the logical address and the physical address. In response to a write command writing data to, for example, LBA100, the properties of the address space indicated by LBA100 are valid. In response to writing data to LBA100 again, the properties of the address space indicated by LBA100 remain valid.
According to the address space attribute reading command and the optional address space attribute table provided by the embodiment of the application, the processing capacity of the storage device is enhanced. For some applications, the processing power can be significantly enhanced or the complexity of the processing can be reduced. Examples of multiple application read address space attribute commands and optional address space attribute tables are provided in connection with fig. 8 through 12.
Fig. 8 shows a flowchart of a method for backing up data or mirroring a storage device according to an embodiment of the present application. Data backup or mirroring of a storage device not only requires acquiring all (valid) data recorded in the storage device, but also writing corresponding data in a new storage device at the same address according to the location (address) of the valid data in the storage device. According to the embodiment of the application, all addresses (logical addresses) in the storage device, in which valid data are recorded, can be conveniently and quickly acquired through the address space attribute reading command, so that data backup is completed by reading data from the addresses and writing the data into a new storage device according to the same address. The data backup in this way also realizes the mirror image of the storage device. Although the image is created without including data corresponding to the invalid address of the original storage device, the created image is semantically equivalent to the original storage device because the invalid data should not be accessed again.
At step 810, all valid elements of the complete address space of the storage device are obtained using the read address space attribute command.
In step 820, data is read from the memory device according to the logical addresses corresponding to all the valid elements.
Step 830 writes the read data to the same logical address of the backup storage device.
The flow in fig. 8 is described below, taking the control section as an example.
In order to perform data backup, the host sends an address space attribute reading command to the storage device, and sets an accessed address range as a complete address space of the storage device in the address space attribute reading command. After the control component acquires the read address space attribute command, all effective elements of the complete address of the storage device are acquired according to the read address space attribute command indication. Optionally, the control unit traverses the L2P table to obtain all valid elements of the address space of the storage device. Still alternatively, the control section obtains all valid elements of the address space from reading the address space attribute table.
It will be appreciated that the active elements of the address space of the storage device are not consistent with the active space used by the file system managing the address space, but rather the set of active elements of the address space of the storage device is a superset of the active space used by the corresponding file system. The file system may delete a portion of the address space elements, but the file system's "delete" operation of the address space elements may not be known to the storage device. This portion of data that has been deleted by the "host" but not garbage collected also belongs to the "all valid elements of the full address space" in this application. Even then, all valid elements of the address space obtained by the read address space attribute command can still be generally smaller than all elements of the full address space of the storage device, thereby reducing the amount of data that needs to be read from the storage device and moved to a new storage device in the data backup.
According to one embodiment, the control unit obtains third data by using the command of reading the address space attribute, where the third data is part or all of an address space attribute table, and the address space attribute table represents whether each address of the address space corresponds to a valid element or not. The third data acquired by the control section is an address corresponding to the effective element. The control unit further accesses the storage device according to the plurality of logical addresses corresponding to the third data, thereby reading all the data to be backed up. The control part writes all the data to be backed up into the second storage device, thereby completing the backup of the data. In this embodiment, the data written in the backup storage device, that is, the data in the second storage device and the data in the first storage device have the same logical address.
Further optionally, the control component writes the data to be backed up into the second storage device according to the correspondence between the effective element and the logical address, so that the correspondence between the backup data and the logical address in the second storage device is the same as the correspondence between the effective element and the logical address.
The embodiment of the application provides another method for backing up data or making an image on a storage device, which comprises the following steps: the host sends a first read address space attribute command to the control component, the first read address space attribute command for reading a valid element of a full address space of the storage device. In response to the first read address space attribute command, the control component feeds back to the host first data indicating all valid addresses in the full address space of the storage device. The first data is in the form of, for example, all of an address space attribute table, or a compressed address space attribute table, or a bitmap generated from an L2P representation field indicating whether each address of an address space is valid, or a set of valid addresses. The host obtains all valid addresses in the complete address space of the storage device to be backed up according to the address data. And the host reads the data corresponding to the effective address from the storage device according to all effective addresses in the complete address space of the storage device to be backed up, and writes the data into the new storage device according to the effective address and the corresponding data, so that the new storage device becomes a backup or mirror image of the original storage device.
According to the embodiment of the application, the read address space attribute command is also used for identifying the fragmentation of the storage device, and whether the storage device needs to be subjected to disk reorganization or not can be judged according to the fragmentation distribution of the storage device. The fragmentation of the storage device is identified by using a read address space attribute command indicating a degree of randomness to be obtained for the first address space, see also fig. 9.
When the first address space attribute reading command indicates that the randomness of the first address space is obtained, responding to the first address space attribute reading command, and obtaining a second address space of which the randomness is larger than a preset threshold value in the first address space; obtaining an active element within the second address space; the second address space is marked according to the valid elements within the second address space.
Fig. 9 shows a flowchart of a defragmentation method according to an embodiment of the present application.
Step 910, obtaining the randomness of the designated address space by using the read address space attribute command.
In step 920, an address space range with a randomness greater than a threshold is obtained.
At step 930, the read address space attribute command obtains a valid element of the address space range.
At step 940, fragments of the address space range are identified according to the valid elements.
According to embodiments of the present application, a host identifies a shard on a storage device by issuing, for example, two read address space attribute commands to the storage device. The first address space attribute reading command acquires the randomness attribute of the address space, the address space with the randomness higher than the threshold value is regarded as fragments exist, and the second address space attribute reading command acquires the effective elements of the address space so as to distinguish the effective data and the ineffective data in the fragments and facilitate defragmentation. For example, in response to a read address space attribute command that indicates an acquisition randomness, the control section acquires a randomness of a specified logical address range according to the read address space attribute command.
Optionally, the host-provided read address space attribute command also indicates a threshold or indicates the use of a preset threshold. = for example, the threshold value is 0.5, and the control unit acquires logical addresses corresponding to a number of degrees of randomness greater than 0.5 (N logical addresses in total) within the specified logical address range. The control unit retrieves the valid elements of the N logical addresses and provides them to the host, the host marks the shards in the storage device based on these valid elements. For example, the logical address range is LBA 77-LBA 88, the randomness of this segment of logical address space is greater than 0.5, the control component acquires that the effective element corresponding to LBA 77-LBA 88 is "010101001101", the control component marks the corresponding effective logical address with "1" in "010101001101", and finally the marked fragments are LBA 78, LBA 80, LBA 82, LBA 85, LBA86, and LBA88. Optionally, the control unit also feeds back addresses corresponding to the marked fragments to the host. For example, the control component feeds back LBA 78, LBA 80, LBA 82, LBA 85, LBA86, and LBA88 to the host. Optionally, the control unit feeds back the tagged address to the host to enable further operation by status of fragmented data in the host or the storage device.
Utilizing a read address space attribute command also helps to assist the storage device in backing up the address space attribute table in the participation of the host. Like the L2P table, the address space attribute table is also important metadata for the storage device. Before the storage device is closed, the address space attribute table needs to be backed up so that the storage device can work normally after being powered on next time.
Fig. 10 illustrates a method for storing an address space attribute table when power is turned off according to an embodiment of the present application.
As shown in FIG. 10, the host sends a read address space attribute command, step 1010, to obtain all valid elements of the full address space using the read address space attribute command. In this embodiment, the control unit obtains all entries of the address space attribute table according to the address space attribute reading command, so as to obtain all effective elements of the complete address space.
Step 1020, store the valid elements of the acquired complete address space. The control unit feeds back all entries of the address space attribute table to the host where they are stored. Thereby preventing the address space attribute table from being lost when the control unit is powered down and eliminating the need to regenerate the address space attributes from the L2P table when the control unit is powered up. It should be noted that in this embodiment, the host does not necessarily need to store the address space attribute table inside the host, and alternatively, the host stores the address space attribute table in another storage device.
FIG. 11 illustrates a flowchart of a method for identifying whether a read command belongs to a sequential stream according to an embodiment of the present application.
Step 1110, obtain a read command. The control unit obtains the read command sent by the host and analyzes the read command.
Step 1120, determine whether the read command belongs to a sequential stream read command. In step 1120, it may be determined whether the read command belongs to the sequential stream, for example, in a manner known in the art. The control section determines whether the read command belongs to a sequential stream read command, and if not, proceeds to step 1130 to identify the read command as belonging to a non-sequential stream. If yes, go to step 1140 to obtain the randomness of the address space accessed by the read command. The randomness of the address space accessed by the read command is obtained using, for example, an address space attribute table. And further proceeds to step 1150, where it is determined whether the randomness is greater than a threshold. If the result of this determination is yes, step 1130 is executed. If the determination result is negative, step 1160 is executed to identify the read command as belonging to the sequential stream.
According to the embodiment, whether the read command belongs to the sequential stream read command is judged again according to the randomness, so that the judgment accuracy is improved, and the sequential stream is accurately identified. Since the time required for subsequent processing of sequential stream read commands and non-sequential stream read commands is different, the accurate classification of read commands can effectively reduce the overall time required to process a large number of read commands.
Fig. 12 is a flowchart illustrating a method for processing a read command by using a cache according to an embodiment of the present application.
According to the address space attribute table provided by the application, whether to allocate the cache for the read command or not is also facilitated to be effectively identified. In storage devices, caching is a scarce resource. It is desirable to allocate the cache to a small number of read commands that access data that is accessed again with a high probability in the next short time. The random degree change condition of the address space provides an auxiliary basis for the cache allocation. The degree of randomness of the address space means the degree to which the address space is updated. Data that is frequently updated is not preferably buffered in read commands because the buffered data may soon be invalidated. Data that is frequently updated is preferably buffered in write commands because multiple updates can be merged and written to the NVM storage medium, thereby reducing write operations to the NVM.
At step 1210, a read command is obtained. The control component acquires a read command sent by the host, analyzes the read command and acquires an address indicated by the read command.
In step 1220, it is determined whether the address hits in the cache. The control component judges whether the address indicated by the read command hits the cache, and if the address hits the cache, the data to be read by the read command is already in the cache, and the cache is the cache in the control component. If there is no cache hit, this indicates that the read command requires reading data from the NVM chip.
Step 1231, obtain the randomness change of the address space accessed by the read command. In this embodiment, the control section further acquires the attribute of the randomness variation of the address indicated by the read command.
Step 1232, read data from NVM in response to the read command. It should be noted that the execution order of step 1231 and step 1232 is not sequential. After step 1232 is performed, the host side processing of the read command is completed and the control unit continues to perform the remaining steps.
Step 1240, retrieve the data from the cache in response to the read command. If the cache is hit, the control unit will read the data from the cache and respond to the read command.
In step 1250, it is determined whether the randomness change is greater than a threshold. The control section further judges whether or not a change in randomness of an address space accessed by the read command is larger than a preset threshold value. If the value is not greater than the predetermined threshold, it indicates that the address space accessed by the read command is not updated frequently, so that caching the data of the current read command helps to hit the cache when the subsequent read command will also access the address space, and step 1260 is performed to keep the cache used by the read command. Therefore, when the address space is accessed next time, the control part does not need to allocate the cache again, and the time is saved. If the value in step 1250 is greater than the predetermined threshold, step 1270 is executed to release the cache used by the read command. When the change of the degree of randomness is greater than the preset threshold, it means that the address space is frequently updated, which results in invalidation of (old) data in the cache and also results in failure of the cached data to respond to subsequent read commands, so that the control unit does not need to reserve the cache for the address space, and can release the cache for other tasks, thereby improving the utilization rate of cache resources.
It is noted that for the sake of brevity, this application describes some methods and embodiments thereof as a series of acts and combinations thereof, but those skilled in the art will appreciate that the aspects of the application are not limited by the order of the acts described. Accordingly, one of ordinary skill in the art will appreciate, in light of the disclosure or teachings herein, that certain steps may be performed in other sequences or concurrently. Further, those skilled in the art will appreciate that the embodiments described herein are capable of alternative embodiments, i.e., acts or modules referred to herein are not necessarily required for the implementation of the solution or solutions described herein. In addition, the description of some embodiments of the present application is also focused on different schemes. In view of the above, those skilled in the art will understand that portions that are not described in detail in one embodiment of the present application may also be referred to in the related description of other embodiments.
In particular implementation, based on the disclosure and teachings of the present application, one of ordinary skill in the art will appreciate that the several embodiments disclosed in the present application may be implemented in other ways not disclosed herein. For example, as for the units in the foregoing embodiments of the electronic device or apparatus, the units are split based on the logic function, and there may be another splitting manner in the actual implementation. Also for example, multiple units or components may be combined or integrated with another system or some features or functions in a unit or component may be selectively disabled. The connections discussed above in connection with the figures may be direct or indirect couplings between the units or components in terms of the connection relationships between the different units or components. In some scenarios, the foregoing direct or indirect coupling involves a communication connection utilizing an interface, where the communication interface may support electrical, optical, acoustic, magnetic, or other forms of signal transmission.
Although the examples referred to in the present application have been described for illustrative purposes only and not as limitations of the present application, changes, additions and/or deletions to the embodiments may be made without departing from the scope of the present application.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for obtaining address space attribute is applied to a host, and is characterized by comprising the following steps:
sending a read address space attribute command to a control component, wherein the read address space attribute command is used for reading at least one attribute of an address or a segment of address space;
receiving first data fed back by the control unit, wherein the first data corresponds to at least one attribute indicated by the read address space attribute command.
2. The method of claim 1, wherein the first data is part or all of an address space attribute table; or, the first data is at least one attribute required by the read address space attribute command.
3. A method for obtaining address space attributes, applied to a control unit, is characterized by comprising the following steps:
receiving a read address space attribute command sent by a host, wherein the read address space attribute command is used for reading at least one attribute of an address or a section of address space;
accessing an address space attribute table according to the address space attribute reading command to acquire first data, wherein the first data correspond to at least one attribute indicated by the address space attribute reading command, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not;
feeding back the first data to the host.
4. The method of claim 3, wherein the method further comprises:
responding to the address space attribute reading command, and acquiring a first address index according to an address carried by the address space attribute reading command;
and acquiring the first data from the address space attribute table according to the first address index, wherein the first data is part or all of the address space attribute table.
5. A data backup method of a storage device is characterized by comprising the following steps:
acquiring third data by using an address space attribute reading command, wherein the third data is part or all of an address space attribute table, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not;
accessing a first storage device according to a first plurality of logical addresses corresponding to effective elements in the third data to read a first plurality of data to be backed up from the first storage device, wherein the first plurality of data to be backed up correspond to the first plurality of logical addresses;
writing the first plurality of data to be backed up into a second storage device to obtain backup data;
wherein the third data comprises at least one valid element, each valid element corresponding to a logical address, and the obtaining of the third data by the read address space attribute command is performed by the method according to any one of claims 1 to 5.
6. The method of claim 5, the writing the data to be backed up into the second storage device includes:
and writing the data to be backed up into the second storage device according to the corresponding relation between the effective elements and the logical addresses, so that the corresponding relation between the backup data and the logical addresses in the second storage device is the same as the corresponding relation between the effective elements and the logical addresses.
7. A method of accessing a storage device, the storage device including an address space attribute table, the method comprising:
the host sends a first access command to the control component, wherein the first access command comprises a read command and a write command;
the control component processes the first access command according to the address space attribute table; or, the control unit adjusts the address space attribute table according to the first access command.
8. The method of claim 7, wherein when the first access command is a first read command, the method comprises:
the host computer supplies power to the control part sending the first read command;
in response to the first read command, the control component judges whether the first read command belongs to a sequential stream read command according to a third address space indicated by the read command;
if yes, the control part acquires the randomness of the third address space;
and the control part judges whether the first read command belongs to a sequential stream read command again according to the randomness of the third address space.
9. The method of claim 7, wherein when the first access command is a second read command, the method comprises:
the host sends a second read command to the control component;
in response to the second read command, the control unit determines whether a third address space indicated by the read command commands a first cache;
when the first read data is read from the first cache, the control component acquires the first read data from the first cache;
the control section feeds back the first read data to the host.
10. A storage system includes a host, a control unit, and a storage medium; the control part maintains an L2P table and an address space attribute table, and the address space attribute table represents whether each address of an address space corresponds to an effective element or not;
the storage system performs the method of any of claims 1-9.
CN202110341520.9A 2021-03-30 2021-03-30 Method for obtaining address space attribute, data backup method and storage device Pending CN115145468A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110341520.9A CN115145468A (en) 2021-03-30 2021-03-30 Method for obtaining address space attribute, data backup method and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110341520.9A CN115145468A (en) 2021-03-30 2021-03-30 Method for obtaining address space attribute, data backup method and storage device

Publications (1)

Publication Number Publication Date
CN115145468A true CN115145468A (en) 2022-10-04

Family

ID=83404219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110341520.9A Pending CN115145468A (en) 2021-03-30 2021-03-30 Method for obtaining address space attribute, data backup method and storage device

Country Status (1)

Country Link
CN (1) CN115145468A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795297A (en) * 2023-08-18 2023-09-22 苏州云途半导体有限公司 Storage device, storage method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795297A (en) * 2023-08-18 2023-09-22 苏州云途半导体有限公司 Storage device, storage method and device
CN116795297B (en) * 2023-08-18 2023-11-17 江苏云途半导体有限公司 Storage device, storage method and device

Similar Documents

Publication Publication Date Title
CN111475427B (en) Logical-to-physical mapping management using low latency nonvolatile memory
US10635310B2 (en) Storage device that compresses data received from a host before writing therein
US11048624B2 (en) Methods for multi-stream garbage collection
US10789162B2 (en) Memory system and method for controlling nonvolatile memory
US10628060B2 (en) Smart storage management based on dynamic logic capacity for the storage
US10402091B1 (en) Managing data in log-structured storage systems
US8166233B2 (en) Garbage collection for solid state disks
EP3168737A2 (en) Distributed multimode storage management
US10013344B2 (en) Enhanced SSD caching
US20130073798A1 (en) Flash memory device and data management method
CN110678836A (en) Persistent memory for key value storage
US9727245B2 (en) Method and apparatus for de-duplication for solid state disks (SSDs)
CN109086219B (en) De-allocation command processing method and storage device thereof
US20200183831A1 (en) Storage system and system garbage collection method
US11747979B2 (en) Electronic device, computer system, and control method
US20190303019A1 (en) Memory device and computer system for improving read performance and reliability
US10459803B2 (en) Method for management tables recovery
US11200178B2 (en) Apparatus and method for transmitting map data in memory system
WO2012021847A2 (en) Apparatus, system and method for caching data
CN115145468A (en) Method for obtaining address space attribute, data backup method and storage device
US11947419B2 (en) Storage device with data deduplication, operation method of storage device, and operation method of storage server
CN111858623A (en) Optimizing database performance using heterogeneous namespaces
CN117369718A (en) System, method and apparatus for forming and selecting recovery units in storage devices
CN117093505A (en) Command processing method, log processing method and storage device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination