Disk space management methods, devices, electronic equipment, and storage media

By using the correspondence between linked lists and vacant cell sequences in storage space management, the performance degradation caused by bitmap query in the prior art is solved, and the efficiency of rapid data writing and deletion is improved.

CN119357200BActive Publication Date: 2025-04-29NANJING YUNCHUANG LARGE DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411929882.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-29
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The use of bitmap query and management of data space in the prior art will lead to performance degradation, especially when the data volume is large and the data is frequently inserted, deleted, and updated.

Method used

By configuring a linked list, and forming a one-to-one correspondence relationship between the intermediate nodes of the linked list and the sequence of vacant units in the storage space, responding to changes in the vacant units in real time, and maintaining the correspondence between the linked list and the actual storage space.

Benefits of technology

It realizes the rapid finding suitable vacant units for data writing and deletion, avoids the problem of bitmap query performance and improves the efficiency of storage space management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357200B_ABST
    Figure CN119357200B_ABST
Patent Text Reader

Abstract

The present application discloses a disk space management method, device, electronic device and storage medium, the method includes configuring a linked list for the storage space to be managed, the linked list is composed of a starting node, a plurality of intermediate nodes and an end node connected in series in sequence; forming a one-to-one correspondence between the sequence of all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is composed of all vacant storage units in the storage space connected in series in sequence according to their relative positional relationship; in response to changes in the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, so that the sequence of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space. The present application solves the technical problems in the prior art of limited processing speed caused by using a single-layer bitmap for data management and affected query performance caused by using a multi-layer bitmap for data management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of storage space query, and in particular to a disk space management method, device, electronic device and storage medium. Background Art

[0002] The reliability and consistency of data in distributed storage are crucial. Data must be protected from loss and remain consistent even when various accidents occur (such as system crashes, power outages, server downtime, etc.). Therefore, a logging mechanism is introduced.

[0003] However, because the logging mechanism first writes data to the log before writing it to the storage layer, data is written twice, resulting in write amplification. To address this, a more efficient writing method is needed that balances logging functionality with manageable data volumes.

[0004] In the prior art, such as Figure 1 This shows a common data writing method, where data is separated and stored in different physical locations, based on primary data and metadata. A log is used to record all operational information, eliminating the need to record complete data blocks. The primary data storage area can be either an HDD or an SSD; metadata and log storage areas are preferably stored in different SSDs.

[0005] Using this approach, primary data is written directly to the raw device's storage area in large blocks, while metadata and logs are written in frequent, smaller blocks. Separate storage allows for faster sequential writes of primary data without slowing down the overall write speed. Metadata, as it manages data, is frequently accessed, queried, and updated, resulting in a longer lifecycle. Logs, on the other hand, are used to record temporary historical operations and can be cleared once the operation is complete, resulting in a shorter lifecycle. Therefore, storing metadata and logs separately allows for quick and stable metadata retrieval and updates without slowing down metadata efficiency. This also facilitates recording and clearing log information.

[0006] Among them, the space allocator is responsible for managing and allocating storage space on the raw device, ensuring that the available space can be efficiently utilized when writing data blocks and reducing fragmentation problems. Specifically, the space allocator divides the disk space into blocks of fixed size and uses a bitmap to manage the usage status of these blocks. In the prior art, there are Figure 2 The management method of the single-layer bitmap shown in Figure 3 The management method of multi-layer bitmap is shown.

[0007] When managing a single-layer bitmap, each block corresponds to a bit in the bitmap, and each block is assigned a value of 0 / 1, with 0 representing unallocated and usable, and 1 representing allocated and unusable. A significant drawback of using a single-layer bitmap is that each allocation requires traversing the entire bitmap memory to find an available location, which limits processing speed.

