aacraid: handle AIF hotplug events
Subsystems (2)
PATCH 3/7 aacraid: handle AIF hotplug events
Received from Mark Salyzyn from Adaptec.
Hotplug sniffs the AIFs (events) from the adapter and if a container change resulting in the device going offline (container zero), online (container zero completed) or changing capacity (morph) it will take actions by calling the appropriate API.
Updated from review comments since the last version of the patch.
Applies to the scsi-misc-2.6 git tree.
drivers/scsi/aacraid/aachba.c +3 -1
@@ -479,7 +479,7 @@* is updated in the struct fsa_dev_info structure rather than returned. */ -static int probe_container (struct aac_dev *dev,int cid) +int probe_container (struct aac_dev *dev,int cid) {struct fsa_dev_info *fsa_dev_ptr;int status;
@@ -1455,6 +1455,8 @@case TEST_UNIT_READY :spin_unlock_irq (host->host_lock);probe_container (dev, cid); +if ((fsa_dev_ptr[cid].valid &1 ) ==0 ) + fsa_dev_ptr[cid].valid =0 ;spin_lock_irq (host->host_lock);if (fsa_dev_ptr[cid].valid ==0 ) { scsicmd->result =DID_NO_CONNECT <<16 ;
drivers/scsi/aacraid/aacraid.h +4 -0
@@ -780,7 +780,9 @@u64 last;u64 size;u32 type; +u32 config_waiting_on;u16 queue_depth; +u8 config_needed;u8 valid;u8 ro;u8 locked;
@@ -1715,6 +1717,7 @@#define AifCmdJobProgress 2/* Progress report */ #define AifJobCtrZero 101/* Array Zero progress */ #define AifJobStsSuccess 1/* Job completes */ +#define AifJobStsRunning 102/* Job running */ #define AifCmdAPIReport 3/* Report from other user of API */ #define AifCmdDriverNotify 4/* Notify host driver of event */ #define AifDenMorphComplete 200/* A morph operation completed */
@@ -1785,6 +1788,7 @@struct aac_driver_ident *aac_get_driver_ident (int devtype);int aac_get_adapter_info (struct aac_dev * dev);int aac_send_shutdown (struct aac_dev *dev); +int probe_container (struct aac_dev *dev,int cid);extern int numacb;extern int acbsize;extern char aac_driver_version[];
drivers/scsi/aacraid/commsup.c +282 -1
307 lines not on this page · raw message
Signature · 1 line
Mark Haverkamp <[email protected]>
Quoted 17 lines · Mark Haverkamp
drivers/scsi/aacraid/commsup.c +3
-0+shost_for_each_device (device, dev->scsi_host_ptr) + { + if ((device->channel == CONTAINER_TO_CHANNEL(container))
drivers/scsi/aacraid/commsup.c +12
-0+ && (device->id == CONTAINER_TO_ID(container)) + && (device->lun == CONTAINER_TO_LUN(container))) { +switch (device_config_needed) { +case DELETE : +scsi_remove_device (device); +break ; +case CHANGE : +if (!dev->fsa_dev[container].valid) { +scsi_remove_device (device); +break ; + } + scsi_rescan_device(&device-Quoted 1 line
sdev_gendev);
drivers/scsi/aacraid/commsup.c line 1056
Quoted 8 lines
drivers/scsi/aacraid/commsup.c +8
-0+ +default : +break ; + } +scsi_device_put (device); +break ; + } + }
This is open coding scsi_lookup_device(); why not simply use that API? It returns a device that also has to have scsi_device_put() called on it when you're finished. I suppose it won't necessarily matter for aacraid, but if we have to make the lookup more efficient for large lun configurations, you'll benefit.
James
Re: [PATCH 3/7] aacraid: handle AIF hotplug events (update)
Quoted 27 lines · James Bottomley
Quoted 17 lines · Mark Haverkamp
(quoted diff) +3
-0+ shost_for_each_device(device, dev->scsi_host_ptr) + { + if ((device->channel == CONTAINER_TO_CHANNEL(container))
(quoted diff) +12
-0+ && (device->id == CONTAINER_TO_ID(container)) + && (device->lun == CONTAINER_TO_LUN(container))) { + switch (device_config_needed) { + case DELETE: + scsi_remove_device(device); + break; + case CHANGE: + if (!dev->fsa_dev[container].valid) { + scsi_remove_device(device); + break; + } + scsi_rescan_device(&device-Quoted 1 line
sdev_gendev);Review
Quoted 8 lines
(quoted diff) +8
-0+ + default: + break; + } + scsi_device_put(device); + break; + } + }
Quoted 8 lines
This is open coding
scsi_lookup_device(); why not simply use that API? It returns a device that also has to havescsi_device_put()called on it when you're finished. I suppose it won't necessarily matter for aacraid, but if we have to make the lookup more efficient for large lun configurations, you'll benefit.James
James,
Here is the patch again with scsi_device_lookup.
----
Received from Mark Salyzyn from Adaptec.
Hotplug sniffs the AIFs (events) from the adapter and if a container change resulting in the device going offline (container zero), online (container zero completed) or changing capacity (morph) it will take actions by calling the appropriate API.
Applies to the scsi-misc-2.6 git tree.
Updated from review comments since the last version of the patch.
drivers/scsi/aacraid/aachba.c +3 -1
@@ -479,7 +479,7 @@* is updated in the struct fsa_dev_info structure rather than returned. */ -static int probe_container (struct aac_dev *dev,int cid) +int probe_container (struct aac_dev *dev,int cid) {struct fsa_dev_info *fsa_dev_ptr;int status;
@@ -1471,6 +1471,8 @@case TEST_UNIT_READY :spin_unlock_irq (host->host_lock);probe_container (dev, cid); +if ((fsa_dev_ptr[cid].valid &1 ) ==0 ) + fsa_dev_ptr[cid].valid =0 ;spin_lock_irq (host->host_lock);if (fsa_dev_ptr[cid].valid ==0 ) { scsicmd->result =DID_NO_CONNECT <<16 ;
drivers/scsi/aacraid/aacraid.h +4 -0
@@ -780,7 +780,9 @@u64 last;u64 size;u32 type; +u32 config_waiting_on;u16 queue_depth; +u8 config_needed;u8 valid;u8 ro;u8 locked;
@@ -1715,6 +1717,7 @@#define AifCmdJobProgress 2/* Progress report */ #define AifJobCtrZero 101/* Array Zero progress */ #define AifJobStsSuccess 1/* Job completes */ +#define AifJobStsRunning 102/* Job running */ #define AifCmdAPIReport 3/* Report from other user of API */ #define AifCmdDriverNotify 4/* Notify host driver of event */ #define AifDenMorphComplete 200/* A morph operation completed */
@@ -1785,6 +1788,7 @@struct aac_driver_ident *aac_get_driver_ident (int devtype);int aac_get_adapter_info (struct aac_dev * dev);int aac_send_shutdown (struct aac_dev *dev); +int probe_container (struct aac_dev *dev,int cid);extern int numacb;extern int acbsize;extern char aac_driver_version[];
drivers/scsi/aacraid/commsup.c +273 -1
298 lines not on this page · raw message
Signature · 1 line
Mark Haverkamp <[email protected]>