CN116360671A - Storage method, storage device, terminal and storage medium - Google Patents

Storage method, storage device, terminal and storage medium Download PDF

Info

Publication number
CN116360671A
CN116360671A CN202111611472.7A CN202111611472A CN116360671A CN 116360671 A CN116360671 A CN 116360671A CN 202111611472 A CN202111611472 A CN 202111611472A CN 116360671 A CN116360671 A CN 116360671A
Authority
CN
China
Prior art keywords
data
stored
storage
partition
storage partition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111611472.7A
Other languages
Chinese (zh)
Inventor
李星辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202111611472.7A priority Critical patent/CN116360671A/en
Publication of CN116360671A publication Critical patent/CN116360671A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0615Address space extension
    • G06F12/063Address space extension for I/O modules, e.g. memory mapped I/O
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The present disclosure relates to a storage method, a device, a terminal and a storage medium, wherein a flash memory unit of the terminal includes a first storage partition and a second storage partition, the first storage partition is a mapping area of a host performance enhancer, and the storage method includes: acquiring data to be stored; and if the residual storage capacity of the first storage partition is larger than or equal to the set capacity and the data type of the data to be stored is the set type, storing the data to be stored into the first storage partition. In the method, the host performance enhancer is only used for storing the data of the set type into the first storage partition, so that the read-write hit rate of the data of the set type can be improved, the read-write performance of the data of the set type is improved, and in addition, the mapping area of the host performance enhancer is the first storage partition, so that the memory occupation of the L2P table corresponding to the host performance enhancer can be reduced, and the memory of the memory unit is released.

Description

Storage method, storage device, terminal and storage medium
Technical Field
The disclosure relates to the technical field of terminals, and in particular relates to a storage method, a storage device, a terminal and a storage medium.
Background
The storage technology mainly stores data generated by an application program into a flash memory unit, and performs operations such as reading or sorting when needed.
In the terminal, the file address of the related operation is a logical address (LBA logic block address), and the storage address of the flash memory unit (for example, UFS unit, where UFS is collectively referred to as Universal Flash Storage and chinese name is general flash memory) operation is a physical address (PBA physical block address), and both of them need to be converted using a logical-to-physical mapping relationship table (L2P table, L2P refers to logical-to-physical). Because of the physical condition limitation of the terminal, the L2P table needs to be continuously loaded from the UFS unit, and the operation of loading the L2P table in the UFS unit affects the random read-write performance.
Disclosure of Invention
In order to overcome the problems in the related art, the present disclosure provides a storage method, apparatus, terminal, and storage medium.
According to a first aspect of an embodiment of the present disclosure, there is provided a storage method applied to a terminal, a flash memory unit of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapping area of a host performance enhancer, the method including:
acquiring data to be stored;
and if the residual storage capacity of the first storage partition is larger than or equal to the set capacity and the data type of the data to be stored is the set type, storing the data to be stored into the first storage partition.
Optionally, the determining that the data type to which the data to be stored belongs is a set type includes:
and if the data quantity of the data to be stored is smaller than or equal to a set value, determining that the data type of the data to be stored is the set type.
Optionally, the method comprises:
and if the residual capacity of the first storage partition is larger than or equal to the set capacity and the data to be stored is not of the set type, storing the data to be stored into the second storage partition.
Optionally, the method comprises:
and if the residual capacity of the first storage partition is smaller than the set capacity, storing the data to be stored into the second storage partition.
Optionally, the method comprises:
and under a setting scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the setting capacity and the data type of the stored data in the second storage partition is determined to be the setting type, the stored data is transferred to the first storage partition.
Optionally, the method comprises:
and according to the fragmentation degree of the first memory partition, performing fragmentation finishing on the first memory partition.
According to a second aspect of embodiments of the present disclosure, there is provided a storage device applied to a terminal, a flash memory unit of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapped area of a host performance enhancer, the device including:
the acquisition module is used for acquiring data to be stored;
and the storage module is used for storing the data to be stored into the first storage partition if the residual storage capacity of the first storage partition is larger than or equal to the set capacity and the data type of the data to be stored is determined to be the set type.
Optionally, the apparatus comprises:
and the determining module is used for determining that the data type of the data to be stored is the set type if the data quantity of the data to be stored is smaller than or equal to the set value.
Optionally, the storage module is configured to:
and if the residual capacity of the first storage partition is larger than or equal to the set capacity and the data to be stored is not of the set type, storing the data to be stored into the second storage partition.
Optionally, the storage module is configured to:
and if the residual capacity of the first storage partition is smaller than the set capacity, storing the data to be stored into the second storage partition.
Optionally, the storage module is configured to:
and under a setting scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the setting capacity and the data type of the stored data in the second storage partition is determined to be the setting type, the stored data is transferred to the first storage partition.
Optionally, the apparatus comprises:
and the defragmentation and arrangement module is used for defragmentation and arrangement of the first memory partition according to the defragmentation degree of the first memory partition.
According to a third aspect of embodiments of the present disclosure, there is provided a terminal comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the method according to the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium, which when executed by a processor of a terminal, causes the terminal to perform the method according to the first aspect.
The technical scheme provided by the embodiment of the disclosure can comprise the following beneficial effects: in the method, when the residual capacity of the first storage partition is greater than or equal to the set capacity and the data type to which the data to be stored belongs is the set type, the data to be stored is stored in the first storage partition, that is, the HPB is only used for storing the data of the set type into the first storage partition, the first storage partition is only used for storing the file of the set type, and the HBP is only used for performing read-write operation on the first storage partition, so that the read-write hit rate of the HPB on the data of the set type can be improved, the read-write performance of the data of the set type can be improved, and in addition, because the mapping area of the HPB is the first storage partition, the address in the L2P table corresponding to the HPB only comprises the address of the first storage partition, the memory occupation of the L2P table can be reduced, and the memory of the memory unit can be released.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow chart illustrating a method of storage according to an exemplary embodiment.
FIG. 2 is a flow chart illustrating a method of storage according to an exemplary embodiment.
FIG. 3 is a block diagram of a memory device, according to an example embodiment.
Fig. 4 is a block diagram of a terminal shown according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
In the related art, HPB (collectively Host performance boost, chinese name, host performance enhancer) is used to improve read-write performance. However, HPB requires storing L2P tables in memory cells (e.g., DDR, DRAM), which may occupy memory of the memory cells, and the mapping range of HPB is limited.
In the actual use process, since the HPB needs to map more storage areas of the UFS unit, the L2P table stored in the memory unit needs to cover as much storage areas of the UFS unit as possible, which causes the L2P table to occupy more memory of the memory unit. In addition, because the mapping range of the HPB is limited, the HPB cannot map all storage areas of the UFS unit, and it is difficult to ensure that the area where the data is read and written each time belongs to the mapping area of the HPB, so that the hit ratio of the read and write is poor, the read and write performance is still poor, and the phenomenon is more obvious during random read and write.
The present disclosure provides a storage method, applied to a terminal, where a flash memory unit of the terminal includes a first storage partition and a second storage partition, where the first storage partition is a mapping area of a host performance enhancer (HPB), in this method, when a remaining capacity of the first storage partition is greater than or equal to a set capacity and a data type to which data to be stored belongs is a set type, the data to be stored is stored to the first storage partition, that is, the HPB is only used to store the set type of data to the first storage partition, the first storage partition is only used to store a set type of file, and the HBP is only used to perform a read-write operation with respect to the first storage partition, so that a read-write hit rate of the HPB on the set type of data can be improved, and a read-write performance on the set type of data can be improved.
In one exemplary embodiment, a storage method is provided for a terminal, a flash memory unit of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapped region of a host performance enhancer (HPB). The flash memory unit may include a Universal Flash Storage (UFS) unit, a Solid State Disk (SSD), and the like, which are not limited herein. In general, when the terminal is a mobile phone, the flash memory unit is a UFS unit. When the terminal is a computer, the flash memory unit is SSD.
Referring to fig. 1, the method includes:
s110, acquiring data to be stored;
and S120, if the residual capacity of the first storage partition is larger than or equal to the set capacity and the data type of the data to be stored is the set type, storing the data to be stored into the first storage partition.
In step S110, the data to be stored refers to data to be stored, and the data to be stored may be a file to be stored. The data to be stored may be data generated by an application program, or may be other data, which is not limited herein.
For example, in the process of using the application program by the user, the application program can generate corresponding use data, the use data can be transmitted to the processor of the terminal, the processor can acquire the use data, and the use data can be recorded as data to be stored. The usage data may be files downloaded by the user through the application.
In step S120, the following two determinations need to be made:
judging 1, judging whether the residual capacity of the first storage partition is larger than or equal to the set capacity;
and 2, judging whether the data type of the data to be stored is a set type or not.
The above-described determination 1 and determination 2 may be performed simultaneously, or may be performed sequentially or in reverse order, and are not limited thereto.
In the judgment 1, the set capacity can be set before the terminal leaves the factory or after the terminal leaves the factory, and after the set capacity is set, the set capacity can be modified to better meet the requirements of users. The specific value of the set capacity is determined according to the actual situation and is not limited herein.
In example 1, the total capacity of the first storage partition is a, and the set capacity may be 10% of the total capacity of the first storage partition, that is, 10% a.
In the determination 2, the data to be stored may be a file to be stored, and the data type to which the data to be stored belongs, that is, the data type to which the file to be stored belongs. Wherein the data type to which the data to be stored belongs can be determined according to the data amount of the data. For example, the data to be stored whose data amount is smaller than or equal to the set value may be determined as the set type of data. That is, if it is determined that the data amount of the data to be stored is less than or equal to the set value, it is determined that the data type to which the data to be stored belongs is the set type.
The set value can be set before the terminal leaves the factory or after the terminal leaves the factory, and can be modified after the set value is set so as to better meet the requirements of users. The specific value of the set value is determined according to the actual situation, and is not limited herein. For example, the setting value may be determined according to the size of one read-ahead of the page cache. The page cache is also called as pcache, wherein the text name is page cache memory, and is called page cache for short. The size of one read-ahead of the page cache is one page, typically 4K. When the linux reads and writes the file, the linux is used for caching the logic content of the file, so that the access to images and data on a disk is quickened.
In example 2, the setting value may be set to the size of four pre-reads of the page cache, that is, the setting value may be set to 4*4 =16k. If the data quantity of the data to be stored is less than or equal to 16K, the data type of the data to be stored is considered to be a set type, namely the type of the data to be stored is considered to be a small file type, and the data to be stored is considered to be a small file. Other types of data to be stored may be considered large files.
When the set type is the small file type, the first storage partition is only used for storing the small file, the total capacity of the first storage partition can be smaller than that of the second storage partition, so that the flash memory unit can be ensured to be provided with enough first storage partitions to store the small file, the memory of an excessive memory unit can be prevented from being occupied by an HPB function, the first storage partition can be ensured to be completely covered by the HPB function, the hit rate of the small file is improved, and the read-write performance of the small file is improved.
It should be noted that the second storage partition may not only store data other than the set type, but may also be used to store data of the set type when the first storage partition is no longer able to store data of the set type.
Example 3 in the case of the use of the heat treatment agent,
the total capacity of the partition storing user data (userdata) in the UFS unit is b, and the partition storing user data can be divided into a first storage partition and a second storage partition. Wherein the first memory partition may be denoted as userdata sf, and its total capacity may be 10% b; the second memory partition may be denoted userdata bf, which may have a total capacity of 90% b. In this example, the first storage partition is used only to store data of the set type and the second storage partition is used to store data of all types (including the set type and other types).
In this example, the set capacity may be 10% of the overall capacity of the first storage partition, i.e., the set capacity is 1%b. The set value is 16K.
In this example, if it is determined that the remaining capacity of the first storage partition is greater than or equal to 1%b and it is determined that the data amount of the data to be stored is less than or equal to 16K, the data to be stored may be stored to the first storage partition by the HPB function, that is, by the L2P table in the memory unit.
The processor (CPU) of the terminal may obtain, according to the L2P table, a Physical address corresponding to the logical address of the data to be stored, where the processor sends an instruction including the Physical address to the UFS unit, and the UFS unit may access, based on the received instruction, the data corresponding to the Physical address (i.e., the data to be stored) to store the data to be stored to the Physical address in the first storage partition.
In this example, if any of the following is determined, the L2P table may be loaded in the UFS unit, and the data to be stored is stored in the second storage partition through the L2P table loaded by the UFS unit:
case 1, determining that the remaining capacity of the first storage partition is less than 1%b, and determining that the data amount of the data to be stored is less than or equal to 16K;
case 2, determining that the remaining capacity of the first storage partition is greater than or equal to 1%b, and determining that the data amount of the data to be stored is greater than 16K;
in case 3, it is determined that the remaining capacity of the first memory partition is smaller than 1%b, and it is determined that the data amount of the data to be stored is larger than 16K. ,
it should be noted that, besides the type to which the data to be stored belongs, the type to which the data to be stored belongs may be distinguished by other means, and the set type may be a small file type or another type, which is not limited herein. For example, the setting type may be a text type, thereby improving the read-write performance of data of the text type.
The method can improve the read-write hit rate of the data of the set type and improve the read-write performance of the data of the set type, and in addition, as the mapping area of the HPB is the first storage partition, the memory occupation of the L2P table corresponding to the HPB can be reduced, so that the memory of the memory unit is released.
In addition, as the system generates certain fragments aiming at the reading and writing of the data, the UFS unit needs to be subjected to the defragmentation, the prior strategy is to carry out the full disk defragmentation of the UFS unit at a proper time, and the management logics of different types of data are different. For example, unlike the management logic of small files and large files, the reading and writing of small files are more frequent, and the defragmentation frequency of small files is higher than that of large files, so that the first storage partition is only used for storing small files, and the defragmentation efficiency can be improved.
In one exemplary embodiment, a storage method is provided for a terminal, a flash memory unit of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapped region of a host performance enhancer (HPB).
Referring to fig. 2, the method may include:
s210, judging whether the residual capacity of the first storage partition is larger than or equal to the set capacity; if the remaining capacity of the first storage partition is greater than or equal to the set capacity, executing step S220; if the remaining capacity of the first storage partition is smaller than the set capacity, step S240 is performed.
S220, judging whether the data type of the data to be stored is a set type or not; if the data type to which the data to be stored belongs is the set type, executing step S240; if the data type to which the data to be stored belongs is not the set type, step S240 is performed.
S230, storing the data to be stored into the first storage partition.
S240, storing the data to be stored in the second storage partition.
In the method, the residual capacity of the first storage partition is firstly judged, and if the residual capacity of the first storage partition is smaller than the set capacity, the data to be stored can be directly stored in the second storage partition. If the residual capacity of the first storage partition is greater than or equal to the set capacity, determining whether the data type of the data to be stored is the set type. And if the data type of the data to be stored is not the set type, storing the data to be stored into the second storage partition. And if the data type of the data to be stored is the set type, storing the data to be stored into the first storage partition.
Example 1 in the case of the use of the heat-sensitive material,
the total capacity of the partition storing user data (userdata) in the UFS unit is b, and the partition storing user data can be divided into a first storage partition and a second storage partition. Wherein the first memory partition may be denoted as userdata sf, and its total capacity may be 10% b; the second memory partition may be denoted userdata bf, which may have a total capacity of 90% b. The set capacity may be 10% of the total capacity of the first storage partition, i.e., the set capacity is 1%b. The data to be stored is a file to be stored. The setting type is a doclet type.
In this example, it is first determined whether the remaining capacity of the first storage partition is sufficient. If the remaining capacity of the first storage partition is determined to be less than 1%b, it is indicated that the remaining capacity of the first storage partition is insufficient, and the L2P table may be loaded in the UFS unit, and the file to be stored may be stored in the second storage partition through the L2P table loaded by the UFS unit.
If the residual capacity of the first storage partition is determined to be greater than or equal to 1%b, further judging whether the file to be stored belongs to a small file type.
If the data type of the file to be stored is determined not to be the small file type (i.e. the file to be stored is a small file), the L2P table can be loaded in the UFS unit, and the file to be stored is stored in the second storage partition through the L2P table loaded by the UFS unit.
If the data type of the file to be stored is determined to be a small file type (i.e., the file to be stored is a small file), the file to be stored can be stored to the first storage partition through the HPB function, that is, the file to be stored is stored to the first storage partition through the L2P table in the memory unit.
In this example, when an application program needs to read or modify an already stored file, the corresponding partition may be taken as an operation target according to original information stored in the file. When the small file is operated, the operation of the system is random reading and writing, at this time, the L2P table of the file is stored in a memory unit (such as DRAM) of the mobile phone due to the existence of the HPB function, and the UFS unit does not need to reload the L2P table, so that the reading and writing performance of the small file can be improved. When the operation of the large file is carried out, the operation of the system is sequential reading and writing, and the storage mode and the operation type of the system are completely consistent with those of the traditional method, so that the system does not have negative influence.
In the method, when the residual capacity of the first storage partition is insufficient, the type of the data to be stored is not required to be judged, the data to be stored can be directly stored into the second storage partition, and the data storage efficiency is further improved.
In one exemplary embodiment, a storage method is provided for a terminal, a flash memory unit (e.g., UFS unit) of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapped region of a host performance enhancer (HPB).
The method may include:
and S310, under a set scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the set capacity and the data type of the stored data in the second storage partition is determined to be the set type, the stored data is transferred to the first storage partition.
The setting scene can be set before the terminal leaves the factory or after the terminal leaves the factory, and in addition, after the setting of the setting scene is finished, the setting scene is modified so as to better meet the requirements of users. The setting scene can be determined according to practical situations, and is not limited herein.
The setting scenario may be that the terminal is in an idle charging scenario, that is, the user does not use the terminal, and the terminal is in a charging state. The setting scenario may also be that the terminal is in a night standby scenario, i.e. the user is not using the terminal for a setting period of time, which may be 20:00 a day to 6:00 a day. Of course, the setting scene may be other scenes according to the actual requirement, and is not limited herein.
In this step, in the setting scenario, the following two determinations are required:
judging 1, judging whether the residual capacity of the first storage partition is larger than or equal to the set capacity;
and judging 2, judging whether the data type of the stored data in the second storage partition is a set type or not.
The above-described determination 1 and determination 2 may be performed simultaneously, or may be performed sequentially or in reverse order, and are not limited thereto.
In decision 2, the stored data refers to the stored data in the second storage partition, which may be a stored file.
The data stored in the second storage partition can be scanned, and whether the data type of the scanned stored data belongs to a set type or not can be judged one by one. The specific method for determining whether the data type of the stored data is a set type may refer to determining whether the data type of the data to be stored is a set type, which is not described herein.
In the method, under a set scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the set capacity and the data type of the stored data in the scanned second storage partition is determined to be the set type, the stored data can be transferred to the first storage partition, and a new storage address of an application corresponding to the stored data can be notified, so that the application can read the stored data from the first storage partition directly based on an HPB function, and the read-write performance of the stored data is improved.
In this method, after each time the stored data is transferred to the first storage partition, it is required to re-determine whether the remaining capacity of the first storage partition is greater than or equal to the set capacity, so as to better ensure that the first storage partition has enough remaining capacity to store the new set type of data.
According to the method, the stored data of the set type in the second storage partition can be transferred to the first storage partition in time, so that the read-write performance of the data of the set type is better improved, and the use experience of a user is further improved.
In one exemplary embodiment, a storage method is provided for a terminal, a flash memory unit (e.g., UFS unit) of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapped region of a host performance enhancer (HPB).
The method may include:
s410, according to the fragmentation degree of the first memory partition, performing fragmentation arrangement on the first memory partition. .
The system is characterized in that a certain fragment is generated during reading and writing of the system, the UFS unit is required to be subjected to defragmentation arrangement, the prior strategy is to carry out full-disk arrangement of the UFS unit at a proper time, and a large number of I/O (input/output) operations are easy to generate in full-disk arrangement, so that the system is blocked. In addition, the management logic of different types of data is different. For example, the management logic of the small file is different from that of the large file, the frequency of the small file to be defragmented is higher than that of the large file, and the small file cannot be subjected to targeted defragmentation by the traditional method.
If the fragmentation degree of the first storage partition is determined to be serious, the first storage partition can be subjected to fragmentation arrangement, so that targeted fragmentation management on the first storage partition can be realized, the efficiency of the fragmentation management can be improved, and furthermore, as the first storage partition can be subjected to independent fragmentation arrangement in time, the read-write performance of the first storage partition can be improved, namely, the read-write performance of data of a set type can be improved, and the use experience of a user can be further improved.
Wherein, the fragmentation degree can be determined according to the using time of the user using the terminal. For example, if the usage time period is greater than or equal to the first set time period (for example, 4×24 h), the first memory partition may be defragmented once by determining that the defragmentation degree of the first memory partition is serious.
The fragmentation degree can also be determined according to the interval duration after the last time of the fragmentation. For example, if the time interval from the last defragmentation of the first memory partition is greater than or equal to the second set time interval (e.g., 7 days), determining that the defragmentation degree of the first memory partition is serious, defragmenting the first memory partition again. If the time interval from the time when the user uses the terminal is greater than or equal to the second set time length, it is determined that the fragmentation degree of the first storage partition is serious, and the first time of defragmentation can be performed on the first storage partition.
The fragmentation degree may also be determined according to the amount of data written to the first memory partition. For example, if the data amount written into the first memory partition is greater than or equal to the set data amount (e.g., 20% of the total capacity of the first memory partition) after the first memory partition is defragmented last time, it is determined that the defragmentation degree of the first memory partition is serious, and the first memory partition may be defragmented once. If the data size written into the first memory partition after the user starts to use the terminal is greater than or equal to the set data size, it is determined that the first memory partition has serious fragmentation degree, and the first memory partition can be subjected to one-time defragmentation.
It should be noted that, in addition to the above manner, whether the fragmentation degree of the first memory partition is serious may be determined by other manners, which is not limited herein. In the method, targeted fragmentation management of the first storage partition can be realized, the efficiency of the fragmentation management can be improved, and the read-write performance of the first storage partition can be improved as the first storage partition can be subjected to independent fragmentation arrangement in time, namely, the read-write performance of set data (such as small files) can be improved, and the use experience of a user is further improved.
In one exemplary embodiment, a storage device is provided for use in a terminal, a flash memory unit (e.g., UFS unit) of the terminal including a first storage partition and a second storage partition, the first storage partition being a mapped region of a host performance enhancer. The apparatus is used for implementing the above storage method, and referring to fig. 3, the apparatus may include an acquisition module 101 and a storage module 102, where the apparatus performs the above method:
an acquisition module 101, configured to acquire data to be stored;
the storage module 102 is configured to store the data to be stored in the first storage partition if it is determined that the remaining storage capacity of the first storage partition is greater than or equal to the set capacity and it is determined that the data type to which the data to be stored belongs is the set type.
In one exemplary embodiment, a memory device is provided for use in a terminal, a flash memory unit of the terminal including a first memory partition and a second memory partition, the first memory partition being a mapped region of a host performance enhancer. Referring to fig. 3, the apparatus includes:
and the determining module 103 is configured to determine that the data type to which the data to be stored belongs is a set type if it is determined that the data amount of the data to be stored is less than or equal to the set value.
In one exemplary embodiment, a memory device is provided for use in a terminal, a flash memory unit of the terminal including a first memory partition and a second memory partition, the first memory partition being a mapped region of a host performance enhancer. Referring to fig. 3, in the apparatus, a storage module 102 is configured to:
and if the residual capacity of the first storage partition is larger than or equal to the set capacity and the data to be stored is not of the set type, storing the data to be stored into the second storage partition.
In one exemplary embodiment, a memory device is provided for use in a terminal, a flash memory unit of the terminal including a first memory partition and a second memory partition, the first memory partition being a mapped region of a host performance enhancer. Referring to fig. 3, in the apparatus, a storage module 102 is configured to:
and if the residual capacity of the first storage partition is smaller than the set capacity, storing the data to be stored into the second storage partition.
In one exemplary embodiment, a memory device is provided for use in a terminal, a flash memory unit of the terminal including a first memory partition and a second memory partition, the first memory partition being a mapped region of a host performance enhancer. Referring to fig. 3, in the apparatus, a storage module 102 is configured to:
under a set scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the set capacity, and the data type of the stored data in the second storage partition is determined to be the set type, the stored data is transferred to the first storage partition.
In one exemplary embodiment, a memory device is provided for use in a terminal, a flash memory unit of the terminal including a first memory partition and a second memory partition, the first memory partition being a mapped region of a host performance enhancer. Referring to fig. 3, the apparatus includes:
the defragmentation module 104 is configured to defragment the first memory partition according to the defragmentation degree of the first memory partition.
In one exemplary embodiment, a terminal is provided, such as a cell phone, a notebook computer, a tablet computer, a wearable device, and the like.
Referring to fig. 4, the terminal 400 may include one or more of the following components: a processing component 402, a memory 404, a power supply component 406, a multimedia component 408, an audio component 410, an input/output (I/O) interface 412, a sensor component 414, and a communication component 416.
The processing component 402 generally controls overall operation of the terminal 400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
The memory 404 is configured to store various types of data to support operations at the terminal 400. Examples of such data include instructions for any application or method operating on the terminal 400, contact data, phonebook data, messages, pictures, videos, and the like. The memory 404 may be implemented by any type of volatile or non-volatile memory terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 406 provides power to the various components of the terminal 400. The power supply components 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the terminal 400.
The multimedia component 408 includes a screen between the terminal 400 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or sliding action, but also the duration and pressure associated with the touch or sliding operation. In some embodiments, the multimedia component 408 includes a front camera module and/or a rear camera module. When the terminal 400 is in an operation mode, such as a photographing mode or a video mode, the front camera module and/or the rear camera module may receive external multimedia data. Each of the front camera module and the rear camera module may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 includes a Microphone (MIC) configured to receive external audio signals when the terminal 400 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 404 or transmitted via the communication component 416. In some embodiments, audio component 410 further includes a speaker for outputting audio signals.
The I/O interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 414 includes one or more sensors for providing status assessment of various aspects of the terminal 400. For example, the sensor assembly 414 may detect the on/off state of the terminal 400, the relative positioning of the components, such as the display and keypad of the terminal 400, the sensor assembly 414 may also detect the change in position of the terminal 400 or one of the components of the terminal 400, the presence or absence of user contact with the terminal 400, the orientation or acceleration/deceleration of the terminal 400, and the temperature change of the terminal 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 416 is configured to facilitate communication between the terminal 400 and other terminals, either wired or wireless. The terminal 700 may access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In one exemplary embodiment, the communication component 416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 416 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the terminal 400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital signal processing terminals (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 404, including instructions executable by processor 420 of terminal 400 to perform the above-described method. For example, the non-transitory computer readable storage medium may be a ROM, random-access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage terminal, etc. The instructions in the storage medium, when executed by the processor of the terminal, enable the terminal to perform the method shown in the above embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (14)

1. A storage method applied to a terminal, wherein a flash memory unit of the terminal includes a first storage partition, the first storage partition being a mapping area of a host performance enhancer, the method comprising:
acquiring data to be stored;
and if the residual storage capacity of the first storage partition is larger than or equal to the set capacity and the data type of the data to be stored is the set type, storing the data to be stored into the first storage partition.
2. The method according to claim 1, wherein the determining that the data type to which the data to be stored belongs is a set type includes:
and if the data quantity of the data to be stored is smaller than or equal to a set value, determining that the data type of the data to be stored is the set type.
3. The method of claim 1, wherein the flash memory unit further comprises a second memory partition, the method comprising:
and if the residual capacity of the first storage partition is larger than or equal to the set capacity and the data to be stored is not of the set type, storing the data to be stored into the second storage partition.
4. The method according to claim 1, characterized in that the method comprises:
and if the residual capacity of the first storage partition is smaller than the set capacity, storing the data to be stored into the second storage partition.
5. The method according to any one of claims 1-4, wherein the method comprises:
and under a setting scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the setting capacity and the data type of the stored data in the second storage partition is determined to be the setting type, the stored data is transferred to the first storage partition.
6. The method according to any one of claims 1-4, wherein the method comprises:
and according to the fragmentation degree of the first memory partition, performing fragmentation finishing on the first memory partition.
7. A memory device for use in a terminal, wherein a flash memory unit of the terminal includes a first memory partition and a second memory partition, the first memory partition being a mapped region of a host performance enhancer, the device comprising:
the acquisition module is used for acquiring data to be stored;
and the storage module is used for storing the data to be stored into the first storage partition if the residual storage capacity of the first storage partition is larger than or equal to the set capacity and the data type of the data to be stored is determined to be the set type.
8. The apparatus of claim 7, wherein the apparatus comprises:
and the determining module is used for determining that the data type of the data to be stored is the set type if the data quantity of the data to be stored is smaller than or equal to the set value.
9. The apparatus of claim 7, wherein the memory module is configured to:
and if the residual capacity of the first storage partition is larger than or equal to the set capacity and the data to be stored is not of the set type, storing the data to be stored into the second storage partition.
10. The apparatus of claim 7, wherein the memory module is configured to:
and if the residual capacity of the first storage partition is smaller than the set capacity, storing the data to be stored into the second storage partition.
11. The apparatus according to any one of claims 7-10, wherein the memory module is configured to:
and under a setting scene, if the residual capacity of the first storage partition is determined to be greater than or equal to the setting capacity and the data type of the stored data in the second storage partition is determined to be the setting type, the stored data is transferred to the first storage partition.
12. The apparatus according to any one of claims 7-10, characterized in that the apparatus comprises:
and the defragmentation and arrangement module is used for defragmentation and arrangement of the first memory partition according to the defragmentation degree of the first memory partition.
13. A terminal, the terminal comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the method of any of claims 1-6.
14. A non-transitory computer readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of a terminal, enable the terminal to perform the method of any one of claims 1-6.
CN202111611472.7A 2021-12-27 2021-12-27 Storage method, storage device, terminal and storage medium Pending CN116360671A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111611472.7A CN116360671A (en) 2021-12-27 2021-12-27 Storage method, storage device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111611472.7A CN116360671A (en) 2021-12-27 2021-12-27 Storage method, storage device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN116360671A true CN116360671A (en) 2023-06-30

Family

ID=86935586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111611472.7A Pending CN116360671A (en) 2021-12-27 2021-12-27 Storage method, storage device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN116360671A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117668319A (en) * 2024-02-01 2024-03-08 荣耀终端有限公司 Data query method, electronic device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117668319A (en) * 2024-02-01 2024-03-08 荣耀终端有限公司 Data query method, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN107291626B (en) Data storage method and device
US10599336B2 (en) Method of displaying content and electronic device adapted to the same
CN111966410B (en) Start-up processing method and device, electronic equipment and storage medium
CN116107742A (en) Virtual memory management method and electronic equipment
CN111373728B (en) Control method and device for camera application
CN116360671A (en) Storage method, storage device, terminal and storage medium
CN107506496B (en) Defragmentation method, defragmentation device and computer-readable storage medium
CN112307229A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN117349246A (en) Disk sorting method, device and storage medium
CN115145735B (en) Memory allocation method and device and readable storage medium
WO2023108989A1 (en) Data access method and apparatus, and non-transient computer-readable storage medium
CN115687270A (en) Data storage sorting method and device, electronic equipment and storage medium
CN106528197B (en) Shooting method and device
CN106354657B (en) Register access method, device and system
CN114428589A (en) Data processing method and device, electronic equipment and storage medium
US10372333B2 (en) Electronic device and method for storing a file in a plurality of memories
CN114610656A (en) Data replacement method and device, electronic equipment and storage medium
CN114077461A (en) Application program running method, device, equipment and storage medium
CN110008135B (en) Information processing method and device and electronic equipment
CN112346617A (en) Information display method, information display device, terminal, and storage medium
CN107665173B (en) Voice storage method, voice reading method and device
CN110968523A (en) Memory defragmentation method and device
CN108132757B (en) Data storage method and device and electronic equipment
CN116560587B (en) Data management system and terminal equipment
CN111241097B (en) Method for processing object, device for processing object and storage medium

Legal Events

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