Mirror image file generation or use method and device, equipment and storage medium

By updating the address information in the metadata during the generation process of image file to avoid duplicate storage, the problem that the prior art cannot compress and deduplicate simultaneously is solved, and more efficient storage space utilization is achieved.

CN119903029APending Publication Date: 2025-04-29BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311407021.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-26
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

In the prior art, when creating a mirror file, data blocks cannot be compressed and deduplicated at the same time, resulting in the inability to make full use of limited storage space.

Method used

By generating the compressed data block to be written and determining whether the same target compressed data block exists in the written compressed data block, if so, the address information in the metadata is updated without writing to the mirror file, thereby realizing deduplication on the basis of compression.

Benefits of technology

It effectively saves the storage space occupied by the mirror file and optimizes the storage efficiency through deduplication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903029A_ABST
    Figure CN119903029A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of communication, in particular to a mirror image file generation or use method and device, equipment and a computer readable storage medium. The generation method of the mirror image file comprises the following steps: generating a compressed data block to be written; determining whether a target compressed data block which is the same as the compressed data block to be written exists in the written compressed data blocks or not; and if the target compressed data block exists, updating address information in metadata corresponding to the compressed data block to be written into an address of the target compressed data block, and not writing the compressed data block to be written into the mirror image file. In the generation process of the mirror image file, whether the same compressed data block is written or not can be determined. If the same compressed data block is written, the address information is updated to be the address information of the written same compressed data block, so that the compressed data block to be written is not written into the mirror image file any more, duplicate removal is performed on the basis of compression, and the storage space occupied by the mirror image file is further saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to a method, device, equipment and computer-readable storage medium for generating or using an image file. Background Art

[0002] When creating an image file, related technologies support compressing data blocks or deduplicating data blocks to save storage space.

[0003] However, in the related art, only one of the compression and deduplication of data blocks can be selected, and the data blocks cannot be compressed and deduplicated at the same time, so that the limited storage space cannot be fully utilized. Summary of the invention

[0004] In order to overcome the problems existing in the related art, the present disclosure provides a method, device, equipment and computer-readable storage medium for generating an image file, which can solve the above problems.

[0005] According to a first aspect of an embodiment of the present disclosure, a method for generating a mirror file is provided, the method comprising: generating a compressed data block to be written; determining whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks that have been written; if the target compressed data block exists, updating the address information in the metadata corresponding to the compressed data block to be written to the address of the target compressed data block, and not writing the compressed data block to be written into the mirror file.

[0006] According to a second aspect of an embodiment of the present disclosure, a method for using an image file is provided, the method comprising: determining metadata of target data to be read, the metadata comprising address information for indicating an address of a compressed data block corresponding to the target data; reading a corresponding compressed data block according to the address information, and decompressing the read compressed data block, the address of the compressed data block being also recorded in the address information of at least one other metadata.

[0007] According to a third aspect of an embodiment of the present disclosure, a device for generating a mirror file is provided, the device comprising: a generating unit, configured to generate a compressed data block to be written; a judging unit, configured to determine whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks already written; and an updating unit, configured to update the address information in the metadata corresponding to the compressed data block to be written to the address of the target compressed data block if the target compressed data block exists, and not write the compressed data block to be written into the mirror file.

[0008] According to a fourth aspect of an embodiment of the present disclosure, a device for using an image file is provided, the device comprising: a determination unit, configured to determine metadata of target data to be read, the metadata comprising address information for indicating an address of a compressed data block corresponding to the target data; a decompression unit, configured to read a corresponding compressed data block according to the address information, and decompress the read compressed data block, the address of the compressed data block being also recorded in the address information of at least one other metadata.

[0009] According to a fifth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the method for generating or using an image file as described in the first and second aspects by calling the computer program.

[0010] According to a sixth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for generating or using an image file as described in the first and second aspects is implemented.

[0011] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0012] In the process of generating the image file, the present disclosure can determine whether the same compressed data block has been written. If the same compressed data block has been written, the address information is updated to the address information of the same compressed data block written, so that the compressed data block to be written is no longer written into the image file, thereby achieving deduplication on the basis of compression, so as to further save the storage space occupied by the image file.

[0013] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0015] Figure 1 It is a schematic diagram of the layout of an image file according to an embodiment of the present disclosure.

[0016] Figure 2 It is a schematic diagram of the layout of an image file according to an embodiment of the present disclosure.

[0017] Figure 3 The present invention is a schematic flowchart of a method for generating an image file according to an embodiment of the present invention.

[0018] Figure 4It is a schematic diagram of a compression process of a method for generating an image file according to an embodiment of the present disclosure.

[0019] Figure 5 The present invention is a schematic flowchart of a method for using an image file according to an embodiment of the present invention.

[0020] Figure 6 The present invention is a schematic diagram of a decompression process of a method for using an image file according to an embodiment of the present invention.

[0021] Figure 7 The present invention is a block diagram of a device for generating an image file according to an exemplary embodiment of the present invention.

[0022] Figure 8 The present invention is a block diagram of a device for using an image file according to an exemplary embodiment of the present invention.

[0023] Fig. 9 The present invention is a schematic block diagram of a device for generating or using an image file according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0025] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0026] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0027] When creating an image file, related technologies only support compressing data blocks or deduplicating data blocks to save storage space.

[0028] Figure 1 It is a schematic diagram of the layout of an image file according to an embodiment of the present disclosure.

[0029] like Figure 1 As shown, the address information in the metadata of the file can be indicated by an index. In the process of making an image file, it is necessary to compress the data blocks in the file to obtain compressed data blocks, and then add the compressed data blocks to the image file.

[0030] However, in some cases, the compressed data blocks obtained after compressing the data blocks in the file may be the same. Figure 1 As shown in , the address information in the metadata is index-x, and the compressed data block corresponding to the address n indicated is compressed data block 2, and the compressed data block corresponding to the address m indicated by the address information is index-x+6 is also compressed data block 2, which shows that the compressed data blocks of the two are the same. This will lead to repeated storage of the same compressed data block in the image file, resulting in a waste of storage space of the image file.

[0031] Figure 2 It is a schematic diagram of the layout of an image file according to an embodiment of the present disclosure.

[0032] like Figure 2 As shown, the technical solution disclosed in the present invention is that in the process of making an image file, when it is determined that the compressed data block corresponding to index-x+6 is the same compressed data block that has been written, the address indicated by index-x+6 is changed to n, and no address is written. Figure 1 The compressed data block 2 on the right side achieves the technical effect of saving the image file size by deduplication.

[0033] The following is a detailed introduction to the technical solution of the present invention.

[0034] Figure 3 FIG. 1 is a schematic flow chart of a method for generating an image file according to an embodiment of the present disclosure. Figure 3 As shown, the method for generating an image file includes:

[0035] In step S301, a compressed data block to be written is generated;

[0036] In step S302, it is determined whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks that have been written;

[0037] In step S303, if the target compressed data block exists, the address information in the metadata corresponding to the compressed data block to be written is updated to the address of the target compressed data block, and the compressed data block to be written is not written into the mirror file.

[0038] In some embodiments, when creating an image file, the data information in the original file may be divided into blocks and compressed to generate compressed data blocks.

[0039] In some embodiments, the image file generation method proposed in the present disclosure is applicable to the production of erofs file system partition image. In this application scenario, the image file generation method proposed in the present disclosure is executed by mkfs.erofs in the erofs file system.

[0040] In some embodiments, based on the compression algorithm, in the process of making the image file, the size of the compressed data block to be written is fixed.

[0041] For example, mkfs.erofs outputs compressed data blocks of fixed 4k size.

[0042] In some embodiments, it is determined whether there is a target compressed data block that is the same as the compressed data block to be written in the compressed data blocks that have been written; if the target compressed data block exists, the address information in the metadata corresponding to the compressed data block to be written is updated to the address of the target compressed data block, and the compressed data block to be written is not written to the image file.

[0043] like Figure 1 , Figure 2 As shown, when the metadata with address information index-x+6 corresponds to the compressed data block to be written, the compressed data block that has been written can be queried. If the compressed data block to be written is included in the compressed data block that has been written, the address indicated by index-x+6 is updated to the address of the same target compressed data block (i.e., compressed data block 2) in the compressed data block that has been written, that is, address = n, and the compressed data block to be written is not written to the mirror file.

[0044] By removing duplicates during the compression process, the addresses indicated by the address information in multiple sets of metadata all correspond to one compressed data block, for example, Figure 2 Both index-x and index-x+6 indicate the same address n and correspond to the same compressed data block 2, thereby avoiding repeated storage of the same compressed data block and further saving the storage space of the image file.

[0045] In some embodiments, the address information may also be indicated by page.

[0046] For example, use page-x, page-x+1, page-x+2, etc.

[0047] In some embodiments, the written compressed data blocks and corresponding addresses may be determined as a data set.

[0048] When a new compressed data block is added to the image file, the new compressed data block and the corresponding address are synchronized to the data set.

[0049] In some embodiments, after the compressed data block to be written is generated, it can be determined whether the target compressed data block exists by comparing with the data set.

[0050] In some embodiments, whether the compressed data block to be written is the same as the target compressed data block may be determined by calculating a hash value.

[0051] In some embodiments, determining whether there is a target compressed data block in the compressed data blocks that have been written that is identical to the compressed data block to be written includes: obtaining a set of hash values ​​of the compressed data blocks that have been written; and comparing the hash value of the compressed data block to be written with the set of hash values.

[0052] A hash value set can be determined, and when a new compressed data block is generated, the hash value of the new compressed data block is calculated and compared with the hash value set; if the hash value corresponding to the new compressed data block does not exist in the hash value set, the corresponding hash value is written into the hash value set, and the new compressed data block is written into the image file, and the address information of the corresponding metadata points to the address of the new compressed data block; if the hash value set contains a hash value that is the same as the hash value corresponding to the new compressed data block, the compressed data block corresponding to the same hash value in the hash value set is determined, and the address information of the metadata corresponding to the new compressed data block is updated to the address of the compressed data block corresponding to the same hash value in the set, the new compressed data block is not written into the image file, and its hash value is not repeatedly recorded in the hash value set.

[0053] In some embodiments, the method further includes: if the target compressed data block does not exist, updating the address information in the metadata corresponding to the compressed data block to be written to the address of the compressed data block to be written, and writing the compressed data block to be written into the mirror file.

[0054] After the compressed data block to be written is written into the mirror file, the compressed data block to be written is converted into a written compressed data block.

[0055] In some embodiments, a database is determined, wherein the database stores hash values ​​and addresses of written compressed data blocks in the image file.

[0056] After calculating the hash value of the generated compressed data block to be written, it is possible to query whether the same hash value exists in the database.

[0057] If the same hash value exists, the address information in the metadata is modified to the address corresponding to the same hash value, and the compressed data block to be written is not written to the mirror file; if the same hash value does not exist, the address information in the metadata is modified to the address of the compressed data block to be written, the compressed data block to be written is written to the mirror file, and the corresponding hash value and address are recorded in the database for subsequent query.

[0058] In some embodiments, when generating a compressed data block to be written, an identifier of the file to which the data block before compression belongs and a relative position of the data block before compression in the file to which it belongs may be recorded.

[0059] In some embodiments, the identifier of the file to which the pre-compression data block belongs and the relative position of the pre-compression data block in the file to which it belongs may be recorded in the form of metadata.

[0060] In addition to the index used to indicate the address, the metadata may also include i_ino and m_la, wherein i_ino is used to indicate the identifier of the file to which it belongs, and m_la is used to indicate the relative position in the file to which it belongs.

[0061] Figure 4 It is a schematic diagram of a compression process of a method for generating an image file according to an embodiment of the present disclosure.

[0062] like Figure 4 As shown in the figure, 5 data blocks of 4k in size of file A are shown. In the process of making the image, the data blocks of the relative positions of these 5 data blocks from 4k×1+1024 to 4k×3+3072 are compressed to obtain compressed data blocks A. At this time, the relative positions (4k×1+1024; 4k×3+3072) can be recorded through m_la in the metadata, and i_ino=file A.

[0063] After compressing some data blocks of file A to generate compressed data block A, by comparing with the compressed data blocks that have been written, it is found that there is no identical compressed data block, then the compressed data block A is written into the mirror file. At this time, the compressed data blocks that have been written into the mirror file include compressed data block A, compressed data block B, compressed data block C, and compressed data block D.

[0064] like Figure 4As shown, when compressing 5 data blocks of 4k in size of file B, the relative positions from 4k×1+2048 to 4k×3+1024 are compressed data blocks A after compression. At this time, through comparison, it is found that the same compressed data block A is included in the compressed data blocks that have been written. Then, the second compressed data block A compressed by file B is not written into the mirror file, and deduplication is completed. At the same time, the address information of the metadata corresponding to file B also points to the address of the compressed data block A in the mirror file, but the "i_ino=file B" and "m_la=(4k×1+2048; 4k×3+1024)" recorded in the metadata during the compression process are different from the metadata records corresponding to file A.

[0065] It should be noted that Figure 4 This is only an example provided for the present disclosure and is not intended to limit the specific content of the present disclosure.

[0066] Therefore, by recording i_ino and m_la in the metadata and combining the metadata address information index, a unique identifier can be formed for the database before compression, so that even if the compressed data blocks are deduplicated, the file can be restored through the recorded metadata during the decompression process.

[0067] Corresponding to the above-mentioned method for generating an image file, the present disclosure also proposes a method for using a matching image file.

[0068] Figure 5 FIG. 1 is a schematic flow chart of a method for using an image file according to an embodiment of the present disclosure. Figure 5 As shown, the method includes:

[0069] In step S501, metadata of target data to be read is determined, wherein the metadata includes address information for indicating an address of a compressed data block corresponding to the target data;

[0070] In step S502, a corresponding compressed data block is read according to the address information, and the read compressed data block is decompressed, wherein the address of the compressed data block is also recorded in the address information of at least one other metadata.

[0071] In some embodiments, the method for using the image file proposed in the present disclosure is applicable to the use of the erofs file system partition image. In this application scenario, the method for using the image file proposed in the present disclosure can be executed by the kernel erofs file system core of the Linux system.

[0072] In some embodiments, during the generation of the image file, repeated compressed data blocks may be deduplicated, and after deduplication, the structure of the compressed data blocks and the structure of the decompressed data blocks need to be reconstructed.

[0073] After reconstruction, the compressed data block can be decompressed multiple times. For example, if there are M repeated compressed data blocks during the compression process, the compressed data block can be decompressed at most M times and is identified by i_ino and m_la in the metadata, where M is a positive integer.

[0074] In some embodiments, determining metadata of the target data to be read includes: executing an application program, and running the application program requires calling the target data.

[0075] The image file stored in the compressed data block can be read directly or called through the application trigger.

[0076] In some embodiments, the corresponding compressed data block is read according to the address information, and the read compressed data block is decompressed, and the address of the compressed data block is also recorded in the address information of at least one other metadata.

[0077] The address of the compressed data block can be recorded in the address information of multiple metadata. Therefore, when data is read through the multiple metadata, the data block before compression can be obtained by decompressing the compressed data block, thereby reducing the storage space of the image file.

[0078] In some embodiments, the metadata further includes: an identifier of a file to which the target data belongs and a relative position of the target data in the file to which it belongs.

[0079] The metadata may include, in addition to address information index for indicating the address of the compressed data block, an identifier i_ino of the file to which the target data belongs, and a relative position m_la of the target data in the file to which it belongs.

[0080] Among them, i_ino and m_la are both determined in the process of compressing the target data to form a compressed data block. The specific process can refer to the relevant description of the above-mentioned method for generating the image file.

[0081] In some embodiments, the target data to be read includes multiple groups of metadata, and the method further includes: if there are two or more groups of metadata with the same address information among the multiple groups of metadata, decompressing the compressed data blocks indicated by the same address information a number of times corresponding to the two or more groups; adding the corresponding identifiers of the belonging files in the two or more groups of metadata and the relative positions in the belonging files after decompression to the data obtained after each decompression.

[0082] In the case that the target data to be read is composed of data blocks obtained by decompressing multiple compressed data blocks, the target data to be read may correspond to multiple sets of metadata, wherein each set of metadata includes corresponding index, i_ino, and m_la.

[0083] If the indexes in multiple sets of metadata point to different addresses, that is, correspond to different compressed data blocks, corresponding i_ino and m_la attributes can be added after these different compressed data blocks are decompressed, so that these decompressed data blocks form unique identifiers.

[0084] If the indexes of N sets of metadata among the multiple sets of metadata point to the same address, it means that these N sets of metadata correspond to the same compressed data block. These N sets of metadata are at least N sets of repeated compressed data blocks that appear during the compression process. Therefore, the compressed data block needs to be decompressed N times. After each decompression, the decompressed data block is added with the corresponding i_ino and m_la of the N sets of metadata, so that each decompressed data block can distinguish the file to which it belongs and the relative position in the file to which it belongs. Wherein, N is a positive integer less than or equal to M.

[0085] Figure 6 The present invention is a schematic diagram of a decompression process of a method for using an image file according to an embodiment of the present invention.

[0086] like Figure 6 As shown, during the calling process of the application, file A and file B need to be read, and by determining the metadata of file A and file B, it is determined that there are two sets of metadata indexes pointing to the address of compressed data block A. In the decompression process, the compressed data block needs to be decompressed twice.

[0087] After the first decompression, the corresponding metadata "i_ino=file A" and "m_la=(4k×1+1024; 4k×3+3072) attributes are added to the decompressed data block, so as to determine that the file to which the decompressed data block belongs is file A, and its relative position in file A; after the second decompression, the corresponding metadata "i_ino=file B" and "m_la=(4k×1+2048; 4k×3+1024) attributes are added to the decompressed data block, so as to determine that the file to which the decompressed data block belongs is file B, and its relative position in file B.

[0088] The present invention determines whether it is necessary to decompress the compressed data block multiple times by determining the address information in the metadata, and after multiple decompressions, uniquely identifies the data block through i_ino and m_la in the metadata, so that after the compressed data block is deduplicated during the compression process, the data can still be read at the corresponding position of the file.

[0089] Corresponding to the embodiments of the method for generating or using an image file of the present disclosure, the present disclosure also provides embodiments of a corresponding device for generating or using an image file.

[0090] See also Figure 7 , Figure 7 FIG. 1 is a block diagram of a device for generating an image file in one embodiment of the present disclosure. Figure 7 As shown, the image file generation device includes:

[0091] A generating unit 710 is configured to generate a compressed data block to be written;

[0092] The judging unit 720 is configured to determine whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks that have been written;

[0093] The updating unit 730 is configured to update the address information in the metadata corresponding to the compressed data block to be written to the address of the target compressed data block if the target compressed data block exists, and not write the compressed data block to be written into the image file.

[0094] In some embodiments, determining whether there is a target compressed data block in the compressed data blocks that have been written that is identical to the compressed data block to be written includes: obtaining a set of hash values ​​of the compressed data blocks that have been written; and comparing the hash value of the compressed data block to be written with the set of hash values.

[0095] In some embodiments, the device is further configured to: if the target compressed data block does not exist, update the address information in the metadata corresponding to the compressed data block to be written to the address of the compressed data block to be written, and write the compressed data block to be written into the mirror file.

[0096] See also Figure 8 , Figure 8 FIG. 1 is a block diagram of a device for using an image file in one embodiment of the present disclosure. Figure 8 As shown, the device using the image file includes:

[0097] A determining unit 810 is configured to determine metadata of target data to be read, wherein the metadata includes address information for indicating an address of a compressed data block corresponding to the target data;

[0098] The decompression unit 820 is configured to read the corresponding compressed data block according to the address information and decompress the read compressed data block, and the address of the compressed data block is also recorded in the address information of at least one other metadata.

[0099] In some embodiments, the metadata further includes: an identifier of a file to which the target data belongs and a relative position of the target data in the file to which it belongs.

[0100] In some embodiments, the target data to be read includes multiple groups of metadata, and the device is further configured to: if there are two or more groups of metadata with the same address information among the multiple groups of metadata, decompress the compressed data blocks indicated by the same address information for a number of times corresponding to the two or more groups; and add the corresponding identifiers of the belonging files in the two or more groups of metadata and the relative positions in the belonging files after decompression to the data obtained after each decompression.

[0101] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0102] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the delay mitigation method as described in any of the above embodiments by calling the computer program.

[0103] An embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for alleviating delay as described in any of the above embodiments is implemented.

[0104] Fig. 9 1 is a schematic block diagram of a device 900 for generating or using an image file according to an embodiment of the present disclosure. For example, the device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0105] Reference Fig. 9 , the device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .

[0106] The processing component 902 generally controls the overall operation of the device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned information receiving method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.

[0107] The memory 904 is configured to store various types of data to support operations on the device 900. Examples of such data include instructions for any application or method operating on the device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0108] The power supply component 906 provides power to the various components of the device 900. The power supply component 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 900.

[0109] The multimedia component 908 includes a screen that provides an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 908 includes a front camera and / or a rear camera. When the device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0110] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the device 900 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting audio signals.

[0111] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0112] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the device 900. For example, the sensor assembly 914 can detect the open / closed state of the device 900, the relative positioning of components, such as the display and keypad of the device 900, and the sensor assembly 914 can also detect the position change of the device 900 or a component of the device 900, the presence or absence of user contact with the device 900, the orientation or acceleration / deceleration of the device 900, and the temperature change of the device 900. The sensor assembly 914 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0113] The communication component 916 is configured to facilitate wired or wireless communication between the device 900 and other devices. The device 900 can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G LTE, 5G NR, or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0114] In an exemplary embodiment, the device 900 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned information receiving method.

[0115] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 904 including instructions, and the instructions can be executed by the processor 920 of the device 900 to complete the above-mentioned information receiving method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0116] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0117] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

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

[0119] The method and device provided in the embodiments of the present disclosure are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method of the present disclosure and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present disclosure, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present disclosure.

Claims

1. A method for generating an image file, characterized in that: The method comprises: Generate compressed data blocks to be written; Determine whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks that have been written; If the target compressed data block exists, the address information in the metadata corresponding to the compressed data block to be written is updated to the address of the target compressed data block, and the compressed data block to be written is not written into the mirror file.

2. The method according to claim 1, characterized in that The determining whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks that have been written, comprises: Obtaining a set of hash values ​​of the written compressed data blocks; The hash value of the compressed data block to be written is compared with the hash value set.

3. The method according to claim 1, characterized in that The method further comprises: If the target compressed data block does not exist, the address information in the metadata corresponding to the compressed data block to be written is updated to the address of the compressed data block to be written, and the compressed data block to be written is written into the mirror file.

4. A method for using an image file, characterized in that: The method comprises: Determining metadata of target data to be read, wherein the metadata includes address information for indicating an address of a compressed data block corresponding to the target data; The corresponding compressed data block is read according to the address information, and the read compressed data block is decompressed, and the address of the compressed data block is also recorded in the address information of at least one other metadata.

5. The method according to claim 4, characterized in that The metadata also includes: The identifier of the file to which the target data belongs and the relative position of the target data in the file to which it belongs.

6. The method according to claim 5, characterized in that The target data to be read includes multiple sets of metadata, and the method further includes: If two or more sets of metadata have the same address information among the multiple sets of metadata, decompressing the compressed data blocks indicated by the same address information a number of times corresponding to the two or more sets; The identifiers of the corresponding files in the two or more sets of metadata and the relative positions in the files after decompression are added to the data obtained after each decompression.

7. A device for generating an image file, characterized in that: The device comprises: A generating unit, configured to generate a compressed data block to be written; a judging unit configured to determine whether there is a target compressed data block identical to the compressed data block to be written in the compressed data blocks that have been written; The updating unit is configured to update the address information in the metadata corresponding to the compressed data block to be written to the address of the target compressed data block if the target compressed data block exists, and not write the compressed data block to be written into the mirror file.

8. A device for using an image file, characterized in that: The device comprises: a determining unit configured to determine metadata of target data to be read, wherein the metadata includes address information for indicating an address of a compressed data block corresponding to the target data; The decompression unit is configured to read the corresponding compressed data block according to the address information and decompress the read compressed data block, wherein the address of the compressed data block is also recorded in the address information of at least one other metadata.

9. An electronic device, characterized in that: include: Processor, memory; The memory is used to store computer programs; The processor is used to execute the method for generating or using the image file according to any one of claims 1 to 6 by calling the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for generating or using the image file described in any one of claims 1 to 6 is implemented.