Subject: linux-next: manual merge of the xarray tree with the ext4 tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 2 Aug 2018 17:48:55 +1000

Hi all,

Today's linux-next merge of the xarray tree got a conflict in:

  fs/dax.c

between commit:

  cdbf8897cb09 ("dax: dax_layout_busy_page() warn on !exceptional")

from the ext4 tree and commits:

  49520d317715 ("xarray: Replace exceptional entries")
  cc9f1fb1672f ("dax: Convert dax_layout_busy_page to XArray")

from the xarray tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/dax.c
index f32d7125ad0f,1914e4e24615..000000000000
--- a/fs/dax.c
+++ b/fs/dax.c
@@@ -662,44 -556,26 +556,26 @@@ struct page *dax_layout_busy_page(struc
  	 */
  	unmap_mapping_range(mapping, 0, 0, 1);
  
- 	while (index < end && pagevec_lookup_entries(&pvec, mapping, index,
- 				min(end - index, (pgoff_t)PAGEVEC_SIZE),
- 				indices)) {
- 		for (i = 0; i < pagevec_count(&pvec); i++) {
- 			struct page *pvec_ent = pvec.pages[i];
- 			void *entry;
- 
- 			index = indices[i];
- 			if (index >= end)
- 				break;
- 
- 			if (WARN_ON_ONCE(
- 			     !radix_tree_exceptional_entry(pvec_ent)))
- 				continue;
- 
- 			xa_lock_irq(&mapping->i_pages);
- 			entry = get_unlocked_mapping_entry(mapping, index, NULL);
- 			if (entry)
- 				page = dax_busy_page(entry);
- 			put_unlocked_mapping_entry(mapping, index, entry);
- 			xa_unlock_irq(&mapping->i_pages);
- 			if (page)
- 				break;
- 		}
- 
- 		/*
- 		 * We don't expect normal struct page entries to exist in our
- 		 * tree, but we keep these pagevec calls so that this code is
- 		 * consistent with the common pattern for handling pagevecs
- 		 * throughout the kernel.
- 		 */
- 		pagevec_remove_exceptionals(&pvec);
- 		pagevec_release(&pvec);
- 		index++;
- 
+ 	xas_lock_irq(&xas);
+ 	xas_for_each(&xas, entry, ULONG_MAX) {
 -		if (!xa_is_value(entry))
++		if (WARN_ON_ONCE(!xa_is_value(entry)))
+ 			continue;
+ 		if (unlikely(dax_is_locked(entry)))
+ 			entry = get_unlocked_entry(&xas);
+ 		if (entry)
+ 			page = dax_busy_page(entry);
+ 		put_unlocked_entry(&xas, entry);
  		if (page)
  			break;
+ 		if (++scanned % XA_CHECK_SCHED)
+ 			continue;
+ 
+ 		xas_pause(&xas);
+ 		xas_unlock_irq(&xas);
+ 		cond_resched();
+ 		xas_lock_irq(&xas);
  	}
+ 	xas_unlock_irq(&xas);
  	return page;
  }
  EXPORT_SYMBOL_GPL(dax_layout_busy_page);