Posted by Anonymous Tue 27th Mar 2007 19:43 - Syntax is Java - 53 views
Download | New Post | Modify | Hide line numbers
  1. protected synchronized void completedRequest ()//{{{
  2.     {
  3.         int cylPosition = 0;
  4.         if (rq_count > 0)
  5.         {
  6.             /* have more requests pending, so dispatch one immediately */
  7.             DSRequest req = request_queue[0];
  8.             int[] cylNo = ddev.getCHS(req.blk);
  9.             int firstCyl = cylNo[0];
  10.  
  11.             int optimumDistance = (firstCyl - last_cyl);
  12.  
  13.         for (int reqPos = 1; reqPos < rq_count; reqPos++)
  14.         {
  15.             DSRequest req2 = request_queue[reqPos];
  16.             int[] nextCylNo = ddev.getCHS(req2.blk);
  17.             int nextCyl = nextCylNo[0];
  18.  
  19.             int currentDistance = (nextCyl - last_cyl);
  20.  
  21.         if (optimumDistance < currentDistance)
  22.         {
  23.                 req = req2;
  24.                 firstCyl = nextCyl;
  25.                 cylPosition = reqPos;
  26.         }
  27.  
  28.         }
  29.             rq_count--;
  30.             if (rq_count > 0) {
  31.                 if (cylPosition < (rq_count))
  32.                 {
  33.                     .arraycopy (request_queue, cylPosition+1, request_queue, cylPosition, rq_count-cylPosition);
  34.                 }
  35.                 else
  36.                 {
  37.                     .arraycopy (request_queue, 0, request_queue, 0, rq_count);
  38.                 }
  39.             }
  40.  
  41.             scheduleRequestNow(req);
  42.         }
  43.         else
  44.         {
  45.             /* else that's one less pending request */
  46.             ddev_pending--;
  47.         }
  48.  
  49.         ddev.setDSchedStr("" + ddev_pending + " pending, RQ " + rq_count + "/" + QUEUESIZE);
  50.     }

PermaLink to this entry https://pastebin.co.uk/12295
Posted by Anonymous Tue 27th Mar 2007 19:43 - Syntax is Java - 53 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0