Trouble Shooting - statvfs() too slow

Android Issue: statvfs() too slow

statvfs() takes too much time if newly inserted USB disk (vfat) is very large

Solution

add “usefree” flag

diff --git a/fs/Vfat.cpp b/fs/Vfat.cpp
index 38681c9..04e9a1d 100644
--- a/fs/Vfat.cpp
+++ b/fs/Vfat.cpp
@@ -140,7 +140,7 @@ status_t Mount(const std::string& source, const std::string& target, bool ro,
     flags |= (remount ? MS_REMOUNT : 0);
     sprintf(mountData,
-            "utf8,uid=%d,gid=%d,fmask=%o,dmask=%o,shortname=mixed",
+            "utf8,uid=%d,gid=%d,fmask=%o,dmask=%o,shortname=mixed,usefree",
             ownerUid, ownerGid, permMask, permMask);
     rc = mount(c_source, c_target, "vfat", flags, mountData);