CN111209257B - File system fragmentation method and device - Google Patents

File system fragmentation method and device Download PDF

Info

Publication number
CN111209257B
CN111209257B CN202010040003.3A CN202010040003A CN111209257B CN 111209257 B CN111209257 B CN 111209257B CN 202010040003 A CN202010040003 A CN 202010040003A CN 111209257 B CN111209257 B CN 111209257B
Authority
CN
China
Prior art keywords
file
size
storage space
file system
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010040003.3A
Other languages
Chinese (zh)
Other versions
CN111209257A (en
Inventor
陈鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Orca Data Technology Xian Co Ltd
Original Assignee
Orca Data Technology Xian Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Orca Data Technology Xian Co Ltd filed Critical Orca Data Technology Xian Co Ltd
Priority to CN202010040003.3A priority Critical patent/CN111209257B/en
Publication of CN111209257A publication Critical patent/CN111209257A/en
Application granted granted Critical
Publication of CN111209257B publication Critical patent/CN111209257B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Abstract

The invention discloses a method and a device for fragmentation of a file system, which are used for generating a first file according to the size of fragments of a preset file and the size of fragments of a preset space, and repeatedly filling the first file into a storage space of the file system; intercepting each first file filled in the storage space to generate a first free storage space; generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and the predetermined storage space occupancy rate; filling the second files into the first free storage space, and deleting each first file after interception to obtain a file system fragmentation state meeting the test requirement; after the technical scheme is used for fragmentation, a file system with a preset file fragment size and a preset space fragment size can be obtained, and the performance degradation condition of the file system is tested and evaluated by combining with other performance testing tools so as to measure the advantages and disadvantages of the file system on fragmented processing logic.

Description

File system fragmentation method and device
[ field of technology ]
The invention belongs to the technical field of computer reliability test, and particularly relates to a method and a device for file system fragmentation.
[ background Art ]
File system fragmentation is a widely occurring problem in the field of computer storage. File fragmentation can lead to increased metadata management pressure, fragmentation of data storage, and reduced system read-write performance. Thus, the ability to reduce file system fragmentation is an important indicator of how good a file system is.
In existing file system test schemes, the performance of a file system is often detected by simulating the read-write behavior of a user and performing a pressurization test on metadata and user data of the file system. However, when performing the user-simulated read-write behavior, a file system fragmentation scene required for the test cannot be formed, which makes it difficult to accurately measure the performance of the file system.
[ invention ]
The invention aims to provide a method and a device for file system fragmentation, which are used for generating corresponding file system fragmentation states according to different test requirements of a file system.
The invention adopts the following technical scheme: a method of file system fragmentation, comprising:
generating a first file according to the size of the fragments of the preset file and the size of the fragments of the preset space, and repeatedly filling the first file into a storage space of a file system;
intercepting each first file filled in the storage space to generate a first free storage space;
generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and the predetermined storage space occupancy rate;
filling the second files into the first free storage space, and deleting each first file after interception to obtain a file system fragmentation state meeting the test requirement.
Further, generating the second file according to the capacity of the first free storage space, the total capacity of the storage space, and the predetermined storage space occupancy comprises:
calculating the size of the second file according to the capacity of the first free storage space, the total capacity of the storage space and the predetermined storage space occupancy rate;
and generating a second file according to the size of the second file.
Further, calculating the size of the second file based on the capacity of the first free storage space, the total capacity of the storage space, and the predetermined storage space occupancy comprises:
calculating a first size of the second file according to the capacity of the first free storage space and the predetermined number of the second file;
calculating a second size of the second file according to the total capacity of the storage space, the predetermined storage space occupancy rate and the predetermined number of the second file;
comparing the first size with the second size results in a size of the second file.
Further, comparing the first size with the second size to obtain the size of the second file includes:
comparing the first dimension to the second dimension;
in response to the first size being greater than the second size, taking the first size as a size of the second file;
in response to the first size being equal to the second size, regarding the first size or the second size as a size of the second file;
and in response to the first size being smaller than the second size, taking the second size as the size of the second file.
Further, filling the second file into the first free storage space includes:
filling the second file into the first free storage space until the first free storage space is filled up in response to taking the second size as the size of the second file;
deleting each first file;
and continuing to fill in the second file until the second file is filled out.
Further, the sum of the predetermined document fragment size and the predetermined space fragment size is equal to the size of the first document.
Further, the second file has a size greater than the size of the first file.
Another technical scheme of the invention is as follows: an apparatus for file system fragmentation, comprising:
the generation filling module is used for generating a first file according to the size of the fragments of the preset file and the size of the fragments of the preset space, and repeatedly filling the first file into the storage space of the file system;
the intercepting module is used for intercepting each first file filled in the storage space to generate a first free storage space;
the generation module is used for generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and the preset storage space occupancy rate;
and the filling and deleting module is used for filling the second file into the first free storage space and deleting each cut first file to obtain a file system fragmentation state meeting the test requirement.
The invention also provides a technical scheme that: an apparatus for file system fragmentation, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor executing the computer program to implement a method of any of the above method aspects.
The invention also provides a technical scheme that: a computer readable storage medium storing a computer program which when executed by a processor performs a method of any of the above method aspects.
The beneficial effects of the invention are as follows: after the technical scheme is used for fragmentation, a file system with a preset file fragment size and a preset space fragment size can be obtained, in the file system, the fragment proportion and the residual space size can be accurately controlled, the file fragments can be controllably, quantitatively and automatically generated in any file system supporting the POSIX standard, and the performance degradation condition of the file system can be tested and evaluated by combining with other performance testing tools, so that the advantages and disadvantages of the file system on fragmented processing logic are measured, and an effective scheme and means are provided for testing the file system.
[ description of the drawings ]
FIG. 1 is a schematic layout store of file shards and space shards;
FIG. 2 is a flow chart of a method of manufacturing file fragments according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating the storage of a blank file system according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a file system filled with 8KB files according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a file system storage after cutting an 8KB file into a 4KB file according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating a file system storage after storing a second file according to an embodiment of the present invention;
FIG. 7 is a schematic diagram illustrating a file system for deleting all first files in an embodiment of the present invention;
FIG. 8 is a schematic block diagram of an apparatus for manufacturing document fragments according to an embodiment of the present invention;
fig. 9 is a schematic block diagram of an apparatus for manufacturing document fragments according to an embodiment of the present invention.
[ detailed description ] of the invention
The invention will be described in detail below with reference to the drawings and the detailed description.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, in the description of the present specification and the appended claims, the terms "first," "second," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The method for fragmenting the file system provided by the embodiment of the invention can be applied to terminal equipment such as mobile phones, tablet computers, vehicle-mounted equipment, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA) and the like, and the embodiment of the invention does not limit the specific types of the terminal equipment.
In the prior art, the file fragments are formed because files are stored in different places of the file system storage space in a scattered manner, rather than being stored in the file system storage space continuously, and the more file fragments in the file system storage space, the slower the speed of reading and creating files by the system.
In the present invention, file system shards are defined as two broad categories:
file fragments: because of the frequent addition, deletion, and modification operations to the file system, and metadata management limitations, some large files may be split by the file system, with different portions being distributed to different physical locations on the disk. The file system must track the file fragments, learn the specific physical locations of all the components of a file, and provide the user with a continuous file access. While these large files remain logically contiguous, in practice the physical locations of the different parts of the files on the physical device are discontinuous, forming file fragments.
Free space debris: in a file system, a space that is not currently allocated for saving files is called free space. Due to the existence of file fragments, physically the file fragments also split the free space into fragments. The file system must be responsible for tracking the shards on these free spaces, knowing at any time which locations on the underlying physical device are free spaces that can be allocated.
Metadata management for file systems is challenged by the existence of file fragments and free space fragments. The file system must store the information of each piece of file fragments and free space fragments somewhere to track the overall layout of the file system, resulting in metadata scattering and expansion, increased memory requirements, and inefficient queries.
The file system is considered as a continuous space over which many files and directories are distributed. The distribution of file fragments and free space fragments is generally as shown in fig. 1, from which it can be seen:
1. file 1 and file 2 are split into 4 and 11 blocks of unequal size, respectively, distributed to different physical locations.
2. Due to the fragmentation of file 1 and file 2, the free space of the file system is split into 15 blocks of unequal size.
3. The file system needs to track each file fragment, and the location and usage of each free space fragment through metadata, which creates a pressure on metadata management.
According to the technical scheme, fragments of the file system can be classified, different types of fragments of the file system can be generated in a targeted manner, different file system storage states are generated, and the corresponding capacity of the file system in the fragmentation state is measured by combining a file system detection tool through the state of the file system to form a detection result of the file system in the state.
Taking the example of generating 4KB file fragments and free space fragments as the example, a method for fragmenting a file system is described with reference to FIG. 2, and the specific process is as follows:
and S1, generating a first file according to the size of the fragments of the predetermined file and the size of the fragments of the predetermined space, and repeatedly filling the first file into a storage space of a file system.
And S2, cutting off each first file filled in the storage space to generate a first free storage space.
And S3, generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and the preset storage space occupancy rate.
And S4, filling the second files into the first free storage space, and deleting each cut first file to obtain a file system fragmentation state meeting the test requirement.
After the technical scheme is used for fragmentation, a file system with a preset file fragment size and a preset space fragment size can be obtained, in the file system, the fragment proportion and the residual space size can be accurately controlled, the file fragments can be controllably, quantitatively and automatically generated in any file system supporting the POSIX standard, and the performance degradation condition of the file system can be tested and evaluated by combining with other performance testing tools, so that the advantages and disadvantages of the file system on fragmented processing logic are measured, and an effective scheme and means are provided for testing the file system.
In step S1, a blank file system just created, as shown in fig. 3, is initially composed of contiguous free space. In this embodiment, the file system is filled by writing a plurality of files with a size of 8KB (i.e., the first file). Since most file systems are on a principle of continuous allocation as much as possible, each 8KB file is continuous. In order to meet the requirements of the file system test state on file fragments and space fragments, the size of the first file is set to be the sum of the size of the predetermined file fragments and the size of the predetermined space fragments. As a possible implementation, when the space remaining in the storage space is insufficient to store the last complete 8KB file (i.e., the first file), the file system may be filled after the storage space is filled, and the size of the last file may be less than 8KB.
In this embodiment, the size of the file fragment is 4KB, and the size of the file to be truncated is also 4KB. The free space fragment size is equal to the size of the first file minus the predetermined file fragment size, i.e. 8-4 = 4KB. According to the method, the size of the predetermined file fragment in the file system test state is set to be X, the size of the predetermined free space fragment is set to be Y, and then the first file size filled for the first time is set to be X+Y.
For example: the file system test state requires that 8KB of file fragments be generated and that 4KB of slots be spaced apart. Then the first file size to fill in the blank file system for the first time is 8kb+4kb=12kb. Subsequently, when the first file is truncated, 8KB is truncated, the 4KB file is reserved, and thus an 8KB gap is generated, the gap is used for filling the second file, and the reserved 4KB file is deleted finally, so that a gap is formed.
3) Number of fragmented files: i.e. the user can specify how many files the file system is filled with. Since the number of files is also a key indicator of the pressure at which metadata of the file system is generated, it is significant to add this control item. The size of each file is equal to the free space divided by the number of files.
Therefore, as shown in fig. 4, this step produces two effects:
a. at this point no file fragments have been formed yet;
b. there is no free space at this time because the file system is already filled with 8KB files.
In step S2, each 8KB file may be truncated to a 4KB size by an associated call such as "truncate ()" provided by the POSIX file system. As shown in FIG. 5, on the file system, a data distribution of "4KB File-4 KB free space-4 KB File- … …" is formed.
After this step is completed, the effect is achieved:
a. file fragmentation is not currently generated because every complete 4KB file is contiguous;
b. since each file is truncated from 8KB to 4KB, free space is created at the end of each file. Since the space fragments that are separated by each 4KB file are 4KB, many 4KB free space fragments, also called "gaps" of 4KB on the file system, are created.
In step S3, one or more oversized files are written into the file system currently covered with the 4KB space, and finally the whole file system is filled, that is, the whole file system is filled with one or more second files, and the number of specific files is specified according to the test state of the file system.
In this step, the entire file system is filled with only one second file. Dividing the free space of the current file system by the preset second file number to obtain the size of each second file, and filling the whole file system by using the file number required by the file system test state. Namely: and setting the total amount of free space of the file system as F and the number of files required by the test state of the file system as N, wherein in the filling process, the size of each second file is F/N.
Specifically, in this embodiment, a second file is taken as an example, and in order to form a file system test status requirement, the size of the second file is larger than that of the first file. Since the free space of the current file system is all composed of 4KB slots, the newly written second file is split by the file system into a number of 4KB small blocks and then filled into those slots. Specifically, if the second file is not an integer multiple of 4KB, for example, the last file block of the second file is 7KB, then part of the contents in the file block may be filled into the last free space, and the remaining 3KB file blocks remain. The data layout at this time is shown in fig. 6, and after this step is completed, the following effects are achieved:
a. the second file is split into a number of blocks, thus creating a number of file fragments;
b. the file system is filled with no free space.
It should be noted that, in the implementation of the file system, the amount of free space is likely to greatly affect the performance thereof. Generally, the more free space, the better the performance is generally, and vice versa. The more free space means that the more available resources of the file system, the more flexibility of rolling allocation, the fewer cases of catching the front and turning the elbow, and the higher performance. Since in file system testing it may be necessary to specify the file system occupancy, the file system occupancy also needs to be taken into account when generating the second file.
Before filling the second files, calculating the total space size of the file system, multiplying the total space size by the percentage P of the occupancy rate specified in the file system test state, dividing the obtained result by the number of fragmented files to obtain the size of each second file, and then starting filling the file system with the second files.
Specifically, when the size of the second file calculated in consideration of the file system occupancy rate is likely to be different from the size of the second file calculated through the first free space, three cases may occur:
a. the size of the second file calculated in consideration of the file system occupancy is equal to the size of the second file calculated through the first free space. In this case, it means that the space occupancy specified by the file system test state is just satisfied after the current first free space is filled. At this time, the size of the second file calculated in any calculation manner may be used as the final size of the second file.
b. The size of the second file calculated in consideration of the file system occupancy rate is smaller than the size of the second file calculated through the first free space. Meaning that the current first free space is not filled up by the size of the second file calculated taking into account the file system occupancy. At this time, the size of the second file should be calculated through the first free space, so that the file system fragmentation can be ensured to be more thorough.
c. The size of the second file calculated in consideration of the file system occupancy rate is larger than the size of the second file calculated through the first free space. Meaning that filling with the size of the second file calculated taking into account the file system occupancy will exceed the remaining space and cannot continue. The size of the second file should be taken into account when this is the file system occupancy. After filling the whole file system, deleting the first file before, and then continuing filling the second file until the space occupancy rate specified by the file system test state is reached.
The above calculation process shows that the size of the second file is MAX (P/N, F/N), i.e., the maximum value is selected from the size of the second file calculated by considering the file system occupancy and the size of the second file calculated by the first free space.
That is, generating the second file based on the capacity of the first free storage space, the total capacity of the storage space, and the predetermined storage space occupancy comprises:
calculating the size of the second file according to the capacity of the first free storage space, the total capacity of the storage space and the predetermined storage space occupancy rate; and generating a second file according to the size of the second file.
Calculating the size of the second file based on the capacity of the first free storage space, the total capacity of the storage space, and the predetermined storage space occupancy comprises:
calculating a first size of the second file according to the capacity of the first free storage space and the predetermined number of the second file; calculating a second size of the second file according to the total capacity of the storage space, the predetermined storage space occupancy rate and the predetermined number of the second file; comparing the first size with the second size results in a size of the second file.
Comparing the first size with the second size to obtain the size of the second file includes:
comparing the first dimension to the second dimension; in response to the first size being greater than the second size, taking the first size as a size of the second file; in response to the first size being equal to the second size, regarding the first size or the second size as a size of the second file; and in response to the first size being smaller than the second size, taking the second size as the size of the second file.
In step S4, all the first files of 4KB are deleted from the file system currently being filled, forming a 4KB gap, as shown in fig. 7. On the current file system:
a. file fragments: a second file is split into a number of 4KB blocks, forming very scattered file fragments;
b. free space debris: the free space of the file system is divided into a plurality of 4KB gaps by file fragments, forming serious fragments.
However, after the whole file system is filled, the second file is not filled, at this time, the previous first file is deleted, and the second file is continuously filled until the space occupancy rate specified by the file system test state is reached.
Namely: filling the second file into the first free storage space includes:
filling the second file into the first free storage space until the first free storage space is filled up in response to taking the second size as the size of the second file; deleting each first file; and continuing to fill in the second file until the second file is filled out.
Under such serious fragmentation situation, the file system has to consume massive metadata to track each piece of file fragments and each piece of free space, and in the process of reading and writing the file system with serious fragmentation, the management, inquiry, update and the like of the metadata consume extremely high system resources, and the performance is seriously reduced. In this state, that is, the predetermined test state of the file system is reached, the file system can be tested by a test tool, and then the test result of the file system is obtained.
Another embodiment of the present invention discloses an apparatus for file system fragmentation, as shown in fig. 8, including:
the generation filling module is used for generating a first file according to the size of the fragments of the preset file and the size of the fragments of the preset space, and repeatedly filling the first file into the storage space of the file system;
the intercepting module is used for intercepting each first file filled in the storage space and generating a first free storage space.
And the generation module is used for generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and the preset storage space occupancy rate.
And the filling and deleting module is used for filling the second file into the first free storage space and deleting each cut first file to obtain a file system fragmentation state meeting the test requirement.
It should be noted that, because the content of information interaction and execution process between the modules and the embodiment of the method of the present invention are based on the same concept, specific functions and technical effects thereof may be referred to in the method embodiment section, and details thereof are not repeated herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional modules are only for distinguishing from each other, and are not used for limiting the protection scope of the application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In yet another embodiment of the present invention, an apparatus for file system fragmentation is disclosed, as shown in fig. 9, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method in the above method embodiments when executing the computer program.
The file system fragmentation device 6 may be a computing device such as a desktop computer, a notebook computer, a palm top computer, and a cloud server. The device may include, but is not limited to, a processor 60 and a memory 61. It will be appreciated by those skilled in the art that fig. 9 is merely an example of the device 6 and is not meant to be limiting as to the device 6, and may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The processor 60 may be a central processing unit (Central Processing Unit, CPU), the processor 60 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may in some embodiments be an internal storage unit of the device 6, such as a hard disk or a memory of the device 6. The memory 61 may in other embodiments also be an external storage device of the device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the device 6. Further, the memory 61 may also include both internal storage units of the device 6 and external storage devices. The memory 61 is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs, such as program codes of the computer programs. The memory 61 may also be used to temporarily store data that has been output or is to be output.
In yet another embodiment of the invention a computer readable storage medium is disclosed, the computer readable storage medium storing a computer program which, when executed by a processor, implements the method of the above-described method embodiments.
The embodiments of the present invention also provide a computer program product which, when run on an apparatus for manufacturing document shreds, causes the apparatus for manufacturing document shreds to perform the steps in the method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above-described embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of the method embodiments described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a terminal device, a recording medium, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the modules and steps of the examples described in connection with the embodiments disclosed herein can be implemented as electronic hardware, or as a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/device and method may be implemented in other manners. For example, the apparatus/device embodiments described above are merely illustrative, e.g., the division of modules is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple modules may be combined or integrated into another system, or some features may be omitted or not performed.
The modules illustrated as separate components may or may not be physically separate, and may or may not be physical units, may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

Claims (8)

1. A method of file system fragmentation, comprising:
generating a first file according to the size of the fragments of the preset file and the size of the fragments of the preset space, and repeatedly filling the first file into a storage space of a file system;
intercepting each first file filled in the storage space to generate a first free storage space;
generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and a preset storage space occupancy rate;
filling the second files into the first free storage space, and deleting each cut first file to obtain a file system fragmentation state meeting the test requirement;
calculating the size of the second file based on the capacity of the first free storage space, the total capacity of the storage space, and a predetermined storage space occupancy comprises:
calculating a first size of a second file according to the capacity of the first free storage space and a predetermined number of the second files;
calculating a second size of a second file according to the total capacity of the storage space, the preset storage space occupancy rate and the preset number of the second file;
comparing the first size with the second size to obtain the size of the second file.
2. The method of file system fragmentation of claim 1, wherein comparing the first size to the second size to obtain the size of the second file comprises:
comparing the first dimension to the second dimension;
in response to the first size being greater than the second size, taking the first size as a size of the second file;
in response to the first size being equal to the second size, regarding the first size or the second size as a size of the second file;
and in response to the first size being smaller than the second size, taking the second size as the size of the second file.
3. The method of file system fragmentation of claim 2, wherein filling the second file into the first free storage space comprises:
filling a second file into the first free storage space until the first free storage space is filled up in response to taking the second size as the size of the second file;
deleting each first file;
and continuing to fill the second file until the second file is filled.
4. A method of file system fragmentation as claimed in claim 1, in which the sum of the predetermined file fragment size and the predetermined space fragment size is equal to the size of the first file.
5. A method of file system fragmentation as claimed in any of claims 2 to 3, in which the size of the second file is larger than the size of the first file.
6. An apparatus for file system fragmentation, comprising:
the generation filling module is used for generating a first file according to the size of the fragments of the preset file and the size of the fragments of the preset space, and repeatedly filling the first file into the storage space of the file system;
the intercepting module is used for intercepting each first file filled in the storage space to generate a first free storage space;
the generation module is used for generating a second file according to the capacity of the first free storage space, the total capacity of the storage space and the preset storage space occupancy rate;
the filling and deleting module is used for filling the second files into the first free storage space and deleting each first file after being cut off to obtain a file system fragmentation state meeting the test requirement;
calculating the size of the second file based on the capacity of the first free storage space, the total capacity of the storage space, and a predetermined storage space occupancy comprises:
calculating a first size of a second file according to the capacity of the first free storage space and a predetermined number of the second files;
calculating a second size of a second file according to the total capacity of the storage space, the preset storage space occupancy rate and the preset number of the second file;
comparing the first size with the second size to obtain the size of the second file.
7. An apparatus for file system fragmentation comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 5 when executing the computer program.
8. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 5.
CN202010040003.3A 2020-01-15 2020-01-15 File system fragmentation method and device Active CN111209257B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010040003.3A CN111209257B (en) 2020-01-15 2020-01-15 File system fragmentation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010040003.3A CN111209257B (en) 2020-01-15 2020-01-15 File system fragmentation method and device

Publications (2)

Publication Number Publication Date
CN111209257A CN111209257A (en) 2020-05-29
CN111209257B true CN111209257B (en) 2023-05-09

Family

ID=70789136

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010040003.3A Active CN111209257B (en) 2020-01-15 2020-01-15 File system fragmentation method and device

Country Status (1)

Country Link
CN (1) CN111209257B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113609082B (en) * 2021-06-25 2023-07-18 苏州浪潮智能科技有限公司 File system defragmentation method, device and storage medium
CN114238249B (en) * 2022-02-25 2022-05-10 成都鲁易科技有限公司 File system aging evaluation method and device, storage medium and terminal
CN116028327B (en) * 2023-02-20 2023-06-13 成都佰维存储科技有限公司 File system read-write performance test method and device, readable storage medium and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5778392A (en) * 1996-04-01 1998-07-07 Symantec Corporation Opportunistic tile-pulling, vacancy-filling method and apparatus for file-structure reorganization
CN105304140A (en) * 2014-06-13 2016-02-03 北京安兔兔科技有限公司 Method and apparatus for testing memory performance of electronic equipment
CN105446848A (en) * 2014-06-13 2016-03-30 北京安兔兔科技有限公司 Electronic device data processing performance test method and device
CN106155878A (en) * 2015-03-24 2016-11-23 富士施乐实业发展(中国)有限公司 For the method and apparatus being created for the test environment of software test in data base

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7089354B2 (en) * 2003-07-30 2006-08-08 International Business Machines Corporation Disk fragmentation test system
CN100440383C (en) * 2006-12-15 2008-12-03 北京中星微电子有限公司 External storing performance testing method and apparatus
CN107656939A (en) * 2016-07-26 2018-02-02 南京中兴新软件有限责任公司 File wiring method and device
CN110221781B (en) * 2019-06-04 2022-08-23 Oppo广东移动通信有限公司 Manufacturing method and device of disk fragments, storage medium and intelligent terminal
CN110502414B (en) * 2019-08-20 2023-08-29 Oppo广东移动通信有限公司 Terminal equipment performance test method and device, terminal equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5778392A (en) * 1996-04-01 1998-07-07 Symantec Corporation Opportunistic tile-pulling, vacancy-filling method and apparatus for file-structure reorganization
CN105304140A (en) * 2014-06-13 2016-02-03 北京安兔兔科技有限公司 Method and apparatus for testing memory performance of electronic equipment
CN105446848A (en) * 2014-06-13 2016-03-30 北京安兔兔科技有限公司 Electronic device data processing performance test method and device
CN106155878A (en) * 2015-03-24 2016-11-23 富士施乐实业发展(中国)有限公司 For the method and apparatus being created for the test environment of software test in data base

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SSD文件系统优化技术的研究与实现;朱浩;《中国优秀硕士学位论文全文数据库 信息科技辑》;2012年(第02期);I138-1489 *

Also Published As

Publication number Publication date
CN111209257A (en) 2020-05-29

Similar Documents

Publication Publication Date Title
CN111209257B (en) File system fragmentation method and device
US9658826B2 (en) Sorting multiple records of data using ranges of key values
KR102050725B1 (en) Computing system and method for managing data in the system
CN108733306B (en) File merging method and device
CN105224237A (en) A kind of date storage method and device
CN111324303B (en) SSD garbage recycling method, SSD garbage recycling device, computer equipment and storage medium
CN110995776B (en) Block distribution method and device of block chain, computer equipment and storage medium
CN111125033B (en) Space recycling method and system based on full flash memory array
CN105117351A (en) Method and apparatus for writing data into cache
CN109086141B (en) Memory management method and device and computer readable storage medium
CN114996173B (en) Method and device for managing write operation of storage equipment
CN111414362A (en) Data reading method, device, equipment and storage medium
CN104750432A (en) Data storage method and device
CN109783321B (en) Monitoring data management method and device and terminal equipment
CN105493080A (en) Method and apparatus for context aware based data de-duplication
CN111158994B (en) Method and device for testing pressing performance
CN112380171B (en) YAFFS file system OOB identification method, terminal device and storage medium
CN114374392A (en) Data compression storage method and device, terminal equipment and readable storage medium
US6510499B1 (en) Method, apparatus, and article of manufacture for providing access to data stored in compressed files
CN111858590B (en) Storage system metadata organization method, system, terminal and storage medium
CN113806803A (en) Data storage method, system, terminal equipment and storage medium
EP3048541A1 (en) File access method and device
CN114756523A (en) Distributed storage method, device and medium
CN112015672A (en) Data processing method, device, equipment and storage medium in storage system
CN112506651A (en) Method and equipment for data operation in large-data-volume environment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 710000 Room 1202, 12th Floor, Cultural Creation Building, Yaodian Street Office, Qinhan New Town, Xixian New District, Xi'an, Shaanxi

Applicant after: Xi'an Okayun Data Technology Co.,Ltd.

Address before: No.6-2, Changxin Industrial Park, east section of Tiangong 1st Road, banxinzhuang village, ZhouLing street, Qinhan new town, Xixian New District, Xi'an City, Shaanxi Province, 710000

Applicant before: Xi'an Okayun Data Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant