cvs commit: src/sys/sys bio.h src/sys/kern subr_disk.c

Poul-Henning Kamp phk at FreeBSD.org
Thu Aug 19 12:51:51 PDT 2004


phk         2004-08-19 19:51:51 UTC

  FreeBSD src repository

  Modified files:
    sys/sys              bio.h 
    sys/kern             subr_disk.c 
  Log:
  Add bioq_takefirst().
  
  If the bioq is empty, NULL is returned.  Otherwise the front element
  is removed and returned.
  
  This can simplify locking in many drivers from:
  
          lock()
          bp = bioq_first(bq);
          if (bp == NULL) {
                  unlock()
                  return
          }
          bioq_remove(bp, bq)
          unlock
  to:
          lock()
          bp = bioq_takefirst(bq);
          unlock()
          if (bp == NULL)
                  return;
  
  Revision  Changes    Path
  1.81      +11 -6     src/sys/kern/subr_disk.c
  1.140     +2 -0      src/sys/sys/bio.h


More information about the cvs-src mailing list