[SCSI] megaraid_sas: Add fpRead/WriteCapable, fpRead/WriteAcrossStripe checks
authoradam radford <aradford@gmail.com>
Tue, 20 Mar 2012 02:50:00 +0000 (19:50 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 23 Apr 2012 18:26:18 +0000 (19:26 +0100)
The following patch for megaraid_sas fixes the fastpath code decision
logic to use fpRead/WriteCapable, fpRead/WriteAcrossStripe flags
instead of the old logic.  This fixes a bug where fastpath writes
could be sent to a read only LD.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/megaraid/megaraid_sas_fp.c

index 294abb0defa66e4b34bb8eacf9d91d534bfe144f..e3d251a2e26a027dd1ef43f891aa6e27d1cdd83a 100644 (file)
@@ -362,15 +362,20 @@ MR_BuildRaidContext(struct megasas_instance *instance,
        /* assume this IO needs the full row - we'll adjust if not true */
        regSize             = stripSize;
 
-       /* If IO spans more than 1 strip, fp is not possible
-          FP is not possible for writes on non-0 raid levels
-          FP is not possible if LD is not capable */
-       if (num_strips > 1 || (!isRead && raid->level != 0) ||
-           !raid->capability.fpCapable) {
+       /* 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;
-       } else {
-               io_info->fpOkForIo = TRUE;
-       }
 
        if (numRows == 1) {
                /* single-strip IOs can always lock only the data needed */