Movatterモバイル変換


[0]ホーム

URL:


CN103226448B - The driving method of solid state hard disc and device - Google Patents

The driving method of solid state hard disc and device
Download PDF

Info

Publication number
CN103226448B
CN103226448BCN201310093035.XACN201310093035ACN103226448BCN 103226448 BCN103226448 BCN 103226448BCN 201310093035 ACN201310093035 ACN 201310093035ACN 103226448 BCN103226448 BCN 103226448B
Authority
CN
China
Prior art keywords
request
block
layer
operation request
operating system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201310093035.XA
Other languages
Chinese (zh)
Other versions
CN103226448A (en
Inventor
顾政
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co LtdfiledCriticalHuawei Technologies Co Ltd
Priority to CN201310093035.XApriorityCriticalpatent/CN103226448B/en
Publication of CN103226448ApublicationCriticalpatent/CN103226448A/en
Application grantedgrantedCritical
Publication of CN103226448BpublicationCriticalpatent/CN103226448B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

Translated fromChinese

本发明公开了一种固态硬盘的驱动方法及装置,该方法包括:接收通用块层发出的记录有操作指令的块I/O请求;将块I/O请求格式转换为记录有操作指令的I/O操作请求,其中I/O操作请求为I/O调度层的基本操作单元;将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置;从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层;根据块设备驱动层接收到的I/O操作请求中记录的操作指令驱动固态硬盘。通过上述技术方案,本发明能有效缩减处理时间,并且可降低功耗及成本。

The invention discloses a driving method and device of a solid-state hard disk. The method comprises: receiving a block I/O request recorded with an operation instruction sent by a general block layer; converting the format of the block I/O request into an I/O request recorded with an operation instruction. /O operation request, wherein the I/O operation request is the basic operation unit of the I/O scheduling layer; the I/O operation request is inserted into the empty position of the I/O device request queue of the I/O scheduling layer; from the I/O Obtain an I/O operation request from the empty position of the device request queue, and send the I/O operation request to the block device driver layer; drive the solid state disk according to the operation instructions recorded in the I/O operation request received by the block device driver layer. Through the above technical solution, the present invention can effectively reduce processing time, and reduce power consumption and cost.

Description

Translated fromChinese
固态硬盘的驱动方法及装置Drive method and device for solid state hard disk

技术领域technical field

本发明涉及电子信息技术领域,特别是涉及一种固态硬盘的驱动方法及装置。The invention relates to the technical field of electronic information, in particular to a driving method and device for a solid-state hard disk.

背景技术Background technique

Linux I/O(Input/Output,输入/输出)子系统的架构设计受当时主流的储存介质影响,即基于机械转动的磁盘,机械磁盘的I/O性能一直以来都是系统的瓶颈。为了能最大限度利用好有限的磁盘I/O资源,LinuxI/O子系统的设计上引入了I/O调度器(I/O scheduler),利用I/O调度器对重复、相连的I/O操作请求合并,以及按照扇区的顺序方向对I/O操作请求排序,从而减少实际发生的磁盘I/O次数和磁盘寻道时间。The architectural design of the Linux I/O (Input/Output, input/output) subsystem was influenced by the mainstream storage media at that time, that is, based on mechanically rotating disks. The I/O performance of mechanical disks has always been the bottleneck of the system. In order to maximize the use of limited disk I/O resources, the design of the Linux I/O subsystem introduces an I/O scheduler (I/O scheduler), which uses the I/O scheduler to process repeated and connected I/O Operation requests are merged, and I/O operation requests are sorted according to the sequential direction of sectors, thereby reducing the actual number of disk I/Os and disk seek time.

随着储存技术的发展,存储介质也发生了巨大变化,但现有的I/O调度器一直沿用至今。I/O调度器的总体目标是希望让磁头能够总是往一个方向移动,移动到底了再往反方向走,以减少机械磁盘磁头的寻道时间,这种实现就被称为I/O调度算法。为了适应不同的应用场景、性能、时效性方面的需求,Linux内核从2.6开始引入了4种不同的I/O调度算法,以针对不同类型的应用程序优化磁盘I/O性能,该4种不同的I/O调度算法包括:CFQ(Completely Fair Queuing完全公平队列)算法,Deadline(最后期限)算法,Noop(无干预)算法,Anticipatory(预期)算法。现有的I/O调度层的调度算法在顺序I/O操作下能对机械式磁盘的I/O性能起到明显的优化效果,但是随着技术的发展,采用闪存颗粒(flash disk)的固态硬盘开始逐渐取代带有机械磁盘磁头的机械磁盘。由于闪存颗粒采用顺序方式进行读写,其与机械磁盘所采用的磁盘转动的读写方式截然不同,因此现有的I/O调度层的调度算法对于固态硬盘而言,往往会增加处理复杂度,延长处理时间,从而造成功耗和成本的浪费。With the development of storage technology, great changes have taken place in the storage medium, but the existing I/O scheduler has been used till now. The overall goal of the I/O scheduler is to allow the head to always move in one direction, and then go in the opposite direction after moving to the end, so as to reduce the seek time of the mechanical disk head. This implementation is called I/O scheduling. algorithm. In order to meet the needs of different application scenarios, performance, and timeliness, the Linux kernel has introduced 4 different I/O scheduling algorithms since 2.6 to optimize disk I/O performance for different types of applications. The I/O scheduling algorithms include: CFQ (Completely Fair Queuing) algorithm, Deadline (deadline) algorithm, Noop (no intervention) algorithm, Anticipatory (expected) algorithm. The scheduling algorithm of the existing I/O scheduling layer can significantly optimize the I/O performance of mechanical disks under sequential I/O operations, but with the development of technology, the use of flash disk Solid state drives are beginning to gradually replace mechanical disks with mechanical disk heads. Since flash memory particles are read and written in a sequential manner, which is completely different from the disk rotation method used by mechanical disks, the existing scheduling algorithm of the I/O scheduling layer often increases the processing complexity for solid-state drives. , prolong the processing time, resulting in waste of power consumption and cost.

发明内容Contents of the invention

本发明实施例主要解决的技术问题是提供一种固态硬盘的驱动方法及装置,在处理针对固态硬盘的I/O操作请求时,可有效简化处理过程,并能有效缩减处理时间,以降低功耗及成本。The technical problem mainly solved by the embodiment of the present invention is to provide a driving method and device for a solid-state hard disk, which can effectively simplify the processing process and effectively reduce the processing time when processing the I/O operation request for the solid-state hard disk, so as to reduce the power consumption. Consumption and cost.

第一方面提供一种固态硬盘的驱动方法,该方法应用于操作系统,操作系统包括通用块层、I/O调度层、块设备驱动层,该方法包括:接收通用块层发出的记录有操作指令的块I/O请求;将块I/O请求格式转换为记录有操作指令的I/O操作请求,其中I/O操作请求为I/O调度层的基本操作单元;将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置;从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层;根据块设备驱动层接收到的I/O操作请求中记录的操作指令驱动固态硬盘。The first aspect provides a driving method for a solid-state hard disk, the method is applied to an operating system, the operating system includes a general block layer, an I/O scheduling layer, and a block device driver layer, and the method includes: receiving a record operation issued by the general block layer The block I/O request of the instruction; the block I/O request format is converted into the I/O operation request with the operation instruction recorded, wherein the I/O operation request is the basic operation unit of the I/O scheduling layer; the I/O operation The request is inserted into the empty position of the I/O device request queue of the I/O scheduling layer; the I/O operation request is obtained from the empty position of the I/O device request queue, and the I/O operation request is sent to the block device driver layer; according to The operation instruction recorded in the I/O operation request received by the block device driver layer drives the solid-state hard disk.

在第一方面的第一种可能的实现方式中,操作指令包括读指令和写指令中的任意一种或两种。In a first possible implementation manner of the first aspect, the operation instruction includes any one or both of a read instruction and a write instruction.

在第一方面的第二种可能的实现方式中,块I/O请求设置为bio结构体,I/O操作请求设置为request结构体。In the second possible implementation of the first aspect, the block I/O request is set as a bio structure, and the I/O operation request is set as a request structure.

在第一方面的第三种可能的实现方式中,操作系统包括linux操作系统或unix操作系统。In a third possible implementation manner of the first aspect, the operating system includes a linux operating system or a unix operating system.

第二方面提供一种固态硬盘的驱动装置,该驱动装置应用于操作系统,操作系统包括通用块层、I/O调度层、块设备驱动层,该装置包括:块I/O请求接收模块,用于接收通用块层发出的记录有操作指令的块I/O请求;格式转换模块,用于将块I/O请求格式转换为记录有操作指令的I/O操作请求,I/O操作请求为I/O调度层的的基本操作单元;插入模块,用于将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置;I/O操作请求获取模块,用于从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层;驱动模块,用于根据块设备驱动层接收到的I/O操作请求中记录的操作指令驱动固态硬盘。The second aspect provides a driving device for a solid-state hard disk, the driving device is applied to an operating system, the operating system includes a general block layer, an I/O scheduling layer, and a block device driver layer, and the device includes: a block I/O request receiving module, It is used to receive block I/O requests recorded with operation instructions issued by the general block layer; the format conversion module is used to convert the format of block I/O requests into I/O operation requests recorded with operation instructions, and the I/O operation request It is the basic operation unit of the I/O scheduling layer; the insertion module is used to insert the I/O operation request into the empty position of the I/O device request queue of the I/O scheduling layer; the I/O operation request acquisition module uses Obtain the I/O operation request from the empty position of the I/O device request queue, and send the I/O operation request to the block device driver layer; the driver module is used to receive the I/O operation request according to the block device driver layer The recorded operating instructions drive the solid-state drive.

在第二方面的第一种可能的实现方式中,操作指令包括读指令和写指令中的任意一种或两种。In a first possible implementation manner of the second aspect, the operation instruction includes any one or both of a read instruction and a write instruction.

在第二方面的第二种可能的实现方式中,块I/O请求设置为bio结构体,I/O操作请求设置为request结构体。In a second possible implementation of the second aspect, the block I/O request is set as a bio structure, and the I/O operation request is set as a request structure.

在第二方面的第三种可能的实现方式中,操作系统包括linux操作系统或unix操作系统。In a third possible implementation manner of the second aspect, the operating system includes a linux operating system or a unix operating system.

区别于现有技术的情况,本发明实施例主要解决的技术问题是提供一种固态硬盘的驱动方法及装置,该方法及装置应用于操作系统,通过将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置,从该空队列位置获取I/O操作请求,从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层,根据I/O操作请求中记录的操作指令驱动固态硬盘,由于本发明实施例并没有对I/O操作请求进行合并、排序等复杂的调度过程,因此更为适合于采用闪存颗粒(flash disk)的固态硬盘,从而在驱动固态硬盘时,能有效缩减处理时间,并且可降低功耗及成本。Different from the situation in the prior art, the technical problem mainly solved by the embodiments of the present invention is to provide a driving method and device for a solid-state hard disk. The method and device are applied to the operating The empty position of the I/O device request queue of the scheduling layer, obtain the I/O operation request from the empty queue position, obtain the I/O operation request from the empty position of the I/O device request queue, and send the I/O operation request to The block device driver layer drives the solid-state hard disk according to the operation instructions recorded in the I/O operation request. Since the embodiment of the present invention does not perform complex scheduling processes such as merging and sorting I/O operation requests, it is more suitable for using flash memory Particle (flash disk) solid-state hard disk, so that when driving the solid-state hard disk, it can effectively reduce the processing time, and can reduce power consumption and cost.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1是本发明实施例的固态硬盘的驱动方法第一实施例的流程示意图;FIG. 1 is a schematic flow chart of a first embodiment of a method for driving a solid-state hard disk according to an embodiment of the present invention;

图2是本发明实施例的固态硬盘的驱动装置第一实施例的装置结构示意图;Fig. 2 is a schematic diagram of the device structure of the first embodiment of the drive device of the solid-state hard disk according to the embodiment of the present invention;

图3是本发明实施例的固态硬盘的驱动方法第二实施例的流程图;FIG. 3 is a flow chart of a second embodiment of a method for driving a solid-state hard disk according to an embodiment of the present invention;

图4是本发明实施例的固态硬盘的驱动装置第二实施例的结构示意图。FIG. 4 is a schematic structural diagram of a second embodiment of a driving device for a solid state disk according to an embodiment of the present invention.

具体实施方式detailed description

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

请参见图1,图1是本发明实施例的固态硬盘的驱动方法第一实施例的流程示意图,如图1所示,本发明实施例提供的固态硬盘的驱动方法应用于操作系统,该操作系统包括通用块层、I/O调度层、块设备驱动层。该方法包括以下步骤:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of the first embodiment of the driving method of the solid-state hard disk according to the embodiment of the present invention. As shown in FIG. 1, the driving method of the solid-state hard disk provided by the embodiment of the present invention is applied to the operating system, and the operation The system includes a general block layer, an I/O scheduling layer, and a block device driver layer. The method includes the following steps:

步骤101:接收通用块层发出的记录有操作指令的块I/O请求。块I/O请求是Linux通用块层中块I/O的描述符,详细描述一个磁盘数据块I/O相关的信息。Step 101: Receive a block I/O request recorded with an operation instruction from the general block layer. A block I/O request is a block I/O descriptor in the Linux general block layer, which describes in detail information related to a disk data block I/O.

步骤102:将块I/O请求格式转换为记录有操作指令的I/O操作请求,其中I/O操作请求为I/O调度层的基本操作单元,也是设备驱动程序的处理对象,描述一个需要被处理的I/O操作。Step 102: Convert the block I/O request format into an I/O operation request with operation instructions recorded, wherein the I/O operation request is the basic operation unit of the I/O scheduling layer and is also the processing object of the device driver, describing a The I/O operation that needs to be processed.

步骤103:将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置。其中,I/O设备请求队列为Linux内核中描述一个块设备需要处理的所有I/O操作请求组成的一个队列。Step 103: Insert the I/O operation request into the empty position of the I/O device request queue of the I/O scheduling layer. Wherein, the I/O device request queue is a queue that describes all I/O operation requests to be processed by a block device in the Linux kernel.

步骤104:从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层。Step 104: Obtain an I/O operation request from an empty position in the I/O device request queue, and send the I/O operation request to the block device driver layer.

步骤105:根据块设备驱动层接收到的I/O操作请求中记录的操作指令驱动固态硬盘。Step 105: Drive the solid state disk according to the operation instruction recorded in the I/O operation request received by the block device driver layer.

由于固态硬盘采用闪存颗粒(flash disk),闪存颗粒采用顺序方式进行读写,其读取机制与内存相仿,因此读取固态硬盘无需进行磁盘寻道,并且固态硬盘没有对I/O操作请求的合并、排序等调度需求。Since solid-state drives use flash disks, which read and write sequentially, the reading mechanism is similar to that of memory, so reading solid-state drives does not require disk seeks, and solid-state drives do not require I/O operations. Scheduling requirements such as merging and sorting.

因此,由于闪存颗粒采用顺序方式进行读写,其与机械磁盘所采用的磁盘转动的读写机制截然不同,故本发明实施例将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置,从该空队列位置获取I/O操作请求,从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层,根据I/O操作请求中记录的操作指令驱动固态硬盘。从而跳过对I/O操作请求进行合并、排序等复杂的调度过程,更为适合于采用闪存颗粒(flash disk)的固态硬盘,在驱动固态硬盘时,能有效缩减处理时间,并且可降低功耗及成本。Therefore, since the flash memory particles are read and written in a sequential manner, which is completely different from the disk rotation reading and writing mechanism adopted by the mechanical disk, the embodiment of the present invention inserts the I/O operation request into the I/O operation of the I/O scheduling layer. The empty position of the device request queue, obtain the I/O operation request from the empty queue position, obtain the I/O operation request from the empty position of the I/O device request queue, and send the I/O operation request to the block device driver layer, according to The operation instruction recorded in the I/O operation request drives the solid-state disk. In this way, complex scheduling processes such as merging and sorting of I/O operation requests are skipped, and it is more suitable for solid-state hard disks using flash disks. When driving solid-state hard disks, it can effectively reduce processing time and reduce power consumption. Consumption and cost.

值得注意的是,上述的操作系统举例而言可为linux操作系统或unix操作系统。It should be noted that the above-mentioned operating system can be, for example, a linux operating system or a unix operating system.

以下请参见图3,图3是本发明实施例的的固态硬盘的驱动方法第二实施例的流程图。如图3所示,在本发明实施例所揭示的操作系统设置有文件系统层301、通用块层305、I/O调度层302、块设备驱动层303以及设备层304。Referring to FIG. 3 below, FIG. 3 is a flow chart of a second embodiment of a method for driving a solid state disk according to an embodiment of the present invention. As shown in FIG. 3 , the operating system disclosed in the embodiment of the present invention is provided with a file system layer 301 , a general block layer 305 , an I/O scheduling layer 302 , a block device driver layer 303 and a device layer 304 .

其中,文件系统层301内设置有文件系统306,文件系统306包括多个页面缓存307,页面缓存307包括块缓冲器308,块缓冲器308包括多个块I/O请求,块I/O请求设置为bio结构体,其中块I/O请求记录有操作指令,文件系统层301传输该块I/O请求至通用块层305。Wherein, the file system layer 301 is provided with a file system 306, the file system 306 includes a plurality of page caches 307, the page cache 307 includes a block buffer 308, and the block buffer 308 includes a plurality of block I/O requests, block I/O requests It is set as a bio structure, wherein the block I/O request records operation instructions, and the file system layer 301 transmits the block I/O request to the general block layer 305 .

通用块层305获取块I/O请求,并将其发送至I/O调度层。The general block layer 305 takes block I/O requests and sends them to the I/O scheduling layer.

I/O调度层302设置有I/O设备请求队列311,I/O设备请求队列311包括多个位置,多个I/O操作请求分别设置在多个位置中,以在I/O设备请求队列311进行排列,图3中虚线框所圈住的位置为非空位置,位置320为空位置。The I/O scheduling layer 302 is provided with an I/O device request queue 311, and the I/O device request queue 311 includes a plurality of positions, and a plurality of I/O operation requests are respectively arranged in a plurality of positions, so as to be processed in the I/O device request The queue 311 is arranged, and the positions enclosed by the dashed box in FIG. 3 are non-empty positions, and the position 320 is an empty position.

块设备驱动层303设置有存储设备驱动器313。The block device driver layer 303 is provided with a storage device driver 313 .

设备层304所设置的设备类型为固态硬盘。The device type set in the device layer 304 is a solid state disk.

以下将结合图3对具体的写操作流程进行详细介绍,在本发明实施例中,当操作系统捕获到用于写入固态硬盘的进程305时,操作系统产生记录有写操作指令的块I/O请求309,块缓冲器308获取该记录有写操作指令的块I/O请求309并发送至通用块层305。The specific write operation process will be described in detail below in conjunction with FIG. 3. In an embodiment of the present invention, when the operating system captures the process 305 for writing into the solid-state disk, the operating system generates a block I/ that is recorded with the write operation instruction. O request 309 , the block buffer 308 acquires the block I/O request 309 recorded with the write operation instruction and sends it to the general block layer 305 .

在通用块层305获取块I/O请求309,并将其发送至I/O调度层302。Block I/O requests 309 are taken at the general block layer 305 and sent to the I/O scheduling layer 302 .

接收通用块层305发出的块I/O请求309,将块I/O请求309格式转换为记录有操作指令的I/O操作请求310,其中,这里所作格式转换具体而言是将格式为bio结构体的块I/O请求309转换为格式为request结构体的I/O操作请求310。bio结构体为现有技术定义的应用于块I/O请求的一种基本结构体,request结构体为现有技术定义的应用于I/O操作请求的一种基本结构体。Receive the block I/O request 309 sent by the general block layer 305, convert the format of the block I/O request 309 into an I/O operation request 310 recorded with an operation instruction, wherein, the format conversion here is specifically to convert the format into bio The block I/O request 309 of the structure is converted into an I/O operation request 310 whose format is the request structure. The bio structure is a basic structure defined in the prior art and applied to block I/O requests, and the request structure is a basic structure defined in the prior art and applied to I/O operation requests.

将I/O操作请求310插入到I/O设备请求队列311的空位置320。The I/O operation request 310 is inserted into the empty position 320 of the I/O device request queue 311 .

并从该空位置320获取I/O操作请求310,将该I/O操作请求310发送给块设备驱动层303。And obtain the I/O operation request 310 from the empty location 320 , and send the I/O operation request 310 to the block device driver layer 303 .

根据块设备驱动层303接收到的I/O操作请求310中记录的写操作指令驱动设备层304中的固态硬盘313,使得固态硬盘313可进行写入动作。Drive the solid-state hard disk 313 in the device layer 304 according to the write operation instruction recorded in the I/O operation request 310 received by the block device driver layer 303 , so that the solid-state hard disk 313 can perform writing operations.

值得注意的是,以上所列的实施方式为操作指令为写指令的流程,而操作指令为读指令的流程与上述流程类似,于此不作赘述。It should be noted that, in the implementation manners listed above, the process in which the operation command is a write command, and the process in which the operation command is a read command is similar to the above process, and will not be repeated here.

因此,在本发明基于操作系统的固态硬盘的驱动方法第二实施例中,相对于现有技术而言省略了复杂的I/O调度过程,将I/O操作请求放置到I/O设备请求队列的空位置上,并直接从该空位置获取I/O操作请求,由于省略复杂的I/O调度过程,因此能简化现有技术中的I/O协议栈,缩短I/O传输的路径深度,减少I/O传输的资源消耗和延时有效缩减处理时间,并且可降低功耗及成本,更为适合针对固态硬盘的高并发、高随机性的I/O操作请求。Therefore, in the second embodiment of the driving method of the solid state disk based on the operating system of the present invention, compared with the prior art, the complex I/O scheduling process is omitted, and the I/O operation request is placed in the I/O device request On the empty position of the queue, and directly obtain the I/O operation request from the empty position, because the complex I/O scheduling process is omitted, it can simplify the I/O protocol stack in the prior art and shorten the path of I/O transmission Depth, reducing resource consumption and delay of I/O transmission effectively reduces processing time, and can reduce power consumption and cost, and is more suitable for high-concurrency and high-random I/O operation requests for solid-state drives.

以下请参见图2,图2是本发明实施例的固态硬盘的驱动装置第一实施例的装置结构示意图。固态硬盘的驱动装置20应用于操作系统,操作系统包括通用块层、I/O调度层、块设备驱动层,如图2所示,该装置20包括块I/O请求接收模块201、格式转换模块202、插入模块203、I/O操作请求获取模块204以及驱动模块205。其中:Referring to FIG. 2 below, FIG. 2 is a schematic diagram of the device structure of the first embodiment of the driving device for the solid state disk according to the embodiment of the present invention. The driving device 20 of the solid-state hard disk is applied to the operating system, and the operating system includes a general block layer, an I/O scheduling layer, and a block device driver layer. As shown in Figure 2, the device 20 includes a block I/O request receiving module 201, a format conversion module 202 , insertion module 203 , I/O operation request acquisition module 204 and driver module 205 . in:

块I/O请求接收模块201,用于接收通用块层发出的记录有操作指令的块I/O请求;A block I/O request receiving module 201, configured to receive a block I/O request recorded with an operation instruction sent by the general block layer;

格式转换模块202,用于将块I/O请求格式转换为记录有操作指令的I/O操作请求,I/O操作请求为I/O调度层的的基本操作单元;A format conversion module 202, configured to convert the format of the block I/O request into an I/O operation request recorded with an operation instruction, and the I/O operation request is a basic operation unit of the I/O scheduling layer;

插入模块203,用于将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置;Insertion module 203, for inserting the I/O operation request into the empty position of the I/O device request queue of the I/O scheduling layer;

I/O操作请求获取模块204,用于从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层;The I/O operation request obtaining module 204 is used to obtain the I/O operation request from the empty position of the I/O device request queue, and send the I/O operation request to the block device driver layer;

驱动模块205,用于根据块设备驱动层接收到的I/O操作请求中记录的操作指令驱动固态硬盘206。The driver module 205 is configured to drive the solid state disk 206 according to the operation instruction recorded in the I/O operation request received by the block device driver layer.

可选地,操作指令包括读指令和写指令中的任意一种或两种。Optionally, the operation instruction includes any one or both of a read instruction and a write instruction.

可选地,块I/O请求设置为bio结构体,I/O操作请求设置为request结构体。Optionally, the block I/O request is set to a bio structure, and the I/O operation request is set to a request structure.

可选地,操作系统包括linux操作系统或unix操作系统。Optionally, the operating system includes a linux operating system or a unix operating system.

由于闪存颗粒采用顺序方式进行读写,其与机械磁盘所采用的磁盘转动的读写机制截然不同,本发明实施例将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置,从该空队列位置获取I/O操作请求,从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层,根据I/O操作请求中记录的操作指令驱动固态硬盘。从而跳过对I/O操作请求进行合并、排序等复杂的调度过程,更为适合于采用闪存颗粒(flash disk)的固态硬盘,在驱动固态硬盘时,能有效缩减处理时间,并且可降低功耗及成本。Since the flash memory particles are read and written in a sequential manner, which is completely different from the disk rotation reading and writing mechanism adopted by the mechanical disk, the embodiment of the present invention inserts the I/O operation request into the I/O device request queue of the I/O scheduling layer The empty position of the queue, obtain the I/O operation request from the empty queue position, obtain the I/O operation request from the empty position of the I/O device request queue, and send the I/O operation request to the block device driver layer, according to the I/O The operation instruction recorded in the operation request drives the solid-state disk. In this way, complex scheduling processes such as merging and sorting of I/O operation requests are skipped, and it is more suitable for solid-state hard disks using flash disks. When driving solid-state hard disks, it can effectively reduce processing time and reduce power consumption. Consumption and cost.

以下请参见图4,图4是本发明固态硬盘的驱动装置第二实施例的结构示意图,如图4所示,本发明固态硬盘的驱动装置30包括存储器33、处理器31以及总线35,其中存储器33以及处理器31分别与总线35连接,以通过总线35进行数据交互。Please refer to FIG. 4 below. FIG. 4 is a schematic structural diagram of a second embodiment of a drive device for a solid-state hard disk of the present invention. As shown in FIG. The memory 33 and the processor 31 are respectively connected to the bus 35 for data exchange through the bus 35 .

本发明固态硬盘的驱动装置30用于驱动固态硬盘32,固态硬盘32与总线35连接,以通过总线35与存储器33、处理器31进行数据交互。需说明的是,固态硬盘32也可以为固态硬盘的驱动装置30内部。The driving device 30 of the solid-state hard disk of the present invention is used to drive the solid-state hard disk 32 , and the solid-state hard disk 32 is connected to the bus 35 to perform data interaction with the memory 33 and the processor 31 through the bus 35 . It should be noted that the solid state disk 32 may also be inside the drive device 30 of the solid state disk.

在本发明的其它一些实施例中,存储器33、处理器31以及固态硬盘32也可以不通过总线35直接连接。In some other embodiments of the present invention, the memory 33 , the processor 31 and the solid state disk 32 may also be directly connected without the bus 35 .

存储器33可以实现为计算机的软盘、U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random AccessMemory)、磁碟或者光盘等的一种或多种。The memory 33 can be implemented as one or more of a computer's floppy disk, U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk, or optical disk.

存储器33存储了如下的元素,可执行模块或者数据结构,或者它们的子集,或者它们的扩展集:The memory 33 stores the following elements, executable modules or data structures, or their subsets, or their extended sets:

应用程序331包括各种应用程序,例如办公室应用软件、绘图软件或各种编辑软件,用于实现各种应用业务,在本发明实施例中,应用程序331可激活操作系统332中用于对固态硬盘32进行操作的进程,该进程包括写入固态硬盘32的进程、读取固态硬盘32的进程或擦除固态硬盘32内存储内容的进程。The application program 331 includes various application programs, such as office application software, drawing software or various editing software, which are used to realize various application services. In the embodiment of the present invention, the application program 331 can activate the The operation process of the hard disk 32 includes the process of writing to the solid state hard disk 32 , the process of reading the solid state hard disk 32 or the process of erasing the stored content in the solid state hard disk 32 .

操作系统332包括各种系统程序,例如图1所示的文件系统层、通用块层、I/O调度层、块设备驱动层以及设备层等,用于实现各种基础业务以及处理基于硬件的任务。The operating system 332 includes various system programs, such as the file system layer, general block layer, I/O scheduling layer, block device driver layer, and device layer shown in FIG. Task.

在本发明实施例中,处理器31通过调用存储器33中存储的程序(该程序可以通过应用程序实现,也可以通过操作系统来实现,在通过操作系统来实现时,具体可以将操作系统的内核进行重新编译,以新的操作系统内核形式存储在操作系统中),执行如下操作:In the embodiment of the present invention, the processor 31 calls the program stored in the memory 33 (the program can be implemented by an application program or an operating system, and when implemented by an operating system, specifically, the kernel of the operating system can be Recompile and store in the operating system in the form of a new operating system kernel), perform the following operations:

接收通用块层发出的记录有操作指令的块I/O请求;Receive block I/O requests recorded with operation instructions issued by the general block layer;

将块I/O请求格式转换为记录有操作指令的I/O操作请求,其中I/O操作请求为I/O调度层的基本操作单元;Convert the block I/O request format into an I/O operation request with operation instructions recorded, where the I/O operation request is the basic operation unit of the I/O scheduling layer;

将I/O操作请求插入到I/O调度层的I/O设备请求队列的空位置;Insert the I/O operation request into the empty position of the I/O device request queue of the I/O scheduling layer;

从I/O设备请求队列的空位置获取I/O操作请求,将I/O操作请求发送给块设备驱动层;Obtain the I/O operation request from the empty position of the I/O device request queue, and send the I/O operation request to the block device driver layer;

根据块设备驱动层接收到的I/O操作请求中记录的操作指令驱动固态硬盘32。The solid-state hard disk 32 is driven according to the operation instruction recorded in the I/O operation request received by the block device driver layer.

进一步的,本发明实施例提供的终端设备还可以包括输入设备,用户可以使用输入设备向应用程序输入对固态硬盘32进行操作的命令,以激活操作系统中用于对固态硬盘32进行操作的进程,在其它一些实施例中,对固态硬盘32进行操作的命令也可以直接来自于操作系统。输入设备可以实现为触摸屏、鼠标、键盘等。Further, the terminal device provided by the embodiment of the present invention may also include an input device, and the user may use the input device to input commands for operating the solid-state hard disk 32 to the application program, so as to activate the process for operating the solid-state hard disk 32 in the operating system , in some other embodiments, the command to operate the solid state disk 32 may also come directly from the operating system. The input device may be implemented as a touch screen, mouse, keyboard, and the like.

如图4所示各个模块通过总线35连接,该总线35可以是ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(Peripheral Component,外部设备互连)总线或EISA(Extended IndustryStandard Architecture,扩展工业标准体系结构)总线等。所述总线35可以是一条或多条物理线路,当是多条物理线路时可以分为地址总线、数据总线、控制总线等。在本发明实施例其它一些实现方式中,本发明实施例提供的各个模块也可以不通过总线35的方式连接,而根据信号传递关系直接建立通信连接。Each module as shown in Figure 4 is connected by bus 35, and this bus 35 can be ISA (Industry Standard Architecture, industry standard architecture) bus, PCI (Peripheral Component, external device interconnection) bus or EISA (Extended IndustryStandard Architecture, extended industry standard architecture) bus, etc. The bus 35 can be one or more physical lines, and when there are multiple physical lines, it can be divided into an address bus, a data bus, a control bus, and the like. In some other implementations of the embodiments of the present invention, the various modules provided in the embodiments of the present invention may also not be connected through the bus 35, but directly establish communication connections according to the signal transmission relationship.

需说明的是,存储器33中存储的程序的模块划分可以参考前述实施例的模块划分方式,也可以采用另外的模块划分方式。It should be noted that, for the module division of the program stored in the memory 33, reference may be made to the module division method of the foregoing embodiments, or another module division method may be adopted.

可选地,操作指令包括读指令和写指令中的一种或任意两种。Optionally, the operation instruction includes one or any two of a read instruction and a write instruction.

可选地,块I/O请求设置为bio结构体,I/O操作请求设置为request结构体。Optionally, the block I/O request is set to a bio structure, and the I/O operation request is set to a request structure.

可选地,操作系统包括linux操作系统或unix操作系统。Optionally, the operating system includes a linux operating system or a unix operating system.

由于对固态硬盘32进行读写操作无需进行磁盘寻道,因此在本实施例中通过将I/O操作请求直接插入到I/O设备请求队列的空位置,从该空队列位置获取I/O操作请求,并根据I/O操作请求中记录的操作指令驱动固态硬盘32,而固态硬盘32没有对I/O操作请求的合并、排序等调度需求,因此本发明实施例省略了对I/O操作请求进行合并、排序等复杂的调度过程,从而能有效缩减处理时间,并且可降低功耗及成本。Since the read and write operations to the solid-state hard disk 32 do not require disk seeking, in this embodiment, the I/O operation request is directly inserted into the empty position of the I/O device request queue, and the I/O is obtained from the empty queue position. operation request, and drive the solid-state disk 32 according to the operation instructions recorded in the I/O operation request, and the solid-state disk 32 does not have scheduling requirements such as merging and sorting of I/O operation requests, so the embodiment of the present invention omits the I/O Complex scheduling processes such as merging and sorting of operation requests can effectively reduce processing time, and reduce power consumption and cost.

另外,在本申请所提供的几个实施方式中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例实施方式仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In addition, in the several implementation manners provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the implementations of the device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or Components may be combined or integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例实施方式方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the implementation scheme of this embodiment.

另外,在本申请各个实施例实施方式中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例实施方式所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes. .

以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above is only an embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the description of the present invention and the contents of the accompanying drawings, or directly or indirectly used in other related technologies fields, are all included in the scope of patent protection of the present invention in the same way.

Claims (8)

CN201310093035.XA2013-03-212013-03-21The driving method of solid state hard disc and deviceExpired - Fee RelatedCN103226448B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201310093035.XACN103226448B (en)2013-03-212013-03-21The driving method of solid state hard disc and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201310093035.XACN103226448B (en)2013-03-212013-03-21The driving method of solid state hard disc and device

Publications (2)

Publication NumberPublication Date
CN103226448A CN103226448A (en)2013-07-31
CN103226448Btrue CN103226448B (en)2016-09-07

Family

ID=48836919

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201310093035.XAExpired - Fee RelatedCN103226448B (en)2013-03-212013-03-21The driving method of solid state hard disc and device

Country Status (1)

CountryLink
CN (1)CN103226448B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105635086B (en)*2014-11-192020-02-04中国科学院声学研究所Method for accessing external memory of switch from control plane and data plane
CN105183601B (en)*2015-09-222018-05-04浪潮(北京)电子信息产业有限公司A kind of test disk rotational time, the method and device of cylinder capacity
CN105573822A (en)*2015-12-212016-05-11国云科技股份有限公司Method for reducing disk space of virtual machine
CN106713494B (en)*2017-01-232020-05-08上海上讯信息技术股份有限公司Intelligent auditing method and device
CN110309001B (en)*2018-03-272023-05-05麒麟软件有限公司Linux universal block layer multi-queue based optimization system and method
CN109032523B (en)*2018-07-262021-08-10郑州云海信息技术有限公司Disk device driving method, system, device and readable storage medium
CN115061648A (en)*2022-05-132022-09-16合肥杰发科技有限公司Operation method of vehicle-mounted display system and vehicle-mounted display system

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7457886B1 (en)*2004-02-032008-11-25Apple Inc.System and method for input/output scheduling
CN102830941A (en)*2012-06-152012-12-19记忆科技(深圳)有限公司Solid-state hard disk driving method and storage system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7457886B1 (en)*2004-02-032008-11-25Apple Inc.System and method for input/output scheduling
CN102830941A (en)*2012-06-152012-12-19记忆科技(深圳)有限公司Solid-state hard disk driving method and storage system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Linux Block I/O Scheduling;Aaron Carroll;《University of New South Welsh》;20071231;第3节*

