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
4dcda2c0
Unverified
Commit
4dcda2c0
authored
Jul 15, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Differentiate memory allocation priorities
Fixes #11 I hope
parent
ed28758e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
fellow_cache.c
src/fellow_cache.c
+10
-10
No files found.
src/fellow_cache.c
View file @
4dcda2c0
...
...
@@ -1608,7 +1608,7 @@ fellow_cache_seglists_load(const struct fellow_cache *fc,
static
struct
fellow_cache_res
fellow_cache_obj_new
(
const
struct
fellow_cache
*
fc
,
size_t
dsk_sz
,
unsigned
nseg_guess
)
size_t
dsk_sz
,
unsigned
nseg_guess
,
uint8_t
pri
)
{
struct
fellow_disk_obj
*
fdo
;
struct
fellow_cache_obj
*
fco
;
...
...
@@ -1647,7 +1647,7 @@ fellow_cache_obj_new(const struct fellow_cache *fc,
assert
(
u
<=
UINT8_MAX
);
bits
=
(
uint8_t
)
u
;
fco_mem
=
buddy_alloc1_ptr_page_wait
(
fc
->
membuddy
,
FEP_GET
,
bits
,
0
);
pri
,
bits
,
0
);
if
(
FC_INJ
||
fco_mem
.
ptr
==
NULL
)
{
fcr
=
FCR_ALLOCFAIL
(
"fco_mem alloc failed"
);
goto
err
;
...
...
@@ -1657,7 +1657,7 @@ fellow_cache_obj_new(const struct fellow_cache *fc,
}
fdo_mem
=
buddy_alloc1_ptr_extent_wait
(
fc
->
membuddy
,
FEP_GET
,
asz
,
0
);
pri
,
asz
,
0
);
if
(
FC_INJ
||
fdo_mem
.
ptr
==
NULL
)
{
fcr
=
FCR_ALLOCFAIL
(
"fdo_mem alloc failed"
);
...
...
@@ -1726,7 +1726,7 @@ fellow_busy_obj_alloc(struct fellow_cache *fc,
size_t
sz
,
asz
,
dsk_sz
;
uint16_t
ldsegs
;
fbo_mem
=
buddy_alloc1_ptr_extent_wait
(
fc
->
membuddy
,
FEP_
GET
,
fbo_mem
=
buddy_alloc1_ptr_extent_wait
(
fc
->
membuddy
,
FEP_
NEW
,
sizeof
*
fbo
,
0
);
fbo
=
fbo_mem
.
ptr
;
if
(
fbo
==
NULL
)
{
...
...
@@ -1763,7 +1763,7 @@ fellow_busy_obj_alloc(struct fellow_cache *fc,
// XXX delay to allow new objects during FP_INIT ?
fds_seg
=
FC_INJ
?
buddy_off_extent_nil
:
fellow_region_alloc
(
fc
->
ffd
,
FEP_
GET
,
dsk_sz
,
0
);
fellow_region_alloc
(
fc
->
ffd
,
FEP_
NEW
,
dsk_sz
,
0
);
if
(
fds_seg
.
off
<
0
)
{
fcr
=
FCR_ALLOCFAIL
(
"fds region"
);
fellow_cache_res_check
(
fc
,
fcr
);
...
...
@@ -1771,7 +1771,7 @@ fellow_busy_obj_alloc(struct fellow_cache *fc,
return
(
fcr
);
}
fcr
=
fellow_cache_obj_new
(
fc
,
dsk_sz
,
ldsegs
);
fcr
=
fellow_cache_obj_new
(
fc
,
dsk_sz
,
ldsegs
,
FEP_NEW
);
if
(
fcr
.
status
!=
fcr_ok
)
{
fellow_cache_res_check
(
fc
,
fcr
);
fellow_region_free
(
fc
->
ffd
,
&
fds_seg
);
...
...
@@ -1872,7 +1872,7 @@ fellow_busy_region_alloc(struct fellow_busy *fbo, size_t size, int8_t cram)
fdr
=
&
fbo
->
region
[
fbo
->
nregion
];
*
fdr
=
FC_INJ
?
buddy_off_extent_nil
:
fellow_region_alloc
(
fc
->
ffd
,
FEP_
GET
,
size
,
cram
);
fellow_region_alloc
(
fc
->
ffd
,
FEP_
SPC
,
size
,
cram
);
if
(
fdr
->
off
<
0
)
{
return
(
NULL
);
...
...
@@ -3098,7 +3098,6 @@ fellow_cache_seg_ref_in(struct fellow_cache *fc, enum fellow_cache_io_e type,
assert
(
n
<=
BUDDY_REQS_MAX
);
reqs
=
BUDDY_REQS_STK
(
fc
->
membuddy
,
BUDDY_REQS_MAX
);
BUDDY_REQS_PRI
(
reqs
,
FEP_GET
);
rets
=
BUDDY_RETURNS_STK
(
fc
->
membuddy
,
BUDDY_RETURNS_MAX
);
memset
(
iosegs
,
0
,
sizeof
iosegs
);
...
...
@@ -3110,6 +3109,7 @@ fellow_cache_seg_ref_in(struct fellow_cache *fc, enum fellow_cache_io_e type,
for
(
r
=
0
,
u
=
0
;
u
<
n
;
u
++
)
{
struct
fellow_disk_seg
*
fds
;
BUDDY_REQS_PRI
(
reqs
,
FEP_ITER
);
fcs
=
segs
[
u
];
CHECK_OBJ_NOTNULL
(
fcs
,
FELLOW_CACHE_SEG_MAGIC
);
...
...
@@ -3469,7 +3469,7 @@ static size_t fellow_busy_seg_memalloc(buddy_t *membuddy,
AZ
(
fcs
->
alloc
.
ptr
);
AZ
(
fcs
->
alloc
.
size
);
fcs
->
alloc
=
buddy_alloc1_ptr_extent_wait
(
membuddy
,
FEP_
GET
,
fcs
->
alloc
=
buddy_alloc1_ptr_extent_wait
(
membuddy
,
FEP_
SPC
,
fds
->
seg
.
size
,
0
);
if
(
fcs
->
alloc
.
ptr
==
NULL
)
...
...
@@ -3971,7 +3971,7 @@ fellow_cache_obj_prepread(const struct fellow_cache *fc, fellow_disk_block fdba)
if
(
!
PAOK
(
sz
))
return
(
FCR_IOFAIL
(
"bad size"
));
fcr
=
fellow_cache_obj_new
(
fc
,
sz
,
0
);
fcr
=
fellow_cache_obj_new
(
fc
,
sz
,
0
,
FEP_GET
);
if
(
fcr
.
status
!=
fcr_ok
)
return
(
fcr
);
...
...
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