Data processing method and device, storage medium and electronic equipment

By applying greedy algorithms to sort and reorganize the data blocks occupied by disk metadata in the disk file system, the disk fragmentation problem is solved, efficient utilization and optimization of disk space is achieved, and file reading speed and system performance are improved.

CN119025438APending Publication Date: 2024-11-26ZUNYI BRANCH OF CHINA MOBILE GRP GUIZHOU COMPANY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411062586.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

There is a problem of disk fragmentation in existing disk file systems, resulting in discontinuity of file storage, reducing file access performance and wasting storage space. Traditional disk defragmentation tools and file system optimization algorithms cannot make full use of disk space.

Method used

By obtaining the space information of the target disk, using greedy algorithms to initialize and sort and reorganize the data blocks occupied by disk metadata, and obtain the reorganized disk space layout, thereby optimizing the disk space layout and achieving efficient reorganization and utilization of disk space.

Benefits of technology

It improves file reading speed, system response performance and storage resource utilization, reduces disk fragmentation and waste of storage space, reduces the risk of data loss and corruption, and is suitable for application scenarios where large amounts of data are frequently read and written.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025438A_ABST
    Figure CN119025438A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, a storage medium and electronic equipment, and relates to the technical field of data processing. Based on the space information, a first data block in the target disk is initialized, and the space of the first data block is occupied by the disk metadata; then sorting and recombining the initialized first data block by using a greedy algorithm to obtain a recombined disk space layout; and determining the spatial layout of the target disk according to the recombined disk spatial layout. Compared with the prior art, the method has the advantages that the first data blocks are merged and recombined through the greedy algorithm, the optimal spatial layout of the target disk is determined, and efficient recombination and optimization of the disk space are achieved. The fragmentation problem can be processed more quickly, and the disk space is fully utilized, so that the file reading speed, the response performance of the system and the utilization rate of storage resources are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device, storage medium and electronic device. Background Art

[0002] In existing disk file systems, files are usually stored non-continuously, so there is a problem of disk fragmentation. Disk fragmentation refers to the non-continuous distribution of files stored on the disk. This fragmentation will reduce file access performance, increase file reading time, and waste a lot of storage space.

[0003] Currently, disk defragmentation tools and file system optimization algorithms mainly focus on reducing disk fragmentation. They usually recombine the scattered data blocks of the disk into continuous blocks to reduce the moving distance of the head when reading files, thereby improving the read and write performance of the file system.

[0004] However, traditional disk defragmentation tools and file system optimization algorithms usually only focus on the creation of continuous space, and the disk space cannot be fully utilized. Summary of the invention

[0005] In view of this, the present application provides a data processing method, device, storage medium and electronic device, the main purpose of which is to improve the current technical problem that disk space cannot be fully utilized when processing disk fragments.

[0006] In a first aspect, the present application provides a data processing method, comprising:

[0007] Get the space information of the target disk;

[0008] Based on the space information, initializing a first data block in the target disk, the first data block being a data block whose space has been occupied by disk metadata;

[0009] Using a greedy algorithm to sort and reorganize the first data block after the initialization process, to obtain a reorganized disk space layout;

[0010] The spatial layout of the target disk is determined according to the reorganized disk spatial layout.

[0011] In a second aspect, the present application provides a data processing device, comprising:

[0012] An acquisition module is configured to acquire space information of a target disk;

[0013] A processing module is configured to perform initialization processing on a first data block in the target disk based on the space information, the first data block being a data block whose space has been occupied by disk metadata;

[0014] The reorganization module is configured to sort and reorganize the first data block after the initialization processing by using a greedy algorithm to obtain a reorganized disk space layout;

[0015] The determination module is configured to determine the spatial layout of the target disk according to the reorganized disk spatial layout.

[0016] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0017] In a fourth aspect, the present application provides an electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.

[0018] In a fifth aspect, the present application provides a computer program product having a computer program stored thereon, wherein the computer program implements the method described in the first aspect when executed by a processor.

[0019] By means of the above technical scheme, the present application provides a data processing method, device, storage medium and electronic device, which first obtains the spatial information of the target disk; then based on the spatial information, initializes the first data block in the target disk, wherein the first data block is a data block whose space has been occupied by the disk metadata; then uses a greedy algorithm to sort and reorganize the first data block after the initialization process to obtain a reorganized disk space layout; and determines the spatial layout of the target disk according to the reorganized disk space layout. Compared with the current prior art, the present application uses a greedy algorithm to merge and reorganize the first data block, determines the optimal spatial layout of the target disk, and realizes efficient reorganization and optimization of the disk space. It can handle fragmentation problems more quickly and make full use of disk space, thereby improving the file reading speed, system response performance and storage resource utilization.

[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0023] Figure 1 A schematic diagram of a data processing method provided in an embodiment of the present application is shown;

[0024] Figure 2 A schematic diagram showing a flow chart of another data processing method provided in an embodiment of the present application is shown;

[0025] Figure 3 A schematic diagram of an example process provided by an embodiment of the present application is shown;

[0026] Figure 4 A schematic diagram showing an example provided by an embodiment of the present application;

[0027] Figure 5 A structural schematic diagram of a data processing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0028] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0029] In order to improve the current technical problem that the disk space cannot be fully utilized when processing disk fragments. This embodiment provides a data processing method, such as Figure 1 As shown, the method includes:

[0030] Step 101: Obtain the space information of the target disk.

[0031] Exemplarily, the space information of the target disk may include free space information and used space information of the target disk. Acquiring the space information of the target disk through the file system interface can provide a data basis for subsequent disk space reorganization.

[0032] Step 102: Initialize the first data block in the target disk based on the space information.

[0033] The first data block is a data block whose space is occupied by disk metadata, that is, a data block to which the used space information of the target disk can correspond. The data block can be a disk block, a file block, and the like.

[0034] Exemplarily, initializing the first data block in the target disk includes: determining the division unit of the disk space, creating a data structure, initializing the disk state, setting algorithm parameters, etc. The goal of the initialization process is to provide a suitable environment and data structure for the subsequent disk space reorganization process to ensure that the algorithm can run smoothly.

[0035] Step 103: Use a greedy algorithm to sort and reorganize the first data block after the initialization process to obtain a reorganized disk space layout.

[0036] In some examples, a greedy algorithm is an algorithm that makes the best choice based on the current state in the hope of reaching the overall optimal solution.

[0037] For example, by using the greedy algorithm strategy, adjacent fragmented file blocks are merged into continuous space, which can reduce fragmentation and improve the continuous storage capacity of the disk. It can also make more full use of the disk space, reduce space waste, improve file reading speed and access performance, and effectively reduce calculation complexity and improve algorithm execution efficiency while ensuring the reorganization effect.

[0038] Step 104: Determine the spatial layout of the target disk according to the reorganized disk spatial layout.

[0039] In some examples, based on the reorganized disk space layout, the storage structure of the target disk can be optimized according to different file access modes and usage modes, thereby providing better access efficiency and response speed.

[0040] The method of this embodiment optimizes the disk space layout, reduces fragmentation and improves the utilization of disk space, thereby improving the read and write performance of the disk system. This is very important for application scenarios that require frequent reading and writing of large amounts of data, such as large-scale database management systems, cloud computing platforms, etc. Through refined management and full utilization of disk space, disk fragmentation and storage space waste can be reduced, and storage costs can be effectively saved, which is particularly suitable for enterprises and organizations that store large amounts of data. In addition, disk space reorganization can also reduce the impact of fragmentation on the disk system and reduce the risk of data loss and damage. By optimizing the disk space layout, the storage stability and reliability of data can be improved, and the probability of system crashes and data damage can be reduced.

[0041] Compared with the current existing technology, by applying the technical solution of this embodiment, the space information of the target disk is first obtained; then based on the space information, the first data block in the target disk is initialized, wherein the first data block is a data block whose space is already occupied by disk metadata; then the first data block after the initialization process is sorted and reorganized using a greedy algorithm to obtain a reorganized disk space layout; the space layout of the target disk is determined according to the reorganized disk space layout. By merging and reorganizing the first data block using a greedy algorithm, the optimal space layout of the target disk is determined, and efficient reorganization and optimization of the disk space is achieved. It can handle fragmentation problems more quickly and make full use of disk space, thereby improving file reading speed, system response performance, and storage resource utilization.

[0042] In order to further illustrate the specific implementation process of the method of this embodiment, this embodiment provides the following Figure 2 The specific method shown includes:

[0043] Step 201: Obtain the space information of the target disk.

[0044] In some examples, this embodiment provides a disk space reorganization method based on a greedy algorithm, such as Figure 3 As shown, the steps may include obtaining disk space information, initialization, sorting, greedy algorithm reorganization, updating disk free block information, storing reorganization results, and disk status monitoring and policy adjustment. Wherein, obtaining disk space information may include obtaining information of a first data block (used block) and a second data block (free block) of the disk space through a file system interface.

[0045] For example, in Windows system, you can use the function of Windows Application Programming Interface (WinAPI) to obtain the free space and used space information of the disk. By calling the function, you can obtain the starting address and size of the disk space and other related information.

[0046] Step 202: Initialize the first data block in the target disk based on the space information.

[0047] The first data block is a data block whose space has been occupied by disk metadata.

[0048] Exemplarily, the free blocks and used blocks of the disk can be stored in two data structures, such as linked lists or arrays. The goal of the initialization phase is to provide a suitable environment and data structure for the subsequent disk space reorganization process to ensure that the algorithm can proceed smoothly.

[0049] Optionally, step 202 may specifically include: creating a data structure corresponding to the target disk by using a linked list; and storing the first data block in the data structure according to the space information and the data structure.

[0050] For example, the division unit of the disk space can be determined first: the disk space can be divided into multiple blocks or pages, and the size of each block or page can be determined according to actual needs. For example, the disk space can be divided into fixed-size blocks, such as 4KB, 8KB, etc. Among them, the selection of the division unit can comprehensively consider the size of the disk space, the requirements of the file system, and the characteristics of the application scenario.

[0051] In some examples, in order to manage the state and allocation of disk space, a linked list may be used to create a corresponding data structure to record information such as the state of each block in the disk space (free or used), the location of the block, and the size of the block. Then, based on the acquired disk space information and the created data structure, the state of the disk is initialized, including dividing the disk space into blocks and setting the initial state of each block to free.

[0052] In some examples, for the disk space reorganization method based on the greedy algorithm, it is also necessary to set the parameters required by the algorithm. The specific setting of the algorithm parameters may depend on specific requirements, such as the block size, the total disk size, the block selection strategy, etc. For example, if the total disk size is 1TB and the block size is 4KB, disk_size may be set to 1000000000000 (i.e., the number of bytes in 1TB), and block_size may be set to 4096 (i.e., the number of bytes in 4KB).

[0053] The method of this embodiment takes into account the size and position of the free space when reorganizing the disk space, and can adapt to the dynamic changes and uncertain size of files, thereby avoiding space waste and disk fragmentation.

[0054] Step 203: Sort the first data blocks according to the starting coordinates of the first data blocks.

[0055] Exemplarily, the used blocks are sorted according to the starting addresses of the disk blocks, and they can be arranged in order according to their starting addresses on the disk. The purpose of sorting is to optimize the subsequent space reorganization operation. The merge_sort function can be used to implement merge sorting. First, determine the length of the array. If the length is less than or equal to 1, return the array directly; otherwise, divide the array into two halves, recursively call the merge_sort function on the left half and the right half respectively, and then merge the two ordered sub-arrays into an ordered array through the merge function.

[0056] In some examples, the used data blocks on the disk may be collected and stored in a list, and then the data blocks in the used block list may be sorted from small to large according to the starting address on the disk using merge sort. After sorting, the used block list is updated so that the data blocks therein can be arranged in order according to the starting address.

[0057] Step 204: Select adjacent data blocks from the sorted list of the first data block based on a greedy algorithm to merge, and obtain a reorganized disk space layout.

[0058] Exemplarily, a greedy algorithm may be used to select adjacent data blocks from a sorted list of used blocks for merging, and the greedy algorithm may be used to select the best disk blocks for reorganization, which may minimize fragmentation and improve disk space utilization.

[0059] Optionally, step 204 may specifically include: traversing the sorted list, placing the first data block at a corresponding position in the disk space layout list; and determining the disk space layout by updating the position information of the first data block in the disk space layout list.

[0060] Exemplarily, first traverse the sorted disk block list; initialize an empty disk space layout list to record the new positions of the reorganized disk blocks; iterate the sorted disk block list from the beginning; for each disk block, find a suitable position to store the disk block, if the disk block can be placed in a free position in the current layout, place it at that position, and update the start and end addresses of the free position, if the disk block cannot be placed in any existing free position, place it at the end of the disk layout, and create a new free position; update the disk space layout list, record the new position of each disk block, and reorganize the disk space layout to optimize the disk's space utilization and access performance.

[0061] For example, suppose there is a list of used blocks on a disk, each block has a start address and an end address. Initially, the list of used blocks is (expressed in start address and end address): [(0, 5), (7, 10), (12, 15), (18, 25)]. According to the steps of the greedy algorithm, these blocks can be merged and laid out. First, the disk block list that has been sorted by the start address can be traversed, an empty disk space layout list can be initialized, and the sorted disk block list can be iterated from the beginning. For the first block (0, 5), it is the first block and is directly placed in the layout, and the layout becomes [(0, 5)]; for the second block (7, 10), its starting address is adjacent to the end address of the previous block and can be merged together, and the layout becomes [(0, 10)]; for the third block (12, 15), the starting address is not adjacent to the blocks that have been laid out, and it is placed at the end of the layout, and the layout becomes [(0, 10), (12, 15)]; for the fourth block (18, 25), the starting address is not adjacent to the blocks that have been laid out, and it is placed at the end of the layout, and the layout becomes [(0, 10), (12, 15), (18, 25)]. The disk space layout list is updated, the position of each data block is recorded, and the reorganized disk space layout is returned as [(0, 10), (12, 15), (18, 25)]. By applying this embodiment, the adjacent disk blocks in the sorted list of the first data block are merged, thereby optimizing the disk space layout.

[0062] In some examples, the method of this embodiment reduces the number of disk scanning and moving operations by selecting adjacent file blocks for merging, thereby greatly improving the efficiency and speed of disk space reorganization. It can also dynamically select the best disk blocks for reorganization, which can make fuller use of disk space, reduce fragmentation and improve disk space utilization.

[0063] Step 205: Determine the spatial layout of the target disk according to the reorganized disk spatial layout.

[0064] In some examples, the disk layout reorganized by the greedy algorithm can be stored back to the disk to replace the original disk layout. First, a new blank disk layout (new_disk_layout) is created to store the reorganized result. Each disk block in the disk layout (reorganized_layout) reorganized by the greedy algorithm is traversed to obtain the starting address (start) and size (size) of the current disk block. Then, the starting address and size of the current disk block are added to the new disk layout (new_disk_layout), and then the new disk layout (new_disk_layout) is returned, which is the spatial layout of the target disk.

[0065] Exemplarily, saving the reorganized data block information in disk metadata can facilitate the file system to correctly locate and access files in subsequent file accesses.

[0066] Optionally, the method of this embodiment may further include: updating the starting address and size of the second data block according to the disk space layout, wherein the second data block is a data block whose space is not occupied by any disk metadata; updating the reorganized disk space layout according to the starting address and size of the second data block; accordingly, step 205 may specifically include: determining the updated disk space layout as the space layout of the target disk.

[0067] Exemplarily, to update the free block information of the disk, a free block list (free_blocks) may be initialized first, and then each disk block in the disk layout may be traversed to obtain the end address (end) of the disk block. If the end address of the current disk block is less than the total capacity of the disk, it means that there are free blocks after the current disk block, and the end address (end) of the current disk block and the start address (next_start) of the next disk block may be obtained. Then the size (size) of the free block between the end address (end) of the current disk block and the start address (next_start) of the next disk block is calculated, and the start address and size of the free block are added to the free block list (free_blocks), and then the updated free block list (free_blocks) is returned.

[0068] The method of this embodiment not only stores the used blocks and records the storage locations, but also updates and optimizes the information of the free blocks, thereby improving the performance and reliability of the entire disk system.

[0069] Optionally, the method of this embodiment may also include: dynamically adjusting the data block merging strategy by real-time monitoring of the status parameters of the target disk, wherein the status parameters may include the degree of fragmentation, available space and read / write speed, and the data block merging strategy is used to update the spatial layout of the target disk.

[0070] For example, the size, access frequency and access order of files in the disk may change over time. When the disk status changes, the merge strategy can be adjusted according to the current disk status, such as the degree of fragmentation, available space and disk load, so as to timely adjust the storage location of the file and the spatial layout of the target disk according to these changes.

[0071] In some examples, disk fragmentation can be dynamically sensed, adjusted, and merged by real-time monitoring of disk status parameters such as the degree of fragmentation, available space, and read / write speed. The state of the disk is a dynamically changing factor, including the degree of fragmentation, available space, and read / write speed. The method of this embodiment maintains real-time perception of the disk state by monitoring these state parameters of the disk in real time. Based on the monitoring and collection of the disk state, the information obtained in real time is used to dynamically adjust the merge strategy. The purpose of the merge strategy is to reorganize the fragmented data blocks into continuous blocks, triggering disk space reorganization and optimization, thereby improving data read and write performance.

[0072] For example, Figure 4 As shown, monitoring of disk status can include monitoring disk space utilization, detecting disk read and write speeds, tracking file access patterns, monitoring disk fragmentation, etc. Specifically, the system can regularly monitor the free space ratio of the disk. If the free space is lower than a certain threshold (such as 30%), the merge strategy needs to be adjusted; the system can also continuously monitor the read and write speed of the disk. If the read and write speed drops rapidly, it may mean that the disk is becoming fragmented, resulting in slower data access. In this case, the system can automatically start a disk reorganization operation to increase the read and write speed; the system can also record which files are frequently accessed and which files are rarely accessed; the system can also regularly scan the fragmentation on the disk. If the fragmentation level exceeds a certain threshold, the system can trigger a defragmentation operation to merge scattered data blocks into continuous blocks to improve read and write performance.

[0073] For example, Figure 4 As shown, the dynamically adjusted merge strategy can include a merge strategy for access hotspot files, a merge strategy for files with low access frequency, a merge strategy based on disk status, etc. Specifically, if the system detects that a certain file is being accessed frequently, an active merge strategy can be adopted; for some files that are rarely accessed, the system can choose a more conservative merge strategy, such as merging these data blocks into larger blocks, but it is not necessary to place them close to the read / write head, so as to avoid over-optimizing files with low access frequency, thereby saving the cost of the merge operation; if the system detects that the disk has a lot of idle time, a more active merge strategy can be selected to try to merge more data blocks into continuous blocks, and when under high load, the system can also choose a more conservative merge strategy to avoid affecting normal read and write operations.

[0074] Illustratively, during the data block reorganization process, the method of this embodiment comprehensively considers multiple factors, such as the size of the disk block, the access frequency of the file, the size of the file, etc., to more comprehensively evaluate the reorganization priority of the block and improve the overall space organization effect.

[0075] The method of this embodiment dynamically adjusts the selection strategy according to the current state of the disk space during the reorganization process, rather than using fixed rules. This dynamic adaptability is reflected in the ability to flexibly adjust the reorganization strategy according to actual conditions, adapt to changes in different disk loads and workloads, and maximize the use of disk space.

[0076] Compared with the current prior art, by applying the technical solution of this embodiment, the first data block is merged and reorganized using a greedy algorithm to determine the optimal spatial layout of the target disk. By dynamically selecting adjacent data blocks for merging, efficient reorganization and optimization of the disk space can be achieved. The method of this embodiment can handle the fragmentation problem more quickly, adapt to the dynamic changes of files, and make full use of the disk space, thereby improving the file reading speed, the system response performance and the utilization rate of storage resources, and can meet the growing data storage needs.

[0077] Further, as Figure 1 and Figure 2 The specific implementation of the method shown in this embodiment provides a data processing device, such as Figure 5 As shown, the device includes: an acquisition module 31, a processing module 32, a reorganization module 33, and a determination module 34.

[0078] The acquisition module 31 is configured to acquire the space information of the target disk;

[0079] The processing module 32 is configured to perform initialization processing on a first data block in the target disk based on the space information, the first data block being a data block whose space has been occupied by disk metadata;

[0080] The reorganization module 33 is configured to sort and reorganize the first data block after the initialization process by using a greedy algorithm to obtain a reorganized disk space layout;

[0081] The determination module 34 is configured to determine the spatial layout of the target disk according to the reorganized disk spatial layout.

[0082] In some examples of this embodiment, the reorganization module 33 is specifically configured to sort the first data blocks according to the starting coordinates of the first data blocks; select adjacent data blocks from the sorted list of the first data blocks based on a greedy algorithm to merge, so as to obtain the reorganized disk space layout.

[0083] In some examples of this embodiment, the reorganization module 33 is specifically configured to traverse the sorted list and place the first data block at a corresponding position in the disk space layout list; and determine the disk space layout by updating the position information of the first data block in the disk space layout list.

[0084] In some examples of this embodiment, the determination module 34 is further specifically configured to update the starting address and size of the second data block according to the disk space layout, the second data block being a data block whose space is not occupied by any disk metadata; update the reorganized disk space layout according to the starting address and size of the second data block; and determine the updated disk space layout as the space layout of the target disk.

[0085] In some examples of this embodiment, the determination module 34 is specifically configured to dynamically adjust the data block merging strategy by real-time monitoring of the status parameters of the target disk, wherein the status parameters include the degree of fragmentation, available space, and read / write speed, and the data block merging strategy is used to update the spatial layout of the target disk.

[0086] In some examples of this embodiment, the processing module 32 is specifically configured to create a data structure corresponding to the target disk by using a linked list; and save the first data block in the data structure according to the space information and the data structure.

[0087] It should be noted that the data processing device provided in this embodiment and other corresponding descriptions of the functional units involved can be referred to in Figure 1 and Figure 2 The corresponding description in will not be repeated here.

[0088] Based on the above Figure 1 and Figure 2 The method shown in the embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned Figure 1 and Figure 2 The method shown.

[0089] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.

[0090] Based on the above Figure 1 and Figure 2 The method shown, and Figure 5 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides an electronic device, such as a personal computer, a server, a laptop computer, an intelligent robot or other intelligent terminal, which includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1and Figure 2 The method shown.

[0091] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0092] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.

[0093] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.

[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the solution of this embodiment, compared with the current prior art, the method of this embodiment uses a greedy algorithm to merge and reorganize the first data block, and determines the optimal spatial layout of the target disk. By dynamically selecting adjacent data blocks for merging, efficient reorganization and optimization of disk space can be achieved. It can handle fragmentation problems more quickly, adapt to the dynamic changes of files, and make full use of disk space, thereby improving the reading speed of files, the response performance of the system, and the utilization rate of storage resources, and can meet the growing data storage needs. The method of this embodiment has good scalability, can adapt to disk systems of different sizes and types, and also has certain adaptability to new disk technologies and storage architectures that may appear in the future.

[0095] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0096] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.

Claims

1. A data processing method, It is characterized in that include: Get the space information of the target disk; Based on the space information, initializing a first data block in the target disk, the first data block being a data block whose space has been occupied by disk metadata; Using a greedy algorithm to sort and reorganize the first data block after the initialization process, to obtain a reorganized disk space layout; The spatial layout of the target disk is determined according to the reorganized disk spatial layout.

2. The method according to claim 1, It is characterized in that The method of using a greedy algorithm to sort and reorganize the first data block after the initialization process to obtain a reorganized disk space layout includes: sorting the first data blocks according to the starting coordinates of the first data blocks; Adjacent data blocks are selected from the sorted list of the first data blocks based on a greedy algorithm to be merged, so as to obtain the reorganized disk space layout.

3. The method according to claim 2, It is characterized in that The step of selecting adjacent data blocks from the sorted list of the first data blocks based on a greedy algorithm to merge them to obtain the reorganized disk space layout includes: Traversing the sorted list, placing the first data block at a corresponding position in the disk space layout list; The disk space layout is determined by updating the position information of the first data block in the disk space layout list.

4. The method according to claim 1, It is characterized in that Before determining the spatial layout of the target disk according to the reorganized disk spatial layout, the method further includes: According to the disk space layout, updating the starting address and size of the second data block, the second data block being a data block whose space is not occupied by any disk metadata; updating the reorganized disk space layout according to the starting address and size of the second data block; Determining the spatial layout of the target disk according to the reorganized disk spatial layout includes: The updated disk space layout is determined as the space layout of the target disk.

5. The method according to claim 1, It is characterized in that After determining the spatial layout of the target disk according to the reorganized disk spatial layout, the method further includes: The data block merging strategy is dynamically adjusted by real-time monitoring of the state parameters of the target disk, wherein the state parameters include the degree of fragmentation, available space, and read / write speed. The data block merging strategy is used to update the spatial layout of the target disk.

6. The method according to claim 1, It is characterized in that The initializing process of the first data block in the target disk based on the space information includes: Using a linked list to create a data structure corresponding to the target disk; According to the spatial information and the data structure, the first data block is stored in the data structure.

7. A data processing device, It is characterized in that include: An acquisition module is configured to acquire space information of a target disk; A processing module is configured to perform initialization processing on a first data block in the target disk based on the space information, the first data block being a data block whose space has been occupied by disk metadata; The reorganization module is configured to sort and reorganize the first data block after the initialization processing by using a greedy algorithm to obtain a reorganized disk space layout; The determination module is configured to determine the spatial layout of the target disk according to the reorganized disk spatial layout.

8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

9. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product having a computer program stored thereon, It is characterized in that When the computer program product is executed by a processor, the method according to any one of claims 1 to 6 is implemented.