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
db933215
Unverified
Commit
db933215
authored
Jul 31, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tighten DLE array sizing
We should do this right and not over-allocate, this is just confusing.
parent
e112b51f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
fellow_cache.c
src/fellow_cache.c
+6
-2
fellow_log.c
src/fellow_log.c
+2
-1
fellow_log_storage.h
src/fellow_log_storage.h
+3
-0
No files found.
src/fellow_cache.c
View file @
db933215
...
@@ -4037,7 +4037,7 @@ fdr_compar(const void *aa, const void *bb)
...
@@ -4037,7 +4037,7 @@ fdr_compar(const void *aa, const void *bb)
static
void
static
void
fellow_busy_log_submit
(
const
struct
fellow_busy
*
fbo
)
fellow_busy_log_submit
(
const
struct
fellow_busy
*
fbo
)
{
{
unsigned
r
=
0
,
ndle
=
(
fbo
->
nregion
/
DLE_REG_NREGION
)
+
2
;
unsigned
r
=
0
,
ndle
=
DLE_N_REG
(
fbo
->
nregion
)
+
1
;
struct
fellow_dle
*
e
,
dle_obj
[
1
],
dles
[
ndle
];
struct
fellow_dle
*
e
,
dle_obj
[
1
],
dles
[
ndle
];
struct
fellow_cache_obj
*
fco
;
struct
fellow_cache_obj
*
fco
;
const
struct
fellow_disk_obj
*
fdo
;
const
struct
fellow_disk_obj
*
fdo
;
...
@@ -4058,11 +4058,13 @@ fellow_busy_log_submit(const struct fellow_busy *fbo)
...
@@ -4058,11 +4058,13 @@ fellow_busy_log_submit(const struct fellow_busy *fbo)
r
=
fellow_dle_reg_fill
(
dles
,
ndle
,
fbo
->
region
,
fbo
->
nregion
,
r
=
fellow_dle_reg_fill
(
dles
,
ndle
,
fbo
->
region
,
fbo
->
nregion
,
DLE_REG_ADD
,
dle_obj
->
u
.
obj
.
hash
);
DLE_REG_ADD
,
dle_obj
->
u
.
obj
.
hash
);
assert
(
r
<
ndle
);
e
=
&
dles
[
r
++
];
e
=
&
dles
[
r
++
];
e
->
type
=
DLEDSK
(
DLE_OBJ_ADD
);
e
->
type
=
DLEDSK
(
DLE_OBJ_ADD
);
memcpy
(
&
e
->
u
.
obj
,
&
dle_obj
->
u
.
obj
,
sizeof
e
->
u
.
obj
);
memcpy
(
&
e
->
u
.
obj
,
&
dle_obj
->
u
.
obj
,
sizeof
e
->
u
.
obj
);
e
->
u
.
obj
.
start
=
fbo
->
fco
->
fdb
;
e
->
u
.
obj
.
start
=
fbo
->
fco
->
fdb
;
assert
(
r
<=
ndle
);
fellow_log_dle_submit
(
fbo
->
fc
->
ffd
,
dles
,
r
);
fellow_log_dle_submit
(
fbo
->
fc
->
ffd
,
dles
,
r
);
#ifdef XXXDEBUG
#ifdef XXXDEBUG
...
@@ -4517,7 +4519,7 @@ fellow_disk_obj_delete_submit(struct fellow_fd *ffd,
...
@@ -4517,7 +4519,7 @@ fellow_disk_obj_delete_submit(struct fellow_fd *ffd,
fellow_disk_block
start
,
const
uint8_t
hash
[
DIGEST_LEN
],
fellow_disk_block
start
,
const
uint8_t
hash
[
DIGEST_LEN
],
const
struct
buddy_off_extent
region
[
FCO_MAX_REGIONS
],
unsigned
n
)
const
struct
buddy_off_extent
region
[
FCO_MAX_REGIONS
],
unsigned
n
)
{
{
unsigned
r
,
ndle
=
(
n
/
DLE_REG_NREGION
)
+
2
;
unsigned
r
,
ndle
=
DLE_N_REG
(
n
)
+
1
;
struct
fellow_dle
*
e
,
dles
[
ndle
];
struct
fellow_dle
*
e
,
dles
[
ndle
];
fellow_dle_init
(
dles
,
ndle
);
fellow_dle_init
(
dles
,
ndle
);
...
@@ -4527,11 +4529,13 @@ fellow_disk_obj_delete_submit(struct fellow_fd *ffd,
...
@@ -4527,11 +4529,13 @@ fellow_disk_obj_delete_submit(struct fellow_fd *ffd,
else
else
r
=
0
;
r
=
0
;
assert
(
r
<
ndle
);
e
=
&
dles
[
r
++
];
e
=
&
dles
[
r
++
];
e
->
type
=
DLEDSK
(
DLE_OBJ_DEL_ALLOCED
);
e
->
type
=
DLEDSK
(
DLE_OBJ_DEL_ALLOCED
);
memcpy
(
e
->
u
.
obj
.
hash
,
hash
,
(
size_t
)
DIGEST_LEN
);
memcpy
(
e
->
u
.
obj
.
hash
,
hash
,
(
size_t
)
DIGEST_LEN
);
e
->
u
.
obj
.
start
=
start
;
e
->
u
.
obj
.
start
=
start
;
assert
(
r
<=
ndle
);
fellow_log_dle_submit
(
ffd
,
dles
,
r
);
fellow_log_dle_submit
(
ffd
,
dles
,
r
);
}
}
...
...
src/fellow_log.c
View file @
db933215
...
@@ -3506,7 +3506,7 @@ static void
...
@@ -3506,7 +3506,7 @@ static void
fellow_log_dle_ban_imm
(
struct
fellow_fd
*
ffd
,
enum
dle_type
type
,
fellow_log_dle_ban_imm
(
struct
fellow_fd
*
ffd
,
enum
dle_type
type
,
const
uint8_t
*
bans
,
uint16_t
len
,
vtim_real
t
)
const
uint8_t
*
bans
,
uint16_t
len
,
vtim_real
t
)
{
{
static
const
unsigned
nentries
=
FELLOW_DISK_LOG_BLOCK_ENTRIES
+
1
;
static
const
unsigned
nentries
=
FELLOW_DISK_LOG_BLOCK_ENTRIES
;
struct
fellow_dle
dle
[
nentries
],
*
e
;
struct
fellow_dle
dle
[
nentries
],
*
e
;
int8_t
n
,
cont
;
int8_t
n
,
cont
;
uint8_t
*
ban
;
uint8_t
*
ban
;
...
@@ -3561,6 +3561,7 @@ fellow_log_dle_ban_imm(struct fellow_fd *ffd, enum dle_type type,
...
@@ -3561,6 +3561,7 @@ fellow_log_dle_ban_imm(struct fellow_fd *ffd, enum dle_type type,
AZ
(
len
);
AZ
(
len
);
AZ
(
cont
);
AZ
(
cont
);
assert
(
n
>
0
);
assert
(
n
>
0
);
assert
((
uint8_t
)
n
<=
nentries
);
fellow_log_dle_submit
(
ffd
,
dle
,
(
uint8_t
)
n
);
fellow_log_dle_submit
(
ffd
,
dle
,
(
uint8_t
)
n
);
}
}
...
...
src/fellow_log_storage.h
View file @
db933215
...
@@ -81,6 +81,9 @@ DLE_TYPE_LIM
...
@@ -81,6 +81,9 @@ DLE_TYPE_LIM
- (sizeof(int8_t) + sizeof(uint16_t) + sizeof(vtim_real)))
- (sizeof(int8_t) + sizeof(uint16_t) + sizeof(vtim_real)))
#define DLE_BAN_REG_NREGION 3
#define DLE_BAN_REG_NREGION 3
// roundup number of DLEs needed for x regions
#define DLE_N_REG(x) ((x + (DLE_REG_NREGION)) / DLE_REG_NREGION)
struct
fellow_dle_reg
{
struct
fellow_dle_reg
{
// 4 - for sanity check
// 4 - for sanity check
uint8_t
hashpfx
[
DLE_REG_HASHPFXSZ
];
uint8_t
hashpfx
[
DLE_REG_HASHPFXSZ
];
...
...
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