Work around O_DIRECT being invalid on Android

If a file is opened with O_DIRECT on Android, an EINVAL will be
triggered.  To try to accomplish the same effect as O_DIRECT,
this change adds calls to flush the page cache at key points for
the file and disk threads.  These calls will sync and write a "1"
to /proc/sys/vm/drop_caches if O_DIRECT caused an EINVAL, but
will be a NOP otherwise.

Change-Id: If0c7ca455384f9d60d4587127e96979a3c7f1169
Signed-off-by: Scott Anderson <saa@android.com>
3 files changed