MCPcopy Create free account
hub / github.com/F-Stack/f-stack / abd_alloc_linear

Function abd_alloc_linear

freebsd/contrib/openzfs/module/zfs/abd.c:248–272  ·  view source on GitHub ↗

* Allocate an ABD that must be linear, along with its own underlying data * buffer. Only use this when it would be very annoying to write your ABD * consumer with a scattered ABD. */

Source from the content-addressed store, hash-verified

246 * consumer with a scattered ABD.
247 */
248abd_t *
249abd_alloc_linear(size_t size, boolean_t is_metadata)
250{
251 abd_t *abd = abd_alloc_struct(0);
252
253 VERIFY3U(size, <=, SPA_MAXBLOCKSIZE);
254
255 abd->abd_flags = ABD_FLAG_LINEAR | ABD_FLAG_OWNER;
256 if (is_metadata) {
257 abd->abd_flags |= ABD_FLAG_META;
258 }
259 abd->abd_size = size;
260 abd->abd_parent = NULL;
261 zfs_refcount_create(&abd->abd_children);
262
263 if (is_metadata) {
264 ABD_LINEAR_BUF(abd) = zio_buf_alloc(size);
265 } else {
266 ABD_LINEAR_BUF(abd) = zio_data_buf_alloc(size);
267 }
268
269 abd_update_linear_stats(abd, ABDSTAT_INCR);
270
271 return (abd);
272}
273
274static void
275abd_free_linear(abd_t *abd)

Callers 15

abd_alloc_for_ioFunction · 0.85
vdev_raidz_map_allocFunction · 0.85
benchmark_raidzFunction · 0.85
abd_allocFunction · 0.85
abd_alloc_sametypeFunction · 0.85
flush_write_batch_implFunction · 0.85
receive_read_recordFunction · 0.85
issue_data_readFunction · 0.85

Calls 5

zfs_refcount_createFunction · 0.85
zio_buf_allocFunction · 0.85
zio_data_buf_allocFunction · 0.85
abd_alloc_structFunction · 0.50
abd_update_linear_statsFunction · 0.50

Tested by 1