filehash/ffdb_page.c
pgno_t
ffdb_last_data_page (ffdb_htab_t* hashp, pgno_t start)
{
  pgno_t page, ret, tp;
  void* pagep;
  int  done = 0;

  /* We start from the first page above reguler hash pages */
  ret = INVALID_PGNO;
  page = start;
  while (!done) {
    pagep = ffdb_get_page (hashp, page, HASH_RAW_PAGE, 0, &tp);
    if (!pagep) {
      fprintf (stderr, "Cannot get page %d while looking for the last data page.\n",
	       page);
      abort ();
    }
    if (TYPE(pagep) == HASH_DATA_PAGE && NEXT_PGNO(pagep) == INVALID_PGNO) {
      done = 1;
      ret = page;
    }
    ffdb_put_page (hashp, pagep, TYPE(pagep), 0);
    page--;
  }

  return ret;
}
/**
 * Search for the last data page on this level starting from the last
 * going backward to search
 *
 * This routine has to success since there is at least one data page
 * at any level
 */
Search for the last data page on this level starting from the last
going backward to search

This routine has to success since there is at least one data page
at any level
Search for the last data page on this level starting from the last going backward to search This routine has to success since there is at least one data page at any level
pgno_t
ffdb_last_data_page (ffdb_htab_t* hashp, pgno_t start)
{
  pgno_t page, ret, tp;
  void* pagep;
  int  done = 0;
  ret = INVALID_PGNO;
  page = start;
  while (!done) {
    pagep = ffdb_get_page (hashp, page, HASH_RAW_PAGE, 0, &tp);
    if (!pagep) {
      fprintf (stderr, "Cannot get page %d while looking for the last data page.\n",
	       page);
      abort ();
    }
    if (TYPE(pagep) == HASH_DATA_PAGE && NEXT_PGNO(pagep) == INVALID_PGNO) {
      done = 1;
      ret = page;
    }
    ffdb_put_page (hashp, pagep, TYPE(pagep), 0);
    page--;
  }
  return ret;
}
pgno_t ffdb_last_data_page ( ffdb_htab_t * hashp , pgno_t start ) { pgno_t page , ret , tp ; void * pagep ; int done = 0 ; ret = INVALID_PGNO ; page = start ; while ( ! done ) { pagep = ffdb_get_page ( hashp , page , HASH_RAW_PAGE , 0 , & tp ) ; if ( ! pagep ) { fprintf ( stderr , " \n " , page ) ; abort ( ) ; } if ( TYPE ( pagep ) == HASH_DATA_PAGE && NEXT_PGNO ( pagep ) == INVALID_PGNO ) { done = 1 ; ret = page ; } ffdb_put_page ( hashp , pagep , TYPE ( pagep ) , 0 ) ; page -- ; } return ret ; }
Search for the last data page on this level starting from the last
 going backward to search
Search for the last data page on this level starting from the last going backward to search
/* We start from the first page above reguler hash pages */