mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-20 23:12:20 +00:00
scst: Add the 'forward_dst' sysfs attribute
Add the 'forward_dst' sysfs attribute next to the 'forwarding' attribute. The plan is to remove the 'forwarding' attribute at some time in the future. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8775 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+5
-3
@@ -807,9 +807,11 @@ Every target should have at least the following entries:
|
||||
until rel_tgt_id becomes unique. This attribute initialized unique by
|
||||
SCST by default.
|
||||
|
||||
- forwarding - if set this target is forwarding target, i.e. does not check
|
||||
any local SCSI events (reservations, etc.). Those event supposed to
|
||||
be checked on the another, requester's side.
|
||||
- forward_dst - if set this target port is a forwarding destination. This means
|
||||
that it does not check any local SCSI events (reservations, etc.). Those
|
||||
event are supposed to be checked at the forwarding source side.
|
||||
|
||||
- forwarding - obsolete synonym for forward_dst.
|
||||
|
||||
- *count*, e.g. read_io_count_kb, - statistics about executed
|
||||
commands and transferred data. Those attributes have speaking names
|
||||
|
||||
+6
-6
@@ -479,8 +479,8 @@ enum scst_exec_res {
|
||||
/* Cache of acg->acg_black_hole_type */
|
||||
#define SCST_TGT_DEV_BLACK_HOLE 1
|
||||
|
||||
/* Cache of tgt->tgt_forwarding */
|
||||
#define SCST_TGT_DEV_FORWARDING 5
|
||||
/* Cache of tgt->tgt_forward_dst */
|
||||
#define SCST_TGT_DEV_FORWARD_DST 5
|
||||
|
||||
/*************************************************************
|
||||
** I/O grouping types. Changing them don't forget to change
|
||||
@@ -1688,11 +1688,11 @@ struct scst_tgt {
|
||||
struct list_head tgt_acg_list; /* target ACG groups */
|
||||
|
||||
/*
|
||||
* Set, if this target is forwarding target, i.e. does not check
|
||||
* any local SCSI events (reservations, etc.). Those event supposed
|
||||
* to be checked on the another, requester's side.
|
||||
* Set, if this target is forwarding destination, i.e. does not check
|
||||
* any local SCSI events (reservations, etc.). Those events are
|
||||
* supposed to be checked at the side of the forwarding source.
|
||||
*/
|
||||
unsigned tgt_forwarding:1;
|
||||
unsigned tgt_forward_dst:1;
|
||||
|
||||
/* Per target analog of the corresponding driver's fields */
|
||||
unsigned tgt_dif_supported:1;
|
||||
|
||||
+3
-3
@@ -5337,10 +5337,10 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
|
||||
tgt_dev->lun = acg_dev->lun;
|
||||
tgt_dev->acg_dev = acg_dev;
|
||||
tgt_dev->tgt_dev_rd_only = acg_dev->acg_dev_rd_only || dev->dev_rd_only;
|
||||
if (sess->tgt->tgt_forwarding)
|
||||
set_bit(SCST_TGT_DEV_FORWARDING, &tgt_dev->tgt_dev_flags);
|
||||
if (sess->tgt->tgt_forward_dst)
|
||||
set_bit(SCST_TGT_DEV_FORWARD_DST, &tgt_dev->tgt_dev_flags);
|
||||
else
|
||||
clear_bit(SCST_TGT_DEV_FORWARDING, &tgt_dev->tgt_dev_flags);
|
||||
clear_bit(SCST_TGT_DEV_FORWARD_DST, &tgt_dev->tgt_dev_flags);
|
||||
tgt_dev->hw_dif_same_sg_layout_required = sess->tgt->tgt_hw_dif_same_sg_layout_required;
|
||||
tgt_dev->tgt_dev_dif_guard_format = acg_dev->acg_dev_dif_guard_format;
|
||||
if (tgt_dev->tgt_dev_dif_guard_format == SCST_DIF_GUARD_FORMAT_IP)
|
||||
|
||||
@@ -1594,7 +1594,7 @@ static int scst_pr_register_all_tg_pt(struct scst_cmd *cmd, uint8_t *buffer,
|
||||
continue;
|
||||
if (tgt->rel_tgt_id == 0)
|
||||
continue;
|
||||
if (tgt->tgt_forwarding) {
|
||||
if (tgt->tgt_forward_dst) {
|
||||
TRACE_PR("ALL_TG_PT: skipping forwarding "
|
||||
"target %s", tgt->tgt_name);
|
||||
continue;
|
||||
|
||||
+26
-16
@@ -2513,7 +2513,7 @@ static struct kobj_attribute scst_rel_tgt_id =
|
||||
__ATTR(rel_tgt_id, S_IRUGO | S_IWUSR, scst_rel_tgt_id_show,
|
||||
scst_rel_tgt_id_store);
|
||||
|
||||
static ssize_t scst_tgt_forwarding_show(struct kobject *kobj,
|
||||
static ssize_t scst_tgt_forward_dst_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
struct scst_tgt *tgt;
|
||||
@@ -2523,14 +2523,14 @@ static ssize_t scst_tgt_forwarding_show(struct kobject *kobj,
|
||||
|
||||
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||
|
||||
res = sprintf(buf, "%d\n%s", tgt->tgt_forwarding,
|
||||
tgt->tgt_forwarding ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||
res = sprintf(buf, "%d\n%s", tgt->tgt_forward_dst,
|
||||
tgt->tgt_forward_dst ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||
|
||||
TRACE_EXIT_RES(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static ssize_t scst_tgt_forwarding_store(struct kobject *kobj,
|
||||
static ssize_t scst_tgt_forward_dst_store(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
int res = 0;
|
||||
@@ -2549,14 +2549,14 @@ static ssize_t scst_tgt_forwarding_store(struct kobject *kobj,
|
||||
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
old = tgt->tgt_forwarding;
|
||||
old = tgt->tgt_forward_dst;
|
||||
|
||||
switch (buf[0]) {
|
||||
case '0':
|
||||
tgt->tgt_forwarding = 0;
|
||||
tgt->tgt_forward_dst = 0;
|
||||
break;
|
||||
case '1':
|
||||
tgt->tgt_forwarding = 1;
|
||||
tgt->tgt_forward_dst = 1;
|
||||
break;
|
||||
default:
|
||||
PRINT_ERROR("%s: Requested action not understood: %s",
|
||||
@@ -2565,7 +2565,7 @@ static ssize_t scst_tgt_forwarding_store(struct kobject *kobj,
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (tgt->tgt_forwarding == old)
|
||||
if (tgt->tgt_forward_dst == old)
|
||||
goto out_unlock;
|
||||
|
||||
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
|
||||
@@ -2576,18 +2576,22 @@ static ssize_t scst_tgt_forwarding_store(struct kobject *kobj,
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
|
||||
list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) {
|
||||
if (tgt->tgt_forwarding)
|
||||
set_bit(SCST_TGT_DEV_FORWARDING, &tgt_dev->tgt_dev_flags);
|
||||
if (tgt->tgt_forward_dst)
|
||||
set_bit(SCST_TGT_DEV_FORWARD_DST,
|
||||
&tgt_dev->tgt_dev_flags);
|
||||
else
|
||||
clear_bit(SCST_TGT_DEV_FORWARDING, &tgt_dev->tgt_dev_flags);
|
||||
clear_bit(SCST_TGT_DEV_FORWARD_DST,
|
||||
&tgt_dev->tgt_dev_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tgt->tgt_forwarding)
|
||||
PRINT_INFO("Set target %s as forwarding", tgt->tgt_name);
|
||||
if (tgt->tgt_forward_dst)
|
||||
PRINT_INFO("Set target %s as forwarding destination",
|
||||
tgt->tgt_name);
|
||||
else
|
||||
PRINT_INFO("Clear target %s as forwarding", tgt->tgt_name);
|
||||
PRINT_INFO("Clear target %s as forwarding destination",
|
||||
tgt->tgt_name);
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&scst_mutex);
|
||||
@@ -2600,9 +2604,14 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
static struct kobj_attribute scst_tgt_forward_dst =
|
||||
__ATTR(forward_dst, S_IRUGO | S_IWUSR, scst_tgt_forward_dst_show,
|
||||
scst_tgt_forward_dst_store);
|
||||
|
||||
// To do: remove the 'forwarding' sysfs attribute and keep 'forward_dst'.
|
||||
static struct kobj_attribute scst_tgt_forwarding =
|
||||
__ATTR(forwarding, S_IRUGO | S_IWUSR, scst_tgt_forwarding_show,
|
||||
scst_tgt_forwarding_store);
|
||||
__ATTR(forwarding, S_IRUGO | S_IWUSR, scst_tgt_forward_dst_show,
|
||||
scst_tgt_forward_dst_store);
|
||||
|
||||
static ssize_t scst_tgt_comment_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
@@ -2876,6 +2885,7 @@ SCST_TGT_SYSFS_STAT_ATTR(cmd_count, none_cmd_count, SCST_DATA_NONE, >> 0);
|
||||
|
||||
static struct attribute *scst_tgt_attrs[] = {
|
||||
&scst_rel_tgt_id.attr,
|
||||
&scst_tgt_forward_dst.attr,
|
||||
&scst_tgt_forwarding.attr,
|
||||
&scst_tgt_comment.attr,
|
||||
&scst_tgt_addr_method.attr,
|
||||
|
||||
@@ -2363,7 +2363,8 @@ int __scst_check_local_events(struct scst_cmd *cmd, bool preempt_tests_only)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (unlikely(test_bit(SCST_TGT_DEV_FORWARDING, &cmd->tgt_dev->tgt_dev_flags))) {
|
||||
if (unlikely(test_bit(SCST_TGT_DEV_FORWARD_DST,
|
||||
&cmd->tgt_dev->tgt_dev_flags))) {
|
||||
/*
|
||||
* All the checks are supposed to be done on the
|
||||
* forwarding requester's side.
|
||||
|
||||
Reference in New Issue
Block a user