file_sys: remove all fsync calls [1/2]
PD#OTT-48177
Problem:
synchronous fsync blocks the procedure due to bad device
Solution:
remove the fsync calls
Verify:
Project PB
Change-Id: I9bb79449d0627432c95208d0c4873c78204c0325
Signed-off-by: Zhiqiang Han <zhiqiang.han@amlogic.com>
diff --git a/src/dvr_segment.c b/src/dvr_segment.c
index db512b7..1c9bd9c 100644
--- a/src/dvr_segment.c
+++ b/src/dvr_segment.c
@@ -337,7 +337,7 @@
}
fflush(fp);
- fsync(fileno(fp));
+ //fsync(fileno(fp));
fclose(fp);
return DVR_SUCCESS;
}
diff --git a/src/dvr_wrapper.c b/src/dvr_wrapper.c
index 6bd0c31..b571219 100644
--- a/src/dvr_wrapper.c
+++ b/src/dvr_wrapper.c
@@ -2744,7 +2744,7 @@
p_status->info.pkts - p_status->info_obsolete.pkts);
fputs(buf, fp);
fflush(fp);
- fsync(fileno(fp));
+ //fsync(fileno(fp));
fclose(fp);
return DVR_SUCCESS;
}
diff --git a/src/segment.c b/src/segment.c
index 5289970..9ef3f41 100644
--- a/src/segment.c
+++ b/src/segment.c
@@ -258,8 +258,9 @@
DVR_RETURN_IF_FALSE(buf);
DVR_RETURN_IF_FALSE(p_ctx->ts_fd != -1);
len = write(p_ctx->ts_fd, buf, count);
- if (p_ctx->time % TS_FILE_SYNC_TIME == 0)
- fsync(p_ctx->ts_fd);
+ /*remove the fsync, use /proc to control the data writeback*/
+ //if (p_ctx->time % TS_FILE_SYNC_TIME == 0)
+ // fsync(p_ctx->ts_fd);
return len;
}
@@ -307,7 +308,7 @@
DVR_INFO("%s force pcr:%llu buf:%s", __func__, pts, buf);
fputs(buf, p_ctx->index_fp);
fflush(p_ctx->index_fp);
- fsync(fileno(p_ctx->index_fp));
+ //fsync(fileno(p_ctx->index_fp));
p_ctx->last_record_pts = pts;
}
p_ctx->last_pts = pts;
@@ -380,8 +381,8 @@
fflush(p_ctx->index_fp);
p_ctx->time++;
//flush idx file 3s
- if ((p_ctx->time > 0 && p_ctx->time % IDX_FILE_SYNC_TIME == 0))
- fsync(fileno(p_ctx->index_fp));
+ //if ((p_ctx->time > 0 && p_ctx->time % IDX_FILE_SYNC_TIME == 0))
+ // fsync(fileno(p_ctx->index_fp));
if (p_ctx->time > IDX_FILE_SYNC_TIME)
p_ctx->time = 0;
p_ctx->last_record_pts = pts;
@@ -702,7 +703,7 @@
fputs(buf, p_ctx->dat_fp);
fflush(p_ctx->dat_fp);
- fsync(fileno(p_ctx->dat_fp));
+ //fsync(fileno(p_ctx->dat_fp));
return DVR_SUCCESS;
}
@@ -756,7 +757,7 @@
fputs(buf, p_ctx->all_dat_fp);
fflush(p_ctx->all_dat_fp);
- fsync(fileno(p_ctx->all_dat_fp));
+ //fsync(fileno(p_ctx->all_dat_fp));
return DVR_SUCCESS;
}