Data processing method and related equipment thereof

By pruning non-mounted nodes that are not currently accessing devices when the metadata cache data reaches the threshold, the problem of excessive memory occupancy of the device by metadata cache is solved, improving the metadata reading efficiency and performance, and reducing memory occupancy.

CN120276658AActive Publication Date: 2025-07-08HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202311865465.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-07-08
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

In existing distributed file systems, metadata cache data occupies too much memory space in the device, resulting in low reading efficiency and long time to access metadata across devices.

Method used

When the metadata cache data reaches the threshold, the non-mounted nodes that are not currently accessed devices are pruned according to the device, and the metadata cache data is managed using the B-tree structure, and the non-mounted nodes that are not currently accessed devices are cut off to save memory space.

Benefits of technology

Effectively control the amount of metadata cached data in device memory, improve cross-device metadata reading efficiency and performance, reduce cross-device communication, and save memory space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276658A_ABST
    Figure CN120276658A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and related equipment thereof, relates to the technical field of terminals, and is applied to first electronic equipment, and the method comprises the following steps: in response to a first operation, when metadata cache data meets a first preset threshold condition, pruning according to equipment, and cutting off non-mounting nodes of non-current access equipment; the metadata cache data are cache objects corresponding to metadata lists in the plurality of second electronic devices in the first electronic device. According to the method and the device, the metadata cache data is reasonably pruned, so that the occupation of the memory space in the first electronic equipment can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technologies, and particularly to a data processing method and related devices thereof. Background Art

[0002] With the booming development of network communication technologies, the Internet of Everything has entered people's lives. The basis of the Internet of Everything is that data between different devices can be accessed mutually, and the distributed file system is exactly a technology that provides data consistency among different devices.

[0003] Existing distributed file systems usually include a metadata processor and a data processor. When a user accesses file data, it is necessary to first access the metadata processor across devices to obtain the basic information and data index information of the file, and then access the data processor to obtain the file data. Summary of the Invention

[0004] This application provides a data processing method and related devices thereof. By reasonably pruning the metadata cached data, the occupation of the memory space in the first electronic device can be saved.

[0005] In a first aspect, a data processing method is provided. The method is applied to a first electronic device and includes: in response to a first operation, when the metadata cached data meets a first preset threshold condition, pruning by device and removing non-mounted nodes of non-currently accessed devices; the metadata cached data is a cached object corresponding to a metadata list in multiple second electronic devices in the first electronic device.

[0006] It should be understood that the first electronic device may refer to Figure 6 the first electronic device 100 in Figure 6 and the second electronic device may refer to

[0007] Figure 6 the second electronic device 200 inthe metadata cache module in the distributed file client of the first electronic device shown. The B-tree structure is used to manage the metadata cached data.

[0008] In the embodiments of this application, when the metadata cached data meets the first preset threshold condition, by reasonably trimming the metadata cached data, the occupation amount of the metadata cached data in the device memory is controlled to achieve the purpose of saving space; and during the trimming process, the directory being accessed by the user will not be affected.

[0009] In combination with the first aspect, in some implementation manners of the first aspect, the first preset threshold condition is: the memory occupation amount of the metadata cached data is greater than or equal to the target occupation amount.

[0010] In combination with the first aspect, in some implementations of the first aspect, the first preset threshold condition is that the metadata nodes accessed by the first operation are metadata nodes equal to a first threshold number.

[0011] In combination with the first aspect, in some implementations of the first aspect, the pruning by device, which cuts off the non-mounted nodes of non-currently accessed devices, includes: cutting off all non-mounted nodes of non-currently accessed devices.

[0012] In this implementation, all non-mounted nodes of non-currently accessed devices can be directly cut off.

[0013] In the embodiments of the present application, according to the device corresponding to the metadata node accessed by the user, the access requirements of the user for a certain device can be judged. When the user accesses the nodes of one of the devices, the access requirements for other devices can be judged to be very low. Therefore, the non-mounted nodes of other devices can be trimmed to save space.

[0014] In combination with the first aspect, in some implementations of the first aspect, the pruning by device, which cuts off the non-mounted nodes of non-currently accessed devices, includes: pruning in descending order of the levels of the metadata nodes of the non-currently accessed devices, and cutting off the non-mounted nodes of a preset number of levels of the non-currently accessed devices; determining whether the number of remaining metadata nodes after pruning meets the second preset threshold condition; when it does not meet, loop and execute the above steps for pruning until all non-mounted nodes of the non-currently accessed devices are cut off.

[0015] Optionally, the second preset threshold condition may be that the ratio of the number of remaining metadata nodes to the number of all metadata nodes before pruning is less than or equal to a preset ratio.

[0016] In combination with the first aspect, in some implementations of the first aspect, when the number of remaining metadata nodes does not meet the second preset threshold condition after cutting off the non-mounted nodes of the non-currently accessed devices, the method further includes: pruning according to the level of the currently accessed node of the currently accessed device.

[0017] In combination with the first aspect, in some implementations of the first aspect, pruning according to the level of the currently accessed node of the currently accessed device includes: cutting off the non-current branches, the sibling nodes of the non-mounted nodes and their child nodes that are two levels different from the level where the currently accessed node is located.

[0018] In combination with the first aspect, in some implementations of the first aspect, when the number of remaining metadata nodes does not meet the second preset threshold condition after pruning the non-current branch, the sibling nodes of the non-mounting nodes, and their child nodes that are two levels different from the level where the current access node is located, the method further includes: pruning the non-current branch, the sibling nodes of the non-mounting nodes, and their child nodes that are five levels different from the level where the current access node is located.

[0019] In combination with the first aspect, in some implementations of the first aspect, when the number of remaining metadata nodes does not meet the second preset threshold condition after pruning the non-current branch, the sibling nodes of the non-mounting nodes, and their child nodes that are five levels different from the level where the current access node is located, the method further includes: pruning the metadata nodes of the non-current branch.

[0020] In combination with the first aspect, in some implementations of the first aspect, the first operation is an open operation for a directory in a file management application.

[0021] Wherein, the open operation is one of a click operation, a voice operation, and a gesture operation in the air.

[0022] In a second aspect, a data processing device is provided, including a unit for executing any of the methods in the first aspect. The device can be a server, a terminal device, or a chip in the terminal device. The device can include an input unit and a processing unit.

[0023] When the device is a terminal device, the processing unit can be a processor, and the input unit can be a communication interface; the terminal device can further include a memory for storing computer program code. When the processor executes the computer program code stored in the memory, the terminal device is caused to execute any of the methods in the first aspect.

[0024] When the device is a chip in the terminal device, the processing unit can be a processing unit inside the chip, and the input unit can be an output interface, a pin, or a circuit, etc.; the chip can further include a memory, which can be a memory inside the chip (for example, a register, a cache, etc.), or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used for storing computer program code. When the processor executes the computer program code stored in the memory, the chip is caused to execute any of the methods in the first aspect.

[0025] In a possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to execute: in response to a first operation, when metadata cache data meets a first preset threshold condition, pruning is performed according to the device, and non-mounted nodes of non-current access devices are pruned; the metadata cache data is a cache object corresponding to a metadata list in multiple second electronic devices in the first electronic device.

[0026] In a third aspect, a chip system is provided, including: a processor, configured to call and run a computer program from a memory, so that a device installed with the chip system executes the first aspect.

[0027] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores computer program code, and when the computer program code is run by an electronic device, the electronic device is caused to execute any one of the data processing methods in the first aspect.

[0028] In a fifth aspect, a computer program product is provided, and the computer program product includes: computer program code, and when the computer program code is run by an electronic device, the electronic device is caused to execute any one of the data processing methods in the first aspect. Description of the Drawings

[0029] Figure 1 is an exemplary schematic diagram of metadata information of a file in an embodiment of the present application;

[0030] Figure 2 is an adaptable application scenario diagram provided by an embodiment of the present application;

[0031] Figure 3 is another adaptable application scenario diagram provided by an embodiment of the present application;

[0032] Figure 4 is a hardware system diagram of an electronic device provided by an embodiment of the present application;

[0033] Figure 5 is a software system diagram provided by an embodiment of the present application;

[0034] Figure 6 is a schematic flowchart of a metadata reading method provided by an embodiment of the present application;

[0035] Figure 7 is an example of a metadata cache object provided by an embodiment of the present application;

[0036] Figure 8 is a schematic flowchart of a data processing method provided by an embodiment of the present application;

[0037] Figure 9 It is a schematic diagram of a metadata cache tree provided by an embodiment of the present application;

[0038] Figure 10 It is a schematic diagram of another metadata cache tree provided by an embodiment of the present application;

[0039] Figure 11 It is a schematic diagram of yet another metadata cache tree provided by an embodiment of the present application;

[0040] Figure 12 It is a schematic diagram of the interface of the first electronic device provided by an embodiment of the present application;

[0041] Figure 13 It is a schematic diagram of the structure of another electronic device provided by an embodiment of the present application;

[0042] Figure 14 It is a schematic diagram of the structure of yet another electronic device provided by an embodiment of the present application. Detailed implementation manners

[0043] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B; "and / or" in the text is only a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two.

[0044] It should be understood that the terms "first", "second", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.

[0045] Referring to "embodiment" in the present application means that a specific feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments.

[0046] For ease of understanding, the terms involved in the embodiments of the present application will be described first.

[0047] 1. File System (FS), a software mechanism in the operating system responsible for managing and storing file information. The functions of the file system include: managing and scheduling the storage space of files, providing the logical structure, physical structure, and storage method of files; implementing the mapping from file identification to the actual address, implementing file control operations and storage operations, implementing file information sharing and providing reliable file confidentiality and protection measures, and providing file security measures.

[0048] 2. A Distributed File System (DFS) means that the physical storage resources managed by the file system are not necessarily directly connected to the local node, but are connected to distributed nodes through a computer network; or it is a complete hierarchical file system formed by combining several different logical disk partitions or volume labels. DFS provides a logically tree-shaped file system structure for resources located anywhere on the network, making it more convenient for users to access shared files distributed on the network. In short, a distributed file system is a system that organizes multiple storage devices to form a unified file system, enabling users to access and manage the data in these storage devices through a logical path.

[0049] 3. Metadata, data used to describe data or information about information. Metadata can describe the elements or attributes (name, size, data type, etc.) of the data, or its structure (length, fields, data columns), or its related data (where it is located, how to connect, the owner). The above-mentioned data is the file data in the file, that is, the data used by the user for calculation.

[0050] In the embodiments of the present application, according to the different file types, the metadata describing the file included in the metadata information of the file may also be different. Generally, the metadata of a file included in the metadata information of a file may include: file name, file type, file size, modification time, access permission, etc. The metadata information of different types of files may include different metadata. For some files with specific formats, the metadata information of the file may also include more specific metadata.

[0051] Figure 1 This is an exemplary schematic diagram of the metadata information of the file in the embodiments of the present application.

[0052] Exemplarily, such as Figure 1As shown in (a) of , for a text document type file: Document1.txt, its metadata information may include: file name: Document1.txt, document type: text document, and metadata such as file size, modification time, etc.

[0053] Exemplarily, as Figure 1 As shown in (b) of , for a picture file: Picture2.jpg, in addition to metadata such as file name, document type, file size, and modification time, its metadata information may also include file-specific metadata of this picture type such as shooting time, resolution, bit depth, width, and height.

[0054] Exemplarily, as Figure 1 As shown in (c) of , for an audio file: Song3.mp1, in addition to metadata such as file name, document type, file size, and modification time, its metadata information may also include file-specific metadata of this audio type such as album, genre, duration, bit rate, etc.

[0055] In the embodiments of the present application, the metadata of a file can be divided into basic information and data index information.

[0056] 4. Mounting, which can also be referred to as distributed storage mounting, refers to mounting the data in a distributed storage system onto a computing node, so that the computing node can access and operate on this data as if it were accessing a local file system. Through distributed storage mounting, the computing node can directly read and write data in the distributed storage system without the need for data transmission through network communication. This method can improve the efficiency and performance of data access, and at the same time facilitate the management and maintenance of data by the computing node. The implementation of distributed storage mounting depends on a distributed file system.

[0057] In the embodiments of the present application, the distributed storage system can instruct the local file system in the second electronic device.

[0058] The above is a simple introduction to the terms involved in the embodiments of the present application, which will not be elaborated further below.

[0059] Figure 2 and Figure 3 respectively show some application scenarios applicable to the embodiments of the present application.

[0060] Such as Figure 2As shown, generally, people such as office workers, scientific researchers, and college students need to save a lot of learning materials, scientific research reports, office summaries and other related documents, and these documents are often distributed on different devices such as personal mobile phones, tablets, laptops, and desktop computers. In this way, when users need to use these documents, they often need to use or view files across devices, search for or transfer files across devices, etc. The operation is troublesome and the efficiency is low. For this reason, the distributed file system came into being. The distributed file system can provide distributed file capabilities and support mutual access to the file system and data between super terminal devices.

[0061] Exemplarily, as Figure 3 shown in (a) of FIG., when in the near field, the user can directly browse and open the files on the tablet computer on the laptop, or, as Figure 3 shown in (b) of FIG., the user can also directly browse and open the files on the tablet computer (i.e., the second electronic device 200) on the mobile phone (i.e., the first electronic device 100).

[0062] However, in the current distributed scenario, when the user accesses cross-device files in the file management application of device A, it is necessary to first obtain the metadata of the file across devices and then obtain the file data. When the user needs to continuously perform read operations on a large number of files, if each file needs to obtain the corresponding metadata across the network, the process of reading the metadata will consume a lot of time, with low efficiency and reduced reading speed. In view of this, the present application provides a new metadata reading method. By caching the metadata in the device body and reading the metadata cache from the memory of the device body during reading, cross-device communication can be reduced, and the efficiency and performance of cross-device metadata reading can be improved.

[0063] However, the metadata cache data is stored in the memory of the device, and the memory available for the metadata cache data corresponding to different upper-layer services is also limited. Therefore, there is an upper limit to the amount of memory occupied by the metadata cache data in the device memory.

[0064] In view of this, the embodiments of the present application provide a data processing method. When the metadata cache data reaches a certain threshold, by reasonably trimming the metadata cache data, the amount of memory occupied by the metadata cache data in the device memory is controlled, and the purpose of saving space is achieved; and during the trimming process, the directory being accessed by the user is not affected.

[0065] First, the first electronic device and the second electronic device provided by the embodiments of the present application will be introduced below.

[0066] The first electronic device 100 and the second electronic device 200 provided by the embodiments of the present application can both be mobile phones, tablet computers, personal computers (PCs), personal digital assistants (PDAs), smart watches, netbooks, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, smart cars, robots, smart glasses, smart TVs, etc. The embodiments of the present application do not limit the specific form of this electronic device.

[0067] Taking the electronic device as the first electronic device 100 or the second electronic device 200 as an example, Figure 4 A hardware system applicable to the electronic device of the present application is shown.

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

[0069] It should be noted that, Figure 4 the structure shown does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than Figure 4 shown, or the electronic device may include a combination of some of the components Figure 4 shown, or the electronic device may include sub-components of some of the components Figure 4 shown. Figure 4 The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0070] The processor 110 may include one or more processing units. For example, the processor 110 may include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU). Among them, different processing units may be independent devices or integrated devices. The controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.

[0071] 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. This memory can store the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0072] In some embodiments, the processor 110 may include one or more interfaces. For example, the processor 110 may include at least one of the following interfaces: an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and a USB interface.

[0073] Exemplarily, the processor 110 provided in the embodiments of the present application may execute the following method: in response to a first operation, when the metadata cache data meets a first preset threshold condition, perform device pruning to cut off non-mounted nodes of non-currently accessed devices; the metadata cache data is a cache object corresponding to a metadata list in multiple second electronic devices in the first electronic device.

[0074] Figure 4 The connection relationships shown among the various modules are only illustrative and do not constitute a limitation on the connection relationships among the modules of the electronic device. Optionally, the various modules of the electronic device may also adopt a combination of various connection methods in the above embodiments.

[0075] The wireless communication function of the electronic device may be implemented by devices such as antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modulation and demodulation processor, and baseband processor.

[0076] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: Antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

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

[0078] The display screen 194 can be used to display images or videos.

[0079] Optionally, the display screen 194 can be used to display images or videos. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini light-emitting diode (Mini LED), a micro light-emitting diode (Micro LED), a Micro OLED, or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device 100 can include one or N display screens 194, where N is a positive integer greater than 1.

[0080] The electronic device can implement the shooting function through an ISP, the camera 193, a video codec, a GPU, the display screen 194, and an application processor, etc.

[0081] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light passes through the camera and is transmitted to the camera sensor. The optical signal is converted into an electrical signal, and the camera sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can perform algorithm optimization on the noise, brightness, and color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be provided in the camera 193.

[0082] The camera 193 (which can also be referred to as a lens) is used to capture static images or videos. It can be triggered to turn on through application instructions to achieve the function of taking pictures, such as capturing images of any scene. The camera may include components such as an imaging lens, a filter, and an image sensor. The light emitted or reflected by an object enters the imaging lens, passes through the filter, and finally converges on the image sensor. The imaging lens is mainly used to converge and form an image of the light emitted or reflected by all objects in the photographing perspective (which can also be referred to as the scene to be photographed, the target scene, or the scene image that the user expects to photograph); the filter is mainly used to filter out the excess light waves in the light (such as light waves other than visible light, such as infrared); the image sensor can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The image sensor is mainly used to perform photoelectric conversion on the received optical signal, convert it into an electrical signal, and then transfer the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into standard image signals in formats such as RGB and YUV.

[0083] Exemplarily, the digital signal processor is used to process digital signals. In addition to being able to process digital image signals, it can also process other digital signals. For example, when the electronic device is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0084] Exemplarily, the video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0085] Exemplarily, the gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, the y-axis, and the z-axis) can be determined through the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake during shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of jitter of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and makes the lens offset the jitter of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used in scenarios such as navigation and motion-sensing games.

[0086] Exemplarily, the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally the x-axis, y-axis, and z-axis). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100 and serve as an input parameter for applications such as horizontal and vertical screen switching and pedometers.

[0087] Exemplarily, the distance sensor 180F is used to measure distance. The electronic device 100 can measure distance through infrared or laser. In some embodiments, for example, in a shooting scenario, the electronic device 100 can use the distance sensor 180F to measure distance to achieve rapid focusing.

[0088] Exemplarily, the ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance during photography. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.

[0089] Exemplarily, the fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement functions such as unlocking, accessing the application lock, taking pictures, and answering incoming calls.

[0090] Exemplarily, the touch sensor 180K, also known as a touch control device. The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, and the touch screen is also called a touch control screen. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100 and at a different position from the display screen 194.

[0091] The hardware system of the electronic device has been described in detail above. On top of the above hardware, an operating system runs. The operating system at the operating system layer can be any one or more computer operating systems that implement business processing through processes. For example, Linux operating system, Unix operating system, Android operating system, iOS operating system, or windows operating system, etc. Application programs can be installed and run on the operating system.

[0092] Combined with Figure 3 as shown in (b) of , taking the first electronic device 100 and the second electronic device 200 both running the Android system as an example,Figure 5 The software system diagram of a first electronic device 100 and a second electronic device 200 provided by an embodiment of the present application is shown.

[0093] In some embodiments, as Figure 5 shown, on the side of the first electronic device 100, for the Android system, the layered architecture can divide the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. For example, the Android system can be divided into three layers, from top to bottom, namely the application layer, the application framework layer (application framework), and the kernel layer.

[0094] Among them, the application layer in the first electronic device 100 may include file management and a distributed file client. In addition, it may also include: a global collection application, a music application, a video application, a teleconference application, a game application, etc., which are not limited in the embodiments of the present application.

[0095] Optionally, in the embodiments of the present application, the distributed file client may include a message transceiver module A, a metadata management module, a Fuse adaptation layer, and a file management module. Among them, the metadata management module may include a metadata cache module. Of course, the distributed file client may also include other modules, which are not limited in the embodiments of the present application. The specific functions of each module can refer to the subsequent introduction for Figure 6 which will not be elaborated here.

[0096] The application framework (or called the framework layer) provides application programming interfaces (application programming interface, API) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions. In the embodiments of the present application, the application framework layer may include POSIX interfaces.

[0097] The kernel layer may include a kernel and a Fuse user-space file system framework. The Fuse user-space file system framework provides a user-space dynamic link library libfuse.so and a kernel-space driver fuse.ko.

[0098] In some embodiments, as Figure 5 shown, on the side of the second electronic device 200, the Android system in the second electronic device 200 is also divided into three layers, from top to bottom, namely the application layer, the application framework layer, and the kernel layer.

[0099] Among them, the application layer may include a series of application packages. For example, the application layer may include a distributed file server. Of course, the application layer may also include a global collection application, a gallery APP, a camera APP, and other applications. The embodiments of the present application do not impose any restrictions on this.

[0100] Optionally, in the embodiments of the present application, the distributed file server may include a message sending and receiving module B and a file operation processing module, and the file operation processing module may include a file monitoring module. Of course, the distributed file server may also include other modules, and the embodiments of the present application do not limit this. The specific functions of each module can be further referred to the subsequent introduction for Figure 6 which will not be elaborated here.

[0101] The application framework (or framework layer) provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions. In the embodiments of the present application, the application framework layer may include POSIX interfaces.

[0102] The kernel layer is the layer between hardware and software. In the embodiments of the present application, the kernel layer in the second electronic device 200 may include a local file system, etc.

[0103] It should be understood that the first electronic device can perform data transmission between the message sending and receiving module in the distributed file client module in the application layer and the message sending and receiving module in the distributed file server module in the application layer of the second electronic device to achieve file sharing between the first electronic device and the second electronic device.

[0104] It should be noted that the embodiments of the present application are described by taking both the first electronic device and the second electronic device as Android systems as examples, but the basic principle also applies to electronic devices based on other operating systems.

[0105] Next, taking Figure 3 the first electronic device shown in (b) as a mobile phone and the second electronic device as a tablet computer, and taking the Figure 5 operating system shown as an example, the metadata reading method provided by the embodiments of the present application will be briefly described first.

[0106] Figure 6 shows a schematic diagram of a metadata reading method provided by the embodiments of the present application. As shown in Figure 6As shown, the metadata reading method 600 is applied to the first electronic device 100 and the second electronic device 200 described above, and both the first electronic device 100 and the second electronic device are Android systems. The metadata reading method 600 may include a mounting stage - a first acquisition stage - a second acquisition stage, and the processes included in each stage are introduced separately below.

[0107] Stage 1: Mounting stage

[0108] S601. Initialize the Fuse adaptation layer in the first electronic device.

[0109] It should be understood that the initialization is used to clear the old and existing nodes for mounting a new root node.

[0110] S602. The Fuse adaptation layer mounts the root node to the Fuse user-space file system framework.

[0111] S603. The Fuse user-space file system framework mounts the root node to the kernel layer.

[0112] S604. In response to the second electronic device going online, the file management application in the first electronic device issues an acquisition instruction to the message receiving and sending module A in the distributed file client.

[0113] The method for the second electronic device to go online is any method provided by the prior art, and the present application does not make any limitation in this regard.

[0114] The acquisition instruction is used to indicate the acquisition of the mountable path of the second electronic device, and the acquisition instruction may also carry parameters, which may include the device ID of the first electronic device, the device ID of the second electronic device, etc.; since the device ID of the second electronic device is carried in the parameters, when the file management application APP in the first electronic device issues an acquisition instruction to the message receiving and sending module A in the distributed file client, the message receiving and sending module A can know the target device for acquiring the mountable path based on the device ID.

[0115] Optionally, the parameters carried by the acquisition instruction may also include the device ID of the first electronic device, and the embodiments of the present application do not make any limitation in this regard.

[0116] S605. The message receiving and sending module A in the distributed file client sends the acquisition instruction to the message receiving and sending module B in the distributed file server in the second electronic device.

[0117] S606. After receiving the acquisition instruction, the message receiving and sending module B sends a list of mountable paths to the message receiving and sending module A.

[0118] The list of mountable paths includes one or more mountable paths of the second electronic device.

[0119] S607. The message sending and receiving module A sends the returned list of mountable paths to the file management application.

[0120] Thus, the second electronic device can send the list of mountable paths to the file management application in the first electronic device based on the device ID of the first electronic device. In this way, it is equivalent to the first electronic device obtaining the list of mount paths of the peer (i.e., the second electronic device).

[0121] S608. The file management application in the first electronic device sends a mount request to the message sending and receiving module A.

[0122] Among them, the mount request is used to request to mount the second electronic device to the first electronic device, which is convenient for opening and browsing the files of the second electronic device on the first electronic device. The mount request can carry parameters, and the parameters can include the device ID of the second electronic device, the mount path of the second electronic device, the local mount path, etc.

[0123] Exemplarily, the mount path of the second electronic device can be: " / sdcard"; the local mount path can be: "Other Devices\Device ID of the Second Electronic Device". If the device ID of the second electronic device is 000010, the local mount path can be expressed as: "Other Devices\000010".

[0124] It should be noted that most of the user's data is saved in the sdcard of the second electronic device. For example, albums, documents, etc. are all saved in the directory of the sdcard. Therefore, the mount path of the second electronic device can be defaulted to: " / sdcard", and the mount request sent by the first electronic device to the second electronic device can default to request to mount this path.

[0125] Here, it should be understood that the mountable path is default selected by the upper-layer service and does not involve user triggering. For example, in the file management application, after sensing the online of the second electronic device, based on the returned list of mountable paths, a certain mount path default corresponding to the file management service can be selected from them, such as " / sdcard" mentioned above; this " / sdcard" is the service mount path corresponding to the file management service.

[0126] It should be understood that for different upper-layer services, the default corresponding mountable paths in the second electronic device can be different. For example, for the global favorite application in the first electronic device, after sensing the online of the second electronic device, another mount path default corresponding to the global favorite service can be selected from the returned list of mountable paths.

[0127] S609. The message sending and receiving module A sends a mount request to the message sending and receiving module B in the distributed file server of the second electronic device.

[0128] S610. In response to the mounting request, the first electronic device performs mounting. After successful mounting, the message transceiver module B returns a feedback message indicating successful mounting to the message transceiver module A.

[0129] Optionally, if the message transceiver module A does not receive the feedback message indicating successful mounting returned by the message transceiver module B, it can send the mounting request to the message transceiver module B again to attempt to trigger mounting again. It should be understood that the message transceiver module A can send multiple mounting requests to the message transceiver module B until the mounting is successful.

[0130] Optionally, if the message transceiver module A does not receive the feedback message indicating successful mounting returned by the message transceiver module B, it can return a feedback message indicating mounting failure to the file management application in the first electronic device to trigger mounting automatically again through the application.

[0131] S611. After the message transceiver module A in the second electronic device receives the feedback message, it points the mounting path (or the service mounting path) to the disk path.

[0132] Exemplarily, Figure 12 is a schematic diagram of the interface in the first electronic device provided in the embodiment of the present application. As Figure 12 shown in (a) therein, in response to the click operation on the file management application displayed on the desktop, the first electronic device can display the main interface of the file management application as shown in Figure 12 (b) therein. Assume that the second electronic device is Honor 100Pro. Point the service mounting path to the disk path, and link "Other Devices\Device ID of the Second Electronic Device" and " / mnt / appfuse / dfs / default / Device ID of the Second Electronic Device".

[0133] S612. The message transceiver module A returns a feedback message indicating successful mounting to the file management application.

[0134] In the embodiment of the present application, the file management application in the first electronic device mounts the second electronic device through the distributed file system. Thus, the distributed file system included in the first electronic device can be referred to as a distributed file client, and the distributed file system included in the second electronic device can be referred to as a distributed file server. After successful mounting, the user can browse and open the files on the second electronic device on the file management application in the first electronic device through the distributed file client.

[0135] Phase II: The First Acquisition Phase

[0136] S621. The first electronic device displays the first interface and receives a user operation on the first interface.

[0137] Optionally, the user operation may indicate a user operation on the directory included in the first interface.

[0138] Exemplarily, as Figure 12 shown in (c) of [], the first interface is the main interface of the file management application; in the first interface, the directory of the second electronic device successfully mounted may be displayed, such as Figure 12 the directory P1 in the interface shown in (a) of []. The user operation on the directory included in the first interface may indicate a user operation on the directory P1 under the mount path.

[0139] For example, the user operation may indicate a click operation by the user on the directory. Alternatively, the user operation may also be other operations such as a voice operation or an air gesture operation for indicating to open the directory P1, which is not limited in the embodiments of the present application.

[0140] Exemplarily, the first interface may be the main interface of the file management application, and the user operation may indicate a double-click operation on "Other Devices\Device ID of the Second Electronic Device\DCIM", where DCIM indicates the file directory corresponding to the photo album in the second electronic device.

[0141] S622. In response to the user operation, the file management application sends a read instruction to the message receiving and sending module A of the distributed file client, and the read instruction is used to indicate to open the directory, or in other words, to indicate to read the metadata of the directory corresponding to the user operation.

[0142] Among them, the read instruction may carry parameters, and the parameters may include: the parent directory, such as "Other Devices / Device ID of the Second Electronic Device"; in one embodiment, the parameters may further include the folder name: "DCIM".

[0143] Optionally, S622 may include the following S6221 to S6225.

[0144] S6221. In response to the user operation, the file management application calls the file library function to traverse the directory. Specifically, the file management application calls the POSIX readdir interface to traverse the directory triggered by the user operation to find the file object corresponding to the directory.

[0145] S6222. The file library function triggers a kernel search and sends a read instruction to the kernel.

[0146] That is, when the upper-layer file management application browses the directory, it directly calls the file library function interface to traverse the directory. That is, the upper-layer service calls the system's file library function, and the readdir interface will trigger the sys_getdents64 system call in the kernel. sys_getdents64 searches for the corresponding file object according to the passed-in directory file descriptor (fd).

[0147] S6223. The kernel searches through the Fuse adaptation layer via the Fuse user-space file system framework, that is, the kernel sends a read instruction to the Fuse user-space file system framework layer.

[0148] S6224. After receiving the read instruction, the Fuse user-space file system framework layer sends the read instruction to the Fuse adaptation layer.

[0149] S6225. The Fuse adaptation layer sends the read instruction to Message Sending and Receiving Module A.

[0150] Based on the operation function specified by the searched file object, the kernel calls the Fuse_readdir interface of the Fuse user-space file system framework. The Fuse_readdir interface encapsulates the parameters into a request and sends it to the user-space libfuse via the device file / dev / fuse. After receiving the request, libfuse calls Message Sending and Receiving Module A in the distributed file system client to implement the readdir function.

[0151] S623. After receiving the read instruction, Message Sending and Receiving Module A instructs to read metadata cache data from the metadata cache module. At this time, if no metadata cache data is read, that is, there is no metadata cache data in the metadata cache module, then S624 to S628 are executed; if metadata cache data is read, that is, there is metadata in the metadata cache module, then S629 is executed.

[0152] Specifically, based on S6224, when a service (such as a file management application) calls Message Sending and Receiving Module A to implement the readdir function, Message Sending and Receiving Module A reads metadata from the metadata cache module.

[0153] Metadata cache data refers to the metadata stored in the metadata cache module.

[0154] Exemplarily, such as Figure 7As shown in the figure, in the embodiment of the present application, a metadata object is an iNode, and the basic information of the file is stored in the iNode. Among them, the basic information may include ino (iNode-number): the unique identifier of the metadata; name: the name; the ID of each user, such as including the User ID (UID) and the Group ID (GID); utime: the modification time and other information. It should be noted that the generation of ino is to generate a unique ino from the hash value of the parent directory address and the name; in addition, UID and GID respectively correspond to the two attributes of the file owner and the owning group. UID uses root and GID / Android / data: ext_data_rw, / Android / obb is ext_obb_rw, and the others are media_rw for control.

[0155] The metadata cache object is a MetaNode object. From the ino in the MetaNode object, the corresponding metadata information can be found. The distributed file uses map<ino, iNode*> to manage the mapping relationship between ino and INode. At the same time, it also uses map<ino, MetaNode*> to manage the mapping relationship between ino and MetaNode. In the MetaNode object, map<string, MetaNode*> children is used to save the mapping relationship between the sub-directory name and the sub-directory. That is, the metadata cache uses a B-tree structure to manage the cache. The root node is assigned a fixed ino. When traversing the sub-directory, the sub-directory information can be found through the name in the map.

[0156] S624. When no metadata cache is read, that is, when there is no metadata cache in the metadata cache module, the message sending and receiving module A in the distributed file client sends a fetch instruction to the message sending and receiving module B in the distributed file server of the second electronic device. The fetch instruction is used to indicate to fetch the metadata of all child nodes from the second electronic device.

[0157] Optionally, fetching metadata indicates fetching the metadata of all child nodes under the directory accessed by the user.

[0158] Among them, the fetch instruction may carry parameters, and the parameters carried may correspond to the parameters in the read instruction.

[0159] For example, the parameters carried in the fetch instruction may include: / sdcard.

[0160] For another example, the parameters carried in the fetch instruction may include: / sdcard / DCIM. " / sdcard" is the mounting path corresponding to the second electronic device, and DCIM is the folder name included in the parameters of the read instruction.

[0161] S625. The message sending and receiving module B sends a fetch instruction to the local file system in the second electronic device.

[0162] It should be understood that all metadata is stored in the local file system of the second electronic device.

[0163] S626. After the local file system in the second electronic device receives the fetch instruction, it returns a corresponding metadata list to the message sending and receiving module B based on the parameters carried in the fetch instruction.

[0164] The metadata list includes one or more metadata.

[0165] It should be understood that after receiving the fetch instruction, the message sending and receiving module B can call the file library function to obtain the metadata related to the instruction and return the obtained metadata to the first electronic device.

[0166] S627. The message sending and receiving module B sends the metadata list to the metadata cache module in the distributed file client in the first electronic device for storage.

[0167] S628. The metadata cache module sends the metadata list to the file management application.

[0168] S629. When the metadata cache data is read, that is, when there is metadata in the metadata cache module, the metadata cache module sends the corresponding metadata list in the cache to the file management application based on the read instruction.

[0169] Regarding S628 and S629, as Figure 6 shown, whether it is the metadata list returned from the second electronic device received or the metadata list read from the metadata cache module, the metadata cache module can send the metadata list to the Fuse adaptation layer, the Fuse adaptation layer sends the metadata list to the Fuse user-mode file system framework, the Fuse user-mode file system framework sends the metadata list to the kernel, and the kernel then sends the metadata list to the file management application through the file library function.

[0170] Exemplarily, in response to a click operation by the user on the directory P1 included in the display interface on the first electronic device, as Figure 12As shown in (c) thereof, the first electronic device can return the metadata list read from the metadata cache module to the file management application by reading. For example, the metadata list may include metadata corresponding to multiple subdirectories such as "Honor System", "HonorDocs", "Magazine", etc. It should be noted that the metadata list is not displayed on the display interface, that is, the user is unaware of it. Optionally, subsequently, when the file management application's file management module and message sending and receiving module A send a file acquisition instruction to message sending and receiving module B, the file data corresponding to the multiple subdirectories can be returned and displayed on the first electronic device as shown in Figure 12 the content shown in (d) thereof.

[0171] It should be understood that when the user performs an operation to read the directory for the first time after mounting, the metadata cache module may not store any metadata. At this time, the first electronic device can execute S624 to S628 to obtain metadata from the second electronic device for the first time across devices. When the user performs an operation to read the directory for the second or Nth time, the metadata cache module may already store a metadata list. Therefore, the first electronic device can execute S629, no longer perform cross-device communication, but directly read the metadata list from the local metadata cache module, thereby achieving the purpose of reducing cross-device communication and improving the reading efficiency and performance.

[0172] In addition, when there is no metadata cache in the metadata cache module, after S626, the method provided in the embodiment of the present application may further include:

[0173] S631: The message sending and receiving module B in the second electronic device sends a registration monitoring instruction to the file monitoring module.

[0174] The registration monitoring instruction is used to register, based on the parameters carried in the acquisition instruction, the monitoring of file changes corresponding to the directory and its subdirectories included in the parameters with the file monitoring module.

[0175] In the embodiment of the present application, the file operation processing module may include a file monitoring module. The file operation processing module can be used to obtain a metadata list from the local file system of the second electronic device and can also be used to implement metadata monitoring through the file monitoring module.

[0176] S632: After registration, the file monitoring module returns a feedback message indicating successful monitoring to the message sending and receiving module B.

[0177] Optionally, after S632, the method provided in the embodiment of the present application may further include:

[0178] S633. When a file in the local file system of the second electronic device changes, the local file system sends a message to the file monitoring module, which is used to notify the file monitoring module that the file in the local file system has changed.

[0179] S634. After receiving the message, the file monitoring module obtains the newly added metadata from the local file system.

[0180] S635. The local file system returns the newly added metadata to the file monitoring module.

[0181] S636. The file monitoring module sends a file change notification to Message Sending / Receiving Module B. The file change notification can carry parameters, which can include directory, change event, newly added file name, etc.

[0182] S637. Message Sending / Receiving Module B sends the file change notification to Message Sending / Receiving Module A in the first electronic device.

[0183] S638. Based on the file change notification, Message Sending / Receiving Module B instructs the metadata cache module to update the metadata cache.

[0184] S639. After the metadata cache module finishes the update, it feeds back a message indicating successful update to Message Sending / Receiving Module B.

[0185] S640. While executing S639, the metadata cache module can also send a notification to the kernel that the old metadata has become invalid.

[0186] Exemplarily, for instance, in response to a user's click operation, if the file management application in the first electronic device opens the photo album, the second electronic device registers to monitor the photo album directory. When the user takes a new photo using the second electronic device, the file monitoring module of the second electronic device can monitor that the file has changed. At this time, the file monitoring module can notify Message Sending / Receiving Module B of this file change in real time; Message Sending / Receiving Module B then notifies Message Change Module A of the first electronic device of the file change; after receiving the notification, the first electronic device can update the metadata in the metadata cache module based on the data carried in the notification.

[0187] Exemplarily, the parameters carried in the notification can include directory: " / sdcard / DCIM / ", change event is "newly added"; the newly added file name can include: "newly added file name: 123.jpg" and the corresponding metadata of this name.

[0188] It should be understood that the above is an example for the newly added event. The file change event can also include: modification, deletion, etc. The change process of each event is similar to the above, and can refer to the above description, which will not be elaborated here.

[0189] In the embodiment of the present application, since a file monitor is registered on the side of the distributed file server, when the text in the server changes, it can notify the distributed file client in real time and update the cache content in the metadata cache module included in the distributed file client. Thus, in the subsequent process of continuously responding to user operations to obtain the cache, the content in the metadata cache module can be consistent with the metadata content on the side of the distributed file server, avoiding data mismatch errors. Since the kernel in the first electronic device itself also has a cache, when the metadata cache module is updated, it is also necessary to notify the kernel that the original cache has expired, that is, the old metadata has expired.

[0190] In addition, each time the file on the side of the distributed file server changes, only the changed metadata content needs to be updated to the metadata cache module on the side of the distributed file client, with a relatively small amount of changed data, high efficiency, and low energy consumption.

[0191] Phase Three: The Second Acquisition Phase

[0192] S641. The first electronic device displays the first interface and receives a user operation.

[0193] Optionally, the user operation may indicate a user operation on the local directory included in the first interface.

[0194] Exemplarily, as shown in (a) of Figure 12 , the first interface is the main interface of the file management application; in the first interface, the local directory of the first electronic device may be displayed, such as P2 in the interface shown in (c) of Figure 12 . The user operation on the local directory included in the first interface may indicate a user operation on directory P2.

[0195] For example, the user operation may indicate a click operation on the directory by the user using the mouse. Or, the user operation may also be other operations such as a voice operation or an air gesture operation for indicating to open directory P2, which is not limited in the embodiment of the present application.

[0196] Exemplarily, the first interface may be the main interface of the file management application, and the user operation may indicate a double-click operation on "My Phone: DCIM", where DCIM indicates the file directory corresponding to the photo album in the first electronic device.

[0197] S642. In response to the user operation, the file management application sends a read instruction to the file library function.

[0198] The read instruction may carry parameters, which may include: the parent directory, such as "My Phone"; and the folder name: "DCIM".

[0199] S643. The file library function sends a read instruction to the kernel, and the read instruction is used to indicate to open a directory, or in other words, to indicate to read the metadata of the directory corresponding to the user operation.

[0200] S644. The kernel returns the corresponding metadata list to the file library function.

[0201] S645. The file library function returns the metadata list to the file management application.

[0202] In the embodiment of the present application, by caching the metadata in the first electronic device, when a read instruction is received, the metadata cache can be first read from the first electronic device body, reducing cross-device communication, and achieving the purpose of improving the efficiency and performance of cross-device metadata reading. When the metadata cache data is not read in the first electronic device, it is obtained from the second electronic device, and a file monitor is registered on the second electronic device. In this way, when the file on the second electronic device changes, the metadata cache data in the first electronic device can be updated in a timely manner, with a small amount of data and high efficiency.

[0203] Optionally, the method provided in the embodiment of the present application may include: a mounting stage and a first acquisition stage.

[0204] Optionally, the method provided in the embodiment of the present application may include: a mounting stage and a second acquisition stage.

[0205] Combined with the above metadata reading process, in S627 and S638, as the user operates to access the directory in the first electronic device, the second electronic device will return the metadata list corresponding to the directory to the metadata cache module, and the amount of data stored in the metadata cache module of the first electronic device will continue to grow. Moreover, the amount of data stored in the metadata cache module will increase significantly as the user accesses deeper into the directory.

[0206] For example, when a certain application is running, when the user operates on the first electronic device to access directory a, the metadata cache module in the first electronic device caches the metadata list corresponding to directory a returned from the second electronic device; when the user continues to access directory b, the metadata cache module in the first electronic device caches the metadata list corresponding to directory b returned from the second electronic device b.

[0207] The more directories the user accesses, the more metadata cache data is stored in the metadata cache module. To control the occupancy of the metadata cache data in the memory of the first electronic device, the embodiment of the present application provides a data processing method 700, as Figure 8As shown, the data processing method 700 is applied to the first electronic device 100 described above. The data processing method 700 may include the following S701 to S702, and the steps S701 to S702 will be introduced one by one below.

[0208] S701. In response to a first operation, when the metadata cache data meets the first preset threshold condition, perform device pruning to prune non-mounted nodes of non-currently accessed devices.

[0209] The metadata cache data is a cache object corresponding to the metadata list of multiple second electronic devices in the first electronic device. In the embodiments of the present application, the metadata cache data is stored in the metadata cache module of the first electronic device.

[0210] The data processing method provided by the embodiments of the present application further includes: in response to the first operation, when the metadata cache data does not meet the first preset threshold condition, read the metadata according to the above metadata reading method.

[0211] In the embodiments of the present application, before receiving the first operation, the upper-layer service may be a file management application. According to Figure 6 the mounting step in the metadata reading method shown, multiple electronic devices are successfully mounted on the first electronic device, such as the second electronic device a, the second electronic device b, the second electronic device c, etc. Among them, the second electronic device a is, for example, the second electronic device 200 involved in the above metadata reading method.

[0212] Optionally, the first operation is an open operation for a directory in the first interface displayed by the first electronic device.

[0213] It should be understood that the first operation may be an open operation for a directory. For example, the first operation may be a click operation, a voice operation, an air gesture operation, etc., or may be other operations. The embodiments of the present application do not limit this.

[0214] It should be understood that the directory corresponds to the electronic device, and each directory is a metadata node. Therefore, based on the currently accessed directory, the currently accessed device, non-currently accessed devices, as well as mounted nodes and non-mounted nodes can be known. The mounted nodes and non-mounted nodes of all devices can be referred to as metadata nodes.

[0215] For example, for a file management application, the mounting path of the second electronic device a is: " / sdcard", then the directory corresponding to "sdcard" is the mounting node of the second electronic device a; when the user accesses the photo album directory of the second electronic device a, the access path is " / sdcard / DCIM". At this time, the directory corresponding to "sdcard" is the mounting node of the second electronic device a; the directory corresponding to DCIM is the non-mounting node of the second electronic device a. The division methods of the mounting nodes and non-mounting nodes of other second electronic devices b and second electronic device c are the same as those of the second electronic device a, and so on, which will not be elaborated here.

[0216] Optionally, the first preset threshold condition may be: in response to the first operation, the memory occupancy of the metadata cache data is greater than or equal to the target occupancy.

[0217] Optionally, the first preset threshold condition may be: the metadata nodes accessed by the first operation are equal to the first threshold number of metadata nodes.

[0218] Exemplarily, assume that the distributed file system client in the first electronic device allocates 10M of memory space for storing metadata cache data, and 10M is the target occupancy. When the metadata list obtained in response to the first operation is cached in the metadata cache module, the sum of the sizes of the old metadata cache data and the new metadata cache data is equal to or exceeds the target occupancy of 10M. At this time, pruning starts according to the device.

[0219] Exemplarily, when the user accesses a certain directory (which is also a metadata node) in the file management application, in response to a click operation, the directory triggered by the click operation is the 20,000th metadata node, and 20,000 is the first threshold number of metadata nodes; at this time, pruning can start according to the device.

[0220] It should be noted that the size of a metadata node is approximately 550B, and the size of 20,000 metadata nodes is approximately 10M. In other words, the 10M space occupancy allocated by the distributed file system client can basically store 20,000 metadata nodes.

[0221] Optionally, pruning by device and pruning the non-mounting nodes of non-currently accessed devices may include: S7011 or S7012.

[0222] S7011. Prune all non-mounting nodes of non-currently accessed devices.

[0223] S7012. Prune according to the levels of the metadata nodes of non-currently accessed devices from large to small, and prune the non-mounting nodes of the preset number of layers of non-currently accessed devices.

[0224] After S7011 or S7012, the method may further include: S7013 and S7014.

[0225] S7013. Determine whether the number of remaining metadata nodes after pruning satisfies a second preset threshold condition; when satisfied, the pruning ends.

[0226] S7013. When not satisfied, if S7011 is executed, then S702 is executed next; if S7012 is executed, the steps of S7012 are looped until all non-mounted nodes of non-current access devices are pruned, and then it is determined again whether the second preset threshold condition is satisfied. When not satisfied, S702 is executed.

[0227] Optionally, the second preset threshold condition may be: the ratio of the number of remaining metadata nodes to the number of all metadata nodes before pruning is less than or equal to a preset ratio.

[0228] For example, the preset ratio may be 90%, 80%, etc., and the present application embodiment does not limit the setting. Assume that the number of metadata nodes before pruning is 20,000 and the preset ratio is 90%, then the number of remaining metadata nodes refers to less than or equal to 18,000. That is, all non-mounted nodes of non-current access devices are pruned, and it is determined whether the number of remaining metadata nodes after pruning is less than or equal to 18,000.

[0229] Exemplarily, Figure 9 The present application embodiment provides a schematic diagram of a metadata cache tree. The metadata cache tree is used to represent the association relationship in metadata cache data. As the access path deepens, the more levels there are on the metadata cache tree, the more metadata nodes are linked.

[0230] As Figure 9 shown, assume that the first electronic device mounts the second electronic device a and the second electronic device b. Among them, root(1) belonging to the first level is used to indicate the root node; default(2) belonging to the second level is used to indicate the metadata node of the first electronic device; directory nodeId1(3) belonging to the third level is used to indicate the second electronic device a, nodeId2(4) is used to indicate the second electronic device b, directory sacard(5) belonging to the fourth level is used to indicate the mounted node of the second electronic device a; sacard(6) is used to indicate the mounted node of the second electronic device b. There are also multiple other metadata nodes under each mounted node.

[0231] If the currently accessed metadata node is test111(14) under the second electronic device a, assuming that the cache limit has been reached, that is, when accessing test111(14), the cache reaches the limit and pruning is required. Since there are two devices on the metadata cache tree and the second electronic device a is the currently accessed device, the second electronic device b is equivalent to the non-currently accessed device; at this time, pruning can be performed on the non-mounted nodes of the non-currently accessed device. For example, Figure 9 As shown, at this time, the metadata nodes test1(10), DCIM(11), and adc.jpg(13) included in the non-mounted nodes under sacard(6) can be pruned.

[0232] Then, determine whether the ratio of the number of remaining metadata nodes to the number of all metadata nodes before pruning is less than or equal to a preset ratio, such as 90%. Here, the total number of metadata nodes cached before pruning is 14. After pruning 3 non-mounted nodes of the second electronic device b, the ratio of the number of remaining metadata nodes to the number of all metadata nodes before pruning is 11 / 14, approximately equal to 78.5%, which is less than 90%. This indicates that this pruning meets the second preset threshold condition and the pruning ends.

[0233] In the embodiment of the present application, according to the device corresponding to the metadata node accessed by the user, the access requirement of the user for a certain device can be judged. When the user accesses the node of one device, the access requirement for other devices can be judged to be very low. Therefore, the non-mounted nodes of other devices can be pruned to save space.

[0234] S702. When the pruning is performed according to S701 and does not meet the second preset threshold condition, pruning is performed according to the level of the currently accessed node of the currently accessed device.

[0235] It should be understood that if, after pruning all the non-mounted nodes of the non-currently accessed device, the memory occupancy cannot be effectively reduced, it means that the data volume of the non-mounted nodes of the non-currently accessed device itself is relatively small. Therefore, subsequently, only the metadata nodes of the currently accessed device can be pruned.

[0236] The currently accessed node is the directory currently opened in response to the first operation.

[0237] Optionally, pruning according to the level of the currently accessed node of the currently accessed device may include:

[0238] S7021. Prune the non-current branches, the sibling nodes of the non-mounted nodes, and their child nodes that are two levels different from the level where the currently accessed node is located, and determine whether the number of remaining nodes after pruning meets the second preset threshold condition.

[0239] It should be understood that based on the statistical user usage experience, it can be determined that the depth that users usually access is two levels of nodes. Therefore, when pruning, metadata nodes whose levels differ from the current accessed node by two levels can be deleted first. It should also be understood that in order not to affect the normal access of users, the nodes to be pruned should be the siblings and their children of non-current branches and non-mounted nodes.

[0240] S7022: If not satisfied, continue to prune the siblings and their children of non-current branches and non-mounted points whose levels differ from the current accessed node by five levels, and determine whether the number of remaining nodes after pruning meets the second preset threshold condition.

[0241] S7023: If still not satisfied, prune other nodes except the nodes of the current branch.

[0242] Exemplarily, Figure 10 is a schematic diagram of another metadata cache tree provided by an embodiment of the present application. As Figure 10 shown, assume that the first electronic device mounts the second electronic device a. Among them, the directory nodeId1(3) belonging to the third level is used to indicate the second electronic device a, and the directory sacard(4) belonging to the fourth level is used to indicate the mounted node of the second electronic device a; there are multiple metadata nodes below this mounted node.

[0243] If the currently accessed metadata node is test111(11) under the second electronic device a, assume that the cache limit is reached at this time, that is, when accessing test111(11), the cache reaches the limit and pruning is required. Since there is no non-current accessed device, or, according to the steps disclosed in S701 above, the non-mounted nodes of non-current accessed devices have been pruned. However, the number of remaining metadata nodes after pruning still does not meet the second preset threshold condition.

[0244] Then, pruning can be performed according to the steps disclosed in S702, according to the level of the current accessed node of the current accessed device. As Figure 10 shown, if the current accessed node test111(11) belongs to the seventh level, then the siblings and their children of non-current branches and non-mounted nodes whose levels differ from the current accessed node by two levels can be pruned. For example, there are two metadata nodes whose levels differ from the current accessed node by two levels. One is test1(5), and the other is DCIM(6). Among them, test1(5) and the current accessed node belong to the same branch, and DCIM(6) and the current accessed node do not belong to the same branch, that is, a non-current branch. Therefore, DCIM(6) belonging to the non-current branch and its children adc.jpg(9) and def.jpg(10) can be pruned.

[0245] Then, determine whether the number of remaining nodes after pruning meets the second preset threshold condition. For example, determine whether the ratio of the number of remaining metadata nodes to the number of all metadata nodes before pruning is less than or equal to a preset ratio, such as 90%. Here, the total number of cached metadata nodes before pruning is 11. After pruning 3 nodes, the number of remaining nodes is 8. The ratio of the number of remaining metadata nodes to the number of metadata nodes cached before pruning is 8 / 11, approximately equal to 72.7%, which is less than 90%. This indicates that this pruning meets the second preset threshold condition, and the pruning ends.

[0246] Exemplarily, Figure 11 is a schematic diagram of another metadata cache tree provided by an embodiment of the present application. As Figure 11 shown, assume that the first electronic device mounts the second electronic device a. Among them, the directory nodeId1(3) belonging to the third level is used to indicate the second electronic device a, and the directory sacard(5) belonging to the fourth level is used to indicate the mounting node of the second electronic device a; there are multiple metadata nodes under this mounting node.

[0247] If the currently accessed metadata node is honor1(14) under the second electronic device a, assume that the cache limit is reached at this time, that is, when accessing honor1(14), the cache reaches the limit and pruning is required. Since there is no non-current access device, or, according to the steps disclosed in S701 above, the non-mounting nodes of non-current access devices have been pruned. However, the number of remaining metadata nodes after pruning still does not meet the second preset threshold condition.

[0248] Then, according to the steps disclosed in S702, pruning can be performed according to the level of the currently accessed node of the current access device. As Figure 11 shown, if the currently accessed node honor1(14) belongs to the ninth level, then non-current branch, non-mounting node sibling nodes and their child nodes with a level difference of 2 levels from the level of the currently accessed node can be pruned first. Since there are no nodes meeting the conditions in the fifth level in this example. Therefore, the pruning strategy can be changed to prune non-current branch, non-mounting node sibling nodes and their child nodes with a level difference of 5 levels from the level of the currently accessed node.

[0249] For example, there are three metadata nodes with a level difference of 5 levels from the level of the currently accessed node, namely test1(8), Android(7), and DCIM(9). Among them, test1(8) and the currently accessed node belong to the same branch, while the other two do not belong to the same branch as the currently accessed node, that is, the non-current branch. Therefore, Android(7), DCIM(9) and their child node adc.jpg(11) belonging to the non-current branch can be pruned.

[0250] Determine again whether the number of remaining nodes after pruning meets the second preset threshold condition. For example, determine whether the ratio of the number of remaining metadata nodes to the number of all metadata nodes before pruning is less than or equal to a preset ratio, such as 90%. Here, the total number of cached metadata nodes before pruning is 14. After pruning 3 nodes, the number of remaining nodes is 11. The ratio of the number of remaining metadata nodes to the number of metadata nodes cached before pruning is 11 / 14, which is approximately 78.5%, less than 90%. This indicates that this pruning meets the second preset threshold condition, and the pruning ends.

[0251] If this pruning still does not meet the second preset threshold condition, then it is possible to target other nodes outside the nodes of the current branch.

[0252] In the embodiments of the present application, when the metadata cache data meets the first preset threshold condition, by reasonably pruning the metadata cache data, the occupancy of the metadata cache data in the device memory is controlled to achieve the purpose of saving space; and during the pruning process, the directories being accessed by the user are not affected.

[0253] It should be understood that although the steps in the flowcharts in the above embodiments are displayed in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.

[0254] It can be understood that in order to implement the above functions, the electronic device includes the corresponding hardware and / or software modules for executing each function. Combining the algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the manner of hardware or computer software driving hardware depends on the specific application and design constraint conditions of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to exceed the scope of the present application.

[0255] As described above in conjunction with Figures 1 to 12 , the data processing method, software system, and hardware system provided by the present application are described. Next, in conjunction with Figure 13 and Figure 14, describe the chip system of the electronic device to which this application is applicable. It should be understood that the chip system in the embodiments of this application can execute various methods of the foregoing embodiments of this application, that is, the specific working processes of the following various products can refer to the corresponding processes in the foregoing method embodiments.

[0256] Figure 13 It is a schematic structural diagram of an electronic device provided by an embodiment of this application. The electronic device 1000 includes a processing module 1010.

[0257] Among them, the processing module 1010 is used to: in response to a first operation, when the metadata cache data meets the first preset threshold condition, perform device pruning to cut off the unmounted nodes of non-currently accessed devices; the metadata cache data is a cache object corresponding to the metadata list in multiple second electronic devices in the first electronic device.

[0258] It should be noted that the above electronic device 1000 is embodied in the form of functional units. The term "module" here can be implemented in software and / or hardware forms, and no specific limitation is made thereto.

[0259] For example, the "module" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a proprietary processor, or a group of processors, etc.) for executing one or more software or firmware programs, and a memory, a combined logic circuit, and / or other suitable components that support the described functions.

[0260] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0261] Figure 14 Shows a schematic structural diagram of an electronic device provided by this application. Figure 14 The dashed line in indicates that the unit or the module is optional, and the electronic device 1100 can be used to implement the data processing method described in the foregoing method embodiments.

[0262] The electronic device 1100 includes one or more processors 1101, and the one or more processors 1101 can support the electronic device 1100 to implement the methods in the method embodiments. The processor 1101 can be a general-purpose processor or a dedicated processor. For example, the processor 1101 can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, such as discrete gate, transistor logic devices, or discrete hardware components.

[0263] The processor 1101 can be used to control the electronic device 1100, execute software programs, and process the data of software programs. The electronic device 1100 can also include a communication unit 1105 for implementing signal input (reception) and output (transmission).

[0264] For example, the electronic device 1100 can be a chip, and the communication unit 1105 can be the input and / or output circuit of the chip, or the communication unit 1105 can be the communication interface of the chip, and the chip can be a component of the electronic device or other electronic devices.

[0265] For another example, the electronic device 1100 can be an electronic device, and the communication unit 1105 can be the transceiver of the electronic device, or the communication unit 1105 can be the transceiver circuit of the electronic device.

[0266] The electronic device 1100 can include one or more memories 1102, on which there is a program 1104. The program 1104 can be run by the processor 1101 to generate instructions 1103, so that the processor 1101 executes the data processing method described in the above method embodiments according to the instructions 1103.

[0267] Optionally, data can also be stored in the memory 1102. Optionally, the processor 1101 can also read the data stored in the memory 1102. The data can be stored at the same storage address as the program 1104, or the data can be stored at a different storage address from the program 1104.

[0268] The processor 1101 and the memory 1102 can be set separately or integrated together; for example, integrated on a system on chip (SOC) of the electronic device.

[0269] Exemplarily, the memory 1102 can be used to store the relevant program 1104 of the data processing method provided in the embodiments of the present application. The processor 1101 can be used to call the relevant program 1104 of the data processing method stored in the memory 1102 during the upgrade and execute the data processing method of the embodiments of the present application. For example: in response to the first operation, when the metadata cache data meets the first preset threshold condition, pruning is performed according to the device, and the non-mounted nodes of the non-current access device are pruned; the metadata cache data is the cache object corresponding to the metadata list in multiple second electronic devices in the first electronic device.

[0270] The present application also provides a computer program product, which implements the data processing method described in any method embodiment of the present application when executed by the processor 1101.

[0271] This computer program product can be stored in the memory 1102, for example, it is the program 1104. The program 1104 is finally converted into an executable target file that can be executed by the processor 1101 through processes such as preprocessing, compilation, assembly, and linking.

[0272] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the computer, it implements the data processing method described in any method embodiment of the present application. This computer program can be a high-level language program or an executable target program.

[0273] Optionally, the computer-readable storage medium is, for example, the memory 1102. The memory 1102 may be a volatile memory or a non-volatile memory, or the memory 1102 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0274] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes and the technical effects generated by the above-described devices and apparatuses can refer to the corresponding processes and technical effects in the foregoing method embodiments, and will not be described herein again.

[0275] In several embodiments provided in the present application, the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, some features of the above-described method embodiments can be ignored or not executed. The above-described apparatus embodiments are merely illustrative. The division of units is only a logical function division, and there may be other division methods in actual implementation. Multiple units or components can be combined or integrated into another system. In addition, the coupling between units or the coupling between components can be a direct coupling or an indirect coupling. The above couplings include electrical, mechanical, or other forms of connection.

[0276] It should be understood that in various embodiments of the present application, the sequence numbers of the various processes do not imply the order of execution, and the order of execution of the various processes should be determined by their functions and internal logics, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0277] In addition, the terms "system" and "network" are often used interchangeably in this document. The term "and / or" in this document is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this document generally represents an "or" relationship between the associated objects before and after.

[0278] In summary, the above description is only a preferred embodiment of the technical solution of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data processing method, characterized in that, Applied to a first electronic device, the method includes: In response to a first operation, when the metadata cache data meets a first preset threshold condition, pruning is performed according to the device, and non-mounted nodes of non-currently accessed devices are pruned; The metadata cache data is a cache object corresponding to a metadata list in a plurality of second electronic devices in the first electronic device.

2. The data processing method according to claim 1, wherein The first preset threshold condition is that the memory occupancy of the metadata cache data is greater than or equal to the target occupancy.

3. The data processing method according to claim 1, characterized in that, The first preset threshold condition is that the metadata nodes accessed by the first operation are equal to a first threshold number of metadata nodes.

4. The data processing method according to claim 3, wherein The pruning according to the device and pruning non-mounted nodes of non-currently accessed devices includes: pruning all non-mounted nodes of non-currently accessed devices.

5. The data processing method according to claim 3, wherein The pruning according to the device and pruning non-mounted nodes of non-currently accessed devices includes: Pruning is performed in descending order of the levels of the metadata nodes of the non-currently accessed device, and non-mounted nodes of a preset number of levels of the non-currently accessed device are pruned; Determine whether the number of remaining metadata nodes after pruning meets a second preset threshold condition; When not satisfied, the above steps are looped to perform pruning until all non-mounted nodes of the non-currently accessed device are pruned.

6. The data processing method according to any one of claims 1 to 5, characterized in that When the number of remaining metadata nodes does not meet the second preset threshold condition after pruning non-mounted nodes of the non-currently accessed device, the method further includes: Pruning is performed according to the level of the currently accessed node of the currently accessed device.

7. The data processing method according to claim 6, wherein Pruning according to the level of the currently accessed node of the currently accessed device includes: Pruning non-current branches, sibling nodes of non-mounted nodes at two levels different from the level where the currently accessed node is located, and their child nodes.

8. The data processing method according to claim 7, wherein When the number of remaining metadata nodes does not meet the second preset threshold condition after pruning non-current branches, sibling nodes of non-mounted nodes at two levels different from the level where the currently accessed node is located, and their child nodes, the method further includes: Pruning non-current branches, sibling nodes of non-mounted nodes at five levels different from the level where the currently accessed node is located, and their child nodes.

9. The data processing method according to claim 8, characterized in that, When the number of remaining metadata nodes does not meet the second preset threshold condition after pruning non-current branches, sibling nodes of non-mounted nodes at five levels different from the level where the currently accessed node is located, and their child nodes, the method further includes: Pruning metadata nodes of non-current branches.

10. The data processing method according to any one of claims 1 to 9, characterized in that, The first operation is an open operation for a directory in a file management application.

11. An electronic device, characterized in that, Including a processor and a memory; The memory is used to store a computer program that can run on the processor; The processor is used to execute the data processing method according to any one of claims 1 to 10.

12. A chip system, characterized in that, Including: a processor, configured to call and run a computer program from a memory, so that a device installed with the chip executes the data processing method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to execute the data processing method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Data processing method and related equipment

    CN109033365A

  • Metadata storage method, device and apparatus, and computer-readable storage medium

    CN109376125A

  • Metadata processing method and related equipment

    CN115437836A

  • Metadata management method and related component

    CN116450590A

  • Data clipping method and device, computer equipment and storage medium

    CN117194026A