From 621679fec6c74233f366b91c07e35bb71590e08c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 6 Jul 2009 16:51:59 -0700 Subject: [PATCH] Update to use dmu_read() instead of dmu_read_impl() now that a 'flags' argument is available. This flags argument was added to allow a clean API for disabling prefetch, so I'll update zpios to use it in preference to the module option hack used before. --- cmd/zpios/zpios_main.c | 7 ++++++- module/zpios/include/zpios-ctl.h | 17 +++++++++-------- module/zpios/zpios.c | 5 ++++- scripts/zpios-survey.sh | 7 +++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/cmd/zpios/zpios_main.c b/cmd/zpios/zpios_main.c index 0505ad5db4..662a7b8ecc 100644 --- a/cmd/zpios/zpios_main.c +++ b/cmd/zpios/zpios_main.c @@ -45,7 +45,7 @@ #include "zpios.h" static const char short_opt[] = "t:l:h:e:n:i:j:k:o:m:q:r:c:a:b:g:s:A:B:C:" - "L:p:xP:R:G:I:N:T:VzOHv?"; + "L:p:xP:R:G:I:N:T:VzOfHv?"; static const struct option long_opt[] = { {"threadcount", required_argument, 0, 't' }, {"threadcount_low", required_argument, 0, 'l' }, @@ -79,6 +79,7 @@ static const struct option long_opt[] = { {"verify", no_argument, 0, 'V' }, {"zerocopy", no_argument, 0, 'z' }, {"nowait", no_argument, 0, 'O' }, + {"noprefetch", no_argument, 0, 'f' }, {"human-readable", no_argument, 0, 'H' }, {"verbose", no_argument, 0, 'v' }, {"help", no_argument, 0, '?' }, @@ -127,6 +128,7 @@ usage(void) " --verify -V\n" " --zerocopy -z\n" " --nowait -O\n" + " --noprefetch -f\n" " --human-readable -H\n" " --verbose -v =increase verbosity\n" " --help -? =this help\n\n"); @@ -283,6 +285,9 @@ args_init(int argc, char **argv) case 'O': /* --nowait */ args->flags |= DMU_WRITE_NOWAIT; break; + case 'f': /* --noprefetch */ + args->flags |= DMU_READ_NOPF; + break; case 'H': /* --human-readable */ args->human_readable = 1; break; diff --git a/module/zpios/include/zpios-ctl.h b/module/zpios/include/zpios-ctl.h index abe4b814bf..25a04bba01 100644 --- a/module/zpios/include/zpios-ctl.h +++ b/module/zpios/include/zpios-ctl.h @@ -46,14 +46,15 @@ #define DMU_IO 0x01 -#define DMU_WRITE 0x01 -#define DMU_READ 0x02 -#define DMU_VERIFY 0x04 -#define DMU_REMOVE 0x08 -#define DMU_FPP 0x10 -#define DMU_WRITE_ZC 0x20 /* Incompatible with DMU_VERIFY */ -#define DMU_READ_ZC 0x40 /* Incompatible with DMU_VERIFY */ -#define DMU_WRITE_NOWAIT 0x80 +#define DMU_WRITE 0x0001 +#define DMU_READ 0x0002 +#define DMU_VERIFY 0x0004 +#define DMU_REMOVE 0x0008 +#define DMU_FPP 0x0010 +#define DMU_WRITE_ZC 0x0020 /* Incompatible w/DMU_VERIFY */ +#define DMU_READ_ZC 0x0040 /* Incompatible w/DMU_VERIFY */ +#define DMU_WRITE_NOWAIT 0x0080 +#define DMU_READ_NOPF 0x0100 #define ZPIOS_NAME_SIZE 16 #define ZPIOS_PATH_SIZE 128 diff --git a/module/zpios/zpios.c b/module/zpios/zpios.c index fb508d7bbf..bf811c67ae 100644 --- a/module/zpios/zpios.c +++ b/module/zpios/zpios.c @@ -469,7 +469,10 @@ zpios_dmu_read(run_args_t *run_args, objset_t *os, uint64_t object, if (run_args->flags & DMU_READ_ZC) flags |= DMU_READ_ZEROCOPY; - return dmu_read_impl(os, object, offset, size, buf, flags); + if (run_args->flags & DMU_READ_NOPF) + flags |= DMU_READ_NO_PREFETCH; + + return dmu_read(os, object, offset, size, buf, flags); } static int diff --git a/scripts/zpios-survey.sh b/scripts/zpios-survey.sh index 2a3a33033e..6c5e1935b3 100755 --- a/scripts/zpios-survey.sh +++ b/scripts/zpios-survey.sh @@ -50,16 +50,16 @@ zpios_survey_base() { # Disable ZFS's prefetching. For some reason still not clear to me # current prefetching policy is quite bad for a random workload. -# Allowint the algorithm to detect a random workload and not do +# Allowing the algorithm to detect a random workload and not do # anything may be the way to address this issue. zpios_survey_prefetch() { TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+prefetch" print_header ${TEST_NAME} ./zfs.sh ${VERBOSE_FLAG} \ - zfs="zfs_prefetch_disable=1" | \ tee -a ${ZPIOS_SURVEY_LOG} ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ + -o "--noprefetch" | \ tee -a ${ZPIOS_SURVEY_LOG} ./zfs.sh -u ${VERBOSE_FLAG} | \ tee -a ${ZPIOS_SURVEY_LOG} @@ -144,12 +144,11 @@ zpios_survey_all() { print_header ${TEST_NAME} ./zfs.sh ${VERBOSE_FLAG} \ - zfs="zfs_prefetch_disable=1" \ zfs="zfs_vdev_max_pending=1024" \ zfs="zio_bulk_flags=0x100" | \ tee -a ${ZPIOS_SURVEY_LOG} ./zpios.sh ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ - -o "--zerocopy" \ + -o "--noprefetch --zerocopy" \ -s "set checksum=off" | \ tee -a ${ZPIOS_SURVEY_LOG} ./zfs.sh -u ${VERBOSE_FLAG} | \