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
93baa0cd
Unverified
Commit
93baa0cd
authored
Jan 17, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fellow_disk_obj: trim memory objects
parent
3e3e7a27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
fellow_cache.c
src/fellow_cache.c
+60
-0
No files found.
src/fellow_cache.c
View file @
93baa0cd
...
...
@@ -599,6 +599,10 @@ struct fellow_disk_obj {
#define fellow_disk_obj_fdsl(fdo) \
(void *)((uint8_t *)fdo + sizeof *fdo + fdo->va_data_len)
#define fellow_disk_obj_size(fdo, fdsl) \
(sizeof *fdo + fdo->va_data_len + \
sizeof *fdsl + fdsl->lsegs * sizeof *fdsl->segs)
// shaved off one pointer...
#define FCO_FCS(fco) (&(fco)->fdo_fcs)
#define FCO_FDO(fco) fellow_disk_obj(FCO_FCS(fco))
...
...
@@ -652,6 +656,9 @@ struct fellow_cache_obj {
struct
fellow_cache_seglist
seglist
;
};
#define fellow_cache_obj_size(fco) \
(sizeof *fco + (fco)->seglist.lsegs * sizeof *(fco)->seglist.segs)
#define FCR_OK(p)\
(struct fellow_cache_res){.r.ptr = (p), .status = fcr_ok}
#define FCR_ALLOCERR(str)\
...
...
@@ -1101,6 +1108,29 @@ fellow_disk_obj_compat(struct fellow_disk_obj *fdo)
fdo
->
fdo_flags
|=
FDO_F_VXID64
;
}
static
void
fellow_disk_obj_trim
(
const
struct
fellow_cache
*
fc
,
struct
fellow_cache_seg
*
fcs
)
{
struct
fellow_disk_seglist
*
fdsl
;
struct
fellow_disk_obj
*
fdo
;
CHECK_OBJ_NOTNULL
(
fc
,
FELLOW_CACHE_MAGIC
);
CHECK_OBJ_NOTNULL
(
fcs
,
FELLOW_CACHE_SEG_MAGIC
);
fdo
=
fellow_disk_obj
(
fcs
);
CHECK_OBJ_NOTNULL
(
fdo
,
FELLOW_DISK_OBJ_MAGIC
);
fdsl
=
fellow_disk_obj_fdsl
(
fdo
);
CHECK_OBJ
(
fdsl
,
FELLOW_DISK_SEGLIST_MAGIC
);
assert
(
fdsl
->
lsegs
>=
fdsl
->
nsegs
);
fdsl
->
lsegs
=
fdsl
->
nsegs
;
buddy_trim1_ptr_extent
(
fc
->
membuddy
,
&
fcs
->
alloc
,
fellow_disk_obj_size
(
fdo
,
fdsl
));
}
/* ============================================================
* cache obj
*/
...
...
@@ -2825,6 +2855,29 @@ fellow_cache_seg_unbusy(struct fellow_busy *fbo, struct fellow_cache_seg *fcs){
fellow_busy_io_submit
(
fbio
);
}
static
void
fellow_cache_obj_trim
(
const
struct
fellow_cache
*
fc
,
struct
fellow_cache_obj
*
fco
)
{
struct
fellow_cache_seglist
*
fcsl
;
struct
fellow_disk_seglist
*
fdsl
;
CHECK_OBJ_NOTNULL
(
fc
,
FELLOW_CACHE_MAGIC
);
CHECK_OBJ_NOTNULL
(
fco
,
FELLOW_CACHE_OBJ_MAGIC
);
fcsl
=
&
fco
->
seglist
;
CHECK_OBJ
(
fcsl
,
FELLOW_CACHE_SEGLIST_MAGIC
);
fdsl
=
fcsl
->
fdsl
;
CHECK_OBJ_NOTNULL
(
fdsl
,
FELLOW_DISK_SEGLIST_MAGIC
);
AZ
(
fcsl
->
fcsl_sz
);
AZ
(
fcsl
->
fdsl_sz
);
assert
(
fcsl
->
lsegs
>=
fdsl
->
nsegs
);
fcsl
->
lsegs
=
fdsl
->
nsegs
;
buddy_trim1_ptr_extent
(
fc
->
membuddy
,
&
fco
->
fco_mem
,
fellow_cache_obj_size
(
fco
));
}
/* XXX can save some io for inlog == 0 */
static
void
...
...
@@ -2880,6 +2933,7 @@ fellow_cache_obj_unbusy(struct fellow_busy *fbo, enum fcol_state wantlog)
AZ
(
pthread_mutex_unlock
(
&
fco
->
mtx
));
fellow_cache_obj_fini
(
fco
);
fellow_cache_obj_trim
(
fc
,
fco
);
AN
(
fbio
);
fbio
->
type
=
FBIO_SEG
;
...
...
@@ -3001,6 +3055,9 @@ fellow_cache_async_write_complete(struct fellow_cache *fc,
fcos_next
=
(
typeof
(
fcos_next
))
(
FCOS_HIGH
(
fcs
->
state
)
|
FCOS_INCORE
);
assert_fcos_transition
(
fcs
->
state
,
fcos_next
);
if
(
fcs
->
state
==
FCO_WRITING
)
fellow_disk_obj_trim
(
fc
,
fcs
);
}
else
{
assert
(
type
==
FBIO_SEGLIST
);
if
(
result
<
(
int32_t
)
fbio
->
u
.
seglist
.
reg
.
size
)
{
...
...
@@ -5316,6 +5373,8 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
if
(
err
!=
NULL
)
goto
err
;
fellow_disk_obj_trim
(
fc
,
fcs
);
#define FDO_AUXATTR(U, l) \
fellow_cache_seg_associate(&fco->aa_##l##_seg, \
&fdo->aa_##l##_seg, fdo->aa_##l##_seg.seg.size == 0 ? \
...
...
@@ -5345,6 +5404,7 @@ struct objcore **ocp, uintptr_t priv2, unsigned crit)
if
(
dowry
.
bits
)
buddy_return1_ptr_page
(
fc
->
membuddy
,
&
dowry
);
fellow_cache_obj_trim
(
fc
,
fco
);
return
(
FCR_OK
(
fco
));
err:
if
(
ocp
)
{
...
...
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