Data processing method and device, computer readable storage medium and program product

By receiving the host's input and output requests in the storage device and writing data blocks according to the data type, the problem of garbage collection occupies computing resources is solved, achieving more efficient garbage collection and longer equipment service life.

CN119861863APending Publication Date: 2025-04-22GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410630962.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-10-19
Filing Date
2024-05-20
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

When existing storage devices are garbage collected, they occupy too much computing resources, resulting in inefficiency.

Method used

By receiving the input and output request sent by the host, the data block is written according to the data type in the request, and garbage collects it according to the data type of the data block when the preset conditions are met.

Benefits of technology

It reduces the computing resource usage of storage devices, improves the efficiency of garbage collection, reduces the write amplification phenomenon, and extends the service life of storage devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119861863A_ABST
    Figure CN119861863A_ABST
Patent Text Reader

Abstract

The invention relates to a data processing method and device, a computer readable storage medium and a program product. The method comprises the following steps: receiving an input / output request sent by a host; the input and output request comprises a data type of to-be-processed data and is used for indicating to write the to-be-processed data into a data block; and under the condition that the number of the data blocks written with the to-be-processed data meets a preset condition, garbage collection is performed on the data blocks according to the data types written with the data blocks. By adopting the method, the problem that garbage collection occupies too much computing resources of storage equipment can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage, and in particular to a data processing method, device, computer-readable storage medium and program product. Background Art

[0002] For storage devices that use blocks as management units, due to the fact that NAND media cannot be updated in situ, the storage devices need to perform garbage collection to integrate blocks with less valid data to release empty blocks.

[0003] In conventional technology, the data type of the data to be processed is mainly identified by a storage device, and data of different data types are controlled to be stored in different cache areas of the storage device.

[0004] However, the traditional method has the problem of occupying too much computing resources of storage devices. Summary of the invention

[0005] The embodiments of the present application provide a data processing method, apparatus, computer-readable storage medium, and program product, which can solve the problem of excessive garbage collection occupying computing resources of storage devices.

[0006] In a first aspect, an embodiment of the present application provides a data storage method, the data storage method comprising:

[0007] receiving an input / output request sent by a host; the input / output request includes a data type of the data to be processed and is used to instruct writing the data to be processed into a data block;

[0008] When the number of data blocks written with the to-be-processed data meets a preset condition, garbage collection is performed on the data blocks according to the types of data written in the data blocks.

[0009] In a second aspect, an embodiment of the present application provides a data storage device, the device comprising:

[0010] A first receiving module is used to receive an input / output request sent by a host; the input / output request includes a data type of the data to be processed, and is used to instruct to write the data to be processed into a data block;

[0011] The first processing module is used to perform garbage collection on the data blocks according to the data types written in the data blocks when the number of data blocks written with the data to be processed meets a preset condition.

[0012] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0014] In the above-mentioned data processing method, apparatus, computer-readable storage medium and program product, the storage device can obtain the data type of the data to be processed according to the input / output request by receiving the input / output request sent by the host, and write the data to be processed into the data block according to the instruction of the input / output request. Since the data type is determined by the host, it is not necessary to use the storage device to identify the data type of the data to be processed, thereby avoiding the problem of excessive occupation of the computing resources of the storage device and reducing the overhead of the storage device. Therefore, when the number of data blocks written with the data to be processed meets the preset conditions, the data blocks can be garbage collected according to the data type written in the data blocks. Since the storage device writes the data blocks according to the data type of the data to be processed, the storage device can collect the data blocks according to the data type of the data to be processed. Data can be stored in corresponding areas of different data types to be processed, reducing the amount of data to be moved, thereby reducing the number of garbage collections and improving the efficiency of garbage collection. In addition, since the data type is determined by the host, it can avoid the problem of inaccurate data type judgment caused by the storage device judging the degree of hotness and coldness only according to the time or number of read and write operations. Moreover, since the storage device writes data according to the data type of the data to be processed in the input and output requests sent by the host, it can avoid storing the data frequently used by the host in the cache area with low read and write speed only according to the write speed, thereby reducing the deviation between the accelerated data in the storage device and the data to be accelerated in the host, and improving the persistence of data acceleration. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 An application environment diagram of a data processing method in an embodiment;

[0017] Figure 2 is a flow chart of a data processing method in one embodiment;

[0018] Figure 3 A flowchart of data diversion during garbage collection in one embodiment;

[0019] Figure 4 is a flow chart of a data processing method in another embodiment;

[0020] Figure 5a is a schematic diagram of performing garbage collection on a first target data block in one embodiment;

[0021] Figure 5b is a schematic diagram of performing garbage collection on a second target data block in one embodiment;

[0022] Figure 6 is a flow chart of a data processing method in another embodiment;

[0023] Figure 7 is a flow chart of a data processing method in another embodiment;

[0024] Figure 8 is a flow chart of a data processing method in another embodiment;

[0025] Fig. 9 is a schematic diagram of interaction between a host and a storage device in one embodiment;

[0026] Fig.10 is a flow chart of a data processing method in another embodiment;

[0027] Fig.11 is a flow chart of a data processing method in another embodiment;

[0028] Fig.12 is a flow chart of a data processing method in another embodiment;

[0029] Fig.13 is a flow chart of a data processing method in another embodiment;

[0030] Fig.14 is a flow chart of a data processing method in another embodiment;

[0031] Fig.15 is a structural block diagram of a data processing device in one embodiment;

[0032] Fig.16 FIG. 4 is a structural block diagram of a data processing device in another embodiment. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0034] For storage devices that use blocks as management units, such as Universal Flash Storage (UFS) devices, due to the fact that the NAND medium of the storage device cannot update the storage content in situ, the storage device needs to perform garbage collection and integrate blocks with less valid data to release empty blocks. Usually, storage devices use a greedy strategy for garbage collection, that is, the object of garbage collection is determined based on the amount of valid data on the block. However, the garbage collection process needs to ensure that there is no valid data on the block to be recycled. If there is, the valid data needs to be moved to other blocks. Therefore, frequent garbage collection requires frequent data movement, which makes the amount of data written greater than the amount of data moved, causing the problem of write amplification and affecting the service life of the storage device.

[0035] The ideal situation of garbage collection is that all data on a block are overwritten at the same time, and no valid data remains. At this time, garbage collection will not frequently perform garbage collection on the block, reducing the amount of data movement and no longer generating write amplification. Therefore, separating data with different overwriting frequencies can make the overwriting concentrated on the blocks where some hot data (with high overwriting frequency) are located, thereby reducing the number of garbage collections. At present, in order to reduce the write amplification caused by garbage collection of storage devices, hot read data, hot write data, cold read data, and cold write data can be distinguished according to the number of data reads and write times, and each type of data can be stored in the corresponding area, optimizing the internal read interference difference problem of the flash memory and the garbage collection efficiency, thereby improving the read and write performance of the flash memory; or, the hotness of the data can be identified according to the number of data movement, and then stored in different storage spaces according to the different hotness and coldness, thereby reducing the amount of data movement, optimizing the data movement process, quickly completing garbage collection, and reducing the impact on read and write performance; or, the garbage collection of hot data can be delayed by overwriting, so that less data needs to be moved during garbage collection.

[0036] However, since the identification and separation of hot and cold data are relatively complex, the solution for implementing the identification of hot and cold data in the storage device needs to maintain a data structure for recording the number of read and write times or time. This data structure will occupy the computing resources of the storage device and increase the overhead on the device side. Moreover, judging the degree of hot and cold only by the time or number of times the data is read and written may not be able to identify the hot and cold of the data just written, and the accuracy of data type identification is low. In addition, in order to take into account the read and write performance, capacity and cost of the storage device, hot data is usually stored in a single-level cell (SLC) cache area with high read and write speed, high cost and small capacity, and cold data is stored in a triple-level cell (TLC) cache area with low read and write speed, low cost and large capacity. However, in the data acceleration solution, since the accelerated data stored in the SLC is determined by the storage device, there may be data stored in the SLC that is not frequently read and written continuously, resulting in a deviation between the accelerated data and the data that the host needs to accelerate, and efficient read and write performance cannot be guaranteed. Based on the above problems, this application proposes a data processing method to accurately identify hot and cold data without increasing the cost of storage devices, and to perform precise data diversion and persistent data acceleration for hot and cold data.

[0037] The data processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the storage device 102 transmits data with the host 104 through the bus. The storage device 102 can store data received or generated by the host 104, and the storage device 102 can receive a request sent by the host 104 through the bus, and process the stored data according to the received request. The storage device 102 can be a non-volatile storage medium and an internal memory. The host 104 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things device can be a processor in a smart speaker, a smart TV, a smart air conditioner, a smart car device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc.

[0038] In one embodiment, Figure 2 As shown, a data processing method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the storage device in the example:

[0039] S201, receiving an input / output request sent by a host; the input / output request includes the data type of the data to be processed and is used to instruct writing the data to be processed into a data block.

[0040] Among them, the input and output request is generated by the host based on the demand for data storage and sent to the storage device through the bus in the device. Optionally, the host can be a terminal, such as a mobile phone or a smart bracelet. The input and output request can include a universal flash storage protocol information unit write command data packet (Write Command Universal flashstorage Protocol Information Unit, Write Command UPIU), and the UPIU write command data packet includes a group number (Group Number) field for indicating data characteristics, and the group number includes a context ID (Context ID) for indicating the context transmission environment. According to the context ID, the type of data to be processed and the data that needs to be accelerated can be determined. It should be noted that different group number values ​​correspond to different functions. For example, the value of the group number and the corresponding function can be shown in Table 1, and different context ID values ​​correspond to different data types. For example, the value of the context ID and the corresponding data type can be shown in Table 2.

[0041] It should be noted that the host can mark cold data or hot data according to the file type and data type. For example, the data type can be determined by the file extension. Media files such as mp3 and jpg can be marked as cold data, and files such as db and tmp can be marked as hot data. Data can also be marked as cold data or hot data according to the index type. The host can also determine the data that needs to be accelerated based on the acceleration range and requirements of the application layer for the file, and mark this type of data as accelerated data. Optionally, the data type can include hot data, cold data, accelerated data, undefined type data, etc.

[0042] Table 1 Meaning of the group number field

[0043] Group Number Value Function 00000b By default, there are no context values ​​or system data characteristics associated with a write operation. 00001b to 01111b(0XXXXb) Range of context ID values 10000b Data characteristics of system data 10001b to 11111b reserve

[0044] Table 2 Meaning of context ID

[0045] Context ID value Data characteristics 00h Undefined type data 01h Hot Data 02h Cold Data 03h Accelerating data

[0046] In this embodiment, the storage device can receive an input / output request sent by the host through a bus, thereby writing the data to be processed into a data block according to the data type of the data to be processed included in the input / output request. Optionally, the data to be processed of the same data type can be written into the same data block according to the data type, for example, the data to be processed stored in data block A are all cold data; or, the data to be processed can also be randomly written into different data blocks, for example, the data to be processed stored in data block B includes cold data and hot data.

[0047] S202: When the number of data blocks written with the to-be-processed data meets a preset condition, garbage collection is performed on the data blocks according to the types of data written in the data blocks.

[0048] Among them, the data block written with the data to be processed refers to the data block in which the data to be processed has been stored in the storage device. The invalid data in the data block written with the data to be processed is erased, and the valid data is moved to other data blocks to obtain the free data block. The processing process is called garbage collection. It should be noted that in order to ensure the reading speed of the entire storage device, it is usually necessary to retain a part of the free data blocks in the storage device for data relocation to ensure that garbage collection can be carried out normally, or, if there are bad data blocks, they can be replaced with substitute data blocks. Therefore, it is necessary to set preset conditions according to the storage capacity of the storage device to avoid saturation of the storage space in the storage device and affect the storage performance. When the number of data blocks written with the data to be processed meets the preset conditions, it is necessary to perform garbage collection on the data blocks to concentrate the scattered data into some data blocks to obtain new free data blocks.

[0049] In this embodiment, when the number of data blocks written with data to be processed meets the preset conditions, data blocks of the same data type can be moved to the same data block according to the data type written in the data blocks, and garbage collection can be performed on the data blocks. Exemplarily, cold data 1 and hot data are stored in data block A, cold data 2 is stored in data block B, and cold data 3 is contained in data block C. Then both cold data 1 and cold data 3 can be moved to data block B, so that data block A only contains hot data, data block B only contains cold data, and data block C is a free data block. Optionally, in this embodiment, if the number of data blocks written with data to be processed meets the preset conditions during the data writing process, garbage collection can be performed on the data blocks according to the data type written in the data blocks during the data writing process; or, after the data writing process is completed, garbage collection can be performed on the data blocks according to the data type written in the data blocks when the number of data blocks written with data to be processed meets the preset conditions.

[0050] In the above data processing method, the storage device can obtain the data type of the data to be processed according to the input / output request by receiving the input / output request sent by the host, and write the data to be processed into the data block according to the instruction of the input / output request. Since the data type is determined by the host, it is not necessary to use the storage device to identify the data type of the data to be processed, thereby avoiding the problem of excessive occupation of the computing resources of the storage device and reducing the overhead of the storage device. Therefore, when the number of data blocks written with the data to be processed meets the preset conditions, the data blocks can be garbage collected according to the data type written in the data blocks. Since the storage device writes data according to the data type of the data to be processed, different data blocks can be stored in the storage device. The data to be processed of different types is stored in the corresponding area, which reduces the amount of data to be moved, thereby reducing the number of garbage collections and improving the efficiency of garbage collection. In addition, since the data type is determined by the host, it can avoid the storage device judging the degree of hotness and coldness only based on the time or number of read and write operations, resulting in inaccurate data type judgment. Moreover, since the storage device writes data according to the data type of the data to be processed in the input and output requests sent by the host, it can avoid storing the data frequently used by the host in the cache area with low read and write speeds only based on the write speed, thereby reducing the deviation between the accelerated data in the storage device and the data to be accelerated in the host, and improving the persistence of data acceleration.

[0051] In the above scenario of garbage collecting data blocks according to the data types written into the data blocks, the target data blocks to be processed can be first determined according to the data types, and then garbage collecting can be performed on the target data blocks. In one embodiment, the above S202 includes: determining the target data blocks to be processed according to the data types written into the data blocks, and performing garbage collection on each target data block.

[0052] The target data block refers to a data block whose stored data needs to be moved during the garbage collection process. In this embodiment, garbage collection can be performed on the determined target data block. In this embodiment, each data block can be classified according to the data type written in each data block, and each data block can be divided into data blocks containing only the same data type and data blocks containing different data types. The data blocks containing different data types are determined as target data blocks, invalid data in the target data blocks are erased, and valid data in the target data blocks are moved to data blocks storing the same data type to obtain free data blocks, thereby realizing garbage collection.

[0053] It should be noted that the storage device can be divided into a single-level unit cache area and a three-level cache area according to the storage medium, wherein the single-level unit (SLC) cache area has a fast read and write speed, high cost, and small capacity, and the triple-level unit (TLC) cache area has a slow read and write speed, low cost, and large capacity. Therefore, data frequently used by the host can be written into the single-level unit cache area, and data less frequently used by the host can be written into the triple-level unit cache area. In this embodiment, based on the consideration of read and write speed, one optional implementation method is: according to the data type of the data to be processed, the hot data and cold data in the data to be processed are written into the triple-level unit cache area, and the accelerated data in the data to be processed are written into the single-level unit cache area. Exemplarily, if the data to be processed a is hot data, the data to be processed b is cold data, and the data to be processed c is accelerated data, then the data to be processed a and the data to be processed b can be written into the data block of the triple-level unit cache area, and the data to be processed c can be written into the data block of the single-level unit cache area.

[0054] In this embodiment, a data block that stores both hot data and cold data in a three-layer unit cache area can be identified as a target data block, invalid data in the target data block can be erased, and valid data in the target data block can be concentrated into a data block that stores the same data type in a single-layer unit cache area, and data diversion is performed on the data to be processed to obtain a free data block to achieve garbage collection.

[0055] It is understandable that in order to take into account the read and write performance, cost and capacity of the storage device, and to make the three-layer unit cache area close to the performance of the single-layer unit cache area to a certain extent, the storage mode of some areas in the three-layer unit cache area can be switched to the storage mode of the single-layer unit cache area, so as to obtain a single-layer unit cache area of ​​dynamic size, wherein the single-layer unit cache area can include two areas: the single-layer unit cache area and the single-layer unit cache data block in the three-layer unit cache area. In this mode, when the device is idle, hot data can be moved to the single-layer unit cache data block in the three-layer unit cache area, and cold data can be moved to the three-layer unit cache area regularly, and when writing accelerated data, when the single-layer unit cache area is full, the accelerated data is written to the single-layer unit cache data block in the three-layer unit cache area, thereby achieving the maximum performance of the storage device while ensuring the technical effect of the minimum possible data loss.

[0056] In this embodiment, a data block storing to-be-processed data of different data types in a three-layer unit cache area can be determined as a target data block. Optionally, if the target data block stores both hot data and acceleration data, the valid acceleration data and the valid hot data can be respectively moved to a single-layer unit cache data block in the three-layer unit cache area storing the same data type; or, if the target data block stores both hot data and cold data, the valid hot data can be moved to a single-layer unit cache data block in the three-layer unit cache area storing the same data type, and the valid cold data can be moved to other data blocks in the three-layer unit cache area storing the same data type, and data diversion is performed on the data to be processed to obtain free data blocks to achieve garbage collection.

[0057] Exemplarily, when garbage collection is performed on data in a target data block storing mixed data, the process of data diversion for different data types may be as follows: Figure 3 As shown, Figure 3 In the embodiment, the target data block may be a data block containing hot data and cold data, or the target data block may be a data block containing hot data and accelerated data, or the target data block may be a data block containing cold data and accelerated data, or the target data block may be a data block containing hot data, cold data and accelerated data. Optionally, if the write boost function is enabled in the storage device, the cold data and hot data in the target data block may be moved to free data blocks in the three-layer unit cache area, and the accelerated data in the target data block may be moved to a single-layer unit cache area or a free single-layer unit cache data block in the three-layer unit cache area; if the write boost function is disabled in the storage device, the cold data in the target data block may be moved to a free data block in the three-layer unit cache area, the hot data in the target data block may be moved to a free single-layer unit cache data block in the three-layer unit cache area, and the accelerated data in the target data block may be moved to a single-layer unit cache area or a free single-layer unit cache data block in the three-layer unit cache area.

[0058] In this embodiment, by determining the target data block to be processed according to the data type written in the data block, the target data block can be quickly and accurately determined according to the data type, so that the valid data in each target data block is moved to the data block storing the same data type, and garbage collection is performed on each target data block, thereby improving the efficiency and accuracy of garbage collection.

[0059] It should be noted that the storage device can determine different target data blocks according to different data types, so as to perform garbage collection on different target data blocks respectively. Figure 4As shown, the above-mentioned “determining the target data block to be processed according to the data type written in the data block, and performing garbage collection on each target data block” includes:

[0060] S301, determining a first target data block according to the data type written in the data block, and performing garbage collection on the first target data block; the first target data block includes a mixed data block with hot data written and / or a mixed data block with cold data written.

[0061] Among them, the first target data block refers to a mixed data block with hot data written and / or a mixed data block with cold data written. In this embodiment, according to the data type of the data to be processed stored in each data block, the mixed data block with hot data written and / or the mixed data block with cold data written can be determined as the first target data block, so as to perform garbage collection on the first target data block, erase invalid data, and move valid data.

[0062] It is understandable that hot data and cold data are determined based on the number of times the host reads the data, the reading time, and the file type. Hot data may not be continuously read and written after processing is completed, and cold data may be frequently read in subsequent processing. Therefore, there is no restriction on the order of garbage collection of hot data and cold data. In the above scenario of garbage collection of the first target data block, hot data can be garbage collected first, and then cold data can be garbage collected, or cold data can be garbage collected first, and then hot data can be garbage collected. The following introduces the garbage collection of the first target data block by the storage device in S301.

[0063] The above S301 may include:

[0064] S3011, determining a first target data block according to the data type written into the data block;

[0065] S3012, performing garbage collection on the first target data block.

[0066] In a possible implementation, when the first target data block includes a mixed data block with hot data written and a mixed data block with cold data written, the storage device first performs garbage collection on the mixed data block with hot data written, and then performs garbage collection on the mixed data block with cold data written.

[0067] When garbage collection is performed on hot data first and then on cold data, the hot data in the mixed data block including the hot data can be first written into a free data block or into a data block that only stores hot data, and then the cold data in the mixed data block including the cold data can be written into a free data block or into a data block that only stores cold data, thereby realizing garbage collection of the first target data block.

[0068] In another possible implementation, when the first target data block includes a mixed data block with hot data written and a mixed data block with cold data written, the storage device first performs garbage collection on the mixed data block with cold data written, and then performs garbage collection on the mixed data block with hot data written.

[0069] When garbage collection is performed on cold data first and then on hot data, the cold data in the mixed data block including the cold data can be first written into a free data block or into a data block that only stores cold data, and then the hot data in the mixed data block including the hot data can be written into a free data block or into a data block that only stores hot data, thereby realizing garbage collection of the first target data block.

[0070] S302, determining a second target data block according to the data type stored in the data block, and performing garbage collection on the second target data block; the second target data block includes a mixed data block with acceleration data written therein.

[0071] The second target data block is a mixed data block including acceleration data. In this embodiment, the mixed data block including acceleration data can be determined as the second target data block according to the data type of the to-be-processed data stored in each data block, so as to perform garbage collection in the second target data block, erase invalid data, and move valid data.

[0072] The above S302 may include:

[0073] S3021, determining a first target data block according to the data type written into the data block;

[0074] S3022: Perform garbage collection on the first target data block.

[0075] In this embodiment, according to the data type written in the data block, a mixed data block including hot data and / or a mixed data block including cold data can be determined as the first target data block, and garbage collection is performed on the first target data block. According to the data type stored in the data block, a mixed data block including acceleration data can be determined as the second target data block, and garbage collection is performed on the second target data block. Since the first target data block and the second target data block can be determined respectively according to the data type of the data block, the second target data block can be garbage collected after the first target data block is garbage collected, which ensures that there are more free data blocks when garbage collection is performed on the acceleration data, so that the acceleration data can be permanently maintained in the storage area with higher read and write speeds, thereby reducing write amplification and improving read and write performance.

[0076] The above mentioned the process of the storage device performing garbage collection on the first target data block and the process of performing garbage collection on the second target data block. The following describes in detail the specific process of the storage device performing garbage collection on the first target data block and the second target data block. Figure 5a As shown, the process of performing garbage collection on the first target data block in S3012 may include:

[0077] S401 , when garbage collection is performed on a mixed data block including hot data, hot data in the mixed data block including hot data is written into a new first data block.

[0078] The first data block is a data block storing hot data. Optionally, the first data block may be a free data block, or the first data block may be a data block that has stored hot data and only stores hot data. In the embodiment of the present application, the free data block refers to a data block that does not store any data. It is understandable that if the host does not require accelerated processing of hot data, the first data block may be a data block in a three-layer unit cache area in the storage device.

[0079] Exemplarily, a mixed data block with hot data can be selected as a target data block. During garbage collection of the target data block, invalid data in the target data block is erased, and valid data in the target data block is moved to the first data block. Each target data block is then processed in turn, so that all hot data in the mixed data block is transferred to the first data block that only stores hot data.

[0080] S402 , when garbage collection is performed on a mixed data block including cold data, the cold data in the mixed data block including cold data is written into a new second data block.

[0081] The second data block is a data block storing cold data. Optionally, the second data block may be a free data block, or the second data block may be a data block that has stored cold data and only stores cold data. It is understandable that if the host does not require accelerated processing of cold data, the second data block may be a data block in a three-layer unit cache area in the storage device.

[0082] Exemplarily, a mixed data block with cold data can be selected as a target data block. During garbage collection of the target data block, invalid data in the target data block is erased, and valid data in the target data block is moved to a second data block. Each target data block is processed in turn, so that all cold data in the mixed data block is transferred to a second data block that only stores cold data.

[0083] It should be noted that the maximum number of erase times for each data block is basically the same. In order to ensure that the number of erase times for all data blocks is basically the same, the wear leveling algorithm can be used to evenly distribute the erase operations among the data blocks. Therefore, in order to achieve the effect of wear leveling, cold data can be placed in data blocks with many erase times, and hot data can be placed in data blocks with few erase times. This will make the data blocks where cold data are located have a low replication frequency and a slower increase in the number of erase times, while the data blocks where hot data are located have a high replication frequency and a faster increase in the number of erase times. This will achieve the effect of dynamic wear leveling and reduce the number of active wear leveling operations.

[0084] like Figure 5b As shown, the process of performing garbage collection on the second target data block in the above S3022 may include: S403, when performing garbage collection on the second target data block, writing the acceleration data in the mixed data block including the acceleration data into a new third data block, wherein, when the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, the third data block is a data block stored in the three-layer unit cache area.

[0085] Among them, the third data block is a data block for storing acceleration data. Optionally, the third data block can be a free data block, or the third data block can also be a data block that has stored acceleration data and only stores acceleration data. It can be understood that when the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, the third data block is a data block stored in the three-layer unit cache area; when the remaining storage capacity of the single-layer unit cache area is greater than or equal to the first capacity threshold, the third data block is a data block stored in the single-layer unit cache area. Among them, the first capacity threshold is the maximum value of the free capacity in the single-layer unit cache area that can normally process data read and write requests. For example, if the total capacity of the single-layer unit cache area is 100G, the first capacity threshold can be 10G.

[0086] It should be noted that the single-layer unit cache area is a cache area with high read and write speed, high cost and small capacity, and the three-layer unit cache area is a cache area with low read and write speed, low cost and large capacity. The storage capacity occupied by the same data stored in the single-layer unit cache area and the three-layer unit cache area is different. For example, the byte size of data A is 1G. If data A is stored in the single-layer unit cache area, it will occupy 3G of storage space. If data A is stored in the three-layer unit cache area, it will occupy 1G of storage space.

[0087] It is understandable that in the process of garbage collection of data by the storage device, since each data block may store data of multiple data types, it is necessary to transfer data of different data types to the free data block first, and then store data of the same data type in the free data block. Therefore, a large number of data blocks will be temporarily occupied, resulting in a reduction in the available storage space of the storage device. If the storage space in the storage device is completely filled, it may cause data errors, system crashes and other problems. In order to increase the available storage space of the storage device, the storage device will transfer the data stored in the single-layer unit cache area to the three-layer unit cache area when the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold. Therefore, when the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, the third data block is a data block stored in the three-layer unit cache area.

[0088] Optionally, in this embodiment, the storage device may first select a mixed data block with acceleration data as a target data block. During garbage collection of the target data block, if the remaining storage capacity of the single-layer unit cache area is greater than or equal to the first capacity threshold, the storage device may erase the invalid data in the target data block, and move the valid data in the target data block to the third data block in the single-layer unit cache area, and process each target data block in turn, thereby transferring all the acceleration data in the mixed data block to the third data block that only stores the acceleration data; if the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, the storage device may erase the invalid data in the target data block, and move the valid data in the target data block to the third data block in the three-layer unit cache area, and process each target data block in turn, thereby transferring all the acceleration data in the mixed data block to the third data block that only stores the acceleration data.

[0089] In this embodiment, the storage device can write the hot data in the mixed data block including hot data into a new first data block when garbage collection is performed on the mixed data block including hot data, write the cold data in the mixed data block including cold data into a new second data block when garbage collection is performed on the mixed data block including cold data, and write the accelerated data in the mixed data block including accelerated data into a new third data block when garbage collection is performed on the second target data block. The hot data, cold data and accelerated data in the mixed data block can be written into data blocks of a single data type respectively, so that the data can be diverted, and when there is invalid data in the data block that needs to be garbage collected, the reading and writing of the data is reduced, thereby reducing the write amplification caused by garbage collection and extending the service life of the storage device. Furthermore, when the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, the storage device writes the accelerated data into the third data block in the three-layer unit cache area, thereby avoiding the problem that the storage space of the storage device is insufficient due to the acceleration data occupying too much storage capacity of the single-layer unit cache area, thereby affecting the normal use of the storage device.

[0090] It should be noted that after the storage device transfers the acceleration data from the data block in the single-layer unit cache area to the data block in the three-layer unit cache area, the information of the data type corresponding to the acceleration data will also be deleted. However, when the host deletes the data in the storage device and the available storage space of the storage device increases, the storage device cannot recognize the acceleration data in the data block transferred to the three-layer unit cache area, resulting in the storage device being unable to rewrite this part of the data into the data block in the single-layer unit cache area. Therefore, the data processing method of the embodiment of the present application also provides a method for rewriting the acceleration data transferred from the single-layer unit cache area to the three-layer unit cache area into the single-layer unit cache area, and the method is described in detail below. In one embodiment, Figure 6 As shown, the above method also includes:

[0091] S501, receiving a write instruction sent by a host; the write instruction is used to instruct to transfer the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area.

[0092] Wherein, the write instruction is generated by the host and sent to the storage device, and is used to instruct the storage device to rewrite the acceleration data flushed to the three-layer unit cache area to the single-layer unit cache area. Exemplarily, when the storage device is UFS, the write instruction can be a UPIU of the data and information transmission unit specified in the UFS protocol, wherein the UPIU includes a group number field, and the group number field includes a context ID, wherein the value of the group number field corresponds to different functions, and the value of the context ID corresponds to the data type of the data, for example, if the value of the group number field is 10000b, it indicates that the data has the data characteristics of system data, and if the context ID is 03h, it indicates that the data type of the data is acceleration data.

[0093] Optionally, the write instruction may include the acceleration data to be rewritten into the single-layer unit cache area and the corresponding data type; or, the write instruction may also include the identifier and data type of the acceleration data to be rewritten into the single-layer unit cache area.

[0094] In this embodiment, the storage device can receive a write instruction sent by the host through the system bus, then parse the write instruction, and transfer the accelerated data stored in the data block in the three-layer unit cache area to the data block in the single-layer unit cache area according to the parsing result.

[0095] S502, in response to a write instruction, transferring the accelerated data in the data block stored in the three-level unit cache area to the data block in the single-level unit cache area.

[0096] In this embodiment, the storage device's response process to the write instruction may include: first parsing the write instruction, and then performing corresponding operations according to the content of the parsed write instruction. Optionally, if the write instruction includes the acceleration data to be rewritten in the single-layer unit cache area and the corresponding data type, the storage device may determine that the part of the acceleration data is the data that needs to be accelerated according to the data type, and then write the part of the acceleration data into the data block in the single-layer unit cache area; if the write instruction includes the identifier and data type of the acceleration data to be rewritten in the single-layer unit cache area, the storage device may identify the part of the acceleration data from the data block in the three-layer unit cache area according to the identifier, and write the part of the data into the data block in the single-layer unit cache area.

[0097] In this embodiment, the storage device receives a write instruction sent by the host. Since the write instruction is used to instruct the accelerated data in the data block stored in the three-layer unit cache area to be transferred to the data block in the single-layer unit cache area, the storage device can transfer the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area in response to the write instruction, so that the accelerated data that was flushed into the three-layer unit cache area due to insufficient remaining storage capacity can be re-written into the single-layer unit cache area, so that this part of the accelerated data can regain the effect of data acceleration, and further, when the remaining storage capacity of the storage device is small, the acceleration function can still be provided for the accelerated data, thereby improving the controllability of the accelerated data.

[0098] In the above scenario where the storage device receives a write instruction sent by the host, the host needs to first sense the acceleration data in the storage device that is flushed to the three-layer unit cache area before generating a write instruction for the acceleration data and sending the write instruction to the storage device. Figure 7 As shown, the above method also includes:

[0099] S601, receiving an acquisition instruction sent by the host; the acquisition instruction is used to obtain the first logical block address of the acceleration data in the data block stored in the single-layer unit cache area, and the acquisition instruction is generated by the host when it determines that the remaining storage capacity of the single-layer unit cache area is greater than the second capacity threshold.

[0100] The acquisition instruction refers to the host obtaining the logical block address of the acceleration data in the data block that is still in the single-layer unit cache area at the current moment from the storage device, and using the logical block address of this part of the acceleration data as the first logical block address.

[0101] It should be noted that the storage device can respond to the acquisition instruction sent by the host only when there is enough free space in the storage device. Therefore, as an optional implementation, the host can determine that the remaining storage capacity of the single-layer unit cache area is greater than the second capacity threshold when the data in the storage device is deleted so that the free space in the storage device increases, and then generate an acquisition instruction and send the acquisition instruction to the storage device. The second capacity threshold refers to the minimum value of the remaining storage capacity of the single-layer unit cache area in the storage device.

[0102] In this embodiment, the storage device can receive an acquisition instruction sent by the host through the system bus, and then parse the acquisition instruction, obtain the physical address of the acceleration data in the single-layer unit cache area at the current moment according to the parsing result, and then determine the logical block address of this part of the acceleration data according to the mapping relationship between the pre-recorded physical address and the logical block address, so that the logical block address of this part of the acceleration data can be sent to the host through the system bus.

[0103] It can be understood that the storage space required by the storage device to respond to the write instruction is greater than the storage space required to respond to the get instruction. When the remaining storage capacity is greater than the second capacity threshold, the storage device can respond to the get instruction. When the remaining storage capacity is less than the first capacity threshold, the storage device cannot respond to the data read and write instructions. Therefore, the second capacity threshold can be less than the first capacity threshold. For example, if the first capacity threshold is 10G, the second capacity threshold can be 5G.

[0104] S602, in response to the acquisition instruction, sending a first logical block address to the host; the first logical block address is used by the host to generate a write instruction based on the first logical block address and the second logical block address, and the second logical block address includes the logical block addresses of all accelerated data in the data blocks pre-stored in the single-layer unit cache area.

[0105] The second logic block address refers to the logic block address of all acceleration data stored in the single-layer unit cache area before the storage device flushes the acceleration data from the single-layer unit cache area to the three-layer unit cache area.

[0106] In this embodiment, the process of the storage device responding to and acquiring instructions may include: first parsing the acquisition instruction, then acquiring the physical address of the acceleration data in the single-layer unit cache at the current moment according to the parsing result, and then sending the logical block address of this part of the acceleration data to the host through the system bus according to the mapping relationship between the pre-recorded physical address and the logical block address, so that the host can calculate the complement of the first logical block address according to the second logical block address. Further, the host can determine the logical address of the acceleration data in the complement as the logical block address of the acceleration data flushed from the single-layer unit cache to the three-layer unit cache by the storage device, and then acquire this part of the acceleration data from the storage device according to the logical block address in the complement, and generate a write instruction according to this part of the acceleration data and the acceleration data type; or, the host can also determine the corresponding acceleration data according to the logical block address in the complement, and generate a write instruction according to the identifier of this part of the acceleration data and the acceleration data type.

[0107] It should be noted that the byte size of each acceleration data is different, and the storage space occupied in the storage device may be the same or different. Therefore, the first logical block address corresponding to each acceleration data may include a logical block address and an address length to indicate all storage units occupied by the acceleration data in the storage device. For example, if the acceleration data A is 4 bytes, the acceleration data A needs to occupy four storage units, and the corresponding address range of the logical block address is 0000-0003. Optionally, if the address length corresponding to each logical block address is different, the format of the first logical block address can be: logical block address + address length; or, if the address length corresponding to each logical block address is the same, the format of the first logical block address can also be: logical block address. Exemplarily, the first logical block address can be as shown in Table 3, where [LBA0, LBA0+length 0] indicates that the data within this range are all acceleration data belonging to LBA0.

[0108] Table 3 First logical block address

[0109] First Logical Block Address (LBA) Address length Address range <![CDATA[LBA0]]> Length 0 <![CDATA[[LBA0, LBA0 + length0]]]> <![CDATA[LBA1]]> Length 1 <![CDATA[[LBA1, LBA1 + length 2]]]> <![CDATA[LBA2]]> Length 2 <![CDATA[[LBA2, LBA2 + Length 2]]]> … … … <![CDATA[LBA n ]]> Length n <![CDATA[[LBA n , LBA n +length n]]]>

[0110] It is understandable that the remaining storage capacity in the storage device will continue to change. Therefore, after obtaining the first logical block address, the host can periodically resend the acquisition instruction to the storage device after waiting for a preset period of time to obtain the latest remaining storage capacity of the storage device. As a possible implementation, if the storage device has sent the first logical block address of all accelerated data in the single-layer unit cache area to the host, when the host sends the acquisition instruction to the storage device again, the storage device will return an acquisition error response message to the host.

[0111] In this embodiment, the storage device receives an acquisition instruction sent by the host. Since the acquisition instruction is used to obtain the first logical block address of the acceleration data in the data block stored in the single-layer unit cache area, the storage device can send the first logical block address to the host in response to the acquisition instruction, so that the host can generate a write instruction based on the first logical block address and the second logical block address of all acceleration data in the data block pre-stored in the single-layer unit cache area recorded in the host. Then, the storage device can receive the write instruction sent by the host and transfer the acceleration data in the data block stored in the three-layer unit cache area to the single-layer unit cache area according to the instruction of the write instruction. in the data block; in addition, since the acquisition instruction is generated by the host when it is determined that the remaining storage capacity of the single-layer unit cache area is greater than the second capacity threshold, the problem of being unable to respond to the instruction due to insufficient remaining storage capacity of the storage device will not occur, which further improves the reliability of the storage device sending the first logical block address to the host, thereby improving the reliability of the host generating write instructions according to the first logical block address and the second logical block address, and further can improve the reliability of the host sending write instructions to the storage device, so that the storage device can transfer the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area according to the write instruction.

[0112] It is understandable that if the storage space of the storage device is full, it cannot respond to the instruction sent by the host. Therefore, the host can send the above acquisition instruction to the host to obtain the first logical block address of the acceleration data in the data block stored in the single-layer unit cache area when the available space in the storage device is restored. Before receiving the acquisition instruction sent by the host, Figure 8 As shown, the above method also includes:

[0113] S701, receiving a capacity query instruction sent by a host; the capacity query instruction is used to query the remaining storage capacity of a single-layer unit cache area; the capacity query instruction is sent by the host when it is determined that the remaining storage capacity is less than a first capacity threshold.

[0114] It should be noted that in the protocol of the storage device, when the storage device senses that its own available space is insufficient, that is, the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, it can synchronize information that the remaining storage capacity is less than the first capacity threshold to the host, so that the host can sense that the storage space of the storage device is full, and the storage device flushes the acceleration data originally stored in the single-layer unit cache area to the three-layer unit cache area, and the host can perform the operation of rewriting this part of the acceleration data into the single-layer unit cache area. Therefore, after receiving the information that the storage space is full synchronized by the storage device, the host can send a capacity query instruction to the host to obtain the remaining storage capacity of the single-layer unit cache area.

[0115] It is understandable that if the remaining storage capacity is less than the second capacity threshold, the storage device cannot respond to the acquisition instruction sent by the host, and the storage device will increase the resource consumption of the storage device due to receiving the acquisition instruction. Therefore, before generating the acquisition instruction, the host can send a capacity query instruction to the storage device. Among them, the capacity query instruction is an instruction sent by the host to the storage device in order to query the remaining storage capacity of the single-layer unit cache area of ​​the storage device that can store accelerated data at the current moment.

[0116] In this embodiment, the storage device can receive a capacity query instruction sent by the host through the system bus, then parse the capacity query instruction, and obtain the remaining storage capacity of the single-layer unit cache area according to the parsing result, so as to send the remaining storage capacity to the host.

[0117] S702, in response to the capacity query instruction, sending the remaining storage capacity to the host; the remaining storage capacity is used by the host to generate an acquisition instruction when it is determined that the remaining storage capacity is greater than a second capacity threshold.

[0118] Because the host needs to determine whether the available space of the storage device can respond to the acquisition instruction before generating the acquisition instruction, the host can determine whether the storage capacity is greater than the second capacity threshold based on the remaining storage capacity of the queried storage device, and generate the acquisition instruction again if it is determined that the remaining storage capacity is greater than the second capacity threshold.

[0119] In this embodiment, the process of the storage device responding to the capacity query instruction of the host may include: parsing the received capacity query instruction, and then sending the remaining storage capacity of the single-layer unit cache area at the current moment to the host through the system bus according to the parsing result; or, sending the storage capacity of the single-layer unit cache area and the percentage of available space to the host according to the parsing result. After receiving the storage capacity of the single-layer unit cache area and the percentage of available space, the host can use the product of the storage capacity of the single-layer unit cache area and the percentage of available space as the remaining storage capacity of the single-layer unit cache area, so that the host can generate an acquisition instruction when it is determined that the remaining storage capacity is greater than the second capacity threshold.

[0120] In this embodiment, the storage device receives a capacity query instruction sent by the host. Since the capacity query instruction is used to query the remaining storage capacity of the single-layer unit cache area, the storage device can send the remaining storage capacity to the host by responding to the capacity query instruction, so that the host can send an acquisition instruction to the storage device when the remaining storage capacity meets the response condition of the acquisition instruction, thereby avoiding the problem that the storage device cannot respond to the acquisition instruction due to insufficient remaining storage capacity, thereby causing the host to be unable to obtain the first logical block address; in addition, the capacity query instruction is sent by the host when it is determined that the remaining storage capacity is less than the first capacity threshold. Since the storage device will flush the acceleration data in the single-layer unit cache area to the three-layer unit cache area when the remaining storage capacity is less than the first capacity threshold, the host sends the capacity query instruction to the storage device when it is determined that the remaining storage capacity is less than the first capacity threshold, which can avoid the problem that the host sends multiple capacity query instructions to the storage device to consume the computing resources of the storage device.

[0121] In one embodiment, in combination Fig. 9 The interaction process shown describes the interaction flow and content between the host and the storage device when the storage device transfers the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area.

[0122] S1, when the remaining storage capacity of the single-layer unit cache area is less than a first capacity threshold, the storage device sends the remaining storage capacity of the single-layer unit cache area to the host.

[0123] S2: The host sends a capacity query command to the storage device.

[0124] S3, the storage device sends the remaining storage capacity of the current single-layer unit cache area to the host in response to the capacity query instruction.

[0125] S4, the host generates an acquisition instruction when determining that the remaining storage capacity of the single-layer unit cache area is greater than the second capacity threshold, and sends the acquisition instruction to the storage device.

[0126] S5, the storage device sends the first logical block address of the acceleration data in the data block in the single-level unit cache area to the host in response to the acquisition instruction.

[0127] S6, the host determines the logical block address of the acceleration data flushed from the single-layer unit cache area to the three-layer unit cache area by the storage device based on the first logical block address and the second logical block address of all acceleration data in the data block pre-stored in the single-layer unit cache area.

[0128] S7, the host reads the acceleration data from the host according to the logical block address of the acceleration data flushed from the single-layer unit cache area to the three-layer unit cache area of ​​the storage device, generates a write instruction according to the acceleration data and the data type carrying the acceleration data, and sends the write instruction to the storage device.

[0129] S8, the host periodically generates new acquisition instructions and new write instructions, and sends the new acquisition instructions and new write instructions to the storage device.

[0130] S9: If the storage device has sent the first logical block address of all the acceleration data in the single-layer unit cache area to the host, a response message of an acquisition error is returned to the host.

[0131] In the above case where the number of data blocks written with the data to be processed meets the preset condition, in the scenario where the data blocks are garbage collected according to the data type written in the data blocks, it can be determined whether the preset condition is met according to the number of data blocks written with the data to be processed and the number of free data blocks. Fig.10 As shown, the above method also includes:

[0132] S1001: When the number of data blocks is greater than a preset first threshold, determine whether the number of free data blocks is greater than a preset second threshold according to the number of data blocks.

[0133] Among them, the preset first threshold is the maximum value of the data block in which data has been stored in the storage device, and the second threshold refers to the minimum value of the data block in which the data to be processed is not stored in the storage device. It should be noted that due to the different types of data and storage time required to be stored in the storage device, the stored data is scattered on different data blocks. Therefore, there may be a situation in which the free data blocks in the storage device are completely occupied, resulting in no free data blocks during data migration, and garbage collection cannot be performed, making the entire storage device only readable but not writable. Therefore, it is necessary to set preset conditions according to the capacity of the storage device, and perform garbage collection in a timely manner when the number of data blocks meets the preset conditions.

[0134] In this embodiment, the number of data blocks can be compared with a first threshold. If the comparison result indicates that the number of data blocks is greater than the preset first threshold, it means that the number of data blocks that have stored data has exceeded the normal threshold. Furthermore, it is necessary to determine the number of free data blocks based on the capacity of the storage device and the number of data blocks, and compare the number of free data blocks with a second threshold. According to the comparison result, it is determined whether the number of free data blocks is greater than the second threshold. If the number of free data blocks is greater than the second threshold, it means that the number of free data blocks in the storage device is large, which will not affect the data movement of the storage device during the garbage collection process.

[0135] As an optional implementation, if the number of free data blocks is greater than the second threshold, garbage collection is performed on the data blocks according to a greedy strategy.

[0136] The greedy strategy refers to garbage collection based on the amount of valid data in the data block. In this implementation, if the number of free data blocks is greater than the second threshold, the target data block for garbage collection can be determined based on the amount of valid data on the data block, and the valid data on the target data block can be moved to the free data block, thereby performing garbage collection on the data block and concentrating data of the same data type into the same data block.

[0137] S1002: If the number of free data blocks is less than or equal to a second threshold, determine that the number of data blocks meets a preset condition.

[0138] In this embodiment, if the number of free data blocks is less than or equal to the second threshold, it means that the number of free data blocks is small, which may affect the data movement of the storage device during the garbage collection process, and garbage collection needs to be performed in time to collect data of the same data type into the same data block to obtain more free data blocks. Therefore, if the number of free data blocks is less than or equal to the second threshold, it can be determined that the number of data blocks meets the preset condition.

[0139] In this embodiment, when the number of data blocks is greater than a preset first threshold, it is possible to determine whether the number of free data blocks is greater than a preset second threshold based on the number of data blocks, so that when the number of free data blocks is less than or equal to the second threshold, it is possible to determine that the number of data blocks meets the preset conditions. Since the preset conditions are determined based on the preset first threshold and the second threshold, the accuracy of the preset conditions can be improved, and then the accuracy of determining whether to perform garbage collection based on the preset conditions can be improved, thereby reducing the number of garbage collection times and improving the utilization rate of the storage device.

[0140] It is understandable that before the storage device receives the input / output request sent by the host, it is necessary to first establish a data transmission channel between the storage device and the host. The specific content of establishing the data transmission channel between the storage device and the host is described in detail below. In one embodiment, Fig.11 As shown, the above method also includes:

[0141] S1101, receiving a first query instruction sent by a host.

[0142] Among them, the first query instruction is a query instruction for the host to query whether the storage device supports the function of data acceleration, and the relevant information of accelerating the data processing. The first query instruction may include the descriptor, attribute, and identifier of the storage device. In this embodiment, the storage device can receive the first query instruction sent by the host through the bus. Optionally, the first query instruction can be sent to the storage device by the host regularly, or it can be sent to the storage device when the host needs to process the data to be processed.

[0143] S1102, in response to the first query instruction, sending a first response message to the host; the first response message includes a device descriptor of the storage device; the device descriptor includes a bit for indicating whether the storage device supports a data acceleration function.

[0144] Among them, the first response message is a message that the storage device replies to the host with its own information based on the first query instruction, wherein the device descriptor is an identifier used to indicate the device status of the storage device. The 30th bit in the 0x4F area of ​​the device descriptor can be used to indicate whether the storage device supports the data acceleration function, for example, [bit30]: DataSeparation.

[0145] In this embodiment, the storage device can respond to the first query instruction, use bit30 in the device identifier to indicate whether the data acceleration function is supported, and use bit30 as a message to send a first response message to the host. Optionally, if the value corresponding to [bit30] in the device identifier is 1, it indicates that the storage device supports the data acceleration function; if the value corresponding to [bit30] in the device identifier is 0, it indicates that the storage device does not support the data acceleration function.

[0146] In this embodiment, by receiving a first query instruction sent by the host, the host can respond to the first query instruction and send a first response information including a device descriptor of the storage device to the host, so that the host can confirm whether the storage device supports the data acceleration function based on the bit included in the device descriptor for indicating whether the storage device supports the data acceleration function, thereby being able to send the data type of the accelerated data to the storage device when the storage device supports the data acceleration function, so that the storage device can store the accelerated data in the corresponding storage area, thereby improving the speed at which the host reads the accelerated data.

[0147] In the above scenario where the storage device supports the bit position of the data acceleration function, the host can configure the storage information of the storage device storing the acceleration data according to the acceleration requirements. Fig.12 As shown, the above method also includes:

[0148] S1201, receiving first configuration information sent by a host; the first configuration information is sent by the host when it is determined that a storage device supports a data acceleration function.

[0149] Among them, the first configuration information refers to the storage information of the acceleration data sent by the host to the storage device according to the acceleration demand. Optionally, the first configuration information may include the amount of data that needs to be accelerated. In this embodiment, when the host determines that the storage device supports the data acceleration function, the first configuration information can be generated according to the acceleration demand and sent to the storage device through the bus. Exemplarily, the host can configure the storage capacity of the acceleration data of the storage device by setting the attribute of the ID number 20h in the storage device. For example, the size of the acceleration data is 4 bytes, and the storage capacity for storing the acceleration data is 4k bytes, and it is sent to the storage device through the first configuration information. Exemplarily, the attribute information of 20h can be as shown in Table 4.

[0150] Table 4 Attribute information of ID number 20h

[0151]

[0152] S1202: Configure the amount of acceleration data processed by the storage device according to the first configuration information.

[0153] The data volume of the acceleration data refers to the data volume of the acceleration data that needs to be stored in the corresponding data block with a higher read / write speed in the storage device. In this embodiment, the storage device can parse the received first configuration information to obtain the data volume of the acceleration data that the host needs to process, thereby configuring the data volume of the acceleration data processed by the storage device according to the data volume of the acceleration data to be processed. For example, the storage device can allocate idle data blocks with a higher read / write speed according to the data volume of the acceleration data that needs to be processed for processing the acceleration data.

[0154] As an optional implementation, if the amount of accelerated data processed by the storage device determined according to the first configuration information is greater than a preset data amount threshold, a second response message is sent to the host; the second response message is used to prompt the host that the first configuration information is wrong.

[0155] The preset data volume threshold refers to the maximum data volume of the acceleration data that can be processed in the storage device. In this embodiment, the storage device can compare the data volume of the acceleration data that the storage device needs to process with the preset data volume threshold, and determine whether the data volume of the processed acceleration data is greater than the preset data volume threshold based on the comparison result. Optionally, if the data volume of the processed acceleration data is greater than the preset data volume threshold, the storage device will generate a second response message indicating an error in the first configuration information and send it to the host; if the data volume of the processed acceleration data is less than or equal to the preset data volume threshold, the storage device will configure the storage capacity according to the first configuration information.

[0156] It should be noted that the default amount of processing acceleration data in the storage device is 20 GB, and the range of values ​​allowed to be configured by the host is [0x140000, 0x500000], which represents a range of 5 GB to 20 GB.

[0157] As another optional implementation, the access attribute of 20h in the storage device is a one-time configuration. Therefore, if the host sends configuration information for a second accelerated data capacity configuration to the storage device, the storage device will generate a second response message of a configuration information error and send it to the host.

[0158] In this embodiment, the storage device receives the first configuration information sent by the host when it determines that the storage device supports the data acceleration function. The storage device can configure the amount of accelerated data processed by the storage device according to the first configuration information, thereby meeting the data acceleration requirements of the host and avoiding the problem that the amount of accelerated data is too large and the storage device cannot process it, resulting in the inability to achieve data acceleration. This further realizes collaborative data acceleration between the storage device and the host, speeds up the reading speed of the accelerated data, and optimizes the user experience.

[0159] In the above scenario where the host determines that the storage device supports the data acceleration function, the host can also query the free capacity of the single-layer unit cache area in the storage device to determine the amount of accelerated data that can be sent. Fig.13 As shown, the above method also includes:

[0160] S1301, receiving a second query instruction sent by a host; the second query instruction is sent by the host when it is determined that the storage device supports a data acceleration function.

[0161] Among them, the second query instruction refers to a query instruction used by the host to query the storage capacity of the storage device that can store acceleration data. In this embodiment, the storage device can receive the second query instruction sent by the host through the bus. The second query instruction can be sent to the storage device by the host regularly, or it can be sent to the storage device when the host needs to process the data to be processed. Exemplarily, the host can obtain the storage capacity of the storage device for processing acceleration data by setting the attribute of the ID number 29h in the storage device, and the attribute information of 29h can be shown in Table 5.

[0162] Table 5 Attribute information of ID number 29h

[0163]

[0164] S1302, in response to the second query instruction, sending third response information to the host; the third response information includes the number of data blocks in the storage device used for writing accelerated data.

[0165] The third response message is information that the storage device sends to the host based on the first query instruction, indicating the free storage capacity in the storage device for storing acceleration data. In this embodiment, when the storage device receives the second query instruction, it can obtain the amount of acceleration data already contained in the storage device, thereby determining the amount of acceleration data that can be processed in the storage device based on the amount of acceleration data and the total storage capacity for storing acceleration data, and then determining the number of data blocks in the storage device for writing acceleration data, and generating a third response message based on the determined number of data blocks in the storage device for writing acceleration data, and sending the third response message to the host.

[0166] It should be noted that the access attribute of 29h is read-only. If the attribute of 29h is modified in the second query instruction sent by the host, the storage device will generate a third response message of attribute modification error and send it to the host.

[0167] In this embodiment, the storage device receives a second query instruction sent by the host when it determines that the storage device supports the data acceleration function, and can send a third response information to the host in response to the second query instruction. Since the third response information includes the number of data blocks used to write accelerated data in the storage device, the host can determine the amount of accelerated data that can be processed according to the response message, so that data acceleration can be coordinated between the storage device and the host, so that the storage device can accurately store the accelerated data and realize accelerated data processing.

[0168] It should be noted that the function of the storage device supporting data acceleration can be modified through configuration information. Therefore, the host can turn on or off the data acceleration function of the storage device by sending configuration information to the storage device to turn on or off the data acceleration function. Fig.14 As shown, the above method also includes:

[0169] S1401, receiving second configuration information sent by a host; the second configuration information includes an ID number for enabling a data acceleration function of a storage device or an ID number for disabling a data acceleration function of a storage device.

[0170] The second configuration information refers to information determined by the host based on whether data acceleration processing is required. Optionally, if the host needs to perform data acceleration, the second configuration information may include an ID number for enabling the data acceleration function of the storage device; if the host does not need to perform data acceleration, the second configuration information may include an ID number for disabling the data acceleration function of the storage device. In this embodiment, the storage device may receive the second configuration information sent by the host via a bus. Exemplarily, the attribute information of the ID number used to indicate whether the data acceleration function of the storage device is enabled may be as shown in Table 6.

[0171] Table 6 Attribute information of ID number 0Dh

[0172]

[0173] S1402: Enable or disable a data acceleration function of the storage device according to the second configuration information.

[0174] In this embodiment, the storage device can parse the second configuration information to obtain the ID number of the data acceleration function in the second configuration information, thereby determining whether to turn on or off the data acceleration function of the storage device through the ID number. Optionally, if the second configuration information includes the ID number for turning on the data acceleration function of the storage device, the data acceleration function of the storage device is turned on the storage device; if the second configuration information includes the ID number for turning off the data acceleration function of the storage device, the data acceleration function of the storage device is turned off on the storage device.

[0175] In this embodiment, the storage device receives the second configuration information sent by the host. Since the second configuration information includes an ID number for turning on the data acceleration function of the storage device or an ID number for turning off the data acceleration function of the storage device, the storage device can turn on or off the data acceleration function of the storage device according to the second configuration information, thereby matching the data acceleration function of the host.

[0176] To facilitate understanding by those skilled in the art, the data processing method provided by the present application is described in detail below. The method may include:

[0177] S1, receiving a first query instruction sent by a host.

[0178] S2, in response to the first query instruction, sending a first response message to the host; the first response message includes a device descriptor of the storage device; the device descriptor includes a bit for indicating whether the storage device supports a data acceleration function.

[0179] S3, receiving first configuration information sent by the host; the first configuration information is sent by the host when it is determined that the storage device supports the data acceleration function.

[0180] S4, if the amount of accelerated data processed by the storage device determined according to the first configuration information is greater than a preset data amount threshold, a second response message is sent to the host; the second response message is used to prompt the host that the first configuration information is wrong.

[0181] S5, receiving a second query instruction sent by the host; the second query instruction is sent by the host when it is determined that the storage device supports the data acceleration function.

[0182] S6, in response to the second query instruction, sending a third response message to the host; the third response message includes the number of data blocks in the storage device used for writing accelerated data.

[0183] S7, receiving second configuration information sent by the host; the second configuration information includes an ID number for enabling the data acceleration function of the storage device or an ID number for disabling the data acceleration function of the storage device.

[0184] S8. Turn on or off the data acceleration function of the storage device according to the second configuration information.

[0185] S9, receiving an input / output request sent by the host; the input / output request includes the data type of the data to be processed and is used to instruct writing the data to be processed into a data block.

[0186] S10, according to the data type of the data to be processed, write the hot data and cold data in the data to be processed into the three-layer unit cache area, and write the accelerated data in the data to be processed into the single-layer unit cache area.

[0187] S11, when the number of data blocks is greater than a preset first threshold, determine whether the number of free data blocks is greater than a preset second threshold according to the number of data blocks.

[0188] S12: If the number of free data blocks is less than or equal to the second threshold, determine that the number of data blocks meets a preset condition.

[0189] S13, when the number of data blocks written with the to-be-processed data meets a preset condition, determining a first target data block according to the type of data written in the data blocks.

[0190] S14, when the first target data block includes a mixed data block with hot data written and a mixed data block with cold data written, garbage collection is first performed on the mixed data block with hot data written, and then garbage collection is performed on the mixed data block with cold data written; or, when the first target data block includes a mixed data block with hot data written and a mixed data block with cold data written, garbage collection is first performed on the mixed data block with cold data written, and then garbage collection is performed on the mixed data block with hot data written.

[0191] S15, writing the hot data in the mixed data block including the hot data into a new first data block.

[0192] S16, writing the cold data in the mixed data block including the cold data into a new second data block.

[0193] S17, determining a second target data block according to the data type stored in the data block, and performing garbage collection on the second target data block, the second target data block including a mixed data block with acceleration data written therein.

[0194] S18, writing the acceleration data in the mixed data block including the acceleration data into a new third data block.

[0195] S19, receiving a capacity query instruction sent by the host; the capacity query instruction is used to query the remaining storage capacity of the single-layer unit cache area; the capacity query instruction is sent by the host when it is determined that the remaining storage capacity is less than a first capacity threshold.

[0196] S20, in response to the capacity query instruction, sending the remaining storage capacity to the host; the remaining storage capacity is used by the host to generate an acquisition instruction when it is determined that the remaining storage capacity is greater than a second capacity threshold.

[0197] S21, receiving an acquisition instruction sent by the host; the acquisition instruction is used to obtain the first logical block address of the acceleration data in the data block stored in the single-layer unit cache area, and the acquisition instruction is generated by the host when it determines that the remaining storage capacity of the single-layer unit cache area is greater than the second capacity threshold.

[0198] S22, in response to the acquisition instruction, sends a first logical block address to the host; the first logical block address is used by the host to generate a write instruction according to the first logical block address and the second logical block address, and the second logical block address includes the logical block addresses of all acceleration data in the data blocks pre-stored in the single-layer unit cache area.

[0199] S23, receiving a write instruction sent by the host; the write instruction is used to instruct to transfer the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area.

[0200] S24, in response to the write instruction, transferring the accelerated data in the data block stored in the three-level unit cache area to the data block in the single-level unit cache area.

[0201] It should be noted that for the descriptions in the above S1-S24, reference may be made to the relevant descriptions in the above embodiments, and the effects are similar, so this embodiment will not be repeated here.

[0202] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0203] Based on the same inventive concept, the embodiment of the present application also provides a data processing device for implementing the data processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more data processing device embodiments provided below can refer to the limitations on the data processing method above, and will not be repeated here.

[0204] In one embodiment, Fig.15 As shown, a data processing device is provided, comprising: a first receiving module 11 and a first processing module 12, wherein:

[0205] The first receiving module 11 is used for receiving an input / output request sent by a host; the input / output request includes the data type of the data to be processed and is used for instructing to write the data to be processed into a data block.

[0206] The first processing module 12 is configured to perform garbage collection on the data blocks according to the data types written in the data blocks when the number of data blocks written with the data to be processed meets a preset condition.

[0207] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0208] In one embodiment, Fig.16 As shown, the first processing module 12 comprises: a processing unit 121, wherein:

[0209] The processing unit 121 is used to determine the target data block to be processed according to the data type written in the data block, and perform garbage collection on each target data block.

[0210] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0211] In one embodiment, please continue to refer to Fig.16 The above-mentioned processing unit 121 is specifically used to: determine the first target data block according to the data type written in the data block, and perform garbage collection on the first target data block; the first target data block includes a mixed data block with hot data and / or a mixed data block with cold data; determine the second target data block according to the data type stored in the data block, and perform garbage collection on the second target data block; the second target data block includes a mixed data block with acceleration data.

[0212] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0213] In one embodiment, please continue to refer to Fig.16 The processing unit 121 is specifically used for: when the first target data block includes a mixed data block with hot data written and a mixed data block with cold data written, first performing garbage collection on the mixed data block with hot data written, and then performing garbage collection on the mixed data block with cold data written; or, when the first target data block includes a mixed data block with hot data written and a mixed data block with cold data written, first performing garbage collection on the mixed data block with hot data written, and then performing garbage collection on the mixed data block with cold data written.

[0214] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0215] In one embodiment, please continue to refer to Fig.16 The processing unit 121 is specifically configured to:

[0216] When garbage collection is performed on a mixed data block including hot data written therein, the hot data in the mixed data block including hot data written therein is written into a new first data block; when garbage collection is performed on a mixed data block including cold data written therein, the cold data in the mixed data block including cold data written therein is written into a new second data block; when garbage collection is performed on the second target data block, the accelerated data in the mixed data block including accelerated data written therein is written into a new third data block, wherein, when the remaining storage capacity of the single-layer unit cache area is less than the first capacity threshold, the third data block is a data block stored in the three-layer unit cache area.

[0217] In one embodiment, please continue to refer to Fig.16 The above device further includes: a second receiving module 13 and a processing module 14, wherein:

[0218] The second receiving module 13 is used to receive a write instruction sent by the host; the write instruction is used to instruct to transfer the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area.

[0219] The storage module 14 is used to transfer the accelerated data stored in the data block in the three-level unit cache area to the data block in the single-level unit cache area in response to the write instruction.

[0220] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0221] In one embodiment, please continue to refer to Fig.16 The above device further includes: a third receiving module 15 and a first sending module 16, wherein:

[0222] The third receiving module 15 is used to receive an acquisition instruction sent by the host; the acquisition instruction is used to obtain the first logical block address of the acceleration data in the data block stored in the single-layer unit cache area, and the acquisition instruction is generated by the host when it is determined that the remaining storage capacity of the single-layer unit cache area is greater than a second capacity threshold.

[0223] The first sending module 16 is used to send the first logical block address to the host in response to the acquisition instruction; the first logical block address is used by the host to generate the write instruction according to the first logical block address and the second logical block address, and the second logical block address includes the logical block addresses of all accelerated data in the data blocks pre-stored in the single-layer unit cache area.

[0224] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0225] In one embodiment, please continue to refer to Fig.16 The above device further includes: a fourth receiving module 17 and a second sending module 18, wherein:

[0226] The fourth receiving module 17 is used to receive a capacity query instruction sent by the host; the capacity query instruction is used to query the remaining storage capacity of the single-layer unit cache area; the capacity query instruction is sent by the host when it is determined that the remaining storage capacity is less than the first capacity threshold.

[0227] The second sending module 18 is used to send the remaining storage capacity to the host in response to the capacity query instruction; the remaining storage capacity is used by the host to generate the acquisition instruction when it is determined that the remaining storage capacity is greater than the second capacity threshold.

