diff --git a/module/bdev/malloc/bdev_malloc.c b/module/bdev/malloc/bdev_malloc.c index ee45a3f13..7da754ddc 100644 --- a/module/bdev/malloc/bdev_malloc.c +++ b/module/bdev/malloc/bdev_malloc.c @@ -534,13 +534,32 @@ bdev_malloc_get_memory_domains(void *ctx, struct spdk_memory_domain **domains, i return num_domains; } +static bool +bdev_malloc_accel_sequence_supported(void *ctx, enum spdk_bdev_io_type type) +{ + struct malloc_disk *malloc_disk = ctx; + + if (malloc_disk->disk.dif_type != SPDK_DIF_DISABLE) { + return false; + } + + switch (type) { + case SPDK_BDEV_IO_TYPE_READ: + case SPDK_BDEV_IO_TYPE_WRITE: + return true; + default: + return false; + } +} + static const struct spdk_bdev_fn_table malloc_fn_table = { - .destruct = bdev_malloc_destruct, - .submit_request = bdev_malloc_submit_request, - .io_type_supported = bdev_malloc_io_type_supported, - .get_io_channel = bdev_malloc_get_io_channel, - .write_config_json = bdev_malloc_write_json_config, - .get_memory_domains = bdev_malloc_get_memory_domains, + .destruct = bdev_malloc_destruct, + .submit_request = bdev_malloc_submit_request, + .io_type_supported = bdev_malloc_io_type_supported, + .get_io_channel = bdev_malloc_get_io_channel, + .write_config_json = bdev_malloc_write_json_config, + .get_memory_domains = bdev_malloc_get_memory_domains, + .accel_sequence_supported = bdev_malloc_accel_sequence_supported, }; static int diff --git a/test/bdev/chaining.sh b/test/bdev/chaining.sh index 4fe02ff8a..990faf1cf 100755 --- a/test/bdev/chaining.sh +++ b/test/bdev/chaining.sh @@ -79,38 +79,39 @@ update_stats # Write a single 64K request and check the stats dd if=/dev/urandom of="$input" bs=1K count=64 spdk_dd --if "$input" --ob Nvme0n1 --bs $((64 * 1024)) --count 1 -(($(get_stat sequence_executed) == stats[sequence_executed] + 2)) +(($(get_stat sequence_executed) == stats[sequence_executed] + 1)) (($(get_stat executed encrypt) == stats[encrypt_executed] + 2)) (($(get_stat executed decrypt) == stats[decrypt_executed])) -# There's still one copy performed by the malloc bdev -(($(get_stat executed copy) == stats[copy_executed] + 1)) +# No copies should be done - the copy from the malloc should translate to changing encrypt's +# destination buffer +(($(get_stat executed copy) == stats[copy_executed])) update_stats # Now read that 64K, verify the stats and check that it matches what was written spdk_dd --of "$output" --ib Nvme0n1 --bs $((64 * 1024)) --count 1 -(($(get_stat sequence_executed) == stats[sequence_executed] + 2)) +(($(get_stat sequence_executed) == stats[sequence_executed] + 1)) (($(get_stat executed encrypt) == stats[encrypt_executed])) (($(get_stat executed decrypt) == stats[decrypt_executed] + 2)) -(($(get_stat executed copy) == stats[copy_executed] + 1)) +(($(get_stat executed copy) == stats[copy_executed])) cmp "$input" "$output" spdk_dd --if /dev/zero --ob Nvme0n1 --bs $((64 * 1024)) --count 1 update_stats # Now do the same using 4K requests spdk_dd --if "$input" --ob Nvme0n1 --bs 4096 --count 16 -(($(get_stat sequence_executed) == stats[sequence_executed] + 32)) +(($(get_stat sequence_executed) == stats[sequence_executed] + 16)) (($(get_stat executed encrypt) == stats[encrypt_executed] + 32)) (($(get_stat executed decrypt) == stats[decrypt_executed])) -(($(get_stat executed copy) == stats[copy_executed] + 16)) +(($(get_stat executed copy) == stats[copy_executed])) update_stats # Check the reads : > "$output" spdk_dd --of "$output" --ib Nvme0n1 --bs 4096 --count 16 -(($(get_stat sequence_executed) == stats[sequence_executed] + 32)) +(($(get_stat sequence_executed) == stats[sequence_executed] + 16)) (($(get_stat executed encrypt) == stats[encrypt_executed])) (($(get_stat executed decrypt) == stats[decrypt_executed] + 32)) -(($(get_stat executed copy) == stats[copy_executed] + 16)) +(($(get_stat executed copy) == stats[copy_executed])) cmp "$input" "$output" trap - SIGINT SIGTERM EXIT