On Mon, 16 Aug 2010, Oliver Neukum wrote: > Am Montag, 16. August 2010, 16:04:52 schrieb Alan Stern: > > On Sun, 15 Aug 2010, Oliver Neukum wrote: > > > > > > Yes, that is true. But where is the connection to open/close? > > > > When the device file is closed, the sd driver tells the device to > > synchronize its cache. While the file is open, we don't know whether > > or not the cache has been written back. While this may not matter for > > flash drives, it does matter for other kinds -- and I wanted the > > initial patch to work with a broad range of devices. > > Don't we sync cache in sd when suspend() is called? Yes. > > At the moment it appears that we have three possible criteria for when > > to power-down a SCSI drive: > > > > When the device file is closed; > > > > When the device file is closed and no medium is present > > That is a degenerate case > > > (or maybe just when no medium is present); > > This is not. > > > After a user-specified idle timeout. > > > > The second is basically a degenerate subcase of the first, to be used > > with things like card readers that report a media change whenever they > > power back up. Do you have any additional suggestions before I post > > something on linux-scsi? > > My concern is that I doubt that cases 1 and 3 are distinct. Now as you can > surely suspend an open device without medium provided you reawaken > it for a command, I don't see the case for tracking open/close. Open and close occur in process context whereas command handling doesn't. That means doing autoresume while handling a command will require considerably more new code, more than I wanted to write for the initial patch. And the open/close scheme works okay for the case people are most concerned about now: empty card readers. Consider the types of devices we will be autosuspending: Rotating disk drives Solid-state drives / flash drives Buggy card readers Non-buggy things with removable media It looks like the buggy card readers need the no-medium restriction but nothing else does. And it looks like the rotating drives are going to require long inactivity timeouts (minutes) whereas the others will require short timeouts (fractions of a second). Does that seem like a reasonable summary? You're right that the open/close aspect may not be useful. But let's check on linux-scsi before making any changes. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html