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

Function blst_meta_fill

freebsd/kern/subr_blist.c:1012–1044  ·  view source on GitHub ↗

* BLIST_META_FILL() - allocate specific blocks at a meta node * * This routine allocates the specified range of blocks, * regardless of any existing allocations in the range. The * range must be within the extent of this node. Returns the * number of blocks allocated by the call. */

Source from the content-addressed store, hash-verified

1010 * number of blocks allocated by the call.
1011 */
1012static daddr_t
1013blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, u_daddr_t radix)
1014{
1015 daddr_t blk, endBlk, i, nblks, skip;
1016 int digit;
1017
1018 if (radix == 1)
1019 return (blst_leaf_fill(scan, allocBlk, count));
1020
1021 endBlk = allocBlk + count;
1022 blk = (allocBlk + radix * BLIST_RADIX) & -(radix * BLIST_RADIX);
1023 /*
1024 * blk is first block past the end of the range of this meta node,
1025 * or 0 in case of overflow.
1026 */
1027 if (blk != 0)
1028 endBlk = ummin(endBlk, blk);
1029 skip = radix_to_skip(radix);
1030 blk = allocBlk & -radix;
1031 nblks = 0;
1032 while (blk < endBlk) {
1033 digit = (blk / radix) & BLIST_MASK;
1034 i = 1 + digit * skip;
1035 blk += radix;
1036 count = ummin(blk, endBlk) - allocBlk;
1037 nblks += blst_meta_fill(&scan[i], allocBlk, count,
1038 radix / BLIST_RADIX);
1039 if (scan[i].bm_bitmap == 0)
1040 scan->bm_bitmap &= ~((u_daddr_t)1 << digit);
1041 allocBlk = blk;
1042 }
1043 return (nblks);
1044}
1045
1046#ifdef BLIST_DEBUG
1047

Callers 1

blist_fillFunction · 0.85

Calls 3

blst_leaf_fillFunction · 0.85
umminFunction · 0.85
radix_to_skipFunction · 0.85

Tested by

no test coverage detected