59 flags1 = AtaReq1->Flags;
60 flags2 = AtaReq2->Flags;
67 cost = AtaReq1->lba+AtaReq1->bcount - AtaReq2->lba;
68 if( write1 || write2 ) {
70 if((AtaReq1->lba < AtaReq2->lba+AtaReq2->bcount) &&
71 (AtaReq1->lba+AtaReq1->bcount > AtaReq2->lba)) {
81 if( write1 == write2 ) {
108 BOOLEAN use_reorder = chan->UseReorder;
109#ifdef QUEUE_STATISTICS
141#ifdef QUEUE_STATISTICS
142 chan->TryReorderTailCount++;
148#ifdef QUEUE_STATISTICS
149 chan->TryReorderHeadCount++;
164#ifdef QUEUE_STATISTICS
165 chan->TryReorderCount++;
170 while ((AtaReq1 = AtaReq2->
prev_req)) {
174#ifdef QUEUE_STATISTICS
177 chan->IntersectCount++;
187 new_cost = new_cost1 + new_cost2 - new_cost;
193 if(new_cost < best_cost) {
194 best_cost = new_cost;
195 BestAtaReq1 = AtaReq1;
196#ifdef QUEUE_STATISTICS
202#ifdef QUEUE_STATISTICS
204 chan->ReorderCount++;
222 while((AtaReq1 = AtaReq1->
next_req)) {
242 chan->DeviceExtension->queue_depth++;
244 if(chan->queue_depth == 1) {
248#ifdef QUEUE_STATISTICS
312 chan->DeviceExtension->queue_depth--;
317 if(chan->NumberLuns > 1) {
318 if(chan->lun[0]->queue_depth * (chan->lun[0]->LunSelectWaitCount+1) >
319 chan->lun[1]->queue_depth * (chan->lun[1]->LunSelectWaitCount+1)) {
331 chan->cur_req = chan->lun[cdev]->first_req;
332 chan->cur_cdev = cdev;
333 if(chan->NumberLuns > 1) {
334 if(!chan->lun[cdev ^ 1]->queue_depth) {
335 chan->lun[cdev ^ 1]->LunSelectWaitCount=0;
337 chan->lun[cdev ^ 1]->LunSelectWaitCount++;
340 chan->lun[cdev]->LunSelectWaitCount=0;
363 if(!chan || !chan->cur_req) {
367 return chan->cur_req->Srb;
385 deviceExtension = chan->DeviceExtension;
395 chan = &deviceExtension->
chan[
c];
396 if(chan->queue_depth &&
397 chan->queue_depth * (chan->ChannelSelectWaitCount+1) >
400 cost_c = chan->queue_depth * (chan->ChannelSelectWaitCount+1);
409 chan = &deviceExtension->
chan[_c];
414 chan->ChannelSelectWaitCount++;
415 if(!chan->queue_depth) {
416 chan->ChannelSelectWaitCount = 0;
418 chan->ChannelSelectWaitCount++;
422 return &deviceExtension->
chan[best_c];
#define REORDER_COST_DENIED
#define REORDER_COST_INTERSECT
#define REQ_FLAG_REORDERABLE_CMD
union _ATA_REQ * PATA_REQ
#define REORDER_COST_RESELECT
_In_ PSCSI_REQUEST_BLOCK Srb
#define SRB_SIMPLE_TAG_REQUEST
#define SRB_ORDERED_QUEUE_TAG_REQUEST
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
#define SRB_HEAD_OF_QUEUE_TAG_REQUEST
VOID NTAPI UniataRemoveRequest(IN PHW_CHANNEL chan, IN PSCSI_REQUEST_BLOCK Srb)
VOID NTAPI UniataQueueRequest(IN PHW_CHANNEL chan, IN PSCSI_REQUEST_BLOCK Srb)
PHW_CHANNEL NTAPI UniataGetNextChannel(IN PHW_CHANNEL chan)
LONGLONG NTAPI UniataGetCost(PHW_LU_EXTENSION LunExt, IN PATA_REQ AtaReq1, IN PATA_REQ AtaReq2)
PSCSI_REQUEST_BLOCK NTAPI UniataGetCurRequest(IN PHW_CHANNEL chan)
ULONG ChannelSelectWaitCount
ULONG FirstChannelToCheck
#define CHAN_NOT_SPECIFIED
union _ATA_REQ * next_req
union _ATA_REQ * prev_req