diff options
author | David Quigley <[email protected]> | 2017-02-01 10:34:22 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-02-01 09:34:22 -0800 |
commit | 2fe36b0bfb80a4955f6ff42b2448f432223f6011 (patch) | |
tree | 010c7c2eb7b90565a10543f1602b5bee1f4699d7 /module/zfs/zio_checksum.c | |
parent | 544b8053dbb03de69950c232d1f1970bc36535b6 (diff) |
Use fletcher_4 routines natively with `abd_iterate_func()`
This patch adds the necessary infrastructure for ABD to make use
of the vectorized fletcher 4 routines.
- export ABD compatible interface from fletcher_4
- add ABD fletcher_4 tests for data and metadata ABD types.
Reviewed-by: Brian Behlendorf <[email protected]>
Original-patch-by: Gvozden Neskovic <[email protected]>
Signed-off-by: David Quigley <[email protected]>
Closes #5589
Diffstat (limited to 'module/zfs/zio_checksum.c')
-rw-r--r-- | module/zfs/zio_checksum.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/module/zfs/zio_checksum.c b/module/zfs/zio_checksum.c index e65b3f061..703d9a5e5 100644 --- a/module/zfs/zio_checksum.c +++ b/module/zfs/zio_checksum.c @@ -119,14 +119,29 @@ abd_fletcher_2_byteswap(abd_t *abd, uint64_t size, fletcher_2_incremental_byteswap, zcp); } +static inline void +abd_fletcher_4_impl(abd_t *abd, uint64_t size, zio_abd_checksum_data_t *acdp) +{ + fletcher_4_abd_ops.acf_init(acdp); + abd_iterate_func(abd, 0, size, fletcher_4_abd_ops.acf_iter, acdp); + fletcher_4_abd_ops.acf_fini(acdp); +} + /*ARGSUSED*/ void abd_fletcher_4_native(abd_t *abd, uint64_t size, const void *ctx_template, zio_cksum_t *zcp) { - fletcher_init(zcp); - (void) abd_iterate_func(abd, 0, size, - fletcher_4_incremental_native, zcp); + fletcher_4_ctx_t ctx; + + zio_abd_checksum_data_t acd = { + .acd_byteorder = ZIO_CHECKSUM_NATIVE, + .acd_zcp = zcp, + .acd_ctx = &ctx + }; + + abd_fletcher_4_impl(abd, size, &acd); + } /*ARGSUSED*/ @@ -134,9 +149,15 @@ void abd_fletcher_4_byteswap(abd_t *abd, uint64_t size, const void *ctx_template, zio_cksum_t *zcp) { - fletcher_init(zcp); - (void) abd_iterate_func(abd, 0, size, - fletcher_4_incremental_byteswap, zcp); + fletcher_4_ctx_t ctx; + + zio_abd_checksum_data_t acd = { + .acd_byteorder = ZIO_CHECKSUM_BYTESWAP, + .acd_zcp = zcp, + .acd_ctx = &ctx + }; + + abd_fletcher_4_impl(abd, size, &acd); } zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { |