Recent changes

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

 



The following changes since commit afa16407813ee36e75aaa665613c469500ed07c6:

  Ensure that we honor aio_read/write() returning EAGAIN (2011-07-07 21:06:40 +0200)

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

Jens Axboe (6):
      Rewrite posixaio back off comment to be closer to actual English
      Set affinity before doing buffer and io_u allocs
      Fix bad start_delay type
      Initial HP-UX port
      Add block device size detection for HP-UX
      Get rid of warning on platforms for casting char -> int

 Makefile           |   22 ++++++++++-------
 engines/posixaio.c |    4 ++-
 fio.c              |   33 ++++++++++++-------------
 fio.h              |    2 +-
 init.c             |    2 +-
 lib/getopt.h       |    2 +
 options.c          |    6 ++--
 os/os-hpux.h       |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 os/os.h            |    9 +++++++
 parse.c            |    8 +++---
 10 files changed, 121 insertions(+), 36 deletions(-)
 create mode 100644 os/os-hpux.h

---

Diff of recent changes:

diff --git a/Makefile b/Makefile
index b609deb..dade0ae 100644
--- a/Makefile
+++ b/Makefile
@@ -13,45 +13,49 @@ SOURCE = gettime.c fio.c ioengines.c init.c stat.c log.c time.c filesetup.c \
 		eta.c verify.c memory.c io_u.c parse.c mutex.c options.c \
 		rbtree.c smalloc.c filehash.c profile.c debug.c lib/rand.c \
 		lib/num2str.c $(wildcard crc/*.c) engines/cpu.c \
-		engines/mmap.c engines/sync.c engines/null.c engines/net.c \
-		memalign.c
+		engines/mmap.c engines/sync.c engines/null.c memalign.c
 
 ifeq ($(UNAME), Linux)
   SOURCE += diskutil.c fifo.c blktrace.c helpers.c cgroup.c trim.c \
 		engines/libaio.c engines/posixaio.c engines/sg.c \
 		engines/splice.c engines/syslet-rw.c engines/guasi.c \
-		engines/binject.c profiles/tiobench.c
+		engines/binject.c profiles/tiobench.c engines/net.c
   LIBS += -lpthread -ldl -lrt -laio
   CFLAGS += -rdynamic
 endif
 ifeq ($(UNAME), SunOS)
   SOURCE += fifo.c lib/strsep.c helpers.c engines/posixaio.c \
-		engines/solarisaio.c
+		engines/solarisaio.c engines/net.c
   LIBS	 += -lpthread -ldl -laio -lrt -lnsl -lsocket
   CPPFLAGS += -D__EXTENSIONS__
 endif
 ifeq ($(UNAME), FreeBSD)
-  SOURCE += helpers.c engines/posixaio.c
+  SOURCE += helpers.c engines/posixaio.c engines/net.c
   LIBS	 += -lpthread -lrt
   CFLAGS += -rdynamic
 endif
 ifeq ($(UNAME), NetBSD)
-  SOURCE += helpers.c engines/posixaio.c
+  SOURCE += helpers.c engines/posixaio.c engines/net.c
   LIBS	 += -lpthread -lrt
   CFLAGS += -rdynamic
 endif
 ifeq ($(UNAME), AIX)
-  SOURCE += fifo.c helpers.c lib/getopt_long.c engines/posixaio.c
+  SOURCE += fifo.c helpers.c lib/getopt_long.c engines/posixaio.c engines/net.c
   LIBS	 += -lpthread -ldl -lrt
   CFLAGS += -rdynamic
   CPPFLAGS += -D_LARGE_FILES -D__ppc__
 endif
+ifeq ($(UNAME), HP-UX)
+  SOURCE += fifo.c helpers.c lib/getopt_long.c lib/strsep.c
+  LIBS   += -lpthread -dl -lrt
+  CPPFLAGS += -D_LARGE_FILES
+endif
 ifeq ($(UNAME), Darwin)
-  SOURCE += helpers.c engines/posixaio.c
+  SOURCE += helpers.c engines/posixaio.c engines/net.c
   LIBS	 += -lpthread -ldl
 endif
 ifneq (,$(findstring CYGWIN,$(UNAME)))
-  SOURCE += engines/windowsaio.c
+  SOURCE += engines/windowsaio.c engines/net.c
   LIBS	 += -lpthread -lrt
 endif
 
diff --git a/engines/posixaio.c b/engines/posixaio.c
index 867b5f7..a84eb77 100644
--- a/engines/posixaio.c
+++ b/engines/posixaio.c
@@ -186,7 +186,9 @@ static int fio_posixaio_queue(struct thread_data *td,
 	if (ret) {
 		/*
 		 * At least OSX has a very low limit on the number of pending
-		 * IOs, so if it will return EAGAIN.
+		 * IOs, so if it returns EAGAIN, we are out of resources
+		 * to queue more. Just return FIO_Q_BUSY to naturally
+		 * drop off at this depth.
 		 */
 		if (errno == EAGAIN)
 			return FIO_Q_BUSY;
diff --git a/fio.c b/fio.c
index 48c728e..8185481 100644
--- a/fio.c
+++ b/fio.c
@@ -1093,6 +1093,22 @@ static void *thread_main(void *data)
 	}
 
 	/*
+	 * If we have a gettimeofday() thread, make sure we exclude that
+	 * thread from this job
+	 */
+	if (td->o.gtod_cpu)
+		fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu);
+
+	/*
+	 * Set affinity first, in case it has an impact on the memory
+	 * allocations.
+	 */
+	if (td->o.cpumask_set && fio_setaffinity(td->pid, td->o.cpumask) == -1) {
+		td_verror(td, errno, "cpu_set_affinity");
+		goto err;
+	}
+
+	/*
 	 * May alter parameters that init_io_u() will use, so we need to
 	 * do this first.
 	 */
