Skip to content

Commit

Permalink
scatterlist handling
Browse files Browse the repository at this point in the history
  • Loading branch information
calccrypto committed Oct 29, 2024
1 parent 4e04468 commit 1d35b72
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions module/zfs/zia.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,38 @@ 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_linear_page(abd) == B_TRUE) ||
(abd_is_gang(abd) == B_TRUE)) {
ret = abd_iterate_func(abd, offset, size,
zia_offload_generic_cb, &mv);

if (ret == 0) {
ret = ZIA_OK;
}
} else {
#if defined(__linux__) && defined(_KERNEL)
if (dpusm->copy.from.scatterlist) {
struct abd_scatter *scatter = &ABD_SCATTER(abd);
mv.offset = scatter->abd_offset;
ret = dpusm->copy.from.scatterlist(&mv,
scatter->abd_sgl, scatter->abd_nents, size);
ret = dpusm_to_ret(ret);
} else {
ret = abd_iterate_func(abd, offset, size,
zia_offload_generic_cb, &mv);

if (ret == 0) {
ret = ZIA_OK;
}
}
#else
ret = abd_iterate_func(abd, offset, size,
zia_offload_generic_cb, &mv);

if (ret == 0) {
ret = ZIA_OK;
}
#endif
}

if (ret == ZIA_OK) {
Expand Down Expand Up @@ -763,13 +788,38 @@ zia_onload_abd_offset(abd_t *abd, size_t offset,
ret = dpusm->copy.to.generic(&mv,
ABD_LINEAR_BUF(abd), size);
ret = dpusm_to_ret(ret);
} else if ((abd_is_linear_page(abd) == B_TRUE) ||
(abd_is_gang(abd) == B_TRUE)) {
ret = abd_iterate_func(abd, offset, size,
zia_onload_generic_cb, &mv);

if (ret == 0) {
ret = ZIA_OK;
}
} else {
#if defined(__linux__) && defined(_KERNEL)
if (dpusm->copy.to.scatterlist) {
struct abd_scatter *scatter = &ABD_SCATTER(abd);
mv.offset = scatter->abd_offset;
ret = dpusm->copy.to.scatterlist(&mv,
scatter->abd_sgl, scatter->abd_nents, size);
ret = dpusm_to_ret(ret);
} else {
ret = abd_iterate_func(abd, offset, size,
zia_onload_generic_cb, &mv);

if (ret == 0) {
ret = ZIA_OK;
}
}
#else
ret = abd_iterate_func(abd, offset, size,
zia_onload_generic_cb, &mv);

if (ret == 0) {
ret = ZIA_OK;
}
#endif
}

if (keep_handle != B_TRUE) {
Expand Down

0 comments on commit 1d35b72

Please sign in to comment.