Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
slash
Commits
102667f9
Unverified
Commit
102667f9
authored
Dec 13, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use BUDDY_POOL() for logblks
parent
a7fe43fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
12 deletions
+42
-12
fellow_log.c
src/fellow_log.c
+42
-12
No files found.
src/fellow_log.c
View file @
102667f9
...
@@ -424,6 +424,9 @@ assert_lbuf_dsk_resv(void)
...
@@ -424,6 +424,9 @@ assert_lbuf_dsk_resv(void)
BUDDY_POOL
(
lbuf_dskpool
,
LBUF_DSK_RSV_REQS
);
BUDDY_POOL
(
lbuf_dskpool
,
LBUF_DSK_RSV_REQS
);
// this is the memory request for dskpool
// this is the memory request for dskpool
BUDDY_REQS
(
lbuf_dskpool_mem_s
,
1
);
BUDDY_REQS
(
lbuf_dskpool_mem_s
,
1
);
// mem block pool
BUDDY_POOL
(
lbuf_mempool
,
4
);
// XXX 4 good?
BUDDY_POOL_GET_FUNC
(
lbuf_mempool
,
static
)
// memory for flush_finish
// memory for flush_finish
BUDDY_POOL
(
lbuf_ffpool
,
1
);
BUDDY_POOL
(
lbuf_ffpool
,
1
);
BUDDY_POOL_GET_FUNC
(
lbuf_ffpool
,
static
)
BUDDY_POOL_GET_FUNC
(
lbuf_ffpool
,
static
)
...
@@ -467,6 +470,7 @@ struct fellow_logbuffer {
...
@@ -467,6 +470,7 @@ struct fellow_logbuffer {
off_t
tail_off
;
off_t
tail_off
;
struct
fellow_logbuffer_ff
*
ff
;
struct
fellow_logbuffer_ff
*
ff
;
struct
lbuf_ffpool
ffpool
[
1
];
struct
lbuf_ffpool
ffpool
[
1
];
struct
lbuf_mempool
mempool
[
1
];
struct
lbuf_dskpool_mem_s
dskpool_mem
;
struct
lbuf_dskpool_mem_s
dskpool_mem
;
struct
lbuf_dskpool
*
dskpool
;
struct
lbuf_dskpool
*
dskpool
;
};
};
...
@@ -2030,6 +2034,7 @@ logbuffer_fini(struct fellow_logbuffer *lbuf)
...
@@ -2030,6 +2034,7 @@ logbuffer_fini(struct fellow_logbuffer *lbuf)
AZ
(
lbuf
->
regions_to_free
);
AZ
(
lbuf
->
regions_to_free
);
logbuffer_fini_dskpool
(
lbuf
);
logbuffer_fini_dskpool
(
lbuf
);
BUDDY_POOL_FINI
(
lbuf
->
mempool
);
BUDDY_POOL_FINI
(
lbuf
->
ffpool
);
BUDDY_POOL_FINI
(
lbuf
->
ffpool
);
if
(
lbuf
->
fdil
.
ioctx
!=
NULL
)
{
if
(
lbuf
->
fdil
.
ioctx
!=
NULL
)
{
...
@@ -2144,6 +2149,19 @@ logbuffer_recycle(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
...
@@ -2144,6 +2149,19 @@ logbuffer_recycle(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
lbuf
->
head_seq
[
1
]
=
0
;
lbuf
->
head_seq
[
1
]
=
0
;
}
}
static
void
logbuffer_fill_mempool
(
struct
buddy_reqs
*
reqs
,
const
void
*
priv
)
{
unsigned
u
;
(
void
)
priv
;
BUDDY_REQS_PRI
(
reqs
,
FEP_MEM_LOG
);
for
(
u
=
0
;
u
<
reqs
->
space
;
u
++
)
AN
(
buddy_req_page
(
reqs
,
MIN_FELLOW_BITS
,
0
));
}
static
void
static
void
logbuffer_init
(
struct
fellow_fd
*
ffd
,
struct
fellow_logbuffer
*
lbuf
,
logbuffer_init
(
struct
fellow_fd
*
ffd
,
struct
fellow_logbuffer
*
lbuf
,
struct
fellow_log_region
*
logreg
)
struct
fellow_log_region
*
logreg
)
...
@@ -2166,6 +2184,8 @@ logbuffer_init(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
...
@@ -2166,6 +2184,8 @@ logbuffer_init(struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
assert
(
b
<=
UINT8_MAX
);
assert
(
b
<=
UINT8_MAX
);
logbuffer_grow
(
lbuf
,
(
uint8_t
)
b
);
logbuffer_grow
(
lbuf
,
(
uint8_t
)
b
);
BUDDY_POOL_INIT
(
lbuf
->
mempool
,
lbuf
->
membuddy
,
logbuffer_fill_mempool
,
lbuf
);
BUDDY_POOL_INIT
(
lbuf
->
ffpool
,
lbuf
->
membuddy
,
BUDDY_POOL_INIT
(
lbuf
->
ffpool
,
lbuf
->
membuddy
,
logbuffer_fill_ffpool
,
lbuf
);
logbuffer_fill_ffpool
,
lbuf
);
...
@@ -2180,29 +2200,39 @@ static inline void
...
@@ -2180,29 +2200,39 @@ static inline void
logbuffer_take
(
struct
fellow_logbuffer
*
to
,
struct
fellow_logbuffer
*
from
)
logbuffer_take
(
struct
fellow_logbuffer
*
to
,
struct
fellow_logbuffer
*
from
)
{
{
logbuffer_fini_dskpool_mem
(
from
);
logbuffer_fini_dskpool_mem
(
from
);
BUDDY_POOL_FINI
(
from
->
mempool
);
BUDDY_POOL_FINI
(
from
->
ffpool
);
BUDDY_POOL_FINI
(
from
->
ffpool
);
logbuffer_wait_flush_fini
(
from
);
logbuffer_wait_flush_fini
(
from
);
TAKE
(
*
to
,
*
from
);
TAKE
(
*
to
,
*
from
);
BUDDY_POOL_INIT
(
to
->
mempool
,
to
->
membuddy
,
logbuffer_fill_mempool
,
to
);
BUDDY_POOL_INIT
(
to
->
ffpool
,
to
->
membuddy
,
BUDDY_POOL_INIT
(
to
->
ffpool
,
to
->
membuddy
,
logbuffer_fill_ffpool
,
to
);
logbuffer_fill_ffpool
,
to
);
}
}
static
struct
fellow_disk_log_block
*
static
struct
fellow_disk_log_block
*
fellow_logblk_new
(
buddy_t
*
membuddy
,
unsigned
wait
,
uint8_t
fht
,
uint8_t
id
)
fellow_logblk_new
(
struct
fellow_logbuffer
*
lbuf
,
unsigned
wait
,
uint8_t
fht
,
uint8_t
id
)
{
{
struct
fellow_disk_log_block
*
logblk
;
struct
fellow_disk_log_block
*
logblk
;
struct
buddy_ptr_extent
e
;
struct
buddy_ptr_page
e
;
const
size_t
sz
=
sizeof
*
logblk
;
if
(
wait
==
0
)
if
(
wait
==
0
)
{
e
=
buddy_alloc1_ptr_extent
(
membuddy
,
sz
,
0
);
// XXX mempool non waiting?
e
=
buddy_alloc1_ptr_page
(
lbuf
->
membuddy
,
MIN_FELLOW_BITS
,
0
);
if
(
e
.
ptr
==
NULL
)
return
(
NULL
);
}
else
else
e
=
buddy_alloc1_ptr_extent_wait
(
membuddy
,
FEP_MEM_LOG
,
sz
,
0
);
e
=
buddy_get_next_ptr_page
(
if
(
e
.
ptr
==
NULL
)
lbuf_mempool_get
(
lbuf
->
mempool
,
lbuf
));
return
(
NULL
);
assert
(
e
.
size
==
sz
);
AN
(
e
.
ptr
);
MEM
(
membuddy
);
//lint -e{587} false positive, definitely -- assertion is true
assert
(((
size_t
)
1
<<
e
.
bits
)
==
sizeof
*
logblk
);
MEM
(
lbuf
->
membuddy
);
logblk
=
e
.
ptr
;
logblk
=
e
.
ptr
;
INIT_OBJ
(
logblk
,
FELLOW_DISK_LOG_BLOCK_MAGIC
);
INIT_OBJ
(
logblk
,
FELLOW_DISK_LOG_BLOCK_MAGIC
);
...
@@ -2491,7 +2521,7 @@ flush_active(const struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
...
@@ -2491,7 +2521,7 @@ flush_active(const struct fellow_fd *ffd, struct fellow_logbuffer *lbuf,
*/
*/
if
(
opts
==
0
)
{
if
(
opts
==
0
)
{
copy
=
fellow_logblk_new
(
lbuf
->
membuddy
,
0
,
copy
=
fellow_logblk_new
(
lbuf
,
0
,
ffd
->
tune
->
hash_log
,
0
);
ffd
->
tune
->
hash_log
,
0
);
if
(
copy
==
NULL
)
{
if
(
copy
==
NULL
)
{
opts
|=
FAIO_SYNC
;
opts
|=
FAIO_SYNC
;
...
@@ -3269,7 +3299,7 @@ logbuffer_getblk(struct fellow_fd *ffd,
...
@@ -3269,7 +3299,7 @@ logbuffer_getblk(struct fellow_fd *ffd,
lbuf
->
active
.
block
->
nentries
<
FELLOW_DISK_LOG_BLOCK_ENTRIES
)
lbuf
->
active
.
block
->
nentries
<
FELLOW_DISK_LOG_BLOCK_ENTRIES
)
return
(
lbuf
->
active
.
block
);
return
(
lbuf
->
active
.
block
);
blk
=
fellow_logblk_new
(
lbuf
->
membuddy
,
1
,
blk
=
fellow_logblk_new
(
lbuf
,
1
,
ffd
->
tune
->
hash_log
,
lbuf
->
id
);
ffd
->
tune
->
hash_log
,
lbuf
->
id
);
XXXAN
(
blk
);
XXXAN
(
blk
);
...
...
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