Commit efcd9831 authored by unknown's avatar unknown

ndb dd -

  convert Dbtup::Page_request and pgman::Page_request to WOPool


storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  remove bad method call
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  Convert disk records to shared global mem users
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
  Convert disk records to shared global mem users
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
  Convert disk records to shared global mem users
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
  Make buddy is initialized first
storage/ndb/src/kernel/blocks/pgman.cpp:
  Convert disk records to shared global mem users
storage/ndb/src/kernel/blocks/pgman.hpp:
  Convert disk records to shared global mem users
storage/ndb/src/kernel/vm/DLFifoList.hpp:
  Made pool templ. ag of DLFifoList + cleanup some
storage/ndb/src/kernel/vm/SLFifoList.hpp:
  Add a few likely's + format some code
storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
  Add records types to blocks includes
parent c5962eb9
......@@ -12381,7 +12381,7 @@ void Dbtc::executeTriggers(Signal* signal, ApiConnectRecordPtr* transPtr)
tmp2.release();
LocalDataBuffer<11> tmp3(pool, trigPtr.p->afterValues);
tmp3.release();
regApiPtr->theFiredTriggers.release(trigPtr.i);
regApiPtr->theFiredTriggers.release(trigPtr);
}
trigPtr = nextTrigPtr;
}
......
......@@ -469,20 +469,21 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
struct Page_request
{
Page_request() {}
Local_key m_key;
Uint16 m_estimated_free_space; // in bytes/records
Uint16 m_list_index; // in Disk_alloc_info.m_page_requests
Uint32 m_frag_ptr_i;
Uint32 m_extent_info_ptr;
Uint16 m_ref_count; // Waiters for page
Uint16 m_estimated_free_space; // in bytes/records
Uint16 m_list_index; // in Disk_alloc_info.m_page_requests
Uint16 m_ref_count; // Waiters for page
Uint16 m_uncommitted_used_space;
union {
Uint32 nextList;
Uint32 nextPool;
};
Uint32 nextList;
Uint32 prevList;
Uint32 m_magic;
}; // 32 bytes
typedef RecordPool<Page_request, WOPool> Page_request_pool;
typedef DLFifoListImpl<Page_request_pool, Page_request> Page_request_list;
typedef LocalDLFifoListImpl<Page_request_pool, Page_request> Local_page_request_list;
STATIC_CONST( EXTENT_SEARCH_MATRIX_COLS = 4 ); // Guarantee size
STATIC_CONST( EXTENT_SEARCH_MATRIX_ROWS = 5 ); // Total size
......@@ -518,7 +519,6 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
}; // 40 bytes
typedef LocalDLList<Extent_info> Extent_list;
typedef LocalDLList<Page_request> Page_request_list;
struct Tablerec;
struct Disk_alloc_info
......@@ -553,7 +553,7 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
* Requests (for update) that have sufficient space left after request
* these are currently being "mapped"
*/
DLList<Page_request>::Head m_page_requests[MAX_FREE_LIST];
Page_request_list::Head m_page_requests[MAX_FREE_LIST];
/**
* Current extent
......@@ -1010,7 +1010,7 @@ ArrayPool<TupTriggerData> c_triggerPool;
};
ArrayPool<Extent_info> c_extent_pool;
ArrayPool<Page_request> c_page_request_pool;
Page_request_pool c_page_request_pool;
DLHashTable<Extent_info> c_extent_hash;
typedef Ptr<Tablerec> TablerecPtr;
......@@ -2609,13 +2609,6 @@ private:
void disk_page_free(Signal*,
Tablerec*, Fragrecord*, Local_key*, PagePtr, Uint32);
void disk_page_update_free_space(Fragrecord*, Ptr<Page_request>,
DLList<Page_request>::Head list[],
Uint32 i, Uint32 sz);
void disk_page_update_free_space(Fragrecord*, PagePtr, Uint32 i,
Int32 uncommitted_delta,
Int32 extent_delta);
void disk_page_commit_callback(Signal*, Uint32 opPtrI, Uint32 page_id);
void disk_page_log_buffer_callback(Signal*, Uint32 opPtrI, Uint32);
......
......@@ -89,8 +89,8 @@ Dbtup::dump_disk_alloc(Dbtup::Disk_alloc_info & alloc)
{
printf(" %d : ", i);
Ptr<Page_request> ptr;
LocalDLList<Page_request> list(c_page_request_pool,
alloc.m_page_requests[i]);
Local_page_request_list list(c_page_request_pool,
alloc.m_page_requests[i]);
for(list.first(ptr); !ptr.isNull(); list.next(ptr))
{
ndbout << ptr << " ";
......@@ -388,8 +388,6 @@ Dbtup::disk_page_prealloc(Signal* signal,
return -err;
}
new (req.p) Page_request();
req.p->m_ref_count= 1;
req.p->m_frag_ptr_i= fragPtr.i;
req.p->m_uncommitted_used_space= sz;
......@@ -510,8 +508,8 @@ Dbtup::disk_page_prealloc(Signal* signal,
// And put page request in correct free list
idx= alloc.calc_page_free_bits(new_size);
{
LocalDLList<Page_request> list(c_page_request_pool,
alloc.m_page_requests[idx]);
Local_page_request_list list(c_page_request_pool,
alloc.m_page_requests[idx]);
list.add(req);
}
......@@ -605,9 +603,9 @@ Dbtup::disk_page_prealloc_transit_page(Disk_alloc_info& alloc,
if (old_idx != new_idx)
{
DLList<Page_request>::Head *lists = alloc.m_page_requests;
LocalDLList<Page_request> old_list(c_page_request_pool, lists[old_idx]);
LocalDLList<Page_request> new_list(c_page_request_pool, lists[new_idx]);
Page_request_list::Head *lists = alloc.m_page_requests;
Local_page_request_list old_list(c_page_request_pool, lists[old_idx]);
Local_page_request_list new_list(c_page_request_pool, lists[new_idx]);
old_list.remove(req);
new_list.add(req);
......@@ -761,8 +759,8 @@ Dbtup::disk_page_prealloc_callback_common(Signal* signal,
}
{
Page_request_list list(c_page_request_pool,
alloc.m_page_requests[old_idx]);
Local_page_request_list list(c_page_request_pool,
alloc.m_page_requests[old_idx]);
list.release(req);
}
}
......
......@@ -309,7 +309,10 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
c_extent_pool.setSize(8192);
c_extent_hash.setSize(1024); // 4k
c_page_request_pool.setSize(1000);
Pool_context pc;
pc.m_block = this;
c_page_request_pool.wo_pool_init(RT_DBTUP_PAGE_REQUEST, pc);
Uint32 nScanOp; // use TUX config for now
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
......
......@@ -90,6 +90,7 @@ static BlockInfo ALL_BLOCKS[] = {
static const Uint32 ALL_BLOCKS_SZ = sizeof(ALL_BLOCKS)/sizeof(BlockInfo);
static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
CMVMI_REF,
DBTUP_REF,
DBACC_REF,
DBTC_REF,
......@@ -100,7 +101,6 @@ static BlockReference readConfigOrder[ALL_BLOCKS_SZ] = {
NDBFS_REF,
NDBCNTR_REF,
QMGR_REF,
CMVMI_REF,
TRIX_REF,
BACKUP_REF,
DBUTIL_REF,
......
......@@ -125,10 +125,13 @@ Pgman::execREAD_CONFIG_REQ(Signal* signal)
{
page_buffer /= GLOBAL_PAGE_SIZE; // in pages
m_page_entry_pool.setSize(100*page_buffer);
m_page_request_pool.setSize(10000);
m_param.m_max_pages = page_buffer;
m_param.m_max_hot_pages = (page_buffer * 9) / 10;
}
Pool_context pc;
pc.m_block = this;
m_page_request_pool.wo_pool_init(RT_PGMAN_PAGE_REQUEST, pc);
ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
conf->senderRef = reference();
......@@ -977,8 +980,7 @@ Pgman::process_callback(Signal* signal, Ptr<Page_entry> ptr)
* Make sure list is in own scope if callback will access this
* list again (destructor restores list head).
*/
LocalDLFifoList<Page_request>
req_list(m_page_request_pool, ptr.p->m_requests);
Local_page_request_list req_list(m_page_request_pool, ptr.p->m_requests);
Ptr<Page_request> req_ptr;
req_list.first(req_ptr);
......@@ -988,8 +990,6 @@ Pgman::process_callback(Signal* signal, Ptr<Page_entry> ptr)
b = globalData.getBlock(req_ptr.p->m_block);
callback = req_ptr.p->m_callback;
req_list.release(req_ptr);
if (req_ptr.p->m_flags & DIRTY_FLAGS)
{
jam();
......@@ -997,6 +997,8 @@ Pgman::process_callback(Signal* signal, Ptr<Page_entry> ptr)
ndbassert(ptr.p->m_dirty_count);
ptr.p->m_dirty_count --;
}
req_list.releaseFirst(req_ptr);
}
ndbrequire(state & Page_entry::BOUND);
ndbrequire(state & Page_entry::MAPPED);
......@@ -1602,12 +1604,11 @@ Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req)
// queue the request
Ptr<Pgman::Page_request> req_ptr;
{
LocalDLFifoList<Page_request>
req_list(m_page_request_pool, ptr.p->m_requests);
Local_page_request_list req_list(m_page_request_pool, ptr.p->m_requests);
if (! (req_flags & Page_request::ALLOC_REQ))
req_list.seize(req_ptr);
req_list.seizeLast(req_ptr);
else
req_list.seizeFront(req_ptr);
req_list.seizeFirst(req_ptr);
}
if (req_ptr.i == RNIL)
......@@ -2171,8 +2172,8 @@ operator<<(NdbOut& out, Ptr<Pgman::Page_entry> ptr)
out << " busy_count=" << dec << pe.m_busy_count;
#ifdef VM_TRACE
{
LocalDLFifoList<Pgman::Page_request>
req_list(ptr.p->m_this->m_page_request_pool, ptr.p->m_requests);
Local_page_request_list req_list(ptr.p->m_this->m_page_request_pool,
ptr.p->m_requests);
if (! req_list.isEmpty())
{
Ptr<Pgman::Page_request> req_ptr;
......
......@@ -262,13 +262,14 @@ private:
Uint16 m_flags;
SimulatedBlock::Callback m_callback;
union {
Uint32 nextPool;
Uint32 nextList;
};
Uint32 prevList;
Uint32 nextList;
Uint32 m_magic;
};
typedef RecordPool<Page_request, WOPool> Page_request_pool;
typedef SLFifoListImpl<Page_request_pool, Page_request> Page_request_list;
typedef LocalSLFifoListImpl<Page_request_pool, Page_request> Local_page_request_list;
struct Page_entry_stack_ptr {
Uint32 nextList;
Uint32 prevList;
......@@ -338,7 +339,7 @@ private:
Uint32 nextPool;
};
DLFifoList<Page_request>::Head m_requests;
Page_request_list::Head m_requests;
Uint32 nextHash;
Uint32 prevHash;
......@@ -384,7 +385,7 @@ private:
File_map::DataBufferPool m_data_buffer_pool;
// page entries and requests
ArrayPool<Page_request> m_page_request_pool;
Page_request_pool m_page_request_pool;
ArrayPool<Page_entry> m_page_entry_pool;
Page_hashlist m_page_hashlist;
Page_stack m_page_stack;
......
......@@ -17,20 +17,23 @@
#ifndef DLFIFOLIST_HPP
#define DLFIFOLIST_HPP
#include "ArrayPool.hpp"
#include <NdbOut.hpp>
#include <ndb_global.h>
#include <kernel_types.h>
#include "Pool.hpp"
/**
* Template class used for implementing an
* list of object retreived from a pool
*/
template <class T, class U = T>
class DLFifoList {
template <typename P, typename T, typename U = T>
class DLFifoListImpl
{
public:
/**
* List head
*/
struct Head {
struct Head
{
Head();
Uint32 firstItem;
Uint32 lastItem;
......@@ -42,61 +45,26 @@ public:
inline bool isEmpty() const { return firstItem == RNIL;}
};
DLFifoList(ArrayPool<T> & thePool);
DLFifoListImpl(P & thePool);
/**
* Allocate an object from pool - update Ptr
*
* Return i
*/
bool seize(Ptr<T> &);
/**
* Allocate an object from pool - update Ptr - put in front of list
*
* Return i
*/
bool seizeFront(Ptr<T> &);
/**
* Allocate object <b>i</b> from pool - update Ptr
*
* Return i
*/
bool seizeId(Ptr<T> &, Uint32 i);
bool seizeFirst(Ptr<T> &);
bool seizeLast(Ptr<T> &);
bool seize(Ptr<T> & ptr) { return seizeLast(ptr);}
/**
* Add object to list
*
* @NOTE MUST be seized from correct pool
*/
void add(Ptr<T> &);
void release(Ptr<T> &);
void release(); // release all
void addFirst(Ptr<T> &);
void addLast(Ptr<T> &);
void add(Ptr<T> & ptr) { addLast(ptr);}
/**
* Insert object <em>ptr</ptr> _before_ <em>loc</em>
*/
void insert(Ptr<T> & ptr, Ptr<T>& loc);
/**
* Remove from list
*/
void remove(Ptr<T> &);
/**
* Return an object to pool
*/
void release(Uint32 i);
/**
* Return an object to pool
*/
void release(Ptr<T> &);
/**
* Return all objects to the pool
*/
void release();
/**
* Update i & p value according to <b>i</b>
*/
......@@ -119,7 +87,6 @@ public:
*/
bool first(Ptr<T> &) const ;
/**
* Update ptr to first element in list
*
......@@ -134,7 +101,6 @@ public:
*/
bool next(Ptr<T> &) const ;
/**
* Get next element
*
......@@ -148,61 +114,37 @@ public:
* NOTE ptr must be both p & i
*/
bool hasNext(const Ptr<T> &) const;
/**
* Check if prev exists i.e. this is not first
* Check if next exists i.e. this is not last
*
* NOTE ptr must be both p & i
*/
bool hasPrev(const Ptr<T> &) const;
Uint32 noOfElements() const {
Uint32 c = 0;
Uint32 i = head.firstItem;
while(i != RNIL){
c++;
const T * t = thePool.getPtr(i);
i = t->U::nextList;
}
return c;
}
/**
* Print
* (Run operator NdbOut<< on every element)
*/
void print(NdbOut & out) {
Uint32 i = head.firstItem;
while(i != RNIL){
T * t = thePool.getPtr(i);
out << (unsigned int) t << "[" << i << "]:";
t->print(out); out << " ";
i = t->U::nextList;
}
}
inline bool isEmpty() const { return head.firstItem == RNIL;}
/**
* Copy list (head)
* Will construct to identical lists
*/
DLFifoList<T>& operator=(const DLFifoList<T>& src){
DLFifoListImpl<P,T,U>& operator=(const DLFifoListImpl<P,T,U>& src){
assert(&thePool == &src.thePool);
this->head = src.head;
return * this;
}
protected:
Head head;
ArrayPool<T> & thePool;
P & thePool;
};
template <class T, class U = T>
class LocalDLFifoList : public DLFifoList<T,U> {
template <typename P, typename T, typename U = T>
class LocalDLFifoListImpl : public DLFifoListImpl<P,T,U>
{
public:
LocalDLFifoList(ArrayPool<T> & thePool, typename DLFifoList<T,U>::Head &_src)
: DLFifoList<T,U>(thePool), src(_src)
LocalDLFifoListImpl(P & thePool, typename DLFifoListImpl<P,T,U>::Head &_src)
: DLFifoListImpl<P,T,U>(thePool), src(_src)
{
this->head = src;
#ifdef VM_TRACE
......@@ -211,25 +153,27 @@ public:
#endif
}
~LocalDLFifoList(){
~LocalDLFifoListImpl(){
#ifdef VM_TRACE
assert(src.in_use == true);
#endif
src = this->head;
}
private:
typename DLFifoList<T,U>::Head & src;
typename DLFifoListImpl<P,T,U>::Head & src;
};
template <class T, class U>
template <typename P, typename T, typename U>
inline
DLFifoList<T,U>::DLFifoList(ArrayPool<T> & _pool):
thePool(_pool){
DLFifoListImpl<P,T,U>::DLFifoListImpl(P & _pool):
thePool(_pool)
{
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
DLFifoList<T,U>::Head::Head(){
DLFifoListImpl<P,T,U>::Head::Head()
{
firstItem = RNIL;
lastItem = RNIL;
#ifdef VM_TRACE
......@@ -237,94 +181,83 @@ DLFifoList<T,U>::Head::Head(){
#endif
}
/**
* Allocate an object from pool - update Ptr
*
* Return i
*/
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::seize(Ptr<T> & p){
thePool.seize(p);
if (p.i != RNIL) {
add(p);
DLFifoListImpl<P,T,U>::seizeFirst(Ptr<T> & p)
{
if (likely(thePool.seize(p)))
{
addFirst(p);
return true;
}
p.p = NULL;
return false;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::seizeFront(Ptr<T> & p){
Uint32 ff = head.firstItem;
thePool.seize(p);
if (p.i != RNIL)
DLFifoListImpl<P,T,U>::seizeLast(Ptr<T> & p)
{
if (likely(thePool.seize(p)))
{
p.p->U::prevList = RNIL;
p.p->U::nextList = ff;
head.firstItem = p.i;
if (ff == RNIL)
{
head.lastItem = p.i;
}
else
{
T * t2 = thePool.getPtr(ff);
t2->U::prevList = p.i;
}
addLast(p);
return true;
}
p.p = NULL;
return false;
}
/**
* Allocate an object from pool - update Ptr
*
* Return i
*/
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::seizeId(Ptr<T> & p, Uint32 ir){
thePool.seizeId(p, ir);
if(p.i != RNIL){
add(p);
return true;
void
DLFifoListImpl<P,T,U>::addFirst(Ptr<T> & p)
{
Uint32 ff = head.firstItem;
p.p->U::prevList = RNIL;
p.p->U::nextList = ff;
head.firstItem = p.i;
if (ff == RNIL)
{
head.lastItem = p.i;
}
else
{
T * t2 = thePool.getPtr(ff);
t2->U::prevList = p.i;
}
p.p = NULL;
return false;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
void
DLFifoList<T,U>::add(Ptr<T> & p){
DLFifoListImpl<P,T,U>::addLast(Ptr<T> & p)
{
T * t = p.p;
Uint32 last = head.lastItem;
if(p.i == RNIL)
ErrorReporter::handleAssert("DLFifoList<T,U>::add", __FILE__, __LINE__);
head.lastItem = p.i;
t->U::nextList = RNIL;
t->U::prevList = last;
if (head.firstItem == RNIL)
head.firstItem = p.i;
head.lastItem = p.i;
if(last != RNIL){
if(last != RNIL)
{
T * t2 = thePool.getPtr(last);
t2->U::nextList = p.i;
}
else
{
head.firstItem = p.i;
}
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
void
DLFifoList<T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc){
DLFifoListImpl<P,T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc)
{
Uint32 prev= loc.p->U::prevList;
if(loc.i == head.firstItem)
{
......@@ -342,88 +275,85 @@ DLFifoList<T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc){
ptr.p->U::nextList = loc.i;
}
/**
* Return an object to pool
*/
template <class T, class U>
inline
void
DLFifoList<T,U>::release(Uint32 i){
Ptr<T> p;
p.i = i;
p.p = thePool.getPtr(i);
release(p);
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
void
DLFifoList<T,U>::remove(Ptr<T> & p){
void
DLFifoListImpl<P,T,U>::remove(Ptr<T> & p)
{
T * t = p.p;
Uint32 ni = t->U::nextList;
Uint32 pi = t->U::prevList;
if(ni != RNIL){
if(ni != RNIL)
{
T * t = thePool.getPtr(ni);
t->U::prevList = pi;
} else {
}
else
{
// We are releasing last
head.lastItem = pi;
}
if(pi != RNIL){
if(pi != RNIL)
{
T * t = thePool.getPtr(pi);
t->U::nextList = ni;
} else {
}
else
{
// We are releasing first
head.firstItem = ni;
}
}
/**
* Return an object to pool
*/
template <class T, class U>
inline
void
DLFifoList<T,U>::release(Ptr<T> & p){
remove(p);
thePool.release(p.i);
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
void
DLFifoList<T,U>::release(){
DLFifoListImpl<P,T,U>::release()
{
Ptr<T> p;
while(head.firstItem != RNIL){
while(head.firstItem != RNIL)
{
p.i = head.firstItem;
p.p = thePool.getPtr(head.firstItem);
T * t = p.p;
head.firstItem = t->U::nextList;
release(p);
}
}
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
void
DLFifoList<T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
DLFifoListImpl<P,T,U>::release(Ptr<T> & p)
{
remove(p);
thePool.release(p);
}
template <typename P, typename T, typename U>
inline
void
DLFifoListImpl<P,T,U>::getPtr(Ptr<T> & p, Uint32 i) const
{
p.i = i;
p.p = thePool.getPtr(i);
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
void
DLFifoList<T,U>::getPtr(Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::getPtr(Ptr<T> & p) const
{
thePool.getPtr(p);
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
T *
DLFifoList<T,U>::getPtr(Uint32 i) const {
DLFifoListImpl<P,T,U>::getPtr(Uint32 i) const
{
return thePool.getPtr(i);
}
......@@ -432,12 +362,14 @@ DLFifoList<T,U>::getPtr(Uint32 i) const {
*
* Return i
*/
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::first(Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::first(Ptr<T> & p) const
{
p.i = head.firstItem;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......@@ -445,12 +377,14 @@ DLFifoList<T,U>::first(Ptr<T> & p) const {
return false;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::last(Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::last(Ptr<T> & p) const
{
p.i = head.lastItem;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......@@ -458,12 +392,14 @@ DLFifoList<T,U>::last(Ptr<T> & p) const {
return false;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::next(Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::next(Ptr<T> & p) const
{
p.i = p.p->U::nextList;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......@@ -471,12 +407,14 @@ DLFifoList<T,U>::next(Ptr<T> & p) const {
return false;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::prev(Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::prev(Ptr<T> & p) const
{
p.i = p.p->U::prevList;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......@@ -484,18 +422,36 @@ DLFifoList<T,U>::prev(Ptr<T> & p) const {
return false;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::hasNext(const Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::hasNext(const Ptr<T> & p) const
{
return p.p->U::nextList != RNIL;
}
template <class T, class U>
template <typename P, typename T, typename U>
inline
bool
DLFifoList<T,U>::hasPrev(const Ptr<T> & p) const {
DLFifoListImpl<P,T,U>::hasPrev(const Ptr<T> & p) const
{
return p.p->U::prevList != RNIL;
}
// Specializations
template <typename T, typename U = T>
class DLFifoList : public DLFifoListImpl<ArrayPool<T>, T, U>
{
public:
DLFifoList(ArrayPool<T> & p) : DLFifoListImpl<ArrayPool<T>, T, U>(p) {}
};
template <typename T, typename U = T>
class LocalDLFifoList : public LocalDLFifoListImpl<ArrayPool<T>,T,U> {
public:
LocalDLFifoList(ArrayPool<T> & p, typename DLFifoList<T,U>::Head & _src)
: LocalDLFifoListImpl<ArrayPool<T>,T,U>(p, _src) {}
};
#endif
......@@ -17,6 +17,7 @@
#ifndef SLFIFOLIST_HPP
#define SLFIFOLIST_HPP
#include <ndb_global.h>
#include <kernel_types.h>
#include "Pool.hpp"
......@@ -154,7 +155,7 @@ inline
bool
SLFifoListImpl<P,T,U>::seizeFirst(Ptr<T> & p)
{
if (thePool.seize(p))
if (likely(thePool.seize(p)))
{
addFirst(p);
return true;
......@@ -168,7 +169,7 @@ inline
bool
SLFifoListImpl<P,T,U>::seizeLast(Ptr<T> & p)
{
if (thePool.seize(p))
if (likely(thePool.seize(p)))
{
addLast(p);
return true;
......@@ -276,7 +277,8 @@ bool
SLFifoListImpl<P,T,U>::first(Ptr<T> & p) const
{
p.i = head.firstItem;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......@@ -290,7 +292,8 @@ bool
SLFifoListImpl<P,T,U>::last(Ptr<T> & p) const
{
p.i = head.lastItem;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......@@ -304,7 +307,8 @@ bool
SLFifoListImpl<P,T,U>::next(Ptr<T> & p) const
{
p.i = p.p->U::nextList;
if(p.i != RNIL){
if(p.i != RNIL)
{
p.p = thePool.getPtr(p.i);
return true;
}
......
......@@ -53,6 +53,7 @@
#include <signaldata/ReadConfig.hpp>
#include <signaldata/UpgradeStartup.hpp>
#include "ndbd_malloc_impl.hpp"
#include <blocks/record_types.hpp>
/**
* Something for filesystem access
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment