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

Function abd_alloc

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

* Allocate an ABD, along with its own underlying data buffers. Use this if you * don't care whether the ABD is linear or not. */

Source from the content-addressed store, hash-verified

165 * don't care whether the ABD is linear or not.
166 */
167abd_t *
168abd_alloc(size_t size, boolean_t is_metadata)
169{
170 if (!zfs_abd_scatter_enabled || abd_size_alloc_linear(size))
171 return (abd_alloc_linear(size, is_metadata));
172
173 VERIFY3U(size, <=, SPA_MAXBLOCKSIZE);
174
175 abd_t *abd = abd_alloc_struct(size);
176 abd->abd_flags = ABD_FLAG_OWNER;
177 abd->abd_u.abd_scatter.abd_offset = 0;
178 abd_alloc_chunks(abd, size);
179
180 if (is_metadata) {
181 abd->abd_flags |= ABD_FLAG_META;
182 }
183 abd->abd_size = size;
184 abd->abd_parent = NULL;
185 zfs_refcount_create(&abd->abd_children);
186
187 abd_update_scatter_stats(abd, ABDSTAT_INCR);
188
189 return (abd);
190}
191
192static void
193abd_free_scatter(abd_t *abd)

Callers 13

abd_alloc_for_ioFunction · 0.85
vdev_rebuild_rangeFunction · 0.85
abd_alloc_sametypeFunction · 0.85
arc_get_data_abdFunction · 0.85
vdev_draid_cksum_finishFunction · 0.85
zio_doneFunction · 0.85
zil_prt_rec_writeFunction · 0.85
zdb_blkptr_cbFunction · 0.85

Calls 6

abd_alloc_linearFunction · 0.85
zfs_refcount_createFunction · 0.85
abd_size_alloc_linearFunction · 0.50
abd_alloc_structFunction · 0.50
abd_alloc_chunksFunction · 0.50
abd_update_scatter_statsFunction · 0.50

Tested by 1

ztest_fletcherFunction · 0.68