|
Zero
0.1.0
|
Free-page allocation/deallocation page. More...
#include <alloc_page.h>
Public Member Functions | |
| uint32_t | byte_place (uint32_t index) |
| uint32_t | bit_place (uint32_t index) |
| uint32_t | bit_mask (uint32_t index) |
| bool | get_bit (uint32_t index) |
| void | unset_bit (uint32_t index) |
| void | set_bit (uint32_t index) |
| uint32_t | get_last_set_bit () |
| void | set_bits (uint32_t from, uint32_t to) |
| void | format_empty () |
| char * | unused_part (size_t &length) |
Public Member Functions inherited from generic_page_header | |
| uint32_t | calculate_checksum () const |
| Calculate the correct value of checksum for this page. More... | |
Public Attributes | |
| uint8_t | bitmap [bitmapsize] |
| char | _fill [sizeof(generic_page)/2 - sizeof(generic_page_header)] |
Public Attributes inherited from generic_page_header | |
| uint32_t | checksum |
| Stored checksum of this page. More... | |
| PageID | pid |
| ID of this page. More... | |
| lsn_t | lsn |
| LSN (Log Sequence Number) of the last write to this page. More... | |
| StoreID | store |
| ID of the store to which this page belongs (0 if none) More... | |
| uint16_t | tag |
| Page type (a page_tag_t) More... | |
Static Public Attributes | |
| static constexpr int | bitmapsize = sizeof(generic_page) / 2 |
| static constexpr int | bits_held = bitmapsize * 8 |
Static Public Attributes inherited from generic_page_header | |
| static const size_t | page_sz = SM_PAGESIZE |
| Size of all Zero pages. More... | |
Additional Inherited Members | |
Protected Attributes inherited from generic_page_header | |
| uint16_t | page_flags |
| Page flags (an OR of page_flag_t's) More... | |
| uint64_t | reserved |
| Reserved for subclass usage. More... | |
Free-page allocation/deallocation page.
These pages contain bitmaps that encode which pages are already allocated. In particular an alloc_page p encodes allocation information for pages with pids in [p.pid_offset..p.pid_offset+p.bits_held).
The implementation is spread between this class and its handle class, alloc_page_h. This class contains the basic fields and accessors for the bitmap's bits. The linkage between these and their interpretation is contained in the handle class.
|
inline |
|
inline |
|
inline |
| void alloc_page::format_empty | ( | ) |
|
inline |
| uint32_t alloc_page::get_last_set_bit | ( | ) |
|
inline |
| void alloc_page::set_bits | ( | uint32_t | from, |
| uint32_t | to | ||
| ) |
|
inline |
|
inline |
| char alloc_page::_fill[sizeof(generic_page)/2 - sizeof(generic_page_header)] |
| uint8_t alloc_page::bitmap[bitmapsize] |
|
static |
Holds the allocation status for pid's in [pid_offset..pid_offset+bits_held); for those pids, a pid p is allocated iff bitmap[bit_place(p-pid_offset)]&bit_mask(p-pid_offset) != 0
Bitmap holds a fixed amount of 32768 (32k) bits. This means that one extent consists of this many pages plus one allocation page responsible for it, yielding exactly 32k pages, or 256MB. The first bit is redundant, as it refers to the alloc page itself. It is always set to one.
|
static |
1.8.12