From 0bd4a8ed0ea5295bd00de63d33253ad05548d71f Mon Sep 17 00:00:00 2001 From: Miguel Figueiredo Date: Mon, 27 May 2013 01:03:41 +0200 Subject: Remove old elevator algorithm function * device/blkio.c (disksort): remove unused function --- device/blkio.c | 129 --------------------------------------------------------- 1 file changed, 129 deletions(-) (limited to 'device') diff --git a/device/blkio.c b/device/blkio.c index 26d4a75..27fec0e 100644 --- a/device/blkio.c +++ b/device/blkio.c @@ -107,132 +107,3 @@ vm_offset_t block_io_mmap() return (0); } -/* - * Disk sort routine. - * - * We order the disk request chain so that the disk head will sweep - * back and forth across the disk. The chain is divided into two - * pieces, with requests ordered in opposite directions. Assume that - * the first part of the chain holds increasing cylinder numbers. - * If a new request has a higher cylinder number than the head of - * the chain, the disk head has not yet reached it; the new request - * can go in the first part of the chain. If the new request has - * a lower cylinder number, the disk head has already passed it and - * must catch it on the way back; so the new request goes in the - * second (descending) part of the chain. - * When all of the requests in the ascending portion are filled, - * the descending chain becomes the first chain, and requests above - * the first now go in the second part of the chain (ascending). - */ - -#define io_cylinder io_residual - /* Disk drivers put cylinder here */ -#define h_head io_next -#define h_tail io_prev - /* IORs are chained here */ - -void disksort(head, ior) - io_req_t head; /* (sort of) */ - io_req_t ior; -{ - register int cylinder = ior->io_cylinder; - register io_req_t next, prev; - - next = head->h_head; - if (next == 0) { - head->h_head = ior; - head->h_tail = ior; - ior->io_next = 0; - return; - } - - do { - prev = next; - next = prev->io_next; - } while (next != 0 && prev->io_cylinder == next->io_cylinder); - - if (next == 0) { - prev->io_next = ior; - head->h_tail = ior; - ior->io_next = 0; - return; - } - - if (prev->io_cylinder < next->io_cylinder) { - /* - * Ascending list first. - */ - if (prev->io_cylinder <= cylinder) { - /* - * Insert in ascending list. - */ - while (next != 0 && - next->io_cylinder <= cylinder && - prev->io_cylinder <= next->io_cylinder) - { - prev = next; - next = prev->io_next; - } - } - else { - /* - * Insert in descending list - */ - do { - prev = next; - next = prev->io_next; - } while (next != 0 && - prev->io_cylinder <= next->io_cylinder); - - while (next != 0 && - next->io_cylinder >= cylinder) - { - prev = next; - next = prev->io_next; - } - } - } - else { - /* - * Descending first. - */ - if (prev->io_cylinder >= cylinder) { - /* - * Insert in descending list. - */ - while (next != 0 && - next->io_cylinder >= cylinder && - prev->io_cylinder >= next->io_cylinder) - { - prev = next; - next = prev->io_next; - } - } - else { - /* - * Insert in ascending list - */ - do { - prev = next; - next = prev->io_next; - } while (next != 0 && - prev->io_cylinder >= next->io_cylinder); - while (next != 0 && - next->io_cylinder <= cylinder) - { - prev = next; - next = prev->io_next; - } - } - } - /* - * Insert between prev and next. - */ - prev->io_next = ior; - ior->io_next = next; - if (next == 0) { - /* At tail of list. */ - head->h_tail = ior; - } -} - -- cgit v1.2.3