Commit fc7657c9d98c250c9fd212348e6e156c73885cc4

Authored by Vikas Chaudhary
Committed by James Bottomley
1 parent 7eece5a084

[SCSI] qla4xxx: cleanup function qla4xxx_process_ddb_changed

We don't need to check ddb old state we can take action
based on ddb new state.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

Showing 1 changed file with 3 additions and 12 deletions Side-by-side Diff

drivers/scsi/qla4xxx/ql4_init.c
... ... @@ -1409,7 +1409,6 @@
1409 1409 uint32_t state, uint32_t conn_err)
1410 1410 {
1411 1411 struct ddb_entry * ddb_entry;
1412   - uint32_t old_fw_ddb_device_state;
1413 1412  
1414 1413 /* check for out of range index */
1415 1414 if (fw_ddb_index >= MAX_DDB_ENTRIES)
1416 1415  
1417 1416  
... ... @@ -1425,22 +1424,14 @@
1425 1424 }
1426 1425  
1427 1426 /* Device already exists in our database. */
1428   - old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state;
1429 1427 DEBUG2(printk("scsi%ld: %s DDB - old state= 0x%x, new state=0x%x for "
1430 1428 "index [%d]\n", ha->host_no, __func__,
1431 1429 ddb_entry->fw_ddb_device_state, state, fw_ddb_index));
1432   - if (old_fw_ddb_device_state == state &&
1433   - state == DDB_DS_SESSION_ACTIVE) {
1434   - if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
1435   - atomic_set(&ddb_entry->state, DDB_STATE_ONLINE);
1436   - iscsi_unblock_session(ddb_entry->sess);
1437   - }
1438   - return QLA_SUCCESS;
1439   - }
1440 1430  
1441 1431 ddb_entry->fw_ddb_device_state = state;
1442 1432 /* Device is back online. */
1443   - if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) {
  1433 + if ((ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) &&
  1434 + (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE)) {
1444 1435 atomic_set(&ddb_entry->state, DDB_STATE_ONLINE);
1445 1436 atomic_set(&ddb_entry->relogin_retry_count, 0);
1446 1437 atomic_set(&ddb_entry->relogin_timer, 0);
... ... @@ -1452,7 +1443,7 @@
1452 1443 * Change the lun state to READY in case the lun TIMEOUT before
1453 1444 * the device came back.
1454 1445 */
1455   - } else {
  1446 + } else if (ddb_entry->fw_ddb_device_state != DDB_DS_SESSION_ACTIVE) {
1456 1447 /* Device went away, mark device missing */
1457 1448 if (atomic_read(&ddb_entry->state) == DDB_STATE_ONLINE) {
1458 1449 DEBUG2(ql4_printk(KERN_INFO, ha, "%s mark missing "