@@ -1105,23 +1121,6 @@ static void *thread_main(void *data)
 	if (td->o.verify_async && verify_async_init(td))
 		goto err;
 
-	if (td->o.cpumask_set && fio_setaffinity(td->pid, td->o.cpumask) == -1) {
-		td_verror(td, errno, "cpu_set_affinity");
-		goto err;
-	}
-
-	/*
-	 * If we have a gettimeofday() thread, make sure we exclude that
-	 * thread from this job
-	 */
-	if (td->o.gtod_cpu) {
-		fio_cpu_clear(&td->o.cpumask, td->o.gtod_cpu);
-		if (fio_setaffinity(td->pid, td->o.cpumask) == -1) {
-			td_verror(td, errno, "cpu_set_affinity");
-			goto err;
-		}
-	}
-
 	if (td->ioprio_set) {
 		if (ioprio_set(IOPRIO_WHO_PROCESS, 0, td->ioprio) == -1) {
 			td_verror(td, errno, "ioprio_set");
diff --git a/fio.h b/fio.h
index fc64e3a..b869dd1 100644
--- a/fio.h
+++ b/fio.h
@@ -223,7 +223,7 @@ struct thread_options {
 	unsigned int fsync_blocks;
 	unsigned int fdatasync_blocks;
 	unsigned int barrier_blocks;
-	unsigned long start_delay;
+	unsigned long long start_delay;
 	unsigned long long timeout;
 	unsigned long long ramp_time;
 	unsigned int overwrite;
diff --git a/init.c b/init.c
index baf3130..4e7eb49 100644
--- a/init.c
+++ b/init.c
@@ -776,7 +776,7 @@ static int is_empty_or_comment(char *line)
 			return 1;
 		if (line[i] == '#')
 			return 1;
-		if (!isspace(line[i]) && !iscntrl(line[i]))
+		if (!isspace((int) line[i]) && !iscntrl((int) line[i]))
 			return 0;
 	}
 
diff --git a/lib/getopt.h b/lib/getopt.h
index 56fe3bf..0dd4608 100644
--- a/lib/getopt.h
+++ b/lib/getopt.h
@@ -1,4 +1,5 @@
 #ifndef _AIX
+#ifndef __hpux
 
 #include <getopt.h>
 
@@ -23,4 +24,5 @@ enum {
 int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
 
 #endif /* _GETOPT_H */
+#endif /* __hpux */
 #endif /* _AIX */
diff --git a/options.c b/options.c
index bd7dc99..f1c0ea7 100644
--- a/options.c
+++ b/options.c
@@ -329,7 +329,7 @@ static int str_cpumask_cb(void *data, unsigned long long *val)
 		return 1;
 	}
 
-	max_cpu = sysconf(_SC_NPROCESSORS_ONLN);
+	max_cpu = cpus_online();
 
 	for (i = 0; i < sizeof(int) * 8; i++) {
 		if ((1 << i) & *val) {
@@ -366,7 +366,7 @@ static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
 	strip_blank_front(&str);
 	strip_blank_end(str);
 
-	max_cpu = sysconf(_SC_NPROCESSORS_ONLN);
+	max_cpu = cpus_online();
 
 	while ((cpu = strsep(&str, ",")) != NULL) {
 		char *str2, *cpu2;
@@ -2095,7 +2095,7 @@ void fio_keywords_init(void)
 	sprintf(buf, "%llu", mb_memory);
 	fio_keywords[1].replace = strdup(buf);
 
-	l = sysconf(_SC_NPROCESSORS_ONLN);
+	l = cpus_online();
 	sprintf(buf, "%lu", l);
 	fio_keywords[2].replace = strdup(buf);
 }
diff --git a/os/os-hpux.h b/os/os-hpux.h
new file mode 100644
index 0000000..3c90841
--- /dev/null
+++ b/os/os-hpux.h
@@ -0,0 +1,69 @@
+#ifndef FIO_OS_HPUX_H
+#define FIO_OS_HPUX_H
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/fcntl.h>
+#include <sys/fadvise.h>
+#include <sys/mman.h>
+#include <sys/mpctl.h>
+#include <sys/scsi.h>
+
+#include "../file.h"
+
+#define FIO_HAVE_POSIXAIO
+#define FIO_HAVE_ODIRECT
+#define FIO_USE_GENERIC_RAND
+#define FIO_HAVE_CLOCK_MONOTONIC
+#define FIO_HAVE_PSHARED_MUTEX
+#define FIO_HAVE_FADVISE
+
+#define OS_MAP_ANON		MAP_ANONYMOUS
+#define OS_MSG_DONTWAIT		0
+
+#define POSIX_MADV_DONTNEED	MADV_DONTNEED
+#define POSIX_MADV_SEQUENTIAL	MADV_SEQUENTIAL
+#define POSIX_MADV_RANDOM	MADV_RANDOM
+#define posix_madvise(ptr, sz, hint)	madvise((ptr), (sz), (hint))
+
+static inline int blockdev_invalidate_cache(struct fio_file *f)
+{
+	return EINVAL;
+}
+
+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+	struct capacity cap;
+
+	if (!ioctl(f->fd, SIOC_CAPACITY, &cap) == -1) {
+		*bytes = cap.lba * cap.blksz;
+		return 0;
+	}
+
+	*bytes = 0;
+	return errno;
+}
+
+static inline unsigned long long os_phys_mem(void)
+{
+#if 0
+	long mem = sysconf(_SC_AIX_REALMEM);
+
+	if (mem == -1)
+		return 0;
+
+	return (unsigned long long) mem * 1024;
+#else
+	return 0;
+#endif
+}
+
+#define FIO_HAVE_CPU_ONLINE_SYSCONF
+
+static inline unsigned int cpus_online(void)
+{
+	return mpctl(MPC_GETNUMSPUS, 0, NULL);
+}
+
+#endif
diff --git a/os/os.h b/os/os.h
index 4bbdd62..3df7b41 100644
--- a/os/os.h
+++ b/os/os.h
@@ -18,6 +18,8 @@
 #include "os-mac.h"
 #elif defined(_AIX)
 #include "os-aix.h"
+#elif defined(__hpux)
+#include "os-hpux.h"
 #elif defined(__CYGWIN__)
 #include "os-windows.h"
 #else
@@ -178,4 +180,11 @@ static inline unsigned long long get_fs_size(const char *path)
 }
 #endif
 
+#ifndef FIO_HAVE_CPU_ONLINE_SYSCONF
+static inline unsigned int cpus_online(void)
+{
+	return sysconf(_SC_NPROCESSORS_ONLN);
+}
+#endif
+
 #endif
diff --git a/parse.c b/parse.c
index 1e6a522..97ea4aa 100644
--- a/parse.c
+++ b/parse.c
@@ -177,12 +177,12 @@ static unsigned long long get_mult_bytes(const char *str, int len, void *data)
          * Go forward until we hit a non-digit
          */
 	while ((p - str) <= len) {
-		if (!isdigit(*p))
+		if (!isdigit((int) *p))
 			break;
 		p++;
 	}
 
-	if (!isalpha(*p))
+	if (!isalpha((int) *p))
 		p = NULL;
 
 	return __get_mult_bytes(p, data);
@@ -230,7 +230,7 @@ void strip_blank_front(char **p)
 {
 	char *s = *p;
 
-	while (isspace(*s))
+	while (isspace((int) *s))
 		s++;
 
 	*p = s;
@@ -250,7 +250,7 @@ void strip_blank_end(char *p)
 		p = s;
 
 	s = p + strlen(p);
-	while ((isspace(*s) || iscntrl(*s)) && (s > start))
+	while ((isspace((int) *s) || iscntrl((int) *s)) && (s > start))
 		s--;
 
 	*(s + 1) = '\0';
--
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