Sync the stream with fdatasync()
This commit is contained in:
parent
df72ab79ac
commit
1d3dc235dc
5
sort.c
5
sort.c
@ -308,6 +308,7 @@ stream_winsort(struct ovni_stream *stream, struct ring *r)
|
|||||||
sp.base = stream->buf;
|
sp.base = stream->buf;
|
||||||
|
|
||||||
size_t empty_regions = 0;
|
size_t empty_regions = 0;
|
||||||
|
size_t updated = 0;
|
||||||
|
|
||||||
for(i=0; stream->active; i++)
|
for(i=0; stream->active; i++)
|
||||||
{
|
{
|
||||||
@ -337,6 +338,7 @@ stream_winsort(struct ovni_stream *stream, struct ring *r)
|
|||||||
{
|
{
|
||||||
if(ends_unsorted_region(ev))
|
if(ends_unsorted_region(ev))
|
||||||
{
|
{
|
||||||
|
updated = 1;
|
||||||
sp.next = ev;
|
sp.next = ev;
|
||||||
dbg("executing sort plan for stream tid=%d\n", stream->tid);
|
dbg("executing sort plan for stream tid=%d\n", stream->tid);
|
||||||
if(execute_sort_plan(&sp) < 0)
|
if(execute_sort_plan(&sp) < 0)
|
||||||
@ -361,6 +363,9 @@ stream_winsort(struct ovni_stream *stream, struct ring *r)
|
|||||||
err("warning: stream %d contains %ld empty sort regions\n",
|
err("warning: stream %d contains %ld empty sort regions\n",
|
||||||
stream->tid, empty_regions);
|
stream->tid, empty_regions);
|
||||||
|
|
||||||
|
if(updated && fdatasync(fd) < 0)
|
||||||
|
die("fdatasync %s failed: %s\n", fn, strerror(errno));
|
||||||
|
|
||||||
if(close(fd) < 0)
|
if(close(fd) < 0)
|
||||||
die("close %s failed: %s\n", fn, strerror(errno));
|
die("close %s failed: %s\n", fn, strerror(errno));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user