filehash/ffdb_pagepool.c
int
ffdb_pagepool_close (ffdb_pagepool_t* pgp)
{
  ffdb_bkt_t* bp;

  /* First Sync Everything to disk */
  ffdb_pagepool_sync (pgp);

  FFDB_LOCK(pgp->lock);
  
  /* Free Every BUCKET */
  bp = FFDB_CIRCLEQ_FIRST(&pgp->lqh);  
  while (!FFDB_CIRCLEQ_EMPTY(&pgp->lqh)) {
    FFDB_CIRCLEQ_REMOVE(&pgp->lqh, bp, lq);

    free (bp);
    bp = FFDB_CIRCLEQ_FIRST(&pgp->lqh);  
  }

  /* close file descriptor */
  if (pgp->close_fd)
    close (pgp->fd);
  
  FFDB_UNLOCK(pgp->lock);  

  /* destroy lock */
  FFDB_LOCK_FINI(pgp->lock);

  free (pgp);
  return 0;
}
/**
 * Close the page poll pointer and any resource associated with this file
 * This implies all dirty pages are flushed out, 
 *
 * @param pgp cache page poll pointer
 * @return 0 the file is closed successfully and all pages are written back
 * to th back file. If there are still pinned pages by other threads, return -1
 * and errno is set to EAGAIN.
 */
Close the page poll pointer and any resource associated with this file
This implies all dirty pages are flushed out.

@param pgp cache page poll pointer
@return 0 the file is closed successfully and all pages are written back
to th back file. If there are still pinned pages by other threads, return -1
and errno is set to EAGAIN.
Close the page poll pointer and any resource associated with this file This implies all dirty pages are flushed out . @param pgp cache page poll pointer @return 0 the file is closed successfully and all pages are written back to th back file . If there are still pinned pages by other threads return - 1 and errno is set to EAGAIN .
int
ffdb_pagepool_close (ffdb_pagepool_t* pgp)
{
  ffdb_bkt_t* bp;
  ffdb_pagepool_sync (pgp);
  FFDB_LOCK(pgp->lock);
  bp = FFDB_CIRCLEQ_FIRST(&pgp->lqh);  
  while (!FFDB_CIRCLEQ_EMPTY(&pgp->lqh)) {
    FFDB_CIRCLEQ_REMOVE(&pgp->lqh, bp, lq);
    free (bp);
    bp = FFDB_CIRCLEQ_FIRST(&pgp->lqh);  
  }
  if (pgp->close_fd)
    close (pgp->fd);
  FFDB_UNLOCK(pgp->lock);  
  FFDB_LOCK_FINI(pgp->lock);
  free (pgp);
  return 0;
}
int ffdb_pagepool_close ( ffdb_pagepool_t * pgp ) { ffdb_bkt_t * bp ; ffdb_pagepool_sync ( pgp ) ; FFDB_LOCK ( pgp -> lock ) ; bp = FFDB_CIRCLEQ_FIRST ( & pgp -> lqh ) ; while ( ! FFDB_CIRCLEQ_EMPTY ( & pgp -> lqh ) ) { FFDB_CIRCLEQ_REMOVE ( & pgp -> lqh , bp , lq ) ; free ( bp ) ; bp = FFDB_CIRCLEQ_FIRST ( & pgp -> lqh ) ; } if ( pgp -> close_fd ) close ( pgp -> fd ) ; FFDB_UNLOCK ( pgp -> lock ) ; FFDB_LOCK_FINI ( pgp -> lock ) ; free ( pgp ) ; return 0 ; }
Close the page poll pointer and any resource associated with this file
 This implies all dirty pages are flushed out,
Close the page poll pointer and any resource associated with this file This implies all dirty pages are flushed out
/* First Sync Everything to disk */ /* Free Every BUCKET */ /* close file descriptor */ /* destroy lock */