aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames.Smart@Emulex.Com <James.Smart@Emulex.Com>2005-10-28 20:29:51 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-10-29 11:30:12 -0400
commita784efbff725b7f4893a8835ac7232c0e00d24e4 (patch)
treeea7a50121dbbca571f702a67c246f69eb911f35b
parent68876920f442912c94f749bc337c888696cb9ed0 (diff)
[SCSI] lpfc: Adjust lpfc_scsi_buf allocation
Adjust lpfc_scsi_buf allocation to account for lun_queue_depth and error handling Under high load and high duress, the error handler could steal some command resources from the normal i/o path. Rework to allocate additional resources to avoid this scneario. Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c993069a6500..b903d3b7b730 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1152,24 +1152,33 @@ lpfc_slave_alloc(struct scsi_device *sdev)
1152 /* 1152 /*
1153 * Populate the cmds_per_lun count scsi_bufs into this host's globally 1153 * Populate the cmds_per_lun count scsi_bufs into this host's globally
1154 * available list of scsi buffers. Don't allocate more than the 1154 * available list of scsi buffers. Don't allocate more than the
1155 * HBA limit conveyed to the midlayer via the host structure. Note 1155 * HBA limit conveyed to the midlayer via the host structure. The
1156 * that this list of scsi bufs exists for the lifetime of the driver. 1156 * formula accounts for the lun_queue_depth + error handlers + 1
1157 * extra. This list of scsi bufs exists for the lifetime of the driver.
1157 */ 1158 */
1158 total = phba->total_scsi_bufs; 1159 total = phba->total_scsi_bufs;
1159 num_to_alloc = LPFC_CMD_PER_LUN; 1160 num_to_alloc = phba->cfg_lun_queue_depth + 2;
1160 if (total >= phba->cfg_hba_queue_depth) { 1161 if (total >= phba->cfg_hba_queue_depth) {
1161 printk(KERN_WARNING "%s, At config limitation of " 1162 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
1162 "%d allocated scsi_bufs\n", __FUNCTION__, total); 1163 "%d:0704 At limitation of %d preallocated "
1164 "command buffers\n", phba->brd_no, total);
1163 return 0; 1165 return 0;
1164 } else if (total + num_to_alloc > phba->cfg_hba_queue_depth) { 1166 } else if (total + num_to_alloc > phba->cfg_hba_queue_depth) {
1167 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
1168 "%d:0705 Allocation request of %d command "
1169 "buffers will exceed max of %d. Reducing "
1170 "allocation request to %d.\n", phba->brd_no,
1171 num_to_alloc, phba->cfg_hba_queue_depth,
1172 (phba->cfg_hba_queue_depth - total));
1165 num_to_alloc = phba->cfg_hba_queue_depth - total; 1173 num_to_alloc = phba->cfg_hba_queue_depth - total;
1166 } 1174 }
1167 1175
1168 for (i = 0; i < num_to_alloc; i++) { 1176 for (i = 0; i < num_to_alloc; i++) {
1169 scsi_buf = lpfc_get_scsi_buf(phba); 1177 scsi_buf = lpfc_get_scsi_buf(phba);
1170 if (!scsi_buf) { 1178 if (!scsi_buf) {
1171 printk(KERN_ERR "%s, failed to allocate " 1179 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
1172 "scsi_buf\n", __FUNCTION__); 1180 "%d:0706 Failed to allocate command "
1181 "buffer\n", phba->brd_no);
1173 break; 1182 break;
1174 } 1183 }
1175 1184