Namespace allocation method of solid state disk and solid state disk
By introducing dynamic reserved space in the solid-state drive, the problem of multiple namespace creation requests failing was solved, achieving efficient namespace allocation and improved data read/write performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MAXIO TECHNOLOGY (HANGZHOU) CO LTD
- Filing Date
- 2024-12-03
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, the creation and deletion operations in multiple namespaces result in unmapped discrete spaces, leading to namespace creation requests failing and impacting the space utilization efficiency of solid-state drives.
By introducing dynamic reserved space (virtual logical space) into the solid-state drive, namespaces can be created using the reserved space when logical spaces do not match. The smallest logical region block that meets the requested capacity is selected for allocation first, ensuring the convenience and success rate of namespace creation.
It improved the success rate of namespace creation, optimized the space utilization efficiency of solid-state drives, ensured data read and write speeds, accelerated the response to user needs, and improved hard drive performance.
Smart Images

Figure CN122152197A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology, and in particular to a namespace allocation method for a solid-state drive (SSD) and the SSD itself. Background Technology
[0002] Solid-state drives (SSDs) are hard disk drives made with solid-state electronic storage chips, mainly composed of a controller, memory, and cache units. SSDs typically use flash memory, such as NAND flash memory, to store data for writing.
[0003] For SSDs, a namespace refers to the logical space corresponding to the flash memory. SSD data read and write operations revolve around the physical location mapped to this logical space. For SATA SSDs, one flash memory space can only correspond to one logical space, but for NVMe SSDs, one flash memory space can correspond to two or even more logical spaces. This is the concept of NVMe Multi-Namespace. Multi-Namespace is commonly used in enterprise-grade SSDs and various customized OEM consumer-grade SSDs, allowing customers to independently control the creation of namespaces of different sizes, characteristics, and purposes according to their different needs. To simplify the implementation logic of the Multi-Namespace function, the common practice is to first determine whether the requested capacity is no greater than the remaining contiguous logical space capacity of the SSD when the host issues a namespace creation request. Creation is only allowed if the condition is met. Ultimately, the entire logical space of the SSD is divided into multiple blocks according to the actual number of namespaces created, and then each block is associated with a different namespace. The attribute characteristics of different namespaces are defined based on different parameters issued by the host.
[0004] When using a contiguous logical space allocation scheme, the Multi-Namespace feature may create unmapped discrete spaces due to multiple rounds of creation and deletion operations in the early stages. This is because the capacity of deleted namespaces may not perfectly match the capacity of newly created namespaces. If a request to create a new namespace in this situation is issued with a capacity less than the remaining unused logical space but greater than the capacity of a single discrete logical space, the namespace creation request will fail, impacting SSD space utilization efficiency. Summary of the Invention
[0005] In view of the above problems, the purpose of this invention is to provide a namespace allocation method for a solid-state drive and a solid-state drive, so as to solve the problems of the prior art.
[0006] According to one aspect of the present invention, a namespace allocation method for a solid-state drive (SSD) is provided. The SSD includes a memory containing multiple physical blocks. The namespace allocation method includes: receiving a namespace creation request from a host, the creation request including the requested capacity of each namespace; polling all unallocated logical region blocks located in a storage mapping space and a reserved space; selecting one logical region block as a to-be-allocated logical region block from all allocable logical region blocks whose capacity is greater than or equal to the requested capacity; obtaining the local ID of the to-be-allocated logical region block and the host ID of the namespace to be created; mapping the local ID and the host ID to complete the allocation; wherein the storage mapping space is a logical space corresponding to the actual storage capacity of the memory, and the reserved space refers to a virtual logical space outside the logical space corresponding to the actual storage capacity.
[0007] Optionally, each physical block of the memory includes multiple physical pages, and the reserved space is the remaining space after removing the memory mapping space, which is the maximum logical space that can actually be represented by the bit width of the logical allocation unit address in the software design.
[0008] Optionally, when filtering the logical region blocks to be allocated, the logical region block with the smallest capacity is selected from all the allocable logical region blocks as the logical region block to be allocated.
[0009] Optionally, after obtaining the local ID of the logical region block to be allocated and the host ID of the namespace to be created, and mapping the local ID and the host ID to complete the allocation, the solid-state drive namespace allocation method further includes: matching the first logical address in the host logical address corresponding to the namespace to be created with the first base global logical address of the logical region block to be allocated; updating the namespace allocation mapping table according to all namespaces created based on the current creation request, wherein the namespace allocation mapping table stores the mapping relationship between the first logical address and the first base global logical address corresponding to all created namespaces.
[0010] Optionally, after obtaining the local ID of the logical region block to be allocated and the host ID of the namespace to be created, and mapping the local ID and the host ID to complete the allocation, the solid-state drive namespace allocation method further includes: returning a namespace creation success instruction to the host, the instruction including the host ID representing the namespace created in this round.
[0011] Optionally, before receiving a namespace creation request from the host, wherein the creation request includes the requested capacity for each namespace, the method further includes: receiving an unallocated capacity query request from the host, polling all unallocated logical region blocks located in the storage mapping space and the reserved space, and returning to the host the capacity of the largest single unallocated logical region block not greater than the total unallocated capacity in the storage mapping space.
[0012] Optionally, after receiving a namespace creation request from the host, wherein the creation request includes the requested capacity for each namespace, the method further includes: polling all unallocated logical region blocks located in the storage mapping space and the reserved space, and determining whether the capacity of the largest single unallocated logical region block and the total unallocated capacity in the storage mapping space both meet the requested capacity.
[0013] Optionally, when obtaining the host ID of the namespace to be created, the host ID is selected from all the ID values of the uncreated namespaces.
[0014] Optionally, the unallocated logical region blocks include logical region blocks that have not been operated on or have been released by namespaces that have been deleted, and each unallocated logical region block includes one or more consecutive logical addresses.
[0015] Optionally, the namespace allocation method for solid-state drives further includes: verifying the specifications of the requested capacity, the attributes of the requested namespace, and the number of creations to determine whether the creation request is valid.
[0016] Optionally, the namespace allocation method for solid-state drives further includes: performing a logical region block merging operation when it is detected that the logical addresses of a logical region block released due to the execution of a namespace deletion request are consecutive with those of an unallocated logical region block.
[0017] Optionally, the namespace allocation method for solid-state drives further includes: receiving read / write operation commands issued by the host, obtaining the host ID and host logical address in the read / write operation commands, calculating the corresponding baseline global logical address according to the namespace allocation mapping table, and performing read / write operations on the physical address corresponding to the baseline global logical address.
[0018] According to another aspect of the present invention, a solid-state drive is provided, comprising: a processor connected to a host, for receiving data, commands and requests from the host, and for executing the namespace allocation method of the solid-state drive described above; and a memory connected to the processor, for storing data and various mapping tables according to the control of the processor.
[0019] The solid-state drive (SSD) namespace allocation method provided in this application expands the capacity of the logical space used to match the namespace creation request by adding dynamically reserved space (virtual logical space). When the creation request fails due to multiple rounds of creation and deletion operations resulting in multiple unmapped discrete spaces when allocating contiguous logical space using the multi-namespace function, the reserved space can be used to complete the matching between the logical space and the namespace, thereby completing the creation request. That is, when the actual remaining unmatched logical space is greater than the requested capacity, but multiple discrete logical spaces cannot meet the requirements, a reserved space with a larger capacity can be selected to complete the namespace creation. This can significantly improve or even completely guarantee the namespace mapping success rate while ensuring the convenience of namespace creation, making the namespace allocation scheme more complete. It can quickly respond to user needs, will not affect the actual storage space, accelerate data read and write speeds, and improve the performance of the SSD.
[0020] Furthermore, by using the remaining space after deducting the storage mapping space, which is the maximum logical space that can actually be represented by the bit width of the logical allocation unit address in the software design, as the reserved space, the capacity of the virtual logical space can be very large, resulting in a higher mapping coverage and almost 100% completion of the creation request.
[0021] Furthermore, the smallest logical region block that meets the requested capacity is prioritized for namespace creation, making the actual logical space allocation more reasonable and the void ratio lower, so that the logical space corresponding to the memory can be utilized to the maximum extent, thus optimizing the space utilization efficiency of the solid-state drive. Attached Figure Description
[0022] The above and other objects, features and advantages of the present invention will become more apparent from the following description of embodiments of the invention with reference to the accompanying drawings, in which:
[0023] Figure 1 A schematic diagram illustrating the namespace allocation process of a solid-state drive (SSD) when no reserved space is used, according to an embodiment of the present invention, is shown.
[0024] Figure 2 A flowchart illustrating a namespace allocation method for a solid-state drive according to a first embodiment of the present invention is shown;
[0025] Figure 3 A schematic diagram illustrating the operation of a solid-state drive (SSD) querying a logical address of the SSD according to a host command, according to an embodiment of the present invention, is shown.
[0026] Figure 4 A flowchart illustrating a namespace allocation method for a solid-state drive according to a second embodiment of the present invention is shown;
[0027] Figure 5A schematic diagram illustrating the namespace allocation process of a solid-state drive after using reserved space, according to an embodiment of the present invention, is shown.
[0028] Figure 6 A schematic block diagram of a solid-state drive according to an embodiment of the present invention is shown. Detailed Implementation
[0029] The invention will now be described in more detail with reference to the accompanying drawings. In the various drawings, the same elements are indicated by similar reference numerals. For clarity, the various parts in the drawings are not drawn to scale. Furthermore, some well-known parts may not be shown.
[0030] The present invention is described below based on embodiments, but the invention is not limited to these embodiments. In the detailed description of the invention below, certain specific details are described in detail. Those skilled in the art will fully understand the invention even without these details. To avoid obscuring the essence of the invention, well-known methods, processes, flows, elements, and circuits are not described in detail.
[0031] Unless the context explicitly requires it, the terms "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than exclusive or exhaustive; that is, meaning "including but not limited to." In the description of this invention, it should be understood that terms such as "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0032] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.
[0033] Figure 1 A schematic diagram illustrating the namespace allocation process of a solid-state drive (SSD) when no reserved space is used, according to an embodiment of the present invention, is shown.
[0034] like Figure 1 As shown, when creating multiple namespaces, reserved space was not used; only the logical space (storage mapping space) corresponding to the storage space of the solid-state drive was used for multiple namespace creation. Specifically, the following steps were taken:
[0035] The first step is initialization. The logical space corresponding to the disk capacity is treated as an entire unallocated logical region block. The capacity of this logical region block is the storage capacity of the solid-state drive. When the unallocated capacity is 0x100000000, its maximum value of LBA (Logical Block Address), LBAmax, is 0x100000000.
[0036] The second step involves creating seven namespaces consecutively, hereinafter referred to as NS1 to NS7. This step requires partitioning the overall unallocated storage mapping space. Logical space is divided according to the requested capacity of each NS, resulting in seven NSs with LBA capacities of 0x1000000, 0x3000000, 0x21000000, 0x5000000, 0x8000000, 0x80000000, and 0x20000000. At this point, the remaining unallocated logical block capacity is 0x2e000000. All allocated namespaces each have a corresponding starting logical address, typically the Base Global Logical Block Address (BGLBA).
[0037] The third step is to delete NS2 and NS4 respectively. Performing the namespace deletion operation releases the logical space corresponding to NS2 and NS4, freeing up two logical region blocks. There are now three separate, individual logical region blocks. The namespaces NS2 and NS4 are also released simultaneously, and the starting logical address of the two released logical region blocks temporarily becomes 0xffffffffff.
[0038] The fourth step is to recreate a group or a single Namespace. This step can be divided into many cases; the following are three of the most common examples. Case A: If the requested capacity of the newly created Namespace is greater than the capacity of the released logical region blocks, but less than the capacity of the largest unallocated logical region block (e.g., 0x6000000), the corresponding capacity from the largest unallocated logical region block is assigned to the newly created namespace, for example, NS2. In this case, the allocation is successful, and the first logical address is remapped to the host logical address. Case B: If the requested capacity of the newly created Namespace is less than the capacity of any released logical region block, the corresponding capacity from the released logical region block is assigned to the newly created namespace. For example, if the requested capacity is 0x2000000, a portion of the logical space from the logical region block with a capacity of 0x3000000 is assigned to NS2. The allocation is successful, and the remaining portion is discrete space. Alternatively, when the requested capacity is 0x4000000, a portion of the logical space in a logical region block with a capacity of 0x5000000 is mapped to NS2, and the allocation request succeeds. The remaining portion is discrete space. In case C, if the requested capacity of a newly created NS is less than the total capacity of the unallocated logical space, but greater than the capacity of any single unallocated logical region block, the allocation request fails. For example, if the requested capacity is 0x30000000, since logical region blocks are discrete, and the largest single logical region block has a capacity of 0x2e000000, it cannot be created, and the allocation request fails.
[0039] Therefore, when not using reserved space, and provided there is sufficient remaining logical space or the capacity of each deleted Namespace can be fully replenished, these Namespace mapping requests can be normally covered. However, due to the uncertainty of host behavior, when a host arbitrarily performs multiple rounds of alternating creation and deletion operations on Namespaces, and the capacity of the deleted Namespaces cannot be completely matched with the capacity of the newly created Namespaces, some discrete unused gaps may appear in the entire logical space. In this case, if a new request is made to create a Namespace with a capacity less than the total capacity of the remaining unused logical space, but greater than the capacity of its single largest discrete unused logical space, the Namespace creation mapping request will fail.
[0040] This invention improves upon the previous solution by adding a dynamically reserved space (virtual logical space), similar to a backup resource pool, to prevent requesters from waiting indefinitely for namespace resources to be released. When situation C occurs, the reserved space can be used for allocation, allocating a portion of logical space from the reserved space to satisfy the NS creation request. Furthermore, a suitable logical space selection strategy makes the actual logical space allocation more reasonable and reduces the void ratio. The following specific embodiments illustrate the namespace allocation method of this invention for solid-state drives.
[0041] Figure 2 A flowchart of a namespace allocation method for a solid-state drive according to a first embodiment of the present invention is shown.
[0042] The namespace allocation method in this embodiment can be applied to solid-state drives (SSDs). An SSD includes a controller, cache units, and memory, such as flash memory, comprising multiple physical blocks. Each physical block includes multiple physical pages, and each physical page includes multiple 4KB cells. The 4KB cells are used to store multiple write data entries and can also store the corresponding Logical Allocation Unit (LAA) addresses. Generally, every eight consecutive LBAs share one LAA, and each LAA corresponds to one 4KB cell. Figure 2 As shown, the namespace allocation method for the solid-state drive in this embodiment specifically includes the following steps:
[0043] In step S101, a namespace creation request is received from the host. The creation request includes the requested capacity for each namespace. In this step, the solid-state drive controller receives and executes the namespace creation request from the host. This namespace creation request can request the creation of one or more namespaces, and the required capacity for each namespace is specified.
[0044] Before step S101, the namespace allocation method for the solid-state drive may further include: verifying the specifications of the requested capacity, the attributes of the requested namespace, and the number of creations to determine whether the creation request is valid. For example, verifying the unit of the requested capacity (GB / MB / KB, etc.), verifying attributes such as encryption or unencryption, and verifying whether the number of creations meets the minimum number of creations supported by the hardware, etc., are all considered valid if they meet the requirements.
[0045] In step S102, all unallocated logical region blocks located in the storage mapping space and reserved space are polled. One logical region block is selected from all allocable logical region blocks whose capacity is greater than or equal to the requested capacity as the logical region block to be allocated. In this step, the storage mapping space is the logical space corresponding to the actual storage capacity of the memory, and the reserved space refers to the virtual logical space outside the logical space corresponding to the actual storage capacity. Therefore, all unallocated logical region blocks in the storage mapping space and reserved space are polled first. At this point, the disk may be a newly initialized disk, or it may have undergone multiple rounds of creation or deletion operations. The remaining logical region blocks are multiple discrete spaces. That is, unallocated logical region blocks include logical region blocks that have not been operated on or have been released from deleted namespaces. Each unallocated logical region block includes one or more consecutive logical addresses. Allocable logical region blocks that meet the requested capacity are selected from these logical region blocks; that is, the logical region block capacity must be greater than or equal to the requested capacity to be considered to meet the requested capacity.
[0046] Then, one logical region block is selected from the multiple allocable logical region blocks to be allocated. For example, the logical region block with the smallest capacity can be selected from all allocable logical region blocks. Optimizing the selection of the smallest unallocated logical region block that meets the requested capacity maximizes the utilization of logical space resources. Furthermore, when there are multiple smallest logical region blocks that meet the requested capacity, priority is given to selecting from the storage mapping space, and only then from the reserved space.
[0047] In step S103, the local ID of the logical region block to be allocated and the host ID of the namespace to be created are obtained, and the local ID and host ID are mapped to complete the allocation. In this step, the ID of the selected logical region block to be allocated is obtained as the local ID, and the ID of the namespace to be created is obtained as the host ID. The local ID and host ID are matched and mapped to complete the allocation of the namespace, that is, a specific logical space is selected as the NS to be created. In this step, when obtaining the host ID of the namespace to be created, the smallest ID value can be selected from all the ID values of the namespaces that have not been created as the host ID. If a namespace deletion operation has been performed before, the smallest ID value is selected from the numbers of the deleted and unallocated NSs.
[0048] Furthermore, after step S103, the solid-state drive namespace allocation method of this embodiment may further include: matching the first logical address in the host logical address corresponding to the namespace to be created with the first base global logical address of the logical region block to be allocated. After completing the mapping between the logical region block and the NS, it is also necessary to match the host logical address and the logical address of the logical region block. This mainly involves matching the first logical address (generally 0) of the host for the NS created this time with the BGLBA (base global LBA) of the starting logical address of the logical region block.
[0049] Furthermore, after matching the first logical address in the host logical address corresponding to the namespace to be created with the first reference global logical address of the logical region block to be allocated, the solid-state drive namespace allocation method of this embodiment may further include: updating the namespace allocation mapping table according to all namespaces created based on this creation request. The namespace allocation mapping table stores the mapping relationship between the first logical address and the first reference global logical address corresponding to all created namespaces. That is, the mapping relationship of the NS created this time is saved and updated to update the namespace allocation mapping table, and subsequently, the corresponding BGLBA can be found according to the host logical address based on the namespace allocation mapping table.
[0050] In a preferred embodiment, after step S101, the solid-state drive namespace allocation method further includes: polling all unallocated logical region blocks located in the storage mapping space and the reserved space, and determining whether the capacity of the largest single unallocated logical region block and the total unallocated capacity in the storage mapping space both meet the requested capacity. That is, it is determined whether the total capacity of all actual unallocated logical spaces can meet the requested capacity, and it is also determined whether the capacity of the largest logical region block among multiple discrete logical region blocks meets the requested capacity. Only when both meet the requirements can the subsequent step S102 be executed.
[0051] In other embodiments, interaction can also occur before the host issues a namespace creation request, providing the remaining unallocated capacity to the host. That is, before step S101, the solid-state drive namespace allocation method can further include: receiving an unallocated capacity query request from the host, polling all unallocated logical region blocks located in the storage mapping space and reserved space, and returning to the host the capacity of the largest single unallocated logical region block that is not greater than the total unallocated capacity in the storage mapping space. Specifically, when the host issues an unallocated capacity query request, if the capacity of the remaining largest unallocated logical region block is greater than the total unallocated space capacity, the firmware returns an unallocated capacity equal to the actual total unallocated capacity; otherwise, it returns the capacity of the current largest single unallocated logical region block.
[0052] If the remaining unallocated single largest logical region block has a capacity greater than the total unallocated space capacity, it generally means that the remaining unallocated capacity of the reserved space is greater than the actual total unallocated space capacity. In this case, a portion of the reserved space is selected for NS creation and allocation. Conversely, if the remaining unallocated single largest logical region block has a capacity less than the total unallocated space capacity, it generally means that the reserved space has also undergone multiple NS creation and deletion operations, and the virtual logical space has become fragmented. In this case, the capacity of the largest allocatable logical region block is returned.
[0053] Typically, each physical block of a solid-state drive (SSD) memory comprises multiple physical pages, and each physical page comprises multiple 4KB cells. The maximum logical space that the logical allocation unit address (LAA) corresponding to a 4KB cell in the software design can actually represent, after deducting the storage mapping space, can be reserved as space. For example, in this embodiment, the LAA field used to represent the logical location of data in the SSD firmware design is 32 bits in size, so the maximum logical space it can actually represent is: 2^32 * 4KB = 16TB. Based on the above... Figure 1 Taking the 2TB capacity disk shown as an example, the storage mapping space is 2TB, and the remaining logical space after it is 14TB (16TB-2TB). The remaining 14TB of logical space after removing the storage mapping space is used as reserved space, which reserves a large amount of OP ZONE (Over-Provision Zone) for developers to use.
[0054] Taking the maximum number of namespaces supported by a solid-state drive as an example, we designed the OP ZONE capacity to be dynamically adjustable, as shown in Table 1 below: ID SSD Cap OP ZONE Cap Note 1 2T (inclusive) and below 0~8 multiple SSD It can achieve 100% coverage; the larger the OP ZONE, the higher the coverage. 2 Greater than 2T 0~8 multiple SSD The larger the OP zone, the higher the coverage, and it is far superior to solutions without OP zones. Table 1
[0055] Table 1 shows that the larger the reserved space is relative to the storage mapping space, the higher the coverage of the actual logical space, the higher the success rate of NS creation, and the faster the response. SSDs of different capacities can have their OP ZONE size configured according to actual needs to modify the actual logical space available for firmware configuration. However, due to the existence of the OP ZONE, invalid LAA regions exist during NS creation, requiring a unified adjustment to the original FTL method for determining invalid LAA regions.
[0056] In step S104, a command indicating successful namespace creation is returned to the host, including the host ID representing the namespace created in this round.
[0057] In this step, after completing the mapping of the local ID and the host ID and the mapping of the host logical address and the BGLBA, an instruction indicating successful namespace creation is returned to the host, and at the same time, the host ID applied for this creation is returned to facilitate subsequent read and write operations of the host.
[0058] In summary, the namespace allocation method of the solid-state drive according to the embodiment of the present invention adds a virtual logical space, namely the OP ZONE, to the range of logical addresses 0 to LBAmax corresponding to the SSD. In the extreme allocation scenario of the host similar to Figure 1 Case C, the corresponding logical area can still be divided from the OP ZONE for NS creation, and the BGLBA corresponding to the Namespace is matched and saved with the first logical address of the host through the actually divided space. Then, when the host issues a read or write operation command later, the host logical address will be attached, which can be the first logical address Start LBA or any host logical address. According to the mapping relationship, the BGLBA of the SSD itself can be calculated, and finally sent to the back-end data processing module of the SSD. The back-end mapping table and the data processing module need to be uniformly modified and judged.
[0059] For the general SSD design, the core idea of the Multi-Namespace design is to convert the LBA in the corresponding NS issued by the host into the GLBA in the SSD logical space. The specific implementation logic is as follows Figure 3 as shown.
[0060] Figure 3 FIG. shows an operation schematic diagram of querying the solid-state drive logical address according to the command of the host according to the embodiment of the present invention. As Figure 3 shown, when receiving a read operation command or a write operation command from the host, first, the host ID of the NS and the host logical address NS.LBA in the NS issued by the host will be received, that is, in the first step, the NSID and the NS.LBA parameters in the host cmd are obtained. Then, in the second step, the namespace allocation mapping table (NS TO BGLBA mapping table) is queried to find the BGLBA of the starting logical address corresponding to the NSID (host ID). In the third step, the actual GLBA is calculated according to NS.LBA, GLBA = BGLBA + (NS.LBA << N), where N represents the LBADS Format. That is, N represents the multiple ratio attribute of the data size of the BGLBA unit actually configured when the host creates the logical space, and the corresponding multiple needs to be magnified during conversion for attribute matching.
[0061] Furthermore, the solid-state drive namespace allocation method of this embodiment of the invention further includes: receiving a read / write operation command issued by the host, obtaining the host ID and host logical address in the read / write operation command, calculating the corresponding baseline global logical address according to the namespace allocation mapping table, and performing read / write operations on the physical address corresponding to the baseline global logical address. For specific operations, please refer to the above description. Figure 3 The description.
[0062] Furthermore, the solid-state drive namespace allocation method of this embodiment of the invention further includes: when it is detected that the logical address of a logical region block released due to the execution of a namespace deletion request is consecutive with that of an unallocated logical region block, a logical region block merging operation is performed. For example, when a host requests to delete a namespace, during the execution of the corresponding deletion operation, if the firmware determines that the logical region block released due to deletion is consecutive with the logical address of a surrounding unallocated region, the firmware will perform a region merging operation to merge the two logical region blocks, thereby increasing the capacity of the single logical region block.
[0063] Figure 4 A flowchart illustrating a namespace allocation method for a solid-state drive according to a second embodiment of the present invention is shown. Figure 4 As shown, the namespace allocation method for solid-state drives in this embodiment mainly includes the following steps:
[0064] In step S201, an NS creation request is received from the host. In step S202, the validity of the creation request is determined, which can be done by verifying the NS's attributes, specifications, and capacity. If valid, step S203 is executed; otherwise, step S212 is executed, and the process ends. In step S203, all unallocated logical region blocks are polled based on the requested capacity. In step S204, it is determined whether the region capacity of the currently queried logical region block is greater than or equal to the requested capacity. If so, step S205 is executed; otherwise, step S206 is executed. In step S205, if the current logical region block meets the requested capacity, the ID of the smallest unallocated logical region that meets the requested capacity is saved. Then, step S206 is executed to determine whether the polling has ended. If not, the process returns to step S203; otherwise, step S207 is executed. Steps S203-S206 are executed repeatedly until the polling ends, and then the next step is initiated. In step S207, it is determined whether the ID of the smallest unallocated logical region block is valid. If valid, step S208 is executed; otherwise, step S212 is executed, and the process ends. In step S208, the smallest NSID of the uncreated NS is obtained. In step S209, the NSID representing the NS to be created is mapped to the ID of the logical region block allocated in this round, that is, the local ID and host ID are mapped and matched. In step S210, the host's SLBA is converted to the BGLBA corresponding to the logical region block. In step S211, the NS allocation mapping table for this round is updated and saved. In step S212, the process ends. Most of the above steps are... Figures 2-3 As described in the examples, they will not be elaborated here.
[0065] Figure 5 A schematic diagram illustrating the namespace allocation process of a solid-state drive (SSD) after using reserved space, according to an embodiment of the present invention, is shown. Figure 5 As shown, in this embodiment, the solid-state drive (SSD) utilizes reserved space. Figure 1 Similarly, it also involves the steps of initialization, creation of NS, deletion of NS, and re-creation of NS.
[0066] The first step is initialization. Taking a 4TB solid-state drive (SSD) as an example, the storage mapping space is 4TB, and the reserved space is 12TB (16TB-4TB). The second step is to create five groups of Service Nodes (NS). Hereinafter referred to as NS1-NS5, their corresponding space capacities are NS1-128GB, NS2-512GB, NS3-2TB, NS4-256GB, and NS5-128GB, respectively. The remaining unallocated logical space in the storage mapping space is 1TB, and the remaining unallocated logical space in the reserved space is 12TB. Of course, in some embodiments, the remaining contiguous 13TB of space can be merged. The third step is to delete NS2 and NS4. The logical region blocks corresponding to these two NS are released, and the corresponding BGLBAs are also deleted. The fourth step is to recreate a group of NS. Several scenarios can still occur at this point, which are explained below.
[0067] After the first three steps, the total remaining unallocated space in the SSD is 1768G, and the capacity of a single largest contiguous unallocated logical region block is 1T. At this point, the capacity of a newly created NS on the host could be 640G, 200G, 400G, and 1536G, corresponding to scenarios A, B, C, and D, respectively.
[0068] For scenario A, 640GB can be selected from the unallocated 1TB space as NS2, corresponding to the creation of BGLBA. For scenario B, 200GB can be selected from the unallocated 256GB space as NS2. For scenario C, 400GB can be selected from the unallocated 512GB space as NS2. For scenario D, if the reserved space is not enabled, the creation request fails; however, if the reserved space is enabled, 1536GB can be allocated from the reserved space as NS2, thus completing this round of creation. Since OP ZONE is enabled, the firmware, after searching, will allocate a region from the OP ZONE space to satisfy the host request, ultimately achieving the following... Figure 5 This allocation under scenario D not only significantly improves or even completely guarantees the mapping success rate of Multi-Namespace, but also ensures the ease of design modification of Multi-Namespace and optimizes performance.
[0069] Figure 6 A schematic block diagram of a solid-state drive according to an embodiment of the present invention is shown.
[0070] like Figure 6 As shown, the computer system 100 includes a host 110 and a solid-state drive (SSD). The SSD is a memory hard drive made of solid-state electronic storage chips. The SSD includes a controller 120 and a memory 130. The memory 130 is, for example, a flash memory. The controller 120 is connected to the host 110 and is used to exchange write data with the host 110, receive data, commands, and requests issued by the host, and perform the aforementioned operations. Figures 1-5The namespace allocation method for the solid-state drive is described. Controller 120 is also used to control the operation of memory 130.
[0071] The controller 120 includes, for example, a host interface 121, a processor 123, a cache unit 124, and a memory controller 128. The host interface 121 of the control system 120 is connected to the host 110 to transmit write data and commands. The processor 123 is connected to the host interface 121, the cache unit 124, and the memory controller 128. The processor 123 is used, for example, to execute the namespace allocation method of the solid-state drive described above. The cache unit 124 is, for example, SRAM, which stores the mapping table or index table corresponding to the write data. The memory controller 128 controls the transmission and storage of write data. The processor 123 is also used to implement the core software layer for memory control, namely the FTL (flash translation layer), enabling the operating system and file system to access the memory like a hard drive. This FTL also has features such as supporting bad block management, wear leveling, garbage collection, power-off recovery, and write balancing technology.
[0072] The memory 130 includes a flash memory chip array comprising multiple physical blocks for storing write data, mapping tables, or index tables. The physical block storing write data is called user physical block 132, while the physical block storing the mapping table is called mapping physical block 131. To improve data read / write performance, the memory controller 128 of the controller 120 can read and write to the flash memory chips of the memory 130 via multiple channels (e.g., CH0 and CH2). Each channel connects to a group of flash memory chips, storing the write data in user physical block 132.
[0073] It should be understood that the above method can be applied not only to solid-state drives (SSDs), but also to other storage hard drives or storage devices that have controllers and memory, and the controller can implement the above namespace allocation method for SSDs.
[0074] As described above, these embodiments of the present invention do not exhaustively cover all details, nor do they limit the invention to the specific embodiments described. Clearly, many modifications and variations can be made based on the above description. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to effectively utilize the invention and its modifications. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A namespace allocation method for a solid-state drive (SSD), wherein the SSD includes a memory containing multiple physical blocks, wherein, The namespace allocation method for the solid-state drive includes: Receive namespace creation requests from the host, wherein the creation requests include the request capacity for each namespace; Poll all unallocated logical region blocks located in the storage mapping space and the reserved space, and select one logical region block to be allocated from all allocable logical region blocks whose capacity is greater than or equal to the requested capacity. Obtain the local ID of the logical region block to be allocated and the host ID of the namespace to be created, and map the local ID and the host ID to complete the allocation. The storage mapping space is the logical space corresponding to the actual storage capacity of the memory, and the reserved space refers to the virtual logical space outside the logical space corresponding to the actual storage capacity.
2. The namespace allocation method for a solid-state drive according to claim 1, wherein, Each physical block of the memory includes multiple physical pages, and the reserved space is the remaining space after removing the memory mapping space, which is the maximum logical space that the bit width of the logical allocation unit address can actually represent in the software design.
3. The namespace allocation method for a solid-state drive according to claim 1, wherein, When filtering the logical region blocks to be allocated, the logical region block with the smallest capacity is selected from all the allocable logical region blocks as the logical region block to be allocated.
4. The solid-state drive namespace allocation method according to claim 1, after obtaining the local ID of the logical region block to be allocated and the host ID of the namespace to be created, and mapping the local ID and the host ID to complete the allocation, the solid-state drive namespace allocation method further includes: Match the first logical address in the host logical address corresponding to the namespace to be created with the first reference global logical address of the logical region block to be allocated; The namespace allocation mapping table is updated based on all namespaces created based on the creation request described herein. The namespace allocation mapping table stores the mapping relationship between the first logical address and the first base global logical address corresponding to all created namespaces.
5. The solid-state drive namespace allocation method according to claim 1, after obtaining the local ID of the logical region block to be allocated and the host ID of the namespace to be created, and mapping the local ID and the host ID to complete the allocation, the solid-state drive namespace allocation method further includes: Return a command to the host indicating that the namespace has been successfully created. The command includes the host ID representing the namespace created in this round.
6. The namespace allocation method for a solid-state drive according to claim 1, wherein, Before the step of receiving a namespace creation request from the host, wherein the creation request includes the requested capacity for each namespace, the method further includes: The system receives an unallocated capacity query request from the host, polls all unallocated logical region blocks located in the storage mapping space and the reserved space, and returns to the host the capacity of the largest single unallocated logical region block that is not greater than the total unallocated capacity in the storage mapping space.
7. The namespace allocation method for a solid-state drive according to claim 1, wherein, After receiving a namespace creation request from the host, wherein the creation request includes the requested capacity for each namespace, the process further includes: Poll all unallocated logical region blocks located in the storage mapping space and the reserved space, and determine whether the capacity of the largest single unallocated logical region block and the total unallocated capacity in the storage mapping space both meet the requested capacity.
8. The namespace allocation method for a solid-state drive according to claim 1, wherein, When obtaining the host ID of the namespace to be created, the host ID is selected from all the ID values of the uncreated namespaces.
9. The namespace allocation method for a solid-state drive according to claim 1, wherein, The unallocated logical region blocks include logical region blocks that have not been operated on or have been released from namespaces that have been deleted, and each unallocated logical region block includes one or more consecutive logical addresses.
10. The namespace allocation method for a solid-state drive according to claim 1, further comprising: The specifications of the requested capacity, the attributes of the requested namespace, and the number of creations are checked to determine whether the creation request is valid.
11. The namespace allocation method for a solid-state drive according to claim 1, further comprising: A logical region block merging operation is performed when it is detected that a logical region block released due to the execution of a namespace deletion request has a logical address contiguous with an unallocated logical region block.
12. The namespace allocation method for a solid-state drive according to claim 1, further comprising: The system receives read / write operation commands from the host, obtains the host ID and host logical address from the read / write operation commands, calculates the corresponding baseline global logical address based on the namespace allocation mapping table, and performs read / write operations on the physical address corresponding to the baseline global logical address.
13. A solid-state drive, comprising: A processor, connected to a host, receives data, commands, and requests from the host, and executes the namespace allocation method for a solid-state drive according to any one of claims 1-12; The memory, connected to the processor, stores data and various mapping tables under the control of the processor.