diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2017-01-09 13:10:19 +0100 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2017-01-14 05:43:35 -0800 |
commit | 66bd1686e90c339ce140bee55ccc1f195b2c862a (patch) | |
tree | 880ae32db32d570ab6f393ff06df34623ee58cf3 /libglusterfs | |
parent | db079ea2be121cfa3616de2b6dae844ab5a979c2 (diff) |
libglusterfs: fix statvfs in FreeBSD
FreeBSD interprets statvfs' f_bsize field in a different way than Linux.
This fix modifies the value returned by statvfs() on FreeBSD to match
the expected value by Gluster.
> Change-Id: I930dab6e895671157238146d333e95874ea28a08
> BUG: 1356076
> Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
> Reviewed-on: http://review.gluster.org/16361
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Change-Id: I68af1b84af47d9714ed3b76513d4d3d5747bcd45
BUG: 1411899
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/16400
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/syscall.c | 35 | ||||
-rw-r--r-- | libglusterfs/src/syscall.h | 3 |
2 files changed, 37 insertions, 1 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c index 316d80452fb..7cf1c7757fe 100644 --- a/libglusterfs/src/syscall.c +++ b/libglusterfs/src/syscall.c @@ -309,7 +309,40 @@ sys_lseek (int fd, off_t offset, int whence) int sys_statvfs (const char *path, struct statvfs *buf) { - return statvfs (path, buf); + int ret; + + ret = statvfs (path, buf); +#ifdef __FreeBSD__ + /* FreeBSD doesn't return the expected vaule in buf->f_bsize. It + * contains the optimal I/O size instead of the file system block + * size. Gluster expects that this field contains the block size. + */ + if (ret == 0) { + buf->f_bsize = buf->f_frsize; + } +#endif /* __FreeBSD__ */ + + return ret; +} + + +int +sys_fstatvfs (int fd, struct statvfs *buf) +{ + int ret; + + ret = fstatvfs (fd, buf); +#ifdef __FreeBSD__ + /* FreeBSD doesn't return the expected vaule in buf->f_bsize. It + * contains the optimal I/O size instead of the file system block + * size. Gluster expects this field to contain the block size. + */ + if (ret == 0) { + buf->f_bsize = buf->f_frsize; + } +#endif /* __FreeBSD__ */ + + return ret; } diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h index b549f6a1b3c..81884f88164 100644 --- a/libglusterfs/src/syscall.h +++ b/libglusterfs/src/syscall.h @@ -147,6 +147,9 @@ int sys_statvfs (const char *path, struct statvfs *buf); int +sys_fstatvfs (int fd, struct statvfs *buf); + +int sys_close (int fd); int |