]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: use mas_store_gfp() in mtree_store_range()
authorSidhartha Kumar <sidhartha.kumar@oracle.com>
Wed, 1 Nov 2023 18:24:39 +0000 (14:24 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Sat, 20 Apr 2024 01:40:09 +0000 (21:40 -0400)
Refactor mtree_store_range() to use mas_store_gfp() which will abstract
the store, memory allocation, and error handling.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
lib/maple_tree.c

index d6d683d4bc545ab6ce7391ef318a655b6a8b7ff0..8270188df718e6b49029417b204309d0247dc455 100644 (file)
@@ -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);