public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>,
	Greg KH <greg@kroah.com>
Subject: Re: [PATCH] 2/2 Use bus dev_attrs to create scsi_device attributes
Date: Wed, 30 Mar 2005 13:44:52 -0800	[thread overview]
Message-ID: <20050330214452.GA18345@us.ibm.com> (raw)
In-Reply-To: <1112207564.4631.59.camel@localhost.localdomain>

On Wed, Mar 30, 2005 at 08:32:44PM +0200, Kay Sievers wrote:
> On Thu, 2005-03-17 at 09:53 -0500, James Bottomley wrote:
> > On Wed, 2005-03-16 at 14:45 -0800, Patrick Mansfield wrote:
> > > Any comments on this? Should I resend these patches?
> > 
> > Well, the basic comment is that there are a lot of features that SCSI
> > has that the driver core lacks:
> > 
> > 1) Attribute overrides.  This is actually part of the published API for SCSI
> 
> What does this exactly mean? Handle the same attribute dynamically with
> a different source of data?

Well a different function handled by the host driver, rather than the
function in scsi core, for example, the twa_queue_depth_attr in
drivers/scsi/3w-9xxx.c overrides the simple read attr function in
scsi_syfs.c created via this line:

	sdev_rd_attr (queue_depth, "%d\n").  

The patch left this in but only for queue_depth, not for all of the
scsi_devie attributes. We have sht->change_queue_depth that can already
handle this, some drivers use it, but some still use the sdev_attrs to
override the queue_depth. IMO, we should get rid of the override, James
doesn't agree.

James - are you OK with allowing only specific overrides of attributes?

> > 2) Ability to add extra attributes---several drivers use this
> 
> What is missing in the driver core here? Why can't you add/remove
> attribute files at any time? 

The patch left this alone, but should be changed to make sure duplicate
(that we can't override) attributes get errors. It is just a nice way for
host adapters to add attributes to a scsi_device.

But, for any of these non bus_attr and class attributes, the hotplug
notification (for scsi_device or the upper level block/char device) will
still come before the attributes are created. This is also true for the
transport attributes. This is a potential problem, I know of no udev
program or hotplug helpers that use any of these attributes.

I see no easy way around this problem without a multi-step registration,
like a device_init(), device_ready(). So a device_add would just be:

	device_init()
	device_ready()

Is your kobject_hotplug patch still pending?

We also need the following, else dev_attrs will show up after the probe
and hotplug event for a matching driver (for example, an sd block hotplug
event is generated via the device_attach() call). This could be causing
problems today, AFAIR you already hack around this problem in udev.

--- bleed-2.5/drivers/base/orig-bus.c	Tue Mar 15 17:08:18 2005
+++ bleed-2.5/drivers/base/bus.c	Wed Mar 30 10:48:34 2005
@@ -458,14 +458,14 @@ int bus_add_device(struct device * dev)
 	int error = 0;
 
 	if (bus) {
+		device_add_attrs(bus, dev);
+		sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
+		sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus");
 		down_write(&dev->bus->subsys.rwsem);
 		pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
 		list_add_tail(&dev->bus_list, &dev->bus->devices.list);
 		device_attach(dev);
 		up_write(&dev->bus->subsys.rwsem);
-		device_add_attrs(bus, dev);
-		sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
-		sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus");
 	}
 	return error;
 }

-- Patrick Mansfield

  reply	other threads:[~2005-03-30 21:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-02 19:44 [PATCH] 0/2 use sysfs bus dev_attrs for scsi_device attributes Patrick Mansfield
2005-03-02 19:45 ` [PATCH] 1/2 remove attr_changed_internally Patrick Mansfield
2005-03-02 19:46   ` [PATCH] 2/2 Use bus dev_attrs to create scsi_device attributes Patrick Mansfield
2005-03-16 22:45     ` Patrick Mansfield
2005-03-17 14:53       ` James Bottomley
2005-03-17 17:08         ` Greg KH
2005-03-30  3:15           ` Kay Sievers
2005-03-30  4:20             ` Greg KH
2005-03-30 18:07               ` Kay Sievers
2005-04-06 20:22                 ` Greg KH
2005-03-30 18:32         ` Kay Sievers
2005-03-30 21:44           ` Patrick Mansfield [this message]
2005-03-30 22:12             ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050330214452.GA18345@us.ibm.com \
    --to=patmans@us.ibm.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox