From 5d5fbc7dd54c1269b660ac1c16bc38572c1c28cc Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 2 Aug 2019 11:29:20 -0400 Subject: [PATCH] maple_tree: Add some comments to ma_rev_alloc and ma_alloc Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 07be6c796b08..d32b23ec6dc0 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3142,6 +3142,16 @@ static int mas_fill_gap(struct ma_state *mas, void *entry, unsigned char slot, _ma_insert(mas, entry, slot); return 0; } + +/** Private + * ma_alloc() - Allocate a range. + * + * Give a size, a minimum starting point (mas->index), a maximum (mas->last), + * and a size (size), find the lowest location in the min-max window in the + * tree which this allocation fits and set index to that value. + * + * Returns: 0 on success, -EBUSY otherwise. + */ static inline int ma_alloc(struct ma_state *mas, void *entry, unsigned long size, unsigned long *index) { @@ -3185,6 +3195,15 @@ static inline int ma_alloc(struct ma_state *mas, void *entry, no_gap: return -EBUSY; } +/** Private + * ma_rev_alloc() - Reverse allocate a range. + * + * Give a size, a minimum value (mas->index), a maximum starting point + * (mas->last), and a size (size), find the largest location in the min-max + * window in tree which this allocation fits and set index to that value. + * + * Returns: 0 on success, -EBUSY otherwise. + */ static inline int ma_rev_alloc(struct ma_state *mas, void *entry, unsigned long size, unsigned long *index) { -- 2.50.1