[0008] When managing multi-layer bitmaps, the bitmap has multiple layers, such as Figure 3 The bitmap shown in the figure includes three layers. Each block corresponds to a bit in the third layer, and each block is represented by 0 / 1 to indicate whether it is allocated or not. 0 means it is unallocated and can be used, and 1 means it is allocated and cannot be used again. The set of several consecutive bits in the third layer is represented as a bit in the second layer, and 00 represents that all subsets under this bit are unoccupied, 01 represents that all subsets under this bit are partially occupied, and 11 represents that all subsets under this bit are occupied. The set of several consecutive bits in the second layer is represented as a bit in the first layer, and 0 represents that all subsets under this bit are unoccupied, and 1 represents that all subsets under this bit are partially occupied. When using a multi-layer bitmap, each layer of the bitmap needs to be queried and traversed, especially when the amount of data is large, which will affect the query performance. In addition, when data needs to be frequently inserted, deleted, and updated, etc., the hierarchical structure of the bitmap needs to be frequently reorganized and adjusted, which will also lead to a decrease in read and write performance. Summary of the Invention

[0009] The embodiments of the present application provide a disk space management method, device, electronic device and storage medium, which are used to solve the technical problem in the prior art that the use of bitmap query and data space management will lead to performance degradation.

[0010] According to one aspect of the present application, a method for managing disk space is provided, comprising:

[0011] Configuring a linked list for the storage space to be managed, wherein the linked list is composed of a starting node, a plurality of intermediate nodes, and an end node connected in series in sequence;

[0012] Forming a one-to-one correspondence between all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is formed by serially connecting all vacant storage units in the storage space in order of their relative positions;

[0013] In response to changes in the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, so that the order of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space.

[0014] Furthermore, the vacant unit sequence is composed of all vacant storage units in the storage space connected in series according to their relative positional relationships, including:

[0015] Obtaining a bitmap corresponding to the storage space;

[0016] Obtaining from the bitmap all vacant bits corresponding to all vacant storage units in the storage space;

[0017] All of the vacant positions are connected in series according to their relative positional relationship to form the vacant unit sequence.

[0018] Furthermore, in response to a change in the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, including:

[0019] In response to a vacant storage cell in the storage space becoming a non-vacant storage cell, obtaining a reduced number of vacant bits in a real-time vacant cell sequence;

[0020] The intermediate nodes corresponding to the reduced vacant positions are deleted from the linked list, and the nodes at both ends of the deleted intermediate nodes are sequentially connected in series.

[0021] Furthermore, in response to a change in the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, including:

[0022] In response to a non-empty storage unit in the storage space becoming an empty storage unit, obtaining a newly added empty position in the real-time empty unit sequence and a preceding empty position and a following empty position adjacent to the newly added empty position;

[0023] Disconnecting at two intermediate nodes corresponding to the front vacant position and the rear vacant position in the linked list;

[0024] A corresponding intermediate node is configured for the newly added vacant storage unit and connected in series to the corresponding disconnected position of the linked list to re-establish the link.

[0025] Furthermore, the method further comprises:

[0026] In response to the storage space status query, querying information of intermediate nodes from the starting node to the end node of the linked list;

[0027] The information of the corresponding vacant storage unit is obtained according to the queried intermediate node information.

[0028] Furthermore, after obtaining the information of the corresponding vacant storage unit according to the queried intermediate node information, the following steps are included:

[0029] The data to be stored are written into the corresponding vacant storage units in the order of the intermediate nodes of the linked list from the beginning to the end.

[0030] Furthermore, obtaining information of corresponding vacant storage units according to the queried intermediate node information includes:

[0031] If the data to be stored is larger than the size of a single vacant storage unit, identifying whether the corresponding vacant storage units are continuous and the overall space size of several continuous corresponding vacant storage units according to the intermediate node information;

[0032] The data to be stored is stored in the overall space which is larger than the size thereof.

[0033] A second aspect of the present application provides a disk space management device, comprising:

[0034] A linked list configuration module is used to configure a linked list for the storage space to be managed, wherein the linked list is composed of a starting node, a plurality of intermediate nodes and an end node connected in series in sequence;

[0035] a relationship correspondence module, configured to establish a one-to-one correspondence between all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is formed by serially connecting all vacant storage units in the storage space in order of their relative positions;

[0036] The closing maintenance module is used to change the composition of the intermediate nodes of the linked list in response to changes in the vacant storage units in the storage space, so that the order of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space.

