* [PATCH 0/3] Solaris related patches
@ 2017-11-03 16:46 kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 1/3] solaris: #include <pthread.h> kusumi.tomohiro
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: kusumi.tomohiro @ 2017-11-03 16:46 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
Add missing ones in Solaris header.
Compiled and tested on illumos.
Tomohiro Kusumi (3):
solaris: #include <pthread.h>
solaris: add os_phys_mem() implementation
solaris: add get_fs_free_size() implementation
os/os-solaris.h | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
--
2.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] solaris: #include <pthread.h>
2017-11-03 16:46 [PATCH 0/3] Solaris related patches kusumi.tomohiro
@ 2017-11-03 16:46 ` kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 2/3] solaris: add os_phys_mem() implementation kusumi.tomohiro
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: kusumi.tomohiro @ 2017-11-03 16:46 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
os/os-solaris.h header uses pthread, but doesn't include <pthread.h>
which should be to be able to include this header alone.
Needed for unittesting of OS specific stuff.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
os/os-solaris.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 45268b2..a6cd376 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -12,6 +12,7 @@
#include <sys/mman.h>
#include <sys/dkio.h>
#include <sys/byteorder.h>
+#include <pthread.h>
#include "../file.h"
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] solaris: add os_phys_mem() implementation
2017-11-03 16:46 [PATCH 0/3] Solaris related patches kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 1/3] solaris: #include <pthread.h> kusumi.tomohiro
@ 2017-11-03 16:46 ` kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 3/3] solaris: add get_fs_free_size() implementation kusumi.tomohiro
2017-11-03 16:48 ` [PATCH 0/3] Solaris related patches Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: kusumi.tomohiro @ 2017-11-03 16:46 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
Copied from os/os-linux.h. The standard sysconf(3C) names work on
Solaris (actually compiled/tested on illumos) as well.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
os/os-solaris.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/os/os-solaris.h b/os/os-solaris.h
index a6cd376..644807c 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -66,7 +66,14 @@ static inline int blockdev_invalidate_cache(struct fio_file *f)
static inline unsigned long long os_phys_mem(void)
{
- return 0;
+ long pagesize, pages;
+
+ pagesize = sysconf(_SC_PAGESIZE);
+ pages = sysconf(_SC_PHYS_PAGES);
+ if (pages == -1 || pagesize == -1)
+ return 0;
+
+ return (unsigned long long) pages * (unsigned long long) pagesize;
}
static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] solaris: add get_fs_free_size() implementation
2017-11-03 16:46 [PATCH 0/3] Solaris related patches kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 1/3] solaris: #include <pthread.h> kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 2/3] solaris: add os_phys_mem() implementation kusumi.tomohiro
@ 2017-11-03 16:46 ` kusumi.tomohiro
2017-11-03 16:48 ` [PATCH 0/3] Solaris related patches Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: kusumi.tomohiro @ 2017-11-03 16:46 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
Copied from os/os-freebsd.h. POSIX statvfs works on Solaris
(actually compiled/tested on illumos) as well.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
os/os-solaris.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 644807c..2f13723 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -12,6 +12,7 @@
#include <sys/mman.h>
#include <sys/dkio.h>
#include <sys/byteorder.h>
+#include <sys/statvfs.h>
#include <pthread.h>
#include "../file.h"
@@ -19,6 +20,7 @@
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_CHARDEV_SIZE
#define FIO_USE_GENERIC_BDEV_SIZE
+#define FIO_HAVE_FS_STAT
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_GETTID
@@ -76,6 +78,19 @@ static inline unsigned long long os_phys_mem(void)
return (unsigned long long) pages * (unsigned long long) pagesize;
}
+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;
+}
+
static inline void os_random_seed(unsigned long seed, os_random_state_t *rs)
{
rs->r[0] = seed & 0xffff;
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Solaris related patches
2017-11-03 16:46 [PATCH 0/3] Solaris related patches kusumi.tomohiro
` (2 preceding siblings ...)
2017-11-03 16:46 ` [PATCH 3/3] solaris: add get_fs_free_size() implementation kusumi.tomohiro
@ 2017-11-03 16:48 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2017-11-03 16:48 UTC (permalink / raw)
To: kusumi.tomohiro; +Cc: fio, Tomohiro Kusumi
On Fri, Nov 03 2017, kusumi.tomohiro@gmail.com wrote:
> From: Tomohiro Kusumi <tkusumi@tuxera.com>
>
> Add missing ones in Solaris header.
> Compiled and tested on illumos.
>
> Tomohiro Kusumi (3):
> solaris: #include <pthread.h>
> solaris: add os_phys_mem() implementation
> solaris: add get_fs_free_size() implementation
Looks good, applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-03 16:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 16:46 [PATCH 0/3] Solaris related patches kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 1/3] solaris: #include <pthread.h> kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 2/3] solaris: add os_phys_mem() implementation kusumi.tomohiro
2017-11-03 16:46 ` [PATCH 3/3] solaris: add get_fs_free_size() implementation kusumi.tomohiro
2017-11-03 16:48 ` [PATCH 0/3] Solaris related patches Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox