Merge branch 'master' into gfio
authorJens Axboe <axboe@kernel.dk>
Tue, 29 Jan 2013 09:09:55 +0000 (10:09 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 Jan 2013 09:09:55 +0000 (10:09 +0100)
Conflicts:
Makefile
configure
options.c

Signed-off-by: Jens Axboe <axboe@kernel.dk>
1  2 
Makefile
backend.c
configure
filesetup.c
fio.h
options.c
os/os.h
parse.c
stat.c

diff --cc Makefile
+++ b/Makefile
@@@ -1,9 -1,8 +1,8 @@@
  DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
- CPPFLAGS= -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
-       $(DEBUGFLAGS)
+ CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(DEBUGFLAGS)
  OPTFLAGS= -O3 -g -ffast-math $(EXTFLAGS)
  CFLAGS        = -std=gnu99 -Wwrite-strings -Wall $(OPTFLAGS)
 -LIBS  = -lm $(EXTLIBS)
 +LIBS  = -lm -lz $(EXTLIBS)
  PROGS = fio
  SCRIPTS = fio_generate_plots
  UNAME  := $(shell uname)
@@@ -32,9 -27,8 +31,9 @@@ SOURCE := gettime.c ioengines.c init.c 
                lib/num2str.c lib/ieee754.c $(wildcard crc/*.c) engines/cpu.c \
                engines/mmap.c engines/sync.c engines/null.c engines/net.c \
                memalign.c server.c client.c iolog.c backend.c libfio.c flow.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
 +              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/hweight.c lib/getrusage.c
  
  ifdef CONFIG_64BIT_LLP64
    CFLAGS += -DBITS_PER_LONG=32
@@@ -251,38 -179,11 +187,38 @@@ FIO-VERSION-FILE: FORC
  CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
  
  .c.o: .depend FORCE
-       $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
+       $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
  
  init.o: FIO-VERSION-FILE
-       $(QUIET_CC)$(CC) -o init.o -c $(CFLAGS) $(CPPFLAGS) -c init.c
+       $(QUIET_CC)$(CC) -o init.o $(CFLAGS) $(CPPFLAGS) -c init.c
  
 +gcompat.o: gcompat.c gcompat.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gcompat.c
 +
 +goptions.o: goptions.c goptions.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c goptions.c
 +
 +ghelpers.o: ghelpers.c ghelpers.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c ghelpers.c
 +
 +gerror.o: gerror.c gerror.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gerror.c
 +
 +gclient.o: gclient.c gclient.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gclient.c
 +
 +gfio.o: gfio.c ghelpers.c
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c gfio.c
 +
 +graph.o: graph.c graph.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c graph.c
 +
 +cairo_text_helpers.o: cairo_text_helpers.c cairo_text_helpers.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c cairo_text_helpers.c
 +
 +printing.o: printing.c printing.h
 +      $(QUIET_CC)$(CC) $(CFLAGS) $(GTK_CFLAGS) $(CPPFLAGS) -c printing.c
 +
  t/stest: $(T_SMALLOC_OBJS)
        $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(T_SMALLOC_OBJS) $(LIBS) $(LDFLAGS)
  
@@@ -307,7 -205,7 +243,7 @@@ t/axmap: $(T_AXMAP_OBJS
  $(PROGS): .depend
  
  clean: FORCE
-       -rm -f .depend $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE config-host.mak config-host.ld cscope.out
 -      -rm -f .depend $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core FIO-VERSION-FILE config-host.mak cscope.out
++      -rm -f .depend $(GFIO_OBJS) $(OBJS) $(T_OBJS) $(PROGS) $(T_PROGS) core.* core gfio FIO-VERSION-FILE config-host.mak cscope.out
  
  cscope:
        @cscope -b -R
diff --cc backend.c
+++ b/backend.c
@@@ -1217,11 -1210,8 +1218,10 @@@ static void *thread_main(void *data
                        goto err;
        }
  
 +      fio_verify_init(td);
 +
        fio_gettime(&td->epoch, NULL);
-       getrusage(RUSAGE_SELF, &td->ru_start);
+       fio_getrusage(&td->ru_start);
        clear_state = 0;
        while (keep_running(td)) {
                uint64_t verify_bytes;
diff --cc configure
+++ b/configure
@@@ -102,24 -122,20 +122,27 @@@ cpu="
  
  cc="${CC-${cross_prefix}gcc}"
  
- gfio="no"
 +# default options
  show_help="no"
  exit_val=0
++gfio="no"
  
  # parse options
  for opt do
    optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
    case "$opt" in
 -  --cc=*) CC="$optarg"
 -  ;;
 -  --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
 +  --cc=*)
 +    CC="$optarg"
 +    ;;
++  --extra-cflags=*)
++  CFLAGS="$CFLAGS $optarg"
+   ;;
 +  --enable-gfio)
 +    gfio="yes"
 +    ;;
    --help)
 -  show_help="yes"
 -  ;;
 +    show_help="yes"
 +    ;;
    *)
    echo "Bad option $opt"
    show_help="yes"
  done
  
  if test "$show_help" = "yes" ; then
 -  echo "--cc=                  Specify compiler to use"
 +    echo "--cc=                  Specify compiler to use"
+   echo "--extra-cflags=        Specify extra CFLAGS to pass to compiler"
 -  exit $exit_val
 +    echo "--enable-gfio          Enable building of gtk gfio"
 +    exit $exit_val
  fi
  
  if check_define __linux__ ; then
  echo "__thread                      $tls_thread"
  
  ##########################################
 +# Whether or not __thread is supported for TLS
 +if test "$gfio" = "yes" ; then
 +  cat > $TMPC << EOF
 +#include <glib.h>
 +#include <cairo.h>
 +#include <gtk/gtk.h>
 +int main(void)
 +{
 +  gdk_threads_enter();
 +  gtk_main();
 +  gdk_threads_leave();
 +  return 0;
 +}
 +EOF
 +GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
 +if test "$?" != "0" ; then
 +  echo "configure: gtk and gthread not found"
 +  exit 1
 +fi
 +GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
 +if test "$?" != "0" ; then
 +  echo "configure: gtk and gthread not found"
 +  exit 1
 +fi
 +if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio"; then
 +  gfio="yes"
 +  LIBS="$LIBS $GTK_LIBS"
 +  CFLAGS="$CFLAGS $GTK_CFLAGS"
 +else
 +  echo "Please install gtk and gdk libraries"
 +  gfio="no"
 +fi
 +fi
 +
 +echo "gfio                          $gfio"
 +
+ # Check whether we have getrusage(RUSAGE_THREAD)
+ rusage_thread="no"
+ cat > $TMPC << EOF
+ #include <sys/time.h>
+ #include <sys/resource.h>
+ int main(int argc, char **argv)
+ {
+   struct rusage ru;
+   getrusage(RUSAGE_THREAD, &ru);
+   return 0;
+ }
+ EOF
+ if compile_prog "" "" "RUSAGE_THREAD"; then
+   rusage_thread="yes"
+ fi
+ echo "RUSAGE_THREAD                 $rusage_thread"
  #############################################################################
  
  echo "# Automatically generated by configure - do not modify" > $config_host_mak
@@@ -861,94 -860,94 +904,98 @@@ els
    exit 1
  fi
  if test "$bigendian" = "yes" ; then
-   echo "CONFIG_BIG_ENDIAN=y" >> $config_host_mak
+   output_sym "CONFIG_BIG_ENDIAN"
  else
-   echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak
+   output_sym "CONFIG_LITTLE_ENDIAN"
  fi
  if test "$libaio" = "yes" ; then
-   echo "CONFIG_LIBAIO=y" >> $config_host_mak
+   output_sym "CONFIG_LIBAIO"
  fi
  if test "$posix_aio" = "yes" ; then
-   echo "CONFIG_POSIXAIO=y" >> $config_host_mak
+   output_sym "CONFIG_POSIXAIO"
  fi
  if test "$posix_aio_fsync" = "yes" ; then
-   echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak
+   output_sym "CONFIG_POSIXAIO_FSYNC"
  fi
  if test "$linux_fallocate" = "yes" ; then
-   echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak
+   output_sym "CONFIG_LINUX_FALLOCATE"
  fi
  if test "$posix_fallocate" = "yes" ; then
-   echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
+   output_sym "CONFIG_POSIX_FALLOCATE"
  fi
  if test "$fdatasync" = "yes" ; then
-   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
+   output_sym "CONFIG_FDATASYNC"
  fi
  if test "$sync_file_range" = "yes" ; then
-   echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
+   output_sym "CONFIG_SYNC_FILE_RANGE"
  fi
  if test "$sfaa" = "yes" ; then
-   echo "CONFIG_SFAA=y" >> $config_host_mak
+   output_sym "CONFIG_SFAA"
  fi
  if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then
-   echo "CONFIG_RDMA=y" >> $config_host_mak
+   output_sym "CONFIG_RDMA"
  fi
  if test "$clock_gettime" = "yes" ; then
-   echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak
+   output_sym "CONFIG_CLOCK_GETTIME"
  fi
  if test "$clock_monotonic" = "yes" ; then
-   echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak
+   output_sym "CONFIG_CLOCK_MONOTONIC"
  fi
  if test "$clock_monotonic_precise" = "yes" ; then
-   echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak
+   output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
  fi
  if test "$gettimeofday" = "yes" ; then
-   echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak
+   output_sym "CONFIG_GETTIMEOFDAY"
  fi
  if test "$posix_fadvise" = "yes" ; then
-   echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak
+   output_sym "CONFIG_POSIX_FADVISE"
  fi
  if test "$linux_3arg_affinity" = "yes" ; then
-   echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak
+   output_sym "CONFIG_3ARG_AFFINITY"
  elif test "$linux_2arg_affinity" = "yes" ; then
-   echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak
+   output_sym "CONFIG_2ARG_AFFINITY"
  fi
  if test "$strsep" = "yes" ; then
-   echo "CONFIG_STRSEP=y" >> $config_host_mak
+   output_sym "CONFIG_STRSEP"
  fi
  if test "$getopt_long_only" = "yes" ; then
-   echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak
+   output_sym "CONFIG_GETOPT_LONG_ONLY"
  fi
  if test "$inet_aton" = "yes" ; then
-   echo "CONFIG_INET_ATON=y" >> $config_host_mak
+   output_sym "CONFIG_INET_ATON"
  fi
  if test "$socklen_t" = "yes" ; then
-   echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak
+   output_sym "CONFIG_SOCKLEN_T"
  fi
  if test "$ext4_me" = "yes" ; then
-   echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak
+   output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
  fi
  if test "$linux_splice" = "yes" ; then
-   echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak
+   output_sym "CONFIG_LINUX_SPLICE"
  fi
  if test "$guasi" = "yes" ; then
-   echo "CONFIG_GUASI=y" >> $config_host_mak
+   output_sym "CONFIG_GUASI"
  fi
  if test "$fusion_aw" = "yes" ; then
-   echo "CONFIG_FUSION_AW=y" >> $config_host_mak
+   output_sym "CONFIG_FUSION_AW"
  fi
  if test "$libnuma" = "yes" ; then
-   echo "CONFIG_LIBNUMA=y" >> $config_host_mak
+   output_sym "CONFIG_LIBNUMA"
  fi
  if test "$solaris_aio" = "yes" ; then
-   echo "CONFIG_SOLARISAIO=y" >> $config_host_mak
+   output_sym "CONFIG_SOLARISAIO"
  fi
  if test "$tls_thread" = "yes" ; then
-   echo "CONFIG_TLS_THREAD=y" >> $config_host_mak
+   output_sym "CONFIG_TLS_THREAD"
+ fi
+ if test "$rusage_thread" = "yes" ; then
+   output_sym "CONFIG_RUSAGE_THREAD"
  fi
 +if test "$gfio" = "yes" ; then
 +  echo "CONFIG_GFIO=y" >> $config_host_mak
 +fi
  
  echo "LIBS+=$LIBS" >> $config_host_mak
 +echo "CFLAGS+=$CFLAGS" >> $config_host_mak
  echo "CC=$cc" >> $config_host_mak
+ echo "EXTFLAGS=$EXTFLAGS $CFLAGS" >> $config_host_mak
diff --cc filesetup.c
@@@ -96,11 -96,11 +96,11 @@@ static int extend_file(struct thread_da
  
                        r = fallocate(f->fd, FALLOC_FL_KEEP_SIZE, 0,
                                        f->real_file_size);
 -                      if (r != 0) {
 +                      if (r != 0)
                                td_verror(td, errno, "fallocate");
 -                      }
 +
                        break;
- #endif /* FIO_HAVE_LINUX_FALLOCATE */
+ #endif /* CONFIG_LINUX_FALLOCATE */
                default:
                        log_err("fio: unknown fallocate mode: %d\n",
                                td->o.fallocate_mode);
diff --cc fio.h
Simple merge
diff --cc options.c
+++ b/options.c
@@@ -1693,12 -1577,10 +1693,12 @@@ struct fio_option fio_options[FIO_MAX_O
                          },
                },
                .parent = "nrfiles",
 +              .hide   = 1,
        },
- #ifdef FIO_HAVE_FALLOCATE
+ #ifdef CONFIG_POSIX_FALLOCATE
        {
                .name   = "fallocate",
 +              .lname  = "Fallocate",
                .type   = FIO_OPT_STR,
                .off1   = td_var_offset(fallocate_mode),
                .help   = "Whether pre-allocation is performed when laying out files",
                          },
                },
        },
- #endif        /* FIO_HAVE_FALLOCATE */
+ #endif        /* CONFIG_POSIX_FALLOCATE */
        {
                .name   = "fadvise_hint",
 +              .lname  = "Fadvise hint",
                .type   = FIO_OPT_BOOL,
                .off1   = td_var_offset(fadvise_hint),
                .help   = "Use fadvise() to advise the kernel on IO pattern",
                .name   = "experimental_verify",
                .off1   = td_var_offset(experimental_verify),
                .type   = FIO_OPT_BOOL,
+               .help   = "Enable experimental verification",
 +              .category = FIO_OPT_C_IO,
 +              .group  = FIO_OPT_G_VERIFY,
        },
  #ifdef FIO_HAVE_TRIM
        {
diff --cc os/os.h
Simple merge
diff --cc parse.c
Simple merge
diff --cc stat.c
Simple merge