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

Function geteblk

freebsd/kern/vfs_bio.c:4170–4186  ·  view source on GitHub ↗

* Get an empty, disassociated buffer of given size. The buffer is initially * set to B_INVAL. */

Source from the content-addressed store, hash-verified

4168 * set to B_INVAL.
4169 */
4170struct buf *
4171geteblk(int size, int flags)
4172{
4173 struct buf *bp;
4174 int maxsize;
4175
4176 maxsize = (size + BKVAMASK) & ~BKVAMASK;
4177 while ((bp = getnewbuf(NULL, 0, 0, maxsize, flags)) == NULL) {
4178 if ((flags & GB_NOWAIT_BD) &&
4179 (curthread->td_pflags & TDP_BUFNEED) != 0)
4180 return (NULL);
4181 }
4182 allocbuf(bp, size);
4183 bufspace_release(bufdomain(bp), maxsize);
4184 bp->b_flags |= B_INVAL; /* b_dep cleared by getnewbuf() */
4185 return (bp);
4186}
4187
4188/*
4189 * Truncate the backing store for a non-vmio buffer.

Callers

nothing calls this directly

Calls 4

getnewbufFunction · 0.85
allocbufFunction · 0.85
bufspace_releaseFunction · 0.85
bufdomainFunction · 0.70

Tested by

no test coverage detected