mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 19:21:26 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -2498,7 +2498,6 @@ out_free:
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
static bool scst_cm_is_lun_free(unsigned int lun)
|
||||
{
|
||||
bool res = true;
|
||||
@@ -2507,6 +2506,9 @@ static bool scst_cm_is_lun_free(unsigned int lun)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->lun == lun) {
|
||||
res = false;
|
||||
@@ -2518,15 +2520,16 @@ static bool scst_cm_is_lun_free(unsigned int lun)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
static unsigned int scst_cm_get_lun(const struct scst_device *dev)
|
||||
{
|
||||
unsigned int res = -1;
|
||||
unsigned int res = SCST_MAX_LUN;
|
||||
int i;
|
||||
bool found = false;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
struct list_head *head = &scst_cm_sess->sess_tgt_dev_list[i];
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
@@ -2534,7 +2537,6 @@ static unsigned int scst_cm_get_lun(const struct scst_device *dev)
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (tgt_dev->dev == dev) {
|
||||
res = tgt_dev->lun;
|
||||
found = true;
|
||||
TRACE_DBG("LUN %d found (full LUN %lld)",
|
||||
res, tgt_dev->lun);
|
||||
goto out;
|
||||
@@ -2542,14 +2544,11 @@ static unsigned int scst_cm_get_lun(const struct scst_device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
sBUG_ON(!found);
|
||||
|
||||
out:
|
||||
TRACE_EXIT_RES(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun)
|
||||
{
|
||||
int res, i;
|
||||
@@ -2558,6 +2557,9 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
TRACE_DBG("dev %s, LUN %ld", dev->virt_name, (unsigned long)lun);
|
||||
|
||||
for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) {
|
||||
@@ -2622,7 +2624,6 @@ out_err:
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
static void scst_cm_dev_unregister(struct scst_device *dev, bool del_lun)
|
||||
{
|
||||
int i;
|
||||
@@ -2630,6 +2631,9 @@ static void scst_cm_dev_unregister(struct scst_device *dev, bool del_lun)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
TRACE_DBG("dev %s, del_lun %d", dev->virt_name, del_lun);
|
||||
|
||||
list_for_each_entry_safe(des, t, &scst_cm_desig_list, cm_desig_list_entry) {
|
||||
@@ -2696,13 +2700,15 @@ out_unblock:
|
||||
goto out_resume;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
int scst_cm_on_dev_register(struct scst_device *dev)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
if (!dev->handler->auto_cm_assignment_possible)
|
||||
goto out;
|
||||
|
||||
@@ -2713,24 +2719,28 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
void scst_cm_on_dev_unregister(struct scst_device *dev)
|
||||
{
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
scst_cm_dev_unregister(dev, true);
|
||||
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
int scst_cm_on_add_acg(struct scst_acg *acg)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
if (scst_cm_tgt == NULL)
|
||||
goto out;
|
||||
|
||||
@@ -2748,13 +2758,13 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
void scst_cm_on_del_acg(struct scst_acg *acg)
|
||||
{
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun,
|
||||
unsigned int *flags)
|
||||
{
|
||||
@@ -2762,6 +2772,9 @@ int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
if (acg_dev->acg != scst_cm_tgt->default_acg)
|
||||
goto out;
|
||||
|
||||
@@ -2780,13 +2793,15 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be held and activities suspended */
|
||||
bool scst_cm_on_del_lun(struct scst_acg_dev *acg_dev, bool gen_report_luns_changed)
|
||||
{
|
||||
bool res = gen_report_luns_changed;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
if (acg_dev->acg != scst_cm_tgt->default_acg)
|
||||
goto out;
|
||||
|
||||
@@ -2799,7 +2814,6 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
/* scst_mutex supposed to be locked */
|
||||
static bool scst_cm_check_access_acg(const char *initiator_name,
|
||||
const struct scst_device *dev, const struct scst_acg *acg,
|
||||
bool default_acg)
|
||||
@@ -2809,6 +2823,9 @@ static bool scst_cm_check_access_acg(const char *initiator_name,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
scst_assert_activity_suspended();
|
||||
lockdep_assert_held(&scst_mutex);
|
||||
|
||||
list_for_each_entry(acg_dev, &acg->acg_dev_list, acg_dev_list_entry) {
|
||||
if (acg_dev->dev == dev) {
|
||||
struct scst_acn *acn;
|
||||
|
||||
Reference in New Issue
Block a user