Disk space management method and device, equipment and medium

The disk space of continuous space blocks of the preset capacity solves the problem of disk fragmentation and improves the read and write performance of the disk.

CN119376619AActive Publication Date: 2025-01-28BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing disk space management technologies are difficult to effectively reduce disk fragmentation, resulting in a degradation in disk read and write performance.

Method used

Manage the disk space through continuous space blocks of the preset capacity, respond to writing and deleting instructions, write data to the space block corresponding to the target level, and recycle space blocks after the data is completely deleted.

Benefits of technology

Reduced disk fragments, improved disk read and write performance, and enabled disk space to be used more efficiently.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376619A_ABST
    Figure CN119376619A_ABST
Patent Text Reader

Abstract

The invention provides a disk space management method and device, equipment and a medium, and relates to the technical field of artificial intelligence, in particular to the technical fields of cloud storage, cloud computing, big data and the like. The disk space management method comprises the following steps: in response to a writing instruction for target data, writing the target data into a target space block corresponding to a target level of the target data; the target space block is a continuous space with a preset capacity in a disk, and the preset capacity is greater than a size corresponding to the target level; in response to a deletion instruction for the target data, deleting the target data in the target space block; and after all the target data are deleted, recovering the target space block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as cloud storage, cloud computing, big data, and more particularly to a disk space management method, device, equipment, and medium. Background Art

[0002] Disk space management mainly includes operations such as allocating space and reclaiming space.

[0003] In order to manage disk space efficiently, it is necessary to solve the problem of how to reduce disk fragmentation. Summary of the invention

[0004] The present invention provides a disk space management method, apparatus, device and medium.

[0005] According to one aspect of the present disclosure, a disk space management method is provided, including: in response to a write instruction for target data, writing the target data into a target space block corresponding to a target level of the target data; the target space block is a continuous space of a preset capacity within the disk, and the preset capacity is greater than the size corresponding to the target level; in response to a delete instruction for the target data, deleting the target data in the target space block; after the target data are all deleted, recycling the target space block.

[0006] According to another aspect of the present disclosure, a disk space management device is provided, including: a write module, for writing the target data into a target space block corresponding to a target level of the target data in response to a write instruction for the target data; the target space block is a continuous space of a preset capacity within the disk, and the preset capacity is larger than the size corresponding to the target level; a delete module, for deleting the target data in the target space block in response to a delete instruction for the target data; and a reclaiming module, for reclaiming the target space block after all the target data are deleted.

[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method as described in any of the above aspects.

[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to any one of the above aspects.

[0009] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the methods described in any one of the above aspects.

[0010] According to the embodiments of the present disclosure, disk fragmentation can be reduced, thereby improving disk read and write performance.

[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0013] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0014] Figure 2 is a schematic diagram of an application scenario for implementing an embodiment of the present disclosure;

[0015] Figure 3 is a schematic diagram of a space block provided according to an embodiment of the present disclosure;

[0016] Figure 4 This is a schematic diagram of data writing after there is an idle position provided according to an embodiment of the present disclosure;

[0017] Figure 5 is a schematic diagram of allocating a new space block according to an embodiment of the present disclosure;

[0018] Figure 6 is a schematic diagram of a data movement operation provided according to an embodiment of the present disclosure;

[0019] Figure 7 is a schematic diagram according to a second embodiment of the present disclosure;

[0020] Figure 8 is a schematic diagram according to a third embodiment of the present disclosure;

[0021] Fig. 9 It is a schematic diagram of an electronic device used to implement the disk space management method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0023] In the related art, a buddy algorithm may be used to manage disk space.

[0024] The buddy algorithm is a dynamic memory management algorithm that meets the needs of storage space allocation or recovery by continuously dividing or merging free blocks.

[0025] The size of each free block is a power of 2, and the minimum is 4k bytes (4kB), namely 4kB, 8kB, 16kB... respectively.

[0026] When allocating space, find the smallest free block that meets the conditions. If not found, split it in half from a larger free block until a suitable free block is found. The two small free blocks split from the same large free block are called partners, and the physical addresses of the two partners are continuous. When merging, if two adjacent partners are both free, that is, neither stores data, then the two adjacent partners are merged into a large free block, and so on, until there are no adjacent free blocks.

[0027] The buddy algorithm continuously splits and merges free blocks, which may cause more disk fragmentation as time accumulates. For example, if there is a 4kB free block between two 8kB free blocks, and the release order is that the two 8kB spaces are released first, then although these 20kB are in a free state, the adjacent 8kB and 4kB cannot be merged due to their different sizes. Therefore, the three free blocks cannot be merged, resulting in disk fragmentation.

[0028] Over time, a large amount of disk fragmentation will affect the read and write performance of the disk. For example, when a user writes a large file, since there is no large continuous space, the large file will be scattered across multiple discrete sectors on the disk, turning the file that could have been read and written sequentially into multiple random reads and writes, greatly affecting performance.

[0029] In order to reduce disk fragmentation and improve disk read and write performance, the present disclosure provides the following embodiments.

[0030] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. This embodiment provides a disk space management method, such as Figure 1 As shown, the method includes:

[0031] 101. In response to a write instruction for target data, write the target data into a target space block corresponding to a target level of the target data; the target space block is a continuous space of a preset capacity within the disk, and the preset capacity is larger than a size corresponding to the target level.

[0032] 102. In response to a deletion instruction for the target data, delete the target data in the target space block.

[0033] 103. After all the target data are deleted, reclaim the target space block.

[0034] In the embodiment of the present disclosure, similar to the buddy algorithm, disk space management is performed based on the size level of data.

[0035] For example, the size level is divided into 10 levels, and the corresponding sizes are 4kB, 8kB, 16kB, ..., 2MB, which are powers of 2.

[0036] Different from the buddy algorithm, in the embodiment of the present disclosure, a space block is pre-allocated for each size level. The space block is a space with continuous physical addresses in the disk, and the capacity is a preset value, such as 32MB.

[0037] For example, the levels corresponding to 4kB and 8kB are called the first level and the second level respectively. Then the first level corresponding to the first space block and the second level corresponding to the second space block can be pre-allocated. The first space block and the second space block are both physically continuous spaces, and the size is 32MB.

[0038] Target data is the data to be written to the disk.

[0039] The target level refers to the size level corresponding to the target data.

[0040] Generally speaking, the target level is greater than or equal to the target data size and the level closest to the target data size. Based on the above level example, if the target data size is 8kB, then the target level is the second level, and if the target data is 10kB, then the target level is 16kB.

[0041] The target spatial block refers to the spatial block corresponding to the target level. Based on the above level example, assuming that the target level is the second level, the target spatial block is the second spatial block.

[0042] For each size level, a corresponding space block is first allocated, and then the data is written into the existing space block of the corresponding level.

[0043] For example, if the target data is 8kB of data to be written for the first time, then first apply for a 32MB continuous disk space as the disk space corresponding to the 8kB level, and write the 8kB of data to the first location interval of the 32MB disk space (8kB of data can be written in each location interval); then, after writing 8kB of data for the second time, write the 8kB of data written for the second time into the second location interval of the existing 32MB disk space, and so on.

[0044] Taking the above-mentioned second level and second space block as an example, if the second level target data is received for the first time, a second space block is allocated and the target data is written into the allocated second space block; if it is not the first time that the second level target data is received, the target data is written into the second space block corresponding to the existing second level.

[0045] The data in the target space block can be deleted. When the target space block is completely free, that is, after all the target data are deleted, the target space block is recycled.

[0046] The reclaimed space block can be allocated again and can be allocated to data of any size level. For example, after the second space block is reclaimed, it can be allocated to data of 4kB level.

[0047] In this embodiment, the target data is written into the target space block, and the target space block can be reclaimed when it is completely free. Since the target space block is continuous and the preset capacity is larger than the size corresponding to the size level of the data, a larger continuous space can be allocated to the data for use. In this way, a larger continuous space can also be reclaimed during recycling, thereby reducing disk fragmentation and improving disk read and write performance.

[0048] In order to better understand the present disclosure, the application scenarios involved in the present disclosure are described as follows:

[0049] Figure 2 It is a schematic diagram of an application scenario for implementing the embodiment of the present disclosure.

[0050] like Figure 2 As shown, this application scenario includes: a client and a disk management system.

[0051] The client is deployed on the user terminal 201, and the user terminal may include: a personal computer (PC), a mobile device (such as a mobile phone), a tablet computer, a laptop computer, a smart wearable device, etc.

[0052] The disk management system is deployed on the disk manager 202, which is used to manage the disk 203. The disk manager 202 and the disk 203 are located on the same electronic device, which may be a host, a server, etc. The disk manager 202 may be located inside the disk 203 or outside the disk 203. This embodiment takes the example where the disk manager 202 is located outside the disk 203.

[0053] The user generates a read / write instruction for the target data through the client, and the disk management system performs a read / write operation on the target data in the disk after receiving the read / write instruction.

[0054] Figure 3 It is a schematic diagram of a space block provided according to an embodiment of the present disclosure.

[0055] like Figure 3 As shown, the disk manager pre-allocates continuous space blocks of preset capacity for each size level. When data of a certain level is actually written, the corresponding space blocks are actually allocated and occupied.

[0056] For example, if the data to be written is at the 4kB level, the first space block is allocated for the 4kB level, and the 4kB data is written into the first space block; then, if an 8kB level data write instruction is received, the second space block is allocated, and the 8kB data is written into the second space block; then, if a 32kB level data write instruction is received, the third space block is allocated, and the 32kB data is written into the third space block. Different space blocks can be allocated sequentially, that is, the first space block, the second space block, and the third space block are physically allocated continuously.

[0057] Taking the 4kB level as an example, after the 4kB data received for the first time is written into the first position interval of the first space block, if a write instruction for 4kB data is received for the second time, the 4kB data received for the second time will be written into the second position interval of the first space block.

[0058] For a hard disk drive (HDD), data in the same space block (such as the first space block) is written sequentially. For example, see Figure 3 , the first position interval and the second position interval are physically continuous. For a solid state drive (SSD), data in the same space block (such as the first space block) can be written sequentially or randomly.

[0059] After data is written into a space block, it can be deleted, so some location intervals will be idle. At this time, after receiving new data, the idle location intervals can be filled or continued to be written sequentially.

[0060] Figure 4It is a schematic diagram of data writing after there is an idle position provided according to an embodiment of the present disclosure.

[0061] like Figure 4 As shown, taking the 4kB level as an example, for the first space block, it is assumed that the third position interval is currently written, and the data in the second position interval is deleted. Among them, 4kB is used to indicate that there is data, and the blank part is used to indicate that the corresponding position interval is an idle position interval. If new 4kB data is received, then the new 4kB data can be written to the second position interval, or the new 4kB data can continue to be written sequentially.

[0062] For example, Figure 4 As shown, for SSD, the new 4kB data (indicated by a filled box) can be written into the second location interval; for HDD, the new 4kB data (indicated by a filled box) can be written into the fourth location interval.

[0063] For data of a certain level (such as 4kB), if the allocated space block (such as the first space block) is full, then a new space block can be allocated for the level.

[0064] Figure 5 It is a schematic diagram of allocating new space blocks according to an embodiment of the present disclosure.

[0065] like Figure 5 As shown, taking the 4kB level as an example, if the first space block is full, then after the write instruction of the 4kB data is received again, a 32M continuous space block is allocated for the 4kB level, which can be called the fourth space block, and the 4kB data received again is written in the fourth space block.

[0066] As data is written and deleted, there may be multiple space blocks for the same level, and there may be more free position intervals in each space block. At this time, the remaining data in multiple space blocks can be moved to the same space block, which can be one of multiple space blocks, or a space block can be reallocated.

[0067] Figure 6 It is a schematic diagram of a data movement operation provided according to an embodiment of the present disclosure.

[0068] like Figure 6 As shown, taking the 4kB level as an example, assuming that the allocated space blocks include the first space block and the fourth space block, if the proportion of the free position intervals in the two space blocks is greater than the preset threshold, then the remaining data in the two space blocks are moved to the same space block. Among them, 4kB is used to represent the remaining data, and the blank part is used to represent that the corresponding position interval is a free position interval.

[0069] Assume that we move to the first spatial block, such as Figure 6 As shown, after the data is moved, the fourth space block is completely idle. Since the fourth space block is completely idle, the fourth space block can be recycled and subsequently reallocated to new data for use.

[0070] In combination with the above application scenarios, the present disclosure also provides the following embodiments.

[0071] Figure 7 is a schematic diagram according to a second embodiment of the present disclosure. This embodiment provides a disk space management method, the method comprising:

[0072] 701. In response to a write instruction for target data, write the target data into a target space block corresponding to a target level of the target data; the target space block is a continuous space of a preset capacity within the disk, and the preset capacity is larger than a size corresponding to the target level.

[0073] For example, refer to Figure 3 After receiving a write instruction for target data at the 4kB level, the disk manager writes the target data into the first space block. After receiving a write instruction for target data at the 8kB level, the disk manager writes the target data into the second space block.

[0074] In addition, the disk manager can also record the location of the space blocks corresponding to each level, as well as the free status. The free status includes, for example, whether the space block is full, what are the free position intervals in the space block, etc., so that after receiving data again, the data can be written into the space block of the corresponding level.

[0075] 702. In response to a deletion instruction for the target data, delete the target data in the target space block.

[0076] 703. After the target data is deleted, the write position of the target data is used as an idle position, and the idle position is recorded.

[0077] 704. If a write instruction for new data is received, and the size level of the new data is the same as the target level, write the new data to the free position in the target space block.

[0078] For example, refer to Figure 4 As shown in the upper right corner, after the data in the second position interval of the first space block is deleted, the second position interval is used as the space position. If 4kB data is received again, the 4kB data can be written into the second position interval.

[0079] In this embodiment, by writing new data into the free space, space utilization can be improved and resource waste can be avoided.

[0080] The above example uses writing to an idle position as an example. You can also ignore the idle position and continue writing sequentially. For example, see Figure 4 At the lower right side of , you can continue writing to the fourth position interval instead of writing to the idle second position interval.

[0081] This sequential writing can increase the writing speed.

[0082] 705. If the target space block is full and a write instruction for new data of the target level is received, a new space block corresponding to the target level is allocated, and the new data is written into the new space block; the new space block is a continuous space of a preset capacity within the disk.

[0083] For example, refer to Figure 5 For the 4kB level, if the first space block is full, a new space block (the fourth space block) can be allocated, and then the new 4kB data is written into the fourth space block.

[0084] In this embodiment, by allocating a new space block, successful writing of new data can be guaranteed, thereby improving disk performance.

[0085] 706. If the target level also corresponds to other spatial blocks, and the remaining data in the target spatial block and the other spatial blocks meet a preset condition, move the remaining data to the same spatial block.

[0086] The same space block may be one of the target space block and other space blocks, or may be a reallocated space block other than the target space block and other space blocks.

[0087] For example, refer to Figure 6 , assuming that the target space block is the first space block, and the other space block is the fourth space block, and taking the same space block as the first space block as an example, the remaining data meets the preset conditions, which can specifically be that the proportion of remaining data is less than a threshold. At this time, the remaining data in the first space block and the fourth space block are moved to the first space block.

[0088] After the move, the fourth space block is empty, that is, completely free. At this time, the fourth space block can be reclaimed and reallocated to any level of data in a subsequent process.

[0089] In this embodiment, by moving the remaining data in multiple space blocks to the same space block, the data centralization can be improved. After the move, the completely free space blocks are recycled, reducing the disk fragmentation problem and improving the disk read and write performance.

[0090] 707. After all the target data are deleted, reclaim the target space block.

[0091] The target data may be deleted according to a deletion instruction of the user, or may be deleted after the data is moved.

[0092] For example, for the first space block, at least part of the 4kB data therein may be deleted according to the user's deletion instruction. Alternatively, after the remaining data in the first space block is moved to other space blocks, the remaining data may also be deleted.

[0093] For each size level, a space block of the same capacity may be pre-allocated. For example, a space block of 32M may be pre-allocated for the 4kB level, the 8kB level, and the like.

[0094] These pre-allocated space blocks are used only when there is actual data writing. In some cases, the pre-allocated space blocks may not be actually used.

[0095] For example, write instructions are all for 4kB data, and data of other levels are not written, so the pre-allocated space blocks of other levels are not actually used. Taking 9 other levels as an example, there are about 270M (9*32M) spaces that are not actually used. In order to improve resource utilization, the size of the pre-allocated space blocks of the unused levels can be adjusted, such as adjusting it from 32M to 8M, which can avoid waste of resources.

[0096] Based on this, in some embodiments, the following may also be included:

[0097] If there is a pre-allocated space block corresponding to another level and no data write instruction of the other level is received, the pre-allocated space block is adjusted from the preset capacity to the target capacity, and the target capacity is smaller than the preset capacity.

[0098] For example, the target level is 4kB and the other levels are 8kB. If no write instruction for 8kB data is received, the space block corresponding to 8kB is adjusted from 32M to 8M.

[0099] In this embodiment, resource utilization can be improved by reducing the capacity of the pre-allocated space that is not actually used.

[0100] If the capacity is adjusted and data of the corresponding level is received, the data in multiple small space blocks (space blocks of target capacity) can be moved to a large space block (space block of preset capacity) through a rewrite operation.

[0101] For example, after adjusting the space block corresponding to 8kB from 32M to 8M, after receiving 8kB of data, write the 8kB data into the 8M space block. After multiple 8M space blocks are full, for example, 4 8M space blocks are full, you can reallocate a space block with a preset capacity (32M) for 8kB, and rewrite the data in the 4 8M space blocks into the 32M space block.

[0102] In this way, data continuity can be improved, and a larger continuous space (32M space) can be reclaimed later, reducing disk fragmentation and improving disk performance.

[0103] Figure 8 It is a schematic diagram according to the third embodiment of the present disclosure. This embodiment provides a disk space management device. The device 800 includes: a writing module 801, a deleting module 802 and a recycling module 803.

[0104] The write module 801 is used to respond to a write instruction for the target data and write the target data into a target space block corresponding to the target level of the target data; the target space block is a continuous space of a preset capacity in the disk, and the preset capacity is greater than the size corresponding to the target level; the delete module 802 is used to respond to a delete instruction for the target data and delete the target data in the target space block; the recycle module 803 is used to recycle the target space block after all the target data are deleted.

[0105] In this embodiment, the target data is written into the target space block, and the target space block can be reclaimed when it is completely free. Since the target space block is continuous and the preset capacity is larger than the size corresponding to the size level of the data, a larger continuous space can be allocated to the data for use. In this way, a larger continuous space can also be reclaimed during recycling, thereby reducing disk fragmentation and improving disk read and write performance.

[0106] In some embodiments, the apparatus 800 further includes:

[0107] A recording module, used for, after the target data is deleted, taking the writing position of the target data as an idle position and recording the idle position;

[0108] The multiplexing module is used to write the new data into the free position in the target space block if a write instruction for new data is received and the size level of the new data is the same as the target level.

[0109] In this embodiment, by writing new data into the free space, space utilization can be improved and resource waste can be avoided.

[0110] In some embodiments, the apparatus 800 further includes:

[0111] An allocation module is used to allocate a new space block corresponding to the target level and write the new data into the new space block if the target space block is full and a write instruction for new data of the target level is received; the new space block is a continuous space of a preset capacity within the disk.

[0112] In this embodiment, by allocating a new space block, successful writing of new data can be guaranteed, thereby improving disk performance.

[0113] In some embodiments, the apparatus 800 further includes:

[0114] A moving module is used to move the remaining data to the same space block if the target level also corresponds to other space blocks and the remaining data in the target space block and the other space blocks meet a preset condition.

[0115] In this embodiment, by moving the remaining data in multiple space blocks to the same space block, the data centralization can be improved. After the move, the completely free space blocks are recycled, reducing the disk fragmentation problem and improving the disk read and write performance.

[0116] In some embodiments, the apparatus 800 further includes:

[0117] The adjustment module is used to adjust the pre-allocated space block from the preset capacity to the target capacity if there is a pre-allocated space block corresponding to other levels and no data write instruction of the other levels is received, and the target capacity is smaller than the preset capacity.

[0118] In this embodiment, resource utilization can be improved by reducing the capacity of the pre-allocated space that is not actually used.

[0119] It can be understood that in the embodiments of the present disclosure, the same or similar contents in different embodiments can be referenced to each other.

[0120] It can be understood that the “first”, “second”, etc. in the embodiments of the present disclosure are only used for distinction and do not indicate the degree of importance, time sequence, etc.

[0121] It is understandable that unless there is any special limitation on the sequence of steps in the process, it means that the timing relationship between these steps is not limited.

[0122] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0123] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0124] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device 900 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0125] like Fig. 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0126] Multiple components in the electronic device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0127] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as the disk space management method. For example, in some embodiments, the disk space management method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the disk space management method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the disk space management method in any other appropriate manner (e.g., by means of firmware).

[0128] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0129] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable task processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0130] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0131] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0132] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0133] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0134] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0135] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A disk space management method, comprising: In response to a write instruction for target data, writing the target data into a target space block corresponding to a target level of the target data; The target space block is a continuous space of a preset capacity in the disk, and the preset capacity is larger than the size corresponding to the target level; In response to a deletion instruction for the target data, deleting the target data in the target space block; After all the target data are deleted, the target space block is reclaimed.

2. The method according to claim 1, further comprising: After the target data is deleted, taking the write position of the target data as an idle position and recording the idle position; If a write instruction for new data is received, and the size level of the new data is the same as the target level, the new data is written to the free position in the target space block.

3. The method according to claim 1, further comprising: If the target space block is full and a write instruction for new data of the target level is received, a new space block corresponding to the target level is allocated and the new data is written into the new space block; the new space block is a continuous space of a preset capacity within the disk.

4. The method according to claim 1, further comprising: If the target level also corresponds to other spatial blocks, and the remaining data in the target spatial block and the other spatial blocks meet a preset condition, the remaining data is moved to the same spatial block.

5. The method according to claim 1, further comprising: If there is a pre-allocated space block corresponding to another level and no data write instruction of the other level is received, the pre-allocated space block is adjusted from the preset capacity to the target capacity, and the target capacity is smaller than the preset capacity.

6. A disk space management device, comprising: A writing module, configured to write the target data into a target space block corresponding to a target level of the target data in response to a write instruction for the target data; The target space block is a continuous space of a preset capacity in the disk, and the preset capacity is larger than the size corresponding to the target level; A deletion module, configured to delete the target data in the target space block in response to a deletion instruction for the target data; The recycling module is used to recycle the target space block after all the target data are deleted.

7. The apparatus according to claim 6, further comprising: A recording module, used for, after the target data is deleted, taking the writing position of the target data as an idle position and recording the idle position; The multiplexing module is used to write the new data into the free position in the target space block if a write instruction for new data is received and the size level of the new data is the same as the target level.

8. The apparatus according to claim 6, further comprising: An allocation module is used to allocate a new space block corresponding to the target level and write the new data into the new space block if the target space block is full and a write instruction for new data of the target level is received; the new space block is a continuous space of a preset capacity within the disk.

9. The apparatus according to claim 6, further comprising: A moving module is used to move the remaining data to the same space block if the target level also corresponds to other space blocks and the remaining data in the target space block and the other space blocks meet a preset condition.

10. The apparatus according to claim 6, further comprising: The adjustment module is used to adjust the pre-allocated space block from the preset capacity to the target capacity if there is a pre-allocated space block corresponding to other levels and no data write instruction of the other levels is received, and the target capacity is smaller than the preset capacity.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

12. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.

13. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Disk space allocation method and device

    CN105279099A

  • DATA STORAGE METHOD, APPARATUS AND device

    CN109117273A

  • Disk space distribution method and device, storage device and storage medium

    CN109977035A

  • Method and device for writing data

    CN110716699A

  • Disk space management method and system based on distributed storage

    CN114115738A