Re: [git patches] Add and use media change notification

2007-11-05 Thread Jeff Garzik

Linus Torvalds wrote:


On Sun, 4 Nov 2007, Jeff Garzik wrote:

The end to CD-ROM polling...  newer SATA ATAPI hardware will emit
'asynchronous notification' events when media is changed.  This adds
support.


I *really* didn't want to pull this.

Not only is it after the -rc1 period, but I also think you pushed this ina 
really offensive manner, and I don't like how you and James have made this 
whole thing personal. You guys need to sort it out, and there is no way 
you can blame James for all your troubles, since I've heard the same kind 
of complaints about every single maintainer out there (including you) 
about some driver or other infrastructure issue.


So I'm unhappy about pulling this.

That said, I did finally decide to just pull it. Partly because the 
concept apparently has been in -mm for a while anyway (even if the final 
patch has not - but the patch itself isn't that large, I'd worry more 
about thngs like certain hardware simply not doing things right), but 
mostly because I hate it when others hold up driver features, and I 
decided that in this case this really is something that is better done 
earlier rather than later, to get exposure as soon as possible.


But I really think you need to lay off James, and help him rather than 
make every single complaint a big flame-war!


Please, Jeff?


Fair enough...

Jeff



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [git patches] Add and use media change notification

2007-11-05 Thread Jeff Garzik

Linus Torvalds wrote:


On Sun, 4 Nov 2007, Jeff Garzik wrote:

The end to CD-ROM polling...  newer SATA ATAPI hardware will emit
'asynchronous notification' events when media is changed.  This adds
support.


I *really* didn't want to pull this.

Not only is it after the -rc1 period, but I also think you pushed this ina 
really offensive manner, and I don't like how you and James have made this 
whole thing personal. You guys need to sort it out, and there is no way 
you can blame James for all your troubles, since I've heard the same kind 
of complaints about every single maintainer out there (including you) 
about some driver or other infrastructure issue.


So I'm unhappy about pulling this.

That said, I did finally decide to just pull it. Partly because the 
concept apparently has been in -mm for a while anyway (even if the final 
patch has not - but the patch itself isn't that large, I'd worry more 
about thngs like certain hardware simply not doing things right), but 
mostly because I hate it when others hold up driver features, and I 
decided that in this case this really is something that is better done 
earlier rather than later, to get exposure as soon as possible.


But I really think you need to lay off James, and help him rather than 
make every single complaint a big flame-war!


Please, Jeff?


Fair enough...

Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [git patches] Add and use media change notification

2007-11-04 Thread Linus Torvalds


On Sun, 4 Nov 2007, Jeff Garzik wrote:
> 
> The end to CD-ROM polling...  newer SATA ATAPI hardware will emit
> 'asynchronous notification' events when media is changed.  This adds
> support.

I *really* didn't want to pull this.

Not only is it after the -rc1 period, but I also think you pushed this ina 
really offensive manner, and I don't like how you and James have made this 
whole thing personal. You guys need to sort it out, and there is no way 
you can blame James for all your troubles, since I've heard the same kind 
of complaints about every single maintainer out there (including you) 
about some driver or other infrastructure issue.

So I'm unhappy about pulling this.

That said, I did finally decide to just pull it. Partly because the 
concept apparently has been in -mm for a while anyway (even if the final 
patch has not - but the patch itself isn't that large, I'd worry more 
about thngs like certain hardware simply not doing things right), but 
mostly because I hate it when others hold up driver features, and I 
decided that in this case this really is something that is better done 
earlier rather than later, to get exposure as soon as possible.

But I really think you need to lay off James, and help him rather than 
make every single complaint a big flame-war!

Please, Jeff?

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git patches] Add and use media change notification

2007-11-04 Thread Jeff Garzik

The end to CD-ROM polling...  newer SATA ATAPI hardware will emit
'asynchronous notification' events when media is changed.  This adds
support.

The libata change /using/ the infrastructure is tiny, encompassed
entirely in the first file patched, drivers/ata/libata-scsi.c.

Been working since August (and in -mm), but has gone through various
revisions to try and make SCSI maintainer happy.  Every step of the way,
it was upstream-mergeable in my opinion.

Everyone agrees this should go upstream; indeed, the key change from
me "[SCSI] add asynchronous event notification API" is even found
in jejb/scsi-misc-2.6.git (db0e2c76011f25f22f71e9c0d69ce95d15f21e8a).

There are minor disagreements with regards to userspace API, with a
more complex "solve all your problems" change currently being discussed,
blocked behind sysfs changes that don't exist yet (and are still being
discussed).

I am ready and waiting to address further feedback -- each feedback
I received so far was addressed in under 24 hours -- but let us not
delay this anymore.

Changes can and should be iterated upstream... that is what the bug fix
process is for...  getting final feedback and polish on working, testing
changes that have been waiting in the wings for months.

Please pull from 'an' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git an

to receive the following updates:

 drivers/ata/libata-scsi.c  |8 ++-
 drivers/scsi/scsi_lib.c|  136 
 drivers/scsi/scsi_scan.c   |3 +
 drivers/scsi/scsi_sysfs.c  |   47 +++
 include/scsi/scsi_device.h |   25 
 5 files changed, 216 insertions(+), 3 deletions(-)


commit f26792d5c63344e14540ced4b19deb29e360bb8d
Author: Jeff Garzik <[EMAIL PROTECTED]>
Date:   Mon Oct 29 17:18:39 2007 -0400

[libata] Utilize new SCSI event infrastructure

An end to CD-ROM polling (if you have a device that supports AN)...
hooray!

Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

commit a341cd0f6a0fde1f85fec9aa8f81f824ea4a3f92
Author: Jeff Garzik <[EMAIL PROTECTED]>
Date:   Mon Oct 29 17:15:22 2007 -0400

SCSI: add asynchronous event notification API

Originally based on a patch by Kristen Carlson Accardi @ Intel.
Copious input from James Bottomley.

Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 245057d..94144ed 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
}
 
+   if (dev->flags & ATA_DFLAG_AN)
+   set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
+
if (dev->flags & ATA_DFLAG_NCQ) {
int depth;
 
@@ -3296,10 +3299,9 @@ static void ata_scsi_handle_link_detach(struct ata_link 
*link)
  */
 void ata_scsi_media_change_notify(struct ata_device *dev)
 {
-#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
if (dev->sdev)
-   scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE);
-#endif
+   sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE,
+GFP_ATOMIC);
 }
 
 /**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 88de771..0e81e4c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2115,6 +2115,142 @@ scsi_device_set_state(struct scsi_device *sdev, enum 
scsi_device_state state)
 EXPORT_SYMBOL(scsi_device_set_state);
 
 /**
+ * sdev_evt_emit - emit a single SCSI device uevent
+ * @sdev: associated SCSI device
+ * @evt: event to emit
+ *
+ * Send a single uevent (scsi_event) to the associated scsi_device.
+ */
+static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
+{
+   int idx = 0;
+   char *envp[3];
+
+   switch (evt->evt_type) {
+   case SDEV_EVT_MEDIA_CHANGE:
+   envp[idx++] = "SDEV_MEDIA_CHANGE=1";
+   break;
+
+   default:
+   /* do nothing */
+   break;
+   }
+
+   envp[idx++] = NULL;
+
+   kobject_uevent_env(>sdev_gendev.kobj, KOBJ_CHANGE, envp);
+}
+
+/**
+ * sdev_evt_thread - send a uevent for each scsi event
+ * @work: work struct for scsi_device
+ *
+ * Dispatch queued events to their associated scsi_device kobjects
+ * as uevents.
+ */
+void scsi_evt_thread(struct work_struct *work)
+{
+   struct scsi_device *sdev;
+   LIST_HEAD(event_list);
+
+   sdev = container_of(work, struct scsi_device, event_work);
+
+   while (1) {
+   struct scsi_event *evt;
+   struct list_head *this, *tmp;
+   unsigned long flags;
+
+   spin_lock_irqsave(>list_lock, flags);
+   list_splice_init(>event_list, _list);
+   spin_unlock_irqrestore(>list_lock, flags);
+
+   if 

[git patches] Add and use media change notification

2007-11-04 Thread Jeff Garzik

The end to CD-ROM polling...  newer SATA ATAPI hardware will emit
'asynchronous notification' events when media is changed.  This adds
support.

The libata change /using/ the infrastructure is tiny, encompassed
entirely in the first file patched, drivers/ata/libata-scsi.c.

Been working since August (and in -mm), but has gone through various
revisions to try and make SCSI maintainer happy.  Every step of the way,
it was upstream-mergeable in my opinion.

Everyone agrees this should go upstream; indeed, the key change from
me [SCSI] add asynchronous event notification API is even found
in jejb/scsi-misc-2.6.git (db0e2c76011f25f22f71e9c0d69ce95d15f21e8a).

There are minor disagreements with regards to userspace API, with a
more complex solve all your problems change currently being discussed,
blocked behind sysfs changes that don't exist yet (and are still being
discussed).

I am ready and waiting to address further feedback -- each feedback
I received so far was addressed in under 24 hours -- but let us not
delay this anymore.

Changes can and should be iterated upstream... that is what the bug fix
process is for...  getting final feedback and polish on working, testing
changes that have been waiting in the wings for months.

Please pull from 'an' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git an

to receive the following updates:

 drivers/ata/libata-scsi.c  |8 ++-
 drivers/scsi/scsi_lib.c|  136 
 drivers/scsi/scsi_scan.c   |3 +
 drivers/scsi/scsi_sysfs.c  |   47 +++
 include/scsi/scsi_device.h |   25 
 5 files changed, 216 insertions(+), 3 deletions(-)


commit f26792d5c63344e14540ced4b19deb29e360bb8d
Author: Jeff Garzik [EMAIL PROTECTED]
Date:   Mon Oct 29 17:18:39 2007 -0400

[libata] Utilize new SCSI event infrastructure

An end to CD-ROM polling (if you have a device that supports AN)...
hooray!

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

commit a341cd0f6a0fde1f85fec9aa8f81f824ea4a3f92
Author: Jeff Garzik [EMAIL PROTECTED]
Date:   Mon Oct 29 17:15:22 2007 -0400

SCSI: add asynchronous event notification API

Originally based on a patch by Kristen Carlson Accardi @ Intel.
Copious input from James Bottomley.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 245057d..94144ed 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
blk_queue_max_hw_segments(q, q-max_hw_segments - 1);
}
 
+   if (dev-flags  ATA_DFLAG_AN)
+   set_bit(SDEV_EVT_MEDIA_CHANGE, sdev-supported_events);
+
if (dev-flags  ATA_DFLAG_NCQ) {
int depth;
 
@@ -3296,10 +3299,9 @@ static void ata_scsi_handle_link_detach(struct ata_link 
*link)
  */
 void ata_scsi_media_change_notify(struct ata_device *dev)
 {
-#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
if (dev-sdev)
-   scsi_device_event_notify(dev-sdev, SDEV_MEDIA_CHANGE);
-#endif
+   sdev_evt_send_simple(dev-sdev, SDEV_EVT_MEDIA_CHANGE,
+GFP_ATOMIC);
 }
 
 /**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 88de771..0e81e4c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2115,6 +2115,142 @@ scsi_device_set_state(struct scsi_device *sdev, enum 
scsi_device_state state)
 EXPORT_SYMBOL(scsi_device_set_state);
 
 /**
+ * sdev_evt_emit - emit a single SCSI device uevent
+ * @sdev: associated SCSI device
+ * @evt: event to emit
+ *
+ * Send a single uevent (scsi_event) to the associated scsi_device.
+ */
+static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
+{
+   int idx = 0;
+   char *envp[3];
+
+   switch (evt-evt_type) {
+   case SDEV_EVT_MEDIA_CHANGE:
+   envp[idx++] = SDEV_MEDIA_CHANGE=1;
+   break;
+
+   default:
+   /* do nothing */
+   break;
+   }
+
+   envp[idx++] = NULL;
+
+   kobject_uevent_env(sdev-sdev_gendev.kobj, KOBJ_CHANGE, envp);
+}
+
+/**
+ * sdev_evt_thread - send a uevent for each scsi event
+ * @work: work struct for scsi_device
+ *
+ * Dispatch queued events to their associated scsi_device kobjects
+ * as uevents.
+ */
+void scsi_evt_thread(struct work_struct *work)
+{
+   struct scsi_device *sdev;
+   LIST_HEAD(event_list);
+
+   sdev = container_of(work, struct scsi_device, event_work);
+
+   while (1) {
+   struct scsi_event *evt;
+   struct list_head *this, *tmp;
+   unsigned long flags;
+
+   spin_lock_irqsave(sdev-list_lock, flags);
+   list_splice_init(sdev-event_list, event_list);
+   spin_unlock_irqrestore(sdev-list_lock, flags);
+
+   if 

Re: [git patches] Add and use media change notification

2007-11-04 Thread Linus Torvalds


On Sun, 4 Nov 2007, Jeff Garzik wrote:
 
 The end to CD-ROM polling...  newer SATA ATAPI hardware will emit
 'asynchronous notification' events when media is changed.  This adds
 support.

I *really* didn't want to pull this.

Not only is it after the -rc1 period, but I also think you pushed this ina 
really offensive manner, and I don't like how you and James have made this 
whole thing personal. You guys need to sort it out, and there is no way 
you can blame James for all your troubles, since I've heard the same kind 
of complaints about every single maintainer out there (including you) 
about some driver or other infrastructure issue.

So I'm unhappy about pulling this.

That said, I did finally decide to just pull it. Partly because the 
concept apparently has been in -mm for a while anyway (even if the final 
patch has not - but the patch itself isn't that large, I'd worry more 
about thngs like certain hardware simply not doing things right), but 
mostly because I hate it when others hold up driver features, and I 
decided that in this case this really is something that is better done 
earlier rather than later, to get exposure as soon as possible.

But I really think you need to lay off James, and help him rather than 
make every single complaint a big flame-war!

Please, Jeff?

Linus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/