[0228] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0229] In one embodiment, please continue to refer to Fig.16 The above device further includes: a first determination module 19 and a second determination module 20, wherein:

[0230] A first determination module 19, configured to determine whether the number of free data blocks is greater than a preset second threshold value according to the number of data blocks when the number of data blocks is greater than a preset first threshold value;

[0231] The second determination module 20 is configured to determine that the number of data blocks meets a preset condition if the number of free data blocks is less than or equal to a second threshold.

[0232] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0233] In one embodiment, please continue to refer to Fig.16 The above device further comprises: a second processing module 21, wherein:

[0234] The second processing module 21 is configured to perform garbage collection on the data blocks according to a greedy strategy if the number of free data blocks is greater than a second threshold.

[0235] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0236] In one embodiment, please continue to refer to Fig.16 The above device further includes: a third processing module 22, wherein:

[0237] The third processing module 22 is used to write the hot data and cold data in the data to be processed into the three-layer unit cache area, and write the accelerated data in the data to be processed into the single-layer unit cache area according to the data type of the data to be processed.

[0238] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0239] In one embodiment, please continue to refer to Fig.16 The above device further includes: a fifth receiving module 23 and a third sending module 24, wherein:

[0240] A fifth receiving module 23, configured to receive a first query instruction sent by the host;

[0241] The third sending module 24 is used to send a first response message to the host in response to the first query instruction; the first response message includes a device descriptor of the storage device; the device descriptor includes a bit for indicating whether the storage device supports the data acceleration function.

[0242] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0243] In one embodiment, please continue to refer to Fig.16 The above device further includes: a sixth receiving module 25 and a configuration module 26, wherein:

[0244] The sixth receiving module 25 is used to receive first configuration information sent by the host; the first configuration information is sent by the host when it is determined that the storage device supports the data acceleration function;

[0245] The configuration module 26 is used to configure the amount of acceleration data processed by the storage device according to the first configuration information.

[0246] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0247] In one embodiment, please continue to refer to Fig.16 The above device further includes: a fourth sending module 27, wherein:

[0248] The fourth sending module 27 is used to send a second response message to the host if the amount of accelerated data processed by the storage device determined according to the first configuration information is greater than a preset data amount threshold; the second response message is used to prompt the host that the first configuration information is wrong.

[0249] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0250] In one embodiment, please continue to refer to Fig.16 The above device further includes: a seventh receiving module 28 and a fifth sending module 29, wherein:

[0251] The seventh receiving module 28 is used to receive a second query instruction sent by the host; the second query instruction is sent by the host when it is determined that the storage device supports the data acceleration function;

[0252] The fifth sending module 29 is used to send a second response message to the host in response to the second query instruction; the second response message includes the number of data blocks used for writing accelerated data in the storage device.

[0253] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0254] In one embodiment, please continue to refer to Fig.16 The above device further includes: an eighth receiving module 30 and a fourth processing module 31, wherein:

[0255] An eighth receiving module 30 is used to receive second configuration information sent by the host; the second configuration information includes an ID number for enabling the data acceleration function of the storage device or an ID number for disabling the data acceleration function of the storage device;

[0256] The fourth processing module 31 is used to enable or disable the data acceleration function of the storage device according to the second configuration information.

[0257] The data processing device provided in this embodiment can execute the above method embodiments, and its implementation principles and technical effects are similar, which will not be repeated here.

[0258] Each module in the above data processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0259] The embodiment of the present application also provides a computer-readable storage medium, which is one or more non-volatile computer-readable storage media containing computer-executable instructions, and when the computer-executable instructions are executed by one or more processors, the processors execute the steps of the data processing method.

[0260] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the data processing method.

[0261] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0262] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0263] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0264] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data processing method, characterized in that: include: Receive input and output requests sent by the host; The input / output request includes the data type of the data to be processed and is used to instruct writing the data to be processed into a data block; When the number of data blocks written with the to-be-processed data meets a preset condition, garbage collection is performed on the data blocks according to the types of data written in the data blocks.

2. The method according to claim 1, characterized in that The performing garbage collection on the data block according to the data type written in the data block comprises: The target data blocks to be processed are determined according to the data types written into the data blocks, and garbage collection is performed on each of the target data blocks.

3. The method according to claim 2, characterized in that The step of determining the target data block to be processed according to the data type written into the data block, and performing garbage collection on each of the target data blocks, comprises: Determine a first target data block according to the data type written in the data block, and perform garbage collection on the first target data block; the first target data block includes a mixed data block with hot data written and / or a mixed data block with cold data written; According to the data type stored in the data block, a second target data block is determined, and garbage collection is performed on the second target data block; the second target data block includes a mixed data block with acceleration data written therein.

4. The method according to claim 3, characterized in that The performing garbage collection on the first target data block includes: In the case where the first target data block includes a mixed data block with hot data and a mixed data block with cold data, garbage collection is first performed on the mixed data block with hot data, and then garbage collection is performed on the mixed data block with cold data; or When the first target data block includes a mixed data block with hot data and a mixed data block with cold data, garbage collection is first performed on the mixed data block with cold data, and then garbage collection is performed on the mixed data block with hot data.

5. The method according to claim 4, characterized in that The garbage collection process includes: In the case of performing garbage collection on the mixed data block including the hot data, writing the hot data in the mixed data block including the hot data into a new first data block; In the case of performing garbage collection on the mixed data block including the cold data, writing the cold data in the mixed data block including the cold data into a new second data block; In the case of performing garbage collection on the second target data block, the acceleration data in the mixed data block including the acceleration data is written into a new third data block.

6. The method according to claim 5, characterized in that The method further comprises: receiving a write instruction sent by the host; the write instruction is used to instruct to transfer the accelerated data in the data block stored in the three-layer unit cache area to the data block in the single-layer unit cache area; In response to the write instruction, the accelerated data stored in the data block in the three-level unit cache area is transferred to the data block in the single-level unit cache area.

7. The method according to claim 6, characterized in that The method further comprises: receiving an acquisition instruction sent by the host; the acquisition instruction is used to acquire a first logical block address of acceleration data in a data block stored in the single-layer unit cache area, and the acquisition instruction is generated by the host when determining that the remaining storage capacity of the single-layer unit cache area is greater than a second capacity threshold; In response to the acquisition instruction, the first logical block address is sent to the host; the first logical block address is used by the host to generate the write instruction based on the first logical block address and the second logical block address, and the second logical block address includes the logical block addresses of all acceleration data in the data blocks pre-stored in the single-layer unit cache area.

8. The method according to claim 7, characterized in that Before receiving the acquisition instruction sent by the host, the method further includes: receiving a capacity query instruction sent by the host; the capacity query instruction is used to query the remaining storage capacity of the single-layer unit buffer area; the capacity query instruction is sent by the host when it is determined that the remaining storage capacity is less than the first capacity threshold; In response to the capacity query instruction, the remaining storage capacity is sent to the host; the remaining storage capacity is used by the host to generate the acquisition instruction when it is determined that the remaining storage capacity is greater than the second capacity threshold.

9. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: In a case where the number of the data blocks is greater than a preset first threshold, determining whether the number of free data blocks is greater than a preset second threshold according to the number of the data blocks; If the number of the free data blocks is less than or equal to the second threshold, it is determined that the number of the data blocks meets the preset condition.

10. The method according to claim 9, characterized in that The method further comprises: If the number of the free data blocks is greater than the second threshold, garbage collection is performed on the data blocks according to a greedy strategy.

11. The method according to claim 1, characterized in that: The method further comprises: According to the data type of the data to be processed, the hot data and the cold data in the data to be processed are written into the three-layer unit cache area, and the accelerated data in the data to be processed are written into the single-layer unit cache area.

12. The method according to claim 1, characterized in that The method further comprises: Receiving a first query instruction sent by the host; In response to the first query instruction, a first response message is sent to the host; the first response message includes a device descriptor of the storage device; the device descriptor includes a bit for indicating whether the storage device supports a data acceleration function.

13. The method according to claim 12, characterized in that The method further comprises: receiving first configuration information sent by the host; the first configuration information is sent by the host when it is determined that the storage device supports a data acceleration function; The amount of acceleration data processed by the storage device is configured according to the first configuration information.

14. The method according to claim 13, characterized in that The method further comprises: If the amount of accelerated data processed by the storage device determined according to the first configuration information is greater than a preset data amount threshold, a second response message is sent to the host; the second response message is used to prompt the host that the first configuration information is wrong.

15. The method according to claim 12, characterized in that The method further comprises: receiving a second query instruction sent by the host; the second query instruction is sent by the host when it is determined that the storage device supports a data acceleration function; In response to the second query instruction, a second response message is sent to the host; the second response message includes the number of data blocks in the storage device used to write accelerated data.

16. The method according to claim 11, characterized in that The method further comprises: receiving second configuration information sent by the host; the second configuration information includes an ID number for enabling a data acceleration function of the storage device or an ID number for disabling a data acceleration function of the storage device; According to the second configuration information, a data acceleration function of the storage device is turned on or off.

17. A data processing device, characterized in that: include: A first receiving module, used for receiving an input / output request sent by a host; The input / output request includes the data type of the data to be processed and is used to instruct writing the data to be processed into a data block; The first processing module is used to perform garbage collection on the data blocks according to the data types written in the data blocks when the number of data blocks written with the data to be processed meets a preset condition.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 16 are implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 16 are implemented.