Re: [PATCH 1/1] target: export protocol identifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/13/2017 03:27 PM, Bart Van Assche wrote:
> On Fri, 2017-01-13 at 04:47 -0600, mchristi@xxxxxxxxxx wrote:
>> From: Mike Christie <mchristi@xxxxxxxxxx>
>>
>> I think the transport statistics device file was supposed
>> to show scsiTransportProtocolType. It instead shows the
>> fabric name which is normally closer to the driver name.
>>
>> I was thinking I cannot change from fabric name to protocol
>> type name incase people are expecting the driver name, so
>> this patch adds another file proto_id that exports the SCSI
>> protocol identifier ID.
>>
>> Signed-off-by: Mike Christie <mchristi@xxxxxxxxxx>
>> ---
>>  drivers/target/target_core_stat.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
>> index 1a39033..be380e4 100644
>> --- a/drivers/target/target_core_stat.c
>> +++ b/drivers/target/target_core_stat.c
>> @@ -795,16 +795,34 @@ static ssize_t target_stat_transport_dev_name_show(struct config_item *item,
>>  	return ret;
>>  }
>>  
>> +static ssize_t target_stat_transport_proto_id_show(struct config_item *item,
>> +		char *page)
>> +{
>> +	struct se_lun *lun = to_transport_stat(item);
>> +	struct se_device *dev;
>> +	struct se_portal_group *tpg = lun->lun_tpg;
>> +	ssize_t ret = -ENODEV;
>> +
>> +	rcu_read_lock();
>> +	dev = rcu_dereference(lun->lun_se_dev);
>> +	if (dev)
>> +		ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->proto_id);
>> +	rcu_read_unlock();
>> +	return ret;
>> +}
>> +
>>  CONFIGFS_ATTR_RO(target_stat_transport_, inst);
>>  CONFIGFS_ATTR_RO(target_stat_transport_, device);
>>  CONFIGFS_ATTR_RO(target_stat_transport_, indx);
>>  CONFIGFS_ATTR_RO(target_stat_transport_, dev_name);
>> +CONFIGFS_ATTR_RO(target_stat_transport_, proto_id);
>>  
>>  static struct configfs_attribute *target_stat_scsi_transport_attrs[] = {
>>  	&target_stat_transport_attr_inst,
>>  	&target_stat_transport_attr_device,
>>  	&target_stat_transport_attr_indx,
>>  	&target_stat_transport_attr_dev_name,
>> +	&target_stat_transport_attr_proto_id,
>>  	NULL,
>>  };
>>  
> 
> Hello Mike,
> 
> I'm fine with exporting the SCSI protocol ID. Since this information only
> depends on the TPG and not on the LUN information, wouldn't it be more
> appropriate to export it in configfs at the TPG level?
> 

Yes. It was a little confusing to me. I saw some other attrs in
scsi_tgt_port and scsi_transport that could be in the TPG dir, but were
lower level under the lun dir.

Will resend.


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux