Efficient media-not-present detection
From: Alan Stern
Date: Sat May 20 2006 - 15:53:39 EST
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
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?
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/