filehash/ffdb_pagepool.c
static ffdb_bkt_t *
_ffdb_pagepool_new_bkt (ffdb_pagepool_t* pgp)
{
  ffdb_bkt_t *bp = 0;

  /* If under cache limit, or there are no pages can be flushed
   * we always create new page
   *
   * valgrind keeps complaining about uninitialized memory. 
   */
  if ((bp = (ffdb_bkt_t *)malloc(sizeof(ffdb_bkt_t) + pgp->pagesize)) == 0)
    return 0;

#ifdef _FFDB_STATISTICS
  ++pgp->pagealloc;
#endif
  ++pgp->curcache;

  bp->page = (char *)bp + sizeof(ffdb_bkt_t);
  bp->ref = 0;
  bp->waiters = 0;
  bp->flags = 0;
  bp->owner = FFDB_THREAD_ID;

  /* change the bp flags */
  bp->flags = FFDB_PAGE_PINNED | FFDB_PAGE_VALID;

  /* initialize waiter queue */
  FFDB_CIRCLEQ_INIT(&(bp->wqh));

  return (bp);
}
/**
 * Get a page from the cache or create a new one
 * There is no lock on this routine. Higher level routines have to do it
 *
 * When this routine is one, the newly found (created) bucket should have
 * its pinned flag set
 *
 * This routine is called when the pgp->lock is held
 */
Get a page from the cache or create a new one
There is no lock on this routine. Higher level routines have to do it

When this routine is one, the newly found (created) bucket should have
its pinned flag set

This routine is called when the pgp->lock is held
Get a page from the cache or create a new one There is no lock on this routine . Higher level routines have to do it When this routine is one the newly found ( created ) bucket should have its pinned flag set This routine is called when the pgp - > lock is held
static ffdb_bkt_t *
_ffdb_pagepool_new_bkt (ffdb_pagepool_t* pgp)
{
  ffdb_bkt_t *bp = 0;
  if ((bp = (ffdb_bkt_t *)malloc(sizeof(ffdb_bkt_t) + pgp->pagesize)) == 0)
    return 0;
#ifdef _FFDB_STATISTICS
  ++pgp->pagealloc;
#endif
  ++pgp->curcache;
  bp->page = (char *)bp + sizeof(ffdb_bkt_t);
  bp->ref = 0;
  bp->waiters = 0;
  bp->flags = 0;
  bp->owner = FFDB_THREAD_ID;
  bp->flags = FFDB_PAGE_PINNED | FFDB_PAGE_VALID;
  FFDB_CIRCLEQ_INIT(&(bp->wqh));
  return (bp);
}
static ffdb_bkt_t * _ffdb_pagepool_new_bkt ( ffdb_pagepool_t * pgp ) { ffdb_bkt_t * bp = 0 ; if ( ( bp = ( ffdb_bkt_t * ) malloc ( sizeof ( ffdb_bkt_t ) + pgp -> pagesize ) ) == 0 ) return 0 ; #ifdef _FFDB_STATISTICS ++ pgp -> pagealloc ; #endif ++ pgp -> curcache ; bp -> page = ( char * ) bp + sizeof ( ffdb_bkt_t ) ; bp -> ref = 0 ; bp -> waiters = 0 ; bp -> flags = 0 ; bp -> owner = FFDB_THREAD_ID ; bp -> flags = FFDB_PAGE_PINNED | FFDB_PAGE_VALID ; FFDB_CIRCLEQ_INIT ( & ( bp -> wqh ) ) ; return ( bp ) ; }
Get a page from the cache or create a new one
 There is no lock on this routine.
Get a page from the cache or create a new one There is no lock on this routine .
/* If under cache limit, or there are no pages can be flushed
   * we always create new page
   *
   * valgrind keeps complaining about uninitialized memory. 
   */ /* change the bp flags */ /* initialize waiter queue */