If it's supposed to be after a certain amount of cumulative bytes read, then you'll need to remember total, because otherwise if caller only uses small reads, POSIX_FADV_DONTNEED will never get hit here.