svn commit: r347462 - head/sys/kern
Doug Moore
dougm at FreeBSD.org
Fri May 10 18:25:07 UTC 2019
Author: dougm
Date: Fri May 10 18:25:06 2019
New Revision: 347462
URL: https://svnweb.freebsd.org/changeset/base/347462
Log:
blist_next_leaf_alloc walks over all the meta-nodes between one leaf
and the next one, and if blocks are allocated from the next leaf, it
walks back toward where it started, as long as there are interleaving
meta-nodes to be updated on account of the last free blocks under
those meta-nodes being allocated. Only if the walk goes all the way
back to the starting point must we calculate the position of the
meta-node that is the least-comment parent of one leaf and the next,
and update a bit in that meta-node to indicate the allocation of its
last free block.
There's no need to start calculating the position of that least-common
parent until the walk back reaches the original starting point, and
there's no need for a calculation that updates 'radius' to tell us
when we've walked back to the beginning, since comparing scan to next
suffices for that.
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20229
Modified:
head/sys/kern/subr_blist.c
Modified: head/sys/kern/subr_blist.c
==============================================================================
--- head/sys/kern/subr_blist.c Fri May 10 18:22:40 2019 (r347461)
+++ head/sys/kern/subr_blist.c Fri May 10 18:25:06 2019 (r347462)
@@ -607,7 +607,6 @@ static int
blst_next_leaf_alloc(blmeta_t *scan, daddr_t blk, int count)
{
blmeta_t *next;
- daddr_t skip;
u_daddr_t radix;
int digit;
@@ -632,13 +631,14 @@ blst_next_leaf_alloc(blmeta_t *scan, daddr_t blk, int
/*
* Update bitmaps of next-ancestors, up to least common ancestor.
*/
- skip = radix_to_skip(radix);
- while (radix != BLIST_BMAP_RADIX && next->bm_bitmap == 0) {
- (--next)->bm_bitmap ^= 1;
- radix /= BLIST_META_RADIX;
- }
- if (next->bm_bitmap == 0)
- scan[-digit * skip].bm_bitmap ^= (u_daddr_t)1 << digit;
+ while (next->bm_bitmap == 0) {
+ if (--next == scan) {
+ scan[-digit * radix_to_skip(radix)].bm_bitmap ^=
+ (u_daddr_t)1 << digit;
+ break;
+ }
+ next->bm_bitmap ^= 1;
+ }
return (0);
}
More information about the svn-src-all
mailing list