?? rhel5-ga.patch
字號:
diff -uprN base/megaraid_sas.c rhel5-ga/megaraid_sas.c--- base/megaraid_sas.c 2007-10-13 20:49:29.000000000 -0700+++ rhel5-ga/megaraid_sas.c 2007-10-13 21:18:22.000000000 -0700@@ -876,6 +876,7 @@ megasas_queue_command(struct scsi_cmnd * u32 frame_count; struct megasas_cmd *cmd; struct megasas_instance *instance;+ unsigned long sec; instance = (struct megasas_instance *) scmd->device->host->hostdata;@@ -903,6 +904,22 @@ megasas_queue_command(struct scsi_cmnd * goto out_done; } + /* If FW is busy donot accept any more cmds */+ if(instance->is_busy){+ sec = (jiffies - instance->last_time) / HZ;+ if(sec<10) + return SCSI_MLQUEUE_HOST_BUSY;+ else{+ instance->is_busy=0;+ instance->last_time=0;+ }+ }++ if(scmd->retries>1){+ instance->is_busy=1;+ instance->last_time=jiffies;+ }+ cmd = megasas_get_cmd(instance); if (!cmd) return SCSI_MLQUEUE_HOST_BUSY;@@ -919,7 +936,6 @@ megasas_queue_command(struct scsi_cmnd * goto out_return_cmd; cmd->scmd = scmd;- scmd->SCp.ptr = (char *)cmd; /* * Issue the command to the FW@@ -953,7 +969,7 @@ static int megasas_slave_configure(struc * The RAID firmware may require extended timeouts. */ if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS)- sdev->timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ;+ sdev->timeout = 90 * HZ; return 0; } @@ -1080,39 +1096,6 @@ static int megasas_generic_reset(struct return ret_val; } - /**- * megasas_reset_timer - quiesce the adapter if required- * @scmd: scsi cmnd- *- * Sets the FW busy flag and reduces the host->can_queue if the- * cmd has not been completed within the timeout period.- */-static enum-scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)-{- struct megasas_cmd *cmd = (struct megasas_cmd *)scmd->SCp.ptr;- struct megasas_instance *instance;- unsigned long flags;-- if (time_after(jiffies, scmd->jiffies_at_alloc +- (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) {- return EH_NOT_HANDLED;- }-- instance = cmd->instance;- if (!(instance->flag & MEGASAS_FW_BUSY)) {- /* FW is busy, throttle IO */- spin_lock_irqsave(instance->host->host_lock, flags);-- instance->host->can_queue = 16;- instance->last_time = jiffies;- instance->flag |= MEGASAS_FW_BUSY;-- spin_unlock_irqrestore(instance->host->host_lock, flags);- }- return EH_RESET_TIMER;-}- /** * megasas_reset_device - Device reset handler entry point */@@ -1261,7 +1244,6 @@ static struct scsi_host_template megasas .eh_device_reset_handler = megasas_reset_device, .eh_bus_reset_handler = megasas_reset_bus_host, .eh_host_reset_handler = megasas_reset_bus_host,- .eh_timed_out = megasas_reset_timer, .bios_param = megasas_bios_param, .use_clustering = ENABLE_CLUSTERING, };@@ -1364,10 +1346,7 @@ megasas_complete_cmd(struct megasas_inst { int exception = 0; struct megasas_header *hdr = &cmd->frame->hdr;- unsigned long flags;-- if (cmd->scmd)- cmd->scmd->SCp.ptr = NULL;+ int outstanding; switch (hdr->cmd) { @@ -1477,22 +1456,12 @@ megasas_complete_cmd(struct megasas_inst hdr->cmd); break; }- - /*- * Check if we can restore can_queue- */- if (instance->flag & MEGASAS_FW_BUSY- && time_after(jiffies, instance->last_time + 5 * HZ)- && atomic_read(&instance->fw_outstanding) < 17) {-- spin_lock_irqsave(instance->host->host_lock, flags);- instance->flag &= ~MEGASAS_FW_BUSY;- instance->host->can_queue =- instance->max_fw_cmds - MEGASAS_INT_CMDS; - spin_unlock_irqrestore(instance->host->host_lock, flags);+ if(instance->is_busy){+ outstanding = atomic_read(&instance->fw_outstanding);+ if(outstanding<17)+ instance->is_busy=0; }- } /**@@ -1525,7 +1494,7 @@ out_done: /** * megasas_isr - isr entry point */-static irqreturn_t megasas_isr(int irq, void *devp)+static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs) { return megasas_deplete_reply_queue((struct megasas_instance *)devp, DID_OK);@@ -2635,8 +2604,8 @@ megasas_probe_one(struct pci_dev *pdev, instance->init_id = MEGASAS_DEFAULT_INIT_ID; megasas_dbg_lvl = 0;- instance->flag = 0;- instance->last_time = 0;+ instance->is_busy=0;+ instance->last_time=0; /* * Initialize MFI Firmware@@ -3167,7 +3136,7 @@ megasas_mgmt_fw_ioctl(struct megasas_ins * sense buffer address */ sense_buff = (unsigned long *) ((unsigned long)ioc->frame.raw +- ioc->sense_off);+ ioc->sense_off); sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw + ioc->sense_off); #if defined(__ia64__)diff -uprN base/megaraid_sas.h rhel5-ga/megaraid_sas.h--- base/megaraid_sas.h 2007-10-13 20:37:32.000000000 -0700+++ rhel5-ga/megaraid_sas.h 2007-10-13 21:18:23.000000000 -0700@@ -556,8 +556,6 @@ struct megasas_ctrl_info { #define MEGASAS_IOCTL_CMD 0 -#define MEGASAS_DEFAULT_CMD_TIMEOUT 90- /* * FW reports the maximum of number of commands that it can accept (maximum * commands that can be outstanding) at any time. The driver must report a@@ -1112,7 +1110,7 @@ struct megasas_instance { struct megasas_instance_template *instancet; struct tasklet_struct isr_tasklet; - u8 flag;+ u8 is_busy; unsigned long last_time; };
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -