Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] megaraid_sas: Add fpRead/WriteCapable, fpRead/WriteAcrossStripe checks

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>

authored by

adam radford and committed by
James Bottomley
c1529fa2 5738f996

+13 -8
+13 -8
drivers/scsi/megaraid/megaraid_sas_fp.c
··· 362 362 /* assume this IO needs the full row - we'll adjust if not true */ 363 363 regSize = stripSize; 364 364 365 - /* If IO spans more than 1 strip, fp is not possible 366 - FP is not possible for writes on non-0 raid levels 367 - FP is not possible if LD is not capable */ 368 - if (num_strips > 1 || (!isRead && raid->level != 0) || 369 - !raid->capability.fpCapable) { 365 + /* Check if we can send this I/O via FastPath */ 366 + if (raid->capability.fpCapable) { 367 + if (isRead) 368 + io_info->fpOkForIo = (raid->capability.fpReadCapable && 369 + ((num_strips == 1) || 370 + raid->capability. 371 + fpReadAcrossStripe)); 372 + else 373 + io_info->fpOkForIo = (raid->capability.fpWriteCapable && 374 + ((num_strips == 1) || 375 + raid->capability. 376 + fpWriteAcrossStripe)); 377 + } else 370 378 io_info->fpOkForIo = FALSE; 371 - } else { 372 - io_info->fpOkForIo = TRUE; 373 - } 374 379 375 380 if (numRows == 1) { 376 381 /* single-strip IOs can always lock only the data needed */