return new_end;
}
-/*
- * mas_wr_rebalance_calc() - Try to calculate a rebalance that will work
- * @data_size: The total data to be written
- * @mt: The maple node types splitting the data
- *
- * Returns: 0 on failure, the split location otherwise.
- */
-static inline
-unsigned char mas_wr_rebalance_calc(unsigned char data_size,
- enum maple_type mt)
-{
- unsigned char space, split;
- unsigned char node_size, node_min;
-
- node_min = mt_min_slots[mt];
- node_size = mt_slots[mt];
-
- space = node_size * 2 - 2;
- /* Greedy rebalance */
- if (space <= data_size)
- return 0;
-
- split = node_size - 2;
- if (data_size - split >= node_size)
- return 0;
-
- if (data_size - split <= node_min)
- split = (data_size + 2) / 2;
-
- return split;
-}
-
static inline
void mas_wr_ascend_init(struct ma_state *mas, struct ma_node_info *ni)
{
} while (src->offset <= src->end);
}
+/*
+ * mas_wr_rebalance_calc() - Try to calculate a rebalance that will work
+ * @data_size: The total data to be written
+ * @mt: The maple node types splitting the data
+ *
+ * Returns: 0 on failure, the split location otherwise.
+ */
+static inline
+unsigned char mas_wr_rebalance_calc(unsigned char data_size,
+ enum maple_type mt)
+{
+ unsigned char space, split;
+ unsigned char node_size, node_min;
+
+ node_min = mt_min_slots[mt];
+ node_size = mt_slots[mt];
+
+ space = node_size * 2 - 2;
+ /* Greedy rebalance */
+ if (space <= data_size)
+ return 0;
+
+ split = node_size - 2;
+ if (data_size - split >= node_size)
+ return 0;
+
+ if (data_size - split <= node_min)
+ split = (data_size + 2) / 2;
+
+ return split;
+}
static inline
bool can_rebalance_right(struct ma_state *tmp_mas, struct ma_node_info *parent,