Smart fadvise

Fuse causes double caching - both the fuse file system and the underlying
system end up caching the same data. There are various approaches to fix
this issue:

1) Use direct access on the fuse file system. This causes all reads and
writes to go to userland, which is very inefficient

2) Use O_DIRECT on the underlying file system. O_DIRECT has a lot of
issues, notably that it causes a performance degradation, and unaligned
accesses fail. It cannot be safely mixed with normal access.

3) Call posix_fadvise on every read and write to flush the cache on the
underlying file system. This causes severe performance degradation on
certain fio write tests.

4) (This solution) Call posix_fadvise 'intelligently' - specifically
this change tracks the total volume of reads and writes through each fd
and calls fadvise only when the total volume exceeds a given threshold.
It calls fadvise on the fds with the highest volume until the total
drops below a lower threshold. It also calls fadvise from a separate
thread to reduce latency.

This algorithm and the thresholds here were selected to make fio tests,
and particularly write fio tests, perform indistinguishably from the
same tests without fadvise while using as little double caching as
possible.

Bug: 141460684
Test: Run fio seq_write. Power usage is same as before, but threshold
      lines are visible in the log.
Change-Id: Ie6e7c44a4100890d83181b171ceea7d12d4ff713
1 file changed