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/zfs/dmu.c b/module/zfs/dmu.c index c0137215b9..ac0f51d8e2 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -601,13 +601,6 @@ dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, return (err); } -int -dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, - void *buf) -{ - return dmu_read_impl(os, object, offset, size, buf, 0); -} - void dmu_write_impl(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, const void *buf, dmu_tx_t *tx, int flags) @@ -651,6 +644,13 @@ dmu_write_impl(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_buf_rele_array(dbp, numbufs, FTAG); } +void +dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, + const void *buf, dmu_tx_t *tx) +{ + dmu_write_impl(os, object, offset, size, buf, tx, 0); +} + void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx) @@ -672,13 +672,6 @@ dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_buf_rele_array(dbp, numbufs, FTAG); } -void -dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, - const void *buf, dmu_tx_t *tx) -{ - dmu_write_impl(os, object, offset, size, buf, tx, 0); -} - #if defined(_KERNEL) && defined(HAVE_UIO_RW) int dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size) @@ -1299,7 +1292,6 @@ dmu_fini(void) #if defined(_KERNEL) && defined(HAVE_SPL) EXPORT_SYMBOL(dmu_bonus_hold); EXPORT_SYMBOL(dmu_free_range); -EXPORT_SYMBOL(dmu_read_impl); EXPORT_SYMBOL(dmu_read); EXPORT_SYMBOL(dmu_write_impl); EXPORT_SYMBOL(dmu_write); diff --git a/module/zfs/include/sys/dmu.h b/module/zfs/include/sys/dmu.h index 562a9251de..e976fc8b1c 100644 --- a/module/zfs/include/sys/dmu.h +++ b/module/zfs/include/sys/dmu.h @@ -156,10 +156,8 @@ void zfs_znode_byteswap(void *buf, size_t size); * The maximum number of bytes that can be accessed as part of one * operation, including metadata. */ -#define DMU_MAX_ACCESS (10<<20) /* 10MB */ -#define DMU_MAX_DELETEBLKCNT (20480) /* ~5MB of indirect blocks */ -#define DMU_WRITE_ZEROCOPY 0x0001 -#define DMU_READ_ZEROCOPY 0x0002 +#define DMU_MAX_ACCESS (10<<20) /* 10MB */ +#define DMU_MAX_DELETEBLKCNT (20480) /* ~5MB of indirect blocks */ #define DMU_USERUSED_OBJECT (-1ULL) #define DMU_GROUPUSED_OBJECT (-2ULL) @@ -481,6 +479,8 @@ int dmu_free_object(objset_t *os, uint64_t object); */ #define DMU_READ_PREFETCH 0 /* prefetch */ #define DMU_READ_NO_PREFETCH 1 /* don't prefetch */ +#define DMU_READ_ZEROCOPY 2 /* zerocopy on read (test) */ +#define DMU_WRITE_ZEROCOPY 4 /* zerocopy on write (test) */ int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, void *buf, uint32_t flags); void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, 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} | \