Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Apr 3, 2014 Kbuild

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 10aa136bddbaa7c845ab4eacb4a9a4a88d6657a3:

Cleanup symbols that should be static (2014-04-01 21:10:36 -0600)

are available in the git repository at:

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

for you to fetch changes up to 2e80228232afc9cf90ad06b360a33a05637978f3:

Use setvbuf() for log writing (2014-04-02 21:47:27 -0600)

----------------------------------------------------------------
Erwan Velu (3):
iolog: Keep full path for logs files
stat: fixing bw_agg reporting
io_u: Using initialized local variable

Jens Axboe (12):
Merge branch 'erwan/nobasename' of https://github.com/enovance/fio
Merge branch 'erwan/clang' of https://github.com/enovance/fio
Fix propagation of error value on failure to connect to fio server Add missing crc/test.h file
Don't crash when using filehash lock before init
mutex: add open init function and down_trylock() variant Add 'f' (Finishing) flag to status output
iolog: don't serialize the writing of all logs
Cleanup the parallellized log writing
crc: add test.h header to test.c
iolog: invert log_mask bits
Use setvbuf() for log writing

 HOWTO      |    1 +
 Makefile   |    2 +-
 backend.c  |   44 +--------------
 configure  |   20 +++++++
 crc/test.c |    2 +
 crc/test.h |    6 ++
 eta.c      |    6 +-
 filehash.c |    6 +-
 filelock.c |  157 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 filelock.h |   11 ++++
 fio.h      |    1 +
 init.c     |    9 ++-
 io_u.c     |    4 +-
 iolog.c    |  179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 iolog.h    |    3 +-
 libfio.c   |    6 ++
 mutex.c    |   55 +++++++++++++------
 mutex.h    |    2 +
 stat.c     |    2 +-
 19 files changed, 432 insertions(+), 84 deletions(-)
 create mode 100644 crc/test.h
 create mode 100644 filelock.c
 create mode 100644 filelock.h

---

Diff of recent changes:

HOWTO +1 -0
index 47eff96..7db7b89 100644
@@ -1590,6 +1590,7 @@ I		Thread initialized, waiting or generating necessary data.
 	M	Running, doing mixed sequential reads/writes.
 	m	Running, doing mixed random reads/writes.
 	F	Running, currently waiting for fsync()
+	f	Running, finishing up (writing IO logs, etc)
 	V	Running, doing verification of written data.
 E		Thread exited, not reaped by main thread yet.
 _		Thread reaped, or
Makefile +1 -1
index 1113c2f..231b4ab 100644
@@ -35,7 +35,7 @@ SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
 		cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \
 		lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
 		lib/hweight.c lib/getrusage.c idletime.c td_error.c \
-		profiles/tiobench.c profiles/act.c io_u_queue.c
+		profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c
 
 ifdef CONFIG_64BIT_LLP64
   CFLAGS += -DBITS_PER_LONG=32
backend.c +1 -43

69 lines not on this page · raw message

configure +20 -0
index 63aa02d..05f985b 100755
@@ -1163,6 +1163,23 @@ if compile_prog "" "-lrbd -lrados" "rbd"; then
 fi
 echo "Rados Block Device engine     $rbd"
 
+##########################################
+# Check whether we have setvbuf
+setvbuf="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+  FILE *f = NULL;
+  char buf[80];
+  setvbuf(f, buf, _IOFBF, sizeof(buf));
+  return 0;
+}
+EOF
+if compile_prog "" "" "setvbuf"; then
+  setvbuf="yes"
+fi
+echo "setvbuf                       $setvbuf"
 
 #############################################################################
 
@@ -1291,6 +1308,9 @@ fi
 if test "$cpu_count" = "yes" ; then
   output_sym "CONFIG_CPU_COUNT"
 fi
+if test "$setvbuf" = "yes" ; then
+  output_sym "CONFIG_SETVBUF"
+fi
 
 echo "LIBS+=$LIBS" >> $config_host_mak
 echo "CFLAGS+=$CFLAGS" >> $config_host_mak
crc/test.c +2 -0
index 174bea3..2cc7c0f 100644
@@ -18,6 +18,8 @@
 #include "../crc/sha512.h"
 #include "../crc/xxhash.h"
 
+#include "test.h"
+
 #define CHUNK		131072U
 #define NR_CHUNKS	  2048U
 
crc/test.h new file +6 -0
new file mode 100644
index 0000000..2b52d6a
@@ -0,0 +1,6 @@
+#ifndef FIO_CRC_TEST_H
+#define FIO_CRC_TEST_H
+
+int fio_crctest(const char *type);
+
+#endif
eta.c +5 -1
index b050102..42066e0 100644
@@ -74,6 +74,9 @@ static void check_str_update(struct thread_data *td)
 	case TD_FSYNCING:
 		c = 'F';
 		break;
+	case TD_FINISHING:
+		c = 'f';
+		break;
 	case TD_CREATED:
 		c = 'C';
 		break;
@@ -331,7 +334,8 @@ int calc_thread_status(struct jobs_eta *je, int force)
 			bw_avg_time = td->o.bw_avg_time;
 		if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING
 		    || td->runstate == TD_FSYNCING
-		    || td->runstate == TD_PRE_READING) {
+		    || td->runstate == TD_PRE_READING
+		    || td->runstate == TD_FINISHING) {
 			je->nr_running++;
 			if (td_read(td)) {
 				je->t_rate[0] += td->o.rate[DDIR_READ];
filehash.c +4 -2
index c6ebe76..0d61f54 100644
@@ -21,12 +21,14 @@ static unsigned short hash(const char *name)
 
 void fio_file_hash_lock(void)
 {
-	fio_mutex_down(hash_lock);
+	if (hash_lock)
+		fio_mutex_down(hash_lock);
 }
 
 void fio_file_hash_unlock(void)
 {
-	fio_mutex_up(hash_lock);
+	if (hash_lock)
+		fio_mutex_up(hash_lock);
 }
 
 void remove_file_hash(struct fio_file *f)
filelock.c new file +157 -0

157 lines not on this page · raw message

filelock.h new file +11 -0
new file mode 100644
index 0000000..97d13b7
@@ -0,0 +1,11 @@
+#ifndef FIO_LOCK_FILE_H
+#define FIO_LOCK_FILE_H
+
+extern void fio_lock_file(const char *);
+extern int fio_trylock_file(const char *);
+extern void fio_unlock_file(const char *);
+
+extern int fio_filelock_init(void);
+extern void fio_filelock_exit(void);
+
+#endif
fio.h +1 -0
index befdce3..a539f21 100644
@@ -471,6 +471,7 @@ enum {
 	TD_PRE_READING,
 	TD_VERIFYING,
 	TD_FSYNCING,
+	TD_FINISHING,
 	TD_EXITED,
 	TD_REAPED,
 };
init.c +4 -5
index c3996a7..910f2ba 100644
@@ -24,6 +24,7 @@
 #include "profile.h"
 #include "server.h"
 #include "idletime.h"
+#include "filelock.h"
 
 #include "lib/getopt.h"
 #include "lib/strcasestr.h"
@@ -259,6 +260,7 @@ static void free_shm(void)
 	}
 
 	options_free(fio_options, &def_thread);
+	fio_filelock_exit();
 	scleanup();
 }
 
@@ -1963,11 +1965,8 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
 	if (do_exit && !(is_backend || nr_clients))
 		exit(exit_val);
 
-	if (nr_clients && fio_clients_connect()) {
-		do_exit++;
-		exit_val = 1;
-		return -1;
-	}
+	if (nr_clients && fio_clients_connect())
+		exit(1);
 
 	if (is_backend && backend)
 		return fio_start_server(pid_file);
io_u.c +1 -3
index 2f6aecf..411da32 100644
@@ -426,12 +426,10 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
 	unsigned int minbs, maxbs;
 	unsigned long r, rand_max;
 
-	assert(ddir_rw(io_u->ddir));
+	assert(ddir_rw(ddir));
 
 	if (td->o.bs_is_seq_rand)
 		ddir = is_random ? DDIR_WRITE: DDIR_READ;
-	else
-		ddir = io_u->ddir;
 
 	minbs = td->o.min_bs[ddir];
 	maxbs = td->o.max_bs[ddir];
iolog.c +171 -8

219 lines not on this page · raw message

iolog.h +1 -2
index 0716391..50d09e2 100644
@@ -131,12 +131,11 @@ extern void add_iops_sample(struct thread_data *, enum fio_ddir, unsigned int,
 extern void init_disk_util(struct thread_data *);
 extern void update_rusage_stat(struct thread_data *);
 extern void setup_log(struct io_log **, unsigned long, int);
-extern void finish_log(struct thread_data *, struct io_log *, const char *);
-extern void finish_log_named(struct thread_data *, struct io_log *, const char *, const char *);
 extern void __finish_log(struct io_log *, const char *);
 extern struct io_log *agg_io_log[DDIR_RWDIR_CNT];
 extern int write_bw_log;
 extern void add_agg_sample(unsigned long, enum fio_ddir, unsigned int);
+extern void fio_writeout_logs(struct thread_data *);
 
 static inline void init_ipo(struct io_piece *ipo)
 {
libfio.c +6 -0
index 8eddab8..1fd77e4 100644
@@ -31,6 +31,7 @@
 #include "fio.h"
 #include "smalloc.h"
 #include "os/os.h"
+#include "filelock.h"
 
 /*
  * Just expose an empty list, if the OS does not support disk util stats
@@ -265,6 +266,11 @@ int initialize_fio(char *envp[])
 
 	sinit();
 
+	if (fio_filelock_init()) {
+		log_err("fio: failed initializing filelock subsys\n");
+		return 1;
+	}
+
 	/*
 	 * We need locale for number printing, if it isn't set then just
 	 * go with the US format.
mutex.c +37 -18

96 lines not on this page · raw message

mutex.h +2 -0
index 4f3486d..246afee 100644
@@ -24,10 +24,12 @@ enum {
 	FIO_MUTEX_UNLOCKED	= 1,
 };
 
+extern int __fio_mutex_init(struct fio_mutex *, int);
 extern struct fio_mutex *fio_mutex_init(int);
 extern void fio_mutex_remove(struct fio_mutex *);
 extern void fio_mutex_up(struct fio_mutex *);
 extern void fio_mutex_down(struct fio_mutex *);
+extern int fio_mutex_down_trylock(struct fio_mutex *);
 extern int fio_mutex_down_timeout(struct fio_mutex *, unsigned int);
 
 extern void fio_rwlock_read(struct fio_rwlock *);
stat.c +1 -1
index 4529f69..509c6f0 100644
@@ -770,7 +770,7 @@ static void add_ddir_status_json(struct thread_stat *ts,
 	}
 	json_object_add_value_int(dir_object, "bw_min", min);
 	json_object_add_value_int(dir_object, "bw_max", max);
-	json_object_add_value_float(dir_object, "bw_agg", mean);
+	json_object_add_value_float(dir_object, "bw_agg", p_of_agg);
 	json_object_add_value_float(dir_object, "bw_mean", mean);
 	json_object_add_value_float(dir_object, "bw_dev", dev);
 }