[0037] The third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method described in the first aspect of the present application.

[0038] The fourth aspect of the present application provides a computer-readable storage medium, which is used to store a computer program. When the computer program runs on a computer, the computer executes the method described in the first aspect of the present application.

[0039] Beneficial effects:

[0040] An embodiment of the present application discloses a method for managing disk space, which includes: configuring a linked list for the storage space to be managed, the linked list being composed of a starting node, several intermediate nodes and an end node connected in series in sequence; forming a one-to-one correspondence between the sequence of all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is composed of all vacant storage units in the storage space being connected in series in sequence according to their relative positional relationship; in response to changes in the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, so that the sequence of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space.

[0041] This application utilizes a linked list and a single-layer bitmap. The linked list maintains a real-time, sequential correspondence with each vacant storage unit in the actual storage space. Therefore, based on the linked list, it can quickly find the appropriate vacant unit for writing data and delete data from the unit that needs to be deleted. This application solves the technical problems of the existing technology that use a single-layer bitmap for data management results in limited processing speed, and that use of a multi-layer bitmap for data management results in poor query performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:

[0043] Figure 1 This is a schematic diagram of a data storage distribution method in the prior art.

[0044] Figure 2 It is a schematic diagram of a model for single-layer bitmap management in the prior art.

[0045] Figure 3 It is a schematic diagram of a model of multi-layer bitmap management in the prior art.

[0046] Figure 4 It is a schematic diagram of a disk space management model according to an embodiment of the present application.

[0047] Figure 5 This is a flowchart of a disk space management method according to an embodiment of the present application.

[0048] Figure 6 This is a model diagram of data writing in a disk space management method according to an embodiment of the present application.

[0049] Figure 7 This is a model diagram of data deletion in a disk space management method according to an embodiment of the present application.

[0050] Figure 8 This is a schematic diagram of a disk space management device according to an embodiment of the present application.

[0051] Figure 9 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0052] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0053] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0054] In the prior art, such as Figure 1 The diagram shows a data storage distribution scheme according to an embodiment of the present invention. A space allocator is used to divide storage space into fixed-size blocks for storing different data. Both the space allocator and the dedicated file system support both traditional large-capacity HDDs and high-performance SSDs. If processing speed is the primary consideration, all SSDs should be used. If cost-effectiveness is a concern, the dedicated file system can be partially allocated to SSDs, while the remainder can be allocated to HDDs.

[0055] like Figure 2 and Figure 3 As shown, a single-layer bitmap or a multi-layer bitmap is used to manage the usage status of these blocks, among which the most basic one is Figure 2 The single-layer bitmap management method shown in FIG. Figure 2 In the bitmap, each bit corresponds to each storage unit in the storage space, and the storage units are formed according to the different address positions. Figure 2 For the convenience of explanation, Figure 2 A blue storage cell indicates an empty space, and the corresponding bit in the bitmap is also blue, with a value of 0. Conversely, a red storage cell indicates a non-empty space, and the corresponding bit in the bitmap is also red, with a value of 1. The single-layer bitmap management method between storage cells has the disadvantages of being unable to quickly query space status and allocate space, and repeated traversal can lead to performance loss.

[0056] like Figure 4 As shown in FIG, a structural diagram of a disk space management method provided by an embodiment of the present application is shown. Figure 5FIG. 1 is a flow chart of a disk space management method provided by an embodiment of the present application. Figure 5 It can be seen that the data method includes the following steps:

[0057] Step S101: configure a linked list for the storage space to be managed, wherein the linked list is composed of a start node, a plurality of intermediate nodes, and an end node connected in series in sequence.

[0058] like Figure 4 As shown, the linked list is located at Figure 4 The top of the list is head, and null is the end node. The start and end nodes are only used to mark the start and end of the list, and do not correspond to specific storage units. There are intermediate nodes between the start and end nodes, and each intermediate node is connected in series from the start node to the end node, such as Figure 4 As shown, the front-back position relationship between two nodes is represented by a straight line with an arrow. In an actual linked list, different nodes can be numbered and a numbering rule can be set to reflect the relative position relationship of the nodes.

[0059] Step S102: forming a one-to-one correspondence between all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is formed by serially connecting all vacant storage units in the storage space in order of their relative positions.

[0060] like Figure 4 As shown, the storage space is Figure 4 A series of blocks marked in the middle and lower part, each block represents a storage unit. In this embodiment, each storage unit in the current state of the storage space is based on Figure 4 In the sequence formed from left to right, taking the first 16 storage cells as an example, the 1st to 5th, 9th to 10th, 12th to 13th, and 16th storage cells are all non-empty storage cells, while the 6th to 8th, 11th, and 14th to 15th storage cells are vacant storage cells, for a total of 5 vacant storage cells. Extracting all vacant storage cells while keeping their relative positions unchanged forms a vacant cell sequence, i.e., the current vacant cell sequence is 6-8-11-14-15. The first 5 intermediate nodes of the linked list corresponding to this part are: the first intermediate node corresponds to the 6th storage cell, the second intermediate node corresponds to the 8th storage cell, the third node corresponds to the 11th storage cell, the fourth node corresponds to the 14th storage cell, and the fifth node corresponds to the 15th storage cell.

[0061] The above correspondence relationship makes the intermediate nodes in the linked list represent corresponding vacant storage units. Such a correspondence relationship can be achieved by mapping the intermediate nodes of the linked list with the addresses of the corresponding vacant storage units, thereby reflecting the vacant storage units represented by each intermediate node and the relative position relationship in the linked list.

[0062] Step S103: In response to changes in the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, so that the order of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space.

[0063] Since the linked list needs to keep consistent with the number of empty storage units in real time, the linked list should be adjusted in real time in response to changes in the actual storage units. Such changes include the increase or decrease of empty storage units, so the intermediate nodes in the linked list also increase or decrease accordingly.

[0064] An embodiment of the present invention is based on the above-mentioned single-layer bitmap management, and configures a linked list. A unique correspondence is formed between the linked list and the bitmap, that is, only the vacant storage units in the bitmap are reflected in the linked list, and the linked list itself has a directional attribute due to its serial connection characteristics. Through this feature, the front-to-back order relationship of the above-mentioned vacant storage units is reflected, thereby converting a single-layer bitmap with both vacant storage units and non-vacant storage units into a linked list with only vacant storage units. It is sufficient to keep the update of the linked list consistent with the update of the bitmap at all times.

[0065] Since the storage space status can be reflected by the bitmap, such as Figure 4 As shown, the long stripe between the linked list and the storage space is a bitmap, and each state of the storage space on the bitmap corresponds to a state, which is represented by the corresponding arrow relationship between the bit and the storage unit in this embodiment. Therefore, in certain preferred embodiments, the vacant unit sequence is composed of all the vacant storage units in the storage space connected in series according to their relative positions, including:

[0066] Step S1021: Acquire a bitmap corresponding to the storage space.

[0067] Step S1022: Acquire from the bitmap all vacant bits corresponding to all vacant storage units in the storage space.

[0068] Step S1023: Connect all the vacant positions in series according to their relative positional relationship to form the vacant unit sequence.

[0069] like Figure 4As shown, from the bitmap, from left to right, the vacant bits in the first 16 bits are bits 6-8, bit 11, and bits 14-15, which correspond to the 6-8, 11, and 14-15 storage units in the storage space. Therefore, the above vacant bits are connected in series in order to form a vacant unit sequence of 6-8-11-14-15.

[0070] In some preferred embodiments, in response to a change in the number of vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, including:

[0071] Step S1031 : In response to a vacant storage unit in the storage space becoming a non-vacant storage unit, obtaining a reduced number of vacant bits in a real-time vacant unit sequence.

[0072] Step S1032: Delete the intermediate nodes corresponding to the reduced vacant positions from the linked list, and sequentially connect the nodes at both ends of the deleted intermediate nodes in series.

