Data processing method, electronic device and storage medium

By obtaining files to be compressed in electronic devices, transferring and compressing their data contents, the problem of limited file compression range in the prior art is solved, and more efficient storage space release and equipment performance improvement is achieved.

CN118444839BActive Publication Date: 2025-02-14HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311291766.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-02-14
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

The conditions for selecting compressible files in the prior art are too demanding, which limits the compressible files in electronic devices, resulting in the inability to effectively free up storage space.

Method used

By obtaining the file to be compressed in the readable and writeable file system, transferring its data content, obtaining a blank file, setting a compression mark on the blank file, modifying its data storage format to a compressed format, realizing file compression.

Benefits of technology

The range of compressible files in the readable and writeable file system has been expanded, the storage space utilization of electronic devices has been improved, and the smoothness and user experience of the device has been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118444839B_ABST
    Figure CN118444839B_ABST
Patent Text Reader

Abstract

The present application provides a data processing method, an electronic device and a storage medium, and relates to the technical field of data processing. The method includes: obtaining a file to be compressed in a readable and writable file system, wherein the data storage format corresponding to the file to be compressed is a non-compressed format; when it is detected that the file to be compressed contains data content, the data content is transferred to obtain a blank file; a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified to a compressed format; the data content is stored in a compressed format in a blank file with a compression mark; the compression mark is used to indicate that the data content is compressible. This method realizes the conversion of an incompressible file into a compressible file, and expands the range of compressible files in the readable and writable file system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the rapid development of terminal technology, electronic devices such as mobile phones, computers, and wearable watches have been widely used. Electronic devices generate a large number of files during use, which include various data generated by users' operations on electronic devices. As the use time of electronic devices increases, more and more files will be generated, resulting in a serious shortage of available storage space for electronic devices. Compressing these files can effectively release the available storage space of electronic devices.

[0003] However, in the related art, when selecting compressible files, the selection conditions are relatively harsh, which greatly limits the range of compressible files in the electronic device, resulting in failure to release more available storage space for the electronic device. Summary of the invention

[0004] The present application provides a data processing method, an electronic device and a storage medium, which can solve the problem in the related art that the range of compressible files in the electronic device is limited, resulting in the inability to release more available storage space for the electronic device.

[0005] In a first aspect, the present application provides a data processing method, which includes: obtaining a file to be compressed in a read-write file system, and when detecting that the file to be compressed contains data content, transferring the data content to obtain a blank file; setting a compression mark for the blank file, and modifying the data storage format corresponding to the blank file to a compressed format; storing the data content in a compressed format in a blank file set with a compression mark.

[0006] The readable and writable file system may include an F2FS file system and other file systems having the same storage characteristics as the F2FS file system.

[0007] The file to be compressed refers to a file that has been created in the F2FS file system, and the data storage format corresponding to the created file is a non-compressed format.

[0008] Each file stored in the F2FS file system has a corresponding inode. In the embodiment of the present application, each file to be compressed also has a corresponding inode. The inode is used to store the attribute information and block number of the file to be compressed.

[0009] The uncompressed format is used to indicate that the number of block numbers (block addresses) stored in the inode is not divisible by 4.

[0010] The compression mark is used to indicate that the data content in the blank file with the compression mark set is compressible.

[0011] In this implementation, for a file to be compressed (an incompressible file) that has been created and includes data content written in an uncompressed format, its data content is first transferred to turn the file into a blank file, and then a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified from an uncompressed format to a compressed format, so that when the transferred data content is written into the blank file again, it is written in a compressed format, thereby making the blank file including data content written in a compressed format a compressible file, realizing the conversion of an incompressible file into a compressible file, and expanding the range of compressible files in a readable and writable file system (such as an F2FS file system). Subsequently, the compressible files can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing a guarantee for users to use electronic devices normally, and improving the user experience.

[0012] Moreover, by expanding the range of compressible files in a read-write file system (such as an F2FS file system), more files can be compressed in an electronic device, thereby improving the compression rate of the read-write file system.

[0013] As an example of the present application, obtaining the file to be compressed in the readable and writable file system may include: when it is detected that the available memory of the electronic device is less than a preset memory threshold, obtaining the file to be compressed in the readable and writable file system.

[0014] In this implementation, there is no need to frequently obtain the files to be compressed in the readable and writable file system. Instead, when it is detected that the available memory of the electronic device is less than a preset memory threshold, the files to be compressed in the readable and writable file system are obtained, which effectively saves the power consumption of the electronic device.

[0015] As an example of the present application, the above-mentioned transfer of data content to obtain a blank file includes: creating a temporary file corresponding to the file to be compressed; copying the data content to the temporary file; deleting the data content contained in the file to be compressed to obtain a blank file.

[0016] Optionally, the association relationship between the file to be compressed and the temporary file is stored in the inode of the file to be compressed, and the association relationship is used to point to the temporary file.

[0017] In this implementation, on the one hand, the data content is transferred to a temporary file to ensure the security of the data content and avoid data loss; on the other hand, the data content contained in the file to be compressed is deleted and the file to be compressed is converted into a blank file, which facilitates the subsequent modification of the data storage format of the blank file and provides support for the subsequent conversion of incompressible files (such as files to be compressed) into compressible files (such as blank files with compression marks).

[0018] As an example of the present application, the above-mentioned storing the data content in a compressed format in a blank file with a compression mark includes: copying the data content in a temporary file; and storing the copied data content in a compressed format in a blank file with a compression mark.

[0019] In this implementation, the copied data content is stored in a compressed format in a blank file with a compression mark, which realizes the conversion of incompressible files into compressible files and expands the range of compressible files in a read-write file system (such as an F2FS file system). Subsequently, the data content in the blank file with a compression mark can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing guarantees for users to use electronic devices normally, and improving user experience.

[0020] As an example of the present application, after the copied data content is stored in a compressed format in a blank file with a compression mark, the temporary file can be deleted, thereby reducing the storage pressure of the electronic device.

[0021] As an example of the present application, the data processing method also includes: detecting that the file to be compressed does not contain data content; setting a compression mark for the file to be compressed, and modifying the data storage format corresponding to the file to be compressed to a compressed format.

[0022] In this implementation, the file to be compressed does not contain data content. The data storage format corresponding to the file to be compressed is modified from the non-compressed format to the compressed format in advance, so that the data content subsequently stored in the file to be compressed can be stored in a compressed format, so that the file to be compressed with data content written in a compressed format becomes a compressible file, realizing the conversion of incompressible files into compressible files, and expanding the range of compressible files in a read-write file system (such as the F2FS file system). The compressible files can be compressed later according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing guarantees for users to use electronic devices normally, and improving user experience.

[0023] As an example of the present application, after storing the data content in a compressed format in a blank file with a compression mark, the data processing method also includes: receiving a compression instruction; obtaining the data amount corresponding to the data content in the blank file; and compressing the data content in the blank file when it is detected that the data amount is greater than or equal to a preset threshold.

[0024] Optionally, the compression instruction may include a compression unit and a preset compression algorithm.

[0025] In this implementation method, in order to ensure the effect after compression, the size of the data content corresponding to the data content in the blank file is determined in advance. When it is detected that the data amount is greater than or equal to the preset threshold, the data content in the blank file is compressed. This can release more available space and improve the performance and fluency of the electronic device. Users can also store new data content, thereby improving the user experience.

[0026] As an example of the present application, after obtaining the data volume corresponding to the data content in the blank file, the data processing method further includes: when it is detected that the data volume is less than a preset threshold, determining that the data content in the blank file is incompressible.

[0027] In this implementation, in order to ensure the effect after compression, the size of the data volume corresponding to the data content in the blank file is determined in advance, and files that are too small are not compressed, thereby ensuring the feasibility of compression.

[0028] As an example of the present application, compressing the data content in a blank file includes: obtaining M data blocks corresponding to the data content in the blank file; compressing the M data blocks using a preset compression algorithm to obtain N compressed data blocks and L blank data blocks.

[0029] Wherein, M is a positive integer greater than or equal to 4, N is a positive integer less than M, and L is the difference between M and N.

[0030] In this implementation, compressing the data content in the blank file can release more available space, improve the performance and fluency of the electronic device, and prevent the electronic device from lagging. Users can also store new data content, thereby improving the user experience.

[0031] In a second aspect, the present application provides an electronic device, comprising: one or more processors; one or more memories; a module with multiple applications installed; the memory stores one or more programs, and when one or more programs are executed by the processor, the electronic device executes the method in the above-mentioned first aspect and any possible implementation thereof.

[0032] In a third aspect, the present application provides a chip, including a processor, wherein the processor is configured to read and execute a computer program stored in a memory to execute the method in the first aspect and any possible implementation thereof.

[0033] Optionally, the chip also includes a memory, and the memory is connected to the processor via a circuit or wire.

[0034] Optionally, the chip also includes a communication interface.

[0035] In a fourth aspect, the present application provides a chip system, including a processor, the processor is coupled to a memory, the memory is used to store computer program instructions, when the processor executes the computer program instructions, the chip system executes the method in the above-mentioned first aspect and any possible implementation thereof.

[0036] In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by an electronic device, the electronic device executes the method in the first aspect and any possible implementation thereof.

[0037] In a sixth aspect, the present application provides a computer program product, the computer program product comprising: a computer program code, when the computer program code runs on an electronic device, the electronic device executes the method in the first aspect and any possible implementation thereof.

[0038] The technical effects obtained by the above-mentioned second, third, fourth, fifth and sixth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of storing data based on the F2FS file system provided in an embodiment of the present application;

[0040] Figure 2 A schematic flow chart of a data processing method shown in an embodiment of the present application;

[0041] Figure 3 A specific flow chart of step S102 of a data processing method shown in an embodiment of the present application;

[0042] Figure 4 A specific flow chart of step S104 of a data processing method shown in an embodiment of the present application;

[0043] Figure 5 A schematic flow chart of another data processing method shown in an embodiment of the present application;

[0044] Figure 6A schematic flow chart of another data processing method shown in an embodiment of the present application;

[0045] Figure 7 A specific flow chart of step S308 of a data processing method shown in an embodiment of the present application;

[0046] Figure 8 A schematic diagram of compressing data based on the F2FS file system provided in an embodiment of the present application;

[0047] Fig. 9 A schematic flow chart of another data processing method shown in an embodiment of the present application;

[0048] Fig.10 A schematic flow chart of another data processing method shown in an embodiment of the present application;

[0049] Fig.11 This is a schematic diagram of the hardware structure of an electronic device shown as an exemplary embodiment of the present application;

[0050] Fig.12 A software structure block diagram of an electronic device shown as an exemplary embodiment of the present application;

[0051] Fig.13 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0053] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0054] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0055] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0056] It should be noted that the data processing method provided in the embodiment of the present application can be applied to any electronic device that supports a read-write file system.

[0057] In order to better understand the data processing method provided in the embodiments of the present application, some terms involved in the embodiments of the present application are first explained below to facilitate understanding by those skilled in the art.

[0058] 1. Readable and writable file system

[0059] The file system is the core module of the operating system kernel, that is, the main component. It can be understood that the file system is responsible for storing and managing files in electronic devices, such as creating, saving, reading, modifying and dumping files for users, and revoking and deleting files when users no longer use them.

[0060] In an embodiment of the present application, the file system may include a readable and writable file system, which refers to a file system that can both write files to a storage device and read files from a storage device.

[0061] The operating system kernel refers to the core part of most operating systems. It consists of those parts of the operating system that are used to manage storage, files, peripherals, and system resources. It is responsible for managing the system's processes, memory, device drivers, files, and network systems, and determines the performance and stability of the operating system.

[0062] 2. Flash Friendly File System (F2FS)

[0063] In an embodiment of the present application, the readable and writable file system may include an F2FS file system.

[0064] The F2FS file system is a file system designed for flash memory (i.e. dynamic random access memory). It configures the Linux kernel to create storage partitions and mount file systems, allowing us to effectively plan the file system space on electronic devices, thereby improving the performance of electronic devices and effectively reducing the waste of flash memory space.

[0065] The above is a brief introduction to the terms involved in the embodiments of the present application, which will not be repeated below.

[0066] At present, electronic devices (such as mobile phones, computers, wearable watches, etc.) have become indispensable devices in users' daily lives. When users use electronic devices, the electronic devices will generate a large number of files.

[0067] For example, when using an electronic device, a user may install applications, take and / or download photos, record and / or download videos, browse web pages, and record text. These operations will cause the electronic device to generate a large number of files, including various data generated by these operations. As the time users use electronic devices increases, more and more files are generated, resulting in a serious shortage of available storage space in the electronic device. Compressing these files can effectively release the available storage space of the electronic device.

[0068] It should be understood that different electronic devices use different file systems and compress files in different ways. In the embodiment of the present application, the file system used by the electronic device is an F2FS file system as an example for description.

[0069] For example, when an electronic device using the F2FS file system compresses files, a compression mark can only be set for newly created files or empty files, and then the files with the compression mark set can be compressed. However, a compression mark cannot be set for files that have already been created and include data, and therefore such files cannot be compressed. This is due to the limitations of the compression technology of the F2FS file system.

[0070] To facilitate understanding, the following briefly introduces the compression technology of the F2FS file system with reference to the accompanying drawings.

[0071] See also Figure 1 , Figure 1 A schematic diagram of data storage based on the F2FS file system provided in an embodiment of the present application. Figure 1 As shown, each file stored based on the F2FS file system has a corresponding index node (inode).

[0072] Among them, inode is used to store the attribute information and data block number of the file. For example, the attribute information may include the creator of the file, the creation date of the file, the file size, the type of electronic device to which the file belongs, the type of the file, the file permissions, the number of links to the file, the owner and group of the file, the last access time of the file, the status change time of the file, the last modification time of the file, the inode number of the file, and the data storage format, etc.

[0073] The data block number is used to indicate the address of the block, that is, the actual storage location of the file.

[0074] For example, an address list can be created in the inode, and the address list is used to store block numbers, or the address list is used to store block addresses. A block number points to a block. Usually, the size of a block is 4 kilobytes (KB), which means that a block can store 4KB of data. For example, there are 864 block numbers stored in the address list, and these 864 block numbers point to 864 blocks respectively. For this file, a total of 3456KB of data can be stored through these 864 blocks.

[0075] Optionally, the inode can also include multiple indirect index nodes (dnodes), each dnode is 4KB in size, and each dnode can store multiple block numbers, with one block number pointing to one block. In this way, more data can be stored. For example, a dnode stores 1016 block numbers, which point to 1016 blocks respectively, and each block can store 4KB of data. For this file, one dnode can store an additional 4064KB of data.

[0076] In one example, multiple block numbers are stored in the inode, and each block number points to a block. Figure 1 As shown, the multiple blocks are data block 0, data block 1, data block 2, data block 3, data block 4, data block 5, data block 6...

[0077] Optionally, the inode may also include a dnode, which stores multiple block numbers, each of which points to a block. Figure 1 As shown, the multiple blocks are data block 00, data block 01, data block 02... This is only an exemplary description and is not limited to this.

[0078] It should be understood that each file has a different inode number, so the F2FS file system uses different inode numbers to identify different files.

[0079] Exemplarily, the F2FS file system finds the corresponding inode number according to the file name, then obtains the inode information through the inode number, then finds the block number according to the inode information, finds the actual storage location of the file based on the block number, and thus obtains the data content in the file. Optionally, the dnode can also be found according to the inode information, then the block number in the dnode can be found through the dnode, and the actual storage location of the file can be found based on the block number in the dnode, and thus other data content in the file can be obtained.

[0080] In the F2FS file system, files can be divided into compressed files and uncompressed files. The data storage formats corresponding to compressed files and uncompressed files are different. For example, when a file is a compressed file, the data storage format stored in the inode of the file is a compressed format; when a file is an uncompressed file, the data storage format stored in the inode of the file is an uncompressed format.

[0081] The compressed format is used to indicate that the number of block numbers stored in the inode is divisible by 4, or in other words, the compressed format is used to indicate that the number of block addresses stored in the inode is divisible by 4. The uncompressed format is used to indicate that the number of block numbers stored in the inode is not divisible by 4, or in other words, the uncompressed format is used to indicate that the number of block addresses stored in the inode is not divisible by 4.

[0082] This is because in the F2FS file system, the compression unit is set in advance before compressing the file. Usually the compression unit is set to 2. 2 ~2 8 For example, the compression unit is set to 2 2 , then the F2FS file system compresses 4 blocks at a time when compressing files. Therefore, when the number of block numbers (block addresses) stored in the inode is divisible by 4, the file corresponding to the inode can be compressed.

[0083] When the number of block numbers (block addresses) stored in the inode is not divisible by 4, that is, when there is a remainder, the block corresponding to the remainder cannot be compressed. For example, the block corresponding to the remainder will be discarded, resulting in file damage. Therefore, when the number of block numbers (block addresses) stored in the inode is not divisible by 4, the file corresponding to the inode cannot be compressed.

[0084] For example, in the F2FS file system, when compressing a file, it is necessary to first set a compression mark for the file, and setting the compression mark means that the data storage format corresponding to the file is in a compressed format. When a file is newly created, the data storage format of the file can be set to a compressed format when it is created, so that the data subsequently written to the file is written in a compressed format, and the file can be compressed afterwards.

[0085] Alternatively, when no data has been written into the file, the data storage format of the file is set to a compressed format; if the data storage format of the file has been set to a non-compressed format, before the data is written, the data storage format of the file is modified to a compressed format. This allows subsequent data written into the file to be written in a compressed format, and the file can then be compressed.

[0086] However, the compression mark cannot be set for files that have already been created and include data (data written in uncompressed format), and since the data has already been written in uncompressed format, the data storage format cannot be changed from uncompressed format to compressed format, and such files cannot be compressed. In the F2FS file system, such files account for the majority, that is, most files in the F2FS file system are incompressible, which greatly limits the range of compressible files, resulting in smaller and smaller storage space for electronic devices, and prone to jamming.

[0087] When the above problems are serious, users will be unable to use the applications in the electronic device normally. For example, the user will be prompted that there is no storage space and the application cannot be installed, or the user will be prompted that there is insufficient storage space and the operation cannot be completed, etc., which greatly reduces the user experience.

[0088] In view of this, an embodiment of the present application provides a data processing method, which includes obtaining a file to be compressed in a read-write file system, wherein the data storage format corresponding to the file to be compressed is a non-compressed format; when it is detected that the file to be compressed contains data content, the data content is transferred to obtain a blank file; a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified to a compressed format; and the data content is stored in a compressed format in a blank file set with a compression mark.

[0089] In this implementation, for a file to be compressed (an incompressible file) that has been created and includes data content written in an uncompressed format, its data content is first transferred to turn the file into a blank file, and then a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified from an uncompressed format to a compressed format, so that when the transferred data content is written into the blank file again, it is written in a compressed format, thereby making the blank file including data content written in a compressed format a compressible file, realizing the conversion of an incompressible file into a compressible file, and expanding the range of compressible files in a readable and writable file system (such as an F2FS file system). Subsequently, the compressible files can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing a guarantee for users to use electronic devices normally, and improving the user experience.

[0090] Moreover, by expanding the range of compressible files in a read-write file system (such as an F2FS file system), more files can be compressed in an electronic device, thereby improving the compression rate of the read-write file system.

[0091] It is worth noting that the execution subject of a data processing method provided in an embodiment of the present application can be an electronic device or a component arranged in an electronic device (for example, a chip, a chip system, a processor, a memory, etc.). The following description is taken as an example where the execution subject is an electronic device.

[0092] In some embodiments of the present application, the electronic device may be referred to as user equipment (UE), terminal equipment, etc. For example, the electronic device may be a smart screen, a tablet computer (Portable Android Device, PAD), a handheld device with a wireless communication function (such as a mobile phone), a wearable device, a television, a vehicle-mounted electronic device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, a wireless terminal device in industrial control (Industrial Control), a wireless terminal device in self-driving (Self Driving), a wireless terminal device in remote medical (Remote Medical), a wireless terminal device in a smart grid (Smart Grid), a wireless terminal device in transportation safety (Transportation Safety), a wireless terminal device in a smart city (Smart City), a wireless terminal device in a smart home (Smart Home), and the like, or may be other devices or apparatuses that can support a readable and writable file system (such as an F2FS file system). The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.

[0093] See also Figure 2 , Figure 2 This is a schematic flow chart of a data processing method shown in an embodiment of the present application. The data processing method is described in detail below.

[0094] S101: Obtain a file to be compressed in a readable and writable file system.

[0095] The readable and writable file system may include an F2FS file system and other file systems having the same storage characteristics as the F2FS file system. In the embodiment of the present application, the readable and writable file system is described by taking the F2FS file system as an example.

[0096] The file to be compressed refers to a file that has been created in the F2FS file system, and the data storage format corresponding to the created file is a non-compressed format.

[0097] The uncompressed format is used to indicate that the number of block numbers (block addresses) stored in the inode is not divisible by 4.

[0098] It should be understood that each file stored based on the F2FS file system has a corresponding inode.

[0099] In the embodiment of the present application, each file to be compressed also has a corresponding inode. The inode is used to store the attribute information and data block number of the file to be compressed.

[0100] For example, attribute information may include the creator of the file, the creation date of the file, the size of the file, the type of electronic device to which the file belongs, the type of the file, the permissions of the file, the number of hard links to the file, the owner and group of the file, the last access time of the file, the time when the file's status changed, the last modification time of the file, the inode number of the file, and the data storage format, etc.

[0101] The data block number is used to indicate the address of the block, that is, the actual storage location of the file.

[0102] Among them, the file permissions may include read permissions, write permissions, and access permissions; the number of file links refers to how many file names point to this inode; the file types may include regular files (regular inode), directory files (directory inode), soft links (symbol link inode) and special files (special inode), etc.

[0103] Soft links are used to record the path of a file (for example, an absolute path and a relative path).

[0104] It is worth noting that, when the file type is a common file, it can also be used to indicate that the data storage format of the file is a non-compressed format. In other words, when the file type is a common file, it can also be used to indicate that the file is an incompressible file.

[0105] Exemplarily, the electronic device searches the F2FS file system for files that have been created and whose data storage format is a non-compressed format, and obtains the files to be compressed.

[0106] Optionally, in a possible implementation, the operating system of the electronic device may include a kernel layer, and the above step S101 is performed in the kernel layer, that is, searching the kernel layer for files that have been created in the F2FS file system and whose data storage format is uncompressed format to obtain files to be compressed.

[0107] S102: When it is detected that the file to be compressed contains data content, the data content is transferred to obtain a blank file.

[0108] The data content may include data generated during the use of the electronic device, as well as native data in the operating system of the electronic device.

[0109] Among them, the data generated by the electronic device during use may include data generated by installing applications, data generated by taking and / or downloading photos, data generated by recording and / or downloading videos, data generated by browsing web pages, data generated by recording text, data generated by using various types of applications (such as social type, shopping type, entertainment type, financial type, etc.), etc. This is only an example and is not limited to this.

[0110] The native data in the operating system of the electronic device may include data contained in a directory file. For example, the directory file may be a Data file.

[0111] Exemplarily, the data content is actually stored in a block, and detecting whether the file to be compressed contains the data content is actually detecting whether the block corresponding to the file to be compressed stores the data content. If it is detected that the block corresponding to the file to be compressed stores the data content, it is determined that the file to be compressed contains the data content; if it is detected that the block corresponding to the file to be compressed does not store the data content, it is determined that the file to be compressed does not contain the data content.

[0112] It should be understood that when it is detected that the file to be compressed contains data content, since the data content is stored in an uncompressed format, the data storage format corresponding to the file to be compressed cannot be directly modified. In an embodiment of the present application, the data content will be transferred to obtain a blank file.

[0113] In this embodiment of the present application, it can be understood that after the data content contained in the to-be-compressed file is transferred out, the to-be-compressed file does not contain data content at this time, and the to-be-compressed file that does not contain data content at this time is a blank file.

[0114] It is understandable that when the file to be compressed contains data content, the inode corresponding to the file to be compressed stores block numbers, each block number points to a block, and the block stores the data content. After the data content in the file to be compressed is transferred out, that is, after the file to be compressed is converted into a blank file, the block number in the inode corresponding to the blank file is also adjusted accordingly. For example, the block number in the inode corresponding to the blank file is deleted.

[0115] Optionally, in a possible implementation, the above step S102 may be performed in the kernel layer. That is, the kernel layer performs a detection of whether data content is stored in the block corresponding to the file to be compressed. If it is detected that data content is stored in the block corresponding to the file to be compressed, it is determined that the file to be compressed contains data content; if it is detected that data content is not stored in the block corresponding to the file to be compressed, it is determined that the file to be compressed does not contain data content. When it is determined that the file to be compressed contains data content, the data content is transferred to obtain a blank file.

[0116] S103: Set a compression mark for the blank file, and modify the data storage format corresponding to the blank file to a compressed format.

[0117] The specific form of the compression mark can be set and adjusted according to actual conditions. For example, the compression mark can be set to F2FS_COMPR_FL. This is only an exemplary description and is not limited to this.

[0118] Exemplarily, the compression flag may be set in the inode, for example, in the attribute information in the inode, or in the i_flags in the inode, which is only an exemplary description and is not limited to this.

[0119] Specifically, the compression mark can be set in the inode through a preset function. The preset function may include an ioctl function, which is a function in a driver of the electronic device that manages the input / output channel of the electronic device.

[0120] For example, an ioctl function is called, and a compression mark is set in an inode corresponding to the blank file through the ioctl function.

[0121] It should be understood that a blank file is obtained by transferring the data content of the file to be compressed, and the data storage format corresponding to the file to be compressed is a non-compressed format. If only the data content is transferred, the data storage format corresponding to the blank file is also a non-compressed format. Therefore, it is necessary to modify the data storage format corresponding to the blank file to a compressed format.

[0122] For example, the data storage format in the inode corresponding to the blank file can be changed from a non-compressed format to a compressed format. Afterwards, when the data content is stored in the blank file, it must be stored in a compressed format.

[0123] Optionally, in a possible implementation, the above step S103 may be performed in the kernel layer, that is, a compression mark is set for the blank file in the kernel layer, and the data storage format corresponding to the blank file is modified to a compressed format.

[0124] S104: Store the data content in a compressed format in a blank file with a compression mark.

[0125] The compression mark is used to indicate that the data content is compressible. It can be understood that the compression mark is used to indicate that the data content in the blank file with the compression mark is compressible.

[0126] Exemplarily, the transferred data content is stored in a blank file with a compression mark, so that the data content in the blank file with a compression mark can be compressed later. It is worth noting that when storing the data content, it must be stored in a compressed format.

[0127] For example, the data content is reasonably distributed and stored in H blocks corresponding to the blank file with the compression mark, where H is a positive integer divisible by 4. H blocks correspond to H block numbers, that is, the number of block numbers (block addresses) stored in the inode corresponding to the blank file is divisible by 4, so that the data content in the blank file with the compression mark can be compressed smoothly later.

[0128] Optionally, in a possible implementation, the above step S104 may be performed in the kernel layer, that is, the data content is stored in a compressed format in a blank file with a compression mark in the kernel layer.

[0129] In this implementation, for a file to be compressed (an incompressible file) that has been created and includes data content written in an uncompressed format, its data content is first transferred to turn the file into a blank file, and then a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified from an uncompressed format to a compressed format, so that when the transferred data content is written into the blank file again, it is written in a compressed format, thereby making the blank file including data content written in a compressed format a compressible file, realizing the conversion of an incompressible file into a compressible file, and expanding the range of compressible files in a readable and writable file system (such as an F2FS file system). Subsequently, the compressible files can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing a guarantee for users to use electronic devices normally, and improving the user experience.

[0130] Moreover, by expanding the range of compressible files in a read-write file system (such as an F2FS file system), more files can be compressed in an electronic device, thereby improving the compression rate of the read-write file system.

[0131] Optionally, in a possible implementation manner, obtaining the file to be compressed in the readable and writable file system may include: periodically obtaining the file to be compressed in the readable and writable file system.

[0132] Exemplarily, a period for obtaining the files to be compressed in the readable and writable file system is preset, for example, the period may be every 8 hours, every 12 hours, every 24 hours, every 2 days, every 5 days, etc., which is only an exemplary description and is not limited thereto.

[0133] In this implementation, the electronic device periodically obtains the files to be compressed in the readable and writable file system to avoid a backlog of too many files to be compressed in the readable and writable file system and making them difficult to obtain. The timely acquisition of the files to be compressed in the readable and writable file system is conducive to the subsequent timely conversion of the files to be compressed into compressible files, thereby providing a guarantee for the subsequent improvement of the compression efficiency of the electronic device.

[0134] Optionally, in a possible implementation, obtaining the file to be compressed in the readable and writable file system may include: when it is detected that the available memory of the electronic device is less than a preset memory threshold, obtaining the file to be compressed in the readable and writable file system.

[0135] Exemplarily, the operating system of the electronic device may include an application layer, an application framework layer, and a kernel layer.

[0136] The application layer may include a series of application packages. The application package may include an application for managing the memory of an electronic device. For example, the application package may include a memory cleaning application, a mobile phone management application, a memory manager application, etc.

[0137] Exemplarily, an application for managing the memory of an electronic device in the application layer is started and run, and the available memory of the electronic device is monitored in real time through the application for managing the memory of the electronic device. When it is monitored that the available memory of the electronic device is less than a preset memory threshold, an acquisition instruction is generated, and the acquisition instruction is used to trigger the electronic device to obtain the file to be compressed in the readable and writable file system. The available memory of the electronic device is usually expressed in the form of a percentage. For example, the available memory of the electronic device is 15%, 30%, 50%, 80%, etc. The preset memory threshold can be set and adjusted according to the actual situation. For example, the preset memory threshold can be set to 20%, 25%, etc. This is only an exemplary description and is not limited to this.

[0138] The application layer passes the acquisition instruction to the application framework layer, and the application framework layer passes the acquisition instruction to the kernel layer, triggering the electronic device to execute the operation of acquiring the file to be compressed in the read-write file system in the kernel layer.

[0139] In this implementation, there is no need to frequently obtain the files to be compressed in the readable and writable file system. Instead, when it is detected that the available memory of the electronic device is less than a preset memory threshold, the files to be compressed in the readable and writable file system are obtained, which effectively saves the power consumption of the electronic device.

[0140] See also Figure 3 , Figure 3 This is a specific flow chart of step S102 of a data processing method shown in an embodiment of the present application. The above step S102 may include step S1021 and step S1023, which are specifically as follows.

[0141] S1021. Create a temporary file corresponding to the file to be compressed.

[0142] Exemplarily, in the disk of the F2FS file system, a temporary file corresponding to the file to be compressed is created, and the temporary file can be represented by a Temp-inode. For example, in the disk of the F2FS file system, a Temp-inode associated with the file to be compressed is created.

[0143] Optionally, the association relationship between the file to be compressed and the temporary file is stored in the inode of the file to be compressed. The association relationship is used to point to the temporary file, so that the temporary file corresponding to the file to be compressed can be found through the association relationship stored in the inode of the file to be compressed.

[0144] It can be understood that when creating temporary files corresponding to multiple files to be compressed at the same time, the association relationship between each file to be compressed and its corresponding temporary file is stored in each file to be compressed. This is conducive to finding the temporary file corresponding to each file to be compressed through the association relationship stored in the inode of each file to be compressed.

[0145] S1022. Copy the data content to a temporary file.

[0146] In one possible implementation, multiple block numbers stored in the inode of the file to be compressed are checked to find multiple blocks pointed to by the multiple block numbers, read and copy the data contents stored in the multiple blocks, and store the copied data contents stored in the multiple blocks into a temporary file.

[0147] Exemplarily, in the process of reading and copying the data contents stored in multiple blocks, the data contents stored in the multiple blocks may be read and copied in sequence. For example, the data contents stored in one block may be read, the data contents stored in the block may be copied, and then the data contents stored in the next block may be read in sequence, the data contents stored in the next block may be copied, and so on, until the data contents stored in all blocks are read and copied.

[0148] Accordingly, each time the data content stored in a block is copied, the data content stored in the block is stored in the corresponding block in the temporary file until the data content stored in all blocks is stored in the temporary file.

[0149] It should be understood that a temporary file also has a corresponding inode, and the inode of the temporary file can store the attribute information of the temporary file, the block number, and the association relationship between the file to be compressed and the temporary file.

[0150] Exemplarily, in the process of storing the data content stored in the copied multiple blocks into a temporary file, the data content stored in the multiple blocks can still be stored in the temporary file in the same data storage format as the file to be compressed. For example, the data content stored in the multiple blocks is stored in the temporary file in an uncompressed format. In this implementation, since the data content in the file to be compressed is copied to the temporary file in the same data storage format as the file to be compressed, the copying speed is improved.

[0151] Exemplarily, in the process of storing the data content stored in the copied multiple blocks into a temporary file, a data storage format different from that of the file to be compressed can also be used to store the data content stored in the multiple blocks into a temporary file. For example, the data content stored in the multiple blocks is stored in a temporary file in a compressed format. Specifically, after the data content in the file to be compressed is copied, the copied data content is reasonably distributed to F blocks, where F is a positive integer that is divisible by 4. F blocks correspond to F block numbers, that is, the number of block numbers (block addresses) stored in the temporary corresponding inode is divisible by 4.

[0152] In this implementation, when the data content in the temporary file is subsequently transferred to the blank file, there is no need to adjust the data storage format of the data content, thereby improving the speed of transferring the data content.

[0153] In another possible implementation, multiple block numbers stored in the inode of the file to be compressed are checked to find multiple blocks pointed to by the multiple block numbers, and the data contents stored in the multiple blocks are cut and pasted, and the data contents stored in the cut and pasted multiple blocks are stored in a temporary file, and the file to be compressed is converted into a blank file.

[0154] In this implementation, the data content of the file to be compressed is stored in a temporary file by cutting and pasting, and the data content in the file to be compressed does not need to be deleted, which saves the process of determining blank files and improves the efficiency of determining blank files.

[0155] It should be understood that in the process of storing the data content stored in the multiple blocks of the clipping into the temporary file, the data content stored in the multiple blocks can still be stored in the temporary file in the same data storage format as the file to be compressed (such as an uncompressed format), or the data content stored in the multiple blocks can be stored in the temporary file in a data storage format different from that of the file to be compressed (such as a compressed format).

[0156] Optionally, in a possible implementation, the electronic device may include a disk storage device and a flash memory device, wherein the disk storage device is used to store blocks, and the flash memory device is used to store temporary files.

[0157] S1023. Delete the data content contained in the file to be compressed to obtain a blank file.

[0158] If the data content in the file to be compressed is stored in a temporary file by copying, the data content in the file to be compressed needs to be deleted to obtain a blank file.

[0159] Exemplarily, multiple block numbers stored in the inode of the file to be compressed are deleted, and data contents stored in multiple blocks pointed to by the multiple block numbers are deleted. At this time, the file to be compressed is a blank file.

[0160] In this implementation, on the one hand, the data content is transferred to a temporary file to ensure the security of the data content and avoid data loss; on the other hand, the data content contained in the file to be compressed is deleted and the file to be compressed is converted into a blank file, which facilitates the subsequent modification of the data storage format of the blank file and provides support for the subsequent conversion of incompressible files (such as files to be compressed) into compressible files (such as blank files with compression marks).

[0161] See also Figure 4 , Figure 4This is a specific flow chart of step S104 of a data processing method shown in an embodiment of the present application. The above step S104 may include step S1041 and step S1042, which are specifically as follows.

[0162] S1041. Copy the data content in the temporary file.

[0163] By checking the multiple block numbers stored in the inode of the temporary file, the multiple blocks pointed to by the multiple block numbers are found, and the data contents stored in the multiple blocks are read and copied.

[0164] Exemplarily, in the process of reading and copying the data contents stored in multiple blocks, the data contents stored in the multiple blocks may be read and copied in sequence. For example, the data contents stored in one block may be read, the data contents stored in the block may be copied, and then the data contents stored in the next block may be read in sequence, the data contents stored in the next block may be copied, and so on, until the data contents stored in all blocks are read and copied.

[0165] S1042: Store the copied data content in a compressed format in a blank file with a compression mark.

[0166] Exemplarily, the inode of the temporary file stores the association relationship between the file to be compressed and the temporary file, and the blank file is the file to be compressed with the data content transferred, so the blank file corresponding to the temporary file can be found through the association relationship between the file to be compressed and the temporary file. Afterwards, the copied data content is stored in a compressed format in the blank file with a compression mark.

[0167] In one possible implementation, if when executing step S1022, the data content is copied to a temporary file in the same data storage format as the file to be compressed (such as an uncompressed format), then when executing step S1042, it is necessary to convert the data storage format of the copied data content, so as to store the copied data content in a compressed format in a blank file with a compression mark.

[0168] It should be understood that storing the copied data content in a compressed format in a blank file with a compression mark essentially means that the number of blocks corresponding to the blank file after storing the data content is divisible by 4.

[0169] Exemplarily, the data content is reasonably distributed and stored in H blocks corresponding to the blank file with a compression mark, where H is a positive integer divisible by 4. H blocks correspond to H block numbers, that is, the number of block numbers (block addresses) stored in the inode corresponding to the blank file is divisible by 4, so that the data content in the blank file with a compression mark can be compressed smoothly later.

[0170] In another possible implementation, if, when executing step S1022, the data content is copied to the temporary file in a data storage format different from that of the file to be compressed (such as a compressed format), then when executing step S1042, there is no need to convert the data storage format of the copied data content, and the copied data content can be directly stored in a blank file with a compression mark. Since there is no need to adjust the data storage format of the data content, the speed of transferring the data content is improved.

[0171] In this implementation, the copied data content is stored in a compressed format in a blank file with a compression mark, which realizes the conversion of incompressible files into compressible files and expands the range of compressible files in a read-write file system (such as an F2FS file system). Subsequently, the data content in the blank file with a compression mark can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing guarantees for users to use electronic devices normally, and improving user experience.

[0172] Optionally, in a possible implementation, after the copied data content is stored in a compressed format in a blank file with a compression mark, the temporary file can be deleted, thereby reducing the storage pressure of the electronic device.

[0173] See also Figure 5 , Figure 5 This is a schematic flow chart of another data processing method according to an embodiment of the present application. The data processing method is described in detail below.

[0174] S201, obtaining a file to be compressed in a readable and writable file system.

[0175] For the description of step S201, please refer to the above Figure 2 The description of step S101 in the corresponding embodiment will not be repeated here.

[0176] S202: Detect that the file to be compressed does not contain any data content.

[0177] Exemplarily, the data content is actually stored in a block, and detecting whether the file to be compressed contains the data content is actually detecting whether the block corresponding to the file to be compressed stores the data content. If it is detected that the block corresponding to the file to be compressed stores the data content, it is determined that the file to be compressed contains the data content; if it is detected that the block corresponding to the file to be compressed does not store the data content, it is determined that the file to be compressed does not contain the data content.

[0178] S203: Set a compression mark on the file to be compressed, and modify the data storage format corresponding to the file to be compressed to a compressed format.

[0179] It should be understood that when it is detected that the file to be compressed does not contain data content, the data storage format corresponding to the file to be compressed can be directly modified, and a compression mark can be set for the file to be compressed that does not contain data content. For example, the non-compressed format stored in the inode corresponding to the file to be compressed is modified to a compressed format, and at the same time, an ioctl function is called to set the compression mark in the inode corresponding to the file to be compressed through the ioctl function.

[0180] In this implementation, the file to be compressed does not contain data content. The data storage format corresponding to the file to be compressed is modified from the non-compressed format to the compressed format in advance, so that the data content subsequently stored in the file to be compressed can be stored in a compressed format, so that the file to be compressed with data content written in a compressed format becomes a compressible file, realizing the conversion of incompressible files into compressible files, and expanding the range of compressible files in a read-write file system (such as the F2FS file system). The compressible files can be compressed later according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing guarantees for users to use electronic devices normally, and improving user experience.

[0181] Moreover, by expanding the range of compressible files in a read-write file system (such as an F2FS file system), more files can be compressed in an electronic device, thereby improving the compression rate of the read-write file system.

[0182] See also Figure 6 , Figure 6 This is a schematic flow chart of another data processing method according to an embodiment of the present application. The data processing method is described in detail below.

[0183] S301: Obtain a file to be compressed in a readable and writable file system.

[0184] S302: When it is detected that the file to be compressed contains data content, the data content is transferred to obtain a blank file.

[0185] S303: Set a compression mark for the blank file, and modify the data storage format corresponding to the blank file to a compressed format.

[0186] S304: Store the data content in a compressed format into a blank file with a compression mark.

[0187] It is worth noting that for the description of steps S301 to S304, please refer to the above Figure 2 The descriptions of steps S101 to S104 in the corresponding embodiments are not repeated here.

[0188] Optionally, the F2FS file system may include different compression modes. For example, the F2FS file system may include an automatic compression mode (fs mode) and a user compression mode (user mode).

[0189] Automatic compression mode means that the F2FS file system will set the data storage format of the newly created file to the compressed format according to the pre-configured file suffix name when creating a new file, and set the compression mark for the newly created file. This allows the data content subsequently written to the file to be written in a compressed format, and the data content in the file can be compressed afterwards.

[0190] Among them, the pre-configured file suffixes may include JPG (Joint Photographic Experts Group), MP3 (Moving Picture Experts Group 3), MP4 (Moving Picture Experts Group 4), TXT (Text File), WAV (Wave Audio Files), PNG (Portable Network Graphics), GIF (Graphics Interchange Format), etc.

[0191] For example, when a new file is created, if it is detected that the suffix of the newly created file is JPG, the data storage format of the newly created file is set to a compressed format, and the data content subsequently written into the file is written in a compressed format. The data content in the file can be directly compressed when necessary.

[0192] User compression mode means that the F2FS file system in the kernel layer provides an interface to the application framework layer. After receiving the compression instruction, the application framework layer can call the interface and implement compression of data content based on the interface.

[0193] The following steps S305 to S308 are described by taking the compression mode as the user compression mode as an example.

[0194] S305: Receive a compression instruction.

[0195] The compression instruction is used to trigger the electronic device to compress the data content in the blank file.

[0196] Exemplarily, the compression instruction can be triggered by the user or automatically by the electronic device. For example, when the user cleans up the memory of the electronic device, he clicks on the compression option displayed on the display screen of the electronic device to trigger the electronic device to generate the compression instruction. After that, the electronic device executes step S306 and step S307, or executes step S306 and step S308. Whether to execute step S306 and step S307 or step S306 and step S308 can be determined according to the actual situation and is not limited to this.

[0197] For another example, the available memory of the electronic device is monitored in real time through an application program for managing the memory of the electronic device. When it is detected that the available memory of the electronic device is less than the preset memory threshold, and steps S301 to S304 have been completed, a compression instruction is generated. The application layer passes the compression instruction to the application framework layer, and the application framework layer passes the compression instruction to the kernel layer, triggering the electronic device to execute steps S306 and S307, or to execute steps S306 and S308. Whether to execute steps S306 and S307 or to execute steps S306 and S308 can be determined according to actual conditions, and there is no limitation on this.

[0198] S306: Obtain the data volume corresponding to the data content in the blank file.

[0199] For example, the inode of a blank file stores block numbers, and each block number points to a block. The number of blocks corresponding to the blank file can be determined by checking the number of block numbers stored in the inode of the blank file. It is known that each block can store 4KB of data, so the amount of data corresponding to the data content in the blank file can be calculated based on the number of blocks and the amount of data stored in each block.

[0200] For example, the inode of a blank file stores 864 block numbers, and these 864 block numbers point to 864 blocks respectively. For the blank file, a total of 3456KB of data content can be stored through these 864 blocks, that is, the data volume corresponding to the data content in the blank file is 3456KB.

[0201] For another example, the inode of a blank file stores 3 block numbers, which point to 3 blocks respectively. For the blank file, 12KB of data content can be stored in total through these 3 blocks, that is, the data content in the blank file corresponds to 12KB of data. This is only an exemplary description and is not limited to this.

[0202] After obtaining the data volume corresponding to the data content in the blank file, compare the data volume with the preset threshold. If the data volume is less than the preset threshold, execute step S307; if the data volume is greater than or equal to the preset threshold, execute step S308.

[0203] S307: When it is detected that the data volume is less than a preset threshold, it is determined that the data content in the blank file is incompressible.

[0204] In the embodiment of the present application, the size of the preset threshold can be adjusted in real time according to the compression unit.

[0205] For example, the compression unit can be set to 2. 2 ~2 8 , that is, the minimum compression unit is 4. It can be understood that at least 4 blocks can be compressed, and each block can store 4KB of data, so at least 16KB of data can be compressed. Therefore, the preset threshold can be set to 16KB.

[0206] For example, when the data volume corresponding to the data content in the blank file is 12 KB, since the data volume 12 KB is less than the preset threshold 16 KB, it is determined that the data content in the blank file is incompressible.

[0207] It should be understood that the larger the compression unit is set, the more blocks are compressed each time, and more storage space can be released. Correspondingly, the larger the compression unit is set, the larger the preset threshold is set to ensure the feasibility of compression.

[0208] For example, the compression unit is set to 2 3 , that is, the compression unit is 8. In this scenario, at least 8 blocks can be compressed, and each block can store 4KB of data, so at least 32KB of data can be compressed. Therefore, the preset threshold can be set to 32KB.

[0209] It is worth noting that the larger the compression unit is set, the longer the corresponding decompression time will be. Therefore, the larger the compression unit is, the better it is. It needs to be set and adjusted according to the actual situation.

[0210] In this implementation, the size of the data volume corresponding to the data content in the blank file is determined in advance, and files with too small data volume are directly determined to be incompressible, thereby avoiding the electronic device from performing useless compression operations and saving power consumption of the electronic device.

[0211] S308: When it is detected that the data volume is greater than or equal to a preset threshold, the data content in the blank file is compressed.

[0212] Exemplarily, when it is detected that the amount of data is greater than or equal to a preset threshold, the data content in the blank file can be compressed by calling a preset function.

[0213] Optionally, the preset function in this embodiment may be the same as the preset function used when setting the compression mark above. For example, the preset function in this embodiment may be an ioctl function.

[0214] Optionally, in a possible implementation, the compression instruction may include a compression unit and a preset compression algorithm. Compressing the data content in the blank file may specifically include obtaining the compression unit and the preset compression algorithm, and calling the ioctl function to compress the data content in the blank file using the preset compression algorithm and the compression unit.

[0215] The preset compression algorithm may include Lz4 compression algorithm, lz4hc compression algorithm, lzo compression algorithm, zstd compression algorithm, etc. These compression algorithms have different compression speeds, and a suitable compression algorithm may be selected according to actual needs. This is only an exemplary description and is not limited to this.

[0216] It is worth noting that the preset compression algorithm in this embodiment is a lossless compression algorithm, which can ensure that the quality of the data content in the blank file will not be affected after compression, so that the subsequent decompression of the compressed data content can obtain data content with the same quality as before compression.

[0217] In this implementation, the amount of data corresponding to the data content in the blank file is determined in advance, and when the amount of data is detected to be greater than or equal to a preset threshold, the data content in the blank file is compressed, thereby ensuring the feasibility of compression. At the same time, after compressing the data content in the blank file, storage space can be released, so that the performance and fluency of the electronic device are improved, and users can also store new data content based on the released storage space, thereby improving the user experience.

[0218] Optionally, in a possible implementation, before executing the above step S301, the data processing method provided in the embodiment of the present application may further include: enabling the compression function of the F2FS file system, so that the electronic device can smoothly execute steps S301 to S308. Exemplarily, there is a code for enabling or disabling the compression function in the F2FS file system, and the compression function of the F2FS file system can be enabled or disabled by adjusting the code.

[0219] Optionally, in a possible implementation, after the above step S203, if the data content is stored in the to-be-compressed file whose data storage format is a compressed format, thereafter, steps S306 to S308 may also be executed.

[0220] See also Figure 7 , Figure 7 This is a specific flow chart of step S308 of a data processing method shown in an embodiment of the present application. The above step S308 may include step S3081 and step S3082, which are specifically as follows.

[0221] S3081. Obtain M data blocks corresponding to the data content in the blank file.

[0222] In order to ensure that the data content in the blank file can be compressed normally, when the compression unit is set differently, the value of M is also different.

[0223] For example, when the compression unit is 2 2 When M is a positive integer greater than or equal to 4; when the compression unit is 2 3 When M is a positive integer greater than or equal to 8; when the compression unit is 2 4 When M is a positive integer greater than or equal to 16; this is only an example and is not limited to this.

[0224] As an example of the present application, the number of block numbers stored in the inode of the blank file is checked, and M data blocks are determined according to the number of block numbers. For example, if the inode of the blank file stores 8 block numbers, the value of M is also 8, that is, the data content in the blank file corresponds to 8 data blocks.

[0225] For easier understanding, see Figure 8 , Figure 8 A schematic diagram of compressing data based on the F2FS file system provided in an embodiment of the present application. Figure 8 As shown, assuming that M is 8, 8 data blocks corresponding to the data content in the blank file are obtained, and the 8 data blocks are data block 0, data block 1, data block 2, data block 3, data block 4, data block 5, data block 6, and data block 7.

[0226] S3082. Compress M data blocks using a preset compression algorithm to obtain N compressed data blocks and L blank data blocks.

[0227] N is a positive integer less than M, and L is the difference between M and N.

[0228] Exemplarily, a compression unit and a preset compression algorithm are obtained. Assuming that the compression unit is 4, the ioctl function is called to read 8 data blocks from the disk storage into the flash memory device, and the preset compression algorithm is used to compress the 8 data blocks in the flash memory device with 4 as the compression unit, and the compressed data blocks are written to the disk storage.

[0229] like Figure 8 As shown in the figure, when the compression unit is 4, the 8 data blocks are divided into two groups of data to be compressed, the first group of data to be compressed is data block 0, data block 1, data block 2, data block 3, and the second group of data to be compressed is data block 4, data block 5, data block 6, data block 7. The two groups of data to be compressed are compressed at the same time. It is assumed that after the first group of data to be compressed is compressed, 2 compressed data blocks are obtained, namely data block 8 and data block 9; after the second group of data to be compressed is compressed, 3 compressed data blocks are obtained, namely data block 10, data block 11 and data block 12.

[0230] Correspondingly, after the first set of data to be compressed is compressed, two blank data blocks are obtained, and after the second set of data to be compressed is compressed, one blank data block is obtained. Figure 8 As shown, the data blocks indicated by dotted lines are blank data blocks. It can be understood that these three blank data blocks are data blocks released after compressing the eight data blocks, and these three data blocks can be used to store other data contents.

[0231] In this implementation, compressing the data content in the blank file can release storage space, thereby improving the performance and fluency of the electronic device. At the same time, users can also store new data content based on the released storage space, thereby improving the user experience.

[0232] Optionally, in a possible implementation, for a group of data to be compressed, the first blank data block obtained after compression can be used to store a mark, which is used to identify that the group of data to be compressed is compressed, which is conducive to subsequent rapid decompression according to the mark.

[0233] Optionally, in a possible implementation, the F2FS file system may include a record file, which is used to record how many blocks each file has, how many of these blocks are blocks storing data content, and how many are blank blocks, i.e., blocks without storing data content. When it is detected that the data content in the blank file is compressed, the content recorded in the record file is updated according to the compressed data blocks and blank data blocks obtained after compression.

[0234] In this implementation, the data content of each file is recorded by recording the file, so that the released blank data blocks can be counted intuitively, thereby quickly determining the released storage space.

[0235] See also Fig. 9 , Fig. 9 This is a schematic flow chart of another data processing method shown in an embodiment of the present application. The data processing method is described below.

[0236] S401: Obtain a file to be compressed in a readable and writable file system.

[0237] S402: Detect whether the file to be compressed contains data content.

[0238] When it is detected that the file to be compressed does not contain data content, the following step S403 is executed; when it is detected that the file to be compressed contains data content, the following steps S404 to S408 are executed.

[0239] S403: When it is detected that the file to be compressed does not contain data content, a compression mark is set for the file to be compressed, and the data storage format corresponding to the file to be compressed is modified to a compressed format.

[0240] S404: When it is detected that the file to be compressed contains data content, the data content is transferred to obtain a blank file.

[0241] S405: Set a compression mark for the blank file, and modify the data storage format corresponding to the blank file to a compressed format.

[0242] S406: Store the data content in a compressed format in a blank file with a compression mark.

[0243] S407: Receive a compression instruction.

[0244] S408: Determine whether the data volume corresponding to the data content in the blank file is less than a preset threshold.

[0245] When the judgment result is that the data amount is less than the preset threshold, the following step S409 is executed; when the judgment result is that the data amount is greater than or equal to the preset threshold, the following step S410 is executed.

[0246] S409: Determine whether the data content in the blank file is incompressible.

[0247] S410: compress the data content in the blank file.

[0248] It is worth noting that the specific implementation methods in the above steps S401 to S410 can refer to the relevant descriptions in the above embodiments and will not be repeated here.

[0249] In this implementation, for a file to be compressed (an incompressible file) that has been created and includes data content written in an uncompressed format, its data content is first transferred to turn the file into a blank file, and then a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified from an uncompressed format to a compressed format, so that when the transferred data content is written into the blank file again, it is written in a compressed format, thereby making the blank file including data content written in a compressed format a compressible file, realizing the conversion of an incompressible file into a compressible file, and expanding the range of compressible files in a readable and writable file system (such as an F2FS file system). Subsequently, the compressible files can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing a guarantee for users to use electronic devices normally, and improving the user experience.

[0250] Moreover, by expanding the range of compressible files in a read-write file system (such as an F2FS file system), more files can be compressed in an electronic device, thereby improving the compression rate of the read-write file system.

[0251] Fig. 9 For other technical effects obtained by the corresponding embodiments, please refer to the relevant descriptions in the aforementioned other embodiments and will not be repeated here.

[0252] See also Fig.10 , Fig.10 This is a schematic flow chart of another data processing method according to an embodiment of the present application. The data processing method is described below.

[0253] S501: Create a temporary file corresponding to the file to be compressed.

[0254] S502: Copy the data content to a temporary file.

[0255] S503: Delete the data content contained in the file to be compressed to obtain a blank file.

[0256] S504: Set a compression mark for the blank file, and modify the data storage format corresponding to the blank file to a compressed format.

[0257] S505: Copy the data content in the temporary file.

[0258] S506: Store the copied data content in a compressed format in a blank file with a compression mark.

[0259] S507: Delete temporary files.

[0260] It is worth noting that the specific implementation methods of the above steps S501 to S507 can be referred to the above related descriptions and will not be repeated here.

[0261] In this implementation, for a file to be compressed (an incompressible file) that has been created and includes data content written in an uncompressed format, its data content is first transferred to turn the file into a blank file, and then a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified from an uncompressed format to a compressed format, so that when the transferred data content is written into the blank file again, it is written in a compressed format, thereby making the blank file including data content written in a compressed format a compressible file, realizing the conversion of an incompressible file into a compressible file, and expanding the range of compressible files in a readable and writable file system (such as an F2FS file system). Subsequently, the compressible files can be compressed according to the actual application scenario, freeing up more available storage space for electronic devices, improving the fluency of electronic devices, providing a guarantee for users to use electronic devices normally, and improving the user experience.

[0262] Moreover, by expanding the range of compressible files in a read-write file system (such as an F2FS file system), more files can be compressed in an electronic device, thereby improving the compression rate of the read-write file system.

[0263] Fig.10 For other technical effects obtained by the corresponding embodiments, please refer to the relevant descriptions in the aforementioned other embodiments and will not be repeated here.

[0264] The data processing method provided in the embodiment of the present application is described above in conjunction with the accompanying drawings. The hardware structure of the electronic device involved in the embodiment of the present application is briefly introduced below in conjunction with the accompanying drawings.

[0265] See also Fig.11 , Fig.11 The figure is a schematic diagram of the hardware structure of an electronic device according to an exemplary embodiment of the present application.

[0266] like Fig.11As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0267] It is to be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Fig.11 More or fewer components than those shown, or the electronic device 100 may include Fig.11 A combination of some of the components shown, or the electronic device 100 may include Fig.11 Subassemblies of some of the components shown. Fig.11 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0268] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0269] In the embodiment of the present application, the processor 110 can execute each step in the data processing method. For example, the processor 110 can run the software code of the data processing method provided in the embodiment of the present application, thereby solving the problem in the related art that the range of files that can be compressed in the electronic device is limited, resulting in failure to release more available storage space for the electronic device.

[0270] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0271] In an embodiment of the present application, the memory in the processor 110 can also be used to store one or more programs corresponding to the above-mentioned data processing method. When one or more programs are executed by the processor, the electronic device executes the above-mentioned related steps to implement the data processing method in the above-mentioned embodiment.

[0272] In some embodiments, the processor 110 may further include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor (MIPI) interface, a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0273] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0274] The display screen 194 is used to display images, videos, etc. A series of graphical user interfaces (GUIs) can be displayed on the display screen 194 of the electronic device 100 .

[0275] The display screen 194 in the embodiment of the present application may be a touch display screen. A touch sensor 180K may be integrated in the display screen 194. The touch sensor 180K may also be referred to as a "touch panel". In other words, the display screen 194 may include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch display screen, also referred to as a "touch screen".

[0276] The touch sensor 180K is used to detect a touch operation applied thereon or near it. After the touch operation detected by the touch sensor 180K, the driver of the kernel layer (such as the TP driver) may pass it to the upper layer to determine the type of touch event. Visual output related to the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0277] For example, when a user clicks on the compression option displayed on the display screen 194 of the electronic device 100, the touch sensor 180K receives the user's touch operation, and the kernel layer processes the touch operation into an input event, which includes touch coordinates, touch force, timestamp of the touch operation, touch type, etc. The input event is stored in the kernel layer, and the kernel layer reports the input event to the application framework layer, which parses the information included in the input event. At the same time, the application framework layer can determine the focus application according to the current focus, and send the parsed information to the focus application.

[0278] Among them, the current focus is the position where the user's finger touches the display screen 194 in the current touch operation; the focus application is the application running in the foreground of the electronic device 100, such as a memory cleaning application, a mobile phone management application, a memory manager application, etc.

[0279] The GPU renders the image corresponding to the input event, and then pre-processes the rendered layer. The pre-processed layers are superimposed and synthesized into an image through the hardware synthesizer, and the image is displayed through the display driver of the kernel layer, so that the display screen 194 displays the corresponding interface that the focus application should display after responding to the input event. For example, the display screen 194 displays an interface of compressing files.

[0280] The internal memory 121 may be used to store computer executable program codes, which include instructions. The processor 110 executes the instructions stored in the internal memory 121 to perform various functional applications and data processing of the electronic device 100.

[0281] The internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system of the electronic device. The data storage area may store data created during the use of the electronic device 100. In an embodiment of the present application, the data storage area may store files to be compressed, temporary files, etc. in a readable and writable file system.

[0282] In addition, the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), a Nand-flash memory, etc.

[0283] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. For example, when the user's finger touches the display screen 194, the user's finger forms a capacitor with the electrode near the corresponding position of the display screen 194.

[0284] It is understandable that the electronic device may further include a speed sensor. The speed sensor is used to obtain the moving speed of the electronic device.

[0285] The data processing method provided in the embodiment of the present application can be implemented in the electronic device 100 having the above hardware structure.

[0286] The above briefly introduces the structure of the electronic device 100 involved in the embodiment of the present application. The following briefly introduces the software structure involved in the embodiment of the present application. Fig.12 , Fig.12 The software structure block diagram of the electronic device shown in an exemplary embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system of the electronic device 100 is divided into three layers, namely, the application layer, the application framework layer, and the kernel layer from top to bottom.

[0287] The application layer can include a series of application packages. Fig.12 As shown, the application package may include applications such as camera, calendar, map, wireless local area networks (WLAN), music, short message, memory cleaning application, memory manager application, etc., and may also include other applications not shown, such as mobile phone management application.

[0288] The Android framework is a layer below the application layer, called the application framework layer. The application framework layer provides an application programming interface (API) and a programming framework for applications in the application layer. The application framework layer can include some predefined functions.

[0289] As an example of this application, Fig.12 As shown, the application framework layer may include an application management module. The application management module is used to manage applications. For example, the running status (such as foreground running status, background running status, etc.) of a memory cleaning application, a mobile phone management application, a memory manager application, etc. may be managed through the application management module.

[0290] Optionally, the application framework layer may further include an instruction generation module. In the embodiment of the present application, the instruction generation module may be used to generate acquisition instructions, compression instructions, and the like.

[0291] Optionally, the application framework layer may also include a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

[0292] The content provider is used to store and obtain data and make the data accessible to applications. The data may include data generated by installing applications, data generated by taking and / or downloading photos, data generated by recording and / or downloading videos, data generated by browsing web pages, data generated by recording text, data generated by using various types of applications (such as social, shopping, entertainment, financial, etc.), etc. This is only an example and is not limited to this.

[0293] The view system may include visual controls, such as controls for displaying text, controls for displaying pictures, etc. In the embodiment of the present application, the visual control may be a compression option control.

[0294] The view system can also be used to construct the display interface of the application, and the display interface can be composed of one or more views. In the embodiment of the present application, the display interface can include the interface of the application such as the memory cleaning application, the mobile phone management application, the memory manager application, and can also include the interface of the file being compressed.

[0295] The phone manager is used to provide communication functions for the electronic device 100, such as management of call status (including answering, hanging up, etc.).

[0296] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, and video files.

[0297] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to inform the user that there is no compressible file, the current file is not compressible, the file has started to be compressed, the file is being compressed, the file has been compressed, etc.

[0298] The notification manager can also be a notification that appears in the top status bar of the system in the form of an icon or scroll bar text, such as a notification that a memory cleaning application, a phone management application, a memory manager application, etc. are running in the background.

[0299] The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message prompt in the status bar, a prompt sound, vibration of the electronic device, flashing indicator light, etc., to notify the user that there is currently no compressible file, the current file is uncompressible, the file has begun to be compressed, the file is being compressed, the file has been compressed, etc.

[0300] The kernel layer is a layer between hardware and software. The kernel layer may include a memory management module. The memory management module may execute memory recovery operations in the operating system of the electronic device, manage the memory occupied by the processes of various running applications, and ensure the normal operation of the operating system of the electronic device.

[0301] In the embodiments of the present application, the memory management module can be used to implement the data processing methods described in the above embodiments. For example, the method can be used to obtain the file to be compressed in the read-write file system, and when it is detected that the file to be compressed contains data content, the data content is transferred to obtain a blank file; a compression mark is set for the blank file, and the data storage format corresponding to the blank file is modified to a compressed format; the data content is stored in a compressed format in a blank file with a compression mark; a compression instruction is received; the data volume corresponding to the data content in the blank file is obtained; when it is detected that the data volume is less than a preset threshold, it is determined that the data content in the blank file is incompressible; when it is detected that the data volume is greater than or equal to the preset threshold, the data content in the blank file is compressed, etc.

[0302] It is understandable that the memory management module may be a software module running at the kernel layer.

[0303] Optionally, the kernel layer may further include a display driver, which may be used to display different windows, such as windows corresponding to a memory cleaning application, a mobile phone management application, a memory manager application, and the like.

[0304] Optionally, the core layer may also include a touch panel driver, a camera driver, an audio driver, a sensor driver, etc.

[0305] The above describes in detail an example of a data processing method provided by an embodiment of the present application. It is understandable that, in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered to exceed the scope of the present application.

[0306] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each function can be divided into each functional module, or two or more functions can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0307] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0308] The electronic device provided in this embodiment is used to execute the above data processing method, and thus can achieve the same effect as the above implementation method.

[0309] In the case of an integrated unit, the electronic device may further include a processing module, a storage module and a communication module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device to execute stored program codes and data, etc. The communication module may be used to support the electronic device to communicate with other devices.

[0310] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a WiFi chip, etc.

[0311] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device involved in this embodiment may be a Fig.11 Device of the structure shown.

[0312] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the data processing method of any of the above embodiments.

[0313] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the data processing method in the above-mentioned embodiment.

[0314] An embodiment of the present application also provides a memory, which stores one or more programs for implementing the data processing methods in the above embodiments. When one or more programs are executed by a processor in an electronic device, the processor executes the data processing method of any of the above embodiments.

[0315] The present application also provides a chip. Fig.13 , Fig.13 A schematic diagram of the structure of a chip provided in an embodiment of the present application. Fig.13 The chip shown can be a general-purpose processor or a special-purpose processor. The chip includes a processor 210. The processor 210 is used to execute the data processing method of any of the above embodiments.

[0316] Optionally, the chip further includes a transceiver 220, which is used to accept control of the processor and to support the communication device in executing the technical solution shown above.

[0317] Optional, Fig.13 The chip shown may further include: a storage medium 230 .

[0318] It should be noted that Fig.13 The chip shown can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits that can perform the various functions described throughout this application.

[0319] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.

[0320] An embodiment of the present application also provides a chip system, including a processor, the processor is coupled to a memory, the memory is used to store computer program instructions, when the processor executes the computer program instructions, the chip system executes the above-mentioned related steps to implement the data processing method in the above-mentioned embodiment.

[0321] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0322] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0323] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0324] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0325] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0326] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A data processing method, characterized in that: include: Acquire a file to be compressed in a readable and writable file system, wherein the readable and writable file system includes an F2FS file system, and the data storage format corresponding to the file to be compressed is a non-compressed format; It is detected that the file to be compressed contains data content, the data content is stored in the non-compressed format, and the data content is not compressible; Transferring the data content to obtain a blank file; Setting a compression mark for the blank file, and modifying the data storage format corresponding to the blank file to a compressed format; Storing the data content in the compressed format into a blank file provided with the compression mark; The compression mark is used to indicate that the data content is compressible.

2. The method according to claim 1, characterized in that The transferring of the data content to obtain a blank file comprises: Creating a temporary file corresponding to the file to be compressed; Copying the data content to the temporary file; The data content contained in the file to be compressed is deleted to obtain the blank file.

3. The method according to claim 2, characterized in that The step of storing the data content in the compressed format into a blank file provided with the compression mark comprises: Copy the data content in the temporary file; The copied data content is stored in the compressed format in a blank file with the compression mark set.

4. The method according to claim 2, characterized in that After obtaining the file to be compressed in the readable and writable file system, the method further includes: Detecting that the file to be compressed does not contain data content; A compression mark is set for the file to be compressed, and the data storage format corresponding to the file to be compressed is modified to a compressed format.

5. The method according to any one of claims 1 to 4, characterized in that: After storing the data content in the compressed format in a blank file provided with the compression mark, the method further includes: receiving a compression instruction; Obtain the data volume corresponding to the data content in the blank file; When it is detected that the data amount is greater than or equal to a preset threshold, the data content in the blank file is compressed.

6. The method according to claim 5, characterized in that After obtaining the data volume corresponding to the data content in the blank file, the method further includes: When it is detected that the data amount is less than the preset threshold, it is determined that the data content in the blank file is incompressible.

7. The method according to claim 5, characterized in that The compressing the data content in the blank file includes: Obtain M data blocks corresponding to the data content in the blank file, where M is a positive integer greater than or equal to 4; The M data blocks are compressed using a preset compression algorithm to obtain N compressed data blocks and L blank data blocks; N is a positive integer less than M, and L is a difference between M and N.

8. The method according to claim 1, characterized in that The step of obtaining the file to be compressed in the readable and writable file system includes: When it is detected that the available memory of the electronic device is less than a preset memory threshold, the file to be compressed in the read-write file system is obtained.

9. An electronic device, characterized in that: include: one or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the processor is enabled to perform the method according to any one of claims 1 to 8.

10. A chip, characterized in that: include: A processor, used to call and run a computer program from a memory, so that an electronic device equipped with the chip executes a method as claimed in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by an electronic device, the electronic device executes the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Traffic information file compression and decompression method and device

    CN103914459A

  • Method and equipment used for classified transmission of files

    CN104978319A