Recent changes (master)

Jens Axboe
2016-10-27T13:51:11Z

The following changes since commit a0290964d9e15aa9faa5a139effc14cfa5bcd3f1:

Fio 2.15 (2016-10-25 12:38:13 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to a955f5297d6951517c663ac9effd94adfae6a563:

Add blockdev_size() support for OpenBSD (2016-10-26 08:00:10 -0600)

----------------------------------------------------------------
Tomohiro Kusumi (2):
Add blockdev_size() support for NetBSD
Add blockdev_size() support for OpenBSD

os/os-netbsd.h | 17 ++++++++++++++++-
os/os-openbsd.h | 17 ++++++++++++++++-
2 files changed, 32 insertions(+), 2 deletions(-)

---

Diff of recent changes:

diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index 1ef5866..2133d7a 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -7,6 +7,9 @@
#include <lwp.h>
#include <sys/param.h>
#include <sys/statvfs.h>
+#include <sys/ioctl.h>
+#include <sys/dkio.h>
+#include <sys/disklabel.h>
/* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
#define rb_node _rb_node
#include <sys/sysctl.h>
@@ -17,7 +20,6 @@
#include "../file.h"

#define FIO_HAVE_ODIRECT
-#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_FS_STAT
@@ -37,6 +39,19 @@

typedef off_t off64_t;

+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ struct disklabel dl;
+
+ if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
+ *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
return EINVAL;
diff --git a/os/os-openbsd.h b/os/os-openbsd.h
index 2998510..3343cbd 100644
--- a/os/os-openbsd.h
+++ b/os/os-openbsd.h
@@ -6,6 +6,9 @@
#include <errno.h>
#include <sys/param.h>
#include <sys/statvfs.h>
+#include <sys/ioctl.h>
+#include <sys/dkio.h>
+#include <sys/disklabel.h>
/* XXX hack to avoid conflicts between rbtree.h and <sys/tree.h> */
#include <sys/sysctl.h>
#undef RB_BLACK
@@ -15,7 +18,6 @@
#include "../file.h"

#undef FIO_HAVE_ODIRECT
-#define FIO_USE_GENERIC_BDEV_SIZE
#define FIO_USE_GENERIC_RAND
#define FIO_USE_GENERIC_INIT_RANDOM_STATE
#define FIO_HAVE_FS_STAT
@@ -35,6 +37,19 @@

typedef off_t off64_t;

+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ struct disklabel dl;
+
+ if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
+ *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+
static inline int blockdev_invalidate_cache(struct fio_file *f)
{
return EINVAL;