CN111209257A - Method and device for fragmenting file system - Google Patents

Method and device for fragmenting file system Download PDF

Info

Publication number
CN111209257A
CN111209257A CN202010040003.3A CN202010040003A CN111209257A CN 111209257 A CN111209257 A CN 111209257A CN 202010040003 A CN202010040003 A CN 202010040003A CN 111209257 A CN111209257 A CN 111209257A
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.)
Granted
Application number
CN202010040003.3A
Other languages
Chinese (zh)
Other versions
CN111209257B (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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for fragmenting a file system, wherein a first file is generated according to the size of a preset file fragment and the size of a preset space fragment, and the first file is repeatedly filled in a storage space of the file system; intercepting each first file filled into 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 preset storage space occupancy rate; filling and writing 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; after fragmentation is carried out by using the technical scheme, the file system with the preset file fragment size and the preset space fragment size can be obtained, and the performance degradation condition of the file system is tested and evaluated by combining other performance testing tools so as to measure the quality of the file system to the fragmented processing logic.

Description

Method and device for fragmenting file system
[ technical field ] A method for producing a semiconductor device
The invention belongs to the technical field of computer reliability testing, and particularly relates to a method and a device for fragmenting a file system.
[ background of the invention ]
File system fragmentation is a widely existing problem in the field of computer storage. File fragmentation can cause increased metadata management pressure, fragmented data storage, and reduced system read-write performance. Thus, the ability to reduce fragmentation of the file system is an important measure of how good or bad the file system is.
In an existing file system testing scheme, the performance of a file system is often tested by simulating the read-write behavior of a user and performing a compression test on metadata and user data of the file system. However, when the read-write behavior of the user is simulated, a fragmentation scene of the file system required by the test cannot be formed, and thus it is difficult to accurately measure the performance of the file system.
[ summary of the invention ]
The invention aims to provide a method and a device for fragmenting a file system, which are used for generating corresponding fragmentation states of the file system according to different test requirements of the 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 preset file fragment and the size of the preset space fragment, and repeatedly filling the first file into a storage space of a file system;
intercepting each first file filled into 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 preset storage space occupancy rate;
and filling and writing the second file into the first free storage space, and deleting each cut first file to obtain the fragmented state of the file system 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 rate includes:
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 preset 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 according to the capacity of the first free storage space, the total capacity of the storage space, and the predetermined storage space occupancy rate includes:
calculating a first size of the second file according to the capacity of the first free storage space and the preset number of the second files;
calculating a second size of the second file according to the total capacity of the storage space, the preset storage space occupancy rate and the preset number of the second files;
comparing the first size and the second size results in a size of the second file.
Further, comparing the first size and the second size to obtain the size of the second file comprises:
comparing the size of the first dimension to the second dimension;
in response to the first size being greater than the second size, treating the first size as a size of a second file;
in response to the first size being equal to the second size, taking the first size or the second size as the size of the second file;
in response to the first size being less than the second size, the second size is taken 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 in response to the second size being taken as the size of the second file until the first free storage space is filled;
deleting each first file;
and continuing to fill in the second file until the second file is completely filled in.
Further, the sum of the predetermined file fragment size and the predetermined space fragment size is equal to the size of the first file.
Further, the size of the second file is larger than the size of the first file.
The other technical scheme of the invention is as follows: an apparatus for file system fragmentation, comprising:
the generating and filling module is used for generating a first file according to the size of the preset file fragment and the size of the preset space fragment and repeatedly filling the first file into a storage space of the file system;
the truncation module is used for truncating each first file filled into the storage space and generating a first free storage space;
the generating 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 and writing the second file into the first free storage space, deleting each cut first file and obtaining the fragmented state of the file system according with the test requirement.
The invention also discloses a technical scheme that: a device for fragmenting a file system comprises 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 one of the above method aspects when executing the computer program.
The invention also discloses a technical scheme that: a computer-readable storage medium, in which a computer program is stored, which computer program, when being executed by a processor, is adapted to carry out the method of any of the above-mentioned method solutions.
The invention has the beneficial effects that: the file system with the preset file fragment size and the preset space fragment size can be obtained after fragmentation is carried out by using the technical scheme, the fragment proportion and the residual space size can be accurately controlled in the file system, the scheme can achieve controllable, quantitative and automatic generation of file fragments in any file system supporting the POSIX standard, and the performance degradation condition of the file system is tested and evaluated by combining other performance testing tools so as to measure the advantages and disadvantages of the file system on fragmentation processing logic and provide an effective scheme and means for testing the file system.
[ description of the drawings ]
FIG. 1 is a schematic diagram of layout storage of file fragments and space fragments;
FIG. 2 is a flow chart of a method of manufacturing a document fragment in accordance with an embodiment of the present invention;
FIG. 3 is a storage diagram 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 the storage of a file system after 8KB files are truncated into 4KB files according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating a file system storing a second file according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a file system storage for deleting all first files in an embodiment of the present invention;
FIG. 8 is a schematic block diagram of an apparatus for manufacturing a fragment of a document according to an embodiment of the present invention;
fig. 9 is a schematic block diagram of an apparatus for manufacturing a document fragment according to an embodiment of the present invention.
[ detailed description ] embodiments
The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the 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 this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present invention and the appended claims, the terms "first," "second," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this 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 present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated 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 devices such as a mobile phone, a tablet computer, a vehicle-mounted device, a notebook computer, a super-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA) and the like, and the embodiment of the invention does not limit the specific type of the terminal device at all.
In the prior art, file fragmentation is caused by that files are stored in different places of the storage space of the file system in a scattered manner, rather than being stored in the storage space of the file system continuously, and the more fragments of files in the storage space of the file system, the slower the system reads and creates the files.
In the present invention, file system fragmentation is defined into two major classes:
file fragmentation: due to frequent file system add, delete, and change operations, and metadata management limitations, some large files may be fragmented by the file system, with different portions distributed to different physical locations on the disk. The file system must track these file fragments, understand the specific physical locations of all components of a file, and provide the user with a continuous file access. Although these large files are still logically contiguous, in practice the physical location of different parts of these files on the physical device is not contiguous, forming a file fragment.
Free space fragmentation: in a file system, space that is not currently allocated for saving files is called free space. Due to the existence of file fragments, the file fragments physically divide the free space into fragments as well. The file system must be responsible for keeping track of the fragmentation on these free spaces and knowing at any time which locations on the underlying physical device are free spaces that can be allocated.
The presence of file fragments and free space fragments presents challenges to the management of metadata for file systems. The file system must store information about each file fragment and free space fragment at a certain location to track the overall layout of the file system, resulting in metadata scatter and expansion, increased memory requirements, and low query efficiency.
The file system is seen as a contiguous space on which a number of files and directories are distributed. The distribution of file fragments and free space fragments is roughly as shown in fig. 1, from which it can be seen that:
1. file 1 and file 2 are divided 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 cut into 15 blocks of unequal size.
3. The file system needs to keep track of each file fragment, and the location and usage of each free space fragment, through metadata, which creates metadata management pressure.
In the technical scheme of the invention, fragments of the file system can be classified, different types of file system fragments can be generated in a targeted manner, different file system storage states can be generated, and the coping ability of the file system in the fragmented state is measured by combining the state of the file system with a file system detection tool so as to form a detection result of the file system in the state.
This embodiment describes a method for fragmenting a file system, taking generating file fragments and free space fragments of 4KB as an example, with reference to fig. 2, and the specific process is as follows:
step S1, generating a first file according to the predetermined file fragment size and the predetermined space fragment size, and repeatedly filling the first file in the storage space of the file system.
Step S2 is to truncate each first file filled into the storage space, and generate a first free storage space.
And step 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 step S4, filling the second file into the first free storage space, and deleting each cut first file to obtain the fragmented state of the file system meeting the test requirement.
The file system with the preset file fragment size and the preset space fragment size can be obtained after fragmentation is carried out by using the technical scheme, the fragment proportion and the residual space size can be accurately controlled in the file system, the scheme can achieve controllable, quantitative and automatic generation of file fragments in any file system supporting the POSIX standard, and the performance degradation condition of the file system is tested and evaluated by combining other performance testing tools so as to measure the advantages and disadvantages of the file system on fragmentation processing logic and provide an effective scheme and means for testing the file system.
In step S1, as shown in fig. 3, a just-created blank file system is initially composed of contiguous free space. The present embodiment fills the file system by writing multiple 8KB sized files (i.e., the first file). Since most file systems are allocated as contiguously as possible, each 8KB file is contiguous. In order to meet the requirements of the file system test state on the file fragmentation and the space fragmentation, the size of the first file is set to be the sum of the size of the preset file fragmentation and the size of the preset space fragmentation. As a possible implementation, when the remaining space in the storage space is not enough to store the last complete 8KB file (i.e. the first file), the file system will be full after the storage space is filled, and at this time, the size of the last file will be less than 8 KB.
In this embodiment, the file fragment size is 4KB, and the size for truncating the file is also 4 KB. The free space fragment size is equal to the size of the first file minus the predetermined file fragment size, i.e. 8-4 KB. According to the method, the size of the preset file fragment in the test state of the file system is set to be X, the size of the preset free space fragment is set to be Y, and then the size of the first file filled for the first time is set to be X + Y.
For example: the file system test state requires the generation of 8KB fragments of a file and spacing of 4KB slots. Then the first file size filled in the blank file system for the first time is 8KB +4 KB-12 KB. Subsequently, while the first file is being truncated, the 8KB file is truncated, leaving the 4KB file, resulting in an 8KB gap that is used to fill out the second file, and the remaining 4KB file is eventually deleted, resulting in a gap.
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 index for generating metadata pressure of the file system, it is meaningful to add the 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 time, file fragments are not formed;
b. there is no free space at this point because the file system is already filled with 8KB files.
In step S2, each 8KB file can be truncated to a size of 4KB by a related call such as "truncate ()" provided by the POSIX file system. As shown in FIG. 5, a data distribution of "4 KB file-4 KB free space-4 KB file- … …" is formed on the file system.
After the step is completed, the following effects are achieved:
a. no file fragmentation is currently generated because each complete 4KB file is contiguous;
b. since each file is truncated from 8KB to 4KB, a free space is created at the end of each file. Since the space between each 4KB file is 4KB, many 4KB free space fragments are generated, which can also be called "slots" filled with 4KB on the file system.
In step S3, one or more extra-large files are written into the file system currently filled with 4KB slots, and the entire file system is finally filled, that is, the entire file system is filled with one or more second files, and the number of specific files is specified according to the test status of the file system.
In this step only one second file is used to fill the whole file system. And dividing the free space of the current file system by the preset number of second files to obtain the size of each second file, and filling the whole file system with the number of files required by the test state of the file system. Namely: and if the total amount of free space of the file system is F and the number of files required by the test state of the file system is N, the size of each second file is F/N in the filling process.
Specifically, in this example, a second file is taken as an example, and in order to form the 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 composed of all 4KB slots, the newly written second file is divided by the file system into many 4KB tiles, which are 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 block is reserved. The data layout at this time is as shown in fig. 6, and after this step is completed, the following effects are achieved:
a. the second file is divided into a plurality of blocks, thus, a large number of file fragments are generated;
b. the file system is filled up 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 of the file system. Generally, the more free space, the better the performance in general, and the worse the other way around. The fact that the free space is large means that the available resources of the file system are large, the flexibility of the rolling distribution is high, the situations of catching elbows are few, and the performance is high. Since the file system occupancy may need to be specified in the file system test, the file system occupancy also needs to be considered when generating the second file.
Before filling the second files, the total space size of the file system is calculated, the total space size is multiplied by the occupancy percentage P specified in the test state of the file system, the obtained result is divided by the number of the fragmented files to obtain the size of each second file, and then the filling of the file system by the second files is started.
Specifically, when the size of the second file calculated after considering the file system occupancy rate is possibly different from the size of the second file calculated through the first free space, three situations may occur:
a. the size of the second file calculated after taking the occupancy rate of the file system into account is equal to the size of the second file calculated by the first free space. In this case, 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 one of the calculation manners can be used as the final size of the second file.
b. The size of the second file calculated after considering the occupancy rate of the file system 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 by the size of the second file calculated after taking into account the file system occupancy. The size of the second file should be calculated through the first free space, so that the fragmentation of the file system can be ensured to be more thorough.
c. The size of the second file calculated after considering the occupancy rate of the file system is larger than the size of the second file calculated through the first free space. Meaning that the filling in according to the size of the second file calculated after taking the file system occupancy into account will exceed the remaining space and cannot be continued. The size of the second file considering the occupancy rate of the file system should be taken as a standard at this time. And after the whole file system is filled, deleting the previous first file, and then continuously filling the second file until the space occupancy rate specified by the file system test state is reached.
As can be seen from the above calculation process, the size of the second file is MAX (P/N, F/N), that is, the maximum value is selected from the size of the second file calculated in consideration of the file system occupancy rate and the size of the second file calculated by the first free space.
Namely, the step of generating the 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 comprises the following steps:
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 preset storage space occupancy rate; and generating a second file according to the size of the second file.
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 comprises:
calculating a first size of the second file according to the capacity of the first free storage space and the preset number of the second files; calculating a second size of the second file according to the total capacity of the storage space, the preset storage space occupancy rate and the preset number of the second files; comparing the first size and the second size results in a size of the second file.
Comparing the first size and the second size to obtain a size of the second file comprises:
comparing the size of the first dimension to the second dimension; in response to the first size being greater than the second size, treating the first size as a size of a second file; in response to the first size being equal to the second size, taking the first size or the second size as the size of the second file; in response to the first size being less than the second size, the second size is taken as the size of the second file.
In step S4, all the first files of 4KB are deleted from the currently filled file system, forming a 4KB slot, as shown in FIG. 7. On the present file system:
a. file fragmentation: a second file is split into many 4KB chunks, forming very scattered file fragments;
b. free space fragmentation: the free space of the file system is divided by the file fragmentation into a number of slots of 4KB, forming a severe fragmentation.
However, after the entire file system is filled, the second file is not filled, at this time, the previous first file is deleted, and the filling of the second file is continued 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 comprises:
filling the second file into the first free storage space in response to the second size being taken as the size of the second file until the first free storage space is filled; deleting each first file; and continuing to fill in the second file until the second file is completely filled in.
Under such a severe fragmentation condition, the file system has to consume a large amount of metadata to track each file fragment and each free space, and during the read-write process of the file system with severe fragmentation, management, query, update, etc. of the metadata consume extremely high system resources, and the performance is severely reduced. In this state, that is, the predetermined test state of the file system is reached, the file system can be tested by the test tool, and the test result of the file system can be obtained.
Another embodiment of the present invention discloses an apparatus for fragmenting a file system, as shown in fig. 8, including:
the generating and filling module is used for generating a first file according to the size of the preset file fragment and the size of the preset space fragment and repeatedly filling the first file into a storage space of a file system;
and the truncation module is used for truncating each first file filled in the storage space and generating a first free storage space.
And the generating 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 and writing the second file into the first free storage space, deleting each cut first file and obtaining the fragmented state of the file system meeting the test requirement.
It should be noted that, because the contents of information interaction, execution process, and the like between the modules are based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to specifically in the method embodiment section, and are not described herein again.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely illustrated, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional modules are only used for distinguishing one functional module from another, and are not used for limiting the protection scope of the application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are 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, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the method in the above-described method embodiment is implemented.
A file system fragmentation device 6 may be a computing device such as a desktop computer, a laptop, a palmtop computer, or a cloud server. The device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that fig. 9 is merely an example of the device 6, and does not constitute a limitation on the device 6, and may include more or less components than those shown, or combine certain components, or different components, such as input output devices, network access devices, etc.
The Processor 60 may be a Central Processing Unit (CPU), and the Processor 60 may be other general-purpose processors, Digital Signal Processors (DSPs), and the like. 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 also be an external storage device of the device 6 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the device 6. Further, the memory 61 may also include both an internal storage unit of the device 6 and an external storage device. The memory 61 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 61 may also be used to temporarily store data that has been output or is to be output.
In a further embodiment of the invention, a computer-readable storage medium is disclosed, in which a computer program is stored which, when being executed by a processor, carries out the method of the above-mentioned method embodiment.
Embodiments of the present invention further provide a computer program product, which when run on an apparatus for manufacturing file fragments, enables the apparatus for manufacturing file fragments to implement the steps in the above method embodiments.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or apparatus capable of carrying computer program code to a terminal device, recording medium, computer Memory, Read-Only Memory (ROM), Random-Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative modules and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations 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 implementation. 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 by the present invention, it should be understood that the disclosed apparatus/device and method can be implemented in other ways. For example, the above-described apparatus/device embodiments are merely illustrative, and for example, a division of modules is merely a division of logical functions, and an actual implementation may have another division, for example, a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not executed.
Modules described as separate components may or may not be physically separate, and modules may or may not be physical units, i.e., 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 the present embodiment.

Claims (10)

1. A method of file system fragmentation, comprising:
generating a first file according to the size of the preset file fragment and the size of the preset space fragment, and repeatedly filling the first file into a storage space of a file system;
intercepting each first file filled into 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 preset storage space occupancy rate;
and 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.
2. The method of claim 1, wherein generating a second file based on the capacity of the first free storage space, the total capacity of the storage spaces, and a predetermined storage 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 preset storage space occupancy rate;
and generating a second file according to the size of the second file.
3. The method of claim 2, wherein 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 occupancy comprises:
calculating a first size of a second file according to the capacity of the first free storage space and the preset number of the second files;
calculating a second size of the second file according to the total capacity of the storage space, the preset storage space occupancy rate and the preset number of the second files;
and comparing the first size with the second size to obtain the size of the second file.
4. The method of claim 3, wherein comparing the first size to the second size to obtain the size of the second file comprises:
comparing the size of the first dimension to the second dimension;
in response to the first size being greater than the second size, treating the first size as a size of a second file;
in response to the first size being equal to the second size, taking the first size or the second size as the size of the second file;
in response to the first size being less than the second size, the second size is taken as the size of the second file.
5. The method of claim 4, wherein filling the first free storage space with the second file comprises:
filling a second file into the first free storage space in response to the second size being the size of the second file until the first free storage space is filled;
deleting each of the first files;
and continuing to fill in the second file until the second file is completely filled in.
6. A method of file system fragmentation as claimed in claim 2 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.
7. A method of file system fragmentation as claimed in any of claims 2 to 5 in which the size of the second file is greater than the size of the first file.
8. An apparatus for file system fragmentation, comprising:
the generating and filling module is used for generating a first file according to the size of the preset file fragment and the size of the preset space fragment and repeatedly filling the first file into a storage space of a file system;
the truncation module is used for truncating each first file filled into the storage space and generating a first free storage space;
the generating 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 and writing the second file into the first free storage space, deleting each cut first file and obtaining the fragmented state of the file system meeting the test requirement.
9. A device for file system fragmentation, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
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 true CN111209257A (en) 2020-05-29
CN111209257B 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)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113609082A (en) * 2021-06-25 2021-11-05 苏州浪潮智能科技有限公司 File system defragmentation method, device and storage medium
US20220066991A1 (en) * 2020-09-02 2022-03-03 Micro Focus Llc Command line utility to generate user-controlled fragmentated test data on a hard disk drive
CN114238249A (en) * 2022-02-25 2022-03-25 成都鲁易科技有限公司 File system aging evaluation method and device, storage medium and terminal
CN116028327A (en) * 2023-02-20 2023-04-28 成都佰维存储科技有限公司 File system read-write performance test method and device, readable storage medium and equipment

Citations (9)

* 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
US20050027934A1 (en) * 2003-07-30 2005-02-03 International Business Machines Corporation Disk fragmentation test system
CN1975935A (en) * 2006-12-15 2007-06-06 北京中星微电子有限公司 External storing performance testing method and apparatus
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
CN107656939A (en) * 2016-07-26 2018-02-02 南京中兴新软件有限责任公司 File wiring method and device
CN110221781A (en) * 2019-06-04 2019-09-10 Oppo广东移动通信有限公司 A kind of manufacturing method of disk fragments, device, storage medium and intelligent terminal
CN110502414A (en) * 2019-08-20 2019-11-26 Oppo广东移动通信有限公司 Terminal device performance test methods, device, terminal device and storage medium

Patent Citations (9)

* 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
US20050027934A1 (en) * 2003-07-30 2005-02-03 International Business Machines Corporation Disk fragmentation test system
CN1975935A (en) * 2006-12-15 2007-06-06 北京中星微电子有限公司 External storing performance testing method and apparatus
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
CN107656939A (en) * 2016-07-26 2018-02-02 南京中兴新软件有限责任公司 File wiring method and device
CN110221781A (en) * 2019-06-04 2019-09-10 Oppo广东移动通信有限公司 A kind of manufacturing method of disk fragments, device, storage medium and intelligent terminal
CN110502414A (en) * 2019-08-20 2019-11-26 Oppo广东移动通信有限公司 Terminal device performance test methods, device, terminal device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱浩: "SSD文件系统优化技术的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220066991A1 (en) * 2020-09-02 2022-03-03 Micro Focus Llc Command line utility to generate user-controlled fragmentated test data on a hard disk drive
CN113609082A (en) * 2021-06-25 2021-11-05 苏州浪潮智能科技有限公司 File system defragmentation method, device and storage medium
CN113609082B (en) * 2021-06-25 2023-07-18 苏州浪潮智能科技有限公司 File system defragmentation method, device and storage medium
CN114238249A (en) * 2022-02-25 2022-03-25 成都鲁易科技有限公司 File system aging evaluation method and device, storage medium and terminal
CN116028327A (en) * 2023-02-20 2023-04-28 成都佰维存储科技有限公司 File system read-write performance test method and device, readable storage medium and equipment
CN116028327B (en) * 2023-02-20 2023-06-13 成都佰维存储科技有限公司 File system read-write performance test method and device, readable storage medium and equipment

Also Published As

Publication number Publication date
CN111209257B (en) 2023-05-09

Similar Documents

Publication Publication Date Title
CN111209257A (en) Method and device for fragmenting file system
CN106919675B (en) Data storage method and device
CN108733306B (en) File merging method and device
CN111324303B (en) SSD garbage recycling method, SSD garbage recycling device, computer equipment and storage medium
CN105224237A (en) A kind of date storage method and device
CN108121813B (en) Data management method, device, system, storage medium and electronic equipment
CN112395322B (en) List data display method and device based on hierarchical cache and terminal equipment
CN113190503B (en) File system capacity expansion method and device, electronic equipment and storage medium
CN115662489A (en) Hard disk test method and device, electronic equipment and storage medium
CN111984204B (en) Data reading and writing method and device, electronic equipment and storage medium
CN114996173B (en) Method and device for managing write operation of storage equipment
CN111522574B (en) Differential packet generation method and related equipment
CN113791735A (en) Video data storage method and device, computer equipment and storage medium
CN111158606B (en) Storage method, storage device, computer equipment and storage medium
CN116842012A (en) Method, device, equipment and storage medium for storing Redis cluster in fragments
CN107315806B (en) Embedded storage method and device based on file system
US12093234B2 (en) Data processing method, apparatus, electronic device, and computer storage medium
CN111158994B (en) Method and device for testing pressing performance
CN113485713A (en) Method and device for quickly compiling program, electronic equipment and storage medium
WO2015058628A1 (en) File access method and device
CN112015672A (en) Data processing method, device, equipment and storage medium in storage system
CN112380174A (en) XFS file system analysis method containing deleted files, terminal equipment and storage medium
CN111090633A (en) Small file aggregation method, device and equipment of distributed file system
CN111625192B (en) Metadata object access method, device, equipment and medium
CN117271440B (en) File information storage method, reading method and related equipment based on freeRTOS

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

GR01 Patent grant
GR01 Patent grant