WO2024045841A1 - 存储的方法、装置和电子设备 - Google Patents

存储的方法、装置和电子设备 Download PDF

Info

Publication number
WO2024045841A1
WO2024045841A1 PCT/CN2023/103559 CN2023103559W WO2024045841A1 WO 2024045841 A1 WO2024045841 A1 WO 2024045841A1 CN 2023103559 W CN2023103559 W CN 2023103559W WO 2024045841 A1 WO2024045841 A1 WO 2024045841A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
cache
request message
app
cache area
Prior art date
Application number
PCT/CN2023/103559
Other languages
English (en)
French (fr)
Inventor
裘杰
方炜
赵鸿江
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024045841A1 publication Critical patent/WO2024045841A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0893Caches characterised by their organisation or structure
    • G06F12/0897Caches characterised by their organisation or structure with two or more cache hierarchy levels
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • Embodiments of the present application relate to the field of storage, and more specifically, to a storage method, apparatus and electronic equipment.
  • flash memory (flash) related products are gradually developing in the direction of high storage density.
  • some negative effects of density increase also begin to appear, such as flash memory access.
  • Performance declines, and even the proportion of decline exceeds the proportion of density improvement.
  • the reliability of storage also declines to a certain extent.
  • the present application provides a storage method, device and electronic equipment.
  • the method is applied to a storage device.
  • the storage device includes a reserved space OP reporting module and a cache management module.
  • the method includes: the OP reporting module reports to the cache management module.
  • Information about the first OP which is an unoccupied OP obtained from the OPs of the flash storage device, wherein the OP reporting module is located at the device layer of the storage device, and the cache management module is located at the core of the storage device layer; based on the information of the first OP, the cache management module configures a cache area, and the cache area includes the first OP.
  • the flash storage device may be a UFS device.
  • the reserved space OP of the flash storage device includes the first OP.
  • the cache area is used for caching data.
  • the user data refers to data delivered by the application program APP, which may be user data, for example.
  • the information of the first OP includes the space storage information of the first OP, which may be, for example, the size of available storage space and other performance parameters.
  • the cache area may be any one of a single-level storage unit SLC cache area, a multi-level storage unit MLC cache area, a three-level storage unit TLC cache area, and a four-level storage unit QLC cache area.
  • the cache area can be any of the TLC cache area, MLC cache area, and SLC cache area;
  • the SLC cache area refers to the cache area configured in the SLC writing mode
  • the MLC cache area refers to the cache area configured in the MLC writing mode
  • the TLC cache area refers to the cache area configured in the TLC writing mode.
  • the cache area can be either an MLC cache area or an SLC cache area;
  • the cache area can be an SLC cache area.
  • the cache area can be configured as a cache area of any flash memory medium writing mode with a lower density than the higher-density flash memory medium.
  • the static cache area on the side of the flash storage device is cancelled, and the excess reserved space of the flash storage device is reported to the file system (including the cache management module) in the kernel layer of the storage device as a storage invisible to the user.
  • Space (cache area) is used for unified configuration of the file system and can be used for caching user data. This can improve storage space utilization and storage efficiency.
  • the cache area also includes the OP of the file system itself, and the file system is located at the kernel layer of the storage device.
  • the static cache area on the side of the flash memory storage device is cancelled, the excess reserved space of the flash memory storage device is reported to the file system, and the excess reserved space of the flash memory storage device is combined with the idle storage reserved space of the file system itself.
  • the hidden storage space (cache area) is used for unified configuration of the file system and can be used for caching user data, which can improve storage space utilization and storage efficiency.
  • the cache management module configures the cache area, including: when the available space of the cache area is greater than or equal to the first threshold, the cache management module downloads the application APP The user data sent is written into this cache area.
  • the caching strategy is not determined based on the second information corresponding to the request message issued by the APP (the type of the request message carrying user data), but all APPs are downloaded. All user data sent is written into the cache area, which can further improve cache space utilization and cache efficiency, and improve user experience.
  • the cache management module configures the cache area, which further includes: the cache management module determines the category corresponding to the request message issued by the application APP, and the request message carries the request message issued by the APP.
  • the user data sent by the APP is determined according to the category corresponding to the request message, and the user data sent by the APP is cached according to the caching policy.
  • the storage device may also include an APP grouping module.
  • the cache management module determines the category corresponding to the request message issued by the APP. It may include: the APP grouping module groups the APPs according to the first information corresponding to the APP. The first information Including one or more of the priority information of the APP, the behavior information of the APP, and the attribute information of the APP; the APP grouping module determines the second location corresponding to the request message issued by the APP according to the grouping situation of the APP.
  • the second information includes one or more of the priority information of the request message, the behavior information of the request message, the foreground and background information of the request message, and the hot and cold attribute information of the request message; then cache management The module determines the category corresponding to the request message based on the second information corresponding to the request message.
  • the cache management module determines the category corresponding to the request message based on the second information corresponding to the request message, including: when the behavior information of the request message is a specific behavior, the cache management module determines the category corresponding to the request message.
  • the first category when the behavior information of the request message is non-specific behavior and meets the requirements that the priority information is high priority, the hot and cold attribute information is hot, and the front and back information is one or more of the foreground APPs , the cache management module determines that the category corresponding to the request message is the second category; or, when the behavior information of the request message is non-specific behavior, and the priority information is low priority, the hot and cold attribute information is cold,
  • the cache management module determines that the category corresponding to the request message is the third category.
  • the grouping information of the application can be used to sense the user scenario (type of request message), thereby providing a more reasonable SLC caching strategy for user data, thereby ensuring full-time high-speed writing of key applications and key scenarios ( For example, the application background changes to the foreground loading) high-speed reading.
  • the cache management module determines a caching strategy for user data issued by the APP according to the category corresponding to the request message, and caches the user data issued by the APP according to the caching policy. , including: when the category corresponding to the request message is the first category, the cache management module writes the user data carried in the request message into the cache area, and locks the user data carried in the request message in the cache area ; When the category corresponding to the request message is the second category, the cache management module writes the user data carried in the request message into the cache area; or, when the category corresponding to the request message is the third category, the cache The management module directly writes the user data carried in the request message into the TLC storage area of the three-layer storage unit.
  • a reasonable caching strategy is determined based on the type of request message issued by the APP, so that some user data of low importance (no need to use cache) directly falls into the TLC storage area, avoiding the need to store data in a short period of time.
  • the secondary storage of user data can avoid additional stream overhead; and it can lock the user data issued by key APPs in the cache area, thereby ensuring full-time high-speed writing of key applications and key scenarios (such as High-speed reading of applications from background to foreground loading), thus improving the user experience.
  • the cache management module caches the user data issued by the APP according to the cache policy, including: when the available space of the cache area is less than the first threshold, the cache The management module caches the user data issued by the APP according to the cache policy.
  • the first threshold can be one quarter of the cache area, or one third of the cache area, or other thresholds, which is not limited in this application.
  • the available space in the cache area is greater than the first threshold, it means that the available space in the cache area is sufficient, and all user data issued by the APP can be stored in the cache area.
  • the available space is less than the first threshold, the user data delivered by the APP will be cached according to the cache policy. In this way, the available space can be fully charged when sufficient.
  • the utilization of points can improve the utilization rate of space.
  • the storage device further includes a garbage collection management module
  • the method further includes: when the available space of the cache area is less than a second threshold, the garbage collection management module removes the cache area from the cache area. The user data is migrated to the TLC storage area of the three-tier storage unit.
  • the second threshold is one-seventh of the cache area, or one-eighth of the cache area, or other thresholds, which is not limited in this application.
  • the information of the first OP may also include bad block information of the first OP, and the bad block information of the first OP is used to synchronize bad blocks in the cache area.
  • the bad block information of the first OP is synchronized in a timely manner and the SLC cache space is simultaneously reduced, which can avoid storage errors caused by the use of bad blocks.
  • a storage device in a second aspect, includes a reserved space OP reporting module and a cache management module, wherein: the reserved space reporting module is used to report the information of the first OP to the cache management module.
  • An OP is an unoccupied OP obtained from the OPs of the flash storage device, wherein the OP reporting module is located at the device layer of the storage device, and the cache management module is located at the kernel layer of the storage device; the cache management module is used Based on the information based on the first OP, a cache area is configured, and the cache area includes the first OP.
  • the flash storage device may be a UFS device.
  • the cache area is used for caching data.
  • the user data refers to data delivered by the application program APP, which may be user data, for example.
  • the information of the first OP includes the space storage information of the first OP, which may be, for example, the size of available storage space and other performance parameters.
  • the cache area may be any one of a single-level storage unit SLC cache area, a multi-level storage unit MLC cache area, a three-level storage unit TLC cache area, and a four-level storage unit QLC cache area.
  • the cache area can be any of the TLC cache area, MLC cache area, and SLC cache area;
  • the SLC cache area refers to the cache area configured in the SLC writing mode
  • the MLC cache area refers to the cache area configured in the MLC writing mode
  • the TLC cache area refers to the cache area configured in the TLC writing mode.
  • the cache area can be either an MLC cache area or an SLC cache area;
  • the cache area can be an SLC cache area.
  • the cache area can be configured as a cache area of any flash memory medium writing mode with a lower density than the higher-density flash memory medium.
  • the static cache area on the side of the flash storage device is cancelled, and the idle storage excess reserved space of the flash storage device is reported to the file system (including the cache management module) in the kernel layer of the storage device, which is invisible to the user.
  • the storage space (cache area) is used for unified configuration of the file system and can be used for caching user data. This can improve storage space utilization and storage efficiency.
  • the cache area also includes the OP of the file system itself, and the file system is located at the kernel layer of the storage device.
  • the static cache area on the side of the flash memory storage device is cancelled, the excess reserved space of the flash memory storage device is reported to the file system, and the excess reserved space of the flash memory storage device is combined with the idle storage reserved space of the file system itself.
  • Integrated into a storage space (cache area) invisible to the user for unified configuration of the file system which can be used to cache user data, which can improve storage space utilization and storage efficiency.
  • the cache management module is also used to: when the available space of the cache area is greater than or equal to the first threshold, write the user data issued by the application APP into This cache area.
  • the third request message corresponding to the request message issued by the APP is not used.
  • the second information type of request message carrying user data determines the caching strategy, but writes all user data issued by the APP into the cache area. In this way, the utilization of cache space and cache efficiency can be further improved, and the user's Use experience.
  • the cache management module is also used to: determine the category corresponding to the request message sent by the APP, the request message carries the user data sent by the APP; according to the request message The corresponding category determines the caching policy for the user data delivered by the APP, and caches the user data delivered by the APP according to the caching policy.
  • the device further includes: an APP grouping module, configured to group the APPs according to first information corresponding to the APP, where the first information includes priority information of the APP , one or more of the behavior information of the APP and the attribute information of the APP; the APP grouping module is also used to determine the second information corresponding to the request message issued by the APP according to the grouping situation of the APP.
  • the second information includes one or more of the priority information of the request message, the behavior information of the request message, the foreground and background information of the request message, and the hot and cold attribute information of the request message; the cache management module specifically uses Then, the category corresponding to the request message is determined according to the second information corresponding to the request message.
  • the cache management module is specifically used to: when the behavior information of the request message is a specific behavior, determine the category corresponding to the request message as the first category; when the behavior information of the request message is a non-specific behavior, and satisfy the When the priority information is high priority, the hot and cold attribute information is hot, and the foreground and background information is one or more items in the foreground APP, it is determined that the category corresponding to the request message is the second category; or, when the request message is When the behavior information is non-specific behavior, and the priority information is low priority, the hot and cold attribute information is cold, and the front and back information is one or more items in the background APP, determine the category corresponding to the request message For the third category.
  • the grouping information of the application can be used to sense the user scenario (type of request message), thereby providing a more reasonable SLC caching strategy for user data, thereby ensuring full-time high-speed writing of key applications and key scenarios ( For example, the application background changes to the foreground loading) high-speed reading.
  • the cache management module is specifically configured to: when the category corresponding to the request message is the first category, write the user data carried in the request message into the cache area. , and lock the user data carried in the request message in the cache area; when the category corresponding to the request message is the second category, write the user data carried in the request message into the cache area; or, when the request When the category corresponding to the message is the third category, the user data carried in the request message is directly written into the TLC storage area of the three-layer storage unit.
  • a reasonable caching strategy is determined based on the type of request message issued by the APP, so that some user data of low importance (no need to use cache) directly falls into the TLC storage area, avoiding the need to store data in a short period of time.
  • the secondary storage of user data can avoid additional stream overhead; and it can lock the user data issued by key APPs in the cache area, thereby ensuring full-time high-speed writing of key applications and key scenarios (such as High-speed reading of applications from background to foreground loading), thus improving the user experience.
  • the cache management module is also specifically configured to: when the available space in the cache area is less than the first threshold, cache the user data issued by the APP according to the cache policy. data.
  • the first threshold can be one quarter of the cache area, or one third of the cache area, or other thresholds, which is not limited in this application.
  • the available space in the cache area is greater than the first threshold, it means that the available space in the cache area is sufficient, and all user data issued by the APP can be stored in the cache area.
  • the available space is less than the first threshold, the user data delivered by the APP will be cached according to the cache policy. In this way, the available space can be fully utilized when there is sufficient space, and the space utilization can be improved.
  • the device further includes: a garbage collection management module, configured to migrate user data in the cache area to Three-layer memory unit TLC storage area.
  • the second threshold is one-seventh of the cache area, or one-eighth of the cache area, or other thresholds, which is not limited in this application.
  • the information of the first OP also includes bad block information of the first OP
  • the device further includes: a bad block synchronization module, configured to use the bad block information of the first OP according to the bad block information of the first OP. Perform bad block synchronization on this cache area.
  • the bad block synchronization module synchronizes the bad block information of the first OP in a timely manner and reduces the SLC cache space simultaneously. It can avoid storage errors caused by using bad blocks.
  • an electronic device in a third aspect, includes a memory and a processor, wherein the memory is used to store computer program code, and the processor is used to execute the computer program code stored in the memory to implement the first aspect or the third aspect.
  • a chip in which instructions are stored, which when run on a device, cause the chip to execute the method in the above-mentioned first aspect or any of the possible implementations of the first aspect.
  • a computer-readable storage medium In a fifth aspect, a computer-readable storage medium is provided. Computer programs or instructions are stored in the computer-readable storage medium. When the computer program or instructions are executed, the first aspect or any one of the first aspects is implemented. possible implementation methods.
  • Figure 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Figure 2 is a software structure block diagram of an electronic device provided by an embodiment of the present application.
  • Figure 3 is a schematic structural diagram of a 2D Flash medium and 3D-TLC particles
  • Figure 4 is a schematic diagram of a flash memory storage device
  • Figure 5 is a software structure block diagram of a storage device provided by an embodiment of the present application.
  • Figure 6 is a functional module schematic diagram of a storage device provided by an embodiment of the present application.
  • Figure 7 is a software structure block diagram of another storage device provided by an embodiment of the present application.
  • Figure 8 is a functional module schematic diagram of another storage device provided by an embodiment of the present application.
  • Figure 9 is a schematic diagram of a storage method provided by an embodiment of the present application.
  • Figure 10 is a schematic flow chart of a storage method provided by an embodiment of the present application.
  • Figure 11 is a schematic flow chart of yet another storage method provided by an embodiment of the present application.
  • Figure 12 is a schematic flow chart of a method for determining a cache policy provided by an embodiment of the present application.
  • Figure 13 is a schematic flow chart of yet another caching policy determination method provided by an embodiment of the present application.
  • first and second are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Therefore, features defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of this embodiment, unless otherwise specified, “plurality” means two or more.
  • the methods provided by the embodiments of this application can be applied to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, ultra mobile personal computers (ultra -Mobile personal computer (UMPC), netbook, personal digital assistant (personal digital assistant, PDA) and other electronic devices, the embodiments of this application do not place any restrictions on the specific types of electronic devices.
  • AR augmented reality
  • VR virtual reality
  • UMPC ultra mobile personal computers
  • PDA personal digital assistant
  • Flash memory refers to non-volatile memory that can be written and erased multiple times and can retain data for a long time without a current or voltage supply. Flash memory is divided into the following two modes:
  • Single-level cell A way of organizing Flash storage information.
  • Each cell (cell) can only store 1 byte (bit) of information, and the storage density is low, but the access (flash memory operations such as read/write/erase) is fast.
  • Multi-level cell A way of organizing Flash storage information. Each unit can store 2 bits of data. Its lower cost compared to single-level cell (SLC) flash memory makes it a desirable choice for consumer-grade solid-state storage.
  • SLC single-level cell
  • the disadvantage of MLC is that the bit error rate is higher than that of SLC, because it has a greater chance of misreading the unit state.
  • TLC Triple-level cell
  • the above two modes can be dynamically set according to the block (a flash is composed of many blocks) granularity during operation.
  • Quad-level cell A way of organizing Flash storage information.
  • Each unit of QLC can store 4 bits of data.
  • the storage density of QLC is increased by 33%. Not only can QLC withstand 1,000 program or erase cycles (equal to or better than TLC), but it also has increased capacity and is cheaper.
  • Bad block refers to the occurrence of certain flash areas in nand flash that cannot be erased or written. We call such a unit area a bad block. Since the read and write operations in nand flash are based on page, and the erasure is based on block, and the erasure operation must be performed before the write operation, therefore, the smallest operable unit is a block, and the entire If any irreparable bit error occurs in a block, we consider the block to be a bad block.
  • FIG. 1 shows a schematic structural diagram of an electronic device 100 .
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (SIM) card interface 195, etc.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyro 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, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • NPU neural-network processing unit
  • different processing units can be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • Interfaces may include integrated circuits (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (PCM) interface, universal asynchronous receiver/transmitter (UART) interface, mobile Industrial processor interface (mobile industry processor interface, MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (universal serial bus) bus, USB) interface, etc.
  • I2C integrated circuits
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver/transmitter
  • MIPI mobile Industrial processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL).
  • processor 110 may include multiple sets of I2C buses.
  • the processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces.
  • the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100 .
  • the processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationships between the modules illustrated in the embodiments of the present application are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
  • 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 supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, etc.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be provided on the processor 110 in.
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • 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.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may 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 LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
  • the mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent 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.
  • the application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites.
  • WLAN wireless local area networks
  • System global navigation satellite system, GNSS
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication, NFC
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , 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 through the antenna 2 for radiation.
  • 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 the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi) -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are 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 alter display information.
  • the display screen 194 is used to display images, videos, etc.
  • Display 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
  • Camera 193 is used to capture still images or video.
  • the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
  • the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other format image signals.
  • the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they 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.
  • Video codecs are used to compress or decompress digital video.
  • Electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • Intelligent cognitive applications of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100 .
  • the internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one App required for a function (such as a sound playback function, an image playback function, etc.), etc.
  • the storage data area may store data created during use of the electronic device 100 (such as audio data, phone book, etc.).
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • 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. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to hands-free calls.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.
  • Microphone 170C also called “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 close to the microphone 170C with the human mouth and input the sound signal to the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which in addition to collecting sound signals, may also implement a 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 sound sources, and implement directional recording functions, etc.
  • the headphone interface 170D is used to connect wired headphones.
  • the headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA Cellular Telecommunications Industry Association of the USA
  • the pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A there are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors sensors, capacitive pressure sensors, etc.
  • a capacitive pressure sensor may include at least two parallel plates of conductive material.
  • the electronic device 100 determines the intensity of the pressure based on the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • Magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may utilize the magnetic sensor 180D to detect opening and closing of the flip holster.
  • the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. Then, based on the detected opening and closing status of the leather case or the opening and closing status of the flip cover, features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
  • Distance sensor 180F for measuring distance.
  • Electronic device 100 can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may utilize the distance sensor 180F to measure distance to achieve fast focusing.
  • 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 outwardly through the light emitting diode.
  • Electronic device 100 uses photodiodes 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 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in holster mode, and pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
  • Fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
  • Temperature sensor 180J is used to detect temperature.
  • the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the 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 a processor located near the temperature sensor 180J in order 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 low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • 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, which is also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
  • the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
  • Bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part.
  • the bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.
  • the bone conduction sensor 180M can also be provided in an earphone and combined into a bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibrating bone obtained by the bone conduction sensor 180M to implement the voice function.
  • the application processor can The heart rate information is analyzed based on the blood pressure beating signal acquired by the bone conduction sensor 180M to implement the heart rate detection function.
  • the buttons 190 include a power button, a volume button, etc.
  • Key 190 may be a mechanical key. It can also be a touch button.
  • 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 .
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback.
  • touch operations for different applications can correspond to different vibration feedback effects.
  • the motor 191 can also respond to different vibration feedback effects for touch operations in different areas of the display screen 194 .
  • Different application scenarios such as time reminders, receiving information, alarm clocks, games, etc.
  • the touch vibration feedback effect can also be customized.
  • the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
  • the electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 is also compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
  • the electronic device 100 uses an embedded SIM (embedded-SIM, eSIM) card, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device
  • the phone card in the embodiment of this application includes but is not limited to SIM card, eSIM card, universal subscriber identity module (USIM), universal integrated circuit card (UICC), etc.
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of this application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 .
  • FIG. 2 is a software structure block diagram of the electronic device 100 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system libraries, and kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include camera, gallery, calendar, calling, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer can include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
  • a window manager is used to manage window programs.
  • the window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make this data accessible to applications.
  • Said data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide communication functions of the electronic device 100 .
  • call status management including connected, hung up, etc.
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • the notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
  • the Android Runtime includes core libraries and virtual machines. The Android runtime is responsible for the scheduling and management of the Android system.
  • the core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.
  • the application layer and application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and application framework layer into binary files.
  • the virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.
  • System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (media libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.
  • 2D Graphics Engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the electronic device in the embodiment of the present application may be a television, a desktop computer, a notebook computer, or a portable electronic device, such as a mobile phone, a tablet computer, a camera, a video recorder, a video recorder, or other electronic devices with storage functions, 5G Electronic equipment in the network or electronic equipment in the future evolved public land mobile communication network (public land mobile network, PLMN), etc.
  • PLMN public land mobile network
  • FIG. 3 shows 2D Flash media (shown in (a) in Figure 3) and 3D- A schematic structural diagram of TLC particles (shown in (b) in Figure 3). As shown in Figure 3, compared with 2D Flash media, the storage density of 3D Flash media has been significantly improved.
  • 3D-TLC particles as Flash media has led to a relatively high improvement in the storage density of flash memory.
  • some negative effects of the density increase have begun to appear. For example, memory access performance has declined, and even The proportion of its decline exceeds the proportion of density improvement.
  • the reliability of storage has also declined to a certain extent.
  • Figure 4 shows a schematic diagram of a flash memory storage device that adopts a dynamically configurable media mode.
  • the device layer of the device includes a universal flash storage (UFS) controller 401 and a flash storage array 402.
  • UFS universal flash storage
  • the flash memory storage array 402 can also be described as a flash memory storage space.
  • the UFS controller 401 divides the flash storage array 402 into a system area 4021 and a data area 4022.
  • the system area 4021 is used to store system data
  • the data area 4022 is used to store user data.
  • the flash storage array 402 can be divided into three parts: static SLC cache area A, dynamic SLC cache area B and TLC storage space C.
  • static SLC buffer area A can be used for system area 4021 and data area 4022;
  • dynamic SLC buffer area B is generally used for data area 4022.
  • the static SLC cache area, dynamic SLC cache area and TLC storage space are introduced in detail below:
  • a designated Flash storage area is allocated in the storage area.
  • the designated Flash storage area is fixed as the SLC cache area.
  • the static SLC cache area is used to receive the write request issued by the system file (host), write the data corresponding to the write request into the static SLC cache area, and then move it to the TLC storage space at the appropriate time.
  • all areas in the flash storage space that can be used to store user data can be temporarily configured as an SLC cache area, and the dynamic SLC cache area is used to receive system files ( The write request issued by the host) writes the corresponding data of the write request into the dynamic SLC cache area.
  • SLC caching policies can be set for different partitions (system area 4021 and data area 4022) of the flash storage array 402.
  • SLC static buffer area A can be configured in the system area 4021; ASLC static buffer area A and SLC dynamic buffer area B can be configured in the data area 4022.
  • the dynamically configurable media mode by adopting the dynamically configurable media mode and setting up the SLC dynamic cache area, it can provide a high-speed writing speed to receive the host's write request, and can hit the host's read request with a certain probability, improving the response. speed.
  • the static SLC cache area configured in this solution has a fixed configuration, so that the static SLC cache area can only be used as an SLC cache and cannot be switched to a normal user data storage area to store user data, resulting in a relatively large space loss, and ,
  • the SLC static cache area can usually only be configured in a small range (usually 1 to 2G space), and can only handle a small number of burst write requests.
  • Read requests are basically unable to hit, and can only play the role of a write buffer;
  • the dynamic SLC buffer area configured in this solution although there is no need to configure a fixed area for it, the size of the dynamic SLC buffer area will be much larger than the size of the static SLC buffer area, but because the device cannot sense the scene and behavior of the system , before the read hit, the user data is likely to have been recovered from the SLC dynamic cache area to the TLC storage space, resulting in a low probability of the read hitting the cache.
  • embodiments of the present application provide a storage space (cache area) invisible to users to implement caching of user data.
  • FIG. 5 shows a software structure block diagram of the storage device 500 provided by the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the system is divided into three layers, which are user layer, kernel layer and device layer from top to bottom.
  • the user layer can include applications.
  • applications can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the user layer of the storage device 500 includes an application (Application, APP) and an application group manager 501 .
  • the application group manager 501 is used to group APPs according to the first information corresponding to the APP, and is also used to determine the request message issued by the APP (IO request: communication between the upper layer program and the driver program) according to the grouping information of the APP.
  • IO request communication between the upper layer program and the driver program
  • the upper layer will issue an I/O request, that is, the second information corresponding to the input and output request package (I/O request package).
  • the request message sent by the APP carries relevant communication data (for example: user data, etc.).
  • the first information corresponding to the APP includes one or more of the priority information of the APP, the behavior information of the APP, and the attribute information of the APP.
  • the first information of the APP may also include information related to the APP. Other information is not limited in this application.
  • the priority information of the APP refers to the priority of the APP among multiple APPs. This priority can be the system default, or it can be preset by the user according to the actual situation; the behavior information of the APP refers to the priority of the APP. Information related to the operations performed or the operations that the APP can perform; the attribute information of the APP refers to the APP's own attributes, such as the category of the APP, whether it is a key APP, whether it is a system APP, etc.
  • the second information corresponding to the IO request includes one or more of the priority information of the IO request, the foreground and background information of the IO request, and the hot and cold attribute information of the IO request.
  • the second information may also include: Other information related to IO requests, this application does not limit this.
  • APPs can be divided into the first group, the second group, and the third group, where the first group includes APPs with high priority, APPs with hot and cold attributes, APPs with specific behavior information, and frontend APPs. /key APPs, etc.; the third group includes low-priority APPs, APPs with hot and cold attributes, APPs with non-specific behavior information, background/non-key APPs, etc.; the second group includes apps between the first group and the third group. APP between three groups.
  • the request message corresponding to the APP can be divided into the first category, the second category and the third category, where the first category includes the following characteristics: the behavior information is a specific behavior; the second category includes the following characteristics: The behavior information is non-specific behavior, and also includes one or more of the following characteristics: priority is high, hot and cold attributes are hot, the corresponding APP is a front-end APP, and the corresponding APP is a key APP; The three categories include the following characteristics: behavioral information is non-specific behavior, and also includes one or more of the following characteristics: low priority, hot and cold attributes: cold, the corresponding APP is a background APP, and the corresponding APP is non-critical APP.
  • the user data carried by the request message is written into the cache area.
  • the storage space of the flash storage device includes a first over-provisioning space (OP) 505 and an occupied space 506 .
  • the first reserved space 505 is the excess reserved space in the reserved space included in the storage space of the flash memory storage device.
  • the first OP may be a reserved space included in the storage space of the flash memory storage device; it may also be a part of the reserved space included in the storage space of the flash memory storage device.
  • the first OP 505 includes a static cache area of the flash storage device (eg, static SLC cache area).
  • the static cache area may also be a QLC cache area, a TLC cache area, or an MLC cache area.
  • the kernel layer of the storage device 500 includes a file system, specifically including: a cache manager 502 , a recycling manager 503 and a file storage manager 504 .
  • the cache manager 502 is used to receive the first OP 505 provided by the device layer, and combine it with its own OP into the first cache space (cache area) for unified management; it is also used to respond to the IO request according to the first OP 505.
  • the second information and the usage of the first cache space determine a reasonable cache strategy for the data carried by the IO request.
  • the cache area may be any one of a single-level storage unit SLC cache area, a multi-level storage unit MLC cache area, a three-level storage unit TLC cache area, and a four-level storage unit QLC cache area.
  • the cache area can be any of the TLC cache area, MLC cache area, and SLC cache area;
  • the SLC cache area refers to the cache area configured in the SLC writing mode
  • the MLC cache area refers to the cache area configured in the MLC writing mode
  • the TLC cache area refers to the cache area configured in the TLC writing mode.
  • the cache area can be either an MLC cache area or an SLC cache area;
  • the cache area can be the SLC cache area
  • the cache area can be configured as a cache area of any flash memory medium writing mode with a lower density than the higher-density flash memory medium.
  • the recycling manager 503 is used to reasonably transfer the data cached in the cache area to the file storage area; the file storage manager 504 is used to manage file storage in the file storage area.
  • the static cache area on the side of the flash memory storage device is cancelled, the excess reserved space of the flash memory storage device is reported to the file system, and the excess reserved space of the flash memory storage device and the reserved space of the file system itself are integrated into A storage space invisible to the user for unified configuration of the file system and caching of user data, which can improve storage space utilization and storage efficiency; and it can use the grouping information of the application to perceive user scenarios, thereby providing users with The data provides a more reasonable cache strategy, which can ensure full-time high-speed writing of key applications and high-speed reading of key scenarios (such as the application background changes to the foreground loading).
  • FIG. 6 shows a schematic functional module diagram of a storage device 600 provided by an embodiment of the present application.
  • the device 600 includes an APP grouping module 601, a cache management module 602, a garbage collection management module 603, a file storage management module 604 and a reserved space reporting module 605. in:
  • the APP grouping module 601 is used to group APPs according to the first information corresponding to the APP, and is also used to determine the second information corresponding to the request message (IO request) issued by the APP according to the grouping information of the APP.
  • the request message sent by the APP carries/carries the communication data (user data, etc.) sent by the APP.
  • the first information corresponding to the APP includes one or more of the priority information of the APP, the behavior information of the APP, and the attribute information of the APP.
  • the first information corresponding to the APP may also include other information related to the APP. Information, this application does not limit this.
  • the priority information of the APP refers to the priority of the APP among multiple APPs. This priority can be the system default, or it can be preset by the user according to the actual situation; the behavior information of the APP refers to the priority of the APP. Information related to the operations performed or the operations that the APP can perform; the attribute information of the APP refers to the APP's own attributes, such as the category of the APP, whether it is a key APP, whether it is a system APP, etc.
  • the second information corresponding to the IO request includes one or more of the priority information of the IO request, the foreground and background information of the IO request, and the hot and cold attribute information of the IO request.
  • the second information may also include other information related to the IO request (user data issued by the APP), which is not limited in this application.
  • the reserved space reporting module 605 is configured to report the first reserved space OP of the flash memory storage device to the cache management module 602, where the first OP is the excess reserved space in the reserved space included in the storage space of the flash memory storage device. Leave space.
  • the first OP may be a reserved space included in the storage space of the flash memory storage device; it may also be a part of the reserved space included in the storage space of the flash memory storage device.
  • the first OP reported by the reserved space reporting module 605 to the cache management module 602 carries the bad block information of the first OP.
  • the first OP reported is actually the information of the first OP reported in real time.
  • the information of the first OP includes space storage information of the first OP, which may be, for example, performance parameters such as the size of available storage space, and may also include bad block information of the first OP.
  • the reserved space reporting module 605 is also used to divide the storage space of the flash memory device into reserved space and occupied space, and can also be used to further divide the first OP from the aforementioned reserved space.
  • the reserved space reporting module 605 reports the reserved storage space of the flash memory storage device to the cache management module 602, which means that there is no static cache area configured in the storage space of the flash memory storage device (for example: static SLC cache area).
  • the cache management module 602 is configured to receive the first OP reported by the reserved space reporting module 603, and combine it with the reserved space OP of the file system itself into a first storage space (cache area) for unified management.
  • the OP of the above-mentioned file system itself can be the idle space reserved by the flash-friendly file system (F2FS), the idle space obtained by file compression, and the idle space obtained by file deduplication.
  • F2FS flash-friendly file system
  • the OP of the file system itself can also be other idle space of the file system, which is not limited in this application.
  • the first OP reported by the reserved space reporting module 605 to the cache management module 602 carries the bad block information of the first OP.
  • bad blocks need to be synchronized on the part of the first OP in the first cache space (cache area).
  • the cache management module 602 is also used to sense the user's application scenario based on the grouping information of the APP and the first information corresponding to the APP.
  • the cache management module 602 is specifically configured to sense the user's application scenario according to the second information corresponding to the IO request.
  • the cache management module 602 is specifically configured to determine a reasonable cache policy for the IO request based on the second information corresponding to the IO request and the usage of the first cache space.
  • the first threshold may be a quarter of the above-mentioned first cache space (cache area), and the first threshold may also be other set values, for example, it may also be the above-mentioned first cache space.
  • One-fifth of the cache space can be set according to actual conditions, and this application does not limit this.
  • a reasonable caching strategy is determined according to the user's application scenario. Specifically, a reasonable cache strategy for the IO is determined based on the second information corresponding to the IO and the usage of the first cache space.
  • the hot and cold attribute information of the request message (user data) sent by the APP is cold data, and/or the priority of the request message (user data) sent by the APP is low priority, then the The user data corresponding to the APP (carried by the request message) is directly written into the file storage area (TLC storage space) without passing through the cache area.
  • the user data corresponding to the APP is written into the cache area. Does not pass through the cache area.
  • the user data corresponding to the APP is written into the cache area and then locked so that it will not flow into the file storage area.
  • the garbage collection management module 603 is used to reasonably transfer the data cached in the cache area to the file storage area.
  • the garbage collection management module 603 is specifically configured to: when the storage space in the cache area is insufficient, reasonably transfer the data cached in the cache area to the file storage area in a timely manner.
  • the file storage management module 604 is used to manage file storage in the file storage area.
  • the static cache area on the side of the flash memory storage device is cancelled, part or all of the reserved space of the flash memory storage device is reported to the file system, and part or all of the reserved space of the flash memory storage device is combined with the reserved space of the file system itself.
  • the reserved space is integrated into a storage space invisible to the user for unified configuration of the file system and used for application caching, which can improve storage space utilization and storage efficiency; and it can use the grouping information of the application to sense user scenarios, This provides a more reasonable cache strategy for user data, thereby ensuring full-time high-speed writing of key applications and high-speed reading of key scenarios (such as the application background changing to the foreground loading).
  • FIG. 7 shows the software of a storage device 700 provided by an embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the system is divided into three layers, which are user layer, kernel layer and device layer from top to bottom.
  • the user layer can include applications.
  • applications can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the user layer of the storage device 700 includes an application (Application, APP) and an application group manager 701 .
  • the application grouping manager 701 is used to group APPs according to the first information corresponding to the APP, and is also used to determine the second information corresponding to the request data (IO) issued by the APP according to the grouping information of the APP.
  • the first information corresponding to the APP includes one or more of the priority information of the APP, the behavior information of the APP, and the attribute information of the APP.
  • the first information of the APP may also include information related to the APP. Other information is not limited in this application.
  • the priority information of the APP refers to the priority of the APP among multiple APPs. This priority can be the system default, or it can be preset by the user according to the actual situation; the behavior information of the APP refers to the priority of the APP. Information related to the operations performed or the operations that the APP can perform; the attribute information of the APP refers to the APP's own attributes, such as the category of the APP, whether it is a key APP, whether it is a system APP, etc.
  • the second information corresponding to the IO request includes one or more of the priority information of the IO request, the foreground and background information of the IO request, and the hot and cold attribute information of the IO request.
  • the second information may also include: Other information related to IO requests, this application does not limit this.
  • APPs can be divided into the first group, the second group, and the third group, where the first group includes APPs with high priority, APPs with hot and cold attributes, APPs with specific behavior information, and frontend APPs. /key APPs, etc.; the third group includes low-priority APPs, APPs with hot and cold attributes, APPs with non-specific behavior information, background/non-key APPs, etc.; the second group includes apps between the first group and the third group. APP between three groups.
  • the request message corresponding to the APP can be divided into the first category, the second category and the third category, where the first category includes the following characteristics: the behavior information is Specific behavior; the second category includes the following characteristics: the behavior information is non-specific behavior, and also includes one or more of the following characteristics: priority is high, hot and cold attributes are hot, the corresponding APP is a front-end APP, The corresponding APP is a key APP; the third category includes the following characteristics: the behavior information is non-specific behavior, and also includes one or more of the following characteristics: low priority, cold and hot attributes, and the corresponding APP It is a background APP and the corresponding APP is a non-critical APP.
  • the user data carried by the request message is written into the cache area.
  • the storage space of the flash storage device includes a first reserved space 705 and an occupied space 706, where the first OP is the reserved space included in the storage space of the flash storage device.
  • the excess reserved space in the space is the space.
  • the first OP may be a reserved space included in the storage space of the flash memory storage device; it may also be a part of the reserved space included in the storage space of the flash memory storage device.
  • the kernel layer of the storage device 700 includes a file system, specifically including: a cache manager 702 , a recycling manager 703 , and a file storage manager 704 .
  • the cache manager 702 includes a policy manager 7021 and a storage manager 7022;
  • the recycling manager 703 includes a waterline identifier 7031 and a cache data mover 7032. specific:
  • the storage manager 7022 is used to receive the first reserved space 705 provided by the device layer, and combine it with the reserved space of the file system itself into a first cache space (cache area) for unified management.
  • the policy manager 7021 is configured to determine a reasonable cache policy for the communication data carried by the IO request based on the second information corresponding to the IO request and/or the usage of the first cache space.
  • Waterline identifier 7031 used to determine the currently available space in the cache area.
  • the cache data mover 7032 is used to reasonably move the data cached in the cache area to the file storage area when the current available space in the cache area is insufficient.
  • the file storage manager 704 is used to manage file storage in the file storage area.
  • FIG. 8 shows a functional module schematic diagram of a storage device 800 provided by an embodiment of the present application.
  • the device 800 includes an APP grouping module 801, a cache Storage management module 802, garbage collection management module 803, file storage management module 804, reserved space reporting module 805 and bad block synchronization module 806. in:
  • the APP grouping module 801 is used to group APPs according to the first information corresponding to the APP, and is also used to determine the second information corresponding to the request message (IO request) issued by the APP according to the grouping information of the APP.
  • the request message (IO request) sent by the APP carries/carries the user data sent by the APP.
  • the first information corresponding to the APP includes one or more of the priority information of the APP, the behavior information of the APP, and the attribute information of the APP.
  • the first information of the APP may also include other information related to the APP. , this application does not limit this.
  • the priority information of the APP refers to the priority of the APP among multiple APPs. This priority can be the system default, or it can be preset by the user according to the actual situation; the behavior information of the APP refers to the priority of the APP. Information related to the operations performed or the operations that the APP can perform; the attribute information of the APP refers to the APP's own attributes, such as the category of the APP, whether it is a key APP, whether it is a system APP, etc.
  • the second information corresponding to the IO request includes one or more of the priority information of the IO request, the foreground and background information of the IO request, and the hot and cold attribute information of the IO request.
  • the second information may also include: Other information related to IO requests, this application does not limit this.
  • APPs can be divided into the first group, the second group, and the third group, where the first group includes APPs with high priority, APPs with hot and cold attributes, APPs with specific behavior information, and frontend APPs. /key APPs, etc.; the third group includes low-priority APPs, APPs with hot and cold attributes, APPs with non-specific behavior information, background/non-key APPs, etc.; the second group includes apps between the first group and the third group. APP between three groups.
  • the request message (user data) corresponding to the APP can be divided into the first category, the second category and the third category.
  • the first category includes the following characteristics: the behavior information is a specific behavior; the second category includes the following Characteristics: Behavior information is non-specific behavior, and also includes one or more of the following characteristics: priority is high, hot and cold attributes are hot, the corresponding APP is a front-end APP, and the corresponding APP is a key APP ;
  • the third category includes the following characteristics: the behavior information is non-specific behavior, and also includes one or more of the following characteristics: low priority, hot and cold attributes: cold, the corresponding APP is a background APP, and the corresponding APP is Non-critical APP.
  • the user data carried by the request message is written into the cache area.
  • the reserved space reporting module 805 is configured to report the first reserved space OP of the flash memory storage device to the cache management module 802, where the first OP is the excess reserved space in the reserved space included in the storage space of the flash memory storage device. Leave space.
  • the first OP may be a reserved space included in the storage space of the flash memory storage device; it may also be a part of the reserved space included in the storage space of the flash memory storage device.
  • the first OP reported by the reserved space reporting module 805 to the cache management module 802 carries the bad block information of the first OP.
  • the reserved space reporting module 805 is also used to divide the storage space of the flash memory device into reserved space and occupied space, and can also be used to further divide the first OP from the aforementioned reserved space.
  • the flash storage device divides a reasonable reserved space (OP space) based on the data partition size of the system file and the total space of the Flash particles.
  • the reserved space includes the OP space originally used for static data.
  • Cache area (for example: static SLC cache area).
  • the reserved space reporting module 805 reports the first OP of the flash storage device to the cache management module 802, which means that there is no static cache area configured in the storage space of the flash storage device.
  • the flash storage device may be a universal flash storage device (universal flash storage, UFS).
  • UFS universal flash storage
  • the bad block synchronization module 806 is used to report the corresponding bad block information to the file system in a timely manner when a bad block occurs in the first OP reported by the reserved space reporting module 805 to the cache management module 802 during use ( Cache management module 802) synchronously reduces the cache space.
  • the cache management module 802 is configured to receive the first OP reported by the reserved space reporting module 803, and combine it with the reserved space of the file system itself to form a first cache space (cache area) for unified management.
  • the storage management unit 8022 located in the cache management module 802 is used to receive the first OP reported by the reserved space reporting module 803, and combine it with the reserved space of the file system itself to form the first cache space (cache space). area) for unified management.
  • the above-mentioned first cache space serves as a cache area.
  • This cache area is a virtual cache area and is not visible to users. Moreover, after the cache area is first formed, the size of the cache area remains unchanged within a period of use.
  • this cache area is used for caching user data.
  • the reserved space of the above-mentioned file system itself can be the idle space reserved by the flash-friendly file system (F2FS), the idle space obtained by file compression, and the idle space obtained by file deduplication.
  • F2FS flash-friendly file system
  • the reserved space of the file system itself can also be other idle space of the file system, which is not limited in this application.
  • the flash memory storage device divides a reasonable reserved space OP according to the data partition size of the file system and the total space of the Flash particles, and then reports the first OP included in the OP to the high-speed Cache management module, wherein the OP includes a static cache area originally used for static cache (for example: SLC static cache area).
  • a static cache area originally used for static cache for example: SLC static cache area
  • the space saved after deduplication or compression can also be used as cache space, which is the OP of the file system itself as mentioned above.
  • the first OP reported by the reserved space reporting module 805 to the cache management module 802 carries the bad block information of the first OP.
  • the cache management module 802 receives the bad block information of the first OP sent by the bad block synchronization module 806, and performs bad block synchronization on the cache space based on the bad block information to synchronize the cache size. space.
  • the cache management module 802 is also used to sense the user's application scenario based on the grouping information of the APP and the first information corresponding to the APP.
  • the cache management module 802 is specifically configured to sense the user's application scenario according to the second information corresponding to the IO request.
  • the cache management module 802 is specifically configured to determine a reasonable cache policy for the IO based on the second information corresponding to the IO request and the usage of the first cache space.
  • the first threshold may be one-fourth of the above-mentioned first cache space, and the first threshold may also be other set values, for example, it may also be five-fifths of the above-mentioned first cache space.
  • the first threshold may be one-fourth of the above-mentioned first cache space, and the first threshold may also be other set values, for example, it may also be five-fifths of the above-mentioned first cache space.
  • a reasonable caching strategy is determined according to the user's application scenario. Specifically, a reasonable SLC cache strategy for the communication data (user data) carried by the IO request is determined based on the second information corresponding to the IO request and the usage of the first cache space.
  • the hot and cold attribute information of the IO request issued by the APP is cold data, and/or the priority of the IO request issued by the APP is low priority, then the user data carried by the IO request is directly written into the file storage area (TLC storage space) without passing through the cache area.
  • the user data carried by the IO request issued by the APP is written into the cache area. Does not pass through the cache area.
  • the user data is locked after being written into the cache area so that it will not flow into the file storage area.
  • the garbage collection management module 803 is used to reasonably transfer the data cached in the cache area to the file storage area.
  • the waterline identifier 8031 located in the garbage collection management module 803 is used to determine the current available space of the cache area.
  • the cache data mover 8032 located in the garbage collection management module 803 is used to reasonably transfer the data cached in the cache area to the file storage area when the current available space in the cache area is insufficient.
  • the garbage collection management module 803 selects blocks of the cold data stream and moves the data in the cache to the file storage area;
  • the garbage collection management module 803 moves the data in the cache to the file storage area according to the Greedy algorithm.
  • the file storage management module 804 is used to manage file storage in the file storage area.
  • the static cache area on the side of the flash memory storage device is cancelled, the excess reserved space of the flash memory storage device is reported to the file system, and the excess reserved space of the flash memory storage device and the reserved space of the file system itself are integrated into A storage space invisible to the user for unified configuration of the file system and used for application caching, which can improve storage space utilization and storage efficiency; and can use the grouping information of the application to perceive user scenarios, thereby providing user data Provide a more reasonable cache strategy to ensure full-time high-speed writing of key applications and high-speed reading in key scenarios (such as the application background changes to the foreground loading).
  • Figure 9 shows a schematic diagram of a storage method 900 provided by an embodiment of the present application.
  • the method 900 includes:
  • S901 The flash storage device cancels the static cache area of its cache space, divides its cache space, obtains the excess reserved space OP (first reserved space), and reports the first OP to the file system, where the first OP The excess reserved space within the reserved space included in the flash storage device's storage space.
  • the first OP may be a reserved space included in the storage space of the flash memory storage device; it may also be a part of the reserved space included in the storage space of the flash memory storage device.
  • the reserved space of the flash storage device includes the original static cache area.
  • the flash storage device will also report the bad block information of the first OP to the file system for bad block synchronization in the cache area in the file system.
  • the bad block information may be information carried by the first OP of the flash memory storage device, or may be a separate piece of information.
  • the corresponding caching strategy can be configured for the user data.
  • the caching strategy includes: directly storing the user data carried by the IO request into the TLC storage area; or, storing the IO
  • the user data carried by the request is stored in the cache area and locked in the cache area; or the user data carried by the IO request is stored in the cache area and not locked.
  • the second threshold may be 1/6 of the cache area, or may be a value preset according to the actual situation, for example, it may be 1/7 of the cache area, which is not limited in this application.
  • the user data cached in the cache area is reasonably migrated to the TLC storage area.
  • the non-locked user data cached in the cache area (the second category of IO in the embodiment shown in Figure 8 The user data carried by the request) is migrated to the TLC storage area.
  • FIG. 10 shows a schematic flowchart of a storage method 1000 provided by an embodiment of the present application.
  • the method 1000 includes:
  • S1001 Divide the cache space of the flash memory storage device to obtain the first reserved space OP of the flash memory storage device, where the first OP is the excess reserved space in the reserved space included in the storage space of the flash memory storage device.
  • the first OP may be a reserved space included in the storage space of the flash memory storage device; it may also be a part of the reserved space included in the storage space of the flash memory storage device.
  • the flash memory storage device cancels the static cache area in its storage space, and the reserved space of the flash memory storage device includes the static cache area.
  • the flash storage device may be a UFS device.
  • S1002 Report the first OP of the flash storage device to the file system, so that the file system configures the cache area based on the information, and the cache area includes the first OP.
  • the file system itself obtains its own reserved space through compression or deduplication, and serves as a cache area together with the first OP of the flash storage device; that is to say, the cache area includes two parts, one part is the above-mentioned The first OP of the flash storage device, and the other part is the OP of the file system itself.
  • this cache area is a virtual area, invisible to users, and can be used as a cache for user data.
  • the static cache area on the side of the flash memory storage device is cancelled, the excess reserved space of the flash memory storage device is reported to the file system, and the excess reserved space of the flash memory storage device and the reserved space of the file system itself are integrated into A storage space invisible to the user is used for unified configuration of the file system and is used for caching user data, which can improve storage space utilization and storage efficiency.
  • Figure 11 shows a schematic flow chart of a storage method 1100 provided by the embodiment of the present application. As shown in Figure 11, the method 1100 includes:
  • S1101 to S1102 are the same as S1001 to S1002 in the embodiment shown in Figure 10, and will not be described again for the sake of simplicity.
  • S1103 Determine the caching policy according to the second information corresponding to the request message.
  • APPs can be divided into the first group, the second group, and the third group, where the first group includes high-priority APPs, hot and cold attributes, etc. APPs with hot attributes, APPs whose behavior information is specific behaviors, front-end/key APPs, etc.; the third group includes APPs with low priority, APPs with hot-cold attributes of cold, APPs whose behavior information is non-specific behaviors, background/non- Key APPs, etc.; the second group is APPs between the first group and the third group.
  • the first group includes high-priority APPs, hot and cold attributes, etc.
  • APPs with hot attributes APPs whose behavior information is specific behaviors, front-end/key APPs, etc.
  • the third group includes APPs with low priority, APPs with hot-cold attributes of cold, APPs whose behavior information is non-specific behaviors, background/non- Key APPs, etc.
  • the second group is APPs between the first group and the third
  • the request message sent by the APP can be divided into the first category, the second category and the third category, where the first category includes the following characteristics: the behavior information is a specific behavior; the second category includes the following characteristics : The behavior information is non-specific behavior, and also includes one or more of the following characteristics: priority is high, hot and cold attributes are hot, the corresponding APP is a front-end APP, and the corresponding APP is a key APP; The third category includes the following characteristics: the behavior information is non-specific behavior, and also includes one or more of the following characteristics: low priority, hot and cold attributes: cold, the corresponding APP is a background APP, the corresponding APP is not Key APP.
  • the user data carried by the request message is written into the cache area.
  • the caching strategy includes: directly storing the user data carried by the request message of the third category into the TLC storage area; or, storing the user data carried by the request message of the first category in the cache area and locking it in the cache area.
  • the cache area or, store the user data carried by the request message of the second category in the cache area without locking.
  • S1104 Cache the above user data according to the above caching policy.
  • the grouping information of the application can be used to perceive user scenarios (categories of request messages), thereby providing a more reasonable cache strategy for user data, thereby ensuring full-time high-speed writing of key applications and key scenarios ( For example, the application background changes to the foreground loading) high-speed reading.
  • FIG. 12 shows a schematic flow chart of a cache policy determination method 1200 provided by an embodiment of the present application. As shown in Figure 12, the method 1200 includes:
  • S1201 Group the APPs according to the first information corresponding to them.
  • APPs can be divided into the first group, the second group, and the third group, where the first group includes APPs with high priority, APPs with hot and cold attributes, APPs with specific behavior information, and frontend APPs. /key APPs, etc.; the third group includes low-priority APPs, APPs with hot and cold attributes, APPs with non-specific behavior information, background/non-key APPs, etc.; the second group includes apps between the first group and the third group. APP between three groups.
  • S1202 According to the grouping situation of the APP, determine the second information corresponding to the request message sent by the APP.
  • the request message is an IO request.
  • S1203 Determine the category corresponding to the request message based on the second information corresponding to the above request message.
  • the request message sent by the APP carries the user data sent by the APP.
  • the request message sent by the APP can be divided into the first category, the second category and the third category, where the first category includes the following characteristics: the behavior information is a specific behavior; the second category includes the following characteristics: behavior information It is a non-specific behavior, and also includes one or more of the following characteristics: high priority, hot and cold attributes, the corresponding APP is a front-end APP, and the corresponding APP is a key APP; the third category It includes the following characteristics: the behavior information is non-specific behavior, and also includes one or more of the following characteristics: low priority, hot and cold attributes: cold, the corresponding APP is a background APP, and the corresponding APP is a non-critical APP.
  • the user data carried by the request message is written into the cache area.
  • step S1207 During the use of the cache area, determine whether the current available space of the cache area is less than the second threshold, and if so, execute step S1208.
  • the second threshold may be 1/6 of the cache area, or may be a value preset according to the actual situation, for example, it may be 1/7 of the cache area, which is not limited in this application.
  • S1208 Reasonably migrate the user data cached in the cache area to the TLC storage space.
  • the user data cached in the cache area is reasonably migrated to the TLC storage area.
  • the non-locked user data cached in the cache area (the user data carried by the above-mentioned second category request message) can be reasonably migrated. Migrate to TLC storage area.
  • a reasonable caching strategy is determined based on the type of request message issued by the APP, so that some user data of low importance (no need to use cache) directly falls into the TLC storage area, avoiding the need to store data in a short period of time.
  • the secondary storage of user data can avoid additional stream overhead; and it can lock the user data issued by key APPs in the cache area, thereby ensuring full-time high-speed writing of key applications and key scenarios (such as High-speed reading of application background to foreground loading). Thereby improving the user experience.
  • FIG. 13 shows a schematic flowchart of yet another caching policy determination method provided by an embodiment of the present application. As shown in Figure 13, the method 1300 includes:
  • the first threshold can be one-quarter of the cache area, and the first threshold can also be other set values, for example, it can also be one-fifth of the cache area, and can be based on It is set according to the actual situation, and this application does not limit this.
  • S1302 Determine the caching policy according to the second information corresponding to the request message sent by the APP.
  • the request message sent by the APP carries the user data sent by the APP.
  • the caching strategy is not determined based on the second information corresponding to the request message issued by the APP (the type of the request message carrying user data), but all APPs are downloaded. All user data sent is written into the cache area, which can further improve cache space utilization and cache efficiency, and improve user experience.
  • Embodiments of the present application also provide a computer-readable medium.
  • the computer-readable medium stores program code.
  • the computer program code When the computer program code is run on a computer, it causes the computer to execute any one of the methods in Figures 9 to 13. .
  • An embodiment of the present application also provides a chip, including: at least one processor and a memory.
  • the at least one processor is coupled to the memory and is used to read and execute instructions in the memory to execute the above-mentioned Figures 9 to 13. any method.
  • An embodiment of the present application also provides an electronic device, which includes a storage device as shown in any one of FIGS. 5 to 8 to perform any one of the above methods in FIGS. 9 to 13 .
  • An embodiment of the present application also provides an electronic device, including: at least one processor and a memory.
  • the at least one processor is coupled to the memory and is used to read and execute instructions in the memory to execute the above-mentioned Figures 9 to 13. any of the methods.
  • One or more of the modules or units described herein may be implemented in software, hardware, or a combination of both.
  • the software exists in the form of computer program instructions and is stored in the memory.
  • the processor can be used to execute the program instructions and implement the above method flow.
  • the processor may include, but is not limited to, at least one of the following: a central processing unit (CPU), a microprocessor, a digital signal processor (DSP), a microcontroller unit (MCU), or artificial intelligence
  • CPU central processing unit
  • DSP digital signal processor
  • MCU microcontroller unit
  • Each computing device may include one or more cores for executing software instructions to perform calculations or processing.
  • the processor can be built into an SoC (system on a chip) or an application specific integrated circuit (ASIC), or it can be an independent semiconductor chip.
  • the processor may further include necessary hardware accelerators, such as field programmable gate array (FPGA), PLD (programmable logic device) , or a logic circuit that implements dedicated logic operations.
  • FPGA field programmable gate array
  • PLD programmable logic device
  • the hardware may be a CPU, microprocessor, DSP, MCU, artificial intelligence processor, ASIC, SoC, FPGA, PLD, dedicated digital circuit, hardware accelerator or non- Any one or any combination of integrated discrete devices, which can run necessary software or not rely on software to perform the above method process.
  • the modules or units described herein When the modules or units described herein are implemented using software, they may be implemented in whole or in part 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, the processes or functions described in the embodiments of the present application are generated in whole or in part.
  • 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 or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium with cache-like configuration capabilities that can be accessed by the computer, or data including one or more servers, data centers, etc. integrated with available media with cache-like configuration capabilities. storage device.
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供了一种存储的方法、装置和电子设备,该方法应用于存储装置,该存储装置包括预留空间OP上报模块和高速缓存管理模块,该方法包括:OP上报模块向高速缓存管理模块上报第一OP的信息,该第一OP为闪存存储设备的OP中获得的未被占用的OP,OP上报模块和高速缓存管理模块分别位于存储装置的设备层和内核层;然后,基于第一OP的信息,高速缓存管理模块配置高速缓存区域,该高速缓存区域包括该第一OP。该方法使得内核层的管理模块能够对设备层的多余预留空间进行配置,可用于用户数据的高速缓存,能够提升存储空间的利用率和存储效率。

