From: Sidhartha Kumar Date: Wed, 1 Nov 2023 18:24:39 +0000 (-0400) Subject: maple_tree: use mas_store_gfp() in mtree_store_range() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=31e83e8a694be510a661d773326a4acae6cc99fa;p=users%2Fjedix%2Flinux-maple.git maple_tree: use mas_store_gfp() in mtree_store_range() Refactor mtree_store_range() to use mas_store_gfp() which will abstract the store, memory allocation, and error handling. Signed-off-by: Sidhartha Kumar --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d6d683d4bc545..8270188df718e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6408,7 +6408,6 @@ int mtree_store_range(struct maple_tree *mt, unsigned long index, unsigned long last, void *entry, gfp_t gfp) { MA_STATE(mas, mt, index, last); - MA_WR_STATE(wr_mas, &mas, entry); int ret = 0; trace_ma_write(__func__, &mas, 0, entry); @@ -6419,17 +6418,10 @@ int mtree_store_range(struct maple_tree *mt, unsigned long index, return -EINVAL; mtree_lock(mt); -retry: - mas_wr_store_entry(&wr_mas); - if (mas_nomem(&mas, gfp)) - goto retry; - + ret = mas_store_gfp(&mas, entry, gfp); mtree_unlock(mt); - if (mas_is_err(&mas)) - ret = xa_err(mas.node); - - mas_destroy(&mas); + MT_BUG_ON(mas.tree, mas.store_type == wr_invalid); return ret; } EXPORT_SYMBOL(mtree_store_range);