Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6d4c8a61
Commit
6d4c8a61
authored
Feb 25, 2006
by
jonas@eel.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb dd -
convert Dbtup::Page_request and pgman::Page_request to WOPool
parent
ba875278
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
215 additions
and
258 deletions
+215
-258
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+1
-1
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
+11
-18
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
+9
-11
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
+4
-1
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
+1
-1
storage/ndb/src/kernel/blocks/pgman.cpp
storage/ndb/src/kernel/blocks/pgman.cpp
+12
-11
storage/ndb/src/kernel/blocks/pgman.hpp
storage/ndb/src/kernel/blocks/pgman.hpp
+8
-7
storage/ndb/src/kernel/vm/DLFifoList.hpp
storage/ndb/src/kernel/vm/DLFifoList.hpp
+159
-203
storage/ndb/src/kernel/vm/SLFifoList.hpp
storage/ndb/src/kernel/vm/SLFifoList.hpp
+9
-5
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
+1
-0
No files found.
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
View file @
6d4c8a61
...
...
@@ -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
;
}
...
...
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
View file @
6d4c8a61
...
...
@@ -469,21 +469,22 @@ 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_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
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
STATIC_CONST
(
EXTENT_SEARCH_MATRIX_SIZE
=
20
);
...
...
@@ -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
);
...
...
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
View file @
6d4c8a61
...
...
@@ -89,7 +89,7 @@ Dbtup::dump_disk_alloc(Dbtup::Disk_alloc_info & alloc)
{
printf
(
" %d : "
,
i
);
Ptr
<
Page_request
>
ptr
;
Local
DLList
<
Page_request
>
list
(
c_page_request_pool
,
Local
_page_request_list
list
(
c_page_request_pool
,
alloc
.
m_page_requests
[
i
]);
for
(
list
.
first
(
ptr
);
!
ptr
.
isNull
();
list
.
next
(
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,7 +508,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
// And put page request in correct free list
idx
=
alloc
.
calc_page_free_bits
(
new_size
);
{
Local
DLList
<
Page_request
>
list
(
c_page_request_pool
,
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
;
Local
DLList
<
Page_request
>
old_list
(
c_page_request_pool
,
lists
[
old_idx
]);
Local
DLList
<
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,7 +759,7 @@ Dbtup::disk_page_prealloc_callback_common(Signal* signal,
}
{
P
age_request_list
list
(
c_page_request_pool
,
Local_p
age_request_list
list
(
c_page_request_pool
,
alloc
.
m_page_requests
[
old_idx
]);
list
.
release
(
req
);
}
...
...
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
View file @
6d4c8a61
...
...
@@ -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
));
...
...
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
View file @
6d4c8a61
...
...
@@ -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
,
...
...
storage/ndb/src/kernel/blocks/pgman.cpp
View file @
6d4c8a61
...
...
@@ -125,11 +125,14 @@ 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
();
conf
->
senderData
=
senderData
;
...
...
@@ -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
.
seize
Last
(
req_ptr
);
else
req_list
.
seizeF
ron
t
(
req_ptr
);
req_list
.
seizeF
irs
t
(
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
{
Local
DLFifoList
<
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
;
...
...
storage/ndb/src/kernel/blocks/pgman.hpp
View file @
6d4c8a61
...
...
@@ -262,12 +262,13 @@ private:
Uint16
m_flags
;
SimulatedBlock
::
Callback
m_callback
;
union
{
Uint32
nextPool
;
Uint32
nextList
;
Uint32
m_magic
;
};
Uint32
prevList
;
};
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
;
...
...
@@ -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
;
...
...
storage/ndb/src/kernel/vm/DLFifoList.hpp
View file @
6d4c8a61
...
...
@@ -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
);
DLFifoList
Impl
(
P
&
thePool
);
/**
* Allocate an object from pool - update Ptr
*
* Return i
*/
bool
seize
(
Ptr
<
T
>
&
);
bool
seizeFirst
(
Ptr
<
T
>
&
);
bool
seizeLast
(
Ptr
<
T
>
&
);
bool
seize
(
Ptr
<
T
>
&
ptr
)
{
return
seizeLast
(
ptr
);}
/**
* Allocate an object from pool - update Ptr - put in front of list
*
* Return i
*/
bool
seizeFront
(
Ptr
<
T
>
&
);
void
release
(
Ptr
<
T
>
&
);
void
release
();
// release all
/**
* Allocate object <b>i</b> from pool - update Ptr
*
* Return i
*/
bool
seizeId
(
Ptr
<
T
>
&
,
Uint32
i
);
/**
* Add object to list
*
* @NOTE MUST be seized from correct pool
*/
void
add
(
Ptr
<
T
>
&
);
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
*
...
...
@@ -150,44 +116,19 @@ public:
bool
hasNext
(
const
Ptr
<
T
>
&
)
const
;
/**
* Check if
prev exists i.e. this is not fir
st
* Check if
next exists i.e. this is not la
st
*
* 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
){
DLFifoList
Impl
<
P
,
T
,
U
>&
operator
=
(
const
DLFifoListImpl
<
P
,
T
,
U
>&
src
){
assert
(
&
thePool
==
&
src
.
thePool
);
this
->
head
=
src
.
head
;
return
*
this
;
...
...
@@ -195,14 +136,15 @@ public:
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
)
LocalDLFifoList
Impl
(
P
&
thePool
,
typename
DLFifoListImpl
<
P
,
T
,
U
>::
Head
&
_src
)
:
DLFifoList
Impl
<
P
,
T
,
U
>
(
thePool
),
src
(
_src
)
{
this
->
head
=
src
;
#ifdef VM_TRACE
...
...
@@ -211,25 +153,27 @@ public:
#endif
}
~
LocalDLFifoList
(){
~
LocalDLFifoList
Impl
(){
#ifdef VM_TRACE
assert
(
src
.
in_use
==
true
);
#endif
src
=
this
->
head
;
}
private:
typename
DLFifoList
<
T
,
U
>::
Head
&
src
;
typename
DLFifoList
Impl
<
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,32 +181,41 @@ 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
)))
{
addLast
(
p
);
return
true
;
}
p
.
p
=
NULL
;
return
false
;
}
template
<
typename
P
,
typename
T
,
typename
U
>
inline
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
;
...
...
@@ -275,56 +228,36 @@ DLFifoList<T,U>::seizeFront(Ptr<T> & p){
T
*
t2
=
thePool
.
getPtr
(
ff
);
t2
->
U
::
prevList
=
p
.
i
;
}
return
true
;
}
p
.
p
=
NULL
;
return
false
;
}
/**
* Allocate an object from pool - update Ptr
*
* Return i
*/
template
<
class
T
,
class
U
>
inline
bool
DLFifoList
<
T
,
U
>::
seizeId
(
Ptr
<
T
>
&
p
,
Uint32
ir
){
thePool
.
seizeId
(
p
,
ir
);
if
(
p
.
i
!=
RNIL
){
add
(
p
);
return
true
;
}
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,61 +275,46 @@ 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
>
template
<
typename
P
,
typename
T
,
typename
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
>
inline
void
DLFifoList
<
T
,
U
>::
remove
(
Ptr
<
T
>
&
p
){
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
;
...
...
@@ -405,25 +323,37 @@ DLFifoList<T,U>::release(){
}
}
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
storage/ndb/src/kernel/vm/SLFifoList.hpp
View file @
6d4c8a61
...
...
@@ -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
;
}
...
...
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
View file @
6d4c8a61
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment