Recent changes (master)
The following changes since commit 7a717ac6e6f154deebfe2af75a82ca0a76025453:
Fix compiler warning (2015-06-10 08:45:36 +0900)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to c08ad04c17e63c275ff477b21460ed6fa3b493f9:
Rename get_fs_size() to get_fs_free_size() (2015-06-11 20:15:54 +0900)
----------------------------------------------------------------
Tomohiro Kusumi (3):
Add header include for DragonFlyBSD
Add get_fs_size() support for BSDs
Rename get_fs_size() to get_fs_free_size()
filesetup.c | 2 +- os/os-android.h | 2 +- os/os-dragonfly.h | 16 ++++++++++++++++ os/os-freebsd.h | 15 +++++++++++++++ os/os-linux.h | 2 +- os/os.h | 2 +- 6 files changed, 35 insertions(+), 4 deletions(-)
---
Diff of recent changes:
filesetup.c +1 -1
@@ -732,7 +732,7 @@ static unsigned long long get_fs_free_counts(struct thread_data *td) fm = flist_entry(n, struct fio_mount, list);flist_del (&fm->list); - sz =get_fs_size (fm->base); + sz =get_fs_free_size (fm->base);if (sz && sz !=-1ULL ) ret += sz;
os/os-android.h +1 -1
@@ -238,7 +238,7 @@ static inline int arch_cache_line_size(void)return atoi (size); } -static inline unsigned long long get_fs_size (const char *path) +static inline unsigned long long get_fs_free_size (const char *path) {unsigned long long ret;struct statfs s;
os/os-dragonfly.h +16 -0
@@ -4,8 +4,10 @@#define FIO_OS os_dragonfly#include <errno.h> +#include <unistd.h> #include <sys/param.h> #include <sys/sysctl.h> +#include <sys/statvfs.h> #include "../file.h"
@@ -13,6 +15,7 @@#define FIO_USE_GENERIC_BDEV_SIZE #define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE +#define FIO_HAVE_FS_STAT #define FIO_HAVE_GETTID #undef FIO_HAVE_CPU_AFFINITY/* XXX notyet */
@@ -49,6 +52,19 @@ static inline int gettid(void)return (int )lwp_gettid (); } +static inline unsigned long long get_fs_free_size (const char *path) +{ +unsigned long long ret; +struct statvfs s; + +if (statvfs (path, &s) <0 ) +return -1ULL ; + + ret = s.f_frsize; + ret *= (unsigned long long ) s.f_bfree; +return ret; +} +#ifdef MADV_FREE #define FIO_MADV_FREE MADV_FREE#endif
os/os-freebsd.h +15 -0
@@ -10,6 +10,7 @@#include <sys/socket.h> #include <sys/param.h> #include <sys/cpuset.h> +#include <sys/statvfs.h> #include "../file.h"
@@ -17,6 +18,7 @@#define FIO_USE_GENERIC_RAND #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_CHARDEV_SIZE +#define FIO_HAVE_FS_STAT #define FIO_HAVE_GETTID #define FIO_HAVE_CPU_AFFINITY
@@ -99,6 +101,19 @@ static inline int gettid(void)return (int ) lwpid; } +static inline unsigned long long get_fs_free_size (const char *path) +{ +unsigned long long ret; +struct statvfs s; + +if (statvfs (path, &s) <0 ) +return -1ULL ; + + ret = s.f_frsize; + ret *= (unsigned long long ) s.f_bfree; +return ret; +} +#ifdef MADV_FREE #define FIO_MADV_FREE MADV_FREE#endif
os/os-linux.h +1 -1
@@ -247,7 +247,7 @@ static inline int arch_cache_line_size(void)return atoi (size); } -static inline unsigned long long get_fs_size (const char *path) +static inline unsigned long long get_fs_free_size (const char *path) {unsigned long long ret;struct statfs s;
os/os.h +1 -1
@@ -332,7 +332,7 @@ static inline int init_random_state(struct thread_data *td, unsigned long *rand_#endif #ifndef FIO_HAVE_FS_STAT -static inline unsigned long long get_fs_size (const char *path) +static inline unsigned long long get_fs_free_size (const char *path) {return 0 ; }