]> www.infradead.org Git - users/willy/xarray.git/commitdiff
drm/i915: Convert cachelines radix tree to XArray
authorMatthew Wilcox <willy@infradead.org>
Thu, 14 Mar 2019 02:55:56 +0000 (22:55 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 8 Aug 2019 03:39:34 +0000 (23:39 -0400)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
drivers/gpu/drm/i915/selftests/i915_timeline.c

index 76d3977f1d4b32e74e027079b1749fd7bf88ed84..ff721277c333b50b6e7939920533bad21ee177a0 100644 (file)
@@ -34,7 +34,7 @@ static unsigned long hwsp_cacheline(struct i915_timeline *tl)
 
 struct mock_hwsp_freelist {
        struct drm_i915_private *i915;
-       struct radix_tree_root cachelines;
+       struct xarray cachelines;
        struct i915_timeline **history;
        unsigned long count, max;
        struct rnd_state prng;
@@ -50,7 +50,7 @@ static void __mock_hwsp_record(struct mock_hwsp_freelist *state,
 {
        tl = xchg(&state->history[idx], tl);
        if (tl) {
-               radix_tree_delete(&state->cachelines, hwsp_cacheline(tl));
+               xa_erase(&state->cachelines, hwsp_cacheline(tl));
                i915_timeline_put(tl);
        }
 }
@@ -71,9 +71,9 @@ static int __mock_hwsp_timeline(struct mock_hwsp_freelist *state,
                        return PTR_ERR(tl);
 
                cacheline = hwsp_cacheline(tl);
-               err = radix_tree_insert(&state->cachelines, cacheline, tl);
+               err = xa_insert(&state->cachelines, cacheline, tl, GFP_KERNEL);
                if (err) {
-                       if (err == -EEXIST) {
+                       if (err == -EBUSY) {
                                pr_err("HWSP cacheline %lu already used; duplicate allocation!\n",
                                       cacheline);
                        }
@@ -115,7 +115,7 @@ static int mock_hwsp_freelist(void *arg)
        unsigned int na;
        int err = 0;
 
-       INIT_RADIX_TREE(&state.cachelines, GFP_KERNEL);
+       xa_init(&state.cachelines);
        state.prng = I915_RND_STATE_INITIALIZER(i915_selftest.random_seed);
 
        state.i915 = mock_gem_device();