Disclosure of Invention
The application aims to provide a data clearing method, a data clearing device, a server and a computer readable storage medium of an SSD, wherein a plurality of data clearing requests corresponding to data written once are counted to obtain the total operation number of the plurality of data clearing requests, and finally the data clearing operation is carried out by sending the unified total operation number instead of sending each data clearing request to the DDR inside a solid state disk for processing, so that the operation times of the data clearing operation are reduced, the performance influence on the SSD is reduced, and the performance utilization rate is improved.
In order to solve the above technical problems, the present application provides a data clearing method for SSD, including:
receiving a plurality of data clearing requests corresponding to a single write operation;
judging whether a data block corresponding to the data clearing request is recorded in an operation array or not;
if yes, performing increment statistics on the operation value corresponding to the data block;
if not, recording the number corresponding to the data block into the operation array, and performing increment statistics on the operation value corresponding to the data block;
and when the judgment of the data clearing requests is completed, executing data clearing operation on the DDR inside the solid state disk according to the operation array and the corresponding operation value.
Optionally, determining whether the data block corresponding to the data clearing request is recorded in the operation array includes:
judging whether a data block corresponding to the data clearing request is recorded in an operation array or not through a Bloom Filter; and the Bloom Filter records the same number data as the operation array.
Optionally, the operation array is an array cached in the SRAM.
Optionally, the method further comprises:
the operation value of each data block is cached in the array of the SRAM.
Optionally, the method further comprises:
and when the data clearing operation is completed, clearing the Bloom Filter, the operation array and the array of operation values.
The application also provides a data clearing device of SSD, including:
the request receiving module is used for receiving a plurality of data clearing requests corresponding to a single write operation;
the record judging module is used for judging whether the data block corresponding to the data clearing request is recorded in the operation array;
the operation value increment module is used for carrying out increment statistics on the operation value corresponding to the data block when the data block is recorded;
the data newly-built module is used for recording the number corresponding to the data block into the operation array when the data block is not recorded, and carrying out increment statistics on the operation value corresponding to the data block;
and the clearing operation module is used for executing data clearing operation on the DDR inside the solid state disk according to the operation array and the corresponding operation value when the judgment of the data clearing requests is completed.
Optionally, the record judging module is specifically configured to judge whether a data block corresponding to the data clearing request is recorded in the operation array through a Bloom Filter; and the Bloom Filter records the same number data as the operation array.
Optionally, the method further comprises:
and the operation value caching module is used for caching the operation value of each data block in the array of the SRAM.
The application also provides a server comprising:
a memory for storing a computer program;
a processor for implementing the steps of the data clearing method as described above when executing the computer program.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data purging method as described above.
The data clearing method for SSD provided by the application comprises the following steps: receiving a plurality of data clearing requests corresponding to a single write operation; judging whether a data block corresponding to the data clearing request is recorded in an operation array or not; if yes, performing increment statistics on the operation value corresponding to the data block; if not, recording the number corresponding to the data block into the operation array, and performing increment statistics on the operation value corresponding to the data block; and when the judgment of the data clearing requests is completed, executing data clearing operation on the DDR inside the solid state disk according to the operation array and the corresponding operation value.
And counting a plurality of data clearing requests corresponding to the data written once to obtain the total operation number of the plurality of data clearing requests, and finally performing data clearing operation by sending the unified total operation number instead of sending each data clearing request to the DDR inside the solid state disk for processing, so that the operation times of the data clearing operation are reduced, the performance influence on the SSD is reduced, and the performance utilization rate is improved.
The application further provides a data clearing device, a server and a computer readable storage medium of the SSD, which have the above beneficial effects and are not described herein.
Detailed Description
The core of the application is to provide a data clearing method, a data clearing device, a server and a computer readable storage medium of SSD, wherein a plurality of data clearing requests corresponding to single write data are counted to obtain the total operation number of the plurality of data clearing requests, and finally the data clearing operation is carried out by sending the unified total operation number instead of sending each data clearing request to the DDR inside the solid state disk for processing, so that the operation times of the data clearing operation are reduced, the performance influence on the SSD is reduced, and the performance utilization rate is improved.
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In the related art, the storage medium in the SSD is FLASH particles, and is characterized in that the FLASH particles are erased according to page programming, so that data fall into the FLASH in the SSD and are sequentially stored, an actual data storage position is obtained according to the LBA in a mapping table mode, when the data are overwritten, old data cannot be immediately deleted, new data are stored in the new position, then the LBA is mapped to the new storage position, then the number of the vdfcs of the blocks where the old data are located is reduced by 1, and the corresponding vdfbmp is cleared to enable the old data to become invalid. The process that will reduce vdfc and clear vdfbmp is the data clear operation inside the SSD. The vdfc and vdfbmp of each Block are recorded in DDR, and a write operation may be performed on a plurality of blocks, or may be performed on a plurality of blocks, during random writing. As can be seen, the data purge operation in the related art affects the performance of the DDR, thereby reducing the overall performance of the SSD.
Therefore, the application provides a data clearing method for SSDs, which is characterized in that a plurality of data clearing requests corresponding to single write data are counted to obtain the total operation number of the plurality of data clearing requests, and finally, the data clearing operation is carried out by sending the unified total operation number instead of sending each data clearing request to the DDR inside a solid state disk for processing, so that the operation times of the data clearing operation are reduced, the performance influence on the SSDs is reduced, and the performance utilization rate is improved.
The following describes a data clearing method for SSD provided in the present application by an embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a data clearing method for an SSD according to an embodiment of the disclosure.
In this embodiment, the method may include:
s101, receiving a plurality of data clearing requests corresponding to a single write operation;
this step is intended to receive a plurality of data purge requests corresponding to a single write operation. That is, in SSDs, a received write-once operation includes a plurality of data clear requests therein. The plurality of data clear requests may be data requests for clear operations to a plurality of blocks.
S102, judging whether a data block corresponding to a data clearing request is recorded in an operation array;
on the basis of S101, this step is aimed at determining whether a data block corresponding to the data clear request is recorded in the operation array. The operation array refers to an array recorded with the number of the data block, and records which data blocks are operated in the current processing process. That is, among the plurality of data clear requests, there are a plurality of data clear operations for the same data block. Therefore, the number of the data block needs to be recorded, which means that there are a plurality of data clear requests for the data block, and statistics are required.
Further, in order to improve the efficiency of data block judgment and reduce the time delay of judgment, the step may include:
judging whether a data block corresponding to the data clearing request is recorded in the operation array or not through a Bloom Filter; wherein, the Bloom Filter records the same number data as the operation array.
Therefore, in the alternative scheme, whether the data block corresponding to the data clearing request is recorded in the operation array is judged mainly through a Bloom Filter; wherein, the Bloom Filter records the same number data as the operation array. Where Bloom filters are Bloom filters, which consist of a very long binary vector (bit vector) and a series of random mapping functions, the Bloom Filter can be used to retrieve whether an element is in a set. Its advantages are high space efficiency and query time, and high recognition rate and deletion difficulty, but no recognition error. Thus, bloom filters are not suitable for those "zero error" applications. In applications where low error rates can be tolerated, bloom filters provide a significant savings in memory space with very few errors.
Further, in order to avoid operating other storage media from affecting the operation process in the SSD, the performance utilization rate is improved, and the operation array may be an array cached in the SRAM.
Further, in order to avoid the performance impact of the statistical operation value on the SSD, the embodiment may further include: the operation value of each data block is cached in the array of the SRAM.
When the operation array is an array of a cached SRAM (Static Random-Access Memory), the process of processing each data clearing request does not operate the DDR in the solid state disk, so that the performance of the DDR in the solid state disk is prevented from being influenced.
S103, if yes, performing increment statistics on the operation value corresponding to the data block;
on the basis of S102, when the information of the data block is recorded in the operation array, incremental statistics is performed on the operation value corresponding to the data block, so that statistics is performed on the operation value for operating on the data block. The increment statistics mainly performs increment processing on the operation value of the data block, and may be adding one to the operation value or setting more flag bits to the operation value. As long as the incremental statistical manner of the number of operations of the data block can be counted eventually, it is possible to use the incremental statistical manner in the present embodiment.
S104, if not, recording the number corresponding to the data block into an operation array, and carrying out increment statistics on the operation value corresponding to the data block;
on the basis of S102, when the information of the data block is not recorded in the operation array, the number corresponding to the data block is recorded in the operation array, and incremental statistics is performed on the operation value corresponding to the data block.
S105, when the judgment of the data clearing requests is completed, executing data clearing operation on the DDR inside the solid state disk according to the operation array and the corresponding operation value.
On the basis of all the steps, when the judgment of the data clearing requests is completed, executing data clearing operation on the DDR inside the solid state disk according to the operation array and the corresponding operation value. That is, the statistics of the operation values in the plurality of data clear requests are completed, and the data clear operation can be performed only once according to the counted data, and all the data clear requests are processed.
Further, in order to achieve the next operation judgment and improve the performance utilization rate, the embodiment may further include:
when the data clear operation is completed, the Bloom Filter, the operation array, and the array of operation values are cleared.
It can be seen that in this alternative, mainly when the data clearing operation is completed, the Bloom Filter, the operation array, and the array of operation values are cleared to process the next request.
In summary, in this embodiment, the total operation number of the plurality of data clearing requests corresponding to the write-once data is obtained by counting the plurality of data clearing requests, and finally, the data clearing operation is performed by sending the unified operation total number instead of sending each data clearing request to the DDR inside the solid state disk for processing, so as to reduce the operation times of the data clearing operation, improve the performance influence on the SSD, and improve the performance utilization rate.
The following further describes a data clearing method of the SSD according to the present application through a specific embodiment.
In this embodiment, N requests are generated by a write operation, and when the N requests are processed sequentially, the vdfc change rate of each Block is cached in the SRAM, where the speed of the SRAM is much faster than that of the DDR, so as to avoid whether the vdfc subtraction operation is performed by the Block to be queried each time, we record the Block number of each operation in the Bloom Filter, and although the Bloom Filter has a certain probability of having a false query, the number of blocks in the SSD is limited, and this problem can be avoided by selecting a proper hash algorithm and parameters of the Bloom Filter and by performing verification in advance.
And allocating an array A with the length of N in the SRAM for recording the Block numbers in the process of the obsoles, and allocating an array B with the length of M according to the number M of the blocks for recording the reduction amount of each Block vdfc. When an obsolete flow arrives, inquiring whether the Block has a record in a Bloom Filter, if not, recording the Block number in an array A, recording the Block in the Bloom Filter, and adding 1 to the corresponding Block position value in an array B; if the Block exists in the Bloom Filter, the corresponding Block position value in the array B is only added with 1. After the N obsole request processes are completed, carrying out batch obsole of the vdfc according to the Block code recorded in the array A and the vdfc variable recorded in the array B, and then emptying the Bloom Filter, the array A and the array B. Modification of the same Block vdfc change in the N obsole requests only needs to modify DDR once.
The array A is a data array, and the array B is an array of operation values corresponding to each block in the operation array.
Therefore, in this embodiment, the total operation number of the plurality of data clearing requests corresponding to the write-once data can be obtained by counting the plurality of data clearing requests, and finally, the data clearing operation is performed by sending the unified operation total number instead of sending each data clearing request to the DDR inside the solid state disk for processing, so as to reduce the operation times of the data clearing operation, improve the performance influence on the SSD, and improve the performance utilization rate.
The following describes a data clearing device of an SSD according to an embodiment of the present application, and the data clearing device of the SSD described below and the data clearing method of the SSD described above may be referred to correspondingly.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a data clearing device of an SSD according to an embodiment of the disclosure.
In this embodiment, the apparatus may include:
a request receiving module 100, configured to receive a plurality of data clear requests corresponding to a single write operation;
the record judging module 200 is used for judging whether a data block corresponding to the data clearing request is recorded in the operation array;
the operation value increment module 300 is configured to perform increment statistics on an operation value corresponding to the data block when the data block is recorded;
the data creation module 400 is configured to record, when no data block is recorded, a number corresponding to the data block into the operation array, and perform incremental statistics on an operation value corresponding to the data block;
and the clearing operation module 500 is configured to execute a data clearing operation on the DDR inside the solid state disk according to the operation array and the corresponding operation value when the determination of the plurality of data clearing requests is completed.
Optionally, the record determining module 200 is specifically configured to determine whether a data block corresponding to the data clearing request is recorded in the operation array through a Bloom Filter; wherein, the Bloom Filter records the same number data as the operation array.
Optionally, the apparatus may further include:
and the operation value caching module is used for caching the operation value of each data block in the array of the SRAM.
The embodiment of the application also provides a server, which comprises:
a memory for storing a computer program;
a processor for implementing the steps of the data clearing method as described in the above embodiments when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data purging method as described in the above embodiments.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above describes in detail a data clearing method, a data clearing device, a server and a computer readable storage medium of an SSD provided in the present application. Specific examples are set forth herein to illustrate the principles and embodiments of the present application, and the description of the examples above is only intended to assist in understanding the methods of the present application and their core ideas. It should be noted that it would be obvious to those skilled in the art that various improvements and modifications can be made to the present application without departing from the principles of the present application, and such improvements and modifications fall within the scope of the claims of the present application.