• Alan Stern's avatar
    [SCSI] sd: improve logic and efficiecy of media-change detection · 3ff5588d
    Alan Stern authored
    This patch (as1415) improves the formerly incomprehensible logic in
    sd_media_changed() (the current code refers to "changed" as a state,
    whereas in fact it is a relation between two states).  It also adds a
    big comment so that everyone can understand what is really going on.
    
    The patch also improves efficiency by not reporting a media change
    when no medium was ever present.  If no medium was present the last
    time we checked and there's still no medium, it's not necessary to
    tell the caller that a change occurred.  Doing so merely causes the
    caller to attempt to revalidate a non-existent disk, which is a waste
    of time.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
    3ff5588d
sd.c 71.7 KB