diff options
author | Tejun Heo <htejun@gmail.com> | 2008-05-19 13:17:51 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-14 15:59:32 -0400 |
commit | 341c2c958ec7bdd9f54733a8b0b432fe76842a82 (patch) | |
tree | 1af1983fe82ad032de6142229fe6c70f04466918 /drivers/ata/libata-eh.c | |
parent | bce7f793daec3e65ec5c5705d2457b81fe7b5725 (diff) |
libata: consistently use msecs for time durations
libata has been using mix of jiffies and msecs for time druations.
This is getting confusing. As writing sub HZ values in jiffies is
PITA and msecs_to_jiffies() can't be used as initializer, unify unit
for all time durations to msecs. So, durations are in msecs and
deadlines are in jiffies. ata_deadline() is added to compute deadline
from a start time and duration in msecs.
While at it, drop now superflous _msec suffix from arguments and
rename @timeout to @deadline if it represents a fixed point in time
rather than duration.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 7894d83ea1eb..08dd07f10008 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -66,15 +66,14 @@ enum { | |||
66 | ATA_ECAT_DUBIOUS_TOUT_HSM = 6, | 66 | ATA_ECAT_DUBIOUS_TOUT_HSM = 6, |
67 | ATA_ECAT_DUBIOUS_UNK_DEV = 7, | 67 | ATA_ECAT_DUBIOUS_UNK_DEV = 7, |
68 | ATA_ECAT_NR = 8, | 68 | ATA_ECAT_NR = 8, |
69 | }; | ||
70 | 69 | ||
71 | /* Waiting in ->prereset can never be reliable. It's sometimes nice | 70 | /* Waiting in ->prereset can never be reliable. It's |
72 | * to wait there but it can't be depended upon; otherwise, we wouldn't | 71 | * sometimes nice to wait there but it can't be depended upon; |
73 | * be resetting. Just give it enough time for most drives to spin up. | 72 | * otherwise, we wouldn't be resetting. Just give it enough |
74 | */ | 73 | * time for most drives to spin up. |
75 | enum { | 74 | */ |
76 | ATA_EH_PRERESET_TIMEOUT = 10 * HZ, | 75 | ATA_EH_PRERESET_TIMEOUT = 10000, |
77 | ATA_EH_FASTDRAIN_INTERVAL = 3 * HZ, | 76 | ATA_EH_FASTDRAIN_INTERVAL = 3000, |
78 | }; | 77 | }; |
79 | 78 | ||
80 | /* The following table determines how we sequence resets. Each entry | 79 | /* The following table determines how we sequence resets. Each entry |
@@ -84,10 +83,10 @@ enum { | |||
84 | * are mostly for error handling, hotplug and retarded devices. | 83 | * are mostly for error handling, hotplug and retarded devices. |
85 | */ | 84 | */ |
86 | static const unsigned long ata_eh_reset_timeouts[] = { | 85 | static const unsigned long ata_eh_reset_timeouts[] = { |
87 | 10 * HZ, /* most drives spin up by 10sec */ | 86 | 10000, /* most drives spin up by 10sec */ |
88 | 10 * HZ, /* > 99% working drives spin up before 20sec */ | 87 | 10000, /* > 99% working drives spin up before 20sec */ |
89 | 35 * HZ, /* give > 30 secs of idleness for retarded devices */ | 88 | 35000, /* give > 30 secs of idleness for retarded devices */ |
90 | 5 * HZ, /* and sweet one last chance */ | 89 | 5000, /* and sweet one last chance */ |
91 | /* > 1 min has elapsed, give up */ | 90 | /* > 1 min has elapsed, give up */ |
92 | }; | 91 | }; |
93 | 92 | ||
@@ -641,7 +640,7 @@ void ata_eh_fastdrain_timerfn(unsigned long arg) | |||
641 | /* some qcs have finished, give it another chance */ | 640 | /* some qcs have finished, give it another chance */ |
642 | ap->fastdrain_cnt = cnt; | 641 | ap->fastdrain_cnt = cnt; |
643 | ap->fastdrain_timer.expires = | 642 | ap->fastdrain_timer.expires = |
644 | jiffies + ATA_EH_FASTDRAIN_INTERVAL; | 643 | ata_deadline(jiffies, ATA_EH_FASTDRAIN_INTERVAL); |
645 | add_timer(&ap->fastdrain_timer); | 644 | add_timer(&ap->fastdrain_timer); |
646 | } | 645 | } |
647 | 646 | ||
@@ -681,7 +680,8 @@ static void ata_eh_set_pending(struct ata_port *ap, int fastdrain) | |||
681 | 680 | ||
682 | /* activate fast drain */ | 681 | /* activate fast drain */ |
683 | ap->fastdrain_cnt = cnt; | 682 | ap->fastdrain_cnt = cnt; |
684 | ap->fastdrain_timer.expires = jiffies + ATA_EH_FASTDRAIN_INTERVAL; | 683 | ap->fastdrain_timer.expires = |
684 | ata_deadline(jiffies, ATA_EH_FASTDRAIN_INTERVAL); | ||
685 | add_timer(&ap->fastdrain_timer); | 685 | add_timer(&ap->fastdrain_timer); |
686 | } | 686 | } |
687 | 687 | ||
@@ -2125,7 +2125,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2125 | } | 2125 | } |
2126 | 2126 | ||
2127 | if (prereset) { | 2127 | if (prereset) { |
2128 | rc = prereset(link, jiffies + ATA_EH_PRERESET_TIMEOUT); | 2128 | rc = prereset(link, |
2129 | ata_deadline(jiffies, ATA_EH_PRERESET_TIMEOUT)); | ||
2129 | if (rc) { | 2130 | if (rc) { |
2130 | if (rc == -ENOENT) { | 2131 | if (rc == -ENOENT) { |
2131 | ata_link_printk(link, KERN_DEBUG, | 2132 | ata_link_printk(link, KERN_DEBUG, |
@@ -2160,7 +2161,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2160 | if (ata_is_host_link(link)) | 2161 | if (ata_is_host_link(link)) |
2161 | ata_eh_freeze_port(ap); | 2162 | ata_eh_freeze_port(ap); |
2162 | 2163 | ||
2163 | deadline = jiffies + ata_eh_reset_timeouts[try++]; | 2164 | deadline = ata_deadline(jiffies, ata_eh_reset_timeouts[try++]); |
2164 | 2165 | ||
2165 | if (reset) { | 2166 | if (reset) { |
2166 | if (verbose) | 2167 | if (verbose) |