]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
maple_tree: use mas_store_gfp() in mtree_store_range()
authorSidhartha Kumar <sidhartha.kumar@oracle.com>
Wed, 14 Aug 2024 16:19:34 +0000 (12:19 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 2 Sep 2024 03:26:15 +0000 (20:26 -0700)
Refactor mtree_store_range() to use mas_store_gfp() which will abstract
the store, memory allocation, and error handling.

Link: https://lkml.kernel.org/r/20240814161944.55347-8-sidhartha.kumar@oracle.com
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c

index 8ba52ffa778e1f043d3f3eca67797745eb494550..e01e05be6301da166b79d64ef072d0be7ac3f556 100644 (file)
@@ -6476,7 +6476,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);
@@ -6487,17 +6486,9 @@ 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);
        return ret;
 }
 EXPORT_SYMBOL(mtree_store_range);