Storage method, device, equipment and storage medium
By adjusting the maximum available cache space of the hybrid SSD with dynamic SLC capacity, the IO performance degradation caused by switching the dynamic SLC region to multi-level cell mode was resolved, thus optimizing IO performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-10-22
- Publication Date
- 2026-05-19
AI Technical Summary
In hybrid SSDs with dynamic SLC capacity, as the overall space utilization increases, the dynamic SLC area switches to multi-layer cell mode, resulting in a decrease in IO performance.
By adjusting the size of the maximum available cache space based on the overall space utilization of the storage device, the available single-level cell cache space is maintained, thus optimizing IO performance.
By controlling the maximum available cache space, the overall space usage is reduced, the size of the available SLC cache space is maintained, and the IO performance of the storage device is improved.
Smart Images

Figure CN116009763B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic devices, and more particularly to a storage method, apparatus, device, and storage medium. Background Technology
[0002] Solid-state disks (SSDs), also known as solid-state drives or solid-state hard drives, are storage devices that utilize flash memory technology. With the rapid advancement of flash storage technology and the increasing demand for storage, the storage density of SSDs has gradually increased. For example, the storage cell usage patterns of SSDs have evolved from single-level cell (SLC) to multi-level cell (MLC), triple-level cell (TLC), and quad-level cell (QLC) patterns. While increased storage density allows for larger capacities and lower costs, it also leads to a significant decrease in SSD input and output (IO) performance (i.e., read and write performance).
[0003] Currently, using a hybrid approach of high-speed and low-speed media in SSDs can optimize their I / O performance. SSDs employing this hybrid approach are called hybrid SSDs. Hybrid SSDs can include: static SLC capacity hybrid SSDs and dynamic SLC capacity hybrid SSDs. Static SLC capacity hybrid SSDs can have a storage space consisting of a QLC area and a static SLC area, with the static SLC area having a fixed size. Dynamic SLC capacity hybrid SSDs can have a storage space consisting of a QLC area, a dynamic SLC area, and a static SLC area, with the static SLC area also having a fixed size. As the overall space utilization of the dynamic SLC capacity hybrid SSD gradually increases, some areas within the dynamic SLC area can switch to multi-level cell mode, and the dynamic SLC area gradually decreases in size.
[0004] For hybrid SSDs with dynamic SLC capacity, when some areas in the dynamic SLC region switch to multi-layer cell mode, the capacity of the hybrid SSD with dynamic SLC capacity will increase, but the IO performance of the hybrid SSD with dynamic SLC capacity will decrease. Summary of the Invention
[0005] This application provides a storage method, apparatus, device, and storage medium. The method adjusts the maximum available cache space of the storage device based on its overall space utilization. By controlling the maximum available cache space, the overall space usage of the storage device can be reduced, maintaining the size of the available single-level cell cache space and improving the read / write performance of the storage device.
[0006] In a first aspect, embodiments of this application provide a storage method, the method comprising: obtaining the overall space utilization rate of a storage device; the storage device including a multi-layer cell region, a dynamic single-layer cell region, and a static single-layer cell region; the overall space utilization rate being determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device; and adjusting the size of the maximum available cache space of the storage device based on the overall space utilization rate; the maximum available cache space being the maximum storage space allowed to be occupied by cached data when storing cached data in the storage device.
[0007] When the overall space utilization rate is the first overall space utilization rate, the size of the dynamic single-layer unit area is the fourth capacity, and the adjusted maximum available cache space size is the first value; when the overall space utilization rate is the second overall space utilization rate, the size of the dynamic single-layer unit area is the fifth capacity, and the adjusted maximum available cache space size is the second value; the second overall space utilization rate is greater than the first overall space utilization rate, the fifth capacity is less than the fourth capacity, and the second value is less than the first value.
[0008] This storage method reduces the overall space usage of the storage device by controlling the maximum available cache space, maintains the size of the available SLC cache space, and improves the IO performance of the storage device.
[0009] In one possible implementation, when the overall space utilization rate is less than or equal to a first threshold, the size of the maximum available cache space is equal to the first capacity, which is less than or equal to the maximum single-level cell capacity of the storage device and greater than the capacity of the static single-level cell area of the storage device; the maximum single-level cell capacity is the sum of the capacities of the dynamic single-level cell area and the static single-level cell area when the dynamic single-level cell area of the storage device is at its maximum.
[0010] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space decreases as the overall space utilization rate increases; the second threshold is greater than the first threshold.
[0011] When the overall space utilization rate is greater than or equal to the second threshold, the maximum available cache space is equal to the second capacity, and the second capacity is less than or equal to the third capacity. The third capacity is the capacity of the static single-level cell area of the storage device, or the capacity of the remaining available storage space of the storage device, or the smaller of the capacity of the static single-level cell area of the storage device and the capacity of the remaining available storage space. The remaining available storage space of the storage device refers to the space remaining after deducting the space occupied by regular data. Regular data includes data generated by local users of the electronic device where the storage device is located.
[0012] In one possible example, the first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0013] In another possible example, the first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0014] In one possible implementation, adjusting the size of the maximum available cache space of the storage device based on the overall space utilization rate includes: when the overall space utilization rate is greater than a first threshold and less than a second threshold, and when the overall space utilization rate changes to a third threshold, adjusting the size of the maximum available cache space of the storage device based on the overall space utilization rate.
[0015] Taking a third threshold of 5% as an example, when the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space of the storage device can be adjusted according to the overall space utilization rate for every 5% increase in the overall space utilization rate.
[0016] In one possible implementation, the method further includes: receiving a file request from a first application, the file request being for requesting a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtaining the first file from the server and caching it in the memory cache space; when the memory cache space is full, removing a second file from the memory cache space; caching the second file in the storage device cache space; the storage space occupied by the cached data stored in the storage device cache space does not exceed the maximum available cache space.
[0017] Optionally, the method further includes: when the first file is cached in the memory cache space, reading the first file from the memory cache space and returning it to the first application; when the first file is cached in the storage device cache space, reading the first file from the storage device cache space and returning it to the first application.
[0018] Optionally, the method further includes: dynamically adjusting the conditions for storing cached files in the storage device based on the overall space utilization rate.
[0019] When the overall space utilization rate is the third overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0020] This method dynamically adjusts the conditions under which cached files can be stored in the cache space of the storage device based on the overall space utilization of the storage device. It can control file writing to the storage device and maintain the IO performance of the storage device in a good state.
[0021] In one possible implementation, when the overall space utilization is less than or equal to a first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the first hit, and / or the size of the cached file is less than or equal to the first byte.
[0022] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the second number, and / or the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second number is greater than the first number, and the second byte is less than the first byte.
[0023] When the overall space utilization rate is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits in the memory of the electronic device where the cached file is located is greater than or equal to the third hit, and / or the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
[0024] Optionally, the second number increases with the increase of the overall space utilization, and / or the second byte decreases with the increase of the overall space utilization.
[0025] In one possible implementation, the method further includes: receiving a file request from a first application, the file request being for requesting a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtaining the first file from the server and caching it in the memory cache space; when the memory cache space is full, removing a second file from the memory cache space; and when the second file meets the adjusted conditions, caching the second file in the storage device cache space.
[0026] Secondly, embodiments of this application provide a storage device that can be applied to an electronic device to enable the electronic device to implement the storage method as described in the first aspect and any possible implementation thereof. The function of the device can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the steps in the storage method described in the first aspect and any possible implementation thereof.
[0027] For example, the device may include an acquisition unit, a processing unit, etc. The acquisition unit and the processing unit can cooperate to implement a storage method as described in the first aspect and any possible implementation thereof. For example, the acquisition unit can be used to acquire the overall space utilization rate of the storage device; the storage device includes operating in a multi-layer cell region, a dynamic single-layer cell region, and a static single-layer cell region; the overall space utilization rate is determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device.
[0028] The processing unit can be used to adjust the size of the maximum available cache space of the storage device based on the overall space utilization rate; the maximum available cache space is the maximum storage space allowed to be occupied by cached data when storing cached data in the storage device.
[0029] When the overall space utilization rate is the first overall space utilization rate, the size of the dynamic single-layer unit area is the fourth capacity, and the adjusted maximum available cache space size is the first value; when the overall space utilization rate is the second overall space utilization rate, the size of the dynamic single-layer unit area is the fifth capacity, and the adjusted maximum available cache space size is the second value; the second overall space utilization rate is greater than the first overall space utilization rate, the fifth capacity is less than the fourth capacity, and the second value is less than the first value.
[0030] In one possible implementation, when the overall space utilization rate is less than or equal to a first threshold, the size of the maximum available cache space is equal to the first capacity, which is less than or equal to the maximum single-level cell capacity of the storage device and greater than the capacity of the static single-level cell area of the storage device; the maximum single-level cell capacity is the sum of the capacities of the dynamic single-level cell area and the static single-level cell area when the dynamic single-level cell area of the storage device is at its maximum.
[0031] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space decreases as the overall space utilization rate increases; the second threshold is greater than the first threshold.
[0032] When the overall space utilization rate is greater than or equal to the second threshold, the maximum available cache space is equal to the second capacity, and the second capacity is less than or equal to the third capacity. The third capacity is the capacity of the static single-level cell area of the storage device, or the capacity of the remaining available storage space of the storage device, or the smaller of the capacity of the static single-level cell area of the storage device and the capacity of the remaining available storage space. The remaining available storage space of the storage device refers to the space remaining after deducting the space occupied by regular data. Regular data includes data generated by local users of the electronic device where the storage device is located.
[0033] In one possible example, the first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0034] In another possible example, the first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0035] In one possible implementation, the processing unit is specifically used to adjust the size of the maximum available cache space of the storage device according to the overall space utilization rate when the overall space utilization rate is greater than a first threshold and less than a second threshold, and when the overall space utilization rate changes to a third threshold.
[0036] In one possible implementation, the processing unit is further configured to: receive a file request from a first application, the file request being for a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtain the first file from the server and cache it in the memory cache space; when the memory cache space is full, remove the second file from the memory cache space; cache the second file in the storage device cache space; the storage space occupied by the cached data stored in the storage device cache space does not exceed the maximum available cache space.
[0037] Optionally, the processing unit is further configured to: when the first file is cached in the memory cache space, read the first file from the memory cache space and return it to the first application; when the first file is cached in the storage device cache space, read the first file from the storage device cache space and return it to the first application.
[0038] Optionally, the processing unit is also used to dynamically adjust the conditions for storing cached files in the storage device based on the overall space utilization rate.
[0039] When the overall space utilization rate is the third overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0040] In one possible implementation, when the overall space utilization is less than or equal to a first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the first hit, and / or the size of the cached file is less than or equal to the first byte.
[0041] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the second number, and / or the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second number is greater than the first number, and the second byte is less than the first byte.
[0042] When the overall space utilization rate is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits in the memory of the electronic device where the cached file is located is greater than or equal to the third hit, and / or the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
[0043] Optionally, the second number increases with the increase of the overall space utilization, and / or the second byte decreases with the increase of the overall space utilization.
[0044] In one possible implementation, the processing unit is further configured to: receive a file request from a first application, the file request being for a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtain the first file from the server and cache it in the memory cache space; when the memory cache space is full, remove the second file from the memory cache space; when the second file meets the adjusted conditions, cache the second file in the storage device cache space.
[0045] Similarly, the acquisition unit and the processing unit can work together to implement all the functions corresponding to the steps of the storage method as described in the first aspect and any possible implementation of the first aspect, which will not be elaborated here.
[0046] Thirdly, embodiments of this application provide an electronic device, which may include a storage device. The electronic device includes: a processor; and a memory for storing processor-executable instructions; when the processor is configured to execute the instructions, the electronic device implements the storage method described in the first aspect and any possible implementation thereof.
[0047] Fourthly, embodiments of this application provide a computer-readable storage medium having computer program instructions stored thereon; when the computer program instructions are executed by an electronic device, the electronic device causes the electronic device to implement the storage method as described in the first aspect and any possible implementation thereof.
[0048] Fifthly, embodiments of this application provide a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is executed in an electronic device, the processor in the electronic device implements the storage method as described in the first aspect and any possible implementation thereof.
[0049] The beneficial effects of the second to fifth aspects mentioned above can be referred to in the first aspect, and will not be repeated here.
[0050] Sixthly, embodiments of this application provide a storage method, the method comprising: obtaining the overall space utilization rate of a storage device; the storage device including a multi-layer cell region, a dynamic single-layer cell region, and a static single-layer cell region; the overall space utilization rate being determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device; and dynamically adjusting the conditions for storing cached files in the storage device based on the overall space utilization rate.
[0051] When the overall space utilization rate is the third overall space utilization rate, the size of the dynamic single-level cell area is the fourth capacity. The adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the size of the dynamic single-level cell area is the fifth capacity. The adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth capacity is less than the fourth capacity, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0052] This method dynamically adjusts the conditions under which cached files can be stored in the cache space of the storage device based on the overall space utilization of the storage device. It can control file writing to the storage device and maintain the IO performance of the storage device in a good state.
[0053] In one possible implementation, when the overall space utilization is less than or equal to a first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the first hit, and / or the size of the cached file is less than or equal to the first byte.
[0054] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the second number, and / or the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second number is greater than the first number, and the second byte is less than the first byte.
[0055] When the overall space utilization rate is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits in the memory of the electronic device where the cached file is located is greater than or equal to the third hit, and / or the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
[0056] In one possible example, the first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0057] In another possible example, the first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0058] Optionally, the second number increases with the increase of the overall space utilization, and / or the second byte decreases with the increase of the overall space utilization.
[0059] In one possible implementation, the method further includes: receiving a file request from a first application, the file request being for requesting a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtaining the first file from the server and caching it in the memory cache space; when the memory cache space is full, removing a second file from the memory cache space; and when the second file meets the adjusted conditions, caching the second file in the storage device cache space.
[0060] Optionally, the method further includes: when the first file is cached in the memory cache space, reading the first file from the memory cache space and returning it to the first application; when the first file is cached in the storage device cache space, reading the first file from the storage device cache space and returning it to the first application.
[0061] In a seventh aspect, embodiments of this application provide a storage device that can be applied to an electronic device to enable the electronic device to implement the storage method as described in the sixth aspect and any possible implementation thereof. The function of the device can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the steps in the storage method described in the sixth aspect and any possible implementation thereof.
[0062] For example, the device may include an acquisition unit, a processing unit, etc. The acquisition unit and the processing unit can cooperate to implement the storage method as described in the sixth aspect and any possible implementation thereof. For instance, the acquisition unit can be used to acquire the overall space utilization rate of the storage device; the storage device includes operating in a multi-layer cell region, a dynamic single-layer cell region, and a static single-layer cell region; the overall space utilization rate is determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device. The processing unit can be used to dynamically adjust the conditions for storing cached files in the storage device based on the overall space utilization rate.
[0063] When the overall space utilization rate is the third overall space utilization rate, the size of the dynamic single-level cell area is the fourth capacity. The adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the size of the dynamic single-level cell area is the fifth capacity. The adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth capacity is less than the fourth capacity, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0064] In one possible implementation, when the overall space utilization is less than or equal to a first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the first hit, and / or the size of the cached file is less than or equal to the first byte.
[0065] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the second number, and / or the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second number is greater than the first number, and the second byte is less than the first byte.
[0066] When the overall space utilization rate is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits in the memory of the electronic device where the cached file is located is greater than or equal to the third hit, and / or the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
[0067] In one possible example, the first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0068] In another possible example, the first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0069] Optionally, the second number increases with the increase of the overall space utilization, and / or the second byte decreases with the increase of the overall space utilization.
[0070] In one possible implementation, the processing unit is further configured to: receive a file request from a first application, the file request being for a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtain the first file from the server and cache it in the memory cache space; when the memory cache space is full, remove the second file from the memory cache space; when the second file meets the adjusted conditions, cache the second file in the storage device cache space.
[0071] Optionally, the processing unit is further configured to: when the first file is cached in the memory cache space, read the first file from the memory cache space and return it to the first application; when the first file is cached in the storage device cache space, read the first file from the storage device cache space and return it to the first application.
[0072] Similarly, the acquisition unit and the processing unit can work together to implement all the functions corresponding to the steps of the storage method as described in the sixth aspect and any possible implementation of the sixth aspect, which will not be elaborated here.
[0073] Eighthly, embodiments of this application provide an electronic device, which may include a storage device. The electronic device includes: a processor; and a memory for storing processor-executable instructions; when the processor is configured to execute the instructions, the electronic device implements the storage method described in the sixth aspect and any possible implementation thereof.
[0074] Ninthly, embodiments of this application provide a computer-readable storage medium having computer program instructions stored thereon; when the computer program instructions are executed by an electronic device, the electronic device causes the electronic device to implement the storage method as described in the sixth aspect and any possible implementation thereof.
[0075] In a tenth aspect, embodiments of this application provide a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is executed in an electronic device, a processor in the electronic device implements the storage method as described in the sixth aspect and any possible implementation thereof.
[0076] The beneficial effects described in aspects seven through ten above can be found in aspect six, and will not be repeated here.
[0077] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description
[0078] Figure 1 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0079] Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0080] Figure 3 A flowchart illustrating the storage method provided in an embodiment of this application;
[0081] Figure 4 A schematic diagram of the storage space of a hybrid SSD with dynamic SLC capacity provided in an embodiment of this application;
[0082] Figure 5 A schematic diagram illustrating the relationship between SLC capacity and overall space utilization provided in an embodiment of this application;
[0083] Figure 6 A schematic diagram illustrating the composition of a storage device in an electronic device provided in an embodiment of this application;
[0084] Figure 7 Another flowchart illustrating the storage method provided in this application embodiment;
[0085] Figure 8 This is a schematic diagram of the structure of the storage device provided in the embodiments of this application;
[0086] Figure 9 Another schematic diagram of the structure of the storage device provided in the embodiments of this application. Detailed Implementation
[0087] The terminology used in the following embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, “at least one” and “one or more” refer to one or more (including two). The character “ / ” generally indicates that the preceding and following objects are in an “or” relationship.
[0088] References to "one embodiment" or "some embodiments" as used in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. The term "connection" includes both direct and indirect connections, unless otherwise stated.
[0089] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0090] In the embodiments of this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0091] Solid-state disks (SSDs), also known as solid-state drives or solid-state hard drives, are storage devices that utilize flash memory technology. With the rapid advancement of flash storage technology and the increasing demand for storage, the storage density of SSDs has gradually increased. For example, the storage cell usage modes of SSDs have evolved from single-level cell (SLC) to multi-level cell (MLC), triple-level cell (TLC), and quad-level cell (QLC) modes. Specifically, in SLC mode, each storage cell of an SSD can store one bit of data; in MLC mode, each storage cell can store two bits of data; in TLC mode, each storage cell can store three bits of data; and in QLC mode, each storage cell can store four bits of data.
[0092] Increasing the storage density of SSDs allows for larger capacities and lower costs, but it also significantly reduces their input / output (IO) performance (read and write speeds). Currently, using a hybrid approach of high-speed and low-speed media in SSDs can optimize IO performance. This means that the SSD can include both high-speed and low-speed media, with the high-speed media being prioritized for read and write operations. For example, the high-speed media could be SLC (Single Cell Module) storage media, while the low-speed media could be MLC, TLC, QLC, or other multi-level cell storage modes. In other words, the storage space of an SSD using a hybrid approach can include multi-level cell areas and SLC areas. SSDs employing this hybrid approach can be referred to as hybrid SSDs.
[0093] Currently, hybrid SSDs can include: hybrid SSDs with static SLC capacity and hybrid SSDs with dynamic SLC capacity. Taking a hybrid SSD's storage space, which includes a QLC area (which can also be an MLC area, TLC area, etc.) and an SLC area, as an example... Figure 1 This is a schematic diagram illustrating the storage space composition of a hybrid SSD. Among them, Figure 1 (a) shows a hybrid SSD with static SLC capacity. Figure 1 (b) in the diagram shows a hybrid SSD with dynamic SLC capacity.
[0094] like Figure 1As shown in (a), the storage space of a hybrid SSD with static SLC capacity may include: a QLC region 101 and a static SLC region 102. The static SLC region 102 has a fixed size and can serve as a read / write buffer area for the entire hybrid SSD with static SLC capacity.
[0095] like Figure 1 As shown in (b), the storage space of a hybrid SSD with dynamic SLC capacity can include: a QLC region 103, a dynamic SLC region 104, and a static SLC region 105. The flash memory blocks in the dynamic SLC region 104 originally operate in QLC mode, but these flash memory blocks can be converted to SLC mode. Therefore, the region composed of these flash memory blocks after conversion to SLC mode can be called the dynamic SLC region 104. Figure 1 Compared to the hybrid SSD with static SLC capacity shown in (a), Figure 1 In the hybrid SSD with dynamic SLC capacity shown in (b), the size of the static SLC region 105 is fixed, but the size of the dynamic SLC region 104 varies. As the overall space utilization of the hybrid SSD with dynamic SLC capacity gradually increases, some areas in the dynamic SLC region 104 will switch to QLC mode (i.e., convert to QLC region 103), and the dynamic SLC region 104 will gradually decrease. As the overall space utilization of the hybrid SSD with dynamic SLC capacity gradually decreases, some areas in the dynamic SLC region 104 that have switched to QLC mode will switch back to SLC region, and the dynamic SLC region 104 will gradually increase. The overall space utilization of the hybrid SSD with dynamic SLC capacity can be defined as the ratio of the used area to the total area (including both used and unused areas) of the storage space. The dynamic SLC region 104 and the static SLC region 105 can serve as read / write buffer areas for the entire hybrid SSD with dynamic SLC capacity. Compared to hybrid SSDs with static SLC capacity, hybrid SSDs with dynamic SLC capacity have a larger read / write buffer area and better IO performance.
[0096] For hybrid SSDs with dynamic SLC capacity, when some areas in the dynamic SLC region switch to multi-layer cell mode, the capacity of the hybrid SSD with dynamic SLC capacity will increase, but the IO performance of the hybrid SSD with dynamic SLC capacity will decrease.
[0097] Against this background, embodiments of this application provide a storage method that can dynamically adjust the maximum available cache space of a hybrid SSD with dynamic SLC capacity based on the overall space utilization rate of the hybrid SSD with dynamic SLC capacity, thereby optimizing the IO performance of the hybrid SSD with dynamic SLC capacity.
[0098] The overall space utilization of a dynamic SLC hybrid SSD can be represented by the ratio of the used area to the total area within the dynamic SLC hybrid SSD's storage space. The used area within the dynamic SLC hybrid SSD's storage space refers to the area storing regular data and the area storing cached data. The maximum available cache space refers to the maximum storage space allowed for cached data when storing cached data in a dynamic SLC hybrid SSD.
[0099] For example, a hybrid SSD with dynamic SLC capacity can be used as a storage device for an electronic device (such as a mobile phone). Regular data may include local user-generated data of the electronic device, and cached data may include remote data stored locally by the electronic device to improve data request performance.
[0100] Taking mobile phones as an example, their operating systems can run various internet-connected applications, such as chat software and online video players. These applications frequently need to request data files from the network (i.e., remotely). However, mobile phones typically have limited memory, making it difficult to meet the file caching needs of all applications. If every file request from an application went through the network, it would lead to unacceptable performance degradation. Therefore, mobile phones can improve data request performance by storing data files as cache data on a local SSD.
[0101] For example, this method can be applied to the aforementioned electronic devices that use hybrid SSDs with dynamic SLC capacity as storage devices.
[0102] In some embodiments, the electronic device may include: a terminal device, a server, or a virtual machine (VM), etc. The terminal device may be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, etc. The embodiments of this application do not impose special limitations on the specific form of the electronic device.
[0103] For example, taking a mobile phone as an electronic device, Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 2 As shown, the electronic device may include: a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, a sensor module 280, buttons 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc.
[0104] Processor 210 may include one or more processing units, such as application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0105] The controller can serve as the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.
[0106] The processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. This memory can store instructions or data that the processor 210 has just used or that are being used repeatedly.
[0107] In some embodiments, the processor 210 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0108] It is understood that the interface connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a structural limitation on the electronic device. In other embodiments, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0109] The charging management module 240 receives charging input from the charger. While charging the battery 242, the charging management module 240 can also supply power to the electronic device through the power management module 241.
[0110] The power management module 241 connects the battery 242, the charging management module 240, and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240, providing power to the processor 210, internal memory 221, external memory, display screen 294, camera 293, and wireless communication module 260. The power management module 241 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 241 may also be located within the processor 210. In other embodiments, the power management module 241 and the charging management module 240 may be housed in the same device.
[0111] The wireless communication function of electronic devices can be realized through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor and baseband processor, etc.
[0112] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 250 can provide solutions for wireless communication applications in electronic devices, including 2G / 3G / 4G / 5G. The mobile communication module 250 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 250 may be housed in the processor 210. In some embodiments, at least some functional modules of the mobile communication module 250 and at least some modules of the processor 210 may be housed in the same device.
[0113] The modem processor may include a modulator and a demodulator. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 210 and may be housed in the same device as the mobile communication module 250 or other functional modules.
[0114] The wireless communication module 260 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 210. The wireless communication module 260 can also receive signals to be transmitted from processor 210, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0115] In some embodiments, antenna 1 of the electronic device is coupled to mobile communication module 250, and antenna 2 is coupled to wireless communication module 260, enabling the electronic device to communicate with networks and other devices via 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), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS). For example, in this embodiment of the application, the electronic device can use the wireless communication module 260 to interact with the network end of some networked applications through wireless communication technology.
[0116] Electronic devices implement display functions through GPUs, display screens 294, and application processors. A GPU is a microprocessor for image processing, connecting display screens 294 and the application processor. Processor 210 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0117] Display screen 294 is used to display images, videos, etc. Display screen 294 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N displays 294, where N is a positive integer greater than 1.
[0118] Electronic devices can achieve shooting functions through ISP, camera 293, video codec, GPU, display 294 and application processor.
[0119] The external storage interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 210 through the external storage interface 220 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0120] Internal memory 221 can be used to store computer executable program code, which includes instructions. Processor 210 executes various functional applications and data processing of the electronic device by running the instructions stored in internal memory 221. For example, in this embodiment, processor 210 can implement the storage method provided in this embodiment by executing the instructions stored in internal memory 221. Internal memory 221 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, phone book, etc.). In addition, internal memory 221 may include high-speed random access memory, and may also include non-volatile memory, such as a hybrid SSD with dynamic SLC capacity, flash memory devices, universal flash storage (UFS), etc.
[0121] Electronic devices can implement audio functions through audio modules 270, speakers 270A, receivers 270B, microphones 270C, headphone jacks 270D, and application processors. Examples include making calls, playing music, and recording.
[0122] The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, a barometric pressure sensor 280C, a magnetic sensor 280D, an accelerometer sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a bone conduction sensor 280M, etc.
[0123] Understandable, Figure 2 The illustrated structure does not constitute a specific limitation on the electronic device. In other embodiments, when the electronic device is a tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, UMPC, netbook, and other devices such as cellular phones, PDAs, AR / VR devices, etc., the electronic device may include more than Figure 2 This may involve more or fewer components, or combining certain components, or splitting certain components, or different component arrangements. Figure 2 The components shown can be implemented in hardware, software, or a combination of both. This application does not limit the specific structure of the electronic device.
[0124] The storage method provided in the embodiments of this application will be described below with reference to specific examples.
[0125] For example, Figure 3 This is a flowchart illustrating the storage method provided in an embodiment of this application. Figure 3 As shown, the method may include:
[0126] S301, Obtain the overall space utilization of a hybrid SSD with dynamic SLC capacity.
[0127] For example, Figure 4 This is a schematic diagram of the storage space of a hybrid SSD with dynamic SLC capacity provided in an embodiment of this application. Figure 4 As shown, the storage space of a hybrid SSD with dynamic SLC capacity can include: regular data storage space, cache data storage space, and free space.
[0128] The system is divided into three parts: regular data storage space for regular data, such as data generated locally by users on electronic devices; cached data storage space for cached data, such as remote data stored locally by electronic devices to improve data request performance; and free space for storage without any data.
[0129] The overall space utilization of a hybrid SSD with dynamic SLC capacity can be expressed as the ratio of the sum of the regular data storage space and the cache data storage space to the total storage space of the hybrid SSD with dynamic SLC capacity. The area comprised of the regular data storage space and the cache data storage space is the used area within the storage space of the hybrid SSD with dynamic SLC capacity. This area can also be referred to as the total used space.
[0130] Understandably, in hybrid SSDs with dynamic SLC capacity, the size of the dynamic SLC region is related to the overall space utilization. For example, when the overall space utilization is at the first overall space utilization rate, the size of the dynamic SLC region is the fourth capacity; when the overall space utilization is at the second overall space utilization rate, the size of the dynamic SLC region is the fifth capacity; when the second overall space utilization rate is greater than the first overall space utilization rate, the fifth capacity is less than the fourth capacity. Specifically, the maximum overall space utilization rate corresponding to the maximum SLC capacity of a hybrid SSD with both the second and first overall space utilization rates is greater than that corresponding to the minimum overall space utilization rate corresponding to the minimum SLC capacity of a hybrid SSD with dynamic SLC capacity.
[0131] S302. Adjust the maximum available cache space of the hybrid SSD with dynamic SLC capacity based on the overall space utilization rate.
[0132] In some embodiments, S302 may include: when the overall space utilization is less than or equal to a first threshold, adjusting the maximum available cache space of the hybrid SSD with dynamic SLC capacity, such that the size of the maximum available cache space is equal to the first capacity, the first capacity being less than or equal to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and greater than the capacity of the static SLC region of the hybrid SSD with dynamic SLC capacity; when the overall space utilization is greater than the first threshold and less than a second threshold, the second threshold being greater than the first threshold, adjusting the maximum available cache space of the hybrid SSD with dynamic SLC capacity, such that the size of the maximum available cache space decreases as the overall space utilization increases; when the overall space utilization is greater than or equal to the second threshold, adjusting the maximum available cache space of the hybrid SSD with dynamic SLC capacity, such that the size of the maximum available cache space is equal to the second capacity, the second capacity being less than or equal to the capacity of the static SLC region of the hybrid SSD with dynamic SLC capacity. It is understood that the second capacity is less than the first capacity.
[0133] The maximum SLC capacity refers to the sum of the capacities of the dynamic SLC area and the static SLC area in a hybrid SSD with dynamic SLC capacity, when all multi-layer cell areas that can be converted to SLC mode are working in SLC mode.
[0134] In one possible implementation, the first threshold can be the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity; the second threshold can be the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity.
[0135] For example, when all multi-layer cell regions in a hybrid SSD with dynamic SLC capacity are operating in SLC mode, the SLC capacity of the hybrid SSD with dynamic SLC capacity is at its maximum. As the overall space utilization increases, when the overall space utilization increases to a certain value, the dynamic SLC area will begin to decrease. The overall space utilization at this point is the maximum overall space utilization corresponding to the maximum SLC capacity. As the overall space utilization continues to increase, when the overall space utilization increases to another value, the dynamic SLC area decreases to 0, and the SLC capacity of the hybrid SSD with dynamic SLC capacity becomes the minimum (i.e., the capacity of the static SLC area). The overall space utilization at this point is the minimum overall space utilization corresponding to the minimum SLC capacity.
[0136] For example, Figure 5 This diagram illustrates the relationship between SLC capacity and overall space utilization in an embodiment of this application. The horizontal and vertical axes represent the overall space utilization of the hybrid SSD with dynamic SLC capacity, and the vertical axis represents the SLC capacity corresponding to the current overall space utilization. SLC capacity max This represents the maximum SLC capacity of a hybrid SSD with dynamic SLC capacity. Specifically, it's the sum of the capacities of the dynamic SLC and static SLC regions when all multi-layer cell regions capable of switching to SLC mode are operating in SLC mode. (SLC capacity) min The minimum SLC capacity of a hybrid SSD representing dynamic SLC capacity is the capacity of the static SLC region.
[0137] like Figure 5 As shown, when the overall space utilization is less than or equal to m1 (m1 is greater than 0 and less than m2), the SLC capacity of the hybrid SSD with dynamic SLC capacity is the SLC capacity. max When the overall space utilization rate is greater than m1 and less than m2 (m2 is greater than m1 and less than 100%), the SLC capacity of the hybrid SSD with dynamic SLC capacity decreases as the overall space utilization rate increases; when the overall space utilization rate is equal to m2, the SLC capacity of the hybrid SSD with dynamic SLC capacity is the SLC capacity. min .
[0138] m1 represents the maximum overall space utilization rate when the SLC capacity is at its maximum, and m2 represents the minimum overall space utilization rate when the SLC capacity is at its minimum. The first threshold can be equal to m1, and the second threshold can be equal to m2.
[0139] In this implementation, when the overall space utilization is less than or equal to m1, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted so that the size of the maximum available cache space is equal to the first capacity, and the first capacity is less than or equal to the SLC capacity. max When the overall space utilization is greater than m1 and less than m2, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted so that the size of the maximum available cache space decreases as the overall space utilization increases. When the overall space utilization is greater than or equal to m2, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted so that the size of the maximum available cache space is equal to the second capacity, which can be less than or equal to the SLC capacity. min .
[0140] In other words, in this implementation, the hybrid SSD with dynamic SLC capacity can be divided into three stages based on the overall space utilization: overall space utilization less than or equal to a first threshold, overall space utilization greater than the first threshold but less than a second threshold, and overall space utilization greater than or equal to the second threshold. For example, the stage where the overall space utilization is less than or equal to the first threshold can be called the idle stage, the stage where the overall space utilization is greater than the first threshold but less than the second threshold can be called the moderate stage, and the stage where the overall space utilization is greater than or equal to the second threshold can be called the heavy stage. In the idle stage, all multi-layer cell regions in the hybrid SSD with dynamic SLC capacity that can be converted to SLC mode operate in SLC mode, the SLC capacity is at its maximum, and the overall performance of the hybrid SSD with dynamic SLC capacity is at its best. This application can set the maximum available cache space to the first capacity, which can be less than or equal to the maximum SLC capacity. In the moderate stage, the multi-layer cell areas in the hybrid SSD with dynamic SLC capacity that can be converted to SLC mode operate in SLC mode, and the SLC capacity is decreasing. This application can adjust the size of the maximum available cache space according to the overall space utilization, so that it decreases as the overall space utilization increases. In the heavy stage, all multi-layer cell areas in the hybrid SSD with dynamic SLC capacity that can be converted to SLC mode operate in multi-layer cell mode. The SLC capacity of the hybrid SSD with dynamic SLC capacity is the capacity of the static SLC area. This application can set the size of the maximum available cache space to a second capacity, which can be less than or equal to the capacity of the static SLC area.
[0141] Taking the first capacity as equal to the maximum SLC capacity and the second capacity as equal to the capacity of the static SLC area as an example, in one possible example, when the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted according to the following formula (1) so that the size of the maximum available cache space decreases as the overall space utilization rate increases.
[0142] Y = kX + c Formula (1)
[0143] In formula (1), Y represents the size of the maximum available cache space, X represents the overall space utilization rate, k represents the coefficient, and c is a constant. The values of k and c can be calculated by substituting the first capacity and the first threshold, as well as the second capacity and the second threshold into formula (1).
[0144] For example, taking a first capacity of n1 (maximum SLC capacity), a first threshold of m1 as described above, and a second capacity of n2 (capacity of static SLC region) as an example, substituting n1 and m1, as well as n2 and n2 into the above formula (1), we can obtain the following set of equations (1).
[0145]
[0146] Solving the system of equations (1), we can obtain the values of k and c as follows.
[0147]
[0148] c = n1 - km1 = n2 - km2
[0149] After obtaining the values of k and c, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted according to the above formula (1) based on the overall space utilization rate, so that the size of the maximum available cache space decreases as the overall space utilization rate increases.
[0150] Understandably, when adjusting the maximum available cache space of a hybrid SSD with dynamic SLC capacity according to the overall space utilization using formula (1), the size of the maximum available cache space can decrease linearly as the overall space utilization increases. Furthermore, this example only uses formula (1) as one way to adjust the size of the maximum available cache space to decrease as the overall space utilization increases, and is not intended to limit it. In other examples, other methods can also be used to adjust the size of the maximum available cache space to decrease as the overall space utilization increases.
[0151] Optionally, in some embodiments, when the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted according to the above formula (1) whenever the overall space utilization rate changes (e.g., increases or decreases) to the third threshold. For example, the third threshold can be 5%, 6%, 8%, etc., and the size of the third threshold is not limited here.
[0152] Taking the third threshold of 5% as an example, when the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted according to the above formula (1) for every 5% increase in the overall space utilization rate.
[0153] In other words, in this embodiment, the maximum available cache space of the hybrid SSD with dynamic SLC capacity can be adjusted at intervals of a third threshold, between the first and second thresholds. The change in the maximum available cache space does not have to be continuous; the size of the maximum available cache space can be updated once when the overall space utilization changes by the third threshold.
[0154] The above implementation describes the scenarios where the first threshold is the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold is the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity. Optionally, in another possible implementation, the first threshold can be less than or greater than the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, such as: the first threshold can be less than or greater than m1 mentioned above; the second threshold can also be less than or greater than the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity, such as: the second threshold can be less than or greater than m2 mentioned above. This application does not limit the specific values of the first and second thresholds.
[0155] For example, in one possible scenario, the first threshold may be greater than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold may be less than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity.
[0156] For example, in another possible example, the first threshold may be less than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold may be greater than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity.
[0157] Optionally, for the case where the first threshold is less than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold is greater than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity, in some possible implementation scenarios, the first threshold can be 0 and the second threshold can be 100%. That is, the hybrid SSD with dynamic SLC capacity can be divided into a whole stage according to the overall space utilization rate.
[0158] For example, in another possible example, the first threshold may be less than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold may be less than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity.
[0159] Optionally, for the cases where the first threshold is less than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold is less than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity, in some possible implementation scenarios, the first threshold can be 0, and the second threshold can be less than the above m2. That is, based on the overall space utilization rate, the hybrid SSD with dynamic SLC capacity can be divided into two stages: the overall space utilization rate is greater than the first threshold and less than the second threshold, and the overall space utilization rate is greater than or equal to the second threshold (the case where the overall space utilization rate is equal to 0 can be classified as the extreme case where the overall space utilization rate is greater than the first threshold and less than the second threshold).
[0160] For example, in another possible example, the first threshold can be greater than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold can be greater than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity.
[0161] Optionally, for the case where the first threshold is greater than or equal to the maximum overall space utilization rate corresponding to the maximum SLC capacity of the hybrid SSD with dynamic SLC capacity, and the second threshold is greater than or equal to the minimum overall space utilization rate corresponding to the minimum SLC capacity of the hybrid SSD with dynamic SLC capacity, in some possible implementation scenarios, the first threshold can be the aforementioned m1, and the second threshold can be 100%. That is, based on the overall space utilization rate, the hybrid SSD with dynamic SLC capacity can be divided into two stages: the overall space utilization rate is less than or equal to the first threshold, and the overall space utilization rate is greater than the first threshold (the case where the overall space utilization rate is equal to the second threshold (i.e., 100%) can be classified as the extreme case where the overall space utilization rate is greater than the first threshold).
[0162] It should be noted that neither the first threshold nor the second threshold described in the embodiments of this application are negative numbers.
[0163] The above examples illustrate how, based on the size of the first and second thresholds and the overall space utilization, a hybrid SSD with dynamic SLC capacity can be divided into one overall stage, or two or three stages, and the size of the maximum available cache space can be adjusted in each stage. Optionally, in some possible implementations, the hybrid SSD with dynamic SLC capacity can be divided into more stages based on the overall space utilization, and the size of the maximum available cache space can be adjusted in each stage. For example, the hybrid SSD with dynamic SLC capacity can be divided into an idle stage, a medium stage, and a heavy stage in the manner described in the aforementioned embodiments. The medium stage can be further divided into multiple sub-stages, such as: the medium stage can be divided into S (S is an integer greater than 1) sub-stages at equal or non-equal intervals according to the size of the overall space utilization. Each sub-stage can adjust the size of the maximum available cache space in different ways (not limited to the above formula (1)) so that the size of the maximum available cache space decreases as the overall space utilization increases, such as: the size of the maximum available cache space decreases linearly or non-linearly as the overall space utilization increases. However, it should be noted that the maximum available cache space is less than or equal to the maximum SLC capacity, and the size of the maximum available cache space tends to decrease as the overall space utilization rate increases.
[0164] For example, when the overall space utilization rate is the first overall space utilization rate, the adjusted maximum available cache space size is the first value; when the overall space utilization rate is the second overall space utilization rate, the adjusted maximum available cache space size is the second value; when the second overall space utilization rate is greater than the first overall space utilization rate, the second value is less than the first value.
[0165] It should be noted that, in this embodiment, for the case where the maximum available cache space changes discontinuously (e.g., decreases) as described in the foregoing embodiments, the second overall space utilization rate and the first overall space utilization rate can be the overall space utilization rate of the hybrid SSD with dynamic SLC capacity in two different stages. Alternatively, for the case where the maximum available cache space changes continuously (e.g., decreases) as described in the foregoing embodiments, the second overall space utilization rate and the first overall space utilization rate can also be the overall space utilization rate of the hybrid SSD with dynamic SLC capacity in the same stage. The division of stages can refer to the foregoing embodiments.
[0166] It is understandable that the method mentioned in the foregoing embodiments, which adjusts the maximum available cache space of the hybrid SSD with dynamic SLC capacity by taking a third threshold as a dynamic adjustment point between the first and second thresholds, can also be regarded as dividing the overall space utilization between the first and second thresholds into multiple sub-stages according to the third threshold as an interval. However, the size of the maximum available cache space in each sub-stage remains unchanged, while the size of the maximum available cache space between two adjacent sub-stages will change. The method of adjusting the maximum available cache space between any two adjacent sub-stages is the same.
[0167] The above embodiments illustrate how to adjust the size of the maximum available cache space under three conditions: the overall space utilization rate is less than or equal to a first threshold, the overall space utilization rate is greater than the first threshold but less than a second threshold, and the overall space utilization rate is greater than or equal to the second threshold. Specifically, when the overall space utilization rate is greater than or equal to the second threshold, the maximum available cache space of the hybrid SSD with dynamic SLC capacity is adjusted so that the size of the maximum available cache space is equal to the second capacity, and the second capacity is less than or equal to the capacity of the static SLC region of the hybrid SSD with dynamic SLC capacity. Optionally, in some other embodiments, the second capacity may also be less than or equal to the capacity of the remaining available storage space of the hybrid SSD with dynamic SLC capacity, or the second capacity may be less than or equal to the smaller value between the capacity of the remaining available storage space of the hybrid SSD with dynamic SLC capacity and the capacity of the static SLC region.
[0168] That is, when the overall space utilization rate is greater than or equal to the second threshold, the maximum available cache space is equal to the second capacity, and the second capacity can be less than or equal to the third capacity; the third capacity is the capacity of the static SLC area of the hybrid SSD with dynamic SLC capacity, or the capacity of the remaining available storage space of the hybrid SSD with dynamic SLC capacity, or the smaller of the capacity of the static SLC area of the hybrid SSD with dynamic SLC capacity and the capacity of the remaining available storage space.
[0169] The remaining available storage space of a hybrid SSD with dynamic SLC capacity refers to the space remaining after deducting the space occupied by regular data from the storage space of the hybrid SSD with dynamic SLC capacity. For example, for the above... Figure 4 Regarding the storage space of the hybrid SSD with dynamic SLC capacity shown, the remaining available storage space of the hybrid SSD with dynamic SLC capacity may include: cache data storage space and free space.
[0170] In the storage method provided in this application embodiment, by controlling the maximum available cache space, the overall space usage of the hybrid SSD with dynamic SLC capacity can be reduced, the size of the available SLC cache space can be maintained, and the IO performance of the hybrid SSD with dynamic SLC capacity can be improved.
[0171] For example, Figure 6 This is a schematic diagram illustrating the composition of a storage device in an electronic device provided in an embodiment of this application. For example... Figure 6 As shown, the electronic device may include memory 601 and a hybrid SSD 602 with dynamic SLC capacity.
[0172] The memory 601 may include: one or more applications, a caching system (or cache management system), and memory cache storage space (referred to as memory cache). For example, applications may include various network applications such as chat software and online video players.
[0173] The hybrid SSD 602 with dynamic SLC capacity can include: regular data storage space, flash cache storage space (i.e., cache data storage space, or simply flash cache), and free space.
[0174] When an application in memory 601 makes a network file request (or file request), such as a first application requesting a first file, the caching system in memory 601 can intercept the request and determine whether the requested file (the first file) is cached in both the memory cache (the cache space in memory) and the flash cache (the cache space of the hybrid SSD 602 with dynamic SLC capacity). If the requested file is cached in the memory cache, it can return the file to the application. If the requested file is cached in the flash cache, it can also return the file to the application. If neither the memory cache nor the flash cache caches the requested file, the device can request the file from a remote location (such as the server corresponding to the application) via the network and cache it in the memory cache.
[0175] When the memory cache space is full, the caching system can remove files from the memory cache according to the eviction policy (such as removing the second file). This application does not limit the eviction policy. Files removed from the memory cache can be cached in the flash cache. The caching system can adjust the maximum available cache space of the hybrid SSD 602 with dynamic SLC capacity according to the storage method provided in the embodiments of this application, based on the overall space utilization rate of the hybrid SSD 602 with dynamic SLC capacity. When files removed from the memory cache are cached in the flash cache, the caching system can remove cached files (i.e., cached data) in the flash cache according to the eviction policy, so that the space occupied by the cached files stored in the flash cache does not exceed the maximum available cache space.
[0176] For example, the caching system may include a cache space management module, which can be used to implement the function of adjusting the maximum available cache space of the hybrid SSD 602 with dynamic SLC capacity according to the overall space utilization of the hybrid SSD 602 with dynamic SLC capacity.
[0177] Optionally, in the method provided in this application embodiment, if the space occupied by the cache file in the flash cache exceeds the updated maximum available cache space after each adjustment of the maximum available cache space, the cache file in the flash cache can be removed according to the removal strategy, so that the space occupied by the cache file stored in the flash cache does not exceed the updated maximum available cache space.
[0178] Optionally, in this embodiment of the application, when the overall space utilization of the hybrid SSD 602 with dynamic SLC capacity reaches 100%, if the regular data storage space needs to continue to grow, the maximum available cache space can be compressed and cache files in the flash cache can be removed to free up space for regular data use.
[0179] The above embodiments describe the process of adjusting the maximum available cache space of a hybrid SSD with dynamic SLC capacity based on the overall space utilization rate in the storage method provided by this application. Optionally, in some embodiments, the storage method provided by this application can also dynamically adjust the conditions for cache files to be stored in the cache data storage space (hereinafter referred to as flash cache) of the hybrid SSD with dynamic SLC capacity based on the overall space utilization rate of the hybrid SSD with dynamic SLC capacity. The electronic device can determine whether a cache file should be stored in the flash cache based on the conditions for cache files to be stored in the flash cache of the hybrid SSD with dynamic SLC capacity. For example, these cache files may be files removed from the memory cache. This method dynamically adjusts the conditions for cache files to be stored in the flash cache of the hybrid SSD with dynamic SLC capacity based on the overall space utilization rate of the hybrid SSD with dynamic SLC capacity, which can control file writing to the hybrid SSD with dynamic SLC capacity and maintain the IO performance of the hybrid SSD with dynamic SLC capacity in a good state.
[0180] For example, Figure 7 This is another schematic diagram of the storage method provided in an embodiment of this application. For example... Figure 7 As shown, the method may include:
[0181] S701, Obtain the overall space utilization of a hybrid SSD with dynamic SLC capacity.
[0182] The specific implementation process of S701 can be referred to the aforementioned S301, and will not be repeated here.
[0183] S702. Based on the overall space utilization rate, dynamically adjust the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity.
[0184] In some embodiments, the caching system of an electronic device can use a least frequently used (LFU) strategy as the file management strategy for flash memory caching. S702 may include: when the overall space utilization is less than or equal to a first threshold, adjusting the condition for storing cached files in the flash cache of a hybrid SSD with dynamic SLC capacity is: the number of times the cached file is hit in memory by file operations (such as read / write operations) is greater than or equal to the first hit (the first hit is an integer greater than 0), that is, when the number of times the cached file is hit in memory by file operations is greater than or equal to the first hit, the cached file can be stored in the flash cache of the hybrid SSD with dynamic SLC capacity; when the overall space utilization is greater than the first threshold and less than a second threshold, where the second threshold is greater than the first threshold, adjusting the condition for storing cached files in the flash cache of the hybrid SSD with dynamic SLC capacity is: the number of times the cached file is hit in memory by file operations is greater than... The condition for adjusting the storage of cache files in the dynamic SLC capacity hybrid SSD flash cache is as follows: the number of file operation hits in memory is greater than or equal to the second number (the second number is an integer greater than 0), and the second number is greater than the first number. That is, when the number of file operation hits in memory of the cache file is greater than or equal to the second number, the cache file can be stored in the flash cache of the dynamic SLC capacity hybrid SSD. When the overall space utilization is greater than or equal to the second threshold, the condition for adjusting the storage of cache files in the dynamic SLC capacity hybrid SSD flash cache is: the number of file operation hits in memory of the cache file is greater than or equal to the third number (the third number is an integer greater than 0), and the third number is greater than the second number. That is, when the number of file operation hits in memory of the cache file is greater than or equal to the third number, the cache file can be stored in the flash cache of the dynamic SLC capacity hybrid SSD.
[0185] The values of the first threshold and the second threshold can be referred to in the previous embodiments, and will not be repeated here.
[0186] In this embodiment, the first number is less than the second number, the second number is less than the third number, and the overall space utilization rate changes from a stage where it is less than or equal to the first threshold, to a stage where the overall space utilization rate is greater than the first threshold and less than the second threshold, and then to a stage where the overall space utilization rate is greater than or equal to the second threshold. During this process, the conditions for storing cached files in the flash cache of the hybrid SSD with dynamic SLC capacity become increasingly strict, which can maintain the IO performance of the hybrid SSD with dynamic SLC capacity in a good state.
[0187] For example, in some possible implementations, the second number can be an integer multiple of the first number, such as: the first number can be L times, and the second number can be 2*L times ("*" represents multiplication). The third number can be an integer multiple of the second number, such as: the third number can be 4*L times. In other possible implementations, the second number may not be an integer multiple of the first number, such as: the first number can be L times, and the second number can be L+L1 times. The third number may also not be an integer multiple of the second number, such as: the third number can be L+L1+L2 times. This application does not limit the specific size of the first, second, and third numbers.
[0188] In other embodiments, the file management strategy for the flash memory cache of the electronic device's caching system can be a file size-based management strategy. S702 may include: when the overall space utilization is less than or equal to a first threshold, adjusting the condition for storing cache files in the flash memory cache of the hybrid SSD with dynamic SLC capacity is: the size of the cache file is less than or equal to a first byte (the first byte is a value greater than 0), that is, when the size of the cache file is less than or equal to the first byte, the cache file can be stored in the flash memory cache of the hybrid SSD with dynamic SLC capacity; when the overall space utilization is greater than the first threshold and less than a second threshold, where the second threshold is greater than the first threshold, adjusting the condition for storing cache files in the flash memory cache of the hybrid SSD with dynamic SLC capacity is: the size of the cache file is less than or equal to... The second byte (a value greater than 0) is smaller than the first byte. That is, when the size of the cache file is less than or equal to the second byte, the cache file can be stored in the flash cache of the hybrid SSD with dynamic SLC capacity. When the overall space utilization is greater than or equal to the second threshold, the condition for adjusting the cache file to be stored in the flash cache of the hybrid SSD with dynamic SLC capacity is: the size of the cache file is less than or equal to the third byte (a value greater than 0), and the third byte is smaller than the second byte. That is, when the size of the cache file is less than or equal to the third byte, the cache file can be stored in the flash cache of the hybrid SSD with dynamic SLC capacity.
[0189] The values of the first threshold and the second threshold can be referred to in the previous embodiments, and will not be repeated here.
[0190] In this embodiment, the third byte is smaller than the second byte, the second byte is smaller than the first byte, and during the process of the overall space utilization rate changing from a stage where it is less than or equal to the first threshold, to a stage where the overall space utilization rate is greater than the first threshold and less than the second threshold, and then to a stage where the overall space utilization rate is greater than or equal to the second threshold, the cache file that can meet the conditions for storing the flash cache of the hybrid SSD with dynamic SLC capacity becomes smaller and smaller, which can maintain the IO performance of the hybrid SSD with dynamic SLC capacity in a good state.
[0191] For example, in some possible implementations, the first byte can be an integer multiple of the second byte, and the second byte can be an integer multiple of the third byte. For instance, the first byte can be B bytes, the second byte can be B / 2 bytes (" / " means division), and the third byte can be B / 4 bytes. In other possible implementations, the first, second, and third bytes may not be in an integer multiple relationship. For instance, the first byte can be B bytes, the second byte can be B-B1 bytes, and the third byte can be B-B1-B2 bytes.
[0192] Optionally, the above embodiments illustrate a method for dynamically adjusting the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity under three scenarios: overall space utilization rate is less than or equal to a first threshold, overall space utilization rate is greater than the first threshold but less than a second threshold, and overall space utilization rate is greater than or equal to the second threshold. Specifically, for the case where the overall space utilization rate is greater than the first threshold but less than the second threshold, the conditions for storing cache files in the flash cache of the hybrid SSD with dynamic SLC capacity remain the same. In some embodiments, for the case where the overall space utilization rate is greater than the first threshold but less than the second threshold, the conditions for storing cache files in the flash cache of the hybrid SSD with dynamic SLC capacity can also be adjusted, making the conditions for storing cache files in the flash cache of the hybrid SSD with dynamic SLC capacity increasingly stringent as the overall space utilization rate increases.
[0193] For example, when the caching system of an electronic device uses the LFU strategy as the file management strategy for flash cache, for cases where the overall space utilization rate is greater than the first threshold and less than the second threshold, the condition for adjusting the storage of cache files in the flash cache of a hybrid SSD with dynamic SLC capacity is: the number of file operation hits of the cache file in memory is greater than or equal to the second number, and the second number increases with the increase of the overall space utilization rate.
[0194] For example, when the file management strategy of the electronic device's caching system for flash memory cache is based on the file size management strategy, for cases where the overall space utilization rate is greater than the first threshold and less than the second threshold, the condition for storing cache files in the flash memory cache of a hybrid SSD with dynamic SLC capacity can be adjusted as follows: the size of the cache file is less than or equal to the second byte, and the second byte decreases as the overall space utilization rate increases.
[0195] Optionally, in some possible implementations, the hybrid SSD with dynamic SLC capacity can be divided into more stages based on the overall space utilization, and the conditions for storing cached files in the flash cache of the hybrid SSD with dynamic SLC capacity can be adjusted in each stage. For example, the hybrid SSD with dynamic SLC capacity can be divided into an idle stage, a medium stage, and a heavy stage as described in the aforementioned embodiments. The medium stage can be further divided into multiple sub-stages. For example, the medium stage can be divided into S (S is an integer greater than 1) sub-stages at equal or non-equal intervals according to the size of the overall space utilization. Each sub-stage can adjust the conditions for storing cached files in the flash cache of the hybrid SSD with dynamic SLC capacity in different ways, so that the conditions for storing cached files in the flash cache of the hybrid SSD with dynamic SLC capacity become more and more stringent as the overall space utilization increases. For example, the second byte increases linearly or non-linearly with the increase of the overall space utilization, or the second byte decreases linearly or non-linearly with the increase of the overall space utilization.
[0196] For example, when the overall space utilization rate is the third overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the hybrid SSD with dynamic SLC capacity resides is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the hybrid SSD with dynamic SLC capacity resides is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; when the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0197] It should be noted that, in this embodiment, for the case where the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity change continuously as described in the foregoing embodiments, the third overall space utilization rate and the fourth overall space utilization rate can be the overall space utilization rate of the hybrid SSD with dynamic SLC capacity in the same stage. Alternatively, for the case where the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity change discontinuously as described in the foregoing embodiments, the third overall space utilization rate and the fourth overall space utilization rate can be the overall space utilization rate of the hybrid SSD with dynamic SLC capacity in different stages. The division of stages can refer to the foregoing embodiments.
[0198] In the storage method provided in this application embodiment, by dynamically adjusting the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity, the number of times invalid cache files are cached can be reduced, the writing to the hybrid SSD with dynamic SLC capacity can be reduced, and the IO performance of the hybrid SSD with dynamic SLC capacity can be optimized.
[0199] For example, with Figure 6 Taking the storage device of the illustrated electronic device as an example, when the memory cache of memory 601 is full, subsequent network file requests may lead to new network file caching operations. At this time, the caching system needs to evict cache files in the memory cache according to the eviction policy (or cache management policy). The caching system can determine whether the cache file evictioned from the memory cache can be cached in the flash cache of the dynamic SLC capacity hybrid SSD 602 according to the conditions for storing the dynamically adjusted cache file in the storage method provided in this application embodiment. When the cache file evictioned from the memory cache (such as the second file) meets the conditions for storing in the flash cache of the dynamic SLC capacity hybrid SSD, the cache file evictioned from the memory cache can be stored in the flash cache; when the cache file evictioned from the memory cache does not meet the conditions for storing in the flash cache of the dynamic SLC capacity hybrid SSD, the cache file evictioned from the memory cache can be deleted or rejected from being stored in the flash cache.
[0200] For example, the caching system may include a cache file filtering module, which can be used to implement the above-mentioned function of dynamically adjusting the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity based on the overall space utilization rate, and the function of filtering cache files according to the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity.
[0201] Optionally, in this embodiment of the application, the caching system can provide an interface for managing the cache space. This interface can be used to access different cache management algorithms. The cache management algorithms can be used to manage memory cache and flash cache. This application does not limit the cache management strategies for memory cache and flash cache.
[0202] In some embodiments, the caching system of the aforementioned electronic device can simultaneously use the LFU policy and the file size-based management policy as the file management policy for the flash cache. The aforementioned embodiments regarding the LFU policy and the embodiments regarding the file size-based management policy can also be related as and , that is, the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity can include: the number of file operation hits of the cache file in memory and the size of the cache file. The method provided in this application embodiment can simultaneously adjust the number of file operation hits of the cache file in memory and the size of the cache file in the conditions for storing cache files in the flash cache of a hybrid SSD with dynamic SLC capacity, and the adjustment method is as described in the aforementioned embodiments.
[0203] It should be noted that the above embodiments all use a hybrid SSD with dynamic SLC capacity as an example to illustrate the storage method provided in this application. In other possible embodiments, the storage method provided in this application can also be applied to other storage devices that can use a mixture of high-speed and low-speed media, such as storage devices whose storage space may include multi-layer cell areas, dynamic SLC areas, and static SLC areas. This application does not limit the specific type of storage device.
[0204] Optionally, the aforementioned Figure 7 The illustrated embodiments can be implemented as a standalone embodiment, or together with... Figure 3 The embodiments shown are implemented as a whole and are not intended to be limiting.
[0205] It should be understood that the above embodiments are merely illustrative examples of the storage methods provided in this application. In other possible implementations, some execution steps may be omitted or added to the above embodiments, or the order of some steps in the above embodiments may be adjusted, and this application does not impose any limitations on these aspects.
[0206] Corresponding to the storage method described in the foregoing embodiments, this application provides a storage device that can be applied to the aforementioned electronic device to implement the storage method described in the foregoing embodiments. The function of this device can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the steps of the aforementioned storage method. For example, Figure 8 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application. Figure 8 As shown, the device may include an acquisition unit 801, a processing unit 802, etc. The acquisition unit 801 and the processing unit 802 can cooperate to implement the storage method as described in the foregoing embodiments.
[0207] For example, the acquisition unit 801 can be used to acquire the overall space utilization rate of the storage device; the storage device includes multi-level cell regions, dynamic single-level cell regions, and static single-level cell regions; the overall space utilization rate is determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device. The processing unit 802 can be used to adjust the size of the maximum available cache space of the storage device based on the overall space utilization rate; the maximum available cache space is the maximum storage space allowed to be occupied by cached data when storing cached data in the storage device.
[0208] When the overall space utilization rate is the first overall space utilization rate, the size of the dynamic single-layer unit area is the fourth capacity, and the adjusted maximum available cache space size is the first value; when the overall space utilization rate is the second overall space utilization rate, the size of the dynamic single-layer unit area is the fifth capacity, and the adjusted maximum available cache space size is the second value; the second overall space utilization rate is greater than the first overall space utilization rate, the fifth capacity is less than the fourth capacity, and the second value is less than the first value.
[0209] In one possible implementation, when the overall space utilization rate is less than or equal to a first threshold, the size of the maximum available cache space is equal to the first capacity, which is less than or equal to the maximum single-level cell capacity of the storage device and greater than the capacity of the static single-level cell area of the storage device; the maximum single-level cell capacity is the sum of the capacities of the dynamic single-level cell area and the static single-level cell area when the dynamic single-level cell area of the storage device is at its maximum.
[0210] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the maximum available cache space decreases as the overall space utilization rate increases; the second threshold is greater than the first threshold.
[0211] When the overall space utilization rate is greater than or equal to the second threshold, the maximum available cache space is equal to the second capacity, and the second capacity is less than or equal to the third capacity. The third capacity is the capacity of the static single-level cell area of the storage device, or the capacity of the remaining available storage space of the storage device, or the smaller of the capacity of the static single-level cell area of the storage device and the capacity of the remaining available storage space. The remaining available storage space of the storage device refers to the space remaining after deducting the space occupied by regular data. Regular data includes data generated by local users of the electronic device where the storage device is located.
[0212] In one possible example, the first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0213] In another possible example, the first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0214] In one possible implementation, the processing unit 802 is specifically used to adjust the size of the maximum available cache space of the storage device according to the overall space utilization rate when the overall space utilization rate is greater than a first threshold and less than a second threshold, and when the overall space utilization rate changes to a third threshold.
[0215] In one possible implementation, the processing unit 802 is further configured to: receive a file request from a first application, the file request being for a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the memory cache space nor the storage device cache space has the first file cached, obtain the first file from the server and cache it in the memory cache space; when the memory cache space is full, remove the second file from the memory cache space; cache the second file in the storage device cache space; the storage space occupied by the cached data stored in the storage device cache space does not exceed the maximum available cache space.
[0216] Optionally, the processing unit 802 is further configured to: when the first file is cached in the memory cache space, read the first file from the memory cache space and return it to the first application; when the first file is cached in the storage device cache space, read the first file from the storage device cache space and return it to the first application.
[0217] Optionally, the processing unit 802 is also used to dynamically adjust the conditions for storing cached files in the storage device based on the overall space utilization rate.
[0218] When the overall space utilization rate is the third overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0219] In one possible implementation, when the overall space utilization is less than or equal to a first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the first hit, and / or the size of the cached file is less than or equal to the first byte.
[0220] When the overall space utilization rate is greater than the first threshold and less than the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the second number, and / or the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second number is greater than the first number, and the second byte is less than the first byte.
[0221] When the overall space utilization rate is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits in the memory of the electronic device where the cached file is located is greater than or equal to the third hit, and / or the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
[0222] Optionally, the second number increases with the increase of the overall space utilization, and / or the second byte decreases with the increase of the overall space utilization.
[0223] In one possible implementation, the processing unit 802 is further configured to: receive a file request from a first application, the file request being for a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the cache space of the memory nor the cache space of the storage device has cached the first file, obtain the first file from the server and cache it in the cache space of the memory; when the cache space of the memory is full, remove the second file from the cache space of the memory; when the second file meets the adjusted conditions, cache the second file in the cache space of the storage device.
[0224] Similarly, the acquisition unit 801 and the processing unit 802 can work together to implement the functions corresponding to all the steps of the storage method described in the foregoing embodiments, which will not be described in detail here.
[0225] Corresponding to the storage method described in the foregoing embodiments, this application also provides a storage device. Figure 9 Another schematic diagram of the storage device provided in an embodiment of this application. For example... Figure 9 As shown, the device may include: an acquisition unit 901, a processing unit 902, etc.
[0226] The acquisition unit 901 can be used to acquire the overall space utilization rate of the storage device; the storage device includes operating in a multi-layer cell region, a dynamic single-layer cell region, and a static single-layer cell region; the overall space utilization rate is determined based on the size of the storage space of the storage device and the size of the area used in the storage space of the storage device.
[0227] The processing unit 902 can be used to dynamically adjust the conditions for storing cached files in the storage device based on the overall space utilization rate.
[0228] When the overall space utilization rate is the third overall space utilization rate, the size of the dynamic single-level cell area is the fourth capacity. The adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the size of the dynamic single-level cell area is the fifth capacity. The adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth capacity is less than the fourth capacity, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
[0229] In one possible implementation, when the overall space utilization is less than or equal to a first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the first hit, and / or, the size of the cached file is less than or equal to the first byte. When the overall space utilization is greater than the first threshold and less than a second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the second hit, and / or, the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second hit is greater than the first hit, and the second byte is less than the first byte. When the overall space utilization is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device resides is greater than or equal to the third hit, and / or, the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
[0230] In one possible example, the first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0231] In another possible example, the first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-level cell capacity of the storage device; the second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-level cell capacity of the storage device.
[0232] Optionally, the second number increases with the increase of the overall space utilization, and / or the second byte decreases with the increase of the overall space utilization.
[0233] In one possible implementation, the processing unit 902 is further configured to: receive a file request from a first application, the file request being for a first file; the first application being an application in the memory of an electronic device where the storage device resides; when neither the cache space of the memory nor the cache space of the storage device has cached the first file, obtain the first file from the server and cache it in the cache space of the memory; when the cache space of the memory is full, remove the second file from the cache space of the memory; when the second file meets the adjusted conditions, cache the second file in the cache space of the storage device.
[0234] Optionally, the processing unit 902 is further configured to: when the first file is cached in the memory cache space, read the first file from the memory cache space and return it to the first application; when the first file is cached in the storage device cache space, read the first file from the storage device cache space and return it to the first application.
[0235] It should be understood that the division of modules (or units) in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, all units in the device can be implemented entirely in software through processing element calls; all units can be implemented entirely in hardware; or some units can be implemented in software through processing element calls, while others can be implemented in hardware.
[0236] For example, each unit can be a separate processing element, or it can be integrated into a chip within the device. Alternatively, it can be stored as a program in memory, invoked and executed by a processing element within the device. Furthermore, these units can be integrated in whole or in part, or implemented independently. The processing element described here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each of the above units can be implemented through integrated logic circuits in the processor element or through software invoked by the processing element.
[0237] In one example, the unit in the above device may be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.
[0238] For example, when the units in the device can be implemented through a processing element scheduler, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor capable of calling programs. Alternatively, these units can be integrated together to form a system-on-a-chip (SOC).
[0239] In one implementation, the units that implement the corresponding steps of the above methods can be implemented in the form of a processing element scheduler. For example, the device may include a processing element and a storage element, wherein the processing element calls a program stored in the storage element to execute the storage method described in the above method embodiments. The storage element may be a storage element located on the same chip as the processing element, i.e., an on-chip storage element.
[0240] In another implementation, the program used to execute the above method can be located on a storage element on a different chip than the processing element, i.e., an off-chip storage element. In this case, the processing element calls or loads the program from the off-chip storage element onto the on-chip storage element to call and execute the storage method described in the above method embodiments.
[0241] This application also provides an electronic device. The electronic device can be the one described above. The electronic device includes: a processor; and a memory for storing processor-executable instructions; when the processor is configured to execute the instructions, the electronic device implements the storage method described in the foregoing embodiments. The memory can be located within or outside the electronic device. The processor may include one or more processors.
[0242] For example, the electronic device may be a terminal device, a server, or a virtual machine (VM). The terminal device may be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, etc. The embodiments of this application do not impose special limitations on the specific form of the electronic device.
[0243] In another implementation, the unit that implements the steps of the above method in the electronic device can be configured as one or more processing elements. These processing elements can be integrated circuits, such as one or more ASICs, one or more DSPs, one or more FPGAs, or combinations of these types of integrated circuits. These integrated circuits can be integrated together to form a chip.
[0244] For example, this application also provides a chip that can be applied to the aforementioned electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the processor receives and executes computer instructions from the memory of the electronic device through the interface circuits to implement the storage method as described in the foregoing embodiments.
[0245] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0246] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0247] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
[0248] Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product, such as a program. This software product is stored in a program product, such as a computer-readable storage medium, and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0249] For example, embodiments of this application also provide a computer-readable storage medium having computer program instructions stored thereon; when the computer program instructions are executed by an electronic device, the electronic device implements the storage method as described in the embodiments.
[0250] For example, embodiments of this application also provide a computer program product, including: computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in an electronic device, the processor in the electronic device implements the storage method as described in the foregoing embodiments.
[0251] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A storage method, characterized in that, The method includes: The overall space utilization rate of the storage device is obtained; the storage device includes operating in multi-layer cell regions, dynamic single-layer cell regions, and static single-layer cell regions; the overall space utilization rate is determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device. Based on the overall space utilization rate, the size of the maximum available cache space of the storage device is adjusted; the maximum available cache space is the maximum storage space allowed to be occupied by cached data when storing cached data in the storage device. When the overall space utilization rate is the first overall space utilization rate, the size of the dynamic single-layer unit area is the fourth capacity, and the adjusted maximum available cache space size is the first value; when the overall space utilization rate is the second overall space utilization rate, the size of the dynamic single-layer unit area is the fifth capacity, and the adjusted maximum available cache space size is the second value; the second overall space utilization rate is greater than the first overall space utilization rate, the fifth capacity is less than the fourth capacity, and the second value is less than the first value; When the overall space utilization rate is less than or equal to the first threshold, the size of the maximum available cache space is equal to the first capacity, the first capacity is less than or equal to the maximum single-layer cell capacity of the storage device, and greater than the capacity of the static single-layer cell area of the storage device; the maximum single-layer cell capacity is the sum of the capacities of the dynamic single-layer cell area and the static single-layer cell area when the dynamic single-layer cell area of the storage device is at its maximum. When the overall space utilization rate is greater than the first threshold and less than the second threshold, the size of the maximum available cache space decreases as the overall space utilization rate increases; the second threshold is greater than the first threshold. When the overall space utilization rate is greater than or equal to the second threshold, the size of the maximum available cache space is equal to the second capacity, and the second capacity is less than or equal to the third capacity; the third capacity is the capacity of the static single-level cell area of the storage device, or the capacity of the remaining available storage space of the storage device, or the smaller value between the capacity of the static single-level cell area of the storage device and the capacity of the remaining available storage space; the remaining available storage space of the storage device refers to the space remaining after deducting the space occupied by regular data from the storage space of the storage device, and the regular data includes the data generated by the local users of the electronic device where the storage device is located.
2. The method according to claim 1, characterized in that, The first threshold is equal to the maximum overall space utilization rate corresponding to the maximum single-layer cell capacity of the storage device; The second threshold is equal to the minimum overall space utilization rate corresponding to the minimum single-layer cell capacity of the storage device.
3. The method according to claim 1, characterized in that, The first threshold is less than or greater than the maximum overall space utilization rate corresponding to the maximum single-layer cell capacity of the storage device; The second threshold is less than or greater than the minimum overall space utilization rate corresponding to the minimum single-layer cell capacity of the storage device.
4. The method according to any one of claims 1-3, characterized in that, The step of adjusting the maximum available cache space of the storage device based on the overall space utilization includes: When the overall space utilization rate is greater than the first threshold and less than the second threshold, and when the overall space utilization rate changes to the third threshold, the size of the maximum available cache space of the storage device is adjusted according to the overall space utilization rate.
5. The method according to any one of claims 1-3, characterized in that, The method further includes: The system receives a file request from a first application, which requests a first file; the first application is an application in the memory of the electronic device where the storage device is located. When neither the cache space of the memory nor the cache space of the storage device has the first file cached, the first file is retrieved from the server and cached in the cache space of the memory. When the memory cache space is full, the second file is removed from the memory cache space; The second file is cached in the cache space of the storage device; the storage space occupied by the cached data stored in the cache space of the storage device does not exceed the maximum available cache space.
6. The method according to claim 5, characterized in that, The method further includes: When the first file is cached in the memory cache space, the first file is read from the memory cache space and returned to the first application; When the first file is cached in the cache space of the storage device, the first file is read from the cache space of the storage device and returned to the first application.
7. The method according to any one of claims 1-3, characterized in that, The method further includes: Based on the overall space utilization rate, the conditions for storing cached files in the storage device are dynamically adjusted; When the overall space utilization rate is the third overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the third value, and / or, the size of the cached file is less than or equal to the fourth value; when the overall space utilization rate is the fourth overall space utilization rate, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the fifth value, and / or, the size of the cached file is less than or equal to the sixth value; the fourth overall space utilization rate is greater than the third overall space utilization rate, the fifth value is greater than the third value, and the sixth value is less than the fourth value.
8. The method according to claim 7, characterized in that, When the overall space utilization rate is less than or equal to the first threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the first hit, and / or the size of the cached file is less than or equal to the first byte; When the overall space utilization rate is greater than the first threshold and less than the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the second hit, and / or the size of the cached file is less than or equal to the second byte; the second threshold is greater than the first threshold; the second hit is greater than the first hit, and the second byte is less than the first byte; When the overall space utilization rate is greater than or equal to the second threshold, the adjusted conditions include: the number of file operation hits of the cached file in the memory of the electronic device where the storage device is located is greater than or equal to the third hit, and / or the size of the cached file is less than or equal to the third byte; the third hit is greater than the second hit, and the third byte is less than the second byte.
9. The method according to claim 8, characterized in that, The second number increases as the overall space utilization rate increases, and / or the second byte decreases as the overall space utilization rate increases.
10. The method according to claim 7, characterized in that, The method further includes: The system receives a file request from a first application, which requests a first file; the first application is an application in the memory of the electronic device where the storage device is located. When neither the cache space of the memory nor the cache space of the storage device has the first file cached, the first file is retrieved from the server and cached in the cache space of the memory. When the memory cache space is full, the second file is removed from the memory cache space; When the second file meets the adjusted conditions, the second file is cached in the cache space of the storage device.
11. A storage device, characterized in that, The device includes: An acquisition unit is used to acquire the overall space utilization rate of a storage device; the storage device includes operating in a multi-layer cell region, a dynamic single-layer cell region, and a static single-layer cell region; the overall space utilization rate is determined based on the size of the storage space of the storage device and the size of the used area within the storage space of the storage device. The processing unit is configured to adjust the size of the maximum available cache space of the storage device based on the overall space utilization rate; the maximum available cache space is the maximum storage space allowed to be occupied by cached data when storing cached data in the storage device. When the overall space utilization rate is the first overall space utilization rate, the size of the dynamic single-layer unit area is the fourth capacity, and the adjusted maximum available cache space size is the first value; when the overall space utilization rate is the second overall space utilization rate, the size of the dynamic single-layer unit area is the fifth capacity, and the adjusted maximum available cache space size is the second value; the second overall space utilization rate is greater than the first overall space utilization rate, the fifth capacity is less than the fourth capacity, and the second value is less than the first value; When the overall space utilization rate is less than or equal to the first threshold, the size of the maximum available cache space is equal to the first capacity, the first capacity is less than or equal to the maximum single-layer cell capacity of the storage device, and greater than the capacity of the static single-layer cell area of the storage device; the maximum single-layer cell capacity is the sum of the capacities of the dynamic single-layer cell area and the static single-layer cell area when the dynamic single-layer cell area of the storage device is at its maximum. When the overall space utilization rate is greater than the first threshold and less than the second threshold, the size of the maximum available cache space decreases as the overall space utilization rate increases; the second threshold is greater than the first threshold. When the overall space utilization rate is greater than or equal to the second threshold, the size of the maximum available cache space is equal to the second capacity, and the second capacity is less than or equal to the third capacity; the third capacity is the capacity of the static single-level cell area of the storage device, or the capacity of the remaining available storage space of the storage device, or the smaller value between the capacity of the static single-level cell area of the storage device and the capacity of the remaining available storage space; the remaining available storage space of the storage device refers to the space remaining after deducting the space occupied by regular data from the storage space of the storage device, and the regular data includes the data generated by the local users of the electronic device where the storage device is located.
12. An electronic device, characterized in that, include: A processor, and a memory for storing processor-executable instructions; When the processor is configured to execute the instructions, it causes the electronic device to implement the method as described in any one of claims 1-10.
13. A computer-readable storage medium having computer program instructions stored thereon; characterized in that, When the computer program instructions are executed by the electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-10.
14. A computer program product comprising computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, characterized in that, When the computer-readable code is run in an electronic device, the processor in the electronic device implements the method as described in any one of claims 1-10.