Data storage method and device
By obtaining data from the operating system kernel of the storage device, determining data characteristics and formulating a diversion strategy, the problem of UFS write performance in the existing technology being unable to be continuously improved is solved, efficient data diversion is achieved, and the write performance of the storage device is improved. and longevity.
Patent Information
- Application Number
- CN202411426067.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-21
AI Technical Summary
When the prior art improves UFS write performance of mobile devices, there are problems such as high performance not being maintained at all times, high load and low portability.
By obtaining data from the kernel of the operating system of the storage device, determine the characteristics of the data, and determine the data diversion strategy based on the attribute parameters and data characteristics of the storage device, and the storage data is diverted to improve the writing performance.
The writing performance of the storage equipment is improved, the high performance is maintained, the number of data migration is reduced, the life of the storage equipment is increased, and the transplantability of the system is improved.
Smart Images

Figure CN119336266A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of storage technology, and more specifically, to a data storage method and device. Background Art
[0002] Existing methods and related technologies for improving the UFS write performance of mobile devices include WriteBooster technology and host-side data diversion technology.
[0003] WriteBooster technology is a general method for optimizing Universal Flash Storage (UFS) devices released by the Joint Electron Device Engineering Council (JEDEC). It allocates a portion of the universal flash storage space as a single-level cell (SLC) flash memory, which is used as a cache. When the host has input / output (Input / Output) IO data written, it will be written directly to the single-level cell flash memory area first, and then when the write instruction is received or the device is idle, the data in the single-level cell flash memory area will be moved to the slower triple-level cell (TLC) / quadruple-level cell (QLC) area. In this way, writing directly to the single-level cell flash memory area will greatly improve performance compared to writing to the slower triple-level cell flash memory / quadruple-level cell flash memory area. However, in WriteBooster technology, when the host writes a large amount of data for a period of time, the single-layer unit flash memory area will be filled up, and if the refresh instruction is not triggered, the subsequent data written by the host can only be written to the slower three-layer unit flash memory / four-layer unit flash memory area because the single-layer unit flash memory space is full. In this case, the write performance will return to the original slower speed, which will be reflected in the user experience and may cause lag.
[0004] Host-side data diversion technology refers to distinguishing the hotness and coldness of written data on the host side. This technology is based on WriteBooster, which has a data diversion module that writes the determined hot data to the single-layer unit flash cache area, while the cold data is directly written to the slower three-layer unit flash / four-layer unit flash area. However, although the host-side data diversion technology can distinguish between hot and cold data and allow high-priority data to be written to the single-layer unit flash area, the single-layer unit flash area will not be quickly filled up. However, due to the presence of a data diversion module, a large amount of data written by the host side needs to be analyzed to distinguish the heat priority, which introduces a lot of calculations and analysis, increasing the system load. In addition, this data diversion module is implemented in the kernel, and it takes a long time to port it to other platforms.
[0005] In summary, existing methods and related technologies for improving the UFS writing performance of mobile devices have problems such as high performance cannot be maintained all the time, high load and low portability. Summary of the invention
[0006] An exemplary embodiment of the present disclosure is to provide a data storage method and apparatus to improve storage performance and avoid high load and low portability.
[0007] According to an exemplary embodiment of the present disclosure, there is provided a data storage method, comprising: acquiring data from a kernel of an operating system of a storage device; determining at least one data feature of the data; determining a data diversion strategy for the data to be stored based on attribute parameters of the storage device and the at least one data feature; and diverting the data to be stored based on the data diversion strategy.
[0008] Optionally, acquiring data from a kernel of an operating system of the storage device may include: acquiring the data through a preset filter program loaded into the kernel.
[0009] Optionally, obtaining the data through a preset filter program loaded into the kernel may include: upon determining that the preset filter program loaded into the kernel passes compliance verification of the kernel, capturing data from various data layers of the kernel through the preset filter program; storing the captured data in a preset mapping table to obtain the data.
[0010] Optionally, determining the data diversion strategy for the data to be stored based on the attribute parameters of the storage device and the at least one data feature may include: determining whether the storage device supports a single-layer unit flash memory fixed cache based on the attribute parameters; selecting a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache; and determining the data diversion strategy based on the selected data feature.
[0011] Optionally, the at least one data feature may include at least one of a read / write type distribution of the data, a read ratio of the data, a write ratio of the data, and a write type distribution of the data.
[0012] Optionally, the selecting of a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache may include: when it is determined that the storage device does not support a single-layer unit flash memory fixed cache, selecting the write ratio of the data from the at least one data feature as the data feature for determining the data diversion strategy, wherein determining the data diversion strategy based on the selected data feature includes: determining the data diversion strategy based on the write ratio of the data.
[0013] Optionally, determining the data diversion strategy based on the write ratio of the data may include: counting the write ratio of the data per unit time; determining a comparison result between a minimum value in the write ratio and a threshold; when the minimum value is greater than or equal to the threshold, using a first area of the storage area as at least a part of the data diversion strategy; when the minimum value is less than the threshold, using a second area of the storage area as at least a part of the data diversion strategy, wherein the write speed of the first area is greater than the write speed of the second area.
[0014] Optionally, the diverting of the data to be stored based on the data diversion strategy may include: when the first area serves as at least a part of the data diversion strategy, writing the data to be stored to the first area; when the second area serves as at least a part of the data diversion strategy, writing the data to be stored to the second area.
[0015] Optionally, the selecting of a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache may include: when it is determined that the storage device supports a single-layer unit flash memory fixed cache, selecting the write type distribution of the data from the at least one data feature as the data feature for determining the data diversion strategy, wherein determining the data diversion strategy based on the selected data feature includes: determining the data diversion strategy based on the write type distribution of the data.
[0016] Optionally, determining the data diversion strategy based on the write type distribution of the data may include: determining the proportion of write types in the data within a predetermined time based on the write type distribution of the data; selecting a write type whose proportion meets a predetermined condition based on the write type proportion in the data diversion strategy; and using the write type in the data diversion strategy as at least a part of the data diversion strategy.
[0017] Optionally, the diverting of the data to be stored based on the data diversion strategy may include: writing the data to be stored whose write type is the write type in the data diversion strategy to a first area, and writing the data to be stored whose write type is not the write type in the data diversion strategy to a second area.
[0018] Optionally, the diverting of the stored data based on the data diversion strategy may include: writing data whose priority or importance meets the conditions into the first area based on the data diversion strategy, and writing data whose priority or importance does not meet the conditions into the second area, wherein the writing speed of the first area is greater than the writing speed of the second area.
[0019] According to an exemplary embodiment of the present disclosure, there is provided a data storage device, comprising: a data acquisition unit, configured to acquire data from a kernel of an operating system of a storage device; a feature determination unit, configured to determine at least one data feature of the data; a strategy determination unit, configured to determine a data diversion strategy for data to be stored based on attribute parameters of the storage device and the at least one data feature; and a diversion storage unit, configured to divert the data to be stored based on the data diversion strategy.
[0020] Optionally, the data acquisition unit may be configured to: acquire the data through a preset filter program loaded into the kernel.
[0021] Optionally, the data acquisition unit may be configured to: in response to determining that the preset filter program loaded into the kernel passes the compliance verification of the kernel, capture data from various data layers of the kernel through the preset filter program; store the captured data in a preset mapping table to obtain the data.
[0022] Optionally, the policy determination unit may be configured to: determine whether the storage device supports single-layer unit flash memory fixed cache based on the attribute parameters; select a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports single-layer unit flash memory fixed cache; and determine the data diversion strategy based on the selected data feature.
[0023] Optionally, the at least one data feature may include at least one of a read / write type distribution of the data, a read ratio of the data, a write ratio of the data, and a write type distribution of the data.
[0024] Optionally, the strategy determination unit may be configured to: when it is determined that the storage device does not support single-layer unit flash memory fixed cache, select the write ratio of the data from the at least one data feature as the data feature for determining the data diversion strategy; and determine the data diversion strategy based on the write ratio of the data.
[0025] Optionally, the strategy determination unit may be configured to: count the write ratio of the data per unit time; determine the comparison result of the minimum value and the threshold value in the write ratio; when the minimum value is greater than or equal to the threshold value, use the first area of the storage area as at least a part of the data diversion strategy; when the minimum value is less than the threshold value, use the second area of the storage area as at least a part of the data diversion strategy, wherein the write speed of the first area is greater than the write speed of the second area.
[0026] Optionally, the diversion storage unit may be configured to: when the first area serves as at least a part of the data diversion strategy, write the data to be stored to the first area; when the second area serves as at least a part of the data diversion strategy, write the data to be stored to the second area.
[0027] Optionally, the strategy determination unit may be configured to: when it is determined that the storage device supports a single-layer unit flash memory fixed cache, select the write type distribution of the data from the at least one data feature as a data feature for determining the data diversion strategy; and determine the data diversion strategy based on the write type distribution of the data.
[0028] Optionally, the strategy determination unit may be configured to: determine a proportion of write types in the data within a predetermined time based on the write type distribution of the data; select a write type whose proportion meets a predetermined condition based on the write type proportion in the data diversion strategy; and use the write type in the data diversion strategy as at least a part of the data diversion strategy.
[0029] Optionally, the diversion storage unit may be configured to: write the data to be stored whose write type is the write type in the data diversion strategy into the first area, and write the data to be stored whose write type is not the write type in the data diversion strategy into the second area.
[0030] Optionally, the diversion storage unit can be configured to: write data whose priority or importance meets the conditions into the first area based on the data diversion strategy, and write data whose priority or importance does not meet the conditions into the second area, wherein the writing speed of the first area is greater than the writing speed of the second area.
[0031] According to an exemplary embodiment of the present disclosure, there is provided a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data storage method according to the exemplary embodiment of the present disclosure is implemented.
[0032] According to an exemplary embodiment of the present disclosure, a computing device is provided, including: at least one processor; and at least one memory storing a computer program, wherein when the computer program is executed by the at least one processor, the data storage method according to the exemplary embodiment of the present disclosure is implemented.
[0033] According to an exemplary embodiment of the present disclosure, a computer program product is provided, and instructions in the computer program product can be executed by a processor of a computer device to implement the data storage method according to the exemplary embodiment of the present disclosure.
[0034] According to the data storage method and device of the exemplary embodiments of the present disclosure, data is obtained from the kernel of the operating system of the storage device to determine at least one data feature of the data, a data diversion strategy for the data to be stored is determined based on the attribute parameters of the storage device and the at least one data feature, and the data to be stored is diverted based on the data diversion strategy, thereby improving the write performance of the storage device, maintaining high performance, reducing the number of data migration times of the storage device, and increasing the life of the storage device.
[0035] Additional aspects and / or advantages of the present general inventive concept will be set forth in part in the following description and in part will be apparent from the description or may be learned through practice of the present general inventive concept. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other objects and features of the exemplary embodiments of the present disclosure will become more apparent through the following description in conjunction with the accompanying drawings which exemplarily illustrate the embodiments, in which:
[0037] Figure 1 A flowchart showing a data storage method according to an exemplary embodiment of the present disclosure;
[0038] Figure 2 A schematic diagram showing the structure of a data storage system according to an exemplary embodiment of the present disclosure is shown;
[0039] Figure 3 A schematic diagram showing write type diversion according to an exemplary embodiment of the present disclosure;
[0040] Figure 4 A schematic diagram showing write ratio splitting according to an exemplary embodiment of the present disclosure;
[0041] Figure 5A block diagram showing a data storage device according to an exemplary embodiment of the present disclosure; and
[0042] Figure 6 A schematic diagram illustrating a computing device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0043] Reference will now be made in detail to exemplary embodiments of the present disclosure, examples of which are shown in the accompanying drawings, wherein like reference numerals refer to like parts throughout. The embodiments will be described below with reference to the drawings in order to explain the present disclosure.
[0044] Figure 1 A flow chart showing a data storage method according to an exemplary embodiment of the present disclosure is shown. Figure 2 A schematic structural diagram of a data storage system according to an exemplary embodiment of the present disclosure is shown.
[0045] Reference Figure 1 , in step S101, data is obtained from the kernel of the operating system of the storage device.
[0046] In an exemplary embodiment of the present disclosure, obtaining data from the kernel of the operating system of the storage device may include: obtaining the data through a preset filter program loaded into the kernel. Here, the preset filter program may be, for example, but not limited to, an extended Berkeley Packet Filter (eBPF) program, so that based on the eBPF technology, the kernel data stream can be obtained without intruding into the kernel of the operating system of the storage device.
[0047] In an exemplary embodiment of the present disclosure, the obtaining of the data through a preset filter program loaded into the kernel may include: in response to determining that the preset filter program loaded into the kernel passes the compliance verification of the kernel, grabbing data from each data layer of the kernel through the preset filter program; storing the grabbed data in a preset mapping table to obtain the data. Here, the data is in a formatted form based on the preset mapping table.
[0048] For example, Figure 2 As shown, the eBPF application is first loaded into the kernel of the operating system of the storage device, and then the kernel calls the Verifier 201 to check whether the eBPF application complies with the specification. After determining that it complies with the specification, the BPF module 202 of the kernel is started, and data information is captured from each data layer of the kernel and stored in the eBPF map. The eBPF map sends the formatted data to the analyzer module 203 in the user state. Figure 2 As shown, the BPF module 202 may include a VFS 2021 , a file system 2022 , a block device layer 2023 , and a device driver 2024 .
[0049] In step S102, at least one data feature of the data is determined.
[0050] In an exemplary embodiment of the present disclosure, the at least one data feature includes at least one of the read and write type distribution of the data, the read ratio of the data, the write ratio of the data, and the write type distribution of the data. In addition, the at least one data feature may also be, for example, a distinguishing feature of foreground process data / background process data. Figure 2 As shown, after the Analyzer 202 receives the formatted data transmitted by the kernel, it can use some algorithmic statistical formulas (for example, but not limited to, summation operations, classification calculations, etc.) to calculate data features, and then store these data features and pass them to the subsequent policy manager 203.
[0051] In step S103, a data diversion strategy for the data to be stored is determined based on the attribute parameters of the storage device and the at least one data feature. Figure 2 After receiving the data features, the policy manager 204 in the storage device will read the attribute parameters of the storage device to select the most suitable policy. In addition, the policy manager 204 selects a suitable data diversion policy in the user state. Here, the attribute parameters can be, for example, but not limited to, the firmware version number.
[0052] In an exemplary embodiment of the present disclosure, determining a data diversion strategy for data to be stored based on the attribute parameters of the storage device and the at least one data feature may include: determining whether the storage device supports a single-layer unit flash memory fixed cache based on the attribute parameters; selecting a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache; and determining the data diversion strategy based on the selected data feature, thereby improving the accuracy of the data diversion strategy.
[0053] In an exemplary embodiment of the present disclosure, selecting a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache may include: when it is determined that the storage device does not support a single-layer unit flash memory fixed cache, selecting the write ratio of the data from the at least one data feature as the data feature for determining the data diversion strategy, thereby improving the accuracy of the data diversion strategy by selecting the data feature. Here, when it is determined that the storage device does not support a single-layer unit flash memory fixed cache, the write ratio of the data is preferentially selected from the at least one data feature as the data feature for determining the data diversion strategy.
[0054] In an exemplary embodiment of the present disclosure, determining the data diversion strategy based on the selected data features may include: determining the data diversion strategy based on the write ratio of the data, thereby improving the accuracy of the data diversion strategy.
[0055] In an exemplary embodiment of the present disclosure, determining the data diversion strategy based on the write ratio of the data may include: counting the write ratio of the data per unit time; determining the comparison result of the minimum value in the write ratio and the threshold; when the minimum value is greater than or equal to the threshold, using the first area of the storage area as at least a part of the data diversion strategy; when the minimum value is less than the threshold, using the second area of the storage area as at least a part of the data diversion strategy, thereby improving the accuracy of the data diversion strategy. Here, the write speed of the first area is greater than the write speed of the second area. For example, in this case, the data diversion strategy may include: when the minimum value in the write ratio per unit time is greater than or equal to the write ratio threshold, writing the data to be stored to the first area (e.g., SLC area); when the minimum value in the write ratio per unit time is less than the write ratio threshold, writing the data to be stored to the second area (e.g., non-SLC area). The non-SLC area is other areas outside the SLC area, for example, a TLC area or a QLC area.
[0056] In an exemplary embodiment of the present disclosure, a data feature for determining the data diversion strategy is selected from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache, including: when it is determined that the storage device supports a single-layer unit flash memory fixed cache, the write type distribution of the data is selected from the at least one data feature as the data feature for determining the data diversion strategy, thereby improving the accuracy of the data diversion strategy by selecting the data feature. Here, when it is determined that the storage device supports a single-layer unit flash memory fixed cache, the write type distribution of the data is preferentially selected from the at least one data feature as the data feature for determining the data diversion strategy.
[0057] In an exemplary embodiment of the present disclosure, determining the data diversion strategy based on the selected data features may include: determining the data diversion strategy based on the write type distribution of the data, thereby improving the accuracy of the data diversion strategy.
[0058] In an exemplary embodiment of the present disclosure, determining the data diversion strategy based on the write type distribution of the data may include: determining the proportion of write types in the data within a predetermined time based on the write type distribution of the data; selecting a write type whose proportion meets a predetermined condition based on the write type proportion in the data diversion strategy; using the write type in the data diversion strategy as at least a part of the data diversion strategy, thereby improving the accuracy of the data diversion strategy. For example, in this case, the data diversion strategy may include: when the write type distribution of the data meets the write type of the predetermined condition, writing the data to be stored to the first area (for example, the SLC fixed cache area); when the write type distribution of the data does not meet the write type of the predetermined condition, writing the data to be stored to the second area (for example, the SLC normal area).
[0059] Figure 3 A schematic diagram illustrating write type diversion according to an exemplary embodiment of the present disclosure.
[0060] like Figure 3 As shown, when the device version supports the single-layer cell flash fixed cache (SLC Pinned buffer) feature, the policy manager 204 can count the proportions of various write types within a period of time (for example, but not limited to, one minute, five minutes, etc.), select the highest proportion of, for example but not limited to, 2 to 3 write types, and send the selected types (for example, types a and b) to the instruction controller 205, and then the instruction controller 205 will send an instruction with the selected type (for example, types a and b) to notify the device driver 2024 of the universal flash storage (UFS) device.
[0061] Figure 4 A schematic diagram showing write ratio splitting according to an exemplary embodiment of the present disclosure.
[0062] like Figure 4 As shown, when the storage device does not support SLC fixed cache, the policy manager 204 can use another algorithm. The policy manager 204 can count, for example but not limited to, the write ratio Wratio of data per second, put Wratio in a queue in order, record the last, for example but not limited to, 5 values in the queue every second, and find the minimum value. Then compare the minimum value with the threshold, and when the minimum value is greater than or equal to the threshold, send the 'A' instruction to the instruction controller 205; when the minimum value is less than the threshold, send the 'B' instruction to the instruction controller 205.
[0063] In addition, when it is determined that the storage device supports a single-layer unit flash memory fixed cache, the data read-write type distribution or the data read ratio can also be selected from the at least one data feature as a data feature for determining the data diversion strategy. For example, in the case of selecting the data read-write type distribution as the data feature for determining the data diversion strategy, when the data read-write type distribution is greater than or equal to the read-write distribution threshold, the data diversion strategy diverts the data to be stored to the SLC fixed cache area; when the data read-write type distribution is less than the read-write distribution threshold, the data diversion strategy diverts the data to be stored to the SLC normal area. In the case of selecting the data read ratio as the data feature for determining the data diversion strategy, when the data read ratio is greater than or equal to the read ratio threshold, the data diversion strategy diverts the data to be stored to the SLC fixed cache area; when the data read ratio is less than the read ratio threshold, the data diversion strategy diverts the data to be stored to the SLC normal area.
[0064] In addition, when it is determined that the storage device supports a single-layer unit flash fixed cache, the data write ratio can be selected from the at least one data feature as a data feature for determining a data diversion strategy. When it is determined that the storage device supports a single-layer unit flash fixed cache, a distinguishing feature of foreground process data / background process data can be selected from the at least one data feature as a data feature for determining a data diversion strategy.
[0065] In addition, when it is determined that the storage device does not support a single-layer unit flash memory fixed cache, the data read-write type distribution or the data read ratio can also be selected from the at least one data feature as a data feature for determining the data diversion strategy. For example, in the case of selecting the data read-write type distribution as the data feature for determining the data diversion strategy, when the data read-write type distribution is greater than or equal to the read-write distribution threshold, the data diversion strategy diverts the data to be stored to the SLC area; when the data read-write type distribution is less than the read-write distribution threshold, the data diversion strategy diverts the data to be stored to the non-SLC area. In the case of selecting the data read ratio as the data feature for determining the data diversion strategy, when the data read ratio is greater than or equal to the read ratio threshold, the data diversion strategy diverts the data to be stored to the SLC area; when the data read ratio is less than the read ratio threshold, the data diversion strategy diverts the data to be stored to the non-SLC area.
[0066] In addition, when it is determined that the storage device does not support single-layer unit flash memory fixed cache, the data write type distribution can also be selected from the at least one data feature as a data feature for determining the data diversion strategy. When it is determined that the storage device does not support single-layer unit flash memory fixed cache, a distinguishing feature of foreground process data / background process data can also be selected from the at least one data feature as a data feature for determining the data diversion strategy.
[0067] In step S104, the data to be stored is diverted based on the data diversion strategy. Figure 2 As shown, after the instruction controller 205 receives the data diversion strategy of the policy manager 204, it sends the corresponding control instruction to the device driver layer to control the writing of the data to be stored into the single-layer cell flash memory (SLC) area or the triple-layer cell flash memory / quadruple-layer cell flash memory (TLC / QLC) area.
[0068] In an exemplary embodiment of the present disclosure, the data to be stored is diverted based on the data diversion strategy, which may include: when the first area is at least a part of the data diversion strategy, the data to be stored is written to the first area; when the second area is at least a part of the data diversion strategy, the data to be stored is written to the second area, so that the write performance of the storage device can be maximized, thereby improving the write performance of the storage device. Figure 4 As shown, when the instruction controller 205 receives the 'A' instruction, it will send the 'write data to SLC area' instruction to the device driver 2024, and the subsequent write type data will enter the SLC area of the universal flash storage (UFS) device; when the instruction controller 205 receives the 'B' instruction, it will send the 'write data to TLC area / QLC area' instruction to the device driver 2024, and the subsequent write type data will enter the TLC area or QLC area of the universal flash storage (UFS) device.
[0069] In an exemplary embodiment of the present disclosure, the data to be stored is diverted based on the data diversion strategy, which may include: writing the data to be stored whose write type is the write type in the data diversion strategy to a first area (for example, an SLC fixed cache area), and writing the data to be stored whose write type is not the write type in the data diversion strategy to a second area (for example, an SLC normal area), so that the write performance of the storage device can be maximized, thereby improving the write performance of the storage device. For example, Figure 3 As shown, after the instruction including the data diversion strategy takes effect, the subsequent selected write type will be determined as a high priority and written to the SLC fixed cache area, and the unselected write type will be written to the SLC normal area.
[0070] In an exemplary embodiment of the present disclosure, diverting the data to be stored based on the data diversion strategy may include: writing data whose priority or importance meets the condition into the first area based on the data diversion strategy, and writing data whose priority or importance does not meet the condition into the second area, so that the writing performance of the storage device can be maximized, thereby improving the writing performance of the storage device. Here, the writing speed of the first area is greater than the writing speed of the second area.
[0071] According to the data storage method of the exemplary embodiment of the present disclosure, high performance can be maintained all the time, the number of data migrations of the storage device can be reduced, and the life of the storage device can be increased.
[0072] In addition, according to the data storage method of the exemplary embodiment of the present disclosure, data can be obtained by a preset filter program loaded into the kernel, so that the kernel data can be obtained without intruding the kernel, thereby improving the portability of the data storage method according to the exemplary embodiment of the present disclosure. In addition, according to the exemplary embodiment of the present disclosure, the load of the operating system of the storage device will not be increased.
[0073] The above has been combined Figures 1 to 4 A data storage method according to an exemplary embodiment of the present disclosure is described. Figure 5 A data storage device and units thereof according to exemplary embodiments of the present disclosure are described.
[0074] Figure 5 A block diagram illustrating a data storage device according to an exemplary embodiment of the present disclosure is shown.
[0075] Reference Figure 5 The data storage device includes a data acquisition unit 51, a feature determination unit 52, a strategy determination unit 53 and a diversion storage unit 54.
[0076] The data acquisition unit 51 is configured to acquire data from the kernel of the operating system of the storage device;
[0077] In an exemplary embodiment of the present disclosure, the data acquisition unit 51 may be configured to acquire the data through a preset filter program loaded into the kernel.
[0078] In an exemplary embodiment of the present disclosure, the data acquisition unit 51 may be configured to: in response to determining that the preset filter program loaded into the kernel has passed the compliance verification of the kernel, capture data from various data layers of the kernel through the preset filter program; store the captured data in a preset mapping table to obtain the data.
[0079] The feature determination unit 52 is configured to determine at least one data feature of the data.
[0080] In an exemplary embodiment of the present disclosure, the at least one data feature may include at least one of a read / write type distribution of the data, a read ratio of the data, a write ratio of the data, and a write type distribution of the data.
[0081] The policy determination unit 53 is configured to determine a data diversion policy for the data to be stored based on the property parameters of the storage device and the at least one data feature.
[0082] In an exemplary embodiment of the present disclosure, the policy determination unit 53 may be configured to: determine whether the storage device supports a single-layer unit flash memory fixed cache based on the attribute parameters; select a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports a single-layer unit flash memory fixed cache; and determine the data diversion strategy based on the selected data feature.
[0083] In an exemplary embodiment of the present disclosure, the policy determination unit 53 may be configured to: when it is determined that the storage device does not support single-layer unit flash memory fixed cache, select the write ratio of the data from the at least one data feature as the data feature for determining the data diversion strategy; and determine the data diversion strategy based on the write ratio of the data.
[0084] In an exemplary embodiment of the present disclosure, the strategy determination unit 53 may be configured to: count the write ratio of the data per unit time; determine the comparison result of the minimum value and the threshold in the write ratio; when the minimum value is greater than or equal to the threshold, use the first area of the storage area as at least a part of the data diversion strategy; when the minimum value is less than the threshold, use the second area of the storage area as at least a part of the data diversion strategy, wherein the write speed of the first area is greater than the write speed of the second area.
[0085] In an exemplary embodiment of the present disclosure, the strategy determination unit 53 may be configured to: when it is determined that the storage device supports a single-layer unit flash memory fixed cache, select the write type distribution of the data from the at least one data feature as a data feature for determining the data diversion strategy; and determine the data diversion strategy based on the write type distribution of the data.
[0086] In an exemplary embodiment of the present disclosure, the strategy determination unit 53 may be configured to: determine the proportion of write types in the data within a predetermined time based on the write type distribution of the data; select a write type whose proportion meets a predetermined condition based on the write type proportion in the data diversion strategy; and use the write type in the data diversion strategy as at least a part of the data diversion strategy.
[0087] The offload storage unit 54 is configured to offload the data to be stored based on the data offload strategy.
[0088] In an exemplary embodiment of the present disclosure, the diversion storage unit 54 may be configured to: when the first area serves as at least a part of the data diversion strategy, write the data to be stored to the first area; when the second area serves as at least a part of the data diversion strategy, write the data to be stored to the second area.
[0089] In an exemplary embodiment of the present disclosure, the diversion storage unit 54 can be configured to: write the to-be-stored data whose write type is the write type in the data diversion strategy to the first area, and write the to-be-stored data whose write type is not the write type in the data diversion strategy to the second area.
[0090] In an exemplary embodiment of the present disclosure, the diversion storage unit 54 may be configured to: based on the data diversion strategy, write data whose priority or importance meets the conditions into the first area, and write data whose priority or importance does not meet the conditions into the second area, wherein the writing speed of the first area is greater than the writing speed of the second area.
[0091] In addition, according to an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium on which a computer program is stored. When the computer program is executed, the data storage method according to the exemplary embodiment of the present disclosure is implemented.
[0092] In an exemplary embodiment of the present disclosure, the computer-readable storage medium may carry one or more programs, and when the computer program is executed, the following steps may be implemented: obtaining data from the kernel of the operating system of the storage device; determining at least one data feature of the data; determining a data diversion strategy for the data to be stored based on the attribute parameters of the storage device and the at least one data feature; and diverting the data to be stored based on the data diversion strategy.
[0093] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a computer program that may be used by or in conjunction with an instruction execution system, device or device. The computer program contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof. The computer-readable storage medium may be contained in any device; it may also exist alone without being assembled into the device.
[0094] In addition, according to an exemplary embodiment of the present disclosure, a computer program product is also provided, and instructions in the computer program product can be executed by a processor of a computer device to complete the data storage method according to the exemplary embodiment of the present disclosure.
[0095] The above has been combined Figure 5 A data storage device according to an exemplary embodiment of the present disclosure is described. Figure 6 A computing device according to an exemplary embodiment of the present disclosure is described.
[0096] Figure 6 A schematic diagram illustrating a computing device according to an exemplary embodiment of the present disclosure.
[0097] Reference Figure 6 According to the exemplary embodiment of the present disclosure, the computing device 6 includes a memory 61 and a processor 62. The memory 61 stores a computer program. When the computer program is executed by the processor 62, the data storage method according to the exemplary embodiment of the present disclosure is implemented.
[0098] In an exemplary embodiment of the present disclosure, when the computer program is executed by the processor 62, the following steps can be implemented: obtaining data from the kernel of the operating system of the storage device; determining at least one data feature of the data; determining a data diversion strategy for the data to be stored based on the attribute parameters of the storage device and the at least one data feature; and diverting the data to be stored based on the data diversion strategy.
[0099] The computing device in the embodiments of the present disclosure may include, but is not limited to, devices such as mobile phones, laptop computers, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, and the like. Figure 6 The computing device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0100] The above has been referred to Figures 1 to 6 The data storage method and apparatus according to the exemplary embodiments of the present disclosure are described. However, it should be understood that: Figure 5 The data storage device and its units shown in the figure may be respectively configured as software, hardware, firmware or any combination of the above items to perform specific functions. Figure 6 The computing device shown in is not limited to including the components shown above, but some components may be added or deleted as needed, and the above components may also be combined.
[0101] According to the data storage method and device of the exemplary embodiments of the present disclosure, data is obtained from the kernel of the operating system of the storage device to determine at least one data feature of the data, a data diversion strategy for the data to be stored is determined based on the attribute parameters of the storage device and the at least one data feature, and the data to be stored is diverted based on the data diversion strategy, thereby improving the write performance of the storage device, maintaining high performance, reducing the number of data migration times of the storage device, and increasing the life of the storage device.
[0102] While the present disclosure has been particularly shown and described with reference to exemplary embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure as defined by the following claims.
Claims
1. A data storage method, comprising: Obtaining data from the kernel of the operating system of the storage device; determining at least one data characteristic of the data; Determine a data diversion strategy for the data to be stored based on the attribute parameters of the storage device and the at least one data feature; The data to be stored is diverted based on the data diversion strategy.
2. The data storage method according to claim 1, wherein: The step of obtaining data from the kernel of the operating system of the storage device includes: The data is acquired through a preset filter program loaded into the kernel.
3. The data storage method according to claim 2, wherein: The obtaining of the data by a preset filter program loaded into the kernel comprises: In response to determining that the preset filter program loaded into the kernel passes the compliance verification of the kernel, fetching data from various data layers of the kernel through the preset filter program; The captured data is stored in a preset mapping table to obtain the data.
4. The data storage method according to claim 1, wherein: The determining of a data diversion strategy for the data to be stored based on the attribute parameters of the storage device and the at least one data feature includes: Determining whether the storage device supports single-level unit flash memory fixed cache based on the attribute parameters; Selecting a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports single-level unit flash memory fixed cache; The data diversion strategy is determined based on the selected data features.
5. The data storage method according to claim 4, wherein: The at least one data feature includes at least one of a read-write type distribution of the data, a read ratio of the data, a write ratio of the data, and a write type distribution of the data.
6. The data storage method according to claim 5, wherein: The selecting a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports single-layer unit flash memory fixed cache includes: When it is determined that the storage device does not support single-layer unit flash memory fixed cache, selecting the write ratio of the data from the at least one data feature as a data feature for determining the data diversion strategy, Wherein, determining the data diversion strategy based on the selected data features includes: The data diversion strategy is determined based on the write ratio of the data.
7. The data storage method according to claim 6, wherein: The determining the data diversion strategy based on the write ratio of the data includes: Counting the writing ratio of the data per unit time; Determine a comparison result between a minimum value in the write ratio and a threshold value; When the minimum value is greater than or equal to the threshold, using the first area of the storage area as at least a part of the data diversion strategy; When the minimum value is less than the threshold value, the second area of the storage area is used as at least a part of the data diversion strategy, The writing speed of the first area is greater than the writing speed of the second area.
8. The data storage method according to claim 7, wherein: The diverting the data to be stored based on the data diversion strategy includes: When the first area serves as at least a part of the data diversion strategy, writing the data to be stored into the first area; When the second area serves as at least a part of the data diversion strategy, the data to be stored is written into the second area.
9. The data storage method according to claim 5, wherein: The selecting a data feature for determining the data diversion strategy from the at least one data feature based on whether the storage device supports single-layer unit flash memory fixed cache includes: When it is determined that the storage device supports a single-layer unit flash memory fixed cache, selecting the write type distribution of the data from the at least one data feature as a data feature for determining the data diversion strategy, Wherein, determining the data diversion strategy based on the selected data features includes: The data diversion strategy is determined based on the write type distribution of the data.
10. The data storage method according to claim 9, wherein: The determining the data diversion strategy based on the write type distribution of the data includes: Determining a write type ratio of the data within a predetermined time based on a write type distribution of the data; Selecting a write type whose proportion meets a predetermined condition based on the write type proportion in the data diversion strategy; The write type in the data diversion strategy is used as at least a part of the data diversion strategy.
11. The data storage method according to claim 10, wherein: The diverting the data to be stored based on the data diversion strategy includes: The data to be stored whose write type is the write type in the data diversion strategy is written into the first area, and the data to be stored whose write type is not the write type in the data diversion strategy is written into the second area.
12. The data storage method according to claim 1, wherein: The diverting the data to be stored based on the data diversion strategy includes: Based on the data diversion strategy, data whose priority or importance meets the conditions is written into the first area, and data whose priority or importance does not meet the conditions is written into the second area, wherein the writing speed of the first area is greater than the writing speed of the second area.
13. A data storage device, comprising: A data acquisition unit, configured to acquire data from a kernel of an operating system of a storage device; a feature determination unit, configured to determine at least one data feature of the data; a strategy determination unit, configured to determine a data diversion strategy for the data to be stored based on the attribute parameters of the storage device and the at least one data feature; and The diversion storage unit is configured to divert the data to be stored based on the data diversion strategy.
14. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the data storage method according to any one of claims 1 to 12 is implemented.
15. A computing device comprising: at least one processor; At least one memory stores a computer program, and when the computer program is executed by the at least one processor, the data storage method according to any one of claims 1 to 12 is implemented.