From b08ed20e5faa75279462e6bd6ddf0c956e7106fb Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Sat, 23 May 2020 21:40:52 +0200 Subject: [PATCH] Linux: enable direct IO for verify Linux has huge buffer cache (all free memory) So make sure we are reading data back from the actual card instead of cache. --- downloadthread.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/downloadthread.cpp b/downloadthread.cpp index 8a62e4e..2516230 100644 --- a/downloadthread.cpp +++ b/downloadthread.cpp @@ -603,6 +603,11 @@ bool DownloadThread::_verify() QElapsedTimer t1; t1.start(); +#ifdef Q_OS_LINUX + /* Make sure we are reading from the drive and not from cache */ + fcntl(_file.handle(), F_SETFL, O_DIRECT | fcntl(_file.handle(), F_GETFL)); +#endif + if (!_firstBlock) { _file.seek(0);