Storage space allocation method and device, equipment and medium

By dividing the storage space into multiple blocks and using merged trees and allocation trees for management, the problems of fragmentation and allocation efficiency in the storage system are solved, and efficient storage space allocation and performance improvement are achieved.

CN120196280APending Publication Date: 2025-06-24CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510270441.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

In existing storage systems, due to the small management granularity, it is easy to cause fragmentation, and the free space allocation management overhead is large, the allocation efficiency is low, which affects storage performance.

Method used

By dividing the storage space into multiple blocks, inserting the block identifier of the free block into the merge tree, determining the continuous block segments based on the merge tree, inserting the block segment information into the allocation tree, responding to the space application request, querying the continuous target blocks that meet the size of the space to be applied from the allocation tree to realize storage space allocation.

Benefits of technology

Effectively avoid space fragmentation, improve storage space allocation efficiency and storage system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196280A_ABST
    Figure CN120196280A_ABST
Patent Text Reader

Abstract

The invention relates to a storage space distribution method and device, equipment and a medium, and the method comprises the steps: dividing a storage space into a plurality of blocks, and inserting block identifiers of free blocks in the plurality of blocks into a merging tree; wherein leaf nodes of the merge tree are linked according to the increasing sequence of the block identifiers; determining all continuous block segments according to the combination tree, and inserting block segment information of the continuous block segments into a distribution tree; nodes in the distribution tree correspond to the continuous block segments; in response to a space application request, querying continuous target blocks meeting the size of a space to be applied from the distribution tree; and responding to the space application request according to the continuous target block so as to realize storage space distribution. According to the technical scheme, space fragmentation is avoided, and the distribution efficiency of the storage space and the performance of the storage system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of cloud computing technology, and in particular, to a storage space allocation method, apparatus, device, and medium. Background Art

[0002] In a storage system, to improve the utilization rate of storage space, the storage space is usually divided into fine-grained units for management. In specific implementation, due to the small management granularity, fragmentation is likely to occur, and the management overhead of free space allocation is large, and the allocation efficiency is low, which affects the storage performance. Summary of the Invention

[0003] To solve the above technical problems, the present disclosure provides a storage space allocation method, apparatus, device, and medium.

[0004] In a first aspect, an embodiment of the present disclosure provides a storage space allocation method, including:

[0005] Dividing a storage space into multiple blocks, and inserting block identifiers of free blocks among the multiple blocks into a merge tree; wherein, leaf nodes of the merge tree are linked in an ascending order of the block identifiers;

[0006] Determining all continuous block segments according to the merge tree, and inserting block segment information of the continuous block segments into an allocation tree; nodes in the allocation tree correspond to the continuous block segments;

[0007] In response to a space application request, querying continuous target blocks that meet the size of the space to be applied for from the allocation tree;

[0008] Responding to the space application request according to the continuous target blocks to implement storage space allocation.

[0009] In a second aspect, an embodiment of the present disclosure provides a storage space allocation apparatus, including:

[0010] A first generation module, configured to divide a storage space into multiple blocks, and insert block identifiers of free blocks among the multiple blocks into a merge tree; wherein, leaf nodes of the merge tree are linked in an ascending order of the block identifiers;

[0011] A second generation module, configured to determine all continuous block segments according to the merge tree, and insert block segment information of the continuous block segments into an allocation tree; nodes in the allocation tree correspond to the continuous block segments;

[0012] A query module, configured to, in response to a space application request, query continuous target blocks that meet the size of the space to be applied for from the allocation tree;

[0013] An allocation module, configured to respond to the space application request according to the continuous target blocks to implement storage space allocation.

[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor; a memory for storing executable instructions executable by the processor; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the storage space allocation method described in the first aspect above.

[0015] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, where the storage medium stores a computer program, and when the computer program is executed by a processor, the storage space allocation method described in the first aspect above is implemented.

[0016] The technical solution provided by the embodiment of the present disclosure has the following advantages compared with the prior art: By dividing the storage space into multiple blocks, inserting the block identifiers of the free blocks among the multiple blocks into a merge tree, determining all continuous block segments according to the merge tree, and inserting the block segment information of the continuous block segments into an allocation tree. Furthermore, in response to a space application request, querying for continuous target blocks that meet the size of the space to be applied for from the allocation tree, and responding to the space application request according to the continuous target blocks to implement storage space allocation. Thus, the storage space is divided into multiple blocks, the continuous blocks are merged using a merge tree, and the blocks are allocated using an allocation tree to implement storage space allocation. In addition, by further dividing the blocks applied for from the allocation tree into segments for allocation and returning the space based on the segments, space fragmentation is avoided, and the allocation efficiency of the storage space and the performance of the storage system are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present disclosure and used together with the specification to explain the principles of the present disclosure.

[0018] To more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0019] Figure 1 It is a flowchart of a storage space allocation method provided by an embodiment of the present disclosure;

[0020] Figure 2 It is a schematic diagram of a merge tree and an allocation tree provided by an embodiment of the present disclosure;

[0021] Figure 3 It is a flowchart of another storage space allocation method provided by an embodiment of the present disclosure;

[0022] Figure 4A schematic diagram of storing allocated blocks provided by an embodiment of the present disclosure;

[0023] Figure 5 A structural schematic diagram of a storage space allocation device provided by an embodiment of the present disclosure. Detailed implementation manners

[0024] In order to more clearly understand the above objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that, without conflict, the embodiments of the present disclosure and the features in the embodiments may be combined with each other.

[0025] Many specific details are set forth in the following description in order to fully understand the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, rather than all of the embodiments.

[0026] Figure 1 A flowchart of a storage space allocation method provided by an embodiment of the present disclosure. The method provided by the embodiment of the present disclosure can be executed by a storage space allocation device, and the device can be implemented by software and / or hardware and can be integrated in any electronic device with computing capabilities.

[0027] As shown in Figure 1 the storage space allocation method provided by the embodiment of the present disclosure may include:

[0028] Step 101: Divide the storage space into multiple blocks, and insert the block identifiers of the free blocks among the multiple blocks into a merge tree.

[0029] In this embodiment, the storage space is divided into multiple blocks, and a merge tree is set up to store the free blocks therein. Among them, the merge tree is implemented by a B+ tree. The leaf nodes of the B+ tree are linked in ascending order of the keywords. By inserting the block identifier on the disk space of the free block as the key into the merge tree, the leaf nodes of the merge tree are linked in ascending order of the block identifier, and continuous block segments can be quickly obtained.

[0030] As an example, the structure of the merge tree is as shown in Figure 2 Among them, the intermediate nodes of the merge tree can be the range of block identifiers corresponding to the leaf nodes below them. For example, the first two intermediate nodes are [1, 5] and [6, 10] respectively, and the first ten leaf nodes respectively correspond to the free blocks with block identifiers from 1 to 10. The intermediate nodes can also have multiple layers, which is not limited herein.

[0031] Step 102: Determine all continuous block segments according to the merge tree, and insert the block segment information of the continuous block segments into an allocation tree.

[0032] In this embodiment, the nodes in the allocation tree correspond to continuous block segments. For example, the structure of the allocation tree is as shown in Figure 2 Each node corresponds to a continuous block segment. Optionally, the block segment information includes the block segment length and the starting block identifier of the block segment. Inserting the block segment information of the continuous block segment into the allocation tree includes: obtaining the block segment length and the starting block identifier of each continuous block segment, and using the block segment length and the starting block identifier of each continuous block segment as a node to generate the allocation tree.

[0033] As an example, the allocation tree is based on a search binary tree. Using the block segment length of the continuous block segment as the key and the starting block identifier as the value, inserting the continuous block segment into the allocation tree can quickly obtain the block space that meets the requirements according to the number of continuous blocks to be applied, improving the allocation efficiency of the storage space. In this example, after deploying the storage system, all free blocks are inserted into the merge tree, and the continuous free blocks are merged through the merge tree. The continuous block segments are inserted into the search binary tree and allocated through the search binary tree. For example, when all the storage space in the storage system is free, there is only one node (N, 0) in the allocation tree, where N represents the total number of blocks in the storage space and 0 represents the starting block identifier of the storage space. Another example is that for the node (100, 1) in the allocation tree, it represents a continuous block segment composed of 100 blocks, and the starting block identifier is 1.

[0034] Step 103: In response to the space application request, query the continuous target block that meets the size of the space to be applied from the allocation tree.

[0035] Step 104: Respond to the space application request according to the continuous target block to implement storage space allocation.

[0036] In this embodiment, the space application request may include the size of the space to be applied. According to the size of the space to be applied and the size of each block, query the continuous block segment that meets the size of the space to be applied from the allocation tree, and then obtain the continuous target block that meets the size of the space to be applied according to the continuous block segment, so as to respond to the space application request according to the continuous target block and implement storage space allocation.

[0037] Optionally, delete the block identifier of the continuous target block from the merge tree to generate an updated merge tree. Furthermore, according to the updated merge tree, update the allocation tree. The step of generating the updated merge tree may refer to the step of inserting the block identifier of the free block into the merge tree. The step of updating the allocation tree may regenerate the allocation tree according to the updated merge tree, or update the current node of the allocation tree. There is no limitation here.

[0038] As an example, assume that 10 blocks are to be applied for. The smallest continuous block segment that meets the requirements is found in the block allocation tree as node (100, 1). This continuous block segment is split into two parts: 1 - 10 and 11 - 100. The blocks with block identifiers from 1 to 10 are allocated as continuous target blocks, and the continuous target blocks with block identifiers from 1 to 10 are deleted from the merge tree. After deletion, a new continuous block segment is obtained through the merge tree and updated into the allocation tree. The updated node includes (90, 11).

[0039] According to the technical solution of the embodiments of the present disclosure, by dividing the storage space into multiple blocks, inserting the block identifiers of the free blocks among the multiple blocks into the merge tree, determining all continuous block segments according to the merge tree, and inserting the block segment information of the continuous block segments into the allocation tree. Furthermore, in response to a space application request, querying for continuous target blocks that meet the size of the space to be applied for from the allocation tree, and responding to the space application request according to the continuous target blocks to achieve storage space allocation. Thus, by dividing the storage space into multiple blocks, using the merge tree to merge continuous blocks, and using the allocation tree to allocate blocks to achieve storage space allocation, space fragmentation is avoided, and the allocation efficiency of the storage space and the performance of the storage system are improved.

[0040] Based on the above embodiments, Figure 3 FIG. is a flowchart of a further optimization method for the above - mentioned storage space allocation method provided by the embodiments of the present disclosure, Figure 3 showing the space allocation process.

[0041] In this embodiment, after dividing the storage space into multiple blocks, each block is further divided into multiple segments. Optionally, the size of a block is 128K, and the size of a segment is 4K. Since the user's read - write I / O is in 4K granularity, the block is further subdivided into segments with a granularity of 4K. During the space allocation process, the storage space is applied for in units of segments.

[0042] During the allocation process, a current block pointer and a current segment pointer are set. Among them, the current block pointer points to the currently allocated block, and the current segment pointer points to the currently allocated segment.

[0043] In this embodiment, responding to the space application request according to the continuous target blocks includes: starting from the currently allocated segment on the currently allocated block, sequentially allocating the remaining segments on the currently allocated block in a preset order; when the remaining segments on the currently allocated block have been allocated, obtaining a block from the continuous target blocks as the currently allocated block, and updating the current block pointer and the current segment pointer until the size of the space to be applied for is allocated completely.

[0044] As an example, at the first allocation, block 0 is obtained as the current allocation block, the current block pointer points to block 0, and the current segment pointer points to the first segment of block 0. When allocating, the remaining segments on block 0 are sequentially allocated in the front-to-back order starting from the first segment, and the current segment pointer is updated in real time until all segments on block 0 are allocated. Then, block 1 is obtained as the current allocation block, the current block pointer is updated to point to block 1, and the current segment pointer is updated to point to the first segment of block 1. In this example, after obtaining the newly allocated block, it is integrated according to the segments applied by the user. Finally, the number of blocks with unallocated segments completely is 0 or 1. If it is 1, then this block is used as the current allocation block. If it is 0, then another block is applied for as the current allocation block.

[0045] As another example, when this space application request is made, the current block pointer points to block M, and the current segment pointer points to segment N, where segment N is a middle segment of block M. According to the currently allocated segment N, it is judged whether the remaining segment space of the current allocation block M reaches the size of the space to be applied. If so, then directly allocate the remaining segments on block M in the front-to-back order starting from segment N until the size of the space to be applied is allocated, and update the current segment pointer to the current allocation segment position. At this time, there is no need to obtain continuous target blocks through the allocation tree. Otherwise, query a specified number of continuous block numbers through the allocation tree to obtain continuous target blocks, remove the block identifiers of the continuous target blocks from the merge tree and update the allocation tree, and allocate sequentially until the size of the space to be applied is allocated, and update the current block pointer and the current segment pointer. Optionally, when the size of the space to be applied is allocated, if there are no remaining segments on the current allocation block that have not been allocated, then obtain a block from the allocation tree as the current allocation block. If there are remaining segments on the current allocation block that have not been allocated, then the current allocation block is still retained.

[0046] Optionally, after querying continuous target blocks that meet the size of the space to be applied from the allocation tree, insert the continuous target blocks into the allocated block hash table for quick query when returning. The allocated block hash table is as follows Figure 4 shown.

[0047] In one embodiment of the present disclosure, after data in the storage system is deleted, the corresponding storage space is released, and a space return request is initiated. Among them, the space return is performed in units of segments. In response to the space return request, the allocated block hash table is queried according to the block identifier corresponding to the segment to be returned to obtain the block information corresponding to the segment to be returned. Furthermore, according to the block information, the flag bit corresponding to the segment to be returned among all the corresponding flag bits is set to the returned flag. Optionally, the block identifiers of the allocated blocks are stored in the allocated block hash table to retrieve the allocated blocks through the hash table. For each allocated block, a segment flag bit table for all segments in the block is set. The segment flag bit table includes the return status of each segment, and the return status includes the returned status and the unreturned status. For the segment to be returned, the corresponding segment flag bit table is queried through the corresponding block identifier, and then the return status of the segment to be returned in the segment flag bit table is set to the returned status.

[0048] In this embodiment, when it is detected that all the flag bits of any allocated block in the allocated block hash table are the returned flags, the allocated block is deleted from the allocated block hash table; the block identifier of the allocated block is inserted into the merge tree to update the merge tree; according to the updated merge tree, the allocation tree is updated. Among them, the implementation manners of updating the merge tree and updating the allocation tree can refer to the foregoing embodiments and will not be elaborated here.

[0049] It should be noted that the segments on the block are allocated from front to back. Even if some segments that have been allocated but then returned in the block will not be reallocated until the entire block is returned. The current block pointer points to the current allocated block, that is, the block that has been allocated but has unallocated segments on it. The current segment pointer points to the current allocated segment in the current allocated block, that is, the segments after the current segment pointer are unallocated, and the segments before are allocated, or allocated and returned. The allocation of segments will only be performed after the current segment pointer.

[0050] In the embodiments of the present disclosure, by dividing the storage space into blocks and further dividing the blocks into segments, when allocating the storage space, the segments are allocated in order within the block, and a hash table is used to retrieve the allocated blocks, further reducing space fragmentation, as well as improving the recycling efficiency and the performance of the storage system.

