* Allocate a linear ABD structure for buf. You must free this with abd_put() * since the resulting ABD doesn't own its own buffer. */
| 596 | * since the resulting ABD doesn't own its own buffer. |
| 597 | */ |
| 598 | abd_t * |
| 599 | abd_get_from_buf(void *buf, size_t size) |
| 600 | { |
| 601 | abd_t *abd = abd_alloc_struct(0); |
| 602 | |
| 603 | VERIFY3U(size, <=, SPA_MAXBLOCKSIZE); |
| 604 | |
| 605 | /* |
| 606 | * Even if this buf is filesystem metadata, we only track that if we |
| 607 | * own the underlying data buffer, which is not true in this case. |
| 608 | * Therefore, we don't ever use ABD_FLAG_META here. |
| 609 | */ |
| 610 | abd->abd_flags = ABD_FLAG_LINEAR; |
| 611 | abd->abd_size = size; |
| 612 | abd->abd_parent = NULL; |
| 613 | zfs_refcount_create(&abd->abd_children); |
| 614 | |
| 615 | ABD_LINEAR_BUF(abd) = buf; |
| 616 | |
| 617 | return (abd); |
| 618 | } |
| 619 | |
| 620 | /* |
| 621 | * Get the raw buffer associated with a linear ABD. |
no test coverage detected