CN115981573A - Data management method, electronic device and computer readable and writable storage medium - Google Patents

Data management method, electronic device and computer readable and writable storage medium Download PDF

Info

Publication number
CN115981573A
CN115981573A CN202310120198.6A CN202310120198A CN115981573A CN 115981573 A CN115981573 A CN 115981573A CN 202310120198 A CN202310120198 A CN 202310120198A CN 115981573 A CN115981573 A CN 115981573A
Authority
CN
China
Prior art keywords
data
data block
electronic device
index table
storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310120198.6A
Other languages
Chinese (zh)
Inventor
齐一川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202310120198.6A priority Critical patent/CN115981573A/en
Publication of CN115981573A publication Critical patent/CN115981573A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a data management method, electronic equipment and a computer readable and writable storage medium, relates to the technical field of storage, and can effectively perform data storage management, avoid the waste of storage space and improve the utilization rate of the storage space. The electronic equipment receives a data writing request sent by a first application program, and blocks to-be-written data corresponding to the data writing request to obtain one or more data blocks included in the written data. Then, the data block identifier of each data block can be calculated, and each data block uniquely corresponds to one data block identifier. And then, acquiring an index table, judging whether the same data blocks as the one or more data blocks are stored in the electronic equipment or not based on the stored data blocks indicated in the index table and the data block identifications of the one or more data blocks, and performing storage management on the one or more data blocks according to the judgment result.

Description

Data management method, electronic device and computer readable and writable storage medium
Technical Field
The present application relates to the field of storage technologies, and in particular, to a data management method, an electronic device, and a computer readable and writable storage medium.
Background
At present, a data storage mode in an Application (APP) in an electronic device (such as a mobile phone, a tablet, etc.) is to uniformly allocate a storage space by a file system, and then classify and manage storage data of all applications according to file types. For example, the system manager application classifies data into different file types such as pictures, videos, audios, documents, compression packages, installation packages, and applications, and performs classification management.
The current data storage method is only classified and managed based on the file type of the data, and cannot effectively manage the data. For example, if a user needs to clean a storage space, the user usually needs to first screen and sort data in the storage space by means of a third-party storage space cleaning tool, and then performs data cleaning operation based on the screening and sorting results of third-party storage space cleaning software. However, when the third-party storage space cleaning tool cleans the data in the storage space, the data is cleaned based on the rules preset by the developer, and cleanable data displayed in the cleaning result is only suspected cleanable data, which is greatly different from the data actually required to be cleaned. Therefore, the user cannot effectively manage the data through the third-party storage space cleaning tool.
Disclosure of Invention
In view of this, the present application provides a data management method, an electronic device, and a computer readable and writable storage medium, which solve the problems in the prior art that the utilization rate of a storage space is not high, and data cannot be effectively managed only by performing classified storage based on file types of data, and improve the utilization rate of the storage space.
In a first aspect, the present application provides a data management method, which is applied to an electronic device supporting an application program to run. The electronic device may receive a data writing request sent by a first application program running on a foreground, and perform block processing on data to be written corresponding to the data writing request to obtain one or more data blocks included in the written data. Then, the data block identifier of each data block can be calculated, and each data block uniquely corresponds to one data block identifier. And then, acquiring an index table, judging whether the same data blocks as the one or more data blocks are stored in the electronic equipment or not based on the stored data blocks indicated in the index table and the data block identifications of the one or more data blocks, and performing storage management on the one or more data blocks according to the judgment result.
In summary, by using the method of the embodiment of the present application, the write data corresponding to the data write request sent by the first application program running on the foreground of the electronic device is blocked to obtain one or more data blocks with smaller length, so as to perform finer-grained processing on the write data. In addition, after calculating the data block identifier of each data block, it may be determined whether the stored data block indicated in the index table is the same as the data block to be stored, based on the data block identifier, so as to implement effective data storage management.
In a possible implementation manner of the first aspect, determining whether a data block identical to the one or more data blocks is already stored according to a data block identifier of the one or more data blocks and an index table, and performing storage management on the one or more data blocks based on a result of the determination includes: the one or more data blocks comprise a first data block, the data block identifier of the first data block is a first data block identifier, and when the index table comprises the first data block identifier, it indicates that the same data block as the first data block is stored, so that it can be determined that the first data block is not stored; the one or more data blocks include a second data block, the data block identifier of the second data block is a second data block identifier, and when the index table does not include the second data block identifier, it may be stated that the second data block is not stored, and it is determined that the second data block is saved.
That is to say, whether the same data block as one or more data blocks is stored in the electronic device can be judged through the index table, so that repeated content storage is reduced, and space utilization rate is improved.
In a possible implementation manner of the first aspect, when the index table includes the first data block identifier, a number of references corresponding to the first data block identifier in the index table may be increased by one, where the number of references may indicate a number of references of the first physical block address of a stored third data block, where the third data block is the same as the first data block and is a stored data block, and therefore the data block identifier of the third data block is the first data block identifier.
In this design, the number of times the stored data chunk is repeatedly referenced may be recorded by the number of references in the index table. Therefore, when the index table includes the first data block identifier, the number of references in the index table corresponding to the first data block identifier may be increased by one, which indicates that the first data block is referenced again, thereby avoiding repeated storage of the same data block.
In a possible implementation manner of the first aspect, when the index table includes the first data block identifier, a first mapping relationship between a first logical block address and a first physical block address of the first data block may be established in the mapping table. Wherein the first logical block address is used to describe the location of the first data block in the logical address space. The first physical block address is used to indicate an address at which the first data block is stored in the memory module.
In the design mode, when the index table includes the first data block identifier, the first mapping relation between the first logical block address and the first physical block address of the first data block is established in the mapping table, and the first mapping relation between the first logical block address and the first physical block address of the first data block in which writing occurs can be recorded, so that operations such as later maintenance or viewing are facilitated, and the stability of the storage function of the electronic device is ensured.
In a possible implementation manner of the first aspect, when the index table does not include the second data block identification, the second physical block address of the second data block may be determined. And then, establishing an index relationship between the second data block identifier and the second physical block address in the index table, and setting the reference frequency of the second physical block address as one in the index table.
In this design, the number of times the stored data chunk is repeatedly referenced may be recorded by the number of references in the index table. Therefore, when the index table does not include the second data block identifier, an index entry corresponding to the second data block may be newly created in the index table. And the newly-built index item comprises the index relationship between the second data block identifier and the second physical block address, so that when the data block to be written which is the same as the second data block needs to be written in the subsequent writing work, the stored data block to be written can be directly searched from the index table without storing again, and the repeated content is prevented from being stored. In addition, the number of times of reference of the second physical block address can be set to one in the index table, which indicates that the second data block is referred to first.
In a possible implementation manner of the first aspect, when the index table does not include the second data block identifier, a second mapping relationship between the second physical block address and the second logical block address of the second data block may be established in the mapping table. Wherein the second logical block address is used to describe the location of the second data block in the logical address space. The second physical block address is used for indicating an address of the second data block stored in the storage module.
In the design mode, when the index table includes the second data block identifier, the second mapping relationship between the second logical block address and the second physical block address of the second data block is established in the mapping table, and the second mapping relationship between the second logical block address and the second physical block address of the second data block in which writing occurs can be recorded, so that operations such as later maintenance or viewing are facilitated.
In a possible implementation manner of the first aspect, a plurality of applications may be installed in the electronic device, and the second physical block address is used to indicate a storage address in the first storage space corresponding to the first application. In order to ensure the normal operation of each application program, each application program in the electronic device has a corresponding storage space.
In the design mode, each application program corresponds to a storage space, and the normal operation of each application program in the electronic equipment can be ensured. Based on this, the write-in data generated by each application program can be written into the corresponding storage space, so that the data generated by the same foreground application program can be aggregated and stored, and the utilization rate of the storage space is further improved.
In a possible implementation manner of the first aspect, when it is determined that the data to be written corresponding to the data write request includes one or more data blocks, the data to be written corresponding to the data write request may be divided into one or more data blocks with the same length according to a preset method. That is to say, the data to be written is divided into one or more data blocks with the same length, and the written data can be converted into the data blocks with smaller length, so that finer-grained processing is realized, and the processing efficiency and the utilization rate of the storage space are improved.
In a second aspect, the present application provides an electronic device comprising a display screen, a memory, and one or more processors; a display screen, a memory and a processor; the display screen is for displaying images generated by the processor, and the memory is for storing computer program code, the computer program code comprising computer instructions.
Wherein the computer instructions, when executed by the processor, cause the electronic device to: receiving a data writing request sent by a first application program; the first application program runs in the foreground; determining one or more data blocks included in data to be written corresponding to the data writing request and data block identifiers of the one or more data blocks; acquiring an index table, wherein the index table is used for indicating stored data blocks; and judging whether the same data blocks as the one or more data blocks are stored or not according to the data block identifications of the one or more data blocks and the index table, and performing storage management on the one or more data blocks based on the judgment result.
In another possible design of the second aspect, the computer instructions, when executed by the processor, cause the electronic device to further perform the following: the one or more data blocks comprise a first data block, the data block identification of the first data block is a first data block identification, and when the index table comprises the first data block identification, the first data block is determined not to be saved; or the one or more data blocks include a second data block, the data block identifier of the second data block is a second data block identifier, and when the index table does not include the second data block identifier, the second data block is determined to be saved.
In another possible design of the second aspect, the computer instructions, when executed by the processor, cause the electronic device to further perform the following: and adding one to the number of references corresponding to the first data block identifier in the index table, wherein the number of references is used for indicating the number of references of the first physical block address of the stored third data block, and the data block identifier of the third data block is the first data block identifier.
In another possible design of the second aspect, the computer instructions, when executed by the processor, cause the electronic device to further perform the following: in the mapping table, a first mapping relation between a first logical block address and a first physical block address of a first data block is established.
In another possible design of the second aspect, the computer instructions, when executed by the processor, cause the electronic device to further perform the following: determining a second physical block address of the second data block; and establishing an index relation between the second data block identifier and the second physical block address in the index table, and setting the reference frequency of the second physical block address as one in the index table.
In another possible design of the second aspect, the computer instructions, when executed by the processor, cause the electronic device to further perform the following: and establishing a second mapping relation between the second physical block address and a second logical block address of the second data block in the mapping table.
In another possible design manner of the second aspect, the second physical block address is used to indicate a storage address in the first storage space corresponding to the first application, and the electronic device further includes the second application, and the second application corresponds to the second storage space.
In another possible design of the second aspect, the computer instructions, when executed by the processor, cause the electronic device to further perform the following: and according to a preset method, dividing the data to be written corresponding to the data writing request into one or more data blocks with the same length.
In a third aspect, the present application provides a computer readable and writable storage medium, comprising computer instructions, which, when run on an electronic device, cause the electronic device to perform the method of the first aspect and any one of its possible designs.
In a fourth aspect, the present application provides a computer program product for causing an electronic device to perform the method of the first aspect and any one of its possible design approaches described above when the computer program product is run on the electronic device.
In a fifth aspect, the present application provides an apparatus, which is included in an electronic device, and has a function of implementing the behavior of the electronic device in any one of the methods in the first aspect and possible implementation manners. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module or unit corresponding to the above functions. Such as a transmitting module or unit, and a receiving scanning module or unit, etc.
In a sixth aspect, an embodiment of the present application provides a chip system, where the chip system includes a processor and may further include a memory, and is configured to implement any one of the methods in the first aspect and any one of the possible design manners. The chip system may be formed by a chip, and may also include a chip and other discrete devices.
It is to be understood that the electronic device of the second aspect and any possible design thereof, the computer readable and writable storage medium of the third aspect, and the computer program product of the fourth aspect are all configured to perform the corresponding methods provided above, and therefore, the beneficial effects achieved by the electronic device can refer to the beneficial effects in the corresponding methods provided above, and are not described herein again.
Drawings
Fig. 1 is a schematic view of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure;
fig. 3 is a block diagram of a software structure of an electronic device according to an embodiment of the present disclosure;
fig. 4 is a block diagram illustrating a storage architecture of an electronic device according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a first display interface provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of a second display interface provided in the embodiments of the present application;
FIG. 7 is a schematic diagram of a third display interface provided in the embodiments of the present application;
fig. 8 is a block diagram of a memory structure of a memory module according to an embodiment of the present disclosure;
fig. 9 is a block diagram schematically illustrating a structure of an electronic device according to an embodiment of the present disclosure;
fig. 10 is a first flowchart illustrating a data management method according to an embodiment of the present application;
fig. 11 is a second flowchart illustrating a data management method according to an embodiment of the present application;
fig. 12 is a block diagram schematically illustrating a structure of an electronic device according to an embodiment of the present application.
Detailed Description
In the following, the terms "first", "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 technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present embodiment, "a plurality" means two or more unless otherwise specified.
In some scenarios, an electronic device (e.g., a smart phone, a tablet computer) or the like may generate an input/output (IO) repeat condition during the running of the APP. However, the electronic device generally cannot recognize the repeated write IO, and then the same content is repeatedly written into the storage space of the electronic device, which causes the performance degradation of the IO and wastes a large amount of storage space.
In some examples, an application program configured to clean the storage space of the electronic device, such as a third-party storage space tool, may be configured in the electronic device, and a user may clean a large amount of duplicate data stored in the storage space by using the third-party storage space tool. The third-party storage space cleaning tool generally filters and arranges the data in the storage space first, so that the user can perform data cleaning operation based on the filtering and arranging result of the third-party storage space cleaning tool.
However, when the third-party storage space cleaning tool is used for screening and cleaning data in the storage space, the data is screened and cleaned based on rules preset by a developer, and only suspected cleanable data determined based on the preset rules in cleanable data displayed in the screening and cleaning result is greatly different from data which needs to be cleaned actually. Moreover, a user may only delete part of the cleanable data according to the requirement of the user, but cannot determine whether the cleanable data is the repeated data. Then, after the user performs the data cleaning operation through the third-party storage space cleaning tool, the repeated data still exists in the storage space of the electronic device.
For example, if a certain type of data is specified as cleanable data in a rule preset by a developer of the third-party storage space cleaning tool. Then, the third-party storage space cleaning tool can classify all the data in the storage space belonging to the same type as the data to be cleaned, and the user can choose to clean some or all types of cleanable data.
In addition, a small portion of the data in a certain type of data determined by the electronic device may affect the normal operation of the related application or the use of the user after being cleaned. However, the user may not be able to obtain the situation, for example, the user deletes all data of a certain type to implement data cleaning, which results in poor controllability of data management of the electronic device.
Therefore, the data management method is provided, and the data are classified and stored in the data storage process, so that the data can be effectively managed. Meanwhile, based on the data management method provided by the application, the repeated data in the IO request can be effectively deleted, so that the utilization rate of the storage space is effectively improved.
The data management method provided by the embodiment of the application can be applied to the electronic device 100. For example, as shown in fig. 1, the electronic device 100 may specifically be a mobile phone 21, a tablet computer 22, a smart screen 23, a notebook computer 24, an in-vehicle device, a wearable device (such as a smart watch), an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), an artificial intelligence (artificial intelligence) device, and other terminal devices having a display function. The operating systems installed on the electronic device 100 comprise but are not limited to iOS, android, harmony, windows, linux or other operating systems. The application is not limited to the specific type of the electronic device 100 or the installed operating system.
Fig. 2 shows a hardware configuration diagram of the electronic device 100. 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 sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (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. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bidirectional synchronous serial bus including a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement a touch function of the electronic device 100.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. In other embodiments, the power management module 141 may be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), global Navigation Satellite System (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), general Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. GNSS may include Global Positioning System (GPS), global navigation satellite system (GLONASS), beidou satellite navigation system (BDS), quasi-zenith satellite system (QZSS), and/or Satellite Based Augmentation System (SBAS).
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an 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 alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement a photographing function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc. The ISP is used to process the data fed back by the camera 193. For example, when a user takes a picture, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, an optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and converting the electric signal into an image visible to the naked eye. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in the external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one hard disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
In some embodiments, the electronic device 100 receives a data write request sent by an application program during the running of the application program. In response to the data write request, the electronic device 100 sends the acquired write IO to the internal memory 121 for storage.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110. In some embodiments, audio module 170 includes, for example, speakers, headphones, a microphone headset interface, and the like.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
Wherein, the sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be brought into and out of contact with the electronic apparatus 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1.
The software system of the electronic device 100 may employ a hierarchical architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention uses an Android system with a hierarchical architecture as an example to exemplarily explain a software structure of the electronic device 100.
Fig. 3 is a block diagram of the software configuration of the electronic device 100 according to the embodiment of the present invention.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom.
The application layer may include a series of application packages.
As shown in fig. 3, the application package may include applications such as camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 3, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide communication functions of the electronic device 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
The Android runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application layer and the application framework layer as binary files. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), two-dimensional (2D) graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The kernel layer at least comprises a display driver, a camera driver, a storage driver, an audio driver and a sensor driver.
In some scenarios, the storage architecture of electronic device 100 may be used to implement data storage of an APP in an electronic device.
Alternatively, the storage architecture may be implemented hierarchically, as shown in FIG. 4, and generally includes a user layer, a storage drive, and a storage hardware layer. Wherein the user layer may correspond to the application layer as shown in fig. 3, and the storage driver is at the kernel layer as shown in fig. 3. The storage hardware layer may correspond to a hardware structure of the electronic device, such as the internal memory shown in fig. 2. In the process of running an APP in a user layer of an electronic device, an input/output (IO) request is generated for writing data or reading data. The storage driver may obtain and process the IO request, and then send a write data request or a read data request to the storage module in the storage hardware layer based on a processing result of the IO request, so that the storage module responds after receiving the write data request or the read data request, for example, performs an operation of writing data or reading data, thereby ensuring normal operation of the application program.
In some examples, as shown in fig. 4, a storage drive may include a file system, a block device (block) layer, and a drive (driver) layer. The file system is configured to convert an IO request initiated by an APP into a request for a Logical Block Address (LBA) in a storage module (e.g., a hard disk). The LBA is used to describe the block on which a data block resides on the memory module. The block layer is used for managing the IO requests, for example, performing operations such as temporary storage and merging on the IO requests, and determining a processing sequence of the IO requests. The driver layer is used for converting the IO request into an instruction recognizable by the storage module, for example, converting a read-write command for a logical block address in the IO request into an interface protocol corresponding to the storage module.
For example, as shown in fig. 4, an IO request generated by the APP running is received by a file system in the storage drive, the file system processes the IO request and then issues the IO request to the block layer and the driver layer, and then the IO request is sent to a storage module in the storage hardware layer after the IO request is processed by the block layer and the driver layer. And the storage module responds to the IO request to realize the writing or reading of data.
In some embodiments, the file system includes, for example, a flash friendly file system (F2 FS), a fourth generation extended file system (ext 4), and the like.
Illustratively, the system administrator classifies the data into different file types such as pictures, videos, audios, documents, compression packages, installation packages, applications, and the like, and performs classification management, as shown in fig. 5, the electronic device displays a first display interface, where the first display interface is a storage classification display interface after the system administrator classifies the data. It can be seen that only the user data stored in the electronic device can be indicated in the first presentation interface, and the storage spaces respectively occupied by the user data according to the categories divided by the file types, such as audio data, installation package data, document data, and the like, are specifically presented. After detecting the operation of clicking the cleaning acceleration control 51 by the user, the electronic device may display a second presentation interface as shown in fig. 6. As shown in fig. 6, the second display interface can be used to display the automatic cleaning result. And moreover, a result of the third-party storage space cleaning tool sorting the data can be displayed on the second display interface, for example, a file classification result sorted by the third-party storage space cleaning tool according to a rule preset by a developer can be displayed in the second display interface.
The junk file is junk data sorted by the third-party storage space cleaning tool based on rules set by a developer, and due to the fact that the judgment standards of the junk data and actual junk data in the rules set by the developer in advance are not uniform, the electronic equipment can execute the operation of cleaning the junk data after detecting that a user clicks the immediate cleaning control 61 in the second display interface. Since the garbage data is sorted according to the rule preset by the developer, and the preset rule has a certain limitation, the actual garbage data may still exist in the electronic device, or the actually cleaned garbage data may include necessary data that affects the operation of the application program.
In addition, after detecting that the user clicks the clear control 62 corresponding to the application data in the second display interface, the electronic device may display a third display interface as shown in fig. 7. As shown in fig. 7, the third presentation interface can be used to display the sub-classifications of the spam data under the application data classification. After detecting that the user operates the deletion control 71 in the third display interface, the electronic device processes the operation according to the specific data under each sub-classification in the application data selected by the user. Wherein, the delete control 71 can display the data amount of the junk data detected by the electronic device.
In some embodiments, multiple applications are configured in the electronic device, wherein each application generates multiple IO content storage requirements. The IO content repetition rate between different applications is low, for example, may be generally less than 1%. However, the IO content repetition rate generated within one application is high. For example, as shown in table 1 below, the IO content repetition rate within each application may be between 20% and 40%. Then, the same IO content may be stored repeatedly in a storage module (e.g., a hard disk, etc.), resulting in a waste of storage space. In addition, by using the data management method of the scene examples shown in fig. 5 to 7, the controllability of the process of managing the storage space of the storage module is poor, which affects the use of the user.
TABLE 1
Figure SMS_1
Therefore, the application provides a data management method, which manages the write IO process to reduce the storage of repeated data in the storage space of the electronic device. In some examples, after obtaining the IO request generated by the foreground application, the electronic device blocks the IO request generated by the foreground application to obtain a plurality of data blocks. The foreground application program is an application program running in the foreground. The electronic equipment respectively calculates the data block identification of each data block based on the obtained data blocks, and then performs storage management on the data blocks based on the data block identification of each data block, so that the data blocks with the same content are prevented from being written into the storage module, and the space utilization rate of the storage module is improved.
In addition, when the electronic equipment writes the data block into the storage module, the data block can be written into a target storage space in the storage module, and the target storage space corresponds to the foreground application program, so that the data storage is classified based on the application program, and the storage in the storage module is effectively managed.
The data management method provided by the present application is described in detail as follows.
In some embodiments, the electronic device may partition the memory space in the memory module by application, with different applications corresponding to different memory spaces.
Illustratively, as shown in fig. 8, the electronic device is installed with an application a, an application B, and an application C. In a memory module of an electronic device, a memory space 1 for storing application a data, a memory space 2 for storing application B data, and a memory space 3 for storing application C data are partitioned, respectively.
Therefore, the electronic equipment can aggregate and store the data of the same application by taking the storage space as a unit, so that the storage data of different applications can be managed independently, and the repetition rate of the storage data in the storage space is reduced.
In some embodiments, the electronic device determines the foreground application in response to a user operation. During the operation of the foreground application, a write IO request is generated for writing data required for the operation of the application in the storage module.
The foreground application program is an application corresponding to an interface currently displayed on a display screen of the electronic device.
It should be noted that the picture content of the foreground application may include not only a picture seen by the user, but also a content without a user interface, a content in a transparent layer, or a content invisible to the user and hidden by other application interfaces, and the running of these picture contents may all generate corresponding write IO requests.
In some examples, the user operation includes, for example, an operation in which the user instructs to start an application, such as an operation on an application icon, an operation of a voice control application, an operation of switching a background application to the foreground, and the like.
Illustratively, the foreground application generates an IO request in response to a user operation on the foreground application. For example, in the process of displaying a product search result display interface of a shopping application, the electronic device detects that a user clicks a detailed information viewing link corresponding to one of the products, the shopping application generates a corresponding data writing request, and the electronic device can acquire the data writing request.
In some embodiments, the electronic device determines a data write request sent by an application program, and blocks (chunks) data to be written carried by the data write request, where each data block may correspond to one IO request. For example, data to be written is divided into a plurality of data blocks in units of 4KB so that the data to be written is written in the form of data blocks in corresponding disc blocks in the disc.
Note that the size of the data block is the same as the size of the disk block. The size of a disk block is generally 4KB, and in order to ensure that each data block can be directly written into one disk block, when data to be written is partitioned, the data to be written can be partitioned into a plurality of data blocks by taking 4KB as a unit.
Optionally, the method for data blocking may refer to the prior art, for example, data blocking may be performed through a block () function, which is not described herein again. It should be understood that the electronic device may also block the data to be written in other data block units.
In some examples, the electronic device determines the identifier of the divided data block according to a preset manner, so that a subsequent electronic device can distinguish different data blocks through different identifiers to determine whether to store data repeatedly.
Optionally, the preset manner includes, for example, that the electronic device calculates a hash value or a hash value of each data block through a hash algorithm, and uses a calculation result as an identifier of the data block. Where each data block has a unique corresponding identifier, then the identifier can be used as a Fingerprint (FP) for the data block.
For example, the electronic device determines the FP of the data block through an algorithm such as a message-digest algorithm (md 5) or a Secure Hash Algorithm (SHA). The secure hash algorithm may comprise, for example, the SHA-1 algorithm.
For example, as shown in fig. 9, the electronic device may monitor the data write request of application a when determining that application a switches to foreground operation (step (1)). Then, in response to the received data write request, the deduplication control module in the block layer of the electronic device may perform blocking on the data to be written according to a preset manner, and determine fingerprints of different data blocks (as in step (2)).
In some embodiments, after the electronic device divides the storage space corresponding to the application program, an index table corresponding to the current storage space may be created, where the index table is used to record an identifier of a data block already stored in the storage space and a Physical Block Address (PBA) corresponding to the data block, and the PBA of the data block represents a corresponding position of the data block in the physical address space.
It should be noted that the physical block address is used to indicate the location of the data block stored in the storage module, i.e. the location of the data block on the external memory, and the logical block address is used to describe the location of a data block in the logical address space.
Illustratively, the index table corresponding to the storage space 1 of the application a is shown in table 2 below. The application a stores a data block 1, a data block 2, and a data block 3. The fingerprint of the data block 1 is FP1, and the stored physical block address is PBA1; the fingerprint of the data block 2 is FP2, and the stored physical block address is PBA2; the fingerprint of the data block 3 is FP3 and the stored physical block address is PBA3.
TABLE 2
Figure SMS_2
In some examples, as shown in fig. 9, after the electronic device determines that the application a switches to the foreground operation, the index management module in the block layer may obtain the index table of the application a (as in step (3)). After the data block division is completed, the deduplication control module may obtain the index table of the application a sent by the index management module. The deduplication control module may determine whether the fingerprint of the data block to be written is the same as the fingerprint already stored in the index table of the application a by searching the index table of the application a. If the data blocks are the same, the corresponding data blocks are determined to be stored in the storage module, and repeated storage is not needed; if the data blocks are not the same, it can be determined that the corresponding data blocks are not stored, and the storage area in the corresponding storage space needs to be divided for storing the data blocks corresponding to the fingerprint.
In this way, the electronic device realizes aggregation management of the stored data in units of the application by looking up the index table corresponding to the application. Meanwhile, in the process of realizing data storage, repeated data blocks are quickly checked for duplication, and repeated storage is avoided. Compared with the method for directly searching whether repeated data blocks exist in the storage module, the method has smaller workload, and therefore, the efficiency can be improved by searching the repeated data blocks through the index table.
In some examples, as shown in fig. 9, the deduplication control module may determine whether the fingerprint of the data block to be written is the same as the fingerprint already stored in the index table of application a by looking up the index table of application a. If the data blocks are the same, determining that the corresponding data blocks are stored in the storage module, and not needing to store repeatedly; if the data blocks are not the same, a data block storage indication can be sent to the data management module, and the data block storage indication can carry the data block to be written.
Accordingly, the data management module allocates a storage area for the data block in the storage space corresponding to the application a, and writes the data block to be written in the storage area (as in step (4)).
In some examples, as shown in table 2 above, the index table further includes a reference number entry, where the reference number is used to indicate the reference number of the data block corresponding to the same physical block address.
For example, as shown in fig. 9, the deduplication control module in the electronic device determines that the fingerprint of the current data block is duplicated according to the index table of application a (as in table 2 above), and may delete the data block, i.e., it is not necessary to rewrite the data block in the storage module. Moreover, the deduplication control module may determine a physical block address corresponding to a repeated fingerprint directly based on the index table, and add 1 to the fingerprint and the reference number corresponding to the physical block address in table 2 above to indicate that the data block corresponding to the physical block address is referred again, thereby avoiding repeated storage of the same data block.
For another example, as shown in fig. 9, the deduplication control module in the electronic device determines that the fingerprint of the current data chunk is not duplicated according to the index table of application a (as in table 2 above). Then, the deduplication control module may update the index table of application a, fill in the new fingerprint and the corresponding physical block address, and determine that the corresponding number of references is 1.
In some embodiments, during the data storage process, the electronic device allocates a physical block address (LBA) and a Logical Block Address (LBA) to the data blocks. The logical block address is used to describe a block where a data block is located on the storage module, and the physical block address represents a physical address of the data block in the storage module. Each data block is configured with a unique LBA. Also, as described above, since data blocks for the same fingerprint are deleted, resulting in the same physical block address being referenced multiple times, different data blocks may correspond to the same PBA, i.e., the corresponding relationship of LBA to PBA is n (n > = 1) to 1. And the reference times represent the times of using the data block in the kernel layer.
For example, as shown in the mapping table shown in table 3 below, the electronic device may determine a mapping relationship between a Logical Block Address (LBA) and a Physical Block Address (PBA) of the data block through the mapping table.
TABLE 3
Figure SMS_3
In some embodiments, the electronic device detects an operation of the user indicating to close the application a or an operation of the user indicating to start the application B, and may determine that the application a is closed or switched to the background running. Accordingly, as shown in fig. 9, the index management module may restore the index table and the mapping table corresponding to the application a to the storage space 1 corresponding to the application a in the storage module.
In addition, if the electronic device determines that the application B is switched to the foreground operation. The electronic device may then start monitoring data write requests generated by application B during operation. Accordingly, as shown in fig. 9, in response to a data write request of the application B, the deduplication control module may obtain an index table and a mapping table corresponding to the application B from the storage space 2 corresponding to the application B in the storage module, so as to determine whether to write the data block.
The following describes in detail the process of providing a data management method according to an embodiment of the present application. Exemplarily, fig. 10 is a schematic flowchart of a data management method provided in an embodiment of the present application. As shown in fig. 10, the method includes the following steps.
S1001, the deduplication control module receives a data writing request sent by the application A.
The data writing request is used for writing corresponding data in the storage module, and the data is used for supporting the running of the application A.
Illustratively, the electronic device displays a first display interface of the application a, where a plurality of pictures are displayed in the first display interface, and each picture corresponds to one link. The electronic equipment detects the operation that a user clicks the picture 1 in the first display interface, and determines that the user indicates to open the link corresponding to the picture 1. Then, the electronic device may display a second presentation interface through the link corresponding to the picture 1. In the interface jump process, the application A generates a data write-in request, and correspondingly, the deduplication control module can acquire the data write-in request. The data writing request is used for storing operation data in the storage module, and the operation data can be used for supporting the electronic equipment to display a second display interface.
S1002, the deduplication control module divides the data into blocks and generates data block identifiers.
In some embodiments, the deduplication control module, in response to the received data write request, chunks data corresponding to the data write request based on the size of the disk chunks to obtain one or more data chunks. Then, the deduplication control module may determine the identifier of the one or more data blocks according to a preset manner, so as to distinguish different data blocks.
S1003, the deduplication control module sends an index table acquisition request to the index management module.
In some embodiments, the deduplication control module sends an index table acquisition request to the index management module in response to the received data write request. The index table may carry an identifier of an application (i.e., a foreground application) to which data is to be written in the request, so that the index management module may distinguish between storage spaces corresponding to different applications.
Correspondingly, the index management module receives an index table acquisition request sent by the deduplication control module.
S1004, the index management module sends an index table acquisition response to the deduplication controller.
In some embodiments, in response to a received data write request, the index management module obtains an application identifier carried in the request according to the index table, and determines a storage space of an application corresponding to the application identifier. Then, the index management module may obtain the corresponding index table from the determined storage space. Then, the index management module may send an index table acquisition response to the deduplication control module, and the index table acquisition response carries the determined index table.
Correspondingly, the deduplication control module may receive an index table acquisition response sent by the index management module.
For example, as shown in fig. 10, the index management module receives an index table acquisition request sent by the deduplication control module, and acquires an identifier of the application a carried in the index table acquisition request. Then, the index management module may determine, according to the identifier, the storage space 1 corresponding to the application a, and obtain the index table of the application a stored in the storage space 1. After that, the index management module may send the index table of the application a to the deduplication control module.
S1005, the deduplication control module determines whether the corresponding data block is already stored according to the data block identifier and the index table. If yes, executing step S1006-step S1007; if not, step S1008-step S1011 are executed.
In some embodiments, after the deduplication control module performs data blocking on the data write request sent by the application a, a plurality of data blocks including the data block a may be obtained. In the process of writing the data block A into the storage module, the deduplication control module calculates the fingerprint of the data block A as FP1, and then determines whether the data block is required to be stored or not through an index table which is sent by the index management module and corresponds to the application A.
As a possible case, if the deduplication control module determines that the target index entry including FP1 exists in the index table corresponding to application a, it indicates that application a has written the data block a in the storage module in the previous running process. Therefore, the data block a is not written into the storage module again, and the index table and the mapping table of the application a are updated only based on the data block a, so that waste of storage space caused by repeatedly writing the data block a into the storage module is avoided. That is, the following steps S1006 and S1007 are performed.
As another possible scenario, if the deduplication control module determines that the target index entry including FP1 does not exist in the index table corresponding to application a, it indicates that application a has not written the data block a in the storage module in the previous running process. At this time, the deduplication control module may allocate a corresponding physical block address and a logical block address to the data block a, and update the index table and the mapping table of the application a based on the data block a. That is, the following steps S1008 to S1011 are performed.
The following are steps S1006 to S1007:
s1006, the deduplication control module sends an index table updating indication to the index management module.
The index table updating indication is used for indicating the index management module to update the index table and the mapping table.
In some embodiments, the index table update indication may carry at least one of an application identification, a data chunk identification, an index table identification, and a mapping table identification.
S1007, the index management module updates the index table and the mapping table.
In some embodiments, after receiving the index table update indication, the index management module may determine the identifier carried therein, thereby determining the index table and the mapping table to be updated, and the content that needs to be updated.
Exemplarily, in the above step S1005, the deduplication control module may determine that the table 2 needs to be updated after determining that the corresponding data block has been stored according to the data block identification FP1 and the index table as shown in the above table 2. Then in step S1006 above, the deduplication control module may send an index table update indication to the index management module for indicating that the index table is updated. Accordingly, in step S1007, the index management module adds 1 to the reference count corresponding to the data block identity FP1 in response to the received index table update indication, so as to obtain a new index table as shown in table 4 below.
TABLE 4
Figure SMS_4
In addition, the index management module may also establish a mapping relationship between the logical block address corresponding to the data block and an existing physical block address in response to the received index table update indication, that is, update the mapping table corresponding to application a. For example, as shown in table 5 below, the index table management module adds a new mapping entry in the mapping table shown in table 3 above, where the mapping entry is used to indicate a mapping relationship between a logical block address LBA4 and a physical block address PBA1 corresponding to a data block.
TABLE 5
Figure SMS_5
With continued reference to fig. 10, in the case that the deduplication control module determines that the corresponding data block is not stored in the storage module according to the data block identifier and the index table, the following steps S1008 to S1011 may be performed:
s1008, the deduplication control module sends a data block storage instruction to the data block management module.
Wherein the data block storage indication is used for indicating the storage of the data block.
In some examples, the data block storage indication carries an application identifier corresponding to the data block to be written, where the application identifier of the application a is used to confirm the storage space corresponding to the application a.
In some embodiments, the deduplication control module determines that the data block to be written is a new data block, and the storage module temporarily does not store the same data block as the new data block. Then, the deduplication control module may determine that the data chunk needs to be stored, and send a data chunk storage indication to the data management module, where the data chunk storage indication may carry the data chunk to be written.
Correspondingly, the data block management module receives the data block storage indication sent by the deduplication control module.
S1009, the data block management module allocates a storage area for the data block in the storage space corresponding to the application A.
The storage module in the electronic device is a hardware structure for providing a storage space, and therefore, a plurality of storage modules may exist in the electronic device. When the data management module of the electronic device manages the storage module, disk blocks distributed at different positions in the storage module can be regarded as a continuous storage space. That is, the data management module stores a plurality of consecutive data blocks, and a plurality of consecutive databases may be allocated with consecutive storage spaces in the storage space corresponding to the application a, but these consecutive storage spaces are not necessarily consecutive disk blocks in the storage module.
The data management module may allocate a storage area for the data block to be written in the determined storage space, and write the data block to be written in the allocated storage area.
Illustratively, as shown in fig. 9, in response to the received data storage indication, the data management module allocates a storage area for the data block to be written in the storage space 1 corresponding to the application a, and writes the data block to be written in the storage area.
S1010, the data block management module sends an index table updating instruction to the index management module.
The updating indication is used for indicating the index management module to update the index table and the mapping table.
In some embodiments, after allocating a storage area for storing a data block, the data block management module may determine a physical block address corresponding to the storage area. And, the data block management module may determine information such as logical block addresses, identifications, etc. of the data blocks. Then, the data block management module may send an update indication to the index management module, and the update indication carries information such as a data block identifier, a logical block address corresponding to the data block, a physical block address corresponding to the data block, an index table identifier, a mapping table identifier, and an application a identifier.
Correspondingly, the index management module receives the update indication sent by the data block management module.
S1011, the index management module updates the index table and the mapping table.
In some embodiments, after receiving the update indication, the index management module may update the corresponding index table and mapping table according to the information, such as the data block identifier, the logical block address corresponding to the data block, the physical block address corresponding to the data block, the index table identifier, the mapping table identifier, and the application a identifier, carried in the update indication.
For example, the index management module adds a new index entry in the index table and adds a new mapping entry in the mapping table. The new index entry comprises a data block identifier and a physical block address, and the new mapping entry comprises a logical block address and a physical block address corresponding to the data block.
For example, in step S1005, the deduplication control module determines that the data block identifier FP4 does not exist in the index table shown in table 4 according to the data block identifier FP4 and the index table shown in table 4, that is, it may be determined that the corresponding data block is not stored. Then, in step S1008, the deduplication control module may send a data chunk storage indication to the data chunk management module. Accordingly, the data block management module may send an update indication to the index management module after completing the storage of the data block (i.e., step S1009 and step S1010). Then, the index management module updates table 4 based on the update indication, and adds a new index entry in table 4, where the index entry includes the data block identifier FP4, the physical block address PBA4 allocated to the data block, and the number of times of reference used to indicate that the physical block address is circularly referred to, so as to obtain a new index table as shown in table 6 below.
TABLE 6
Figure SMS_6
In addition, the index management module updates the table 5 based on the update indication, and adds a new mapping entry to the table 5, where the mapping entry includes the logical block address LBA5 and the physical block address PBA4 corresponding to the data block, so as to obtain a new mapping table shown in table 7 below.
TABLE 7
Figure SMS_7
Therefore, after the electronic equipment performs block processing on the IO request generated by the foreground application program, the obtained data block can be deleted again by using the data block identifier, and the waste of storage space is avoided.
In addition, the electronic equipment can effectively manage the data blocks through maintaining the index table and the mapping table corresponding to the foreground application program, aggregate and store the data generated by the same foreground application program, and improve the utilization rate of the storage space.
Exemplarily, fig. 11 is a schematic flowchart of another data management method provided in the embodiment of the present application. As shown in fig. 11, the method includes the following steps.
S1101: the electronic equipment receives a data writing request sent by a first application program.
Wherein, the first application program runs in the foreground, namely, the first application program foreground application program is represented.
In some examples, the first application program is an application corresponding to an interface currently displayed by a display screen of the electronic device. For example, if the currently displayed interface of the display screen of the electronic device is a login interface in the application a, the application a is the first application program.
It should be noted that the picture content of the first application program may include not only a picture seen by the user, but also a content without a user interface, a content in a transparent layer, or a content invisible to the user and hidden by other application interfaces, and the operation of these picture contents may all generate corresponding write IO requests.
S1102: the electronic equipment determines one or more data blocks included in the data to be written corresponding to the data writing request and data block identifications of the one or more data blocks.
As shown in fig. 10, the electronic device may utilize the deduplication control module to chunk data and generate a data chunk identifier.
For example, the deduplication control module may receive a data write request, and then block data corresponding to the data write request based on a size of a disk block to obtain one or more data blocks. Then, the deduplication control module may determine the identifier of the one or more data blocks according to a preset manner, so as to distinguish different data blocks.
It should be noted that the hash value or hash value of each data block may be calculated by a hash algorithm, and the calculation result is used as the identifier of the data block. Where each data block has a unique corresponding identifier, then the identifier may be used as a fingerprint for the data block.
S1103: the electronic equipment acquires an index table, and the index table is used for indicating the stored data blocks.
In some examples, the index table corresponds to the first application, and each application may have an index table corresponding thereto.
In some examples, the index table is stored in a storage module of the electronic device, and when an application program corresponding to the index table runs in a foreground, the electronic device may read the index table stored in the storage module into a memory of the electronic device, thereby ensuring a processing speed of the electronic device.
Illustratively, a plurality of application programs, such as application a, application B, and application C, are installed in the electronic device. If the foreground application program is the application A, the index table corresponding to the application A is read from the storage module to the memory by the electronic equipment. Then, if the electronic device detects that the user performs a closing operation on the application a and performs an opening operation on the application C. The electronic device may cause application C to run in the foreground of the electronic device. Accordingly, the electronic device may restore the index table of the application a from the memory to the storage module, and read the index table of the application C from the storage module to the memory.
S1104: the electronic equipment judges whether the same data blocks as the one or more data blocks are stored or not according to the data block identifications of the one or more data blocks and the index table, and performs storage management on the one or more data blocks based on the judgment result.
In some embodiments, the one or more data blocks include a first data block, the data block identification of the first data block is a first data block identification, and the electronic device may determine not to save the first data block when the index table includes the first data block identification.
Alternatively, the one or more data blocks include a second data block, the data block identification of the second data block being a second data block identification, and the electronic device may determine to save the second data block when the index table does not include the second data block identification.
For example, the electronic device includes a data block a and a data block B in one or more data blocks determined based on data to be written corresponding to the data writing request. If the index table includes the data block identifier a of the data block a, it indicates that the same data block as the data block a has been stored in the electronic device, and therefore, the electronic device may determine not to store the data block a; if the index table does not include the data block identifier B of the data block B, it indicates that the same data block is not stored in the electronic device, and therefore, the electronic device may determine to store the data block B.
The index table comprises stored data block identifications and reference times items, and the times are used for indicating the reference times of the data blocks corresponding to the same physical block address.
Optionally, when it is determined that the index table includes the first data block identifier, the electronic device may add, by one, the number of references corresponding to the first data block identifier in the index table, where the number of references is used to indicate the number of references of the first physical block address of the stored third data block, where the data block identifier of the third data block is the first data block identifier, and the first physical block address is used to indicate a storage address of the third data block.
Based on the above scheme, the electronic device may further establish a first mapping relationship between the first logical block address and the first physical block address of the first data block in the mapping table.
Alternatively, when it is determined that the index table includes the second data block identifier, the second physical block address of the second data block may be determined first, so that the second data block is written into the storage module based on the second physical block address. And then, establishing an index relationship between the second data block identifier and the second physical block address in the index table, and setting the reference frequency of the second physical block address as one in the index table.
Based on the above scheme, the electronic device may further establish a second mapping relationship between the second physical block address and the second logical block address of the second data block in the mapping table.
It should be noted that the second physical block address is used to indicate a storage address in the first storage space corresponding to the first application program, and the electronic device further includes a second application program, where the second application program corresponds to the second storage space.
As a possible situation, when determining one or more data blocks included in the data to be written corresponding to the data write request, the method may divide the data to be written corresponding to the data write request into one or more data blocks with the same length according to a preset method.
Therefore, after the data writing request sent by the first application program is subjected to blocking processing, the electronic equipment can utilize the data block identifier to perform storage management on the obtained data block, and waste of storage space is avoided.
In addition, the electronic equipment can effectively manage the data blocks through maintaining the index table and the mapping table corresponding to the first application program, aggregate and store data generated by the same foreground application program, and improve the utilization rate of the storage space.
The data management method provided in the embodiment of the present application is described in detail above with reference to fig. 8 to fig. 11. The electronic device provided by the embodiment of the application is described in detail below with reference to fig. 12.
In a possible design, fig. 12 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. As shown in fig. 12, the electronic device 1200 may include: a processing unit 1201 and a transmitting/receiving unit 1202. The electronic device 1200 may be used to implement the functionality of the electronic device involved in the method embodiments described above.
Optionally, the processing unit 1201 is configured to support the electronic apparatus 1200 to execute S1002, S1005, S1007, S1009, and S1011 in fig. 10, and further configured to support the electronic apparatus 1200 to execute S1102 and S1104 in fig. 11.
Optionally, the transceiver unit 1202 is configured to support the electronic device 1200 to execute S1001, S1003, S1004, S1006, S1008, and S1010 in fig. 10, and further support the electronic device 1200 to execute S1101 and S1103 in fig. 11.
The transceiver unit 1202 may include a receiving unit and a transmitting unit, may be implemented by a transceiver or a transceiver-related circuit component, and may be a transceiver or a transceiver module. In order to implement the corresponding process of the data management method in the foregoing method embodiment, all relevant contents of each step related to the foregoing method embodiment may be referred to as a functional description of the corresponding functional unit, and for brevity, no further description is provided herein.
Optionally, the electronic device 1200 shown in fig. 12 may further include a storage unit (not shown in fig. 12) in which programs or instructions are stored. The processing unit 1201 and the transceiving unit 1202, when executing the program or the instructions, enable the electronic device 1200 shown in fig. 12 to perform the data management method in the above-described method embodiment.
Technical effects of the electronic device 1200 shown in fig. 12 can refer to technical effects of the data management method in the foregoing method embodiment, and are not described herein again.
Besides the form of the electronic device 1200, the technical solution provided in the present application may also be a functional unit or chip in the electronic device, or a device used in cooperation with the electronic device.
Embodiments of the present application further provide a computer-readable and writable storage medium, where the computer-readable and writable storage medium includes computer instructions, and when the computer instructions are executed on the electronic device, the electronic device is caused to perform the functions or steps in the foregoing method embodiments.
Embodiments of the present application further provide a computer program product, which includes a computer program and when the computer program runs on an electronic device, causes the electronic device to perform each function or step in the foregoing method embodiments.
Through the description of the above embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable and writable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a readable and writable storage medium, and includes several instructions to enable a device (which may be a single chip microcomputer, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. The readable and writable storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A data management method is applied to an electronic device, and the method comprises the following steps:
receiving a data writing request sent by a first application program; the first application program runs in the foreground;
determining one or more data blocks included in the data to be written corresponding to the data writing request and data block identifiers of the one or more data blocks;
acquiring an index table, wherein the index table is used for indicating stored data blocks;
and judging whether the data blocks which are the same as the one or more data blocks are stored or not according to the data block identifications of the one or more data blocks and the index table, and performing storage management on the one or more data blocks based on the judgment result.
2. The method according to claim 1, wherein the determining whether a data block identical to the one or more data blocks is already stored according to the data block identifier of the one or more data blocks and the index table, and performing storage management on the one or more data blocks based on a result of the determining comprises:
the one or more data blocks comprise a first data block, the data block identifier of the first data block is a first data block identifier, and when the index table comprises the first data block identifier, the first data block is determined not to be saved;
alternatively, the first and second electrodes may be,
the one or more data blocks include a second data block, a data block identifier of the second data block is a second data block identifier, and when the index table does not include the second data block identifier, the second data block is determined to be saved.
3. The method of claim 2, further comprising:
and adding one to the number of references corresponding to the first data block identifier in the index table, wherein the number of references is used for indicating the number of references of the first physical block address of the stored third data block, and the data block identifier of the third data block is the first data block identifier.
4. The method of claim 3, further comprising:
and establishing a first mapping relation between a first logical block address and a first physical block address of the first data block in a mapping table.
5. The method of claim 2, further comprising:
determining a second physical block address of the second data block;
and establishing an index relation between the second data block identifier and the second physical block address in the index table, and setting the reference times of the second physical block address as one in the index table.
6. The method of claim 5, further comprising:
and establishing a second mapping relation between the second physical block address and a second logical block address of the second data block in a mapping table.
7. The method according to claim 5 or 6, wherein the second physical block address is used for indicating a storage address in the first storage space corresponding to the first application program, and the electronic device further comprises a second application program, and the second application program corresponds to the second storage space.
8. The method according to claim 1, wherein the determining one or more data blocks included in the data to be written corresponding to the data write request comprises:
and dividing the data to be written corresponding to the data writing request into one or more data blocks with the same length according to a preset method.
9. An electronic device, comprising a display screen, a memory, and one or more processors; the display screen, the memory and the processor are coupled; the display screen is for displaying images generated by the processor, the memory is for storing computer program code, the computer program code comprising computer instructions; the computer instructions, when executed by the processor, cause the electronic device to perform the method of any of claims 1-8.
10. A computer readable and writable storage medium comprising computer instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1-8.
CN202310120198.6A 2023-02-16 2023-02-16 Data management method, electronic device and computer readable and writable storage medium Pending CN115981573A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310120198.6A CN115981573A (en) 2023-02-16 2023-02-16 Data management method, electronic device and computer readable and writable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310120198.6A CN115981573A (en) 2023-02-16 2023-02-16 Data management method, electronic device and computer readable and writable storage medium

Publications (1)

Publication Number Publication Date
CN115981573A true CN115981573A (en) 2023-04-18

Family

ID=85968206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310120198.6A Pending CN115981573A (en) 2023-02-16 2023-02-16 Data management method, electronic device and computer readable and writable storage medium

Country Status (1)

Country Link
CN (1) CN115981573A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942292A (en) * 2014-04-11 2014-07-23 华为技术有限公司 Virtual machine mirror image document processing method, device and system
CN107092439A (en) * 2017-03-07 2017-08-25 华为技术有限公司 A kind of method and apparatus of data storage
CN109918018A (en) * 2017-12-13 2019-06-21 华为技术有限公司 A kind of date storage method and storage equipment
CN114185494A (en) * 2022-02-16 2022-03-15 荣耀终端有限公司 Memory anonymous page processing method, electronic device and readable storage medium
CN115328403A (en) * 2022-08-19 2022-11-11 济南浪潮数据技术有限公司 Data deduplication method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942292A (en) * 2014-04-11 2014-07-23 华为技术有限公司 Virtual machine mirror image document processing method, device and system
CN107092439A (en) * 2017-03-07 2017-08-25 华为技术有限公司 A kind of method and apparatus of data storage
CN109918018A (en) * 2017-12-13 2019-06-21 华为技术有限公司 A kind of date storage method and storage equipment
CN114185494A (en) * 2022-02-16 2022-03-15 荣耀终端有限公司 Memory anonymous page processing method, electronic device and readable storage medium
CN115328403A (en) * 2022-08-19 2022-11-11 济南浪潮数据技术有限公司 Data deduplication method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112783564B (en) Method for accelerating starting of application program and electronic equipment
CN113254409B (en) File sharing method, system and related equipment
CN116244067B (en) Virtual memory management method and electronic equipment
CN113805797B (en) Processing method of network resource, electronic equipment and computer readable storage medium
CN113791850B (en) Information display method and electronic equipment
WO2021185352A1 (en) Version upgrade method and related apparatus
CN116700601B (en) Memory optimization method, equipment and storage medium
CN114077529B (en) Log uploading method and device, electronic equipment and computer readable storage medium
CN112835610A (en) Method and device for constructing application program resource package and terminal equipment
CN113485969B (en) Storage fragmentation method and device, terminal and computer storage medium
CN112783418B (en) Method for storing application program data and mobile terminal
CN115981573A (en) Data management method, electronic device and computer readable and writable storage medium
CN114489471A (en) Input and output processing method and electronic equipment
CN114489469A (en) Data reading method, electronic equipment and storage medium
CN113642010A (en) Method for acquiring data of extended storage device and mobile terminal
CN117009023B (en) Method for displaying notification information and related device
CN116089320B (en) Garbage recycling method and related device
CN116089368B (en) File searching method and related device
CN117992092A (en) Method for upgrading equipment and related equipment
CN117784990A (en) Method and related device for displaying icons of application programs in task bar
CN117666937A (en) Storage method and device and electronic equipment
CN117675881A (en) Application data storage method and electronic equipment
CN116069224A (en) Input control method and electronic equipment
CN115146303A (en) Private file protection method and device, terminal equipment and readable storage medium
CN117527822A (en) Data synchronization method, electronic equipment and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination