A pre-allocated logical unit capacity inquiry method, device and medium

CN122711080APending Publication Date: 2026-09-08CHENGDU TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610987655.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-03
Publication Date
2026-09-08

AI Technical Summary

Technical Problem

[0007]针对现有技术存在的分布式存储设备在逻辑存储单元未绑定物理块时容量查询不准确,以及提前绑定物理块会干扰底层资源调度的问题,本申请提供一种基于预分配的逻辑单元容量查询方法、设备和介质,通过在响应容量查询指令时,为未绑定物理存储块的逻辑存储单元预先分配物理存储块并建立映射关系,使得系统能够基于该物理存储块的实际物理属性精确计算可用容量,解决了查询不准确的问题

Benefits of technology

[0049] This application addresses the problem of inaccurate queries caused by traditional solutions that only return the theoretical maximum value due to the lack of physical block binding. This is achieved by pre-allocating physical storage blocks and establishing a mapping relationship for logical storage units that are not bound to physical blocks when responding to capacity query commands. Furthermore, a pre-allocation state is introduced, distinguishing it from the regular allocated or active states. Physical storage blocks in the pre-allocated state are considered idle in the storage device's resource reclamation statistics. This pre-allocation action serves only the accuracy of capacity queries and is not misjudged as valid data occupation by the underlying resource scheduling mechanism, thus avoiding interference with garbage collection threshold calculations and processes caused by pre-binding physical blocks. When a logical storage unit actually receives a data write command, the pre-allocated state is changed back to the allocated state, ensuring the correctness of physical block lifecycle management. This approach guarantees high accuracy in capacity queries while effectively decoupling the query mechanism from the underlying resource scheduling mechanism, improving the overall reliability and performance stability of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122711080A_ABST
    Figure CN122711080A_ABST
Patent Text Reader

Abstract

This invention discloses a method, device, and medium for querying the capacity of logical units based on pre-allocation, relating to the field of distributed storage technology. By pre-allocating physical storage blocks and establishing mapping relationships for logical storage units that are not bound to physical storage blocks when responding to capacity query commands, the system can accurately calculate the available capacity based on the actual physical attributes of the physical storage block, solving the problem of inaccurate queries. Simultaneously, a pre-allocation state is introduced, distinguishing this state from the conventional allocated or active states. Physical storage blocks in the pre-allocated state are considered idle in the resource reclamation statistics of the storage device. When a logical storage unit receives a data write command, the pre-allocation state is changed back to the allocated state, ensuring the correctness of physical block lifecycle management. While ensuring high accuracy in capacity queries, efficient resource scheduling is achieved, improving the overall reliability and performance stability of the storage system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed storage technology, and more specifically to a method, device, and medium for querying the capacity of pre-allocated logical units. Background Technology

[0002] FDP (Flexible Data Placement) is a flexible data placement technology that transfers the decision-making power for data layout in distributed storage from the SSD (Solid State Drive) firmware to the host system. This allows the host to guide data isolation according to application needs, significantly reducing the amount of effective data that needs to be moved during garbage collection, thereby reducing write amplification and improving the write performance and lifespan of the SSD.

[0003] In SSD (Solid State Drive) Flexible Data Placement (FDP) technology, data writing management between the host and the SSD is handled through Reuse Units. In traditional solutions, before the host is ready to write data to a Reuse Unit, the system pre-binds the Reuse Unit to a Super Block within the SSD and returns the writable capacity of the Reuse Unit to the host based on the Super Block's maximum physical capacity (e.g., 10GB).

[0004] This pre-binding mechanism has the following problems:

[0005] Bad block-induced capacity deviation: If a bound physical storage block contains bad blocks, its actual usable capacity will be less than the theoretical maximum. When the host writes 1GB of data to the logical storage unit, the expected remaining writable capacity of the logical storage unit is 9GB. However, due to the presence of bad blocks, the actual remaining writable capacity provided by the SSD may be less than 9GB (e.g., 8.5GB). This causes the remaining capacity queried by the host to be inconsistent with its expectations, which may lead to abnormal host write strategies or data write failures.

[0006] Ineffective resource occupation: Before a write I / O operation occurs, logical storage units and physical storage blocks are already bound together. At this point, if some logical storage units ultimately do not perform data write operations, they will still continue to occupy the physical resources of the physical storage blocks inside the SSD. This ineffective occupation will affect the accurate calculation and execution efficiency of core processes such as garbage collection (GC) and wear leveling inside the SSD, reducing the overall performance and lifespan management capabilities of the SSD. Summary of the Invention

[0007] To address the issues of inaccurate capacity queries in existing distributed storage devices when logical storage units are not bound to physical blocks, and the interference of pre-binding physical blocks with underlying resource scheduling, this application provides a method, device, and medium for querying logical unit capacity based on pre-allocation. By pre-allocating physical storage blocks and establishing a mapping relationship for logical storage units that are not bound to physical storage blocks when responding to capacity query commands, the system can accurately calculate the available capacity based on the actual physical attributes of the physical storage block, thus solving the problem of inaccurate queries. Simultaneously, a pre-allocation state is introduced, distinguishing this state from the regular allocated or active states. Physical storage blocks in the pre-allocated state are considered idle in the storage device's resource reclamation statistics. When a logical storage unit receives a data write command, the pre-allocated state is changed back to the allocated state, ensuring the correctness of physical block lifecycle management. This ensures high accuracy in capacity queries while achieving efficient resource scheduling, improving the overall reliability and performance stability of the storage system.

[0008] This invention is achieved through the following technical solution:

[0009] The first aspect of this invention provides a method for querying the capacity of pre-allocated logical units, comprising:

[0010] In response to a capacity query command for a logical memory cell, query the capacity of the logical memory cell;

[0011] Determine whether a mapping relationship exists between the logical storage unit and the physical storage block;

[0012] If no mapping relationship exists, an idle physical storage block is obtained from the idle physical storage block pool, a mapping relationship is established between the logical storage unit and the physical storage block, and the state of the physical storage block is set to the pre-allocated state FDP_OPEN.

[0013] Based on the established mapping relationship, obtain the actual physical attributes of the physical storage block;

[0014] Based on the actual physical attributes of the allocated physical storage block, calculate and return the available capacity of the logical storage unit:

[0015] Set the state of the allocated physical storage blocks to the pre-allocated state;

[0016] Upon receiving a data write instruction for the logical storage unit, the pre-allocated state is changed to the allocated state;

[0017] When the physical storage block is full, the mapping relationship between the logical storage unit and the physical storage block is released, and the state of the physical storage block is changed to the closed state.

[0018] Furthermore, the physical storage block includes:

[0019] The physical storage blocks present at the time of manufacture of flash memory chips;

[0020] Physical storage blocks generated during operation;

[0021] All of the above physical storage blocks are marked and recorded in the physical storage block record table;

[0022] When the system is powered on, all physical storage blocks are organized into several physical storage blocks according to the internal configuration of the solid-state drive. If there is a mapping relationship between the logical storage unit and the physical storage block, then each physical storage block logically corresponds to a logical storage unit.

[0023] Furthermore, determining whether a mapping relationship exists between the logical storage unit and the physical storage block includes:

[0024] In response to a capacity query command for a logical storage unit, when querying the status of a logical storage unit, the solid-state drive looks up the mapping table between logical storage units and physical storage blocks based on the logical storage unit.

[0025] If the logical storage unit in the mapping table does not have a corresponding physical storage block, it is considered that a binding relationship has not yet been established between the logical storage unit and the physical storage block.

[0026] Furthermore, establishing the mapping relationship between the logical storage unit and the physical storage block includes:

[0027] The mapping table between the logical storage unit and the physical storage block is looked up based on the state of the logical storage unit;

[0028] If the logical storage unit in the mapping table is not bound to any physical storage block, then a target physical storage block is selected to establish the binding relationship between the logical storage unit and the target physical storage block, and the state of the target physical storage block is set to the pre-allocated state.

[0029] In response to the presence of I / O data writing in the logical storage unit, the state of the target physical storage block is adjusted from FDP_OPEN to OPEN.

[0030] Furthermore, the step of adjusting the state of the target physical storage block from the FDP_OPEN state to the OPEN state in response to the presence of I / O data writing in the logical storage unit includes:

[0031] By selecting a physical storage block inside the solid-state drive and writing it into the mapping table, the binding relationship between the logical storage unit and the physical storage block is established, and the status of the physical storage block is set to FDP_OPEN.

[0032] Return the physical space size of the physical storage block to the host, as the writable capacity of the logical storage unit;

[0033] The step of selecting a target physical storage block and establishing a binding relationship between the logical storage unit and the target physical storage block includes:

[0034] A free physical storage block is selected from inside the solid-state drive as the target physical storage block, and the correspondence between the logical storage unit and the target physical storage block is written into the mapping table;

[0035] If subsequent IO data is written to this logical storage unit, the corresponding physical storage block status will be changed from FDP_OPEN to OPEN for internal management by the solid-state drive.

[0036] Furthermore, when the physical storage block is in the FDP_OPEN state, it indicates that the physical storage block has established a binding relationship with a certain logical storage unit, but has not yet received any user IO data writes;

[0037] When the physical storage block is in the OPEN state, it means that the physical storage block has been bound to a logical storage unit and has started to receive IO data writes.

[0038] In the FDP_OPEN state, the solid-state drive does not perform any state transition operations other than data writing on the physical storage block;

[0039] Only after receiving an actual IO write command for that logical storage unit will the state be changed from FDP_OPEN to OPEN, allowing the normal IO write process.

[0040] Furthermore, the block management state machine also includes at least the OPEN state, CLOSE state, GC_Start state, GC_Complete state, ERASE state, and FREE state.

[0041] The FDP_OPEN state is different from the OPEN state, CLOSE state, GC_Start state, GC_Complete state, ERASE state, and FREE state in the block management state machine.

[0042] Furthermore, calculating the available capacity of the logical storage unit includes:

[0043] Obtain the capacity of a single flash memory die, the total number of flash memory dies, the amount of data inside the system, the capacity of bad blocks, and the amount of IO data written, and calculate the writable capacity of the logical storage unit.

[0044] The internal data volume of the system includes the mapping data from physical addresses to logical addresses and the data generated by XOR operations;

[0045] The available capacity is obtained by multiplying the capacity of a single flash memory die by the total number of dies, and then subtracting the capacity occupied by physical address and logical address mapping data, XOR check data, bad block information, and written data.

[0046] A second aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a method for querying the capacity of pre-allocated logical units.

[0047] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for querying the capacity of pre-allocated logical units.

[0048] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0049] This application addresses the problem of inaccurate queries caused by traditional solutions that only return the theoretical maximum value due to the lack of physical block binding. This is achieved by pre-allocating physical storage blocks and establishing a mapping relationship for logical storage units that are not bound to physical blocks when responding to capacity query commands. Furthermore, a pre-allocation state is introduced, distinguishing it from the regular allocated or active states. Physical storage blocks in the pre-allocated state are considered idle in the storage device's resource reclamation statistics. This pre-allocation action serves only the accuracy of capacity queries and is not misjudged as valid data occupation by the underlying resource scheduling mechanism, thus avoiding interference with garbage collection threshold calculations and processes caused by pre-binding physical blocks. When a logical storage unit actually receives a data write command, the pre-allocated state is changed back to the allocated state, ensuring the correctness of physical block lifecycle management. This approach guarantees high accuracy in capacity queries while effectively decoupling the query mechanism from the underlying resource scheduling mechanism, improving the overall reliability and performance stability of the storage system. Attached Figure Description

[0050] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. The following drawings only show some embodiments of the present invention and should not be considered as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:

[0051] Figure 1 This is a flowchart of the pre-allocated logical unit capacity query method in an embodiment of the present invention;

[0052] Figure 2 This is a mapping diagram of RU and Super Block in an embodiment of the present invention;

[0053] Figure 3 This is a schematic diagram of the physical layout and redundancy protection of the storage system in an embodiment of the present invention. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.

[0055] Example 1, as one possible implementation, such as Figure 1 As shown, this embodiment provides a method for querying the capacity of pre-allocated logical units, including:

[0056] S1. In response to a capacity query command for a logical storage unit, the capacity of the logical storage unit is queried. When the host needs to know the remaining writable space of a certain logical storage unit in order to plan the data layout, it sends a capacity query command to the storage device. After receiving the command, the controller of the storage device parses the identifier of the target logical storage unit and initiates the capacity query process. Here, the logical storage unit is a data isolation or management unit from the host's perspective. It is not directly equivalent to the underlying physical storage space, but is associated with the physical medium through the internal mapping mechanism of the storage device.

