Print this page
Code review comments
        
*** 26,36 ****
  #include "mr_sas.h"
  #include "ld_pd_map.h"
  
  /*
   * This function will check if FAST IO is possible on this logical drive
!  * by checking the EVENT information availabe in the driver
   */
  #define MR_LD_STATE_OPTIMAL 3
  #define ABS_DIFF(a, b)   (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
  
  static void mr_update_load_balance_params(MR_FW_RAID_MAP_ALL *,
--- 26,36 ----
  #include "mr_sas.h"
  #include "ld_pd_map.h"
  
  /*
   * This function will check if FAST IO is possible on this logical drive
!  * by checking the EVENT information available in the driver
   */
  #define MR_LD_STATE_OPTIMAL 3
  #define ABS_DIFF(a, b)   (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
  
  static void mr_update_load_balance_params(MR_FW_RAID_MAP_ALL *,
*** 208,217 ****
--- 208,219 ----
          U8              retval = TRUE;
          U32             rowMod;
          U32             armQ;
          U32             arm;
  
+         ASSERT(raid->rowDataSize != 0);
+ 
          row = (stripRow / raid->rowDataSize);
  
          if (raid->level == 6) {
                  U32 logArm =  (stripRow % (raid->rowDataSize));
  
*** 218,228 ****
                  if (raid->rowSize == 0) {
                          return (FALSE);
                  }
                  rowMod = (row % (raid->rowSize));
                  armQ = raid->rowSize-1-rowMod;
!                 arm = armQ+1+logArm;
                  if (arm >= raid->rowSize)
                          arm -= raid->rowSize;
                  physArm = (U8)arm;
          } else {
                  if (raid->modFactor == 0)
--- 220,230 ----
                  if (raid->rowSize == 0) {
                          return (FALSE);
                  }
                  rowMod = (row % (raid->rowSize));
                  armQ = raid->rowSize-1-rowMod;
!                 arm = armQ + 1 + logArm;
                  if (arm >= raid->rowSize)
                          arm -= raid->rowSize;
                  physArm = (U8)arm;
          } else {
                  if (raid->modFactor == 0)
*** 331,341 ****
          ref_in_start_stripe     = (U16)(ldStartBlock & stripe_mask);
          endLba                  = ldStartBlock + numBlocks - 1;
          ref_in_end_stripe       = (U16)(endLba & stripe_mask);
          endStrip                = endLba >> raid->stripeShift;
          num_strips              = (U8)(endStrip - start_strip + 1);
!         /* Check to make sure is not deviding by zero */
          if (raid->rowDataSize == 0)
                  return (FALSE);
          start_row               =  (start_strip / raid->rowDataSize);
          endRow                  =  (endStrip  / raid->rowDataSize);
          /* get the row count */
--- 333,343 ----
          ref_in_start_stripe     = (U16)(ldStartBlock & stripe_mask);
          endLba                  = ldStartBlock + numBlocks - 1;
          ref_in_end_stripe       = (U16)(endLba & stripe_mask);
          endStrip                = endLba >> raid->stripeShift;
          num_strips              = (U8)(endStrip - start_strip + 1);
!         /* Check to make sure is not dividing by zero */
          if (raid->rowDataSize == 0)
                  return (FALSE);
          start_row               =  (start_strip / raid->rowDataSize);
          endRow                  =  (endStrip  / raid->rowDataSize);
          /* get the row count */
*** 347,365 ****
          regStart        = start_row << raid->stripeShift;
          regSize         = stripSize;
  
          /* Check if we can send this I/O via FastPath */
          if (raid->capability.fpCapable) {
!                 if (isRead)
                          io_info->fpOkForIo = (raid->capability.fpReadCapable &&
                              ((num_strips == 1) ||
                              raid->capability.fpReadAcrossStripe));
!                 else
                          io_info->fpOkForIo =
                              (raid->capability.fpWriteCapable &&
                              ((num_strips == 1) ||
                              raid->capability.fpWriteAcrossStripe));
          } else
                  io_info->fpOkForIo = FALSE;
  
  
          /*
--- 349,368 ----
          regStart        = start_row << raid->stripeShift;
          regSize         = stripSize;
  
          /* Check if we can send this I/O via FastPath */
          if (raid->capability.fpCapable) {
!                 if (isRead) {
                          io_info->fpOkForIo = (raid->capability.fpReadCapable &&
                              ((num_strips == 1) ||
                              raid->capability.fpReadAcrossStripe));
!                 } else {
                          io_info->fpOkForIo =
                              (raid->capability.fpWriteCapable &&
                              ((num_strips == 1) ||
                              raid->capability.fpWriteAcrossStripe));
+                 }
          } else
                  io_info->fpOkForIo = FALSE;
  
  
          /*
*** 381,395 ****
                          regStart += ref_in_start_stripe;
                  regSize = stripSize - ref_in_start_stripe;
                  }
  
                  if (numRows > 2) {
!                         regSize += (numRows-2) << raid->stripeShift;
                  }
  
!                 if (endStrip == endRow*raid->rowDataSize) {
!                         regSize += ref_in_end_stripe+1;
                  } else {
                          regSize += stripSize;
                  }
          }
  
--- 384,398 ----
                          regStart += ref_in_start_stripe;
                  regSize = stripSize - ref_in_start_stripe;
                  }
  
                  if (numRows > 2) {
!                         regSize += (numRows - 2) << raid->stripeShift;
                  }
  
!                 if (endStrip == endRow * raid->rowDataSize) {
!                         regSize += ref_in_end_stripe + 1;
                  } else {
                          regSize += stripSize;
                  }
          }