Description

存储的方法、装置和电子设备
本申请要求于2022年08月31日提交中国专利局、申请号为202211066503.X、申请名称为“存储的方法、装置和电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及存储领域,并且更具体地,涉及一种存储的方法、装置和电子设备。
背景技术
随着存储技术的发展,闪存(flash)相关的产品也逐渐朝着存储密度高的方向发展,然而,随着其存储密度的提升,一些密度提升的负作用也开始显现,例如,闪存的访问性能下降,甚至其下降的比例超出密度提升的比例,此外,存储的可靠性也出现一定的下降。
因此,亟需提供一种存储方法,使得在存储密度提升的同时,能够降低密度提升带来的负作用。
发明内容
本申请提供一种存储的方法、装置和电子设备,该方法应用于存储装置,该存储装置包括预留空间OP上报模块和高速缓存管理模块,该方法包括:OP上报模块向高速缓存管理模块上报第一OP的信息,该第一OP为闪存存储设备的OP中获得的未被占用的OP,其中,OP上报模块位于所述存储装置的设备层,高速缓存管理模块位于所述存储装置的内核层;基于该第一OP的信息,高速缓存管理模块配置高速缓存区域,该高速缓存区域包括该第一OP。可选地,闪存存储设备可以是UFS设备。
应理解:该闪存存储设备的预留空间OP包括该第一OP。
可选地,所述高速缓存区域用于数据的高速缓存。所述用户数据是指应用程序APP下发的数据,例如可以是用户数据。
其中,第一OP的信息包括第一OP的空间存储信息,例如可以是可用存储空间的大小等性能参数。
可选地,高速缓存区域可以为单层存储单元SLC缓存区域、多层存储单元MLC缓存区域、三层存储单元TLC缓存区域,四层存储单元QLC缓存区域中的任意一种。
具体地:
当设备层配置的存储介质为QLC时,高速缓存区域可以是TLC缓存区域、MLC缓存区域、SLC缓存区域中的任意一种;
其中,SLC缓存区域是指配置为SLC写入方式的缓存区域;MLC缓存区域是指配置为MLC写入方式的缓存区域;TLC缓存区域是指配置为TLC写入方式的缓存区域。
当设备层配置的存储介质为TLC时,高速缓存区域可以是MLC缓存区域、SLC缓存区域中的任意一种;
当设备层配置的存储介质为MLC时,高速缓存区域可以是SLC缓存区域。
应理解:当未来出现的设备层配置的存储介质为更高密度的闪存介质时,高速缓存区域可以配置为任意比该更高密度的闪存介质的密度低的闪存介质写入方式的缓存区域。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的多余预留空间上报给存储装置内核层中的文件系统(包括高速缓存管理模块),作为一个用户看不见的存储空间(高速缓存区域),以供文件系统统一配置,可以用于用户数据的高速缓存,这样,能够提升存储空间的利用率和存储效率。
结合第一方面,在一种可能的实现方式中,该高速缓存区域还包括该文件系统自身的OP,该文件系统位于该存储装置的内核层。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的多余预留空间上报给文件系统,将该闪存存储设备的多余预留空间与文件系统自身的闲置存储预留空间整合为一个用户看 不见的存储空间(高速缓存区域),以供文件系统统一配置,可以用于用户数据的高速缓存,能够提升存储空间的利用率和存储效率。
结合第一方面,在一种可能的实现方式中,高速缓存管理模块配置高速缓存区域,包括:当该高速缓存区域的可用空间大于或者等于第一阈值时,高速缓存管理模块将应用程序APP下发的用户数据写入该高速缓存区域。
本申请实施例中,当高速缓存区域的当前可用空间充足时,不根据APP下发的请求消息对应的第二信息(承载用户数据的请求消息的类别)确定缓存策略,而是将所有APP下发的用户数据都写入高速缓存区域,这样,能够进一步提高缓存空间的利用率和缓存效率,提高用户的使用体验。
结合第一方面,在一种可能的实现方式中,高速缓存管理模块配置高速缓存区域,还包括:高速缓存管理模块确定应用程序APP下发的请求消息对应的类别,该请求消息携带该APP下发的用户数据;再根据该请求消息对应的类别确定该APP下发的用户数据的缓存策略,并根据该缓存策略缓存该APP下发的用户数据。
其中,存储装置还可以包括APP分组模块,高速缓存管理模块确定APP下发的请求消息对应的类别,可以包括:APP分组模块根据该APP对应的第一信息对该APP进行分组,该第一信息包括该APP的优先级信息、该APP的行为信息、该APP的属性信息中的一项或者多项;APP分组模块再根据该APP的分组情况,确定该APP下发的请求消息对应的第二信息,该第二信息包括该请求消息的优先级信息、该请求消息的行为信息、该请求消息的前后台信息、该请求消息的冷热属性信息中的一项或者多项;然后高速缓存管理模块根据该请求消息对应的第二信息确定该请求消息对应的类别。
进一步地,高速缓存管理模块根据该请求消息对应的第二信息确定该请求消息对应的类别,包括:当该请求消息的行为信息为特定行为时,高速缓存管理模块确定该请求消息对应的类别为第一类别;当该请求消息的行为信息为非特定行为,且满足该优先级信息为高优先级、该冷热属性信息为热、该前后台信息为前台APP中的一项或者多项时,高速缓存管理模块确定该请求消息对应的类别为第二类别;或,当该请求消息的行为信息为非特定行为,且满足该优先级信息为低优先级、该冷热属性信息为冷、该前后台信息为后台APP中的一项或者多项时,高速缓存管理模块确定该请求消息对应的类别为第三类别。
本申请实施例中,能够利用应用程序的分组信息感知用户场景(请求消息的类别),从而为用户数据提供更合理的SLC缓存策略,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。
结合第一方面,在一种可能的实现方式中,高速缓存管理模块根据该请求消息对应的类别确定该APP下发的用户数据的缓存策略,并根据该缓存策略缓存该APP下发的用户数据,包括:当该请求消息对应的类别为第一类别时,高速缓存管理模块将该请求消息携带的用户数据写入该高速缓存区域,并将该请求消息携带的用户数据锁定在该高速缓存区域;当该请求消息对应的类别为第二类别时,高速缓存管理模块将该请求消息携带的用户数据写入该高速缓存区域;或,当该请求消息对应的类别为第三类别时,高速缓存管理模块将该请求消息所携带的用户数据直接写入三层存储单元TLC存储区域。
本申请实施例中,根据APP下发的请求消息的类别确定合理的缓存策略,使得一些重要性不高(没有必要用到高速缓存)的用户数据直接落入TLC存储区域,避免了短时内用户数据的2次存储,进而能够避免带来额外的流开销;并且,能够使得关键APP下发的用户数据锁定在高速缓存区域,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取,从而提升用户的使用体验。
结合第一方面,在一种可能的实现方式中,高速缓存管理模块根据该缓存策略缓存该APP下发的用户数据,包括:当该高速缓存区域的可用空间小于该第一阈值时,高速缓存管理模块根据该缓存策略缓存该APP下发的用户数据。
可选地,该第一阈值为该高速缓存区域的四分之一,还可以为该高速缓存区域的三分之一,还可以为其他阈值,本申请对此不作限定。
本申请实施例中,若高速缓存区域的可用空间大于第一阈值,则说明高速缓存区域的可用空间充足,可以把所有APP下发的用户数据都存入高速缓存区域,只有在高速缓存区域的可用空间小于第一阈值时,才会根据缓存策略缓存APP下发的用户数据,这样,能够使得可用空间在充足的时候得到充 分的利用,能够提高空间的利用率。
结合第一方面,在一种可能的实现方式中,存储装置还包括垃圾回收管理模块,方法还包括:当该高速缓存区域的可用空间小于第二阈值时,垃圾回收管理模块将该高速缓存区域的用户数据迁移至三层存储单元TLC存储区域。
可选地,该第二阈值为该高速缓存区域的七分之一,还可以为该高速缓存区域的八分之一,还可以为其他阈值,本申请对此不作限定。
本申请实施例中,在识别到高速缓存区域的可用空间不足时,及时将一些不必要的用户数据迁移到TLC存储区域,这样,能够避免由于高速缓存区域的空间被不必要的用户数据长期占据而导致的缓存出错。
结合第一方面,在一种可能的实现方式中,第一OP的信息还可以包括该第一OP的坏块信息,该第一OP的坏块信息用于对高速缓存区域进行坏块同步。
本申请实施例中,及时对第一OP的坏块信息进行同步,并同步缩小SLC缓存空间,能够避免因使用坏块而导致的存储出错。
第二方面,提供一种存储的装置,该装置包括预留空间OP上报模块和高速缓存管理模块,其中:预留空间上报模块,用于向高速缓存管理模块上报第一OP的信息,该第一OP为闪存存储设备的OP中获得的未被占用的OP,其中,OP上报模块位于所述存储装置的设备层,高速缓存管理模块位于所述存储装置的内核层;高速缓存管理模块,用于基于所述第一OP的信息,配置高速缓存区域,该高速缓存区域包括该第一OP。
可选地,闪存存储设备可以是UFS设备。
可选地,所述高速缓存区域用于数据的高速缓存。所述用户数据是指应用程序APP下发的数据,例如可以是用户数据。
其中,第一OP的信息包括第一OP的空间存储信息,例如可以是可用存储空间的大小等性能参数。
可选地,高速缓存区域可以为单层存储单元SLC缓存区域、多层存储单元MLC缓存区域、三层存储单元TLC缓存区域,四层存储单元QLC缓存区域中的任意一种。
具体地:
当设备层配置的存储介质为QLC时,高速缓存区域可以是TLC缓存区域、MLC缓存区域、SLC缓存区域中的任意一种;
其中,SLC缓存区域是指配置为SLC写入方式的缓存区域;MLC缓存区域是指配置为MLC写入方式的缓存区域;TLC缓存区域是指配置为TLC写入方式的缓存区域。
当设备层配置的存储介质为TLC时,高速缓存区域可以是MLC缓存区域、SLC缓存区域中的任意一种;
当设备层配置的存储介质为MLC时,高速缓存区域可以是SLC缓存区域。
应理解:当未来出现的设备层配置的存储介质为更高密度的闪存介质时,高速缓存区域可以配置为任意比该更高密度的闪存介质的密度低的闪存介质写入方式的缓存区域。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的闲置存储多余预留空间上报给存储装置内核层中的文件系统(包括高速缓存管理模块),作为一个用户看不见的存储空间(高速缓存区域),以供文件系统统一配置,可以用于用户数据的高速缓存,这样,能够提升存储空间的利用率和存储效率。
结合第二方面,在一种可能的实现方式中,该高速缓存区域还包括该文件系统自身的OP,该文件系统位于该存储装置的内核层。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的多余预留空间上报给文件系统,将该闪存存储设备的多余预留空间与文件系统自身的闲置存储预留空间整合为一个用户看不见的存储空间(高速缓存区域),以供文件系统统一配置,可以用于用户数据的高速缓存,能够提升存储空间的利用率和存储效率。
结合第二方面,在一种可能的实现方式中,该高速缓存管理模块还用于:当该高速缓存区域的可用空间大于或者等于第一阈值时,将应用程序APP下发的用户数据写入该高速缓存区域。
本申请实施例中,当高速缓存区域的当前可用空间充足时,不根据APP下发的请求消息对应的第 二信息(承载用户数据的请求消息的类别)确定缓存策略,而是将所有APP下发的用户数据都写入高速缓存区域,这样,能够进一步提高缓存空间的利用率和缓存效率,提高用户的使用体验。
结合第二方面,在一种可能的实现方式中,该高速缓存管理模块还用于:确定APP下发的请求消息对应的类别,该请求消息携带该APP下发的用户数据;根据该请求消息对应的类别确定该APP下发的用户数据的缓存策略,并根据该缓存策略缓存该APP下发的用户数据。
结合第二方面,在一种可能的实现方式中,该装置还包括:APP分组模块,用于根据该APP对应的第一信息对该APP进行分组,该第一信息包括该APP的优先级信息、该APP的行为信息、该APP的属性信息中的一项或者多项;该APP分组模块还用于,根据该APP的分组情况,确定该APP下发的请求消息对应的第二信息,该第二信息包括该请求消息的优先级信息、该请求消息的行为信息、该请求消息的前后台信息、该请求消息的冷热属性信息中的一项或者多项;该高速缓存管理模块具体用于,根据该请求消息对应的第二信息确定该请求消息对应的类别。
其中,该高速缓存管理模块具体用于:当该请求消息的行为信息为特定行为时,确定该请求消息对应的类别为第一类别;当该请求消息的行为信息为非特定行为,且满足该优先级信息为高优先级、该冷热属性信息为热、该前后台信息为前台APP中的一项或者多项时,确定该请求消息对应的类别为第二类别;或,当该请求消息的行为信息为非特定行为,且满足该优先级信息为低优先级、该冷热属性信息为冷、该前后台信息为后台APP中的一项或者多项时,确定该请求消息对应的类别为第三类别。
本申请实施例中,能够利用应用程序的分组信息感知用户场景(请求消息的类别),从而为用户数据提供更合理的SLC缓存策略,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。
结合第二方面,在一种可能的实现方式中,该高速缓存管理模块具体用于:当该请求消息对应的类别为第一类别时,将该请求消息携带的用户数据写入该高速缓存区域,并将该请求消息携带的用户数据锁定在该高速缓存区域;当该请求消息对应的类别为第二类别时,将该请求消息携带的用户数据写入该高速缓存区域;或,当该请求消息对应的类别为第三类别时,将该请求消息所携带的用户数据直接写入三层存储单元TLC存储区域。
本申请实施例中,根据APP下发的请求消息的类别确定合理的缓存策略,使得一些重要性不高(没有必要用到高速缓存)的用户数据直接落入TLC存储区域,避免了短时内用户数据的2次存储,进而能够避免带来额外的流开销;并且,能够使得关键APP下发的用户数据锁定在高速缓存区域,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取,从而提升用户的使用体验。
结合第二方面,在一种可能的实现方式中,该高速缓存管理模块还具体用于:当该高速缓存区域的可用空间小于该第一阈值时,根据该缓存策略缓存该APP下发的用户数据。
可选地,该第一阈值为该高速缓存区域的四分之一,还可以为该高速缓存区域的三分之一,还可以为其他阈值,本申请对此不作限定。
本申请实施例中,若高速缓存区域的可用空间大于第一阈值,则说明高速缓存区域的可用空间充足,可以把所有APP下发的用户数据都存入高速缓存区域,只有在高速缓存区域的可用空间小于第一阈值时,才会根据缓存策略缓存APP下发的用户数据,这样,能够使得可用空间在充足的时候得到充分的利用,能够提高空间的利用率。
结合第二方面,在一种可能的实现方式中,该装置还包括:垃圾回收管理模块,用于当该高速缓存区域的可用空间小于第二阈值时,将该高速缓存区域的用户数据迁移至三层存储单元TLC存储区域。
可选地,该第二阈值为该高速缓存区域的七分之一,还可以为该高速缓存区域的八分之一,还可以为其他阈值,本申请对此不作限定。
本申请实施例中,在识别到高速缓存区域的可用空间不足时,及时将一些不必要的用户数据迁移到TLC存储区域,这样,能够避免由于高速缓存区域的空间被不必要的用户数据长期占据而导致的缓存出错。
结合第二方面,在一种可能的实现方式中,第一OP的信息还包括该第一OP的坏块信息,该装置还包括:坏块同步模块,用于根据第一OP的坏块信息对该高速缓存区域进行坏块同步。
本申请实施例中,坏块同步模块及时对第一OP的坏块信息进行同步,并同步缩小SLC缓存空间, 能够避免因使用坏块而导致的存储出错。
第三方面,提供一种电子设备,该电子设备包括存储器和处理器,其中,存储器用于存储计算机程序代码,处理器用于执行存储于存储器中的计算机程序代码,以实现上述第一方面或第一方面中任一种可能实现方式中的方法。
第四方面,提供了一种芯片,其中存储有指令,当其在设备上运行时,使得所述芯片执行上述第一方面或第一方面中任一种可能实现方式中的方法。
第五方面,提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序或指令,当该计算机程序或指令被执行时,实现上述第一方面或第一方面中任一种可能实现方式中的方法。
附图说明
图1是本申请实施例提供的一种电子设备的结构示意图;
图2是本申请实施例提供的一种电子设备的软件结构框图;
图3是一种2D的Flash介质和3D-TLC颗粒的结构示意图;
图4是一种闪存存储装置的示意图;
图5是本申请实施例提供的一种存储装置的软件结构框图;
图6是本申请实施例提供的一种存储装置的功能模块示意图;
图7是本申请实施例提供的另一种存储装置的软件结构框图;
图8是本申请实施例提供的另一种存储装置的功能模块示意图;
图9是本申请实施例提供的一种存储方法的示意图;
图10是本申请实施例提供的一种存储方法的示意性流程图;
图11是本申请实施例提供的又一种存储方法的示意性流程图;
图12是本申请实施例提供的一种缓存策略的确定方法的示意性流程图;
图13是本申请实施例提供的又一种缓存策略的确定方法的示意性流程图。
具体实施方式
下面将结合附图,对本申请中的技术方案进行描述。显然,所描述的实施例仅仅是本申请的一部分实施例,而不是全部的实施例。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“复数个”或者“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请以下各实施例中,“至少一个”、“一个或多个”是指一个、两个或两个以上。术语“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“一个实施例”、“一些实施例”、“另一个实施例”、“另外一些实施例”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
本申请实施例提供的方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等电子设备上,本申请实施例对电子设备的具体类型不作任何限制。
以下,先对本申请实施例中涉及到的一些术语进行详细介绍。
1.闪存(flash)
闪存是指非易失性内存,该内存可以多次写入擦除,并且可以在没有电流电压供应的情况下长久保持数据。闪存分为以下两种模式:
(1)单层存储单元(single-level cell,SLC):Flash存储信息组织的一种方式。每个单元(cell)只能存储1字节(bit)信息,存储密度低,但访问(读/写/擦等闪存操作)速度快。
(2)多层存储单元(multi-level cell,MLC):Flash存储信息组织的一种方式。是在每个单元可以存储2bit数据。相比于单层存储单元(SLC)闪存,其成本要低,这使得它是消费级固态存储的可取选择。MLC的缺点是比特误差率比SLC要高,那是因为它误读单元状态的机率大。
(3)三层存储单元(triple-level cell,TLC):Flash存储信息组织的一种方式。每个cell只能存储3bit信息,存储密度高,但访问(读/写/擦等闪存操作)速度慢。
上述两种模式,在运行的时候,按照block(一个flash由许多个block组成)粒度可动态设置。
(4)四层存储单元(quad-level cell,QLC):Flash存储信息组织的一种方式。QLC每个单元可储存4bit数据,跟TLC相比,QLC的储存密度提高了33%。QLC不仅能经受1000次编程或擦写循环(与TLC相当,甚至更好),而且容量提升了,成本也更低。
2.坏块
坏块是指:在nand flash中出现某些flash区域不能进行擦写操作,我们称这样的一个单位区域为一个坏块。而由于nand flash中的读和写操作是以page为单位,擦除是以block为单位,且写操作之前必须要先进行擦除操作,因此,一个最小的可操作单位即为一个block,整个block中产生任何不可修复的位错误,我们就认为这个块是坏块。
示例性的,图1示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户身份识别(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated  circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户身份识别(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器 110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(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,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的App(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传 感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以 基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用嵌入式SIM(embedded-SIM,eSIM)卡,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。
应理解,本申请实施例中的电话卡包括但不限于SIM卡、eSIM卡、全球用户识别卡(universal subscriber identity module,USIM)、通用集成电话卡(universal integrated circuit card,UICC)等等。
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图2是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
应理解,本申请实施例中的技术方案可以用于Android、IOS、鸿蒙等系统中。
本申请实施例的技术方案可以应用于电子设备或者服务器等设备的内存管理场景。
本申请实施例中的电子设备可以是电视机、台式电脑、笔记本电脑,还可以是便携式电子设备,诸如手机、平板电脑、照相机、摄影机、录像机,还可以是其他具有存储功能的电子设备、5G网络中的电子设备或者未来演进的公用陆地移动通信网络(public land mobile network,PLMN)中的电子设备等,本申请对此不做限定。
当前,业界主流的Flash介质采用的是3D的三层存储单元(triple-level cell,TLC)颗粒,图3示出了2D的Flash介质(如图3中的(a)所示)和3D-TLC颗粒(如图3中的(b)所示)的结构示意图,由图3可知,相较于2D的Flash介质,3D的Flash介质的存储密度有显著的提升。
采用3D-TLC颗粒为Flash介质,使得闪存的存储密度得到了比较高的提升,然而,随着其存储密度的提升,一些密度提升的负作用也开始显现,例如,内存的访问性能下降,甚至其下降的比例超出密度提升的比例,此外,存储的可靠性也出现一定的下降。
针对该问题,图4示出了一种闪存存储装置的示意图,该装置采用了动态可配置的介质模式。如图4所示,该装置的设备层包括通用闪存存储(universal flash storage,UFS)控制器401和闪存存储阵列402。其中,闪存存储阵列402也可以描述为闪存存储空间。
具体地,UFS控制器401在位于内核层中的系统文件(host)的指令下,将闪存存储阵列402分为系统区4021和数据区4022,其中,系统区4021用于存储系统数据,数据区4022用于存储用户数据。
进一步地,闪存存储阵列402可以划分成3部分,分别为:静态SLC缓存区A、动态SLC缓存区B和TLC存储空间C。其中,静态SLC缓存区A可用于系统区4021和数据区4022;动态SLC缓存区B一般用于数据区4022。为了便于理解,以下,分别对:静态SLC缓存区、动态SLC缓存区和TLC存储空间进行详细介绍:
1.静态SLC缓存区
产品初始化时,在存储区域划出一块指定的Flash存储区域,在整个产品的使用周期内,将该指定的Flash存储区域固定作为SLC高速缓存的区域。并且,静态SLC缓存区用于接收系统文件(host)下发的写请求,将该写请求相应的数据写入该静态SLC缓存区,然后再在合适的时机将其搬移到TLC存储空间。
2.动态SLC缓存区
不配置特定的区域固定作为SLC高速缓存的区域,闪存存储空间中的所有可用于存储用户数据的区域都可以临时配置为SLC高速缓存的区域,并且,该动态SLC缓存区用于接收系统文件(host)下发的写请求,将该写请求相应的数据写入该动态SLC缓存区。
也可以理解为:针对闪存存储阵列402不同的分区(系统区4021和数据区4022),可以设置不同的SLC缓存策略。在系统区4021可配置SLC静态缓存区A;在数据区4022可配置ASLC静态缓存区A和SLC动态缓存区B。
该实施例中,通过采用了动态可配置的介质模式,设置SLC动态缓存区,能够提供高速的写入速度来接收host的写请求,并且能在一定概率下命中host的读请求,提高了响应速度。
然而,该方案还是存在一些不足之处。一方面,该方案配置的静态SLC缓存区为固定配置,使得该静态SLC缓存区仅能用作SLC高速缓存,无法切换为正常的用户数据存储区来存储用户数据,导致空间损失比较大,并且,SLC静态缓存区通常只能配置为很小的范围(通常是1~2G空间),只能承接少量突发(burst)的写请求,读请求基本无法命中,只能发挥写buffer的作用;另一方面,该方案中配置的动态SLC缓存区,尽管由于无需为其配置固定的区域,动态SLC缓存区的大小会远大于静态SLC缓存区的大小,但由于器件无法感知系统的场景和行为,在读命中前,用户数据很可能已经从SLC动态缓存区回收到了TLC存储空间,导致读命中缓存的概率还是不高,并且,对于写场景,难以识别什么时候直落TLC存储空间(绕过SLC缓存区),导致数据先写入SLC缓存区,然后又马上搬移到TLC存储空间,导致数据短时写了2次,从而引入写放大,反而降低了写性能,此外,由于除了原先要支持TLC存储空间的流,在高速缓存区域也同样需要对应的流,使得该过程还可能带来额外的流开销。
针对上述问题,本申请实施例提供了一种用户不可见的存储空间(高速缓存区域),来实现用户数据的高速缓存。
示例性地,图5示出了本申请实施例提供的存储装置500的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将系统分为三层,从上至下分别为用户层、内核层以及设备层。用户层可以包括应用程序。
可选地,应用程序可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
如图5所示,存储装置500的用户层包括应用程序(Application,APP)和应用程序分组管理器501。
其中,应用程序分组管理器501用于根据APP对应的第一信息将APP进行分组,还用于根据APP的分组信息确定该APP下发的请求消息(IO请求:上层程序与驱动程序之间通信时,上层会发出I/O请求,即输入输出请求包(I/O request package))对应的第二信息。
其中,APP下发的请求消息携带相关的通信数据(例如:用户数据等)。
其中,可选地,APP对应的第一信息包括APP的优先级信息、APP的行为信息、APP的属性信息中的一项或者多项,此外,APP的第一信息还可以包括与APP相关的其他信息,本申请对此不作限定。
更具体地,APP的优先级信息是指该APP在多个APP中的优先级,该优先级可以是系统默认的,也可以是用户根据实际情况预先设置的;APP的行为信息是指APP即将执行的操作或该APP能够执行的操作相关的信息;APP的属性信息是指APP的自身属性,例如APP的类别、是否为关键APP、是否为系统APP等。
可选地,IO请求对应的第二信息包括IO请求的优先级信息、IO请求的前后台信息、IO请求的冷热属性信息中的一项或者多项,此外,第二信息还可以包括与IO请求相关的其他信息,本申请对此不作限定。
可选地,可以将APP分为第一组、第二组和第三组,其中,第一组包括优先级高的APP、冷热属性为热的APP、行为信息为特定行为的APP、前台/关键APP等;第三组包括优先级低的APP、冷热属性为冷的APP、行为信息为非特定行为的APP、后台/非关键APP等;第二组为介于第一组和第三组之间的APP。
类似地,可选地,可以将APP对应的请求消息分为第一类别、第二类别和第三类别,其中,第一类别包括以下特征:行为信息为特定行为;第二类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为高、冷热属性为热、对应的所述APP为前台APP、对应的所述APP为关键APP;第三类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为低、冷热属性为冷、对应的APP为后台APP、对应的APP为非关键APP。
可选地,可以理解为:若确定请求消息的类别不是第三类别,则该请求消息承载的用户数据写入高速缓存区域。
如图5所示,存储装置500的设备层中,闪存存储设备的存储空间包括第一预留空间(over-provisioning,OP)505和已占用空间506。其中,第一预留空间505为闪存存储设备的存储空间所包括的预留空间中的多余预留空间。
可选地,第一OP可以是闪存存储设备的存储空间所包括的预留空间;也可以是闪存存储设备的存储空间所包括的预留空间的一部分。
可选地,第一OP505包括闪存存储设备的静态缓存区域(例如:静态SLC缓存区域)。
可选地,静态缓存区域还可以是QLC缓存区域,还可以是TLC缓存区域,还可以是MLC缓存区域。
如图5所示,存储装置500的内核层包括文件系统,具体包括:高速缓存管理器502、回收管理器503和文件存储管理器504。
其中,高速缓存管理器502,用于接收设备层提供的第一OP505,并将其与自身的OP拼合成第一缓存空间(高速缓存区域),进行统一管理;还用于根据IO请求对应的第二信息和第一缓存空间的使用情况确定针对该IO请求携带的数据的合理的高速缓存策略。
可选地,高速缓存区域可以为单层存储单元SLC缓存区域、多层存储单元MLC缓存区域、三层存储单元TLC缓存区域,四层存储单元QLC缓存区域中的任意一种。
具体地:
当设备层配置的存储介质为QLC时,高速缓存区域可以是TLC缓存区域、MLC缓存区域、SLC缓存区域中的任意一种;
其中,SLC缓存区域是指配置为SLC写入方式的缓存区域;MLC缓存区域是指配置为MLC写入方式的缓存区域;TLC缓存区域是指配置为TLC写入方式的缓存区域。
当设备层配置的存储介质为TLC时,高速缓存区域可以是MLC缓存区域、SLC缓存区域中的任意一种;
当设备层配置的存储介质为MLC时,高速缓存区域可以是SLC缓存区域;
应理解:当未来出现的设备层配置的存储介质为更高密度的闪存介质时,高速缓存区域可以配置为任意比该更高密度的闪存介质的密度低的闪存介质写入方式的缓存区域。回收管理器503,用于将高速缓存区域缓存的数据合理转移到文件存储区;文件存储管理器504用于管理文件存储区的文件存储。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的多余预留空间上报给文件系统,将该闪存存储设备的多余预留空间与文件系统自身的预留空间整合为一个用户看不见的存储空间,以供文件系统统一配置,用于用户数据的高速缓存,能够提升存储空间的利用率和存储效率;并且,能够利用应用程序的分组信息感知用户场景,从而为用户数据提供更合理的高速缓存策略,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。
示例性地,图6示出了本申请实施例提供的一种存储装置600的功能模块示意图。如图6所示,该装置600包括APP分组模块601、高速缓存管理模块602、垃圾回收管理模块603、文件存储管理模块604和预留空间上报模块605。其中:
APP分组模块601,用于根据APP对应的第一信息将APP进行分组,还用于根据APP的分组信息确定该APP下发的请求消息(IO请求)对应的第二信息。
其中,APP下发的请求消息携带/承载该APP下发的通信数据(用户数据等)。
可选地,APP对应的第一信息包括APP的优先级信息、APP的行为信息、APP的属性信息中的一项或者多项,此外,APP对应的第一信息还可以包括与APP相关的其他信息,本申请对此不作限定。
更具体地,APP的优先级信息是指该APP在多个APP中的优先级,该优先级可以是系统默认的,也可以是用户根据实际情况预先设置的;APP的行为信息是指APP即将执行的操作或该APP能够执行的操作相关的信息;APP的属性信息是指APP的自身属性,例如APP的类别、是否为关键APP、是否为系统APP等。
可选地,IO请求(APP下发的用户数据)对应的第二信息包括IO请求的优先级信息、IO请求的前后台信息、IO请求的冷热属性信息中的一项或者多项,此外,第二信息还可以包括与IO请求(APP下发的用户数据)相关的其他信息,本申请对此不作限定。
预留空间上报模块605,用于将闪存存储设备的第一预留空间OP上报给高速缓存管理模块602,其中,第一OP为闪存存储设备的存储空间所包括的预留空间中的多余预留空间。
可选地,第一OP可以是闪存存储设备的存储空间所包括的预留空间;也可以是闪存存储设备的存储空间所包括的预留空间的一部分。
可选地,预留空间上报模块605上报给高速缓存管理模块602的第一OP携带有该第一OP的坏块信息。
应注意:本申请实施例中,上报的第一OP,实际上时上报的第一OP的信息。
可选地,该第一OP的信息包括该第一OP的空间存储信息,例如可以是可用存储空间的大小等性能参数,还可以包括第一OP的坏块信息。
可选地,预留空间上报模块605还用于将闪存存储设备的存储空间划分为预留空间和已占用空间,还可用于进一步从前述预留空间中划分出第一OP。
应理解:在本申请实施例中,预留空间上报模块605将闪存存储设备的预留存储空间上报给高速缓存管理模块602,也就意味着闪存存储设备的存储空间中没有配置静态缓存区域(例如:静态SLC缓存区域)。
高速缓存管理模块602,用于接收预留空间上报模块603上报的第一OP,并将其与文件系统自身的预留空间OP拼合成第一存储空间(高速缓存区域),进行统一管理。
其中,可选地,上述文件系统自身的OP可以是闪存友好文件系统(flash-friendly file system,F2FS)预留的闲置空间、进行文件压缩得到的闲置空间、进行文件去重的闲置空间中的一项或者多项,此外,该文件系统自身的OP还可以是文件系统的其他闲置空间,本申请对此不作限定。
可选地,预留空间上报模块605上报给高速缓存管理模块602的第一OP携带有该第一OP的坏块信息。在系统运行过程中,需要对第一缓存空间(高速缓存区域)中的该部分第一OP进行坏块同步。
高速缓存管理模块602,还用于根据APP的分组信息和APP对应的第一信息感知用户的应用场景。
具体地,高速缓存管理模块602具体用于根据IO请求对应的第二信息感知用户的应用场景。
可选地,高速缓存管理模块602具体用于根据IO请求对应的第二信息和第一缓存空间的使用情况确定针对该IO请求的合理的高速缓存策略。
在一种可能的实现方式中,若当前可用的SLC缓存空间大于或者等于第一阈值,则将所有APP对应的用户数据都写入到该高速缓存区域。
其中,可选地,该第一阈值可以是上述第一缓存空间(高速缓存区域)的四分之一,并且,该第一阈值还可以是其他的设定值,例如还可以是上述第一缓存空间的五分之一,可以根据实际情况进行设定,本申请对此不作限定。
在又一种可能的实现方式中,若当前可用的高速缓存空间小于第一阈值,则根据用户的应用场景确定合理的缓存策略。具体地,根据IO对应的第二信息和第一缓存空间的使用情况确定针对该IO的合理的高速缓存策略。
在一个示例中,若APP下发的请求消息(用户数据)的冷热属性信息为冷数据,和/或,APP下发的请求消息(用户数据)的优先级为低优先级,则将该APP对应的用户数据(由请求消息承载)直接写入文件存储区域(TLC存储空间),不经过高速缓存区域。
在另一个示例中,若APP为前台APP,和/或,APP为关键APP,则将该APP对应的用户数据写入高速缓存区域。不经过高速缓存区域。
其中,可选地,为了便于后续的快速读操作,将该APP对应的用户数据写入高速缓存区域后对其进行锁定,使其不会流入到文件存储区域。
垃圾回收管理模块603,用于将高速缓存区域缓存的数据合理转移到文件存储区。
可选地,垃圾回收管理模块603具体用于:当高速缓存区域的存储空间不够时,及时将高速缓存区域缓存的数据合理转移到文件存储区。
文件存储管理模块604,用于管理文件存储区的文件存储。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的部分或者全部预留空间上报给文件系统,将该闪存存储设备的部分或者全部预留空间与文件系统自身的预留空间整合为一个用户看不见的存储空间,以供文件系统统一配置,用于应用的高速缓存,能够提升存储空间的利用率和存储效率;并且,能够利用应用程序的分组信息感知用户场景,从而为用户数据提供更合理的高速缓存策略,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。
在图5所示实施例的基础上,示例性地,图7示出了本申请实施例提供的一种存储装置700的软 件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将系统分为三层,从上至下分别为用户层、内核层以及设备层。用户层可以包括应用程序。
可选地,应用程序可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
如图7所示,存储装置700的用户层包括应用程序(Application,APP)和应用程序分组管理器701。
其中,应用程序分组管理器701用于根据APP对应的第一信息将APP进行分组,还用于根据APP的分组信息确定该APP下发的请求数据(IO)对应的第二信息。
其中,可选地,APP对应的第一信息包括APP的优先级信息、APP的行为信息、APP的属性信息中的一项或者多项,此外,APP的第一信息还可以包括与APP相关的其他信息,本申请对此不作限定。
更具体地,APP的优先级信息是指该APP在多个APP中的优先级,该优先级可以是系统默认的,也可以是用户根据实际情况预先设置的;APP的行为信息是指APP即将执行的操作或该APP能够执行的操作相关的信息;APP的属性信息是指APP的自身属性,例如APP的类别、是否为关键APP、是否为系统APP等。
可选地,IO请求对应的第二信息包括IO请求的优先级信息、IO请求的前后台信息、IO请求的冷热属性信息中的一项或者多项,此外,第二信息还可以包括与IO请求相关的其他信息,本申请对此不作限定。
可选地,可以将APP分为第一组、第二组和第三组,其中,第一组包括优先级高的APP、冷热属性为热的APP、行为信息为特定行为的APP、前台/关键APP等;第三组包括优先级低的APP、冷热属性为冷的APP、行为信息为非特定行为的APP、后台/非关键APP等;第二组为介于第一组和第三组之间的APP。
类似地,可选地,可以将APP对应的请求消息(承载该APP下发的用户数据)分为第一类别、第二类别和第三类别,其中,第一类别包括以下特征:行为信息为特定行为;第二类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为高、冷热属性为热、对应的所述APP为前台APP、对应的所述APP为关键APP;第三类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为低、冷热属性为冷、对应的APP为后台APP、对应的APP为非关键APP。
可选地,可以理解为:若确定请求消息的类别不是第三类别,则该请求消息承载的用户数据写入高速缓存区域。
如图7所示,存储装置700的设备层中,闪存存储设备的存储空间包括第一预留空间705和已占用空间706,其中,第一OP为闪存存储设备的存储空间所包括的预留空间中的多余预留空间。
可选地,第一OP可以是闪存存储设备的存储空间所包括的预留空间;也可以是闪存存储设备的存储空间所包括的预留空间的一部分。
如图7所示,存储装置700的内核层包括文件系统,具体包括:高速缓存管理器702、回收管理器703和文件存储管理器704。其中,高速缓存管理器702包括策略管理器7021和存储管理器7022;回收管理器703包括水线识别器7031和缓存数据搬移器7032。具体的:
存储管理器7022,用于接收设备层提供的第一预留空间705,并将其与文件系统自身的预留空间拼合成第一缓存空间(高速缓存区域),进行统一管理。
策略管理器7021,用于根据IO请求对应的第二信息和/或第一缓存空间的使用情况确定针对该IO请求所承载的通信数据的合理的高速缓存策略。
水线识别器7031,用于确定高速缓存区域的当前可用空间。
缓存数据搬移器7032,用于在高速缓存区域的当前可用空间不足时,将高速缓存区域缓存的数据合理转移到文件存储区。
文件存储管理器704,用于管理文件存储区的文件存储。
在图6所示实施例的基础上,与图7所示实施例对应地,示例性地,图8示出了本申请实施例提供的一种存储装置800的功能模块示意图。如图8所示,该装置800包括APP分组模块801、高速缓 存管理模块802、垃圾回收管理模块803、文件存储管理模块804、预留空间上报模块805和坏块同步模块806。其中:
APP分组模块801,用于根据APP对应的第一信息将APP进行分组,还用于根据APP的分组信息确定该APP下发的请求消息(IO请求)对应的第二信息。
其中,APP下发的请求消息(IO请求)携带/承载该APP下发的用户数据。
可选地,APP对应的第一信息包括APP的优先级信息、APP的行为信息、APP的属性信息中的一项或者多项,此外,APP的第一信息还可以包括与APP相关的其他信息,本申请对此不作限定。
更具体地,APP的优先级信息是指该APP在多个APP中的优先级,该优先级可以是系统默认的,也可以是用户根据实际情况预先设置的;APP的行为信息是指APP即将执行的操作或该APP能够执行的操作相关的信息;APP的属性信息是指APP的自身属性,例如APP的类别、是否为关键APP、是否为系统APP等。
可选地,IO请求对应的第二信息包括IO请求的优先级信息、IO请求的前后台信息、IO请求的冷热属性信息中的一项或者多项,此外,第二信息还可以包括与IO请求相关的其他信息,本申请对此不作限定。
可选地,可以将APP分为第一组、第二组和第三组,其中,第一组包括优先级高的APP、冷热属性为热的APP、行为信息为特定行为的APP、前台/关键APP等;第三组包括优先级低的APP、冷热属性为冷的APP、行为信息为非特定行为的APP、后台/非关键APP等;第二组为介于第一组和第三组之间的APP。
类似地,可选地,可以将APP对应的请求消息(用户数据)分为第一类别、第二类别和第三类别,第一类别包括以下特征:行为信息为特定行为;第二类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为高、冷热属性为热、对应的所述APP为前台APP、对应的所述APP为关键APP;第三类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为低、冷热属性为冷、对应的APP为后台APP、对应的APP为非关键APP。
可选地,可以理解为:若确定请求消息的类别不是第三类别,则该请求消息承载的用户数据写入高速缓存区域。
预留空间上报模块805,用于将闪存存储设备的第一预留空间OP上报给高速缓存管理模块802,其中,第一OP为闪存存储设备的存储空间所包括的预留空间中的多余预留空间。
可选地,第一OP可以是闪存存储设备的存储空间所包括的预留空间;也可以是闪存存储设备的存储空间所包括的预留空间的一部分。
可选地,预留空间上报模块805上报给高速缓存管理模块802的第一OP携带有该第一OP的坏块信息。
可选地,预留空间上报模块805还用于将闪存存储设备的存储空间划分为预留空间和已占用空间,还可用于进一步从前述预留空间中划分出第一OP。
具体地,存储装置800首次使用时,闪存存储设备根据系统文件的数据分区大小以及Flash颗粒的总空间,划分出合理的预留空间(OP空间),其中,该预留空间包括原先用于静态缓存的区域(例如:静态SLC缓存区域)。
应理解:在本申请实施例中,预留空间上报模块805将闪存存储设备的第一OP上报给高速缓存管理模块802,也就意味着闪存存储设备的存储空间中没有配置静态缓存区域。
可选地,闪存存储设备可以是通用闪存存储设备(universal flash storage,UFS)。
坏块同步模块806,用于当在使用过程中,预留空间上报模块805上报给高速缓存管理模块802的第一OP发生了坏块时,将该相应的坏块信息及时上报给文件系统(高速缓存管理模块802),同步缩小高速缓存空间。
高速缓存管理模块802,用于接收预留空间上报模块803上报的第一OP,并将其与文件系统自身的预留空间拼合成第一缓存空间(高速缓存区域),进行统一管理。
具体地,位于高速缓存管理模块802的存储管理单元8022,用于接收预留空间上报模块803上报的第一OP,并将其与文件系统自身的预留空间拼合成第一缓存空间(高速缓存区域),进行统一管理。
应理解:上述第一缓存空间作为高速缓存区域。该高速缓存区域为虚拟缓存区域,用户不可见, 并且,该高速缓存区域初次形成后,在一段使用时间内,该高速缓存区域的大小不变。
可选地,该高速缓存区域用于用户数据的高速缓存。
其中,可选地,上述文件系统自身的预留空间可以是闪存友好文件系统(flash-friendly file system,F2FS)预留的闲置空间、进行文件压缩得到的闲置空间、进行文件去重的闲置空间中的一项或者多项,此外,该文件系统自身的预留空间还可以文件系统的其他闲置空间,本申请对此不作限定。
具体地,在首次使用该存储装置800时,闪存存储设备根据文件系统的数据分区大小及Flash颗粒的总空间,划分出合理的预留空间OP,再将该OP包括的第一OP上报给高速缓存管理模块,其中,该OP包括原先用于静态缓存的静态缓存区域(例如:SLC静态缓存区域)。
并且,若文件系统启用了文件去重或者压缩,可以将去重或压缩后节省出的空间也用作高速缓存空间,也就是以上所述的文件系统自身的OP。
可选地,预留空间上报模块805上报给高速缓存管理模块802的第一OP携带有该第一OP的坏块信息。
可选地,在系统运行过程中,高速缓存管理模块802接收坏块同步模块806发送的第一OP的坏块信息,并根据该坏块信息对高速缓存空间进行坏块同步,同步缩小高速缓存空间。
高速缓存管理模块802,还用于根据APP的分组信息和APP对应的第一信息感知用户的应用场景。
具体地,高速缓存管理模块802具体用于根据IO请求对应的第二信息感知用户的应用场景。
可选地,高速缓存管理模块802具体用于根据IO请求对应的第二信息和第一缓存空间的使用情况确定针对该IO的合理的高速缓存策略。
在一种可能的实现方式中,若当前可用的高速缓存空间大于或者等于第一阈值,则将所有APP对应的用户数据都写入到该高速缓存区域。
其中,可选地,该第一阈值可以是上述第一缓存空间的四分之一,并且,该第一阈值还可以是其他的设定值,例如还可以是上述第一缓存空间的五分之一,可以根据实际情况进行设定,本申请对此不作限定。
在又一种可能的实现方式中,若当前可用的高速缓存空间小于第一阈值,则根据用户的应用场景确定合理的缓存策略。具体地,根据IO请求对应的第二信息和第一缓存空间的使用情况确定针对该IO请求所承载的通信数据(用户数据)的合理的SLC缓存策略。
在一个示例中,若APP下发的IO请求的冷热属性信息为冷数据,和/或,APP下发的IO请求的优先级为低优先级,则将该IO请求承载的用户数据直接写入文件存储区域(TLC存储空间),不经过高速缓存区域。
在另一个示例中,若APP为前台APP,和/或,APP为关键APP,则将该APP下发的IO请求所承载的用户数据写入高速缓存区域。不经过高速缓存区域。
其中,可选地,为了便于后续的快速读操作,将该用户数据写入高速缓存区域后对其进行锁定,使其不会流入到文件存储区域。
垃圾回收管理模块803,用于将高速缓存区域缓存的数据合理转移到文件存储区。
具体地,位于垃圾回收管理模块803的水线识别器8031,用于确定高速缓存区域的当前可用空间。
位于垃圾回收管理模块803的缓存数据搬移器8032,用于在高速缓存区域的当前可用空间不足时,将高速缓存区域缓存的数据合理转移到文件存储区。
可选地,当IO空闲时,垃圾回收管理模块803选择冷数据流的块,将高速缓存中的数据搬入到文件存储区域;
可选地,当IO繁忙,并且当前可用的高速缓存空间紧张时,垃圾回收管理模块803根据Greedy算法,将高速缓存中的数据搬入到文件存储区域。
文件存储管理模块804,用于管理文件存储区的文件存储。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的多余预留空间上报给文件系统,将该闪存存储设备的多余预留空间与文件系统自身的预留空间整合为一个用户看不见的存储空间,以供文件系统统一配置,用于应用的高速缓存,能够提升存储空间的利用率和存储效率;并且,能够利用应用程序的分组信息感知用户场景,从而为用户数据提供更合理的高速缓存策略,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。
示例性地,图9示出了本申请实施例提供的一种存储方法900的示意图,如图9所示,该方法900包括:
S901:闪存存储设备取消其缓存空间的静态缓存区域,对其缓存空间进行划分,得到多余预留空间OP(第一预留空间),并向文件系统上报该第一OP,其中,第一OP为闪存存储设备的存储空间所包括的预留空间中的多余预留空间。
可选地,第一OP可以是闪存存储设备的存储空间所包括的预留空间;也可以是闪存存储设备的存储空间所包括的预留空间的一部分。
其中,闪存存储设备的预留空间包括原来的静态缓存区域。
可选地,闪存存储设备还会向文件系统上报该第一OP的坏块信息,用于文件系统中的高速缓存区域进行坏块同步。其中,该坏块信息可以是被闪存存储设备的第一OP携带的信息,还可以是一个单独的信息。
S902-S904:根据APP下发的IO请求的类别,可以对该用户数据配置相应的缓存策略,该缓存策略包括:将该IO请求承载的用户数据直接存储到TLC存储区域;或,将该IO请求承载的用户数据存储到高速缓存区域,并锁定在高速缓存区域;或,将该IO请求承载的用户数据存储到高速缓存区域,不锁定。
S905:当高速缓存区域的可用空间小于第二阈值时,将高速缓存区域中缓存的用户数据合理地迁移到TLC存储区域。
其中,第二阈值可以是高速缓存区域的1/6,还可以是根据实际情况预设的值,例如还可以是高速缓存区域的1/7,本申请对此不作限定。
可选地,将高速缓存区域中缓存的用户数据合理地迁移到TLC存储区域,具体可以是将高速缓存区域中缓存的非锁定的用户数据(图8所示实施例中的第二类别的IO请求所承载的用户数据)迁移到TLC存储区域。
示例性地,图10示出了本申请实施例提供的一种存储方法1000的示意性流程图。如图10所示,该方法1000包括:
S1001:对闪存存储设备的缓存空间进行划分,得到闪存存储设备的第一预留空间OP,其中,第一OP为闪存存储设备的存储空间所包括的预留空间中的多余预留空间。
可选地,第一OP可以是闪存存储设备的存储空间所包括的预留空间;也可以是闪存存储设备的存储空间所包括的预留空间的一部分。
具体地,闪存存储设备取消其存储空间中的静态缓存区域,闪存存储设备的预留空间包括该静态缓存区域。
可选地,闪存存储设备可以是UFS设备。
S1002:将上述闪存存储设备的第一OP上报给文件系统,以便于文件系统基于该信息对高速缓存区域进行配置,该高速缓存区域包括该第一OP。
可选地,文件系统自身通过压缩或去重等方式得到自身的预留空间,与上述闪存存储设备的第一OP共同作为高速缓存区域;也就是说,高速缓存区域包括两部分,一部分为上述闪存存储设备的第一OP,另一部分为文件系统自身的OP。
应理解:该高速缓存区域为虚拟区域,用户不可见,可用作用户数据的高速缓存。
本申请实施例中,取消闪存存储设备侧的静态缓存区域,将闪存存储设备的多余预留空间上报给文件系统,将该闪存存储设备的多余预留空间与文件系统自身的预留空间整合为一个用户看不见的存储空间,以供文件系统统一配置,用于用户数据的高速缓存,能够提升存储空间的利用率和存储效率。
在图10所示实施例的基础上,示例性地,图11示出了本申请实施例提供的一种存储方法1100的示意性流程图,如图11所示,该方法1100包括:
S1101至S1102,与图10所示实施例中的S1001至S1002相同,为了简洁,在此不再赘述。
S1103:根据请求消息对应的第二信息确定缓存策略。
其中,关于请求消息对应的第二信息的解释,在图5至图8所示的实施例中已经做了详细说明,为了简洁,在此不再赘述。
可选地,可以将APP分为第一组、第二组和第三组,其中,第一组包括优先级高的APP、冷热属 性为热的APP、行为信息为特定行为的APP、前台/关键APP等;第三组包括优先级低的APP、冷热属性为冷的APP、行为信息为非特定行为的APP、后台/非关键APP等;第二组为介于第一组和第三组之间的APP。
类似地,可选地,可以将APP下发的请求消息分为第一类别、第二类别和第三类别,其中,第一类别包括以下特征:行为信息为特定行为;第二类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为高、冷热属性为热、对应的所述APP为前台APP、对应的所述APP为关键APP;第三类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为低、冷热属性为冷、对应的APP为后台APP、对应的APP为非关键APP。
可选地,可以理解为:若确定请求消息的类别不是第三类别,则该请求消息承载的用户数据写入高速缓存区域。
可选地,该缓存策略包括:将第三类别的请求消息承载的用户数据直接存储到TLC存储区域;或,将第一类别的请求消息承载的用户数据存储到高速缓存区域,并锁定在该高速缓存区域;或,将第二类别的请求消息承载的用户数据存储到高速缓存区域,不锁定。
S1104:根据上述缓存策略缓存上述用户数据。
本申请实施例中,能够利用应用程序的分组信息感知用户场景(请求消息的类别),从而为用户数据提供更合理的高速缓存策略,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。
为了更加清楚地理解缓存策略的确定过程,示例性地,图12示出了本申请实施例提供的一种缓存策略的确定方法1200的示意性流程图。如图12所示,该方法1200包括:
S1201:根据APP对应的第一信息对其进行分组。
其中,关于对APP对应的第一信息的解释,在图5至图8所示的实施例中已经做出了详细说明,为了简洁,在此不再赘述。
可选地,可以将APP分为第一组、第二组和第三组,其中,第一组包括优先级高的APP、冷热属性为热的APP、行为信息为特定行为的APP、前台/关键APP等;第三组包括优先级低的APP、冷热属性为冷的APP、行为信息为非特定行为的APP、后台/非关键APP等;第二组为介于第一组和第三组之间的APP。
S1202:根据APP的分组情况,确定APP下发的请求消息对应的第二信息。
可选地,该请求消息为IO请求。
其中,关于对APP下发的请求消息对应的第二信息的解释,在图5至图8所示的实施例中已经做出了详细说明,为了简洁,在此不再赘述。
S1203:根据上述请求消息对应的第二信息确定该请求消息对应的类别。
其中,APP下发的请求消息承载该APP下发的用户数据。
可选地,可以将APP下发的请求消息分为第一类别、第二类别和第三类别,其中,第一类别包括以下特征:行为信息为特定行为;第二类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为高、冷热属性为热、对应的所述APP为前台APP、对应的所述APP为关键APP;第三类别包括以下特征:行为信息为非特定行为,且还包括以下特征中的一项或者多项:优先级为低、冷热属性为冷、对应的APP为后台APP、对应的APP为非关键APP。
可选地,可以理解为:若确定请求消息的类别不是第三类别,则该请求消息承载的用户数据写入高速缓存区域。
S1204:当APP下发的请求消息对应的类别为第一类别时,将该请求消息承载的用户数据写入高速缓存区域,并将该请求消息承载的用户数据锁定在高速缓存区域。
应理解:在锁定期内,被锁定的用户数据会一直在高速缓存区域,不会流入TLC存储区域。
S1205:当APP下发的请求消息对应的类别为第二类别时,将该请求消息所承载的用户数据写入高速缓存区域。
应理解:在该情况下,不会对该用户数据进行锁定。
S1206:当APP下发的请求消息对应的类别为第三类别时,将该请求消息所承载的用户数据直接写入TLC存储区域。
S1207:在高速缓存区域的使用过程中,确定高速缓存区域的当前可用空间是否小于第二阈值,若是,则执行步骤S1208。
其中,第二阈值可以是高速缓存区域的1/6,还可以是根据实际情况预设的值,例如还可以是高速缓存区域的1/7,本申请对此不作限定。
S1208:将高速缓存区域缓存的用户数据合理迁移至TLC存储空间。
可选地,将高速缓存区域中缓存的用户数据合理地迁移到TLC存储区域,具体可以是将高速缓存区域中缓存的非锁定的用户数据(上述第二类别的请求消息所承载的用户数据)迁移到TLC存储区域。
本申请实施例中,根据APP下发的请求消息的类别确定合理的缓存策略,使得一些重要性不高(没有必要用到高速缓存)的用户数据直接落入TLC存储区域,避免了短时内用户数据的2次存储,进而能够避免带来额外的流开销;并且,能够使得关键APP下发的用户数据锁定在高速缓存区域,进而能够保证关键应用的全时高速写入以及关键场景(例如应用后台变前台载入)的高速读取。从而提升用户的使用体验。
在图12所示实施例的基础上,示例性地,图13示出了本申请实施例提供的又一种缓存策略的确定方法的示意性流程图。如图13所示,该方法1300包括:
S1301:确定高速缓存区域的当前可用空间是否大于第一阈值,若否,则执行步骤S1302;若是,则执行步骤S1303。
其中,可选地,该第一阈值可以高速缓存区域的四分之一,并且,该第一阈值还可以是其他的设定值,例如还可以是高速缓存区域的五分之一,可以根据实际情况进行设定,本申请对此不作限定。
S1302:根据APP下发的请求消息对应的第二信息确定缓存策略。
该步骤中确定缓存策略的具体方法与图12所示实施例相同,为了简洁,在此不再赘述。
其中,APP下发的请求消息承载该APP下发的用户数据。
S1303:将所有APP下发的用户数据都写入高速缓存区域。
本申请实施例中,当高速缓存区域的当前可用空间充足时,不根据APP下发的请求消息对应的第二信息(承载用户数据的请求消息的类别)确定缓存策略,而是将所有APP下发的用户数据都写入高速缓存区域,这样,能够进一步提高缓存空间的利用率和缓存效率,提高用户的使用体验。
本申请实施例还提供一种计算机可读介质,该计算机可读介质存储有程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行上述图9至图13中的任一种方法。
本申请实施例还提供一种芯片,包括:至少一个处理器和存储器,该至少一个处理器与该存储器耦合,用于读取并执行该存储器中的指令,以执行上述图9至图13中的任一种方法。
本申请实施例还提供一种电子设备,该电子设备包括如图5至图8中的任一种所示的存储装置,以执行上述图9至图13中的任一种方法。
本申请实施例还提供一种电子设备,包括:至少一个处理器和存储器,该至少一个处理器与该存储器耦合,用于读取并执行该存储器中的指令,以执行上述图9至图13中的任一种方法。
以上各个实施例可以单独使用,也可以相互结合使用,以实现不同的技术效果。
应理解,本申请提供的方案不局限于文件系统,也可用于其它具有Flash介质的数据管理程序(例如,数据库);本申请提供的方案,不局限于智能终端领域,在服务器领域若有相应的业务场景,也可进行应用。
本文中所描述的模块或单元的一个或多个可以软件、硬件或二者结合来实现。当以上任一模块或单元以软件实现的时候,所述软件以计算机程序指令的方式存在,并被存储在存储器中,处理器可以用于执行所述程序指令并实现以上方法流程。所述处理器可以包括但不限于以下至少一种:中央处理单元(central processing unit,CPU)、微处理器、数字信号处理器(DSP)、微控制器(microcontroller unit,MCU)、或人工智能处理器等各类运行软件的计算设备,每种计算设备可包括一个或多个用于执行软件指令以进行运算或处理的核。该处理器可以内置于SoC(片上系统)或专用集成电路(application specificintegrated circuit,ASIC),也可是一个独立的半导体芯片。该处理器内处理用于执行软件指令以进行运算或处理的核外,还可进一步包括必要的硬件加速器,如现场可编程门阵列(field programmable gate array,FPGA)、PLD(可编程逻辑器件)、或者实现专用逻辑运算的逻辑电路。
当本文中所描述的模块或单元以硬件实现的时候,该硬件可以是CPU、微处理器、DSP、MCU、人工智能处理器、ASIC、SoC、FPGA、PLD、专用数字电路、硬件加速器或非集成的分立器件中的任一个或任一组合,其可以运行必要的软件或不依赖于软件以执行以上方法流程。
当本文中所描述的模块或单元使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何具备类似高速缓存的配置能力的可用介质或者是包含一个或多个具备类似高速缓存的配置能力的可用介质集成的服务器、数据中心等数据存储设备。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及方法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (31)

  1. 一种存储的方法,其特征在于,所述方法应用于存储装置,所述存储装置包括预留空间OP上报模块和高速缓存管理模块,所述方法包括:
    所述OP上报模块向所述高速缓存管理模块上报第一OP的信息,所述第一OP为闪存存储设备的OP中获得的未被占用的OP,所述OP上报模块位于所述存储装置的设备层,所述高速缓存管理模块位于所述存储装置的内核层;
    基于所述第一OP的信息,所述高速缓存管理模块配置高速缓存区域,所述高速缓存区域包括所述第一OP。
  2. 根据权利要求1所述的方法,其特征在于,所述高速缓存区域还包括文件系统自身的OP,所述文件系统位于所述存储装置的内核层。
  3. 根据权利要求1或2所述的方法,其特征在于,所述高速缓存管理模块配置高速缓存区域,包括:
    当所述高速缓存区域的可用空间大于或者等于第一阈值时,所述高速缓存管理模块将应用程序APP下发的用户数据写入所述高速缓存区域。
  4. 根据权利要求1或2所述的方法,其特征在于,所述高速缓存管理模块配置高速缓存区域,包括:
    所述高速缓存管理模块确定应用程序APP下发的请求消息对应的类别,所述请求消息携带所述APP下发的用户数据;
    所述高速缓存管理模块根据所述请求消息对应的类别确定所述APP下发的用户数据的缓存策略,并根据所述缓存策略缓存所述APP下发的用户数据。
  5. 根据权利要求4所述的方法,其特征在于,所述存储装置还包括APP分组模块,所述高速缓存管理模块确定APP下发的请求消息对应的类别,包括:
    所述APP分组模块根据所述APP对应的第一信息对所述APP进行分组,所述第一信息包括所述APP的优先级信息、所述APP的行为信息、所述APP的属性信息中的一项或者多项;
    所述APP分组模块根据所述APP的分组情况,确定所述APP下发的请求消息对应的第二信息,所述第二信息包括所述请求消息的优先级信息、所述请求消息的行为信息、所述请求消息的前后台信息、所述请求消息的冷热属性信息中的一项或者多项;
    所述高速缓存管理模块根据所述请求消息对应的第二信息确定所述请求消息对应的类别。
  6. 根据权利要求5所述的方法,其特征在于,所述高速缓存管理模块根据所述请求消息对应的第二信息确定所述请求消息对应的类别,包括:
    当所述请求消息的行为信息为特定行为时,所述高速缓存管理模块确定所述请求消息对应的类别为第一类别;
    当所述请求消息的行为信息为非特定行为,且满足所述优先级信息为高优先级、所述冷热属性信息为热、所述前后台信息为前台APP中的一项或者多项时,所述高速缓存管理模块确定所述请求消息对应的类别为第二类别;或,
    当所述请求消息的行为信息为非特定行为,且满足所述优先级信息为低优先级、所述冷热属性信息为冷、所述前后台信息为后台APP中的一项或者多项时,所述高速缓存管理模块确定所述请求消息对应的类别为第三类别。
  7. 根据权利要求6所述的方法,其特征在于,所述高速缓存管理模块根据所述请求消息对应的类别确定所述APP下发的用户数据的缓存策略,并根据所述缓存策略缓存所述APP下发的用户数据,包括:
    当所述请求消息对应的类别为第一类别时,所述高速缓存管理模块将所述请求消息携带的用户数据写入所述高速缓存区域,并将所述请求消息携带的用户数据锁定在所述高速缓存区域;
    当所述请求消息对应的类别为第二类别时,所述高速缓存管理模块将所述请求消息携带的用户数据写入所述高速缓存区域;或,
    当所述请求消息对应的类别为第三类别时,所述高速缓存管理模块将所述请求消息所携带的用户数据直接写入三层存储单元TLC存储区域。
  8. 根据权利要求4至7中任一项所述的方法,其特征在于,所述高速缓存管理模块根据所述缓存策略缓存所述APP下发的用户数据,包括:
    当所述高速缓存区域的可用空间小于所述第一阈值时,所述高速缓存管理模块根据所述缓存策略缓存所述APP下发的用户数据。
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,所述存储装置还包括垃圾回收管理模块,所述方法还包括:
    当所述高速缓存区域的可用空间小于第二阈值时,所述垃圾回收管理模块将所述高速缓存区域的用户数据迁移至三层存储单元TLC存储区域。
  10. 根据权利要求3至9中任一项所述的方法,其特征在于,所述第一阈值为所述高速缓存区域的四分之一。
  11. 根据权利要求9所述的方法,其特征在于,所述第二阈值为所述高速缓存区域的八分之一。
  12. 根据权利要求1至11中任一项所述的方法,其特征在于,所述第一OP的信息包括所述第一OP的空间存储信息。
  13. 根据权利要求1至12中任一项所述的方法,其特征在于,所述第一OP的信息还包括所述第一OP的坏块信息,所述第一OP的坏块信息用于对所述高速缓存区域进行坏块同步。
  14. 根据权利要求1至13中任一项所述的方法,其特征在于,所述高速缓存区域为单层存储单元SLC缓存区域、多层存储单元MLC缓存区域、三层存储单元TLC缓存区域、四层存储单元QLC缓存区域中的任意一种。
  15. 一种存储的装置,其特征在于,所述装置包括预留空间OP上报模块和高速缓存管理模块,其中:
    预留空间OP上报模块,用于向所述高速缓存管理模块上报第一OP的信息,所述第一OP为闪存存储设备的OP中获得的未被占用的OP,所述OP上报模块位于所述存储装置的设备层,所述高速缓存管理模块位于所述存储装置的内核层;
    所述高速缓存管理模块,用于基于所述第一OP的信息,配置高速缓存区域,所述高速缓存区域包括所述第一OP。
  16. 根据权利要求15所述的装置,其特征在于,所述高速缓存区域还包括文件系统自身的OP,所述文件系统位于所述存储装置的内核层。
  17. 根据权利要求15或16所述的装置,其特征在于,所述高速缓存管理模块还用于:
    当所述高速缓存区域的可用空间大于或者等于第一阈值时,将应用程序APP下发的用户数据写入所述高速缓存区域。
  18. 根据权利要求15或16所述的装置,其特征在于,所述高速缓存管理模块还用于:
    确定应用程序APP下发的请求消息对应的类别,所述请求消息携带所述APP下发的用户数据;
    根据所述请求消息对应的类别确定所述APP下发的用户数据的缓存策略,并根据所述缓存策略缓存所述APP下发的用户数据。
  19. 根据权利要求18所述的装置,其特征在于,所述装置还包括:
    APP分组模块,用于根据所述APP对应的第一信息对所述APP进行分组,所述第一信息包括所述APP的优先级信息、所述APP的行为信息、所述APP的属性信息中的一项或者多项;
    所述APP分组模块还用于,根据所述APP的分组情况,确定所述APP下发的请求消息对应的第二信息,所述第二信息包括所述请求消息的优先级信息、所述请求消息的行为信息、所述请求消息的前后台信息、所述请求消息的冷热属性信息中的一项或者多项;
    所述高速缓存管理模块具体用于,根据所述请求消息对应的第二信息确定所述请求消息对应的类别。
  20. 根据权利要求19所述的装置,其特征在于,所述高速缓存管理模块具体用于:
    当所述请求消息的行为信息为特定行为时,确定所述请求消息对应的类别为第一类别;
    当所述请求消息的行为信息为非特定行为,且满足所述优先级信息为高优先级、所述冷热属性信 息为热、所述前后台信息为前台APP中的一项或者多项时,确定所述请求消息对应的类别为第二类别;或,
    当所述请求消息的行为信息为非特定行为,且满足所述优先级信息为低优先级、所述冷热属性信息为冷、所述前后台信息为后台APP中的一项或者多项时,确定所述请求消息对应的类别为第三类别。
  21. 根据权利要求20所述的装置,其特征在于,所述高速缓存管理模块具体用于:
    当所述请求消息对应的类别为第一类别时,将所述请求消息携带的用户数据写入所述高速缓存区域,并将所述请求消息携带的用户数据锁定在所述高速缓存区域;
    当所述请求消息对应的类别为第二类别时,将所述请求消息携带的用户数据写入所述高速缓存区域;或,
    当所述请求消息对应的类别为第三类别时,将所述请求消息所携带的用户数据直接写入三层存储单元TLC存储区域。
  22. 根据权利要求18至21中任一项所述的装置,其特征在于,所述高速缓存管理模块还具体用于:
    当所述高速缓存区域的可用空间小于所述第一阈值时,根据所述缓存策略缓存所述APP下发的用户数据。
  23. 根据权利要求15至22中任一项所述的装置,其特征在于,所述装置还包括:
    垃圾回收管理模块,用于当所述高速缓存区域的可用空间小于第二阈值时,将所述高速缓存区域的用户数据迁移至三层存储单元TLC存储区域。
  24. 根据权利要求17至23中任一项所述的装置,其特征在于,所述第一阈值为所述高速缓存区域的四分之一。
  25. 根据权利要求23所述的装置,其特征在于,所述第二阈值为所述高速缓存区域的八分之一。
  26. 根据权利要求15至25中任一项所述的装置,其特征在于,所述第一OP的信息包括所述第一OP的空间存储信息。
  27. 根据权利要求15至26中任一项所述的装置,其特征在于,所述第一OP的信息还包括所述第一OP的坏块信息,所述装置还包括:
    坏块同步模块,用于根据所述第一OP的坏块信息对所述高速缓存区域进行坏块同步。
  28. 根据权利要求15至27中任一项所述的装置,其特征在于,所述高速缓存区域为单层存储单元SLC缓存区域、多层存储单元MLC缓存区域、三层存储单元TLC缓存区域、四层存储单元QLC缓存区域中的任意一种。
  29. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    一个或多个存储器;
    以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述一个或多个存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述一个或多个处理器执行时,使得所述电子设备执行如权利要求1至14中任一项所述的方法。
  30. 一种计算机可读存储介质,其特征在于,所述存储介质中存储有程序或指令,当所述程序或指令被运行时,实现如权利要求1至14中任一项所述的方法。
  31. 一种芯片,其特征在于,包括:
    一个或多个处理器;
    一个或多个存储器,所述一个或多个处理器与所述一个或多个存储器耦合,用于读取并执行所述一个或多个存储器中的指令,以执行如权利要求1至14中任一项所述的方法。
PCT/CN2023/103559 2022-08-31 2023-06-29 存储的方法、装置和电子设备 WO2024045841A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211066503.XA CN117666937A (zh) 2022-08-31 2022-08-31 存储的方法、装置和电子设备
CN202211066503.X 2022-08-31

Publications (1)

Publication Number Publication Date
WO2024045841A1 true WO2024045841A1 (zh) 2024-03-07

Family

ID=90077679

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103559 WO2024045841A1 (zh) 2022-08-31 2023-06-29 存储的方法、装置和电子设备

Country Status (2)

Country Link
CN (1) CN117666937A (zh)
WO (1) WO2024045841A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104049907A (zh) * 2013-03-13 2014-09-17 希捷科技有限公司 动态存储设备自动配置
US20150113223A1 (en) * 2013-10-18 2015-04-23 Fusion-Io, Inc. Systems and methods for adaptive reserve storage
CN111104066A (zh) * 2019-12-17 2020-05-05 华中科技大学 数据写入方法、装置及存储服务器和计算机可读存储介质
CN113419679A (zh) * 2021-06-18 2021-09-21 Oppo广东移动通信有限公司 存储装置、系统级芯片、电子设备及存储方法
US11256620B1 (en) * 2020-11-13 2022-02-22 Micron Technology, Inc. Cache management based on memory device over-provisioning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104049907A (zh) * 2013-03-13 2014-09-17 希捷科技有限公司 动态存储设备自动配置
US20150113223A1 (en) * 2013-10-18 2015-04-23 Fusion-Io, Inc. Systems and methods for adaptive reserve storage
CN111104066A (zh) * 2019-12-17 2020-05-05 华中科技大学 数据写入方法、装置及存储服务器和计算机可读存储介质
US11256620B1 (en) * 2020-11-13 2022-02-22 Micron Technology, Inc. Cache management based on memory device over-provisioning
CN113419679A (zh) * 2021-06-18 2021-09-21 Oppo广东移动通信有限公司 存储装置、系统级芯片、电子设备及存储方法

Also Published As

Publication number Publication date
CN117666937A (zh) 2024-03-08

Similar Documents

Publication Publication Date Title
CN109559270B (zh) 一种图像处理方法及电子设备
CN114443277A (zh) 内存管理方法、装置、电子设备以及计算机可读存储介质
CN113704014A (zh) 日志获取系统、方法、电子设备及存储介质
WO2021159746A1 (zh) 文件共享方法、系统及相关设备
EP4239477A1 (en) Virtual memory management method and electronic device
CN113553130A (zh) 应用执行绘制操作的方法及电子设备
WO2021093626A1 (zh) 一种内存的管理方法及电子设备
WO2022078105A1 (zh) 内存管理方法、电子设备以及计算机可读存储介质
CN113986369A (zh) 物联网设备控制方法、系统、电子设备及存储介质
WO2023179123A1 (zh) 蓝牙音频播放方法、电子设备及存储介质
CN113485969B (zh) 一种存储碎片化方法及装置、终端及计算机存储介质
CN114461589B (zh) 读取压缩文件的方法、文件系统及电子设备
CN114489471B (zh) 一种输入输出处理方法和电子设备
CN113590346B (zh) 处理业务请求的方法和电子设备
WO2024045841A1 (zh) 存储的方法、装置和电子设备
CN112783418B (zh) 一种存储应用程序数据的方法及移动终端
CN114489469A (zh) 一种数据读取方法、电子设备及存储介质
WO2023246783A1 (zh) 调整设备功耗的方法及电子设备
CN115529379B (zh) 防止蓝牙音频Track音轨抖动的方法、电子设备及存储介质
WO2022262291A1 (zh) 应用的图像数据调用方法、系统、电子设备及存储介质
WO2024109573A1 (zh) 悬浮窗显示的方法和电子设备
WO2024041456A1 (zh) 一种应用数据保存方法及电子设备
US20240211509A1 (en) Image Data Invoking Method and System for Application, Electronic Device, and Storage Medium
WO2022166550A1 (zh) 数据传输方法及电子设备
WO2023001208A1 (zh) 多文件同步方法及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23858879

Country of ref document: EP

Kind code of ref document: A1