Recent changes (master)
The following changes since commit 669e8bf8d509458aa6b3978b9e8a2e3d666e892d:
server: make the setsockopt() error output a bit more informative (2015-07-29 09:00:03 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 92060d6c59f1848e86cd9ddd7550907c79bda3d5:
arch-ppc.h: Add ilog2 implementation for ppc64 (2015-08-13 12:45:20 -0600)
----------------------------------------------------------------
Chandan Rajendra (1):
arch-ppc.h: Add ilog2 implementation for ppc64
DaveGlen (2):
Implement new Rate Control
initialize rate_io_issue_bytes
Jens Axboe (1):
Whitespace fixup
arch/arch-ppc.h | 12 ++++++++--- backend.c | 26 ++++++++++++++++++++++ fio.h | 3 ++- init.c | 3 ++- io_u.c | 67 +++++++++++++++------------------------------------------ ioengines.c | 2 ++ libfio.c | 2 ++ workqueue.c | 1 + 8 files changed, 61 insertions(+), 55 deletions(-)
---
Diff of recent changes:
arch/arch-ppc.h +9 -3
@@ -33,18 +33,24 @@#define write_barrier () __asm__ __volatile__ ("sync" : : : "memory") +#ifdef __powerpc64__ +#define PPC_CNTLZL "cntlzd" +#else +#define PPC_CNTLZL "cntlzw" +#endif +static inline int __ilog2 (unsigned long bitmask) {int lz; - asm ("cntlzw %0,%1" :"=r" (lz) :"r" (bitmask)); -return 31 - lz; + asm (PPC_CNTLZL " %0,%1" :"=r" (lz) :"r" (bitmask)); +return BITS_PER_LONG -1 - lz; }static inline int arch_ffz (unsigned long bitmask) {if ((bitmask = ~bitmask) ==0 ) -return 32 ; +return BITS_PER_LONG ;return __ilog2 (bitmask & -bitmask); }
backend.c +26 -0
@@ -763,6 +763,25 @@ static int io_complete_bytes_exceeded(struct thread_data *td) }/* +* used to calculate the next io time for rate control +* +*/ +static long long usec_for_io (struct thread_data *td,enum fio_ddir ddir) +{ +uint64_t secs, remainder, bps, bytes; + +assert (!(td->flags &TD_F_CHILD )); + bytes = td->rate_io_issue_bytes[ddir]; + bps = td->rate_bps[ddir]; +if (bps) { + secs = bytes / bps; + remainder = bytes % bps; +return remainder *1000000 / bps + secs *1000000 ; + }else +return 0 ; +} + +/* * Main IO worker function. It retrieves io_u's to process and queues * and reaps them, checking for rate and errors along the way. *
@@ -891,9 +910,16 @@ static uint64_t do_io(struct thread_data *td)if (td->error)break ; ret =workqueue_enqueue (&td->io_wq, io_u); + +if (should_check_rate (td)) + td->rate_next_io_time[ddir] =usec_for_io (td, ddir); + }else { ret =td_io_queue (td, io_u); +if (should_check_rate (td)) + td->rate_next_io_time[ddir] =usec_for_io (td, ddir); +if (io_queue_event (td, io_u, &ret, ddir, &bytes_issued,0 , &comp_time))break ;
fio.h +2 -1
@@ -238,9 +238,10 @@ struct thread_data {* Rate state */ uint64_t rate_bps[DDIR_RWDIR_CNT ]; -long rate_pending_usleep[DDIR_RWDIR_CNT ]; +unsigned long rate_next_io_time[DDIR_RWDIR_CNT ];unsigned long rate_bytes[DDIR_RWDIR_CNT ];unsigned long rate_blocks[DDIR_RWDIR_CNT ]; +unsigned long rate_io_issue_bytes[DDIR_RWDIR_CNT ];struct timeval lastrate[DDIR_RWDIR_CNT ];/*
init.c +2 -1
@@ -465,7 +465,8 @@ static int __setup_rate(struct thread_data *td, enum fio_ddir ddir)return -1 ; } - td->rate_pending_usleep[ddir] =0 ; + td->rate_next_io_time[ddir] =0 ; + td->rate_io_issue_bytes[ddir] =0 ;return 0 ; }
io_u.c +17 -50
118 lines not on this page · raw message
ioengines.c +2 -0
@@ -299,6 +299,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)if (ddir_rw (ddir)) { td->io_issues[ddir]++; td->io_issue_bytes[ddir] += buflen; + td->rate_io_issue_bytes[ddir] += buflen; } ret = td->io_ops->queue (td, io_u);
@@ -308,6 +309,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)if (ret ==FIO_Q_BUSY &&ddir_rw (ddir)) { td->io_issues[ddir]--; td->io_issue_bytes[ddir] -= buflen; + td->rate_io_issue_bytes[ddir] -= buflen; }/*
libfio.c +2 -0
@@ -89,6 +89,8 @@ static void reset_io_counters(struct thread_data *td) td->rate_bytes[ddir] =0 ; td->rate_blocks[ddir] =0 ; td->bytes_done[ddir] =0 ; + td->rate_io_issue_bytes[ddir] =0 ; + td->rate_next_io_time[ddir] =0 ; } td->zone_bytes =0 ;
workqueue.c +1 -0
@@ -124,6 +124,7 @@ int workqueue_enqueue(struct workqueue *wq, struct io_u *io_u)if (ddir_rw (ddir)) { parent->io_issues[ddir]++; parent->io_issue_bytes[ddir] += io_u->xfer_buflen; + parent->rate_io_issue_bytes[ddir] += io_u->xfer_buflen; }pthread_mutex_lock (&sw->lock);