Data storage method and device based on eMMC, terminal equipment and storage medium

By caching write requests and writing them all at once to the cached data cluster of the eMMC when conditions are met, the problem of shortened eMMC lifespan caused by frequent writes of small data is solved, resulting in a longer device lifespan.

CN114077550BActive Publication Date: 2026-01-30GEER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111279243.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2026-01-30
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

Existing eMMC storage systems suffer from frequent small data write requests, causing the small data corresponding to the write request to be written to the same storage area multiple times, resulting in a shortened lifespan.

Method used

When a write request is received, the write request is cached in the cache data cluster corresponding to the target sector. When the cache data cluster meets the preset conditions, the write data in the cache data cluster is written to the sector at once. The cache data cluster that meets the conditions is cached at least twice for write requests.

Benefits of technology

This reduces the number of writes to the block storage area, extending the lifespan of the eMMC.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077550B_ABST
    Figure CN114077550B_ABST
Patent Text Reader

Abstract

This invention discloses a data storage method, apparatus, terminal device, and storage medium based on eMMC. The method includes: upon receiving a write request, obtaining the target sector corresponding to the write request; caching the sector to a cache data cluster corresponding to the target sector; caching the write request to the cached data cluster; and when a cached data cluster meets a preset condition, writing the write data corresponding to the write request in the cached data cluster that meets the preset condition to the sector corresponding to the cached data cluster. When a write request is received, the method of this invention first caches the write request to a cached data cluster until a cached data cluster meets the preset condition. Then, by writing the write data corresponding to at least two separate write requests to the sector corresponding to the cached data cluster in a single write operation, the block storage area where the sector is located is updated once, reducing the number of write operations to the block storage area and extending the lifespan of the eMMC.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer information technology, and in particular to a data storage method and device based on eMMC, a terminal device and a storage medium. BACKGROUND

[0002] The basic structure of eMMC (Embedded Multi Media Card) is to encapsulate an eMMC controller and a NAND type flash memory (NAND Flash) chip in one chip. The eMMC is internally composed of a NAND FLASH, and the update of the NAND FLASH memory is in units of blocks, which leads to unstable random write performance of the storage system based on eMMC, especially poor random write performance for small data. For example, in the prior art, the eMMC directly updates the block storage area requested to be written by the write request when receiving the write request issued by the operating system, and thus when the write request for small data occurs frequently, the small data corresponding to the write request may be written to the same block storage area multiple times, which shortens the service life of the eMMC.

[0003] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY

[0004] The present application provides a data storage method and device based on eMMC, a terminal device and a storage medium, aiming to solve the problem that the small data corresponding to the write request is written to the same block storage area multiple times, which shortens the service life of the eMMC.

[0005] To achieve the above-mentioned purpose, the present application provides a data storage method based on eMMC, which comprises:

[0006] When a write request is received, the target sector corresponding to the write request is obtained;

[0007] The write request is cached to the cache data cluster corresponding to the target sector;

[0008] When the cache data cluster meets a preset condition, the write data corresponding to the write request in the cache data cluster meeting the preset condition is written to the sector corresponding to the cache data cluster, wherein the cache data cluster meeting the preset condition caches at least two write requests.

[0009] Optionally, the preset condition comprises at least one of the following conditions:

[0010] The remaining storage capacity of the sector corresponding to the cache data cluster is less than a preset storage capacity.

[0011] The target sectors corresponding to each of the write requests in the cache data cluster constitute all sectors corresponding to the cache data cluster.

[0012] Optionally, after the step of obtaining the target sectors corresponding to the write request, when the write request is received, the method further comprises:

[0013] Obtaining the to-be-cached data cluster from the continuous cache area in the LRU management list;

[0014] Obtaining the cache data cluster corresponding to the target sectors;

[0015] When the to-be-cached data cluster is the same as the cache data cluster corresponding to the target sectors, performing the step of caching the write request to the cache data cluster corresponding to the target sectors.

[0016] Optionally, after the step of obtaining the cache data cluster corresponding to the target sectors, the method further comprises:

[0017] When the to-be-cached data cluster is not the same as the cache data cluster corresponding to the target sectors, obtaining a to-be-written sector corresponding to a last write request;

[0018] When the to-be-written cache data cluster corresponding to the to-be-written sector is the same as the cache data cluster corresponding to the target sectors, moving the cache data cluster to the continuous cache area in the LRU management list.

[0019] Optionally, after the step of obtaining the target sectors corresponding to the write request, when the write request is received, the method further comprises:

[0020] Obtaining a storage capacity of the write data corresponding to the write request;

[0021] When the storage capacity is less than or equal to a second preset storage capacity, performing the step of caching the write request to the cache data cluster corresponding to the target sectors.

[0022] Optionally, after the step of obtaining the storage capacity of the write data corresponding to the write request, the method further comprises:

[0023] When the storage capacity is greater than the second preset storage capacity, writing the write data corresponding to the write request to the target sectors.

[0024] Optionally, after the step of writing the write data corresponding to the write request in the cache data cluster satisfying a preset condition to the sectors corresponding to the cache data cluster when the cache data cluster satisfies the preset condition, the method further comprises:

[0025] Deleting the cache data cluster satisfying the preset condition from the LRU management list.

[0026] In addition, to achieve the above object, the application further provides an eMMC-based data storage device, comprising:

[0027] an acquisition module, configured to acquire a target sector corresponding to a write request when the write request is received;

[0028] a cache module, configured to cache the write request to a cache data cluster corresponding to the target sector;

[0029] a write module, configured to write write-in data corresponding to the write request in the cache data cluster satisfying a preset condition to a sector corresponding to the cache data cluster when the cache data cluster satisfies the preset condition, wherein the cache data cluster satisfying the preset condition caches at least two write requests.

[0030] In addition, to achieve the above object, the application further provides a terminal device, comprising a memory, a processor, and an eMMC-based data storage program stored in the memory and executable on the processor, wherein the eMMC-based data storage program is executed by the processor to implement each step of the above eMMC-based data storage method.

[0031] In addition, to achieve the above object, the application further provides a storage medium, wherein the storage medium stores an eMMC-based data storage program, and the eMMC-based data storage program is executed by the processor to implement each step of the above eMMC-based data storage method.

[0032] Compared with writing write-in data corresponding to a write request to a sector corresponding to the write request to update a block storage area where the sector is located each time a write request is received, the eMMC-based data storage method, device, terminal device, and storage medium provided by the application cache the write request to a cache data cluster for caching when the write request is received, the cache data cluster is a cache data cluster corresponding to a target sector to be written by the write request, and write-in data corresponding to the write request in the cache data cluster satisfying a preset condition is written to a sector corresponding to the cache data cluster at one time until the cache data cluster satisfies the preset condition. When at least two write requests are cached in the cache data cluster satisfying the preset condition, write-in data corresponding to the at least two write requests is written to the sector corresponding to the cache data cluster at one time through one write operation to update the block storage area where the sector is located once, thereby reducing the number of write operations to the block storage area and prolonging the service life of the eMMC. BRIEF DESCRIPTION OF DRAWINGS

[0033] Figure 1Structure diagram of terminal device related to each embodiment of the eMMC-based data storage method of the present application;

[0034] Figure 2 Flowchart of an embodiment of the eMMC-based data storage method of the present application;

[0035] Figure 3 Simple diagram of eMMC consisting of a series of data clusters;

[0036] Figure 4 Mapping relationship diagram of LRU mapping table;

[0037] Figure 5 Flowchart of a second embodiment of the eMMC-based data storage method of the present application;

[0038] Figure 6 Module diagram of the eMMC-based data storage device of the present application.

[0039] The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION

[0040] It should be understood that the specific embodiments described herein are merely intended to explain the present application and not to limit the present application.

[0041] The eMMC-based data storage method of the present application comprises:

[0042] When a write request is received, a target sector corresponding to the write request is obtained;

[0043] The write request is cached to a cache data cluster corresponding to the target sector; the write request is cached to the cache data cluster to be cached;

[0044] When the cache data cluster meets a preset condition, write data corresponding to the write request in the cache data cluster meeting the preset condition is written to a sector corresponding to the cache data cluster, wherein the cache data cluster meeting the preset condition caches at least two write requests.

[0045] Compared with writing the write data corresponding to the write request into the sector corresponding to the write request to update the block storage area where the sector is located each time the write request is received, the method of the present application receives the write request, buffers the write request to the cache data cluster first, the cache data cluster is the cache data cluster corresponding to the target sector to which the write request is written, until the cache data cluster meets the preset condition, the write data corresponding to the write request in the cache data cluster meeting the preset condition is written into the sector corresponding to the cache data cluster at one time, when there are at least two write requests in the cache data cluster meeting the preset condition, the write data corresponding to the at least two write requests is written into the sector corresponding to the cache data cluster at one time through one write operation, and the block storage area where the sector is located is updated at one time, the number of write operations to the block storage area is reduced, and the service life of the eMMC is increased.

[0046] In the following description, the suffixes such as "module", "part", or "unit" used to designate elements are merely for facilitating the description of the present application, and have no particular meaning by themselves. Thus, "module", "part", or "unit" can be mixedly used.

[0047] The terminal device can be implemented in various forms. For example, the terminal device described in the present application can include a mobile terminal such as a pedometer and a portable media player (PMP), and can include a wearable device such as a bracelet and a watch.

[0048] Please refer to Figure 1 , Figure 1 The structure diagram of the terminal device related to the embodiments of the eMMC-based data storage method of the present application.

[0049] As Figure 1 indicated, the terminal device can include a memory 101 and a processor 102. Those skilled in the art can understand that Figure 1 The structure block diagram of the terminal shown does not constitute a limitation on the terminal, and the terminal can include more or fewer components than shown, or combine certain components, or different component arrangements. Among them, the memory 101 stores an operating system and an eMMC-based data storage program. The processor 102 is the control center of the terminal device, and the processor 102 executes the eMMC-based data storage program stored in the memory 101 to realize the steps of the embodiments of the eMMC-based data storage method of the present application.

[0050] Optionally, the terminal device further includes a display unit 103, which includes a display panel, and the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like, and is used to output an interface for user browsing.

[0051] Based on the structure block diagram of the terminal device, various embodiments of the eMMC-based data storage method of the present application are proposed.

[0052] In an embodiment, the present application provides an eMMC-based data storage method, which refers to Figure 2 , Figure 2 The flowchart of an embodiment of the eMMC-based data storage method of the present application is shown in the figure. In this embodiment, the eMMC-based data storage method includes the following steps:

[0053] Step S10, when a write request is received, the target sector corresponding to the write request is obtained;

[0054] Step S20, the write request is cached to the cache data cluster corresponding to the target sector;

[0055] Step S30, when the cache data cluster meets the preset condition, the write data corresponding to the write request in the cache data cluster meeting the preset condition is written to the sector corresponding to the cache data cluster.

[0056] The eMMC is internally composed of a NAND FLASH, and the update of the NAND FLASH memory is in units of blocks. In order to facilitate the understanding of the physical storage space of the eMMC, from the perspective of the block device driver, the physical storage space of the eMMC is composed of a series of data clusters, which can be referred to in detail in Figure 3 , Figure 3 The simple schematic diagram of the eMMC composed of a series of data clusters is shown in the figure. It should be noted that each data cluster is composed of a plurality of continuous sectors, wherein the sector is the most basic processing unit of physical storage. It can be understood that since the eMMC update is in units of blocks, the basic unit of I / O transmission between the eMMC driver and the eMMC device is a data cluster composed of a plurality of continuous sectors.

[0057] In the embodiment, corresponding to a series of data clusters constituting the eMMC, a cache data cluster corresponding to each data cluster is set, wherein the cache data cluster is a cache area occupying the kernel storage capacity, the cache data cluster is used to cache the write request, the corresponding relationship between the cache data cluster and the sector is realized by setting the LRU management list, that is, the LRU mapping table, and each cache data cluster constituting the eMMC is managed by the LRU management list. For example, the series of data clusters constituting the eMMC are C0-Cn, a cache data cluster corresponding to each data cluster is set, that is, the cache data cluster is cluster 0-cluster n, and assuming that the sector corresponding to the data cluster C1 is 1-10, the sector corresponding to the write request stored in the cache data cluster cluster 0 is requested to write 1-10, when the sector corresponding to the data cluster C1 is 11-20, the sector corresponding to the write request stored in the cache data cluster cluster 1 is requested to write 11-20.

[0058] Optionally, the LRU management list, that is, the LRU mapping table, is realized by adopting a two-level index manner of the cache data cluster and the sector. It should be noted that the LRU mapping table includes a first mapping table and a second mapping table, wherein the first mapping table includes the related information of the cache data cluster, and the second mapping table includes the mapping relationship between each cache data cluster and the sector. For example, it can be referred to Figure 4 , Figure 4 The mapping relationship diagram of the LRU mapping table is shown in the figure, wherein the size of the cache data cluster can be set to 1M, and the size of each sector is 512 bytes.

[0059] Optionally, each cache data cluster constituting the eMMC is managed by the LRU management list, specifically, among each cache data cluster constituting the eMMC, the target cache data cluster whose corresponding sector has a remaining storage capacity greater than or equal to a preset storage capacity is managed by the LRU management list, wherein the remaining storage capacity of the sector corresponding to the cache data cluster refers to the storage capacity of the sector other than the target sector among all sectors corresponding to the cache data cluster, and the target sector is the sector requested to be written by all write requests cached in the cache data cluster.

[0060] Optionally, the target cache data cluster whose corresponding sector has a remaining storage capacity greater than or equal to a preset storage capacity can be a target cache data cluster which still has at least one sector without written data.

[0061] The target sector is the object storage area of the write request. When the write request is received, the target sector corresponding to the write request is obtained, wherein the target sector of the write request can be obtained by obtaining the physical address to be written by the write request, so as to determine the target sector to be written by the physical address.

[0062] Based on the correspondence between the cache data cluster and the sectors, the write request is cached to the cache data cluster corresponding to the target sector, the cache data cluster corresponding to the target sector can be obtained first, and then the write request is cached to the cache data cluster, so as to "accumulate" at least two write requests through the cache data cluster.

[0063] Step S30 writes the write data corresponding to the write request in the cache data cluster satisfying the preset condition to the sector corresponding to the cache data cluster when the cache data cluster satisfies the preset condition. Optionally, the preset condition includes at least one of the following conditions:

[0064] The remaining storage capacity of the sector corresponding to the cache data cluster is less than a preset storage capacity;

[0065] The target sectors corresponding to each of the write requests in the cache data cluster constitute all the sectors corresponding to the cache data cluster.

[0066] It should be noted that the remaining storage capacity of the sector corresponding to the cache data cluster refers to the storage capacity of the sectors other than the target sector in all the sectors corresponding to the cache data cluster, and the target sector is the sector requested to be written by all the write requests cached in the cache data cluster. When the remaining storage capacity of the sector corresponding to the cache data cluster is less than the preset storage capacity, it indicates that there is a high probability that there is no sector with unwritten data in the sector corresponding to the cache data cluster. The write data corresponding to the write request in the cache data cluster satisfying the preset condition is written to the sector corresponding to the cache data cluster, so as to fill the entire block of storage area corresponding to the cache data cluster by one write operation.

[0067] Similarly, the preset condition is that the target sectors corresponding to each of the write requests in the cache data cluster constitute all the sectors corresponding to the cache data cluster. For example, the write requests A, C and D are cached in the cache data cluster, A requests to be written to the 1-4 sectors of cluster0, C requests to be written to the 5-6 sectors of cluster0, and D requests to be written to the 7-10 sectors of cluster0, wherein the mapping relationship cluster0 corresponds to the sectors 1-10. The target sectors corresponding to the write requests A, C and D cached in the cache data cluster are exactly the sectors corresponding to the cache data cluster, that is, it indicates that each sector corresponding to the cache data cluster stores data.

[0068] Optionally, when the preset condition includes two conditions that the remaining storage capacity of the sector corresponding to the cache data cluster is less than the preset storage capacity and the target sectors corresponding to each of the write requests in the cache data cluster constitute all the sectors corresponding to the cache data cluster, as long as one of the preset conditions is satisfied by the cache data cluster, it can be considered that the cache data cluster satisfies the preset condition.

[0069] Optionally, the cache data cluster satisfying the preset condition caches at least two write requests.

[0070] In addition, for the convenience of understanding the embodiment, the following is described by an example:

[0071] Suppose there are the following write requests: A, B, C, D, and E, wherein A requests to write to sectors 1-4 of cluster0; B requests to write to sectors 12-13 of cluster1; C requests to write to sectors 5-6 of cluster0; D requests to write to sectors 7-10 of cluster0; E requests to write to sectors 15-17 of cluster1; wherein the mapping relationship is that cluster0 corresponds to sectors 1-10, and cluster1 corresponds to sectors 11-20.

[0072] By sequentially caching the write requests A, C, and D to cluster0, when all sectors corresponding to cluster0 correspond to write data to be written, it can be simply understood that the write requests A, C, and D are combined into a large write request F, and the write data corresponding to the write request F is written to the sectors corresponding to cluster0, that is, the write data corresponding to the write request A is written to the sectors 1-4 corresponding to cluster0, the write data corresponding to the write request C is written to the sectors 5-6 corresponding to cluster0, and the write data corresponding to the write request D is written to the sectors 7-10 corresponding to cluster0, to store the entire block storage area corresponding to cluster0, so as to achieve that the write data of multiple small data write requests is written to fill the entire block storage area corresponding to cluster0 by one write operation, avoid that multiple small data write requests are written to the entire block storage area corresponding to cluster0 by multiple write operations, and reduce the number of write operations. Similarly, the write requests B and E are combined into another large write request G, which will not be described here. The LRU management list allocates write caches required by the requests corresponding to F and G to cluster0 and cluster1, respectively.

[0073] As an optional implementation, after step S10, the method further comprises:

[0074] obtaining a storage capacity of the write data corresponding to the write request;

[0075] when the storage capacity is less than or equal to a second preset storage capacity, performing step S20, that is, caching the write request to the cache data cluster corresponding to the target sector;

[0076] when the storage capacity is greater than the second preset storage capacity, writing the write data corresponding to the write request to the target sector.

[0077] It can be understood that when the storage capacity of the write data corresponding to the write request is less than or equal to the second preset storage capacity, it indicates that the write request is a small-data write request, and the write request can be cached to the cache data cluster corresponding to the target sector, so as to accumulate the small-data write request through the cache data cluster, and then when the cache data cluster reaches the preset condition, the write data corresponding to the write request in the cache data cluster satisfying the preset condition is written into the sector corresponding to the cache data cluster; when the storage capacity of the write data corresponding to the write request is greater than the second preset storage capacity, it indicates that the write request is a large-data write request, and the write data corresponding to the write request can be directly written into the target sector.

[0078] Optionally, the second preset storage capacity can be determined according to the storage capacity of a sector corresponding to the cache data cluster, and can also be determined according to the number of sectors corresponding to the cache data cluster and the storage capacity of a sector, so that the number of write requests cached by the cache data cluster satisfying the preset condition is at least twice.

[0079] As an optional implementation, after step S30, the method further comprises:

[0080] The cache data cluster satisfying the preset condition is deleted from the LRU management list.

[0081] LRU (Least Recently Used) is a cache management strategy, and the basic idea of the strategy is that cache records rarely accessed recently are not likely to be accessed in the near future. In the embodiment, when the cache data cluster satisfying the preset condition, that is, the sector corresponding to the cache data cluster is probably full, the cache data cluster satisfying the preset condition is deleted from the LRU management list, so as to reserve the free cache area space to store the cache data cluster not yet full.

[0082] It should be noted that the eMMC is internally composed of NAND FLASH, and since the update of the NAND FLASH memory is in units of blocks, the storage system based on eMMC is poor in random write performance of small data. For example, when a small-data write request is received, the write data corresponding to the write request is directly written into the corresponding block storage area, and then when the small-data write request frequently occurs, the small data corresponding to the write request is frequently written into the same block storage area, which shortens the service life of the eMMC.

[0083] Compared with writing the write data corresponding to the write request into the sector corresponding to the write request to update the block storage area where the sector is located each time the write request is received, in the technical solution disclosed in the embodiment, when the write request is received, the write request is cached to the cache data cluster first, the cache data cluster is the cache data cluster corresponding to the target sector to which the write request is to be written, and the write data corresponding to the write request in the cache data cluster meeting the preset condition is written into the sector corresponding to the cache data cluster at one time until the cache data cluster meeting the preset condition. When there are at least two write requests cached in the cache data cluster meeting the preset condition, the write data corresponding to the at least two write requests is written into the sector corresponding to the cache data cluster at one time through one write operation, the block storage area where the sector is located is updated at one time, the number of write operations to the block storage area is reduced, and the service life of the eMMC is prolonged.

[0084] In the second embodiment based on any one of the above embodiments, refer to Figure 5 , Figure 5 The flowchart of the second embodiment of the data storage method based on the eMMC of the application is shown in the figure. In the embodiment, after step S10, the following steps are further included.

[0085] Step S40: obtaining the to-be-cached data cluster from the continuous cache area in the LRU management list;

[0086] Step S50: obtaining the cache data cluster corresponding to the target sector;

[0087] Step S60: when the to-be-cached data cluster is the same as the cache data cluster corresponding to the target sector, executing step S20, that is, caching the write request to the cache data cluster corresponding to the target sector.

[0088] The to-be-cached data cluster of the continuous cache area refers to the data cluster in which the target sectors requested to be written by at least two continuous write requests are the same, that is, the target sectors requested to be written by the at least two continuous write requests belong to the same block storage area. By placing the to-be-cached data cluster in the continuous cache area in the LRU management list, it is indicated that the sector or the block storage area corresponding to the to-be-cached data cluster is frequently written. When the write request is received, the target sector requested to be written by the write request is determined, and it is determined whether the cache data cluster corresponding to the target sector is the same as the to-be-cached data cluster first. When the to-be-cached data cluster is the same as the cache data cluster corresponding to the target sector, it is indicated that the write request is continuously written to the same block storage area, and step S20 is executed, that is, the write request is cached to the cache data cluster corresponding to the target sector, so as to reduce the write caching time of the allocated cache data cluster and quickly determine the cache data cluster hit by the write request.

[0089] As an optional implementation, after step S50, the following steps are further included:

[0090] When the to-be-cached data cluster is different from the cached data cluster corresponding to the target sector, obtaining a to-be-written sector corresponding to a previous write request;

[0091] When the to-be-written cached data cluster corresponding to the to-be-written sector is the same as the cached data cluster corresponding to the target sector, moving the cached data cluster to a continuous cache area in the LRU management list.

[0092] When the to-be-cached data cluster is different from the cached data cluster corresponding to the target sector, it is indicated that the write request is not continuous writing to the same block storage area, and a to-be-written sector corresponding to a previous write request is obtained. When the to-be-written cached data cluster corresponding to the to-be-written sector is the same as the cached data cluster corresponding to the target sector, it is indicated that the cached data cluster corresponding to the target sector corresponding to the write request of the two consecutive times is the same, and the sector or block storage area corresponding to the cached data cluster is frequently written with data. The cached data cluster is moved to a continuous cache area in the LRU management list.

[0093] In the technical solution disclosed in the embodiment, by placing the to-be-cached data cluster in the continuous cache area in the LRU management list, it is indicated that the sector or block storage area corresponding to the to-be-cached data cluster is frequently written with data. When a write request is received, the target sector to which the write request is requested to be written is determined, and it is determined whether the cached data cluster corresponding to the target sector is the same as the to-be-cached data cluster. When the to-be-cached data cluster is the same as the cached data cluster corresponding to the target sector, the write request is cached to the cached data cluster corresponding to the target sector, so as to reduce the write caching time of the allocated cached data cluster and quickly determine the cached data cluster hit by the write request.

[0094] The application further provides an eMMC-based data storage device 100, which refers to Figure 6 , Figure 6 The application provides a module schematic diagram of the eMMC-based data storage device, and the eMMC-based data storage device 100 comprises:

[0095] The obtaining module 110 is configured to obtain a target sector corresponding to a write request when the write request is received.

[0096] The caching module 120 is configured to cache the write request to a cached data cluster corresponding to the target sector.

[0097] The writing module 130 is configured to write write data corresponding to the write request in the cached data cluster satisfying a preset condition to a sector corresponding to the cached data cluster when the cached data cluster satisfies the preset condition, and the cached data cluster satisfying the preset condition caches at least two write requests.

[0098] The application further provides a terminal device, comprising a memory, a processor, and an eMMC-based data storage program stored in the memory and executable on the processor, the eMMC-based data storage program realizing the steps of the eMMC-based data storage method in any of the above embodiments when executed by the processor.

[0099] The application further provides a storage medium, which stores an eMMC-based data storage program, the eMMC-based data storage program realizing the steps of the eMMC-based data storage method in any of the above embodiments when executed by a processor.

[0100] In the embodiments of the device, the terminal device and the readable storage medium provided by the application, all the technical features of the above embodiments of the eMMC-based data storage method are included, and the description and explanation in the specification are basically the same as those of the above embodiments of the eMMC-based data storage method, which will not be repeated here.

[0101] It should be noted that in this document, the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or system. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of another identical element in the process, method, article or system including the element.

[0102] The above embodiment numbers of the application are only for description, and do not represent the advantages or disadvantages of the embodiments.

[0103] Through the above description of the embodiments, those skilled in the art can clearly understand that the above embodiment methods can be realized by means of software and necessary general hardware platforms, of course, they can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, an optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device) to execute the method of each embodiment of the application.

