# 2.11BSD#431 - /usr/src/sys/sys/ufs_dsort.c

##### Functions

    disksort          X
    dk_alloc          X

       1: /*
       2:  * Copyright (c) 1986 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  *
       6:  *	@(#)ufs_dsort.c	1.1 (2.10BSD Berkeley) 12/1/86
       7:  */
       8:
       9: /*
      10:  * generalized seek sort for disk
      11:  */
      12:
      13: #include "param.h"
      14: #include "systm.h"
      15: #include "buf.h"
      16: #include "dk.h"
      17:
      18: disksort(dp, bp)
      19:     register struct buf *dp, *bp;
      20: {
      21:     register struct buf *ap;
      22:     struct buf *tp;
      23:
      24:     ap = dp->b_actf;
      25:     if (ap == NULL) {
      26:         dp->b_actf = bp;
      27:         dp->b_actl = bp;
      28:         bp->av_forw = NULL;
      29:         return;
      30:     }
      31:     tp = NULL;
      32:     for (; ap != NULL; ap = ap->av_forw) {
      33:         if ((bp->b_flags&B_READ) && (ap->b_flags&B_READ) == 0) {
      34:             if (tp == NULL)
      35:                 tp = ap;
      36:             break;
      37:         }
      38:         if ((bp->b_flags&B_READ) == 0 && (ap->b_flags&B_READ))
      39:             continue;
      40:         if (ap->b_cylin <= bp->b_cylin)
      41:             if (tp == NULL || ap->b_cylin >= tp->b_cylin)
      42:                 tp = ap;
      43:     }
      44:     if (tp == NULL)
      45:         tp = dp->b_actl;
      46:     bp->av_forw = tp->av_forw;
      47:     tp->av_forw = bp;
      48:     if (tp == dp->b_actl)
      49:         dp->b_actl = bp;
      50: }
      51:
      52: #ifdef UCB_METER
      53: /*
      54:  * Allocate iostat disk monitoring slots for a driver.  If slots already
      55:  * allocated (*dkn >= 0) or not enough slots left to satisfy request simply
      56:  * ignore it.
      57:  */
      58: dk_alloc(dkn, slots, name, wps)
      59:     int *dkn;   /* pointer to number for iostat */
      60:     int slots;  /* number of iostat slots requested */
      61:     char *name; /* name of device */
      62:     long wps;   /* words per second transfer rate */
      63: {
      64:     int i;
      65:     register char **np;
      66:     register int *up;
      67:     register long *wp;
      68:
      69:     if (*dkn < 0 && dk_n + slots <= DK_NDRIVE) {
      70:         /*
      71: 		 * Allocate and initialize the slots
      72: 		 */
      73:         *dkn = dk_n;
      74:         np = &dk_name[dk_n];
      75:         up = &dk_unit[dk_n];
      76:         wp = &dk_wps[dk_n];
      77:         dk_n += slots;
      78:
      79:         for (i = 0; i < slots; i++) {
      80:             *np++ = name;
      81:             *up++ = i;
      82:             *wp++ = wps;
      83:         }
      84:     }
      85: }
      86: #endif /* UCB_METER */

#### Defined functions

disksort defined in line 18; used 6 times

- in /usr/src/sys/pdpuba/br.c line 203
- in /usr/src/sys/pdpuba/hk.c line 351
- in /usr/src/sys/pdpuba/rl.c line 353, 580
- in /usr/src/sys/pdpuba/si.c line 144
- in /usr/src/sys/pdpuba/xp.c line 413

dk_alloc defined in line 58; used 8 times

- in /usr/src/sys/pdp/ram.c line 44
- in /usr/src/sys/pdpuba/br.c line 138
- in /usr/src/sys/pdpuba/hk.c line 110
- in /usr/src/sys/pdpuba/ra.c line 307
- in /usr/src/sys/pdpuba/rk.c line 51
- in /usr/src/sys/pdpuba/rl.c line 117
- in /usr/src/sys/pdpuba/si.c line 84
- in /usr/src/sys/pdpuba/xp.c line 147

Last modified: 1987-08-19 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 525 |