2006-06-22 19:10:02 +00:00
|
|
|
/**
|
|
|
|
Allocates and deallocates regions of pages. The page before each
|
|
|
|
region is of type BOUNDARY_TAG. All regions except the last one in
|
|
|
|
the page file have a BOUNDARY_TAG page immediately after the end of
|
|
|
|
the region.
|
|
|
|
|
|
|
|
Each region is managed by an allocation manager, which manages the
|
|
|
|
allocation of pages within a region. The contents of pages within
|
|
|
|
a newly allocated region are undefined.
|
|
|
|
*/
|
|
|
|
|
2006-07-20 01:29:39 +00:00
|
|
|
typedef struct boundary_tag {
|
|
|
|
unsigned int size;
|
|
|
|
unsigned int prev_size;
|
|
|
|
int status;
|
|
|
|
int region_xid;
|
|
|
|
int allocation_manager;
|
|
|
|
} boundary_tag;
|
|
|
|
|
|
|
|
#define REGION_BASE (123)
|
|
|
|
#define REGION_VACANT (REGION_BASE + 0)
|
|
|
|
#define REGION_ZONED (REGION_BASE + 1)
|
|
|
|
#define REGION_OCCUPIED (REGION_BASE + 2)
|
|
|
|
#define REGION_CONDEMNED (REGION_BASE + 3)
|
|
|
|
|
|
|
|
void regionsInit();
|
|
|
|
|
|
|
|
unsigned int TregionAlloc(int xid, unsigned int pageCount, int allocaionManager);
|
|
|
|
void TregionDealloc(int xid, unsigned int firstPage);
|
|
|
|
unsigned int TregionSize(int xid, unsigned int firstPage);
|
|
|
|
|
|
|
|
/** Currently, this function is O(n) in the number of regions, so be careful! */
|
|
|
|
void TregionFindNthActive(int xid, unsigned int n, unsigned int * firstPage, unsigned int * size);
|
2006-06-22 19:10:02 +00:00
|
|
|
|
2008-02-19 22:07:13 +00:00
|
|
|
int TregionNextBoundaryTag(int xid, pageid_t*pid, boundary_tag *tag, int allocationManager);
|
|
|
|
int TregionReadBoundaryTag(int xid, pageid_t pid, boundary_tag *tag);
|
|
|
|
|
2006-07-18 23:59:00 +00:00
|
|
|
Operation getAllocBoundaryTag();
|
|
|
|
|
2006-07-25 00:56:50 +00:00
|
|
|
Operation getAllocRegion();
|
|
|
|
Operation getDeallocRegion();
|
2006-06-22 19:10:02 +00:00
|
|
|
|
2006-07-25 22:23:15 +00:00
|
|
|
/** This function checks the regions in the page file for consistency.
|
|
|
|
It makes sure that the doublly linked list is consistent (eg
|
|
|
|
this->next->prev == this), and it makes sure that all boundary
|
|
|
|
tags pages (that are marked REGION_ZONED) occur somewhere in the
|
|
|
|
linked list. */
|
|
|
|
|
|
|
|
void fsckRegions(int xid);
|
|
|
|
|
2006-06-22 19:10:02 +00:00
|
|
|
// XXX need callbacks to handle transaction commit/abort.
|