• Tejun Heo's avatar
    libata: implement EH fast drain · 5ddf24c5
    Tejun Heo authored
    In most cases, when EH is scheduled, all in-flight commands are
    aborted causing EH to kick in immediately.  However, in some cases
    (especially with PMP), it's unclear which commands are affected by the
    error condition and although aborting all in-flight commands work, it
    isn't optimal and may cause unnecessary disruption.  On the other
    hand, waiting for in-flight commands to drain themselves can take up
    to 30seconds.
    
    This patch implements EH fast drain to handle such situations.  It
    gives in-flight commands some time to finish up but doesn't wait for
    too long.  After EH is scheduled, fast drain timer is started and if
    no other completion occurs in ATA_EH_FASTDRAIN_INTERVAL all in-flight
    commands are aborted.  If any completion occurred in the interval, the
    port is given another interval to finish up itself.
    
    Currently ATA_EH_FASTDRAIN_INTERVAL is 3 secs which should be enough
    for finishing up most commands.
    Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    5ddf24c5
libata-eh.c 58.5 KB