From ff906a5b0868a4c66e09a9a867e26dfae57f8a87 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 17 Jul 2024 15:23:04 +0000 Subject: [PATCH] reenable scatterlist offloading --- include/os/linux/kernel/linux/kmap_compat.h | 2 -- module/os/linux/zfs/abd_os.c | 6 ++---- module/zfs/zia.c | 9 +++++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/os/linux/kernel/linux/kmap_compat.h b/include/os/linux/kernel/linux/kmap_compat.h index 90beef2bf89e..4616f9140a50 100644 --- a/include/os/linux/kernel/linux/kmap_compat.h +++ b/include/os/linux/kernel/linux/kmap_compat.h @@ -30,8 +30,6 @@ #include /* 2.6.37 API change */ -#define zfs_kmap_atomic(page) kmap_atomic(page) -#define zfs_kunmap_atomic(addr) kunmap_atomic(addr) #define zfs_kmap(page) kmap(page) #define zfs_kunmap(page) kunmap(page) diff --git a/module/os/linux/zfs/abd_os.c b/module/os/linux/zfs/abd_os.c index 9f1cb5b717da..966c2a6bf16e 100644 --- a/module/os/linux/zfs/abd_os.c +++ b/module/os/linux/zfs/abd_os.c @@ -534,10 +534,8 @@ abd_alloc_zero_scatter(void) #define PAGE_SHIFT (highbit64(PAGESIZE)-1) #endif -#define zfs_kmap_atomic(chunk) ((void *)chunk) -#define zfs_kunmap_atomic(addr) do { (void)(addr); } while (0) #define zfs_kmap(chunk) ((void *)chunk) -#define zfs_kunmap(chunk) ((void *)chunk) +#define zfs_kunmap(addr) do { (void)(addr); } while (0) #define zfs_kmap_local(chunk) ((void *)chunk) #define zfs_kunmap_local(addr) do { (void)(addr); } while (0) #define local_irq_save(flags) do { (void)(flags); } while (0) @@ -1063,7 +1061,7 @@ abd_iter_map(struct abd_iter *aiter) aiter->iter_mapsize = MIN(aiter->iter_sg->length - offset, aiter->iter_abd->abd_size - aiter->iter_pos); - paddr = zfs_kmap_local(sg_page(aiter->iter_sg)); + paddr = zfs_kmap(sg_page(aiter->iter_sg)); } aiter->iter_mapaddr = (char *)paddr + offset; diff --git a/module/zfs/zia.c b/module/zfs/zia.c index 18118f27cc77..f8ed90328f2c 100644 --- a/module/zfs/zia.c +++ b/module/zfs/zia.c @@ -655,6 +655,15 @@ zia_offload_abd_offset(void *provider, abd_t *abd, ret = dpusm->copy.from.generic(&mv, ABD_LINEAR_BUF(abd), size); ret = dpusm_to_ret(ret); + } + else if (abd_is_from_pages(abd) == B_TRUE) { + ret = dpusm->copy.from.scatterlist(&mv, + ABD_SCATTER(abd).abd_sgl, + ABD_SCATTER(abd).abd_nents, + size); + if (ret == 0) { + ret = ZIA_OK; + } } else { ret = abd_iterate_func(abd, offset, size, zia_offload_generic_cb, &mv);