Messages in this thread | | | Date | Sat, 20 May 2006 15:49:34 -0400 (EDT) | From | Alan Stern <> | Subject | Efficient media-not-present detection |
| |
The block layer detects missing media during open() via a two-step process. First it invokes the media_changed() method, and if that returns a positive result it invokes the revalidate_disk() method, which will realize that no media is present.
This ends up doing twice as much work as needed. Often the media_changed() method is capable of detecting whether media is present; if it isn't there's no reason to call revalidate_disk(). Applications like hald that poll drives to see when media is present therefore end up generating twice the necessary overhead.
To remedy this would require altering the meaning of the return value from media_changed(). Something like: 0 for no change, -ENOMEDIUM for media definitely not present, anything else for media changed or possibly not present.
This would be a fairly big change since there a lot of block device drivers. Is there any reason to think it shouldn't be done?
Alan Stern
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |