|
|
|
@ -68,7 +68,8 @@ DataFlash_File::DataFlash_File(const char *log_directory) :
@@ -68,7 +68,8 @@ DataFlash_File::DataFlash_File(const char *log_directory) :
|
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN |
|
|
|
|
,_perf_write(perf_alloc(PC_ELAPSED, "DF_write")), |
|
|
|
|
_perf_fsync(perf_alloc(PC_ELAPSED, "DF_fsync")), |
|
|
|
|
_perf_errors(perf_alloc(PC_COUNT, "DF_errors")) |
|
|
|
|
_perf_errors(perf_alloc(PC_COUNT, "DF_errors")), |
|
|
|
|
_perf_overruns(perf_alloc(PC_COUNT, "DF_overruns")) |
|
|
|
|
#endif |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
@ -194,6 +195,7 @@ void DataFlash_File::WriteBlock(const void *pBuffer, uint16_t size)
@@ -194,6 +195,7 @@ void DataFlash_File::WriteBlock(const void *pBuffer, uint16_t size)
|
|
|
|
|
uint16_t space = BUF_SPACE(_writebuf); |
|
|
|
|
if (space < size) { |
|
|
|
|
// discard the whole write, to keep the log consistent
|
|
|
|
|
perf_count(_perf_overruns); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -648,10 +650,10 @@ void DataFlash_File::_io_timer(void)
@@ -648,10 +650,10 @@ void DataFlash_File::_io_timer(void)
|
|
|
|
|
chunk, ensuring the directory entry is updated after each |
|
|
|
|
write. |
|
|
|
|
*/ |
|
|
|
|
BUF_ADVANCEHEAD(_writebuf, nwritten); |
|
|
|
|
#if CONFIG_HAL_BOARD != HAL_BOARD_AVR_SITL && CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE |
|
|
|
|
::fsync(_write_fd); |
|
|
|
|
#endif |
|
|
|
|
BUF_ADVANCEHEAD(_writebuf, nwritten); |
|
|
|
|
} |
|
|
|
|
perf_end(_perf_write); |
|
|
|
|
} |
|
|
|
|