From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 02/12] zfcp: Add zfcp private struct as SCSI device driver data
Date: Wed, 08 Sep 2010 14:39:51 +0200 [thread overview]
Message-ID: <20100908124352.825446061@de.ibm.com> (raw)
In-Reply-To: 20100908123949.483410445@de.ibm.com
[-- Attachment #1: 701-zfcp-private-struct.diff --]
[-- Type: text/plain, Size: 2681 bytes --]
From: Christof Schmitt <christof.schmitt@de.ibm.com>
Add a new data structure zfcp_scsi_dev that holds zfcp private data
for each SCSI device. Use scsi_transport_reserve_device to let the
SCSI midlayer automatically allocate this with each SCSI device.
Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---
drivers/s390/scsi/zfcp_aux.c | 3 +++
drivers/s390/scsi/zfcp_def.h | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff -urpN linux-2.6/drivers/s390/scsi/zfcp_aux.c linux-2.6-patched/drivers/s390/scsi/zfcp_aux.c
--- linux-2.6/drivers/s390/scsi/zfcp_aux.c 2010-09-08 08:49:26.000000000 +0200
+++ linux-2.6-patched/drivers/s390/scsi/zfcp_aux.c 2010-09-08 08:49:26.000000000 +0200
@@ -159,6 +159,9 @@ static int __init zfcp_module_init(void)
fc_attach_transport(&zfcp_transport_functions);
if (!zfcp_data.scsi_transport_template)
goto out_transport;
+ scsi_transport_reserve_device(zfcp_data.scsi_transport_template,
+ sizeof(struct zfcp_scsi_dev));
+
retval = misc_register(&zfcp_cfdc_misc);
if (retval) {
diff -urpN linux-2.6/drivers/s390/scsi/zfcp_def.h linux-2.6-patched/drivers/s390/scsi/zfcp_def.h
--- linux-2.6/drivers/s390/scsi/zfcp_def.h 2010-09-08 08:49:06.000000000 +0200
+++ linux-2.6-patched/drivers/s390/scsi/zfcp_def.h 2010-09-08 08:49:26.000000000 +0200
@@ -234,6 +234,45 @@ struct zfcp_unit {
};
/**
+ * struct zfcp_scsi_dev - zfcp data per SCSI device
+ * @status: zfcp internal status flags
+ * @lun_handle: handle from "open lun" for issuing FSF requests
+ * @erp_action: zfcp erp data for opening and recovering this LUN
+ * @erp_counter: zfcp erp counter for this LUN
+ * @latencies: FSF channel and fabric latencies
+ * @port: zfcp_port where this LUN belongs to
+ */
+struct zfcp_scsi_dev {
+ atomic_t status;
+ u32 lun_handle;
+ struct zfcp_erp_action erp_action;
+ atomic_t erp_counter;
+ struct zfcp_latencies latencies;
+ struct zfcp_port *port;
+};
+
+/**
+ * sdev_to_zfcp - Access zfcp LUN data for SCSI device
+ * @sdev: scsi_device where to get the zfcp_scsi_dev pointer
+ */
+static inline struct zfcp_scsi_dev *sdev_to_zfcp(struct scsi_device *sdev)
+{
+ return scsi_transport_device_data(sdev);
+}
+
+/**
+ * zfcp_scsi_dev_lun - Return SCSI device LUN as 64 bit FCP LUN
+ * @sdev: SCSI device where to get the LUN from
+ */
+static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev)
+{
+ u64 fcp_lun;
+
+ int_to_scsilun(sdev->lun, (struct scsi_lun *)&fcp_lun);
+ return fcp_lun;
+}
+
+/**
* struct zfcp_fsf_req - basic FSF request structure
* @list: list of FSF requests
* @req_id: unique request ID
next prev parent reply other threads:[~2010-09-08 12:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-08 12:39 [patch 00/12] zfcp patches for 2.6.37 merge window Christof Schmitt
2010-09-08 12:39 ` [patch 01/12] zfcp: Reorder registration of initial SCSI device Christof Schmitt
2010-09-08 12:39 ` Christof Schmitt [this message]
2010-09-08 12:39 ` [patch 03/12] zfcp: Move code for managing zfcp_unit devices to new file Christof Schmitt
2010-09-08 12:39 ` [patch 04/12] zfcp: Remove ZFCP_SYSFS_FAILED macro and implement fcp_lun_show without macro Christof Schmitt
2010-09-08 12:39 ` [patch 05/12] zfcp: Allow running unit/LUN shutdown without acquiring reference Christof Schmitt
2010-09-08 12:39 ` [patch 06/12] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit Christof Schmitt
2010-09-08 12:39 ` [patch 07/12] zfcp: Allow midlayer to scan for LUNs when running in NPIV mode Christof Schmitt
2010-09-08 12:39 ` [patch 08/12] zfcp: Change spin_lock_bh to spin_lock_irq to fix lockdep warning Christof Schmitt
2010-09-08 12:39 ` [patch 09/12] zfcp: Reorder FCP I/O and task management handler functions Christof Schmitt
2010-09-08 12:39 ` [patch 10/12] zfcp: Move ACL/CFDC code to zfcp_cfdc.c Christof Schmitt
2010-09-08 12:40 ` [patch 11/12] zfcp: Remove duplicated code from zfcp_ccw_set_online Christof Schmitt
2010-09-08 12:40 ` [patch 12/12] zfcp: Replace status modifier functions Christof Schmitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100908124352.825446061@de.ibm.com \
--to=christof.schmitt@de.ibm.com \
--cc=James.Bottomley@suse.de \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.