Print this page
Code review comments
        
@@ -26,11 +26,11 @@
 #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
+ * 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,10 +208,12 @@
         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,11 +220,11 @@
                 if (raid->rowSize == 0) {
                         return (FALSE);
                 }
                 rowMod = (row % (raid->rowSize));
                 armQ = raid->rowSize-1-rowMod;
-                arm = armQ+1+logArm;
+                arm = armQ + 1 + logArm;
                 if (arm >= raid->rowSize)
                         arm -= raid->rowSize;
                 physArm = (U8)arm;
         } else {
                 if (raid->modFactor == 0)
@@ -331,11 +333,11 @@
         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 */
+        /* 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,19 +349,20 @@
         regStart        = start_row << raid->stripeShift;
         regSize         = stripSize;
 
         /* Check if we can send this I/O via FastPath */
         if (raid->capability.fpCapable) {
-                if (isRead)
+                if (isRead) {
                         io_info->fpOkForIo = (raid->capability.fpReadCapable &&
                             ((num_strips == 1) ||
                             raid->capability.fpReadAcrossStripe));
-                else
+                } else {
                         io_info->fpOkForIo =
                             (raid->capability.fpWriteCapable &&
                             ((num_strips == 1) ||
                             raid->capability.fpWriteAcrossStripe));
+                }
         } else
                 io_info->fpOkForIo = FALSE;
 
 
         /*
@@ -381,15 +384,15 @@
                         regStart += ref_in_start_stripe;
                 regSize = stripSize - ref_in_start_stripe;
                 }
 
                 if (numRows > 2) {
-                        regSize += (numRows-2) << raid->stripeShift;
+                        regSize += (numRows - 2) << raid->stripeShift;
                 }
 
-                if (endStrip == endRow*raid->rowDataSize) {
-                        regSize += ref_in_end_stripe+1;
+                if (endStrip == endRow * raid->rowDataSize) {
+                        regSize += ref_in_end_stripe + 1;
                 } else {
                         regSize += stripSize;
                 }
         }