[0051] Figure 5 This is a schematic structural diagram of a storage space allocation device provided by the embodiments of the present disclosure, as Figure 5 shown, the storage space allocation device includes: a first generation module 51, a second generation module 52, a query module 53, and an allocation module 54.

[0052] The first generation module 51 is used to divide the storage space into multiple blocks and insert the block identifiers of the free blocks among the multiple blocks into the merge tree; among them, the leaf nodes of the merge tree are linked in ascending order of the block identifiers.

[0053] A second generation module 52, configured to determine all continuous block segments according to the merge tree, and insert the block segment information of the continuous block segments into an allocation tree; nodes in the allocation tree correspond to the continuous block segments;

[0054] A query module 53, configured to, in response to a space application request, query continuous target blocks that meet the size of the space to be applied for from the allocation tree;

[0055] An allocation module 54, configured to respond to the space application request according to the continuous target blocks, so as to implement storage space allocation.

[0056] In an embodiment of the present disclosure, the second generation module 52 is specifically configured to:

[0057] Obtain the block segment length and start block identifier of each continuous block segment;

[0058] Based on a binary search tree, generate an allocation tree with the block segment length and start block identifier of each continuous block segment as a node.

[0059] In an embodiment of the present disclosure, the apparatus further includes:

[0060] A first update module, configured to delete the block identifier of the continuous target block from the merge tree, so as to generate an updated merge tree;

[0061] Update the allocation tree according to the updated merge tree.

[0062] In an embodiment of the present disclosure, each block is divided into multiple segments, a current block pointer points to the current allocated block, and a current segment pointer points to the current allocated segment. The allocation module 54 is specifically configured to:

[0063] Starting from the current allocated segment on the current allocated block, sequentially allocate the remaining segments on the current allocated block in a preset order;

[0064] When the remaining segments on the current allocated block have been allocated, obtain a block from the continuous target blocks as the current allocated block, and update the current block pointer and the current segment pointer until the size of the space to be applied for is allocated.

[0065] In an embodiment of the present disclosure, the apparatus further includes:

[0066] A storage module, configured to insert the continuous target blocks into an allocated block hash table.

[0067] In an embodiment of the present disclosure, the apparatus further includes:

[0068] A return module, configured to, in response to a space return request, query an allocated block hash table according to the block identifier corresponding to the segment to be returned, so as to obtain block information corresponding to the segment to be returned;

[0069] According to the block information, set the flag bit corresponding to the segment to be returned among all the corresponding flag bits to a returned flag.

[0070] In an embodiment of the present disclosure, the device further includes:

[0071] A second update module, configured to, when it is detected that all the flag bits of any allocated block in the allocated block hash table are returned flags, delete the allocated block from the allocated block hash table;

[0072] Insert the block identifier of the allocated block into the merge tree to update the merge tree;

[0073] Update the allocation tree according to the updated merge tree.

[0074] The storage space allocation device provided in the embodiments of the present disclosure can execute any storage space allocation method provided in the embodiments of the present disclosure, and has functional modules and beneficial effects corresponding to the execution of the method. The content not described in detail in the device embodiments of the present disclosure can be referred to the description in any method embodiment of the present disclosure.

[0075] An electronic device provided in an embodiment of the present disclosure, the electronic device includes one or more processors and a memory. The processor may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to execute desired functions. The memory may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory, etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage media, and the processor may run the program instructions to implement the method of the above embodiments of the present disclosure and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage media.

[0076] In one example, the electronic device may further include: an input device and an output device, and these components are interconnected through a bus system and / or other forms of connection mechanisms. In addition, the input device may include, for example, a keyboard, a mouse, and so on. The output device may output various information to the outside, including the determined distance information, direction information, and so on. The output device may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, and so on. In addition, according to specific application scenarios, the electronic device may further include any other appropriate components such as a bus, an input / output interface, and so on.

[0077] In addition to the above methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions that cause a processor to execute any method provided by the embodiments of the present disclosure when the computer program instructions are run by the processor.

[0078] The computer program product may be written in any combination of one or more programming languages for programming code to perform the operations of the embodiments of the present disclosure. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The programming code may be executed entirely on the user computing device, partially on the user device, executed as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0079] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium, on which computer program instructions are stored, and the computer program instructions cause a processor to execute any method provided by the embodiments of the present disclosure when the computer program instructions are run by the processor.

[0080] The computer-readable storage medium may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0081] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.

[0082] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.

Claims

1. A storage space allocation method, characterized in that: The method comprises: Divide the storage space into a plurality of blocks, and insert the block identifiers of the free blocks in the plurality of blocks into a merge tree; wherein the leaf nodes of the merge tree are linked in the order of increasing the block identifiers; Determine all continuous blocks according to the merge tree, and insert block information of the continuous blocks into an allocation tree; the nodes in the allocation tree correspond to the continuous blocks; In response to the space application request, querying the allocation tree for continuous target blocks that meet the size of the space to be applied for; The space application request is responded to according to the continuous target block to implement storage space allocation.

2. The method according to claim 1, characterized in that The inserting the block information of the continuous block into the allocation tree comprises: Get the block length and starting block identifier of each continuous block segment; Based on the search binary tree, the allocation tree is generated with the block length and the start block identifier of each continuous block segment as a node.

3. The method according to claim 2, characterized in that After searching the allocation tree for continuous target blocks that satisfy the size of the space to be applied for, the method further includes: Deleting the block identifiers of the continuous target blocks from the merge tree to generate an updated merge tree; The allocation tree is updated according to the updated merged tree.

4. The method according to claim 1, characterized in that Each of the blocks is divided into a plurality of segments, a current block pointer points to a current allocation block, and a current segment pointer points to a current allocation segment, and the responding to the space application request according to the continuous target blocks includes: Starting from the current allocation segment on the current allocation block, allocating the remaining segments on the current allocation block in sequence according to a preset order; When the remaining segments on the current allocation block have been allocated, a block is obtained from the continuous target blocks as the current allocation block, and the current block pointer and the current segment pointer are updated until the allocation of the space size to be applied is completed.

5. The method according to claim 4, characterized in that After searching the allocation tree for continuous target blocks that satisfy the size of the space to be applied for, the method further includes: The consecutive target blocks are inserted into the allocated block hash table.

6. The method according to claim 5, characterized in that The method further comprises: In response to the space return request, query the allocated block hash table according to the block identifier corresponding to the to-be-returned segment to obtain block information corresponding to the to-be-returned segment; According to the block information, the flag bit corresponding to the to-be-returned segment among all corresponding flag bits is set as a returned flag.

7. The method according to claim 6, characterized in that The method further comprises: When it is detected that all flag bits of any allocated block in the allocated block hash table are the returned flags, the allocated block is deleted from the allocated block hash table; Inserting the block identifier of the allocated block into the merge tree to update the merge tree; The allocation tree is updated according to the updated merged tree.

8. A storage space allocation device, characterized in that: include: A first generating module is used to divide the storage space into a plurality of blocks, and insert the block identifiers of the free blocks in the plurality of blocks into a merge tree; wherein the leaf nodes of the merge tree are linked in the order of increasing the block identifiers; A second generation module is used to determine all continuous blocks according to the merge tree, and insert the block information of the continuous blocks into an allocation tree; the nodes in the allocation tree correspond to the continuous blocks; A query module, configured to query, in response to a space application request, continuous target blocks satisfying the size of the space to be applied for from the allocation tree; The allocation module is used to respond to the space application request according to the continuous target block to implement storage space allocation.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the storage space allocation method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the storage space allocation method described in any one of claims 1 to 7 is implemented.