mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-23 21:51:27 +00:00
Cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2296 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -224,8 +224,7 @@ Summary of changes between versions 0.9.5 and 1.0.0
|
||||
Target drivers need to be updated accordingly.
|
||||
|
||||
- Linear search in the LUN translation routines scst_translate_lun()
|
||||
and scst_mgmt_translate_lun() was changed to a hash-based one, thanks
|
||||
to Michael G. Byrnes.
|
||||
and scst_mgmt_translate_lun() was changed to a hash-based one.
|
||||
|
||||
- Building from the Linux kernel tree updated, inside kernel building fixed.
|
||||
|
||||
|
||||
@@ -1946,11 +1946,8 @@ Thanks to:
|
||||
* Erik Habbinga <erikhabbinga@inphase-tech.com> for fixes and support
|
||||
of the LSI target driver.
|
||||
|
||||
* Ross S. W. Walker <rswwalker@hotmail.com> for the original block IO
|
||||
code and Vu Pham <huongvp@yahoo.com> who updated it for the VDISK dev
|
||||
handler.
|
||||
|
||||
* Michael G. Byrnes <michael.byrnes@hp.com> for fixes.
|
||||
* Ross S. W. Walker <rswwalker@hotmail.com> for BLOCKIO inspiration
|
||||
and Vu Pham <huongvp@yahoo.com> who implemented it for VDISK dev handler.
|
||||
|
||||
* Alessandro Premoli <a.premoli@andxor.it> for fixes
|
||||
|
||||
|
||||
@@ -1434,11 +1434,8 @@ Thanks to:
|
||||
* Erik Habbinga <erikhabbinga@inphase-tech.com> for fixes and support
|
||||
of the LSI target driver.
|
||||
|
||||
* Ross S. W. Walker <rswwalker@hotmail.com> for the original block IO
|
||||
code and Vu Pham <huongvp@yahoo.com> who updated it for the VDISK dev
|
||||
handler.
|
||||
|
||||
* Michael G. Byrnes <michael.byrnes@hp.com> for fixes.
|
||||
* Ross S. W. Walker <rswwalker@hotmail.com> for BLOCKIO inspiration
|
||||
and Vu Pham <huongvp@yahoo.com> who implemented it for VDISK dev handler.
|
||||
|
||||
* Alessandro Premoli <a.premoli@andxor.it> for fixes
|
||||
|
||||
|
||||
@@ -1394,11 +1394,6 @@ struct scst_tgt {
|
||||
struct kobject *tgt_ini_grp_kobj; /* target/ini_groups/ */
|
||||
};
|
||||
|
||||
/* Hash size and hash fn for hash based lun translation */
|
||||
#define TGT_DEV_HASH_SHIFT 5
|
||||
#define TGT_DEV_HASH_SIZE (1 << TGT_DEV_HASH_SHIFT)
|
||||
#define HASH_VAL(_val) (_val & (TGT_DEV_HASH_SIZE - 1))
|
||||
|
||||
#ifdef CONFIG_SCST_MEASURE_LATENCY
|
||||
|
||||
/* Defines extended latency statistics */
|
||||
@@ -1447,10 +1442,13 @@ struct scst_session {
|
||||
unsigned long sess_aflags;
|
||||
|
||||
/*
|
||||
* Hash list of tgt_dev's for this session, protected by scst_mutex
|
||||
* and suspended activity
|
||||
* Hash list for tgt_dev's for this session with size and fn. It isn't
|
||||
* hlist_entry, because we need ability to go over the list in the
|
||||
* reverse order. Protected by scst_mutex and suspended activity.
|
||||
*/
|
||||
struct list_head sess_tgt_dev_list_hash[TGT_DEV_HASH_SIZE];
|
||||
#define SESS_TGT_DEV_LIST_HASH_SIZE (1 << 5)
|
||||
#define SESS_TGT_DEV_LIST_HASH_FN(val) ((val) & (SESS_TGT_DEV_LIST_HASH_SIZE - 1))
|
||||
struct list_head sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_SIZE];
|
||||
|
||||
/*
|
||||
* List of cmds in this session. Protected by sess_list_lock.
|
||||
@@ -2219,7 +2217,7 @@ struct scst_async_io_context_keeper {
|
||||
* SCSI I_T_L nexus.
|
||||
*/
|
||||
struct scst_tgt_dev {
|
||||
/* List entry in sess->sess_tgt_dev_list_hash */
|
||||
/* List entry in sess->sess_tgt_dev_list */
|
||||
struct list_head sess_tgt_dev_list_entry;
|
||||
|
||||
struct scst_device *dev; /* to save extra dereferences */
|
||||
|
||||
@@ -1285,16 +1285,14 @@ void scst_set_initial_UA(struct scst_session *sess, int key, int asc, int ascq)
|
||||
TRACE_MGMT_DBG("Setting for sess %p initial UA %x/%x/%x", sess, key,
|
||||
asc, ascq);
|
||||
|
||||
/* Protect sess_tgt_dev_list_hash */
|
||||
/* To protect sess_tgt_dev_list */
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
spin_lock_bh(&tgt_dev->tgt_dev_lock);
|
||||
if (!list_empty(&tgt_dev->UA_list)) {
|
||||
struct scst_tgt_dev_UA *ua;
|
||||
@@ -1474,7 +1472,7 @@ static void scst_queue_report_luns_changed_UA(struct scst_session *sess,
|
||||
int flags)
|
||||
{
|
||||
uint8_t sense_buffer[SCST_STANDARD_SENSE_LEN];
|
||||
struct list_head *shead;
|
||||
struct list_head *head;
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
int i;
|
||||
|
||||
@@ -1485,21 +1483,20 @@ static void scst_queue_report_luns_changed_UA(struct scst_session *sess,
|
||||
|
||||
local_bh_disable();
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry(tgt_dev, shead,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
/* Lockdep triggers here a false positive.. */
|
||||
spin_lock(&tgt_dev->tgt_dev_lock);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry(tgt_dev, shead,
|
||||
sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
int sl;
|
||||
|
||||
if (!scst_is_report_luns_changed_type(
|
||||
@@ -1515,11 +1512,11 @@ static void scst_queue_report_luns_changed_UA(struct scst_session *sess,
|
||||
}
|
||||
}
|
||||
|
||||
for (i = TGT_DEV_HASH_SIZE-1; i >= 0; i--) {
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = SESS_TGT_DEV_LIST_HASH_SIZE-1; i >= 0; i--) {
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry_reverse(tgt_dev,
|
||||
shead, sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry_reverse(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
spin_unlock(&tgt_dev->tgt_dev_lock);
|
||||
}
|
||||
}
|
||||
@@ -1546,13 +1543,13 @@ static void scst_report_luns_changed_sess(struct scst_session *sess)
|
||||
|
||||
TRACE_DBG("REPORTED LUNS DATA CHANGED (sess %p)", sess);
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *shead;
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head;
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry(tgt_dev, shead,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
if (scst_is_report_luns_changed_type(
|
||||
tgt_dev->dev->type)) {
|
||||
@@ -1645,7 +1642,7 @@ void scst_aen_done(struct scst_aen *aen)
|
||||
SCST_SET_UA_FLAG_AT_HEAD);
|
||||
mutex_unlock(&scst_mutex);
|
||||
} else {
|
||||
struct list_head *shead;
|
||||
struct list_head *head;
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
uint64_t lun;
|
||||
|
||||
@@ -1654,8 +1651,8 @@ void scst_aen_done(struct scst_aen *aen)
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
/* tgt_dev might get dead, so we need to reseek it */
|
||||
shead = &aen->sess->sess_tgt_dev_list_hash[HASH_VAL(lun)];
|
||||
list_for_each_entry(tgt_dev, shead,
|
||||
head = &aen->sess->sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_FN(lun)];
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->lun == lun) {
|
||||
TRACE_MGMT_DBG("Requeuing failed AEN UA for "
|
||||
@@ -1707,7 +1704,7 @@ static void scst_check_reassign_sess(struct scst_session *sess)
|
||||
struct scst_acg *acg, *old_acg;
|
||||
struct scst_acg_dev *acg_dev;
|
||||
int i, rc;
|
||||
struct list_head *shead;
|
||||
struct list_head *head;
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
bool luns_changed = false;
|
||||
bool add_failed, something_freed, not_needed_freed = false;
|
||||
@@ -1734,10 +1731,10 @@ retry_add:
|
||||
list_for_each_entry(acg_dev, &acg->acg_dev_list, acg_dev_list_entry) {
|
||||
unsigned int inq_changed_ua_needed = 0;
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry(tgt_dev, shead,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
if ((tgt_dev->dev == acg_dev->dev) &&
|
||||
(tgt_dev->lun == acg_dev->lun) &&
|
||||
@@ -1774,11 +1771,11 @@ next:
|
||||
|
||||
something_freed = false;
|
||||
not_needed_freed = true;
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct scst_tgt_dev *t;
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry_safe(tgt_dev, t, shead,
|
||||
list_for_each_entry_safe(tgt_dev, t, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->acg_dev->acg != acg) {
|
||||
TRACE_MGMT_DBG("sess %p: Deleting not used "
|
||||
@@ -1811,10 +1808,10 @@ next:
|
||||
if (luns_changed) {
|
||||
scst_report_luns_changed_sess(sess);
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
shead = &sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
head = &sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry(tgt_dev, shead,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->inq_changed_ua_needed) {
|
||||
TRACE_MGMT_DBG("sess %p: Setting "
|
||||
@@ -3276,7 +3273,7 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
|
||||
int ini_sg, ini_unchecked_isa_dma, ini_use_clustering;
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
struct scst_device *dev = acg_dev->dev;
|
||||
struct list_head *sess_tgt_dev_list_head;
|
||||
struct list_head *head;
|
||||
int i, sl;
|
||||
uint8_t sense_buffer[SCST_STANDARD_SENSE_LEN];
|
||||
|
||||
@@ -3400,10 +3397,8 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
|
||||
__set_bit(SCST_TGT_DEV_RESERVED, &tgt_dev->tgt_dev_flags);
|
||||
spin_unlock_bh(&dev->dev_lock);
|
||||
|
||||
sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[HASH_VAL(tgt_dev->lun)];
|
||||
list_add_tail(&tgt_dev->sess_tgt_dev_list_entry,
|
||||
sess_tgt_dev_list_head);
|
||||
head = &sess->sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_FN(tgt_dev->lun)];
|
||||
list_add_tail(&tgt_dev->sess_tgt_dev_list_entry, head);
|
||||
|
||||
*out_tgt_dev = tgt_dev;
|
||||
|
||||
@@ -3541,14 +3536,13 @@ void scst_sess_free_tgt_devs(struct scst_session *sess)
|
||||
TRACE_ENTRY();
|
||||
|
||||
/* The session is going down, no users, so no locks */
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
list_for_each_entry_safe(tgt_dev, t, sess_tgt_dev_list_head,
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
list_for_each_entry_safe(tgt_dev, t, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
scst_free_tgt_dev(tgt_dev);
|
||||
}
|
||||
INIT_LIST_HEAD(sess_tgt_dev_list_head);
|
||||
INIT_LIST_HEAD(head);
|
||||
}
|
||||
|
||||
TRACE_EXIT();
|
||||
@@ -3995,10 +3989,9 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask,
|
||||
sess->init_phase = SCST_SESS_IPH_INITING;
|
||||
sess->shut_phase = SCST_SESS_SPH_READY;
|
||||
atomic_set(&sess->refcnt, 0);
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
INIT_LIST_HEAD(sess_tgt_dev_list_head);
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
INIT_LIST_HEAD(head);
|
||||
}
|
||||
spin_lock_init(&sess->sess_list_lock);
|
||||
INIT_LIST_HEAD(&sess->sess_cmd_list);
|
||||
@@ -6257,17 +6250,16 @@ again:
|
||||
|
||||
/*
|
||||
* cmd won't allow to suspend activities, so we can access
|
||||
* sess->sess_tgt_dev_list_hash without any additional
|
||||
* sess->sess_tgt_dev_list without any additional
|
||||
* protection.
|
||||
*/
|
||||
|
||||
local_bh_disable();
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
/* Lockdep triggers here a false positive.. */
|
||||
spin_lock(&tgt_dev->tgt_dev_lock);
|
||||
@@ -6288,12 +6280,11 @@ again:
|
||||
list_del(&UA_entry->UA_list_entry);
|
||||
|
||||
if (UA_entry->global_UA) {
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
struct scst_tgt_dev_UA *ua;
|
||||
list_for_each_entry(ua, &tgt_dev->UA_list,
|
||||
@@ -6323,11 +6314,10 @@ again:
|
||||
|
||||
out_unlock:
|
||||
if (global_unlock) {
|
||||
for (i = TGT_DEV_HASH_SIZE-1; i >= 0; i--) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = SESS_TGT_DEV_LIST_HASH_SIZE-1; i >= 0; i--) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry_reverse(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry_reverse(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
spin_unlock(&tgt_dev->tgt_dev_lock);
|
||||
}
|
||||
|
||||
@@ -579,11 +579,11 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
seq_printf(seq, "%-47s\n", buf);
|
||||
}
|
||||
|
||||
for (t = TGT_DEV_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[t];
|
||||
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *head =
|
||||
&sess->sess_tgt_dev_list[t];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
|
||||
seq_printf(seq, "\nLUN: %llu\n", tgt_dev->lun);
|
||||
@@ -749,11 +749,11 @@ static ssize_t scst_proc_scsi_tgt_gen_write_lat(struct file *file,
|
||||
memset(sess->sess_latency_stat, 0,
|
||||
sizeof(sess->sess_latency_stat));
|
||||
|
||||
for (t = TGT_DEV_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[t];
|
||||
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *head =
|
||||
&sess->sess_tgt_dev_list[t];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
tgt_dev->scst_time = 0;
|
||||
tgt_dev->tgt_time = 0;
|
||||
@@ -2412,12 +2412,11 @@ static int scst_sessions_info_show(struct seq_file *seq, void *v)
|
||||
list_for_each_entry(sess, &acg->acg_sess_list,
|
||||
acg_sess_list_entry) {
|
||||
int active_cmds = 0, t;
|
||||
for (t = TGT_DEV_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[t];
|
||||
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *head =
|
||||
&sess->sess_tgt_dev_list[t];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev,
|
||||
sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
active_cmds += atomic_read(&tgt_dev->tgt_dev_cmd_count);
|
||||
}
|
||||
|
||||
@@ -2154,12 +2154,10 @@ static int scst_sess_zero_latency(struct scst_sysfs_work_item *work)
|
||||
memset(sess->sess_latency_stat, 0,
|
||||
sizeof(sess->sess_latency_stat));
|
||||
|
||||
for (t = TGT_DEV_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[t];
|
||||
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[t];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
tgt_dev->scst_time = 0;
|
||||
tgt_dev->tgt_time = 0;
|
||||
tgt_dev->dev_time = 0;
|
||||
@@ -2239,12 +2237,10 @@ static int scst_sysfs_sess_get_active_commands(struct scst_session *sess)
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
for (t = TGT_DEV_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[t];
|
||||
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[t];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
active_cmds += atomic_read(&tgt_dev->tgt_dev_cmd_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1703,13 +1703,11 @@ static int scst_report_luns_local(struct scst_cmd *cmd)
|
||||
|
||||
/*
|
||||
* cmd won't allow to suspend activities, so we can access
|
||||
* sess->sess_tgt_dev_list_hash without any additional protection.
|
||||
* sess->sess_tgt_dev_list without any additional protection.
|
||||
*/
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&cmd->sess->sess_tgt_dev_list_hash[i];
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &cmd->sess->sess_tgt_dev_list[i];
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (!overflow) {
|
||||
if (offs >= buffer_size) {
|
||||
scst_put_buf(cmd, buffer);
|
||||
@@ -1775,14 +1773,12 @@ out_compl:
|
||||
|
||||
/*
|
||||
* cmd won't allow to suspend activities, so we can access
|
||||
* sess->sess_tgt_dev_list_hash without any additional protection.
|
||||
* sess->sess_tgt_dev_list without any additional protection.
|
||||
*/
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&cmd->sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &cmd->sess->sess_tgt_dev_list[i];
|
||||
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
struct scst_tgt_dev_UA *ua;
|
||||
|
||||
spin_lock_bh(&tgt_dev->tgt_dev_lock);
|
||||
@@ -3808,13 +3804,12 @@ static int scst_translate_lun(struct scst_cmd *cmd)
|
||||
__scst_get(1);
|
||||
|
||||
if (likely(!test_bit(SCST_FLAG_SUSPENDED, &scst_flags))) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&cmd->sess->sess_tgt_dev_list_hash[HASH_VAL(cmd->lun)];
|
||||
struct list_head *head =
|
||||
&cmd->sess->sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_FN(cmd->lun)];
|
||||
TRACE_DBG("Finding tgt_dev for cmd %p (lun %lld)", cmd,
|
||||
(long long unsigned int)cmd->lun);
|
||||
res = -1;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->lun == cmd->lun) {
|
||||
TRACE_DBG("tgt_dev %p found", tgt_dev);
|
||||
|
||||
@@ -4378,7 +4373,7 @@ void scst_cmd_tasklet(long p)
|
||||
static int scst_mgmt_translate_lun(struct scst_mgmt_cmd *mcmd)
|
||||
{
|
||||
struct scst_tgt_dev *tgt_dev = NULL;
|
||||
struct list_head *sess_tgt_dev_list_head;
|
||||
struct list_head *head;
|
||||
int res = -1;
|
||||
|
||||
TRACE_ENTRY();
|
||||
@@ -4397,10 +4392,8 @@ static int scst_mgmt_translate_lun(struct scst_mgmt_cmd *mcmd)
|
||||
goto out;
|
||||
}
|
||||
|
||||
sess_tgt_dev_list_head =
|
||||
&mcmd->sess->sess_tgt_dev_list_hash[HASH_VAL(mcmd->lun)];
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
head = &mcmd->sess->sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_FN(mcmd->lun)];
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->lun == mcmd->lun) {
|
||||
TRACE_DBG("tgt_dev %p found", tgt_dev);
|
||||
mcmd->mcmd_tgt_dev = tgt_dev;
|
||||
@@ -4984,7 +4977,7 @@ static int scst_is_cmd_belongs_to_dev(struct scst_cmd *cmd,
|
||||
struct scst_device *dev)
|
||||
{
|
||||
struct scst_tgt_dev *tgt_dev = NULL;
|
||||
struct list_head *sess_tgt_dev_list_head;
|
||||
struct list_head *head;
|
||||
int res = 0;
|
||||
|
||||
TRACE_ENTRY();
|
||||
@@ -4992,10 +4985,8 @@ static int scst_is_cmd_belongs_to_dev(struct scst_cmd *cmd,
|
||||
TRACE_DBG("Finding match for dev %p and cmd %p (lun %lld)", dev, cmd,
|
||||
(long long unsigned int)cmd->lun);
|
||||
|
||||
sess_tgt_dev_list_head =
|
||||
&cmd->sess->sess_tgt_dev_list_hash[HASH_VAL(cmd->lun)];
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
head = &cmd->sess->sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_FN(cmd->lun)];
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->lun == cmd->lun) {
|
||||
TRACE_DBG("dev %p found", tgt_dev->dev);
|
||||
res = (tgt_dev->dev == dev);
|
||||
@@ -5338,11 +5329,9 @@ static void scst_do_nexus_loss_sess(struct scst_mgmt_cmd *mcmd)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
scst_nexus_loss(tgt_dev,
|
||||
(mcmd->fn != SCST_UNREG_SESS_TM));
|
||||
}
|
||||
@@ -5373,11 +5362,9 @@ static int scst_abort_all_nexus_loss_sess(struct scst_mgmt_cmd *mcmd,
|
||||
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
int rc;
|
||||
|
||||
__scst_abort_task_set(mcmd, tgt_dev);
|
||||
@@ -5412,11 +5399,10 @@ static void scst_do_nexus_loss_tgt(struct scst_mgmt_cmd *mcmd)
|
||||
TRACE_ENTRY();
|
||||
|
||||
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
scst_nexus_loss(tgt_dev, true);
|
||||
}
|
||||
@@ -5448,11 +5434,10 @@ static int scst_abort_all_nexus_loss_tgt(struct scst_mgmt_cmd *mcmd,
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
|
||||
for (i = 0; i < TGT_DEV_HASH_SIZE; i++) {
|
||||
struct list_head *sess_tgt_dev_list_head =
|
||||
&sess->sess_tgt_dev_list_hash[i];
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
list_for_each_entry(tgt_dev, sess_tgt_dev_list_head,
|
||||
list_for_each_entry(tgt_dev, head,
|
||||
sess_tgt_dev_list_entry) {
|
||||
int rc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user