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
858adc2a
Unverified
Commit
858adc2a
authored
Jan 15, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fellow_logcache: Add a mempool
parent
e3aaef01
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
13 deletions
+30
-13
fellow_log.c
src/fellow_log.c
+30
-13
No files found.
src/fellow_log.c
View file @
858adc2a
...
...
@@ -1077,6 +1077,11 @@ struct fellow_logcache_entry {
off_t off;
};
#define FLC_MEMPOOL_SIZE 2
BUDDY_POOL(flc_mempool, FLC_MEMPOOL_SIZE);
BUDDY_POOL_GET_FUNC(flc_mempool, static)
BUDDY_POOL_AVAIL_FUNC(flc_mempool, static)
VTAILQ_HEAD(flehead, fellow_logcache_entry);
struct fellow_logcache {
...
...
@@ -1089,6 +1094,7 @@ struct fellow_logcache {
struct fellow_fd_ioctx_lease fdil;
const struct buddy_off_extent *region;
struct buddy_ptr_page alloc_entry;
struct flc_mempool mempool[1];
struct fellow_logcache_entry *current;
struct flehead free;
struct flehead used;
...
...
@@ -1139,6 +1145,8 @@ fellow_logcache_fini(struct fellow_logcache *flc)
CHECK_OBJ_NOTNULL(flc, FELLOW_LOGCACHE_MAGIC);
rets = BUDDY_RETURNS_STK(flc->ffd->membuddy, BUDDY_RETURNS_MAX);
BUDDY_POOL_FINI(flc->mempool);
/* wait for all IO to complete before returning memory and
* the ioctx
*/
...
...
@@ -1160,12 +1168,23 @@ fellow_logcache_fini(struct fellow_logcache *flc)
buddy_return(rets);
}
// dup logbuffer_fill_mempool
static void
flc_mempool_fill(struct buddy_reqs *reqs, const void *priv)
{
unsigned u;
(void) priv;
for (u = 0; u < reqs->space; u++)
AN(buddy_req_page(reqs, MIN_FELLOW_BITS, 0));
}
static void
fellow_logcache_init(struct fellow_logcache *flc, struct fellow_fd *ffd,
uint8_t id, const struct buddy_off_extent *region)
{
struct fellow_logcache_entry *fle;
struct
buddy_reqs
*
reqs
;
size_t sz;
unsigned n, u;
...
...
@@ -1195,6 +1214,7 @@ fellow_logcache_init(struct fellow_logcache *flc, struct fellow_fd *ffd,
if (u > UINT8_MAX)
u = UINT8_MAX;
/* init FLEs */
flc->alloc_entry = buddy_alloc1_ptr_page_wait(ffd->membuddy,
FEP_MEM_FLC, (uint8_t)u, (int8_t)0);
AN(flc->alloc_entry.ptr);
...
...
@@ -1202,26 +1222,23 @@ fellow_logcache_init(struct fellow_logcache *flc, struct fellow_fd *ffd,
assert(sz >= sizeof *fle);
sz /= sizeof *fle;
if
(
sz
>
BUDDY_REQS_MAX
)
sz
=
BUDDY_REQS_MAX
;
reqs
=
BUDDY_REQS_STK
(
ffd
->
membuddy
,
BUDDY_REQS_MAX
);
BUDDY_REQS_PRI
(
reqs
,
FEP_MEM_FLC
);
for
(
u
=
0
;
u
<
sz
;
u
++
)
AN
(
buddy_req_page
(
reqs
,
MIN_FELLOW_BITS
,
0
));
u
=
buddy_alloc_wait
(
reqs
);
assert
(
u
>=
2
);
flc
->
n
=
u
;
BUDDY_POOL_INIT(flc->mempool, ffd->membuddy, FEP_MEM_FLC,
flc_mempool_fill, NULL);
assert(sz < UINT_MAX);
flc->n = (unsigned)sz;
for (fle = flc->alloc_entry.ptr, u = 0;
u < flc->n;
u++, fle++) {
INIT_OBJ(fle, FELLOW_LOGCACHE_ENTRY_MAGIC);
fle
->
alloc
=
buddy_get_ptr_page
(
reqs
,
(
uint8_t
)
u
);
fle->alloc = buddy_get_next_ptr_page(
flc_mempool_get(flc->mempool, NULL));
VTAILQ_INSERT_TAIL(&flc->free, fle, list);
}
buddy_alloc_wait_done
(
reqs
);
//XXX
(void) flc_mempool_avail(flc->mempool);
fellow_fd_ioctx_get(ffd, &flc->fdil);
}
...
...
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