vfs: Use an xarray in the mount namespace to handle /proc/mounts list
Add an xarray to the mount namespace and use this to perform a mnt_id to
mount object mapping for the namespace. Make use of xa_reserve() to
perform preallocation before taking the mount_lock.
This will allow the set of mount objects in a namespace to be iterated
using xarray iteration and without the need to insert and remove fake
mounts as bookmarks - which cause issues for other trawlers of the list.
As a bonus, if we want to allow it, lseek() can be used to start at a
particular mount - though there's no easy way to limit the return to just a
single entry or enforce a failure if that mount doesn't exist, but a later
one does.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Alexander Viro <viro@zeniv.linux.org.uk>
cc: Miklos Szeredi <miklos@szeredi.hu>
cc: Matthew Wilcox <willy@infradead.org>
2 files changed