diff options
author | scottl <scottl@FreeBSD.org> | 2004-05-18 19:51:41 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2004-05-18 19:51:41 +0000 |
commit | fe4d2929f58783dfd7b5e89dacdcd0fe5ed7ccee (patch) | |
tree | e9dc478d4ba9a429afa3515860349348a165d289 | |
parent | 8e37fd0b5d59683f6f59b7f25f522dd702b2e0eb (diff) | |
download | FreeBSD-src-fe4d2929f58783dfd7b5e89dacdcd0fe5ed7ccee.zip FreeBSD-src-fe4d2929f58783dfd7b5e89dacdcd0fe5ed7ccee.tar.gz |
Improve the delay algorithm used in bgfsck. From the author:
shuffles the timing and sleep calls in bgfsck from:
sleep timer_on io timer_off io io io io io io io
to
sleep io io io io io io io timer_on io timer_off
The original method basically guaranteed that the timed I/O included a
disk seek every time, which made bgfsck sleep for much longer than
necessary.
Submitted by: Dan Nelson
Reviewed by: kirk
-rw-r--r-- | sbin/fsck_ffs/fsutil.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 528e115..28d5399 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -478,10 +478,9 @@ void slowio_start() { - /* Delay one in every 8 operations by 16 times the average IO delay */ + /* Delay one in every 8 operations */ slowio_pollcnt = (slowio_pollcnt + 1) & 7; if (slowio_pollcnt == 0) { - usleep(slowio_delay_usec * 16); gettimeofday(&slowio_starttime, NULL); } } @@ -501,9 +500,12 @@ slowio_end() (tv.tv_usec - slowio_starttime.tv_usec); if (delay_usec < 64) delay_usec = 64; - if (delay_usec > 1000000) - delay_usec = 1000000; + if (delay_usec > 2500000) + delay_usec = 2500000; slowio_delay_usec = (slowio_delay_usec * 63 + delay_usec) >> 6; + /* delay by 8 times the average IO delay */ + if (slowio_delay_usec > 64) + usleep(slowio_delay_usec * 8); } /* |