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
19356649
Unverified
Commit
19356649
authored
Feb 01, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fellow_cache: Wait for io completions before mutating objects
Fixes #52
parent
710c7588
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
fellow_cache.c
src/fellow_cache.c
+15
-0
fellow_cache.h
src/fellow_cache.h
+1
-0
fellow_storage.c
src/fellow_storage.c
+1
-0
No files found.
src/fellow_cache.c
View file @
19356649
...
...
@@ -5157,6 +5157,21 @@ fellow_disk_obj_delete_submit(struct fellow_fd *ffd,
fellow_log_dle_submit
(
ffd
,
dles
,
r
);
}
/*
* for drain, wait until object is written before mutating
*/
void
fellow_cache_obj_wait_written
(
struct
fellow_cache_obj
*
fco
)
{
CHECK_OBJ_NOTNULL
(
fco
,
FELLOW_CACHE_OBJ_MAGIC
);
AZ
(
pthread_mutex_lock
(
&
fco
->
mtx
));
/* we must not free the object's disk space while it is still writing */
while
(
FCO_STATE
(
fco
)
==
FCO_WRITING
)
fellow_cache_seg_wait_locked
(
FCO_FCS
(
fco
));
AZ
(
pthread_mutex_unlock
(
&
fco
->
mtx
));
}
/* evict, then delete from log (this order is important to avoid
* fdb reuse)
*
...
...
src/fellow_cache.h
View file @
19356649
...
...
@@ -52,6 +52,7 @@ fellow_cache_init(struct fellow_fd *, buddy_t *, struct stvfe_tune *,
fellow_task_run_t
,
uint64_t
*
);
void
fellow_cache_fini
(
struct
fellow_cache
**
);
void
fellow_cache_obj_wait_written
(
struct
fellow_cache_obj
*
fco
);
void
fellow_cache_obj_delete
(
struct
fellow_cache
*
fc
,
struct
fellow_cache_obj
*
fco
,
const
uint8_t
hash
[
32
]);
void
fellow_cache_obj_deref
(
struct
fellow_cache
*
fc
,
...
...
src/fellow_storage.c
View file @
19356649
...
...
@@ -537,6 +537,7 @@ sfemem_free(struct worker *wrk, struct objcore *memoc)
LRU_Remove
(
memoc
);
if
(
stvfe
->
shutdown
&&
wrk
->
strangelove
==
(
int
)
STVELOVE_IS_DRAIN
)
{
fellow_cache_obj_wait_written
(
fco
);
fellow_cache_obj_deref
(
stvfe
->
fc
,
fco
);
}
else
{
// fellow_cache_obj_delete() implies deref
...
...
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