Recent changes (master)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit a64ea63f648e77d583b5287634f44bea7da79b4b:

  lfsr: Fix spin related bug (2013-03-10 10:58:05 +0100)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Aaron Carroll (1):
      Android: add ioprio support

Alex Pyrgiotis (1):
      lfsr: fix verification and spin bugs

Martin Steigerwald (1):
      Make test for gnuplot work with empty strings.

Oleg (1):
      Conditionally include <sys/shm.h> based on OS support. Define missing MAP_HUGETLB for Android.

Oleg Matcovschi (1):
      Remove config-host.h on clean.

 Makefile           |    2 +-
 backend.c          |    6 +++---
 fio_generate_plots |    2 +-
 init.c             |    7 ++++---
 lib/lfsr.c         |   35 +++++++++++++++++++++++------------
 lib/lfsr.h         |    1 +
 memory.c           |    6 +++---
 os/os-android.h    |   26 ++++++++++++++++++++++++++
 t/lfsr-test.c      |    6 ++++--
 9 files changed, 66 insertions(+), 25 deletions(-)

---

Diff of recent changes:

diff --git a/Makefile b/Makefile
index 023557c..7a17555 100644
--- a/Makefile
+++ b/Makefile
@@ -217,7 +217,7 @@ fio: $(OBJS)
 	$(QUIET_LINK)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
 
 clean: FORCE
-	-rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak cscope.out *.d
+	-rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak config-host.h cscope.out *.d
 
 cscope:
 	@cscope -b -R
diff --git a/backend.c b/backend.c
index d1fe964..e482fb8 100644
--- a/backend.c
+++ b/backend.c
@@ -34,12 +34,12 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/ipc.h>
-#ifndef FIO_NO_HAVE_SHM_H
-#include <sys/shm.h>
-#endif
 #include <sys/mman.h>
 
 #include "fio.h"
+#ifndef FIO_NO_HAVE_SHM_H
+#include <sys/shm.h>
+#endif
 #include "hash.h"
 #include "smalloc.h"
 #include "verify.h"
diff --git a/fio_generate_plots b/fio_generate_plots
index 4285415..5e2febd 100755
--- a/fio_generate_plots
+++ b/fio_generate_plots
@@ -8,7 +8,7 @@ if [ "$1"x = "x" ]; then
 fi
 
 GNUPLOT=$(which gnuplot)
-if [ ! -x $GNUPLOT ]; then
+if [ ! -x "$GNUPLOT" ]; then
 	echo You need gnuplot installed to generate graphs
 	exit 1
 fi
diff --git a/init.c b/init.c
index c722688..9d15318 100644
--- a/init.c
+++ b/init.c
@@ -9,13 +9,14 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/ipc.h>
-#ifndef FIO_NO_HAVE_SHM_H
-#include <sys/shm.h>
-#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include "fio.h"
+#ifndef FIO_NO_HAVE_SHM_H
+#include <sys/shm.h>
+#endif
+
 #include "parse.h"
 #include "smalloc.h"
 #include "filehash.h"
diff --git a/lib/lfsr.c b/lib/lfsr.c
index 4c15c62..b10ba7a 100644
--- a/lib/lfsr.c
+++ b/lib/lfsr.c
@@ -112,26 +112,36 @@ static inline void __lfsr_next(struct fio_lfsr *fl, unsigned int spin)
  * lfsr_next does the following:
  *
  * a. Return if the number of max values has been exceeded.
- * b. Check if the next iteration(s) produce a cycle (due to spin) and add "1"
- *    where necessary.
- * c. Calculate the next value and return.
+ * b. Check if we have a spin value that produces a repeating subsequence.
+ *    This is previously calculated in `prepare_spin` and cycle_length should
+ *    be > 0. If we do have such a spin:
+ *
+ *    i. Decrement the calculated cycle.
+ *    ii. If it reaches zero, add "+1" to the spin and reset the cycle_length
+ *        (we have it cached in the struct fio_lfsr)
+ *
+ *    In either case, continue with the calculation of the next value.
+ * c. Check if the calculated value exceeds the desirable range. In this case,
+ *    go back to b, else return.
  */
 int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t last)
 {
-	int repeat;
-	unsigned int spin;
+	unsigned int spin = fl->spin;
 
 	if (fl->num_vals++ > fl->max_val)
 		return 1;
 
-	repeat = fl->num_vals % fl->cycle_length;
-	if (repeat == 0)
-		spin = fl->spin + 1;
-	else
-		spin = fl->spin;
-
 	do {
+		if (fl->cycle_length) {
+			fl->cycle_length--;
+			if (!fl->cycle_length) {
+				__lfsr_next(fl, fl->spin + 1);
+				fl->cycle_length = fl->cached_cycle_length;
+				goto check;
+			}
+		}
 		__lfsr_next(fl, spin);
+check: ;
 	} while (fl->last_val > fl->max_val);
 
 	*off = fl->last_val;
@@ -189,7 +199,7 @@ int prepare_spin(struct fio_lfsr *fl, unsigned int spin)
 
 	x = max / (spin + 1);
 	y = max % (spin + 1);
-	fl->cycle_length = max;	/* This is the expected cycle */
+	fl->cycle_length = 0;	/* No cycle occurs, other than the expected */
 	fl->spin = spin;
 
 	for (i = 1; i <= spin; i++) {
@@ -198,6 +208,7 @@ int prepare_spin(struct fio_lfsr *fl, unsigned int spin)
 			break;
 		}
 	}
+	fl->cached_cycle_length = fl->cycle_length;
 
 	return 0;
 }
diff --git a/lib/lfsr.h b/lib/lfsr.h
index bc16af9..187abf2 100644
--- a/lib/lfsr.h
+++ b/lib/lfsr.h
@@ -18,6 +18,7 @@ struct fio_lfsr {
 	uint64_t max_val;
 	uint64_t num_vals;
 	uint64_t cycle_length;
+	uint64_t cached_cycle_length;
 	unsigned int spin;
 };
 
diff --git a/memory.c b/memory.c
index ee5f895..443d71d 100644
--- a/memory.c
+++ b/memory.c
@@ -5,12 +5,12 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#ifndef FIO_NO_HAVE_SHM_H
-#include <sys/shm.h>
-#endif
 #include <sys/mman.h>
 
 #include "fio.h"
+#ifndef FIO_NO_HAVE_SHM_H
+#include <sys/shm.h>
+#endif
 
 static void *pinned_mem;
 
diff --git a/os/os-android.h b/os/os-android.h
index cedfdaf..070aa1a 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -19,6 +19,7 @@
 
 #define FIO_HAVE_DISK_UTIL
 #define FIO_HAVE_IOSCHED_SWITCH
+#define FIO_HAVE_IOPRIO
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_HUGETLB
 #define FIO_HAVE_BLKTRACE
@@ -31,6 +32,7 @@
 #define FIO_HAVE_E4_ENG
 #define FIO_HAVE_BYTEORDER_FUNCS
 #define FIO_HAVE_MMAP_HUGE
+#define FIO_NO_HAVE_SHM_H
 
 #define OS_MAP_ANON		MAP_ANONYMOUS
 
@@ -41,6 +43,9 @@
 #ifdef MADV_REMOVE
 #define FIO_MADV_FREE	MADV_REMOVE
 #endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB 0x40000 /* arch specific */
+#endif
 
 
 /*
@@ -74,6 +79,27 @@ static inline int shmdt (const void *__shmaddr)
 
 #define SPLICE_DEF_SIZE	(64*1024)
 
+static inline int ioprio_set(int which, int who, int ioprio)
+{
+	return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+enum {
+	IOPRIO_CLASS_NONE,
+	IOPRIO_CLASS_RT,
+	IOPRIO_CLASS_BE,
+	IOPRIO_CLASS_IDLE,
+};
+
+enum {
+	IOPRIO_WHO_PROCESS = 1,
+	IOPRIO_WHO_PGRP,
+	IOPRIO_WHO_USER,
+};
+
+#define IOPRIO_BITS		16
+#define IOPRIO_CLASS_SHIFT	13
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64	_IOR(0x12,114,size_t)
 #endif
diff --git a/t/lfsr-test.c b/t/lfsr-test.c
index 193a7f9..d371087 100644
--- a/t/lfsr-test.c
+++ b/t/lfsr-test.c
@@ -94,13 +94,15 @@ int main(int argc, char *argv[])
 	clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end);
 	fprintf(stderr, "finished.\n");
 
+
 	/* Check if all expected numbers within range have been calculated */
 	r = 0;
 	if (verify) {
 		fprintf(stderr, "Verifying results... ");
 		for (i = 0; i < numbers; i++) {
-			if (*(uint8_t *)(v + 1) != 1) {
-				fprintf(stderr, "failed.\n");
+			if (*(uint8_t *)(v + i) != 1) {
+				fprintf(stderr, "failed (%lu = %d).\n",
+						i, *(uint8_t *)(v + i));
 				r = 1;
 				break;
 			}
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux