return max_gap;
}
-/*
- * ma_max_gap() - Get the maximum gap in a maple node (non-leaf)
- * @node: The maple node
- * @gaps: The pointer to the gaps
- * @mt: The maple node type
- * @off: Pointer to store the offset location of the gap.
- *
- * Uses the metadata data end to scan backwards across set gaps.
- *
- * Return: The maximum gap value
- */
-static inline unsigned long
-ma_max_gap(struct maple_node *node, unsigned long *gaps, enum maple_type mt,
- unsigned char *off)
-{
- unsigned char offset, i;
- unsigned long max_gap = 0;
-
- i = offset = ma_meta_end(node, mt);
- do {
- if (gaps[i] > max_gap) {
- max_gap = gaps[i];
- offset = i;
- }
- } while (i--);
-
- *off = offset;
- return max_gap;
-}
-
/*
* mas_max_gap() - find the largest gap in a non-leaf node and set the slot.
* @mas: The maple state.
ma_set_meta_gap(pnode, pmt, offset);
} else if (new < meta_gap) {
- new = ma_max_gap(pnode, pgaps, pmt, &meta_offset);
+ unsigned char i;
+
+ /* Get the new maximum gap in the node */
+ i = meta_offset = ma_meta_end(pnode, pmt);
+ new = pgaps[i];
+ while (i--) {
+ if (pgaps[i] > new) {
+ new = pgaps[i];
+ meta_offset = i;
+ }
+ }
ma_set_meta_gap(pnode, pmt, meta_offset);
}