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
eb7adad4
Unverified
Commit
eb7adad4
authored
Dec 17, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to segmented bitfields
parent
ffd6d950
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
30 deletions
+47
-30
fellow_log.c
src/fellow_log.c
+40
-30
flint.lnt
src/flint.lnt
+7
-0
No files found.
src/fellow_log.c
View file @
eb7adad4
...
...
@@ -913,7 +913,7 @@ struct flivs {
// const
struct
fellow_logbuffer
*
const
lbuf
;
struct
bitf
*
const
bitf
;
struct
bitf
s
*
const
bitfs
;
// non const
struct
regionlist
*
tofree
;
...
...
@@ -4519,7 +4519,7 @@ fellow_log_ban_keep(struct flivs *flivs, const struct fellow_dle *e,
// EXP
assert
(
DLE_OP
(
e
->
type
)
==
DLE_OP_CHG
);
u
=
bitf
_set
(
flivs
->
bitf
,
BAN_EXP_BIT
);
u
=
bitf
s_set
(
flivs
->
bitfs
,
BAN_EXP_BIT
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" u %u = bitf_set(%zu)"
,
u
,
BAN_EXP_BIT
);
if
(
u
)
{
fellow_log_ban_exp_time
(
flivs
,
t
);
...
...
@@ -4765,7 +4765,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
continue
;
}
bit
=
off_bit
(
off
);
AN
(
bitf
_set
(
flivs
->
bitf
,
bit
));
AN
(
bitf
s_set
(
flivs
->
bitfs
,
bit
));
}
if
(
flics
->
ffd
->
phase
==
FP_FINI
||
...
...
@@ -4872,7 +4872,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
FDBG
(
D_LOGS_ITER_BLOCK
,
" (void) bitf_set(%zu)"
,
bit
);
(
void
)
bitf
_set
(
flivs
->
bitf
,
bit
);
(
void
)
bitf
s_set
(
flivs
->
bitfs
,
bit
);
}
goto
next_entry
;
default:
...
...
@@ -4894,7 +4894,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
case
DLE_OBJ_DEL_FREE
:
FDBG
(
D_LOGS_ITER_BLOCK
,
" (void) bitf_set(%zu)"
,
bit
);
(
void
)
bitf
_set
(
flivs
->
bitf
,
bit
);
(
void
)
bitf
s_set
(
flivs
->
bitfs
,
bit
);
// no CHG seen after DEL_FREE
#ifndef DEBUG
AZ
(
fellow_dlechg_find
(
flivs
->
fdct
,
e
));
...
...
@@ -4909,7 +4909,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
#endif
break
;
case
DLE_OBJ_DEL_ALLOCED
:
AN
(
bitf
_set
(
flivs
->
bitf
,
bit
));
AN
(
bitf
s_set
(
flivs
->
bitfs
,
bit
));
// no CHG seen after DEL_FREE
AZ
(
fellow_dlechg_find
(
flivs
->
fdct
,
e
));
FDBG
(
D_LOGS_ITER_BLOCK
,
" AN(bitf_set(%zu))"
,
bit
);
...
...
@@ -4927,7 +4927,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
case
DLE_OBJ_DEL_THIN
:
// THIN is like DEL_ALLOCED, space still reserved
FDBG
(
D_LOGS_ITER_BLOCK
,
" AN(bitf_set(%zu))"
,
bit
);
AN
(
bitf
_set
(
flivs
->
bitf
,
bit
));
AN
(
bitf
s_set
(
flivs
->
bitfs
,
bit
));
/* no CHG after DEL_THIN
* AZ(fellow_dlechg_find(flivs->fdct, e));
* ^^^ is implicit in fellow_dlechg_add()
...
...
@@ -4937,7 +4937,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
WRONG
(
"Need to handle ENOMEM for DLECHG with DEL_THIN"
);
break
;
case
DLE_OBJ_CHG
:
u
=
bitf
_set
(
flivs
->
bitf
,
bit
);
u
=
bitf
s_set
(
flivs
->
bitfs
,
bit
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" u %u = bitf_set(%zu)"
,
u
,
bit
);
if
(
!
u
)
...
...
@@ -4948,10 +4948,10 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
"fellow: had to drop DLE_OBJ_CHG errno %d
\n
"
,
errno
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" AN(bitf_clr(%zu))"
,
bit
);
AN
(
bitf
_clr
(
flivs
->
bitf
,
bit
));
AN
(
bitf
s_clr
(
flivs
->
bitfs
,
bit
));
break
;
case
DLE_OBJ_ADD
:
obj_alive
=
bitf
_set
(
flivs
->
bitf
,
bit
);
obj_alive
=
bitf
s_set
(
flivs
->
bitfs
,
bit
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" obj alive %u = bitf_set(%zu)"
,
obj_alive
,
bit
);
...
...
@@ -4983,7 +4983,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
(
int8_t
)
i
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" AN(bitf_clr(%zu))"
,
bit
);
AN
(
bitf
_clr
(
flivs
->
bitf
,
bit
));
AN
(
bitf
s_clr
(
flivs
->
bitfs
,
bit
));
goto
again
;
default:
WRONG
(
"dle type for dlechg"
);
...
...
@@ -5009,14 +5009,14 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
bit
=
off_bit
(
off
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" (void) bitf_set(%zu)"
,
bit
);
(
void
)
bitf
_set
(
flivs
->
bitf
,
bit
);
(
void
)
bitf
s_set
(
flivs
->
bitfs
,
bit
);
}
break
;
case
DLE_REG_DEL_ALLOCED
:
DLE_REG_FOREACH
(
e
,
off
,
sz
)
{
bit
=
off_bit
(
off
);
// must be the first time we see this offset
u
=
bitf
_set
(
flivs
->
bitf
,
bit
);
u
=
bitf
s_set
(
flivs
->
bitfs
,
bit
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" u %u = bitf_set(%zu)"
,
u
,
bit
);
assert
(
flivs
->
oob
||
u
);
...
...
@@ -5044,7 +5044,7 @@ fellow_logs_iter_block(const struct flics *flics, struct flivs *flivs,
* been reused or not.
*/
u
=
bitf
_set
(
flivs
->
bitf
,
bit
);
u
=
bitf
s_set
(
flivs
->
bitfs
,
bit
);
FDBG
(
D_LOGS_ITER_BLOCK
,
" u %u = bitf_set(%zu)"
,
u
,
bit
);
...
...
@@ -5249,6 +5249,9 @@ bfa_alloc(struct bitfalloc *bfa)
{
struct
buddy_ptr_extent
mem
;
size_t
bits
;
int8_t
cram
;
unsigned
c
;
size_t
sz
;
CHECK_OBJ
(
bfa
,
BITFALLOC_MAGIC
);
...
...
@@ -5271,9 +5274,17 @@ bfa_alloc(struct bitfalloc *bfa)
bfa
->
need
-=
bits
;
}
if
(
bfa
->
need
>
0
&&
bfa
->
reqs
->
n
==
0
)
{
sz
=
bitf_sz
(
bfa
->
need
);
// do not cram to below the minimum bitf size
c
=
log2down
((
size_t
)
bfa
->
lmem
-
bfa
->
nmem
);
assert
(
c
<
INT8_MAX
);
cram
=
(
int8_t
)
c
;
cram
=
buddy_cramlimit_bits
(
sz
,
cram
,
(
int8_t
)
log2up
(
bitf_sz
((
size_t
)
1
)));
BUDDY_REQS_PRI
(
bfa
->
reqs
,
FEP_MEM_REWR
);
AN
(
buddy_req_extent
(
bfa
->
reqs
,
bitf_sz
(
bfa
->
need
),
log2down
(
bfa
->
lmem
-
bfa
->
nmem
)));
AN
(
buddy_req_extent
(
bfa
->
reqs
,
sz
,
cram
));
(
void
)
buddy_alloc_async
(
bfa
->
reqs
);
goto
bfa_again
;
}
...
...
@@ -5285,7 +5296,7 @@ bfa_alloc_wait(struct bitfalloc *bfa)
bfa_alloc
(
bfa
);
while
(
bfa
->
need
>
0
)
{
(
void
)
buddy_alloc_wait
(
bfa
->
reqs
);
(
void
)
buddy_alloc_
async_
wait
(
bfa
->
reqs
);
bfa_alloc
(
bfa
);
}
}
...
...
@@ -5518,23 +5529,23 @@ fellow_logs_rewrite(struct fellow_fd *ffd,
// ffd->logbuf is usable as LBUF_PEND
bfa_alloc_wait
(
bfa
);
struct
bitf
*
bitf
;
struct
buddy_ptr_extent
bitfmem
;
size_t
nblocks
;
AZ
(
ffd
->
size
&
FELLOW_BLOCK_ALIGN
);
nblocks
=
ffd
->
size
>>
MIN_FELLOW_BITS
;
bitfmem
=
buddy_alloc1_ptr_extent_wait
(
ffd
->
membuddy
,
FEP_MEM_REWR
,
bitf_sz
(
nblocks
),
0
);
XXXAN
(
bitfmem
.
ptr
);
MEM
(
ffd
->
membuddy
);
bitf
=
bitf_init
(
bitfmem
.
ptr
,
nblocks
,
bitfmem
.
size
);
#define BFA_DIAG
#ifdef BFA_DIAG_VERBOSE
for
(
u
=
0
;
u
<
bfa
->
nmem
;
u
++
)
{
ffd
->
diag
(
"bitfs mem[%u].size = %zu"
,
u
,
bfa
->
mem
[
u
].
size
)
;
}
#endif
#ifdef BFA_DIAG
ffd
->
diag
(
"bitfs %u segments"
,
bfa
->
nmem
);
#endif
struct
flivs
flivs
=
(
struct
flivs
){
.
magic
=
FLIVS_MAGIC
,
.
oob
=
0
,
.
lbuf
=
lbuf
,
.
bitf
=
bitf
,
.
bitf
s
=
bfa
->
bitfs
,
.
tofree
=
tofree
,
.
ban_dles
=
{{
0
}},
.
fdct
=
{{
0
}},
...
...
@@ -5562,7 +5573,6 @@ fellow_logs_rewrite(struct fellow_fd *ffd,
logblk_off
);
bfa_free
(
bfa
);
buddy_return1_ptr_extent
(
ffd
->
membuddy
,
&
bitfmem
);
// does not work for vcl mode and test cases
//XXXAN(flivs.ban_export_time);
...
...
src/flint.lnt
View file @
eb7adad4
...
...
@@ -51,6 +51,12 @@
//bitf.h only used for test
-esym(768, bitf::extra)
/*
* bitf_segmentation.h
* strange false positive - the macro _is_ used in bfamem[]
*/
-esym(755, bitfs_sz)
//buddy.h
-esym(768, buddy_reqs::func) // member not referenced
-esym(768, buddy_reqs::line) // member not referenced
...
...
@@ -167,6 +173,7 @@
-efile(766, config.h)
-efile(537, "bitsof.h")
-efile(537, "bitf.h")
-efile(537, "fellow_task.h")
-efile(537, "vqueue.h")
-efile(537, "vtree.h")
...
...
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