diff options
author | 2013-11-20 23:52:42 +0000 | |
---|---|---|
committer | 2013-11-20 23:52:42 +0000 | |
commit | 19a2caae5e40d9de3b61fad8d545b301375f2074 (patch) | |
tree | 95c718abca24cf3598d9370e8605c685af563ee1 /sys/kern/subr_disk.c | |
parent | shared semaphore fixes. first, eliminate the sem inside a sem indirection. (diff) | |
download | wireguard-openbsd-19a2caae5e40d9de3b61fad8d545b301375f2074.tar.xz wireguard-openbsd-19a2caae5e40d9de3b61fad8d545b301375f2074.zip |
now that all the direct users of disksort have been removed, we can now
safely remove disksort.
most hardware and pretty much all of the kernel has moved to logical
block addressing when dealing with disks, so the assumptions disksort
was built against arent useful these days. it also has bad edge cases
with lots of sequential writes being able to starve other io requests
in the system. these issues have been addressed by becks nscan
implementation, which disksort was previously deprecated in favour
of.
this removes the guts of disksort and the bufq wrapper around it.
ok miod@
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r-- | sys/kern/subr_disk.c | 98 |
1 files changed, 1 insertions, 97 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 57a4027e57c..fccc90c1a58 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.158 2013/11/18 17:45:01 deraadt Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.159 2013/11/20 23:52:42 dlg Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -91,99 +91,6 @@ void sr_map_root(void); void disk_attach_callback(void *, void *); /* - * Seek sort for disks. We depend on the driver which calls us using b_resid - * as the current cylinder number. - * - * The argument ap structure holds a b_actf activity chain pointer on which we - * keep two queues, sorted in ascending cylinder order. The first queue holds - * those requests which are positioned after the current cylinder (in the first - * request); the second holds requests which came in after their cylinder number - * was passed. Thus we implement a one way scan, retracting after reaching the - * end of the drive to the first request on the second queue, at which time it - * becomes the first queue. - * - * A one-way scan is natural because of the way UNIX read-ahead blocks are - * allocated. - */ - -void -disksort(struct buf *ap, struct buf *bp) -{ - struct buf *bq; - - /* If the queue is empty, then it's easy. */ - if (ap->b_actf == NULL) { - bp->b_actf = NULL; - ap->b_actf = bp; - return; - } - - /* - * If we lie after the first (currently active) request, then we - * must locate the second request list and add ourselves to it. - */ - bq = ap->b_actf; - if (bp->b_cylinder < bq->b_cylinder) { - while (bq->b_actf) { - /* - * Check for an ``inversion'' in the normally ascending - * cylinder numbers, indicating the start of the second - * request list. - */ - if (bq->b_actf->b_cylinder < bq->b_cylinder) { - /* - * Search the second request list for the first - * request at a larger cylinder number. We go - * before that; if there is no such request, we - * go at end. - */ - do { - if (bp->b_cylinder < - bq->b_actf->b_cylinder) - goto insert; - if (bp->b_cylinder == - bq->b_actf->b_cylinder && - bp->b_blkno < bq->b_actf->b_blkno) - goto insert; - bq = bq->b_actf; - } while (bq->b_actf); - goto insert; /* after last */ - } - bq = bq->b_actf; - } - /* - * No inversions... we will go after the last, and - * be the first request in the second request list. - */ - goto insert; - } - /* - * Request is at/after the current request... - * sort in the first request list. - */ - while (bq->b_actf) { - /* - * We want to go after the current request if there is an - * inversion after it (i.e. it is the end of the first - * request list), or if the next request is a larger cylinder - * than our request. - */ - if (bq->b_actf->b_cylinder < bq->b_cylinder || - bp->b_cylinder < bq->b_actf->b_cylinder || - (bp->b_cylinder == bq->b_actf->b_cylinder && - bp->b_blkno < bq->b_actf->b_blkno)) - goto insert; - bq = bq->b_actf; - } - /* - * Neither a second list nor a larger request... we go at the end of - * the first list, which is the same as the end of the whole schebang. - */ -insert: bp->b_actf = bq->b_actf; - bq->b_actf = bp; -} - -/* * Compute checksum for disk label. */ u_int @@ -720,9 +627,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp) bp->b_bcount = sz << DEV_BSHIFT; } - /* calculate cylinder for disksort to order transfers with */ - bp->b_cylinder = (bp->b_blkno + DL_SECTOBLK(lp, DL_GETPOFFSET(p))) / - DL_SECTOBLK(lp, lp->d_secpercyl); return (0); bad: |