Also Published As

Publication numberPublication date
CN103226448A (en)2013-07-31

Similar Documents

PublicationPublication DateTitle
CN103226448B (en)The driving method of solid state hard disc and device
CN101616174B (en) A method for dynamically tracking the IO processing path of a storage system to optimize system performance
CN112181293B (en) Solid state disk controller, solid state disk, storage system and data processing method
US8661163B2 (en)Tag allocation for queued commands across multiple devices
CN103631624A (en)Method and device for processing read-write request
CN105393236B (en)Requiring rapid data read/writing method and apparatus
US20200319797A1 (en)System and method for file processing from a block device
CN113778317B (en) Computer readable storage medium, method and device for scheduling host commands
CN113568731B (en) A task scheduling method, chip and electronic device
CN118575159A (en)Real-time migration of virtual machine data with non-volatile memory device assistance
CN116582438A (en) A virtualized video codec system and method, electronic equipment and storage medium
CN102681790B (en)A kind of data dump equipment and carried out the method and system of data dump by it
WO2025152506A1 (en)Data processing system and method, device and nonvolatile readable storage medium
CN109347899B (en) Method of writing log data in distributed storage system
KR20080105390A (en) Method and apparatus for controlling instructions used in flash memory
CN103049546B (en)The method and apparatus of a kind of management, access system daily record
JP2009087282A (en)Parallel computation system and parallel computation method
CN115079936A (en)Data writing method and device
CN115061958B (en) Hard disk identification method, identification system, storage medium and computer equipment
CN108932112A (en)A kind of data read-write method of solid granulates, device, equipment and medium
CN104750547B (en)The input and output I/O request processing method and processing device of virtual machine
CN116774925A (en) Disk storage system, method and server
CN104571952A (en)Method for separately processing data reading and writing requests and metadata reading and writing requests
CN115221099A (en) Method and system for task processing
CN110502190B (en)File reading and writing method

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C14Grant of patent or utility model
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20160907

Termination date:20180321

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp