14 #include <sys/cdefs.h> 
   19 #include <sys/param.h> 
   20 #include <sys/systm.h> 
   24 #include <geom/geom_disk.h> 
   34 disk_err(
struct bio *bp, 
const char *what, 
int blkdone, 
int nl)
 
   38         if (bp->bio_dev != NULL)
 
   40         else if (bp->bio_disk != NULL)
 
   42                     bp->bio_disk->d_name, bp->bio_disk->d_unit, what);
 
   44                 printf(
"disk??: %s ", what);
 
   46         case BIO_READ:          
printf(
"cmd=read "); 
break;
 
   47         case BIO_WRITE:         
printf(
"cmd=write "); 
break;
 
   48         case BIO_DELETE:        
printf(
"cmd=delete "); 
break;
 
   49         case BIO_GETATTR:       
printf(
"cmd=getattr "); 
break;
 
   50         case BIO_FLUSH:         
printf(
"cmd=flush "); 
break;
 
   51         default:                
printf(
"cmd=%x ", bp->bio_cmd); 
break;
 
   54         if (bp->bio_bcount <= DEV_BSIZE) {
 
   55                 printf(
"fsbn %jd%s", (intmax_t)sn, nl ? 
"\n" : 
"");
 
   60                 printf(
"fsbn %jd of ", (intmax_t)sn);
 
   62         printf(
"%jd-%jd", (intmax_t)bp->bio_pblkno,
 
   63             (intmax_t)(bp->bio_pblkno + (bp->bio_bcount - 1) / DEV_BSIZE));
 
  150         TAILQ_INIT(&head->queue);
 
  151         head->last_offset = 0;
 
  152         head->insert_point = NULL;
 
  159         if (head->insert_point == NULL) {
 
  160                 if (bp == TAILQ_FIRST(&head->queue))
 
  161                         head->last_offset = bp->bio_offset + bp->bio_length;
 
  162         } 
else if (bp == head->insert_point)
 
  163                 head->insert_point = NULL;
 
  165         TAILQ_REMOVE(&head->queue, bp, bio_queue);
 
  169 bioq_flush(
struct bio_queue_head *head, 
struct devstat *stp, 
int error)
 
  181         if (head->insert_point == NULL)
 
  182                 head->last_offset = bp->bio_offset;
 
  183         TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
 
  190         TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue);
 
  191         head->insert_point = bp;
 
  192         head->last_offset = bp->bio_offset;
 
  199         return (TAILQ_FIRST(&head->queue));
 
  207         bp = TAILQ_FIRST(&head->queue);
 
  222         return ((uoff_t)(bp->bio_offset - head->last_offset));
 
  235         struct bio *cur, *prev;
 
  238         if ((bp->bio_flags & BIO_ORDERED) != 0) {
 
  251         cur = TAILQ_FIRST(&head->queue);
 
  253         if (head->insert_point) {
 
  254                 prev = head->insert_point;
 
  255                 cur = TAILQ_NEXT(head->insert_point, bio_queue);
 
  260                 cur = TAILQ_NEXT(cur, bio_queue);
 
  264                 TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue);
 
  266                 TAILQ_INSERT_AFTER(&head->queue, prev, bp, bio_queue);
 
struct bio * bioq_first(struct bio_queue_head *head)
static uoff_t bioq_bio_key(struct bio_queue_head *head, struct bio *bp)
void biofinish(struct bio *bp, struct devstat *stat, int error)
void bioq_insert_head(struct bio_queue_head *head, struct bio *bp)
void bioq_init(struct bio_queue_head *head)
void bioq_disksort(struct bio_queue_head *head, struct bio *bp)
void disk_err(struct bio *bp, const char *what, int blkdone, int nl)
int printf(const char *fmt,...)
void bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error)
void bioq_remove(struct bio_queue_head *head, struct bio *bp)
void bioq_insert_tail(struct bio_queue_head *head, struct bio *bp)
const char * devtoname(struct cdev *dev)
struct bio * bioq_takefirst(struct bio_queue_head *head)