From: "Nicholas A. Bellinger" <nab@daterainc.com>
To: target-devel <target-devel@vger.kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
Martin Petersen <martin.petersen@oracle.com>,
Chris Mason <chris.mason@fusionio.com>,
Roland Dreier <roland@purestorage.com>,
Zach Brown <zab@redhat.com>, Kent Overstreet <kmo@daterainc.com>,
Theodore Tso <tytso@mit.edu>,
James Bottomley <JBottomley@Parallels.com>,
Nicholas Bellinger <nab@linux-iscsi.org>,
Nicholas Bellinger <nab@daterainc.com>
Subject: [PATCH-v2 4/9] target: Add global device list for EXTENDED_COPY
Date: Mon, 26 Aug 2013 22:03:03 +0000 [thread overview]
Message-ID: <1377554588-28394-5-git-send-email-nab@daterainc.com> (raw)
In-Reply-To: <1377554588-28394-1-git-send-email-nab@daterainc.com>
From: Nicholas Bellinger <nab@daterainc.com>
EXTENDED_COPY needs to be able to search a global list of devices
based on NAA WWN device identifiers, so add a simple g_device_list
protected by g_device_mutex.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Chris Mason <chris.mason@fusionio.com>
Cc: Roland Dreier <roland@purestorage.com>
Cc: Zach Brown <zab@redhat.com>
Cc: James Bottomley <JBottomley@Parallels.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@daterainc.com>
---
drivers/target/target_core_device.c | 13 +++++++++++++
include/target/target_core_base.h | 1 +
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index de89046..458944e 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -47,6 +47,9 @@
#include "target_core_pr.h"
#include "target_core_ua.h"
+DEFINE_MUTEX(g_device_mutex);
+LIST_HEAD(g_device_list);
+
static struct se_hba *lun0_hba;
/* not static, needed by tpg.c */
struct se_device *g_lun0_dev;
@@ -1406,6 +1409,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
INIT_LIST_HEAD(&dev->delayed_cmd_list);
INIT_LIST_HEAD(&dev->state_list);
INIT_LIST_HEAD(&dev->qf_cmd_list);
+ INIT_LIST_HEAD(&dev->g_dev_node);
spin_lock_init(&dev->stats_lock);
spin_lock_init(&dev->execute_task_lock);
spin_lock_init(&dev->delayed_cmd_lock);
@@ -1525,6 +1529,11 @@ int target_configure_device(struct se_device *dev)
spin_lock(&hba->device_lock);
hba->dev_count++;
spin_unlock(&hba->device_lock);
+
+ mutex_lock(&g_device_mutex);
+ list_add_tail(&dev->g_dev_node, &g_device_list);
+ mutex_unlock(&g_device_mutex);
+
return 0;
out_free_alua:
@@ -1543,6 +1552,10 @@ void target_free_device(struct se_device *dev)
if (dev->dev_flags & DF_CONFIGURED) {
destroy_workqueue(dev->tmr_wq);
+ mutex_lock(&g_device_mutex);
+ list_del(&dev->g_dev_node);
+ mutex_unlock(&g_device_mutex);
+
spin_lock(&hba->device_lock);
hba->dev_count--;
spin_unlock(&hba->device_lock);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 0783b2c..6b14f3c 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -686,6 +686,7 @@ struct se_device {
struct list_head delayed_cmd_list;
struct list_head state_list;
struct list_head qf_cmd_list;
+ struct list_head g_dev_node;
/* Pointer to associated SE HBA */
struct se_hba *se_hba;
/* T10 Inquiry and VPD WWN Information */
--
1.7.2.5
next prev parent reply other threads:[~2013-08-26 22:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-26 22:02 [PATCH-v2 0/9] target: Add support for EXTENDED_COPY (VAAI) offload emulation Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 1/9] target: Make target_core_subsystem defined as non static Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 2/9] target: Make spc_parse_naa_6h_vendor_specific " Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 3/9] target: Make helpers non static for EXTENDED_COPY command setup Nicholas A. Bellinger
2013-08-26 22:03 ` Nicholas A. Bellinger [this message]
2013-08-26 22:03 ` [PATCH-v2 5/9] target: Avoid non-existent tg_pt_gp_mem in target_alua_state_check Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 6/9] target: Add support for EXTENDED_COPY copy offload emulation Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 7/9] target: Enable EXTENDED_COPY setup in spc_parse_cdb Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 8/9] target: Add Third Party Copy (3PC) bit in INQUIRY response Nicholas A. Bellinger
2013-08-26 22:03 ` [PATCH-v2 9/9] target: Enable global EXTENDED_COPY setup/release Nicholas A. Bellinger
2013-08-26 22:46 ` [PATCH-v2 0/9] target: Add support for EXTENDED_COPY (VAAI) offload emulation Zach Brown
2013-08-27 0:02 ` Nicholas A. Bellinger
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=1377554588-28394-5-git-send-email-nab@daterainc.com \
--to=nab@daterainc.com \
--cc=JBottomley@Parallels.com \
--cc=chris.mason@fusionio.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kmo@daterainc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nab@linux-iscsi.org \
--cc=roland@purestorage.com \
--cc=target-devel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=zab@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®