2004-07-31 00:27:55 +00:00
|
|
|
/**
|
2008-04-17 06:29:34 +00:00
|
|
|
@file
|
|
|
|
|
|
|
|
Indirect block implementation.
|
2004-07-31 00:27:55 +00:00
|
|
|
|
|
|
|
On disk layout of indirect blocks:
|
|
|
|
END
|
|
|
|
lsn (2 bytes)
|
|
|
|
type = 2 (2 bytes)
|
|
|
|
level (2 bytes)
|
|
|
|
...
|
|
|
|
|
|
|
|
block1 = {pageid, maxslot} (8 bytes)
|
|
|
|
block0 = {pageid, maxslot} (8 bytes)
|
|
|
|
START
|
|
|
|
|
|
|
|
If blockN has pageid = INVALID_SLOT, then block(N-1) is the last
|
|
|
|
indirect block that has been allocated.
|
|
|
|
|
|
|
|
maxslot is the first slot number that would not fit on this page. (If the slot exists, then it must be on the next page).
|
|
|
|
|
|
|
|
The 'level' field indicates how many levels of indirect blocks lie
|
|
|
|
below this block. level = 1 means that the pageid's point to 'normal'
|
|
|
|
pages. (They may be slotted (type = 1), or provided by some other
|
|
|
|
implementation).
|
|
|
|
|
2007-06-07 21:53:09 +00:00
|
|
|
@todo Does anything actually use indirect.h? Why doesn't arrayList use it?
|
|
|
|
|
2004-07-31 00:27:55 +00:00
|
|
|
*/
|
|
|
|
|
2007-06-11 21:36:57 +00:00
|
|
|
#include <stasis/common.h>
|
2004-07-31 00:27:55 +00:00
|
|
|
#include "../page.h"
|
|
|
|
|
|
|
|
#ifndef __LLADD_PAGE_INDIRECT_H
|
|
|
|
#define __LLADD_PAGE_INDIRECT_H
|
|
|
|
|
|
|
|
BEGIN_C_DECLS
|
|
|
|
|
2007-10-02 00:18:33 +00:00
|
|
|
#define level_ptr(page) stasis_page_int16_ptr_from_end((page), 3)
|
2004-07-31 00:27:55 +00:00
|
|
|
|
2007-10-02 00:18:33 +00:00
|
|
|
/** @todo indirect.h cannot handle 64 bit file offsets! */
|
|
|
|
#define page_ptr(page, offset) stasis_page_int32_ptr_from_start((page), 2*(offset))
|
|
|
|
#define maxslot_ptr(page, offset) stasis_page_int32_ptr_from_start((page), 2*(offset)+1)
|
2004-07-31 00:27:55 +00:00
|
|
|
|
|
|
|
#define INDIRECT_POINTERS_PER_PAGE (USABLE_SIZE_OF_PAGE / 16)
|
|
|
|
|
|
|
|
/**
|
|
|
|
Translates a recordid that points to an indirect block into the
|
|
|
|
physical location of the record.
|
|
|
|
*/
|
2007-10-02 00:18:33 +00:00
|
|
|
compensated_function recordid dereferenceIndirectRID(int xid, recordid rid);
|
2004-07-31 00:27:55 +00:00
|
|
|
void indirectInitialize(Page * p, int height);
|
2005-02-22 03:10:54 +00:00
|
|
|
|
|
|
|
compensated_function recordid rallocMany(/*int parentPage, lsn_t lsn,*/int xid, int recordSize, int recordCount);
|
2005-02-16 04:11:14 +00:00
|
|
|
compensated_function int indirectPageRecordCount(int xid, recordid rid);
|
2004-07-31 00:27:55 +00:00
|
|
|
|
2007-07-18 20:09:14 +00:00
|
|
|
page_impl indirectImpl();
|
|
|
|
|
2004-07-31 00:27:55 +00:00
|
|
|
END_C_DECLS
|
|
|
|
|
|
|
|
#endif /*__LLADD_PAGE_INDIRECT_H*/
|