[0057] S2. Determine if a mapping relationship exists between logical storage units and physical storage blocks. The storage device maintains an internal mapping table to record the binding status of logical storage units and physical storage blocks. Before performing capacity calculation, the system first checks the table to confirm whether the target logical storage unit is already associated with a specific physical storage block. If a mapping relationship exists, it means that the unit has previously been allocated physical resources, and subsequent processing can be performed directly based on the existing binding relationship. If no mapping relationship exists, it indicates that the logical storage unit has not yet been allocated an actual physical medium. In this case, directly returning the theoretical nominal capacity will not reflect the true condition of the physical medium (such as bad block loss), therefore, a subsequent dynamic allocation process needs to be triggered.

[0058] S3. If no mapping relationship exists, a free physical storage block is obtained from the free physical storage block pool, a mapping relationship is established between the logical storage unit and the physical storage block, and the state of the physical storage block is set to the pre-allocated state FDP_OPEN. When a mapping is determined to be missing, the system does not return a default value, but actively intervenes in resource allocation. The controller selects an available physical storage block from the free physical storage block pool according to a preset strategy (e.g., by number order or wear leveling algorithm) and binds it to the currently queried logical storage unit in the mapping relationship table. The core purpose of this step is to map abstract logical units to specific physical entities, so that subsequent capacity calculations can be based on the real attributes of that specific physical entity.

[0059] S4. Based on the established mapping relationship, obtain the actual physical attributes of the physical storage block; once the mapping is established, the system can read the metadata information of the specific physical storage block. The actual physical attributes include, but are not limited to, the number of factory-made bad blocks contained in the block, newly added bad blocks generated during operation, and the inherent system overhead of the physical area to which the block belongs (such as the space occupied by verification data).

[0060] S5. Based on the actual physical attributes of the allocated physical storage block, calculate and return the available capacity of the logical storage unit: set the state of the allocated physical storage block to the pre-allocated state; when a data write instruction for the logical storage unit is received, change the pre-allocated state to the allocated state; when the physical storage block is full, release the mapping relationship between the logical storage unit and the physical storage block, and change the state of the physical storage block to the closed state. After obtaining the actual physical attributes, the system deducts the bad block capacity, system reserved overhead, and the amount of data already written from the total physical space of the physical storage block to obtain the actual remaining writable capacity, and returns this value as the query result to the host. In this way, the capacity value obtained by the host is an accurate value that has been physically corrected, effectively avoiding host-side write planning overflow or anomalies caused by invisible losses such as bad blocks. To prevent this binding behavior from interfering with the normal resource scheduling inside the virtual storage device, the system marks the state of the physical distributed storage block as pre-allocated at this time. This pre-allocated state has a specific functional limitation: during the storage device's Garbage Collection (GC) statistics and threshold calculation process, physical storage blocks in the pre-allocated state are considered idle, not occupied. This means that although the physical block is logically reserved for responding to capacity queries, from the perspective of the underlying resource manager, it still belongs to the resource pool that can be freely scheduled or included in the GC candidate range until actual data is written. This resolves the contradiction between the need for binding physical blocks for precise queries and the potential for resource hoarding due to binding physical blocks, ensuring that the query mechanism does not sacrifice overall system performance. When the host subsequently issues a write command to the logical storage unit, the system detects the actual I / O traffic and immediately switches the state of the corresponding physical storage block from the pre-allocated state to the allocated state (or open state). At this point, the physical storage block officially leaves the idle resource pool and is included in the normal user data management and GC statistics scope. This state transition ensures that actual resource hoarding only occurs when real business needs arise. As data continues to be written, when the available space of the physical storage block is exhausted, the system performs a block closing operation, sets its state to closed, and simultaneously removes its mapping relationship with the original logical storage unit.

[0061] Example 2, based on Example 1, further describes a method for querying the capacity of pre-allocated logical units.

[0062] In some possible implementations, physical storage blocks include: factory physical storage blocks present when the flash memory chip leaves the factory; running physical storage blocks generated during operation; all of the above physical storage blocks are marked and recorded in a physical storage block record table; when the system is powered on, according to the internal configuration of the solid-state drive, all physical storage blocks are organized into several physical storage blocks. If there is a mapping relationship between logical storage units and physical storage blocks, then each physical storage block logically corresponds to a logical storage unit.

[0063] In some possible implementations, determining whether a mapping relationship exists between logical storage units and physical storage blocks includes:

[0064] In response to a capacity query command for a logical storage unit, when querying the status of a logical storage unit, the solid-state drive looks up the mapping table between logical storage units and physical storage blocks based on the logical storage unit.

[0065] If the logical storage unit in the mapping table does not have a corresponding physical storage block, it is considered that a binding relationship has not yet been established between the logical storage unit and the physical storage block.

[0066] In some possible implementations, such as Figure 2 As shown, in a specific FDP system, the SSD internally supports only 8 RUs, but contains multiple Super Blocks (hundreds of them). The mapping relationship between RUs and Super Blocks is only generated when data is written. During the use of FDP, the host uses the I / O Management Receive command to obtain the SSD's operating information and returns the Reclaim Unit Handle Status, which is the statistical information of the RU pointed to by RUH. This mainly includes:

[0067] 1. Placement Identifier, which is the ID corresponding to the Placement Handle used by the host.

[0068] 2. Reclaim Unit Handle Identifier, which is the ID corresponding to the RUH (Reclaim Unit Handle) used by the SSD.

[0069] 3. Estimated Active Reclaim Unit Time Remaining (EARUTR): The remaining writable time of the reclaim unit. This is the remaining time that the RU currently pointed to by RUH can still be written to. After the remaining time is used up, RUH will switch to point to another RU.

[0070] 4. Reclaim Unit Available Media Writes (RUAMW): The amount of writable media available in the reclaimed unit. This represents the number of logical blocks that the RU currently points to can write. (Example query: Returns the status of all RUHs supported by the SSD. Some RUs have a mapping relationship with the Super Block, while others do not. If no mapping relationship exists, the returned writable space is the maximum space of the Super Block. General FDP only creates the mapping relationship between RUs and Super Blocks when writing data.)

[0071] In the FDP scenario, before the host performs an I / O write, there is no specific mapping relationship between the RU and the SSD management unit Super block. The number of writable logical blocks of the RU obtained by the command is the ReclaimUnit Nominal Size in the FDP effective configuration. However, this Size is a maximum value of the Super Block, not the space value of a specific Super Block. This may cause an anomaly in the Size returned when retrieving the RU Size during I / O write.

[0072] Therefore, this embodiment establishes a mapping relationship between logical storage units and the physical storage block, including:

[0073] The mapping table between logical storage units and physical storage blocks is looked up based on the state of the logical storage units.

[0074] If the logical storage unit in the mapping table is not bound to any physical storage block, then select the target physical storage block to establish the binding relationship between the logical storage unit and the target physical storage block, and set the state of the target physical storage block to the pre-allocated state;

[0075] In response to the presence of I / O data writes in the logical storage unit, the state of the target physical storage block is adjusted from FDP_OPEN to OPEN.

[0076] In some possible implementations, in response to the presence of I / O data writes in the logical storage unit, the state of the target physical storage block is adjusted from the FDP_OPEN state to the OPEN state, including:

[0077] By selecting a physical storage block inside the solid-state drive and writing it into the mapping table, the binding relationship between the logical storage unit and the physical storage block is established, and the status of the physical storage block is set to FDP_OPEN.

[0078] Return the physical space size of the physical storage block to the host, as the writable capacity of the logical storage unit;

[0079] Selecting a target physical storage block and establishing a binding relationship between the logical storage unit and the target physical storage block includes:

[0080] A free physical storage block is selected from inside the solid-state drive as the target physical storage block, and the correspondence between logical storage units and target physical storage blocks is written into a mapping table.

[0081] If subsequent IO data is written to this logical storage unit, the corresponding physical storage block status will be changed from FDP_OPEN to OPEN for internal management by the solid-state drive.

[0082] In some possible implementations, when a physical storage block is in the FDP_OPEN state, it indicates that the physical storage block has established a binding relationship with a logical storage unit, but has not yet received any user IO data writes;

[0083] When a physical storage block is in the OPEN state, it means that the physical storage block has been bound to a logical storage unit and has started receiving IO data writes.

[0084] In the FDP_OPEN state, the solid-state drive does not perform any state transition operations other than data writing on the physical storage block;

[0085] Only after receiving an actual IO write command for that logical storage unit will the state be changed from FDP_OPEN to OPEN, allowing the normal IO write process.

[0086] In some possible implementations, the block management state machine may include at least the OPEN state, CLOSE state, GC_Start state, GC_Complete state, ERASE state, and FREE state.

[0087] The FDP_OPEN state differs from the OPEN, CLOSE, GC_Start, GC_Complete, ERASE, and FREE states in the block management state machine.

[0088] The system typically supports multiple Runners (RUs), but a host may only use one RU at a time, generally not multiple RUs simultaneously. When a new query is added, a mapping relationship is created between the RU and the Super Block. To prevent an RU from occupying physical space without data being written, an FDP_OPEN state is added to distinguish it from the true OPEN state. If an RU fills up all the remaining Super Blocks on the disk, other RUs with an FDP_OPEN state can be used preferentially. This state is not included in the garbage collection (GC) process statistics; FDP_OPEN blocks are treated as FREE blocks when calculating GC thresholds, without affecting the threshold and process calculations. During power-on / off and formatting processes, blocks in the FDP_OPEN state need to be reset to FREE or restored.

[0089] In some possible implementations, such as Figure 3 As shown, the available capacity of the computational logical storage unit includes:

[0090] Obtain the capacity of a single flash memory die, the total number of flash memory dies, the amount of data inside the system, the capacity of bad blocks, and the amount of IO data written, and calculate the writable capacity of the logical storage unit.

[0091] The internal data volume of the system includes the mapping data from physical addresses to logical addresses and the data generated by XOR operations;

[0092] The usable capacity is calculated by multiplying the capacity of a single flash die by the total number of dies, and then subtracting the capacity occupied by physical address to logical address mapping data, XOR check data, bad block information, and written data. The formula is: RUSize = Capacity of a single DIE * Number of DIEs - Internal system data volume (capacity occupied by P2L and XOR data) - Bad block capacity - Written I / O data volume. (NAND Die: This is a physical chip in an SSD. An SSD typically contains multiple dies. P2L: Physical address to logical address mapping; XOR: Exclusive OR calculation.)

[0093] In some possible implementations, when the I / O Management Receive command queries the RUH status, there are two scenarios: If I / O has already been written, it's unnecessary to check for I / O writes; instead, checking for a mapping relationship can be used. Specifically, the remaining writable capacity of the current RU can be calculated directly based on the RU-Super Block mapping (establishing a mapping relationship between the current RU and the Super Block with the largest internal number and a Free status from among multiple Super Blocks; this mapping is temporary and one-to-one; once a Super Block is full, a block closing operation is performed, and if data continues to be written, the RU will re-establish a mapping relationship with another Super Block). If no I / O is being written, the mapping between the RU and Super Block is first created according to the FW's block selection strategy, and then the writable capacity of the current RU is calculated.

[0094] Example 3, as a possible implementation, provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements a method for querying the capacity of pre-allocated logical units.

[0095] Example 4, as a possible implementation, provides a computer-readable storage medium storing a computer program. When the program is executed by a processor, it implements a method for querying the capacity of pre-allocated logical units. The storage medium can be virtual storage and involves data interaction and transmission between GPUs, FPGAs, NPUs, MCUs, etc.

[0096] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for querying the capacity of pre-allocated logical units, characterized in that, include: In response to a capacity query command for a logical memory cell, query the capacity of the logical memory cell; Determine whether a mapping relationship exists between the logical storage unit and the physical storage block; If no mapping relationship exists, an idle physical storage block is obtained from the idle physical storage block pool, a mapping relationship is established between the logical storage unit and the physical storage block, and the state of the physical storage block is set to the pre-allocated state FDP_OPEN. Based on the established mapping relationship, obtain the actual physical attributes of the physical storage block; Based on the actual physical attributes of the allocated physical storage block, calculate and return the available capacity of the logical storage unit: Set the state of the allocated physical storage blocks to the pre-allocated state; Upon receiving a data write instruction for the logical storage unit, the pre-allocated state is changed to the allocated state; When the physical storage block is full, the mapping relationship between the logical storage unit and the physical storage block is released, and the state of the physical storage block is changed to the closed state.

2. The method for querying the capacity of pre-allocated logical units according to claim 1, characterized in that, The physical storage block includes: The physical storage blocks present at the time of manufacture of flash memory chips; Physical storage blocks generated during operation; All of the above physical storage blocks are marked and recorded in the physical storage block record table; When the system is powered on, all physical storage blocks are organized into several physical storage blocks according to the internal configuration of the solid-state drive. If there is a mapping relationship between the logical storage unit and the physical storage block, then each physical storage block logically corresponds to a logical storage unit.

3. The method for querying the capacity of pre-allocated logical units according to claim 1, characterized in that, The step of determining whether a mapping relationship exists between the logical storage unit and the physical storage block includes: In response to a capacity query command for a logical storage unit, when querying the status of a logical storage unit, the solid-state drive looks up the mapping table between logical storage units and physical storage blocks based on the logical storage unit. If the logical storage unit in the mapping table does not have a corresponding physical storage block, it is considered that a binding relationship has not yet been established between the logical storage unit and the physical storage block.

4. The method for querying the capacity of pre-allocated logical units according to claim 1, characterized in that, Establishing the mapping relationship between the logical storage unit and the physical storage block includes: The mapping table between the logical storage unit and the physical storage block is looked up based on the state of the logical storage unit; If the logical storage unit in the mapping table is not bound to any physical storage block, then a target physical storage block is selected to establish the binding relationship between the logical storage unit and the target physical storage block, and the state of the target physical storage block is set to the pre-allocated state. In response to the presence of I / O data writing in the logical storage unit, the state of the target physical storage block is adjusted from FDP_OPEN to OPEN.

5. The method for querying the capacity of pre-allocated logical units according to claim 4, characterized in that, The step of adjusting the state of the target physical storage block from the FDP_OPEN state to the OPEN state in response to the presence of I / O data write in the logical storage unit includes: By selecting a physical storage block inside the solid-state drive and writing it into the mapping table, the binding relationship between the logical storage unit and the physical storage block is established, and the status of the physical storage block is set to FDP_OPEN. Return the physical space size of the physical storage block to the host, as the writable capacity of the logical storage unit; The step of selecting a target physical storage block and establishing a binding relationship between the logical storage unit and the target physical storage block includes: A free physical storage block is selected from inside the solid-state drive as the target physical storage block, and the correspondence between the logical storage unit and the target physical storage block is written into the mapping table; If subsequent IO data is written to this logical storage unit, the corresponding physical storage block status will be changed from FDP_OPEN to OPEN for internal management by the solid-state drive.

6. The method for querying the capacity of pre-allocated logical units according to claim 5, characterized in that, When the physical storage block is in the FDP_OPEN state, it means that the physical storage block has established a binding relationship with a certain logical storage unit, but has not yet received any user IO data writes; When the physical storage block is in the OPEN state, it means that the physical storage block has been bound to a logical storage unit and has started to receive IO data writes. In the FDP_OPEN state, the solid-state drive does not perform any state transition operations other than data writing on the physical storage block; Only after receiving an actual IO write command for that logical storage unit will the state be changed from FDP_OPEN to OPEN, allowing the normal IO write process.

7. The method for querying the capacity of pre-allocated logical units according to claim 6, characterized in that, The block management state machine includes at least the OPEN state, the CLOSE state, the GC_Start state, the GC_Complete state, the ERASE state, and the FREE state. The FDP_OPEN state is different from the OPEN state, CLOSE state, GC_Start state, GC_Complete state, ERASE state, and FREE state in the block management state machine.

8. The method for querying the capacity of pre-allocated logical units according to claim 1, characterized in that, The calculation of the available capacity of the logical storage unit includes: Obtain the capacity of a single flash memory die, the total number of flash memory dies, the amount of data inside the system, the capacity of bad blocks, and the amount of IO data written, and calculate the writable capacity of the logical storage unit. The internal data volume of the system includes the mapping data from physical addresses to logical addresses and the data generated by XOR operations; The available capacity is obtained by multiplying the capacity of a single flash memory die by the total number of dies, and then subtracting the capacity occupied by physical address and logical address mapping data, XOR check data, bad block information, and written data.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the pre-allocated logical unit capacity query method as described in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the pre-allocated logical unit capacity query method as described in any one of claims 1 to 8.