convert the scsi layer to use struct device
Subsystems (21)
PATCH 1/1 convert the scsi layer to use struct device
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of class_device.
It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
After this, all of the class_device code is now finally gone from the kernel!
thanks,
greg k-h
-------------
From: Tony Jones <[email protected]>
Subject: SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller...
--- block/bsg.c | 11 drivers/ata/ahci.c | 4 drivers/ata/libata-scsi.c | 15 - drivers/base/attribute_container.c | 77 ++--- drivers/base/transport_class.c | 14 drivers/infiniband/ulp/srp/ib_srp.c | 132 +++++---- drivers/infiniband/ulp/srp/ib_srp.h | 2 drivers/message/fusion/mptscsih.c | 120 ++++---- drivers/message/fusion/mptscsih.h | 2 drivers/misc/enclosure.c | 118 ++++---- drivers/scsi/3w-9xxx.c | 9 drivers/scsi/3w-xxxx.c | 9 drivers/scsi/aacraid/aachba.c | 2 drivers/scsi/aacraid/aacraid.h | 4 drivers/scsi/aacraid/linit.c | 93 +++--- drivers/scsi/arcmsr/arcmsr.h | 4 drivers/scsi/arcmsr/arcmsr_attr.c | 163 ++++++----- drivers/scsi/ch.c | 13 drivers/scsi/hosts.c | 34 +- drivers/scsi/hptiop.c | 14 drivers/scsi/ibmvscsi/ibmvscsi.c | 44 +-- drivers/scsi/ibmvscsi/ibmvstgt.c | 27 + drivers/scsi/ipr.c | 140 +++++---- drivers/scsi/lpfc/lpfc_attr.c | 482 ++++++++++++++++++---------------- drivers/scsi/lpfc/lpfc_crtn.h | 4 drivers/scsi/megaraid/megaraid_mbox.c | 13 drivers/scsi/ncr53c8xx.c | 7 drivers/scsi/osst.c | 76 ++--- drivers/scsi/pcmcia/sym53c500_cs.c | 14 drivers/scsi/qla2xxx/qla_attr.c | 177 ++++++------ drivers/scsi/qla2xxx/qla_gbl.h | 4 drivers/scsi/raid_class.c | 73 ++--- drivers/scsi/scsi_sas_internal.h | 24 - drivers/scsi/scsi_sysfs.c | 150 +++++----- drivers/scsi/scsi_transport_fc.c | 385 ++++++++++++++------------- drivers/scsi/scsi_transport_iscsi.c | 107 +++---- drivers/scsi/scsi_transport_sas.c | 157 ++++++----- drivers/scsi/scsi_transport_spi.c | 185 ++++++------- drivers/scsi/scsi_transport_srp.c | 26 - drivers/scsi/sd.c | 78 +++-- drivers/scsi/ses.c | 28 - drivers/scsi/sg.c | 36 +- drivers/scsi/st.c | 71 ++--- include/linux/attribute_container.h | 28 - include/linux/bsg.h | 2 include/linux/enclosure.h | 11 include/linux/libata.h | 2 include/linux/raid_class.h | 12 include/linux/transport_class.h | 6 include/scsi/scsi_device.h | 10 include/scsi/scsi_host.h | 7 include/scsi/scsi_transport.h | 2 include/scsi/scsi_transport_fc.h | 14 include/scsi/scsi_transport_sas.h | 12 include/scsi/sd.h | 4 55 files changed, 1754 insertions(+), 1504 deletions(-)
block/bsg.c +5 -6
@@ -755,7 +755,7 @@ static struct bsg_device *bsg_add_devicemutex_lock (&bsg_mutex);hlist_add_head (&bd->dev_list,bsg_dev_idx_hash (bd->minor)); -strncpy (bd->name, rq->bsg_dev.class_dev->class_id,sizeof (bd->name) -1 ); +strncpy (bd->name, rq->bsg_dev.class_dev->bus_id,sizeof (bd->name) -1 );dprintk ("bound to <%s>, max queue %d\n" ,format_dev_t (buf, inode->i_rdev), bd->max_queue);
@@ -939,7 +939,7 @@ void bsg_unregister_queue(struct requestmutex_lock (&bsg_mutex);idr_remove (&bsg_minor_idr, bcd->minor);sysfs_remove_link (&q->kobj,"bsg" ); -class_device_unregister (bcd->class_dev); +device_unregister (bcd->class_dev);put_device (bcd->dev); bcd->class_dev =NULL ; bcd->dev =NULL ;
@@ -953,7 +953,7 @@ int bsg_register_queue(struct request_qustruct bsg_class_device *bcd;dev_t dev;int ret, minor; -struct class_device *class_dev =NULL ; +struct device *class_dev =NULL ;const char *devname;if (name)
@@ -992,8 +992,7 @@ int bsg_register_queue(struct request_qu bcd->queue = q; bcd->dev =get_device (gdev); dev =MKDEV (bsg_major, bcd->minor); - class_dev =class_device_create (bsg_class,NULL , dev, gdev,"%s" , - devname); + class_dev =device_create (bsg_class, gdev, dev,"%s" , devname);if (IS_ERR (class_dev)) { ret =PTR_ERR (class_dev); goto put_dev;
@@ -1010,7 +1009,7 @@ int bsg_register_queue(struct request_qureturn 0 ; unregister_class_dev: -class_device_unregister (class_dev); +device_unregister (class_dev); put_dev:put_device (gdev); remove_idr:
drivers/ata/ahci.c +2 -2
@@ -266,8 +266,8 @@ static int ahci_pci_device_suspend(strucstatic int ahci_pci_device_resume (struct pci_dev *pdev);#endif -static struct class_device_attribute *ahci_shost_attrs[] = { - &class_device_attr_link_power_management_policy, +static struct device_attribute *ahci_shost_attrs[] = { + &dev_attr_link_power_management_policy,NULL };
drivers/ata/libata-scsi.c +8 -7
@@ -131,10 +131,11 @@ static const char *ata_scsi_lpm_get(enumreturn NULL ; } -static ssize_t ata_scsi_lpm_put (struct class_device *class_dev, -const char *buf,size_t count) +static ssize_t ata_scsi_lpm_put (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) { -struct Scsi_Host *shost =class_to_shost (class_dev); +struct Scsi_Host *shost =class_to_shost (dev);struct ata_port *ap =ata_shost_to_port (shost);enum link_pm policy =0 ;int i;
@@ -162,9 +163,9 @@ static ssize_t ata_scsi_lpm_put(struct c }static ssize_t -ata_scsi_lpm_show (struct class_device *class_dev,char *buf) +ata_scsi_lpm_show (struct device *dev,struct device_attribute *attr,char *buf) { -struct Scsi_Host *shost =class_to_shost (class_dev); +struct Scsi_Host *shost =class_to_shost (dev);struct ata_port *ap =ata_shost_to_port (shost);const char *policy =ata_scsi_lpm_get (ap->pm_policy);
@@ -174,9 +175,9 @@ ata_scsi_lpm_show(struct class_device *creturn snprintf (buf,23 ,"%s\n" , policy); } -CLASS_DEVICE_ATTR (link_power_management_policy,S_IRUGO |S_IWUSR , +DEVICE_ATTR (link_power_management_policy,S_IRUGO |S_IWUSR , ata_scsi_lpm_show, ata_scsi_lpm_put); -EXPORT_SYMBOL_GPL (class_device_attr_link_power_management_policy); +EXPORT_SYMBOL_GPL (dev_attr_link_power_management_policy);static void ata_scsi_invalid_field (struct scsi_cmnd *cmd,void (*done)(struct scsi_cmnd *))
drivers/base/attribute_container.c +38 -39
245 lines not on this page · raw message
drivers/base/transport_class.c +7 -7
@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(transport_class_unregistatic int anon_transport_dummy_function (struct transport_container *tc,struct device *dev, -struct class_device *cdev) +struct device *cdev) {/* do nothing */ return 0 ;
@@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(anon_transport_class_ustatic int transport_setup_classdev (struct attribute_container *cont,struct device *dev, -struct class_device *classdev) +struct device *classdev) {struct transport_class *tclass =class_to_transport_class (cont->class);struct transport_container *tcont =attribute_container_to_transport_container (cont);
@@ -148,7 +148,7 @@ EXPORT_SYMBOL_GPL(transport_setup_devicestatic int transport_add_class_device (struct attribute_container *cont,struct device *dev, -struct class_device *classdev) +struct device *classdev) {int error =attribute_container_add_class_device (classdev); struct transport_container *tcont =
@@ -180,7 +180,7 @@ EXPORT_SYMBOL_GPL(transport_add_device);static int transport_configure (struct attribute_container *cont,struct device *dev, -struct class_device *cdev) +struct device *cdev) {struct transport_class *tclass =class_to_transport_class (cont->class);struct transport_container *tcont =attribute_container_to_transport_container (cont);
@@ -211,7 +211,7 @@ EXPORT_SYMBOL_GPL(transport_configure_destatic int transport_remove_classdev (struct attribute_container *cont,struct device *dev, -struct class_device *classdev) +struct device *classdev) {struct transport_container *tcont =attribute_container_to_transport_container (cont);
@@ -250,12 +250,12 @@ EXPORT_SYMBOL_GPL(transport_remove_devicstatic void transport_destroy_classdev (struct attribute_container *cont,struct device *dev, -struct class_device *classdev) +struct device *classdev) {struct transport_class *tclass =class_to_transport_class (cont->class);if (tclass->remove != anon_transport_dummy_function) -class_device_put (classdev); +put_device (classdev); }
drivers/infiniband/ulp/srp/ib_srp.c +71 -61
260 lines not on this page · raw message
drivers/infiniband/ulp/srp/ib_srp.h +1 -1
@@ -99,7 +99,7 @@ struct srp_device {struct srp_host {struct srp_device *srp_dev;u8 port; -struct class_device class_dev; +struct device dev;struct list_head target_list;spinlock_t target_lock;struct completion released;
drivers/message/fusion/mptscsih.c +67 -53
239 lines not on this page · raw message
drivers/message/fusion/mptscsih.h +1 -1
@@ -129,4 +129,4 @@ extern void mptscsih_timer_expired(unsigextern int mptscsih_TMHandler (MPT_SCSI_HOST *hd,u8 type,u8 channel,u8 id,int lun,int ctx2abort,ulong timeout);extern u8 mptscsih_raid_id_to_num (MPT_ADAPTER *ioc,u8 channel,u8 id);extern int mptscsih_is_phys_disk (MPT_ADAPTER *ioc,u8 channel,u8 id); -extern struct class_device_attribute *mptscsih_host_attrs[]; +extern struct device_attribute *mptscsih_host_attrs[];
drivers/misc/enclosure.c +64 -54
286 lines not on this page · raw message
drivers/scsi/3w-9xxx.c +5 -4
@@ -140,9 +140,10 @@ static void twa_unmap_scsi_data(TW_Devic/* Functions */ /* Show some statistics about the card */ -static ssize_t twa_show_stats (struct class_device *class_dev,char *buf) +static ssize_t twa_show_stats (struct device *dev, +struct device_attribute *attr,char *buf) { -struct Scsi_Host *host =class_to_shost (class_dev); +struct Scsi_Host *host =class_to_shost (dev);TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata;unsigned long flags =0 ;ssize_t len;
@@ -184,7 +185,7 @@ static int twa_change_queue_depth(struct }/* End twa_change_queue_depth() */ /* Create sysfs 'stats' entry */ -static struct class_device_attribute twa_host_stats_attr = { +static struct device_attribute twa_host_stats_attr = { .attr = { .name ="stats" , .mode =S_IRUGO ,
@@ -193,7 +194,7 @@ static struct class_device_attribute twa };/* Host attributes initializer */ -static struct class_device_attribute *twa_host_attrs[] = { +static struct device_attribute *twa_host_attrs[] = { &twa_host_stats_attr,NULL , };
drivers/scsi/3w-xxxx.c +5 -4
@@ -484,9 +484,10 @@ static void tw_state_request_start(TW_De }/* End tw_state_request_start() */ /* Show some statistics about the card */ -static ssize_t tw_show_stats (struct class_device *class_dev,char *buf) +static ssize_t tw_show_stats (struct device *dev,struct device_attribute *attr, +char *buf) { -struct Scsi_Host *host =class_to_shost (class_dev); +struct Scsi_Host *host =class_to_shost (dev);TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata;unsigned long flags =0 ;ssize_t len;
@@ -528,7 +529,7 @@ static int tw_change_queue_depth(struct }/* End tw_change_queue_depth() */ /* Create sysfs 'stats' entry */ -static struct class_device_attribute tw_host_stats_attr = { +static struct device_attribute tw_host_stats_attr = { .attr = { .name ="stats" , .mode =S_IRUGO ,
@@ -537,7 +538,7 @@ static struct class_device_attribute tw_ };/* Host attributes initializer */ -static struct class_device_attribute *tw_host_attrs[] = { +static struct device_attribute *tw_host_attrs[] = { &tw_host_stats_attr,NULL , };
drivers/scsi/aacraid/aachba.c +1 -1
@@ -1331,7 +1331,7 @@ int aac_get_adapter_info(struct aac_dev* tmp>>24 ,(tmp>>16 )&0xff ,tmp&0xff , le32_to_cpu(dev->adapter_info.biosbuild)); buffer[0 ] ='\0' ; -if (aac_show_serial_number ( +if (aac_get_serial_number (shost_to_class (dev->scsi_host_ptr), buffer))printk (KERN_INFO "%s%d: serial %s" , dev->name, dev->id, buffer);
drivers/scsi/aacraid/aacraid.h +2 -2
@@ -1850,9 +1850,9 @@ int aac_get_containers(struct aac_dev *dint aac_scsi_cmd (struct scsi_cmnd *cmd);int aac_dev_ioctl (struct aac_dev *dev,int cmd,void __user *arg);#ifndef shost_to_class -#define shost_to_class (shost) &shost->shost_classdev +#define shost_to_class (shost) &shost->shost_dev#endif -ssize_t aac_show_serial_number (struct class_device *class_dev,char *buf); +ssize_t aac_get_serial_number (struct device *dev,char *buf);int aac_do_ioctl (struct aac_dev * dev,int cmd,void __user *arg);int aac_rx_init (struct aac_dev *dev);int aac_rkt_init (struct aac_dev *dev);
drivers/scsi/aacraid/linit.c +53 -40
240 lines not on this page · raw message
drivers/scsi/arcmsr/arcmsr.h +2 -2
@@ -44,7 +44,7 @@*/ #include <linux/interrupt.h> -struct class_device_attribute ; +struct device_attribute ;/*The limit of outstanding scsi command that firmware can handle*/ #define ARCMSR_MAX_OUTSTANDING_CMD 256#define ARCMSR_MAX_FREECCB_NUM 320
@@ -556,6 +556,6 @@ struct SENSE_DATAextern void arcmsr_post_ioctldata2iop (struct AdapterControlBlock *);extern void arcmsr_iop_message_read (struct AdapterControlBlock *);extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer (struct AdapterControlBlock *); -extern struct class_device_attribute *arcmsr_host_attrs[]; +extern struct device_attribute *arcmsr_host_attrs[];extern int arcmsr_alloc_sysfs_attr (struct AdapterControlBlock *);void arcmsr_free_sysfs_attr (struct AdapterControlBlock *acb);
drivers/scsi/arcmsr/arcmsr_attr.c +96 -67
277 lines not on this page · raw message
drivers/scsi/ch.c +6 -7
@@ -880,7 +880,7 @@ static long ch_ioctl_compat(struct filestatic int ch_probe (struct device *dev) {struct scsi_device *sd =to_scsi_device (dev); -struct class_device *class_dev; +struct device *class_dev;int minor, ret = -ENOMEM ;scsi_changer *ch;
@@ -909,11 +909,11 @@ static int ch_probe(struct device *dev) ch->minor = minor;sprintf (ch->name,"ch%d" ,ch->minor); - class_dev =class_device_create (ch_sysfs_class,NULL , -MKDEV (SCSI_CHANGER_MAJOR , ch->minor), - dev,"s%s" , ch->name); + class_dev =device_create (ch_sysfs_class, dev, +MKDEV (SCSI_CHANGER_MAJOR ,ch->minor), +"s%s" , ch->name);if (IS_ERR (class_dev)) { -printk (KERN_WARNING "ch%d: class_device_create failed\n" , +printk (KERN_WARNING "ch%d: device_create failed\n" , ch->minor); ret =PTR_ERR (class_dev); goto remove_idr;
@@ -944,8 +944,7 @@ static int ch_remove(struct device *dev)idr_remove (&ch_index_idr, ch->minor);spin_unlock (&ch_index_lock); -class_device_destroy (ch_sysfs_class, -MKDEV (SCSI_CHANGER_MAJOR ,ch->minor)); +device_destroy (ch_sysfs_class,MKDEV (SCSI_CHANGER_MAJOR ,ch->minor));kfree (ch->dt);kfree (ch);return 0 ;
drivers/scsi/hosts.c +17 -17
@@ -43,14 +43,14 @@static int scsi_host_next_hn;/* host_no for next new host */ -static void scsi_host_cls_release (struct class_device *class_dev) +static void scsi_host_cls_release (struct device *dev) { -put_device (&class_to_shost (class_dev)->shost_gendev); +put_device (&class_to_shost (dev)->shost_gendev); }static struct class shost_class = { .name ="scsi_host" , - .release = scsi_host_cls_release, + .dev_release = scsi_host_cls_release, };/**
@@ -174,7 +174,7 @@ void scsi_remove_host(struct Scsi_Host *spin_unlock_irqrestore (shost->host_lock, flags);transport_unregister_device (&shost->shost_gendev); -class_device_unregister (&shost->shost_classdev); +device_unregister (&shost->shost_dev);device_del (&shost->shost_gendev);scsi_proc_hostdir_rm (shost->hostt); }
@@ -212,7 +212,7 @@ int scsi_add_host(struct Scsi_Host *shosscsi_host_set_state (shost,SHOST_RUNNING );get_device (shost->shost_gendev.parent); - error =class_device_add (&shost->shost_classdev); + error =device_add (&shost->shost_dev);if (error) goto out_del_gendev;
@@ -221,7 +221,7 @@ int scsi_add_host(struct Scsi_Host *shosif (shost->transportt->host_size && (shost->shost_data =kzalloc (shost->transportt->host_size,GFP_KERNEL )) ==NULL ) - goto out_del_classdev; + goto out_del_dev;if (shost->transportt->create_work_queue) { snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d",
@@ -244,8 +244,8 @@ int scsi_add_host(struct Scsi_Host *shosdestroy_workqueue (shost->work_q); out_free_shost_data:kfree (shost->shost_data); - out_del_classdev: -class_device_del (&shost->shost_classdev); + out_del_dev: +device_del (&shost->shost_dev); out_del_gendev:device_del (&shost->shost_gendev); out:
@@ -380,11 +380,11 @@ struct Scsi_Host *scsi_host_alloc(struct shost->host_no); shost->shost_gendev.release = scsi_host_dev_release; -class_device_initialize (&shost->shost_classdev); - shost->shost_classdev.dev = &shost->shost_gendev; - shost->shost_classdev.class = &shost_class; -snprintf (shost->shost_classdev.class_id,BUS_ID_SIZE ,"host%d" , - shost->host_no); +device_initialize (&shost->shost_dev); + shost->shost_dev.parent = &shost->shost_gendev; + shost->shost_dev.class = &shost_class; +snprintf (shost->shost_dev.bus_id,BUS_ID_SIZE ,"host%d" , + shost->host_no); shost->ehandler =kthread_run (scsi_error_handler, shost,"scsi_eh_%d" , shost->host_no);
@@ -427,12 +427,12 @@ void scsi_unregister(struct Scsi_Host *s }EXPORT_SYMBOL (scsi_unregister); -static int __scsi_host_match (struct class_device *cdev,void *data) +static int __scsi_host_match (struct device *dev,void *data) {struct Scsi_Host *p;unsigned short *hostnum = (unsigned short *)data; - p =class_to_shost (cdev); + p =class_to_shost (dev);return p->host_no == *hostnum; }
@@ -445,10 +445,10 @@ static int __scsi_host_match(struct clas**/ struct Scsi_Host *scsi_host_lookup (unsigned short hostnum) { -struct class_device *cdev; +struct device *cdev;struct Scsi_Host *shost =ERR_PTR (-ENXIO ); - cdev =class_find_child (&shost_class, &hostnum, __scsi_host_match); + cdev =class_find_device (&shost_class, &hostnum, __scsi_host_match);if (cdev) shost =scsi_host_get (class_to_shost (cdev));
drivers/scsi/hptiop.c +8 -6
@@ -857,14 +857,16 @@ static int hptiop_adjust_disk_queue_deptreturn queue_depth; } -static ssize_t hptiop_show_version (struct class_device *class_dev,char *buf) +static ssize_t hptiop_show_version (struct device *dev, +struct device_attribute *attr,char *buf) {return snprintf (buf,PAGE_SIZE ,"%s\n" , driver_ver); } -static ssize_t hptiop_show_fw_version (struct class_device *class_dev,char *buf) +static ssize_t hptiop_show_fw_version (struct device *dev, +struct device_attribute *attr,char *buf) { -struct Scsi_Host *host =class_to_shost (class_dev); +struct Scsi_Host *host =class_to_shost (dev);struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
@@ -874,7 +876,7 @@ static ssize_t hptiop_show_fw_version(st hba->firmware_version & 0xff); } -static struct class_device_attribute hptiop_attr_version = { +static struct device_attribute hptiop_attr_version = { .attr = { .name ="driver-version" , .mode =S_IRUGO ,
@@ -882,7 +884,7 @@ static struct class_device_attribute hpt .show = hptiop_show_version, }; -static struct class_device_attribute hptiop_attr_fw_version = { +static struct device_attribute hptiop_attr_fw_version = { .attr = { .name ="firmware-version" , .mode =S_IRUGO ,
@@ -890,7 +892,7 @@ static struct class_device_attribute hpt .show = hptiop_show_fw_version, }; -static struct class_device_attribute *hptiop_attrs[] = { +static struct device_attribute *hptiop_attrs[] = { &hptiop_attr_version, &hptiop_attr_fw_version,NULL
drivers/scsi/ibmvscsi/ibmvscsi.c +25 -19
130 lines not on this page · raw message
drivers/scsi/ibmvscsi/ibmvstgt.c +15 -12
@@ -780,32 +780,35 @@ static int ibmvstgt_it_nexus_response(streturn 0 ; } -static ssize_t system_id_show (struct class_device *cdev,char *buf) +static ssize_t system_id_show (struct device *dev, +struct device_attribute *attr,char *buf) {return snprintf (buf,PAGE_SIZE ,"%s\n" , system_id); } -static ssize_t partition_number_show (struct class_device *cdev,char *buf) +static ssize_t partition_number_show (struct device *dev, +struct device_attribute *attr,char *buf) {return snprintf (buf,PAGE_SIZE ,"%x\n" , partition_number); } -static ssize_t unit_address_show (struct class_device *cdev,char *buf) +static ssize_t unit_address_show (struct device *dev, +struct device_attribute *attr,char *buf) { -struct Scsi_Host *shost =class_to_shost (cdev); +struct Scsi_Host *shost =class_to_shost (dev);struct srp_target *target =host_to_srp_target (shost);struct vio_port *vport =target_to_port (target);return snprintf (buf,PAGE_SIZE ,"%x\n" , vport->dma_dev->unit_address); } -static CLASS_DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL); -static CLASS_DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL); -static CLASS_DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL); - -static struct class_device_attribute *ibmvstgt_attrs[] = { - &class_device_attr_system_id, - &class_device_attr_partition_number, - &class_device_attr_unit_address, +static DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL); +static DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL); +static DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL); + +static struct device_attribute *ibmvstgt_attrs[] = { + &dev_attr_system_id, + &dev_attr_partition_number, + &dev_attr_unit_address,NULL , };
drivers/scsi/ipr.c +75 -65
358 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_attr.c +256 -226
506 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_crtn.h +2 -2
Lines of this file are not shown. View the raw message.
drivers/scsi/megaraid/megaraid_mbox.c +7 -6
Lines of this file are not shown. View the raw message.
drivers/scsi/ncr53c8xx.c +4 -3
Lines of this file are not shown. View the raw message.
drivers/scsi/osst.c +39 -37
76 lines not on this page · raw message
drivers/scsi/pcmcia/sym53c500_cs.c +8 -6
Lines of this file are not shown. View the raw message.
drivers/scsi/qla2xxx/qla_attr.c +96 -81
177 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_gbl.h +2 -2
Lines of this file are not shown. View the raw message.
drivers/scsi/raid_class.c +37 -36
73 lines not on this page · raw message
drivers/scsi/scsi_sas_internal.h +12 -12
Lines of this file are not shown. View the raw message.
drivers/scsi/scsi_sysfs.c +85 -65
150 lines not on this page · raw message
drivers/scsi/scsi_transport_fc.c +208 -177
385 lines not on this page · raw message
drivers/scsi/scsi_transport_iscsi.c +55 -52
107 lines not on this page · raw message
drivers/scsi/scsi_transport_sas.c +88 -69
157 lines not on this page · raw message
drivers/scsi/scsi_transport_spi.c +98 -87
185 lines not on this page · raw message
drivers/scsi/scsi_transport_srp.c +14 -12
Lines of this file are not shown. View the raw message.
drivers/scsi/sd.c +44 -34
78 lines not on this page · raw message
drivers/scsi/ses.c +14 -14
Lines of this file are not shown. View the raw message.
drivers/scsi/sg.c +18 -18
Lines of this file are not shown. View the raw message.
drivers/scsi/st.c +38 -33
71 lines not on this page · raw message
include/linux/attribute_container.h +14 -14
Lines of this file are not shown. View the raw message.
include/linux/bsg.h +1 -1
Lines of this file are not shown. View the raw message.
include/linux/enclosure.h +6 -5
Lines of this file are not shown. View the raw message.
include/linux/libata.h +1 -1
Lines of this file are not shown. View the raw message.
include/linux/raid_class.h +6 -6
Lines of this file are not shown. View the raw message.
include/linux/transport_class.h +3 -3
Lines of this file are not shown. View the raw message.
include/scsi/scsi_device.h +5 -5
Lines of this file are not shown. View the raw message.
include/scsi/scsi_host.h +3 -4
Lines of this file are not shown. View the raw message.
include/scsi/scsi_transport.h +1 -1
Lines of this file are not shown. View the raw message.
include/scsi/scsi_transport_fc.h +7 -7
Lines of this file are not shown. View the raw message.
include/scsi/scsi_transport_sas.h +6 -6
Lines of this file are not shown. View the raw message.
include/scsi/sd.h +2 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 7 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
Quoted 6 lines
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
After this, all of the
class_devicecode is now finally gone from the kernel!
Unfortunately, it doesn't apply cleanly to the current scsi-misc tree. I've modified it so that it actually compiles.
Good that you've sent it; now I can finally push my scsi target rework patches.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg)
From: Tony Jones <[email protected]>
Subject: SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller...
--- block/bsg.c | 11 +- drivers/ata/ahci.c | 4 +- drivers/ata/libata-scsi.c | 15 +- drivers/base/attribute_container.c | 77 +++--- drivers/base/transport_class.c | 14 +- drivers/infiniband/ulp/srp/ib_srp.c | 134 +++++----- drivers/infiniband/ulp/srp/ib_srp.h | 2 +- drivers/message/fusion/mptscsih.c | 122 +++++---- drivers/message/fusion/mptscsih.h | 2 +- drivers/misc/enclosure.c | 118 +++++---- drivers/scsi/3w-9xxx.c | 9 +- drivers/scsi/3w-xxxx.c | 9 +- drivers/scsi/aacraid/aachba.c | 2 +- drivers/scsi/aacraid/aacraid.h | 4 +- drivers/scsi/aacraid/linit.c | 93 ++++--- drivers/scsi/arcmsr/arcmsr.h | 4 +- drivers/scsi/arcmsr/arcmsr_attr.c | 163 +++++++----- drivers/scsi/ch.c | 13 +- drivers/scsi/hosts.c | 34 ++-- drivers/scsi/hptiop.c | 14 +- drivers/scsi/ibmvscsi/ibmvscsi.c | 44 ++-- drivers/scsi/ibmvscsi/ibmvstgt.c | 25 +- drivers/scsi/ipr.c | 140 +++++----- drivers/scsi/lpfc/lpfc_attr.c | 484 +++++++++++++++++--------------- drivers/scsi/lpfc/lpfc_crtn.h | 4 +- drivers/scsi/megaraid/megaraid_mbox.c | 13 +- drivers/scsi/ncr53c8xx.c | 7 +- drivers/scsi/osst.c | 76 +++--- drivers/scsi/pcmcia/sym53c500_cs.c | 14 +- drivers/scsi/qla2xxx/qla_attr.c | 177 +++++++------ drivers/scsi/qla2xxx/qla_gbl.h | 4 +- drivers/scsi/raid_class.c | 73 +++--- drivers/scsi/scsi_sas_internal.h | 24 +- drivers/scsi/scsi_sysfs.c | 150 ++++++----- drivers/scsi/scsi_transport_fc.c | 385 ++++++++++++++------------ drivers/scsi/scsi_transport_iscsi.c | 107 ++++---- drivers/scsi/scsi_transport_sas.c | 157 ++++++----- drivers/scsi/scsi_transport_spi.c | 185 +++++++------ drivers/scsi/scsi_transport_srp.c | 26 +- drivers/scsi/sd.c | 78 +++--- drivers/scsi/ses.c | 28 +- drivers/scsi/sg.c | 36 ++-- drivers/scsi/st.c | 83 +++--- include/linux/attribute_container.h | 28 +- include/linux/bsg.h | 2 +- include/linux/enclosure.h | 11 +- include/linux/libata.h | 2 +- include/linux/raid_class.h | 12 +- include/linux/transport_class.h | 6 +- include/scsi/scsi_device.h | 10 +- include/scsi/scsi_host.h | 7 +- include/scsi/scsi_transport.h | 2 +- include/scsi/scsi_transport_fc.h | 14 +- include/scsi/scsi_transport_sas.h | 12 +- include/scsi/sd.h | 4 +- 55 files changed, 1763 insertions(+), 1511 deletions(-)
James Bottomley
maintainerQuoted 7 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
Quoted 5 lines
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
After this, all of the
class_devicecode is now finally gone from the kernel!
Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
Since the patch is separable, it's probably best to take it through the SCSI tree ... including the infiniband bits that depend on the iser/iscsi transport classes. You can give the rest of the infiniband pieces to roland, since he's got a nasty set of clashes with the __FUNCTION__->__func__ conversion which I don't want to be responsible for.
James
James Bottomley
maintainerQuoted 11 lines · James Bottomley
Quoted 10 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
Quoted 7 lines
Quoted 2 lines
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
OK, I looked at converting ses and enclosure, but it looks impossible given the way you've set all of this up (and at the moment it's almost non functional).
What it wants is for the enclosure and component devices to be arranged hierarchically under the enclosure class and then the device link of the components to be populated if they're actually present (which they might not be).
Given the fact that you've chosen to have dev->parent point to the device the original class_device->dev was pointing to, there's almost no way left to express this relationship. We can do it by having kobj->parent point to the enclosure and dev->parent point to the enclosed device, but I can't encapsulate that information into a struct device alone.
Quoted 1 line
From an interface point of view, this dual use of the parent pointer
looks a bit nasty ... and you have some fun code to prove the point in drivers/base/core.c:get_device_parent()
How about just adding a struct device *peer; entry to struct device and using it to express the former class relationship? That way we can do all the parenting stuff correctly.
Otherwise, I'm going to need something like a device_add_class_parent() API that allows me to add these former class devices and set up the kobject parent correctly.
James
Quoted 40 lines · James Bottomley
Quoted 11 lines · James Bottomley
Quoted 10 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
Quoted 7 lines
Quoted 2 lines
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
OK, I looked at converting ses and enclosure, but it looks impossible given the way you've set all of this up (and at the moment it's almost non functional).
What it wants is for the enclosure and component devices to be arranged hierarchically under the enclosure class and then the device link of the components to be populated if they're actually present (which they might not be).
Given the fact that you've chosen to have
dev->parentpoint to the device the originalclass_device->devwas pointing to, there's almost no way left to express this relationship. We can do it by havingkobj->parentpoint to the enclosure anddev->parentpoint to the enclosed device, but I can't encapsulate that information into a struct device alone.Quoted 1 line
From an interface point of view, this dual use of the parent pointer
looks a bit nasty ... and you have some fun code to prove the point in drivers/base/core.c:get_device_parent()
Quoted 7 lines
How about just adding a struct device *peer; entry to struct device and using it to express the former class relationship? That way we can do all the parenting stuff correctly.
Otherwise, I'm going to need something like a
device_add_class_parent()API that allows me to add these former class devices and set up the kobject parent correctly.
Unfortunately, the enclosure/enclusure-component/component-device relationship is not a tree. There is only a single "parent" for a device. The "device" link already expresses the parent device, and the class devices will show up as childs of the devices, where the "device" link pointed to. There can't be a second device which could be used as a parent.
A sysfs class device hierarchy, and at the same let the "device" link point to a different device is not supported. Existing userspace tools do not support that.
We have a similar problem for raid block devices, which can't be expressed in a single device tree. The "reverse tree" is constructed by custom holders/ slave/ directories at the devices.
I suggest to express the relationship of the enclosure components to the enclosure device by custom symlinks, instead of expecting a "device" link maintained by the core to build a "reverse tree".
Would that work?
Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 49 lines · Kay Sievers
Quoted 40 lines · James Bottomley
Quoted 11 lines · James Bottomley
Quoted 10 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
Quoted 7 lines
Quoted 2 lines
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
OK, I looked at converting ses and enclosure, but it looks impossible given the way you've set all of this up (and at the moment it's almost non functional).
What it wants is for the enclosure and component devices to be arranged hierarchically under the enclosure class and then the device link of the components to be populated if they're actually present (which they might not be).
Given the fact that you've chosen to have
dev->parentpoint to the device the originalclass_device->devwas pointing to, there's almost no way left to express this relationship. We can do it by havingkobj->parentpoint to the enclosure anddev->parentpoint to the enclosed device, but I can't encapsulate that information into a struct device alone.Quoted 1 line
From an interface point of view, this dual use of the parent pointer
looks a bit nasty ... and you have some fun code to prove the point in drivers/base/core.c:get_device_parent()
Quoted 7 lines
How about just adding a struct device *peer; entry to struct device and using it to express the former class relationship? That way we can do all the parenting stuff correctly.
Otherwise, I'm going to need something like a
device_add_class_parent()API that allows me to add these former class devices and set up the kobject parent correctly.
Quoted 6 lines
Unfortunately, the enclosure/enclusure-component/component-device relationship is not a tree. There is only a single "parent" for a device. The "device" link already expresses the parent device, and the class devices will show up as childs of the devices, where the "device" link pointed to. There can't be a second device which could be used as a parent.
But that's precisely my point: it is a tree; it's not a multi rooted tree either. Each enclosure has a fixed number of components (the bays in the enclosure) that's a simple two level tree. However, both the enclosure and the components may point to devices in the regular tree (bays only if the bay is actually populated).
This was formerly representable in the class_device infrastructure, because class devices were allowed to have parents. Class devices are supposed to represent interfaces to devices and not all interfaces are fully flat.
Quoted 8 lines
A sysfs class device hierarchy, and at the same let the "device" link point to a different device is not supported. Existing userspace tools do not support that.
We have a similar problem for raid block devices, which can't be expressed in a single device tree. The "reverse tree" is constructed by custom holders/ slave/ directories at the devices.
Quoted 5 lines
I suggest to express the relationship of the enclosure components to the enclosure device by custom symlinks, instead of expecting a "device" link maintained by the core to build a "reverse tree".
Would that work?
There are still several problems with the symlink approach; not least of which is that the component namespace isn't globally unique, it's only unique to the enclosure: If you have two separate enclosures connected, they're likely each going to have a component called slot1 (the name is actually take from the enclosure). I also think we're going to have difficulty going back from a component to an enclosure, which was pretty much the whole point of the exercise but I need to get ses/enclosure actually working to look at that.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 57 lines · James Bottomley
Quoted 49 lines · Kay Sievers
Quoted 40 lines · James Bottomley
Quoted 11 lines · James Bottomley
Quoted 10 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
Quoted 7 lines
Quoted 2 lines
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
OK, I looked at converting ses and enclosure, but it looks impossible given the way you've set all of this up (and at the moment it's almost non functional).
What it wants is for the enclosure and component devices to be arranged hierarchically under the enclosure class and then the device link of the components to be populated if they're actually present (which they might not be).
Given the fact that you've chosen to have
dev->parentpoint to the device the originalclass_device->devwas pointing to, there's almost no way left to express this relationship. We can do it by havingkobj->parentpoint to the enclosure anddev->parentpoint to the enclosed device, but I can't encapsulate that information into a struct device alone.Quoted 1 line
From an interface point of view, this dual use of the parent pointer
looks a bit nasty ... and you have some fun code to prove the point in drivers/base/core.c:get_device_parent()
Quoted 7 lines
How about just adding a struct device *peer; entry to struct device and using it to express the former class relationship? That way we can do all the parenting stuff correctly.
Otherwise, I'm going to need something like a
device_add_class_parent()API that allows me to add these former class devices and set up the kobject parent correctly.Quoted 6 lines
Unfortunately, the enclosure/enclusure-component/component-device relationship is not a tree. There is only a single "parent" for a device. The "device" link already expresses the parent device, and the class devices will show up as childs of the devices, where the "device" link pointed to. There can't be a second device which could be used as a parent.
Quoted 2 lines
But that's precisely my point: it is a tree; it's not a multi rooted tree either.
Hmm, the enclosure components have two parents in this model, the enclosure itself _and_ the scsi device, so it's not a flat tree anymore.
Quoted 2 lines
Each enclosure has a fixed number of components (the bays
in the enclosure) that's a simple two level tree.
I think it's not a second level, it's a second tree if you have two parents for one single node. The driver core only supports one flat device tree, and one parent relationship per device.
Quoted 3 lines
However, both the
enclosure and the components may point to devices in the regular tree (bays only if the bay is actually populated).
Sure, that's fine, but still, the component can have only one parent managed by the core, we have only one single device tree
at /sys/devices/ and other relations should be expressed by the driver itself.
Quoted 2 lines
This was formerly representable in the
class_deviceinfrastructure, because class devices were allowed to have parents.
The "parent" field was something Greg added for trying to represent "input", and it failed, existing userspace logic could not handle it, and we immediately deprecated hierarchies in /sys/class. It was never supposed to be used with the "dev" field pointing to a different device at the same time.
As documented in Documentation/, all this "device" link magic we are talking about, will only work in SYSFS_DEPRECATED=y mode anyway, which no recent distro uses anymore, and the enclosure stuff was added long after that.
Quoted 2 lines
Class devices are
supposed to represent interfaces to devices
That's not true. Class devices are just devices, as documented in the Documentation/ directory. Class devices are _not_ supposed to be anything special, they just don't have drivers/binding in the kernel internals - no other difference. There is no such thing as an "interface" in the driver core or sysfs. Every device _is_ the interface itself, otherwise devices would have no functional sysfs attributes.
It was one of the biggest mistakes to expose such a kernel implementation details as different entities to userspace, and one reason sysfs is that hard to understand. The guy who did all that just ran away leaving all this mess behind him. :) And yes, we are too slow cleaning all that up, but we will get there over time.
Quoted 2 lines
and not all interfaces are
fully flat.
True, but the core is only one flat tree, the drivers need to express "reverse trees" themselves, just like the raid block devices do.
Quoted 14 lines
Quoted 8 lines
A sysfs class device hierarchy, and at the same let the "device" link point to a different device is not supported. Existing userspace tools do not support that.
We have a similar problem for raid block devices, which can't be expressed in a single device tree. The "reverse tree" is constructed by custom holders/ slave/ directories at the devices.
Quoted 5 lines
I suggest to express the relationship of the enclosure components to the enclosure device by custom symlinks, instead of expecting a "device" link maintained by the core to build a "reverse tree".
Would that work?
Quoted 8 lines
There are still several problems with the symlink approach; not least of which is that the component namespace isn't globally unique, it's only unique to the enclosure: If you have two separate enclosures connected, they're likely each going to have a component called slot1 (the name is actually take from the enclosure). I also think we're going to have difficulty going back from a component to an enclosure, which was pretty much the whole point of the exercise but I need to get ses/enclosure actually working to look at that.
Hmm, I don't understand. The only thing that changed is that you don't have a core-managed "device" link at the enclosure component anymore, nothing else should be different. The namespace issue should be the same as it was before, right?
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 10 lines · Kay Sievers
Quoted 9 lines · James Bottomley
Quoted 7 lines · Kay Sievers
On Fri, 2008-03-14 at 16:20 -0500, James Bottomley wrote:
Unfortunately, the enclosure/enclusure-component/component-device relationship is not a tree. There is only a single "parent" for a device. The "device" link already expresses the parent device, and the class devices will show up as childs of the devices, where the "device" link pointed to. There can't be a second device which could be used as a parent.
Quoted 5 lines
Quoted 2 lines
But that's precisely my point: it is a tree; it's not a multi rooted tree either.
Hmm, the enclosure components have two parents in this model, the enclosure itself _and_ the scsi device, so it's not a flat tree anymore.
Only because you're expressing the class relationship as a parent. It wasn't designed like this; an interface sits off to the side.
Quoted 19 lines
Quoted 2 lines
Each enclosure has a fixed number of components (the bays
in the enclosure) that's a simple two level tree.I think it's not a second level, it's a second tree if you have two parents for one single node. The driver core only supports one flat device tree, and one parent relationship per device.
Quoted 3 lines
However, both the
enclosure and the components may point to devices in the regular tree (bays only if the bay is actually populated).Sure, that's fine, but still, the component can have only one parent managed by the core, we have only one single device tree
at/sys/devices/and other relations should be expressed by the driver itself.Quoted 2 lines
This was formerly representable in the
class_deviceinfrastructure, because class devices were allowed to have parents.
Quoted 9 lines
The "parent" field was something Greg added for trying to represent "input", and it failed, existing userspace logic could not handle it, and we immediately deprecated hierarchies in
/sys/class. It was never supposed to be used with the "dev" field pointing to a different device at the same time.
As documented inDocumentation/, all this "device" link magic we are talking about, will only work in SYSFS_DEPRECATED=y mode anyway, which no recent distro uses anymore, and the enclosure stuff was added long after that.
OK, where is this? There's no mention of any deprecation in Documentation/driver-model; grep -i deprec returns an empty list.
Quoted 5 lines
Quoted 2 lines
Class devices are
supposed to represent interfaces to devicesThat's not true. Class devices are just devices, as documented in the
Documentation/directory.
OK, which kernel is this? The latest greatest upstream merge kernel I know is 2.6.25-rc5-mc6 and that says
Documentation/driver-model/class.txt:
[...]
Each device class defines a set of semantics and a programming interface that devices of that class adhere to. Device drivers are the implementation of that programming interface for a particular device on a particular bus.
The "programming interface" bit seems pretty clear to me.
The whole of SCSI use of the driver model is designed around the interface concept. Essentially, SCSI device represents the generic object that sits on the end of the bus. We export one set of interfaces from the upper layer driver that binds (st, sd, sr etc.) we express another through the SCSI generic, and we express a third (or more) through the transport class interfaces.
In theory, we could express all this as simply additional attribute groups on the generic SCSI device or use a parent/child device relationship for them, or something else ... This is the piece I still don't get from you and Greg. Just saying it isn't an interface any more doesn't help me in this regard.
Quoted 5 lines
Class devices are _not_ supposed to be
anything special, they just don't havedrivers/bindingin the kernel internals - no other difference. There is no such thing as an "interface" in the driver core or sysfs. Every device _is_ the interface itself, otherwise devices would have no functional sysfs attributes.
But if the actual class documentation doesn't say this, how am I supposed to know it? I keep asking what you're planning but I don't get a complete response.
If I had to guess, I'd say eventually you want all classes to fold up under the device directory (hence the parent pointer) and so be part of a continuous tree ... is that it?
Quoted 35 lines
It was one of the biggest mistakes to expose such a kernel implementation details as different entities to userspace, and one reason sysfs is that hard to understand. The guy who did all that just ran away leaving all this mess behind him. :) And yes, we are too slow cleaning all that up, but we will get there over time.
Quoted 2 lines
and not all interfaces are
fully flat.True, but the core is only one flat tree, the drivers need to express "reverse trees" themselves, just like the raid block devices do.
Quoted 14 lines
Quoted 8 lines
A sysfs class device hierarchy, and at the same let the "device" link point to a different device is not supported. Existing userspace tools do not support that.
We have a similar problem for raid block devices, which can't be expressed in a single device tree. The "reverse tree" is constructed by custom holders/ slave/ directories at the devices.
Quoted 5 lines
I suggest to express the relationship of the enclosure components to the enclosure device by custom symlinks, instead of expecting a "device" link maintained by the core to build a "reverse tree".
Would that work?
Quoted 8 lines
There are still several problems with the symlink approach; not least of which is that the component namespace isn't globally unique, it's only unique to the enclosure: If you have two separate enclosures connected, they're likely each going to have a component called slot1 (the name is actually take from the enclosure). I also think we're going to have difficulty going back from a component to an enclosure, which was pretty much the whole point of the exercise but I need to get ses/enclosure actually working to look at that.
Quoted 4 lines
Hmm, I don't understand. The only thing that changed is that you don't have a core-managed "device" link at the enclosure component anymore, nothing else should be different. The namespace issue should be the same as it was before, right?
No, the way you broke it was removing the functioning component link. If you boot now, all components are linked to the enclosure devices, not the component devices ... I can fix this easily, I'm still just trying to figure out how you want it represented.
Quoted 3 lines
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
with a back link in the component device pointing to the enclosure component.
The way components work, probably blowing away enclosure_component_class makes the most sense anyway.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 8 lines · James Bottomley
Quoted 3 lines · Kay Sievers
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
Quoted 8 lines
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
with a back link in the component device pointing to the enclosure component.
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.
OK, so this is the patch doing the above; is this what you had in mind? We're now managing all the links.
James
---
drivers/misc/enclosure.c +71 -29
@@ -31,7 +31,6 @@static LIST_HEAD (container_list);static DEFINE_MUTEX (container_list_lock);static struct class enclosure_class; -static struct class enclosure_component_class;/** * enclosure_find - find an enclosure given a device
@@ -166,6 +165,40 @@ void enclosure_unregister(struct enclosure_device *edev) }EXPORT_SYMBOL_GPL (enclosure_unregister); +#define ENCLOSURE_NAME_SIZE 64 + +static void enclosure_link_name (struct enclosure_component *cdev,char *name) +{ +strcpy (name,"enclosure_device:" ); +strcat (name, cdev->cdev.bus_id); +} + +static void enclosure_remove_links (struct enclosure_component *cdev) +{ +char name[ENCLOSURE_NAME_SIZE ]; + +enclosure_link_name (cdev, name); +sysfs_remove_link (&cdev->dev->kobj, name); +sysfs_remove_link (&cdev->cdev.kobj,"device" ); +} + +static int enclosure_add_links (struct enclosure_component *cdev) +{ +int error; +char name[ENCLOSURE_NAME_SIZE ]; + + error =sysfs_create_link (&cdev->cdev.kobj, &cdev->dev->kobj,"device" ); +if (error) +return error; + +enclosure_link_name (cdev, name); + error =sysfs_create_link (&cdev->dev->kobj, &cdev->cdev.kobj, name); +if (error) +sysfs_remove_link (&cdev->cdev.kobj,"device" ); + +return error; +} +static void enclosure_release (struct device *cdev) {struct enclosure_device *edev =to_enclosure_device (cdev);
@@ -178,10 +211,15 @@ static void enclosure_component_release(struct device *dev) {struct enclosure_component *cdev =to_enclosure_component (dev); -put_device (cdev->dev); +if (cdev->dev) { +enclosure_remove_links (cdev); +put_device (cdev->dev); + }put_device (dev->parent); } +static struct attribute_group *enclosure_groups[]; +/** * enclosure_component_register - add a particular component to an enclosure * @edev: the enclosure to add the component
@@ -217,12 +255,14 @@ enclosure_component_register(struct enclosure_device *edev, ecomp->number = number; cdev = &ecomp->cdev; cdev->parent =get_device (&edev->edev); - cdev->class = &enclosure_component_class;if (name)snprintf (cdev->bus_id,BUS_ID_SIZE ,"%s" , name);else snprintf (cdev->bus_id,BUS_ID_SIZE ,"%u" , number); + cdev->release = enclosure_component_release; + cdev->groups = enclosure_groups; + err =device_register (cdev);if (err)ERR_PTR (err);
@@ -255,10 +295,12 @@ int enclosure_add_device(struct enclosure_device *edev, int component, cdev = &edev->component[component]; -device_del (&cdev->cdev); +if (cdev->dev) +enclosure_remove_links (cdev); +put_device (cdev->dev); cdev->dev =get_device (dev); -return device_add (&cdev->cdev); +return enclosure_add_links (cdev); }EXPORT_SYMBOL_GPL (enclosure_add_device);
@@ -442,24 +484,32 @@ static ssize_t get_component_type(struct device *cdev, } -static struct device_attribute enclosure_component_attrs[] = { -__ATTR (fault,S_IRUGO |S_IWUSR , get_component_fault, - set_component_fault), -__ATTR (status,S_IRUGO |S_IWUSR , get_component_status, - set_component_status), -__ATTR (active,S_IRUGO |S_IWUSR , get_component_active, - set_component_active), -__ATTR (locate,S_IRUGO |S_IWUSR , get_component_locate, - set_component_locate), -__ATTR (type,S_IRUGO , get_component_type,NULL ), - __ATTR_NULL +static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault, + set_component_fault); +static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, get_component_status, + set_component_status); +static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active, + set_component_active); +static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate, + set_component_locate); +static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL); + +static struct attribute *enclosure_component_attrs[] = { + &dev_attr_fault.attr, + &dev_attr_status.attr, + &dev_attr_active.attr, + &dev_attr_locate.attr, + &dev_attr_type.attr, +NULL }; -static struct class enclosure_component_class = { - .name ="enclosure_component" , - .owner =THIS_MODULE , - .dev_attrs = enclosure_component_attrs, - .dev_release = enclosure_component_release, +static struct attribute_group enclosure_group = { + .attrs = enclosure_component_attrs, +}; + +static struct attribute_group *enclosure_groups[] = { + &enclosure_group, +NULL };static int __init enclosure_init (void )
@@ -469,20 +519,12 @@ static int __init enclosure_init(void) err =class_register (&enclosure_class);if (err)return err; - err =class_register (&enclosure_component_class); -if (err) - goto err_out;return 0 ; - err_out: -class_unregister (&enclosure_class); - -return err; } static void __exit enclosure_exit(void) { -class_unregister (&enclosure_component_class);class_unregister (&enclosure_class); }
Quoted 12 lines · James Bottomley
Quoted 11 lines · James Bottomley
Quoted 3 lines · Kay Sievers
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Quoted 8 lines
Quoted 5 lines
with a back link in the component device pointing to the enclosure component.
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.OK, so this is the patch doing the above; is this what you had in mind? We're now managing all the links.
Yeah, that looks fine.
While I in general don't really like the <classname>:<devname> symlinks. One needs to readdir() the whole device directory to find them, which is not nice for a 1:1 relationship link between two devices. I would prefer to be able to find an enclosure component for a LUN by simply looking at:
/sys/bus/scsi/devices/0:0:0:0/enclosure/
instead of searching for that composed link, because one can't predict its name. Can there ever be more than one link from a device to an enclosure?
Also the "device" link, it will work to use that name, I guess, but it has usually a different meaning, as all "device" links are just meaninglessly pointing to the next parent device with !SYSFS_DEPRECATED. With !SYSFS_DEPRECATED <classname>:<devname> links are no longer created for any device, the class device directories just live in a subdirectory with the class name.
Do you prefer the <classname>:<devname>, "device" names?
Thanks,
Kay
Quoted 163 lines
drivers/misc/enclosure.c +71
-26@@ -31,7 +31,6 @@static LIST_HEAD (container_list);static DEFINE_MUTEX (container_list_lock);static struct class enclosure_class; -static struct class enclosure_component_class;/** * enclosure_find - find an enclosure given a device @@ -166,6 +165,40 @@ void enclosure_unregister(struct enclosure_device *edev) }EXPORT_SYMBOL_GPL (enclosure_unregister); +#define ENCLOSURE_NAME_SIZE 64 + +static void enclosure_link_name (struct enclosure_component *cdev,char *name) +{ +strcpy (name,"enclosure_device:" ); +strcat (name, cdev->cdev.bus_id); +} + +static void enclosure_remove_links (struct enclosure_component *cdev) +{ +char name[ENCLOSURE_NAME_SIZE ]; + +enclosure_link_name (cdev, name); +sysfs_remove_link (&cdev->dev->kobj, name); +sysfs_remove_link (&cdev->cdev.kobj,"device" ); +} + +static int enclosure_add_links (struct enclosure_component *cdev) +{ +int error; +char name[ENCLOSURE_NAME_SIZE ]; + + error =sysfs_create_link (&cdev->cdev.kobj, &cdev->dev->kobj,"device" ); +if (error) +return error; + +enclosure_link_name (cdev, name); + error =sysfs_create_link (&cdev->dev->kobj, &cdev->cdev.kobj, name); +if (error) +sysfs_remove_link (&cdev->cdev.kobj,"device" ); + +return error; +} +static void enclosure_release (struct device *cdev) {struct enclosure_device *edev =to_enclosure_device (cdev);@@ -178,10 +211,15 @@ static void enclosure_component_release(struct device *dev) {struct enclosure_component *cdev =to_enclosure_component (dev); -put_device (cdev->dev); +if (cdev->dev) { +enclosure_remove_links (cdev); +put_device (cdev->dev); + }put_device (dev->parent); } +static struct attribute_group *enclosure_groups[]; +/** * enclosure_component_register - add a particular component to an enclosure * @edev: the enclosure to add the component @@ -217,12 +255,14 @@ enclosure_component_register(struct enclosure_device *edev, ecomp->number = number; cdev = &ecomp->cdev; cdev->parent =get_device (&edev->edev); - cdev->class = &enclosure_component_class;if (name)snprintf (cdev->bus_id,BUS_ID_SIZE ,"%s" , name);else snprintf (cdev->bus_id,BUS_ID_SIZE ,"%u" , number); + cdev->release = enclosure_component_release; + cdev->groups = enclosure_groups; + err =device_register (cdev);if (err)ERR_PTR (err);@@ -255,10 +295,12 @@ int enclosure_add_device(struct enclosure_device *edev, int component, cdev = &edev->component[component]; -device_del (&cdev->cdev); +if (cdev->dev) +enclosure_remove_links (cdev); +put_device (cdev->dev); cdev->dev =get_device (dev); -return device_add (&cdev->cdev); +return enclosure_add_links (cdev); }EXPORT_SYMBOL_GPL (enclosure_add_device);@@ -442,24 +484,32 @@ static ssize_t get_component_type(struct device *cdev, } -static struct device_attribute enclosure_component_attrs[] = { -__ATTR (fault,S_IRUGO |S_IWUSR , get_component_fault, - set_component_fault), -__ATTR (status,S_IRUGO |S_IWUSR , get_component_status, - set_component_status), -__ATTR (active,S_IRUGO |S_IWUSR , get_component_active, - set_component_active), -__ATTR (locate,S_IRUGO |S_IWUSR , get_component_locate, - set_component_locate), -__ATTR (type,S_IRUGO , get_component_type,NULL ), - __ATTR_NULL +static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault, + set_component_fault); +static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, get_component_status, + set_component_status); +static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active, + set_component_active); +static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate, + set_component_locate); +static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL); + +static struct attribute *enclosure_component_attrs[] = { + &dev_attr_fault.attr, + &dev_attr_status.attr, + &dev_attr_active.attr, + &dev_attr_locate.attr, + &dev_attr_type.attr, +NULL }; -static struct class enclosure_component_class = { - .name ="enclosure_component" , - .owner =THIS_MODULE , - .dev_attrs = enclosure_component_attrs, - .dev_release = enclosure_component_release, +static struct attribute_group enclosure_group = { + .attrs = enclosure_component_attrs, +}; + +static struct attribute_group *enclosure_groups[] = { + &enclosure_group, +NULL };static int __init enclosure_init (void )@@ -469,20 +519,12 @@ static int __init enclosure_init(void) err =class_register (&enclosure_class);if (err)return err; - err =class_register (&enclosure_component_class); -if (err) - goto err_out;return 0 ; - err_out: -class_unregister (&enclosure_class);
drivers/misc/enclosure.c static int __init enclosure_init(void) · line 530
Quoted 10 lines
drivers/misc/enclosure.c +0
-3- -return err; } static void __exit enclosure_exit(void) { -class_unregister (&enclosure_component_class);class_unregister (&enclosure_class); }
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 34 lines · Kay Sievers
Quoted 12 lines · James Bottomley
Quoted 11 lines · James Bottomley
Quoted 3 lines · Kay Sievers
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Quoted 8 lines
Quoted 5 lines
with a back link in the component device pointing to the enclosure component.
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.OK, so this is the patch doing the above; is this what you had in mind? We're now managing all the links.
Yeah, that looks fine.
While I in general don't really like the <classname>:<devname> symlinks. One needs to
readdir()the whole device directory to find them, which is not nice for a 1:1 relationship link between two devices. I would prefer to be able to find an enclosure component for a LUN by simply looking at:
/sys/bus/scsi/devices/0:0:0:0/enclosure/
instead of searching for that composed link, because one can't predict its name. Can there ever be more than one link from a device to an enclosure?
Quoted 6 lines
Also the "device" link, it will work to use that name, I guess, but it has usually a different meaning, as all "device" links are just meaninglessly pointing to the next parent device with !SYSFS_DEPRECATED. With !SYSFS_DEPRECATED <classname>:<devname> links are no longer created for any device, the class device directories just live in a subdirectory with the class name.
Right, but we can't do that with enclosure components, otherwise it really will be a multi rooted tree.
Quoted 1 line
Do you prefer the <classname>:<devname>, "device" names?
I'm not wedded to the name. I like the backlink because it tells me where a device is in the enclosure when I look at it, but it could be called anything. I chose those names to match what's in 2.6.24, but I suppose there aren't very many users yet, since it was new functionality in 2.6.24.
If the backlink were called "enclosure_component", that would probably be fine. Not sure I have a better name than "device" for the actual device in the enclosure slot, though.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · James Bottomley
If the backlink were called "
enclosure_component", that would probably be fine. Not sure I have a better name than "device" for the actual device in the enclosure slot, though.
enclosed_device
or enclosed/<bus_id> if it is a 1:n relationship
Signature · 3 lines
Stefan Richter -=====-==--- --== -==== http://arcgraph.de/sr/
Quoted 11 lines · James Bottomley
Quoted 10 lines · Kay Sievers
Quoted 9 lines · James Bottomley
Quoted 7 lines · Kay Sievers
On Fri, 2008-03-14 at 16:20 -0500, James Bottomley wrote:
Unfortunately, the enclosure/enclusure-component/component-device relationship is not a tree. There is only a single "parent" for a device. The "device" link already expresses the parent device, and the class devices will show up as childs of the devices, where the "device" link pointed to. There can't be a second device which could be used as a parent.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
But that's precisely my point: it is a tree; it's not a multi rooted tree either.
Hmm, the enclosure components have two parents in this model, the enclosure itself _and_ the scsi device, so it's not a flat tree anymore.
Only because you're expressing the class relationship as a parent.
It's that way forever. There are no hierarchies in /sys/class, no existing tool supports that, or plans to support it, and the "device" link was always the single parent of a class device, or it had no parent at all.
Quoted 1 line
It wasn't designed like this; an interface sits off to the side.
No, that's the way SCSI thinks it works, and unfortunately just duplicates real devices in the class directory. Class scsi_device- and scsi_host-devices are just 1:1 mirrors of the real bus devices. It just makes things far more complicated than needed. There is no such thing as "off the side interface" in the driver model or in sysfs, we just have "devices".
Quoted 29 lines
Quoted 19 lines
Quoted 2 lines
Each enclosure has a fixed number of components (the bays
in the enclosure) that's a simple two level tree.I think it's not a second level, it's a second tree if you have two parents for one single node. The driver core only supports one flat device tree, and one parent relationship per device.
Quoted 3 lines
However, both the
enclosure and the components may point to devices in the regular tree (bays only if the bay is actually populated).Sure, that's fine, but still, the component can have only one parent managed by the core, we have only one single device tree
at/sys/devices/and other relations should be expressed by the driver itself.Quoted 2 lines
This was formerly representable in the
class_deviceinfrastructure, because class devices were allowed to have parents.Quoted 9 lines
The "parent" field was something Greg added for trying to represent "input", and it failed, existing userspace logic could not handle it, and we immediately deprecated hierarchies in
/sys/class. It was never supposed to be used with the "dev" field pointing to a different device at the same time.
As documented inDocumentation/, all this "device" link magic we are talking about, will only work in SYSFS_DEPRECATED=y mode anyway, which no recent distro uses anymore, and the enclosure stuff was added long after that.
Quoted 2 lines
OK, where is this? There's no mention of any deprecation in
Documentation/driver-model; grep -i deprec returns an empty list.
Documentation/sysfs-rules.txt
"- devices are only "devices"
There is no such thing like class-, bus-, physical devices, interfaces, and such that you can rely on in userspace. Everything is just simply a "device". Class-, bus-, physical, ... types are just kernel implementation details which should not be expected by applications that look for devices in sysfs."
"- Hierarchy in a single device tree
There is only one valid place in sysfs where hierarchy can be examined and this is below: /sys/devices.
It is planned that all device directories will end up in the tree below this directory."
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Class devices are
supposed to represent interfaces to devicesThat's not true. Class devices are just devices, as documented in the
Documentation/directory.OK, which kernel is this? The latest greatest upstream merge kernel I know is 2.6.25-rc5-mc6 and that says
Since some releases. We talked about these plans and the way SCSI does it in person at FreedomHEC.
The driver model is just too complicated, we are cleaning that up step by step, and the completely inconsistent "class devices are interfaces" idea will completely go away. Sure, there will be symlinks preserving the old interfaces/behavior.
Quoted 7 lines
Documentation/driver-model/class.txt:
[...]
Each device class defines a set of semantics and a programming interface that devices of that class adhere to. Device drivers are the implementation of that programming interface for a particular device on a particular bus.
Quoted 8 lines
The "programming interface" bit seems pretty clear to me.
The whole of SCSI use of the driver model is designed around the interface concept. Essentially, SCSI device represents the generic object that sits on the end of the bus. We export one set of interfaces from the upper layer driver that binds (st, sd, sr etc.) we express another through the SCSI generic, and we express a third (or more) through the transport class interfaces.
Sure, that all makes sense. All what I say, is that we can't have two driver core parents for the same device, which is only the case for enclosure, not for all the other stuff you mention. To express the second parent is the responsibility of the driver itself, not to be done by the core.
Quoted 5 lines
In theory, we could express all this as simply additional attribute groups on the generic SCSI device or use a parent/child device relationship for them, or something else ... This is the piece I still don't get from you and Greg. Just saying it isn't an interface any more doesn't help me in this regard.
We talked about this extensively at LFS a few weeks ago. And Hannes gave a whole talk about that. What does a 1:1 mirror of the same device, other than having just doubled the number of devices, do good for us? Nothing but make it complicated to find information.
SCSI bus devices have functional attributes on their own, so it's completely inconsistent to split off _some_ of the functionality off to a second "mirror device" and call that an "interface".
We have a SCSI target and host in the /sys/devices/ tree already, there is no reason to mirror anything in a class scsi_device, same for the scsi_host. Really, that "interface to a device" idea must die, it never existed in the kernel code, only in some very confusing "documentation", which will be replaced pretty soon.
Quoted 9 lines
Quoted 5 lines
Class devices are _not_ supposed to be
anything special, they just don't havedrivers/bindingin the kernel internals - no other difference. There is no such thing as an "interface" in the driver core or sysfs. Every device _is_ the interface itself, otherwise devices would have no functional sysfs attributes.But if the actual class documentation doesn't say this, how am I supposed to know it? I keep asking what you're planning but I don't get a complete response.
I completely agree, its not as it should be. We talked about that problem in person several times though, but there is no decent documentation to read, only the sysfs-rules file.
Quoted 3 lines
If I had to guess, I'd say eventually you want all classes to fold up under the device directory (hence the parent pointer) and so be part of a continuous tree ... is that it?
There will be no "device" link with any meaning with !SYSFS_DEPRECATED, only a single tree expressing _all_ core hierarchy, and flat classification symlinks (/sys/bus,class) to lookup the devices in the single device tree. In the end, there will be no bus or class device differences any userspace app would need to care about.
Quoted 35 lines
Quoted 35 lines
It was one of the biggest mistakes to expose such a kernel implementation details as different entities to userspace, and one reason sysfs is that hard to understand. The guy who did all that just ran away leaving all this mess behind him. :) And yes, we are too slow cleaning all that up, but we will get there over time.
Quoted 2 lines
and not all interfaces are
fully flat.True, but the core is only one flat tree, the drivers need to express "reverse trees" themselves, just like the raid block devices do.
Quoted 22 lines
Quoted 8 lines
A sysfs class device hierarchy, and at the same let the "device" link point to a different device is not supported. Existing userspace tools do not support that.
We have a similar problem for raid block devices, which can't be expressed in a single device tree. The "reverse tree" is constructed by custom holders/ slave/ directories at the devices.
Quoted 5 lines
I suggest to express the relationship of the enclosure components to the enclosure device by custom symlinks, instead of expecting a "device" link maintained by the core to build a "reverse tree".
Would that work?
There are still several problems with the symlink approach; not least of which is that the component namespace isn't globally unique, it's only unique to the enclosure: If you have two separate enclosures connected, they're likely each going to have a component called slot1 (the name is actually take from the enclosure). I also think we're going to have difficulty going back from a component to an enclosure, which was pretty much the whole point of the exercise but I need to get ses/enclosure actually working to look at that.
Quoted 6 lines
Quoted 4 lines
Hmm, I don't understand. The only thing that changed is that you don't have a core-managed "device" link at the enclosure component anymore, nothing else should be different. The namespace issue should be the same as it was before, right?
No, the way you broke it was removing the functioning component link.
No, enclosure used the core in a way it isn't supposed to work. As we have no opaque structures in the kernel, we have no way to prevent anyone from assigning something to a pointer in a core structure, but that does not make it work as expected.
Even before this patch, it didn't work with !SYSFS_DEPRECATED, and that exists much longer than enclosure exists, and is what is used for new distros.
Quoted 3 lines
If you boot now, all components are linked to the enclosure devices, not the component devices ... I can fix this easily, I'm still just trying to figure out how you want it represented.
Yes, but that happens only in SYSFS_DEPRECATED mode, which just does not allow a class device hierarchy like enclosure tries to establish. With !SYSFS_DEPRECATED, you still have the expected hierarchy
in /sys/devices/.
Quoted 9 lines
Quoted 3 lines
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Yes, sounds good. Only that there will be no meaningful "device" link with !SYSFS_DEPRECATED, we need a custom link, maintained by the enclosure itself, to do that.
Quoted 2 lines
with a back link in the component device pointing to the enclosure component.
That sounds fine.
Quoted 2 lines
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.
If we go for a single class, can't we express enclosures and components in the device name and put them in the same class like:/sys/class/enclosure/
|- enclosure1 -> ../../../devices/<...>/enclosure1 |- enclosure1.slot1 -> ../../../../devices/<...>/enclosure1/enclosure1.slot1 |- enclosure1.slot2 -> ../../../../devices/<...>/enclosure1/enclosure1.slot2 |- enclosure2 -> ../../../devices/<...>/enclosure2 |- enclosure2.slot1 -> -> ../../../../devices/<...>/enclosure1/enclosure2.slot1
...
while /sys/devices/<...>/enclosure1/enclosure1.slot1/ has a something like a "contains" link pointing to the SCSI device, and the SCSI device an "enclosure" link back?
Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 31 lines · Kay Sievers
Quoted 9 lines · James Bottomley
Quoted 3 lines
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Yes, sounds good. Only that there will be no meaningful "device" link with !SYSFS_DEPRECATED, we need a custom link, maintained by the enclosure itself, to do that.
Quoted 2 lines
with a back link in the component device pointing to the enclosure component.
That sounds fine.
Quoted 2 lines
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.If we go for a single class, can't we express enclosures and components in the device name and put them in the same class like:
/sys/class/enclosure/|- enclosure1 -> ../../../devices/<...>/enclosure1 |- enclosure1.slot1 -> ../../../../devices/<...>/enclosure1/enclosure1.slot1 |- enclosure1.slot2 -> ../../../../devices/<...>/enclosure1/enclosure1.slot2 |- enclosure2 -> ../../../devices/<...>/enclosure2 |- enclosure2.slot1 -> -> ../../../../devices/<...>/enclosure1/enclosure2.slot1
Quoted 5 lines
...
while /sys/devices/<...>/enclosure1/enclosure1.slot1/ has a something like a "contains" link pointing to the SCSI device, and the SCSI device an "enclosure" link back?
OK, I've got a two expander system with six slots each pretending to be a twelve slot installation. I've also got two slots populated (slot 1 and 6). This is what it looks like with the deprecated setting:
sparkweed:/sys/class/enclosure# tree
.
|-- 0:0:1:0
| |-- SLOT 006
| | |-- active
| | |-- device -> ../../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0
| | |-- fault
| | |-- locate
| | |-- power
| | | `-- wakeup
| | |-- status
| | |-- type
| | `-- uevent
| |-- SLOT 007
| | |-- active
| | |-- fault
| | |-- locate
| | |-- power
| | | `-- wakeup
| | |-- status
| | |-- type
| | `-- uevent
| |-- SLOT 008
| | |-- active
| | |-- fault
| | |-- locate
| | |-- power
| | | `-- wakeup
| | |-- status
| | |-- type
| | `-- uevent
| |-- SLOT 009
| | |-- active
| | |-- fault
| | |-- locate
| | |-- power
| | | `-- wakeup
| | |-- status
| | |-- type
| | `-- uevent
| |-- SLOT 010
| | |-- active
| | |-- fault
| | |-- locate
| | |-- power
| | | `-- wakeup
| | |-- status
| | |-- type
| | `-- uevent
| |-- SLOT 011
| | |-- active
| | |-- fault
| | |-- locate
| | |-- power
| | | `-- wakeup
| | |-- status
| | |-- type
| | `-- uevent
| |-- components
| |-- device -> ../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:12/end_device-0:0:12/target0:0:1/0:0:1:0
| |-- power
| | `-- wakeup
| |-- subsystem -> ../../enclosure
| `-- uevent
`-- 0:0:3:0
|-- SLOT 000
| |-- active
| |-- fault
| |-- locate
| |-- power
| | `-- wakeup
| |-- status
| |-- type
| `-- uevent
|-- SLOT 001
| |-- active
| |-- device -> ../../../../devices/pci0000:01/0000:01:02.0/host0/port-0:1/expander-0:1/port-0:1:11/end_device-0:1:11/target0:0:2/0:0:2:0
| |-- fault
| |-- locate
| |-- power
| | `-- wakeup
| |-- status
| |-- type
| `-- uevent
|-- SLOT 002
| |-- active
| |-- fault
| |-- locate
| |-- power
| | `-- wakeup
| |-- status
| |-- type
| `-- uevent
|-- SLOT 003
| |-- active
| |-- fault
| |-- locate
| |-- power
| | `-- wakeup
| |-- status
| |-- type
| `-- uevent
|-- SLOT 004
| |-- active
| |-- fault
| |-- locate
| |-- power
| | `-- wakeup
| |-- status
| |-- type
| `-- uevent
|-- SLOT 005
| |-- active
| |-- fault
| |-- locate
| |-- power
| | `-- wakeup
| |-- status
| |-- type
| `-- uevent
|-- components
|-- device -> ../../../devices/pci0000:01/0000:01:02.0/host0/port-0:1/expander-0:1/port-0:1:12/end_device-0:1:12/target0:0:3/0:0:3:0
|-- power
| `-- wakeup
|-- subsystem -> ../../enclosure
`-- ueventAnd without the deprecated setting:
sparkweed:/sys/class/enclosure# tree . |-- 0:0:1:0 -> ../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:12/end_device-0:0:12/target0:0:1/0:0:1:0/enclosure/0:0:1:0 `-- 0:0:3:0 -> ../../devices/pci0000:01/0000:01:02.0/host0/port-0:1/expander-0:1/port-0:1:12/end_device-0:1:12/target0:0:3/0:0:3:0/enclosure/0:0:3:0
sparkweed:/sys/class/enclosure/0:0:1:0# tree . |-- SLOT 006 | |-- active | |-- device -> ../../../../../../../port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0 | |-- fault | |-- locate | |-- power | | `-- wakeup | |-- status | |-- type | `-- uevent |-- SLOT 007 | |-- active | |-- fault | |-- locate | |-- power | | `-- wakeup | |-- status | |-- type | `-- uevent |-- SLOT 008 | |-- active | |-- fault | |-- locate | |-- power | | `-- wakeup | |-- status | |-- type | `-- uevent |-- SLOT 009 | |-- active | |-- fault | |-- locate | |-- power | | `-- wakeup | |-- status | |-- type | `-- uevent |-- SLOT 010 | |-- active | |-- fault | |-- locate | |-- power | | `-- wakeup | |-- status | |-- type | `-- uevent |-- SLOT 011 | |-- active | |-- fault | |-- locate | |-- power | | `-- wakeup | |-- status | |-- type | `-- uevent |-- components |-- device -> ../../../0:0:1:0 |-- power | `-- wakeup |-- subsystem -> ../../../../../../../../../../../../class/enclosure `-- uevent
So are we now all happy?
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 42 lines · James Bottomley
Quoted 31 lines · Kay Sievers
Quoted 9 lines · James Bottomley
Quoted 3 lines
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Yes, sounds good. Only that there will be no meaningful "device" link with !SYSFS_DEPRECATED, we need a custom link, maintained by the enclosure itself, to do that.
Quoted 2 lines
with a back link in the component device pointing to the enclosure component.
That sounds fine.
Quoted 2 lines
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.If we go for a single class, can't we express enclosures and components in the device name and put them in the same class like:
/sys/class/enclosure/|- enclosure1 -> ../../../devices/<...>/enclosure1 |- enclosure1.slot1 -> ../../../../devices/<...>/enclosure1/enclosure1.slot1 |- enclosure1.slot2 -> ../../../../devices/<...>/enclosure1/enclosure1.slot2 |- enclosure2 -> ../../../devices/<...>/enclosure2 |- enclosure2.slot1 -> -> ../../../../devices/<...>/enclosure1/enclosure2.slot1Quoted 5 lines
...
while /sys/devices/<...>/enclosure1/enclosure1.slot1/ has a something like a "contains" link pointing to the SCSI device, and the SCSI device an "enclosure" link back?
OK, I've got a two expander system with six slots each pretending to be a twelve slot installation. I've also got two slots populated (slot 1 and 6). This is what it looks like with the deprecated setting:
Quoted 13 lines
sparkweed:/sys/class/enclosure# tree . |-- 0:0:1:0 | |-- SLOT 006 | | |-- active | | |-- device -> ../../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0 | | |-- fault | | |-- locate | | |-- power | | | `-- wakeup | | |-- status | | |-- type | | `-- uevent
The components are not assigned to any subsystem. Userspace will not see any event for these devices, which might not be nice. Is that expected behavior?
If you assign them to the enclosure class, the device name would need the enclosure name prefixed, because they are not unique across different enclosures, right?
...
Quoted 11 lines
| |-- SLOT 011 | | |-- active | | |-- fault | | |-- locate | | |-- power | | | `-- wakeup | | |-- status | | |-- type | | `-- uevent | |-- components | |-- device -> ../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:12/end_device-0:0:12/target0:0:1/0:0:1:0
Oh, interesting, can the parent for a whole enclosure be a SCSI LUN? Is that because the expander _is_ a LUN itself?
...
Quoted 1 line
So are we now all happy?
If we don't need uevents for components, and no directory in /sys/class/ which lists all enclosure components for easy finding them. And if we never want to send things link "change" events to userspace from an enclosure component, that should be ok. And we can be happy, yes. :)
I still slightly prefer cross link-names between the component and the LUN like "contains" -> and "enclosure" ->, but the current one should work too.
Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 57 lines · Kay Sievers
Quoted 42 lines · James Bottomley
Quoted 31 lines · Kay Sievers
Quoted 9 lines · James Bottomley
Quoted 3 lines
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Yes, sounds good. Only that there will be no meaningful "device" link with !SYSFS_DEPRECATED, we need a custom link, maintained by the enclosure itself, to do that.
Quoted 2 lines
with a back link in the component device pointing to the enclosure component.
That sounds fine.
Quoted 2 lines
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.If we go for a single class, can't we express enclosures and components in the device name and put them in the same class like:
/sys/class/enclosure/|- enclosure1 -> ../../../devices/<...>/enclosure1 |- enclosure1.slot1 -> ../../../../devices/<...>/enclosure1/enclosure1.slot1 |- enclosure1.slot2 -> ../../../../devices/<...>/enclosure1/enclosure1.slot2 |- enclosure2 -> ../../../devices/<...>/enclosure2 |- enclosure2.slot1 -> -> ../../../../devices/<...>/enclosure1/enclosure2.slot1Quoted 5 lines
...
while /sys/devices/<...>/enclosure1/enclosure1.slot1/ has a something like a "contains" link pointing to the SCSI device, and the SCSI device an "enclosure" link back?
OK, I've got a two expander system with six slots each pretending to be a twelve slot installation. I've also got two slots populated (slot 1 and 6). This is what it looks like with the deprecated setting:
Quoted 13 lines
sparkweed:/sys/class/enclosure# tree . |-- 0:0:1:0 | |-- SLOT 006 | | |-- active | | |-- device -> ../../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0 | | |-- fault | | |-- locate | | |-- power | | | `-- wakeup | | |-- status | | |-- type | | `-- uevent
Quoted 3 lines
The components are not assigned to any subsystem. Userspace will not see any event for these devices, which might not be nice. Is that expected behavior?
Hmm, I suppose they might. Failure of an enclosure bay is most likely a failure of the device in that bay, but it could be for some other reason, I suppose.
Quoted 3 lines
If you assign them to the enclosure class, the device name would need the enclosure name prefixed, because they are not unique across different enclosures, right?
They can't be assigned to the enclosure class otherwise they'd get the enclosure class interface, which is wrong for components.
Quoted 14 lines
...
Quoted 11 lines
| |-- SLOT 011 | | |-- active | | |-- fault | | |-- locate | | |-- power | | | `-- wakeup | | |-- status | | |-- type | | `-- uevent | |-- components | |-- device -> ../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:12/end_device-0:0:12/target0:0:1/0:0:1:0
Quoted 2 lines
Oh, interesting, can the parent for a whole enclosure be a SCSI LUN? Is that because the expander _is_ a LUN itself?
In this case, it is; but it's actually worse than that: the enclosure spec allows the enclosure device to be embedded in a LUN (i.e. a LUN responds as a SCSI disk but also responds to enclosure commands). That's why the ses driver has to bind like SG.
Quoted 8 lines
...
Quoted 1 line
So are we now all happy?
If we don't need uevents for components, and no directory in
/sys/class/which lists all enclosure components for easy finding them. And if we never want to send things link "change" events to userspace from an enclosure component, that should be ok. And we can be happy, yes. :)
It would be nice, but then we run into the enumeration problem again. The names are taken from the actual enclosure information and are only guaranteed unique per enclosure. I could make up unique names, but then they wouldn't correspond with the actual names printed on the enclosure.
Quoted 3 lines
I still slightly prefer cross link-names between the component and the LUN like "contains" -> and "enclosure" ->, but the current one should work too.
OK.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 66 lines · James Bottomley
Quoted 57 lines · Kay Sievers
Quoted 42 lines · James Bottomley
Quoted 31 lines · Kay Sievers
Quoted 9 lines · James Bottomley
Quoted 3 lines
We just need to create something like a "contains" link from the component to the scsi device, and a "enclosure" link at the scsi device back to the component, right?
Assuming you're moving to the single tree model, then I can easily do this:
<real enclosure device>/<enclosure>/<enclosure component>/device -> link to component device
Yes, sounds good. Only that there will be no meaningful "device" link with !SYSFS_DEPRECATED, we need a custom link, maintained by the enclosure itself, to do that.
Quoted 2 lines
with a back link in the component device pointing to the enclosure component.
That sounds fine.
Quoted 2 lines
The way components work, probably blowing away
enclosure_component_classmakes the most sense anyway.If we go for a single class, can't we express enclosures and components in the device name and put them in the same class like:
/sys/class/enclosure/|- enclosure1 -> ../../../devices/<...>/enclosure1 |- enclosure1.slot1 -> ../../../../devices/<...>/enclosure1/enclosure1.slot1 |- enclosure1.slot2 -> ../../../../devices/<...>/enclosure1/enclosure1.slot2 |- enclosure2 -> ../../../devices/<...>/enclosure2 |- enclosure2.slot1 -> -> ../../../../devices/<...>/enclosure1/enclosure2.slot1Quoted 5 lines
...
while /sys/devices/<...>/enclosure1/enclosure1.slot1/ has a something like a "contains" link pointing to the SCSI device, and the SCSI device an "enclosure" link back?
OK, I've got a two expander system with six slots each pretending to be a twelve slot installation. I've also got two slots populated (slot 1 and 6). This is what it looks like with the deprecated setting:
Quoted 13 lines
sparkweed:/sys/class/enclosure# tree . |-- 0:0:1:0 | |-- SLOT 006 | | |-- active | | |-- device -> ../../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0 | | |-- fault | | |-- locate | | |-- power | | | `-- wakeup | | |-- status | | |-- type | | `-- ueventQuoted 3 lines
The components are not assigned to any subsystem. Userspace will not see any event for these devices, which might not be nice. Is that expected behavior?
Hmm, I suppose they might. Failure of an enclosure bay is most likely a failure of the device in that bay, but it could be for some other reason, I suppose.
Quoted 6 lines
Quoted 3 lines
If you assign them to the enclosure class, the device name would need the enclosure name prefixed, because they are not unique across different enclosures, right?
They can't be assigned to the enclosure class otherwise they'd get the enclosure class interface, which is wrong for components.
If we can distinguish the both device types by the device name, that would still be fine. Like we have disks and partitions in "block, or mouseX and inputX in "input" at the same time. Or we can have a separate classes, like it was in the original version, if that fits better.
Quoted 14 lines
Quoted 14 lines
...
Quoted 11 lines
| |-- SLOT 011 | | |-- active | | |-- fault | | |-- locate | | |-- power | | | `-- wakeup | | |-- status | | |-- type | | `-- uevent | |-- components | |-- device -> ../../../devices/pci0000:01/0000:01:02.0/host0/port-0:0/expander-0:0/port-0:0:12/end_device-0:0:12/target0:0:1/0:0:1:0
Quoted 7 lines
Quoted 2 lines
Oh, interesting, can the parent for a whole enclosure be a SCSI LUN? Is that because the expander _is_ a LUN itself?
In this case, it is; but it's actually worse than that: the enclosure spec allows the enclosure device to be embedded in a LUN (i.e. a LUN responds as a SCSI disk but also responds to enclosure commands). That's why the ses driver has to bind like SG.
Ouch! People have crazy ideas. :)
Quoted 9 lines
Quoted 8 lines
...
Quoted 1 line
So are we now all happy?
If we don't need uevents for components, and no directory in
/sys/class/which lists all enclosure components for easy finding them. And if we never want to send things link "change" events to userspace from an enclosure component, that should be ok. And we can be happy, yes. :)
Quoted 4 lines
It would be nice, but then we run into the enumeration problem again. The names are taken from the actual enclosure information and are only guaranteed unique per enclosure. I could make up unique names, but then they wouldn't correspond with the actual names printed on the enclosure.
If we prefix the component device name with the enclosure device name,
like: "<encl-name>.<comp-name>", it would be unique, right? And still match the labels, and also identify the enclosure.
Quoted 5 lines
Quoted 3 lines
I still slightly prefer cross link-names between the component and the LUN like "contains" -> and "enclosure" ->, but the current one should work too.
OK.
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kay, James,
I'm not sure I'm following all of the threads, but several of the points give me some concern. Bear with me if I'm off in the weeds (and I assume you'll straighten me out).
Quoted 8 lines
Quoted 1 line
It wasn't designed like this; an interface sits off to the side.
No, that's the way SCSI thinks it works, and unfortunately just duplicates real devices in the class directory. Class scsi_device- and scsi_host-devices are just 1:1 mirrors of the real bus devices. It just makes things far more complicated than needed. There is no such thing as "off the side interface" in the driver model or in sysfs, we just have "devices".
<ignoring the sas enclosure distinctions>
Is this discussion about removing the class device device object ? at least from the "class" directory and moving it into the /sys/devices tree ?
E.g.
Today, if I have a scsi hba, I have:
the scsi_host base device that is in the /sys/devices tree, which may then have 2 other objects, a scsi_host device for the /sys/class/scsi_host element and a fc_host device for the /sys/class/fc_host element. The base device in /sys/devices has 2 symlinks of the form <class>:<nm_relative_to_class>, and the /sys/class devices have a symlink, named "device" that points back to the base device in /sys/devices.
With the modification, you have:
the scsi_host base device that is in the /sys/devices tree, which then has 2 other devices underneath of it - one a scsi_host device (for the scsi_host class) and the other a fc_host device (for the fc_host class). The naming of <class>:<nm_relative_to_class> stays in the base device, but instead of being symlinks these are real directories for the sub-devices. Out in /sys/class, there is now a /sys/class/scsi_host/<nm1> that is a symlink back to the scsi_host class device, and similarly /sys/class/fc_host/<nm2> is a symlink back to the fc_host class device. And within the class devices, there is a "device" symlink to "..", mainly for compatibility ?
Did I follow this right ?
Quoted 6 lines
Since some releases. We talked about these plans and the way SCSI does it in person at FreedomHEC.
The driver model is just too complicated, we are cleaning that up step by step, and the completely inconsistent "class devices are interfaces" idea will completely go away. Sure, there will be symlinks preserving the old interfaces/behavior.
I'm confused... If what I described above is true, then yes, the class device become real devices, at least as far as there is only 1 device struct and its always linked under /sys/devices and there's never a "device" object off to the side for the class. But isn't there still an interface relationship to each of these device structures ? All this did was clean up where device structures live to a single place.
Quoted 9 lines
We talked about this extensively at LFS a few weeks ago. And Hannes gave a whole talk about that. What does a 1:1 mirror of the same device, other than having just doubled the number of devices, do good for us? Nothing but make it complicated to find information.
SCSI bus devices have functional attributes on their own, so it's completely inconsistent to split off _some_ of the functionality off to a second "mirror device" and call that an "interface".
Quoted 5 lines
We have a SCSI target and host in the
/sys/devices/tree already, there is no reason to mirror anything in a classscsi_device, same for thescsi_host. Really, that "interface to a device" idea must die, it never existed in the kernel code, only in some very confusing "documentation", which will be replaced pretty soon.
So, you are lobbying that we kill those devices for the class(es) and simply put all the different interface sysfs attributes on the base device ? If so, I'm concerned about attribute namespace overlap, and just a conglomeration of attributes on the base device. But I do like killing the other device structures.
Quoted 5 lines
There will be no "device" link with any meaning with !SYSFS_DEPRECATED, only a single tree expressing _all_ core hierarchy, and flat classification symlinks (
/sys/bus,class) to lookup the devices in the single device tree. In the end, there will be no bus or class device differences any userspace app would need to care about.
which seems to jive with my description above, with the only exception that the "device" symlink only exists if SYSFS_DEPRECATED.
and from your other email thread :
Quoted 3 lines
With !SYSFS_DEPRECATED <classname>:<devname> links are no longer created for any device, the class device directories just live in a subdirectory with the class name.
Well, the <classname> prefix came about because there was namespace overlap between different classes (e.g. scsi_host and fc_host classes use the same name, and I think where we originally saw this was in the way serial ports were enumerated for some base systems as well).
So I don't see how you can kill the <classname>:<devname> names by SYSFS_DEPRECATED.
-- james s
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 13 lines · James Smart
I'm not sure I'm following all of the threads, but several of the points give me some concern. Bear with me if I'm off in the weeds (and I assume you'll straighten me out).
Quoted 8 lines
Quoted 1 line
It wasn't designed like this; an interface sits off to the side.
No, that's the way SCSI thinks it works, and unfortunately just duplicates real devices in the class directory. Class scsi_device- and scsi_host-devices are just 1:1 mirrors of the real bus devices. It just makes things far more complicated than needed. There is no such thing as "off the side interface" in the driver model or in sysfs, we just have "devices".
Quoted 4 lines
<ignoring the sas enclosure distinctions>
Is this discussion about removing the class device device object ? at least from the "class" directory and moving it into the
/sys/devicestree ?
The directories move to /sys/devices, /sys/class is functionally the same, but only a bunch of symlinks pointing to the devices instead of real directories.
Quoted 8 lines
E.g.
Today, if I have a scsi hba, I have:
thescsi_hostbase device that is in the/sys/devicestree, which may then have 2 other objects, ascsi_hostdevice for the/sys/class/scsi_hostelement and afc_hostdevice for the/sys/class/fc_hostelement. The base device in/sys/deviceshas 2 symlinks of the form <class>:<nm_relative_to_class>, and the/sys/classdevices have a symlink, named "device" that points back to the base device in/sys/devices.
The class devices needed to be connected to their bus parents by the "<class>:<name>" link and the "device" link, yes.
This became a real mess when people tried to put hierarchies between class devices. So we deprecated the "lots of disconnected trees spread around" model, and moved all into a single tree, with proper device DEVPATH's, which include all the parent dependencies, for the devices.
Quoted 10 lines
With the modification, you have:
thescsi_hostbase device that is in the/sys/devicestree, which then has 2 other devices underneath of it - one ascsi_hostdevice (for thescsi_hostclass) and the other afc_hostdevice (for thefc_hostclass). The naming of <class>:<nm_relative_to_class> stays in the base device, but instead of being symlinks these are real directories for the sub-devices. Out in/sys/class, there is now a /sys/class/scsi_host/<nm1> that is a symlink back to thescsi_hostclass device, and similarly /sys/class/fc_host/<nm2> is a symlink back to thefc_hostclass device. And within the class devices, there is a "device" symlink to "..", mainly for compatibility ?
The class devices appear where they belong, below their parents. In the /sys/class directories will be only symlinks. The "<class>:<name>" links are gone. The "device" link is not needed, it's just the next parent device. It is still created at the moment, but will go away some day.
Quoted 10 lines
Did I follow this right ?
Quoted 6 lines
Since some releases. We talked about these plans and the way SCSI does it in person at FreedomHEC.
The driver model is just too complicated, we are cleaning that up step by step, and the completely inconsistent "class devices are interfaces" idea will completely go away. Sure, there will be symlinks preserving the old interfaces/behavior.
Quoted 6 lines
I'm confused... If what I described above is true, then yes, the class device become real devices, at least as far as there is only 1 device struct and its always linked under
/sys/devicesand there's never a "device" object off to the side for the class. But isn't there still an interface relationship to each of these device structures ? All this did was clean up where device structures live to a single place.
All devices live in /sys/devices/, all the rest is symlinks. All devices will continue to exist, have the same names and attributes, and will still looks the same, just all in one single hierarchy. The /sys/class/ directory will on be a classification directory to lookup devices in the tree, just like /sys/bus/*/devices/ was forever.
Quoted 15 lines
Quoted 9 lines
We talked about this extensively at LFS a few weeks ago. And Hannes gave a whole talk about that. What does a 1:1 mirror of the same device, other than having just doubled the number of devices, do good for us? Nothing but make it complicated to find information.
SCSI bus devices have functional attributes on their own, so it's completely inconsistent to split off _some_ of the functionality off to a second "mirror device" and call that an "interface".
Quoted 5 lines
We have a SCSI target and host in the
/sys/devices/tree already, there is no reason to mirror anything in a classscsi_device, same for thescsi_host. Really, that "interface to a device" idea must die, it never existed in the kernel code, only in some very confusing "documentation", which will be replaced pretty soon.
Quoted 4 lines
So, you are lobbying that we kill those devices for the class(es) and simply put all the different interface sysfs attributes on the base device ? If so, I'm concerned about attribute namespace overlap, and just a conglomeration of attributes on the base device. But I do like killing the other device structures.
Only the 1:1 duplicated devices, both refcounted objects embedded in the same scsi struct, like scsi_device and scsi_host. We should move the attributes to the real device, and create a symlink at the old place, there is no need for two device directories for the same thing.
Quoted 8 lines
Quoted 5 lines
There will be no "device" link with any meaning with !SYSFS_DEPRECATED, only a single tree expressing _all_ core hierarchy, and flat classification symlinks (
/sys/bus,class) to lookup the devices in the single device tree. In the end, there will be no bus or class device differences any userspace app would need to care about.which seems to jive with my description above, with the only exception that the "device" symlink only exists if
SYSFS_DEPRECATED.
It still exists in both cases, but it will go away some day.
Quoted 6 lines
and from your other email thread :
Quoted 3 lines
With !SYSFS_DEPRECATED <classname>:<devname> links are no longer created for any device, the class device directories just live in a subdirectory with the class name.
Quoted 6 lines
Well, the <classname> prefix came about because there was namespace overlap between different classes (e.g.
scsi_hostandfc_hostclasses use the same name, and I think where we originally saw this was in the way serial ports were enumerated for some base systems as well).So I don't see how you can kill the <classname>:<devname> names by
SYSFS_DEPRECATED.
With SYSFS_DEPRECATED, nothing will change. But these links don't exist with !SYSFS_DEPRECATED, because the class devices live in subdirectories, named after the class they come from, there is no namespace problem, or any problem to find these devices, you don't even need readdir() to look them up.
Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Kay Sievers
Quoted 5 lines
Well, the <classname> prefix came about because there was namespace overlap between different classes (e.g.
scsi_hostandfc_hostclasses use the same name, and I think where we originally saw this was in the way serial ports were enumerated for some base systems as well).
Quoted 7 lines
Quoted 1 line
So I don't see how you can kill the <classname>:<devname> names by
SYSFS_DEPRECATED.With
SYSFS_DEPRECATED, nothing will change. But these links don't exist with !SYSFS_DEPRECATED, because the class devices live in subdirectories, named after the class they come from, there is no namespace problem, or any problem to find these devices, you don't even needreaddir()to look them up.
Ok, it should have read :
I don't see how you can kill the <classname>:<devname> names w/ !SYSFS_DEPRECATED.
You still haven't answered my question about namespace overlap. What happens when the device belongs to multiple classes, and the classes have the same name for the class
device ? I don't believe we ever want to be in the case where the classes have to
understand a global namespace.
I know this exists a couple of places, because it's what drove us to using the "<class_nm>:" prefix in the beginning. Additionally, I know of several utilities that found a lot of benefit to having the class name. For example, the different transports in scsi all use the same names for their devices, which overlap with the scsi_host name. The utility could use the prefix to understand what class the device belonged to. What do you have to replace this with ? - a symlink to the /sys/class symlink ? a pattern matching on
what attributes exist (and optional attributes make this ugly) ? a new sysfs attributes
in the object, say class, that spits out the class name ?
Keeping the prefix may also be useful to distinguish between class devices and real child devices.
-- james s
Quoted 23 lines · James Smart
Quoted 8 lines · Kay Sievers
Quoted 8 lines
Well, the <classname> prefix came about because there was namespace overlap
between different classes (e.g.scsi_hostandfc_hostclasses use the same name,
and I think where we originally saw this was in the way serial ports were enumerated
for some base systems as well).Quoted 7 lines
Quoted 2 lines
So I don't see how you can kill the <classname>:<devname> names by
SYSFS_DEPRECATED.With
SYSFS_DEPRECATED, nothing will change. But these links don't exist with !SYSFS_DEPRECATED, because the class devices live in subdirectories, named after the class they come from, there is no namespace problem, or any problem to find these devices, you don't even needreaddir()to look them up.Ok, it should have read :
I don't see how you can kill the <classname>:<devname> names w/
!SYSFS_DEPRECATED.
Quoted 7 lines
You still haven't answered my question about namespace overlap. What happens when the
device belongs to multiple classes, and the classes have the same name for the class
device ? I don't believe we ever want to be in the case where the classes
have to
understand a global namespace.
I take it you haven't even looked at how !SYSFS_DEPRECATED works today, have you? Try it and you will see that the namespace issue has been taken care of a long time ago :)
thanks,
greg k-h
Quoted 3 lines · Greg KH
I take it you haven't even looked at how !SYSFS_DEPRECATED works today, have you? Try it and you will see that the namespace issue has been taken care of a long time ago :)
You are right... but I would assume it can be answered without pushing
someone back into the internals of the code to figure it out.
-- james s
Quoted 7 lines · James Smart
Quoted 3 lines · Greg KH
I take it you haven't even looked at how !SYSFS_DEPRECATED works today, have you? Try it and you will see that the namespace issue has been taken care of a long time ago :)
You are right... but I would assume it can be answered without pushing
someone back into the internals of the code to figure it out.
Oh, I already answered it in an earlier mail :)
"these links don't exist with !SYSFS_DEPRECATED, because the
class devices live in subdirectories, named after the class they come from, there is no namespace problem"
This is how a LUN looks now:
tree /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host13/target13:0:0/13:0:0:0/ /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host13/target13:0:0/13:0:0:0/
|-- block | `-- sdb | |-- subsystem -> ../../../../../../../../../../../class/block
| |-- sdb1 | | |-- subsystem -> ../../../../../../../../../../../../class/block
| |-- sdb2 | | |-- subsystem -> ../../../../../../../../../../../../class/block
|-- bsg | `-- 13:0:0:0 | |-- subsystem -> ../../../../../../../../../../../class/bsg
|-- scsi_disk | `-- 13:0:0:0 | |-- subsystem -> ../../../../../../../../../../../class/scsi_disk
|-- scsi_generic | `-- sg2 | |-- subsystem -> ../../../../../../../../../../../class/scsi_generic
Kay
James Bottomley
maintainerQuoted 31 lines · Kay Sievers
Quoted 7 lines · James Smart
Quoted 3 lines · Greg KH
I take it you haven't even looked at how !SYSFS_DEPRECATED works today, have you? Try it and you will see that the namespace issue has been taken care of a long time ago :)
You are right... but I would assume it can be answered without pushing
someone back into the internals of the code to figure it out.Oh, I already answered it in an earlier mail :)
"these links don't exist with !SYSFS_DEPRECATED, because the
class devices live in subdirectories, named after the class they come from, there is no namespace problem"This is how a LUN looks now:
tree /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host13/target13:0:0/13:0:0:0/ /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host13/target13:0:0/13:0:0:0/|-- block | `-- sdb | |-- subsystem -> ../../../../../../../../../../../class/block| |-- sdb1 | | |-- subsystem -> ../../../../../../../../../../../../class/block| |-- sdb2 | | |-- subsystem -> ../../../../../../../../../../../../class/block|-- bsg | `-- 13:0:0:0 | |-- subsystem -> ../../../../../../../../../../../class/bsg
Quoted 8 lines
|-- scsi_disk | `-- 13:0:0:0 | |-- subsystem -> ../../../../../../../../../../../class/scsi_disk|-- scsi_generic | `-- sg2 | |-- subsystem -> ../../../../../../../../../../../class/scsi_generic
So the real answer is that the backlink <class>:<class device> becomes the directory hierarchy <class>/<class device>.
The uniqueness is hopefully solved essentially because the <class> name has to be unique. As long as there's no clash with the actual device property names (not necessarily a given) we're fine.
I suppose it means we have to be a bit more careful about sysfs device file names from now on.
James
James Bottomley
maintainerQuoted 19 lines · James Bottomley
Quoted 7 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
Quoted 5 lines
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
Quoted 6 lines
Since the patch is separable, it's probably best to take it through the SCSI tree ... including the infiniband bits that depend on the iser/iscsi transport classes. You can give the rest of the infiniband pieces to roland, since he's got a nasty set of clashes with the
__FUNCTION__->__func__conversion which I don't want to be responsible for.
OK, I've changed my mind ... it doesn't really work well without all the rest of the pieces ... plus I think there are going to be merge nasties which I'd rather you sorted out.
What I'll do is run a scsi-post-merge-2.6 tree here:
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-post-merge-2.6.git;a=summary
I've dropped a quasi stable branch from your quilt tree and plumbed it into the -mc tree generation machinery, so it will warn me if you make too radical an alteration to your quilt.
Andrew,
you probably won't be able to pull this into -mm without the -mc machinery, so the best thing will simply to be to pull in the changes patch here right at the end of the -mm build (the same goes for linux-next):
http://www.kernel.org/pub/linux/kernel/people/jejb/scsi-post-merge-2.6.diff
It's a roll up patch of only the SCSI pieces. It's updated every time I push a patch, so it should always be current.
James
Quoted 27 lines · James Bottomley
Quoted 19 lines · James Bottomley
Quoted 7 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
Quoted 5 lines
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
Quoted 6 lines
Since the patch is separable, it's probably best to take it through the SCSI tree ... including the infiniband bits that depend on the iser/iscsi transport classes. You can give the rest of the infiniband pieces to roland, since he's got a nasty set of clashes with the
__FUNCTION__->__func__conversion which I don't want to be responsible for.
Quoted 3 lines
OK, I've changed my mind ... it doesn't really work well without all the rest of the pieces ... plus I think there are going to be merge nasties which I'd rather you sorted out.
Ok, so what do you want me to do? I can keep the scsi patch and the IB patches in my tree and merge them that way, but I think it causes problems with your scsi patches. That will cause the -next and -mm tree issues, right?
Quoted 7 lines
What I'll do is run a scsi-post-merge-2.6 tree here:
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-post-merge-2.6.git;a=summary
I've dropped a quasi stable branch from your quilt tree and plumbed it into the -mc tree generation machinery, so it will warn me if you make too radical an alteration to your quilt.
So I shouldn't drop the patch from my tree?
confused,
greg k-h
James Bottomley
maintainerQuoted 28 lines · Greg KH
Quoted 27 lines · James Bottomley
Quoted 25 lines · James Bottomley
Quoted 7 lines · Greg KH
Here's a huge patch from Tony and Kay that converts the scsi layer to use struct device instead of
class_device.It doesn't seem like it could be split up any smaller due to the interconectedness of the whole mess, if you have any suggestions otherwise, it would be appreciated.
Quoted 5 lines
If you want, I can take this through my tree as it does depend on a previous IB patch to make that portion of the patch much smaller.
After this, all of the
class_devicecode is now finally gone from the kernel!Actually, I have it built and running (actually 2.6.25-rc5-mc5 which includes all the changes in your tree). Amazingly it's pretty much fully functional, except ses which seems to have suffered a breakdown in the way its model works. I'll see if I can fix it up.
Since the patch is separable, it's probably best to take it through the SCSI tree ... including the infiniband bits that depend on the iser/iscsi transport classes. You can give the rest of the infiniband pieces to roland, since he's got a nasty set of clashes with the
__FUNCTION__->__func__conversion which I don't want to be responsible for.
Quoted 5 lines
Quoted 3 lines
OK, I've changed my mind ... it doesn't really work well without all the rest of the pieces ... plus I think there are going to be merge nasties which I'd rather you sorted out.
Ok, so what do you want me to do?
Keep the patch in your tree.
Quoted 4 lines
I can keep the scsi patch and the IB
patches in my tree and merge them that way, but I think it causes problems with your scsi patches. That will cause the -next and -mm tree issues, right?
No, that's what the post-merge tree is below. Its an unstable (as in fairly rapidly rebasing) tree built on your quilt that includes all the device changes. After you push your gregkh-drivers tree upstream, I'll rebase it on the final history in Linus tree, and then it should only have the added SCSI pieces ready for merging.
Any changes that come in which would cause a conflict in the generic device stuff, we'll force to be rediffed against the post merge tree. Effectively I'm running two merge window trees now: scsi-misc-2.6 which contains all the fixes ready for integration now (and will go at the start of the merge window) and scsi-post-merge-2.6 which contains changes dependent on you getting your gregkh-drivers quilt upstream before it can go.
The only difference between the current post merge tree and the one I had to run for 2.6.24 is that 2.6.24 was built on Jens block git tree because of the sg_table changes. This time I'm building on a quilt, which makes the tree a bit more difficult to deal with for people pulling from it.
Quoted 9 lines
Quoted 7 lines
What I'll do is run a scsi-post-merge-2.6 tree here:
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-post-merge-2.6.git;a=summary
I've dropped a quasi stable branch from your quilt tree and plumbed it into the -mc tree generation machinery, so it will warn me if you make too radical an alteration to your quilt.
So I shouldn't drop the patch from my tree?
Correct.
James