Method and apparatus for simulating file system aging

By determining the storage capacity and file system type in a computing device, and copying and deleting small files in a specific ratio, the aging of the file system is simulated, which solves the problem of incomplete simulation of file system aging in existing technologies and improves the accuracy of performance testing.

CN113961519BActive Publication Date: 2026-02-03YANGTZE MEMORY TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111230055.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-19
Publication Date
2026-02-03
Estimated Expiration
2042-02-03

AI Technical Summary

Technical Problem

Existing technologies cannot effectively simulate the aging process of a computing device's file system, resulting in incomplete performance testing.

Method used

By determining the device's storage capacity and file system type, small files of different sizes are copied in a specific ratio, and some small files are deleted at predetermined intervals to simulate the aging process of the file system.

Benefits of technology

The file system fragmentation level has been optimized, improving the accuracy and effectiveness of performance testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113961519B_ABST
    Figure CN113961519B_ABST
Patent Text Reader

Abstract

A method for simulating file system aging is disclosed, including: determining a storage capacity of a first device and a type of a file system; determining a ratio between a plurality of small files having different sizes based on the storage capacity of the first device and the type of the file system; copying the plurality of small files having different sizes to the first device according to the ratio; and deleting a part of the small files among all the small files copied onto the first device according to a predetermined interval pattern.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to storage devices, and more particularly, to a method and apparatus for simulating file system aging of a device. BACKGROUND

[0002] A file system is an important component in an operating system of a computing device, which is used to organize, manage and store files on a storage medium of the computing device.

[0003] File system aging of a computing device refers to a phenomenon that the system performance gradually decreases due to an increase in stored files and an increase in fragmentation after the device is used for a long time. After a user uses a computing device for a long time, the storage device of the computing device is in an aging state with serious fragmentation and little storage capacity left. Performance testing of the computing device in the aging state can more comprehensively test the performance of the computing device, especially the storage device. Therefore, there is a need for an improved method for simulating file system aging. SUMMARY

[0004] In one embodiment, a method for simulating file system aging is disclosed, comprising: determining a storage capacity of a first device and a type of a file system; determining a ratio between a plurality of small files having different sizes based on the storage capacity of the first device and the type of the file system; copying the plurality of small files having different sizes to the first device according to the ratio; and deleting a part of all the small files copied to the first device according to a predetermined interval pattern.

[0005] In another embodiment, an apparatus for simulating file system aging is disclosed, comprising: an obtaining module configured to obtain a storage capacity of a first device and a type of a file system; a ratio determining module configured to determine a ratio between a plurality of small files having different sizes based on the storage capacity of the first device and the type of the file system; a small file copying module configured to copy the plurality of small files having different sizes to the first device according to the ratio; and a deleting module configured to delete a part of all the small files copied to the first device according to a predetermined interval pattern.

[0006] In another embodiment, an apparatus for simulating file system aging is disclosed, comprising: one or more processing units; and a storage unit storing instructions that, when executed by the one or more processing units, cause the one or more processing units to perform the above method and the method of each embodiment of the present disclosure.

[0007] In another embodiment, a machine-readable storage medium is disclosed, which stores executable instructions that, when executed, cause one or more processing units to perform the above method and the method of each embodiment of the present disclosure.

[0008] In another embodiment, a computer program product is disclosed, which includes executable instructions that, when executed, cause one or more processing units to perform the above method and the method of each embodiment of the present disclosure.

[0009] By determining the proportion between small files of different sizes based on the storage capacity of the terminal device and the file system type, the method of the embodiments of the present disclosure can optimize the degree of file system fragmentation in the process of simulating file system aging, thereby helping to improve the subsequent performance test results. The embodiments of the present disclosure also have other advantages, which are described in detail in the following detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0010] The drawings of the embodiments of the present disclosure are briefly described as follows, and the same or corresponding components in the drawings are denoted by the same or similar reference numerals.

[0011] Figure 1 A schematic block diagram of a computing device is shown according to one embodiment of the present disclosure.

[0012] Figure 2 A schematic structural diagram of a file system is shown according to one embodiment of the present disclosure.

[0013] Figure 3A And 3B A schematic diagram of the file system condition of a computing device before use and after use for a period of time is shown according to one embodiment of the present disclosure.

[0014] Figure 4 A schematic diagram for simulating file system aging is shown according to one embodiment of the present disclosure.

[0015] Figure 5 A model for simulating file system aging is shown according to one embodiment of the present disclosure.

[0016] Figure 6 A schematic flowchart for copying small files to a computing device is shown according to one embodiment of the present disclosure.

[0017] Figures 7A-7C A model for simulating file system aging is shown according to one embodiment of the present disclosure.

[0018] Figure 8 A flowchart of a method for simulating file system aging is shown according to one embodiment of the present disclosure.

[0019] Figure 9 A schematic block diagram of an apparatus for simulating file system aging is shown according to an embodiment of the present disclosure.

[0020] Figure 10 A schematic block diagram of an apparatus for simulating file system aging is shown according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0021] In the following, specific embodiments of the present disclosure will be described, and those skilled in the art understand that obvious variations of the described embodiments can be used without departing from the scope of the present disclosure.

[0022] Figure 1 A schematic block diagram of a computing device 10 is shown according to an embodiment of the present disclosure.

[0023] The computing device 10 can be a communication device such as a mobile phone, a computer device such as a tablet computer, a multimedia device, a game device, etc. As shown, the computing device 10 includes a memory 110 and a processor 120. The processor 120 performs and controls various functions of the computing device 10 by running various program instructions stored in the memory 110. Figure 1

[0024] The memory 110 can be a flash memory device such as a universal flash storage card, a solid state disk, etc. The memory 110 stores system files such as an operating system 1110. The operating system 1110 is, for example, an Android system, a Harmony system, etc. The memory 110 can also store various application programs 1130 and data 1140, etc.

[0025] The memory 110 further includes a file system 1120. The file system 1120 is used to manage files in the memory 110, and the file system 1120 determines how the files in the memory 110 are stored, hierarchically organized, accessed, etc. The file system includes, for example, a Third Extended Filesystem (EXT3), a Fourth Extended Filesystem (EXT4), a Flash Friendly FileSystem, etc.

[0026] Figure 2 A schematic structural diagram of a file system is shown according to an embodiment of the present disclosure.

[0027] In Figure 2 ​In the example shown, from the perspective of storage areas, the memory 110 can include a system data storage area 1120A for storing system file data and a user data storage area 1120B for storing user data. A storage area can be managed by a file system, so a storage area can also be referred to as a file system 1120A or 1120B. Each storage area includes a plurality of data blocks, which are the smallest units of data storage in a file system. The system data storage area and the user data storage area can be managed by different file systems 1120A or 1120B for the files stored therein. For either the system data storage area or the user data storage area, it can include a superblock, an inode block, a data block, and the like.

[0028] From the perspective of the system, the file system 1120 is a system for organizing and allocating the space of the memory 110. The file system 1120 includes the interface of the file system, a software set for file manipulation and management, file data, and attributes. A file system has a superblock, which records basic information of the file system, such as the sizes of blocks and inodes, the total amount, the numbers of unused and used blocks and inodes, the mounting time of the file system, the time of the last data write, and other relevant information of the file system. The inode block is used to save inodes, and one inode corresponds to one file. The inode records the size of the corresponding file, the creation time, the last read time, the last modification time, the pointer of the corresponding file, and the like, and the data block where the file is located can be determined according to the pointer.

[0029] It can be understood that although Figure 2 two file systems are shown in the memory 110, in other implementations, the memory 110 can include one file system or more file systems. One or more file systems of a computing device are collectively referred to as a file system in this article.

[0030] Figure 3A and 3B According to one embodiment of the present disclosure, a schematic diagram of the file system status of a computing device before use and after use for a period of time is shown.

[0031] As Figure 3A shown, for example, before the computing device 10 is shipped, the file system of the memory 110 of the computing device 10 is created, and system files such as an operating system and user files such as some applications are pre-installed, and the type of the file system is, for example, the above-mentioned EXT4, F2FS. In Figure 3AIn the example shown, a certain amount of space can be reserved in the system file storage area 1120A for future upgrades of the computing device, and a large amount of storage space can be reserved in the user file storage area 1120B for storing user data.

[0032] like Figure 3B As shown, after a period of use, with the storage and deletion of data in the user file storage area 1120B, fragmented storage areas appear in the user file storage area 1120. The phenomenon of system performance gradually declining due to the increase in the number of stored files and the increased degree of fragmentation is called file system aging. Although Figure 3B The document does not show any changes in the reserved space of the system file storage area 1120A, but it is understandable that the system file storage area 1120A may also experience aging.

[0033] Figure 4 A schematic diagram for simulating file system aging is shown according to an embodiment of this disclosure.

[0034] The first device 10 can be Figure 1 The computing device 10 shown is, for example, a mobile phone running the Android operating system. To test the performance of the first device 10, especially the memory 110, the aging process of the file system of the memory 110 can be simulated.

[0035] The second device 20 can be the master device for testing, which stores a collection of small files. In one example, such as... Figure 4 As shown, the small files stored in the second device 20 include three sizes: 4kB, 8kB, and 128kB. It is understood that in other examples, more or fewer sizes of small files may be included, and the file sizes may also be other values.

[0036] In step 410, three small files of 4kB, 8kB, and 128kB are copied from the second device 20 to the first device 10, such as... Figure 4 As shown, the small file is stored in the memory 110 of the first device 10. See also Figure 2 and 3A 3B, according to the rules of the file system of the first device 10, small files are stored in the data blocks of the file system 1120. Figure 4 The filenames shown are 1_4K, 3_4K, etc. It is understood that these filenames are only illustrative and are used to indicate that three small files of different sizes are copied to the file system of the first device 10 in this example. In other examples, any appropriate filename can be used.

[0037] In step 420, a subset of small files copied to the first device 10 are deleted according to a certain interval pattern.Figure 4 In the example, every fourth small file copied to the first device 10 is deleted. This deletion of small files can accelerate the fragmentation of the file system of the first device 10.

[0038] In step 430, contact information, SMS messages, call logs, emails, and other information are imported from the second device 20 to the first device 10. If the first device 10 is a mobile phone, importing this information effectively simulates the real-world functionality of a mobile phone. It is understood that one or more of contact information, SMS messages, call logs, and emails can be imported, as well as other similar information. Furthermore, in step 430, an application can also be installed on the first device 10. If the first device 10 is a device with an Android operating system, an application installation package (APK) file can be imported from the second device 20 to the first device 10, thereby installing the application on the first device.

[0039] In step 440, a large file is copied from the second device 20 to the first device 10. This large file may include images, videos, music, etc. By copying the large file to the first device 10, the remaining storage space on the first device is reduced to a specific value, thus simulating a file system aging situation.

[0040] In the example where the second device 20 is a computing device such as a computer, a program for simulating the aging of the file system of the first device 10 can be installed on the second device 20, and the operations described in 410 to 440 above can be performed by running the program. This program can be referred to as an aging program.

[0041] The second device 20 may also be a storage device such as a memory card, which is connected to the first device 10. The aging program may be installed on the first device 10, and the operations described in 410 to 440 are performed by running the program.

[0042] Figure 5 An embodiment of this disclosure illustrates a model for simulating file system aging. Aging time refers to the time a computing device has been used. Figure 5 The aging times shown in the examples are 10 months, 18 months, and 24 months. It is understood that the specific value of the aging time can also be other values; therefore, the 10 months, 18 months, and 24 months mentioned above are examples of the first, second, and third aging times, respectively. Storage capacity refers to the capacity of memory 110. Figure 5 The examples shown are for storage capacities of 32GB and 64GB or greater. The remaining capacity values ​​for different aging times and storage capacities are as follows: Figure 5The remaining space aging model is shown in the example. Specifically, in this example, after an aging time of 10 months, the remaining capacity of a 32GB device is 2GB, and the remaining capacity of a device with a storage capacity of 64GB or more is 5GB; after an aging time of 18 months, the remaining capacity of a 32GB device is 1.5GB, and the remaining capacity of a device with a storage capacity of 64GB or more is 3GB; after an aging time of 24 months, the remaining capacity of a 32GB device is 1.5GB, and the remaining capacity of a device with a storage capacity of 64GB or more is 2GB.

[0043] Figure 5 The fragmented aging model illustrates the proportion of small files and the interval deletion method for different aging times. In this example, when the aging time is 10 months, in... Figure 4 The proportions of small files (4kB, 8kB, and 128kB) copied from 410 to computing device 10 in terms of file system capacity or space are 80%, 15%, and 5%, respectively; when the aging time is 18 months, in Figure 4 In the 410 file system, the proportions of small files (4kB, 8kB, and 128kB) copied to the computing device 10 are 80%, 15%, and 5% of the total file system capacity, respectively; with an aging time of 24 months, in Figure 4 In example 410, the percentages of small files (4kB, 8kB, and 128kB) copied to computing device 10 and stored in the file system are 100%, 0%, and 0%, respectively. In this example, with an aging time of 10 months, the percentages of small files in the file system are 100%, 0%, and 0%. Figure 4 The interval pattern for deleting small files in the 420 is to delete the 1st, 2nd, 3rd, 5th, 6th, 7th, and 9th small files out of every 10 small files; with an aging time of 18 months, in Figure 4 The interval pattern for deleting small files in the 420 is to delete the 1st, 3rd, 5th, 7th, and 9th small files out of every 10 small files; with an aging time of 24 months, in Figure 4 The interval pattern for deleting small files in 420 is to delete the 1st, 3rd, 5th, 7th, and 9th small files out of every 10 small files.

[0044] In one embodiment, to improve the fragmentation effect, in Figure 4 In step 410, a sufficient number of small files are copied to the first device 10, such that there is no remaining space in the memory 110, or in other words, the copied small files fill the data blocks of the file system in the memory 110. For example... Figure 2 The data block shown is located in user file storage area 1120B. It can be understood that... Figure 2 The system file storage area 1120A may be an area that users cannot operate on, so during the process of copying small files in step 410, they cannot be copied to the data block of the system file storage area 1120A.

[0045] Figure 6 A schematic flowchart for copying small files to a computing device is shown according to an embodiment of this disclosure.

[0046] Figure 6 The copying process shown is Figure 4 This is an example of copying step 410. Multiple small files of different sizes are stored on the second device 20; in other words, the multiple small files stored on the second device 20 include small files of different sizes. For example, the multiple small files stored on the second device 20 include a 4kB set of small files, an 8kB set of small files, and a 128kB set of small files. Before the copying process, the proportions between the various small files are determined, for example, by referring to... Figure 5 The fragmented aging model, when the aging time is 10 months, can determine the proportion of storage space occupied by the three sizes of small files to be copied to the first device 10 as 80%, 15% and 5%, respectively.

[0047] In step 610, at least a portion of the multiple small files stored on the second device 20 is selected based on the proportions between small files of different sizes. In this example, the proportions between small files of different sizes in the selected at least portion of small files are substantially 80%, 15%, and 5%. In one example, small files of each size can be placed in their respective folders, and in step 610, the corresponding small files are selected in each folder according to the determined proportions. Optionally, small files can be selected in a random order, thus giving all small files in a folder a chance to be selected. In another example, they can be selected in a random order, for example... Figure 5 The fragmented aging model assigns a specific percentage to each set of small files of different sizes, placing them in the corresponding folder. For example, sets of small files of 80%, 15%, and 5% of the total size are placed in the first folder, while sets of 4kB small files are placed in the second folder. Therefore, for an aging time of 10 months or 18 months, the set of small files in the first folder can be selected, while for an aging time of 34 months, the set of small files in the second folder can be selected.

[0048] In step 620, the names of at least a portion of the selected small files are changed. The names of the small files can be changed in any suitable manner, as long as it makes the changes more convenient. Figure 6 The name changed during the copying process should not be a duplicate of any previously used name.

[0049] In step 630, the small files with the changed names are copied to the first device 10. In one example, at least a portion of the selected small files of different sizes can be copied to the first device 10 in a random order. Since small files of different sizes occupy different numbers of data blocks in the file system of the first device 10, this randomized copying order improves the simulation of file system fragmentation after the subsequent deletion step. In one example, multiple folders can be created in the first device 10, and the small files can be copied to these folders in step 620. In one example, each small file can be randomly copied to one of the folders. By using this randomized target folder method, the simulation of file system fragmentation can be improved after the subsequent deletion step.

[0050] In step 640, log information is recorded regarding the copying of small files from the second device 20 to the first device 10. In one example, a log file can be created to record log information about the copying process. This log information includes the copying record for each small file, and each small file's copying record may include the sequence number of the copying record, the filename of the small file, the source folder of the small file, and the destination folder of the small file. It is understood that each small file's copying record may include more or less information; for example, a small file's copying record may include the time the copying occurred. It is understood that although... Figure 6 Step 640 is described as occurring after step 630, but in the actual copying process, the logging of step 640 and the file copying of step 630 occur simultaneously. For example, with each small file copying operation, a copying record for that small file copying operation is generated in the log file.

[0051] At step 650, determine if the predetermined conditions are met. If the predetermined conditions are met, end the replication process and proceed to step 1. Figure 4 The step 420 shows the deletion of small files. If the predetermined conditions are not met, return to step 610.

[0052] In one example, the predetermined condition is that the storage space of the first device 10 is full. For example, the predetermined condition is met when the file system of the first device 10 generates an indication that there is no remaining storage space. In another example, the predetermined condition is whether the total size of the copied small files has reached a threshold. For example, the remaining capacity of the first device can be determined before copying. This remaining capacity can be used as the aforementioned threshold. Alternatively, the remaining capacity can be multiplied by a certain coefficient to obtain an adjusted capacity, which can then be used as the aforementioned threshold. For example, if the storage capacity of the first device 10 is 32GB, in... Figure 6Before the copying process shown, the remaining capacity can be determined, for example, 20GB. In one example, 20GB can be used as the aforementioned threshold. In another example, 20GB can be multiplied by a coefficient, for example, 0.9, and the adjusted remaining capacity of 18GB can be used as the aforementioned threshold. During the selection process in step 610, or during the copying process in step 630, the total size of the copied small files can be calculated. By adopting Figure 6 The illustrated cyclic copying process only requires a limited number of small files to be prepared on the second device, avoiding the need to prepare small files on the second device with a storage capacity equivalent to that of the first device, thereby reducing the storage capacity requirements of the second device.

[0053] In step 420, based on the log information generated in step 640, a subset of small files copied to the first device 10 can be deleted according to a predetermined interval pattern. In one example, based on the order of copy records in the log information, a subset of small files copied to the first device can be deleted according to a predetermined interval pattern. Figure 4 Taking the example shown, in step 420, the small file corresponding to every fourth record in the log information is deleted. In one example, based on the sequence number in the log information, a portion of the small files copied to the first device are deleted according to a predetermined interval pattern. Still using... Figure 4 The example shown illustrates that in step 420, the file corresponding to every fourth record indicated by the sequence number in the log information is deleted. It is understood that the predetermined interval pattern used to indicate deletion can be any suitable interval pattern. For example, the small files corresponding to the 4th and 8th records out of every ten records can be deleted; the small files corresponding to the 1st, 2nd, 3rd, 5th, 6th, 7th, 9th, and 10th records out of every ten records can be deleted; the small files corresponding to the 1st, 3rd, 5th, 7th, and 9th records out of every ten records can be deleted, and so on.

[0054] Back Figure 5 The aging model shown is in Figure 5 The implementation only considers two cases: storage capacity of 32GB and storage capacity of 64GB or greater. However, when the storage capacity of the first device increases, Figure 5 The aging model shown may have issues. Taking the file system types EXT4 and F2FS described above as examples, the total number of inodes in the EXT4 file system is given when the file system is created, and the total number of nodes indicated in the NAT table in the F2FS file system is also given when the file system is created. In both the EXT4 and F2FS file systems, each node corresponds to one file. When the storage capacity of the first device is large, based on... Figure 5 When the aging model shown is operated, in, for exampleFigure 6 During the small file copying process shown, a situation may occur where nodes are exhausted but the storage space is not actually full. In this case, the effectiveness of file system fragmentation will be affected.

[0055] Figures 7A-7C An embodiment of this disclosure illustrates a model for simulating file system aging. Figures 7A-7C The aging times shown in the examples are 10 months, 18 months, and 24 months. It is understood that the specific values ​​of the aging time can also be other values, so the above 10 months, 18 months, and 24 months are examples of the first aging time, the second aging time, and the third aging time, respectively.

[0056] Storage capacity refers to the capacity of the memory 110 of the first device 10. Figure 7A The examples shown are for storage capacities of 128GB and 256GB or greater. The remaining capacity values ​​for different aging times and storage capacities are as follows: Figure 7A The remaining space aging model is shown in the example. Specifically, in this example, after an aging time of 10 months, the remaining capacity of a 128GB device is 5GB, and the remaining capacity of a device with a storage capacity of 256GB or more is 8GB; after an aging time of 18 months, the remaining capacity of a 128GB device is 3GB, and the remaining capacity of a device with a storage capacity of 256GB or more is 5GB; after an aging time of 24 months, the remaining capacity of a 128GB device is 2GB, and the remaining capacity of a device with a storage capacity of 256GB or more is 3GB.

[0057] Figure 7B The fragmented aging model illustrates the proportion of small files and interval deletion methods in the F2FS file system for different aging times and storage capacities. In this example, with an aging time of 10 months, in... Figure 4 The proportions of the 4kB, 8kB, and 128kB small files copied from the 410 to the computing device 10 in terms of file system capacity or space are as follows: when the storage capacity of the computing device 10 is 128GB, the proportions of the three types of small files are 80%, 15%, and 5%, respectively; when the storage capacity of the computing device 10 is 256GB, the proportions are 20%, 20%, and 60%, respectively; and when the storage capacity of the computing device 10 is 512GB, the proportions are 10%, 10%, and 80%, respectively. With an aging time of 18 months, in... Figure 4The proportions of 4kB, 8kB, and 128kB small files copied from the 410 to the computing device 10 in the file system are as follows: when the storage capacity of the computing device 10 is 128GB, the proportions of the three types of small files are 80%, 15%, and 5%, respectively; when the storage capacity of the computing device 10 is 256GB, the proportions are 20%, 20%, and 60%, respectively; and when the storage capacity of the computing device 10 is 512GB, the proportions are 10%, 10%, and 80%, respectively. With an aging time of 24 months, Figure 4 The percentages of the file system capacity occupied by the 4kB, 8kB, and 128kB small files copied from the 410 to the computing device 10 are as follows: when the storage capacity of the computing device 10 is 128GB, the percentages of the three types of small files are 100%, 0%, and 0%, respectively; when the storage capacity of the computing device 10 is 256GB, the percentages of the three types of small files are 35%, 0%, and 65%, respectively; and when the storage capacity of the computing device 10 is 512GB, the percentages of the three types of small files are 14%, 0%, and 86%, respectively.

[0058] exist Figure 7B In the example shown, when the aging time is 10 months, Figure 4 The interval pattern for deleting small files in the 420 is to delete the 1st, 2nd, 3rd, 5th, 6th, 7th, and 9th small files out of every 10 small files; with an aging time of 18 months, in Figure 4 The interval pattern for deleting small files in the 420 is to delete the 1st, 3rd, 5th, 7th, and 9th small files out of every 10 small files; with an aging time of 24 months, in Figure 4 The interval pattern for deleting small files in 420 is to delete the 1st, 3rd, 5th, 7th, and 9th small files out of every 10 small files.

[0059] Figure 7C The fragmented aging model illustrates the proportion of small files and interval deletion methods for different aging times and storage capacities in the EXT4 file system. In this example, with an aging time of 10 months, in... Figure 4 The proportions of the 4kB, 8kB, and 128kB small files copied from the 410 to the computing device 10 in terms of file system capacity or space are as follows: when the storage capacity of the computing device 10 is 128GB, the proportions of the three types of small files are 40%, 10%, and 50%, respectively; when the storage capacity of the computing device 10 is 256GB, the proportions are 40%, 10%, and 50%, respectively; and when the storage capacity of the computing device 10 is 512GB, the proportions are 90%, 5%, and 5%, respectively. With an aging time of 18 months, in... Figure 4The proportions of 4kB, 8kB, and 128kB small files copied from 410 to computing device 10 in the file system are as follows: when the storage capacity of computing device 10 is 128GB, the proportions of the three types of small files are 40%, 10%, and 50%, respectively; when the storage capacity of computing device 10 is 256GB, the proportions are 40%, 10%, and 50%, respectively; and when the storage capacity of computing device 10 is 512GB, the proportions are 90%, 5%, and 5%, respectively. With an aging time of 24 months, Figure 4 The proportions of the 4kB, 8kB, and 128kB small files copied to computing device 10 in the file system are as follows: when the storage capacity of computing device 10 is 128GB, the proportions of the three types of small files are 40%, 0%, and 60%, respectively; when the storage capacity of computing device 10 is 256GB, the proportions of the three types of small files are 40%, 0%, and 60%, respectively; and when the storage capacity of computing device 10 is 512GB, the proportions of the three types of small files are 90%, 0%, and 10%, respectively.

[0060] exist Figure 7C In the example shown, when the aging time is 10 months, Figure 4 The interval pattern for deleting small files in the 420 is to delete the 1st, 2nd, 3rd, 5th, 6th, 7th, and 9th small files out of every 10 small files; with an aging time of 18 months, in Figure 4 The interval pattern for deleting small files in the 420 is to delete the 1st, 3rd, 5th, 7th, and 9th small files out of every 10 small files; with an aging time of 24 months, in Figure 4 The interval pattern for deleting small files in 420 is to delete the 1st, 3rd, 5th, 7th, and 9th small files out of every 10 small files.

[0061] By adopting Figure 7B and 7C The file system fragmentation aging model shown determines the proportion of small files of various sizes based on the storage capacity of the first device 10 and the type of file system, which can avoid or mitigate the aforementioned issues. Figure 5 In the model shown, the file system nodes are exhausted and storage space (such as...) Figure 2 This addresses the issue that the data blocks shown are not actually full, thereby improving the simulation effect of file system fragmentation after a deletion operation.

[0062] Figure 7B and 7CExamples of storage capacities of 128GB, 256GB, and 512GB are shown, but it is understandable that the proportion of small files of different sizes can be determined based on the storage capacity and the type of file system. For example, for a first device 10 with a 1TB storage capacity, after a file system such as F2FS or EXT4 has been established, the number of available nodes and the available storage capacity of that file system can be obtained, and the proportion of small files of different sizes can be determined based on the number of available nodes and the available storage capacity. In one example, similar to... Figure 7B and 7C As shown, the ratio between small files of different sizes can be pre-configured based on storage capacity and file system type, and... Figure 4 The aging process shown is based on storage capacity and file system type. Figure 7B and 7C In the fragmentation model shown, select the corresponding proportion of small files. This is understandable. Figure 7B and 7C The small file percentage shown is an example value, which is an optimized value in one implementation, but other values ​​may be used in other implementations.

[0063] The above text combines Figure 5 The aging model shown is in Figure 6 The document describes an example process for copying small files. This can be understood or based on... Figures 7A to 7C The aging model shown is implemented Figure 6 The example process of copying small files described in [the document], where, based on Figure 7B and 7C The fragmented aging model determines the ratio between small files of various sizes based on the storage capacity of the first device 10 and the type of file system, and then performs step 610 and subsequent operations based on the determined ratio.

[0064] Figure 8 A flowchart of a method for simulating file system aging is shown according to an embodiment of this disclosure.

[0065] In step 810, the storage capacity and file system type of the first device are determined. In one example, the storage capacity and file system type of the first device 10 can be determined by querying the configuration information of the file system. For example, the superblock of the file system records the basic information of the file system, and the storage capacity and file system type of the first device can be obtained by querying the superblock.

[0066] In step 820, the ratio between various small files of different sizes is determined based on the storage capacity of the first device and the type of file system. In one example, this could be based on, for example...Figure 7B and 7C The fragmentation aging model shown determines the proportion of various small files based on the storage capacity of the first device and the type of file system.

[0067] In step 830, multiple small files of different sizes are copied to the first device according to the determined proportions. See one example. Figure 7B and 7C The aging model shown, with a storage capacity of 128GB and a file system type of EXT4, determines that the storage space occupied by the three small file sizes is 40%, 10%, and 50% over a 10-month aging period. In step 830, these three small files are copied to the first device according to this ratio.

[0068] In step 840, a subset of small files copied to the first device are deleted according to a predetermined interval pattern. See the example above. Figure 7B and 7C The aging model shown determines that the predetermined interval pattern is to delete the 1st, 2nd, 3rd, 5th, 6th, 7th, and 9th files every 10 small files. In step 840, a portion of the small files copied to the first device are deleted according to this pattern.

[0069] In one embodiment, the method further includes: storing one or more of the following information into the first device: contact information, SMS messages, call logs, and emails; installing an application on the first device; and copying a large file to the first device until the remaining storage capacity in the first device is reduced to a predetermined value. The above steps correspond to... Figure 4 Steps 430 and 440 are shown. See also: [example provided]. Figure 7A The aging model shown can be used to determine the predetermined value of the remaining capacity.

[0070] In one embodiment, step 830 further includes copying a plurality of small files of different sizes from a second device to a first device, wherein copying a plurality of small files of different sizes from a second device to a first device further includes repeatedly performing the following steps until a predetermined condition is met: changing the filenames of at least a portion of the small files in the plurality of small files, and copying the at least a portion of the small files with the changed filenames from the second device to the first device.

[0071] In one embodiment, the predetermined condition is that the storage space of the first device is full. In another embodiment, the predetermined condition is that the total size of the small files copied to the first device reaches a threshold.

[0072] In one embodiment, step 830 further includes: creating multiple folders in the first device, and randomly copying the at least part of the small file with the changed filename to the multiple folders.

[0073] In one embodiment, step 830 further includes copying multiple small files of different sizes to a first device in a random order.

[0074] In one embodiment, the method further includes logging information about copying various small files from a second device to a first device. In this embodiment, step 840 further includes deleting a portion of the small files copied to the first device based on the log information, according to a predetermined interval pattern. In one embodiment, the log information includes a copy record for each small file, wherein each small file copy record includes a copy record number and the filename of the small file. Each small file copy record may also include the source folder and the destination folder of the small file. In this embodiment, step 840 further includes deleting a portion of the small files copied to the first device based on the order of the copy records in the log information, according to a predetermined interval pattern.

[0075] In one embodiment, step 820 further includes determining a ratio between multiple small files of different sizes based on aging time. (Reference) Figure 7B and 7C The fragmentation aging model shown determines the proportion of multiple small files based on aging time, storage capacity, and file system type. When the aging time is 10 months, the storage capacity is 128GB, and the file system type is EXT4, the proportion of storage space occupied by small files of three different sizes can be determined to be 40%, 10%, and 50%.

[0076] In one embodiment, the multiple small files of different sizes include a first-size small file, a second-size small file, and a third-size small file, wherein the first size is smaller than the second size, and the second size is smaller than the third size.

[0077] In one embodiment, the first size, the second size, and the third size are 4kB, 8kB, and 128kB, respectively.

[0078] In one embodiment, step 820 further includes:

[0079] When the file system type is F2FS

[0080] When the aging time is the first aging time.

[0081] When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 80%, 15%, and 5%, respectively.

[0082] When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 20%, 20%, and 60%, respectively.

[0083] When the storage capacity is 512GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 10%, 10%, and 80%, respectively.

[0084] When the aging time is the second aging time...

[0085] When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 80%, 15%, and 5%, respectively.

[0086] When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 20%, 20%, and 60%, respectively.

[0087] When the storage capacity is 512GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 10%, 10%, and 80%, respectively.

[0088] When the aging time is the third aging time

[0089] When the storage capacity is 128GB, the percentages of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 100%, 0%, and 0%, respectively.

[0090] When the storage capacity is 256GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 35%, 0%, and 65%, respectively.

[0091] When the storage capacity is 512GB, the proportions of the capacity of the first-size small files, the second-size small files, and the third-size small files are 14%, 0%, and 86%, respectively.

[0092] When the file system type is EXT4

[0093] When the aging time is the first aging time.

[0094] When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively.

[0095] When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively.

[0096] When the storage capacity is 512GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 90%, 5%, and 5%, respectively.

[0097] When the aging time is the second aging time...

[0098] When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively.

[0099] When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively.

[0100] When the storage capacity is 512GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 90%, 5%, and 5%, respectively.

[0101] When the aging time is the third aging time

[0102] When the storage capacity is 128GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 0%, and 60%, respectively.

[0103] When the storage capacity is 256GB, the percentages of the capacity for the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 0%, and 60%, respectively.

[0104] When the storage capacity is 512GB, the percentages of the capacity of the first-size small files, the second-size small files, and the third-size small files are 90%, 0%, and 10%, respectively.

[0105] Figure 9 A schematic block diagram of an apparatus for simulating file system aging is shown according to an embodiment of the present disclosure.

[0106] The device 90 includes: an acquisition module 910 for acquiring the storage capacity and file system type of a first device; a ratio determination module 920 for determining the ratio between multiple small files of different sizes based on the storage capacity and file system type of the first device; a small file copying module 930 for copying multiple small files of different sizes to the first device according to the above ratio; and a deletion module 940 for deleting a portion of the small files copied to the first device at predetermined intervals.

[0107] In one embodiment, the device 90 further includes: an information import module 950 for importing one or more of the following information into the first device: contact information, SMS messages, call logs, and emails; an application installation module 960 for installing applications on the first device; and a large file copy module 970 for copying large files to the first device until the remaining storage capacity in the first device is reduced to a predetermined value.

[0108] In one embodiment, the small file copying module 930 copies multiple small files of different sizes from a second device to a first device. This copying of multiple small files of different sizes from the second device to the first device further includes repeatedly performing the following steps until a predetermined condition is met: changing the filenames of at least a portion of the multiple small files, and copying the at least a portion of the small files with the changed filenames from the second device to the first device.

[0109] In one embodiment, the predetermined conditions include: the storage space of the first device is full; or the total size of the small files copied to the first device reaches a threshold.

[0110] In one embodiment, the small file copying module 930 randomly copies multiple small files with modified filenames to multiple folders on a first device.

[0111] In one embodiment, the small file copying module 930 copies multiple small files of different sizes to the first device in a random order.

[0112] In one embodiment, the device 90 further includes a log module 980 for recording log information of copying multiple small files from a second device to a first device. Based on this log information, a deletion module 940 deletes a portion of the small files copied to the first device according to a predetermined interval pattern. In one embodiment, the log information includes a copy record for each small file, wherein each copy record includes a copy record number and the filename of the small file. Each copy record may also include the source folder and the destination folder of the small file. The deletion module 940 deletes a portion of the small files copied to the first device according to the order of the copy records in the log information and a predetermined interval pattern.

[0113] In one embodiment, the obtaining module 910 further obtains the aging time, and the ratio determining module 920 further determines the ratio between multiple small files of different sizes based on the aging time. In one embodiment, the ratio determining module 920 can proceed as described above. Figure 8 Step 820 is used to determine the ratio between various small files.

[0114] In one embodiment, the device 90 can be implemented as a software module, which may also be referred to as an aging program, wherein each module 910-980 includes software code for implementing corresponding operations or functions.

[0115] Figure 10 A schematic block diagram of an apparatus for simulating file system aging is shown according to an embodiment of the present disclosure.

[0116] The apparatus 100 includes one or more processing units 1010 and one or more storage units 1020, the storage units 1020 being able to store computer-executable instructions that, when executed, cause the one or more processing units to perform the methods described in this disclosure.

[0117] In one embodiment, the device 100 may be Figure 4 The second device 20 shown can run a program that simulates file system aging on the first device 10. In another embodiment, the device 100 may be... Figure 4 The first device 10 shown can be used to simulate the aging of the file system of the first device 10.

[0118] In one embodiment, the technical solution of this disclosure can be implemented as a machine-readable storage medium storing executable instructions that, when executed, cause one or more processing units to perform the methods described in this disclosure.

[0119] In one embodiment, the technical solution of this disclosure can be implemented as a computer program product, which includes executable instructions that, when executed, cause one or more processing units to perform the methods described in this disclosure.

[0120] The specific embodiments described above with reference to the accompanying drawings are exemplary embodiments, but do not represent all embodiments that can be implemented or fall within the scope of the claims. For the purpose of providing an understanding of the described technology, the specific embodiments include detailed descriptions. However, these technologies can be implemented without these detailed descriptions. In some instances, well-known structures and apparatuses are shown in block diagram form to avoid obscuring the concepts of the described embodiments.

[0121] The foregoing description of this disclosure is provided to enable any person skilled in the art to implement or use this disclosure. Various modifications to this disclosure will be apparent to those skilled in the art, and the general principles defined herein can be applied to other variations without departing from the scope of this disclosure. Therefore, this disclosure is not limited to the examples and designs described herein, but is consistent with the widest scope of the principles and novel features disclosed herein.

Claims

1. A method for simulating file system aging, comprising: Determine the storage capacity and file system type of the first device; The proportion of various small files with different sizes is determined based on the storage capacity of the first device and the type of file system; The various small files of different sizes are copied to the first device according to the stated ratio; Delete a portion of the small files copied to the first device according to a predetermined interval pattern; Store one or more of the following information into the first device: contact information, SMS messages, call logs, and emails; Install the application on the first device; Copy large files to the first device until the remaining storage capacity in the first device is reduced to a predetermined value.

2. The method as described in claim 1, wherein, Copying the multiple small files of different sizes to the first device further includes copying the multiple small files of different sizes from the second device to the first device, wherein copying the multiple small files of different sizes from the second device to the first device further includes: Repeat the following steps until a predetermined condition is met: change the filename of at least a portion of the small files in the plurality of small files, and copy the at least a portion of the small files with the changed filenames from the second device to the first device.

3. The method as described in claim 2, wherein, The predetermined conditions include: The storage space of the first device is full; or The total size of the small files copied to the first device has reached the threshold.

4. The method of claim 2, wherein, Copying the various small files of different sizes to the first device includes: Create multiple folders in the first device; and The at least some small files with changed filenames are randomly copied to the plurality of folders.

5. The method of claim 2, wherein, Copying the various small files of different sizes to the first device includes: The various small files of different sizes are copied to the first device in a random order.

6. The method of claim 2, further comprising: Record log information of copying the various small files from the second device to the first device; The step of deleting a portion of the small files copied to the first device according to a predetermined interval pattern includes: based on the log information, deleting a portion of the small files copied to the first device according to a predetermined interval pattern.

7. The method of claim 6, wherein, The log information includes copy records for each small file, wherein each copy record includes the sequence number of the copy record and the filename of the small file. The step of deleting a portion of the small files copied to the first device according to a predetermined interval pattern includes: deleting a portion of the small files copied to the first device according to the order of the copy records in the log information and according to a predetermined interval pattern.

8. The method of claim 1, wherein, The determination of the ratio among multiple small files of different sizes also includes: determining the ratio among multiple small files of different sizes based on aging time.

9. The method of claim 8, wherein, The various small files with different sizes include a first-size small file, a second-size small file, and a third-size small file, wherein the first size is smaller than the second size, and the second size is smaller than the third size.

10. The method of claim 9, wherein, Determining the ratio among various small files of different sizes based on the storage capacity and file system type of the first device also includes: When the file system type is a flash-friendly file system (F2FS), When the aging time is the first aging time. When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 80%, 15%, and 5%, respectively. When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 20%, 20%, and 60%, respectively. When the storage capacity is 512GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 10%, 10%, and 80%, respectively. When the aging time is the second aging time. When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 80%, 15%, and 5%, respectively. When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 20%, 20%, and 60%, respectively. When the storage capacity is 512GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 10%, 10%, and 80%, respectively. When the aging time is the third aging time... When the storage capacity is 128GB, the percentages of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 100%, 0%, and 0%, respectively. When the storage capacity is 256GB, the percentages of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 35%, 0%, and 65%, respectively. When the storage capacity is 512GB, the proportions of the capacity of the first-size small file, the second-size small file, and the third-size small file are 14%, 0%, and 86%, respectively.

11. The method of claim 9, wherein, Determining the ratio among various small files of different sizes based on the storage capacity and file system type of the first device includes: When the file system type is fourth-generation extended filesystem (EXT4), When the aging time is the first aging time. When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively. When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively. When the storage capacity is 512GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 90%, 5%, and 5%, respectively. When the aging time is the second aging time. When the storage capacity is 128GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively. When the storage capacity is 256GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 10%, and 50%, respectively. When the storage capacity is 512GB, the proportions of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 90%, 5%, and 5%, respectively. When the aging time is the third aging time... When the storage capacity is 128GB, the percentages of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 0%, and 60%, respectively. When the storage capacity is 256GB, the percentages of the capacity of the first-sized small files, the second-sized small files, and the third-sized small files are 40%, 0%, and 60%, respectively. When the storage capacity is 512GB, the proportions of the capacity of the first-size small file, the second-size small file, and the third-size small file are 90%, 0%, and 10%, respectively.

12. An apparatus for simulating file system aging, comprising: The module is used to obtain the storage capacity and file system type of the first device; The ratio determination module is used to determine the ratio between various small files of different sizes based on the storage capacity of the first device and the type of file system; The small file copying module is used to copy various small files of different sizes to the first device according to the stated ratio; The deletion module is used to delete a portion of the small files copied to the first device according to a predetermined interval pattern; The information import module is used to import one or more of the following information into the first device: contact information, SMS messages, call logs, and emails; An application installation module is used to install applications on the first device; The large file copying module is used to copy large files to the first device until the remaining storage capacity in the first device is reduced to a predetermined value.

13. The apparatus of claim 12, wherein, The small file copying module copies multiple small files of different sizes from the second device to the first device. The copying of multiple small files of different sizes from the second device to the first device further includes: Repeat the following steps until a predetermined condition is met: change the filename of at least a portion of the small files in the plurality of small files, and copy the at least a portion of the small files with the changed filenames from the second device to the first device.

14. The apparatus of claim 13, wherein, The predetermined conditions include: The storage space of the first device is full; or The total size of the small files copied to the first device has reached the threshold.

15. The apparatus of claim 13, further comprising: The log module is used to record log information about copying the multiple small files from the second device to the first device; The deletion module, based on the log information, deletes a portion of the small files copied to the first device at predetermined intervals.

16. An apparatus for simulating file system aging, comprising: One or more processing units; as well as A storage unit that stores instructions, which, when executed by the one or more processing units, cause the one or more processing units to perform the method as described in any one of claims 1 to 11.

17. A machine-readable storage medium storing executable instructions that, when executed, cause one or more processing units to perform the method as described in any one of claims 1 to 11.

18. A computer program product comprising executable instructions that, when executed, cause one or more processing units to perform the method as described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • File system fragmentation method and device

    CN111209257A