]> www.infradead.org Git - users/willy/xarray.git/log
users/willy/xarray.git
5 years agoxen: Convert pvcalls-back to XArray
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>
5 years agosh: intc: Convert to XArray
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>
5 years agoirqdomain: Convert to XArray
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>
5 years agovmalloc: Convert to XArray
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>
5 years agomm: Convert cgroup writeback to XArray
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>
5 years agopid: Convert to XArray
Matthew Wilcox [Wed, 14 Nov 2018 13:52:14 +0000 (08:52 -0500)]
pid: Convert to XArray

The new semantics for xa_alloc_cyclic match the PID allocator much
better than the way the IDR cyclic allocation had evolved.

5 years agoaio: Convert ioctx_table to XArray
Matthew Wilcox [Wed, 14 Nov 2018 17:12:50 +0000 (12:12 -0500)]
aio: Convert ioctx_table to XArray

This custom resizing table can use an XArray and save a lot of lines of
code.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoMerge branches 'xa-block', 'xa-drm', 'xa-fs', 'xa-infiniband', 'xa-net', 'xa-scsi...
Matthew Wilcox (Oracle) [Thu, 8 Aug 2019 18:00:23 +0000 (14:00 -0400)]
Merge branches 'xa-block', 'xa-drm', 'xa-fs', 'xa-infiniband', 'xa-net', 'xa-scsi' and 'xa-usb' into xa-merge

5 years agoocfs2: Convert nn_status_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 13:38:17 +0000 (08:38 -0500)]
ocfs2: Convert nn_status_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodlm: Convert recovery_idr to XArray
Matthew Wilcox [Tue, 12 Feb 2019 18:46:11 +0000 (13:46 -0500)]
dlm: Convert recovery_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodlm: Convert ls_lkbidr to XArray
Matthew Wilcox [Tue, 12 Feb 2019 16:28:15 +0000 (11:28 -0500)]
dlm: Convert ls_lkbidr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoinotify: Convert IDR of marks to XArray
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>
5 years agonfsd: Convert s2s_cp_stateids to XArray
Matthew Wilcox [Wed, 9 Jan 2019 20:34:09 +0000 (15:34 -0500)]
nfsd: Convert s2s_cp_stateids to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agonfsd: Convert cl_stateids to XArray
Matthew Wilcox [Wed, 9 Jan 2019 18:47:19 +0000 (13:47 -0500)]
nfsd: Convert cl_stateids to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agonfs: Convert cb_ident_idr to XArray
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>
5 years agokernfs: Convert to XArray
Matthew Wilcox [Wed, 9 Jan 2019 18:00:22 +0000 (13:00 -0500)]
kernfs: Convert to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agofscache: Convert to XArray
Matthew Wilcox [Wed, 26 Sep 2018 14:21:30 +0000 (10:21 -0400)]
fscache: Convert to XArray

Use the advanced API for this conversion for efficiency.
Removes another user of radix_tree_preload().

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agof2fs: Convert nat_root to XArray
Matthew Wilcox [Thu, 18 Oct 2018 19:06:36 +0000 (15:06 -0400)]
f2fs: Convert nat_root to XArray

Leave the locking unchanged, although I suspect nat_tree_lock
could probably now be removed or at least narrowed in scope.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agof2fs: Convert nat_set_root to XArray
Matthew Wilcox [Thu, 18 Oct 2018 18:18:11 +0000 (14:18 -0400)]
f2fs: Convert nat_set_root to XArray

Rename it to nat_set_cache.  The locking is unadjusted here; this
xa_lock nests under the nat_tree_lock mutex.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agof2fs: Rewrite the free NID cache
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>
5 years agof2fs: Convert gclist.iroot to XArray
Matthew Wilcox [Wed, 17 Oct 2018 19:36:23 +0000 (15:36 -0400)]
f2fs: Convert gclist.iroot to XArray

Straightforward conversion.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agousb/serial: Convert serial_minors to XArray
Matthew Wilcox [Mon, 18 Feb 2019 23:52:49 +0000 (18:52 -0500)]
usb/serial: Convert serial_minors to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agousb: Convert usb_bus_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 23:44:50 +0000 (18:44 -0500)]
usb: Convert usb_bus_idr to XArray

Remove the usb_bus_idr_lock as it doesn't appear to be protecting
anything more than the built-in XArray lock does.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agocdc-acm: Convert acm_minors to XArray
Matthew Wilcox [Mon, 18 Feb 2019 23:08:09 +0000 (18:08 -0500)]
cdc-acm: Convert acm_minors to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agousb: Convert xhci-mem to XArray
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>
5 years agocxlflash: Convert context idr to an IDA
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>
5 years agobfad: Convert bfad_im_port_index to IDA
Matthew Wilcox [Sun, 10 Feb 2019 12:01:59 +0000 (07:01 -0500)]
bfad: Convert bfad_im_port_index to IDA

Also remove the unused bfad_list.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agolpfc: Convert hba_index to IDA
Matthew Wilcox [Sun, 10 Feb 2019 11:21:25 +0000 (06:21 -0500)]
lpfc: Convert hba_index to IDA

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoch: Convert ch_index_idr to XArray
Matthew Wilcox [Sun, 10 Feb 2019 11:33:09 +0000 (06:33 -0500)]
ch: Convert ch_index_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agosg: Convert sg_index_idr to XArray
Matthew Wilcox [Sun, 10 Feb 2019 16:36:49 +0000 (11:36 -0500)]
sg: Convert sg_index_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agost: Convert to XArray
Matthew Wilcox [Fri, 26 Oct 2018 13:18:32 +0000 (09:18 -0400)]
st: Convert to XArray

Replace the st_index_idr with an XArray.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: idr_init_base todo item is done
Matthew Wilcox [Tue, 19 Feb 2019 01:30:51 +0000 (20:30 -0500)]
drm: idr_init_base todo item is done

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/vmwgfx: Convert res_idr to XArray
Matthew Wilcox [Fri, 15 Feb 2019 04:11:53 +0000 (23:11 -0500)]
drm/vmwgfx: Convert res_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/vmwgfx: Convert base IDR to XArray
Matthew Wilcox [Thu, 14 Feb 2019 21:59:32 +0000 (16:59 -0500)]
drm/vmwgfx: Convert base IDR to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/via: Convert object_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 18:31:38 +0000 (13:31 -0500)]
drm/via: Convert object_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/vgem: Convert fence_idr to XArray
Matthew Wilcox [Thu, 14 Feb 2019 17:59:43 +0000 (12:59 -0500)]
drm/vgem: Convert fence_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/sis: Convert object_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 18:26:30 +0000 (13:26 -0500)]
drm/sis: Convert object_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/vc4: Convert perfmon IDR to XArray
Matthew Wilcox [Fri, 15 Feb 2019 19:13:49 +0000 (14:13 -0500)]
drm/vc4: Convert perfmon IDR to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/tegra: Convert contexts IDR to XArray
Matthew Wilcox [Fri, 15 Feb 2019 19:08:31 +0000 (14:08 -0500)]
drm/tegra: Convert contexts IDR to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/qxl: Convert surf_id_idr to XArray
Matthew Wilcox [Thu, 14 Feb 2019 17:52:19 +0000 (12:52 -0500)]
drm/qxl: Convert surf_id_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/qxl: Convert release_idr to XArray
Matthew Wilcox [Thu, 14 Feb 2019 21:55:20 +0000 (16:55 -0500)]
drm/qxl: Convert release_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert cachelines radix tree to XArray
Matthew Wilcox [Thu, 14 Mar 2019 02:55:56 +0000 (22:55 -0400)]
drm/i915: Convert cachelines radix tree to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert vgpus_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 18:22:36 +0000 (13:22 -0500)]
drm/i915: Convert vgpus_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert metrics_idr to XArray
Matthew Wilcox [Fri, 15 Feb 2019 19:03:55 +0000 (14:03 -0500)]
drm/i915: Convert metrics_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert vm_idr to XArray
Matthew Wilcox (Oracle) [Wed, 15 May 2019 17:35:38 +0000 (13:35 -0400)]
drm/i915: Convert vm_idr to XArray

Rename vm_idr to vms and remove the mutex protecting it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agodrm/i915: Convert context_idr to XArray
Matthew Wilcox [Fri, 15 Feb 2019 19:03:41 +0000 (14:03 -0500)]
drm/i915: Convert context_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert object_idr to IDA
Matthew Wilcox [Mon, 18 Feb 2019 16:04:18 +0000 (11:04 -0500)]
drm/i915: Convert object_idr to IDA

I suspect dmabuf_obj_list_head and object_ids should be combined into
a single xarray, but that's a job for later.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert get_page to XArray
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>
5 years agodrm/i915: Convert page_track_tree to XArray
Matthew Wilcox [Wed, 24 Oct 2018 17:51:16 +0000 (13:51 -0400)]
drm/i915: Convert page_track_tree to XArray

No locking changes.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert spt_tree to XArray
Matthew Wilcox [Tue, 23 Oct 2018 18:36:36 +0000 (14:36 -0400)]
drm/i915: Convert spt_tree to XArray

A straightforward conversion.  Notice the XArray does not suffer from
exposing the RCU problem to its users like the radix tree did.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/i915: Convert handles_vma to XArray
Matthew Wilcox [Wed, 26 Sep 2018 15:11:14 +0000 (11:11 -0400)]
drm/i915: Convert handles_vma to XArray

Straightforward conversion.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/etnaviv: Convert fence_idr to XArray
Matthew Wilcox [Tue, 8 Jan 2019 14:28:28 +0000 (09:28 -0500)]
drm/etnaviv: Convert fence_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/amdkfd: Convert alloc_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 13:25:32 +0000 (08:25 -0500)]
drm/amdkfd: Convert alloc_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/amdkfd: Convert event_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 13:14:28 +0000 (08:14 -0500)]
drm/amdkfd: Convert event_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/amdgpu: Convert pasid_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 12:37:03 +0000 (07:37 -0500)]
drm/amdgpu: Convert pasid_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/amdgpu: Convert ctx_handles to XArray
Matthew Wilcox [Sat, 16 Feb 2019 04:49:56 +0000 (23:49 -0500)]
drm/amdgpu: Convert ctx_handles to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm/amdgpu: Convert bo_list_handles to XArray
Matthew Wilcox [Thu, 14 Feb 2019 17:36:10 +0000 (12:36 -0500)]
drm/amdgpu: Convert bo_list_handles to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert object_idr to XArray
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>
5 years agodrm: Convert tile_idr to XArray
Matthew Wilcox [Mon, 18 Feb 2019 15:57:33 +0000 (10:57 -0500)]
drm: Convert tile_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert ctx_idr to XArray
Matthew Wilcox [Thu, 14 Feb 2019 12:58:31 +0000 (07:58 -0500)]
drm: Convert ctx_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Remove linked lists for lessees
Matthew Wilcox [Thu, 14 Feb 2019 03:44:38 +0000 (22:44 -0500)]
drm: Remove linked lists for lessees

These are already tracked in the XArray so we do not need to also keep
a doubly-linked list.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert lessee_idr to XArray
Matthew Wilcox [Wed, 13 Feb 2019 23:10:06 +0000 (18:10 -0500)]
drm: Convert lessee_idr to XArray

Part of the mass conversion of IDR users to the XArray API.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert magic_map to XArray
Matthew Wilcox [Wed, 13 Feb 2019 14:39:17 +0000 (09:39 -0500)]
drm: Convert magic_map to XArray

Part of the mass conversion of IDR users to the XArray API.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert syncobj_idr to XArray
Matthew Wilcox [Wed, 13 Feb 2019 14:02:47 +0000 (09:02 -0500)]
drm: Convert syncobj_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert object_idr to XArray
Matthew Wilcox [Wed, 13 Feb 2019 13:43:44 +0000 (08:43 -0500)]
drm: Convert object_idr to XArray

Part of the mass conversion of IDR users to the XArray API.
No locking changes.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert object_name_idr to XArray
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>
5 years agodrm: Convert aux_idr to XArray
Matthew Wilcox [Tue, 8 Jan 2019 14:15:14 +0000 (09:15 -0500)]
drm: Convert aux_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrm: Convert drm_minors_idr to XArray
Matthew Wilcox [Mon, 7 Jan 2019 22:33:48 +0000 (17:33 -0500)]
drm: Convert drm_minors_idr to XArray

Convert a few _irqsave to plain _irq where I can prove it's currently
called from process context with interrupts enabled.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoIB/core: Use xa_insert insted of xa_reserve
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.

5 years agoocrdma: Fix whitespace
Matthew Wilcox [Sat, 9 Feb 2019 04:01:26 +0000 (23:01 -0500)]
ocrdma: Fix whitespace

In the heat of the merge window, an inadvertent line got inserted.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agouverbs: Fix comments
Matthew Wilcox [Thu, 17 Jan 2019 16:36:28 +0000 (11:36 -0500)]
uverbs: Fix comments

A couple of comments missed conversion from IDR to XArray terminology.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoucma: Check the XArrays are empty at exit
Matthew Wilcox [Sat, 9 Feb 2019 04:40:34 +0000 (23:40 -0500)]
ucma: Check the XArrays are empty at exit

This is a debugging aid which was agreed to but missed during the merge.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agoinfiniband/core: Convert uverbs to XArray
Matthew Wilcox [Thu, 25 Oct 2018 21:18:29 +0000 (17:18 -0400)]
infiniband/core: Convert uverbs to XArray

Use a direct xa_load lookup instead of hyperoptimising the lookup.
No locking changes.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agof2fs: Convert extent_tree_root to XArray
Matthew Wilcox [Wed, 17 Oct 2018 19:34:43 +0000 (15:34 -0400)]
f2fs: Convert extent_tree_root to XArray

Rename it to extent_array and use the xa_lock in place of the
extent_tree_lock mutex.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agof2fs: Convert ino_root to XArray
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>
5 years agof2fs: Convert pids radix tree to XArray
Matthew Wilcox [Wed, 17 Oct 2018 19:32:57 +0000 (15:32 -0400)]
f2fs: Convert pids radix tree to XArray

The XArray API works out rather well for this user.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agobtrfs: Convert name_cache to XArray
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>
5 years agobtrfs: Convert delayed_nodes_tree to XArray
Matthew Wilcox [Wed, 17 Oct 2018 19:08:54 +0000 (15:08 -0400)]
btrfs: Convert delayed_nodes_tree to XArray

Rename it to just 'delayed_nodes' and remove it from the protection of
btrfs_root->inode_lock.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agobtrfs: Convert buffer_radix to XArray
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>
5 years agobtrfs: Convert reada_tree to XArray
Matthew Wilcox [Wed, 17 Oct 2018 19:07:26 +0000 (15:07 -0400)]
btrfs: Convert reada_tree to XArray

Rename reada_tree to reada_array.  Use the xa_lock in reada_array to
replace reada_lock.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agobtrfs: Convert reada_extents to XArray
Matthew Wilcox [Wed, 17 Oct 2018 19:02:30 +0000 (15:02 -0400)]
btrfs: Convert reada_extents to XArray

Straightforward conversion.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agobtrfs: Convert reada_zones to XArray
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>
5 years agobtrfs: Convert fs_roots_radix to XArray
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>
5 years agoxfs: Convert mru cache to XArray
Matthew Wilcox [Wed, 26 Sep 2018 12:14:59 +0000 (08:14 -0400)]
xfs: Convert mru cache to XArray

This eliminates a call to radix_tree_preload() and a personal spinlock.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoxfs: Convert xfs dquot to XArray
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>
5 years agoxfs: Convert pag_ici_root to XArray
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>
5 years agoxfs: Convert m_perag_tree to XArray
Matthew Wilcox [Tue, 25 Sep 2018 22:52:51 +0000 (18:52 -0400)]
xfs: Convert m_perag_tree to XArray

This is a relatively straightforward conversion to the XArray API.
I've renamed a few tags to marks in this patch; more will follow in
later patches.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrbd: Convert peer devices to XArray
Matthew Wilcox [Fri, 15 Feb 2019 22:06:29 +0000 (17:06 -0500)]
drbd: Convert peer devices to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agodrbd: Convert drbd devices to XArray
Matthew Wilcox [Fri, 15 Feb 2019 21:48:39 +0000 (16:48 -0500)]
drbd: Convert drbd devices to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agozram: Convert zram_index_idr to XArray
Matthew Wilcox [Fri, 15 Feb 2019 18:31:29 +0000 (13:31 -0500)]
zram: Convert zram_index_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agonbd: Convert nbd_index_idr to XArray
Matthew Wilcox [Fri, 15 Feb 2019 15:32:20 +0000 (10:32 -0500)]
nbd: Convert nbd_index_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoloop: Convert loop_index_idr to XArray
Matthew Wilcox [Tue, 5 Feb 2019 22:03:19 +0000 (17:03 -0500)]
loop: Convert loop_index_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agonull_blk: Convert to XArray
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>
5 years agobrd: Convert to XArray
Matthew Wilcox [Tue, 25 Sep 2018 22:08:25 +0000 (18:08 -0400)]
brd: Convert to XArray

Convert brd_pages from a radix tree to an XArray.  Simpler and smaller
code; in particular another user of radix_tree_preload is eliminated.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agobsg: Convert bsg_minor_idr to XArray
Matthew Wilcox [Fri, 15 Feb 2019 20:41:46 +0000 (15:41 -0500)]
bsg: Convert bsg_minor_idr to XArray

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agogenhd: Convert to XArray
Matthew Wilcox [Sat, 20 Oct 2018 03:20:05 +0000 (23:20 -0400)]
genhd: Convert to XArray

Replace the IDR with the XArray.  Includes converting the lookup from
being protected by a spinlock to being protected by RCU.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoblk-ioc: Remove ioc's icq_list
Matthew Wilcox [Mon, 18 Mar 2019 19:16:12 +0000 (15:16 -0400)]
blk-ioc: Remove ioc's icq_list

Use the XArray's iterator instead of this hlist.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoblk-ioc: Convert to XArray
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>
5 years agoblk-cgroup: Reduce scope of blkg_array lock
Matthew Wilcox [Mon, 18 Mar 2019 15:31:18 +0000 (11:31 -0400)]
blk-cgroup: Reduce scope of blkg_array lock

We can now take and release the blkg_array lock within blkg_destroy()
instead of forcing the caller to hold it across the call.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agoblk-cgroup: Remove blkg_list hlist
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>