Print this page
Code review comments

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mr_sas/ld_pd_map.c
          +++ new/usr/src/uts/common/io/mr_sas/ld_pd_map.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21   *
  22   22   * **********************************************************************
  23   23   */
  24   24  
  25   25  #include <sys/scsi/scsi.h>
  26   26  #include "mr_sas.h"
  27   27  #include "ld_pd_map.h"
  28   28  
  29   29  /*
  30   30   * This function will check if FAST IO is possible on this logical drive
  31      - * by checking the EVENT information availabe in the driver
       31 + * by checking the EVENT information available in the driver
  32   32   */
  33   33  #define MR_LD_STATE_OPTIMAL 3
  34   34  #define ABS_DIFF(a, b)   (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
  35   35  
  36   36  static void mr_update_load_balance_params(MR_FW_RAID_MAP_ALL *,
  37   37      PLD_LOAD_BALANCE_INFO);
  38   38  
  39   39  #define FALSE 0
  40   40  #define TRUE 1
  41   41  
↓ open down ↓ 161 lines elided ↑ open up ↑
 203  203          MR_LD_RAID      *raid = MR_LdRaidGet(ld, map);
 204  204          U32             pd, arRef;
 205  205          U8              physArm, span;
 206  206          U64             row;
 207  207          int             error_code = 0;
 208  208          U8              retval = TRUE;
 209  209          U32             rowMod;
 210  210          U32             armQ;
 211  211          U32             arm;
 212  212  
      213 +        ASSERT(raid->rowDataSize != 0);
      214 +
 213  215          row = (stripRow / raid->rowDataSize);
 214  216  
 215  217          if (raid->level == 6) {
 216  218                  U32 logArm =  (stripRow % (raid->rowDataSize));
 217  219  
 218  220                  if (raid->rowSize == 0) {
 219  221                          return (FALSE);
 220  222                  }
 221  223                  rowMod = (row % (raid->rowSize));
 222  224                  armQ = raid->rowSize-1-rowMod;
 223      -                arm = armQ+1+logArm;
      225 +                arm = armQ + 1 + logArm;
 224  226                  if (arm >= raid->rowSize)
 225  227                          arm -= raid->rowSize;
 226  228                  physArm = (U8)arm;
 227  229          } else {
 228  230                  if (raid->modFactor == 0)
 229  231                          return (FALSE);
 230  232                  physArm = MR_LdDataArmGet(ld,
 231  233                      (stripRow % (raid->modFactor)), map);
 232  234          }
 233  235          if (raid->spanDepth == 1) {
↓ open down ↓ 92 lines elided ↑ open up ↑
 326  328          stripe_mask = stripSize-1;
 327  329          /*
 328  330           * calculate starting row and stripe, and number of strips and rows
 329  331           */
 330  332          start_strip             = ldStartBlock >> raid->stripeShift;
 331  333          ref_in_start_stripe     = (U16)(ldStartBlock & stripe_mask);
 332  334          endLba                  = ldStartBlock + numBlocks - 1;
 333  335          ref_in_end_stripe       = (U16)(endLba & stripe_mask);
 334  336          endStrip                = endLba >> raid->stripeShift;
 335  337          num_strips              = (U8)(endStrip - start_strip + 1);
 336      -        /* Check to make sure is not deviding by zero */
      338 +        /* Check to make sure is not dividing by zero */
 337  339          if (raid->rowDataSize == 0)
 338  340                  return (FALSE);
 339  341          start_row               =  (start_strip / raid->rowDataSize);
 340  342          endRow                  =  (endStrip  / raid->rowDataSize);
 341  343          /* get the row count */
 342  344          numRows                 = (U8)(endRow - start_row + 1);
 343  345  
 344  346          /*
 345  347           * calculate region info.
 346  348           */
 347  349          regStart        = start_row << raid->stripeShift;
 348  350          regSize         = stripSize;
 349  351  
 350  352          /* Check if we can send this I/O via FastPath */
 351  353          if (raid->capability.fpCapable) {
 352      -                if (isRead)
      354 +                if (isRead) {
 353  355                          io_info->fpOkForIo = (raid->capability.fpReadCapable &&
 354  356                              ((num_strips == 1) ||
 355  357                              raid->capability.fpReadAcrossStripe));
 356      -                else
      358 +                } else {
 357  359                          io_info->fpOkForIo =
 358  360                              (raid->capability.fpWriteCapable &&
 359  361                              ((num_strips == 1) ||
 360  362                              raid->capability.fpWriteAcrossStripe));
      363 +                }
 361  364          } else
 362  365                  io_info->fpOkForIo = FALSE;
 363  366  
 364  367  
 365  368          /*
 366  369           * Check for DIF support
 367  370           */
 368  371          if (!raid->capability.ldPiMode) {
 369  372                  io_info->ldPI = FALSE;
 370  373          } else {
↓ open down ↓ 5 lines elided ↑ open up ↑
 376  379                          regStart += ref_in_start_stripe;
 377  380                          regSize = numBlocks;
 378  381                  }
 379  382          } else {
 380  383                  if (start_strip == (start_row + 1) * raid->rowDataSize - 1) {
 381  384                          regStart += ref_in_start_stripe;
 382  385                  regSize = stripSize - ref_in_start_stripe;
 383  386                  }
 384  387  
 385  388                  if (numRows > 2) {
 386      -                        regSize += (numRows-2) << raid->stripeShift;
      389 +                        regSize += (numRows - 2) << raid->stripeShift;
 387  390                  }
 388  391  
 389      -                if (endStrip == endRow*raid->rowDataSize) {
 390      -                        regSize += ref_in_end_stripe+1;
      392 +                if (endStrip == endRow * raid->rowDataSize) {
      393 +                        regSize += ref_in_end_stripe + 1;
 391  394                  } else {
 392  395                          regSize += stripSize;
 393  396                  }
 394  397          }
 395  398  
 396  399          pRAID_Context->timeoutValue = map->raidMap.fpPdIoTimeoutSec;
 397  400  
 398  401          if (instance->device_id == PCI_DEVICE_ID_LSI_INVADER) {
 399  402                  pRAID_Context->regLockFlags = (isRead) ?
 400  403                      raid->regTypeReqOnRead : raid->regTypeReqOnWrite;
↓ open down ↓ 136 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX