Recent changes (master)

Jens Axboe
2017-03-18T13:45:15Z

The following changes since commit 8243be59aa35aa016fcbeee99353b08376953911:

Add 'stats' option (2017-03-16 14:43:37 -0600)

are available in the git repository at:

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

for you to fetch changes up to d9bb03d475e918e08c38bd882032ff788daa297f:

is_power_of_2() should return bool (2017-03-17 10:39:42 -0600)

----------------------------------------------------------------
Jens Axboe (2):
io_u: we don't need to set power_2 to false
is_power_of_2() should return bool

Pan Liu (1):
fixed the error=invalid argument when the lower bound of bsrange is not power of 2.

io_u.c | 7 +++++--
lib/pow2.h | 3 ++-
2 files changed, 7 insertions(+), 3 deletions(-)

---

Diff of recent changes:

diff --git a/io_u.c b/io_u.c
index f6efae0..5f01c1b 100644
--- a/io_u.c
+++ b/io_u.c
@@ -533,6 +533,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
unsigned int buflen = 0;
unsigned int minbs, maxbs;
uint64_t frand_max, r;
+ bool power_2;

assert(ddir_rw(ddir));

@@ -577,9 +578,11 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
}
}

- if (!td->o.bs_unaligned && is_power_of_2(minbs))
+ power_2 = is_power_of_2(minbs);
+ if (!td->o.bs_unaligned && power_2)
buflen &= ~(minbs - 1);
-
+ else if (!td->o.bs_unaligned && !power_2)
+ buflen -= buflen % minbs;
} while (!io_u_fits(td, io_u, buflen));

return buflen;
diff --git a/lib/pow2.h b/lib/pow2.h
index f3ca4d7..2cbca1a 100644
--- a/lib/pow2.h
+++ b/lib/pow2.h
@@ -2,8 +2,9 @@
#define FIO_POW2_H

#include <inttypes.h>
+#include "types.h"

-static inline int is_power_of_2(uint64_t val)
+static inline bool is_power_of_2(uint64_t val)
{
return (val != 0 && ((val & (val - 1)) == 0));
}