Re: [PATCH 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-07 Thread Matthew Wilcox
On Wed, Apr 07, 2021 at 02:32:05PM +0800, Shiyang Ruan wrote: > +static int dax_fault_cow_page(struct vm_fault *vmf, struct iomap *iomap, > + loff_t pos, vm_fault_t *ret) > +{ > + int error = 0; > + unsigned long vaddr = vmf->address; > + sector_t sector = dax_iomap_sector(i

Re: [PATCH] btrfs: Use readahead_batch_length

2021-03-30 Thread Matthew Wilcox
ping? On Sun, Mar 21, 2021 at 09:03:11PM +, Matthew Wilcox (Oracle) wrote: > Implement readahead_batch_length() to determine the number of bytes in > the current batch of readahead pages and use it in btrfs. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/btrfs/

[PATCH] btrfs: Use readahead_batch_length

2021-03-21 Thread Matthew Wilcox (Oracle)
Implement readahead_batch_length() to determine the number of bytes in the current batch of readahead pages and use it in btrfs. Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/extent_io.c| 6 ++ include/linux/pagemap.h | 9 + 2 files changed, 11 insertions(+), 4 deletions

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 08:21:59AM -0600, Goldwyn Rodrigues wrote: > On 13:02 10/03, Matthew Wilcox wrote: > > On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > > > Forgive my ignorance, but is there a reason why this isn't wired up to > > > Btrfs at the

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 08:36:06AM -0500, Neal Gompa wrote: > On Wed, Mar 10, 2021 at 8:02 AM Matthew Wilcox wrote: > > > > On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > > > Forgive my ignorance, but is there a reason why this isn't wired up to >

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-03-10 Thread Matthew Wilcox
On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > Forgive my ignorance, but is there a reason why this isn't wired up to > Btrfs at the same time? It seems weird to me that adding a feature btrfs doesn't support DAX. only ext2, ext4, XFS and FUSE have DAX support. If you think about

Re: page->index limitation on 32bit system?

2021-02-21 Thread Matthew Wilcox
On Sat, Feb 20, 2021 at 04:01:17PM -0800, Erik Jensen wrote: > On Sat, Feb 20, 2021 at 3:23 PM Matthew Wilcox wrote: > > On Sat, Feb 20, 2021 at 03:02:26PM -0800, Erik Jensen wrote: > > > Out of curiosity, would it be at all feasible to use 64-bits for the page > > >

Re: page->index limitation on 32bit system?

2021-02-20 Thread Matthew Wilcox
On Sat, Feb 20, 2021 at 03:02:26PM -0800, Erik Jensen wrote: > On 2/18/21 5:39 AM, Matthew Wilcox wrote: > > On Thu, Feb 18, 2021 at 08:42:14PM +0800, Qu Wenruo wrote: > > > [...] > > > BTW, what would be the extra cost by converting page::index to u64? > > >

Re: page->index limitation on 32bit system?

2021-02-19 Thread Matthew Wilcox
On Fri, Feb 19, 2021 at 06:20:43PM -0800, Erik Jensen wrote: > I assume the 4KiB entry size in the page cache is fundamental, and can't be, > e.g., increased to 16KiB to allow addressing up to 64TiB of storage? The bootlin link i sent in the other email does exactly that.

Re: page->index limitation on 32bit system?

2021-02-19 Thread Matthew Wilcox
On Sat, Feb 20, 2021 at 07:10:14AM +0800, Qu Wenruo wrote: > > > On 2021/2/20 上午12:12, Theodore Ts'o wrote: > > On Fri, Feb 19, 2021 at 08:37:30AM +0800, Qu Wenruo wrote: > > > So it means the 32bit archs are already 2nd tier targets for at least > > > upstream linux kernel? > > > > At least as

Re: page->index limitation on 32bit system?

2021-02-19 Thread Matthew Wilcox
On Fri, Feb 19, 2021 at 02:22:01PM +, Matthew Wilcox wrote: > In the last decade, nobody's tried to fix it in mainline that I know of. > As I said, some vendors have tried to fix it in their NAS products, > but I don't know where to find that patch any more. Arnd foun

Re: page->index limitation on 32bit system?

2021-02-19 Thread Matthew Wilcox
On Thu, Feb 18, 2021 at 01:27:09PM -0800, Erik Jensen wrote: > On 2/18/21 4:15 AM, Matthew Wilcox wrote: > > > On Thu, Feb 18, 2021 at 04:54:46PM +0800, Qu Wenruo wrote: > > > Recently we got a strange bug report that, one 32bit systems like armv6 > > > or non-64bit

Re: page->index limitation on 32bit system?

2021-02-18 Thread Matthew Wilcox
On Thu, Feb 18, 2021 at 08:42:14PM +0800, Qu Wenruo wrote: > On 2021/2/18 下午8:15, Matthew Wilcox wrote: > > Yes, this is a known limitation. Some vendors have gone to the trouble > > of introducing a new page_index_t. I'm not convinced this is a problem > > worth solvi

Re: page->index limitation on 32bit system?

2021-02-18 Thread Matthew Wilcox
On Thu, Feb 18, 2021 at 04:54:46PM +0800, Qu Wenruo wrote: > Recently we got a strange bug report that, one 32bit systems like armv6 > or non-64bit x86, certain large btrfs can't be mounted. > > It turns out that, since page->index is just unsigned long, and on 32bit > systemts, that can just be 3

Re: [PATCH 04/17] block: split bio_kmalloc from bio_alloc_bioset

2021-01-30 Thread Matthew Wilcox
On Tue, Jan 26, 2021 at 03:52:34PM +0100, Christoph Hellwig wrote: > bio_kmalloc shares almost no logic with the bio_set based fast path > in bio_alloc_bioset. Split it into an entirely separate implementation. > > Signed-off-by: Christoph Hellwig > --- > block/bio.c | 167 +

Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64

2021-01-23 Thread Matthew Wilcox
On Sat, Jan 23, 2021 at 01:41:52PM +0200, Lennert Buytenhek wrote: > IORING_OP_GETDENTS64 behaves like getdents64(2) and takes the same Could we drop the '64'? We don't, for example, have IOURING_OP_FADVISE64 even though that's the name of the syscall.

Re: [RFC PATCH 2/3] fs: add RWF_ENCODED for writing compressed data

2019-09-24 Thread Matthew Wilcox
On Tue, Sep 24, 2019 at 10:22:29PM +0200, Christian Brauner wrote: > On Tue, Sep 24, 2019 at 10:01:41PM +0200, Jann Horn wrote: > > Mmh... but if the file descriptor has been passed through a privilege > > boundary, it isn't really clear whether the original opener of the > > file intended for this

Re: [PATCH 10/13] iomap: use a function pointer for dio submits

2019-08-09 Thread Matthew Wilcox
On Wed, Aug 07, 2019 at 10:49:36PM -0700, Eric Biggers wrote: > On Thu, Aug 08, 2019 at 12:26:42PM +0800, Gao Xiang wrote: > > 1. decrypt->verity->decompress > > > > 2. verity->decompress->decrypt > > > > 3. decompress->decrypt->verity > > > >1. and 2. could cause less computatio

Re: [PATCH 01/15] btrfs: create a mount option for dax

2019-03-27 Thread Matthew Wilcox
On Wed, Mar 27, 2019 at 06:00:52AM -0500, Goldwyn Rodrigues wrote: > On 12:10 26/03, Matthew Wilcox wrote: > > On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > > > This sets S_DAX in inode->i_flags, which can be used with > > > IS_DAX().

Re: [PATCH 01/15] btrfs: create a mount option for dax

2019-03-26 Thread Matthew Wilcox
On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > This sets S_DAX in inode->i_flags, which can be used with > IS_DAX(). > > The dax option is restricted to non multi-device mounts. > dax interacts with the device directly instead of using bio, so > all bio-hooks which we use for

Re: [LSF/MM TOPIC] More async operations for file systems - async discard?

2019-02-27 Thread Matthew Wilcox
On Fri, Feb 22, 2019 at 09:45:05AM -0700, Keith Busch wrote: > On Thu, Feb 21, 2019 at 09:51:12PM -0500, Martin K. Petersen wrote: > > > > Keith, > > > > > With respect to fs block sizes, one thing making discards suck is that > > > many high capacity SSDs' physical page sizes are larger than the

Re: [RFC PATCH 0/6] Allow setting file birth time with utimensat()

2019-02-18 Thread Matthew Wilcox
On Sun, Feb 17, 2019 at 12:40:09PM -0800, Andy Lutomirski wrote: > So I'm highly in favor of this patch. If XFS wants to disallow > writing the birth time, fine, but I think that behavior should be > overridable. Please, no. We need to have consistent behaviour between at least Linux local files

Re: [PATCH 07/25] vfs: combine the clone and dedupe into a single remap_file_range

2018-10-15 Thread Matthew Wilcox
On Sun, Oct 14, 2018 at 10:19:27AM -0700, Christoph Hellwig wrote: > > unsigned (*mmap_capabilities)(struct file *); > > #endif > > ssize_t (*copy_file_range)(struct file *, loff_t, struct file *, > > loff_t, size_t, unsigned int); > > - int (*clone_file_range)(struct file *, loff_t, st

Re: [PATCH 1/9] mm: infrastructure for page fault page caching

2018-09-27 Thread Matthew Wilcox
On Wed, Sep 26, 2018 at 05:08:48PM -0400, Josef Bacik wrote: > We want to be able to cache the result of a previous loop of a page > fault in the case that we use VM_FAULT_RETRY, so introduce > handle_mm_fault_cacheable that will take a struct vm_fault directly, add > a ->cached_page field to vm_fa

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-25 Thread Matthew Wilcox
On Thu, May 24, 2018 at 05:29:43PM +0200, Michal Hocko wrote: > > ie if we had more, > > could we solve our pain by making them more generic? > > Well, if you have more you will consume more bits in the struct pages, > right? Not necessarily ... the zone number is stored in the struct page curren

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-24 Thread Matthew Wilcox
On Thu, May 24, 2018 at 02:23:23PM +0200, Michal Hocko wrote: > > If we had eight ZONEs, we could offer: > > No, please no more zones. What we have is quite a maint. burden on its > own. Ideally we should only have lowmem, highmem and special/device > zones for directly kernel accessible memory, t

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-23 Thread Matthew Wilcox
On Tue, May 22, 2018 at 08:37:28PM +0200, Michal Hocko wrote: > So why is this any better than the current code. Sure I am not a great > fan of GFP_ZONE_TABLE because of how it is incomprehensible but this > doesn't look too much better, yet we are losing a check for incompatible > gfp flags. The d

Re: [RFC PATCH v2 10/12] mm/zsmalloc: update usage of address zone modifiers

2018-05-22 Thread Matthew Wilcox
On Mon, May 21, 2018 at 11:20:31PM +0800, Huaisheng Ye wrote: > @@ -343,7 +343,7 @@ static void destroy_cache(struct zs_pool *pool) > static unsigned long cache_alloc_handle(struct zs_pool *pool, gfp_t gfp) > { > return (unsigned long)kmem_cache_alloc(pool->handle_cachep, > -

Re: [PATCH] [RFC] bcachefs: SIX locks (shared/intent/exclusive)

2018-05-21 Thread Matthew Wilcox
On Mon, May 21, 2018 at 10:19:51PM -0400, Kent Overstreet wrote: > New lock for bcachefs, like read/write locks but with a third state, > intent. > > Intent locks conflict with each other, but not with read locks; taking a > write lock requires first holding an intent lock. Can you put something

Re: [PATCH 01/10] mm: pagecache add lock

2018-05-18 Thread Matthew Wilcox
t said, my patch is kind of ugly, and it requires filesystem changes > for other filesystems to take advantage of it. And unfortunately, since > one of the code paths that needs locking is readahead, I don't see any > realistic way of implementing the locking within just bcachefs code.

Re: vm_fault_t conversion, for real

2018-05-16 Thread Matthew Wilcox
On Wed, May 16, 2018 at 03:03:09PM +0200, Christoph Hellwig wrote: > On Wed, May 16, 2018 at 04:23:47AM -0700, Matthew Wilcox wrote: > > On Wed, May 16, 2018 at 07:43:34AM +0200, Christoph Hellwig wrote: > > > this series tries to actually turn vm_fault_t into a type that can be

Re: [PATCH 10/14] vgem: separate errno from VM_FAULT_* values

2018-05-16 Thread Matthew Wilcox
On Wed, May 16, 2018 at 03:01:59PM +0200, Christoph Hellwig wrote: > On Wed, May 16, 2018 at 11:53:03AM +0200, Daniel Vetter wrote: > > Reviewed-by: Daniel Vetter > > > > Want me to merge this through drm-misc or plan to pick it up yourself? > > For now I just want a honest discussion if people

Re: [PATCH 14/14] mm: turn on vm_fault_t type checking

2018-05-16 Thread Matthew Wilcox
On Wed, May 16, 2018 at 07:43:48AM +0200, Christoph Hellwig wrote: > Switch vm_fault_t to point to an unsigned int with __bіtwise annotations. > This both catches any old ->fault or ->page_mkwrite instance with plain > compiler type checking, as well as finding more intricate problems with > sparse

Re: vm_fault_t conversion, for real

2018-05-16 Thread Matthew Wilcox
On Wed, May 16, 2018 at 07:43:34AM +0200, Christoph Hellwig wrote: > this series tries to actually turn vm_fault_t into a type that can be > typechecked and checks the fallout instead of sprinkling random > annotations without context. Yes, why should we have small tasks that newcomers can do when

Re: [PATCH 01/14] orangefs: don't return errno values from ->fault

2018-05-16 Thread Matthew Wilcox
On Wed, May 16, 2018 at 07:43:35AM +0200, Christoph Hellwig wrote: > + rc = orangefs_inode_getattr(file->f_mapping->host, 0, 1, STATX_SIZE); > if (rc) { > gossip_err("%s: orangefs_inode_getattr failed, " > "rc:%d:.\n", __func__, rc); > - return

[PATCH v8 00/63] XArray v8

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This patchset is, I believe, appropriate for merging for 4.17. It contains the XArray implementation, to eventually replace the radix tree, and converts the page cache to use it. This conversion keeps the radix tree and XArray data structures in sync at all times. That

[PATCH v8 03/63] arm64: Turn flush_dcache_mmap_lock into a no-op

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox ARM64 doesn't walk the VMA tree in its flush_dcache_page() implementation, so has no need to take the tree_lock. Signed-off-by: Matthew Wilcox Reviewed-by: Will Deacon --- arch/arm64/include/asm/cacheflush.h | 6 ++ 1 file changed, 2 insertions(+), 4 dele

[PATCH v8 05/63] Export __set_page_dirty

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox XFS currently contains a copy-and-paste of __set_page_dirty(). Export it from buffer.c instead. Signed-off-by: Matthew Wilcox Acked-by: Jeff Layton --- fs/buffer.c| 3 ++- fs/xfs/xfs_aops.c | 15 ++- include/linux/mm.h | 1 + 3 files changed, 5

[PATCH v8 04/63] unicore32: Turn flush_dcache_mmap_lock into a no-op

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Unicore doesn't walk the VMA tree in its flush_dcache_page() implementation, so has no need to take the tree_lock. Signed-off-by: Matthew Wilcox --- arch/unicore32/include/asm/cacheflush.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a

[PATCH v8 08/63] fscache: Use appropriate radix tree accessors

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Don't open-code accesses to data structure internals. Signed-off-by: Matthew Wilcox Reviewed-by: Jeff Layton --- fs/fscache/cookie.c | 2 +- fs/fscache/object.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fscache/cookie.c b/fs/fs

[PATCH v8 06/63] btrfs: Use filemap_range_has_page()

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox The current implementation of btrfs_page_exists_in_range() gives the wrong answer if the workingset code has stored a shadow entry in the page cache. The filemap_range_has_page() function does not have this problem, and it's shared code, so use it instead. Signed-o

[PATCH v8 07/63] xfs: Rename xa_ elements to ail_

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is a simple rename, except that xa_ail becomes ail_head. Signed-off-by: Matthew Wilcox Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_buf_item.c| 10 ++-- fs/xfs/xfs_dquot.c | 4 +- fs/xfs/xfs_dquot_item.c | 11 ++-- fs/xfs/xfs_inode_item.c | 22

[PATCH v8 02/63] radix tree: Use GFP_ZONEMASK bits of gfp_t for flags

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox None of these bits may be used for slab allocations, so we can use them as radix tree flags as long as we mask them off before passing them to the slab allocator. Move the IDR flag from the high bits to the GFP_ZONEMASK bits. Signed-off-by: Matthew Wilcox Acked-by: Jeff

[PATCH v8 12/63] xarray: Change definition of sibling entries

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Instead of storing a pointer to the slot containing the canonical entry, store the offset of the slot. Produces slightly more efficient code (~300 bytes) and simplifies the implementation. Signed-off-by: Matthew Wilcox --- include/linux/xarray.h | 93

[PATCH v8 09/63] xarray: Add the xa_lock to the radix_tree_root

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This results in no change in structure size on 64-bit machines as it fits in the padding between the gfp_t and the void *. 32-bit machines will grow the structure from 8 to 12 bytes. Almost all radix trees are protected with (at least) a spinlock, so as they are converted

[PATCH v8 11/63] xarray: Replace exceptional entries

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Introduce xarray value entries to replace the radix tree exceptional entry code. This is a slight change in encoding to allow the use of an extra bit (we can now store BITS_PER_LONG - 1 bits in a value entry). It is also a change in emphasis; exceptional entries are

[PATCH v8 10/63] page cache: Use xa_lock

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Remove the address_space ->tree_lock and use the xa_lock newly added to the radix_tree_root. Rename the address_space ->page_tree to ->i_pages, since we don't really care that it's a tree. Signed-off-by: Matthew Wilcox Acked-by: Jeff Layton --- Docu

[PATCH v8 17/63] xarray: Add xa_get_tag, xa_set_tag and xa_clear_tag

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox XArray tags are slightly more strongly typed than the radix tree tags, but occupy the same bits. This commit also adds the xas_ family of tag operations, for cases where the caller is already holding the lock, and xa_tagged() to ask whether any array member has a particular

[PATCH v8 16/63] xarray: Add xa_load

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This first function in the XArray API brings with it a lot of support infrastructure. The advanced API is based around the xa_state which is a more capable version of the radix_tree_iter. As the test-suite demonstrates, it is possible to use the xarray and radix tree APIs

[PATCH v8 15/63] xarray: Add documentation

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is documentation on how to use the XArray, not details about its internal implementation. Signed-off-by: Matthew Wilcox --- Documentation/core-api/index.rst | 1 + Documentation/core-api/xarray.rst | 361 ++ 2 files changed, 362

[PATCH v8 19/63] xarray: Add xa_cmpxchg and xa_insert

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Like cmpxchg(), xa_cmpxchg will only store to the index if the current entry matches the old entry. It returns the current entry, which is usually more useful than the errno returned by radix_tree_insert(). For the users who really only want the errno, the xa_insert

[PATCH v8 18/63] xarray: Add xa_store

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox xa_store() differs from radix_tree_insert() in that it will overwrite an existing element in the array rather than returning an error. This is the behaviour which most users want, and those that want more complex behaviour generally want to use the xas family of routines

[PATCH v8 23/63] xarray: Add xas_next and xas_prev

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox These two functions move the xas index by one position, and adjust the rest of the iterator state to match it. This is more efficient than calling xas_set() as it keeps the iterator at the leaves of the tree instead of walking the iterator from the root each time. Signed

[PATCH v8 24/63] xarray: Add xas_create_range

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This hopefully temporary function is useful for users who have not yet been converted to multi-index entries. Signed-off-by: Matthew Wilcox --- include/linux/xarray.h | 2 ++ lib/xarray.c | 22 ++ 2 files changed, 24 insertions(+) diff

[PATCH v8 21/63] xarray: Add xa_extract

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This function combines the functionality of radix_tree_gang_lookup() and radix_tree_gang_lookup_tagged(). It extracts entries matching the specified filter into a normal array. Signed-off-by: Matthew Wilcox --- include/linux/xarray.h | 2 ++ lib/xarray.c | 80

[PATCH v8 20/63] xarray: Add xa_for_each

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This iterator allows the user to efficiently walk a range of the array, executing the loop body once for each entry in that range that matches the filter. This commit also includes xa_find() and xa_find_above() which are helper functions for xa_for_each() but may also be

[PATCH v8 22/63] xarray: Add xa_destroy

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This function frees all the internal memory allocated to the xarray and reinitialises it to be empty. Signed-off-by: Matthew Wilcox --- include/linux/xarray.h | 1 + lib/xarray.c | 28 2 files changed, 29 insertions(+) diff --git a

[PATCH v8 29/63] page cache: Convert page deletion to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox The code is slightly shorter and simpler. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 30 ++ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 0e19ea454cba..bdda1beda932 100644 --- a/mm

[PATCH v8 26/63] page cache: Rearrange address_space

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Change i_pages from a radix_tree_root to an xarray, convert the documentation into kernel-doc format and change the order of the elements to pack them better on 64-bit systems. Signed-off-by: Matthew Wilcox --- include/linux/fs.h | 46

[PATCH v8 25/63] xarray: Add MAINTAINERS entry

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Add myself as XArray and IDR maintainer. Signed-off-by: Matthew Wilcox --- MAINTAINERS | 12 1 file changed, 12 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6d78237066ab..08613d97a74d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15293,6

[PATCH v8 27/63] page cache: Convert hole search to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox The page cache offers the ability to search for a miss in the previous or next N locations. Rather than teach the XArray about the page cache's definition of a miss, use xas_prev() and xas_next() to search the page array. This should be more efficient as it does not

[PATCH v8 30/63] page cache: Convert page cache lookups to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Introduce page_cache_pin() to factor out the common logic between the various lookup routines: find_get_entry find_get_entries find_get_pages_range find_get_pages_contig find_get_pages_range_tag find_get_entries_tag filemap_map_pages By using the xa_state to control the

[PATCH v8 28/63] page cache: Add and replace pages using the XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Use the XArray APIs to add and replace pages in the page cache. This removes two uses of the radix tree preload API and is significantly shorter code. Signed-off-by: Matthew Wilcox --- include/linux/swap.h | 8 ++- mm/filemap.c | 143

[PATCH v8 32/63] page cache: Remove stray radix comment

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 0635e9cdbc06..86c83014c909 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2579,7 +2579,7 @@ static struct page

[PATCH v8 31/63] page cache: Convert delete_batch to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Rename the function from page_cache_tree_delete_batch to just page_cache_delete_batch. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index

[PATCH v8 33/63] page cache: Convert filemap_range_has_page to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Instead of calling find_get_pages_range() and putting any reference, use xas_find() to iterate over any entries in the range, skipping the shadow/swap entries. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 26 ++ 1 file changed, 18 insertions

[PATCH v8 38/63] mm: Convert delete_from_swap_cache to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Both callers of __delete_from_swap_cache have the swp_entry_t already, so pass that in to make constructing the XA_STATE easier. Signed-off-by: Matthew Wilcox --- include/linux/swap.h | 5 +++-- mm/swap_state.c | 24 ++-- mm/vmscan.c

[PATCH v8 37/63] mm: Convert add_to_swap_cache to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Combine __add_to_swap_cache and add_to_swap_cache into one function since there is no more need to preload. Signed-off-by: Matthew Wilcox --- mm/swap_state.c | 93 ++--- 1 file changed, 29 insertions(+), 64 deletions

[PATCH v8 34/63] mm: Convert page-writeback to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Includes moving mapping_tagged() to fs.h as a static inline, and changing it to return bool. Signed-off-by: Matthew Wilcox --- include/linux/fs.h | 17 +-- mm/page-writeback.c | 63 +++-- 2 files changed, 32

[PATCH v8 36/63] mm: Convert truncate to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is essentially xa_cmpxchg() with the locking handled above us, and it doesn't have to handle replacing a NULL entry. Signed-off-by: Matthew Wilcox --- mm/truncate.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mm/truncate.c

[PATCH v8 35/63] mm: Convert workingset to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox We construct a fake XA_STATE and use it to delete the node with xa_store() rather than adding a special function for this unique use case. Signed-off-by: Matthew Wilcox --- include/linux/swap.h | 9 - mm/workingset.c | 51

[PATCH v8 40/63] mm: Convert page migration to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- mm/migrate.c | 41 - 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 740b71857898..9a15d27768a0 100644 --- a/mm/migrate.c +++ b/mm/migrate.c

[PATCH v8 13/63] xarray: Add definition of struct xarray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is a direct replacement for struct radix_tree_root. Some of the struct members have changed name; convert those, and use a #define so that radix_tree users continue to work without change. Signed-off-by: Matthew Wilcox --- include/linux/radix-tree.h

[PATCH v8 39/63] mm: Convert __do_page_cache_readahead to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This one is trivial. Signed-off-by: Matthew Wilcox --- mm/readahead.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index 3ff9763b0461..5f528d649d5e 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -174,9 +174,7

[PATCH v8 41/63] mm: Convert huge_memory to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Quite a straightforward conversion. Signed-off-by: Matthew Wilcox --- mm/huge_memory.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 89737c0e0d34..354b7f768d0f 100644 --- a/mm/huge_memory.c

[PATCH v8 42/63] mm: Convert collapse_shmem to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox I found another victim of the radix tree being hard to use. Because there was no call to radix_tree_preload(), khugepaged was allocating radix_tree_nodes using GFP_ATOMIC. I also converted a local_irq_save()/restore() pair to disable()/enable(). Signed-off-by: Matthew

[PATCH v8 43/63] mm: Convert khugepaged_scan_shmem to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Slightly shorter and easier to read code. Signed-off-by: Matthew Wilcox --- mm/khugepaged.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 3685c8e2b3dc..39e260a0639c 100644 --- a/mm

[PATCH v8 44/63] pagevec: Use xa_tag_t

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Removes sparse warnings. Signed-off-by: Matthew Wilcox --- fs/btrfs/extent_io.c| 4 ++-- fs/ext4/inode.c | 2 +- fs/f2fs/data.c | 2 +- fs/gfs2/aops.c | 2 +- include/linux/pagevec.h | 8 +--- mm/swap.c | 4 ++-- 6 files

[PATCH v8 47/63] shmem: Convert find_swap_entry to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is a 1:1 conversion. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 0af8a439dfad..49f42dc9e1dc 100644 --- a/mm/shmem.c +++ b/mm/shmem.c

[PATCH v8 53/63] memfd: Convert shmem_wait_for_pins to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox As with shmem_tag_pins(), hold the lock around the entire loop instead of acquiring & dropping it for each entry we're going to untag. Signed-off-by: Matthew Wilcox --- mm/memfd.c | 61 + 1 file ch

[PATCH v8 52/63] memfd: Convert shmem_tag_pins to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Simplify the locking by taking the spinlock while we walk the tree on the assumption that many acquires and releases of the lock will be worse than holding the lock for a (potentially) long time. We could replicate the same locking behaviour with the xarray, but would have

[PATCH v8 50/63] shmem: Convert shmem_free_swap to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is a perfect use for xa_cmpxchg(). Note the use of 0 for GFP flags; we won't be allocating memory. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index a0a354a

[PATCH v8 49/63] shmem: Convert shmem_alloc_hugepage to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox xa_find() is a slightly easier API to use than radix_tree_gang_lookup_slot() because it contains its own RCU locking. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c

[PATCH v8 51/63] shmem: Convert shmem_partial_swap_usage to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Simpler code because the xarray takes care of things like the limit and dereferencing the slot. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index cfbffb4b47a2

[PATCH v8 54/63] shmem: Comment fixups

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Remove the last mentions of radix tree from various comments. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 707430003ec7..6b044cb6c8b5 100644 --- a/mm/shmem.c

[PATCH v8 59/63] f2fs: Convert to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is a straightforward conversion. Signed-off-by: Matthew Wilcox --- fs/f2fs/data.c | 3 +-- fs/f2fs/dir.c| 5 + fs/f2fs/inline.c | 6 +- fs/f2fs/node.c | 10 ++ 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/fs/f2fs/data.c b

[PATCH v8 58/63] nilfs2: Convert to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox I'm not 100% convinced that the rewrite of nilfs_copy_back_pages is correct, but it will at least have different bugs from the current version. Signed-off-by: Matthew Wilcox --- fs/nilfs2/btnode.c | 37 +++- fs/nilfs2/page.c

[PATCH v8 55/63] btrfs: Convert page cache to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- fs/btrfs/compression.c | 4 +--- fs/btrfs/extent_io.c | 8 +++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index ad330af89eef..c2286f436571 100644 --- a/fs/btrfs

[PATCH v8 57/63] fs: Convert writeback to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox A couple of short loops. Signed-off-by: Matthew Wilcox --- fs/fs-writeback.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 091577edc497..98e5e08274a2 100644 --- a/fs/fs

[PATCH v8 56/63] fs: Convert buffer to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Mostly comment fixes, but one use of __xa_set_tag. Signed-off-by: Matthew Wilcox --- fs/buffer.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 3ee82c056d85..70af8fbc64cf 100644 --- a/fs/buffer.c +++ b/fs

[PATCH v8 61/63] dax: Convert to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox The DAX code (by its nature) is deeply interwoven with the radix tree infrastructure, doing operations directly on the radix tree slots. Convert the whole file to use XArray concepts; mostly passing around xa_state instead of address_space, index or slot. Signed-off-by

[PATCH v8 60/63] lustre: Convert to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- drivers/staging/lustre/lustre/llite/glimpse.c | 12 +--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 16 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite

[PATCH v8 63/63] radix tree: Remove unused functions

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox The following functions are (now) unused: - __radix_tree_delete_node - radix_tree_gang_lookup_slot - radix_tree_join - radix_tree_maybe_preload_order - radix_tree_split - radix_tree_split_preload Signed-off-by: Matthew Wilcox --- include/linux/radix-tree.h | 16

[PATCH v8 62/63] page cache: Finish XArray conversion

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox With no more radix tree API users left, we can drop the GFP flags and use xa_init() instead of INIT_RADIX_TREE(). Signed-off-by: Matthew Wilcox --- fs/inode.c | 2 +- mm/swap_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/inode.c b

[PATCH v8 46/63] shmem: Convert shmem_confirm_swap to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox xa_load has its own RCU locking, so we can eliminate it here. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 5813808965cd..0af8a439dfad 100644 --- a/mm/shmem.c +++ b/mm

[PATCH v8 48/63] shmem: Convert shmem_add_to_page_cache to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This removes the last caller of radix_tree_maybe_preload_order(). Simpler code, unless we run out of memory for new xa_nodes partway through inserting entries into the xarray. Hopefully we can support multi-index entries in the page cache soon and all the awful code goes

[PATCH v8 14/63] xarray: Define struct xa_node

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is a direct replacement for struct radix_tree_node. A couple of struct members have changed name, so convert those. Use a #define so that radix tree users continue to work without change. Signed-off-by: Matthew Wilcox --- include/linux/radix-tree.h| 29

[PATCH v8 45/63] shmem: Convert replace to XArray

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox shmem_radix_tree_replace() is renamed to shmem_xa_replace() and converted to use the XArray API. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index

[PATCH v8 01/63] mac80211_hwsim: Use DEFINE_IDA

2018-03-06 Thread Matthew Wilcox
From: Matthew Wilcox This is preferred to opencoding an IDA_INIT. Signed-off-by: Matthew Wilcox --- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread Matthew Wilcox
On Thu, Jan 18, 2018 at 05:56:12PM +0100, David Sterba wrote: > On Thu, Jan 18, 2018 at 08:48:43AM -0800, Matthew Wilcox wrote: > > Thank you! I shall attempt to debug. Was this with a btrfs root > > filesystem? I'm most suspicious of those patches right now, since they

  1   2   3   4   5   >