Don't forget to unhash buffers when freeing them.
{
/* There are only dirty pages here */
p = HEAD(c->dirty_pages);
+ ASSERT(p->n.next);
flush_page(c, p);
}
ASSERT(!p->lock_count);
{
ASSERT(!(p->flags & PG_FLAG_DIRTY) && !p->lock_count);
rem_node(&p->n);
+ rem_node(&p->hn);
c->free_count--;
c->total_count--;
free(p);
}
else
{
+ rem_node(&p->hn);
free(p);
c->total_count--;
}
return p->data + offset;
}
+sh_off_t
+pgc_page_pos(struct page_cache *c, struct page *p)
+{
+ return PAGE_NUMBER(p->key);
+}
+
#ifdef TEST
int main(int argc, char **argv)
void pgc_put(struct page_cache *, struct page *); /* Release page */
void pgc_mark_dirty(struct page_cache *, struct page *); /* Mark locked page as dirty */
byte *pgc_read_data(struct page_cache *, int fd, sh_off_t, uns *); /* Partial reading */
+sh_off_t pgc_page_pos(struct page_cache *, struct page *); /* Get page position */
#endif