[0104] The above is only the preferred embodiment of the application, and does not limit the patent scope of the application, and any equivalent structure or equivalent process transformation based on the content of the specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the application.

Claims

1. An eMMC-based data storage method, characterized in that, The eMMC-based data storage method comprises the following steps: When a write request is received, a target sector corresponding to the write request is obtained; When the to-be-written sector corresponds to a to-be-written cache data cluster identical to a cache data cluster corresponding to the target sector, the cache data cluster is moved to a continuous cache area in an LRU management list, wherein, when the write request is continuously written to the same block storage area, the to-be-written cache data cluster is identical to the cache data cluster corresponding to the target sector; The to-be-written cache data cluster is obtained from the continuous cache area in the LRU management list, wherein the to-be-written cache data cluster is a data cluster identical to the cache data cluster corresponding to the target sector and written by at least two continuous write requests; The cache data cluster corresponding to the target sector is obtained; The write request is cached to the cache data cluster corresponding to the target sector; When the cache data cluster meets a preset condition, write data corresponding to the write request in the cache data cluster meeting the preset condition is written to a sector corresponding to the cache data cluster, wherein the cache data cluster meeting the preset condition caches at least two write requests, and the preset condition is that a remaining storage capacity of the sector corresponding to the cache data cluster is less than a preset storage capacity, and the remaining storage capacity is a storage capacity of a sector other than the target sector in all sectors corresponding to the cache data cluster.

2. The eMMC-based data storage method of claim 1, wherein, The preset condition further comprises: All target sectors corresponding to each write request in the cache data cluster form all sectors corresponding to the cache data cluster.

3. The eMMC-based data storage method of claim 1, wherein, After the step of obtaining the cache data cluster corresponding to the target sector, the following steps are further included: When the to-be-written cache data cluster is not identical to the cache data cluster corresponding to the target sector, a to-be-written sector corresponding to a last write request is obtained.

4. The eMMC-based data storage method of claim 1, wherein, After the step of obtaining the target sector corresponding to the write request when the write request is received, the following steps are further included: A storage capacity of write data corresponding to the write request is obtained; When the storage capacity is less than or equal to a second preset storage capacity, the step of caching the write request to the cache data cluster corresponding to the target sector is executed.

5. The eMMC-based data storage method of claim 4, wherein, After the step of obtaining the storage capacity of the write data corresponding to the write request, the following steps are further included: When the storage capacity is greater than the second preset storage capacity, the write data corresponding to the write request is written to the target sector.

6. The eMMC-based data storage method of claim 1, wherein, After the step of writing the write data corresponding to the write request in the cache data cluster meeting the preset condition to the sector corresponding to the cache data cluster when the cache data cluster meets the preset condition, the following steps are further included: The cache data cluster meeting the preset condition is deleted from the LRU management list.

7. An eMMC-based data storage device, comprising: The eMMC-based data storage device comprises: An obtaining module, configured to obtain a target sector corresponding to a write request when the write request is received; The cache module is configured to move the cache data cluster to a continuous cache area in an LRU management list when the to-be-written cache data cluster corresponding to the to-be-written sector is the same as the cache data cluster corresponding to the target sector; and acquire a to-be-cached data cluster from the continuous cache area in the LRU management list, wherein the to-be-cached data cluster is a data cluster written by at least two continuous write requests and is the same as the cache data cluster corresponding to the target sector. The write module is configured to write write data corresponding to the write request in the cache data cluster that meets the preset condition to a sector corresponding to the cache data cluster when the cache data cluster meets the preset condition, wherein the cache data cluster that meets the preset condition caches at least two write requests, and the preset condition is that a remaining storage capacity of the sector corresponding to the cache data cluster is less than a preset storage capacity, and the remaining storage capacity is a storage capacity of a sector other than the target sector among all sectors corresponding to the cache data cluster.

8. A terminal device, comprising: The terminal device comprises a memory, a processor, and an eMMC-based data storage program stored in the memory and executable on the processor, and the eMMC-based data storage program implements the steps of the eMMC-based data storage method according to any one of claims 1-6 when executed by the processor.

9. A storage medium, characterized by The storage medium has an eMMC-based data storage program stored thereon, and the eMMC-based data storage program implements the steps of the eMMC-based data storage method according to any one of claims 1-6 when executed by the processor.

Citation Information

Patent Citations

  • Control method and device for disk sectors

    CN105302501A

  • Disk data reading / writing method and virtual machine monitor

    CN106406981A