Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
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
Abuhujair Javed
Postgres FD Implementation
Commits
c4cb6175
Commit
c4cb6175
authored
Aug 24, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Major patch to speed up backend startup after profiling analysis.
parent
281ba3f4
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
122 additions
and
198 deletions
+122
-198
src/backend/access/common/heaptuple.c
src/backend/access/common/heaptuple.c
+14
-20
src/backend/access/common/heapvalid.c
src/backend/access/common/heapvalid.c
+5
-2
src/backend/storage/ipc/s_lock.c
src/backend/storage/ipc/s_lock.c
+38
-86
src/backend/storage/page/bufpage.c
src/backend/storage/page/bufpage.c
+1
-63
src/backend/utils/adt/oid.c
src/backend/utils/adt/oid.c
+5
-1
src/backend/utils/cache/catcache.c
src/backend/utils/cache/catcache.c
+14
-3
src/backend/utils/mmgr/oset.c
src/backend/utils/mmgr/oset.c
+5
-15
src/include/c.h
src/include/c.h
+2
-3
src/include/storage/bufpage.h
src/include/storage/bufpage.h
+38
-5
No files found.
src/backend/access/common/heaptuple.c
View file @
c4cb6175
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.
19 1997/08/19 21:28:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.
20 1997/08/24 23:07:26
momjian Exp $
*
*
* NOTES
* NOTES
* The old interface functions have been converted to macros
* The old interface functions have been converted to macros
...
@@ -695,26 +695,20 @@ heap_getattr(HeapTuple tup,
...
@@ -695,26 +695,20 @@ heap_getattr(HeapTuple tup,
if
(
attnum
>
(
int
)
tup
->
t_natts
)
{
if
(
attnum
>
(
int
)
tup
->
t_natts
)
{
*
isnull
=
true
;
*
isnull
=
true
;
return
((
char
*
)
NULL
);
return
((
char
*
)
NULL
);
}
}
else
if
(
attnum
>
0
)
{
/* ----------------
/* ----------------
* take care of user defined attributes
* take care of user defined attributes
* ----------------
* ----------------
*/
*/
if
(
attnum
>
0
)
{
return
fastgetattr
(
tup
,
attnum
,
tupleDesc
,
isnull
);
char
*
datum
;
}
else
{
datum
=
fastgetattr
(
tup
,
attnum
,
tupleDesc
,
isnull
);
return
(
datum
);
}
/* ----------------
/* ----------------
* take care of system attributes
* take care of system attributes
* ----------------
* ----------------
*/
*/
*
isnull
=
false
;
*
isnull
=
false
;
return
return
heap_getsysattr
(
tup
,
b
,
attnum
);
heap_getsysattr
(
tup
,
b
,
attnum
);
}
}
}
/* ----------------
/* ----------------
...
...
src/backend/access/common/heapvalid.c
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.1
3 1997/03/28 07:03:53 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.1
4 1997/08/24 23:07:26 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <utils/rel.h>
#include <utils/rel.h>
#include <utils/tqual.h>
#include <utils/tqual.h>
#include <storage/bufmgr.h>
#include <storage/bufmgr.h>
#include <utils/builtins.h>
/* ----------------
/* ----------------
* heap_keytest
* heap_keytest
...
@@ -53,7 +54,9 @@ heap_keytest(HeapTuple t,
...
@@ -53,7 +54,9 @@ heap_keytest(HeapTuple t,
return
(
false
);
return
(
false
);
}
}
if
(
keys
->
sk_flags
&
SK_COMMUTE
)
if
(
keys
->
sk_func
==
(
func_ptr
)
oideq
)
/* optimization */
test
=
(
keys
->
sk_argument
==
atp
);
else
if
(
keys
->
sk_flags
&
SK_COMMUTE
)
test
=
(
long
)
FMGR_PTR2
(
keys
->
sk_func
,
keys
->
sk_procedure
,
test
=
(
long
)
FMGR_PTR2
(
keys
->
sk_func
,
keys
->
sk_procedure
,
keys
->
sk_argument
,
atp
);
keys
->
sk_argument
,
atp
);
else
else
...
...
src/backend/storage/ipc/s_lock.c
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.
19 1997/08/20 00:50:11 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.
20 1997/08/24 23:07:28 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -44,12 +44,6 @@
...
@@ -44,12 +44,6 @@
#if defined(HAS_TEST_AND_SET)
#if defined(HAS_TEST_AND_SET)
# if defined(__alpha__) && defined(linux)
static
long
int
tas
(
slock_t
*
lock
);
# else
static
int
tas
(
slock_t
*
lock
);
#endif
#if defined (nextstep)
#if defined (nextstep)
/*
/*
* NEXTSTEP (mach)
* NEXTSTEP (mach)
...
@@ -167,6 +161,8 @@ S_LOCK_FREE(slock_t *lock)
...
@@ -167,6 +161,8 @@ S_LOCK_FREE(slock_t *lock)
defined(sparc_solaris)
defined(sparc_solaris)
/* for xxxxx_solaris, this is defined in port/.../tas.s */
/* for xxxxx_solaris, this is defined in port/.../tas.s */
static
int
tas
(
slock_t
*
lock
);
void
void
S_LOCK
(
slock_t
*
lock
)
S_LOCK
(
slock_t
*
lock
)
{
{
...
@@ -233,6 +229,8 @@ S_INIT_LOCK(slock_t *lock)
...
@@ -233,6 +229,8 @@ S_INIT_LOCK(slock_t *lock)
*/
*/
static
slock_t
clear_lock
=
{
-
1
,
-
1
,
-
1
,
-
1
};
static
slock_t
clear_lock
=
{
-
1
,
-
1
,
-
1
,
-
1
};
static
int
tas
(
slock_t
*
lock
);
void
void
S_LOCK
(
slock_t
*
lock
)
S_LOCK
(
slock_t
*
lock
)
{
{
...
@@ -268,6 +266,8 @@ S_LOCK_FREE(slock_t *lock)
...
@@ -268,6 +266,8 @@ S_LOCK_FREE(slock_t *lock)
#if defined(sun3)
#if defined(sun3)
static
int
tas
(
slock_t
*
lock
);
void
void
S_LOCK
(
slock_t
*
lock
)
S_LOCK
(
slock_t
*
lock
)
{
{
...
@@ -320,6 +320,8 @@ tas_dummy()
...
@@ -320,6 +320,8 @@ tas_dummy()
#define asm(x) __asm__(x)
#define asm(x) __asm__(x)
#endif
#endif
static
int
tas
(
slock_t
*
lock
);
static
int
static
int
tas_dummy
()
tas_dummy
()
{
{
...
@@ -383,19 +385,14 @@ S_INIT_LOCK(unsigned char *addr)
...
@@ -383,19 +385,14 @@ S_INIT_LOCK(unsigned char *addr)
#if defined(NEED_I386_TAS_ASM)
#if defined(NEED_I386_TAS_ASM)
static
int
tas
(
slock_t
*
m
)
{
slock_t
res
;
__asm__
(
"xchgb %0,%1"
:
"=q"
(
res
),
"=m"
(
*
m
)
:
"0"
(
0x1
));
return
(
res
);
}
void
void
S_LOCK
(
slock_t
*
lock
)
S_LOCK
(
slock_t
*
lock
)
{
{
while
(
tas
(
lock
))
slock_t
res
;
;
do
{
__asm__
(
"xchgb %0,%1"
:
"=q"
(
res
),
"=m"
(
*
lock
)
:
"0"
(
0x1
));
}
while
(
res
!=
0
);
}
}
void
void
...
@@ -415,10 +412,12 @@ S_INIT_LOCK(slock_t *lock)
...
@@ -415,10 +412,12 @@ S_INIT_LOCK(slock_t *lock)
#if defined(__alpha__) && defined(linux)
#if defined(__alpha__) && defined(linux)
static
long
int
void
tas
(
slock_t
*
m
)
S_LOCK
(
slock_t
*
lock
)
{
{
slock_t
res
;
slock_t
res
;
do
{
__asm__
(
" ldq $0, %0
\n
\
__asm__
(
" ldq $0, %0
\n
\
bne $0, already_set
\n
\
bne $0, already_set
\n
\
ldq_l $0, %0
\n
\
ldq_l $0, %0
\n
\
...
@@ -431,15 +430,8 @@ tas(slock_t *m)
...
@@ -431,15 +430,8 @@ tas(slock_t *m)
jmp $31, end
\n
\
jmp $31, end
\n
\
stqc_fail: or $31, 1, $0
\n
\
stqc_fail: or $31, 1, $0
\n
\
already_set: bis $0, $0, %1
\n
\
already_set: bis $0, $0, %1
\n
\
end: nop "
:
"=m"
(
*
m
),
"=r"
(
res
)
::
"0"
);
end: nop "
:
"=m"
(
*
lock
),
"=r"
(
res
)
::
"0"
);
return
(
res
);
}
while
(
res
!=
0
);
}
void
S_LOCK
(
slock_t
*
lock
)
{
while
(
tas
(
lock
))
;
}
}
void
void
...
@@ -459,21 +451,16 @@ S_INIT_LOCK(slock_t *lock)
...
@@ -459,21 +451,16 @@ S_INIT_LOCK(slock_t *lock)
#if defined(linux) && defined(sparc)
#if defined(linux) && defined(sparc)
static
int
void
tas
(
slock_t
*
m
)
S_LOCK
(
slock_t
*
lock
)
{
{
slock_t
res
;
slock_t
res
;
do
{
__asm__
(
"ldstub [%1], %0"
__asm__
(
"ldstub [%1], %0"
:
"=&r"
(
res
)
:
"=&r"
(
res
)
:
"r"
(
m
));
:
"r"
(
lock
));
return
(
res
!=
0
);
}
while
(
!
res
!=
0
);
}
void
S_LOCK
(
slock_t
*
lock
)
{
while
(
tas
(
lock
))
;
}
}
void
void
...
@@ -490,41 +477,6 @@ S_INIT_LOCK(slock_t *lock)
...
@@ -490,41 +477,6 @@ S_INIT_LOCK(slock_t *lock)
#endif
/* defined(linux) && defined(sparc) */
#endif
/* defined(linux) && defined(sparc) */
#if defined(NEED_NS32K_TAS_ASM)
static
int
tas
(
slock_t
*
m
)
{
slock_t
res
=
0
;
__asm__
(
"movd 8(fp), r1"
);
__asm__
(
"movqd 0, r0"
);
__asm__
(
"sbitd r0, 0(r1)"
);
__asm__
(
"sprb us, %0"
:
"=r"
(
res
));
res
=
(
res
>>
5
)
&
1
;
return
res
;
}
void
S_LOCK
(
slock_t
*
lock
)
{
while
(
tas
(
lock
))
;
}
void
S_UNLOCK
(
slock_t
*
lock
)
{
*
lock
=
0
;
}
void
S_INIT_LOCK
(
slock_t
*
lock
)
{
S_UNLOCK
(
lock
);
}
#endif
/* NEED_NS32K_TAS_ASM */
#if defined(linux) && defined(PPC)
#if defined(linux) && defined(PPC)
static
int
tas_dummy
()
static
int
tas_dummy
()
...
...
src/backend/storage/page/bufpage.c
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.
7 1997/08/19 21:33:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.
8 1997/08/24 23:07:30
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -31,43 +31,6 @@ static void PageIndexTupleDeleteAdjustLinePointers(PageHeader phdr,
...
@@ -31,43 +31,6 @@ static void PageIndexTupleDeleteAdjustLinePointers(PageHeader phdr,
static
bool
PageManagerShuffle
=
true
;
/* default is shuffle mode */
static
bool
PageManagerShuffle
=
true
;
/* default is shuffle mode */
/* ----------------------------------------------------------------
* Buffer support functions
* ----------------------------------------------------------------
*/
/*
* BufferGetPageSize --
* Returns the page size within a buffer.
*
* Notes:
* Assumes buffer is valid.
*
* The buffer can be a raw disk block and need not contain a valid
* (formatted) disk page.
*/
Size
BufferGetPageSize
(
Buffer
buffer
)
{
Size
pageSize
;
Assert
(
BufferIsValid
(
buffer
));
pageSize
=
BLCKSZ
;
/* XXX dig out of buffer descriptor */
Assert
(
PageSizeIsValid
(
pageSize
));
return
(
pageSize
);
}
/*
* BufferGetPage --
* Returns the page associated with a buffer.
*/
Page
BufferGetPage
(
Buffer
buffer
)
{
return
(
Page
)
BufferGetBlock
(
buffer
);
}
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
* Page support functions
* Page support functions
* ----------------------------------------------------------------
* ----------------------------------------------------------------
...
@@ -94,31 +57,6 @@ PageInit(Page page, Size pageSize, Size specialSize)
...
@@ -94,31 +57,6 @@ PageInit(Page page, Size pageSize, Size specialSize)
PageSetPageSize
(
page
,
pageSize
);
PageSetPageSize
(
page
,
pageSize
);
}
}
/*
* PageGetItem --
* Retrieves an item on the given page.
*
* Note:
* This does change the status of any of the resources passed.
* The semantics may change in the future.
*/
Item
PageGetItem
(
Page
page
,
ItemId
itemId
)
{
Item
item
;
Assert
(
PageIsValid
(
page
));
/* Assert(itemId->lp_flags & LP_USED); */
if
(
!
(
itemId
->
lp_flags
&
LP_USED
))
{
elog
(
NOTICE
,
"LP_USED assertion failed. dumping core."
);
abort
();
}
item
=
(
Item
)(((
char
*
)
page
)
+
itemId
->
lp_off
);
return
(
item
);
}
/*
/*
* PageAddItem --
* PageAddItem --
* Adds item to the given page.
* Adds item to the given page.
...
...
src/backend/utils/adt/oid.c
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.
7 1997/07/24 20:16:17
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.
8 1997/08/24 23:07:35
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -96,6 +96,10 @@ char *oidout(Oid o)
...
@@ -96,6 +96,10 @@ char *oidout(Oid o)
* PUBLIC ROUTINES *
* PUBLIC ROUTINES *
*****************************************************************************/
*****************************************************************************/
/*
* If you change this function, change heap_keytest()
* because we have hardcoded this in there as an optimization
*/
bool
oideq
(
Oid
arg1
,
Oid
arg2
)
bool
oideq
(
Oid
arg1
,
Oid
arg2
)
{
{
return
(
arg1
==
arg2
);
return
(
arg1
==
arg2
);
...
...
src/backend/utils/cache/catcache.c
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.
7 1997/08/19 21:34:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.
8 1997/08/24 23:07:42
momjian Exp $
*
*
* Notes:
* Notes:
* XXX This needs to use exception.h to handle recovery when
* XXX This needs to use exception.h to handle recovery when
...
@@ -656,8 +656,19 @@ InitSysCache(char *relname,
...
@@ -656,8 +656,19 @@ InitSysCache(char *relname,
* and the LRU tuple list
* and the LRU tuple list
* ----------------
* ----------------
*/
*/
{
/*
* We can only do this optimization because the number of hash
* buckets never changes. Without it, we call malloc() too much.
* We could move this to dllist.c, but the way we do this is not
* dynamic/portabl, so why allow other routines to use it.
*/
void
*
cache_begin
=
malloc
((
NCCBUCK
+
1
)
*
sizeof
(
Dllist
));
for
(
i
=
0
;
i
<=
NCCBUCK
;
++
i
)
{
for
(
i
=
0
;
i
<=
NCCBUCK
;
++
i
)
{
cp
->
cc_cache
[
i
]
=
DLNewList
();
cp
->
cc_cache
[
i
]
=
cache_begin
+
i
*
sizeof
(
Dllist
);
cp
->
cc_cache
[
i
]
->
dll_head
=
0
;
cp
->
cc_cache
[
i
]
->
dll_tail
=
0
;
}
}
}
cp
->
cc_lrulist
=
DLNewList
();
cp
->
cc_lrulist
=
DLNewList
();
...
...
src/backend/utils/mmgr/oset.c
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.
2 1997/08/19 21:35:59
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.
3 1997/08/24 23:07:50
momjian Exp $
*
*
* NOTE
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
* XXX This is a preliminary implementation which lacks fail-fast
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "utils/memutils.h"
/* where declarations of this file goes */
#include "utils/memutils.h"
/* where declarations of this file goes */
static
Pointer
OrderedElemGetBase
(
OrderedElem
elem
);
static
Pointer
OrderedElemGetBase
(
OrderedElem
elem
);
static
void
OrderedElemInit
(
OrderedElem
elem
,
OrderedSet
set
);
static
void
OrderedElemPush
(
OrderedElem
elem
);
static
void
OrderedElemPush
(
OrderedElem
elem
);
static
void
OrderedElemPushHead
(
OrderedElem
elem
);
static
void
OrderedElemPushHead
(
OrderedElem
elem
);
...
@@ -49,18 +48,6 @@ OrderedSetInit(OrderedSet set, Offset offset)
...
@@ -49,18 +48,6 @@ OrderedSetInit(OrderedSet set, Offset offset)
set
->
offset
=
offset
;
set
->
offset
=
offset
;
}
}
/*
* OrderedElemInit --
*/
static
void
OrderedElemInit
(
OrderedElem
elem
,
OrderedSet
set
)
{
elem
->
set
=
set
;
/* mark as unattached */
elem
->
next
=
NULL
;
elem
->
prev
=
NULL
;
}
/*
/*
* OrderedSetContains --
* OrderedSetContains --
* True iff ordered set contains given element.
* True iff ordered set contains given element.
...
@@ -148,7 +135,10 @@ OrderedElemPop(OrderedElem elem)
...
@@ -148,7 +135,10 @@ OrderedElemPop(OrderedElem elem)
void
void
OrderedElemPushInto
(
OrderedElem
elem
,
OrderedSet
set
)
OrderedElemPushInto
(
OrderedElem
elem
,
OrderedSet
set
)
{
{
OrderedElemInit
(
elem
,
set
);
elem
->
set
=
set
;
/* mark as unattached */
elem
->
next
=
NULL
;
elem
->
prev
=
NULL
;
OrderedElemPush
(
elem
);
OrderedElemPush
(
elem
);
}
}
...
...
src/include/c.h
View file @
c4cb6175
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: c.h,v 1.1
4 1997/08/12 20:16:17
momjian Exp $
* $Id: c.h,v 1.1
5 1997/08/24 23:07:56
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -686,8 +686,7 @@ typedef struct Exception {
...
@@ -686,8 +686,7 @@ typedef struct Exception {
* Does string copy, and forces terminating NULL
* Does string copy, and forces terminating NULL
*/
*/
/* we do this so if the macro is used in an if action, it will work */
/* we do this so if the macro is used in an if action, it will work */
#define strNcpy(dest,src,len) do \
#define strNcpy(dst,src,len) (strncpy((dst),(src),(len)),*((dst)+(len))='\0',dst)
{strncpy((dest),(src),(len));*((dest) + (len)) = '\0';} while (0)
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
* Section 9: externs
* Section 9: externs
...
...
src/include/storage/bufpage.h
View file @
c4cb6175
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: bufpage.h,v 1.
8 1997/08/19 21:39:47
momjian Exp $
* $Id: bufpage.h,v 1.
9 1997/08/24 23:08:01
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -233,17 +233,50 @@ typedef enum {
...
@@ -233,17 +233,50 @@ typedef enum {
#define PageGetSpecialPointer(page) \
#define PageGetSpecialPointer(page) \
(AssertMacro(PageIsValid(page)) ? \
(AssertMacro(PageIsValid(page)) ? \
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
(char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \
: (char *) 0)
: (char *)0 )
/*
* PageGetItem --
* Retrieves an item on the given page.
*
* Note:
* This does change the status of any of the resources passed.
* The semantics may change in the future.
*/
#define PageGetItem(page, itemId) \
(AssertMacro(PageIsValid(page)) ? \
AssertMacro(itemId->lp_flags & LP_USED) ? \
(Item)(((char *)page) + itemId->lp_off) : false : false)
/*
* BufferGetPageSize --
* Returns the page size within a buffer.
*
* Notes:
* Assumes buffer is valid.
*
* The buffer can be a raw disk block and need not contain a valid
* (formatted) disk page.
*/
/* XXX dig out of buffer descriptor */
#define BufferGetPageSize(buffer) \
(AssertMacro(BufferIsValid(buffer)) ? \
AssertMacro(PageSizeIsValid(pageSize)) ? \
((Size)BLCKSZ) : false : false)
/*
* BufferGetPage --
* Returns the page associated with a buffer.
*/
#define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer))
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
* extern declarations
* extern declarations
* ----------------------------------------------------------------
* ----------------------------------------------------------------
*/
*/
extern
Size
BufferGetPageSize
(
Buffer
buffer
);
extern
Page
BufferGetPage
(
Buffer
buffer
);
extern
void
PageInit
(
Page
page
,
Size
pageSize
,
Size
specialSize
);
extern
void
PageInit
(
Page
page
,
Size
pageSize
,
Size
specialSize
);
extern
Item
PageGetItem
(
Page
page
,
ItemId
itemId
);
extern
OffsetNumber
PageAddItem
(
Page
page
,
Item
item
,
Size
size
,
extern
OffsetNumber
PageAddItem
(
Page
page
,
Item
item
,
Size
size
,
OffsetNumber
offsetNumber
,
ItemIdFlags
flags
);
OffsetNumber
offsetNumber
,
ItemIdFlags
flags
);
extern
Page
PageGetTempPage
(
Page
page
,
Size
specialSize
);
extern
Page
PageGetTempPage
(
Page
page
,
Size
specialSize
);
...
...
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