[0073] The method in the above embodiment provides a method for adjusting the corresponding linked list when the number of vacant storage cells decreases. When a vacant storage cell becomes a non-vacant storage cell, the corresponding bit in the real-time bitmap changes from vacant to non-vacant, and the resulting vacant cell sequence will also have a corresponding reduction in vacant bits. In this way, the corresponding relationship between the vacant cell sequence and the linked list can be used to delete intermediate nodes and then re-form the chain.

[0074] by Figure 6 For example, the arrow marked 1 indicates the correspondence between the current linked list and the bitmap. After that, the 6th and 7th bits from left to right in the bitmap, that is, the 1st intermediate node and the 2nd intermediate node in the corresponding linked list, change from empty to non-empty. Therefore, the arrow marked 2 in the linked list needs to be disconnected, that is, the original 1st intermediate node and the 2nd intermediate node need to be deleted from the linked list, and the starting node and the original 3rd intermediate node are directly connected to form a chain as indicated by the arrow marked 3 in the linked list.

[0075] In some preferred embodiments, in response to a change in the number of vacant storage units in the storage space, the composition of the intermediate nodes of the linked list changes, including:

[0076] Step S1033: in response to a non-empty storage unit in the storage space becoming an empty storage unit, obtaining a newly added empty position in the real-time empty unit sequence and a preceding empty position and a succeeding empty position adjacent to the newly added empty position;

[0077] Step S1034: disconnect at two intermediate nodes corresponding to the front vacant position and the back vacant position in the linked list;

[0078] Step S1035: configure a corresponding intermediate node for the newly added vacant storage unit, connect it in series to the corresponding break in the linked list, and re-link it.

[0079] The method in the above embodiment provides a method for adjusting the corresponding linked list when an additional vacant storage unit is added. When a non-vacant storage unit becomes a vacant storage unit, the corresponding bit in the real-time bitmap changes from non-vacant to vacant, thereby adding a corresponding vacant bit to the control unit sequence. At this point, the position in the linked list where the disconnection should occur can be found based on the vacant bits preceding and following the newly added vacant bit. The intermediate node corresponding to the newly added vacant bit can then be inserted at that position to reconnect the chain.

[0080] by Figure 7 For example, in the current state, the second block of storage units from left to right in the original storage space has changed from a non-empty storage unit to an empty storage unit, that is, the second bit of the corresponding bitmap has become an empty bit. Originally, since the second bit of the bitmap does not correspond to any intermediate node in the linked list, the newly added empty bit is the first bit found in the real-time empty unit sequence currently generated by the bitmap. Therefore, it is known that in the linked list, according to the arrow marked 2, the connection between the original starting node and the first intermediate node needs to be disconnected, and then according to the arrow marked 3, a new intermediate node needs to be inserted between the starting node and the original first intermediate node and the chain is re-formed.

[0081] Therefore, no matter whether the number of vacant storage units decreases or increases, the linked list can quickly implement the corresponding changes.

[0082] In some preferred embodiments, based on the relationship between the linked list and the storage space, this embodiment can more conveniently query the storage space status, so the method further includes:

[0083] Step S104 : In response to the storage space status query, query information of intermediate nodes from the starting node to the end node of the linked list.

[0084] Step S105: Obtain information of corresponding vacant storage units according to the queried intermediate node information.

[0085] In this way, the intermediate nodes can be queried from the starting node to the end node of the linked list. Since the intermediate nodes all correspond to empty storage units, there is no need to query non-empty storage units, which greatly improves the query efficiency and quickly realizes the query of storage space status. Based on the above query, free space can be allocated more quickly, avoiding performance loss caused by traversal.

[0086] Since each query starts from the starting node, vacant storage units can be checked in order and data can be written as needed. For example, if there are no special circumstances, storage units can be absorbed in order, thereby reducing the fragmentation of the entire storage space and improving the utilization of the storage space. Therefore, in some preferred embodiments, after obtaining the corresponding vacant storage unit information based on the queried intermediate node information, the following steps are included:

[0087] The data to be stored are written into the corresponding vacant storage units in the order of the intermediate nodes of the linked list from the beginning to the end.

[0088] In certain preferred embodiments, because the data written at one time varies in size and needs to be placed in the same or adjacent storage units, when some data is larger than a vacant storage unit, it is necessary to find some continuous storage unit space that can accommodate this data. Therefore, how to quickly find these data spaces that meet the requirements is the key to affecting write performance. Therefore, the method of obtaining the corresponding vacant storage unit information based on the queried intermediate node information includes:

[0089] Step S1051: If the data to be stored is larger than the size of a single vacant storage unit, identify whether the corresponding vacant storage units are continuous and the overall space size of several continuous corresponding vacant storage units according to the intermediate node information.

[0090] Step S1052: store the data to be stored in the overall space that is larger than its size.

[0091] by Figure 4 For example, when the size of the data to be written is less than or equal to the size of one storage unit, starting from the starting node of the linked list, searching for the first intermediate node can quickly find that the first intermediate node corresponds to the sixth storage unit, and the data can be written directly. The data writing method of this embodiment preferably performs aligned writing, that is, each time writing is performed from the next or multiple consecutive empty storage units adjacent to the non-empty storage unit, and when the data cannot fill the corresponding storage unit space, fill the storage unit with filling data. When the size of the data to be written is greater than the size of one storage unit, it is necessary to find several consecutive empty storage units until these empty storage units can continuously write the data to be written. At this time, the linked list can be used to quickly find where there are continuous control storage units. Since the intermediate nodes carry the information of the corresponding empty storage units, such as the disk location marked with the empty storage unit, it is possible to quickly determine whether several intermediate nodes correspond to continuous storage units in the storage space and the corresponding sizes, so as to quickly find the appropriate storage unit to complete the write.

[0092] Based on the same inventive concept as the above method embodiment, the present application embodiment also provides a disk space management device, such as Figure 8 The diagram shows a schematic diagram of the structure of a disk space management device. Figure 8 It can be seen that the disk space management device includes:

[0093] A linked list configuration module is used to configure a linked list for the storage space to be managed, wherein the linked list is composed of a starting node, a plurality of intermediate nodes and an end node connected in series in sequence;

[0094] a relationship correspondence module, configured to establish a one-to-one correspondence between all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is formed by serially connecting all vacant storage units in the storage space in order of their relative positions;

[0095] A relationship maintaining module is used to change the composition of the intermediate nodes of the linked list in response to changes in the vacant storage units in the storage space, so that the order of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space.

[0096] In some preferred embodiments, the relationship correspondence module is used to serially connect the vacant unit sequence according to the relative position relationship of all vacant storage units in the storage space, and the relationship correspondence module includes:

[0097] A bitmap acquisition module, used to acquire a bitmap corresponding to the storage space;

[0098] a vacant bit acquisition module, configured to acquire all vacant bits corresponding to all vacant storage units in the storage space from the bitmap;

[0099] The series connection module is used to connect all the vacant positions in series according to their relative position relationship to form the vacant unit sequence.

[0100] In some preferred embodiments, the closing and maintaining module is configured to change the composition of the intermediate nodes of the linked list in response to a change in the number of vacant storage units in the storage space, including:

[0101] a real-time vacant position acquisition module, configured to acquire reduced vacant positions in a real-time vacant unit sequence in response to a vacant storage unit in the storage space becoming a non-vacant storage unit;

[0102] The post-deletion serial connection module is used to delete the intermediate nodes corresponding to the reduced vacant positions from the linked list, and sequentially connect the nodes at both ends of the deleted intermediate nodes in series.

[0103] In some preferred embodiments, the closing and maintaining module is configured to change the composition of the intermediate nodes of the linked list in response to a change in the number of vacant storage units in the storage space, including:

[0104] a newly added vacant position acquisition module, configured to obtain, in response to a non-vacant storage unit in the storage space becoming a vacant storage unit, a newly added vacant position in the real-time vacant unit sequence and a preceding vacant position and a succeeding vacant position adjacent to the newly added vacant position;

[0105] A disconnection module, configured to disconnect at two intermediate nodes corresponding to the front vacant position and the rear vacant position in the linked list;

[0106] The re-chaining module is used to configure a corresponding intermediate node for the newly added vacant storage unit, connect it in series with the corresponding disconnection point of the linked list, and re-chain it.

[0107] In some preferred embodiments, the disk space management device further includes:

[0108] a query module, configured to query information of intermediate nodes from the starting node to the end node of the linked list in response to the storage space status query;

[0109] The vacant storage unit obtaining module is used to obtain the information of the corresponding vacant storage unit according to the queried intermediate node information.

[0110] In some preferred embodiments, the vacant storage unit obtaining module is configured to obtain information of corresponding vacant storage units according to the queried intermediate node information, and further comprises:

[0111] The sequential writing module is used to write the data to be stored into the corresponding vacant storage units in the order of the intermediate nodes of the linked list from the beginning to the end.

[0112] In some preferred embodiments, the vacant storage unit obtaining module is configured to obtain information of corresponding vacant storage units based on the queried intermediate node information, including:

[0113] a continuous identification module, configured to determine, if the data to be stored is larger than the size of the corresponding vacant storage unit, whether the corresponding vacant storage units are continuous and the overall space size of a plurality of continuous corresponding vacant storage units according to the intermediate node information;

[0114] The storage module is used to store the data to be stored in the overall space that is larger than the size of the storage module.

[0115] It should be noted that although several units or subunits of the device are mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, depending on the embodiment of the application, the features and functions of two or more units described above can be embodied in a single unit. Conversely, the features and functions of a single unit described above can be further divided and embodied by multiple units.

[0116] Based on the same inventive concept as the above-mentioned method embodiment, an embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the electronic device implements the disk space management method in the above-mentioned embodiment.

[0117] In one embodiment, the electronic device may be a server. In this embodiment, the structure of the electronic device may be as follows: Figure 9 As shown, it includes a memory 2001 , a communication module 2003 and one or more processors 2002 .

[0118] Memory 2001 is used to store computer programs executed by processor 2002. Memory 2001 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and programs required for running instant messaging functions, while the data storage area may store various instant messaging messages and operating instruction sets.

[0119] Memory 2001 may be a volatile memory, such as random-access memory (RAM); a non-volatile memory, such as read-only memory, flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or any other medium capable of carrying or storing a desired computer program in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 2001 may be a combination of the aforementioned memories.

[0120] The processor 2002 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 2002 is configured to implement the above-mentioned audio data processing method when calling the computer program stored in the memory 2001 .

[0121] The communication module 2003 is used to communicate with terminal devices and other servers.

[0122] The specific connection medium between the memory 2001, the communication module 2003 and the processor 2002 is not limited in the embodiment of the present application. Figure 9 In the embodiment, the memory 2001 and the processor 2002 are connected via a bus 2004. The bus 2004 is connected to the processor 2002 via a bus 2004. Figure 9 The arrows in the figure are used to illustrate the connection between the other components. The connection between the components is for illustrative purposes only and is not intended to be limiting. The bus 2004 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Figure 9 The diagram shows that only one arrow is used, but this does not mean that there is only one bus or one type of bus.

[0123] Based on the same inventive concept as the above-mentioned method embodiment, an embodiment of the present invention further provides a computer-readable storage medium for storing a computer program. When the computer program is executed on a computer, the electronic device implements the control method in the above-mentioned embodiment. The computer-readable storage medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with 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 thereof.

[0124] Based on the same inventive concept as the above-mentioned method embodiment, an embodiment of the present invention further provides a computer program product, which includes a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the control method according to the various exemplary embodiments of the present application described above in this specification. The program product can adopt any combination of one or more readable media. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the commands executed by the processor of the computer or other programmable data processing device generate commands for implementing the steps in the process Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.

Claims

1. A method for managing disk space, characterized in that: A linked list is configured for the storage space to be managed, wherein the linked list is composed of a starting node, a plurality of intermediate nodes and an end node connected in series in sequence; Forming a one-to-one correspondence between all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is formed by connecting all vacant storage units in the storage space in series according to the relative position relationship order, including: obtaining a bitmap corresponding to the storage space; obtaining all vacant bits corresponding to all vacant storage units in the storage space from the bitmap; connecting all the vacant bits in series according to the relative position relationship order to form the vacant unit sequence; In response to changes in vacant storage units in the storage space, the update of the linked list is kept consistent with the update of the bitmap, that is, the composition of the intermediate nodes of the linked list is changed so that the sequence of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space; The method further comprises: In response to the storage space status query, query the information of the intermediate nodes from the starting node to the end node of the linked list; Obtaining information of corresponding vacant storage units according to the queried intermediate node information; Wherein, after obtaining the information of the corresponding vacant storage unit according to the queried intermediate node information, the following steps are included: Writing the data to be stored into the corresponding vacant storage units in the order of the intermediate nodes of the linked list from the beginning to the end; Among them, the method of obtaining the information of the corresponding vacant storage unit based on the queried intermediate node information includes: if the data to be stored is larger than the size of a single vacant storage unit, identifying whether the corresponding vacant storage unit is continuous and the overall space size of several continuous corresponding vacant storage units based on the intermediate node information; and storing the data to be stored in the overall space that is larger than its size.

2. The method according to claim 1, characterized in that: In response to a change in the vacant storage unit in the storage space, the composition of the intermediate nodes of the linked list changes, including: In response to a vacant storage unit in the storage space becoming a non-vacant storage unit, obtaining a reduced vacant position in a real-time vacant unit sequence; The intermediate nodes corresponding to the reduced vacant positions are deleted from the linked list, and the nodes at both ends of the deleted intermediate nodes are sequentially connected in series.

3. The method according to claim 1, characterized in that: In response to a change in the vacant storage unit in the storage space, the composition of the intermediate nodes of the linked list changes, including: In response to a non-empty storage unit in the storage space becoming an empty storage unit, obtaining a newly added empty position in the real-time empty unit sequence and a preceding empty position and a succeeding empty position adjacent to the newly added empty position; Disconnecting at two intermediate nodes corresponding to the front vacant position and the rear vacant position in the linked list; A corresponding intermediate node is configured for the newly added vacant storage unit and connected in series at the corresponding disconnection point of the linked list to re-link the link.

4. The method according to claim 1, characterized in that: The method further comprises: In response to the storage space status query, query the information of the intermediate nodes from the starting node to the end node of the linked list; The information of the corresponding vacant storage unit is obtained according to the queried intermediate node information.

5. A disk space management device, characterized in that: include: A linked list configuration module, used to configure a linked list for the storage space to be managed, wherein the linked list is composed of a starting node, a plurality of intermediate nodes and an end node connected in series in sequence; A relationship correspondence module, used for forming a one-to-one correspondence between the sequence of all intermediate nodes of the linked list and a vacant unit sequence; wherein the vacant unit sequence is composed of all vacant storage units in the storage space connected in series according to the relative position relationship between each other; A closing and maintaining module is used to keep the update of the linked list consistent with the update of the bitmap in response to the change of the vacant storage units in the storage space, and the composition of the intermediate nodes of the linked list changes, so that the sequence of the intermediate nodes of the linked list always maintains a one-to-one correspondence with the real-time vacant unit sequence of the storage space; A query module, configured to query information of intermediate nodes from the starting node to the end node of the linked list in response to the storage space status query; A vacant storage unit obtaining module is used to obtain the corresponding vacant storage unit information according to the queried intermediate node information; The vacant storage unit obtaining module is used to obtain the information of the corresponding vacant storage unit according to the queried intermediate node information, and comprises: A sequential writing module, used for writing the data to be stored into the corresponding vacant storage units in the order of the intermediate nodes of the linked list from the beginning to the end; The vacant storage unit obtaining module is used to obtain the corresponding vacant storage unit information according to the queried intermediate node information, including: A continuous identification module, used to determine whether the corresponding vacant storage units are continuous and the overall space size of several continuous corresponding vacant storage units according to the intermediate node information if the data to be stored is larger than the size of the corresponding vacant storage units; The storage module is used to store the data to be stored in the overall space which is larger than its size.

6. 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 computer program, the electronic device implements the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data processing method and device

    CN115016728A