Disclosure of Invention
In view of this, an object of the present application is to provide a method, an apparatus, a device, and a medium for holding data of a solid state disk, which can save system process resources, perform data holding processing on a block in batch, improve data holding processing efficiency, and improve system performance. The specific scheme is as follows:
in a first aspect, the present application discloses a method for holding data in a solid state disk, including:
setting data holding time of block in Flash;
determining a target information recording table for recording the block information of the block according to the latest operation type of the block;
determining a target information recording sub-list actually used for recording the block information from the target information recording table according to a first time difference between the latest operation time of the block and the system starting time, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier;
determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the data holding time;
and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list.
Optionally, the setting of the data retention time of the block in Flash includes:
setting the maximum opening time and the maximum closing time of the block in Flash to set the data holding time of the block.
Optionally, the determining, according to the latest operation type of the block, a target information recording table for recording block information of the block includes:
if the latest operation type is opening operation, determining an information recording table corresponding to the opening operation as a target information recording table for recording the block information of the block;
and if the latest operation type is closing operation, determining an information recording table corresponding to the closing operation as a target information recording table for recording the block information of the block.
Optionally, the determining whether the second time difference is greater than or equal to the data retention time includes:
and if the latest operation is the opening operation, judging whether the second time difference is greater than or equal to the maximum opening duration so as to judge whether the second time difference is greater than or equal to the data holding time.
Optionally, the determining whether the second time difference is greater than or equal to the data retention time includes:
and if the latest operation is the closing operation, judging whether the second time difference is greater than or equal to the maximum closing time length so as to judge whether the second time difference is greater than or equal to the data holding time.
Optionally, the performing data retention processing on all blocks corresponding to the block information recorded in the target information recording sub-list includes:
and if the second time difference is greater than or equal to the maximum opening duration, closing all the blocks corresponding to the block information recorded in the target information recording sub-list.
Optionally, the performing data retention processing on all blocks corresponding to the block information recorded in the target information recording sub-list includes:
and if the second time difference is greater than or equal to the longest closing time, moving all the blocks corresponding to the block information recorded in the target information recording sub-list.
In a second aspect, the present application discloses a solid state disk data holding apparatus, including:
the time setting module is used for setting the data holding time of the block in the Flash;
the first list determining module is used for determining a target information recording list for recording the block information of the block according to the latest operation type of the block;
a second list determining module, configured to determine, according to a first time difference between a latest operation time of the block and a system start time, a target information recording sub-list actually used for recording the block information from the target information recording table, where the target information recording sub-list has a corresponding time identifier, and the first time difference is matched with the time identifier;
the information recording module is used for recording the block information in the target information recording sublist;
a time difference determining module for determining a second time difference between the current time and the time represented by the time identifier;
the judging module is used for judging whether the second time difference is larger than or equal to the data holding time or not;
and the data holding processing module is used for carrying out data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list when the second time difference is greater than or equal to the data holding time.
In a third aspect, the present application discloses a solid state disk data holding device, including:
a memory and a processor;
wherein the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the solid state disk data holding method disclosed above.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the solid state disk data retention method disclosed in the foregoing.
Therefore, the data retention time of the block in the Flash needs to be set firstly; determining a target information recording table for recording the block information of the block according to the latest operation type of the block; determining a target information recording sub-list actually used for recording the block information from the target information recording table according to a first time difference between the latest operation time of the block and the system starting time, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier; then determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the data holding time; and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list. When the second time difference is greater than or equal to the data holding time, it can be determined that all the blocks corresponding to the block information in the target information recording sub-list are subjected to data holding processing, so that system process resources are saved, data holding processing is performed on the blocks in batches, data holding processing efficiency is improved, and system performance is improved.
Detailed Description
The technical solutions in 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 obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, a data holding processing method is mainly used for monitoring the continuous opening or continuous closing time of each block, then judging whether the continuous opening or continuous closing time of each block reaches the data holding time, and carrying out data holding processing on the blocks reaching the data holding time, so that a large number of processes are occupied in the system operation process to monitor the continuous opening or continuous closing time of each block, system process resources are caused, frequent data holding processing is caused during operation, and system performance is reduced. In view of this, the present application provides a solid state disk data processing method, which can save system process resources, perform data retention processing on blocks in batches, improve data retention processing efficiency, and improve system performance.
Referring to fig. 1, an embodiment of the present application discloses a method for holding data in a solid state disk, where the method includes:
step S11: and setting the data holding time of the block in the Flash.
In a specific real-time process, the data retention time of the block in Flash needs to be set first. Specifically, data holding time of the block needs to be set according to the actual performance of the Flash and the like so as to judge whether corresponding data holding processing needs to be performed on the block, wherein the data holding time includes a maximum opening time and a maximum closing time, the maximum opening time is the maximum time for continuously opening the block, and the maximum closing time is the maximum time for continuously closing the block.
Step S12: and determining a target information recording table for recording the block information of the block according to the latest operation type of the block.
In a specific implementation process, after the data holding time of the block in Flash is set, a target information recording table for recording the block information of the block is determined according to the latest operation type of the block. Wherein the recent operation types include two types of on operation and off operation.
Step S13: and according to a first time difference between the latest operation time of the block and the system starting time, determining a target information recording sub-list actually used for recording the block information from the target information recording table, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier.
In this embodiment, a target information recording sub-list actually used for storing the block information is determined from the target information recording table according to a first time difference between the latest operation time of the block and a system start time, and the block information is recorded in the target information recording sub-list, where the target information recording sub-list has a corresponding time identifier, and the first time difference needs to be matched with the time identifier.
In a specific implementation process, the time indicator may be a period of time interval, and the time indicated by the time indicator may be a maximum value of the time interval or an average value of the time interval. When the time indication may be a time interval, the first time difference should belong to the time interval. For example, if the time stamp corresponding to the target information sub-list is 1 to 5 seconds after the system is started, the time represented by the time stamp may be set to be the 5 th second after the system is started, and the block information with the first time difference smaller than or equal to 5 seconds is stored in the target information sub-list, that is, the block information corresponding to the block which is opened and closed within 1 to 5 seconds after the system is started is recorded in the target information sub-list.
Step S14: and determining a second time difference between the current time and the time represented by the time mark, and judging whether the second time difference is larger than or equal to the data holding time.
It will be appreciated that after recording the block information into the target information recording sub-list, a second time difference between the current time and the time represented by the time stamp needs to be determined. And when the time mark is a period of time interval and the time represented by the time mark is the maximum value of the time interval, determining the difference value between the current time and the maximum value to obtain the second time difference. For example, the current time is the 7 th second after the system is started, the time identifier corresponding to the target information recording sub-list is 1-5 seconds after the system is started, the time represented by the time identifier is the 5 th second after the system is started, and then the second time difference between the current time and the time represented by the time identifier is 2 seconds. After the second time difference is determined, it is further required to determine whether the second time difference is greater than or equal to the data retention time.
Step S15: and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list.
In a specific implementation process, if the second time difference is greater than or equal to the data holding time, performing data holding operation on all blocks corresponding to the block information in the target information recording sub-list.
Therefore, the data retention time of the block in the Flash needs to be set firstly; determining a target information recording table for recording the block information of the block according to the latest operation type of the block; determining a target information recording sub-list actually used for recording the block information from the target information recording table according to a first time difference between the latest operation time of the block and the system starting time, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier; then determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the data holding time; and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list. When the second time difference is greater than or equal to the data holding time, it can be determined that all the blocks corresponding to the block information in the target information recording sub-list are subjected to data holding processing, so that system process resources are saved, data holding processing is performed on the blocks in batches, data holding processing efficiency is improved, and system performance is improved.
Referring to fig. 2, an embodiment of the present application discloses a specific method for holding data in a solid state disk, where the method includes:
step S21: setting the maximum opening time and the maximum closing time of the block in Flash to set the data holding time of the block.
In this embodiment, the maximum opening time and the maximum closing time of a block in Flash need to be set to set the data holding time of the block, and the maximum opening time and the maximum closing time may be different according to an actual situation.
Step S22: and if the latest operation type of the block is opening operation, determining an information recording table corresponding to the opening operation as a target information recording table for recording the block information of the block.
In a specific implementation process, the latest operation type of the block comprises an opening operation and a closing operation, and if the latest operation of the block is the opening operation, an information recording table corresponding to the opening operation is determined as a target information recording table for recording block information of the block.
Step S23: and according to a first time difference between the latest operation time of the block and the system starting time, determining a target information recording sub-list actually used for recording the block information from the target information recording table, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier.
Step S24: and determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the maximum opening time length so as to judge whether the second time difference is greater than or equal to the data holding time.
It is understood that, when the latest operation of the block is an opening operation, after the second time difference is determined, it is required to determine whether the second time difference is greater than or equal to the maximum opening duration, so as to determine whether the second time difference is greater than or equal to the data holding time.
Step S25: and if the second time difference is greater than or equal to the maximum opening duration, closing all the blocks corresponding to the block information recorded in the target information recording sub-list.
In a specific implementation process, if the second time difference is greater than or equal to the maximum opening duration, closing all blocks corresponding to the block information recorded in the target information recording sub-list.
For example, if the maximum starting duration is 10 minutes, the time identifier corresponding to the target information recording sub-list is 1-5 minutes after the system is started, the time represented by the time identifier is 5 minutes after the system is started, and the current time is 15 minutes after the system is started, the second time difference is 10 minutes, and the second time difference is equal to the maximum starting duration, and it is necessary to close all the blocks corresponding to the block information in the target information recording sub-list.
Referring to fig. 3, an embodiment of the present application discloses a specific method for holding data in a solid state disk, where the method includes:
step S31: setting the maximum opening time and the maximum closing time of the block in Flash to set the data holding time of the block.
Step S32: and if the latest operation type is closing operation, determining an information recording table corresponding to the closing operation as a target information recording table for recording the block information of the block.
In a specific implementation process, the latest operation type of the block comprises an opening operation and a closing operation, and if the latest operation type is the closing operation, an information recording table corresponding to the closing operation is determined as a target information recording table for recording block information of the block.
Step S33: and according to a first time difference between the latest operation time of the block and the system starting time, determining a target information recording sub-list actually used for recording the block information from the target information recording table, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier.
Step S34: and determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the maximum closing time length so as to judge whether the second time difference is greater than or equal to the data holding time.
It is understood that when the latest operation of the block is a closing operation, after the second time difference is determined, it is required to determine whether the second time difference is greater than or equal to the maximum closing time length, so as to determine whether the second time difference is greater than or equal to the data holding time.
Step S35: and if the second time difference is greater than or equal to the longest closing time, moving all the blocks corresponding to the block information recorded in the target information recording sub-list.
In a specific implementation process, if the second time difference is greater than or equal to the longest closing time, moving all the blocks corresponding to the block information recorded in the target information recording sub-list. Specifically, if the second time difference is greater than or equal to the maximum closing time length, moving the data in the block corresponding to the block information in the target information recording sub-list to other blocks to avoid data loss.
Referring to fig. 4, an embodiment of the present application discloses a solid state disk data holding apparatus, including:
the time setting module 11 is used for setting the data holding time of the block in the Flash;
a first list determining module 12, configured to determine, according to the latest operation type of the block, a target information recording list used for recording block information of the block;
a second list determining module 13, configured to determine, according to a first time difference between the latest operation time of the block and a system start time, a target information recording sub-list actually used for recording the block information from the target information recording table, where the target information recording sub-list has a corresponding time identifier, and the first time difference is matched with the time identifier;
an information recording module 14, configured to record the block information in the target information recording sublist;
a time difference determining module 15, configured to determine a second time difference between the current time and the time represented by the time identifier;
a judging module 16, configured to judge whether the second time difference is greater than or equal to the data retention time;
and a data holding processing module 17, configured to perform data holding processing on all blocks corresponding to the block information recorded in the target information recording sub-list when the second time difference is greater than or equal to the data holding time.
Therefore, the data retention time of the block in the Flash needs to be set firstly; determining a target information recording table for recording the block information of the block according to the latest operation type of the block; determining a target information recording sub-list actually used for recording the block information from the target information recording table according to a first time difference between the latest operation time of the block and the system starting time, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier; then determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the data holding time; and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list. When the second time difference is greater than or equal to the data holding time, it can be determined that all the blocks corresponding to the block information in the target information recording sub-list are subjected to data holding processing, so that system process resources are saved, data holding processing is performed on the blocks in batches, data holding processing efficiency is improved, and system performance is improved.
Further, referring to fig. 5, an embodiment of the present application further discloses a solid state disk data holding device, including: a processor 21 and a memory 22.
Wherein the memory 22 is used for storing a computer program; the processor 21 is configured to execute the computer program to implement the solid state disk data holding method disclosed in the foregoing embodiment.
For a specific process of the above method for maintaining data in a solid state disk, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
Fig. 6 is a schematic structural diagram of an electronic device 20 provided in an embodiment of the present application, where the electronic device may specifically include, but is not limited to, various computers and the like.
In general, the electronic device 20 in the present embodiment includes: a processor 21 and a memory 22.
The processor 21 may include one or more processing cores, such as a four-core processor, an eight-core processor, and so on. The processor 21 may be implemented by at least one hardware of a DSP (digital signal processing), an FPGA (field-programmable gate array), and a PLA (programmable logic array). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a GPU (graphics processing unit) which is responsible for rendering and drawing images to be displayed on the display screen. In some embodiments, the processor 21 may include an AI (artificial intelligence) processor for processing a calculation operation related to machine learning.
Memory 22 may include one or more computer-readable storage media, which may be non-transitory. Memory 22 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 22 is at least used for storing the following computer program 221, wherein after the computer program is loaded and executed by the processor 21, the steps of the data holding method of the solid state disk disclosed in the foregoing embodiments can be implemented. In addition, the resources stored in the memory 22 may also include an operating system 222, data 223, and the like, and the storage manner may be a transient storage or a permanent storage. The operating system 222 may be Windows, Unix, Linux, or the like. Data 223 may include a wide variety of data.
In some embodiments, the electronic device 20 may further include a display 23, an input/output interface 24, a communication interface 25, a sensor 26, a power supply 27, and a communication bus 28.
Those skilled in the art will appreciate that the configuration shown in FIG. 6 is not limiting of electronic device 20 and may include more or fewer components than those shown.
Further, an embodiment of the present application also discloses a computer readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the following steps:
setting data holding time of block in Flash; determining a target information recording table for recording the block information of the block according to the latest operation type of the block; determining a target information recording sub-list actually used for recording the block information from the target information recording table according to a first time difference between the latest operation time of the block and the system starting time, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier; determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the data holding time; and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list.
Therefore, the data retention time of the block in the Flash needs to be set firstly; determining a target information recording table for recording the block information of the block according to the latest operation type of the block; determining a target information recording sub-list actually used for recording the block information from the target information recording table according to a first time difference between the latest operation time of the block and the system starting time, and recording the block information in the target information recording sub-list, wherein the target information recording sub-list is provided with a corresponding time identifier, and the first time difference is matched with the time identifier; then determining a second time difference between the current time and the time represented by the time identifier, and judging whether the second time difference is greater than or equal to the data holding time; and if the second time difference is greater than or equal to the data holding time, performing data holding processing on all the blocks corresponding to the block information recorded in the target information recording sub-list. When the second time difference is greater than or equal to the data holding time, it can be determined that all the blocks corresponding to the block information in the target information recording sub-list are subjected to data holding processing, so that system process resources are saved, data holding processing is performed on the blocks in batches, data holding processing efficiency is improved, and system performance is improved.
In this embodiment, when the computer subprogram stored in the computer-readable storage medium is executed by the processor, the following steps may be specifically implemented: setting the maximum opening time and the maximum closing time of the block in Flash to set the data holding time of the block.
In this embodiment, when the computer subprogram stored in the computer-readable storage medium is executed by the processor, the following steps may be specifically implemented: if the latest operation type is opening operation, determining an information recording table corresponding to the opening operation as a target information recording table for recording the block information of the block; and if the latest operation type is closing operation, determining an information recording table corresponding to the closing operation as a target information recording table for recording the block information of the block.
In this embodiment, when the computer subprogram stored in the computer-readable storage medium is executed by the processor, the following steps may be specifically implemented: and if the latest operation is the opening operation, judging whether the second time difference is greater than or equal to the maximum opening duration so as to judge whether the second time difference is greater than or equal to the data holding time.
In this embodiment, when the computer subprogram stored in the computer-readable storage medium is executed by the processor, the following steps may be specifically implemented: and if the latest operation is the closing operation, judging whether the second time difference is greater than or equal to the maximum closing time length so as to judge whether the second time difference is greater than or equal to the data holding time.
In this embodiment, when the computer subprogram stored in the computer-readable storage medium is executed by the processor, the following steps may be specifically implemented: and if the second time difference is greater than or equal to the maximum opening duration, closing all the blocks corresponding to the block information recorded in the target information recording sub-list.
In this embodiment, when the computer subprogram stored in the computer-readable storage medium is executed by the processor, the following steps may be specifically implemented: and if the second time difference is greater than or equal to the longest closing time, moving all the blocks corresponding to the block information recorded in the target information recording sub-list.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
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. A software module may reside 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.
Finally, it is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of other elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The method, the apparatus, the device, and the medium for holding data of a solid state disk provided by the present application are described in detail above, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.