Page MenuHomeFreeBSD

D18474.id51724.diff
No OneTemporary

D18474.id51724.diff

Index: sys/kern/subr_blist.c
===================================================================
--- sys/kern/subr_blist.c
+++ sys/kern/subr_blist.c
@@ -644,9 +644,9 @@
/*
* BLST_LEAF_ALLOC() - allocate at a leaf in the radix tree (a bitmap).
*
- * This is the core of the allocator and is optimized for the
- * BLIST_BMAP_RADIX block allocation case. Otherwise, execution
- * time is proportional to log2(count) + bitpos time.
+ * This is the core of the allocator. Execution time is proportional
+ * to log(count), plus height of the tree if the allocation crosses a
+ * leaf boundary.
*/
static daddr_t
blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count)
@@ -691,9 +691,19 @@
}
/* Discard any candidates that appear before blk. */
- mask &= (u_daddr_t)-1 << (blk & BLIST_BMAP_MASK);
- if (mask == 0)
- return (SWAPBLK_NONE);
+ if ((blk & BLIST_BMAP_MASK) != 0) {
+ if ((mask & bitrange(0, blk & BLIST_BMAP_MASK)) != 0) {
+ mask ^= mask & bitrange(0, blk & BLIST_BMAP_MASK);
+ if (mask == 0)
+ return (SWAPBLK_NONE);
+ /*
+ * Prevent bighint change if the last block gets
+ * allocated below.
+ */
+ range1 = scan->bm_bighint;
+ }
+ blk &= ~BLIST_BMAP_MASK;
+ }
/*
* The least significant set bit in mask marks the start of the first
@@ -734,7 +744,7 @@
}
/* Clear the allocated bits from this leaf. */
scan->bm_bitmap &= ~mask;
- return ((blk & ~BLIST_BMAP_MASK) + lo);
+ return (blk + lo);
}
/*

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 15, 1:57 PM (6 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40851679
Default Alt Text
D18474.id51724.diff (1 KB)

Event Timeline