s390 (8/10): zfcp fixes.
Subsystems (2)
PATCH 1/1 s390 (8/10): zfcp fixes.
zfcp host adapter fixes:
- Reuse freed scsi_ids and scsi_luns for mappings.
- Order list of ports/units by assigned scsi_id/scsi_lun.
- Don't update max_id/max_lun in scsi_host anymore.
- Get rid of all magics.
- Add owner field to ccw_driver structure.
- Replace release function for device structures by kfree. Move struct device to the start of struct zfcp_port/zfcp_unit to make it work.
- Avoid deadlock on bus->subsys.rwsem.
- Use a macro for all scsi device sysfs attributes.
- Change proc_name from "dummy" to "zfcp".
- Don't wait for scsi_add_device to complete while holding a semaphore.
diffstat:
drivers/s390/scsi/zfcp_aux.c | 159 +++++++++-------------------- drivers/s390/scsi/zfcp_ccw.c | 14 -- drivers/s390/scsi/zfcp_def.h | 36 ++---- drivers/s390/scsi/zfcp_ext.h | 4 drivers/s390/scsi/zfcp_fsf.c | 175 +++++++++++++++++---------------- drivers/s390/scsi/zfcp_fsf.h | 12 +- drivers/s390/scsi/zfcp_qdio.c | 15 -- drivers/s390/scsi/zfcp_scsi.c | 98 ++++++------------ drivers/s390/scsi/zfcp_sysfs_adapter.c | 31 ----- drivers/s390/scsi/zfcp_sysfs_port.c | 20 --- drivers/s390/scsi/zfcp_sysfs_unit.c | 16 --- 11 files changed, 218 insertions(+), 362 deletions(-)
drivers/s390/scsi/zfcp_aux.c +52 -107
@@ -29,7 +29,7 @@*/ /* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_AUX_REVISION "$Revision: 1.98 $" +#define ZFCP_AUX_REVISION "$Revision: 1.101 $"/********************** INCLUDES *********************************************/
@@ -52,7 +52,6 @@#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/workqueue.h> -#include <linux/syscalls.h> #include "zfcp_ext.h"
@@ -421,8 +420,8 @@ goto out_unit;up (&zfcp_data.config_sema);ccw_device_set_online (adapter->ccw_device); -down (&zfcp_data.config_sema);wait_event (unit->scsi_add_wq,atomic_read (&unit->scsi_add_work) ==0 ); +down (&zfcp_data.config_sema);zfcp_unit_put (unit); out_unit:zfcp_port_put (port);
@@ -978,7 +977,9 @@struct zfcp_unit *zfcp_unit_enqueue (struct zfcp_port *port,fcp_lun_t fcp_lun) { -struct zfcp_unit *unit; +struct zfcp_unit *unit, *tmp_unit; +scsi_lun_t scsi_lun; +int found;/* * check that there is no unit with this FCP_LUN already in list
@@ -1002,18 +1003,12 @@init_waitqueue_head (&unit->remove_wq); unit->port = port; -/* -* FIXME: reuse of scsi_luns! -*/ - unit->scsi_lun = port->max_scsi_lun +1 ; unit->fcp_lun = fcp_lun; - unit->common_magic =ZFCP_MAGIC ; - unit->specific_magic =ZFCP_MAGIC_UNIT ;/* setup for sysfs registration */ snprintf (unit->sysfs_device.bus_id,BUS_ID_SIZE ,"0x%016llx" , fcp_lun); unit->sysfs_device.parent = &port->sysfs_device; - unit->sysfs_device.release = zfcp_sysfs_unit_release; + unit->sysfs_device.release = (void (*)(struct device *))kfree;dev_set_drvdata (&unit->sysfs_device, unit);/* mark unit unusable as long as sysfs registration is not complete */
@@ -1025,43 +1020,29 @@ }if (zfcp_sysfs_unit_create_files (&unit->sysfs_device)) { -/* -* failed to create all sysfs attributes, therefore the unit -* must be put on the unit_remove listhead of the port where -* the release function expects it. -*/ -write_lock_irq (&zfcp_data.config_lock); -list_add_tail (&unit->list, &port->unit_remove_lh); -write_unlock_irq (&zfcp_data.config_lock);device_unregister (&unit->sysfs_device);return NULL ; } -/* -* update max SCSI LUN of logical units attached to parent remote port -*/ - port->max_scsi_lun++; - -/* -* update max SCSI LUN of logical units attached to parent adapter -*/ -if (port->adapter->max_scsi_lun < port->max_scsi_lun) - port->adapter->max_scsi_lun = port->max_scsi_lun; - -/* -* update max SCSI LUN of logical units attached to host (SCSI stack) -*/ -if (port->adapter->scsi_host && - (port->adapter->scsi_host->max_lun < port->max_scsi_lun)) - port->adapter->scsi_host->max_lun = port->max_scsi_lun +1 ; -zfcp_unit_get (unit); -/* unit is new and needs to be added to list */ + scsi_lun =0 ; + found =0 ;write_lock_irq (&zfcp_data.config_lock); +list_for_each_entry (tmp_unit, &port->unit_list_head, list) { +if (tmp_unit->scsi_lun != scsi_lun) { + found =1 ; +break ; + } + scsi_lun++; + } + unit->scsi_lun = scsi_lun; +if (found) +list_add_tail (&unit->list, &tmp_unit->list); +else +list_add_tail (&unit->list, &port->unit_list_head);atomic_clear_mask (ZFCP_STATUS_COMMON_REMOVE , &unit->status);atomic_set_mask (ZFCP_STATUS_COMMON_RUNNING , &unit->status); -list_add_tail (&unit->list, &port->unit_list_head);write_unlock_irq (&zfcp_data.config_lock); port->units++;
@@ -1070,21 +1051,17 @@return unit; } -/* locks: config_sema must be held */ void zfcp_unit_dequeue (struct zfcp_unit *unit) { -/* remove specified unit data structure from list */ +zfcp_unit_wait (unit);write_lock_irq (&zfcp_data.config_lock);list_del (&unit->list);write_unlock_irq (&zfcp_data.config_lock); - unit->port->units--;zfcp_port_put (unit->port); - -kfree (unit); - -return ; +zfcp_sysfs_unit_remove_files (&unit->sysfs_device); +device_unregister (&unit->sysfs_device); } static void *
@@ -1154,7 +1131,7 @@ adapter->pool.data_status_read =mempool_create (ZFCP_POOL_STATUS_READ_NR , - zfcp_mempool_alloc, zfcp_mempool_free, + zfcp_mempool_alloc, zfcp_mempool_free, (void *)sizeof (struct fsf_status_read_buffer ));if (NULL == adapter->pool.data_status_read) {
@@ -1246,10 +1223,6 @@if (retval) goto failed_low_mem_buffers; -/* set magics */ - adapter->common_magic =ZFCP_MAGIC ; - adapter->specific_magic =ZFCP_MAGIC_ADAPTER ; -/* initialise reference count stuff */ atomic_set (&adapter->refcount,0 );init_waitqueue_head (&adapter->remove_wq);
@@ -1515,25 +1488,20 @@ }/* -* Enqueues a remote port at the end of the port list. -* All port internal structures are set-up and the proc-fs entry is also -* allocated. Some SCSI-stack structures are modified for the port. +* Enqueues a remote port to the port list. All port internal structures +* are set up and the sysfs entry is also generated. * -* returns: 0 if a new port was successfully enqueued -* ZFCP_KNOWN if a port with the requested wwpn already exists -* -ENOMEM if allocation failed -* -EINVAL if at least one of the specified parameters was wrong +* returns: pointer to port or NULL * locks: config_sema must be held to serialise changes to the port list -* within this function (must not be held on entry) */ struct zfcp_port *zfcp_port_enqueue (struct zfcp_adapter *adapter,wwn_t wwpn,u32 status) { -struct zfcp_port *port; -int check_scsi_id; +struct zfcp_port *port, *tmp_port;int check_wwpn; +scsi_id_t scsi_id; +int found; - check_scsi_id = !(status &ZFCP_STATUS_PORT_NO_SCSI_ID ); check_wwpn = !(status &ZFCP_STATUS_PORT_NO_WWPN );/*
@@ -1561,17 +1529,11 @@ port->adapter = adapter; -if (check_scsi_id) - port->scsi_id = adapter->max_scsi_id +1 ; -if (check_wwpn) port->wwpn = wwpn;atomic_set_mask (status, &port->status); - port->common_magic =ZFCP_MAGIC ; - port->specific_magic =ZFCP_MAGIC_PORT ; -/* setup for sysfs registration */ if (status &ZFCP_STATUS_PORT_NAMESERVER )snprintf (port->sysfs_device.bus_id,BUS_ID_SIZE ,"nameserver" );
@@ -1579,7 +1541,7 @@snprintf (port->sysfs_device.bus_id,BUS_ID_SIZE ,"0x%016llx" , wwpn); port->sysfs_device.parent = &adapter->ccw_device->dev; - port->sysfs_device.release = zfcp_sysfs_port_release; + port->sysfs_device.release = (void (*)(struct device *))kfree;dev_set_drvdata (&port->sysfs_device, port);/* mark port unusable as long as sysfs registration is not complete */
@@ -1591,41 +1553,32 @@ }if (zfcp_sysfs_port_create_files (&port->sysfs_device, status)) { -/* -* failed to create all sysfs attributes, therefore the port -* must be put on the port_remove listhead of the adapter -* where the release function expects it. -*/ -write_lock_irq (&zfcp_data.config_lock); -list_add_tail (&port->list, &adapter->port_remove_lh); -write_unlock_irq (&zfcp_data.config_lock);device_unregister (&port->sysfs_device);return NULL ; } -if (check_scsi_id) { -/* -* update max. SCSI ID of remote ports attached to -* "parent" adapter if necessary -* (do not care about the adapters own SCSI ID) -*/ - adapter->max_scsi_id++; - -/* -* update max. SCSI ID of remote ports attached to -* "parent" host (SCSI stack) if necessary -*/ -if (adapter->scsi_host && - (adapter->scsi_host->max_id < adapter->max_scsi_id +1 )) - adapter->scsi_host->max_id = adapter->max_scsi_id +1 ; - } -zfcp_port_get (port); + scsi_id =1 ; + found =0 ;write_lock_irq (&zfcp_data.config_lock); +list_for_each_entry (tmp_port, &adapter->port_list_head, list) { +if (atomic_test_mask (ZFCP_STATUS_PORT_NO_SCSI_ID , + &tmp_port->status)) +continue ; +if (tmp_port->scsi_id != scsi_id) { + found =1 ; +break ; + } + scsi_id++; + } + port->scsi_id = scsi_id; +if (found) +list_add_tail (&port->list, &tmp_port->list); +else +list_add_tail (&port->list, &adapter->port_list_head);atomic_clear_mask (ZFCP_STATUS_COMMON_REMOVE , &port->status);atomic_set_mask (ZFCP_STATUS_COMMON_RUNNING , &port->status); -list_add_tail (&port->list, &adapter->port_list_head);write_unlock_irq (&zfcp_data.config_lock); adapter->ports++;
@@ -1634,26 +1587,18 @@return port; } -/* -* returns: 0 - struct zfcp_port data structure successfully removed -* !0 - struct zfcp_port data structure could not be removed -* (e.g. still used) -* locks : port list write lock is assumed to be held by caller -*/ void zfcp_port_dequeue (struct zfcp_port *port) { -/* remove specified port from list */ +zfcp_port_wait (port);write_lock_irq (&zfcp_data.config_lock);list_del (&port->list);write_unlock_irq (&zfcp_data.config_lock); - port->adapter->ports--;zfcp_adapter_put (port->adapter); - -kfree (port); - -return ; +zfcp_sysfs_port_remove_files (&port->sysfs_device, +atomic_read (&port->status)); +device_unregister (&port->sysfs_device); }/* Enqueues a nameserver port */
drivers/s390/scsi/zfcp_ccw.c +5 -9
@@ -26,7 +26,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_CCW_C_REVISION "$Revision: 1.48 $" +#define ZFCP_CCW_C_REVISION "$Revision: 1.51 $"#include <linux/init.h> #include <linux/module.h>
@@ -55,6 +55,7 @@ };static struct ccw_driver zfcp_ccw_driver = { + .owner =THIS_MODULE , .name =ZFCP_NAME , .ids = zfcp_ccw_device_id, .probe = zfcp_ccw_probe,
@@ -130,14 +131,9 @@list_for_each_entry_safe (port, p, &adapter->port_remove_lh, list) {list_for_each_entry_safe (unit, u, &port->unit_remove_lh, list) { -zfcp_unit_wait (unit); -zfcp_sysfs_unit_remove_files (&unit->sysfs_device); -device_unregister (&unit->sysfs_device); +zfcp_unit_dequeue (unit); } -zfcp_port_wait (port); -zfcp_sysfs_port_remove_files (&port->sysfs_device, -atomic_read (&port->status)); -device_unregister (&port->sysfs_device); +zfcp_port_dequeue (port); }zfcp_adapter_wait (adapter);zfcp_adapter_dequeue (adapter);
@@ -163,7 +159,7 @@down (&zfcp_data.config_sema); adapter =dev_get_drvdata (&ccw_device->dev); - retval =zfcp_erp_thread_setup (adapter); + retval =zfcp_erp_thread_setup (adapter);if (retval) {ZFCP_LOG_INFO ("error: out of resources. " "error recovery thread for adapter %s "
drivers/s390/scsi/zfcp_def.h +14 -22
@@ -33,7 +33,7 @@#define ZFCP_DEF_H /* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_DEF_REVISION "$Revision: 1.62 $" +#define ZFCP_DEF_REVISION "$Revision: 1.66 $"/*************************** INCLUDES *****************************************/
@@ -937,8 +937,6 @@struct zfcp_adapter { -u32 common_magic;/* driver common magic */ -u32 specific_magic;/* struct specific magic */ struct list_head list;/* list of adapters */ atomic_t refcount;/* reference count */ wait_queue_head_t remove_wq;/* can be used to wait for
@@ -956,14 +954,12 @@u32 hardware_version;/* of FCP channel */ u8 serial_number[32 ];/* of hardware */ struct Scsi_Host *scsi_host;/* Pointer to mid-layer */ - +unsigned short scsi_host_no;/* Assigned host number */ unsigned char name[9 ];struct list_head port_list_head;/* remote port list */ struct list_head port_remove_lh;/* head of ports to be removed */ u32 ports;/* number of remote ports */ -scsi_id_t max_scsi_id;/* largest SCSI ID */ -scsi_lun_t max_scsi_lun;/* largest SCSI LUN */ struct timer_list scsi_er_timer;/* SCSI err recovery watch */ struct list_head fsf_req_list_head;/* head of FSF req list */ rwlock_t fsf_req_list_lock;/* lock for ops on list of
@@ -1003,9 +999,13 @@struct qdio_initialize qdio_init_data;/* for qdio_establish */ }; +/* +* the struct device sysfs_device must be at the beginning of this structure. +* pointer to struct device is used to free port structure in release function +* of the device. don't change! +*/ struct zfcp_port { -u32 common_magic;/* driver wide common magic */ -u32 specific_magic;/* structure specific magic */ +struct device sysfs_device;/* sysfs device */ struct list_head list;/* list of remote ports */ atomic_t refcount;/* reference count */ wait_queue_head_t remove_wq;/* can be used to wait for
@@ -1020,37 +1020,36 @@wwn_t wwnn;/* WWNN if known */ wwn_t wwpn;/* WWPN */ fc_id_t d_id;/* D_ID */ -scsi_lun_t max_scsi_lun;/* largest SCSI LUN */ u32 handle;/* handle assigned by FSF */ struct zfcp_erp_action erp_action;/* pending error recovery */ atomic_t erp_counter; -struct device sysfs_device;/* sysfs device */ }; +/* the struct device sysfs_device must be at the beginning of this structure. +* pointer to struct device is used to free unit structure in release function +* of the device. don't change! +*/ struct zfcp_unit { -u32 common_magic;/* driver wide common magic */ -u32 specific_magic;/* structure specific magic */ +struct device sysfs_device;/* sysfs device */ struct list_head list;/* list of logical units */ atomic_t refcount;/* reference count */ wait_queue_head_t remove_wq;/* can be used to wait for refcount drop to zero */ struct zfcp_port *port;/* remote port of unit */ atomic_t status;/* status of this logical unit */ +u32 lun_access;/* access flags for this unit */ scsi_lun_t scsi_lun;/* own SCSI LUN */ fcp_lun_t fcp_lun;/* own FCP_LUN */ u32 handle;/* handle assigned by FSF */ struct scsi_device *device;/* scsi device struct pointer */ struct zfcp_erp_action erp_action;/* pending error recovery */ atomic_t erp_counter; -struct device sysfs_device;/* sysfs device */ atomic_t scsi_add_work;/* used to synchronize */ wait_queue_head_t scsi_add_wq;/* wait for scsi_add_device */ };/* FSF request */ struct zfcp_fsf_req { -u32 common_magic;/* driver wide common magic */ -u32 specific_magic;/* structure specific magic */ struct list_head list;/* list of FSF requests */ struct zfcp_adapter *adapter;/* adapter request belongs to */ u8 sbal_number;/* nr of SBALs free for use */
@@ -1158,13 +1157,6 @@#define ZFCP_INTERRUPTIBLE 1#define ZFCP_UNINTERRUPTIBLE 0 -/* some magics which may be used to authenticate data structures */ -#define ZFCP_MAGIC 0xFCFCFCFC -#define ZFCP_MAGIC_ADAPTER 0xAAAAAAAA -#define ZFCP_MAGIC_PORT 0xBBBBBBBB -#define ZFCP_MAGIC_UNIT 0xCCCCCCCC -#define ZFCP_MAGIC_FSFREQ 0xEEEEEEEE -#ifndef atomic_test_mask#define atomic_test_mask (mask, target) \ ((atomic_read(target) & mask) == mask)
drivers/s390/scsi/zfcp_ext.h +1 -3
@@ -31,7 +31,7 @@#ifndef ZFCP_EXT_H #define ZFCP_EXT_H /* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_EXT_REVISION "$Revision: 1.45 $" +#define ZFCP_EXT_REVISION "$Revision: 1.46 $"#include "zfcp_def.h"
@@ -46,8 +46,6 @@extern void zfcp_sysfs_port_remove_files (struct device *,u32 );extern int zfcp_sysfs_unit_create_files (struct device *);extern void zfcp_sysfs_unit_remove_files (struct device *); -extern void zfcp_sysfs_port_release (struct device *); -extern void zfcp_sysfs_unit_release (struct device *);/**************************** CONFIGURATION *********************************/ extern struct zfcp_unit *zfcp_get_unit_by_lun(struct zfcp_port *,
drivers/s390/scsi/zfcp_fsf.c +95 -80
389 lines not on this page · raw message
drivers/s390/scsi/zfcp_fsf.h +9 -3
@@ -198,18 +198,23 @@/* channel features */ #define FSF_FEATURE_QTCB_SUPPRESSION 0x00000001#define FSF_FEATURE_CFDC 0x00000002 -#define FSF_FEATURE_SENSEDATA_REPLICATION 0x00000004#define FSF_FEATURE_LOST_SAN_NOTIFICATION 0x00000008#define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010#define FSF_FEATURE_ELS_CT_CHAINED_SBALS 0x00000020/* option */ #define FSF_OPEN_LUN_SUPPRESS_BOXING 0x00000001 +#define FSF_OPEN_LUN_UNSOLICITED_SENSE_DATA 0x00000002/* adapter types */ #define FSF_ADAPTER_TYPE_FICON 0x00000001#define FSF_ADAPTER_TYPE_FICON_EXPRESS 0x00000002 +/* flags */ +#define FSF_CFDC_OPEN_LUN_ALLOWED 0x01 +#define FSF_CFDC_EXCLUSIVE_ACCESS 0x02 +#define FSF_CFDC_OUTBOUND_TRANSFER_ALLOWED 0x10 +/* port types */ #define FSF_HBA_PORTTYPE_UNKNOWN 0x00000001#define FSF_HBA_PORTTYPE_NOTPRESENT 0x00000003
@@ -394,9 +399,10 @@u64 res2;u64 req_handle;u32 service_class; -u8 res3[3 ]; +u8 res3[3 ];u8 timeout; -u8 res4[184 ]; +u32 lun_access; +u8 res4[180 ];u32 els1_length;u32 els2_length;u32 req_buf_length;
drivers/s390/scsi/zfcp_qdio.c +2 -13
@@ -28,7 +28,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_QDIO_C_REVISION "$Revision: 1.13 $" +#define ZFCP_QDIO_C_REVISION "$Revision: 1.15 $"#include "zfcp_ext.h"
@@ -502,17 +502,6 @@/* valid request id and thus (hopefully :) valid fsf_req address */ fsf_req = (struct zfcp_fsf_req *) sbale_addr; -if (unlikely ((fsf_req->common_magic !=ZFCP_MAGIC ) || - (fsf_req->specific_magic !=ZFCP_MAGIC_FSFREQ ))) { -ZFCP_LOG_NORMAL ("bug: An inbound FSF acknowledgement was " -"faulty (debug info 0x%x, 0x%x, 0x%lx)\n" , - fsf_req->common_magic, - fsf_req->specific_magic, - (unsigned long ) fsf_req); - retval = -EINVAL ; - goto out; - } -if (unlikely (adapter != fsf_req->adapter)) { ZFCP_LOG_NORMAL("bug: An inbound FSF acknowledgement was not " "correct (debug info 0x%lx, 0x%lx, 0%lx) \n",
@@ -665,7 +654,7 @@/** * zfcp_qdio_sbals_zero - initialize SBALs between first and last in queue -* with zero from +* with zero from */ static inline int zfcp_qdio_sbals_zero (struct zfcp_qdio_queue *queue,int first,int last)
drivers/s390/scsi/zfcp_scsi.c +34 -64
134 lines not on this page · raw message
drivers/s390/scsi/zfcp_sysfs_adapter.c +3 -28
@@ -26,7 +26,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.30 $" +#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.32 $"#include <asm/ccwdev.h> #include "zfcp_ext.h"
@@ -75,6 +75,7 @@ZFCP_DEFINE_ADAPTER_ATTR (hardware_version,"0x%08x\n" , adapter->hardware_version);ZFCP_DEFINE_ADAPTER_ATTR (serial_number,"%17s\n" , adapter->serial_number); +ZFCP_DEFINE_ADAPTER_ATTR (scsi_host_no,"0x%x\n" , adapter->scsi_host_no);/** * zfcp_sysfs_adapter_in_recovery_show - recovery state of adapter
@@ -100,30 +101,6 @@ zfcp_sysfs_adapter_in_recovery_show, NULL);/** -* zfcp_sysfs_adapter_scsi_host_no_show - display scsi_host_no of adapter -* @dev: pointer to belonging device -* @buf: pointer to input buffer -* -* "scsi_host_no" attribute of adapter. Displays the SCSI host number. -*/ -static ssize_t -zfcp_sysfs_adapter_scsi_host_no_show (struct device *dev,char *buf) -{ -struct zfcp_adapter *adapter; -unsigned short host_no =0 ; - -down (&zfcp_data.config_sema); - adapter =dev_get_drvdata (dev); -if (adapter->scsi_host) - host_no = adapter->scsi_host->host_no; -up (&zfcp_data.config_sema); -return sprintf (buf,"0x%x\n" , host_no); -} - -static DEVICE_ATTR(scsi_host_no, S_IRUGO, zfcp_sysfs_adapter_scsi_host_no_show, - NULL); - -/** * zfcp_sysfs_port_add_store - add a port to sysfs tree * @dev: pointer to belonging device * @buf: pointer to input buffer
@@ -219,9 +196,7 @@zfcp_erp_port_shutdown (port,0 );zfcp_erp_wait (adapter);zfcp_port_put (port); -zfcp_sysfs_port_remove_files (&port->sysfs_device, -atomic_read (&port->status)); -device_unregister (&port->sysfs_device); +zfcp_port_dequeue (port); out:up (&zfcp_data.config_sema);return retval ? retval : count;
drivers/s390/scsi/zfcp_sysfs_port.c +2 -18
@@ -26,7 +26,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.37 $" +#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.39 $"#include <linux/init.h> #include <linux/module.h>
@@ -37,20 +37,6 @@#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG/** -* zfcp_sysfs_port_release - gets called when a struct device port is released -* @dev: pointer to belonging device -*/ -void -zfcp_sysfs_port_release (struct device *dev) -{ -struct zfcp_port *port; - - port =dev_get_drvdata (dev); -zfcp_port_dequeue (port); -return ; -} - -/** * ZFCP_DEFINE_PORT_ATTR * @_name: name of show attribute * @_format: format string
@@ -112,7 +98,6 @@zfcp_erp_unit_reopen (unit,0 );zfcp_erp_wait (unit->port->adapter); -wait_event (unit->scsi_add_wq,atomic_read (&unit->scsi_add_work) ==0 );zfcp_unit_put (unit); out:up (&zfcp_data.config_sema);
@@ -168,8 +153,7 @@zfcp_erp_unit_shutdown (unit,0 );zfcp_erp_wait (unit->port->adapter);zfcp_unit_put (unit); -zfcp_sysfs_unit_remove_files (&unit->sysfs_device); -device_unregister (&unit->sysfs_device); +zfcp_unit_dequeue (unit); out:up (&zfcp_data.config_sema);return retval ? retval : count;
drivers/s390/scsi/zfcp_sysfs_unit.c +1 -15
@@ -26,7 +26,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.23 $" +#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.24 $"#include <linux/init.h> #include <linux/module.h>
@@ -37,20 +37,6 @@#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG/** -* zfcp_sysfs_unit_release - gets called when a struct device unit is released -* @dev: pointer to belonging device -*/ -void -zfcp_sysfs_unit_release (struct device *dev) -{ -struct zfcp_unit *unit; - - unit =dev_get_drvdata (dev); -zfcp_unit_dequeue (unit); -return ; -} - -/** * ZFCP_DEFINE_UNIT_ATTR * @_name: name of show attribute * @_format: format string
Quoted 2 lines · Martin Schwidefsky
- Replace release function for device structures by kfree. Move struct device to the start of struct zfcp_port/zfcp_unit to make it work.
That's ugly as hell. Actually even more ugly. It's not that ->release is such a performance critical path that you absolutely need to avoid one level of function calls. So please put a simple wrapper back instead of the horrible casts and suddenly the silly placement restrictions are gone, too.
And *please* send any scsi driver changes to [email protected].
While we're at it, what's the reason zfcp isn't in drivers/scsi/?
Quoted 8 lines · Martin Schwidefsky
zfcp host adapter fixes:
- Reuse freedscsi_idsandscsi_lunsfor mappings.
- Order list of ports/units by assigned scsi_id/scsi_lun.
- Don't update max_id/max_lun inscsi_hostanymore.
- Get rid of all magics.
- Add owner field toccw_driverstructure.
- Replace release function for device structures by kfree. Move struct device to the start of struct zfcp_port/zfcp_unit to make it work.
Ick, ick, ick!
Why? Please do not do this, as it is not needed, and completly unnecessary. The fact that you have to create a cast like:
drivers/s390/scsi/zfcp_aux.c line 1011
Quoted 1 line
drivers/s390/scsi/zfcp_aux.c +1
-0+ unit->sysfs_device.release = (void (*)(struct device *))kfree;
Should set off all kinds of "this is a something we should not be doing" warning flags.
thanks,
greg k-h