Matthew Wilcox [Sun, 30 Sep 2018 04:12:02 +0000 (00:12 -0400)]
xen: Convert pvcalls-back to XArray
Pull the XArray out from under the semaphore as it is serialised by its
own spinlock. In pvcalls_back_release(), it's more efficient to erase
the element than to load it then erase it if it was present.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 26 Sep 2018 15:02:10 +0000 (11:02 -0400)]
sh: intc: Convert to XArray
The radix tree was being protected by a raw spinlock. I believe that
was not necessary, and the new internal regular spinlock will be
adequate for this array.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 26 Sep 2018 12:26:00 +0000 (08:26 -0400)]
irqdomain: Convert to XArray
This is a pretty straightforward conversion; mostly just removing
now-redundant locking. The only thing of note is just how much simpler
irq_domain_fix_revmap() becomes.
Signed-off-by: Matthew Wilcox <willy@infradead.org> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Matthew Wilcox [Tue, 25 Sep 2018 22:05:32 +0000 (18:05 -0400)]
vmalloc: Convert to XArray
The radix tree of vmap blocks is simpler to express as an XArray.
Saves a couple of hundred bytes of text and eliminates a user of the
radix tree preload API.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Tue, 25 Sep 2018 22:06:27 +0000 (18:06 -0400)]
mm: Convert cgroup writeback to XArray
We're still under the protection of the cgwb_lock as well as the xa_lock.
It could probably be removed or reduced in scope in a few places, but
I'll leave that to someone who understands this code better than I do.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Fri, 11 Jan 2019 20:05:50 +0000 (15:05 -0500)]
inotify: Convert IDR of marks to XArray
The IDR was being used in a somewhat complicated way where we'd look up
a mark to be deleted in the IDR, then pass it into the fsnotify machinery
which would pass the mark back to us, then we'd look it up again in order
to delete it. Just deleting it from the XArray in the first place lets
us simplify the reference counting tremendously.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Sat, 3 Nov 2018 16:14:05 +0000 (12:14 -0400)]
nfs: Convert cb_ident_idr to XArray
Rename it to cb_ids. The XArray does not need a 'destroy' function to
be called, so remove all trace of nfs_cleanup_cb_ident_idr(). Pass the
nfs_net parameter to nfs_cb_id_remove_locked() so it doesn't have to
look that up again.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 17 Oct 2018 19:52:06 +0000 (15:52 -0400)]
f2fs: Rewrite the free NID cache
There's no need to allocate a free_nid data structure; we only need to
store three states per ID, which we can do much more efficiently with
the XArray.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 26 Sep 2018 12:23:14 +0000 (08:23 -0400)]
usb: Convert xhci-mem to XArray
The XArray API is a better fit for xhci than the radix tree API was,
to the point where we can remove the wrappers around the radix tree
and just call the XArray APIs directly.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Sun, 10 Feb 2019 17:12:38 +0000 (12:12 -0500)]
cxlflash: Convert context idr to an IDA
This driver does not look up the pointers it stores, so it can use the
IDA instead of the IDR or XArray, consuming less memory. Also actually
store the max instead of one greater than the max in the variable
called pasid_max.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 24 Oct 2018 19:33:54 +0000 (15:33 -0400)]
drm/i915: Convert get_page to XArray
This initially seemed like an ideal use-case for the store_range
functionality, but there's no easy way to determine where we were
relative to the base of the entry. So this is a straightforward
conversion which doesn't even touch the locking.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Thu, 14 Feb 2019 21:40:05 +0000 (16:40 -0500)]
drm: Convert object_idr to XArray
- Rename it to 'objects'
- Also convert leases IDR to XArray as the two are occasionally used by
the same code (see drm_mode_get_lease_ioctl())
- Refactor drm_mode_create_lease_ioctl() to create the new drm_master
early to avoid creating an XArray on the stack and reparenting it
afterwards.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Tue, 12 Feb 2019 21:33:38 +0000 (16:33 -0500)]
drm: Convert object_name_idr to XArray
It's not possible to replace object_name_lock as it protects more
code than should be reasonably be run under a spinlock, so the xa_lock
is nested under the object_name_lock.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox (Oracle) [Wed, 7 Aug 2019 20:05:01 +0000 (16:05 -0400)]
IB/core: Use xa_insert insted of xa_reserve
It's more efficient to call xa_insert() than xa_load() followed by
xa_reserve(). Also use xa_erase() as I've decided to remove the
xa_reserve()/release() API.
Matthew Wilcox [Wed, 17 Oct 2018 19:34:20 +0000 (15:34 -0400)]
f2fs: Convert ino_root to XArray
I did a fairly major rewrite of __add_ino_entry(); please check carefully.
Also, we can remove ino_list unless it's important to write out orphan
inodes in the order they were orphaned. It may also make more sense to
combine the array of inode_management structures into a single XArray
with tags, but that would be a job for someone who understands this
filesystem better than I do.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 17 Oct 2018 19:09:12 +0000 (15:09 -0400)]
btrfs: Convert name_cache to XArray
This is a very straightforward conversion. The handling of collisions
in the namecache could be better handled with an hlist, but that's a
patch for another day.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 17 Oct 2018 19:08:30 +0000 (15:08 -0400)]
btrfs: Convert buffer_radix to XArray
Eliminate the buffer_lock as the internal xa_lock provides all the
necessary protection. We can remove the radix_tree_preload calls, but
I can't find a good way to use the 'exists' result from xa_cmpxchg().
We could resort to the advanced API to improve this, but it's a really
unlikely case (nothing in the xarray when we first look; something there
when we try to add the newly-allocated extent buffer), so I think it's
not worth optimising for.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 17 Oct 2018 19:01:57 +0000 (15:01 -0400)]
btrfs: Convert reada_zones to XArray
The use of the reada_lock means we have to use the xa_reserve() API.
If we can avoid using reada_lock to protect this xarray, we can drop
the use of that function.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 17 Oct 2018 19:00:24 +0000 (15:00 -0400)]
btrfs: Convert fs_roots_radix to XArray
Most of the gang lookups being done can be expressed just as efficiently
and somewhat more naturally as xa_for_each() loops. I opted not to
change the one in btrfs_cleanup_fs_roots() as it's using SRCU which is
subtle and quick to anger.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 26 Sep 2018 12:01:13 +0000 (08:01 -0400)]
xfs: Convert xfs dquot to XArray
The dquot arrays are protected by a mutex as well as the internal
spinlock. That makes it hard to take advantage of the features of the
XArray and this patch ends up being a straightforward replacement of
the radix tree API with the XArray API.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Tue, 25 Sep 2018 23:05:09 +0000 (19:05 -0400)]
xfs: Convert pag_ici_root to XArray
Rename pag_ici_root to pag_ici_xa and use XArray APIs instead of radix
tree APIs. Shorter code, typechecking on tag numbers, better error
checking in xfs_reclaim_inode(), and eliminates a call to
radix_tree_preload().
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Thu, 18 Oct 2018 19:18:13 +0000 (15:18 -0400)]
null_blk: Convert to XArray
By changing the locking we could remove the slightly awkward dance in
null_insert_page(), but I'll leave that for someone who's more familiar
with the driver.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Wed, 17 Oct 2018 18:42:26 +0000 (14:42 -0400)]
blk-ioc: Convert to XArray
Use xa_insert_irq() to do the allocation before grabbing the other
locks. This user appears to be able to race, so use xa_cmpxchg() to
handle the race effectively.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Matthew Wilcox [Mon, 18 Mar 2019 15:27:07 +0000 (11:27 -0400)]
blk-cgroup: Remove blkg_list hlist
We can iterate over all blkcgs using the XArray iterator instead of
maintaining a separate hlist. This removes a nasty locking inversion
in blkcg_destroy_blkgs().
Signed-off-by: Matthew Wilcox <willy@infradead.org>