Storage medium replacement of NVM group
Through logical unit replacement and data migration methods, the problem of uneven wear between NVM groups in storage devices is solved, extending device life and improving service quality.
Patent Information
- Application Number
- CN201810730565.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-07-05
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2038-07-05
AI Technical Summary
In storage devices, the problem of uneven wear between NVM groups leads to shortened storage device life, and it is difficult to effectively achieve wear leveling with existing technology.
Through logical unit replacement and data migration methods, select the source logical unit and destination logical unit to be replaced, copy the data and update the metadata, map the access of the source logical unit to the destination logical unit, and set the source logical unit to an idle state. , to achieve wear balancing between NVM groups.
It extends the life of storage devices, effectively achieves wear balancing between NVM groups through replacement of logical units and data migration methods, and improves the service quality of storage devices.
Smart Images

Figure CN110688056B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a storage device, and more particularly to replacement or data migration of a storage medium constituting an NVM set (NVMSet) of the storage device. Background Art
[0002] Figure 1 The block diagram of the storage device is shown. The solid-state storage device 100 is coupled with the host to provide storage capacity for the host. The host and the solid-state storage device 100 can be coupled in a variety of ways, including but not limited to connecting the host and the solid-state storage device 100 through, 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), NVMe (NVM Express), Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 100 includes an interface 110 , a control component 120 , one or more NVM chips 130 , and a DRAM (Dynamic Random Access Memory) 140 .
[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), etc. are common NVMs.
[0004] The interface 110 may be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.
[0005] The control component 120 is used to control data transmission between the interface 110, the NVM chip 130 and the DRAM 140, and is also used for storage management, host logical address to flash physical address mapping, erase leveling, bad block management, etc. The control component 120 can be implemented in a variety of ways such as software, hardware, firmware or a combination thereof. For example, the control component 120 can be in the form of FPGA (Field-programmable gate array), ASIC (Application Specific Integrated Circuit) or a combination thereof. The control component 120 can also include a processor or a controller, in which software is executed to manipulate the hardware of the control component 120 to process IO (Input / Output) commands. The control component 120 can also be coupled to the DRAM 140 and can access the data of the DRAM 140. The FTL table and / or the data of the cached IO commands can be stored in the DRAM.
[0006] The control unit 120 includes a flash memory interface controller (or medium interface controller, flash memory channel controller), which is coupled to the NVM chip 130 and issues commands to the NVM chip 130 in a manner that complies with the interface protocol of the NVM chip 130 to operate the NVM chip 130, and receives command execution results output from the NVM chip 130. Known NVM chip interface protocols include "Toggle", "ONFI", and the like.
[0007] A memory target is one or more logic units (LUNs) within a NAND flash memory package that share a chip enable (CE) signal. A NAND flash memory package includes one or more dies. Typically, a logic unit corresponds to a single die. A logic unit may include multiple planes. Multiple planes within a logic unit can be accessed in parallel, and multiple logic units within a NAND flash memory chip can execute commands and report status independently of each other. In the "Open NAND Flash Interface Specification (Revision 3.0)" available from http: / / www.micron.com / ~ / media / Documents / Products / Other%20Documents / ON FI3_0Gold.ashx, the meanings of target, logic unit (LUN), and plane are provided, which is part of the prior art.
[0008] Data is usually stored and read on a storage medium in pages. Data is erased in blocks. A block (also called a physical block) contains multiple pages. A page on a storage medium (called a physical page) has a fixed size, such as 17664 bytes. A physical page can also have other sizes.
[0009] In a solid-state storage device, a Flash Translation Layer (FTL) is used to maintain mapping information from logical addresses to physical addresses. The logical address constitutes the storage space of the solid-state storage device perceived by upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the solid-state storage device. In the prior art, address mapping can also be implemented using an intermediate address form. For example, a logical address is mapped to an intermediate address, and then the intermediate address is further mapped to a physical address.
[0010] The table structure storing the mapping information from logical address to physical address is called FTL table. FTL table is an important metadata in solid-state storage device. Usually, the data items of FTL table record the address mapping relationship in the solid-state storage device in units of data page.
[0011] Figure 2 A schematic diagram of a large block is shown. A large block includes physical blocks from each of a plurality of logical units (referred to as logical unit groups). Preferably, each logical unit provides a physical block for a large block. As an example, a large block is constructed on every 16 logical units (LUNs). Each large block includes 16 physical blocks from each of the 16 logical units (LUNs). Figure 2 In the example, chunk 0 includes physical chunk 0 from each of the 16 logical units (LUNs), and chunk 1 includes physical chunk 1 from each logical unit (LUN). There are many other ways to construct chunks. For example, Chinese patent application 2017107523210 (named "Garbage Collection Method and Apparatus Based on Variable-Sized Chunks") provides a method for constructing variable-sized chunks.
[0012] As an optional way, page stripes are constructed in large blocks, and physical pages with the same physical address in each logical unit (LUN) constitute a "page stripe". Figure 2 In , physical pages P0-0, P0-1, ... and P0-x constitute page stripe 0, where physical pages P0-0, P0-1, ... and P0-14 are used to store user data, and physical page P0-15 is used to store check data calculated based on all user data in the stripe. Similarly, Figure 2 In FIG. 2 , physical page P2-0, physical page P2-1, ... and physical page P2-x constitute page stripe 2. Optionally, the physical page for storing the check data may be located at any position in the page stripe.
[0013] The storage device also performs a wear leveling operation so that each physical block of the storage device experiences substantially the same number of erasures during use, thereby reducing the adverse effect of the life exhaustion of individual physical blocks on the life of the storage device.
[0014] To improve the quality of service of storage devices, the NVM Set (NVMSet) mechanism is being explored in storage devices (see https: / / www.snia.org / sites / default / files / SDCEMEA / 2018 / Presentations / Achieving-Predictable-Latency-Solid-State-Storage-SSD-SNIA-SDC-EMEA- 2018.pdf). NVM A group is a collection of non-volatile storage media. Non-volatile storage media in different NVM groups are independent of each other. For example, non-volatile storage media belonging to one NVM group no longer belongs to another NVM group. By distinguishing NVM groups in a storage device, the impact of IO commands accessing some non-volatile storage media on the processing performance of IO commands accessing other non-volatile storage media is reduced or eliminated. Endurance groups are also being discussed. An endurance group may include one or more NVM groups. One or more endurance groups exist in a storage device.
[0015] The NVMe protocol also defines a namespace (NS). A namespace of size n is a set of logical blocks with logical block addresses from 0 to n-1. A namespace can be uniquely identified by a namespace ID (NSID). The non-volatile storage media used by the same namespace comes from the same NVM group, not from multiple NVM groups. Two or more namespaces can use non-volatile storage media from the same NVM group. Summary of the invention
[0016] Once NVM groups are provided, wear unevenness will occur between NVM groups in the storage device as the NVM groups are used. Therefore, it is necessary to provide wear leveling capability between NVM groups to extend the life of the storage device. Wear leveling between NVM groups is achieved by replacing storage media such as logical units.
[0017] According to a first aspect of the present application, a storage medium replacement method for a first NVM group according to the first aspect of the present application is provided, comprising: selecting a source logical unit and a destination logical unit to be replaced; copying data of the source logical unit to the destination logical unit; and updating metadata so that access to the source logical unit is mapped to the destination logical unit.
[0018] According to the storage medium replacement method of the first NVM group of the first aspect of the present application, a second storage medium replacement method of the NVM group of the first aspect of the present application is provided, further comprising: erasing a physical block of a source logical unit.
[0019] According to the storage medium replacement method of the first or second NVM group of the first aspect of the present application, a third storage medium replacement method of the NVM group according to the first aspect of the present application is provided, which also includes: setting the destination logical unit to an occupied state and setting the source logical unit to an idle state.
[0020] According to one of the storage medium replacement methods of the first to third NVM groups of the first aspect of the present application, a fourth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein: part of the data of the source logical unit is copied to the destination logical unit; the method also includes: copying another part of the data of the source logical unit to the first logical unit.
[0021] According to one of the storage medium replacement methods of the first to fourth NVM groups of the first aspect of the present application, a fifth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein the virtual logical unit mapped to the source logical unit is modified to be mapped to the destination logical unit by updating metadata.
[0022] According to one of the storage medium replacement methods of the first to fourth NVM groups of the first aspect of the present application, a sixth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein the logical address for accessing the copied data is modified to a logical address mapped to the destination logical unit by updating metadata.
[0023] According to one of the storage medium replacement methods of the first to sixth NVM groups of the first aspect of the present application, a seventh storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein the physical address of the copied data on the destination logical unit is the same as the physical address on the source logical unit.
[0024] According to one of the storage medium replacement methods of the first to seventh NVM groups of the first aspect of the present application, an eighth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, which also includes: obtaining a first large block on the source logical unit; selecting a first logical unit from a plurality of logical units including the destination logical unit; selecting a first physical block from the first logical unit to replace the physical block provided by the source logical unit for the first large block; and copying data of the physical block provided by the source logical unit for the first large block to the first physical block.
[0025] According to the storage medium replacement method of the eighth NVM group of the first aspect of the present application, a ninth storage medium replacement method of the NVM group of the first aspect of the present application is provided, wherein a first logical unit is selected from the multiple logical units according to a specified probability, and the multiple logical units each have a probability of being selected.
[0026] According to the storage medium replacement method of the ninth NVM group of the first aspect of the present application, there is provided a tenth storage medium replacement method of the NVM group according to the first aspect of the present application, wherein the probability of the first logical unit being selected is greater than the probability of other logical units of the multiple logical units other than the first logical unit being selected.
[0027] According to the eighth or twenty-ninth NVM group storage medium replacement method of the first aspect of the present application, there is provided an eleventh NVM group storage medium replacement method according to the first aspect of the present application, further comprising setting the probability of each logical unit being selected.
[0028] According to the storage medium replacement method of the eleventh NVM group of the first aspect of the present application, a twelfth storage medium replacement method of the NVM group of the first aspect of the present application is provided, wherein in the first stage of the life cycle of the storage device, substantially the same probability of being selected is set for each logical unit; and in the second stage of the life cycle of the storage device, a different probability of being selected is set for each logical unit.
[0029] According to the storage medium replacement method of the eleventh or twelfth NVM group of the first aspect of the present application, a thirteenth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein the probability of being selected set for one or more logical units is positively or negatively correlated with the number of erasures experienced by the logical unit.
[0030] According to one of the storage medium replacement methods of the eleventh to thirteenth NVM groups of the first aspect of the present application, a fourteenth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein the probability of the source logical unit being selected is increased in response to the expected replacement of the source logical unit.
[0031] According to one of the storage medium replacement methods of the eighth to fourteenth NVM groups of the first aspect of the present application, a fifteenth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, which also includes: in response to creating a second large block, selecting a second plurality of logical units, and obtaining physical blocks for constructing the second large block from the second plurality of logical units.
[0032] According to the storage medium replacement method of the fifteenth NVM group of the first aspect of the present application, a sixteenth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, further comprising: selecting logical units according to a specified probability to obtain the second plurality of logical units.
[0033] According to the storage medium replacement method of the fifteenth or sixteenth NVM group of the first aspect of the present application, a seventeenth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein each logical unit of the second plurality of logical units belongs to the same durability group or NVM group.
[0034] According to one of the storage medium replacement methods of the first to seventeenth NVM groups of the first aspect of the present application, an eighteenth storage medium replacement method of the NVM group of the first aspect of the present application is provided, wherein the source logical unit and the destination logical unit belong to the same durability group.
[0035] According to one of the storage medium replacement methods of the eighth to seventeenth NVM groups of the first aspect of the present application, a nineteenth storage medium replacement method of the NVM group according to the first aspect of the present application is provided, wherein each of the multiple logical units belongs to the same durability group.
[0036] According to a second aspect of the present application, a first storage device according to the second aspect of the present application is provided, comprising a control component and an NVM chip, wherein the control component executes one of the storage medium replacement methods of the NVM group according to the first aspect of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For those skilled in the art, other drawings can also be obtained based on these drawings.
[0038] Figure 1 is a block diagram of a storage device;
[0039] Figure 2 It is a schematic diagram of a large block;
[0040] Figure 3A is a schematic diagram of replacing a non-volatile storage medium with an NVM group according to an embodiment of the present application;
[0041] Figure 3B A flowchart of data migration according to an embodiment of the present application is shown;
[0042] Figure 4A is a schematic diagram of replacing a non-volatile storage medium with an NVM group according to another embodiment of the present application;
[0043] Figure 4B According to this application Figure 4A A schematic diagram of the result of replacing a non-volatile storage medium with an NVM group of an embodiment;
[0044] Figure 5 Demonstrated according to this application Figure 4A and Figure 4B A flowchart of data migration of an embodiment of the present invention;
[0045] Fig. 6Ais a schematic diagram of migrating a non-volatile storage medium according to another embodiment of the present application; and
[0046] Figure 6B Demonstrated according to this application Fig. 6A A schematic diagram of the results of migrating a non-volatile storage medium of an embodiment. DETAILED DESCRIPTION
[0047] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0048] Figure 3A is a schematic diagram of replacing a non-volatile storage medium with an NVM group according to an embodiment of the present application.
[0049] according to Figure 3A In an embodiment of the present invention, the storage device includes multiple logical units (LUN 0 to LUN 9). The storage device provides multiple NVM groups (NVM group 310, NVM group 312, and NVM group 314). Optionally, NVM group 310 and NVM group 312 belong to durability group 320, and NVM group 322 belongs to durability group 322. It can be understood that according to other embodiments of the present application, the storage device may not provide a durability group.
[0050] According to an embodiment of the present application, non-volatile storage media are allocated to NVM groups in units of LUNs. NVM group 310 is allocated LUN 0 and LUN 1, NVM group 312 is allocated LUN 2 and LUN 3, and NVM group 314 is allocated LUN 6 to LUN 7. Since NVM group 310 and NVM group 312 belong to the same durability group 320, the logical units of NVM group 310 and NVM group 312 can be exchanged, thereby achieving wear leveling within the durability group 320. For example, LUN 1 and LUN 2 are exchanged, so that LUN 1 is allocated to NVM group 312 and LUN 2 is allocated to NVM group 310, and data migration is performed between LUN 1 and LUN 2 as LUN 1 and LUN 2 are exchanged.
[0051] Optionally, the storage device further includes idle logical units (LUN 4 and LUN 5). An idle logical unit is a logical unit that has not been assigned to any NVM group. For example, when LUN 2 is excessively worn due to frequent writing, LUN 4 is assigned to NVM group 312 to replace LUN 2, and LUN 2 is removed from NVM group 312, thereby achieving wear leveling. Along with the exchange of LUN 4 and LUN 2, data migration is performed between LUN 4 and LUN 2.
[0052] Alternatively or further, if a free logical unit (e.g., LUN 4) is allocated to the durability group 320, LUN 4 is no longer allocated to other durability groups (durability group 322) except the durability group 320. Once each LUN is used in a durability group, it is only used in the durability group or as a free logical unit during the life cycle of the storage device.
[0053] In addition to allocating nonvolatile storage media to NVM groups in units of logical units, in other implementations, nonvolatile storage media are allocated to NVM groups in units of NVM chips, dies, or targets.
[0054] According to an embodiment of the present application, the logical unit of the storage device may be in a plurality of states, such as an occupied state, an idle state, and a migrating state. A logical unit in an idle state is not assigned to any NVM group. A logical unit that is assigned to an NVM group and is not involved in data migration is in an occupied state. A logical unit that is undergoing data migration is in a migrating state.
[0055] Figure 3B A flow chart of data migration according to an embodiment of the present application is shown.
[0056] The storage device initiates data migration according to the usage of the logical units of each NVM group or in response to a data migration command sent by the host to the storage device.
[0057] For example, NVM group 312 bears more large write operations, so that the number of erasures of LUN 2 and LUN 3 is significantly higher (for example, compared with other logical units of the storage device), and data migration is initiated.
[0058] To migrate data, see Figure 3B, select a source logical unit (LUN(s)) and a destination logical unit (LUN(d)) to be migrated (340), wherein the source logical unit is an occupied logical unit in the NVM group to be migrated, and the destination logical unit is an idle logical unit. And the selected source logical unit and the destination logical unit are both marked as being in a migrating state. As an example, also referring to FIG. 3 , LUN3 of NVM group 312 is selected as the source logical unit, and LUN 4 is selected as the destination logical unit.
[0059] The data of the source logical unit (LUN 3) is copied to the destination logical unit (LUN 4) (350). Optionally, the data of the source logical unit (LUN 3) is copied to other logical units (e.g., LUN 2) belonging to the NVM group 312 except the destination logical unit (LUN 4), and the purpose of the present application can also be achieved. Optionally, only valid data in the source logical unit is migrated, thereby improving the efficiency of data migration and reducing the amount of data written during the data migration process.
[0060] The metadata of the storage device is also updated to record the new storage location of the data after migration (360). For example, for each piece of migrated data, its physical address in the destination logical unit or other logical units is recorded in the FTL table of the storage device. Thus, when the host accesses the data with the logical address, the FTL table is queried to find out that the accessed logical address is provided by the destination logical unit (LUN 4) or other logical unit (LUN 2) with the corresponding physical address.
[0061] In an optional implementation, there is no FTL table in the storage device, and the host accesses the storage device with a physical address. The storage device provides a virtual logical unit (vLUN) and provides a mapping of the virtual logical unit to the logical unit. In response to migrating the data of the source logical unit to the destination logical unit in data migration, the metadata is updated to modify the virtual logical unit originally mapped to the source logical unit to be mapped to the destination logical unit. And during the data migration process, the data is only copied to the destination logical unit but not to other logical units, and the physical address of the migrated data in the logical unit is not changed. For example, the data at the physical address P1 of the source logical unit (LUN 3) is copied to the physical address P1 of the destination logical unit (LUN 4). Optionally or further, if the physical address P1 of LUN 4 is a bad block, the storage device reports to the host that a bad block or data error occurs at the physical address P1 of the virtual logical unit corresponding to LUN 3, and the host initiates a data error processing process, such as moving all data or all valid data of the block where the physical address P1 is located to a new physical address.
[0062] In response to the completion of data migration for all data or all valid data of the source logical unit (LUN 3), LUN 3 is marked as idle. Optionally, all physical blocks of LUN 3 are also erased. And the destination logical unit (LUN 4) is marked as occupied.
[0063] During the data migration of the source logical unit, for the part of the data of the source logical unit that has been migrated, the part of the data is present on both the source logical unit and the destination logical unit (or other logical units, the other logical units are logical units that belong to the same NVM group as the source logical unit and are different from the source logical unit). The read command for this part of the data can be responded to by both the source logical unit and the destination logical unit. For the part of the data of the source logical unit that has not been migrated, the read command for this part of the data is responded to by the source logical unit. For example, the FTL table is queried according to the logical address accessed by the read command to obtain the corresponding physical address, and the obtained physical address is accessed to obtain the data to be read by the read command. For a write command, a physical address is allocated from the destination logical unit (or other logical unit), and the data to be written by the write command is written to the allocated physical address.
[0064] Figure 4A is a schematic diagram of replacing a non-volatile storage medium with an NVM group according to yet another embodiment of the present application.
[0065] according to Figure 4A In an embodiment, the storage device includes multiple logical units (LUN 0 to LUN 9). The storage device provides multiple NVM groups (NVM group 410, NVM group 412 and NVM group 414). Optionally, NVM group 410 and NVM group 412 belong to durability group 420, and NVM group 422 belongs to durability group 422. It can be understood that according to other embodiments of the present application, the storage device may not provide a durability group. NVM group 410 is assigned LUN 0 and LUN 1, NVM group 412 is assigned LUN 2 and LUN 3, and NVM group 414 is assigned LUN 6 to LUN 7. The storage device also includes idle logical units (LUN 4 and LUN 5).
[0066] According to an embodiment of the present application, large blocks are provided by respective logical units of the NVM group. Logical units that provide physical blocks for the same large block are from the same endurance group. Figure 4AEach of the large blocks 430, 432, and 438 includes physical blocks provided by LUN 0 to LUN 3. A write command accessing the namespace provided by the NVM group 410 allocates, for example, large block 430 to it, and writes data to the physical blocks provided by LUN 0 and / or LUN 1 for large block 430, but does not allocate the physical blocks provided by LUN 2 or LUN 3 for large block 430. Each of the large blocks 450, 452, and 458 includes physical blocks provided by LUN 6 to LUN 9.
[0067] according to Figure 4A The illustrated embodiment structures the chunks from logical units belonging to the same endurance group, so that each logical unit providing physical blocks for the chunk is from the same endurance group, and may be from the same or different NVM groups.
[0068] In an alternative embodiment, the large block is constructed from logical units belonging to the same NVM group, so that each logical unit providing physical blocks for the large block is from the same NVM group.
[0069] Continue to view Figure 4A , each physical block belonging to the same large block has the same physical block address in its own logical unit. Optionally, the large block is constructed according to the technical solution provided by Chinese patent application 201610814552.5 (data organization method and device for multi-plane flash memory), especially the patent application is combined with Figure 4A , Figure 4B , Figure 5 , Fig. 6A or Figure 6B A large block construction method is provided for the relevant description.
[0070] Continue to view Figure 4A , data migration is performed on LUN 3 belonging to NVM group 412 and idle LUN 4.
[0071] Figure 4B According to this application Figure 4A A schematic diagram of the results of replacing a non-volatile storage medium with an NVM set of an embodiment.
[0072] After data migration is performed on LUN 3 and LUN 4, LUN 3 is called a free LUN in the storage device, and LUN 4 becomes a logical unit belonging to NVM group 412. Each of chunk 430, chunk 432, and chunk 438 includes physical blocks provided by LUN 0-LUN 2 and LUN 4.
[0073] In one embodiment, the storage device maintains a chunk table that records the logical units that construct the chunks. For example, in response to data migration between LUN 3 and LUN 4, each logical unit number that constructs chunks 430, 432, and 438 is updated in the chunk table.
[0074] In another embodiment, a large block is constructed based on a virtual logical unit. Thus, although the data of LUN 3 is migrated to LUN 4, LUN 4 is still referenced by the same virtual logical unit, so when a large block is constructed or accessed based on the virtual logical unit, data migration between LUN 3 and LUN 4 is not perceived.
[0075] The data recorded in each physical block of the large block may be user data or verification data. During the data migration process, if the physical block of the large block provided by the source logical unit stores user data, the physical address of the user data is updated in the FTL table after the data migration. If the physical block of the large block provided by the source logical unit stores verification data, there is no need to update the FTL table accordingly.
[0076] according to Figure 4A and Figure 4B In the illustrated embodiment, although the logical units providing physical blocks for large block 430, large block 432, and large block 438 belong to two NVM groups, these logical units belong to the same durability group 420. The garbage collection operation of the storage device occurs within the durability group. For example, valid data recovered from large block 438 is written to the large block constructed by the logical units of the durability group 420. Further, for valid data from NVM group 410 in large block 438, the physical blocks provided by the logical units belonging to NVM group 410 of the constructed large block are still written. And for valid data from NVM group 412 in large block 438, the physical blocks provided by the logical units belonging to NVM group 412 of the constructed large block are still written. Thereby, it is ensured that the user data belonging to NVM group 410 will not be written to the physical blocks belonging to NVM group 412, nor will it be written to the physical blocks belonging to NVM group 414.
[0077] Figure 5 Demonstrated according to this application Figure 4A and Figure 4B A flowchart of data migration of an embodiment.
[0078] The storage device initiates data migration according to the usage of the logical units of each NVM group or in response to a data migration command sent by the host to the storage device.
[0079] As an example, the storage device receives an instruction from the host to implement data migration. As an example, the host also indicates that the selected source logical unit is LUN 3, and the destination logical unit is LUN 4 (see also Figure 4A and Figure 4B )(510). And the selected source logical unit and the destination logical unit are both marked as being in the migration state.
[0080] Obtain each large block on the source logical unit (LUN 3) (530). The large block on the logical unit is the large block to which the physical block of the logical unit belongs. And identify whether the portion of each large block on the source logical unit stored on the source logical unit is user data or verification data. The physical blocks on the source logical unit (LUN 3) that do not belong to any large block do not undergo data migration. For example, obtain each large block on the source logical unit through a large block table maintained by a storage device.
[0081] The acquired partial data of each large block on the source logical unit (LUN 3) belonging to the source logical unit is copied to the destination logical unit (LUN 4) (540), and the migrated data has the same physical address in the source logical unit and the destination logical unit. And the metadata including the large block table and the FTL table are updated (550). The updated large block table records the new physical blocks (provided by the destination logical unit (LUN 4)) of each large block where data migration has occurred. The updated FTL table records the physical address of the user data after data migration on the destination logical unit (LUN (4)). If the data migration is large block check data, there is no need to update the FTL table for it.
[0082] according to Figure 5 In the embodiment, the part where data migration occurs, whether it is valid data or invalid data, is migrated, so that the new large block obtained after the data migration still meets the data verification rule.
[0083] In an optional embodiment, there is no FTL table in the storage device, and the host accesses the storage device with a physical address. The storage device provides a virtual logical unit (vLUN) and provides a mapping of the virtual logical unit to the logical unit. In response to migrating the data of the source logical unit to the destination logical unit in data migration, the metadata is updated to modify the virtual logical unit originally mapped to the source logical unit (LUN 3) to be mapped to the destination logical unit (LUN 4). And during the data migration process, the data is only copied to the destination logical unit but not to other logical units, and the physical address of the migrated data in the logical unit is not changed.
[0084] In response to the completion of data migration for all data of the source logical unit (LUN 3), LUN 3 is marked as being in an idle state. Optionally, all physical blocks of LUN 3 are also erased. And the destination logical unit (LUN 4) is marked as being in an occupied state.
[0085] Fig. 6A is a schematic diagram of migrating a non-volatile storage medium according to another embodiment of the present application.
[0086] according to Fig. 6A In the embodiment, the storage device includes a plurality of logical units (LUN 620 to LUN 628) belonging to the same NVM group or durability group. The storage device also includes a free logical unit (LUN (d)). The source logical unit LUN (s) 620 is to be exchanged with the destination logical unit LUN (d) through data migration.
[0087] Fig. 6A In the figure, the dotted box indicates a physical block, and the number in the dotted box indicates the block to which the physical block belongs. Fig. 6A In an embodiment, the physical blocks constituting the large block do not need to have the same physical address, but can be located at any position of the logical unit. As an example, the physical blocks of the large block follow such a rule that no two of the multiple physical blocks constituting the large block are from the same logical unit, in other words, the physical blocks constituting the large block are from different logical units.
[0088] Still by way of example, chunk 1 includes each of the contributed physical blocks from LUN 620, LUN 622, and LUN 624, and chunk 4 includes each of the contributed physical blocks from LUN 620, LUN 622, and LUN 626. Alternatively, each chunk need not include the same number of physical blocks.
[0089] Optionally, the storage device maintains a large block table, in which each physical block constituting each large block is recorded. Optionally, information of all physical blocks constituting the large block is recorded in each physical block of the large block.
[0090] In order to exchange the source logical unit LUN(s) 620 with the destination logical unit LUN(d), it is necessary to migrate the data of multiple physical blocks (indicated by the dotted boxes marked 1, 2, 3, 4, 5 in LUN(s) 620) in the source logical unit LUN(s) 620 that have been used to build large blocks to the destination logical unit LUN(d) and / or other logical units (LUN 622, LUN 624, LUN 626 or LUN 628) belonging to the same NVM group or durability group as the source logical unit LUN(s) 620.
[0091] Figure 6B Demonstrated according to this application Fig. 6AA schematic diagram of the results of replacing a non-volatile storage medium of an embodiment.
[0092] Figure 6B In FIG. 6 , data of each physical block (indicated by a shaded dashed box) of the source logical unit LUN(s) 620 is migrated to other logical units, and physical blocks as data migration targets are indicated by dashed boxes with numbers with superscripts “′”.
[0093] The physical blocks indicated by numbers 1, 2 and 3 of the source logical unit LUN(s) 620 are migrated to the destination logical unit LUN(d); the physical blocks indicated by number 4 of the source logical unit LUN(s) 620 are migrated to the logical unit LUN 626; and the physical blocks indicated by number 5 of the source logical unit LUN(s) 620 are migrated to the logical unit LUN 624.
[0094] In this way, the data to be migrated in the source logical unit LUN(s) 620 is written to multiple logical units (destination logical unit LUN(d), logical unit LUN626 and logical unit LUN624), thereby reducing the amount of data written to the destination logical unit LUN(d) and distributing the written data to multiple logical units, so that the write operations caused by the data migration are processed in parallel on multiple logical units, thereby speeding up the data migration process.
[0095] As an example, to migrate the data of the physical block indicated by the number 4 in the source logical unit LUN(s) 620, a physical block for carrying the data to be migrated is selected. Consider a variety of strategies to select the physical block carrying the migrated data. For example, (1) based on the large block where the migrated data is located, the selected physical block must meet the conditions for constructing a large block. See Fig. 6A , before data migration, the physical blocks of chunk 4 are provided by LUN(s) 620, LUN 622 and LUN 626, so the newly selected physical blocks should avoid coming from these logical units to meet the conditions for constructing chunks. (2) The destination logical unit LUN(d) has already provided physical blocks for chunk 1, chunk 2 and chunk 3 (see Figure 6B , indicated by the dashed boxes containing the numbers 1', 2' and 3'), then the newly selected physical block should avoid coming from the destination logical unit LUN(d). (3) The remaining selectable logical units are LUN 624 and LUN 628. One of LUN 624 and LUN 628 is selected, for example, randomly, to carry the physical block 4 of the source logical unit LUN(s) 620. Figure 6B In the example of FIG. 6 , the physical block indicated by the dashed box where the number 4′ is located and provided by LUN 628 is selected to carry the data to be migrated.
[0096] Optionally or further, when selecting the logical unit carrying the data to be migrated, each optional logical unit is selected with a different probability. Fig. 6A and Figure 6B , to migrate the data of the physical block of the source logical unit LUN(s) in the dashed box where the number 5 is located, the logical units that can be selected to carry the data to be migrated are LUN(d), LUN 622 and LUN 624. Based on the fact that the remaining life of the logical unit LUN 624 is longer (for example, its number of erases and writes is lower), the physical block provided by LUN 624 is selected to carry the data to be migrated. Selecting a logical unit with a longer remaining life to carry the data to be migrated helps to achieve wear leveling of each logical unit of the storage device.
[0097] The inventors also realize that the uniform wear degree of each logical unit is conducive to extending the service life of the NVM group or the durability group, but is not conducive to exchanging the logical units belonging to the NVM group or the durability group with the idle logical units. Because the wear degree difference between the idle logical unit and the occupied logical unit may be large, after the exchange, the life of each logical unit of the NVM group or the durability group will be significantly different. Therefore, as another embodiment, to migrate the data of the physical block of the dotted box where the number 5 of the source logical unit LUN (s) is located, the logical units that can be selected to carry the data to be migrated are LUN (d), LUN 622 and LUN 624. Based on the fact that the remaining life of the logical unit LUN 624 is relatively short (for example, its number of erases and writes is relatively high), the physical block provided by LUN 624 is selected to carry the data to be migrated. As a result, the life of LUN 624 is consumed at a faster rate than other logical units (see FIG. 6, LUN (s) 620, LUN 622, LUN 626 and LUN 628). Therefore, after the LUN 624 and the idle logical unit are exchanged in the future, the difference in life span between the idle logical unit and other logical units in the NVM group or the durability group will not be too large.
[0098] Still optionally, when selecting the logical unit carrying the data to be migrated, the probability of each candidate logical unit being selected is specified, so that each logical unit in the NVM group or the durability group is used at the specified probability, and then the remaining life of each logical unit shows a difference as it is used. For example, for the candidate logical units LUN 624, LUN 626 and LUN 628, the probability of being selected is 20%, 30% and 50%, so that the life of LUN 628 is consumed the fastest, and the life of LUN 624 is consumed the slowest. Then, when it is necessary to exchange logical units, LUN 628 is preferentially exchanged with idle logical units.
[0099] Still optionally, in addition to specifying the probability of each candidate logical unit being selected when selecting a logical unit carrying data to be migrated, the probability of each candidate logical unit being selected for building a large block is also specified when building a large block, so that the remaining life of each logical unit will show differences as the storage device is used. This makes it easier to select a logical unit suitable for exchange from the NVM group or the durability group when a logical unit needs to be exchanged.
[0100] In an alternative embodiment, in the initial stage of the use of the storage device, each logical unit is selected to construct a large block with substantially the same probability to achieve wear leveling of the storage medium of the storage device. As the storage device is used and / or it is expected that occupied logical units and idle logical units will be exchanged, and the probability of constructing large blocks and / or data migration is changed, the probability of selecting each logical unit is changed so that some logical units are used more to construct large blocks, while other logical units are used relatively less to construct large blocks. For example, the sum of the number of times each physical block of the logical unit is erased is divided by the total number of times erased in the storage device, and the quotient obtained is used as the probability of selecting the logical unit. Thereby, the probability of a logical unit being selected to construct a large block or to carry migrated data is positively correlated with the number of times the logical unit is erased.
[0101] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application. Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for replacing a storage medium of an NVM group, include: Select a source logical unit and a destination logical unit to be replaced; Copy the data of the source logical unit to the destination logical unit; The metadata is also updated so that access to the source logical unit is mapped to the destination logical unit; Also included: constructing the large block according to the logical units of the durability group or the NVM group, or constructing the large block according to the virtual logical unit; When selecting a logical unit carrying data to be migrated, the probability of each candidate logical unit being selected is specified. When constructing a large block, the probability of each candidate logical unit being selected for constructing the large block is specified. Each candidate logical unit is selected with a different probability.
2. The method according to claim 1, further comprising: include: Erase the physical block of the source logical unit.
3. The method according to claim 1 or 2, further comprising: include: The destination logical unit is set to an occupied state, and the source logical unit is set to an idle state.
4. The method according to claim 1, in: Part of the data of the source logical unit is copied to the destination logical unit; The method further includes copying another portion of the data of the source logical unit to the first logical unit. 5 . The method according to claim 1 , wherein the virtual logical unit mapped to the source logical unit is modified to be mapped to the destination logical unit by updating metadata. 6 . The method according to claim 1 , wherein a logical address for accessing the copied data is modified to a logical address mapped to the destination logical unit by updating metadata.
7. The method according to claim 1, wherein The physical address of the copied data on the destination logical unit is the same as the physical address on the source logical unit.
8. The method according to claim 1, further comprising: include: Obtaining a first large block on the source logical unit; selecting a first logical unit from a plurality of logical units including the destination logical unit; Selecting a first physical block from the first logical unit to replace the physical block provided by the source logical unit for the first large block; and The data of the physical block provided by the source logical unit for the first large block is copied to the first physical block.
9. The method according to claim 8, wherein From the plurality of logic units, a first logic unit is selected with a specified probability, and the plurality of logic units each have a probability of being selected.
10. The method according to claim 9, wherein The probability that the first logic unit is selected is greater than the probability that other logic units of the plurality of logic units other than the first logic unit are selected. The method according to claim 8 , further comprising setting a probability of each logic unit being selected.
12. The method according to claim 11, wherein in the first stage of the life cycle of the storage device, substantially the same probability of being selected is set for each logical unit; and in the second stage of the life cycle of the storage device, a different probability of being selected is set for each logical unit.
13. The method according to claim 11, wherein the probability of being selected set for one or more logical units is positively or negatively correlated with the number of erasures experienced by the logical unit.
14. The method of claim 11, wherein the probability of the source logic unit being selected is increased in response to the source logic unit being expected to be replaced.
15. The method according to claim 8, further comprising: include: In response to creating a second large block, a second plurality of logical units are selected, and physical blocks for constructing the second large block are obtained from the second plurality of logical units.
16. The method according to claim 15, further comprising: include: Logical cells are selected with a specified probability to obtain the second plurality of logical cells.
17. The method of claim 15, wherein each logical unit of the second plurality of logical units belongs to the same endurance group or NVM group.
18. The method of claim 1, wherein the source logical unit and the destination logical unit belong to the same durability group.
19. The method of claim 8, wherein each logical unit of the plurality of logical units belongs to the same durability group.
20. A storage device, comprising a control component and a NVM chip, wherein the control component executes the method according to any one of claims 1-19.
