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
625592f3
Unverified
Commit
625592f3
authored
Feb 05, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fellow_log: Simplify dskpool by reusing the logblk mempool
parent
852b8156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
54 deletions
+16
-54
fellow_log.c
src/fellow_log.c
+16
-54
No files found.
src/fellow_log.c
View file @
625592f3
...
...
@@ -409,9 +409,9 @@ assert_seq_macros(void)
== (seqvar)); \
} while (0)
// <
8K for BUDDY_POOL
// <
4K to fit in logblk
#define LBUF_DSKPOOL_SIZE \
(((
(1<<13) - 16
) - 2 * sizeof(struct buddy_reqs)) / \
(((
1<<12
) - 2 * sizeof(struct buddy_reqs)) / \
(2 * sizeof(struct i_reqalloc)))
#define LOGBLK_MEMPOOL_SIZE 2
//lint -e{506, 527}
...
...
@@ -423,8 +423,6 @@ assert_lbuf_dsk_resv(void)
// dsk block pool
BUDDY_POOL
(
lbuf_dskpool
,
LBUF_DSKPOOL_SIZE
);
// this is the memory request for dskpool
BUDDY_REQS
(
lbuf_dskpool_mem_s
,
1
);
// mem block pool
BUDDY_POOL
(
logblk_mempool
,
LOGBLK_MEMPOOL_SIZE
);
BUDDY_POOL_GET_FUNC
(
logblk_mempool
,
static
)
...
...
@@ -486,7 +484,6 @@ struct fellow_logbuffer {
struct
fellow_logbuffer_ff
*
ff
;
struct
lbuf_ffpool
ffpool
[
1
];
struct
logblk_mempool
*
mempool
;
struct
lbuf_dskpool_mem_s
dskpool_mem
;
struct
lbuf_dskpool
*
dskpool
;
};
...
...
@@ -2037,34 +2034,19 @@ logbuffer_fill_ffpool(struct buddy_reqs *reqs, const void *priv)
AN
(
buddy_req_extent
(
reqs
,
sizeof
*
lbuf
->
ff
,
0
));
}
static
inline
void
logbuffer_fini_dskpool_mem
(
struct
fellow_logbuffer
*
lbuf
)
{
if
(
lbuf
->
dskpool_mem
.
reqs
.
magic
==
0
)
return
;
buddy_alloc_wait_done
(
&
lbuf
->
dskpool_mem
.
reqs
);
lbuf
->
dskpool_mem
.
reqs
.
magic
=
0
;
}
static
void
logbuffer_fini_dskpool
(
struct
fellow_logbuffer
*
lbuf
)
{
struct
buddy_ptr_extent
alloc
;
size_t
sz
;
struct
buddy_ptr_page
alloc
;
if
(
lbuf
->
dskpool
!=
NULL
)
{
BUDDY_POOL_FINI
(
lbuf
->
dskpool
);
sz
=
buddy_rndup
(
lbuf
->
membuddy
,
sizeof
*
lbuf
->
dskpool
);
alloc
=
BUDDY_PTR_EXTENT
(
lbuf
->
dskpool
,
sz
);
buddy_return1_ptr_extent
(
lbuf
->
membuddy
,
&
alloc
);
alloc
=
BUDDY_PTR_PAGE
(
lbuf
->
dskpool
,
MIN_FELLOW_BITS
);
buddy_return1_ptr_page
(
lbuf
->
membuddy
,
&
alloc
);
lbuf
->
dskpool
=
NULL
;
}
else
if
(
lbuf
->
dskpool_mem
.
reqs
.
magic
==
BUDDY_REQS_MAGIC
)
logbuffer_fini_dskpool_mem
(
lbuf
);
AZ
(
lbuf
->
dskpool
);
AZ
(
lbuf
->
dskpool_mem
.
reqs
.
magic
);
}
static
void
...
...
@@ -2239,11 +2221,6 @@ logbuffer_take(struct fellow_logbuffer *to, struct logblk_mempool *to_mempool,
struct
fellow_logbuffer
*
from
)
{
logbuffer_wait_flush_fini
(
from
);
/* we take the dskpool to the new logbuffer, if any,
* but the dskpool_mem request belongs to the old
* logbuffer
*/
logbuffer_fini_dskpool_mem
(
from
);
*
to
=
*
from
;
to
->
mempool
=
to_mempool
;
...
...
@@ -2382,44 +2359,29 @@ static void
logbuffer_prep_dskpool
(
struct
fellow_logbuffer
*
lbuf
,
unsigned
urgent
)
{
struct
lbuf_dskpool
*
dskpool
;
struct
buddy_ptr_
extent
alloc
;
struct
buddy_ptr_
page
alloc
;
if
(
lbuf
->
dskpool
!=
NULL
)
return
;
if
(
urgent
==
0
&&
logblk_mempool_avail
(
lbuf
->
mempool
)
==
0
)
return
;
assert
(
logbuffer_can
(
lbuf
,
LBUF_CAN_FLUSH
));
/*
* when the log region is becoming full, start
* pre-allocating disk blocks. For this, we need
* buddy_reqs, which, in turn, needs memory. We
* also allocate that async to not delay the happy
* path (we are in the middle of flushing logs under the lock)
* pre-allocating disk blocks.
*
* XXX is 25% a good measure?
*/
if
(
lbuf
->
dskpool_mem
.
reqs
.
magic
==
0
&&
(
lbuf
->
logreg
==
NULL
||
lbuf
->
logreg
->
free_n
*
4
<
lbuf
->
logreg
->
space
||
lbuf
->
logreg
->
free_n
<
lbuf
->
n
*
4
))
{
BUDDY_REQS_INIT
(
&
lbuf
->
dskpool_mem
,
lbuf
->
membuddy
);
BUDDY_REQS_PRI
(
&
lbuf
->
dskpool_mem
.
reqs
,
FEP_MEM_LOG
);
AN
(
buddy_req_extent
(
&
lbuf
->
dskpool_mem
.
reqs
,
sizeof
*
lbuf
->
dskpool
,
0
));
(
void
)
buddy_alloc_async
(
&
lbuf
->
dskpool_mem
.
reqs
);
}
if
(
lbuf
->
dskpool_mem
.
reqs
.
magic
==
BUDDY_REQS_MAGIC
&&
urgent
>
0
)
(
void
)
buddy_alloc_async_wait
(
&
lbuf
->
dskpool_mem
.
reqs
);
if
(
lbuf
->
dskpool_mem
.
reqs
.
magic
==
BUDDY_REQS_MAGIC
&&
buddy_alloc_async_ready
(
&
lbuf
->
dskpool_mem
.
reqs
))
{
alloc
=
buddy_get_ptr_extent
(
&
lbuf
->
dskpool_mem
.
reqs
,
0
);
buddy_alloc_wait_done
(
&
lbuf
->
dskpool_mem
.
reqs
);
lbuf
->
dskpool_mem
.
reqs
.
magic
=
0
;
if
(
lbuf
->
logreg
==
NULL
||
lbuf
->
logreg
->
free_n
*
4
<
lbuf
->
logreg
->
space
||
lbuf
->
logreg
->
free_n
<
lbuf
->
n
*
4
)
{
alloc
=
buddy_get_next_ptr_page
(
logblk_mempool_get
(
lbuf
->
mempool
,
lbuf
));
AN
(
alloc
.
ptr
);
assert
(
alloc
.
size
>=
sizeof
*
lbuf
->
dskpool
);
assert
(
(
size_t
)
1
<<
alloc
.
bits
>=
sizeof
*
lbuf
->
dskpool
);
dskpool
=
alloc
.
ptr
;
BUDDY_POOL_INIT
(
dskpool
,
lbuf
->
dskbuddy
,
FEP_DSK_LOG
,
...
...
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