diff options
author | phk <phk@FreeBSD.org> | 2002-09-13 11:39:11 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-09-13 11:39:11 +0000 |
commit | 39330dc632633393578de07de7d1e1faf9768680 (patch) | |
tree | 7c7544e626b6f5e3cb927d117a4259b70005d3af /sys/geom/geom_io.c | |
parent | c7f7c94e96a3ca3b6ee08f2709863c82e301de41 (diff) | |
download | FreeBSD-src-39330dc632633393578de07de7d1e1faf9768680.zip FreeBSD-src-39330dc632633393578de07de7d1e1faf9768680.tar.gz |
Use biowait() rather than DIY.
Sponsored by: DARPA & NAI Labs
Diffstat (limited to 'sys/geom/geom_io.c')
-rw-r--r-- | sys/geom/geom_io.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 9fadc7c..db6db80 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -178,12 +178,7 @@ g_io_setattr(const char *attr, struct g_consumer *cp, int len, void *ptr) bp->bio_length = len; bp->bio_data = ptr; g_io_request(bp, cp); - while ((bp->bio_flags & BIO_DONE) == 0) { - mtx_lock(&Giant); - tsleep(bp, 0, "setattr", hz / 10); - mtx_unlock(&Giant); - } - error = bp->bio_error; + error = biowait(bp, "gsetattr"); g_destroy_bio(bp); if (error == EBUSY) tsleep(&error, 0, "setattr_busy", hz); @@ -207,13 +202,8 @@ g_io_getattr(const char *attr, struct g_consumer *cp, int *len, void *ptr) bp->bio_length = *len; bp->bio_data = ptr; g_io_request(bp, cp); - while ((bp->bio_flags & BIO_DONE) == 0) { - mtx_lock(&Giant); - tsleep(bp, 0, "getattr", hz / 10); - mtx_unlock(&Giant); - } + error = biowait(bp, "ggetattr"); *len = bp->bio_completed; - error = bp->bio_error; g_destroy_bio(bp); if (error == EBUSY) tsleep(&error, 0, "getattr_busy", hz); @@ -346,13 +336,8 @@ g_io_schedule_up(struct thread *tp __unused) cp = bp->bio_from; - bp->bio_flags |= BIO_DONE; atomic_add_int(&cp->biocount, -1); - if (bp->bio_done != NULL) { - bp->bio_done(bp); - } else { - wakeup(bp); - } + biodone(bp); } } @@ -372,12 +357,7 @@ g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error) ptr = g_malloc(length, M_WAITOK); bp->bio_data = ptr; g_io_request(bp, cp); - while ((bp->bio_flags & BIO_DONE) == 0) { - mtx_lock(&Giant); - tsleep(bp, 0, "g_read_data", hz / 10); - mtx_unlock(&Giant); - } - errorc = bp->bio_error; + errorc = biowait(bp, "gread"); if (error != NULL) *error = errorc; g_destroy_bio(bp); |