Storage system, file storage and reading method and terminal equipment

文档序号:1296042 发布日期:2020-08-07 浏览:4次 中文

阅读说明:本技术 一种存储系统、文件存储和读取方法及终端设备 (Storage system, file storage and reading method and terminal equipment ) 是由 高恩博 童娟娟 周喜渝 杜维 张智伟 易见 周未来 李家欣 于 2020-03-25 设计创作,主要内容包括:本申请提供了一种存储系统、文件存储和读取方法及终端设备,该方法可以应用于人工智能领域,终端设备可以是手机、平板、笔记本等。以包括UFS的存储系统为例,该存储系统通过配置UFS的不同的介质形态,例如配置UFS包括SLC和TLC介质形态的持久化存储空间,实现混合介质的多盘存储。并基于该存储系统,优先选取与应用运行速率相关的热点文件,存储到UFS的SLC存储区,并将映射的多盘的文件挂载在文件系统的同一目录下,可以在用户无感知的情况下实现文件在SLC存储区和TLC存储区的迁移,从而提高存储系统的性能;此外,配置该UFS具有多种介质形态的转换模式,平衡用户对性能和容量的需求,保证运行速率,提高用户体验。(Taking a storage system comprising UFS as an example, the storage system realizes multi-disk storage of mixed media by configuring different media forms of UFS, such as persistent storage space of the UFS comprising S L C and T L C media forms, preferentially selects hot files related to application running speed based on the storage system, stores the hot files in an S L C storage area of the UFS, and mounts the mapped files of the multiple disks in the same directory of the file system, so that migration of the files in the S L C storage area and the T L C storage area can be realized under the condition that a user does not sense the files, the performance of the storage system is improved, and in addition, the UFS is configured with a conversion mode of multiple media forms, so that the requirements of the user on the performance and the capacity are balanced, the running speed is ensured, and the user experience is improved.)

1. A storage method applied to an electronic device comprising a processor and a universal flash memory UFS, the method comprising:

configuring a data storage form of a first logic unit of the UFS as a first storage form, configuring a data storage form of a second logic unit as a second storage form, wherein the first logic unit and the second logic unit are mounted in a same directory of a file system, the first storage form and the second storage form are different, and the read-write performance of the second storage form is greater than that of the first storage form;

and responding to a creation request of a new file, determining first information, selecting the first logic unit or the second logic unit according to the first information, and creating the new file in the selected logic unit.

2. The method of claim 1, wherein the first information comprises file type information of the new file.

3. The method according to claim 1 or 2, wherein the first information includes information of a directory to which the new file belongs; or when the new file is used as a directory file, the first information comprises information of the directory file.

4. The method according to any one of claims 1 to 3, wherein the first information includes information of an application to which the new file belongs.

5. The method according to claim 4, wherein the information of the application to which the new file belongs comprises an application package name corresponding to the application to which the new file belongs.

6. The method according to any one of claims 1 to 5, further comprising:

migrating the file of the first logic unit to the second logic unit according to the access heat of the processor to the file of the file system; and/or migrating the file of the second logical unit to the first logical unit.

7. The method of claim 6,

migrating the file of the first logical unit to the second logical unit when the frequency of accessing the file of the first logical unit by the processor is greater than or equal to a first threshold; and/or

Migrating the file of the second logical unit to the first logical unit when the frequency of the processor accessing the file of the second logical unit is less than or equal to the first threshold value.

8. The method according to claim 6 or 7, characterized in that the method further comprises:

acquiring quantity information of application programs installed by a user;

migrating the file of the first logical unit to the second logical unit when the number of the applications installed by the user is less than a second threshold;

when the total number of the application programs installed by the user is larger than or equal to the second threshold, the application programs installed by the user are arranged in the order of the use frequency of the user from large to small, hot spot files of the first K application programs with the use frequency of the user from large to small are determined according to the capacity of the second logic unit, the hot spot files of the first K application programs are migrated to the second logic unit, and K is a positive integer.

9. The method of claim 8, wherein when hotspot files of the first K applications in the user-installed applications have been created in the second logical unit and the capacity of the second logical unit is greater than or equal to a third threshold, the method further comprises:

acquiring N applications except the first K applications in the application program installed by the user, traversing different files of the N applications, and determining M file sets, wherein each file set in the M file sets comprises at least one file of the N applications;

calculating M time gains corresponding to the M file sets respectively created to the second logic unit, wherein the time gains are relative time gains or absolute time gains;

determining M influence coefficients of the M file sets according to the M file sets and the corresponding M time gains;

and arranging the M influence coefficients according to a descending order, determining the first S influence coefficients from the M influence coefficients according to the capacity of the second logic unit and the sizes of the M file sets, and creating the S file sets corresponding to the S influence coefficients to the second logic unit.

10. The method according to any of claims 6 to 9, wherein the migration of the file of the first logical unit to the second logical unit and/or the migration of the file of the second logical unit to the first logical unit occurs at the following occasions:

the electronic equipment is in an idle state currently; and/or

Receiving a system optimization request of a user; and/or

The capacity of the second logic unit is greater than or equal to a fourth threshold.

11. The method according to any one of claims 1 to 10, further comprising:

and configuring a storage form conversion mode of the second logic unit.

12. The method according to claim 11, wherein the storage form conversion mode of the second logic unit comprises any one of:

the second logic unit is fixed to the second storage form; or

When the storage space of the second logic unit is smaller than a fifth threshold value, the second logic unit is unidirectionally converted from the second storage form to the first storage form; or

When the storage space of the second logic unit is smaller than the fifth threshold value, the second logic unit is converted from the second storage form to the first storage form, and when the storage space of the second logic unit is larger than or equal to the fifth threshold value, the second logic unit is converted from the first storage form to the second storage form.

13. The method according to any one of claims 1 to 12,

the first storage configuration comprises a tri-level cell T L C and the second storage configuration comprises a single-level cell S L C, or

The first storage form comprises a double-layer memory cell M L C, the second storage form comprises S L C, or

The first storage state comprises a four-level cell Q L C and the second storage state comprises S L C, or

The first storage form comprises T L C and the second storage form comprises M L C, or

The first storage form comprises Q L C and the second storage form comprises M L C, or

The first storage modality includes Q L C, and the second storage modality includes T L C.

14. The method of any of claims 1-13, wherein the configuring the UFS to comprise a first logic unit and a second logic unit comprises:

the processor sends a first instruction to a controller of the UFS, the first instruction including a start address and an end address of the UFS multiple logical units;

in response to the first instruction, the controller of the UFS determines the first logical unit and the second logical unit according to a start address and an end address of the multiple logical units of the UFS;

the processor sends a second instruction to the controller of the UFS, and in response to the second instruction, the controller of the UFS configures the data storage form of the first logic unit as the first storage form, and the data storage form of the second logic unit is the second storage form;

the first logic unit is mapped to a system normal disk, the second logic unit is mapped to a system fast disk, and files of the system normal disk and the system fast disk are mounted in the same directory of the file system.

15. An electronic device, comprising:

a configuration unit, configured to configure a data storage form of a first logic unit of the UFS as a first storage form, and a data storage form of a second logic unit as a second storage form, where the first logic unit and the second logic unit are mounted in a same directory of a file system, the first storage form and the second storage form are different, and a read-write performance of the second storage form is greater than a read-write performance of the first storage form;

and the processing unit is used for responding to a creation request of a new file, determining first information, selecting the first logic unit or the second logic unit according to the first information, and creating the new file in the selected logic unit.

16. The electronic device of claim 15, wherein the first information comprises file type information of the new file.

17. The electronic device according to claim 15 or 16, wherein the first information includes information of a directory to which the new file belongs; or when the new file is used as a directory file, the first information comprises information of the directory file.

18. The electronic device according to any one of claims 15 to 17, wherein the first information includes information of an application to which the new file belongs.

19. The electronic device according to claim 18, wherein the information of the application to which the new file belongs includes an application package name corresponding to the application to which the new file belongs.

20. The electronic device of any of claims 15-19, wherein the processing unit is further configured to:

migrating the file of the first logic unit to the second logic unit according to the access heat of the processor to the file of the file system; and/or migrating the file of the second logical unit to the first logical unit.

21. The electronic device of claim 20,

migrating the file of the first logical unit to the second logical unit when the frequency of accessing the file of the first logical unit by the processor is greater than or equal to a first threshold; and/or

Migrating the file of the second logical unit to the first logical unit when the frequency of the processor accessing the file of the second logical unit is less than or equal to the first threshold value.

22. The electronic device of claim 20 or 21, further comprising:

an acquisition unit configured to acquire information on the number of applications installed by a user;

and the processing unit is further configured to:

migrating the file of the first logical unit to the second logical unit when the number of the applications installed by the user is less than a second threshold;

when the total number of the application programs installed by the user is larger than or equal to the second threshold, the application programs installed by the user are arranged in the order of the use frequency of the user from large to small, hot spot files of the first K application programs with the use frequency of the user from large to small are determined according to the capacity of the second logic unit, the hot spot files of the first K application programs are migrated to the second logic unit, and K is a positive integer.

23. The electronic device according to claim 22, wherein when the hotspot files of the first K applications in the user-installed applications have been created in the second logic unit and the capacity of the second logic unit is greater than or equal to a third threshold, the obtaining unit is further configured to:

acquiring N applications except the first K applications in the application program installed by the user, traversing different files of the N applications, and determining M file sets, wherein each file set in the M file sets comprises at least one file of the N applications;

the processing unit is further configured to:

calculating M time gains corresponding to the M file sets respectively created to the second logic unit, wherein the time gains are relative time gains or absolute time gains;

determining M influence coefficients of the M file sets according to the M file sets and the corresponding M time gains;

and arranging the M influence coefficients according to a descending order, determining the first S influence coefficients from the M influence coefficients according to the capacity of the second logic unit and the sizes of the M file sets, and creating the S file sets corresponding to the S influence coefficients to the second logic unit.

24. The electronic device according to any one of claims 20 to 23, wherein the migration of the file of the first logical unit to the second logical unit and/or the migration of the file of the second logical unit to the first logical unit occur at the following timing:

the electronic equipment is in an idle state currently; and/or

Receiving a system optimization request of a user; and/or

The capacity of the second logic unit is greater than or equal to a fourth threshold.

25. The electronic device of any of claims 15-24, wherein the configuration unit is further configured to:

and configuring a storage form conversion mode of the second logic unit.

26. The electronic device of claim 25, wherein the storage modality conversion mode of the second logic unit comprises any one of:

the second logic unit is fixed to the second storage form; or

When the storage space of the second logic unit is smaller than a fifth threshold value, the second logic unit is unidirectionally converted from the second storage form to the first storage form; or

When the storage space of the second logic unit is smaller than the fifth threshold value, the second logic unit is converted from the second storage form to the first storage form, and when the storage space of the second logic unit is larger than or equal to the fifth threshold value, the second logic unit is converted from the first storage form to the second storage form.

27. The electronic device of any of claims 15-26,

the first storage configuration comprises a tri-level cell T L C and the second storage configuration comprises a single-level cell S L C, or

The first storage form comprises a double-layer memory cell M L C, the second storage form comprises S L C, or

The first storage state comprises a four-level cell Q L C and the second storage state comprises S L C, or

The first storage form comprises T L C and the second storage form comprises M L C, or

The first storage form comprises Q L C and the second storage form comprises M L C, or

The first storage modality includes Q L C, and the second storage modality includes T L C.

28. The electronic device according to any of claims 15 to 27, wherein the configuration unit is specifically configured to:

receiving a first instruction comprising a start address and an end address of the plurality of logical units of the UFS;

determining the first logic unit and the second logic unit according to the starting address and the ending address of the UFS logic units in response to the first instruction;

receiving a second instruction, and configuring the data storage form of the first logic unit as the first storage form and the data storage form of the second logic unit as the second storage form in response to the second instruction;

the first logic unit is mapped to a system normal disk, the second logic unit is mapped to a system fast disk, and files of the system normal disk and the system fast disk are mounted in the same directory of the file system.

29. An electronic device, characterized in that the electronic device comprises a processor for performing the method of any of claims 1 to 14, and a universal flash memory UFS.

30. A terminal device, comprising: one or more processors; a universal flash memory UFS, a memory; a plurality of application programs; and one or more programs, wherein the one or more programs are stored in the memory, which when executed by the processor, cause the terminal device to perform the method of any of claims 1-14.

31. A computer storage medium comprising computer instructions that, when executed on an electronic device, cause the electronic device to perform the method of any of claims 1-14.

32. A computer program product, which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 14.

Technical Field

The present application relates to the field of electronic technologies, and in particular, to a mixed media multi-disk storage system, a file storage method, a file reading method, and a terminal device.

Background

In the existing terminal equipment, a storage device is usually built in the existing terminal equipment so as to enlarge the storage space of the terminal equipment. Different media types of the storage device and corresponding different storage areas are configured, and the different storage areas are used for storing different data types, so that multi-disk storage of mixed media is realized in the operation process of the terminal equipment, and the storage performance of the terminal equipment is improved.

For example, a fixed terminal such as a Personal Computer (PC) is usually provided with a plurality of memory devices such as a Solid State Drive (SSD) or a mechanical disk drive (HDD), and the memory performance is improved by implementing multi-disk storage of a mixed medium through a performance difference between the memory devices.

In general, a mobile terminal such as a mobile phone has a single memory device such as a Universal Flash Storage (UFS) or an Embedded Multimedia Memory Card (EMMC) built therein. Since mobile terminals such as mobile phones are light, thin, small, and portable, and have a narrow structural space, only a single memory device is usually built in, and the single memory device is usually configured to have a storage form with a relatively large capacity. As the demand of users increases, more and more data needs to be stored, and if the storage space of the storage device meets the requirement, the performance cannot meet the use demand of the users.

Disclosure of Invention

The application provides a storage system, a file storage and reading method and a terminal device, which can realize multi-disk storage of mixed media and take capacity, performance and service life of the storage system into consideration.

In a first aspect, a storage method is provided, where the method is applied to an electronic device including a processor and a universal flash memory UFS, and the method includes: configuring a data storage form of a first logic unit of the UFS as a first storage form, configuring a data storage form of a second logic unit as a second storage form, wherein the first logic unit and the second logic unit are mounted in the same directory of a file system, the first storage form and the second storage form are different, and the read-write performance of the second storage form is greater than that of the first storage form; in response to a request for creating a new file, first information is determined, the first logical unit or the second logical unit is selected according to the first information, and the new file is created in the selected logical unit.

In other words, the second logic unit with the second storage configuration has higher read-write performance than the first logic unit with the first storage configuration, for example, the second logic unit with the S L C storage configuration and the first logic unit with the T L C storage configuration are arranged in the storage space of the UFS.

It should be understood that the S L C storage area (second logical unit) configured in the embodiment of the present application is a persistent storage area, the S L C storage area is a part of the terminal device body storage, which is equivalent to a part of the persistent storage area divided from the original regular storage area (T L C storage area), and the data stored in the S L C storage area is continuously retained after power is turned off.

The embodiment of the application can directly create the file into the S L C storage area by configuring the high-speed storage area in the S L C storage form and read the file from the S L C storage area, so that the situation that the file can only be created into a conventional storage area (T L C storage area) through a cache area (cache) to be persistently stored is avoided, and the performance and the service life of an S L C medium are far higher than those of a T L C medium, so that the storage system provided by the embodiment of the application can improve the performance of data reading and writing and can prolong the service life of the storage system.

Therefore, for files of one application, migration can be carried out between the S L C storage area and the T L C storage area, and on a user level, a user does not need to sense the migration process and does not influence the use of the user.

It should be understood that the new file herein may refer to various files obtained after the application installation package is decompressed, compiled, and the like.

The process of creating a new file by the system can correspond to different implementation processes. For example, the system may open the buffer through an open interface, perform different results depending on the parameters, create a file if there is no file, e.g., write the contents of the new file through a write interface, close the new file through a close interface.

In a possible implementation manner, in the process of creating a new file to a file system, when the new file needs to be created to a storage area (high-speed storage area) of S L C, the system may first call an open interface or a create interface to create the new file, obtain a descriptor fd of the new file, then call an ioctl interface to enter a parameter, specify that the content of the new file is to be landed to a flash disk mapped by the storage area of S L C, then call a write interface to write the content of the new file into a memory buffer area corresponding to the descriptor fd, call a close interface to close the descriptor fd of the new file, and finally, the kernel file system may swipe data in the memory back to the high-speed storage area of the disk at an appropriate time, so that the content of the new file realizes real landing.

In the process of creating a new file to a file system, when the new file needs to be created to a T L C storage area (a conventional storage area), the system may call an open interface or a create interface to create the new file, acquire the descriptor fd of the new file, call an ioctl interface incoming parameter to specify that the content of the new file is to be landed on a slow disk mapped by the T L C storage area, call a write interface to write the content of the new file into a memory buffer area corresponding to the descriptor fd, call a close interface to close the descriptor fd of the new file, and finally, the kernel file system may copy the data in the memory back to the conventional storage area of the disk at a proper time, so that the content of the new file is actually landed.

In the embodiment of the present application, the interface of the system call does not contain any information of the logic unit L U, and the interface of various applications for accessing the file does not need to be changed for the user level.

It should also be understood that, in the embodiment of the present application, for each file of an application, different files are distinguished according to different rules, and then different files are respectively created to the S L C storage area and the T L C storage area of the UFS, so as to meet requirements on performance and storage capacity in different scenarios.

Optionally, the request message for creating a new file may include machine-learned data or information of a preset data table, the host may obtain the machine-learned data or the information of the preset data table according to the received request message, and the machine-learned data or the information of the preset data table may list a plurality of hotspot applications or hotspot files of an application, so that the host may determine whether an application to be currently installed by a user is a hotspot application, or which files in the application are hotspot files. Alternatively, the host may also obtain the machine-learned data or the information of the preset data table in other possible manners, which is not limited in this embodiment of the application.

With reference to the first aspect, in certain implementations of the first aspect, the first information includes file type information of the new file.

Alternatively, the host may select to create the new file to the first logic unit or the second logic unit according to a request message for creating the new file, where the request message for creating the new file may further include information of a file type of the new file, and the host may combine the aforementioned machine-learned data or information of the preset data table, and the information of the file type of the new file.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, the first information includes information of a directory to which the new file belongs; or when the new file is a directory file, the first information includes information of the directory file.

It should be understood that the directory to which the new file belongs or the information that the new file is a directory file may also be included in the new file creation request message received by the host 30, which is not limited in this embodiment of the present application.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, the first information includes information of an application to which the new file belongs. With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, the information of the application to which the new file belongs includes an application package name corresponding to the application to which the new file belongs.

Alternatively, the storage unit for file creation is determined according to preset rules when the application is installed, for example, when the user downloads the application at an application store. For example, the application store indicates a directory to which the file of the application belongs, and when a new file to be created belongs to the hotspot file, the host creates the new file to the second logical unit when creating the new file.

In another possible implementation manner, the host may select the first logical unit or the second logical unit according to an application to which the new file belongs. For example, the application store indicates the scope of the hotspot application, and when a new file to be created belongs to a certain hotspot application, the host creates the new file to the second logical unit when creating the new file.

Alternatively, the host 30 may determine the file to be written into the high-speed storage area according to the packet name of the currently installed APP.

For example, in the embodiment of the present application, when a certain Application (APP) is installed or the APP is run, the frequency of reading various files of the APP by the processor is different, a frequency threshold may be set according to the sequence from high to low of the frequency of reading various files of the APP by the processor, a file with the frequency greater than or equal to the frequency threshold read by the processor is called a "hot file", the hot file is written into the S L C storage area, other files of the APP may be written into the T L C storage area, or according to the size of the remaining capacity of the S L C storage area, other files of the APP are also written into a file with a part of higher reading frequency according to the sequence from high to low of the reading frequency of the processor, so that the high performance of the high-speed storage area can be utilized to improve the rate of reading data, further improve the rate of running the APP, and improve user experience.

In addition, other related files of the APP are established to a T L C storage area, invalid occupation of the storage area of S L C by the files can be avoided, more space of the storage area of S L C is saved for other applications, the running speed of other applications is increased, and user experience is improved.

With reference to the first aspect and the foregoing implementations, in some implementations of the first aspect, the method further includes: migrating the file of the first logic unit to the second logic unit according to the access heat of the processor to the file of the file system; and/or migrating files of the second logical unit to the first logical unit.

It should be understood that, for the files already created in the S L C storage area and the T L C storage area, the frequency of reading the files in the two storage areas by the host changes for different application scenarios during the subsequent use of the mobile phone.

With reference to the first aspect and the foregoing implementations, in some implementations of the first aspect, when the frequency with which the processor accesses the file of the first logical unit is greater than or equal to a first threshold, migrating the file of the first logical unit to the second logical unit; and/or migrating the file of the second logical unit to the first logical unit when the frequency of accessing the file of the second logical unit by the processor is less than or equal to the first threshold value.

With reference to the first aspect and the foregoing implementations, in some implementations of the first aspect, the method further includes: acquiring quantity information of application programs installed by a user; when the number of the application programs installed by the user is smaller than a second threshold value, migrating the file of the first logic unit to the second logic unit; when the total number of the application programs installed by the user is larger than or equal to the second threshold, the application programs installed by the user are arranged in the order of the use frequency of the user from large to small, hot spot files of the first K application programs with the use frequency of the user from large to small are determined according to the capacity of the second logic unit, the hot spot files of the first K application programs are migrated to the second logic unit, and K is a positive integer.

The method can enable the user to obtain performance benefits of an S L C storage area as soon as possible, for the user with the large number of installed APPs, the installed APPs are large, at the moment, the hotspot files of the APPs with high use frequency can be directly created to the S L C storage area according to the use frequency of the user to the various APPs once, and the like.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, when the hotspot files of the first K applications in the applications installed by the user have been created in the second logical unit, and the capacity of the second logical unit is greater than or equal to a third threshold, the method further includes: acquiring N applications except the first K applications in an application program installed by a user, traversing different files of the N applications, and determining M file sets, wherein each file set in the M file sets comprises at least one file of the N applications; calculating M time gains corresponding to the M file sets respectively established to the second logic unit, wherein the time gains are relative time gains or absolute time gains; determining M influence coefficients of the M file sets according to the M file sets and the corresponding M time gains; the M influence coefficients are arranged in a descending order, the first S influence coefficients are determined from the M influence coefficients according to the capacity of the second logic unit and the size of the M file sets, and S file sets corresponding to the S influence coefficients are created to the second logic unit.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, migrating the file of the first logic unit to the second logic unit, and/or migrating the file of the second logic unit to the first logic unit occur at the following timing: the electronic equipment is in an idle state currently; and/or receiving a system optimization request of a user; and/or the capacity of the second logic unit is greater than or equal to a fourth threshold.

In one possible implementation, when the mobile phone is in an idle and unused scene, the host migrates the files created in the T L C storage area and the files created in the S L C storage area according to the daily usage habits of the user.

When the device is judged to be in the charging state or the screen of the device is turned off for a preset time, determining that the device is in an idle and unused period, determining the period as the proper time, and migrating the file created in the storage area of T L C and the file created in the storage area of S L C.

By the method, personalized dynamic adjustment is performed by combining the use habits of users, the region for storing the files is adjusted when the mobile phone is in idle states such as a charging state or a screen-off state, effective management of the space of the high-performance S L C storage region is realized, the file combination with the maximum write-in time and income in limited capacity is ensured, and the optimal gain improvement is obtained.

With reference to the first aspect and the foregoing implementations, in some implementations of the first aspect, the method further includes: and configuring a storage form conversion mode of the second logic unit.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, the second logic unit is fixed to the second storage form; or when the storage space of the second logic unit is smaller than a fifth threshold value, the second logic unit is unidirectionally converted into the first storage form from the second storage form; or when the storage space of the second logic unit is smaller than the fifth threshold, the second logic unit is converted from the second storage form to the first storage form, and when the storage space of the second logic unit is larger than or equal to the fifth threshold, the second logic unit is converted from the first storage form to the second storage form.

The embodiment of the application can also be configured by configuring a conversion mode of the storage form of the S L C storage area, for example, the S L C storage area can be configured to be a unidirectional return mode in which the S L C storage form is converted into the T L C storage form under a certain condition to meet the capacity requirement of a user on the storage system, or can be configured to be a non-return mode of the permanent S L C storage form to meet the read-write performance requirement of the user on the storage system, or can be configured to be a bidirectional return mode of the S L C storage form and the T L C storage form, and can be converted from the S L C storage form into the T7C storage form, and the T L C storage form can be further converted into the S L C storage form.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, the first storage form includes a triple-layer memory cell T L C, the second storage form includes a single-layer memory cell S L C, or the first storage form includes a double-layer memory cell M L0C, the second storage form includes S L1C, or the first storage form includes a quadruple-layer memory cell Q L C, the second storage form includes S L C, or the first storage form includes a T L C, the second storage form includes a M L C, or the first storage form includes a Q L C, the second storage form includes a M L C, or the first storage form includes a Q L C, and the second storage form includes a T L C.

It should be understood that the capacity of the single-layer memory cell S L C, the multi-level cell (M L C), the triple-layer memory cell T L C, and the quad-layer memory cell (Q L C) increases in sequence, but the performance and the lifetime decrease in sequence.

With reference to the first aspect and the foregoing implementation manners, in some implementation manners of the first aspect, the processor sends a first instruction to a controller of the UFS, where the first instruction includes a start address and an end address of the multiple logical units of the UFS; in response to the first instruction, the controller of the UFS determines the first logical unit and the second logical unit according to a start address and an end address of the UFS logical units; the processor sends a second instruction to the controller of the UFS, and in response to the second instruction, the controller of the UFS configures the data storage form of the first logic unit as the first storage form, and the data storage form of the second logic unit as the second storage form; the first logic unit is mapped to a system normal disk, the second logic unit is mapped to a system fast disk, and files of the system normal disk and the system fast disk are mounted in the same directory of the file system.

Specifically, the processor may send an instruction to the UFS, and the UFS controller completes the above-described processes of configuring the logic unit, creating a file, migrating a file, or converting the storage form according to the instruction, which is not described in detail in this embodiment of the present application.

The high-speed storage area and the conventional storage area mapped disk of the embodiment of the present application are mounted in the same directory of the file system, that is, the files of the high-speed storage area and the conventional storage area have the same directory. Therefore, the file of one application can be migrated between the high-speed storage area and the conventional storage area, and on a user level, a user does not need to sense the migration process and the use of the user is not influenced.

In a second aspect, an electronic device is provided, which includes: the configuration unit is used for configuring the data storage form of the first logic unit of the UFS to be a first storage form, the data storage form of the second logic unit to be a second storage form, the first logic unit and the second logic unit are mounted under the same directory of a file system, the first storage form and the second storage form are different, and the read-write performance of the second storage form is greater than that of the first storage form; and the processing unit is used for responding to a creation request of a new file, determining first information, selecting the first logic unit or the second logic unit according to the first information, and creating the new file in the selected logic unit.

With reference to the second aspect, in some implementations of the second aspect, the first information includes file type information of the new file.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the first information includes information of a directory to which the new file belongs; or when the new file is a directory file, the first information includes information of the directory file.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the first information includes information of an application to which the new file belongs.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the information of the application to which the new file belongs includes an application package name corresponding to the application to which the new file belongs.

With reference to the second aspect and the foregoing implementations, in some implementations of the second aspect, the processing unit is further configured to: migrating the file of the first logic unit to the second logic unit according to the access heat of the processor to the file of the file system; and/or migrating files of the second logical unit to the first logical unit.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, when the frequency of accessing the file of the first logical unit by the processor is greater than or equal to a first threshold value, the file of the first logical unit is migrated to the second logical unit; and/or migrating the file of the second logical unit to the first logical unit when the frequency of accessing the file of the second logical unit by the processor is less than or equal to the first threshold value.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the electronic device further includes: an acquisition unit configured to acquire information on the number of applications installed by a user; and, the processing unit is further configured to: when the number of the application programs installed by the user is smaller than a second threshold value, migrating the file of the first logic unit to the second logic unit; when the total number of the application programs installed by the user is larger than or equal to the second threshold, the application programs installed by the user are arranged in the order of the use frequency of the user from large to small, hot spot files of the first K application programs with the use frequency of the user from large to small are determined according to the capacity of the second logic unit, the hot spot files of the first K application programs are migrated to the second logic unit, and K is a positive integer.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, when the hotspot files of the first K applications in the applications installed by the user have been created in the second logic unit, and the capacity of the second logic unit is greater than or equal to a third threshold, the obtaining unit is further configured to: acquiring N applications except the first K applications in an application program installed by a user, traversing different files of the N applications, and determining M file sets, wherein each file set in the M file sets comprises at least one file of the N applications; the processing unit is further configured to: calculating M time gains corresponding to the M file sets respectively established to the second logic unit, wherein the time gains are relative time gains or absolute time gains; determining M influence coefficients of the M file sets according to the M file sets and the corresponding M time gains; the M influence coefficients are arranged in a descending order, the first S influence coefficients are determined from the M influence coefficients according to the capacity of the second logic unit and the size of the M file sets, and S file sets corresponding to the S influence coefficients are created to the second logic unit.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the migration of the file of the first logic unit to the second logic unit and/or the migration of the file of the second logic unit to the first logic unit by the processing unit occurs at the following timing: the electronic equipment is in an idle state currently; and/or receiving a system optimization request of a user; and/or the capacity of the second logic unit is greater than or equal to a fourth threshold.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the configuration unit is further configured to: configuring the storage form conversion mode of the second logic unit.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the storage form conversion mode of the second logic unit includes any one of: the second logic unit is fixed to the second storage form; or when the storage space of the second logic unit is smaller than a fifth threshold value, the second logic unit is unidirectionally converted into the first storage form from the second storage form; or when the storage space of the second logic unit is smaller than the fifth threshold, the second logic unit is converted from the second storage form to the first storage form, and when the storage space of the second logic unit is larger than or equal to the fifth threshold, the second logic unit is converted from the first storage form to the second storage form.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, the first storage form includes a triple-layer memory cell T L C, the second storage form includes a single-layer memory cell S L C, or the first storage form includes a double-layer memory cell M L0C, the second storage form includes S L1C, or the first storage form includes a quadruple-layer memory cell Q L C, the second storage form includes S L C, or the first storage form includes T L C, the second storage form includes M L C, or the first storage form includes Q L C, the second storage form includes M L C, or the first storage form includes Q L C, the second storage form includes T L C.

With reference to the second aspect and the foregoing implementation manners, in some implementation manners of the second aspect, a first instruction is received, where the first instruction includes a start address and an end address of the multiple logical units of the UFS; determining the first logic unit and the second logic unit according to the starting address and the ending address of the UFS logic units in response to the first instruction; receiving a second instruction, and configuring the data storage form of the first logic unit as the first storage form and the data storage form of the second logic unit as the second storage form in response to the second instruction; the first logic unit is mapped to a system normal disk, the second logic unit is mapped to a system fast disk, and files of the system normal disk and the system fast disk are mounted in the same directory of the file system.

In a third aspect, an electronic device is provided, which includes: one or more processors; a universal flash memory UFS; one or more memories; a plurality of application programs; and one or more programs, wherein the one or more programs are stored in the memory, which when executed by the processor, cause the electronic device to perform the method of any of the implementations of the first aspect and the first aspect.

In a fourth aspect, an apparatus is provided, which is included in an electronic device, and which has functionality to implement the above aspects and possible implementations of the above aspects. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules or units corresponding to the above-described functions. Such as a display module or unit, a detection module or unit, a processing module or unit, etc.

In a fifth aspect, a storage system includes: a universal flash memory UFS, a processor and an interface, which cooperate with each other such that the storage system performs the method as described above in any of the implementations of the first aspect and the first aspect.

In a sixth aspect, the present application provides an electronic device, comprising: a touch display screen, wherein the touch display screen comprises a touch sensitive surface and a display; a camera; one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, which when executed by the electronic device, cause the electronic device to perform any of the possible methods of any of the above aspects.

In a seventh aspect, the present application provides an electronic device comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors for storing computer program code comprising computer instructions which, when executed by the one or more processors, cause the electronic device to perform the method as described above in any one of the implementations of the first aspect and the first aspect.

In an eighth aspect, the present application provides a computer storage medium comprising computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as any one of the implementation manners of the first aspect and the first aspect.

In a ninth aspect, the present application provides a computer program product, which, when run on an electronic device, causes the electronic device to perform the method according to any of the implementations of the first aspect and the first aspect.

Drawings

Fig. 1 is a schematic structural diagram of an example of a storage system according to an embodiment of the present application.

Fig. 2 is a block diagram of a software configuration of a storage system according to an embodiment of the present application.

Fig. 3 is a schematic diagram of an example UFS configuration of a storage system.

Fig. 4 is a schematic diagram of an example UFS configuration according to an embodiment of the present application.

Fig. 5 is a schematic diagram illustrating an example of a storage mode conversion mode according to an embodiment of the present application.

Fig. 6 is a schematic diagram of an example of a data read/write process of the memory system according to the embodiment of the present application.

Fig. 7 is a schematic diagram of an example file creation process provided in an embodiment of the present application.

Fig. 8 is a schematic diagram of an example file system management module according to an embodiment of the present application.

Fig. 9 is a schematic diagram of a file creation process according to another embodiment of the present application.

Fig. 10 is a schematic diagram of a file migration process according to another embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two.

In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating 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.

Fig. 1 is a schematic structural diagram of an example of a memory system 100 according to an embodiment of the present disclosure. Illustratively, the memory system 100 may include a processor 10, a memory 20, and an interface 30.

Processor 10 may include one or more processing units, such as: the processor 10 may include an Application Processor (AP), a modem processor, a Graphics Processor (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors. The controller may be, among other things, a neural hub and a command center of the storage system 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.

The memory 20 is used to store instructions and data, and the memory 20 may include an internal memory provided in the processor 10 and an external memory, which may be connected to the processor 10. In some embodiments, the internal memory in the processor 10 may be a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 10. If the processor 10 needs to use the instruction or data again, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 10 and thus increases the efficiency of the system.

In the embodiment of the present application, the storage system 100 can implement the file storage and reading processes based on the UFS, and therefore, taking the storage system 100 with a single UFS as an example, a mixed-media multi-disk storage system is established based on the UFS. It should be understood that the memory 20 includes, but is not limited to UFS, and may be other types of memory, which is not limited by the embodiment of the present application.

It should also be understood that the memory system 100 may further include more memory devices or other types of memory devices, such as an EMMC, and the like, which is not limited in the embodiments of the present application.

The interface 30 may be one or more of a variety of interfaces, and may include internal interfaces or external interfaces for connecting the various modules of the storage system. Illustratively, the interface may include an integrated circuit (I2C) interface, an inter-integrated circuit built-in audio (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. It should be understood that the storage system 100 may also adopt different interface connection manners or a combination of a plurality of interface connection manners, and the type and connection manner of the interface are not limited in the embodiment of the present application.

It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the storage system 100. In other embodiments of the present application, storage system 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

The storage system 100 provided in the embodiment of the present application may be applied to a terminal device with an embedded UFS, where the terminal device may be a mobile phone, a tablet computer, a PC, a wearable device, an in-vehicle device, an Augmented Reality (AR)/Virtual Reality (VR) device, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), and other devices with an UFS.

It should be understood that the terminal device recited in the embodiment of the present application may include other more components besides the storage system 100 described above. For example, the terminal device may further include one or more of a charging management module, a power management module, a battery, an antenna, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, an earphone interface, a sensor module, a button, a motor, an indicator, a camera, a display screen, and a Subscriber Identity Module (SIM) card interface. Wherein, the sensor module may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like. The number and the type of the components included in the terminal equipment are not limited in any way in the embodiment of the application.

Fig. 2 is a block diagram of a software configuration of the storage system 100 according to the embodiment of the present application. It should be understood that fig. 2 may correspond to the storage system 100 architecture of fig. 1, dividing the storage system 100 into a device side and a host 30. Wherein the device side may correspond to a memory of the storage system 100, such as UFS 20; the host 30 may correspond to the processor 10 and a software architecture provided by the processor 10. The software architecture of the host 30 may adopt a layered architecture, and in the embodiment of the present application, the Android system of the layered architecture is taken as an example to exemplarily illustrate the software structure of the storage system 100.

The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom.

The application layer may include a series of application packages. As shown in fig. 2, the application packages may include camera, telephony, music, video, navigation, etc. applications.

The application framework layer provides an Application Programming Interface (API) and a programming framework for the application programs of the application layer. The application framework layer includes a number of predefined functions. As shown in FIG. 2, the application framework layer may include a window manager, a content provider, a resource manager, and the like.

Wherein, the window manager is used for managing the window program. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like. The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.

The Android runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system. The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android. The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.

The system library may include a plurality of functional modules. For example: media libraries (media libraries), image processing libraries, and the like. The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like. The image processing library is used for realizing graphic drawing, image rendering, synthesis, layer processing and the like.

The kernel layer is a layer between hardware and software. The kernel layer at least comprises a driving module, a file system management module and the like, and the driving module can comprise a display driver, a camera driver, a sensor driver and the like. The file management module is used for realizing the management of user data or files.

For convenience of understanding, the following embodiments of the present application will specifically describe a storage system provided in the embodiments of the present application, and a method for storing data and a method for reading data based on the storage system, by taking the storage system having the structure shown in fig. 1 and fig. 2 as an example, and assuming that the size of the UFS20 embedded in the storage system 100 is 256 Gigabytes (GB).

Fig. 3 is a schematic diagram of an UFS configuration of an example storage system, as shown in fig. 3, for an existing storage system including UFS20, UFS20 may be divided into a cache area (cache) and a normal storage area, where the cache area and the normal storage area have different data storage forms, where the cache area (cache) is generally encapsulated as a data storage form in a single-level cell (S L C) mode, and each storage unit encapsulated as an S L C storage form may store 1 bit (bit) of data, so the cache area may also be referred to as a "cache area" (cache).

The conventional storage area is generally encapsulated as a three-level cell (T L C) storage form, and each storage unit encapsulated as a T L C storage form can store 3 bits (bit) of data, so the conventional storage area may also be referred to as a "T L C storage area".

It should be understood that a 4GB cache is typically a cache area accompanying the UFS when shipped from the factory, in addition to 256GB persistent storage area, and therefore, the UFS may actually include 256GB storage area and 4GB cache area.

For storage devices and terminal devices, considering the capacity specification and performance of the storage system, as shown in fig. 3, an existing storage system including UFS is packaged to include a cache (cache region) and a regular storage region (T L C storage region), which can be understood as a mixed media storage form including a small number of S L C storage forms and T L C storage forms, to obtain a large storage space and improve the performance of the storage system, wherein the cache region packaged as the S L C storage form is small, e.g., 4GB, and is generally used only as a data cache (cache) and cannot achieve persistent storage of data, the storage region packaged as the T L C storage form is persistent-stored, e.g., 256GB, corresponding to the regular storage region (or referred to as "T L C storage region") shown in a shaded portion in fig. 3.

In the data writing process shown in the arrow direction of fig. 3, when the host 30 writes data into the UFS20, the data must be written into the cache for caching, and then written into the regular storage area (T L C storage area) by the cache for persistent storage.

It should be understood that the capacity of the cache (cache) is small, and when the cache is used to a certain extent, data can be squeezed out of the cache (cache), and if the squeezed data is read again, the data can still be acquired from the T L C storage area, only when the data is stored in the cache (cache), the data reading performance can be improved, if the data is acquired from the T L C storage area (conventional storage area), the reading and writing performance cannot be improved, in addition, when the data is written into the T L C storage area for the first time, the data reading process still reflects the conventional T L C performance, and the performance cannot be improved.

The application provides a storage system based on UFS and a storage method to realize the storage effect of mixed media and give consideration to the storage space and read-write performance of the storage system.

Fig. 4 is a schematic diagram of an example UFS configuration according to an embodiment of the present application. In the present application, taking the storage system 100 with 256GB UFS20 as an example, in the present application, the UFS20 is initially configured according to the method shown in fig. 4, and it should be understood that the initialization configuration process may be executed by the processor 10 or the host 30 of the storage system 100.

Alternatively, processor 10 or host 30 may send an instruction to UFS20, according to which the UFS controller performs the configuration process. The specific configuration process comprises the following steps:

the method comprises the following steps: configuring the number and size of logical units of the UFS20

Specifically, in the initialization process of UFS20, 256GB of UFS20 is first configured as (N + M) logical units (L U), where N is greater than or equal to 1, M is greater than or equal to 1, and N and M are integers, where N and M are used to distinguish between different storage modalities, e.g., (N + M) L U includes at least two different storage modalities.

In a possible implementation manner, a data storage form of a first logic unit of the UFS is configured to be a first storage form, a data storage form of a second logic unit is configured to be a second storage form, the first logic unit and the second logic unit are mounted in a same directory of a file system, the first storage form and the second storage form are different, and a read-write performance of the second storage form is greater than a read-write performance of the first storage form.

In the embodiment of the present application, it is described that (N + M) L U includes two different storage forms, where (N + M) L U includes N first logic units and M second logic units, the N first logic units are configured as the first storage form, the M second logic units are configured as the second storage form, and the first logic units and the second logic units are mounted in the same directory of the file system.

It should be understood that the embodiment of the present application does not limit the size of the storage space of each L U in (N + M).

In the following description of the embodiments, taking N as 4 and M as 1 as an example, 256GB of UFS20 is configured to include (4+1) L U, 4 first logic units are configured as a first storage form, and 1 second logic unit is configured as a second storage form, where the storage sizes of the 4 first logic units are respectively labeled L U0, L0U 1, L U2, and L U3, and the storage sizes of the 1 second logic units are labeled L U4, L U0, L U1, L U2, L U3, and L U4 may be the same or different, which is not limited in this application.

In one possible implementation manner, in the configuration of (4+1) L U in this embodiment of the application, L U0 and L0U 1 are configured as 4 megabytes (MByte, MB), L1U 2 is configured as 8MB, &lttttranslation = L "&tttl &ltt/t &tttgtt U3 is configured as 1008MB +225GB, that is, 4L U (L U0 to L U3) are configured to have a total storage space of 226GB, and 5L U (L U4) is configured to have a size of 30GB, respectively, where L U3 and L U4 are storage areas that can be used by a user.

Thus, through the configuration process described above, the 256GB logical unit domain of the UFS is configured to include 4 storage areas having the first storage form and 1 storage area having the second storage form.

Step two: storage form of logic unit configured with UFS20

In one possible implementation, the second logic unit is configured as a granular medium with higher read-write performance than the first logic unit. In other words, the second logic unit with the second storage form has higher read/write performance than the first logic unit with the first storage form.

Optionally, the first storage form comprises a triple-layer memory cell T L C, the second storage form comprises a single-layer memory cell S L C, or the first storage form comprises a double-layer memory cell M L0C, the second storage form comprises S L1C, or the first storage form comprises Q L C, and the second storage form comprises S L C, or the first storage form comprises T L C, and the second storage form comprises M L C, or the first storage form comprises Q L C, and the second storage form comprises M L C, or the first storage form comprises Q L C, and the second storage form comprises T L C.

It should be understood that the capacity of the single-layer memory cell S L C, the multi-level cell (M L C), the triple-layer memory cell T L C, and the quad-layer memory cell (Q L C) increases in sequence, but the performance and the lifetime decrease in sequence.

Illustratively, in the embodiment of the present application, as shown in fig. 4, 256GB UFS20 are configured as (4+1) L U with different sizes through step one, and then configured as L U storage form through step two, for example, front 4L 0U (L1U 0, L2U 1, L U2, and L U3) are configured as T L C storage form, and 5L U (L U4) is configured as S L C storage form, in other words, UFS20 is configured to include 4T L C storage areas and 1S L C storage area.

It should be appreciated that the capacity of the T L C storage area is three times that of the S L C storage area at the same media cost, and therefore, when the 30GB L U4 is configured in the S L C storage configuration, the actual storage space of the L U4 is 10GB, as shown in fig. 4, 30GB L U4 is embodied as a 10GB S L C storage area through step two.

It should be further understood that the S L C storage area configured in the embodiment of the present application is a persistent storage area, the S L C storage area is a part of fixed storage divided from an original conventional storage area (T L C storage area), and is a part of terminal device body storage, and data stored in the S L C storage area is continuously retained after power failure.

However, the S L C storage area can be applied to all user scenes of data reading and writing, for example, data can be directly written into the S L C storage area without writing into the T L C storage area through cache, the data writing process is simplified, the data reading and writing performance is improved, and the service life of the S L C storage area is far longer than that of the T L C storage area, so that the service life of a storage system can be prolonged.

For example, after detection, if the UFS is configured to include the storage region of the S L C storage modality and the storage region of the T L C storage modality, the reading performance of the UFS can be improved by 50% from the device level of the storage system or from the operating efficiency level of the kernel layer during reading data, and the overall user file reading performance can be improved by 20% -30% from the user usage level during the user usage of the application process.

Step three: storage form conversion mode for configuring logic unit of UFS20

Specifically, 4T L C storage areas included in the UFS20 are regular storage areas for persistent storage, and therefore L U0, L0U 1, L U2, and L U3 are fixedly configured as T L C storage forms, for 1S L C storage area, L U4 can be configured as a corresponding storage form conversion mode in the future use process according to different scenarios and requirements by configuring different storage forms, for example, the L U4 can implement conversion between S L C storage form and T L C storage form to meet different user requirements.

(1) Storage form conversion mode one

In one possible implementation, the storage form conversion mode of L U4 is configured as a one-way return mode, specifically, L U4 can be unidirectionally converted from the second storage form to the first storage form.

It should be understood that the "one-way return mode" herein may be understood as L U4 configured as the S L C storage form, and when a preset condition is satisfied, the L U4 may be converted from the S L C storage form to the T L C storage form.

Optionally, the preset condition may include at least one of that the data stored in the S L C storage area represented by L U4 is greater than or equal to a preset threshold (e.g., 10GB), that the remaining storage space of the S L C storage area represented by L0U 4 is less than a preset threshold, and that the lifetime of the S L C storage area represented by L U4 reaches a preset value, optionally, the lifetime of the S L C storage area may be counted by the number of times of program & erase (PE) of the S L C storage area, where the number of times of PE reaches 1000 times, and when at least one of the preset conditions is met, the S L C storage form of the S L U4 may be converted into the T L C storage form.

For example, fig. 5 is a schematic diagram of an example of a storage form conversion mode provided by an embodiment of the present application, and the one-way return mode may be as shown in (a) of fig. 5, L U4 may be converted from a 10GB S L C storage area to a 30GB T L C storage area when a preset condition is satisfied.

For example, when the data stored on L U4 exceeds 10GB, the storage space of L U4 cannot meet the current user requirement, L U4 is converted from the S L C storage form to the T L C storage form, that is, the storage space of 10GB is expanded to the storage space of 30GB, the current data storage pressure can be relieved, and the conversion process of the storage form does not affect the format and size of the original data stored in S L C.

In addition, the storage form conversion mode of L U4 is configured to be a one-way return mode, and on the user level, the available actual storage space of UFS20 is not lost and still is 256GB, thereby ensuring the use efficiency of the actual storage space of UFS without perception of the user.

It should also be appreciated that when L U4 is converted from the S L C storage form to the T L0C storage form, i.e., L1U 4 is converted from the S L2C storage region to the T L C storage region and permanently embodied as the T L C storage region, then L U0, L U1, L U2, L U3, and L U4 are all T L C storage regions.

(2) Storage form conversion mode two

In one possible implementation, the storage modality conversion mode of L U4 is configured as a no-return mode.

It should be understood that the "no-return mode" herein may be understood as L U4 being configured as the S L C storage modality and remaining permanently as the S L C storage modality.

Specifically, as shown in (b) of fig. 5, the storage form conversion mode corresponding to the S L C storage area during the use process may be configured to be a "no-return mode", that is, the S L C storage area cannot be converted from the S L C storage form to the T L C storage form, and the upper limit of the program-erase frequency of the S L C storage area is not set, that is, the service life of the S L C storage area is not set.

It is to be understood that in this conversion mode, the storage space and visible capacity size specification of the S L C storage area actually accessed by the user are both 10GB, and eventually the actual storage space of the UFS20 becomes 236 GB.

(3) Storage form conversion mode three

In one possible implementation, the storage modality conversion mode of L U4 is configured as a two-way return mode.

It should be understood that the "bidirectional return mode" herein may be understood that L U4 may be configured in any one of the S L C storage modality and the T L C storage modality, and that the S L C storage modality and the T L C storage modality may be switched with each other.

Specifically, as shown in (C) of fig. 5, the storage form conversion mode corresponding to the S L C storage area during use may be configured to be a "bidirectional return mode", that is, the L U4 may be converted from the S L C storage form to the T L C storage form, and the T L C storage form may be further converted to the S L C storage form.

Optionally, when the storage space of L U4 is less than a preset threshold, L U4 may be converted from the second storage form to the first storage form, and when the storage space of L U4 is greater than or equal to the preset threshold, L U4 may also be converted from the first storage form to the second storage form, which is not limited in this embodiment.

Optionally, when the program-erase frequency of L U4 is within a preset value (e.g., 1000 times), L U4 may be converted from the S L C storage form to the T L C storage form, or from the T L C storage form to the S L C storage form, according to the requirement of the user on the size specification of the capacity of the storage system.

It should be understood that L U4 is the S L C storage form when the capacity of the storage system is sufficient, and in the high performance mode, better read-write experience can be obtained, and L U4 is the T L C storage form when the capacity of the storage system is insufficient, and that in the high capacity mode, a larger storage space can be obtained.

Compared with the storage form conversion mode of a non-return mode, the method can enlarge the storage space under the condition of limited storage space, can avoid that when the storage capacity of L U4 reaches the peak value (for example, 10GB), the L U4 is converted into the T L C storage form from the S L C storage form, and the L U4 cannot return to the high-performance state of the S L C storage form, so that the performance of the storage system is improved.

It should be understood that, the above steps one to three are the initial configuration process that the UFS20 accepts the instruction from the processor 10 and is completed by the UFS controller at the UFS20, after the initial configuration of the UFS20 is completed, (4+1) L U configured by the UFS20 are mapped to the host 30 according to the instruction from the processor 10, forming a logical storage device on the host 30 side, which can be understood as different storage areas or storage spaces on the host 30 side, and the logical storage device on the host 30 side corresponds to L U of the UFS20 one-to-one.

Step four: mapping logical units of UFS20

Specifically, L U0, L U1, L U2, L U3, and L U4 configured by the UFS20 are mapped to the host 30, forming logical storage devices of the host 30, and correspond to independent storage areas on the host 30 side, respectively.

Illustratively, L U0 corresponds to storage area sda of the host 30, L U1 corresponds to storage area sdb of the host 30, L U2 corresponds to storage area sdc of the host 30, L U3 corresponds to storage area sdd of the host 30, L U4 corresponds to storage area sde of the host 30. the independent storage area corresponding to the host 30 side can be referred to as a "disk", e.g., L U0, L U1, L U2, L U3 of UFS20 is mapped to a normal disk of the host 30, L U4 is mapped to a high-speed disk of the host 30.

It should be understood that L U4 and L U3 of the embodiments of the present application map different disks, but for the file system of the device, the files of the L U4 mapped high-speed disk and L U3 mapped normal disk are mounted under the same directory of the file system.

During the operation of the storage system, the host 30 is in an operating state, when a file is written into the storage area sdd on the host 30 side, it means that the file is actually stored in L U3 of the UFS20, i.e., the file is stored in the normal storage area (T L C storage area) as shown in fig. 6. when a file is written into the storage area sde on the host 30 side, it means that the file is actually stored in L U4 of the UFS20, i.e., the file is ready to be stored in the high-speed storage area (S L C storage area) as shown in fig. 6.

In the embodiment of the present application, based on a storage system with a built-in UFS, through the process from the first step to the fourth step, the UFS is configured to include a plurality of storage areas with different storage forms, and the data read-write performance of the storage areas with different storage forms is different, so that the storage system has a hybrid storage medium, and meets the requirements of a user on the capacity and performance of the storage system.

Fig. 6 is a schematic diagram illustrating an example of a data read/write process of a storage system according to an embodiment of the present application, and as shown in fig. 6, a storage area configured by the UFS20 includes a normal storage area in the T L C storage form, a cache area (cache) in the S L C storage form, and a high-speed storage area in the S L C storage form.

It should be understood that the high-speed storage area (S L C storage area) of the S L C storage form can improve the read-write performance and the lifetime of the storage system, and the conventional storage area (T L C storage area) of the T L C storage form can ensure the capacity specification of the storage system, thereby balancing the requirements of users on the capacity and the performance of the storage system.

It should also be understood that the normal storage area and the high-speed storage area in fig. 6 may also be separate storage areas, and the storage forms of the normal storage area and the high-speed storage area may not be converted. In other words, the method for creating a file provided by the embodiment of the present application may also be used in a storage system including an independent normal storage area and an independent high-speed storage area, which is not limited by the embodiment of the present application.

As shown in fig. 6, the downward arrow may represent the process of the host 30 writing data into the UFS20, and the upward arrow represents the process of the host 30 reading data from the UFS20, specifically, during the data writing process, the host 30 may write data into a cache (cache), or write data into a normal storage area (T L C storage area) through the cache (cache), or may directly write data into a cache area (S L C storage area) of S L C storage form, wherein the normal storage area (T L C storage area) and the cache area (S L C storage area) may be used for persistent storage, and the cache area (cache) is used only for data caching with reference to the existing scheme.

During data reading, the host 30 may read data from a cache area (cache), or directly read data from a normal storage area (T L C storage area), or directly read data from a high-speed storage area (S L C storage area).

In summary, in the embodiment of the present application, by configuring the high-speed storage area in the S L C storage form, the host 30 can directly write data into the high-speed storage area (S L C storage area), and can read data from the high-speed storage area, so that it is avoided that data can only be written into a conventional storage area through a cache area (cache) for persistent storage.

In addition, the embodiment of the application can also configure a conversion mode of the storage form of the high-speed storage area (S L C storage area), for example, the high-speed storage area can be configured as a unidirectional return mode in which the storage form of S L C is converted into a T L0C storage form under certain conditions to meet the capacity requirement of a user on the storage system, or the high-speed storage area can be configured as a non-return mode of a permanent S L C storage form to meet the read-write performance requirement of the user on the storage system, or the high-speed storage area can be configured as a bidirectional return mode in which an S L C storage form and a T L C storage form, and can be converted from an S L C storage form into a T L C storage form and a T L C storage form can be further converted into an S L C storage form.

According to the storage system described above, during operation of the storage system, host 30 can write data to UFS 20. Fig. 7 is a schematic diagram of an example of a file creation process provided in an embodiment of the present application, where types of data to be written are different in different usage scenarios of a mobile phone. As shown in FIG. 7, method 700 determines that different data or files are written to the high-speed storage area for different application scenarios.

Scene one

The methods of steps 701-704 may be performed, for example, when a user installs an Application (APP) for a cell phone.

701, begin.

Host 30 receives a request to create a new file when installing an application scenario 702. ,

when a user installs an APP, a file of the APP needs to be created in a storage area of a storage system. Specifically, when an APP is installed, new files to be created include various types of binary files when the APP is installed, and the different binary files have different names and file types.

It should be understood that the new file herein may refer to various files obtained by decompressing, compiling, and the like, the application installation package downloaded at the application store.

Optionally, the request message for creating a new file may include machine-learned data or information of a preset data table, the host 30 may obtain the machine-learned data or the information of the preset data table according to the received request message, and the machine-learned data or the information of the preset data table may list a plurality of hotspot applications or hotspot files of an application, so that the host 30 may determine whether an application to be currently installed by a user is a hotspot application, or which files in the application are hotspot files.

The host 30 may further create different files into different storage areas, such as a cache area (cache) shown in fig. 6, or write data into a conventional storage area (T L C storage area) through the cache area (cache), or may directly write data into a high-speed storage area (S L C storage area) in an S L C storage form.

703, the host 30 responds to the request message for creating the new file, and selects the first logical unit or the second logical unit according to the request message.

Host 30 creates the new file in the selected logical unit 704.

In a possible implementation manner, the host 30 may select the first logical unit or the second logical unit according to a file type of the new file to be created.

Alternatively, the host 30 may select to create the new file to the first logic unit or the second logic unit according to a request message for creating the new file, which may further include information of a file type of the new file, and the host 30 may combine the aforementioned machine-learned data or information of the preset data table and the information of the file type of the new file.

For example, the file types commonly found in the mobile phone can be listed as shown in table 1 below, where table 1 lists some possible file formats and corresponding file types. For example, the application compression package file is preset in the request message as a hot file, and when the host 30 receives a file creation request, the apk file is created to the second logic unit, i.e., the high-speed storage area.

TABLE 1

File format File type
.apk Application compression package
.so Library file
.odex/.vdex Optimized compiled binary files
.db/.db-journal/.db-wal Database file
.xml Configuration information
.mp4 Video media files
.jpg/.png Picture mediaDocument
.m4a/.mp3/.flac Audio media files
.amr Audio files (call record, recording, etc.)
enc Encrypted file (personal data, chatting record, etc.)

In another possible implementation manner, the host 30 may select the first logical unit or the second logical unit according to a directory to which the new file to be created belongs or the new file as a directory file.

For example, a directory to which a file of the application belongs is indicated by the application store, and when a new file to be created belongs to the hot spot file, the host 30 creates the new file to the second logic unit when creating the new file (L U4).

It should be understood that the directory to which the new file belongs or the information that the new file is a directory file may be included in the new file creation request message received by the host 30, which is not limited in this embodiment of the present application.

Alternatively, host 30 may select either the first logical unit or the second logical unit based on the application to which the new file belongs, e.g., the scope of a hotspot application is indicated by an application store, and when a new file to be created belongs to a certain hotspot application, host 30 creates the new file to the second logical unit when creating the new file (L U4).

Alternatively, the host 30 may determine the file to be written into the high-speed storage area according to the packet name of the currently installed APP.

For example, the host 30 may determine to write the relevant data (binary file) of a specific type in a specific path of the APP with the packet name PKG into the high-speed storage area according to the packet name of the APP. For example, the APP-related data, having the package name PKG, may list one or more of the following:

(1) apk file;

(2) so file under/data/app/PKG/lib path;

(3) base.odex, base.vdex, base.art files under the/data/app/PKG/oat path;

(4) db file under/data/data/PKG, etc.

At the time of installing the APP, the host 30 does not know the situation of being used by the user after the APP is installed, that is, the frequency of reading various types of data of the APP after the APP is installed cannot be obtained, and in this situation, the data to be written into the high-speed storage area can be directly determined according to the above method and the packet name of the APP.

Optionally, the host 30 writes the file of the APP with the packet name PKG into the high-speed storage area, may write other files of the APP into the regular storage area, or partially write other files except for the specific type in the above specific path into the high-speed storage area according to the size of the remaining capacity of the high-speed storage area, which is not limited in this embodiment of the present application.

It should be understood that, because the performance and lifetime of the S L C storage medium of the high-speed storage area are higher than those of the conventional storage area, if the host 30 writes the APP file with the package name PKG into the high-speed storage area, the high performance of the high-speed storage area can be utilized to improve the speed of running the APP and improve the user experience.

For example, in the embodiment of the present application, when the APP is installed or run, the host 30 has different frequencies for reading various files of the APP. According to the sequence of the frequency of reading various files of the APP by the host 30 from high to low, a frequency threshold value can be set, and the files with the frequency greater than or equal to the frequency threshold value read by the host 30 are called hot spot files.

Optionally, for an APP widely used, through application start behavior analysis, before installation, the mobile phone may obtain common characteristics of a file path and a file type frequently accessed in a start process after installation of the APP, so as to determine that the host 30 reads a hot spot file with a high frequency, and create the hot spot file in a high-speed storage area. The method for determining the frequency of various files of the APP is not limited in the embodiment of the application.

Optionally, the host 30 writes the hot spot file into a high-speed storage area, and may write other files of the APP into a conventional storage area, or write other files of the APP into a file with a higher read frequency according to a sequence from high to low of the read frequency of the host according to the size of the remaining capacity of the high-speed storage area, which is not limited in this embodiment of the present application.

It should be understood that, because the performance and the life of the S L C storage medium of the high-speed storage area are both higher than those of the conventional storage area, if the host 30 creates the hot spot file into the high-speed storage area, the high performance of the high-speed storage area can be utilized to improve the speed of reading the file, thereby improving the speed of running the APP and improving the user experience.

In another possible implementation, host 30 may determine the files to be created to the high-speed storage area based on the number of APPs installed by the user.

The number of the APP installed in the mobile phone is different for different users. The users may be divided into different groups according to their number of installed APPs. For example, a user whose number of installed APPs is greater than or equal to 100 is marked as a heavy-use user; marking users with the number of installed APPs greater than or equal to 50 and less than 100 as moderate-use users; users with a number of installed APPs less than 50 are flagged as light use users.

It should be understood that "heavy," "medium," and "light" are a division based on the number of APPs installed by the user, and the division manner of the user is not limited in the embodiment of the present application.

It should also be understood that, in the embodiment of the present application, a manner of obtaining the APP installed by the user by the host is not limited. Alternatively, for example, when a user uses a mobile phone, the user account is registered on the side of a server provided by the manufacturer of the mobile phone, and 45 applications are installed. If the user changes the mobile phone, the account can be continuously logged in the new mobile phone, and the host can acquire the number of the account installation applications under the condition that the privacy of the user is ensured, so that the user is classified as a light-use user.

For light-use users or medium-use users, the number of installed APPs is small, for example, the number of installed APPs is less than or equal to 100. At this time, the capacity of the high-speed storage area (10GB) can accommodate the hot spot files of most of the 100 APPs, and the host can directly create the hot spot files of all the APPs into the high-speed storage area. The method can enable the user to obtain the performance benefit of the high-speed storage area as soon as possible, and the application does not need to wait for being migrated into the high-speed storage area after being used for a period of time.

For heavy users, the number of installed APPs is large, for example, the number of installed APPs is greater than 100. At this time, the capacity of the high-speed storage area (10GB) can only accommodate the hot files in part of the APP. At this time, according to the frequency of use of various APPs once by the user, the hot spot file of the APP with high frequency of use can be directly created into the high-speed storage area. The method can obtain the performance benefit of the high-speed storage area for the APP frequently used by the user, and improve the user experience.

Scene two

In the above scenario that the user installs the APP for the mobile phone, the host 30 may determine to create the file to the high-speed storage area according to different methods. For files which are created into a high-speed storage area and a conventional storage area, the frequency of reading the files of the two storage areas by a host can be changed according to different application scenes in the subsequent use process of the mobile phone.

For example, in the working period from 09:00 to 18:00 in the daytime, the use probability of the office APP installed by the mobile phone by the user is high, and the use probability of the social APP such as chat is low; and in the leisure time period from 18:00 to 23:00, the use probability of the office APP by the user is low, and the use probability of the social APP such as chat is high. If the files of office APP are permanently written into the high-speed storage area, and the files of social APP such as chat are permanently written into the conventional storage area, the user has high use experience on the office APP in the working period of 09:00 to 18:00 in the day; during leisure hours from 18:00 to 23:00, users have a poor use experience of social-type APPs. Or if the files of the office APP are permanently written into the conventional storage area, and the files of the social APP such as chat are permanently written into the high-speed storage area, the user has poor use experience on the office APP during the working period from 09:00 to 18:00 in the day; during the leisure time period from 18:00 to 23:00, the user has a higher use experience of the social APP.

Therefore, the embodiment of the application also provides a data adjustment scheme aiming at the high-speed storage area and the conventional storage area so as to meet different use requirements of users. Steps 705-707 of method 700 may be performed for a user daily usage scenario as follows.

Host 30 determines that a daily usage scenario is currently for the user 705.

At 706, the host 30 determines the file to be migrated to the high speed storage area.

707, the host 30 migrating the file of the first logical unit to the second logical unit; and/or migrating the file of the second logical unit to the file of the first logical unit.

First, the files in the high-speed storage area and the normal storage area are adjusted, and the normal use of the user cannot be influenced. Alternatively, the host 30 may select an appropriate timing to perform storage location adjustment of data stored in the normal storage area and data stored in the high-speed storage area.

In one possible implementation mode, when the mobile phone is in an idle and unused scene, the host computer migrates the file created in the conventional storage area to the high-speed storage area and/or migrates the file created in the high-speed storage area to the conventional storage area according to the daily use habit of the user.

For example, the host may determine a current usage state of the handset, such as whether the handset is in a charging state or a screen-off state. Further, when the mobile phone is in a charging state or the time length of the mobile phone screen being extinguished reaches the preset time length, the mobile phone is determined to be in an idle unused time period, the time period is determined to be the appropriate time, and the host computer migrates the file created in the conventional storage area to the high-speed storage area and/or migrates the file created in the high-speed storage area to the conventional storage area.

Alternatively, the host may reallocate the storage space of the high-speed storage area for each application according to the usage habit of the user on a plurality of APPs, and then adjust the files of the normal storage area and the files of the high-speed storage area.

In one possible implementation manner, in a certain time, according to the sequence that the use frequency (or the access times) of L installed applications by a user is arranged from large to small, K applications with the highest use frequency (or the access times) are selected from L applications, enough storage space is allocated in the high-speed storage area, and all hotspot files of the K applications are loaded into the high-speed storage area.

It should be understood that L is greater than or equal to K, and L and K are positive integers, where the number of L and K can be determined by the application heat of big data statistics, which is not described in detail in this application.

If the selected hotspot files of the K applications are stored in the conventional storage area, the hotspot files of the K applications can be adjusted from the conventional storage area to the high-speed storage area when the mobile phone is idle and unused.

Or, if the hotspot files of the selected K applications are all stored in the high-speed storage area and the capacity of the high-speed storage area is still sufficient, the hotspot files of the K applications can be continuously arranged according to the sequence of the use frequency (or the access times) of the applications from large to small, a certain number of applications can be selected from the remaining (L-K) applications, and the hotspot files of the K applications can be completely written into the high-speed storage area.

By the method, the hot point file of the application with high use frequency or multiple access times can be written into the high-speed storage area under the condition that the capacity of the high-speed storage area allows, so that high-performance experience brought by the high-speed storage area is guaranteed, the running speed of the application is improved, and the user experience is improved.

In another possible implementation, when the hotspot files of the selected K applications are all stored in the high-speed storage area, and the capacity of the high-speed storage area is still sufficient, for the remaining (L-K) applications, the remaining total space of the allocable high-speed storage area can be proportionally distributed to the remaining (L-K) applications according to the ratio of the usage frequency (or access times) of the applications.

Optionally, when the remaining total space of the high-speed storage area is proportionally distributed to the remaining (L-K) applications, the application hotspot files can be screened for the (L-K) applications according to the following strategy.

(1) Firstly, sample collection is carried out, and by selecting a large number of applications, the application starting time benefit after combination of files of different types is written into the fast storage area is traversed.

(2) And calculating the correlation coefficient of the files of different types and the application starting time gain as the influence coefficient corresponding to the file type.

Through the step (1) and the step (2), table 2 is obtained, and table 2 is a statistical table of file types and influence coefficients provided in the embodiment of the present application. As shown in table 2, for the file types including base.apk, base.odex, base.vdex, base.art, and. so files, respectively, as an example, the application time gain after the file of each file type is written into the fast storage area is calculated.

It should be appreciated that, taking the file types listed in Table 2 as an example, the application launch time gain may be characterized by a relative time gain or an absolute time gain. Wherein, the relative gain can be understood as: for application a, after the base.apk file of the application is written from the regular storage area to the high-speed storage area, when the user starts application a, time can be saved. For example, if the time saved after the base.apk file of the application is written from the regular storage area to the high-speed storage area is greater than the time saved after the base.apk file of the application is written from the regular storage area to the high-speed storage area, the time gain from adjusting the base.apk file to the high-speed storage area can be considered to be greater, i.e., the start-up of application a will be faster.

The absolute time gain can be understood as: for application a and application B, if the base.apk file is stored in the regular storage area, the time consumed when application a is started is 10 seconds (second, s), and the time consumed when application B is started is 30 s; when the base.apk file is written into the high-speed storage area from the conventional storage area, the starting time of the application A is shortened by 2s, and the starting time of the application B is also shortened by 2 s. At this time, even if the startup time of both application a and application B is shortened by 2s, the absolute time gain is 2/10 for application a and 2/30 for application B, and thus the absolute time gain of application a is greater than that of application B, and a greater time gain can be achieved by writing the base. The embodiment of the present application does not limit the manner of representing the time gain.

TABLE 2

File type Coefficient of influence
base.apk a
base.odex b
base.vdex c
base.art d
.so e

(3) And calculating to obtain a file combination decision table.

For example, for application a, from the results calculated in table 2, all combinations of types of files may be traversed, and the influence coefficient for each combination may be calculated. Table 3 is an example of a statistical table of influence coefficients of file combinations provided in the embodiments of the present application. For example, the file combination may include base.apk + base.odex, base.odex + base.vdex, base.apk + base.odex + base.vdex, and the like, and the total size of all files in the file combination is correspondingly calculated. Sorting according to the size of the file combination from small to large, that is, the size of the file combination in table 3 is: y1< Y2< Y3< … < Yk.

Meanwhile, the sum of the influence coefficients of all types of files in the corresponding calculation file combination is enveloped according to the principle that the influence coefficient X is gradually increased along with the increase of the size Y of the file combination, and the combinations which do not accord with the principle are excluded. Finally, the file combination decision table shown in table 3 is obtained, and the influence coefficient X of the file combination in table 3 increases with the increase of the size Y of the file combination.

TABLE 3

File type Coefficient of influence Size of file combination
base.apk+base.odex X1=a+b Y1
base.odex+base.vdex X2=b+c Y2
base.apk+base.odex+base.vdex X3=a+b+c Y3
base.apk+base.odex+…+… Xk Yk

(4) And selecting the corresponding file combination according to the capacity y of the high-speed storage area.

Specifically, if the available space of the high-speed storage area is limited and the capacity allocated to the application a is Y, a file combination having a size Y of less than or equal to Y and having the largest influence coefficient X, that is, the optimal file combination, can be selected from the table.

Illustratively, if Y3 is exactly equal to the available capacity Y of the high-speed storage area, X3> X2 and X3> X1, then base.apk + base.odex + base.vdex is the optimal file combination, and base.apk + base.odex + base.vdex of application a is written into the high-speed storage area from the normal storage area as a hotspot file, so as to ensure the high-performance experience brought by the high-speed storage area and obtain the maximum time gain.

Similarly, for a plurality of applications installed by a user, a high-speed storage area space can be allocated to each application according to the frequency of accessing each application by the user, a file combination decision table of the application is calculated for each application, an optimal file combination is obtained from the file combination decision table and is used as a hot file, and the optimal file combination is written into the high-speed storage area from a conventional storage area, so that high-performance experience brought by the high-speed storage area is guaranteed, and the maximum time gain is obtained for each application.

By the method, personalized dynamic adjustment is performed by combining the use habits of users, and the file storage area is adjusted when the mobile phone is in idle states such as a charging state or a screen-off state, so that the space of a high-performance high-speed storage area is effectively managed, the file combination with the largest write-in time and the largest profit in limited capacity is ensured, and the optimal gain improvement is obtained. In addition, the process of adjusting the storage area is not sensible to users, and the normal use of the mobile phone by the users is not influenced.

In the above-described file creation and file reading process, or in the process of file migration between the normal storage area and the high-speed storage area, the host 30 not only needs to know exactly where the file is created for each application, but also needs to be able to manage the normal storage area and the high-speed storage area.

It should be understood that the disks mapped by L U4 and L U3 of the embodiment of the present application are mounted in the same directory of the file system, therefore, for a file of an application, migration can be performed between L U3 and L U4, and at the user level, a user does not need to perceive the migration process and does not affect the use of the user.

The process of creating a new file by the system can correspond to different implementation processes. For example, the system may open the buffer through an open interface, perform different results depending on the parameters, create a file if there is no file, e.g., write the contents of the new file through a write interface, close the new file through a close interface.

In a possible implementation manner, in the process of creating a new file to a file system, when the new file needs to be created to a storage area (high-speed storage area) of S L C, the system may first call an open interface or a create interface to create the new file, obtain a descriptor fd of the new file, then call an ioctl interface to enter a parameter, specify that the content of the new file is to be landed to a flash disk mapped by the storage area of S L C, then call a write interface to write the content of the new file into a memory buffer area corresponding to the descriptor fd, call a close interface to close the descriptor fd of the new file, and finally, the kernel file system may swipe data in the memory back to the high-speed storage area of the disk at an appropriate time, so that the content of the new file realizes real landing.

In the process of creating a new file to a file system, when the new file needs to be created to a T L C storage area (a conventional storage area), the system may call an open interface or a create interface to create the new file, acquire the descriptor fd of the new file, call an ioctl interface incoming parameter to specify that the content of the new file is to be landed on a slow disk mapped by the T L C storage area, call a write interface to write the content of the new file into a memory buffer area corresponding to the descriptor fd, call a close interface to close the descriptor fd of the new file, and finally, the kernel file system may copy the data in the memory back to the conventional storage area of the disk at a proper time, so that the content of the new file is actually landed.

In the embodiment of the present application, the interface of the system call does not contain any information of the logic unit L U, and the interface of various applications for accessing the file does not need to be changed for the user level.

Illustratively, the embodiment of the application provides four new interfaces of file systems, and the management of high-speed storage areas is realized.

For example, fig. 8 is a schematic diagram of an example file system management module provided in an embodiment of the present application, and as shown in fig. 8, for the file system management module in the kernel layer of the host 30 in fig. 2, the present application provides interfaces with a plurality of different functions, such as a configuration interface, a query interface, a write interface, a migration interface, and the like.

Specifically, an interface is configured for configuring the storage form conversion mode of the high-speed storage area in real time. The configuration interface can configure the storage form conversion mode of the high-speed storage area in real time. By using the capability of the configuration interface, the storage form conversion direction and the conversion life value of the high-speed storage area can be adjusted.

In a specific implementation process, by means of a newly added cmd code F2FS _ IOC _ SET _ TZ _ STATUS _ IOR (F2FS _ IOCT L _ MAGIC,20, structure TZ _ STATUS), a TZ _ STATUS structure body contains information of a high-speed storage area to be configured, for example, storage form information and capacity information of S L C.

And the query interface is used for querying the use state information of the high-speed storage area in real time. The configuration interface can inquire the use state information of the high-speed storage area in real time, such as the space use amount of the high-speed storage area, the residual capacity, the residual life value, the storage form conversion information and the like.

In a specific implementation process, by means of a new add cmd code F2FS _ IOC _ GET _ TZ _ STATUS _ IOR (F2FS _ IOCT L _ MAGIC,20, structure TZ _ STATUS), a TZ _ STATUS structure body contains high-speed storage area use state information needing to be inquired.

The write interface, which may also be referred to as a "landed interface," is used to create files to the high-speed storage area. When creating data, the host can determine whether the data is stored in the high-speed storage area or the regular storage area. Fig. 9 is a schematic diagram of a file creating process according to another example provided in this embodiment of the present application, where a write interface is used, and a certain rule and policy are adopted, as shown in fig. 9, a proper file is selected and placed in a high-speed storage area, and then other files are written into a conventional storage area.

In a specific implementation process, a cmd code F2FS _ IOC _ SET _ TZ _ KEY _ FI L E _ IOW (F2FS _ IOCT L _ MAGIC,16, __ u32) can be newly added, when a file is landed, the descriptor attribute of the file is synchronously configured, 0 represents that a conventional storage area is landed, and 1 represents that a high-speed storage area is landed.

And the migration interface is used for migrating the file from the high-speed storage area to the conventional storage area or from the conventional storage area to the high-speed storage area, namely, realizing mutual migration of the file between the high-speed storage area and the conventional storage area. By utilizing the capability, the use behavior habit of the user and the change of the importance degree of the file are adjusted, and the file is migrated at a proper time. Fig. 10 is a schematic diagram of a further example of a file migration process provided by an embodiment of the present application, and as shown in fig. 10, a file 1 may be adjusted from a high-speed storage area to a normal storage area, or from the normal storage area to the high-speed storage area, that is, a mutual migration between the high-speed storage area and the normal storage area.

In a specific implementation process, a cmd code F2FS _ IOC _ MIGMRATE _ TZ _ KEY _ FI L E _ IOW (F2FS _ IOCT L _ MAGIC,22, __ u32) can be newly added, when a file is landed, the descriptor attribute of the file is synchronously configured, 0 represents that the file is migrated from a conventional storage area to a high-speed storage area, and 1 represents that the file is migrated from the high-speed storage area to the conventional storage area.

By designing the various interfaces, the processes of configuration, file creation and file reading of the storage system and the process of file migration between the conventional storage area and the high-speed storage area can be realized, so that the requirements on the performance, the service life and the capacity of the storage system are further met under various different scenes, and the running speed of the system is improved.

It should be understood that the storage system provided in the embodiment of the present application may also be widely applied to a scenario that requires high storage performance in the future, for example, the low-latency high-performance requirement of an AI scenario for large data access may be met, or a requirement of frequently exchanging data with a storage at a high speed when a memory capacity is tight, a data transmission requirement of a network bandwidth of fifth generation mobile network communication (5th generation wireless systems, 5G), a distributed terminal data transmission requirement of a work local area network or a home local area network, and the like.

In addition, the applicable architecture of the storage system is not limited to a specific hybrid storage architecture, such as T L C or S L C.

It will be appreciated that the terminal device, in order to implement the above-described functions, comprises corresponding hardware and/or software modules for performing the respective functions. The present application is capable of being implemented in hardware or a combination of hardware and computer software in conjunction with the exemplary algorithm steps described in connection with the embodiments disclosed herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, with the embodiment described in connection with the particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

In this embodiment, the terminal device may be divided into functional modules according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module may be implemented in the form of hardware. It should be noted that the division of the modules in this embodiment is schematic, and is only a logic function division, and there may be another division manner in actual implementation.

It should be noted that all relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.

The terminal device provided by this embodiment can execute the above method for storing or reading data, and therefore can achieve the same effect as the above implementation method.

In case of an integrated unit, the terminal device may comprise a processing module, a storage module and a communication module. The processing module can be used for controlling and managing the action of the terminal equipment. The memory module may be used to support the terminal device in executing stored program codes and data, etc. And the communication module can be used for supporting the communication between the terminal equipment and other equipment.

The processing module may be a processor or a controller. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., a combination of one or more microprocessors, a Digital Signal Processing (DSP) and a microprocessor, or the like. The storage module may be a memory. The communication module may specifically be a radio frequency circuit, a bluetooth chip, a Wi-Fi chip, or other devices that interact with other terminal devices.

In an embodiment, when the processing module is a processor and the storage module is a memory, the terminal device according to this embodiment may be a device having the structure shown in fig. 1.

The present embodiment also provides a computer storage medium, where a computer instruction is stored, and when the computer instruction runs on a terminal device, the terminal device executes the above related method steps to implement the method for data storage and data reading in the above embodiments.

The present embodiment also provides a computer program product, which when running on a computer, causes the computer to execute the relevant steps described above, so as to implement the method for data storage and data reading in the above embodiments.

In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component or a module, and may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored by the memory, so that the chip can execute the method for storing data and reading data in the above-mentioned method embodiments.

The terminal device, the computer storage medium, the computer program product, or the chip provided in this embodiment are all configured to execute the corresponding method provided above, so that the beneficial effects achieved by the terminal device, the computer storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding method provided above, and are not described herein again.

Through the description of the above embodiments, those skilled in the art will understand that, for convenience and simplicity of description, only the division of the above functional modules is used as an example, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.

In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

39页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种心跳连接的建立方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类