CN106598474A - Small computer system interface (SCSI) command concurrent processing method and apparatus - Google Patents

Small computer system interface (SCSI) command concurrent processing method and apparatus Download PDF

Info

Publication number
CN106598474A
CN106598474A CN201510673132.5A CN201510673132A CN106598474A CN 106598474 A CN106598474 A CN 106598474A CN 201510673132 A CN201510673132 A CN 201510673132A CN 106598474 A CN106598474 A CN 106598474A
Authority
CN
China
Prior art keywords
queue
lun
scsi command
scsi
order
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.)
Withdrawn
Application number
CN201510673132.5A
Other languages
Chinese (zh)
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201510673132.5A priority Critical patent/CN106598474A/en
Priority to PCT/CN2016/100873 priority patent/WO2017063507A1/en
Publication of CN106598474A publication Critical patent/CN106598474A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Advance Control (AREA)

Abstract

The present invention discloses a small computer system interface (SCSI) command concurrent processing method. The method comprises a first step of when a first level of logical units number (LUN) queue is non-null, acquiring an LUN corresponding to a current queue head of the first level of LUN queue, and deleting the current queue head of the first level of LUN queue after the LUN is acquired; and a second step of when a second level of SCSI command queue corresponding to the acquired LUN is non-null or meets a first preset condition, sequentially processing SCSI commands in the second level of SCSI command queue till the second level of SCSI command queue is null or meets the a second preset condition, and returning to the first step. The present invention further discloses an SCSI command concurrent processing apparatus. Through adoption of the method and apparatus, the SCSI commands can be processed concurrently, so that the CPU use rate is lowered, the storage system performance is improved, and the SCSI commands are ensured to deliver according to a command receiving sequence to a bottom layer to process.

Description

The concurrent processing method and device of scsi command
Technical field
The present invention relates to memory system technologies field, more particularly to the concurrent processing method and dress of scsi command Put.
Background technology
In disk array controller, miniature computer system interface target equipment (Small Computer System Interface Target Device) comprising logical block (logical units) and scsi target end Mouth (SCSI target ports), its major function is to receive to come from SCSI initiator (SCSI initiator Devices device service) and task management request command, after process, to SCSI initiator response are sent; Wherein, when scsi command process is realized, need to ensure two principles:One is order especially SCSI The order-preserving of order, that is, ensure the SCSI on same LUN (logical units number, LUN) Order is given first floor system and is performed by its order for receiving;Two is the high efficiency that scsi command is processed, i.e., Ask command process function performance have to it is very high, it is impossible to become the bottleneck of storage system.
When at present scsi command is processed and realized, often using the queue of single thread list to all scsi commands according to Secondary to be processed, the scsi command of different LUN is ranked process into same fifo queue, such as Shown in Fig. 1.The advantage of single thread list queue be evaded the concurrent of multithreading and realize it is relatively easy, together When scsi command execution sequence can be effectively ensured.But have the disadvantage to be written and read (I/O) per second When the number of times of operation is very big, single thread can take very high CPU, even up to the limit of CPU, become The bottleneck of storage system.Therefore the realization that scsi command is processed is necessary that introducing concurrent processing mechanism is (multi-thread Journey substitutes single thread), so as to effectively reduce the utilization rate of CPU so that storage system overall performance is obtained Lifted, but the introducing of concurrent processing mechanism is then difficult to ensure that the execution sequence of scsi command, such as use Single queue processing scsi command, the order 1 for first receiving is taken and is performed by thread 1, then receives afterwards Order 2 is taken and is performed by thread 2, concurrently runs because scsi command processes thread, then line Journey 1 may be blocked and thread 2 is scheduled and performs, and order 2 on the contrary can give bottom and hold prior to order 1 OK.It is therefore desirable to studying a kind of concurrent processing method and device of scsi command of practicability and effectiveness.
The content of the invention
Present invention is primarily targeted at providing a kind of concurrent processing method and device of scsi command, it is intended to Solve how to ensure the execution sequence of scsi command and connecing for scsi command after concurrent processing mechanism is introduced Receive the technical problem of sequence consensus.
For achieving the above object, the present invention provides a kind of the concurrent of small computer system interface scsi command Processing method, the concurrent processing method of the scsi command includes step:
S1, when first order LUN queue non-NULL, obtain the current queue of the first order LUN queue LUN corresponding to head, and after LUN is obtained, delete the current queue of the first order LUN queue Head;
S2, when with the corresponding second level scsi command queue not empties of LUN for obtaining or to meet first pre- If during condition, the scsi command in the second level scsi command queue is processed successively, until described Return to step S1 when two grades of scsi command queues are sky or pre-conditioned satisfaction second.
Preferably, in step S2, the SCSI processed in the second level scsi command queue Order includes step:
Obtain the scsi command corresponding to the current queue head of the second level scsi command queue;
After scsi command is obtained, the current queue head of the second level scsi command queue is deleted;
The first floor system that acquired scsi command is sent to into corresponding scsi target device is corresponding to perform Process operation.
Preferably, the bottom system that acquired scsi command is sent to corresponding scsi target device System is included with performing after respective handling is operated:
In acquired scsi command needs to be linked into currently accessed second level scsi command queue with When proceeding to process, it would be desirable to which the scsi command being linked into adds currently accessed second level SCSI lives Make the rear of queue of queue;
Whether the LUN corresponding to scsi command that judgement is linked into be not processed and not described first In level LUN queue;
If so, then by the LUN additions first order LUN queue corresponding to the scsi command being linked into Rear of queue.
Preferably, described first pre-conditioned at least includes the second level scsi command queue not empty and not Accumulative to have processed N number of scsi command, described second is pre-conditioned at least including second level SCSI lives Make queue not empty and add up to have processed N number of scsi command;When second level scsi command queue is sky Or meet second it is pre-conditioned when return to step S1 include:
When second level scsi command queue be space-time, return to step S1;Or,
When the second level scsi command queue not empty and it is accumulative processed N number of scsi command when, ought LUN corresponding to described N number of scsi command of pre-treatment adds the team of the first order LUN queue Row tail, return to step S1.
Preferably, the concurrent processing method of the scsi command also includes:
When scsi command is received, the relevant information in scsi command, it is determined that received LUN corresponding to scsi command;
Received scsi command is added into the second level scsi command corresponding to the LUN with determined by The rear of queue of queue;
Whether LUN determined by judgement be not processed and not in the first order LUN queue;
If so, then by determined by LUN adds the rear of queue of the first order LUN queue.
Further, for achieving the above object, the present invention also provides a kind of small computer system interface SCSI The concurrent processing device of order, the concurrent processing device of the scsi command includes:
LUN queue processing module, for when first order LUN queue non-NULL, obtaining the first order LUN corresponding to the current queue head of LUN queue, and after LUN is obtained, delete the first order The current queue head of LUN queue;
Command queue's processing module, for when the second level scsi command team corresponding with the LUN for obtaining When row non-NULL or pre-conditioned satisfaction first, the SCSI in the second level scsi command queue is processed successively Order, until second level scsi command queue for it is empty or meet second it is pre-conditioned when return and process the One-level LUN queue.
Preferably, command queue's processing module includes:
Command acquisition unit, for obtaining corresponding to the current queue head of the second level scsi command queue Scsi command;
Unit is deleted in queue heads order, for after scsi command is obtained, deleting the second level SCSI The current queue head of command queue;
Command sending unit, for acquired scsi command to be sent to into corresponding scsi target device First floor system is operated with performing respective handling.
Preferably, the concurrent processing device of the scsi command also includes:
Order adds Queue module, for needing to be linked into currently accessed the when acquired scsi command When being processed with proceeding in two grades of scsi command queues, it would be desirable to which the scsi command being linked into adds current The rear of queue of the second level scsi command queue for being accessed;
LUN judge modules, for judge LUN corresponding to the scsi command that is linked into whether not by Process and not in the first order LUN queue;
LUN adds Queue module, for not located as the LUN corresponding to the scsi command being linked into Reason and not in the first order LUN queue when, by corresponding to the scsi command being linked into LUN add The rear of queue of the first order LUN queue.
Preferably, described first pre-conditioned at least includes the second level scsi command queue not empty and not Accumulative to have processed N number of scsi command, described second is pre-conditioned at least including second level SCSI lives Make queue not empty and add up to have processed N number of scsi command;Command queue's processing module also includes:
Returning unit, for being space-time when second level scsi command queue, returns and processes the first order LUN queue;Or, when the second level scsi command queue not empty and adding up to have processed N number of SCSI During order, the LUN corresponding to currently processed described N number of scsi command is added into first order LUN The rear of queue of queue, returns and processes first order LUN queue.
Preferably, the concurrent processing device of the scsi command also includes:
LUN determining modules, for the related letter when scsi command is received, in scsi command Breath, it is determined that the LUN corresponding to received scsi command;
The order adds Queue module to be additionally operable to:Received scsi command is added with determined by The rear of queue of the second level scsi command queue corresponding to LUN;
The LUN judge modules are additionally operable to:Whether LUN determined by judgement be not processed and not In the first order LUN queue;
The LUN adds Queue module to be additionally operable to:LUN be not processed and is not existing determined by When in the first order LUN queue, LUN adds the team of the first order LUN queue by determined by Row tail.
The present invention will be received according to scsi command and the corresponding relation of LUN using secondary queue Scsi command is ranked preservation, in combination with certain process rule ensureing the execution of scsi command Sequentially, wherein, first order queue is used to deposit LUN, and second level queue is used to deposit order, the first order Every LUN one corresponding second level queue of correspondence in queue.First order queue is processed first to obtain One LUN, and after LUN is obtained, the LUN is deleted from first order queue, so as to ensure Before having processed the LUN, other concurrent threads can not get the LUN from first order queue, and then Ensure that at any time, each LUN can only be right so as to effectively evade by a thread process In the concurrent processing of same LUN;Then in reprocessing second level queue corresponding with the LUN for obtaining Scsi command, it is same so as to also accordingly ensure that because scsi command is stored in the queue of the second level Scsi command on individual LUN must give scsi device execution in the order received.By this Invention, so as to reduce CPU usage, can improve performance of storage system with concurrent processing scsi command, Also ensure that scsi command gives bottom layer treatment according to order reception order simultaneously.
Description of the drawings
Fig. 1 is the single thread list queue processing schematic diagram of existing scsi command;
Fig. 2 is that the multithreading secondary queue of scsi command in the present invention processes schematic diagram;
Fig. 3 is the schematic flow sheet of the concurrent processing method first embodiment of scsi command of the present invention;
Fig. 4 is the schematic flow sheet of the concurrent processing method second embodiment of scsi command of the present invention;
Fig. 5 is the schematic flow sheet of the concurrent processing method 3rd embodiment of scsi command of the present invention;
Fig. 6 is the schematic flow sheet of the concurrent processing method fourth embodiment of scsi command of the present invention;
Fig. 7 is the schematic flow sheet of scsi command reception and the embodiment of handling process one;
Fig. 8 is the high-level schematic functional block diagram of the concurrent processing device first embodiment of scsi command of the present invention;
Fig. 9 is the refinement high-level schematic functional block diagram of the embodiment of Tu8Zhong command queues processing module one;
Figure 10 is the high-level schematic functional block diagram of the concurrent processing device second embodiment of scsi command of the present invention;
Figure 11 is the refinement high-level schematic functional block diagram of another embodiment of Tu8Zhong command queues processing module;
Figure 12 is the high-level schematic functional block diagram of the concurrent processing device 3rd embodiment of scsi command of the present invention.
The realization of the object of the invention, functional characteristics and advantage will be done referring to the drawings further in conjunction with the embodiments Explanation.
Specific embodiment
It should be appreciated that specific embodiment described herein is not used to limit only to explain the present invention The present invention.
The present invention in view of very high CPU can be taken during single thread list queue processing scsi command, even up to The limit of CPU and become the bottleneck of storage system, and adopt concurrent processing mechanism (multithreading substitute single line Journey) be then difficult to ensure that scsi command execution sequence problem, therefore, be effectively to reduce CPU to make With rate so that storage system overall performance gets a promotion, while also ensure the execution sequence of scsi command, The present invention will receive SCSI according to scsi command and the corresponding relation of LUN using secondary queue Preservation of ranking is ordered, in combination with certain regular execution sequence to ensure scsi command of process, Wherein, first order queue is used to deposit LUN LUN, and second level queue is used to deposit SCSI lives Order, the every LUN in first order queue corresponds to a corresponding second level queue, pending SCSI Order is put in the second level queue corresponding to correspondence LUN;First order LUN queue and second level order Queue is all fifo queue (First in First out, fifo queue) as shown in Fig. 2 wherein, Because first order queue and second level queue are used as the shared resource of multiple threads during concurrent processing, therefore, The concurrently protection that each self-corresponding mutual exclusion lock is preferably adopted in the present embodiment to conduct interviews during shared resource.
Furthermore, it is necessary to further illustrate, there are some scsi commands within the storage system and do not correspond to Any one LUN, therefore, it is to realize the process to these scsi commands, the present invention will be by generating One public pseudo- LUN structure (LUN is only used inside storage system and externally do not presented), The public pseudo- LUN can also put into first order queue as other LUN and be processed;It is all The order for not corresponding to any LUN is put in the command queue corresponding to the pseudo- LUN.For this type The processing mode of scsi command is identical with the processing mode of other scsi commands, therefore, under the present invention State in each embodiment for scsi command and process need not be made a distinction.
In disk array controller within the storage system, scsi target device includes logical block and SCSI Target port, its major function is to receive and process scsi command, and returns result.Specially divide The parameters such as the operation code of each scsi command are analysed, and scsi command parameter is passed to into scsi target device First floor system corresponding process operation to perform.
Wherein, LUN (LUN) is corresponding with entity scsi device, is to scsi device A kind of description method, also as a kind of virtualized storage device.The main face of LUN (LUN) To in operating system, the data interaction between operating system and scsi device is realized, while LUN (LUN) lower floor relies on physical storage device.Scsi interface (Small Computer System Interface, small computer system interface) it is a kind of general-purpose interface, can connect on SCSI buses Host adapter and scsi device, such as disk, tape, CD-ROM, erasable optical disk driver, Printer, scanner and communication apparatus etc., wherein scsi command correspond to process corresponding scsi device, Such as transmit print parameters, transmission print data etc..
With reference to Fig. 3, Fig. 3 is that the flow process of the concurrent processing method first embodiment of scsi command of the present invention is shown It is intended to.In the present embodiment, the concurrent processing method of the scsi command includes step:
S1, when first order LUN queue non-NULL, obtain the current queue of the first order LUN queue LUN corresponding to head, and after LUN is obtained, delete the current queue of the first order LUN queue Head;
Firstly the need of explanation, when scsi command process is realized, the one of principle for ensureing is needed It is exactly the order-preserving of scsi command, that is, ensures same LUN (logical units number, logical block Number) on scsi command give first floor system by its order for receiving and perform, it is and corresponding in the present embodiment The concurrent processing environments of scsi command are multiple threads, namely have multiple thread process multiple different Scsi command, therefore to ensure any time, the every LUN in first order LUN queue can only be by One thread process, first obtains the LUN for being currently needed for processing in the present embodiment, then obtaining the LUN Afterwards and before the LUN of the acquisition is really processed, the current queue head of first order LUN queue is first deleted Corresponding LUN, the LUN that also will be obtained are deleted from first order LUN queue, so as to ensure to work as Before the LUN has been processed, other threads are impossible to get this LUN front thread, so as to ensure Any time, the every LUN in first order LUN queue by a thread process, thus can only have Effect has evaded the concurrent processing for same LUN.
It should be noted that the LUN that obtains from first order LUN queue in the present embodiment is only merely With the information that reading manner obtains the LUN, after having obtained, the information of the LUN still exists in first In the queue heads of level LUN queue, so needing to delete LUN queue again from first order LUN queue Queue heads corresponding to LUN.
S2, when with the corresponding second level scsi command queue not empties of LUN for obtaining or to meet first pre- If during condition, the scsi command in the second level scsi command queue is processed successively, until described Return to step S1 when two grades of scsi command queues are sky or pre-conditioned satisfaction second.
According to the LUN for obtaining with the SCSI in the second level scsi command queue corresponding to processing the LUN Order.Because the scsi command on LUN is all stored in second level scsi command queue (fifo queue) In, and fifo queue can ensure that the scsi command on the LUN must be the order received according to it The first floor system execution of scsi target device is given, further, since any time is ensure that, the first order Every LUN in LUN queue by a thread process, thus can only effectively evade for same The concurrent processing of LUN, namely different scsi commands in same scsi command queue are avoided by two Different threads is performed and causes execution sequence not correspond with reception order, namely the present invention is in concurrent processing The order-preserving to scsi command is successfully realized under mechanism.Meanwhile, concurrent processing mechanism is similarly realized The high efficiency of scsi command process, effectively reduces the utilization rate of CPU so that storage system overall performance Get a promotion.
In addition, it is necessary to explanation, in the second level, scsi command queue not empty or satisfaction first are pre-conditioned When, second level scsi command queue is processed, wherein the first pre-conditioned setting is not limited, specifically It is configured according to actual needs.And all SCSI lives in second level scsi command queue has been processed The scsi command queue of after the order namely second level exits process for space-time, or can also preset meeting second Process is exited during condition, the second pre-conditioned setting is not limited, and is configured with specific reference to being actually needed.
In the present embodiment, according to scsi command and the corresponding relation of LUN, using two grades of FIFO Queue will receive scsi command and rank preservation, in combination with certain process rule ensureing SCSI The execution sequence of order, in the LUN in processing first order queue, by the LUN for obtaining from the first order Delete in queue, so as to ensure before the LUN has been processed, other concurrent threads can not be from first order team The LUN is got in row, and then be ensure that at any time, each LUN can only be by a thread Process, so as to effectively evade the concurrent processing for same LUN;Because scsi command is stored in In the fifo queue of the second level, so as to the scsi command that also accordingly ensure that on same LUN must be by Scsi device execution is given according to the order for receiving.By the present invention can with concurrent processing scsi command, So as to reduce CPU usage, performance of storage system is improved, while also ensure that scsi command according to life Make reception order give first floor system and perform respective handling operation.
With reference to Fig. 4, Fig. 4 is that the flow process of the concurrent processing method second embodiment of scsi command of the present invention is shown It is intended to.It is described to process described second in above-mentioned steps S2 in the present embodiment based on above-described embodiment Scsi command in level scsi command queue includes step:
Scsi command corresponding to S21, the current queue head of the acquisition second level scsi command queue;
S22, after scsi command is obtained, delete the current queue head of the second level scsi command queue;
S23, acquired scsi command is sent to the first floor system of corresponding scsi target device to perform Respective handling is operated.
In the present embodiment, need first to obtain scsi command, Ran Houzai from the scsi command queue of the second level Scsi command to obtaining carries out respective handling.Further, since second level scsi command queue is FIFO Queue and reception have multiple tactic scsi commands, therefore, be ensure connecing according to scsi command Sequential processing scsi command is received, after a scsi command is obtained, needs to delete from current queue head The scsi command that Jing is obtained, so that queue head pointer points to next scsi command, namely is deleting team After scsi command corresponding to row head, queue heads will again correspond to next scsi command, then obtain next time Correspondence is obtained into next scsi command during queue heads.Finally, the scsi command that will be obtained is needed to send Operated with performing respective handling to the first floor system of corresponding scsi target device, for example, the SCSI of acquisition Order to be arranged for print parameters and operate, then after the scsi command is obtained, send it to printer apparatus First floor system to perform corresponding print parameters, operation is set.
In the present embodiment, above-mentioned steps S21-S23 are performed by circulation, so as to realize successively to the second level Each scsi command is processed according to its order for receiving in scsi command queue, so as to ensure that SCSI Order is given first floor system and performs respective handling operation according to order reception order.
With reference to Fig. 5, Fig. 5 is that the flow process of the concurrent processing method 3rd embodiment of scsi command of the present invention is shown It is intended to.Based on above-described embodiment, in the present embodiment, step is included after step S23:
S31, need to be linked into currently accessed second level scsi command queue when acquired scsi command In to proceed to process when, it would be desirable to the scsi command that is linked into adds currently accessed second level SCSI The rear of queue of command queue;
In the present embodiment, the process cycle of scsi command generally can be divided into multiple stages, when certain scala media After the completion of section is processed, need again order to be linked in the scsi command queue of the second level, so as to follow-up again It is next processing stage in proceed process, after the completion of all processing processing stage all, just understand from Delete in the scsi command queue of the second level and be no longer linked into.
When remaining a need for continuing with the scsi command that processed in the subsequent processing stage of scsi command When, treated scsi command is linked into into again the second level command queue afterbody of corresponding LUN, Wherein, it is to ensure that the order that the order for processing scsi command is received with it is consistent, accordingly, it would be desirable to will The scsi command being linked into adds the rear of queue of currently accessed second level scsi command queue, Ye Jibao Hold the sequence consensus for putting in order and receiving of scsi command in the command queue of the second level.
Whether the LUN corresponding to scsi command that S32, judgement are linked into be not processed and not described In first order LUN queue;
In the present embodiment, in view of in the present invention secondary queue structure access mode, therefore, will need The scsi command being linked into is added after the rear of queue of currently accessed second level scsi command queue, is also needed LUN corresponding to the scsi command being linked into further is added the rear of queue of first order LUN queue.This Outward, the LUN corresponding to scsi command being linked into due to this is possible to have been positioned at first order LUN queue In or be processed, therefore for avoid produce conflict, add LUN in first order LUN queue When, need to judge the state of the LUN of the addition.
For ease of entering to the current state of LUN (ratio is such as whether in queue, if processed etc.) Row accurately judgement, can describe each by arranging the status indicator parameter of LUN to each LUN The current state of LUN.At any time, as long as the state of LUN changes, its status indicator parameter Value be also required to accordingly be changed.
S33, if so, then the LUN corresponding to the scsi command being linked into added into first order LUN The rear of queue of queue;
S34, if it is not, being then left intact.
When the current state of the LUN for needing to add meets above-mentioned Rule of judgment, namely there is no addition punching When prominent, then the LUN is added the rear of queue of first order LUN queue.And when the LUN's for needing to add When current state is unsatisfactory for above-mentioned Rule of judgment, namely the LUN for adding is needed to have been positioned at first order LUN In queue or it is being processed, thus any process need not be being done, and the scsi command being linked into also can Realization is processed again.
In the present embodiment, it is contemplated that continue with the situation of processed scsi command, due to When processing each scsi command, be required for deleting scsi command from queue, therefore, when need after It is continuous when being processed, need to be added to again in queue.It is further perfect originally by the present embodiment The concurrent processing flow process of scsi command in invention, improves the practicality of the present invention.
Based on above-described embodiment, in another embodiment of the concurrent processing method of scsi command of the present invention, When the scsi command in the scsi command queue of the second level is processed successively, it is understood that there may be certain extreme case, It is continual on such as certain LUN to receive scsi command (namely command queue's long-time is in non- Dummy status), so as to cause other LUN to be processed and " hungry to death ", it is therefore desirable to pre-set corresponding Condition in case the generation of class extreme case here, such as can arrange a LUN and once at most be processed N number of order, N is positive integer and specifically can rule of thumb arrange suitable value;Or one LUN of setting Once at most manageable duration t, t can rule of thumb arrange suitable value, as long as being prevented from pole End situation occurs, and the concrete set-up mode pre-conditioned to first is not limited.In the present embodiment, preferably first It is pre-conditioned at least to include second level scsi command queue not empty and do not add up to have processed N number of scsi command.
In addition, in the present embodiment, for return to step S1 redirects condition bag with process next LUN Include:
Redirect condition 1:Second level scsi command queue is sky;
Under the condition that redirects 1, the current command processes thread to be needed to have processed second level scsi command team successively The process to current second level scsi command queue could be terminated after all scsi commands in row, so as to Processing authority is conceded, and then other command process thread process next one LUN, namely return can be allowed to hold Row step S1.Originally the scsi command process that condition is only applicable under non-extreme conditions is redirected.
Redirect condition 2:The second level scsi command queue not empty and accumulative N number of SCSI processed and has ordered Order.
When there is above-mentioned extreme case, can be jumped out from extreme case to current the by redirecting condition 2 The process of two grades of scsi command queues, namely when meeting second and being pre-conditioned, you can return to step S1. In the present embodiment, preferably second pre-conditioned at least includes second level scsi command queue not empty and accumulative place N number of scsi command is managed.
When execution redirect condition 2 and return process the next one LUN when, because current LUN is from the Delete in one-level LUN queue, and still also deposit in the second level scsi command queue corresponding to the LUN (force because the process number of scsi command has had reached N number of in untreated complete scsi command Exit), therefore, to continue to complete to remaining in the second level scsi command queue corresponding to the LUN The process of scsi command, under the condition that redirects 2, before return to step S1, needs first will be currently processed Described N number of scsi command corresponding to LUN add first order LUN queue rear of queue, then Return again to execution step S1.Continue to corresponding to the LUN by when thread gets again the LUN Second level scsi command queue in remaining scsi command processed.
Needs explanation in addition, when second level scsi command queue is for sky and adds up to have processed N number of SCSI During order, need to return execution step S1 according to the condition that redirects 1.
In the present embodiment, further contemplate and processed the SCSI in the scsi command queue of the second level successively During order, it is understood that there may be the problem of extreme case.And under this kind of extreme case, second level scsi command Scsi command in queue can not disposably be disposed, therefore, to continue to complete to remaining SCSI The process of order, in the present embodiment, by arranging the second pre-conditioned generation to prevent extreme case, Simultaneously when there is extreme case, be currently executing process and deleted LUN is weighed again In being newly added to first order LUN queue, in order to continue with remaining scsi command, by this reality Apply example, the concurrent processing flow process of scsi command in the further perfect present invention, while also improving this The practicality of invention.
With reference to Fig. 6, Fig. 6 is that the flow process of the concurrent processing method fourth embodiment of scsi command of the present invention is shown It is intended to.Based on above-described embodiment, in the present embodiment, the concurrent processing method of the scsi command also includes Step:
S01, when scsi command is received, the relevant information in scsi command, it is determined that being received The LUN corresponding to scsi command for arriving;
In the present embodiment, in view of the present invention will receive scsi command using secondary queue rank preservation, Therefore, when scsi command is received, it is thus necessary to determine that the LUN corresponding to the scsi command.Existing In the transfer mechanism of scsi command, can be by the operation code of scsi command, relevant parameter, corresponding LUN Scsi command is formed etc. information package, therefore, after parsing scsi command, by the correlation letter in order Breath can determine that the LUN corresponding to received scsi command.Relevant information tool in the present embodiment Body refers to the LUN information corresponding to scsi command, is configured with specific reference to being actually needed.
If needed it is further noted that without corresponding LUN information in the information of the scsi command When, then the LUN being set to public pseudo- LUN corresponding to the scsi command.
S02, received scsi command is added into the second level SCSI corresponding to the LUN with determined by The rear of queue of command queue;
To ensure that the order that the order for processing scsi command is received with it is consistent, accordingly, it would be desirable to will connect The scsi command for receiving adds the second level scsi command corresponding to the LUN according to determined by relevant information The rear of queue of queue, namely keep second level command queue in scsi command put in order with receive it is suitable Sequence is consistent.
Whether S03, LUN determined by judgement be not processed and not in the first order LUN queue In;
In the present embodiment, in view of in the present invention secondary queue structure access mode, therefore, will newly connect The scsi command for receiving adds the queue of the second level scsi command queue with determined by corresponding to LUN After tail, also need further the LUN corresponding to the scsi command for receiving to be added into first order LUN queue Rear of queue.Further, since the LUN corresponding to the scsi command that receives is possible to have been positioned at In first order LUN queue or it is being processed, therefore to avoid producing conflict, in first order LUN When adding LUN in queue, need to judge the state of the LUN of the addition.
For ease of entering to the current state of LUN (ratio is such as whether in queue, if processed etc.) Row accurately judgement, can describe each by arranging the status indicator parameter of LUN to each LUN The current state of LUN.At any time, as long as the state of LUN changes, its status indicator parameter Value be also required to accordingly be changed.
S04, if so, then by determined by LUN adds the rear of queue of the first order LUN queue;
S05, if it is not, being then left intact.
When the current state of the LUN for needing to add meets above-mentioned Rule of judgment, namely there is no addition punching When prominent, then the LUN is added the rear of queue of first order LUN queue.And when the LUN's for needing to add When current state is unsatisfactory for above-mentioned Rule of judgment, namely the LUN for adding is needed to have been positioned at first order LUN In queue or it is being processed, thus any process need not be being done.
In the present embodiment, it is contemplated that the situation of the new scsi command of reception, by the above-mentioned of the present embodiment Handling process, the concurrent processing flow process of scsi command, improves this in the further perfect present invention Bright practicality.
With reference to Fig. 7, Fig. 7 is the schematic flow sheet of scsi command reception and the embodiment of handling process one.This In embodiment, command process thread is as follows to the concrete handling process of scsi command:
(1) command process thread enters sleep state;
(2) 1, activation command processes thread;2nd, the command process thread being activated obtains SCSI by competition The processing authority of order;Wherein, activation command processes the mode of thread and does not limit, with specific reference to being actually needed It is configured.
(3) first order LUN queue is locked;Corresponding to first order LUN queue and every LUN The queue of second level scsi command conducted interviews protection using mutex.By mutual exclusion lock, to protect team LUN in row currently can only be handled by a command process thread.As shown in Fig. 2 according to concrete field Scape is generating the command process thread of varying number.
(4) judge whether first order LUN queue is empty;If so, then (1) is returned so that current life Order processes thread and enters sleep state;(5) are otherwise performed to carry out process operation to LUN;
(5) 1, the current queue head of first order LUN queue is obtained, corresponding to the queue heads is obtained Individual LUN;2nd, after LUN is obtained, delete corresponding to the current queue head of first order LUN queue LUN;The 3rd, the status indicator parameter of LUN is set:LUN.isInLunList=0, LUN.isProcess=1;
Wherein, the identification parameter of LUN states is used to record the current state of each LUN, LUN.isInLunList represents whether (" 0 " represents not in queue the LUN in first order LUN queue In, " 1 " is represented in queue), LUN.isProcess represents whether the LUN is processed (" 0 " Represent that not in processes, " 1 " represents present).It is understood that the mark ginseng of LUN states Several setting forms and mode are not limited.By the identification parameter of LUN states so as to convenient subsequently according to LUN Current state determining whether to increase new LUN in first order LUN queue.
(6) first order LUN queue is unlocked.
(7) second level scsi command queue is locked;
(8) condition for continuing with next scsi command is judged whether:
Condition 11:When second level scsi command queue not empty or when second level scsi command queue not empty And the accumulative quantity for having processed scsi command less than it is N number of when, execution (9) is continuing with next SCSI Order.
Condition 12:When second level scsi command queue is for space-time or when second level scsi command queue is non- When the empty and accumulative quantity for having processed scsi command reaches N number of, perform (17) to continue with the next one LUN。
(9) 1, the current queue head of second level scsi command queue is obtained, is obtained corresponding to the queue heads A scsi command;2nd, after scsi command is obtained, working as second level scsi command queue is deleted Scsi command corresponding to front queue heads;
(10) to second level scsi command queue unblock;
(11) scsi command for obtaining is processed;
(12) judge whether currently processed complete scsi command needs to be linked into second level scsi command queue In subsequently to continue with;If so, then (13) are performed;Otherwise return (7).
(13) 1, second level scsi command queue is locked;2nd, scsi command to be linked into is added The rear of queue of second level scsi command queue;3rd, to second level scsi command queue unblock;
(14) the current state identification parameter of the LUN according to corresponding to the order, judges the LUN's Current state;If during the current state of the LUN is not processed and not in first order LUN queue, Then (15) are performed, be otherwise left intact.
(15) 1, first order LUN queue is locked;2nd, the LUN is added into first order LUN queue Rear of queue;The 3rd, the status indicator parameter of the current LUN is set:LUN.isInLunList=1;4th, it is right First order LUN queue is unlocked and returned (2).
(16) the status indicator parameter of the current LUN is set:LUN.isProcess=0;
(17) judge that redirecting the condition for processing next one LUN is:
Condition 21:Second level scsi command queue is sky;Condition 22:Second level scsi command queue is non- The empty and accumulative quantity for having processed scsi command reaches N number of.When for condition 21 when, return (3);When For condition 22 when, perform (18);
(18) 1, first order LUN queue is locked;2nd, the LUN is added into first order LUN queue Rear of queue;The status indicator parameter of the current LUN is set:LUN.isInLunList=1;3rd, to One-level LUN queue is unlocked and returned (3).
In addition, in the present embodiment, order receiving thread is as follows to the concrete reception flow process of scsi command:
(01) scsi command is received;
(02) relevant information in the scsi command of the reception, finds corresponding to the scsi command LUN;
(03) 1, second level scsi command queue is locked;2nd, scsi command to be linked into is added The rear of queue of second level scsi command queue;3rd, to second level scsi command queue unblock;
(04) the current state identification parameter of the LUN according to corresponding to the order, judges the LUN's Current state;If during the current state of the LUN is not processed and not in first order LUN queue, Then (05) is performed, be otherwise left intact.
(05) 1, first order LUN queue is locked;2nd, the LUN is added into first order LUN queue Rear of queue;The 3rd, the status indicator parameter of the current LUN is set:LUN.isInLunList=1;4th, it is right First order LUN queue is unlocked and returned (2).
With reference to Fig. 8, Fig. 8 is the function mould of the concurrent processing device first embodiment of scsi command of the present invention Block schematic diagram.In the present embodiment, the concurrent processing device of the scsi command includes:
LUN queue processing module 10, for when first order LUN queue non-NULL, obtaining described first LUN corresponding to the current queue head of level LUN queue, and after LUN is obtained, delete described first The current queue head of level LUN queue;
Firstly the need of explanation, when scsi command process is realized, the one of principle for ensureing is needed It is exactly the order-preserving of scsi command, that is, ensures same LUN (logical units number, logical block Number) on scsi command give first floor system by its order for receiving and perform, it is and corresponding in the present embodiment The concurrent processing environments of scsi command are multiple threads, namely have multiple thread process multiple different Scsi command, therefore to ensure any time, the every LUN in first order LUN queue can only be by One thread process, LUN queue processing module 10 is first obtained and is currently needed for what is processed in the present embodiment LUN, then LUN queue processing module 10 is after the LUN is obtained and is really processing the acquisition Before LUN, the LUN corresponding to the current queue head of first order LUN queue is first deleted, also will be obtained The LUN for taking is deleted from first order LUN queue, so as to ensure current thread processed the LUN it Before, other threads are impossible to get this LUN, so as to ensure any time, first order LUN team Every LUN in row by a thread process, thus can only effectively evade for same LUN Concurrent processing.
It should be noted that the LUN that obtains from first order LUN queue in the present embodiment is only merely The information of the LUN is obtained in the way of reading, after having obtained, the information of the LUN still exists in the In the queue heads of one-level LUN queue, so needing to delete LUN teams again from first order LUN queue LUN corresponding to the queue heads of row.
Command queue's processing module 20, for when the second level scsi command corresponding with the LUN for obtaining When queue not empty or pre-conditioned satisfaction first, during the second level scsi command queue is processed successively Scsi command, returns when second level scsi command queue is sky or satisfaction second is pre-conditioned Process first order LUN queue.
Command queue's processing module 20 is according to the LUN for obtaining with the second level corresponding to processing the LUN Scsi command in scsi command queue.Because the scsi command on LUN is all stored in second level SCSI In command queue's (fifo queue), and fifo queue can ensure that the scsi command one on the LUN Surely be the order received according to it give scsi target device first floor system perform, further, since Ensure that any time, the every LUN in first order LUN queue all can only by a thread process, Thus effectively evaded the concurrent processing for same LUN, namely avoid same scsi command team Different scsi commands in row are performed by two different threads and cause execution sequence and reception order not phase Accord with, namely the present invention is successfully realized the order-preserving to scsi command under concurrent processing mechanism.Meanwhile, and The high efficiency that treatment mechanism similarly realizes scsi command process is sent out, the use of CPU is effectively reduced Rate so that storage system overall performance gets a promotion.
In addition, it is necessary to explanation, in the second level, scsi command queue not empty or satisfaction first are pre-conditioned When, second level scsi command queue is processed, wherein the first pre-conditioned setting is not limited, specifically It is configured according to actual needs.And all SCSI lives in second level scsi command queue has been processed The scsi command queue of after the order namely second level exits process for space-time, or can also preset meeting second Process is exited during condition, the second pre-conditioned setting is not limited, and is configured with specific reference to being actually needed.
In the present embodiment, according to scsi command and the corresponding relation of LUN, using two grades of FIFO Queue will receive scsi command and rank preservation, in combination with certain process rule ensureing SCSI The execution sequence of order, in the LUN in processing first order queue, by LUN queue processing module 10 delete the LUN for obtaining from first order queue, so as to ensure before the LUN has been processed, its He can not get the LUN by concurrent thread from first order queue, and then ensure that at any time, often One LUN can only be concurrent for same LUN so as to effectively evade by a thread process Process;Because scsi command is stored in the fifo queue of the second level, so as to also accordingly ensure that order team Must hand in the order received during scsi command of the column processing module 20 on same LUN is processed Perform to scsi device.Can be made so as to reduce CPU with concurrent processing scsi command by the present invention With rate, performance of storage system is improved, while also ensure that scsi command gives bottom according to order reception order Layer system performs respective handling operation.
With reference to Fig. 9, Fig. 9 illustrates for the refinement functional module of the embodiment of Tu8Zhong command queues processing module one Figure.In the present embodiment, command queue's processing module 20 includes:
Command acquisition unit 201, for obtaining the current queue head institute of the second level scsi command queue Corresponding scsi command;
Unit 202 is deleted in queue heads order, for after scsi command is obtained, deleting the second level SCSI The current queue head of command queue;
Command sending unit 203, sets for acquired scsi command to be sent to into corresponding scsi target Standby first floor system is operated with performing respective handling.
In the present embodiment, command acquisition unit 201 first obtains SCSI from the scsi command queue of the second level Order, then the scsi command again to obtaining carries out respective handling.Further, since second level SCSI lives Make queue for fifo queue and reception have multiple tactic scsi commands, therefore, be ensure according to The reception sequential processing scsi command of scsi command, in command acquisition unit 201 a SCSI life is obtained After order, need queue heads order to delete unit 202 and delete the scsi command obtained from current queue head, So that queue head pointer points to next scsi command, namely deleting the lives of the SCSI corresponding to queue heads After order, queue heads will again correspond to next scsi command, then under when obtaining queue heads next time correspondence is obtained One scsi command.Finally, the scsi command of acquisition is sent to corresponding SCSI by command sending unit 203 The first floor system of target device to perform respective handling operation, for example, to print join by the scsi command of acquisition Number arranges operation, then after the scsi command is obtained, send it to the first floor system of printer apparatus with Perform corresponding print parameters and operation is set.
In the present embodiment, command queue's processing module 20 performs above-mentioned process by circulation, so as to real successively Now each scsi command in the scsi command queue of the second level is processed according to its order for receiving, so as to Ensure that scsi command gives first floor system and performs respective handling operation according to order reception order.
With reference to Figure 10, Figure 10 is the function of the concurrent processing device second embodiment of scsi command of the present invention Module diagram.In the present embodiment, the concurrent processing device of the scsi command also includes:
Order adds Queue module 30, for when acquired scsi command need to be linked into it is currently accessed When being processed with proceeding in the scsi command queue of the second level, it would be desirable to which the scsi command being linked into is added works as The rear of queue of front accessed second level scsi command queue;
In the present embodiment, the process cycle of scsi command generally can be divided into multiple stages, when certain scala media After the completion of section is processed, need again order to be linked in the scsi command queue of the second level, so as to follow-up again It is next processing stage in proceed process, after the completion of all processing processing stage all, just understand from Delete in the scsi command queue of the second level and be no longer linked into.
When remaining a need for continuing with the scsi command that processed in the subsequent processing stage of scsi command When, order adds Queue module 30 that treated scsi command is linked into again into corresponding LUN's Second level command queue afterbody, wherein, it is to ensure that the order that the order for processing scsi command is received with it is protected Hold consistent, therefore, it is currently accessed that order adds Queue module 30 to add the scsi command being linked into The rear of queue of second level scsi command queue, namely keep the row of scsi command in the command queue of the second level Row order and the sequence consensus for receiving.
LUN judge modules 40, for whether not to judge the LUN corresponding to the scsi command being linked into It is processed and not in the first order LUN queue;
In the present embodiment, in view of in the present invention secondary queue structure access mode, therefore, order plus Enqueue module 30 will need the scsi command being linked into add currently accessed second level scsi command team After the rear of queue of row, also need further the LUN corresponding to the scsi command being linked into be added into first order LUN The rear of queue of queue.Further, since the LUN corresponding to the scsi command that is linked into is possible to position In first order LUN queue or it is being processed, therefore to avoid producing conflict, in the first order When adding LUN in LUN queue, entered by the state of the LUN of 40 pairs of additions of LUN judge modules Row judges.
For ease of entering to the current state of LUN (ratio is such as whether in queue, if processed etc.) Row accurately judgement, can describe each by arranging the status indicator parameter of LUN to each LUN The current state of LUN.At any time, as long as the state of LUN changes, its status indicator parameter Value be also required to accordingly be changed.
LUN adds Queue module 50, for when the LUN corresponding to the scsi command that be linked into not by Process and not in the first order LUN queue when, the LUN corresponding to the scsi command being linked into is added Enter the rear of queue of the first order LUN queue.
When the current state of the LUN for needing to add meets above-mentioned Rule of judgment, namely there is no addition punching When prominent, add Queue module 50 that the LUN is added the rear of queue of first order LUN queue by LUN. And when the current state of the LUN for needing to add is unsatisfactory for above-mentioned Rule of judgment, namely need what is added LUN has been positioned in first order LUN queue or being processed, thus need not do any place Reason, and the scsi command being linked into also can be realized being processed again.
In the present embodiment, it is contemplated that continue with the situation of processed scsi command, due to When processing each scsi command, be required for deleting scsi command from queue, therefore, when need after It is continuous when being processed, need to be added to again in queue.It is further perfect originally by the present embodiment The concurrent processing flow process of scsi command in invention, improves the practicality of the present invention.
With reference to Figure 11, Figure 11 is the refinement functional module of another embodiment of Tu8Zhong command queues processing module Schematic diagram.In the present embodiment, command queue's processing module 20 also includes:
Returning unit 204, for being space-time when second level scsi command queue, returns and processes first Level LUN queue;Or, when the second level scsi command queue not empty and adding up to have processed N number of SCSI During order, the LUN corresponding to currently processed described N number of scsi command is added into first order LUN The rear of queue of queue, returns and processes first order LUN queue.
Process the scsi command in the scsi command queue of the second level successively in command queue's processing module 20 When, it is understood that there may be it is continual on certain extreme case, such as certain LUN to receive scsi command (namely command queue's long-time is in non-null states), " starves so as to cause other LUN to be processed Extremely ", it is therefore desirable to pre-set corresponding condition in case the generation of class extreme case here, such as can set A LUN once at most processed N number of orders are put, N is positive integer and specifically can rule of thumb arrange Suitable value;Or a LUN once at most manageable duration t are set, t can rule of thumb set Suitable value is put, as long as being prevented from extreme case generation, the concrete set-up mode pre-conditioned to first Do not limit.
In the present embodiment, for returning unit 204 returns the next one processed in first order LUN queue The condition that redirects of LUN includes:
Redirect condition 1:Second level scsi command queue is sky;
Under the condition that redirects 1, the current command queue processing module 20 needs to have processed second level SCSI successively The process to current second level scsi command queue could be terminated after all scsi commands in command queue, So as to concede processing authority, and then other command process thread process next one LUN can be allowed, namely returned Receipt unit 204 returns the next LUN processed in first order LUN queue.Originally redirect condition to be only applicable to Scsi command under non-extreme conditions is processed.
Redirect condition 2:The second level scsi command queue not empty and accumulative N number of SCSI processed and has ordered Order.
When there is above-mentioned extreme case, returning unit 204 can be from extreme case by redirecting condition 2 The process to current second level scsi command queue is jumped out, namely when meeting second and being pre-conditioned, you can Return and process first order LUN queue.In the present embodiment, preferably second is pre-conditioned at least including the second level Scsi command queue not empty and accumulative N number of scsi command is processed.
When returning unit 204 is performed redirects condition 2 and return process next one LUN, due to current LUN is deleted from first order LUN queue, and the second level scsi command corresponding to the LUN Still also there is untreated complete scsi command in queue (because the process number of scsi command adds up Reach N number of and compulsory withdrawal), therefore, to continue to complete to the second level SCSI corresponding to the LUN The process of remaining scsi command in command queue, under the condition that redirects 2, returning the first order is processed Before LUN queue, returning unit 204 is needed corresponding to currently processed described N number of scsi command first LUN add first order LUN queue rear of queue, then returning unit 204 return again to process first Next LUN in level LUN queue.When command queue's processing module 20 gets again the LUN When can continue remaining scsi command in the second level scsi command queue corresponding to the LUN is carried out Process.
Needs explanation in addition, when second level scsi command queue is for sky and adds up to have processed N number of SCSI During order, returning unit 204 needs to be returned according to the condition that redirects 1 and processes first order LUN queue.
In the present embodiment, further contemplate and processed the SCSI in the scsi command queue of the second level successively During order, it is understood that there may be the problem of extreme case.And under this kind of extreme case, second level scsi command Scsi command in queue can not disposably be disposed, therefore, to continue to complete to remaining SCSI The process of order, in the present embodiment, by arranging the second pre-conditioned generation to prevent extreme case, Simultaneously when there is extreme case, be currently executing process and deleted LUN is weighed again In being newly added to first order LUN queue, in order to continue with remaining scsi command, by this reality Apply example, the concurrent processing flow process of scsi command in the further perfect present invention, while also improving this The practicality of invention.
With reference to Figure 12, Figure 12 is the function of the concurrent processing device 3rd embodiment of scsi command of the present invention Module diagram.In the present embodiment, the concurrent processing device of the scsi command also includes:
LUN determining modules 60, for the correlation when scsi command is received, in scsi command Information, it is determined that the LUN corresponding to received scsi command;
In the present embodiment, in view of the present invention will receive scsi command using secondary queue rank preservation, Therefore, when scsi command is received, LUN determining modules 60 are it needs to be determined that the scsi command institute is right The LUN for answering.In the transfer mechanism of existing scsi command, can be by the operation code of scsi command, correlation The information packages such as parameter, corresponding LUN form scsi command, therefore, LUN determining modules 60 are solved After analysis scsi command, can determine that received scsi command institute is right by the relevant information in order The LUN for answering.Relevant information in the present embodiment specifically refers to the LUN information corresponding to scsi command, It is configured with specific reference to being actually needed.
If needed it is further noted that without corresponding LUN information in the information of the scsi command When, then the LUN being set to public pseudo- LUN corresponding to the scsi command.
The order adds Queue module 30 to be additionally operable to:Received scsi command is added with institute really The rear of queue of the second level scsi command queue corresponding to fixed LUN;
To ensure that the order that the order for processing scsi command is received with it is consistent, therefore, order is added Queue module 30 needs to add the LUN institutes according to determined by relevant information right the scsi command for receiving The rear of queue of the second level scsi command queue answered, namely keep scsi command in the command queue of the second level Put in order and receive sequence consensus.
The LUN judge modules 40 are additionally operable to:LUN determined by judgement whether be not processed and Not in the first order LUN queue;
In the present embodiment, in view of in the present invention secondary queue structure access mode, therefore, by order Add Queue module 30 that the scsi command for newly receiving is added corresponding to the LUN with determined by second After the rear of queue of level scsi command queue, also need the LUN corresponding to the scsi command for receiving further Add the rear of queue of first order LUN queue.Further, since corresponding to the scsi command that receives LUN is possible to have been positioned in first order LUN queue or being processed, therefore to avoid producing Conflict, when adding LUN in first order LUN queue, LUN judge modules 40 are needed to the addition The state of LUN judged.
For ease of entering to the current state of LUN (ratio is such as whether in queue, if processed etc.) Row accurately judgement, can describe each by arranging the status indicator parameter of LUN to each LUN The current state of LUN.At any time, as long as the state of LUN changes, its status indicator parameter Value be also required to accordingly be changed.
The LUN adds Queue module 50 to be additionally operable to:Determined by LUN be processed and not When in the first order LUN queue, LUN adds the first order LUN queue by determined by Rear of queue.
When the current state of the LUN for needing to add meets above-mentioned Rule of judgment, namely there is no addition punching When prominent, LUN adds Queue module 50 that the LUN is added the rear of queue of first order LUN queue.And When the current state of the LUN for needing to add is unsatisfactory for above-mentioned Rule of judgment, namely need the LUN for adding Have been positioned in first order LUN queue or being processed, thus any process need not be done.
In the present embodiment, it is contemplated that the situation of the new scsi command of reception, by the above-mentioned of the present embodiment Handling process, the concurrent processing flow process of scsi command, improves this in the further perfect present invention Bright practicality.
The preferred embodiments of the present invention are these are only, the scope of the claims of the present invention is not thereby limited, it is every The equivalent structure made using description of the invention and accompanying drawing content or equivalent flow conversion, or directly or Connect and be used in other related technical fields, be included within the scope of the present invention.

Claims (10)

1. a kind of concurrent processing method of small computer system interface scsi command, it is characterised in that The concurrent processing method of the scsi command includes step:
S1, when first order LUN queue non-NULL, obtain the current queue of the first order LUN queue LUN corresponding to head, and after LUN is obtained, delete the current queue of the first order LUN queue Head;
S2, when with the corresponding second level scsi command queue not empties of LUN for obtaining or to meet first pre- If during condition, the scsi command in the second level scsi command queue is processed successively, until described Return to step S1 when two grades of scsi command queues are sky or pre-conditioned satisfaction second.
2. the concurrent processing method of scsi command as claimed in claim 1, it is characterised in that in institute In stating step S2, the scsi command processed in the second level scsi command queue includes step:
Obtain the scsi command corresponding to the current queue head of the second level scsi command queue;
After scsi command is obtained, the current queue head of the second level scsi command queue is deleted;
The first floor system that acquired scsi command is sent to into corresponding scsi target device is corresponding to perform Process operation.
3. the concurrent processing method of scsi command as claimed in claim 2, it is characterised in that described Acquired scsi command is sent to into the first floor system of corresponding scsi target device to perform respective handling Include after operation:
In acquired scsi command needs to be linked into currently accessed second level scsi command queue with When proceeding to process, it would be desirable to which the scsi command being linked into adds currently accessed second level SCSI lives Make the rear of queue of queue;
Whether the LUN corresponding to scsi command that judgement is linked into be not processed and not described first In level LUN queue;
If so, then by the LUN additions first order LUN queue corresponding to the scsi command being linked into Rear of queue.
4. the concurrent processing method of the scsi command as any one of claim 1-3, its feature It is that described first pre-conditioned at least includes the second level scsi command queue not empty and not adding up N number of scsi command is processed, described second is pre-conditioned at least including the second level scsi command team Row non-NULL and accumulative N number of scsi command is processed;When second level scsi command queue is empty or full Return to step S1 includes when foot second is pre-conditioned:
When second level scsi command queue be space-time, return to step S1;Or,
When the second level scsi command queue not empty and it is accumulative processed N number of scsi command when, ought LUN corresponding to described N number of scsi command of pre-treatment adds the team of the first order LUN queue Row tail, return to step S1.
5. the concurrent processing method of scsi command as claimed in claim 4, it is characterised in that described The concurrent processing method of scsi command also includes:
When scsi command is received, the relevant information in scsi command, it is determined that received LUN corresponding to scsi command;
Received scsi command is added the second level SCSI lives corresponding to the LUN with determined by Make the rear of queue of queue;
Whether LUN determined by judgement be not processed and not in the first order LUN queue;
If so, then by determined by LUN adds the rear of queue of the first order LUN queue.
6. a kind of concurrent processing device of small computer system interface scsi command, it is characterised in that The concurrent processing device of the scsi command includes:
LUN queue processing module, for when first order LUN queue non-NULL, obtaining the first order LUN corresponding to the current queue head of LUN queue, and after LUN is obtained, delete the first order The current queue head of LUN queue;
Command queue's processing module, for when the second level scsi command team corresponding with the LUN for obtaining When row non-NULL or pre-conditioned satisfaction first, during the second level scsi command queue is processed successively Scsi command, returns when second level scsi command queue is sky or satisfaction second is pre-conditioned Process first order LUN queue.
7. the concurrent processing device of scsi command as claimed in claim 6, it is characterised in that described Command queue's processing module includes:
Command acquisition unit, the current queue head institute for obtaining the second level scsi command queue is right The scsi command answered;
Unit is deleted in queue heads order, for after scsi command is obtained, deleting the second level SCSI The current queue head of command queue;
Command sending unit, for acquired scsi command to be sent to into corresponding scsi target device First floor system is operated with performing respective handling.
8. the concurrent processing device of scsi command as claimed in claim 7, it is characterised in that described The concurrent processing device of scsi command also includes:
Order adds Queue module, for when acquired scsi command need to be linked into it is currently accessed When being processed with proceeding in the scsi command queue of the second level, it would be desirable to which the scsi command being linked into is added works as The rear of queue of front accessed second level scsi command queue;
LUN judge modules, for judge LUN corresponding to the scsi command that is linked into whether not by Process and not in the first order LUN queue;
LUN adds Queue module, for not located as the LUN corresponding to the scsi command being linked into Reason and not in the first order LUN queue when, the LUN corresponding to the scsi command being linked into is added Enter the rear of queue of the first order LUN queue.
9. the concurrent processing device of the scsi command as any one of claim 6-8, its feature It is that described first pre-conditioned at least includes the second level scsi command queue not empty and not adding up N number of scsi command is processed, described second is pre-conditioned at least including the second level scsi command team Row non-NULL and accumulative N number of scsi command is processed;Command queue's processing module also includes:
Returning unit, for being space-time when second level scsi command queue, returns and processes the first order LUN queue;Or, when the second level scsi command queue not empty and adding up to have processed N number of SCSI During order, the LUN corresponding to currently processed described N number of scsi command is added into the first order The rear of queue of LUN queue, returns and processes first order LUN queue.
10. the concurrent processing device of scsi command as claimed in claim 9, it is characterised in that institute Stating the concurrent processing device of scsi command also includes:
LUN determining modules, for the correlation when scsi command is received, in scsi command Information, it is determined that the LUN corresponding to received scsi command;
The order adds Queue module to be additionally operable to:Received scsi command is added and determined LUN corresponding to second level scsi command queue rear of queue;
The LUN judge modules are additionally operable to:Whether LUN determined by judgement be not processed and not In the first order LUN queue;
The LUN adds Queue module to be additionally operable to:LUN be not processed and is not existing determined by When in the first order LUN queue, LUN adds the first order LUN queue by determined by Rear of queue.
CN201510673132.5A 2015-10-16 2015-10-16 Small computer system interface (SCSI) command concurrent processing method and apparatus Withdrawn CN106598474A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201510673132.5A CN106598474A (en) 2015-10-16 2015-10-16 Small computer system interface (SCSI) command concurrent processing method and apparatus
PCT/CN2016/100873 WO2017063507A1 (en) 2015-10-16 2016-09-29 Method and apparatus for concurrently processing scsi commands

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510673132.5A CN106598474A (en) 2015-10-16 2015-10-16 Small computer system interface (SCSI) command concurrent processing method and apparatus

Publications (1)

Publication Number Publication Date
CN106598474A true CN106598474A (en) 2017-04-26

Family

ID=58517773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510673132.5A Withdrawn CN106598474A (en) 2015-10-16 2015-10-16 Small computer system interface (SCSI) command concurrent processing method and apparatus

Country Status (2)

Country Link
CN (1) CN106598474A (en)
WO (1) WO2017063507A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024027280A1 (en) * 2022-08-02 2024-02-08 华为技术有限公司 Instruction execution method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5421014A (en) * 1990-07-13 1995-05-30 I-Tech Corporation Method for controlling multi-thread operations issued by an initiator-type device to one or more target-type peripheral devices
CN102202410A (en) * 2010-03-23 2011-09-28 中兴通讯股份有限公司 Multi-user and multi-service scheduling method and device of wireless communication network
CN102831014A (en) * 2012-07-30 2012-12-19 华中科技大学 Method for prompting IO (input/output) parallelism and reducing small IO delay by utilizing multiple request queues
CN103218455A (en) * 2013-05-07 2013-07-24 中国人民解放军国防科学技术大学 Method of high-speed concurrent processing of user requests of Key-Value database
CN103810072A (en) * 2012-11-09 2014-05-21 上海飞田通信技术有限公司 Device and method for guaranteeing order execution of multithread tasks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5421014A (en) * 1990-07-13 1995-05-30 I-Tech Corporation Method for controlling multi-thread operations issued by an initiator-type device to one or more target-type peripheral devices
CN102202410A (en) * 2010-03-23 2011-09-28 中兴通讯股份有限公司 Multi-user and multi-service scheduling method and device of wireless communication network
CN102831014A (en) * 2012-07-30 2012-12-19 华中科技大学 Method for prompting IO (input/output) parallelism and reducing small IO delay by utilizing multiple request queues
CN103810072A (en) * 2012-11-09 2014-05-21 上海飞田通信技术有限公司 Device and method for guaranteeing order execution of multithread tasks
CN103218455A (en) * 2013-05-07 2013-07-24 中国人民解放军国防科学技术大学 Method of high-speed concurrent processing of user requests of Key-Value database

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024027280A1 (en) * 2022-08-02 2024-02-08 华为技术有限公司 Instruction execution method and device

Also Published As

Publication number Publication date
WO2017063507A1 (en) 2017-04-20

Similar Documents

Publication Publication Date Title
US8381230B2 (en) Message passing with queues and channels
US10826980B2 (en) Command process load balancing system
CN104980454B (en) A kind of resource data sharing method, server and system
US9164935B2 (en) Determining when to throttle interrupts to limit interrupt processing to an interrupt processing time period
US9928004B2 (en) Assigning device adaptors to use to copy source extents to target extents in a copy relationship
CN105045632A (en) Method and device for implementing lock free queue in multi-core environment
TW200413936A (en) Integrated circuit having multiple modes of operation
US11789865B2 (en) Semiconductor device
CN102402401A (en) Method for scheduling input output (IO) request queue of disk
US8732350B2 (en) Method and system for improving direct memory access offload
CN109271242A (en) Data processing method, device, equipment and medium based on queue
CN106855871A (en) A kind of method and apparatus of Data Migration
CN113139873A (en) Method and apparatus for concurrently executing transactions in a blockchain
KR102604740B1 (en) Key-value based system for parallel computing and method for operating a parallelized application
US8543722B2 (en) Message passing with queues and channels
US20100229174A1 (en) Synchronizing Resources in a Computer System
CN106598474A (en) Small computer system interface (SCSI) command concurrent processing method and apparatus
CN110289043A (en) Store apparatus testing method, device, electronic equipment
US9459910B1 (en) Controlling a layered driver
CN112767976B (en) Method, device, storage medium and computer equipment for stabilizing flash memory writing speed
CN109800184A (en) For the caching method of fritter input, system, device and can storage medium
CN109558241A (en) A kind of method and device obtaining spin lock
US9766828B2 (en) Mailbox communication mechanism with ownership locking
KR20230059536A (en) Method and apparatus for process scheduling
CN108345791A (en) Processor security detection method, system and detection device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20170426