Disk space management method and device, electronic equipment and storage medium

By configured the linked list in the storage space and renewed its corresponding relationship in real time, the performance decline caused by the management caused by the management in the existing technology, and the efficient data writing and deletion operation was realized.

CN119357200AActive Publication Date: 2025-01-24NANJING YUNCHUANG LARGE DATA TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

The use of bitmap query and management of data space in the prior art can lead to performance degradation, especially when processing large amounts of data and frequent insertion, deletion and update operations.

Method used

By configuring a linked list and forming a one-to-one correspondence between the intermediate nodes of the linked list and the vacant units in the storage space, real-time response to changes in vacant units ensures that the linked list is always consistent with the sequence of vacant units in the actual storage space.

Benefits of technology

This method can quickly find suitable vacant units for data writing and deletion, avoid the performance bottleneck of bitmap query, and improve the efficiency of data management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357200A_ABST
    Figure CN119357200A_ABST
Patent Text Reader

Abstract

The invention discloses a disk space management method and device, electronic equipment and a storage medium, and the method comprises the steps that a linked list is configured for a to-be-managed storage space, and the linked list is formed by sequentially connecting a starting node, a plurality of intermediate nodes and an end node in series; forming a one-to-one correspondence relationship between all intermediate node sequences of the linked list and a vacant unit sequence; wherein the vacant unit sequence is formed by sequentially connecting all vacant storage units in the storage space in series according to the relative position relation of the vacant storage units; in response to the change of the vacant storage units in the storage space, the composition of the intermediate nodes of the linked list is changed, so that the sequence of the intermediate nodes of the linked list is always kept in one-to-one correspondence with the sequence of the real-time vacant units in the storage space. The technical problems that in the prior art, the processing speed is limited due to the fact that data management is conducted through a single-layer bitmap, and the query performance is affected due to the fact that data management is conducted through a multi-layer bitmap are solved.
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 able to be preserved and remain consistent even when various accidents (such as system crashes, power outages, server downtime, etc.) occur. Therefore, a log mechanism is introduced.

[0003] However, since the log mechanism will write data to the storage layer only after the data is successfully written to the log, the data is written twice, resulting in write amplification. In order to change the above situation, it is necessary to design a more efficient writing method that takes into account both the log function and the controllable data volume.

[0004] In the prior art, such as Figure 1 The figure shows a common data writing method, which separates the data into main data and metadata and stores them in different physical locations. The log is used to record all operation information without the need to record complete data blocks. The main data storage area can be an HHD or an SSD; the metadata and log storage areas are preferably stored in different SSDs.

[0005] In the above method, the main data is written directly to the storage area of ​​the raw device in large blocks, while the metadata and logs are written in frequent small blocks. Separate storage allows the main data to be written sequentially faster, and the metadata and logs written in small blocks will not slow down the overall writing speed. Among them, metadata is frequently accessed, queried, and updated because it is responsible for data management, and has a long life cycle; while logs are used to record temporary historical operations. Once the operation is completed, the logs can be cleared and have a short life cycle. Therefore, storing metadata and logs separately allows metadata to be quickly and stably found and updated, and logs will not drag down the efficiency of metadata. It is also convenient to record and clear log information.

[0006] The space allocator is responsible for managing and allocating storage space on the raw device, ensuring that the available space can be efficiently used and reducing fragmentation when writing data blocks. 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. 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 represented by 0 / 1 to indicate whether it is allocated or not. 0 represents unallocated and can be used, and 1 represents allocated and cannot be used again. When using a single-layer bitmap, there is an obvious disadvantage that each time you allocate space, you need to traverse the entire bitmap memory to find an idle location, which limits the 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, 0 represents unallocated and can be used, 1 represents allocated and cannot be used again; a 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 the bit are not occupied, 01 represents that all subsets under the bit are partially occupied, and 11 represents that all subsets under the bit are occupied; a 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 the bit are not occupied, and 1 represents that all subsets under the bit are partially occupied. When a multi-layer bitmap is used, each layer of the bitmap needs to be queried and traversed, especially when the amount of data is large, the query performance will be affected. 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 management of data space will lead to performance degradation.

[0010] According to one aspect of the present application, a method for managing disk space is provided, comprising: 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; Form 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 their relative positional relationship; In response to changes in 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.

[0011] Furthermore, the vacant unit sequence is composed of all vacant storage units in the storage space connected in series according to their relative positional relationship, and includes: Obtaining a bitmap corresponding to the storage space; Acquire from the bitmap all vacant bits corresponding to all vacant storage units in the storage space; All of the vacant positions are connected in series in order according to their relative positional relationship to form the vacant unit sequence.

[0012] Further, 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.

[0013] Further, 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.

[0014] Furthermore, 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.

[0015] Further, after obtaining the information of the corresponding vacant storage unit according to the queried intermediate node information, the method further includes: 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.

[0016] Further, the obtaining of the corresponding vacant storage unit information according to 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 units are continuous and the overall space size of several continuous corresponding vacant storage units according to the intermediate node information; The data to be stored is stored in the overall space which is larger than the size thereof.

[0017] A second aspect of the present application provides a disk space management device, comprising: 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; The closing and maintaining module is used to respond to changes in 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.

[0018] 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.

[0019] 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.

[0020] Beneficial effects: An embodiment of the present application discloses a method for managing disk space, the method comprising: configuring a linked list for the storage space to be managed, the linked list being 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 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.

[0021] The present application utilizes a linked list and a single-layer bitmap in combination, and the linked list maintains a sequential correspondence with each vacant storage unit in the actual storage space in real time, so that the appropriate vacant unit can be quickly found based on the linked list to write data and delete data from the unit that needs to be deleted. The present application solves the technical problems of limited processing speed caused by using a single-layer bitmap for data management in the prior art and affected query performance caused by using a multi-layer bitmap for data management. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 It is a schematic diagram of a data storage distribution method in the prior art.

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

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

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

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

[0027] Figure 6 It is a schematic diagram of a model when data is written in a disk space management method according to an embodiment of the present application.

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

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

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

[0031] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present 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.

[0032] 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.

[0033] In the prior art, such as Figure 1 The diagram shows a data storage distribution method of an embodiment of the present invention, in which a space allocator is used to divide the storage space into blocks of fixed size and used to store different data, wherein the space allocator and the dedicated file system support both traditional HDD large-capacity hard disks and high-performance SSD solid-state hard disks. If the processing speed is the main consideration, all SSD solid-state hard disks should be used. If the cost-effectiveness is considered, the dedicated file system part can use SSD solid-state hard disks, and the rest can use HDD large-capacity hard disks.

[0034] 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 is Figure 2 The single-layer bitmap management method shown in Figure 1 is as follows. Figure 2 In the bitmap, each bit has a corresponding relationship with each storage unit of the storage space, and the storage units are connected according to the different address positions. Figure 2 A string of storage units is shown. For the convenience of explanation, Figure 2 The blue storage unit indicates that it is vacant, and the corresponding bit in the bitmap is also blue, and the bit is assigned a value of 0. On the contrary, the red storage unit indicates that it is not empty, and the corresponding bit in the bitmap is also red, and the bit is assigned a value of 1. The single-layer bitmap management method between storage units has many problems such as the inability to quickly query the space status and allocate space, and repeated traversal will lead to performance loss.

[0035] like Figure 4 As shown, it is a structural diagram of a disk space management method provided by an embodiment of the present application, such as Figure 5 FIG. 1 is a flowchart 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: 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.

[0036] like Figure 4 As shown, the linked list is located at Figure 4The top of the list is head, and null is the end node. The start node and the end node 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 node and the end node, and each intermediate node is connected in series from the start node to the end node, such as Figure 4 As shown, the front-to-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.

[0037] Step S102, 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 their relative positional relationship.

[0038] like Figure 4 As shown, the storage space is Figure 4 A sequence of blocks marked in the lower middle part, each block represents a storage unit. In this embodiment, each storage unit in the storage space in the current state is Figure 4 In the sequence formed from left to right, taking the first 16 storage units as an example, the 1st to 5th, 9th to 10th, 12th to 13th and 16th storage units are all non-empty storage units, and the 6th to 8th, 11th and 14th to 15th storage units are vacant storage units, totaling 5 vacant storage units. Extract all vacant storage units and keep the front and back relative positions of these vacant storage units unchanged to form a vacant unit sequence, that is, the current vacant unit sequence is 6-8-11-14-15, corresponding to the first 5 intermediate nodes of this part of the linked list, that is, the first intermediate node corresponds to the 6th storage unit, the second intermediate node corresponds to the 8th storage unit, the third node corresponds to the 11th storage unit, the fourth node corresponds to the 14th storage unit, and the fifth node corresponds to the 15th storage unit.

[0039] The above correspondence makes the intermediate nodes in the linked list represent corresponding vacant storage units. Such a correspondence 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.

[0040] Step S103, in response to changes in 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] Since the linked list needs to keep consistent with the vacant storage units in real time, the linked list should respond to the changes of the actual storage units in real time and make adjustments. Such changes include the increase and decrease of vacant storage units, so the intermediate nodes in the linked list also increase and decrease accordingly.

[0042] The embodiment of the present invention is based on the above-mentioned single-layer bitmap management, and configures a linked list to form a unique corresponding relationship 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 the series connection characteristics, and the front-to-back order relationship of the above-mentioned vacant storage units is reflected through this feature, 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, as long as the update of the linked list is kept consistent with the update of the bitmap at all times.

[0043] Since the storage space status can be reflected by the bitmap, such as Figure 4 As shown, the long strip between the linked list and the storage space is a bitmap, and each storage space state 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 some preferred embodiments, the vacant unit sequence is composed of all the vacant storage units in the storage space connected in series according to the relative position relationship between each other, including: Step S1021: Obtain a bitmap corresponding to the storage space.

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

[0045] Step S1023: connect all the vacant positions in series according to their relative position relationship to form the vacant unit sequence.

[0046] like Figure 4 As shown, from the bitmap, in the direction 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 sequence to form a vacant unit sequence of 6-8-11-14-15.

[0047] In some preferred embodiments, 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: Step S1031, in response to a vacant storage unit in the storage space becoming a non-vacant storage unit, obtaining the reduced vacant bits in the real-time vacant unit sequence.

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

[0049] The method in the above embodiment provides a method for adjusting the corresponding linked list when the number of vacant storage units decreases. When the vacant storage unit becomes a non-vacant storage unit, the corresponding bit in the real-time bitmap changes from vacant to non-vacant, so that the vacant unit sequence formed will also reduce the corresponding vacant bit, so that the intermediate node can be deleted and the chain can be formed again through the corresponding relationship between the vacant unit sequence and the linked list.

[0050] 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 in 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.

[0051] In some preferred embodiments, 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: 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; Step S1034, disconnecting at two intermediate nodes corresponding to the front vacant position and the rear vacant position in the linked list; Step S1035: configure a corresponding intermediate node for the newly added vacant storage unit, connect it in series at the corresponding break in the linked list, and re-link it.

[0052] The method in the above embodiment provides a method for adjusting the corresponding linked list when an empty storage unit is added. When a non-empty storage unit becomes an empty storage unit, the corresponding bit in the real-time bitmap changes from non-empty to empty, so that the formed control unit sequence also increases the empty bit accordingly. At this time, the position that should be disconnected in the linked list can be found according to the empty bit before and after the newly added empty bit, and the intermediate node corresponding to the newly added empty bit is inserted at this position to re-link.

[0053] by Figure 7For example, in the current state, the second storage unit 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. Since the second bit of the bitmap does not correspond to any intermediate node in the linked list, the newly added empty bit is found in the real-time empty unit sequence currently generated by the bitmap, which is the first bit. 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 a new intermediate node is inserted between the starting node and the original first intermediate node according to the arrow marked 3, and the chain is re-formed.

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

[0055] 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: Step S104: 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.

[0056] Step S105: Obtain the corresponding vacant storage unit information according to the queried intermediate node information.

[0057] In this way, the intermediate nodes can be queried from the starting node of the linked list to the end node. 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 to avoid performance loss caused by traversal.

[0058] Since each query starts from the starting node, the vacant storage units can be checked in order and data can be written as needed. For example, the storage units can be absorbed in order without special circumstances, 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 according to the queried intermediate node information, it includes: 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.

[0059] In some preferred embodiments, since the size of the data written at one time varies, and the written data needs to be placed in the same or adjacent storage units, when some data is larger than an empty storage unit, it is necessary to find some continuous storage unit spaces to accommodate the data. Therefore, how to quickly find these data spaces that meet the requirements is the key to affecting the writing performance. Therefore, the information of the corresponding empty storage unit is obtained according to the queried intermediate node information, including: 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.

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

[0061] by Figure 4 For example, when the size of the data to be written is less than or equal to the size of 1 storage unit, starting from the starting node of the linked list, the first intermediate node can be found to quickly find the 6th storage unit corresponding to the first intermediate node, and the data can be written directly. The data writing method of this embodiment preferably aligns the write, that is, each time it is written from the next or multiple consecutive vacant storage units adjacent to the non-empty storage unit, and when the data cannot fill the corresponding storage unit space, the filling data is constructed to fill the storage unit. When the size of the data to be written is greater than the size of 1 storage unit, it is necessary to find several consecutive vacant storage units until these vacant storage units can write the data to be written continuously. At this time, the linked list can be used to quickly find where there are continuous control storage units. Since the intermediate node carries the information of the corresponding vacant storage unit, such as the disk position marked with the vacant storage unit, it can quickly determine whether several intermediate nodes correspond to continuous storage units in the storage space and the corresponding size, so as to quickly find the appropriate storage unit to complete the writing.

[0062] 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 is a schematic diagram of the structure of a disk space management device. Figure 8 It can be known that the disk space management device includes: 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; The 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 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.

[0063] In some preferred embodiments, the relationship correspondence module is used to connect the vacant unit sequence in series according to the relative position relationship of all vacant storage units in the storage space, and the relationship correspondence module includes: A bitmap acquisition module, used to acquire a bitmap corresponding to the storage space; A vacant bit acquisition module, used to acquire all vacant bits corresponding to all vacant storage units in the storage space from the bitmap; 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.

[0064] In some preferred embodiments, the closing and maintaining module is used to respond to changes in the vacant storage units in the storage space and changes in the composition of the intermediate nodes of the linked list, including: 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; 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.

[0065] In some preferred embodiments, the closing and maintaining module is used to respond to changes in the vacant storage units in the storage space and changes in the composition of the intermediate nodes of the linked list, including: A newly added vacant position acquisition module, for obtaining a newly added vacant position in a real-time vacant unit sequence and a preceding vacant position and a succeeding vacant position adjacent to the newly added vacant position in response to a non-vacant storage unit in the storage space becoming a vacant storage unit; A disconnection module, used for disconnecting at two intermediate nodes corresponding to the front vacant position and the rear vacant position in the linked list; The re-chaining module is used to configure a corresponding intermediate node for the newly added vacant storage unit, connect it in series at the corresponding disconnection point of the linked list, and re-chain it.

[0066] In some preferred embodiments, the disk space management device further includes: 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; The vacant storage unit obtaining module is used to obtain the corresponding vacant storage unit information according to the queried intermediate node information.

[0067] In some preferred embodiments, 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: 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.

[0068] In some preferred embodiments, 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 if the data to be stored is larger than the size of the corresponding vacant storage unit, and to identify whether the corresponding vacant storage unit is continuous and the overall space size of several continuous corresponding vacant storage units according to the intermediate node information; The storage module is used to store the data to be stored in the overall space which is larger than its size.

[0069] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.

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

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

[0072] The memory 2001 is used to store computer programs executed by the processor 2002. The memory 2001 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0073] The memory 2001 may be a volatile memory, such as a random-access memory (RAM); the memory 2001 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 2001 may be any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2001 may be a combination of the above memories.

[0074] The processor 2002 may include one or more central processing units (CPU) or a digital processing unit, 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 .

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

[0076] 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. Fig. 9 In the embodiment, the memory 2001 and the processor 2002 are connected via a bus 2004. The bus 2004 is Fig. 9 The arrows in the figure are used to describe the connection between other components, which is only for illustrative purposes and is not intended to be limiting. Bus 2004 can be divided into address bus, data bus, control bus, etc. For ease of description, Fig. 9 The diagram only uses one arrow, but does not describe only one bus or one type of bus.

[0077] Based on the same inventive concept as the above method embodiment, an embodiment of the present invention also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is run on a computer, the electronic device implements the control method in the above 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 of the above. 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 of the above.

[0078] Based on the same inventive concept as the above-mentioned method embodiment, an embodiment of the present invention further provides a computer program product, the computer program product including 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 various exemplary embodiments of the present application described above in this specification. The program product may adopt any combination of one or more readable media. These computer program commands may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate 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.

[0079] 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 falling 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; Form 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 their relative positional relationship; In response to changes in 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.

2. The method according to claim 1, characterized in that The vacant unit sequence is composed of all vacant storage units in the storage space connected in series according to their relative position relationship, including: Obtaining a bitmap corresponding to the storage space; Acquire from the bitmap all vacant bits corresponding to all vacant storage units in the storage space; All of the vacant positions are connected in series in order according to their relative positional relationship to form the vacant unit sequence.

3. The method according to claim 2, 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.

4. The method according to claim 2, 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.

5. 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.

6. The method according to claim 5, characterized in that After obtaining the information of the corresponding vacant storage unit according to the queried intermediate node information, the method further comprises: 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.

7. The method according to claim 5, characterized in that The step of obtaining the corresponding vacant storage unit information according to 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 units are continuous and the overall space size of several continuous corresponding vacant storage units according to the intermediate node information; The data to be stored is stored in the overall space which is larger than the size thereof.

8. 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; The closing and maintaining module is used to respond to changes in 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.

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

10. 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 7.

Citation Information

Patent Citations

  • Data caching method

    CN105243030A

  • Method and device for storing, retrieving and deleting embedded audio and video data, and memory

    CN112558873A

  • Data writing method and device

    CN113704190A

  • Data processing method and device

    CN115016728A

  • Traffic management system and method, chip and computer readable storage medium

    CN118900254A

Cited By

  • Data processing system, method, device, medium and program product

    CN120872613A