subr_disk.c (112367) | subr_disk.c (112846) |
---|---|
1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * | 1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * |
9 * $FreeBSD: head/sys/kern/subr_disk.c 112367 2003-03-18 08:45:25Z phk $ | 9 * $FreeBSD: head/sys/kern/subr_disk.c 112846 2003-03-30 08:51:23Z phk $ |
10 * 11 */ 12 13#include "opt_geom.h" 14 15#include <sys/param.h> 16#include <sys/systm.h> 17#include <sys/bio.h> --- 39 unchanged lines hidden (view full) --- 57 } 58 printf("%jd-%jd", (intmax_t)bp->bio_blkno, 59 (intmax_t)(bp->bio_blkno + (bp->bio_bcount - 1) / DEV_BSIZE)); 60 if (nl) 61 printf("\n"); 62} 63 64/* | 10 * 11 */ 12 13#include "opt_geom.h" 14 15#include <sys/param.h> 16#include <sys/systm.h> 17#include <sys/bio.h> --- 39 unchanged lines hidden (view full) --- 57 } 58 printf("%jd-%jd", (intmax_t)bp->bio_blkno, 59 (intmax_t)(bp->bio_blkno + (bp->bio_bcount - 1) / DEV_BSIZE)); 60 if (nl) 61 printf("\n"); 62} 63 64/* |
65 * BIO queue implementation 66 */ 67 68void 69bioq_init(struct bio_queue_head *head) 70{ 71 TAILQ_INIT(&head->queue); 72 head->last_pblkno = 0; 73 head->insert_point = NULL; 74 head->switch_point = NULL; 75} 76 77void 78bioq_remove(struct bio_queue_head *head, struct bio *bp) 79{ 80 if (bp == head->switch_point) 81 head->switch_point = TAILQ_NEXT(bp, bio_queue); 82 if (bp == head->insert_point) { 83 head->insert_point = TAILQ_PREV(bp, bio_queue, bio_queue); 84 if (head->insert_point == NULL) 85 head->last_pblkno = 0; 86 } else if (bp == TAILQ_FIRST(&head->queue)) 87 head->last_pblkno = bp->bio_pblkno; 88 TAILQ_REMOVE(&head->queue, bp, bio_queue); 89 if (TAILQ_FIRST(&head->queue) == head->switch_point) 90 head->switch_point = NULL; 91} 92void 93bioq_insert_tail(struct bio_queue_head *head, struct bio *bp) 94{ 95 96 TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue); 97} 98 99struct bio * 100bioq_first(struct bio_queue_head *head) 101{ 102 103 return (TAILQ_FIRST(&head->queue)); 104} 105 106 107/* |
|
65 * Seek sort for disks. 66 * 67 * The buf_queue keep two queues, sorted in ascending block order. The first 68 * queue holds those requests which are positioned after the current block 69 * (in the first request); the second, which starts at queue->switch_point, 70 * holds requests which came in after their block number was passed. Thus 71 * we implement a one way scan, retracting after reaching the end of the drive 72 * to the first request on the second queue, at which time it becomes the --- 111 unchanged lines hidden --- | 108 * Seek sort for disks. 109 * 110 * The buf_queue keep two queues, sorted in ascending block order. The first 111 * queue holds those requests which are positioned after the current block 112 * (in the first request); the second, which starts at queue->switch_point, 113 * holds requests which came in after their block number was passed. Thus 114 * we implement a one way scan, retracting after reaching the end of the drive 115 * to the first request on the second queue, at which time it becomes the --- 111 unchanged lines hidden --- |