public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Matthew Wilcox <willy@infradead•org>, Jan Kara <jack@suse•cz>
Cc: Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>
Subject: linux-next: manual merge of the folio tree with the ext3 tree
Date: Wed, 21 Jul 2021 15:02:05 +1000	[thread overview]
Message-ID: <20210721150205.2a7f4fb7@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 4860 bytes --]

Hi all,

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

  mm/filemap.c

between commit:

  730633f0b7f9 ("mm: Protect operations adding pages to page cache with invalidate_lock")

from the ext3 tree and commit:

  e3700f8b6abe ("mm/filemap: Add __folio_lock_async()")

from the folio tree.

I fixed it up (I think - 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 mm/filemap.c
index 0fad08331cf4,104b27c372bf..000000000000
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@@ -999,54 -997,16 +999,54 @@@ struct folio *filemap_alloc_folio(gfp_
  		do {
  			cpuset_mems_cookie = read_mems_allowed_begin();
  			n = cpuset_mem_spread_node();
- 			page = __alloc_pages_node(n, gfp, 0);
- 		} while (!page && read_mems_allowed_retry(cpuset_mems_cookie));
+ 			folio = __folio_alloc_node(gfp, order, n);
+ 		} while (!folio && read_mems_allowed_retry(cpuset_mems_cookie));
  
- 		return page;
+ 		return folio;
  	}
- 	return alloc_pages(gfp, 0);
+ 	return folio_alloc(gfp, order);
  }
- EXPORT_SYMBOL(__page_cache_alloc);
+ EXPORT_SYMBOL(filemap_alloc_folio);
  #endif
  
 +/*
 + * filemap_invalidate_lock_two - lock invalidate_lock for two mappings
 + *
 + * Lock exclusively invalidate_lock of any passed mapping that is not NULL.
 + *
 + * @mapping1: the first mapping to lock
 + * @mapping2: the second mapping to lock
 + */
 +void filemap_invalidate_lock_two(struct address_space *mapping1,
 +				 struct address_space *mapping2)
 +{
 +	if (mapping1 > mapping2)
 +		swap(mapping1, mapping2);
 +	if (mapping1)
 +		down_write(&mapping1->invalidate_lock);
 +	if (mapping2 && mapping1 != mapping2)
 +		down_write_nested(&mapping2->invalidate_lock, 1);
 +}
 +EXPORT_SYMBOL(filemap_invalidate_lock_two);
 +
 +/*
 + * filemap_invalidate_unlock_two - unlock invalidate_lock for two mappings
 + *
 + * Unlock exclusive invalidate_lock of any passed mapping that is not NULL.
 + *
 + * @mapping1: the first mapping to unlock
 + * @mapping2: the second mapping to unlock
 + */
 +void filemap_invalidate_unlock_two(struct address_space *mapping1,
 +				   struct address_space *mapping2)
 +{
 +	if (mapping1)
 +		up_write(&mapping1->invalidate_lock);
 +	if (mapping2 && mapping1 != mapping2)
 +		up_write(&mapping2->invalidate_lock);
 +}
 +EXPORT_SYMBOL(filemap_invalidate_unlock_two);
 +
  /*
   * In order to wait for pages to become available there must be
   * waitqueues associated with pages. By using a hash table of
@@@ -2406,49 -2362,42 +2402,50 @@@ static int filemap_update_page(struct k
  		struct address_space *mapping, struct iov_iter *iter,
  		struct page *page)
  {
+ 	struct folio *folio = page_folio(page);
  	int error;
  
 +	if (iocb->ki_flags & IOCB_NOWAIT) {
 +		if (!filemap_invalidate_trylock_shared(mapping))
 +			return -EAGAIN;
 +	} else {
 +		filemap_invalidate_lock_shared(mapping);
 +	}
 +
- 	if (!trylock_page(page)) {
+ 	if (!folio_trylock(folio)) {
 +		error = -EAGAIN;
  		if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_NOIO))
 -			return -EAGAIN;
 +			goto unlock_mapping;
  		if (!(iocb->ki_flags & IOCB_WAITQ)) {
 +			filemap_invalidate_unlock_shared(mapping);
- 			put_and_wait_on_page_locked(page, TASK_KILLABLE);
+ 			put_and_wait_on_page_locked(&folio->page, TASK_KILLABLE);
  			return AOP_TRUNCATED_PAGE;
  		}
- 		error = __lock_page_async(page, iocb->ki_waitq);
+ 		error = __folio_lock_async(folio, iocb->ki_waitq);
  		if (error)
 -			return error;
 +			goto unlock_mapping;
  	}
  
 +	error = AOP_TRUNCATED_PAGE;
- 	if (!page->mapping)
+ 	if (!folio->mapping)
 -		goto truncated;
 +		goto unlock;
  
  	error = 0;
- 	if (filemap_range_uptodate(mapping, iocb->ki_pos, iter, page))
+ 	if (filemap_range_uptodate(mapping, iocb->ki_pos, iter, &folio->page))
  		goto unlock;
  
  	error = -EAGAIN;
  	if (iocb->ki_flags & (IOCB_NOIO | IOCB_NOWAIT | IOCB_WAITQ))
  		goto unlock;
  
- 	error = filemap_read_page(iocb->ki_filp, mapping, page);
+ 	error = filemap_read_page(iocb->ki_filp, mapping, &folio->page);
 -	if (error == AOP_TRUNCATED_PAGE)
 -		folio_put(folio);
 -	return error;
 -truncated:
 -	folio_unlock(folio);
 -	folio_put(folio);
 -	return AOP_TRUNCATED_PAGE;
 +	goto unlock_mapping;
  unlock:
- 	unlock_page(page);
+ 	folio_unlock(folio);
 +unlock_mapping:
 +	filemap_invalidate_unlock_shared(mapping);
 +	if (error == AOP_TRUNCATED_PAGE)
- 		put_page(page);
++		folio_put(folio);
  	return error;
  }
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2021-07-21  5:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  5:02 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-07-21  4:42 linux-next: manual merge of the folio tree with the ext3 tree Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210721150205.2a7f4fb7@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=jack@suse$(echo .)cz \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=willy@infradead$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox