Solid state hard disk data transmission method and solid state hard disk
By using synchronization request and verification data in solid-state hard disk data transmission to determine the block to be sent, the problems of high complexity of data transmission and untimely transmission of missing data in the prior art are solved, and more efficient and timely data transmission is achieved .
Patent Information
- Application Number
- CN202411464244.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-21
AI Technical Summary
The data transmission process of existing solid-state drives is complicated and requires traversing all data, which leads to high complexity of data transmission and untimely transmission of missing data, which easily leads to data discarding.
By sending a synchronization request between the master and slave devices, the verification data of the storage block is obtained, which is used to determine the block to be sent in the slave device's solid-state hard disk and directly transmit the unsent block data to avoid traversing all Block.
It reduces the complexity of SSD data transmission, improves the real-time nature of data transmission, ensures data integrity and timely transmission, and avoids data discarding.
Smart Images

Figure CN119011605B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of solid state hard disks, and in particular to a solid state hard disk data transmission method and a solid state hard disk. Background Art
[0002] In the current SSD data transmission process, data is generally generated by slave devices and uploaded to the master device layer by layer. In order to meet business needs (such as reporting, settlement, reconciliation, etc.), it is generally necessary for the slave device to upload all important data to the master device without omission.
[0003] In the related technology, the commonly used process of hard disk-to-hard disk transmission is as follows: the slave device records and marks the data as sent but not audited during the data upload process; after a statistical period ends, the master device generates the transmission audit data of the corresponding previous statistical period based on the received data; then the master device sends the transmission audit data to the slave device; after receiving the transmission audit data of the master device, the lower node traverses and compares it with its own recorded data based on its content, and marks the sent but not audited data corresponding to itself in the transmission audit data as audited, until the content of the transmission audit data is fully processed / compared; then it can traverse its own recorded data again to find out the data that is still marked as sent but not audited, and these data that are still marked as sent but not audited are the data missing from the master device, and then the slave device can retransmit these data.
[0004] However, the above technologies all need to traverse all data during the data transmission process, which leads to high complexity of the solid state drive data transmission process. Summary of the invention
[0005] The present invention provides a solid state hard disk data transmission method and a solid state hard disk, which are used to reduce the complexity of the solid state hard disk data transmission process.
[0006] In a first aspect, the present invention provides a solid state hard disk data transmission method, which is applied to a data transmission system, wherein the data transmission system at least includes a master device, a solid state hard disk and a slave device, wherein the interaction port between the master device and the solid state hard disk is a network interface terminal, and the interaction port between the solid state hard disk and the slave device is a serial transceiver interface terminal; the solid state hard disk data transmission method includes:
[0007] Sending a synchronization request to the master device based on the serial transceiver interface end, and receiving first verification data and first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes an identifier of the slave device; the data type of the first data includes a control command or a query request; the first verification data is verification data determined according to the first storage block of the solid-state hard disk corresponding to the identifier of the slave device in the master device according to the synchronization request, after the master device determines the first storage block of the solid-state hard disk corresponding to the identifier of the slave device in the master device according to the synchronization request;
[0008] Determine, according to the first verification data, a target block corresponding to second verification data consistent with the first verification data in the solid-state hard disk corresponding to the slave device;
[0009] Determine the block to be sent in the solid-state hard disk of the slave device according to the target block, and transmit the original solid-state hard disk data associated with the block to be sent to the master device; the block to be sent is a block in the solid-state hard disk of the slave device whose data has not been sent to the master device;
[0010] Submitting the first data to a data transmission queue of the serial transceiver interface end based on the network interface end;
[0011] Based on the serial transceiver interface, the first data in the data transmission queue is sent to a slave device according to the data type.
[0012] In a second aspect, the present invention further provides a solid state drive, which is applied to a data transmission system, wherein the data transmission system comprises at least a master device, a solid state drive and a slave device, wherein the interaction port between the master device and the solid state drive is a network interface terminal, and the interaction port between the solid state drive and the slave device is a serial transceiver interface terminal; the solid state drive comprises a communication unit, a determination unit and a data transmission unit;
[0013] A communication unit, configured to send a synchronization request to the master device based on the serial transceiver interface end, and receive first verification data and first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes an identifier of the slave device; a data type of the first data includes a control command or a query request; the first verification data is verification data determined according to the first storage block of the solid-state hard disk corresponding to the identifier of the slave device after the master device determines the first storage block in the master device according to the synchronization request;
[0014] a determination unit, configured to determine, based on the first verification data, a target block corresponding to second verification data consistent with the first verification data in the solid state hard disk corresponding to the slave device;
[0015] Data transmission unit, used for:
[0016] Determine the block to be sent in the solid-state hard disk of the slave device according to the target block, and transmit the original solid-state hard disk data associated with the block to be sent to the master device; the block to be sent is a block in the solid-state hard disk of the slave device whose data has not been sent to the master device;
[0017] Submitting the first data to a data transmission queue of the serial transceiver interface end based on the network interface end;
[0018] Based on the serial transceiver interface, the first data in the data transmission queue is sent to a slave device according to the data type.
[0019] In a third aspect, the present invention further provides an electronic device, comprising: a memory for storing a computer software program; a processor for reading and executing the computer software program, thereby implementing the solid state hard disk data transmission method as described in the first aspect above.
[0020] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, wherein the storage medium stores a computer software program, and when the computer software program is executed by a processor, the solid-state hard disk data transmission method as described in the first aspect above is implemented.
[0021] In a fifth aspect, the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the solid-state hard disk data transmission method as described in the first aspect above.
[0022] The solid-state hard disk data transmission method provided by the present invention can determine the untransmitted blocks for transmission because the slave device only needs to verify its own blocks according to the verification data of the storage blocks fed back by the master device. In this way, there is no need to traverse the data of all blocks, thereby reducing the complexity of the solid-state hard disk data transmission process, and at the same time, it can also improve the real-time performance of the solid-state hard disk data transmission and make the transmission of missing data more timely, and further avoid the data being discarded during the data transmission process. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a flow chart of the solid state hard disk data transmission method provided by the present invention;
[0024] Figure 2 It is a structural schematic diagram of the solid state hard disk provided by the present invention;
[0025] Figure 3 A schematic diagram of an electronic device according to an embodiment of the present invention;
[0026] Figure 4 A schematic diagram of an embodiment of a computer-readable storage medium provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0028] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0029] In the description of the present invention, the term "for example" is used to mean "used as an example, illustration or explanation". Any embodiment described as "for example" in the present invention is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any technician in the field to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present invention.
[0030] Optional, see Figure 1 , Figure 1 It is a flow chart of the solid-state hard disk data transmission method provided by the present invention. The solid-state hard disk data transmission method provided by the present invention is applied to a data transmission system. The data transmission system at least includes a master device, a solid-state hard disk and a slave device. The interaction port between the master device and the solid-state hard disk is a network interface terminal, and the interaction port between the solid-state hard disk and the slave device is a serial transceiver interface terminal.
[0031] Therefore, it can be understood that the execution subject of the embodiment of the present invention can be a data transmission system. Therefore, the solid state hard disk data transmission method includes the following steps:
[0032] Step 10, sending a synchronization request to the master device based on the serial transceiver interface end, and receiving the first verification data and the first data sent by the master device based on the synchronization request based on the network interface end. The synchronization request includes the identifier of the slave device; the data type of the first data includes a control command or a query request, and the transmission priority of the control command is higher than the transmission priority of the query request; the first verification data is the verification data determined by the master device according to the synchronization request in the master device after determining the first storage block of the solid-state hard disk corresponding to the identifier of the slave device, and then determining the first storage block according to the first storage block;
[0033] Among them, the master device and the slave device are relative concepts, in which the master device is the upper-layer device of the slave device. The transmitted data is generally generated by the slave device and transmitted and aggregated to the master device layer by layer.
[0034] In an embodiment of the present invention, both the master device and the slave device may be provided with respective corresponding solid-state hard disks to store respective data, wherein the data stored in the solid-state hard disk of the master device is data sent from the device to the master device, and the data stored in the solid-state hard disk of the slave device may be data generated by the slave device itself or data sent from the lower hard disk of the device. The number of master devices and slave devices may be one or more. In the case where there are multiple slave devices and one master device, the master device may include a solid-state hard disk corresponding to each slave device, and each solid-state hard disk is used to store data transmitted by the corresponding slave device.
[0035] For a solid-state drive in a master device, the solid-state drive may include multiple blocks, and each block may include block depth, block generation time, verification data of the previous block (or parent block), verification data of the current block, and block data, etc. Among them, the block depth can be recorded as Height, which can increase as the block is generated, and the block with the largest block depth is the storage block in the solid-state drive; the block generation time can be recorded as TimeStamp, and each time a data transmitted from a slave device is received, a block can be created to store the corresponding data; the verification data of the previous block (or parent block) can be a hash value, which can be recorded as PreHash; the verification data of the current block can be the hash value of the current block, which can be recorded as Hash, which can be calculated by using a hash algorithm (such as sha256, etc.) for data other than the hash of the current block; the block data can be recorded as Data, which can be the original data associated with the current block or the summary information of the original data (such as the original data file name, file save path, verification code, etc.). Among them, hash algorithm usually refers to mapping data to a fixed-size value through a hash function or hash table. In programming, hash is often used to quickly find or compare data.
[0036] Specifically, when the slave device needs to transmit data to the master device, it can send a synchronization request to the master device through the serial transceiver interface and the network interface. The synchronization request can include an identifier of the slave device, such as an identity identifier.
[0037] In an embodiment of the present invention, a synchronization request indicates that the slave device needs to realize data synchronization, and at this time it is necessary to know which data the master device specifically transmitted to last time. In an embodiment of the present invention, the slave device first sends a synchronization request to the master device. After the master device receives the synchronization request, it can find a solid-state hard disk that matches the identifier of the slave device in each solid-state hard disk of the master device according to the identifier of the slave device in the synchronization request. The data stored in the matching solid-state hard disk is the data transmitted from the slave device to the master device. Afterwards, the master device can also learn from the synchronization request that the slave device needs to realize data synchronization, and then it can obtain the block at the tail of the matching solid-state hard disk, which is recorded as the first storage block.
[0038] It can be understood that when the main device stores data in the solid-state hard disk, it creates a block to store data every time it receives data from a block, and the depth of the solid-state hard disk will continue to increase as the amount of data received increases. Therefore, the creation time / data reception time of the solid-state hard disk from the head block to the tail block is getting later and later, that is, the tail block is the block corresponding to the data transmitted from the device at the last time. The block at the tail of the solid-state hard disk can quickly determine the end point of the last data sent from the device.
[0039] Therefore, after the master device of the embodiment of the present invention obtains the first storage block in the solid-state hard disk that matches the identifier of the slave device, the verification data of the block included in the first storage block can be obtained by parsing the first storage block, and the verification data of the first storage block can be obtained, which is recorded as the first verification data, and then the first verification data can be sent to the corresponding slave device.
[0040] The data type of the first data includes a control command or a query request, and the transmission priority of the control command is higher than the transmission priority of the query request. In the embodiment of the present invention, the first data in the data transmission queue is sent to the slave device according to the priority of different types of data to avoid data being discarded during the data transmission process.
[0041] The embodiment of the present invention obtains the first data sent by the master device through the network interface terminal and determines the data type of the first data. Specifically, after receiving the first data sent by the master device, the first data can be parsed to determine the data type of the first data.
[0042] Among them, control commands and query requests are basic operations in the Modbus protocol, and the corresponding data types are control commands or query requests. Control commands are usually sent by the master device to the slave device to change the state of the slave device or perform specific operations. For example, the master device can send a command to read or write the register value of the slave device. The query request is initiated by the master device to obtain the status information or data of the slave device. After receiving the query request, the slave device will return the corresponding response message according to the content of the request. In addition, the function code in the Modbus protocol defines the operation type of the request and response. For example, function code 03 (hexadecimal 0x03) is used to read the value of the holding register, while function code 06 (hexadecimal 0x06) is used to write a value to a single holding register. In addition, the Modbus protocol also specifies some error codes, which are represented by adding 0x80 to the function code to indicate abnormal status in the response.
[0043] Step 20: Determine, based on the first verification data, a target block corresponding to second verification data that is consistent with the first verification data in the solid-state hard disk corresponding to the slave device.
[0044] In the embodiment of the present invention, each slave device will also be provided with a corresponding solid-state hard disk, and the solid-state hard disk includes a plurality of blocks linked together in an orderly manner, wherein a new block is created each time a data is generated by the slave device, and the new solid-state hard disk is connected to the end of the solid-state hard disk, and the depth of the solid-state hard disk of the slave device is continuously deepened in this way, that is, the blocks in the solid-state hard disk of the slave device are also arranged and linked in sequence according to the time of creation. It can be understood that each block in the solid-state hard disk of the slave device can be a block whose data has been transmitted to the master device, or a block whose data has not yet been transmitted to the master device.
[0045] For each block in the SSD of the slave device, each block may also include block depth, block generation time, check data of the previous block (or parent block), check data of the current block, and block data, etc. For explanations of the relevant block contents, please refer to the explanations in the steps.
[0046] Specifically, after receiving the first verification data of the first storage block sent to it by the master device, the slave device that needs to perform data synchronization can find the verification data of the current block (which can be recorded as the second verification data) in each of its blocks, and compare it with the first verification data for consistency, so as to find a block whose second verification data is consistent with the first verification data in each block of the slave device, and use the block whose second verification data is consistent with the first verification data as the target block; or the slave device can also obtain one or more blocks from the end of its solid-state hard disk, and obtain the verification data of the current block in these small blocks, and compare it with the first verification data for consistency, so as to find a block whose second verification data is consistent with the first verification data in these blocks, and use the block whose second verification data is consistent with the first verification data as the target block; or the slave device can also obtain one block at a time from the end of its solid-state hard disk to perform verification data consistency comparison until the target block whose verification data is consistent is found; or other methods can be used, in short, the target block whose second verification data is consistent with the first verification data can be found.
[0047] Step 30, determine the block to be sent in the SSD of the slave device according to the target block, and transmit the original SSD data associated with the block to be sent to the master device; the block to be sent is the block in the SSD of the slave device whose data has not been sent to the master device.
[0048] In the embodiment of the present invention, it can be understood that the verification data of the current block in the target block is consistent with the first verification data of the storage block of the master device, that is, the last time the slave device sent data ended with the target block, that is, the target block is the end position of the last data sent by the slave device. Through the end position, blocks whose block creation time is before the target block creation time can be found in the solid-state hard disk of the slave device. These blocks are blocks whose data has not been sent to the master device and can be recorded as blocks to be sent.
[0049] After obtaining the block to be sent, the original data associated with the block to be sent can be obtained, and the data associated with the block to be sent and the block to be sent can be sent to the master device. After receiving the data, the master device can continue to create a new block after the first storage block of the solid-state hard disk of the slave device to store the data of the block to be sent.
[0050] Step 40: submitting the first data to the data transmission queue of the serial transceiver interface based on the network interface.
[0051] Step 50: Based on the serial transceiver interface, send the first data in the data transmission queue to the slave device according to the data type.
[0052] When determining the data type of the first data, the first data can be further submitted to the data transmission queue of the serial transceiver interface end based on the data type of the first data based on the network interface end. For example, different types of first data are first submitted to the queue of the serial transceiver interface end for queuing, and data transmission priorities of various data types are agreed upon at the same time, so that the serial transceiver interface end can perform solid state hard disk data transmission in order of priority. The data types of the first data are different, and the transmission priorities of different types of data can be pre-defined. The data transmission priorities are used to characterize each data type in the data transmission queue at the same time.
[0053] Further combined with the transmission priority of each data type, the first data in the data transmission queue is sent to the data transmission queue of the serial transceiver interface end of the slave device based on the serial transceiver interface end, which can improve the serial bus rate, thereby improving communication efficiency and avoiding data loss.
[0054] After the embodiment of the present invention receives the first data sent by the master device, the network interface end of the solid-state hard disk parses the first data to obtain the data type of the first data, and submits the first data to the data transmission queue of the serial transceiver interface end, wherein, because different data types have different transmission priorities, the transmission priority of the control command is higher than the transmission priority of the query request, and the serial transceiver interface end sends the first data in the data transmission queue to the slave device according to the priority of different types of data, which can avoid data being discarded during the data transmission process.
[0055] In the embodiment of the present invention, since the slave device only needs to verify its own blocks according to the verification data of the storage blocks fed back by the master device to determine the untransmitted blocks for transmission, there is no need to traverse the data of all blocks, thereby reducing the complexity of the solid-state hard disk data transmission process, and at the same time can improve the real-time performance of the solid-state hard disk data transmission and make the transmission of missing data more timely.
[0056] In one embodiment, the step 20 of determining, in the solid state drive corresponding to the slave device, a target block corresponding to second verification data that is consistent with the first verification data, comprises:
[0057] Step 201, obtaining a second storage block in a solid state drive corresponding to a slave device, and using the second storage block as a current block.
[0058] Among them, the blocks in the solid-state hard disk of the slave device are linked in chronological order, and the tail block is the block with the latest creation time. The block at the tail of the solid-state hard disk of the slave device can be obtained first and recorded as the second storage block, and then the second storage block can be used as the current block for verification data comparison of the slave device.
[0059] Step 202, perform a verification operation, the verification operation includes: determining the second verification data corresponding to the current block based on the current block; determining whether the first verification data and the second verification data are consistent; if the first verification data and the second verification data are inconsistent, obtaining the parent block corresponding to the current block from the solid-state hard disk of the device based on the current block.
[0060] In an embodiment of the present invention, after obtaining the current block in the slave device, the verification data of the current block can be obtained in the current block, recorded as the second verification data of the current block, and then the second verification data of the current block can be compared with the first verification data of the storage block of the master device to see whether they are consistent, that is, whether the two are the same. If the second verification data of the current block of the slave device is consistent with the first verification data of the storage block of the master device, it means that the second storage block of the slave device is the target block.
[0061] If the second verification data of the current block of the slave device is inconsistent with the first verification data of the storage block of the master device, it means that the block where the master device last received data was not the second storage block, that is, the data of the second storage block in the slave device has not been sent yet, then you can look for the block where the sending is cut off before the second storage block, that is, you can get the previous block of the current block in the solid-state hard disk of the slave device and record it as the parent block of the current block.
[0062] Optionally, the current block includes the parent check data of the parent block corresponding to the current block. For the method of obtaining the previous block / parent block of the current block from the solid state disk of the slave device, the parent block corresponding to the check data consistent with the parent check data can be determined in the solid state disk corresponding to the slave device according to the parent check data. In other words, a block consistent with PreHash can be found in the solid state disk according to PreHash in the current block, and the consistent block is the parent block of the current block.
[0063] Step 203, taking the parent block as the new current block, and returning to perform the verification operation until the first verification data and the second verification data are consistent, and when the first verification data and the second verification data are consistent, determining the parent block with the consistent verification data as the target block.
[0064] In an embodiment of the present invention, when the verification data of the storage blocks of the upper slave devices are inconsistent, the search can continue in the blocks before the second storage block of the slave device, and each time a block is searched forward, when the verification data of the second storage block of the slave device is inconsistent, the parent block before the second storage block can be found, and then the parent block is used as the new current block, and the verification operation in step 202 is returned to execute, that is, the verification data of the current block in the parent block can be continued to be obtained, and used as the new second verification data, and then compared with the first verification data for consistency. If they are consistent, the parent block is the target block; if they are still inconsistent, the parent block of the parent block can be continued to be obtained, and then the parent block of the parent block is used as the latest current block, and the verification operation in step 202 is iteratively / looped until a parent block whose second verification data is consistent with the first verification data is found in the solid-state hard disk of the slave device, and the iteration is stopped, and the parent block at this time is the target block.
[0065] In one embodiment, the step of determining the blocks to be sent in the solid state drive of the slave device according to the target blocks in step 40 includes: taking all current blocks whose first verification data and second verification data verified before the target block are inconsistent as the blocks to be sent.
[0066] That is to say, in the iteration / loop, starting from the second storage block of the slave device, each time when it is determined that its second verification data is inconsistent with the first verification data, the inconsistent block is used as the block to be sent, and all the blocks to be sent can be obtained after the iteration / loop.
[0067] The embodiment of the present invention starts from the storage block of the slave device and iterates / loops forward to search for blocks and compare the verification data with the storage block of the master device until the target block at the sending cutoff position in the slave device is found. In this way, there is no need for the slave device to traverse all its own data. It only needs to search and compare part of the data to obtain the unsent data, so that the transmission of missing data is more timely, and the time complexity of the solid-state hard disk data transmission can be reduced and the integrity of the solid-state hard disk data transmission can be ensured. In addition, the corresponding parent block can be determined in the solid-state hard disk through the verification data of the parent block included in the current block of the slave device, which can improve the efficiency and accuracy of determining the parent block, further reduce the time complexity of the solid-state hard disk data transmission and ensure the integrity of the solid-state hard disk data transmission. Further, the blocks with inconsistent verification data before the target block in the slave device can be used as the blocks to be sent, so that the blocks to be sent can be quickly and completely determined, and the integrity of the solid-state hard disk data transmission can be ensured.
[0068] In one embodiment, in the process of determining the block to be sent and actually transmitting the data of the block to be sent, in order to ensure the timing and accuracy of the solid state drive data transmission, the step of transmitting the original solid state drive data associated with the block to be sent to the host device in step 30 may include:
[0069] During the verification operation, each time it is determined that the first verification data and the second verification data are inconsistent, the current block whose first verification data and the second verification data are inconsistent is pushed into the preset to-be-sent stack as a to-be-sent block.
[0070] Among them, the stack is a data structure that follows the last-in-first-out (LIFO, La step t-in, Fir step t-out) principle, that is, the data pushed into the stack first is popped out last, and the data pushed into the stack later is popped out first.
[0071] In an embodiment of the present invention, a data structure for temporarily storing blocks can be pre-set from the device, such as a to-be-sent stack, which can be empty when initially set, and blocks to be sent can be continuously added later. In the process of iterative / loop execution of the verification operation, starting from the second storage block of the slave device, each time the verification data is inconsistent, the current block with the current verification inconsistency is pushed into the to-be-sent stack, and then the next iteration / loop process is continued, so that the earlier the block pushed into the to-be-sent stack is, the later the creation time / addition time of the data from the solid-state hard disk of the device is, that is, the later the creation time / addition time of the data in the solid-state hard disk is, the earlier the data is pushed into the to-be-sent stack (that is, the earlier the order in the to-be-sent stack is, the earlier it is pushed into the stack, and the later it is popped out when popping out), and the earlier the creation time / addition time of the data in the solid-state hard disk is, the later the data is pushed into the to-be-sent stack (that is, the later the order in the to-be-sent stack is, the later it is pushed into the stack, and the earlier it is popped out when popping out).
[0072] That is to say, the order in which the blocks to be sent in the to-be-sent stack are popped out is consistent with their creation time / joining time in the solid-state hard disk of the slave device. The creation time / joining time here can also be understood as the sending time of the block data, that is, the earlier the data needs to be sent, the earlier it will be popped out of the to-be-sent stack, thereby ensuring the accuracy and consistency of the solid-state hard disk data transmission.
[0073] The blocks to be sent in the to-be-sent stack are obtained in sequence according to the last-in-first-out order, and the original solid-state hard disk data associated with the blocks to be sent are transmitted to the main device in sequence.
[0074] In an embodiment of the present invention, when the lower slave device sends data associated with a block to be sent to the master device, it can take out / pop out one block to be sent from the stack to be sent at a time according to the last-in-first-out principle, and send the original data associated with the block to be sent to the master device, and then continue to obtain the next block to be sent and send the data in sequence.
[0075] Optionally, before obtaining the blocks to be sent in the to-be-sent stack in a last-in-first-out order, it is also possible to first determine whether the to-be-sent stack is empty; if the to-be-sent stack is not empty, then the process returns to the step of obtaining the blocks to be sent in the to-be-sent stack in a last-in-first-out order. If the to-be-sent stack is empty, it means that all data from the device has been sent, and the process can be terminated.
[0076] The embodiment of the present invention sequentially adds the blocks that are inconsistent in each verification in the iterative process to the to-be-sent stack, and subsequently obtains data from the to-be-sent stack and sends it to the main device in accordance with the last-in-first-out principle, so that the processing / transmission order of the to-be-sent blocks is consistent with the order in which they are added to the solid-state hard disk, thereby ensuring the accuracy and consistency of the solid-state hard disk data transmission. In addition, before taking a block from the to-be-sent stack for transmission, it can be determined whether the to-be-sent stack is empty, and if it is not empty, the block is taken for transmission, so that it can avoid taking a block for transmission when the to-be-sent stack is empty, thereby improving the efficiency and accuracy of the solid-state hard disk data transmission and avoiding invalid transmission.
[0077] In actual situations, due to storage space limitations, the block to be sent may include the original data associated with the block to be sent, or may not include the original data associated with the block to be sent, such as summary information of the original data associated with the block to be sent, and the summary information may be information such as the original data file name, file save path, checksum, etc. Therefore, the step of transmitting the original solid-state hard disk data associated with the block to be sent to the main device in step 30 may include:
[0078] If the block to be sent includes the original data associated with the block to be sent, the block to be sent is transmitted to the main device; or, if the block to be sent includes summary information of the original data associated with the block to be sent, the original data associated with the block to be sent is obtained according to the summary information, and both the original data and the block to be sent are transmitted to the main device.
[0079] Among them, if the block to be sent directly includes the original data associated with the block to be sent, after popping a block to be sent from the stack to be sent, the block to be sent can be directly sent to the master device. After receiving the block to be sent, the master device can directly add the sending block to the end of its solid state drive, or create a block at the end of its solid state drive and fill it with information corresponding to the block to be sent.
[0080] If the block to be sent does not directly include the original data associated with the block to be sent, after a block to be sent is popped from the stack to be sent, the original data associated with the block to be sent can be found at the corresponding position of the slave device through the summary information of the original data associated with the block to be sent, and then the original data and the block to be sent are sent to the master device together.
[0081] After receiving the block to be sent and its associated original data, the master device can directly add the block to the end of its SSD; or it can create a block at the end of its SSD and fill it with the information corresponding to the block to be sent. At the same time, the original data can also be stored in the master device.
[0082] The embodiment of the present invention transmits blocks and / or original data to the main device when the blocks to be sent include different contents of the original data associated with them. This ensures that the original data associated with the blocks to be sent can be accurately transmitted to the main device under various circumstances, thereby ensuring the accuracy and integrity of the solid-state hard disk data transmission.
[0083] In one embodiment, submitting the first data to a data transmission queue of the serial transceiver interface end according to the data type of the first data includes:
[0084] In the case where the first data is a control command, submitting the control command to a data transmission queue;
[0085] In the case where the first data is a query request, querying whether there is data to be queried in the cache of the solid-state hard disk according to the query request; the query request includes a slave device address, a function code, a query start address, a query quantity, and a cyclic redundancy check code corresponding to the data to be queried, the query start address is used to determine the address of the register to be queried, the slave device includes at least one register, and the register is used to store and transfer data;
[0086] When there is no data to be queried in the cache of the solid state drive, the query request that does not hit the cache is submitted to the data transmission queue;
[0087] When there is data to be queried in the cache of the solid state drive, determining whether the data to be queried is within the validity period according to the cache timestamp corresponding to the data to be queried;
[0088] When the data to be queried is not within the validity period, the query request whose cache has expired is submitted to the data transmission queue.
[0089] Specifically, because the data type includes a control command or a query request, different data types have different transmission priorities, and the transmission priority of the control command is higher than the transmission priority of the query request. Based on this, submitting the first data to the data transmission queue of the serial transceiver interface end can be implemented in the following manner:
[0090] In the case where the first data is a control command, the control command is submitted to a data transmission queue for queuing. It can be understood that the data transmission priority of the control command may be high.
[0091] It is understandable that the master device, in addition to sending query requests, also sends control messages to write into certain registers. Such messages are not cached but transmitted immediately.
[0092] In the case where the first data is a query request, the query request is further parsed, wherein the query request may be a register query request, and the register is used to store data. In the Modbus protocol, a register query request is a communication transaction that allows the master device to read the state or value of a specific register on the slave device. This request is mainly used for data acquisition and monitoring to ensure that the system can obtain real-time or latest data from the slave device. The register query request consists of the following parts, as shown in Table 1, which is an information table of the register query request:
[0093] Table 1 Information table of register query request
[0094] ;
[0095] The function code is used to indicate the type of query request. The following are several common register query requests and their functions:
[0096] 1. Read coil status (function code 0x01): Read the status of the coil register. Each coil corresponds to a bit, and the status can be ON (1) or OFF (0).
[0097] 2. Read discrete input status (function code 0x02): Read the status of discrete input registers. These inputs usually come from sensors or other switching devices, and the status is also ON or OFF.
[0098] 3. Read holding registers (function code 0x03): Read the values in the holding registers. These registers are readable and writable and are used to store data that needs to be maintained, such as set points, configuration parameters, etc.
[0099] 4. Read input registers (function code 0x04): Read the values in the input registers. These registers are usually read-only and are used to store the values of analog input signals or other data that needs to be reported.
[0100] 5. Read multiple coil status (function code 0x0F, used only in Modbus Plus): Read the status of multiple coil registers, allowing the status of multiple coils to be read in one request.
[0101] 6. Read multiple holding registers (function code 0x0B, used only in Modbus Plus): Read the values of multiple holding registers, allowing the values of multiple holding registers to be read in one request.
[0102] Furthermore, based on the "device address", "function code", "query starting address" and "query quantity" in the register query request, it is possible to further query whether there is a corresponding register value in the local cache of the solid-state drive, that is, to query whether there is data to be queried in the cache of the solid-state drive according to the query request. The query request includes the slave device address, function code, query starting address, query quantity, and cyclic redundancy check code corresponding to the data to be queried. The query starting address is used to determine the address of the register to be queried. The slave device includes at least one register, and the register is used to store and transfer data.
[0103] If there is no data to be queried in the cache of the solid state drive, the query request that does not hit the cache is submitted to the data transmission queue.
[0104] If there is data to be queried in the cache of the solid-state drive, it is determined whether the data to be queried is within the validity period according to the cache timestamp corresponding to the data to be queried. That is, if there is data to be queried, it is further determined whether the cache timestamp of the data to be queried is within the validity period (the validity period is configurable).
[0105] If the timestamp is within the validity period, the register value can be directly returned to the master device according to the Modbus protocol, and the timestamp of this access can be recorded.
[0106] Specifically, if there is no corresponding register value in the local cache, the query content of the master device is transmitted to the slave device, and then returned to the master device after the slave device returns the query result, caches the query result, and records the timestamp in the query result to facilitate subsequent determination of whether the cached value is within the validity period.
[0107] When the data to be queried is not within the validity period, the query request with expired cache is submitted to the data transmission queue. Specifically, if the cache timestamp of the data to be queried exceeds the validity period, it means that the communication between the solid-state drive and the slave device fails, and an error is returned directly to the master device.
[0108] Optionally, the SSD may periodically check the access timestamps of cached query results. For caches that have not been accessed for a period of time (configurable), it may be considered that the host device no longer needs the data and the data may be deleted from the cache to free up memory space.
[0109] In one embodiment, a solid state drive data transmission method includes:
[0110] Step 301: Receive data.
[0111] Receive data sent by the master device.
[0112] Step 302: determine whether the data is a control command;
[0113] If the result of executing step 302 is yes, execute step 303;
[0114] Step 303: Submit the control command to the queue of the serial transceiver interface (priority: high);
[0115] If the execution result of step 302 is no, execute step 304;
[0116] Step 304: Check whether there is data to be queried in the cache;
[0117] If the execution result of step 304 is no, execute step 305;
[0118] Step 305: submit the data to the queue of the serial transceiver interface for queuing (priority: medium);
[0119] If the result of step 304 is yes, execute step 306;
[0120] Step 306: determine whether the data to be queried is within the validity period;
[0121] If the execution result of step 306 is no, execute step 307;
[0122] Step 307: submit the data to the queue of the serial transceiver interface for queuing (priority: medium);
[0123] If the result of step 306 is yes, execute step 308;
[0124] Step 308: Return the query result based on the cached data.
[0125] In the embodiment of the present invention, when the first data is a control command, the control command is directly submitted to the data transmission queue. When the first data is a query request, whether there is data to be queried in the cache of the solid-state hard disk is queried according to the query request. When there is no data to be queried in the cache of the solid-state hard disk, the query request with cache miss is submitted to the data transmission queue. When there is data to be queried in the cache of the solid-state hard disk, whether the data to be queried is within the validity period is determined according to the cache timestamp corresponding to the data to be queried. When the data to be queried is not within the validity period, the query request with cache invalidation is submitted to the data transmission queue, so that the query result is returned after the query request is received from the device later, so that the solid-state hard disk caches the query result locally. The solid-state hard disk avoids repeated transmission of the same data on the serial bus by caching the query results within a certain time range, and avoids the problem of inconsistency between the cache state and the actual state through the periodic refresh and invalidation mechanism of the cache, thereby improving the bus utilization rate, improving communication efficiency, and avoiding data loss during data transmission.
[0126] In one embodiment, a cache miss query request is used for a slave device to perform a data query based on a cache miss query request, and second data corresponding to the cache miss query request is returned to the solid-state drive; the second data corresponding to the cache miss query request includes a query result corresponding to the cache miss query request and a cache timestamp corresponding to the query result; a cache invalidated query request is used for a slave device to perform a data query based on a cache invalidated query request, and second data corresponding to the cache invalidated query request is returned to the solid-state drive; the second data corresponding to the cache invalidated query request includes a query result corresponding to the cache invalidated query request and a cache timestamp corresponding to the query result.
[0127] Specifically, in some embodiments, after the query request of cache miss is sent to the slave device, the slave device performs data query in the register according to the query request of cache miss, and returns the second data (i.e., query result) corresponding to the query request of cache miss to the solid state drive, so that the solid state drive stores the second data (i.e., query result) corresponding to the query request of cache miss in the cache, which is convenient for the master device to query, and the second data corresponding to the query request of cache miss includes the query result corresponding to the query request of cache miss and the cache timestamp corresponding to the query result. It can be understood that because the solid state drive returns the query result directly from the cache, it can cope with the query even when multiple master devices query at the same time, and the number of master devices supporting simultaneous query is only limited by the processing power of the solid state drive.
[0128] Correspondingly, the cache-expired query request is used for the slave device to perform data query according to the cache-expired query request, and return the second data corresponding to the cache-expired query request to the solid-state drive; the second data corresponding to the cache-expired query request includes the query result corresponding to the cache-expired query request and the cache timestamp corresponding to the query result.
[0129] Since the solid-state drive directly returns the query results from the cache, the embodiment of the present invention can handle simultaneous queries even if there are multiple master devices. The number of master devices supporting simultaneous queries is only limited by the processing capacity of the solid-state drive, and the communication efficiency is also greatly improved.
[0130] In one embodiment, the transmission priority of the control command is higher than the transmission priority of the query request of the cache miss, and the transmission priority of the query request of the cache miss is higher than the query request of the cache invalidated; sending the first data in the data transmission queue to the slave device according to the data type of the first data includes:
[0131] Determine whether there is a control command in the data transmission queue;
[0132] When there is a control command in the data transmission queue, the control command is sent to the slave device;
[0133] When it is determined that there is no control command in the data transmission queue, determining whether there is a query request with a cache miss in the data transmission queue;
[0134] If there is a query request with a cache miss in the data transmission queue, the query request with a cache miss in the data transmission queue is sent to the slave device;
[0135] If there is a query request with a cache miss in the data transmission queue, the query request with a cache failure in the data transmission queue is sent to the slave device.
[0136] Specifically, in some embodiments, the transmission priority of each data type is ranked as follows:
[0137] The transmission priority of the control command is higher than the transmission priority of the query request of the cache miss, and the transmission priority of the query request of the cache miss is higher than the query request of the cache expired.
[0138] Correspondingly, according to the data type of the first data, the first data in the data transmission queue is sent to the slave device and can be screened in order of priority from high to low, and the data type with high priority is transmitted first. This process can be implemented by the following steps, including:
[0139] First, it is determined whether there is a control command in the data transmission queue. The determination result includes: there is a control command or there is no control command. Different steps are performed according to different determination results, as follows:
[0140] When there is a control command in the data transmission queue, the control command is directly sent to the slave device.
[0141] On the contrary, when it is determined that there is no control command in the data transmission queue, it is further determined whether there is a cache miss query request in the data transmission queue. If there is a cache miss query request, the cache miss query request in the data transmission queue is sent to the slave device; if there is no cache miss query request in the data transmission queue, the cache invalid query request in the data transmission queue is sent to the slave device. By analogy, the data in the data transmission queue can be sent to the slave device according to the transmission priority, so as to maximize the serial bus rate and improve the communication efficiency, thereby avoiding the data being discarded during the data transmission process.
[0142] The transmission process of the serial bus transmitter for the data in the data transmission queue is as follows:
[0143] Step 401, determine whether there is a control message in the queue;
[0144] If the execution result of step 401 is yes, then execute step 402;
[0145] Step 402: Send the control message;
[0146] If the execution result of step 401 is no, then execute step 403;
[0147] Step 403: determine whether there is a query message in the queue that does not hit the cache;
[0148] If the result of step 403 is yes, then step 404 is executed;
[0149] Step 404: Send out the query message that does not hit the cache;
[0150] If the execution result of step 403 is no, then execute step 405;
[0151] Step 405: Find the query message that will be invalidated earliest
[0152] Step 406: Send out the earliest invalid query message.
[0153] The serial transceiver interface end of the embodiment of the present invention can prioritize the data in the queue for the data to be sent, the transmission priority of the control command is higher than the transmission priority of the query request of the cache miss, the transmission priority of the query request of the cache miss is higher than the query request of the cache expired, and the data in the data transmission queue is transmitted according to the data transmission priority, that is, the control message is transmitted first, followed by the query message of the cache miss, and then the query message of the cache periodically refreshed, and the query message that expires first is refreshed first, so that the tight bandwidth of the serial bus can be used to transmit the most important and urgent messages in an orderly manner, which can improve the serial bus rate and improve communication efficiency.
[0154] In one embodiment, the solid state drive data transmission method further includes:
[0155] In response to receiving the second data, when a preset number of bytes of the second data are received, the preset number of bytes of the second data are parsed, and whether the second data is a legal message is determined according to the parsing result and the message legality condition; wherein the message legality condition includes at least one of the following: the device identification and function code corresponding to the second data are the same as the device identification and function code in the query request; the cyclic redundancy check code corresponding to the second data is the same as the cyclic redundancy check code in the query request; and the length of the second data meets a preset threshold;
[0156] When it is determined that the second data is a legitimate message, the second data is stored in the solid state drive.
[0157] Specifically, in some embodiments, the solid state drive data transmission method further includes timely processing after determining that the received data is complete, so as to avoid unnecessary waiting time:
[0158] It is understandable that the serial interface uses a data stream mode, and there is no clear boundary between two messages, which is separated by idle time. Therefore, in the traditional receiving method, if no new data is received for a period of time, it is considered that a message has been transmitted. Therefore, it is always necessary to wait for a period of idle time. During this period, data cannot be transmitted, which easily leads to a waste of bandwidth.
[0159] In response to receiving the second data, in the present embodiment, when a preset number of bytes of the second data are received, the serial transceiver interface end can parse the preset number of bytes of the second data, and determine whether the second data is a legal message based on the parsing result and the message legality condition. For example, each time one or more bytes are received, the received second data is parsed. When it conforms to a legal Modbus message, it is processed. The advantage of doing so is that there is no need to wait for the bus timeout. The next query or control message can be sent immediately after an interval of 3.5 characters as specified in the Modbus RTU protocol.
[0160] Among them, the message legality condition includes at least one of the following: the device identification and function code corresponding to the second data are the same as the device identification and function code in the query request; the cyclic redundancy check code CRC corresponding to the second data is the same as the cyclic redundancy check code CRC in the query request; and the length of the second data meets the preset threshold. It should be noted that the message legality condition is used to determine whether the second data is a legal message, and the message legality condition can also be determined according to actual needs, and is not limited to the above message legality condition.
[0161] Furthermore, when it is determined that the second data is a legitimate message, the second data can be stored in the solid state drive. Specifically, when it is determined that the second data is a legitimate message, the second data can be processed, for example, the second data (such as cache results) can be stored according to preset fields, and stored in the cache of the solid state drive, so as to facilitate subsequent rapid query by the main device and improve data query efficiency.
[0162] The embodiment of the present invention does not perform any additional waiting except for the interval specified by the protocol, and can make full use of the transmission time of the serial bus, thereby improving the utilization rate of the serial bus and further improving the efficiency of data query.
[0163] In one embodiment, the first data includes a plurality of adjacent query requests; and sending the first data in the data transmission queue to the slave device according to the data type of the first data includes:
[0164] Merging multiple adjacent query requests to obtain a merged query request;
[0165] Send the merged query request to the slave device.
[0166] Specifically, the first data includes multiple adjacent query requests, wherein the adjacent query requests can be understood as the query start addresses (registers) corresponding to each query request are adjacent, that is, each query request is a query for adjacent registers. When the first data includes multiple adjacent query requests, the serial bus interface can merge the multiple adjacent query requests when sending the query request to the slave device, and send them to the slave device at one time, thereby improving the efficiency of the serial bus.
[0167] In one embodiment, the specific implementation process of merging query requests for adjacent registers is as follows:
[0168] First, multiple adjacent query requests are merged to obtain a merged query request. It should be noted that the number of registers that can be queried in the merged query request is multiple, and the maximum number is no more than 127. It can be understood that when the Modbus protocol queries registers, 1 to 127 registers can be queried at a time. Taking the most commonly used Modbus RTU protocol as an example, if one register is queried, the query message sent is 8 bytes long, and the query result message returned is 7 bytes long, of which only 2 bytes are valid data, and the rest are auxiliary communication content. Without considering the delay between sending and receiving, the transmission efficiency is 13%; if 127 registers are queried, the query message sent is still 8 bytes long, and the query result message returned is 259 bytes long, 254 bytes are valid data, and the transmission efficiency is 95.1%. It can be seen that the more registers queried at one time, the higher the communication efficiency. Therefore, splicing adjacent registers (that is, splicing adjacent query requests) can improve communication efficiency. Then, the serial bus based on the solid-state drive sends the merged query request to the slave device, which can improve the efficiency of the serial bus.
[0169] The embodiment of the present invention combines a plurality of adjacent query requests and sends the combined query requests to a slave device, which can improve the rate of the serial bus and thus improve the communication efficiency.
[0170] The solid state drive provided by the present invention is described below. The solid state drive described below and the solid state drive data transmission method described above can be referenced to each other.
[0171] See also Figure 2 , Figure 2A structural diagram of a solid-state hard disk provided in an embodiment of the present invention is applied to a data transmission system, wherein the data transmission system comprises at least a master device, a solid-state hard disk and a slave device, wherein the interaction port between the master device and the solid-state hard disk is a network interface terminal, and the interaction port between the solid-state hard disk and the slave device is a serial transceiver interface terminal; the solid-state hard disk comprises a communication unit, a determination unit and a data transmission unit;
[0172] The communication unit 210 is used to send a synchronization request to the master device based on the serial transceiver interface end, and receive the first verification data and the first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes the identification of the slave device; the data type of the first data includes a control command or a query request; the first verification data is the verification data determined by the master device according to the synchronization request, after the master device determines the first storage block of the solid-state hard disk corresponding to the identification of the slave device in the master device according to the synchronization request, based on the first storage block;
[0173] A determination unit 220, configured to determine, in the solid state hard disk corresponding to the slave device, a target block corresponding to second verification data consistent with the first verification data, based on the first verification data;
[0174] The data transmission unit 230 is configured to:
[0175] Determine the block to be sent in the SSD of the slave device according to the target block, and transmit the original SSD data associated with the block to be sent to the master device; the block to be sent is the block in the SSD of the slave device whose data has not been sent to the master device;
[0176] Submitting the first data to the data transmission queue of the serial transceiver interface end based on the network interface end;
[0177] Based on the serial transceiver interface, the first data in the data transmission queue is sent to the slave device according to the data type.
[0178] The solid-state hard disk provided by the present invention can determine the untransmitted blocks for transmission because the slave device only needs to verify its own blocks according to the verification data of the storage blocks fed back by the master device. In this way, there is no need to traverse the data of all blocks, thereby reducing the complexity of the data transmission process of the solid-state hard disk.
[0179] See also Figure 3 , Figure 3 Schematic diagram of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, an embodiment of the present invention provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0180] Sending a synchronization request to the master device based on the serial transceiver interface end, and receiving first verification data and first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes the identification of the slave device; the data type of the first data includes a control command or a query request; the first verification data is verification data determined by the master device according to the synchronization request in the master device after determining the first storage block of the solid-state hard disk corresponding to the identification of the slave device according to the first storage block;
[0181] Determine, based on the first verification data, a target block corresponding to second verification data that is consistent with the first verification data in a solid-state hard disk corresponding to the slave device;
[0182] Determine the block to be sent in the SSD of the slave device according to the target block, and transmit the original SSD data associated with the block to be sent to the master device; the block to be sent is the block in the SSD of the slave device whose data has not been sent to the master device;
[0183] Submitting the first data to the data transmission queue of the serial transceiver interface end based on the network interface end;
[0184] Based on the serial transceiver interface, the first data in the data transmission queue is sent to the slave device according to the data type.
[0185] See also Figure 4 , Figure 4 Schematic diagram of an embodiment of a computer-readable storage medium provided in an embodiment of the present invention. Figure 4 As shown, this embodiment provides a computer-readable storage medium 400, on which a computer program 311 is stored. When the computer program 311 is executed by a processor, the following steps are implemented:
[0186] Sending a synchronization request to the master device based on the serial transceiver interface end, and receiving first verification data and first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes the identification of the slave device; the data type of the first data includes a control command or a query request; the first verification data is verification data determined by the master device according to the synchronization request in the master device after determining the first storage block of the solid-state hard disk corresponding to the identification of the slave device according to the first storage block;
[0187] Determine, based on the first verification data, a target block corresponding to second verification data that is consistent with the first verification data in a solid-state hard disk corresponding to the slave device;
[0188] Determine the block to be sent in the SSD of the slave device according to the target block, and transmit the original SSD data associated with the block to be sent to the master device; the block to be sent is the block in the SSD of the slave device whose data has not been sent to the master device;
[0189] Submitting the first data to the data transmission queue of the serial transceiver interface end based on the network interface end;
[0190] Based on the serial transceiver interface, the first data in the data transmission queue is sent to the slave device according to the data type.
[0191] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0192] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0193] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0194] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0195] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0196] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0197] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A solid state hard disk data transmission method, characterized in that: Applied to a data transmission system, the data transmission system at least comprises a master device, a solid state drive and a slave device, the interactive port between the master device and the solid state drive is a network interface terminal, and the interactive port between the solid state drive and the slave device is a serial transceiver interface terminal; The solid state hard disk data transmission method comprises: Sending a synchronization request to the master device based on the serial transceiver interface end, and receiving first verification data and first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes an identifier of the slave device; the data type of the first data includes a control command or a query request, and the transmission priority of the control command is higher than the transmission priority of the query request; the first verification data is verification data determined according to the first storage block of the solid-state hard disk corresponding to the identifier of the slave device in the master device according to the synchronization request, after the master device determines the first storage block in the master device according to the synchronization request; Determine, according to the first verification data, a target block corresponding to second verification data consistent with the first verification data in the solid-state hard disk corresponding to the slave device; Determine the block to be sent in the solid-state hard disk of the slave device according to the target block, and transmit the original solid-state hard disk data associated with the block to be sent to the master device; the block to be sent is a block in the solid-state hard disk of the slave device whose data has not been sent to the master device; Submitting the first data to a data transmission queue of the serial transceiver interface end based on the network interface end; Based on the serial transceiver interface, the first data in the data transmission queue is sent to a slave device according to the data type.
2. The solid state hard disk data transmission method according to claim 1, characterized in that: Submitting the first data to the data transmission queue of the serial transceiver interface includes: In the case where the first data is the control command, submitting the control command to the data transmission queue; In the case where the first data is the query request, querying whether there is data to be queried in the cache of the solid-state drive according to the query request; the query request includes a slave device address, a function code, a query start address, a query quantity, and a cyclic redundancy check code corresponding to the data to be queried, the query start address is used to determine an address of a register to be queried, the slave device includes at least one register, and the register is used to store and transfer data; In the case where the data to be queried does not exist in the cache of the solid state drive, submitting a cache miss query request to the data transmission queue; In the case where the data to be queried is present in the cache of the solid state drive, determining whether the data to be queried is within a validity period according to a cache timestamp corresponding to the data to be queried; In the case that the data to be queried is not within the validity period, the query request whose cache has expired is submitted to the data transmission queue.
3. The solid state hard disk data transmission method according to claim 2, characterized in that: The cache miss query request is used for the slave device to perform data query according to the cache miss query request, and return the second data corresponding to the cache miss query request to the solid state drive; The second data corresponding to the cache-missed query request includes a query result corresponding to the cache-missed query request and a cache timestamp corresponding to the query result; the cache-expired query request is used for the slave device to perform data query according to the cache-expired query request, and return the second data corresponding to the cache-expired query request to the solid-state drive; The second data corresponding to the query request whose cache has expired includes the query result corresponding to the query request whose cache has expired and the cache timestamp corresponding to the query result.
4. The solid state hard disk data transmission method according to claim 3, characterized in that: The transmission priority of the control command is higher than the transmission priority of the query request of the cache miss; the transmission priority of the query request of the cache miss is higher than the query request of the cache expired; The sending the first data in the data transmission queue to a slave device according to the data type includes: Determining whether there is a control command in the data transmission queue; If the control command is in the data transmission queue, sending the control command to the slave device; In the case where it is determined that the control command is not in the data transmission queue, determining whether there is a query request with the cache miss in the data transmission queue; There is a query request for the cache miss in the data transmission queue, sending the query request for the cache miss in the data transmission queue to the slave device; If there is a query request with a cache miss in the data transmission queue, the query request with a cache fail in the data transmission queue is sent to the slave device.
5. The solid state hard disk data transmission method according to claim 4, characterized in that: The solid state hard disk data transmission method further includes: In response to receiving the second data, when a preset number of bytes of the second data are received, the preset number of bytes of the second data are parsed, and whether the second data is a legal message is determined according to the parsing result and a message legality condition; the message legality condition includes at least one of the following: the device identification and function code corresponding to the second data are the same as the device identification and function code in the query request; the cyclic redundancy check code corresponding to the second data is the same as the cyclic redundancy check code in the query request; and the length of the second data meets a preset threshold; When it is determined that the second data is a legitimate message, the second data is stored in the solid state drive.
6. The solid state hard disk data transmission method according to claim 1, characterized in that: The determining, according to the first verification data, in the solid state hard disk corresponding to the slave device, a target block corresponding to second verification data that is consistent with the first verification data includes: Obtain a second storage block in the solid state drive corresponding to the slave device, and use the second storage block as the current block; Performing a verification operation, the verification operation comprising: determining second verification data corresponding to the current block according to the current block; determining whether the first verification data and the second verification data are consistent; if the first verification data and the second verification data are inconsistent, obtaining a parent block corresponding to the current block in the solid-state hard disk of the slave device according to the current block; The parent block is used as a new current block, and the verification operation is performed again until the first verification data and the second verification data are consistent, and when the first verification data and the second verification data are consistent, the parent block with consistent verification data is determined as the target block.
7. The solid state hard disk data transmission method according to claim 6, characterized in that: The transmitting the original solid state hard disk data associated with the block to be sent to the main device includes: In the process of performing the verification operation, each time it is determined that the first verification data and the second verification data are inconsistent, the current block for which the first verification data and the second verification data are inconsistent is pushed into a preset to-be-sent stack as a to-be-sent block; The blocks to be sent in the to-be-sent stack are acquired in sequence according to a last-in-first-out order, and the original solid-state hard disk data associated with the blocks to be sent are transmitted to the master device in sequence.
8. The solid state hard disk data transmission method according to claim 1, characterized in that: The block to be sent includes original data associated with the block to be sent or summary information of the original data associated with the block to be sent; the original solid-state hard disk data associated with the block to be sent is transmitted to the main device, including: If the block to be sent includes original data associated with the block to be sent, transmitting the block to be sent to the master device; If the block to be sent includes summary information of original data associated with the block to be sent, the original data associated with the block to be sent is obtained according to the summary information, and the original data and the block to be sent are transmitted to the master device.
9. A solid state hard disk, characterized in that: Applied to a data transmission system, the data transmission system at least comprises a master device, a solid state drive and a slave device, the interaction port between the master device and the solid state drive is a network interface terminal, the interaction port between the solid state drive and the slave device is a serial transceiver interface terminal; the solid state drive comprises a communication unit, a determination unit and a data transmission unit; A communication unit, configured to send a synchronization request to the master device based on the serial transceiver interface end, and receive first verification data and first data sent by the master device based on the synchronization request based on the network interface end; the synchronization request includes an identifier of the slave device; a data type of the first data includes a control command or a query request; the first verification data is verification data determined according to the first storage block of the solid-state hard disk corresponding to the identifier of the slave device after the master device determines the first storage block in the master device according to the synchronization request; a determination unit, configured to determine, based on the first verification data, a target block corresponding to second verification data consistent with the first verification data in the solid state hard disk corresponding to the slave device; Data transmission unit, used for: Determine the block to be sent in the solid-state hard disk of the slave device according to the target block, and transmit the original solid-state hard disk data associated with the block to be sent to the master device; the block to be sent is a block in the solid-state hard disk of the slave device whose data has not been sent to the master device; Submitting the first data to a data transmission queue of the serial transceiver interface end based on the network interface end; Based on the serial transceiver interface, the first data in the data transmission queue is sent to a slave device according to the data type.
10. A non-transitory computer-readable storage medium having a computer software program stored therein, characterized in that: When the computer software program is executed by the processor, the solid state hard disk data transmission method as claimed in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Trim data verification test method, device and system for SSD (Solid State Disk)
CN111737051A
Solid state disk monitoring method, device and equipment and storage medium
CN118445146A
Device integration for a network access control server based on device mappings and testing verification
US20200106773A1