summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-14 19:34:11 +0000
committerphk <phk@FreeBSD.org>2002-09-14 19:34:11 +0000
commitcff87abbac5243f0a34923de8c9a99a54a663adb (patch)
tree44ed797fbc1fadb644d7aacd1e0b88e69a6755e4 /sys/kern/vfs_bio.c
parent79ce8a243fa3651af69ae1551da894135499e83b (diff)
downloadFreeBSD-src-cff87abbac5243f0a34923de8c9a99a54a663adb.zip
FreeBSD-src-cff87abbac5243f0a34923de8c9a99a54a663adb.tar.gz
Un-inline the non-trivial "trivial" bio* functions.
Untangle devstat_end_transaction_bio()
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a4e0397..3ef984a 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -32,6 +32,7 @@
#include <sys/stdint.h>
#include <sys/bio.h>
#include <sys/buf.h>
+#include <sys/devicestat.h>
#include <sys/eventhandler.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@@ -2834,6 +2835,44 @@ biowait(struct bio *bp, const char *wchan)
return (EIO);
}
+void
+biofinish(struct bio *bp, struct devstat *stat, int error)
+{
+
+ if (error) {
+ bp->bio_error = error;
+ bp->bio_flags |= BIO_ERROR;
+ }
+ if (stat != NULL)
+ devstat_end_transaction_bio(stat, bp);
+ biodone(bp);
+}
+
+void
+bioq_init(struct bio_queue_head *head)
+{
+ TAILQ_INIT(&head->queue);
+ head->last_pblkno = 0;
+ head->insert_point = NULL;
+ head->switch_point = NULL;
+}
+
+void
+bioq_remove(struct bio_queue_head *head, struct bio *bp)
+{
+ if (bp == head->switch_point)
+ head->switch_point = TAILQ_NEXT(bp, bio_queue);
+ if (bp == head->insert_point) {
+ head->insert_point = TAILQ_PREV(bp, bio_queue, bio_queue);
+ if (head->insert_point == NULL)
+ head->last_pblkno = 0;
+ } else if (bp == TAILQ_FIRST(&head->queue))
+ head->last_pblkno = bp->bio_pblkno;
+ TAILQ_REMOVE(&head->queue, bp, bio_queue);
+ if (TAILQ_FIRST(&head->queue) == head->switch_point)
+ head->switch_point = NULL;
+}
+
/*
* bufwait:
*
OpenPOWER on IntegriCloud