Driving method and system of non-standard SATA interface

文档序号:189818 发布日期:2021-11-02 浏览:23次 中文

阅读说明:本技术 一种非标准sata接口的驱动方法和系统 (Driving method and system of non-standard SATA interface ) 是由 熊帮发 童乐 李旭勇 朱国定 喻政 于 2021-07-21 设计创作,主要内容包括:本发明公开了一种非标准SATA接口的驱动方法和系统,通过获取io并将io缓存至内存中,如果没有触发下发io的条件,就一直获取新的io并将这些io缓存至内存中,如果触发了下发io的条件,则将内存中的全部io合并为一个请求后,通过非标准控制器发送到硬盘中,此方法能够提高单次读写硬盘时携带的io数,提升了SATA数据的传输吞吐量,从而提高非标准SATA控制器读写硬盘的速率。(The invention discloses a driving method and a system of a non-standard SATA interface, which are characterized in that io is obtained and cached in a memory, if the condition of issuing io is not triggered, new io is obtained all the time and is cached in the memory, and if the condition of issuing io is triggered, all io in the memory are combined into a request and then are sent to a hard disk through a non-standard controller.)

1. A driving method of a non-standard SATA interface is characterized by comprising the following steps:

obtaining io and storing the io in a memory;

if the condition of issuing the io is triggered, combining all the ios in the memory into a request, and then sending the request to the SATA hard disk through the non-standard SATA controller so that the SATA hard disk executes corresponding operation according to the request.

2. The method of claim 1, wherein the obtaining io comprises the following steps:

obtaining bio from an operating system;

the bio is divided into a read direction io or a write direction io.

3. The method of claim 1, wherein the storing the io in the memory comprises: and sequentially storing the ios in the memory according to the sequence of obtaining the ios.

4. The method of claim 1, wherein the method comprises: and the condition of issuing the io is that the bio sector is discontinuous.

5. The method for driving a non-standard SATA interface according to any one of claims 1 to 4, further comprising the steps of:

and carrying out overtime detection, and combining all the ios in the memory into a request and sending the request to the SATA hard disk if the storage time of the first io stored in the memory exceeds a threshold value.

6. The method of claim 1, wherein the method comprises: the SATA hard disk is a SATA solid state hard disk.

7. A driving system of a non-standard SATA interface, comprising:

the data storage management module is used for storing the io in the memory, and combining all the io in the memory into a request and sending the request to the data storage control module if the condition of issuing the io is triggered;

the data storage control module is in communication connection with the data storage management module and is used for sending the request to the SATA hard disk;

and the SATA hard disk is in communication connection with the data storage control module and is used for executing corresponding operation according to the request.

8. The system of claim 7, wherein: and the condition of issuing the io is that the bio sector is discontinuous.

9. The system of claim 8, wherein: and the condition of delivering the io is that the time interval of delivering the io exceeds a preset threshold value.

Technical Field

The invention relates to the technical field of data storage, in particular to a driving method and a driving system of a non-standard SATA interface.

Background

SATA (serial Advanced Technology attachment) is a serial Advanced Technology attachment, an industry standard based serial hardware driver interface, with a complete command set and NCQ queue functions provided internally to the standard SATA controller logic.

When the existing non-standard SATA controller lacking NCQ command sequencing and command queues reads and writes a SATA hard disk, the speed is very low and far reaches the level of the hard disk reading and writing speed of the standard SATA controller.

Disclosure of Invention

The present invention is directed to at least solving the problems of the prior art. Therefore, the invention provides a driving method and a system of a non-standard SATA interface, which can improve the speed of reading and writing a hard disk by a non-standard SATA controller.

In a first aspect of the present invention, a method for driving a non-standard SATA interface is provided, including the following steps:

obtaining io and storing the io in a memory;

if the condition of issuing the io is triggered, combining all the ios in the memory into a request, and sending the request to the SATA hard disk through the non-standard SATA controller so that the SATA hard disk executes corresponding operation according to the io.

According to the embodiment of the invention, at least the following technical effects are achieved:

the method can improve the number of the ios carried in the process of reading and writing the hard disk once, improve the transmission throughput of SATA data, and further improve the speed of reading and writing the hard disk by the non-standard SATA controller.

According to some embodiments of the invention, the obtaining io comprises the steps of: obtaining bio from an operating system; the bio is divided into a read direction io or a write direction io.

According to some embodiments of the invention, the storing the io in the memory comprises: and sequentially storing the ios in a memory according to the sequence of obtaining the ios.

According to some embodiments of the present invention, the condition of issuing io is that the bio sector is not continuous.

According to some embodiments of the present invention, the method for driving the non-standard SATA interface further includes: and carrying out overtime detection, and if the storage time of the first io stored in the memory exceeds a threshold value, sending all the ios in the memory to the SATA hard disk.

According to some embodiments of the invention, the SATA hard disk is a SATA solid state disk.

In a second aspect of the present invention, a driving system of a non-standard SATA interface is provided, including: the system comprises a data storage management module, a data storage control module and an SATA hard disk; the data storage management module is used for storing the io in a memory, and if the condition of issuing the io is triggered, all the io in the memory are combined into a request and then sent to the data storage control module; the data storage control module is in communication connection with the data storage management module and is used for sending the request to the SATA hard disk; and the SATA hard disk is in communication connection with the data storage control module and is used for executing corresponding operation according to the request.

According to the embodiment of the invention, at least the following technical effects are achieved:

if the condition of issuing the io is not triggered, the data storage management module acquires the io all the time and caches the io into the memory, and if the condition of issuing the io is triggered, all the io in the memory are combined into a request and then the request is sent to the hard disk through the data storage control module.

According to some embodiments of the present invention, the condition of issuing io is that the bio sector is not continuous.

According to some embodiments of the present invention, the condition of delivering the io is that a time interval of delivering the io exceeds a preset threshold.

Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.

Drawings

The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:

FIG. 1 is a flowchart illustrating a method for driving a non-standard SATA interface according to an embodiment of the present invention;

FIG. 2 is a schematic structural diagram of a driving system of a non-standard SATA interface according to an embodiment of the present invention;

FIG. 3 is a sorting algorithm for write direction according to an embodiment of the present invention;

FIG. 4 is a sorting algorithm for read direction provided by an embodiment of the present invention;

FIG. 5 is a non-standard SATA controller implemented based on an FPGA module according to an embodiment of the present invention;

FIG. 6 is a data storage management module provided by an embodiment of the present invention;

FIG. 7 is a block diagram of a data read/write logic module according to an embodiment of the present invention;

FIG. 8 is a fio write provided by an embodiment of the present invention;

FIG. 9 is a fio read provided by an embodiment of the present invention;

FIG. 10 is a block diagram of file replication provided by embodiments of the present invention;

FIG. 11 is a test procedure provided by an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be fully described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all 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 invention.

Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.

SATA (serial Advanced Technology attachment) is a serial Advanced Technology attachment, an industry standard based serial hardware driver interface, with a complete command set and NCQ queue functions provided internally to the standard SATA controller logic. The performance of a standard SATA 2.0 interface can reach 375MB/s in theoretical speed.

In a computer system, a central processing unit, a memory and a hard disk are the most important three hardware, the central processing unit reads data from the hard disk, the data is handed to the memory, then the central processing unit fetches the data from the memory for processing, and the storage and reading speeds of the central processing unit, the memory and the hard disk are increased progressively. The hardware driver interface is an interface for connecting the memory and the hard disk.

Therefore, it is necessary to increase the data transmission rate between the memory and the hardware to improve the operation performance of the computer system, and SATA is an interface to improve the data transmission rate between the memory and the hardware.

Due to the considerations of compatibility, hardware of the device, and the like, SATA controllers do not always contain all command sets and functions in the SATA protocol, and these SATA controllers are called non-standard SATA controllers, and lack of some command sets or functions results in that these non-standard SATA controllers have a very slow speed when reading and writing a hard disk, which impairs the operational performance of the computer system.

In order to solve the above problems, the present invention takes a non-standard SATA controller implemented by FPGA as an example, and the SATA controller logic only provides READ _ DMA _ EXT (0x25), WRITE _ DMA _ EXT (0x35), and IDENTIFY _ DEVICE (0xEC) in ATA standard commands, and has no NCQ command sorting and no command queue.

Referring to fig. 1, in a first aspect of the present invention, a method for driving a non-standard SATA interface is provided, including the following steps:

s110: obtaining io and storing the io in a memory;

s120: if the condition of issuing the io is triggered, all the ios in the memory are merged into one request and then sent to the SATA hard disk through the non-standard controller, so that the SATA hard disk executes corresponding operation according to the io.

It can be known from the principle of computer system that if an io is generated by an operating system each time, the io is transmitted to a hard disk, data exchange between a memory and the hard disk will be frequently performed, the read-write speed between the memory and the hard disk is much slower than the read speed between a central processing unit and the memory, and finally the read-write speed of the hard disk will delay the operation speed of the central processing unit. If the io is cached in the memory first and a plurality of ios are combined into one request, data exchanged between the memory and the hard disk once becomes more, and the transmission throughput of the SATA data is improved.

Due to the considerations of compatibility, hardware of the device, and the like, SATA controllers do not always contain all command sets and functions in the SATA protocol, and these SATA controllers are called non-standard SATA controllers, and lack of some command sets or functions results in that these non-standard SATA controllers have a very slow speed when reading and writing a hard disk, which impairs the operational performance of the computer system. The embodiment of the invention provides a driving method of a non-standard SATA interface, which comprises the steps of obtaining io and caching the io in a memory, obtaining new io and caching the io in the memory if the condition of issuing the io is not triggered, combining all the io in the memory into a request and sending the request to a hard disk through a non-standard controller if the condition of issuing the io is triggered.

In some embodiments of the present invention, the obtaining io includes the following steps: obtaining bio from an operating system; bio is divided into a read direction io or a write direction io. And bio is a universal block layer of linux, serves as a middle layer of the io subsystem, is an upper-layer output interface and provides data for a lower layer. That is, a bio represents an io request of the operating system, and since there are many types of ios in a request, the bio is classified into different types of ios first. The classified io is temporarily stored in the memory, rather than being directly transmitted to the hard disk. The bio type is divided into a reading direction io and a writing direction io, and the classification method is more suitable for the working mode of the hard disk and improves the speed of reading and writing the hard disk data more obviously.

In some embodiments of the present invention, storing io in memory comprises: and sequentially storing the io in the memory according to the order of acquiring the io. The sequenced ios are more beneficial to the read-write operation of the hard disk, and the sequencing method is a simpler and low-cost memory operation sequencing method according to the sequence of obtaining the ios.

In some embodiments of the present invention, the condition for issuing io is that the bio sector is not contiguous. The speed of the hard disk is faster when the data of the continuous sectors are read and written. If the next bio sectors are continuous, continuing to buffer the ios into a read buffer or a write buffer according to the read and write directions; and if the next bio sectors are not continuous, transmitting all the ios in the buffer areas to the hard disk through the non-standard SATA controller at one time, and reading and writing the data of the hard disk. Therefore, "bio sector non-contiguous" is a condition for triggering the issue of io.

In some embodiments of the present invention, the method for driving a non-standard SATA interface further includes the steps of: and carrying out overtime detection, and if the storage time of the first io stored in the memory exceeds a threshold value, sending all ios in the memory to the SATA hard disk. If the condition of issuing the io cannot be triggered all the time, the memory is cached all the time, the load of the cpu is increased, and sometimes the program is lost, when the command of issuing the io is triggered to not respond, an independent task is set for enabling the response time of reading and writing the hard disk to be proper and reducing the load of the cpu of the system to carry out timeout detection, when the timeout does not occur, the timing of issuing the io is triggered by the condition of 'bio sector non-continuity', and when the timeout occurs, the timing of issuing the io is triggered by the task.

In some embodiments of the present invention, the SATA hard disk is a SATA solid state hard disk. The hard disk is mainly divided into a mechanical hard disk and a solid state hard disk, and the performance influence factors of the mechanical hard disk are mainly the rotating speed, the density and the quality of a magnetic head; the solid state disk is internally divided into a main control unit, a storage unit and an interface. The storage unit is used for storing data, the main control unit is used for recording data storage positions and performing data operation, the interface is used for exchanging data with the computer, and the interface and the controller are mainly used for determining the speed of the solid state. Since the storage medium of the solid-state disk is a flash memory, data is written in "erase before write" instead of being directly overwritten, and new data is written again after the previous data is erased. For a mechanical hard disk, an operation system carries an elevator algorithm, and the elevator algorithm is a magnetic disk scheduling algorithm and aims to reduce the moving distance of a magnetic head, reduce the seek time and accelerate the disk reading speed. The dispatching mode of the elevator is like an elevator, and the elevator firstly walks to the head from one direction, then is folded back and walks to the other direction. When the algorithm is applied to a mechanical hard disk, the effect is obvious, and if the technical means of the invention is reused, the effect is not obvious. When the SATA hard disk is a SATA solid state hard disk, the effect of the invention is more obvious.

Referring to fig. 2, in a second aspect of the present invention, there is provided a driving system of a non-standard SATA interface, including: a data storage management module 210, a data storage control module 220 and a SATA hard disk 230; the data storage management module 210 is configured to store io in the memory, and if an io issuing condition is triggered, merge all io in the memory into one request and send the request to the data storage control module 220; a data storage control module 220, communicatively connected to the data storage management module 210, for sending the request to the SATA hard disk 230; and the SATA hard disk 230 is in communication connection with the data storage control module 220 and is configured to perform a corresponding operation according to the request.

If the condition of issuing the io is not triggered, the data storage management module acquires the io all the time and caches the io into the memory, and if the condition of issuing the io is triggered, all the io in the memory are combined into a request and then the request is sent to the hard disk through the data storage control module.

In some embodiments of the present invention, the condition for issuing io is that the bio sector is not contiguous.

In some embodiments of the present invention, the condition for delivering the io is that a time interval of delivering the io exceeds a preset threshold.

Based on the above embodiment, the present invention further provides an embodiment, as follows:

the method is a method for driving a non-standard SATA controller to read and write a solid state disk based on a Linux operating system. When the non-standard SATA controller is used, the throughput capacity of reading and writing the hard disk when the standard SATA controller is used can be obtained by the method. Meanwhile, the invention also discloses a system for driving the non-standard SATA device under the Linux operating system.

The non-standard SATA controller is realized by an FPGA (field programmable gate array), the FPGA realizes 12 paths of non-standard SATA controllers, and the external part of the FPGA is connected with an SATA solid state disk. The SATA controller logic is internally provided with only READ _ DMA _ EXT (0x25), WRITE _ DMA _ EXT (0x35) and IDENTIFY _ DEVICE (0xEC) in ATA standard commands, and has no NCQ command ordering and no command queue. While standard SATA controllers provide a complete command set and NCQ queuing functions, etc. Therefore, the non-standard SATA controller needs to obtain data throughput capability close to that of the standard SATA controller, and needs to be optimized by a driving software implementation method.

The Linux layer driver software is used for driving the non-standard SATA controller, and in order to improve the throughput of reading and writing the data of the whole disk, the driver software buffers the IO data according to the I/O data transmitted by the operating system layer and a classified sorting algorithm according to the reference of fig. 3 and 4, and the data writing and reading occur according to a condition triggering mode. Compared with the traditional elevator algorithm provided by an operating system, the method can combine more continuous I/O into 1 larger request, thereby improving the transmission throughput of the SATA data.

The system architecture is realized as follows:

the system is a universal data storage device designed based on FPGA of the Danish micro company and CPU of the Loongson company. The system comprises a data storage management module, a data storage control module and a hard disk. The storage management module and the storage control module are connected and communicated by adopting a pcie bus. The data storage control module provides the realized non-standard SATA controller to be connected with the hard disk.

Referring to fig. 5, the data storage control module: the FPGA module provides for implementing a non-standard SATA controller.

Referring to FIG. 6, the data storage management module: driving a non-standard SATA controller.

Referring to fig. 7, the data read/write logic module:

reading and writing data by the user interface: disk array computer users, i.e., users, read and write disk array data. The data is passed to the operating system.

Operating system interface: the operating system provides an interface method for the user interface according to the standard interface, and the interface method is used for reading and writing the user operation data. And simultaneously, calling an interface of disk array driving software of a lower layer, namely a driving layer, and transmitting data.

Disk array driver software: the disk control module is used for providing a read-write interface for an operating system upwards and controlling the disk control module downwards.

A disk control module: comprises a 12-way non-standard sata controller, provides sata basic read and write commands and disk recognizing commands.

The actual test in the method is as follows, the speed test has the test result under different conditions, the average writing speed is 145MB/s, and the reading speed is 100 MB/s.

fio test tool: the 100G data was tested.

As shown in fig. 8, fio writing is performed;

as shown in fig. 9, fio reading is performed;

as shown in fig. 10, files are copied to the hard disk: copy 4.3GB of data;

as shown in fig. 11, the test program disk _ test: write is write and read is read. Writing 1GB data, and calculating speed; then, 1GB data is read out, and the speed is calculated.

The result is a write speed average of 145MB/s and a read speed of 100 MB/s.

It is 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 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.

While embodiments of the invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种写入batch group串行化逻辑的优化方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类