}
 
 /*
- * Remove swap entry from radix tree, free the swap and its page cache.
+ * Remove swap entry from page cache, free the swap and its page cache.
  */
 static int shmem_free_swap(struct address_space *mapping,
                           pgoff_t index, void *radswap)
        void *old;
 
        xa_lock_irq(&mapping->i_pages);
-       old = radix_tree_delete_item(&mapping->i_pages, index, radswap);
+       old = __xa_cmpxchg(&mapping->i_pages, index, radswap, NULL, 0);
        xa_unlock_irq(&mapping->i_pages);
        if (old != radswap)
                return -ENOENT;