aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_def.h
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2009-11-24 10:53:59 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:02:02 -0500
commitf3450c7b917201bb49d67032e9f60d5125675d6a (patch)
tree404b1c23490b0a5ba3d6cbbb14e64381a12a108a /drivers/s390/scsi/zfcp_def.h
parentecf0c7721b104c0ce9c8ca534c911f6310cf92a8 (diff)
[SCSI] zfcp: Replace local reference counting with common kref
Replace the local reference counting by already available mechanisms offered by kref. Where possible existing device structures were used, including the same functionality. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
-rw-r--r--drivers/s390/scsi/zfcp_def.h53
1 files changed, 1 insertions, 52 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index e45a08d6c98..55dc402c3ae 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -446,9 +446,7 @@ struct zfcp_qdio {
446}; 446};
447 447
448struct zfcp_adapter { 448struct zfcp_adapter {
449 atomic_t refcount; /* reference count */ 449 struct kref ref;
450 wait_queue_head_t remove_wq; /* can be used to wait for
451 refcount drop to zero */
452 u64 peer_wwnn; /* P2P peer WWNN */ 450 u64 peer_wwnn; /* P2P peer WWNN */
453 u64 peer_wwpn; /* P2P peer WWPN */ 451 u64 peer_wwpn; /* P2P peer WWPN */
454 u32 peer_d_id; /* P2P peer D_ID */ 452 u32 peer_d_id; /* P2P peer D_ID */
@@ -501,9 +499,6 @@ struct zfcp_port {
501 struct device sysfs_device; /* sysfs device */ 499 struct device sysfs_device; /* sysfs device */
502 struct fc_rport *rport; /* rport of fc transport class */ 500 struct fc_rport *rport; /* rport of fc transport class */
503 struct list_head list; /* list of remote ports */ 501 struct list_head list; /* list of remote ports */
504 atomic_t refcount; /* reference count */
505 wait_queue_head_t remove_wq; /* can be used to wait for
506 refcount drop to zero */
507 struct zfcp_adapter *adapter; /* adapter used to access port */ 502 struct zfcp_adapter *adapter; /* adapter used to access port */
508 struct list_head unit_list; /* head of logical unit list */ 503 struct list_head unit_list; /* head of logical unit list */
509 rwlock_t unit_list_lock; /* unit list lock */ 504 rwlock_t unit_list_lock; /* unit list lock */
@@ -525,9 +520,6 @@ struct zfcp_port {
525struct zfcp_unit { 520struct zfcp_unit {
526 struct device sysfs_device; /* sysfs device */ 521 struct device sysfs_device; /* sysfs device */
527 struct list_head list; /* list of logical units */ 522 struct list_head list; /* list of logical units */
528 atomic_t refcount; /* reference count */
529 wait_queue_head_t remove_wq; /* can be used to wait for
530 refcount drop to zero */
531 struct zfcp_port *port; /* remote port of unit */ 523 struct zfcp_port *port; /* remote port of unit */
532 atomic_t status; /* status of this logical unit */ 524 atomic_t status; /* status of this logical unit */
533 u64 fcp_lun; /* own FCP_LUN */ 525 u64 fcp_lun; /* own FCP_LUN */
@@ -656,47 +648,4 @@ zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req)
656 return NULL; 648 return NULL;
657} 649}
658 650
659/*
660 * functions needed for reference/usage counting
661 */
662
663static inline void
664zfcp_unit_get(struct zfcp_unit *unit)
665{
666 atomic_inc(&unit->refcount);
667}
668
669static inline void
670zfcp_unit_put(struct zfcp_unit *unit)
671{
672 if (atomic_dec_return(&unit->refcount) == 0)
673 wake_up(&unit->remove_wq);
674}
675
676static inline void
677zfcp_port_get(struct zfcp_port *port)
678{
679 atomic_inc(&port->refcount);
680}
681
682static inline void
683zfcp_port_put(struct zfcp_port *port)
684{
685 if (atomic_dec_return(&port->refcount) == 0)
686 wake_up(&port->remove_wq);
687}
688
689static inline void
690zfcp_adapter_get(struct zfcp_adapter *adapter)
691{
692 atomic_inc(&adapter->refcount);
693}
694
695static inline void
696zfcp_adapter_put(struct zfcp_adapter *adapter)
697{
698 if (atomic_dec_return(&adapter->refcount) == 0)
699 wake_up(&adapter->remove_wq);
700}
701
702#endif /* ZFCP_DEF_H */ 651#endif /* ZFCP_DEF_H */