Use time_uptime instead of time_second, as the latter may go backwards.

Suggested by:	ru
MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2006-02-12 17:36:09 +00:00
parent 2ce61916c2
commit 01f1f41c25
2 changed files with 8 additions and 8 deletions

View File

@ -787,7 +787,7 @@ g_mirror_idle(struct g_mirror_softc *sc, int from_access)
if (sc->sc_writes > 0)
return (0);
if (!from_access && sc->sc_provider->acw > 0) {
timeout = g_mirror_idletime - (time_second - sc->sc_last_write);
timeout = g_mirror_idletime - (time_uptime - sc->sc_last_write);
if (timeout > 0)
return (timeout);
}
@ -813,7 +813,7 @@ g_mirror_unidle(struct g_mirror_softc *sc)
struct g_mirror_disk *disk;
sc->sc_idle = 0;
sc->sc_last_write = time_second;
sc->sc_last_write = time_uptime;
g_topology_lock();
LIST_FOREACH(disk, &sc->sc_disks, d_next) {
if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE)
@ -1368,7 +1368,7 @@ g_mirror_register_request(struct bio *bp)
if (sc->sc_idle)
g_mirror_unidle(sc);
else
sc->sc_last_write = time_second;
sc->sc_last_write = time_uptime;
/*
* Allocate all bios before sending any request, so we can
@ -2534,7 +2534,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md)
sc->sc_flags = md->md_mflags;
sc->sc_bump_id = 0;
sc->sc_idle = 1;
sc->sc_last_write = time_second;
sc->sc_last_write = time_uptime;
sc->sc_writes = 0;
bioq_init(&sc->sc_queue);
mtx_init(&sc->sc_queue_mtx, "gmirror:queue", NULL, MTX_DEF);

View File

@ -809,7 +809,7 @@ g_raid3_idle(struct g_raid3_softc *sc, int from_access)
if (sc->sc_writes > 0)
return (0);
if (!from_access && sc->sc_provider->acw > 0) {
timeout = g_raid3_idletime - (time_second - sc->sc_last_write);
timeout = g_raid3_idletime - (time_uptime - sc->sc_last_write);
if (timeout > 0)
return (timeout);
}
@ -837,7 +837,7 @@ g_raid3_unidle(struct g_raid3_softc *sc)
u_int i;
sc->sc_idle = 0;
sc->sc_last_write = time_second;
sc->sc_last_write = time_uptime;
g_topology_lock();
for (i = 0; i < sc->sc_ndisks; i++) {
disk = &sc->sc_disks[i];
@ -1575,7 +1575,7 @@ g_raid3_register_request(struct bio *pbp)
if (sc->sc_idle)
g_raid3_unidle(sc);
else
sc->sc_last_write = time_second;
sc->sc_last_write = time_uptime;
ndisks = sc->sc_ndisks;
@ -2786,7 +2786,7 @@ g_raid3_create(struct g_class *mp, const struct g_raid3_metadata *md)
sc->sc_flags = md->md_mflags;
sc->sc_bump_id = 0;
sc->sc_idle = 1;
sc->sc_last_write = time_second;
sc->sc_last_write = time_uptime;
sc->sc_writes = 0;
for (n = 0; n < sc->sc_ndisks; n++) {
sc->sc_disks[n].d_softc = sc;