summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-30 08:51:23 +0000
committerphk <phk@FreeBSD.org>2003-03-30 08:51:23 +0000
commita0fbf937559403c829123a70c7d5a56e2ef741bb (patch)
tree1258453658c2e860001261df6ebe12fa9e449e33 /sys/kern
parent47e745e49e994d3ccd02cc13b6f3840824314f0c (diff)
downloadFreeBSD-src-a0fbf937559403c829123a70c7d5a56e2ef741bb.zip
FreeBSD-src-a0fbf937559403c829123a70c7d5a56e2ef741bb.tar.gz
Preparation commit before I start on the bioqueue lockdown:
Collect all the bits of bioqueue handing in subr_disk.c, vfs_bio.c is big enough as it is and disksort already lives in subr_disk.c.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_disk.c43
-rw-r--r--sys/kern/vfs_bio.c25
2 files changed, 43 insertions, 25 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 375f751..3e09cca 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -62,6 +62,49 @@ disk_err(struct bio *bp, const char *what, int blkdone, int nl)
}
/*
+ * BIO queue implementation
+ */
+
+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;
+}
+void
+bioq_insert_tail(struct bio_queue_head *head, struct bio *bp)
+{
+
+ TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue);
+}
+
+struct bio *
+bioq_first(struct bio_queue_head *head)
+{
+
+ return (TAILQ_FIRST(&head->queue));
+}
+
+
+/*
* Seek sort for disks.
*
* The buf_queue keep two queues, sorted in ascending block order. The first
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 82db7f4..489512c 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -2986,31 +2986,6 @@ biofinish(struct bio *bp, struct devstat *stat, int error)
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