Data storage method and electronic device

By intelligently selecting storage devices and dynamically adjusting data storage locations, the problem of low utilization of multiple storage devices on terminal devices is solved, extending device life and improving storage speed and user experience.

WO2024212924A1PCT designated stage expired Publication Date: 2024-10-17HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/086574
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-14
Filing Date
2024-04-08
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

It is difficult to effectively improve the utilization rate of multiple storage devices on terminal devices with existing technology. The busy status and lifespan of storage devices are not fully utilized, resulting in slow storage speed and shortened device lifespan.

Method used

By obtaining the busy index and remaining read, write and erase times of the storage device, intelligently select the device to store the data, dynamically adjust the data storage location, use fast devices to store commonly used application data, use slow devices to store less commonly used application data, and save the data to disk. Then periodically migrate the storage location.

Benefits of technology

It extends the service life of storage devices, increases data storage speed, makes full use of the performance of storage devices, and improves user experience and storage device utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024086574_17102024_PF_FP_ABST
    Figure CN2024086574_17102024_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a data storage method and an electronic device. The method is applied to an electronic device, and the electronic device comprises at least two storage devices, the at least two storage devices comprising a first storage device and a second storage device. The method comprises: before storing application data, the electronic device may determine, on the basis of busyness indexes and / or service lives of the different storage devices, and / or the application type of an application and device types of the different storage devices, from amongst the multiple storage devices one storage device for storing the application data; and, after storing the application data, the electronic device may also implement dynamic migration of an application data storage position on the basis of the application type of the application and / or the use frequency of data in the application. Using the method improves utilization rates of different storage devices.
Need to check novelty before this filing date? Find Prior Art

Description

Data storage method and electronic device

[0001] This application claims priority to the Chinese patent application with application number 202310417841.1 filed with the State Intellectual Property Office of China on April 14, 2023, and priority to the Chinese patent application with the invention name “A Data Storage Method and Electronic Device”, all contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of electronic technology, and in particular to a data storage method and electronic equipment. Background Art

[0003] With the development of terminal technology, more and more applications are installed on terminal devices, and the application data generated by terminal devices during operation is also increasing. To increase the storage space of terminal devices, multiple storage devices can be pre-installed on a terminal device. How to improve the utilization of multiple storage devices on a terminal device requires further research.

[0004] Summary of the Invention

[0005] The present application provides a data storage method and electronic device, which improve the utilization rate of multiple storage devices on a terminal device.

[0006] In a first aspect, the present application provides a data storage method, which is applied to an electronic device, wherein the electronic device includes at least two storage devices, and the at least two storage devices include a first storage device and a second storage device. The method includes: the electronic device obtains a first write data request, and the first write data request is used to store the first data in a first application; the electronic device obtains a busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, and a busy index of the second storage device and / or the remaining read, write and erase times of the second storage device, the busy index is used to indicate the busy status of the first storage device and the second storage device, and the remaining read, write and erase times are used to indicate the lifespan of the first storage device and the second storage device; in response to the first write data request, the electronic device determines that the storage device storing the first data is the first storage device based on the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device; the electronic device stores the first data in the first storage device.

[0007] In a possible implementation, the electronic device may determine that the storage device storing the first data is the first storage device only based on the busy index of the first storage device and the busy index of the second storage device.

[0008] In other possible implementations, the electronic device may also determine that the storage device storing the first data is the first storage device based solely on the remaining read, write, and erase counts of the first storage device and the remaining read, write, and erase counts of the second storage device.

[0009] In other possible implementations, the electronic device may also determine that the storage device storing the first data is the first storage device based on the busy index of the first storage device and the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and the remaining read, write and erase times of the second storage device.

[0010] Here, the remaining number of read, write, and erase cycles of the storage device may be referred to as the lifespan of the storage device.

[0011] With this method, when an electronic device includes multiple storage devices, before storing application data, the electronic device can select a storage device based on the busy index and / or lifespan of the multiple storage devices. This can extend the service life of the multiple different storage devices and also speed up the storage of the first data.

[0012] In combination with the first aspect, in a possible implementation method, the electronic device obtains the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device, specifically including: when the installation duration of the first application is greater than the first duration or less than the first duration, the electronic device obtains the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device.

[0013] In this way, there is no need to consider the installation time of the application. This solution is applicable to both newly installed applications and applications that have been installed for a long time.

[0014] In combination with the first aspect, in a possible implementation, the method also includes: the electronic device obtains a second write data request, the second write data request is used to store second data in the second application; the electronic device obtains an application type of the second application, the application type of the second application includes a frequently used application or an infrequently used application, a frequently used application is an application whose cumulative usage time within a certain period of time is greater than the second period of time, and an infrequently used application is an application whose cumulative usage time within a certain period of time is less than the second period of time; the electronic device obtains a reading speed of the first storage device and a reading speed of the second storage device, and based on the reading speed of the first storage device and the reading speed of the second storage device, determines the device type of the first storage device and the second storage device, the device type of the storage device including a fast device and a slow device; when the second application is a fast application, the first storage is set to a fast device, and the second storage device is a slow device, the electronic device determines that the storage device storing the second data is the first storage device.

[0015] In some embodiments, the first duration may be the same as or different from the second duration.

[0016] In this way, for applications that have been downloaded for a long time, the application type of the application can be determined. For such applications, the electronic device can store the data in the application in the corresponding storage device according to the type of application and the reading speed of the device. That is, the data in applications that the user frequently uses is stored in a storage device with a fast reading speed, and the data in applications that the user does not frequently use is stored in a storage device with a slow reading speed. On the one hand, the performance of the storage device can be fully utilized. On the other hand, for applications that the user frequently uses, the user expects that when loading data in a fast application, the electronic device 100 can read the data from the fast device faster and load it out to display it to the user for viewing or use, which can improve the user experience.

[0017] In combination with the first aspect, in a possible implementation method, the electronic device obtains the application type of the second application and the reading speed of the first storage device and the reading speed of the second storage device, specifically including: when the installation time of the second application is longer than the first time, the electronic device obtains the application type of the second application and the reading speed of the first storage device and the reading speed of the second storage device.

[0018] In this way, it is necessary to consider the installation time of the application. This solution can be applied to applications that have been installed for a long time.

[0019] In combination with the first aspect, in a possible implementation, the electronic device stores the first data in a first storage device, specifically including: when the first data is non-media data, the electronic device stores the first data in the first storage device.

[0020] In combination with the first aspect, in a possible implementation manner, the method further includes: when the first data is media data, the electronic device stores the first data in a second storage device.

[0021] Before obtaining the busy index of the first storage device and / or the remaining read, write, and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write, and erase times of the second storage device, or before obtaining the application type of the application and the device type of the storage device, it is possible to first determine whether the application data is media data or non-media data. In the case that the application data is non-media data, the media data can be directly stored in the slow device. This is because media data does not require a high speed for data reading. Avoid storing media data in a fast device, which takes up the storage space of the fast device. In the case that the application data is non-media data, before obtaining the busy index of the first storage device and / or the remaining read, write, and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write, and erase times of the second storage device, or after obtaining the application type of the application and the device type of the storage device, it is possible to determine the storage device that stores non-media data.

[0022] In combination with the first aspect, in a possible implementation, after the electronic device stores the first data in the first storage device, the method further includes: the electronic device sends the first data to the second storage device, and stores the first data in the second storage device.

[0023] In this way, after the data is stored in the disk, the storage location of the application data can be migrated periodically / in real time / irregularly according to preset rules, thereby improving the utilization rate of the storage device.

[0024] In combination with the first aspect, in a possible implementation method, the electronic device sends the first data to the second storage device, specifically including: the electronic device obtains the application type of the first application; when the application type of the first application is an infrequently used application, the electronic device sends the first data to the second storage device.

[0025] In combination with the first aspect, in a possible implementation, the method further includes: when the application type of the first application is a common application, the electronic device continues to store the first data in the first storage device.

[0026] In this way, after the data is stored, the type of application can be counted to determine whether to migrate the storage location of the application data. The data of fast and frequently used applications can be dynamically stored on fast devices, and the data of slow applications can be stored on slow devices.

[0027] In combination with the first aspect, in a possible implementation method, when the application type of the first application is a commonly used application, the electronic device continues to store the first data in the first storage device, specifically including: when the application type of the first application is a commonly used application, the electronic device obtains the cumulative usage time of the first data within a certain period of time; when the cumulative usage time of the first data within a certain period of time is greater than a third period of time, the electronic device stores the first data in the second storage device.

[0028] In combination with the first aspect, in a possible implementation, the method further includes: when the cumulative usage time of the first data within a certain time period is less than a third time period, the electronic device continues to store the first data in the first storage device.

[0029] Because the application data in frequently used applications is not all frequently used data. The application data in infrequently used applications are all infrequently used data.

[0030] In this way, the electronic device can first count the application types, then count the types of data in commonly used applications. It can then determine which data in commonly used applications needs to be migrated. This can reduce the amount of computation required by the electronic device and improve the accuracy of data storage location migration.

[0031] In conjunction with the first aspect, in one possible implementation, the busy index of the first storage device includes a first busy state value and a first busy degree value, and the busy index of the second storage device includes a second busy state value and a second busy degree value;

[0032] The electronic device determines that the storage device storing the first data is the first storage device, specifically including:

[0033] In the case where the remaining read, write and erase times of the first storage device are greater than the remaining read, write and erase times of the second storage device, the first busy state value is less than the preset busy state value, and the electronic device determines that the storage device storing the first data is the first storage device; or, in the case where the remaining read, write and erase times of the first storage device are greater than the remaining read, write and erase times of the second storage device, the first busy state value is greater than the preset busy state value, but the first busy level value is less than the second busy level value, and the electronic device determines that the storage device storing the first data is the first storage device; or, in the case where the remaining read, write and erase times of the first storage device are less than the remaining read, write and erase times of the second storage device, the second busy state value is greater than the preset busy state value, but the first busy level value is less than the second busy level value, and the electronic device determines that the storage device storing the first data is the first storage device.

[0034] In a second aspect, the present application provides an electronic device, comprising: one or more processors and at least two memories; the at least two memories are coupled to the one or more processors, and the at least two memories are used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute a data storage method provided in any possible implementation of the first aspect above.

[0035] In a third aspect, the present application provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes a data storage method provided in any possible implementation of the first aspect above.

[0036] In a fourth aspect, the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute a data storage method provided in any possible implementation of the first aspect.

[0037] For the beneficial effects of the second to fourth aspects, reference may be made to the description of the beneficial effects in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] FIG1 is a schematic diagram of storing data generated by an application on a storage device according to an embodiment of the present application;

[0039] FIG2 is a schematic structural diagram of an electronic device 100 provided in an embodiment of the present application;

[0040] FIG3 shows a schematic diagram of a system architecture of a storage device selection strategy before application data storage provided by the present application;

[0041] FIG4 shows a schematic diagram of a system architecture of another storage device selection strategy before application data storage provided by the present application;

[0042] FIG5 shows a schematic diagram of the system architecture of a storage path update strategy after application data storage provided by the present application;

[0043] FIG6A is a flow chart of a method for selecting a storage device before applying data storage according to an embodiment of the present application;

[0044] FIG6B is a schematic diagram of a write data request queue provided in an embodiment of the present application;

[0045] 7A is a flow chart of another method for selecting a storage device before applying data storage according to an embodiment of the present application;

[0046] 7B-7F are schematic diagrams of a set of data storage provided in an embodiment of the present application;

[0047] FIG8A is a flow chart of a method for applying a storage path update strategy after data storage according to an embodiment of the present application;

[0048] 8B-8D are another set of data storage schematic diagrams provided in an embodiment of the present application;

[0049] FIG9A is a flow chart of another method for updating a storage path strategy after application data storage provided by an embodiment of the present application;

[0050] 9B-9D are another set of data storage schematic diagrams provided in an embodiment of the present application;

[0051] 9E-9I are another set of data storage schematic diagrams provided in an embodiment of the present application;

[0052] FIG10 is a flow chart of a method for implementing data storage location migration provided by the present application;

[0053] FIG11 is a flow chart of a data storage method provided in this application. DETAILED DESCRIPTION

[0054] The following is a clear and detailed description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0055] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.

[0056] The term "user interface (UI)" in the following embodiments of this application refers to the media interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. A common form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.

[0057] In order to increase the storage capacity of an electronic device, multiple storage devices may generally be installed on the electronic device.

[0058] FIG. 1 shows a schematic diagram of storing data generated by an application on a storage device.

[0059] As shown in FIG1 , the first application may generate application data (eg, first data) after use, and the first application may store the first data in a storage device.

[0060] Specifically, the first application may send a first data write request to the file system, where the first data write request is used to instruct the file system to store the first data in the storage device.

[0061] After receiving a first write data request, the file system may determine a first storage device from a plurality of storage devices, where the first storage device is used to store the first data. The file system may determine the first storage device from the plurality of storage devices based on the proportion of stored data. For example, the file system may store application data in either the first storage device or the second storage device at a ratio of 50%. Exemplarily, when the file system receives a second write data request, the file system has already stored the second data corresponding to the second write data request in the second storage device. After receiving the second write data request, the file system receives the first write data request again. In this case, the file system may store the first data in the first storage device.

[0062] After the file system determines that the first data is stored in the first storage device, the file system may send an identifier of the first storage device and a first data write request to the IO scheduling module.

[0063] The IO scheduling module may send the first write data request to the first storage device based on the identifier of the first storage device.

[0064] After receiving the first data write request, the first storage device acquires the first data based on the first data write request and stores the first data in the first storage device.

[0065] As can be seen from the process in Figure 1, the file system determines the target storage device from multiple storage devices based on the proportion of stored data. This method of storing data is relatively simple and does not take into account the performance of the storage device, which cannot improve the utilization rate of the storage device.

[0066] The present application provides a data storage method, which is applied to an electronic device 100 including at least two storage devices. The at least two storage devices may be a first storage device and a second storage device.

[0067] The method may include but is not limited to two storage strategies: a storage device selection strategy before applying data storage and a storage path update strategy after applying data storage.

[0068] The storage device selection policy for application data storage can include but is not limited to the following two implementation methods:

[0069] Method 1: The electronic device 100 may obtain the remaining read, write, and erase times of the first storage device and / or the busy index of the storage device, as well as the remaining read, write, and erase times of the second storage device and / or the busy index of the second storage device. After the electronic device 100 obtains the first write data request of the first application, the electronic device 100 may determine that the storage device is the first storage device based on the remaining read, write, and erase times of the first storage device and / or the busy index of the first storage device, as well as the remaining read, write, and erase times of the second storage device and / or the busy index of the second storage device, and store the first data corresponding to the first write data request in the first storage device.

[0070] In some embodiments, the remaining read, write, and erase times of the first storage device may also be referred to as the lifespan of the first storage device. The remaining read, write, and erase times of the second storage device may also be referred to as the lifespan of the second storage device.

[0071] The busy index of the first storage device may include a busy state value of the first storage device and a busy degree value of the first storage device.

[0072] The busy index of the second storage device may include a busy state value of the second storage device and a busy degree value of the second storage device.

[0073] Determining that the storage device is the first storage device specifically includes:

[0074] Implementation 1: When the remaining read, write, and erase times of the first storage device are greater than the remaining read, write, and erase times of the second storage device, if the busy status value of the first storage device is less than a preset value, it can be determined that the storage device is the first storage device.

[0075] Implementation 2: When the remaining read, write and erase times of the first storage device are greater than the remaining read, write and erase times of the second storage device, if the busy status value of the first storage device is greater than a preset value, but the busy level value of the first storage device is less than the busy level value of the second storage device, it can be determined that the storage device is the first storage device.

[0076] Implementation three: When the remaining read, write and erase times of the first storage device are less than the remaining read, write and erase times of the second storage device, if the busy status value of the second storage device is greater than a preset value, but the busy level value of the first storage device is less than the busy level value of the second storage device, it can be determined that the storage device is the first storage device.

[0077] According to the first approach, before storing the first data generated by the first application, the electronic device 100 can comprehensively determine which storage device to store the first data in based on the busy indexes and lifespans of multiple different storage devices. This can, on the one hand, extend the lifespans of the multiple different storage devices, and on the other hand, speed up the storage of the first data.

[0078] Method 2: The electronic device 100 can obtain the performance of the first storage device and the performance of the second storage device, and determine the device type of the first storage device and the device type of the second storage device. After the electronic device 100 obtains the first write data request of the first application, the electronic device 100 can obtain the application type of the first application. Based on the device type of the first storage device, the device type of the second storage device, and the application type of the first application, the electronic device 100 can determine that the storage device is the first storage device, and store the first data corresponding to the first write data request in the first storage device.

[0079] The performance of the first storage device may refer to a read speed of the first storage device, and the performance of the second storage device may refer to a read speed of the second storage device.

[0080] The device types to which the first storage device and the second storage device belong may include fast devices and slow devices. In some embodiments, a fast device may refer to a storage device having a read speed greater than a preset read speed, and a slow device may refer to a storage device having a read speed less than a preset read speed. In other embodiments, a fast device may refer to a storage device having a faster read speed relative to the other storage devices, and a slow device may refer to a storage device having a slower read speed relative to the other storage devices.

[0081] The application type of the first application may include fast applications and slow applications. A fast application may refer to an application whose cumulative usage time within a certain period is greater than a preset time, while a slow application may refer to an application whose cumulative usage time within a certain period is less than a preset time.

[0082] Determining that the storage device is the first storage device specifically includes:

[0083] When the first application is a fast application and the first storage device is a fast device, the electronic device 100 stores the first data in the first storage device.

[0084] According to the second method, the electronic device 100 can store the data of the application in the corresponding storage device according to the application type. That is, the data of the application frequently used by the user is stored in the storage device with a fast reading speed, and the data of the application infrequently used by the user is stored in the storage device with a slow reading speed. On the one hand, the performance of the storage device can be fully utilized. On the other hand, when the user frequently uses the application and the user expects to load the data in the fast application, the electronic device 100 can read the data from the fast device more quickly and load it for the user to view or use, which can improve the user experience.

[0085] In some embodiments, the electronic device 100 may also comprehensively consider the above-mentioned method 1 and method 2 to determine in which storage device the data is stored.

[0086] In other embodiments, the electronic device 100 may also separately consider the above-mentioned method 1 or method 2 to determine in which storage device the data is stored.

[0087] The storage path update policy after application data storage can include but is not limited to the following implementation methods:

[0088] The electronic device 100 can obtain the performance of the first storage device and the performance of the second storage device, and determine the device type of the first storage device and the device type of the second storage device. For example, the electronic device 100 determines that the first storage device is a fast device and determines that the second storage device is a slow device.

[0089] The electronic device 100 may also determine the type of each application, such as a fast application or a slow application, based on the cumulative usage time of each application on the electronic device 100 within a certain period of time.

[0090] For example, if the electronic device 100 determines that the first application is a slow application, the electronic device 100 may send a message to the first storage device, instructing the first storage device to obtain the application data of the first application stored in the first storage device and send the application data of the first application to the second storage device, so that the second storage device can store the application data of the first application.

[0091] For example, if the electronic device 100 determines that the first application is a quick application, the electronic device 100 may send a message to the second storage device, instructing the second storage device to obtain the application data of the first application stored in the second storage device and send the application data of the first application to the first storage device, so that the first storage device can store the application data of the first application.

[0092] In this way, the fast devices can store data that is frequently used by users, while the full devices can store data that is infrequently used by users, thereby improving the utilization of storage devices with different performances.

[0093] In some embodiments, the cumulative usage time of the data in the application within a certain period of time can also be counted to determine the type of data in the application. Based on the type of data, it is then determined whether the storage location of the data needs to be updated. For details, please refer to the embodiment shown in Figure 9A or the embodiments shown in Figures 9H and 9I.

[0094] In some embodiments, the application type and the data type may be combined to determine whether the storage location of the data in the storage device needs to be updated.

[0095] Referring to FIG. 2 , FIG. 2 shows a schematic structural diagram of an electronic device 100 .

[0096] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device, and / or a smart city device. The embodiments of the present application do not impose any particular restrictions on the specific type of the electronic device.

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

[0098] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

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

[0100] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0101] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

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

[0103] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the electronic device 100.

[0104] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.

[0105] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0106] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.

[0107] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0108] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0109] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.

[0110] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0111] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.

[0112] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0113] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

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

[0115] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0116] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0117] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0118] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

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

[0120] Display screen 194 is used to display images, videos, and the like. 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 MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

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

[0122] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise and brightness. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.

[0123] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion 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 an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0124] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0125] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0126] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0127] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0128] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.

[0129] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage cell potential level; universal flash storage (UFS) and embedded multi media card (eMMC) can be divided into UFS and eMMC according to the storage specification.

[0130] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0131] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0132] In the embodiment of the present application, the number of non-volatile memories may be at least two.

[0133] In some embodiments, different non-volatile memories have different performances, for example, different non-volatile memories have different read and write speeds.

[0134] In other embodiments, the lifespans and busy indices of different non-volatile memories are also different.

[0135] The plurality of non-volatile memories may include a first non-volatile memory and a second non-volatile memory. For example, the first non-volatile memory may be a UFS device, and the second non-volatile memory may be an eMMC device.

[0136] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory.

[0137] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0138] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0139] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0140] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0141] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0142] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0143] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be located on display screen 194. There are many types of pressure sensors 180A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force acts on pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch location based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch location but with different touch intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, a command to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, a command to create a new short message is executed.

[0144] 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., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.

[0145] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.

[0146] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Based on the detected opening and closing status of the case or flip cover, features such as automatic unlocking of the flip cover can be configured.

[0147] Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). It can also detect the magnitude and direction of gravity when electronic device 100 is stationary. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.

[0148] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.

[0149] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user is holding the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0150] Ambient light sensor 180L is used to sense ambient light brightness. Electronic device 100 can adaptively adjust the brightness of display screen 194 based on the perceived ambient light. Ambient light sensor 180L can also be used to automatically adjust white balance when taking photos. Ambient light sensor 180L can also work with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent accidental touches.

[0151] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0152] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the electronic device 100 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to prevent abnormal shutdown due to low temperature.

[0153] The touch sensor 180K is also called a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a location different from that of the display screen 194.

[0154] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals from the vibrating bones of the human body. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure pulse signals. In some embodiments, the bone conduction sensor 180M can also be set in headphones to form bone conduction headphones. The audio module 170 can parse out voice signals based on the vibration signals of the vibrating bones of the human body obtained by the bone conduction sensor 180M to implement voice functions. The application processor can parse heart rate information based on the blood pressure pulse signals obtained by the bone conduction sensor 180M to implement heart rate detection functions.

[0155] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0156] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0157] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0158] The SIM card interface 195 is used to connect a SIM card.

[0159] Next, the corresponding system architectures of the storage device selection strategy before applying data storage and the storage path update strategy after applying data storage are introduced.

[0160] FIG3 shows a schematic diagram of a system architecture of a storage device selection strategy before application data storage provided by the present application.

[0161] The system architecture shown in FIG. 3 may be a system architecture corresponding to a storage device selection strategy provided in the first approach.

[0162] As shown in Figure 3, the system architecture includes a software layer and a hardware layer, wherein the software layer includes an application layer and a kernel layer.

[0163] The application layer may include one or more applications, for example, the application layer may include a first application. The kernel layer may include a file system and an IO scheduling module.

[0164] The hardware layer may include at least two storage devices, such as a first storage device and a second storage device. The hardware layer may also include other storage devices, which is not limited in this application and is only described with two different storage devices.

[0165] The IO scheduling module is configured to obtain the lifespan of the first storage device from the first storage device, which can also be referred to as the remaining read, write, and erase cycles of the first storage device. The IO scheduling module is configured to obtain the lifespan of the second storage device from the second storage device, which can also be referred to as the remaining read, write, and erase cycles of the second storage device.

[0166] After obtaining the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the second storage device, the IO scheduling module is also used to send the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the second storage device to the file system so that the file system can determine the storage location of the data.

[0167] After generating application data (e.g., first data) during use of a first application, the first application needs to store the first data in a storage device. Specifically, the first application may send a first data write request to a file, where the first data write request is used to instruct the file system to determine which storage device stores the first data.

[0168] A file system is configured to receive a first data write request sent by a first application. In response to the first data write request, the file system is further configured to send the first data write request to an I / O scheduling module, so that the I / O scheduling module can obtain busy indexes of the first storage device and the second storage device, and send the busy indexes of the first storage device and the second storage device to the file system, so that the file system can determine which storage device stores the first data based on the lifespan of the first storage device and the second storage device and / or the busy indexes of the first storage device and the second storage device.

[0169] The busy index of the first storage device may include a busy state value of the first storage device and a busy degree value of the first storage device.

[0170] The busy index of the second storage device may include a busy state value of the second storage device and a busy degree value of the second storage device.

[0171] The IO scheduling module is further configured to obtain the busy index of the first storage device from the first storage device and obtain the busy index of the second storage device from the second storage device in response to the first data write request.

[0172] After obtaining the busy index of the first storage device and the busy index of the second storage device, the IO scheduling module is further configured to send the busy index of the first storage device and the busy index of the second storage device to the file system.

[0173] The file system is further used to determine the storage device storing the first data based on the remaining read, write and erase times of the first storage device and the remaining read, write and erase times of the second storage device, and / or the busy index of the first storage device and the busy index of the second storage device after obtaining the remaining read, write and erase times of the first storage device and the busy index of the first storage device, as well as the remaining read, write and erase times of the second storage device and the busy index of the second storage device.

[0174] In one possible implementation, the file system may determine the storage device storing the first data based solely on the remaining read, write, and erase counts of the first storage device and the remaining read, write, and erase counts of the second storage device. In this case, steps 6, 7, and 8 shown in FIG. 3 may not be performed.

[0175] In other possible implementations, the file system may also determine the storage device storing the first data based solely on the busy index of the first storage device and the busy index of the second storage device. In this case, "step 1," "step 2," and "step 3" shown in FIG3 may not be performed.

[0176] In other possible implementations, the file system may also determine the storage device storing the first data based on the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the second storage device, as well as the busy index of the first storage device and the busy index of the second storage device.

[0177] As to how the file system determines the storage device storing the first data, reference may be made to the description in the embodiment of FIG6A , and this application does not make any limitation thereto.

[0178] Exemplarily, the file system may determine that the storage device storing the first data may be the first storage device.

[0179] The file system is further configured to send an identifier of the first storage device to the IO scheduling module after determining that the storage device storing the first data may be the first storage device.

[0180] The IO scheduling module is further configured to respond to the identifier of the first storage device sent by the file system and send the first write data request to the first storage device based on the identifier of the first storage device.

[0181] The first storage device is configured to, in response to the first data write request, obtain first data corresponding to the first data write request and store the first data in the first storage device.

[0182] It should be noted that one or more steps shown in the embodiment of FIG3 can be combined into one step for execution, and this application does not limit the execution order of one or more steps shown in the embodiment of FIG3.

[0183] FIG4 shows a schematic diagram of a system architecture of another storage device selection strategy before applying data storage provided by the present application.

[0184] The system architecture shown in FIG. 4 may be a system architecture corresponding to a storage device selection strategy provided in the second approach.

[0185] As shown in Figure 4, the system architecture includes a software layer and a hardware layer. The software layer includes an application layer, an application architecture layer, and a kernel layer.

[0186] The application layer may include one or more applications, for example, the application layer may include a first application. The application architecture layer may include an application classification module. The kernel layer may include a file system and an IO scheduling module.

[0187] The hardware layer may include at least two storage devices, such as a first storage device and a second storage device. The hardware layer may also include other storage devices, which is not limited in this application and is only described with two different storage devices.

[0188] The IO scheduling module is configured to obtain the performance of the first storage device from the first storage device, which can also be referred to as the read and write speed of the first storage device, and obtain the performance of the second storage device from the second storage device, which can also be referred to as the read and write speed of the second storage device.

[0189] After obtaining the performance of the first storage device and the performance of the second storage device, the IO scheduling module is further configured to send the performance of the first storage device and the remaining performance of the second storage device to the file system so that the file system can determine the storage location of the data.

[0190] The application classification module is used to classify the applications installed on the electronic device 100 and divide one or more applications into fast applications or slow applications. In some embodiments, fast applications can also be called commonly used applications.

[0191] A fast application may refer to an application whose cumulative usage time within a certain period is greater than a preset time. A slow application may refer to an application whose cumulative usage time within a certain period is less than a preset time. For example, the file system may determine that the type of the first application is a fast application.

[0192] The application classification module is further configured to, after determining that the type of the first application is a quick application, send a message indicating that the type of the first application is a quick application to the file system.

[0193] After generating application data (e.g., first data) during use of a first application, the first application needs to store the first data in a storage device. Specifically, the first application may send a first data write request to a file, where the first data write request is used to instruct the file system to determine which storage device stores the first data.

[0194] The file system is configured to receive a first data write request sent by a first application.

[0195] The file system is further configured to, in response to the first data write request, determine that the storage device storing the first data is the first storage device based on the type of the first application, the performance of the first storage device, and the performance of the second storage device.

[0196] Specifically, the file system may determine the device types to which the first storage device and the second storage device belong based on the performance of the first storage device and the performance of the second storage device. The device types to which the first storage device and the second storage device belong may include fast devices and slow devices. In some embodiments, a fast device may refer to a storage device having a read speed greater than a preset read speed, and a slow device may refer to a storage device having a read speed less than a preset read speed. In other embodiments, a fast device may refer to a device having a faster relative read speed among storage devices, and a slow device may refer to a device having a slower relative read speed among storage devices. For example, the file system may determine that the first storage device is a fast device and the second storage device is a slow device.

[0197] When it is determined that the type of the first application is a fast application, the first storage device is a fast device, and the second storage device is a slow device, the file system may determine that the storage device storing the first data is the first storage device.

[0198] In other possible embodiments, when it is determined that the first application is a slow application, the first storage device is a fast device, and the second storage device is a slow device, the file system may determine that the storage device storing the first data is the second storage device.

[0199] Illustratively, after the file system determines that the storage device storing the first data is the first storage device, the file system may send the first data write request and the identifier of the first storage device to the IO scheduling module.

[0200] The IO scheduling module is further configured to respond to the first write data request sent by the file system and the identifier of the first storage device, and send the first write data request to the first storage device based on the identifier of the first storage device.

[0201] The first storage device is configured to, in response to the first data write request, obtain first data corresponding to the first data write request and store the first data in the first storage device.

[0202] It should be noted that one or more steps shown in the embodiment of FIG. 4 may be combined into one step for execution, and this application does not limit the execution order of one or more steps shown in the embodiment of FIG. 4 .

[0203] FIG5 shows a schematic diagram of a system architecture of another storage path update strategy after application data storage provided by the present application.

[0204] As shown in Figure 5, the system architecture includes a software layer and a hardware layer, wherein the software layer includes an application architecture layer and a kernel layer.

[0205] The application architecture layer may include an application classification module.

[0206] The kernel layer may include a file system and an IO scheduling module.

[0207] The hardware layer may include at least two storage devices, such as a first storage device and a second storage device. The hardware layer may also include other storage devices, which is not limited in this application and is only described with two different storage devices.

[0208] The IO scheduling module is configured to obtain the performance of the first storage device from the first storage device, which can also be referred to as the read and write speed of the first storage device, and obtain the performance of the second storage device from the second storage device, which can also be referred to as the read and write speed of the second storage device.

[0209] After obtaining the performance of the first storage device and the performance of the second storage device, the IO scheduling module is further configured to send the performance of the first storage device and the remaining performance of the second storage device to the file system so that the file system can determine the storage location of the data.

[0210] The file system is used to determine the device types of the first storage device and the second storage device based on the performance of the first storage device and the remaining performance of the second storage device after receiving the performance of the first storage device and the remaining performance of the second storage device sent by the IO scheduling module.

[0211] The device types to which the first storage device and the second storage device belong may include fast devices and slow devices. In some embodiments, a fast device may refer to a storage device having a read speed greater than a preset read speed, and a slow device may refer to a storage device having a read speed less than a preset read speed. In other embodiments, a fast device may refer to a storage device having a faster read speed relative to the other storage devices, and a slow device may refer to a storage device having a slower read speed relative to the other storage devices.

[0212] Illustratively, the file system may determine that the first storage device is a fast device and the second storage device is a slow device.

[0213] The application classification module is used to classify the applications installed on the electronic device 100 and divide one or more applications into fast applications or slow applications. In some embodiments, fast applications can also be called commonly used applications.

[0214] A fast application may refer to an application whose cumulative usage time within a certain period is greater than a preset time. A slow application may refer to an application whose cumulative usage time within a certain period is less than a preset time. For example, the file system may determine that the type of the first application is a fast application.

[0215] The application classification module is further configured to, after determining that the type of the first application is a quick application, send a message indicating that the type of the first application is a quick application to the file system.

[0216] The file system is further used to, after receiving a message indicating that the type of the first application is a quick application, send the identifier of the second storage device, the identifier of the first application, and a first notification to the IO scheduling module based on the type of the first application, the device types to which the first storage device and the second storage device belong, wherein the first notification is used to instruct the second storage device to send the application data of the first application stored in the second storage device to the first storage device and store it in the first storage device.

[0217] It should be noted that the identifier of the first application can be carried in the first notification and sent to the IO scheduling module, or the identifier of the first application can be sent to the IO scheduling module separately from the first notification. This application does not limit this.

[0218] In other embodiments, when the file system determines that the type of the second application is a slow application, the first storage device is a fast device, and the second storage device is a slow device, the file system can send the identifier of the first storage device, the identifier of the second application, and a second notification to the IO scheduling module. The second notification is used to instruct the first storage device to send the application data of the second application stored in the first storage device to the second storage device and store it in the second storage device.

[0219] The IO scheduling module is further configured to, after receiving the identifier of the second storage device and the first notification, send the first notification to the second storage device based on the identifier of the second storage device.

[0220] The second storage device is configured to obtain the data in the first application after receiving the first notification, and send the data in the first application to the first storage device.

[0221] The first storage device is configured to store the data in the first application after receiving the data in the first application.

[0222] In this way, it can be achieved that the fast device stores the application data of the fast application, and the slow device stores the application data of the slow application.

[0223] It should be noted that one or more steps shown in the example of FIG. 5 can be combined into one step for execution, and this application does not limit the execution order of one or more steps shown in the example of FIG. 5 .

[0224] In some embodiments, the cumulative usage time of the data in the application within a certain period of time can also be counted to determine the type of data in the application. Based on the type of data, it is then determined whether the storage location of the data needs to be updated. For details, please refer to the embodiment shown in Figure 9A or the embodiments shown in Figures 9H and 9I.

[0225] In some embodiments, the application type and the data type may be combined to determine whether the storage location of the data in the storage device needs to be updated.

[0226] Next, the specific implementation of the storage device selection strategy before applying data storage and the storage path update strategy after applying data storage are introduced.

[0227] FIG6A shows a flow chart of a method for applying a storage device selection strategy before data storage.

[0228] The method flow shown in FIG. 6A may be a method flow corresponding to a storage device selection strategy provided in the first approach.

[0229] The method can be applied to an electronic device 100, which may include a first application, a file system, and an IO scheduling module. The electronic device 100 may also include a first storage device and a second storage device.

[0230] The first application, the file system, and the IO scheduling module may be software modules. The first storage device and the second storage device may be hardware devices. In the present application, the software module and the hardware device may work together to implement a storage device selection strategy provided in the present application.

[0231] S601: A first storage device sends the remaining read, write, and erase times of the first storage device to an IO scheduling module.

[0232] S602: The second storage device sends the remaining read, write, and erase times of the second storage device to the IO scheduling module.

[0233] The remaining read, write, and erase cycles of a storage device are also referred to as its lifespan or usable lifespan. After leaving the factory, the total number of read, write, and erase cycles is fixed. As a storage device ages, its total number of read, write, and erase cycles gradually decreases. This remaining number can be used to estimate the lifespan of a storage device.

[0234] The first storage device may obtain the remaining read, write, and erase times of the first storage device, and send the remaining read, write, and erase times of the first storage device to the IO scheduling module.

[0235] The second storage device may obtain the remaining read, write, and erase times of the second storage device, and send the remaining read, write, and erase times of the second storage device to the IO scheduling module.

[0236] In some embodiments, S602 may also be performed before S601 .

[0237] S603: The IO scheduling module sends the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the second storage device to the file system.

[0238] In this way, the file system can obtain the lifespans of the first storage device and the second storage device, so that the location for storing application data can be determined based on the lifespans of the first storage device and the second storage device.

[0239] It should be noted that the lifespan of the first storage device and the second storage device may change, and S601-S603 may be executed periodically, irregularly, or at regular intervals, so that the file system can obtain updated remaining read, write, and erase counts of the first storage device and the second storage device.

[0240] S604: The first application sends a first data write request to the file system.

[0241] After the first application is started, the first application generates application data. Before saving the application data to the storage device, the first application can send a first write data request to the file system so that the file system can determine which storage device stores the application data in the first application.

[0242] S605: The file system sends a first data write request to the IO scheduling module.

[0243] After receiving the first data write request from the first application, the file system may send the first data write request to the IO scheduling module, so that the IO scheduling module obtains the busy indexes of the first storage device and the second storage device and sends them to the file system.

[0244] S606: The IO scheduling module sends a first message to the first storage device.

[0245] S607: The IO scheduling module sends a second message to the second storage device.

[0246] Optionally, S607 may also be executed before S606.

[0247] In response to the first data write request sent by the file system, the IO scheduling module may send a first message to the first storage device and a second message to the second storage device respectively to obtain busy indexes of the first storage device and the second storage device.

[0248] Here, the busy index of the first storage device may include a busy state value of the first storage device and a busy degree value of the first storage device.

[0249] The busy index of the second storage device may include a busy state value of the second storage device and a busy degree value of the second storage device.

[0250] Next, the specific meanings of the busy state value and the busy degree value are explained.

[0251] FIG6B shows two queues in a storage device.

[0252] The two queues are a software queue and a hardware queue, each of which stores one or more write data requests.

[0253] The software queue stores pending write data requests, while the hardware queue stores currently processed write data requests.

[0254] Pending write requests can be understood as write requests that the storage device has just received from an application and that the I / O scheduling module has not yet processed. Pending write requests in the software queue can be read and stored in the hardware queue on a first-in, first-out basis.

[0255] A "processing write data request" can be understood as: the storage device receives the processing write data request from the software queue, obtains application data based on the processing write data request, processes the application data, and then stores it in a storage unit within the storage device. For example, compression processing may be performed to reduce the storage space occupied by the application data. Optionally, the storage device can store multiple write data requests simultaneously.

[0256] After the application data corresponding to the write data request in the hardware queue is stored in the storage unit in the storage device, the storage device can read the pending write data request from the software queue according to the first-in-first-out principle and store it in the hardware queue, so that the storage device can start processing the pending write data request read from the software queue.

[0257] As shown in FIG6B , the pending write data requests included in the software queue may include, but are not limited to, write data request n, write data request n+1, write data request n+2, write data request n+3, write data request n+4, write data request n+5, ..., write data request n+a, where n is a positive integer greater than or equal to 1, and a is a positive integer greater than or equal to 6.

[0258] Write data request n is used to store data n. Write data request n+1 is used to store data n+1. Write data request n+2 is used to store data n+2. Write data request n+3 is used to store data n+3. Write data request n+4 is used to store data n+4. Write data request n+5 is used to store data n+5. Write data request n+a is used to store data n+a.

[0259] As shown in FIG6B , the pending write data requests included in the hardware queue may include, but are not limited to, write data request n-1, write data request n-2, write data request n-3, write data request n-4, write data request n-5, write data request n-6, ..., write data request m, where n is a positive integer greater than or equal to 1, and m is a positive integer greater than or equal to 7.

[0260] Write data request n-1 is used to store data n-1. Write data request n-2 is used to store data n-2. Write data request n-3 is used to store data n-3. Write data request n-4 is used to store data n-4. Write data request n-5 is used to store data n-5. Write data request n-6 is used to store data n-6. Write data request m is used to store data m.

[0261] As shown in Figure 6B, after processing the write data request, the storage device may store the data corresponding to the write data request in a storage unit within the storage device. For example, the storage device stores data m-1, data m-2, data m-3, data m-4, ..., data 4, data 3, data 2, and data 1. Data m-1 corresponds to write data request m-1. Data m-2 corresponds to write data request m-2. Data m-3 corresponds to write data request m-3. Data m-4 corresponds to write data request m-4. Data 4 corresponds to write data request 4. Data 3 corresponds to write data request 3. Data 2 corresponds to write data request 2. Data 1 corresponds to write data request 1.

[0262] It is understandable that each storage device may have the above-mentioned software queue and hardware queue when processing a write data request.

[0263] The busy state value of the storage device can be obtained based on the number of pending write data requests in the software queue and the number of write data requests being processed in the hardware queue. For example, the number of pending write data requests in the software queue is (a+1), and the number of write data requests being processed in the hardware queue is (nm). Then the busy state value of the storage device = (a+1) + (nm).

[0264] The busyness value can be calculated based on the number of pending write requests in the software queue and the number of write requests currently being processed in the hardware queue. For example, if the number of pending write requests in the software queue is (a+1) and the number of write requests currently being processed in the hardware queue is (nm), then the busyness value of the storage device is (a+1) / [a+1)+(nm)].

[0265] The busy status value can reflect whether a single storage device is busy. The busy degree value can reflect the busyness of different storage devices.

[0266] S608: The first storage device sends the first number of write data requests to be processed and the second number of write data requests being processed to the IO scheduling module.

[0267] S609: The second storage device sends the third number of write data requests to be processed and the fourth number of write data requests being processed to the IO scheduling module.

[0268] After receiving the first message sent by the I / O scheduling module, the first storage device may, in response to the first message, obtain a first number of pending write data requests from the software queue and a second number of currently processed write data requests from the hardware queue. The first storage device then sends the first number of pending write data requests and the second number of currently processed write data requests to the I / O scheduling module.

[0269] Similarly, after receiving the second message sent by the I / O scheduling module, the second storage device may, in response to the second message, obtain from the software queue a third number of pending write data requests and obtain from the hardware queue a fourth number of currently processed write data requests. The second storage device then sends the third number of pending write data requests and the fourth number of currently processed write data requests to the I / O scheduling module.

[0270] Optionally, S609 may also be executed before S608.

[0271] S610: The IO scheduling module calculates a first busy state value of the first storage device and a first busy degree value of the first storage device based on the first quantity and the second quantity.

[0272] S611. The IO scheduling module calculates a second busy state value and a second busy degree value of the second storage device based on the third number and the fourth number.

[0273] Please refer to the introduction in S609. When the IO scheduling module receives a first number of pending write data requests and a second number of write data requests being processed sent by the first storage device, the IO scheduling module can calculate a first busy state value and a first busy degree value of the first storage device based on the first number and the second number.

[0274] Similarly, when the IO scheduling module receives a third number of pending write data requests and a fourth number of write data requests being processed sent by the second storage device, the IO scheduling module can calculate the second busy state value of the second storage device and the second busy degree value of the second storage device based on the third number and the fourth number.

[0275] Optionally, S608, S609, S610 and S611 may not be executed, and the first storage device may calculate the first busy state value and the first busy degree value of the first storage device, and the first storage device may directly send the first busy state value and the first busy degree value of the first storage device to the IO scheduling module.

[0276] Similarly, the second storage device calculates a second busy state value and a second busy degree value of the second storage device, and the second storage device directly sends the second busy state value and the first busy degree value of the second storage device to the IO scheduling module.

[0277] S612: The IO scheduling module sends the first busy state value, the first busy level value, the second busy state value, and the second busy level value to the file system.

[0278] After obtaining the first busy state value and the first busy degree value of the first storage device and the second busy state value and the second busy degree value of the second storage device, the IO scheduling module can send the first busy state value and the first busy degree value of the first storage device and the second busy state value and the second busy degree value of the second storage device to the file system.

[0279] It should be noted that S604 to S612 may be executed in real time, that is, only when S604 is executed, S605 to S612 will also be executed.

[0280] S613: The file system needs to determine whether the remaining read, write, and erase times of the first storage device is greater than the remaining read, write, and erase times of the second storage device.

[0281] Optionally, S613 may also be executed before, after, or simultaneously with any step after S603 and before S614, which is not limited in this application.

[0282] After obtaining the remaining read, write, and erase counts of the first storage device and the remaining read, write, and erase counts of the second storage device, before storing the first data, the file system needs to confirm the relationship between the lifespans of the first storage device and the second storage device, and tends to store the first data in the storage device with the longer lifespan to extend the usage time of the storage device with the shorter lifespan.

[0283] The file system needs to determine whether the remaining read, write, and erase counts of the first storage device are greater than the remaining read, write, and erase counts of the second storage device. If the remaining read, write, and erase counts of the first storage device are greater than the remaining read, write, and erase counts of the second storage device, it indicates that the first data has a longer lifespan, and the file system prefers to store the first data in the first storage device. If the remaining read, write, and erase counts of the first storage device are less than the remaining read, write, and erase counts of the second storage device, it indicates that the second data has a longer lifespan, and the file system prefers to store the first data in the second storage device.

[0284] If the remaining read, write, and erase times of the first storage device is greater than the remaining read, write, and erase times of the second storage device, S614 is executed.

[0285] When the remaining read, write, and erase times of the first storage device is less than the remaining read, write, and erase times of the second storage device, S622 is executed.

[0286] S614: The file system needs to determine whether the first busy state value is less than a preset busy state value.

[0287] If the remaining read, write, and erase counts on the first storage device are greater than those on the second storage device, the file system prefers to store the first data on the first storage device. Before determining the storage device, the file system must also determine whether the first storage device is busy or idle. If the first storage device is busy, the file system must also determine the relative busyness of the first and second storage devices and store the first data on the relatively idle storage device.

[0288] When the first busy state value is less than the preset busy state value, S616-S618 are executed, indicating that the first storage device is in an idle state. There is no need to compare the relative busyness of the first storage device and the second storage device, and the first data is directly stored in the first storage device.

[0289] When the first busy state value is greater than the preset busy state value, S615 is executed, indicating that the first storage device is busy. It is necessary to compare the relative busyness of the first storage device and the second storage device, and store the first data in the relatively idle storage device.

[0290] S615: The file system needs to determine whether the first busyness value is less than the second busyness value.

[0291] If the remaining read, write, and erase counts of the first storage device are greater than the remaining read, write, and erase counts of the second storage device, but the first busy state value is greater than the preset busy state value, then the first storage device is also busy. The first busy level value and the second busy level value need to be compared. If the first busy level value is less than the second busy level value, then the first storage device is less busy than the second storage device. Therefore, it can be determined that the first data should be stored in the less busy first storage device to reduce the workload of the busier second storage device and speed up the storage of the first data.

[0292] If the remaining read, write, and erase counts of the first storage device are greater than the remaining read, write, and erase counts of the second storage device, but the first busy state value is greater than the preset busy state value, then the first storage device is also busy. The first busy level value and the second busy level value need to be compared. If the first busy level value is greater than the second busy level value, then the second storage device is less busy than the first storage device. Therefore, it can be determined that the first data should be stored in the less busy second storage device to reduce the workload of the busier first storage device and speed up the storage of the first data.

[0293] When the first busyness level value is less than the second busyness level value, steps S616 to S618 are executed.

[0294] If the first busyness level value is greater than the second busyness level value, steps S619 to S621 are executed.

[0295] S616: The file system sends the identifier of the first storage device to the IO scheduling module.

[0296] S617: The IO scheduling module sends the first data write request to the first storage device.

[0297] S618: The first storage device stores the first data.

[0298] When the file system determines that the storage device storing the first data is the first storage device, the file system may send an identifier of the first storage device to the IO scheduling module.

[0299] After receiving the identifier of the first storage device, the IO scheduling module may send the first write data request to the first storage device based on the identifier of the first storage device.

[0300] In response to the first write data request, the first storage device may obtain the first data corresponding to the first write data request and store the first data in a storage unit within the first storage device.

[0301] S619: The file system sends the identifier of the second storage device to the IO scheduling module.

[0302] S620: The IO scheduling module sends the first write data request to the second storage device.

[0303] S621: The second storage device stores the first data.

[0304] When the file system determines that the storage device storing the first data is the second storage device, the file system may send an identifier of the second storage device to the IO scheduling module.

[0305] After receiving the identifier of the second storage device, the IO scheduling module may send the first write data request to the second storage device based on the identifier of the second storage device.

[0306] In response to the first write data request, the second storage device may obtain the first data corresponding to the first write data request and store the first data in a storage unit within the second storage device.

[0307] S622: The file system needs to confirm whether the second busy state value is less than the preset busy state value.

[0308] When the remaining read, write, and erase times of the first storage device are less than the remaining read, write, and erase times of the second storage device, it indicates that the life of the second data storage is longer, and the file system tends to store the first data in the second storage device.

[0309] Before determining the storage device, the file system needs to determine whether the second storage device is in a busy state or an idle state.

[0310] When the second busy state value is less than the preset busy state value, S623 is executed, indicating that the second storage device is in an idle state. There is no need to compare the relative busyness of the first storage device and the second storage device, and the first data is directly stored in the second storage device.

[0311] When the second busy state value is greater than the preset busy state value, S624 is executed, indicating that the second storage device is busy. It is necessary to compare the relative busyness of the first storage device and the second storage device, and store the first data in the relatively idle storage device.

[0312] S623. Execute S619-S621.

[0313] S624: The file system needs to confirm whether the second busyness value is less than the first busyness value.

[0314] If the remaining read, write, and erase counts of the first storage device are less than the remaining read, write, and erase counts of the second storage device, but the second busy state value is greater than the preset busy state value, then the second storage device is also busy. The first busy level value and the second busy level value need to be compared. If the second busy level value is less than the first busy level value, then the second storage device is less busy than the first storage device. Therefore, it can be determined that the first data should be stored in the less busy second storage device to reduce the workload of the busier first storage device and speed up the storage of the first data.

[0315] If the remaining read, write, and erase counts of the first storage device are less than the remaining read, write, and erase counts of the second storage device, but the first busy state value is greater than the preset busy state value, then the first storage device is also busy. The first busy level value and the second busy level value need to be compared. If the second busy level value is greater than the first busy level value, then the first storage device is less busy than the first storage device. Therefore, it can be determined that the first data should be stored in the less busy first storage device to reduce the workload of the busier second storage device and speed up the storage of the first data.

[0316] If the second busyness level value is smaller than the first busyness level value, S625 is executed.

[0317] If the second busyness level value is greater than the first busyness level value, S626 is executed.

[0318] S625. Execute S619 and S621.

[0319] S626. Execute S616 and S618.

[0320] It should be noted that one or more steps shown in FIG6A may be performed in combination, and this application does not limit the order in which the method steps shown in FIG6A are performed.

[0321] Based on the data storage method provided in the embodiment of FIG6A , the electronic device 100 can comprehensively determine which storage device to store the data in based on the busy indexes and lifespans of multiple different storage devices. This can, on the one hand, extend the lifespans of the multiple different storage devices, and on the other hand, speed up the storage of the first data.

[0322] As can be seen from the embodiment of FIG6A , the method for determining which storage device to store the first data in from among multiple storage devices only needs to consider the lifespan and busyness index of the multiple storage devices, and is unrelated to the first data or the first application that generated the first data. Therefore, this method is applicable to both newly downloaded applications and applications that have been downloaded for a long time.

[0323] FIG. 7A shows a flow chart of another method for applying a storage device selection strategy before data storage.

[0324] The method flow shown in FIG. 7A may be a method flow corresponding to a storage device selection strategy provided in the second approach.

[0325] The method can be applied to the electronic device 100, which can include a first application, a file system, an IO scheduling module, and an application classification module. The electronic device 100 can also include a first storage device and a second storage device.

[0326] The first application, file system, IO scheduling module, and application classification module may be software modules. The first storage device and the second storage device may be hardware devices. In the present application, the software modules and hardware devices may work together to implement a storage device selection strategy provided in the present application.

[0327] S701: A first storage device sends the performance of the first storage device to an IO scheduling module.

[0328] S702: The second storage device sends the performance of the second storage device to the IO scheduling module.

[0329] Optionally, S702 may also be executed before S701.

[0330] S703: The IO scheduling module sends the performance of the first storage device and the performance of the second storage device to the file system.

[0331] The first storage device may send the performance of the first storage device to the IO scheduling module, and the second storage device may also send the performance of the second storage device to the IO scheduling module.

[0332] After acquiring the performance of the first storage device and the performance of the second storage device, the IO scheduling module may send the performance of the first storage device and the performance of the second storage device to the file system.

[0333] The performance of a storage device may include, but is not limited to, the read speed of the storage device.

[0334] In some embodiments, the reading speed of the storage device may be preset before leaving the factory, so S701 to S703 only need to be performed once.

[0335] In other embodiments, the storage device's read speed may vary with usage time. The storage device may obtain the storage device's read speed periodically, irregularly, or at regular intervals, and send the storage device's read speed periodically, irregularly, or at regular intervals to the IO scheduling module. S701-S703 may also be executed periodically, irregularly, or at regular intervals.

[0336] S704: The file system determines, based on the performance of the first storage device and the performance of the second storage device, that the first storage device is a fast device and that the second storage device is a slow device.

[0337] After obtaining the read speed of the first storage device and the read speed of the second storage device, the file system may determine the device types of the first storage device and the second storage device based on the read speed of the first storage device and the read speed of the second storage device.

[0338] The device types to which the first storage device and the second storage device belong may include fast devices and slow devices. In some embodiments, a fast device may refer to a storage device having a read speed greater than a preset read speed, and a slow device may refer to a storage device having a read speed less than a preset read speed. In other embodiments, a fast device may refer to a storage device having a faster read speed relative to the other storage devices, and a slow device may refer to a storage device having a slower read speed relative to the other storage devices. For example, a file system may determine that the first storage device is a fast device and the second storage device is a slow device.

[0339] S704 may be executed only once, or may be executed periodically, irregularly, or at intervals of a certain time.

[0340] S705: The application classification module obtains the cumulative usage time of the first application within a certain period of time.

[0341] S706: The application classification module needs to confirm whether the cumulative usage time of the first application within a certain time period is greater than a preset time period.

[0342] The application classification module can count the cumulative usage time of the first application within a certain period of time to determine whether the first application is a fast application or a slow application. Among them, fast applications can also be called frequently used applications. Slow applications can also be called infrequently used applications.

[0343] A fast app may refer to an app whose cumulative usage time within a certain period is greater than the preset time. A slow app may refer to an app whose cumulative usage time within a certain period is less than the preset time.

[0344] In some embodiments, the preset duration in S706 may be the second duration.

[0345] In some embodiments, the cumulative usage time of an application may refer to the cumulative usage time when the application is opened and in the foreground.

[0346] For example, the first timer duration can be within 7 days. The preset duration can be that the cumulative time the application is open and running in the foreground is at least 15 minutes. A fast application can refer to an application that is open and running in the foreground for a cumulative time of greater than or equal to 15 minutes within 7 days. A slow application can refer to an application that is open and running in the foreground for a cumulative time of less than 15 minutes within 7 days.

[0347] In other embodiments, the cumulative usage time of an application may also refer to the cumulative usage time of the application being opened and in the foreground and background.

[0348] For example, the first timer duration can be within 7 days. The preset duration can be that the cumulative running time of the application in the foreground and background is at least 15 minutes. A fast application can be an application that is opened and the cumulative running time in the foreground and background is greater than or equal to 15 minutes within 7 days. A slow application can be an application that is opened and the cumulative running time in the foreground and background is less than 15 minutes within 7 days.

[0349] If the cumulative usage time of the first application within a certain time period is greater than the preset time period, S707 is executed.

[0350] If the accumulated usage time of the first application within a certain time period is less than the preset time period, S708 is executed.

[0351] S707: The application classification module sends a message indicating that the first application is a quick application to the file system.

[0352] S708: The application classification module sends a message indicating that the first application is a slow application to the file system.

[0353] After determining that the cumulative usage time of the first application within a certain period is greater than the preset time, that is, determining that the first application is a quick application, the application classification module can send a message including that the first application is a quick application to the file system.

[0354] After determining that the cumulative usage time of the first application within a certain period is less than the preset time, that is, determining that the first application is a slow application, the application classification module can send a message including that the first application is a slow application to the file system.

[0355] Since the user's habits of using various applications may change, S705 to S708 may be executed periodically, irregularly, or at certain intervals.

[0356] It should be noted that S705-S708 can be executed before, after or simultaneously with any method step before S709, and this application does not limit this.

[0357] It should be noted that S701-S704 can also be executed before, after or simultaneously with any method step before S713 and S716, and this application does not limit this.

[0358] S709: The first application sends a first data write request to the file system.

[0359] After the first application is started, the first application generates application data. Before saving the application data to the storage device, the first application can send a first write data request to the file system so that the file system can determine which storage device stores the application data in the first application.

[0360] S710: The file system needs to confirm whether the first data is media data.

[0361] In the embodiment of the present application, media data is stored in the slow device by default. Because the reading speed of the media data is not high, the media data can be stored in the slow device to avoid storing the media data in the fast device and occupying the storage space of the fast device for storing the data of the fast application.

[0362] Then media data can belong to fast applications or slow applications.

[0363] Based on this, the file system needs to determine whether the first data is media data. If the first data is media data, S716-S718 are executed to directly store the first data in the slow device.

[0364] When the first data is non-media data, execute S711.

[0365] For example, media data may include, but is not limited to, image data, video data, audio data, and the like. For example, image data may include, but is not limited to, ".Png" files and ".jpg" files. Video data and audio data may include, but are not limited to, ".avi" files and the like.

[0366] For example, non-media data may include, but is not limited to, non-image data, non-video data, non-audio data, etc. Non-media data may include, but is not limited to, ".apk" files, ".so" files, ".dex" files, ".jar" files, ".json" files, ".odex" files, etc.

[0367] Optionally, S710 may not be executed.

[0368] S711: The file system needs to confirm whether the first application is a quick application.

[0369] If the first application is a quick application, S713 to S715 are executed.

[0370] If the first application is a slow application, S716 to S718 are executed.

[0371] In the case where the first data is non-media data, the file system needs to determine the application type of the first application that generates the first data, and determine in which storage device to store the first data based on the application type of the first application.

[0372] If the first application is a quick application, S713 to S715 are executed, that is, the first data is stored in the quick device.

[0373] In the case that the first application is a slow application, S716 to S718 are executed, that is, the first data is stored in the slow device.

[0374] S712. Execute S716-S718.

[0375] S713: The file system sends the identifier of the first storage device and the first data write request to the IO scheduling module.

[0376] S714: The IO scheduling module sends the first write data request to the first storage device.

[0377] S715: The first storage device stores the first data.

[0378] When the file system determines that the storage device storing the first data is the first storage device, the file system may send an identifier of the first storage device and the first data write request to the IO scheduling module.

[0379] After receiving the identifier of the first storage device, the IO scheduling module may send the first write data request to the first storage device based on the identifier of the first storage device.

[0380] In response to the first write data request, the first storage device may obtain the first data corresponding to the first write data request and store the first data in a storage unit within the first storage device.

[0381] S716: The file system sends the identifier of the second storage device and the first data write request to the IO scheduling module.

[0382] S717: The IO scheduling module sends the first write data request to the second storage device.

[0383] S718: The second storage device stores the first data.

[0384] When the file system determines that the storage device storing the first data is the second storage device, the file system may send an identifier of the second storage device and the first write data request to the IO scheduling module.

[0385] After receiving the identifier of the second storage device, the IO scheduling module may send the first write data request to the second storage device based on the identifier of the second storage device.

[0386] In response to the first write data request, the second storage device may obtain the first data corresponding to the first write data request and store the first data in a storage unit within the second storage device.

[0387] In some embodiments, the electronic device 100 may also combine the methods shown in FIG. 7A and FIG. 6A to determine the storage device storing the first data. For example, the electronic device 100 may combine the following conditions to determine the storage device storing the first data. The conditions include, but are not limited to, one or more of the following: the lifespan of the storage device, a busy index of the storage device, the type of the first data, the application type of the first application, and the device type of the storage device.

[0388] Illustratively, after executing S711 and before executing S713 , the lifespan of the storage device and / or the busy index of the first storage device may be determined.

[0389] For example, if the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the second storage device are both greater than the preset times, but the first busy state value of the first storage device is less than the preset busy state value, S713 may be executed.

[0390] If the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the second storage device are both greater than the preset times, and the first busy state value of the first storage device is greater than the preset busy state value, but the first busy level value of the first storage device is less than the second busy level value of the second storage device, S713 can be executed.

[0391] For another example, after executing S711, if the remaining read, write, and erase times of the first storage device is greater than the preset times and the remaining read, write, and erase times of the second storage device is less than the preset times, S713 may be executed.

[0392] For another example, after executing S711, if the remaining read, write, and erase times of the first storage device are less than the preset times, and the remaining read, write, and erase times of the second storage device are greater than the preset times, S713-S715 are no longer executed, and S716-S718 are directly executed.

[0393] For another example, after executing S711, if the remaining read, write, and erase times of the first storage device and the remaining read, write, and erase times of the first storage device are both less than the preset times, but the remaining read, write, and erase times of the first storage device are greater than the remaining read, write, and erase times of the first storage device, then S713-S715 are executed.

[0394] Based on a data storage method provided in the embodiment of FIG7A , the electronic device 100 can store the data in the application in the corresponding storage device according to the type of application, that is, the data in the application frequently used by the user is stored in the storage device with a fast reading speed, and the data in the application not frequently used by the user is stored in the storage device with a slow reading speed. On the one hand, the performance of the storage device can be fully utilized. On the other hand, for applications frequently used by the user, when the user expects to load data in the fast application, the electronic device 100 can read the data from the fast device faster and load it out to display it to the user for viewing or use, which can improve the user experience.

[0395] As can be seen from the embodiment of FIG7A , the method for determining which storage device to store the first data in from among multiple storage devices requires consideration of the application type of the first application that generated the first data and the device types of the multiple storage devices. Furthermore, determining the application type of the first application requires that the installation time of the first application be greater than a certain period of time. Therefore, this method is not applicable to newly downloaded applications, such as those whose installation time is less than a certain period of time. However, a data storage method provided in the embodiment of FIG6A can be used.

[0396] In some embodiments, data in fast applications may be referred to as hot data, and data in slow applications may be referred to as cold data.

[0397] According to the method shown in the embodiment of FIG. 7A , hot data in a fast application can be stored in a fast device, and cold data in a slow application can be stored in a slow device.

[0398] As shown in FIG7B , the first storage device may be a fast device, and the second storage device may be a slow device. The first storage device stores third and fourth data, both of which are hot data. The second storage device stores fifth and sixth data, both of which are cold data.

[0399] As shown in FIG7C , after the first application generates the first data, the electronic device 100 determines that the first application described in the first data is a quick application. Then the first data can be called hot data, and the electronic device 100 can determine that the storage device storing the first data is the first storage device.

[0400] As shown in FIG. 7D , the electronic device 100 may store the first data in the first storage device.

[0401] 7E , the electronic device 100 also obtains the second data in the second application. The electronic device 100 may determine that the second application is a slow application, and the second data may be called cold data. The electronic device 100 may determine that the storage device storing the second data is the second storage device.

[0402] As shown in FIG. 7F , the electronic device 100 may store the second data in the second storage device.

[0403] In some embodiments, the electronic device 100 may store data generated by an application according to the data storage method provided in FIG6A and / or FIG7A. However, the data storage method shown in FIG6A does not store data based on the application type. Therefore, after the data is stored, the electronic device 100 may obtain the application type and, based on the application type, update the storage path strategy after the application data is stored to dynamically adjust the storage location of the application data to improve the utilization of storage devices with different performances.

[0404] Although the data storage method shown in FIG7A stores data according to the application type, the user's application usage habits may change, resulting in changes in the application type. Therefore, after the data is stored, the electronic device 100 can determine the application type and then update the storage path of the application data based on the newly determined application type to improve the utilization of storage devices with different performance.

[0405] FIG8A shows a flow chart of a method for applying a storage path update strategy after data storage.

[0406] The method can be applied to the electronic device 100, which may include a file system, an IO scheduling module, and an application classification module. The electronic device 100 may also include a first storage device and a second storage device.

[0407] Among them, the file system, IO scheduling module and application classification module can be software modules. The first storage device and the second storage device can be hardware devices. In this application, the software module and the hardware device can work together to implement a storage device selection strategy provided in this application.

[0408] S801: A first storage device sends the performance of the first storage device to an IO scheduling module.

[0409] S802: The second storage device sends the performance of the second storage device to the IO scheduling module.

[0410] S803: The IO scheduling module sends the performance of the first storage device and the performance of the second storage device to the file system.

[0411] S804: The file system determines, based on the performance of the first storage device and the performance of the second storage device, that the first storage device is a fast device and that the second storage device is a slow device.

[0412] For the description in S801-S804, please refer to the description in S701-S704, and this application will not go into details here.

[0413] S805: The application classification module obtains the cumulative usage time of the first application within a certain period of time.

[0414] S806: The application classification module needs to confirm whether the cumulative usage time of the first application within a certain time period is greater than a preset time period.

[0415] The application classification module can count the cumulative usage time of the first application within a certain period of time to determine whether the first application is a fast application or a slow application. Among them, fast applications can also be called frequently used applications. Slow applications can also be called infrequently used applications.

[0416] A fast app may refer to an app whose cumulative usage time within a certain period is greater than the preset time. A slow app may refer to an app whose cumulative usage time within a certain period is less than the preset time.

[0417] Due to changes in user usage habits, the types of applications installed on the electronic device 100 may also change. For example, a week ago, the user frequently used a first application, and the electronic device 100 determined that the first application was a fast application. For example, a week later, the user frequently used the first application, and the electronic device 100 determined that the first application was a slow application.

[0418] After the data in the application is stored, the electronic device 100 may also periodically / irregularly / at regular intervals re-determine the application type of the application installed on the electronic device 100 and update the storage path of the stored data to improve the utilization of storage performance.

[0419] After the application classification module determines that the cumulative usage time of the first application within a certain time period is greater than the preset time period, S807 and S814 - S818 are executed.

[0420] After the application classification module determines that the cumulative usage time of the first application within a certain time period is less than the preset time period, S808 to S813 are executed.

[0421] S807: The application classification module sends a message indicating that the first application is a quick application to the file system.

[0422] S808: The application classification module sends a message indicating that the first application is a slow application to the file system.

[0423] S809: The file system sends the identifier of the first storage device, the identifier of the first application, and the second notification to the IO scheduling module.

[0424] S810. The IO scheduling module sends the identifier of the first application and the second notification to the first storage device.

[0425] S811: The first storage device obtains data in the first application stored in the first storage device.

[0426] S812: The first storage device sends the data in the first application to the second storage device.

[0427] S813. The second storage device stores data in the first application.

[0428] After receiving a message indicating that the first application is a slow application, the file system can determine that the data in the slow application stored on the first storage device needs to be removed and stored on the second storage device. The file system can then send the first application's identifier and a second notification to the I / O scheduling module. The identifier of the first storage device instructs the I / O scheduling module to send the first application's identifier and the second notification to the first storage device. The second notification and the identifier of the first application instruct the first storage device to retrieve the data in the first application stored on the first storage device.

[0429] In some embodiments, the identifier of the first application may be carried in the second notification sent to the first storage device.

[0430] In other embodiments, the identifier of the first application may not be carried in the second notification, and the identifier of the first application and the second notification may be sent to the first storage device separately.

[0431] After the IO scheduling module sends the identifier of the first application and the second notification to the first storage device, the first storage device may obtain the identifier of the first application and the second notification.

[0432] In response to the second notification, the first storage module may obtain the data in the first application from the first storage module based on the identifier of the first application, and send the data in the first application to the second storage device, so that the second storage device can store the data in the first application.

[0433] S814: The file system sends the identifier of the second storage device, the identifier of the first application, and the first notification to the IO scheduling module.

[0434] S815. The IO scheduling module sends the identifier of the first application and the first notification to the second storage device.

[0435] S816: The second storage device obtains the data in the first application stored in the first storage device.

[0436] S817: The second storage device sends the data in the first application to the first storage device.

[0437] S818. The first storage device stores data in the first application.

[0438] After receiving a message indicating that the first application is a quick app, the file system can determine that the data in the quick app stored on the second storage device needs to be removed and stored on the first storage device. The file system can then send the first application's identifier and a first notification to the I / O scheduling module. The second storage device's identifier instructs the I / O scheduling module to send the first application's identifier and the first notification to the second storage device. The first notification and the first application's identifier instruct the second storage device to retrieve the data in the first application stored on the second storage device.

[0439] In some embodiments, the identifier of the first application may be carried in the first notification sent to the second storage device.

[0440] In other embodiments, the identifier of the first application may not be carried in the first notification, and the identifier of the first application and the first notification may be sent to the second storage device separately.

[0441] After the IO scheduling module sends the identifier of the first application and the first notification to the second storage device, the second storage device may obtain the identifier of the first application and the first notification.

[0442] In response to the first notification, the second storage module may obtain the data in the first application from the second storage module based on the identifier of the first application, and send the data in the first application to the first storage device, so that the first storage device can store the data in the first application.

[0443] Optionally, in some embodiments, in S816 and S817, after the second storage device obtains the data in the first application stored in the first storage device, and after the second storage device sends the data in the first application to the first storage device, the second storage device can filter the data in the first application to obtain the media data in the first application and the non-media data in the first application. In S817, the second storage device can only send the non-media data in the first application to the first storage device, so that the first storage device can store the non-media data in the first application, and the media data in the first application is still stored in the second storage device. In this way, the media data in the quick application can be prevented from occupying the storage space of the quick device, and the quick device can store more non-media data in the quick application.

[0444] In other embodiments, media data and non-media data may not be distinguished. The first storage device sends all data of the first application to the first storage device.

[0445] Based on the data storage path updating method shown in FIG8A , the latest hot data can be stored in the fast device, and the latest cold data can be stored in the slow device.

[0446] For example, the first application includes first data, and the second application includes second data. If the electronic device 100 previously determined that the first data is hot data and the second data is cold data, after implementing the method shown in FIG8A , as shown in FIG8B , the electronic device 100 determines that the first data is cold data and the second data is hot data.

[0447] Then the storage locations of the first data and the second data need to be updated.

[0448] As shown in FIG. 8C , the first storage device may send the first data to the second storage device, and the second storage device may send the second data to the first storage device.

[0449] As shown in FIG8D , the first storage device may store the second data, and the second storage device may store the first data.

[0450] In this way, after the data in the application is stored on the storage device, the electronic device 100 can dynamically update the storage location of the data in the application based on the user's usage habits, so as to improve the utilization rate of the performance of different devices.

[0451] The above embodiment uses application type as a dimension to determine the data type in an application. In some embodiments, some data in an application is frequently used by users, while another portion of the data in the application is less frequently used by users. Following the above approach, it is also possible to classify less frequently used data in an application as hot data.

[0452] In order to improve the accuracy of data storage location updates, avoid storing data that users use less frequently in fast devices and avoid storing data that users use more frequently in slow devices.

[0453] The electronic device 100 can also obtain the usage frequency of each data in the storage device and classify the data stored in the storage device into high-frequency data and low-frequency data based on the usage frequency of each data in the storage device. Furthermore, based on the usage frequency of each data in the storage device, the storage location of the data in the application can be dynamically migrated.

[0454] FIG9A shows a flow chart of another method for applying a storage path update strategy after data storage.

[0455] S901: A first storage device obtains a cumulative usage time of first data in a first application within a certain time period.

[0456] For example, the certain duration may be 5 days, 7 days, or one month, etc. The cumulative usage duration may be 30 minutes, one hour, or two hours, etc.

[0457] It should be noted that the first storage device can also obtain the cumulative usage time of more data in the first application within a certain period of time, or the cumulative usage time of data in other applications within a certain period of time. This application only uses the first data in the first application as an example for illustration and does not constitute a limitation.

[0458] S902: The first storage device needs to confirm whether the cumulative usage time of the first data within a certain time period is greater than a preset time period.

[0459] In some embodiments, the preset duration mentioned in S902 may be a third duration.

[0460] When the accumulated usage time of the first data within a certain time period is greater than the preset time period, it indicates that the first data is high-frequency data, and S903 is executed.

[0461] When the accumulated usage time of the first data within a certain time period is less than the preset time period, it indicates that the first data is low-frequency data, and S904 - S905 are executed.

[0462] The certain time period mentioned in S902 may be the same as or different from the certain time period mentioned in S705.

[0463] The preset duration mentioned in S902 may be the same as or different from the preset duration mentioned in S706. In other words, the third duration may be the same as or different from the second duration.

[0464] S903: The first storage device continues to store the first data.

[0465] S904: The first storage device sends the first data to the second storage device.

[0466] S905: The second storage device stores the first data.

[0467] For example, as shown in FIG9B , the first storage device may obtain the cumulative usage time of each data stored in the first storage device within a certain period of time. For example, the cumulative usage time of the first data in the first application within a certain period of time may be obtained. Furthermore, it may be determined that the data type of the first data has been converted from hot data to low-frequency data.

[0468] As shown in FIG. 9C , the first storage device may send the first data to the second storage device.

[0469] As shown in FIG. 9D , the second storage device may store the first data.

[0470] In this way, low-frequency data stored in fast devices can be dynamically migrated and stored in slow devices, avoiding the storage of low-frequency data in fast devices and occupying the storage space of high-frequency data on fast devices.

[0471] S906: The second storage device obtains the accumulated usage time of the second data in the second application within a certain time period.

[0472] For example, the certain duration may be 5 days, 7 days, or one month, etc. The cumulative usage duration may be 30 minutes, one hour, or two hours, etc.

[0473] It should be noted that the second storage device can also obtain the cumulative usage time of more data in the second application within a certain period of time, or the cumulative usage time of data in other applications within a certain period of time. This application only uses the second data in the second application as an example for illustration and does not constitute a limitation.

[0474] S907: The second storage device needs to confirm whether the cumulative usage time of the second data within a certain time period is greater than a preset time period.

[0475] When the accumulated usage time of the second data within a certain time period is greater than the preset time period, it indicates that the second data is high-frequency data, and S909 - S910 are executed.

[0476] When the accumulated usage time of the first data within a certain time period is less than the preset time period, it indicates that the second data is low-frequency data, and S908 is executed.

[0477] S908: The second storage device continues to store the second data.

[0478] S909: The second storage device sends the second data to the first storage device.

[0479] S910: A first storage device stores second data.

[0480] For example, as shown in FIG9E , the second storage device may obtain the cumulative usage time of each data stored in the second storage device within a certain period of time. For example, the cumulative usage time of the second data in the second application within a certain period of time may be obtained. Furthermore, it may be determined that the data type of the second data has been converted from cold data to high-frequency data.

[0481] As shown in FIG. 9F , the second storage device may send the second data to the first storage device.

[0482] As shown in FIG. 9G , the first storage device may store second data.

[0483] In this way, high-frequency data stored in slow devices can be dynamically migrated and stored in fast devices, avoiding the problem of high-frequency data being stored in slow devices and slow loading speed affecting user experience when the electronic device 100 loads high-frequency data stored in the slow device.

[0484] In some embodiments, the data stored in the storage device may also be divided into high-frequency data, medium-frequency data, and low-frequency data. High-frequency data refers to data with a cumulative usage duration greater than a fourth duration within a certain time period, medium-frequency data refers to data with a cumulative usage duration greater than a fifth duration and less than a fourth duration within a certain time period, and low-frequency data refers to data with a cumulative usage duration less than the fifth duration within a certain time period.

[0485] In some embodiments, the fourth duration may be the same as the third duration, or may be different.

[0486] In some embodiments, high-frequency data may also be referred to as hot data, medium-frequency data may be referred to as warm data, and low-frequency data may be referred to as cold data.

[0487] After determining the data types stored in the storage devices, only the low-frequency data stored in the fast device can be migrated to the slow device. The high-frequency data stored in the slow device can be migrated to the fast device. The medium-frequency data stored in the fast and slow devices can remain unprocessed and stored in the fast or slow device.

[0488] In other embodiments, the intermediate frequency data stored in the fast device may be migrated and stored in the slow device, or the intermediate frequency data stored in the slow device may be migrated and stored in the fast device.

[0489] For example, as shown in FIG9H , the first storage device can obtain the cumulative usage time of each data stored in the first storage device within a certain period of time. For example, the first storage device can obtain the cumulative usage time of the first data in the first application within a certain period of time. It can also determine that the data type of the first data has been converted from hot data to intermediate frequency data. The first storage device can then continue to store the first data.

[0490] For example, as shown in FIG9I , the second storage device can obtain the cumulative usage time of each data stored in the second storage device within a certain period of time. For example, the second storage device can obtain the cumulative usage time of the second data in the second application within a certain period of time. It can also determine that the data type of the second data has been converted from hot data to intermediate frequency data. The second storage device can then continue to store the second data.

[0491] In some embodiments, after the data in the application is stored in the storage device, the electronic device 100 may also combine the method for determining the application type shown in FIG8A with the embodiment shown in FIG9A or the method for determining the frequency of use of data shown in FIG9H and FIG9I to determine whether the storage location of the data in the storage device needs to be updated. In this way, the amount of computation of the electronic device 100 can be reduced.

[0492] For example, there are 10 applications installed in the electronic device 100, and each application contains 10 data. There are a total of 100 data. If the electronic device 100 calculates the cumulative usage time of each data in a certain period of time at a time, it needs to calculate 100 times, and the calculation time is very large. If the electronic device 100 first obtains the cumulative usage time of each application in a certain market, for example, it determines that 5 applications are quick applications. The electronic device 100 only needs to calculate the cumulative usage time of each data in the quick application in a certain period of time, then it only needs to calculate 50 times, which shortens the calculation amount of the electronic device 100 by half. Afterwards, the electronic device 100 can implement the storage location migration of the data based on the embodiment shown in Figure 9A or the embodiments shown in Figures 9H and 9I.

[0493] FIG10 is a flow chart of a method for implementing data storage location migration provided in the present application.

[0494] For example, before executing the embodiments of Figures 8A and 9A, the embodiment shown in Figure 10 can be executed. In this way, the electronic device 100 can implement data storage location migration when it is not in use, avoiding the need to perform data storage location migration operations when the user is using the electronic device 100, which would affect the user experience.

[0495] S1001. The electronic device 100 is turned on.

[0496] S1002: The electronic device 100 needs to determine whether there are at least two storage devices on the device.

[0497] When the electronic device 100 determines that there are at least two storage devices on the device, S1003 is executed.

[0498] When the electronic device 100 determines that there is only one storage device on the device, the process ends.

[0499] S1003: The electronic device 100 monitors whether the device status meets a preset condition.

[0500] When the device status meets the preset conditions, execute S1004.

[0501] If the device state does not meet the preset condition, S1003 is executed until the device state of the electronic device 100 meets the preset condition.

[0502] In some embodiments, the preset condition may be that the electronic device 100 is not in use, for example, the electronic device 100 is in the screen-off state, for example, the electronic device 100 is charging, for example, the electronic device 100 is both screen-off and charging, etc.

[0503] S1004: The electronic device 100 executes FIG. 8A and / or FIG. 9A.

[0504] When the electronic device 100 is not in use, or when the electronic device 100 has not been used for a predetermined period of time, the electronic device 100 may begin to migrate the data stored on the storage device according to the method shown in FIG8A and / or FIG9A . This, on the one hand, can improve the utilization rate of storage devices with different performances. On the other hand, the data storage location migration operation can also be performed when the user is not using the electronic device 100, avoiding lag and improving the user experience.

[0505] FIG11 is a flow chart of a data storage method provided in this application.

[0506] S1101: The electronic device obtains a first data write request, where the first data write request is used to store first data in a first application.

[0507] S1102. The electronic device obtains the busy index of the first storage device and / or the remaining read, write, and erase times of the first storage device, as well as the busy index of the second storage device and / or the remaining read, write, and erase times of the second storage device. The busy index is used to indicate the busy status of the first storage device and the second storage device, and the remaining read, write, and erase times are used to indicate the lifespan of the first storage device and the second storage device.

[0508] In one possible implementation, the electronic device obtains the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device, specifically including: when the installation duration of the first application is greater than the first duration or less than the first duration, the electronic device obtains the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device.

[0509] In this way, there is no need to consider the installation time of the application. This solution is applicable to both newly installed applications and applications that have been installed for a long time.

[0510] S1103. In response to the first write data request, the electronic device determines that the storage device storing the first data is the first storage device based on the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device.

[0511] In a possible implementation, the electronic device may determine that the storage device storing the first data is the first storage device only based on the busy index of the first storage device and the busy index of the second storage device.

[0512] In other possible implementations, the electronic device may also determine that the storage device storing the first data is the first storage device based solely on the remaining read, write, and erase counts of the first storage device and the remaining read, write, and erase counts of the second storage device.

[0513] In other possible implementations, the electronic device may also determine that the storage device storing the first data is the first storage device based on the busy index of the first storage device and the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and the remaining read, write and erase times of the second storage device.

[0514] Here, the remaining number of read, write, and erase cycles of the storage device may be referred to as the lifespan of the storage device.

[0515] S1104: The electronic device stores the first data in a first storage device.

[0516] With this method, when an electronic device includes multiple storage devices, before storing application data, the electronic device can select a storage device based on the busy index and / or lifespan of the multiple storage devices. This can extend the service life of the multiple different storage devices and also speed up the storage of the first data.

[0517] In one possible implementation, the method also includes: the electronic device obtains a second write data request, the second write data request is used to store second data in the second application; the electronic device obtains an application type of the second application, the application type of the second application includes a frequently used application or an infrequently used application, a frequently used application is an application whose cumulative usage time within a certain period of time is greater than the second period of time, and an infrequently used application is an application whose cumulative usage time within a certain period of time is less than the second period of time; the electronic device obtains a reading speed of the first storage device and a reading speed of the second storage device, and based on the reading speed of the first storage device and the reading speed of the second storage device, determines the device type of the first storage device and the second storage device, the device type of the storage device including a fast device and a slow device; when the second application is a fast application, the first storage is set to a fast device, and the second storage device is a slow device, the electronic device determines that the storage device storing the second data is the first storage device.

[0518] In this way, for applications that have been downloaded for a long time, the application type of the application can be determined. For such applications, the electronic device can store the data in the application in the corresponding storage device according to the type of application and the reading speed of the device. That is, the data in applications that the user frequently uses is stored in a storage device with a fast reading speed, and the data in applications that the user does not frequently use is stored in a storage device with a slow reading speed. On the one hand, the performance of the storage device can be fully utilized. On the other hand, for applications that the user frequently uses, the user expects that when loading data in a fast application, the electronic device 100 can read the data from the fast device faster and load it out to display it to the user for viewing or use, which can improve the user experience.

[0519] In one possible implementation, the electronic device obtains the application type of the second application and the reading speed of the first storage device and the reading speed of the second storage device, specifically including: when the installation duration of the second application is greater than the first duration, the electronic device obtains the application type of the second application and the reading speed of the first storage device and the reading speed of the second storage device.

[0520] In this way, it is necessary to consider the installation time of the application. This solution can be applied to applications that have been installed for a long time.

[0521] In a possible implementation, the method further includes: when the first data is media data, the electronic device stores the first data in a second storage device.

[0522] Before obtaining the busy index of the first storage device and / or the remaining read, write, and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write, and erase times of the second storage device, or before obtaining the application type of the application and the device type of the storage device, it is possible to first determine whether the application data is media data or non-media data. If the application data is non-media data, the media data can be directly stored on the slow device. This is because media data does not require high data read speeds. Avoid storing media data on a fast device, which would otherwise occupy the storage space of the fast device.

[0523] In a possible implementation, the electronic device stores the first data in a first storage device, specifically including: when the first data is non-media data, the electronic device stores the first data in the first storage device.

[0524] In a possible implementation, the method further includes: when the first data is media data, the electronic device stores the first data in a second storage device.

[0525] Before obtaining the busy index of the first storage device and / or the remaining read, write, and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write, and erase times of the second storage device, or before obtaining the application type of the application and the device type of the storage device, it is possible to first determine whether the application data is media data or non-media data. In the case where the application data is media data, the media data can be directly stored in a slow device. This is because media data does not require a high speed for data reading. Avoid storing media data in a fast device, which takes up the storage space of the fast device. In the case where the application data is non-media data, before obtaining the busy index of the first storage device and / or the remaining read, write, and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write, and erase times of the second storage device, or after obtaining the application type of the application and the device type of the storage device, it is possible to determine the storage device that stores non-media data.

[0526] In a possible implementation, after the electronic device stores the first data in the first storage device, the method further includes: the electronic device sending the first data to the second storage device, and storing the first data in the second storage device.

[0527] In this way, after the data is stored in the disk, the storage location of the application data can be migrated periodically / in real time / irregularly according to preset rules, thereby improving the utilization rate of the storage device.

[0528] In one possible implementation, the electronic device sends the first data to the second storage device, specifically including: the electronic device obtains the application type of the first application; when the application type of the first application is an infrequently used application, the electronic device sends the first data to the second storage device.

[0529] In combination with the first aspect, in a possible implementation, the method further includes: when the application type of the first application is a common application, the electronic device continues to store the first data in the first storage device.

[0530] In this way, after the data is stored, the type of application can be counted to determine whether to migrate the storage location of the application data. The data of fast and frequently used applications can be dynamically stored on fast devices, and the data of slow applications can be stored on slow devices.

[0531] In one possible implementation, when the application type of the first application is a commonly used application, the electronic device continues to store the first data in the first storage device, specifically including: when the application type of the first application is a commonly used application, the electronic device obtains the cumulative usage time of the first data within a certain period of time; when the cumulative usage time of the first data within a certain period of time is greater than a third period of time, the electronic device stores the first data in the second storage device.

[0532] In a possible implementation, the method further includes: when the cumulative usage time of the first data within a certain time period is less than a third time period, the electronic device continues to store the first data in the first storage device.

[0533] Because the application data in frequently used applications is not all frequently used data. The application data in infrequently used applications are all infrequently used data.

[0534] In this way, the electronic device can first count the application types, then count the types of data in commonly used applications. It can then determine which data in commonly used applications needs to be migrated. This can reduce the amount of computation required by the electronic device and improve the accuracy of data storage location migration.

[0535] In a possible implementation, the busy index of the first storage device includes a first busy state value and a first busy degree value, and the busy index of the second storage device includes a second busy state value and a second busy degree value;

[0536] The electronic device determines that the storage device storing the first data is the first storage device, specifically including:

[0537] In the case where the remaining read, write and erase times of the first storage device are greater than the remaining read, write and erase times of the second storage device, the first busy state value is less than the preset busy state value, and the electronic device determines that the storage device storing the first data is the first storage device; or, in the case where the remaining read, write and erase times of the first storage device are greater than the remaining read, write and erase times of the second storage device, the first busy state value is greater than the preset busy state value, but the first busy level value is less than the second busy level value, and the electronic device determines that the storage device storing the first data is the first storage device; or, in the case where the remaining read, write and erase times of the first storage device are less than the remaining read, write and erase times of the second storage device, the second busy state value is greater than the preset busy state value, but the first busy level value is less than the second busy level value, and the electronic device determines that the storage device storing the first data is the first storage device.

[0538] The present application provides an electronic device, which includes: one or more processors and at least two memories; the at least two memories are coupled to the one or more processors, and the at least two memories are used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute a data storage method shown in Figure 11.

[0539] The present application provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes a data storage method shown in FIG11 .

[0540] The present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes a data storage method shown in FIG11 .

[0541] The various implementation modes of this application can be combined arbitrarily to achieve different technical effects.

[0542] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0543] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0544] In short, the above description is only an embodiment of the technical solution of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of the present invention should be included in the scope of protection of the present invention.

Claims

1. A data storage method, characterized in that: The method is applied to an electronic device, the electronic device includes at least two storage devices, the at least two storage devices include a first storage device and a second storage device, and the method includes: The electronic device obtains a first write data request, where the first write data request is used to store first data in a first application; The electronic device acquires a busy index of the first storage device and / or a remaining number of read, write and erase operations of the first storage device, and a busy index of the second storage device and / or a remaining number of read, write and erase operations of the second storage device, wherein the busy index is used to indicate a busy state of the first storage device and the second storage device, and the remaining number of read, write and erase operations is used to indicate a life span of the first storage device and the second storage device; In response to the first data write request, the electronic device determines that the storage device storing the first data is the first storage device based on the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device; The electronic device stores the first data in the first storage device.

2. The method according to claim 1, characterized in that The electronic device acquires the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, and the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device, specifically including: When the installation time of the first application is greater than the first time period or less than the first time period, the electronic device obtains the busy index of the first storage device and / or the remaining read, write and erase times of the first storage device, as well as the busy index of the second storage device and / or the remaining read, write and erase times of the second storage device.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: The electronic device obtains a second write data request, where the second write data request is used to store second data in a second application; The electronic device acquires an application type of the second application, where the application type of the second application includes a commonly used application or an uncommonly used application, the commonly used application is an application whose cumulative usage time within a certain time period is greater than the second time period, and the uncommonly used application is an application whose cumulative usage time within the certain time period is less than the second time period; The electronic device obtains a reading speed of the first storage device and a reading speed of the second storage device, and determines device types of the first storage device and the second storage device based on the reading speed of the first storage device and the reading speed of the second storage device, where the device types of the storage devices include fast devices and slow devices; When the second application is a fast application, the first storage is set as a fast device, and the second storage device is a slow device, the electronic device determines that the storage device storing the second data is the first storage device.

4. The method according to claim 3, characterized in that The electronic device acquires the application type of the second application and the reading speed of the first storage device and the reading speed of the second storage device, specifically including: When the installation time of the second application is longer than the first time, the electronic device obtains the application type of the second application and the reading speed of the first storage device and the reading speed of the second storage device.

5. The method according to any one of claims 1 to 4, wherein the electronic device stores the first data in the first storage device, specifically comprising: In the case that the first data is non-media data, the electronic device stores the first data in the first storage device.

6. The method according to claim 5, further comprising: In the case where the first data is media data, the electronic device stores the first data in the second storage device.

7. The method according to any one of claims 1 to 6, characterized in that: After the electronic device stores the first data in the first storage device, the method further includes: The electronic device sends the first data to the second storage device and stores the first data in the second storage device.

8. The method according to claim 7, characterized in that The electronic device sending the first data to the second storage device specifically includes: The electronic device acquires an application type of the first application; In a case where the application type of the first application is an infrequently used application, the electronic device sends the first data to the second storage device.

9. The method according to claim 7 or 8, characterized in that: The method further comprises: In a case where the application type of the first application is a common application, the electronic device continues to store the first data in the first storage device.

10. The method according to claim 9, characterized in that In a case where the application type of the first application is a common application, the electronic device continues to store the first data in the first storage device, specifically including: In a case where the application type of the first application is a common application, the electronic device acquires a cumulative usage time of the first data within a certain time period; When the accumulated usage time of the first data within a certain time period is greater than a third time period, the electronic device stores the first data in the second storage device.

11. The method according to claim 10, characterized in that The method further comprises: When the accumulated usage time of the first data within a certain time period is less than the third time period, the electronic device continues to store the first data in the first storage device.

12. The method according to any one of claims 1 to 11, characterized in that: The busy index of the first storage device includes a first busy state value and a first busy degree value, and the busy index of the second storage device includes a second busy state value and a second busy degree value; The electronic device determines that the storage device storing the first data is the first storage device, specifically including: In a case where the remaining number of read, write and erase times of the first storage device is greater than the remaining number of read, write and erase times of the second storage device, and the first busy state value is less than a preset busy state value, the electronic device determines that the storage device storing the first data is the first storage device; or, In a case where the remaining number of read, write and erase times of the first storage device is greater than the remaining number of read, write and erase times of the second storage device, the first busy state value is greater than a preset busy state value, but the first busy degree value is less than the second busy degree value, the electronic device determines that the storage device storing the first data is the first storage device; or, When the remaining read, write and erase times of the first storage device are less than the remaining read, write and erase times of the second storage device, the second busy state value is greater than the preset busy state value, but the first busy level value is less than the second busy level value, the electronic device basically determines that the storage device storing the first data is the first storage device.

13. An electronic device, characterized in that: The electronic device includes: one or more processors and at least two memories; the at least two memories are coupled to the one or more processors, the at least two memories are used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute any one of the methods described in claims 1-12 above.

14. A computer-readable storage medium, characterized in that: Used to store computer instructions, when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 12.

15. A computer program product, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Method and apparatus for writing data into storage device and storage device

    CN105224240A

  • Multi-storage apparatus-based data access method and device

    CN108196791A

  • Writing data in a storage system that includes a first type of storage device and a second type of storage device

    CN108292196A

  • Data storage method and device, and computer storage medium

    CN108710474A

  • Memory management method, memory control circuit unit and memory storage apparatus

    US20160216906A1